修改禅道bug

This commit is contained in:
ljx
2025-09-03 15:10:20 +08:00
parent 288ee14d5e
commit eb98e8c8c3
2 changed files with 49 additions and 15 deletions

View File

@ -6,7 +6,7 @@ VITE_APP_ENV = 'development'
# 开发环境 # 开发环境
# 李陈杰 209 # 李陈杰 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' # VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 罗成 # 罗成

View File

@ -285,8 +285,8 @@
:data="form" :data="form"
uploadUrl="/supplierInput/supplierInput" uploadUrl="/supplierInput/supplierInput"
:limit="1" :limit="1"
:onUploadSuccess="handleUploadSuccess" @handleChange="handleFileChange"
@handleChange="change" @handleRemove="handleFileRemove"
showFileList showFileList
> >
<div><el-button type="primary">上传文件</el-button><br /></div> <div><el-button type="primary">上传文件</el-button><br /></div>
@ -309,7 +309,7 @@
<script setup name="SupplierInput" lang="ts"> <script setup name="SupplierInput" lang="ts">
import { ComponentInternalInstance, getCurrentInstance, onMounted, ref, reactive, toRefs, computed } from 'vue'; import { ComponentInternalInstance, getCurrentInstance, onMounted, ref, reactive, toRefs, computed } from 'vue';
import { ElFormInstance } from 'element-plus'; 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 { SupplierInputVO, SupplierInputQuery, SupplierInputForm, PageData, DialogOption } from '@/api/supplierInput/supplierInput/types';
import Pagination from '@/components/Pagination/index.vue'; import Pagination from '@/components/Pagination/index.vue';
import RightToolbar from '@/components/RightToolbar/index.vue'; import RightToolbar from '@/components/RightToolbar/index.vue';
@ -576,6 +576,7 @@ const handleAdd = () => {
dialog.title = '添加供应商入库'; dialog.title = '添加供应商入库';
}; };
const editFileId = ref('');
const handleUpdate = async (row?: SupplierInputVO) => { const handleUpdate = async (row?: SupplierInputVO) => {
reset(); reset();
const _id = row?.id || ids.value[0]; const _id = row?.id || ids.value[0];
@ -583,7 +584,8 @@ const handleUpdate = async (row?: SupplierInputVO) => {
try { try {
const res = await getSupplierInput(_id); const res = await getSupplierInput(_id);
const resData = res.data || {}; const resData: any = res.data || {};
editFileId.value = resData.fileId;
// 1. 基础字段回显 // 1. 基础字段回显
form.value = { ...form.value, ...resData, inputFile: '' }; form.value = { ...form.value, ...resData, inputFile: '' };
// 2. 核心修复:拆分后端拼接字符串到表单单独字段 // 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 = () => { const submitForm = () => {
supplierInputFormRef.value?.validate(async (valid: boolean) => { supplierInputFormRef.value?.validate(async (valid: boolean) => {
@ -619,15 +640,21 @@ const submitForm = () => {
buttonLoading.value = true; buttonLoading.value = true;
try { try {
if (fileUploadRef.value) { if (fileUploadRef.value) {
await fileUploadRef.value.submitUpload().then((res) => { if (form.value.fileId === editFileId.value && !isUpdateFile.value) {
if (res == 'noFile') { console.log(1111111111);
proxy?.$modal.msgError('请上传文件');
return; editFormData();
} } else {
proxy?.$modal.msgSuccess('操作成功'); fileUploadRef.value.submitUpload().then((res) => {
dialog.visible = false; if (res == 'noFile') {
getList(); proxy?.$modal.msgError('请上传文件');
}); return;
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
getList();
});
}
} }
} catch (error) { } catch (error) {
proxy?.$modal.msgError('提交失败,请重试'); 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 handleDelete = async (row?: SupplierInputVO) => {
const _ids = row?.id || ids.value; const _ids = row?.id || ids.value;