修改禅道bug
This commit is contained in:
@ -6,7 +6,7 @@ VITE_APP_ENV = 'development'
|
||||
|
||||
# 开发环境
|
||||
# 李陈杰 209
|
||||
VITE_APP_BASE_API = 'http://192.168.110.149:8899'
|
||||
VITE_APP_BASE_API = 'http://192.168.110.210:8899'
|
||||
# 曾涛
|
||||
# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
|
||||
# 罗成
|
||||
|
@ -285,8 +285,8 @@
|
||||
:data="form"
|
||||
uploadUrl="/supplierInput/supplierInput"
|
||||
:limit="1"
|
||||
:onUploadSuccess="handleUploadSuccess"
|
||||
@handleChange="change"
|
||||
@handleChange="handleFileChange"
|
||||
@handleRemove="handleFileRemove"
|
||||
showFileList
|
||||
>
|
||||
<div><el-button type="primary">上传文件</el-button><br /></div>
|
||||
@ -309,7 +309,7 @@
|
||||
<script setup name="SupplierInput" lang="ts">
|
||||
import { ComponentInternalInstance, getCurrentInstance, onMounted, ref, reactive, toRefs, computed } from 'vue';
|
||||
import { ElFormInstance } from 'element-plus';
|
||||
import { listSupplierInput, getSupplierInput, delSupplierInput } from '@/api/supplierInput/supplierInput/index';
|
||||
import { listSupplierInput, getSupplierInput, delSupplierInput, updateSupplierInput } from '@/api/supplierInput/supplierInput/index';
|
||||
import { SupplierInputVO, SupplierInputQuery, SupplierInputForm, PageData, DialogOption } from '@/api/supplierInput/supplierInput/types';
|
||||
import Pagination from '@/components/Pagination/index.vue';
|
||||
import RightToolbar from '@/components/RightToolbar/index.vue';
|
||||
@ -576,6 +576,7 @@ const handleAdd = () => {
|
||||
dialog.title = '添加供应商入库';
|
||||
};
|
||||
|
||||
const editFileId = ref('');
|
||||
const handleUpdate = async (row?: SupplierInputVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
@ -583,7 +584,8 @@ const handleUpdate = async (row?: SupplierInputVO) => {
|
||||
|
||||
try {
|
||||
const res = await getSupplierInput(_id);
|
||||
const resData = res.data || {};
|
||||
const resData: any = res.data || {};
|
||||
editFileId.value = resData.fileId;
|
||||
// 1. 基础字段回显
|
||||
form.value = { ...form.value, ...resData, inputFile: '' };
|
||||
// 2. 核心修复:拆分后端拼接字符串到表单单独字段
|
||||
@ -598,6 +600,25 @@ const handleUpdate = async (row?: SupplierInputVO) => {
|
||||
}
|
||||
};
|
||||
|
||||
const fileStatus = ref(false);
|
||||
const updateFileStatus = ref(true);
|
||||
const isUpdateFile = ref(false); //记录是否在修改页面时是否有新上传的文件
|
||||
const handleFileChange = (file, fileList) => {
|
||||
if (form.value.id) {
|
||||
updateFileStatus.value = true;
|
||||
isUpdateFile.value = true; //记录是否在修改页面时是否有新上传的文件
|
||||
}
|
||||
fileStatus.value = true;
|
||||
};
|
||||
|
||||
const handleFileRemove = (file, fileList) => {
|
||||
if (form.value.id) {
|
||||
updateFileStatus.value = false;
|
||||
isUpdateFile.value = false; //记录是否在修改页面时是否有新上传的文件
|
||||
}
|
||||
|
||||
fileStatus.value = false;
|
||||
};
|
||||
/** 提交表单 */
|
||||
const submitForm = () => {
|
||||
supplierInputFormRef.value?.validate(async (valid: boolean) => {
|
||||
@ -619,15 +640,21 @@ const submitForm = () => {
|
||||
buttonLoading.value = true;
|
||||
try {
|
||||
if (fileUploadRef.value) {
|
||||
await fileUploadRef.value.submitUpload().then((res) => {
|
||||
if (res == 'noFile') {
|
||||
proxy?.$modal.msgError('请上传文件');
|
||||
return;
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
getList();
|
||||
});
|
||||
if (form.value.fileId === editFileId.value && !isUpdateFile.value) {
|
||||
console.log(1111111111);
|
||||
|
||||
editFormData();
|
||||
} else {
|
||||
fileUploadRef.value.submitUpload().then((res) => {
|
||||
if (res == 'noFile') {
|
||||
proxy?.$modal.msgError('请上传文件');
|
||||
return;
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
proxy?.$modal.msgError('提交失败,请重试');
|
||||
@ -636,7 +663,14 @@ const submitForm = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const editFormData = async () => {
|
||||
const res = await updateSupplierInput(form.value);
|
||||
if ((res.code = 200)) {
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
/** 删除操作 */
|
||||
const handleDelete = async (row?: SupplierInputVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
|
Reference in New Issue
Block a user