Bläddra i källkod

fix:4707【协同办公】最好每个表单里有支持修改功能,目前没有

mlchen 6 dagar sedan
förälder
incheckning
b3fb58df69

+ 1 - 0
.gitignore

@@ -25,3 +25,4 @@ vue.config.js
 package-lock.json
 .history
 .workbuddy
+AGENTS.md

+ 10 - 10
src/BIZComponents/processSubmitDialog/components/businessComponent.vue

@@ -21,7 +21,7 @@
                 label="出发地">
             </el-table-column>
             <el-table-column
-                prop="endPlace" 
+                prop="endPlace"
                 align="center"
                 label="到达地">
             </el-table-column>
@@ -41,7 +41,7 @@
                 width="100"
                  v-if="!view">
                 <template slot-scope="scope">
-                    <!-- <el-button @click="editRow(scope.row, scope.$index)" type="text" size="mini">编辑</el-button> -->
+                    <el-button @click="editRow(scope.row, scope.$index)" type="text" size="mini">编辑</el-button>
                     <el-button @click="deleteRow(scope.$index)" type="text" size="mini">删除</el-button>
                 </template>
                 </el-table-column>
@@ -129,9 +129,9 @@
                             v-model="form.endPlace"
                         ></el-input>
                     </el-form-item>
-                    <el-form-item 
-                        label="交通方式" 
-                        label-width="80px" 
+                    <el-form-item
+                        label="交通方式"
+                        label-width="80px"
                         prop="transportationWay"
                         :rules="{
                                 required: true,
@@ -250,9 +250,9 @@
                         v-model="row.endPlace"
                     ></el-input>
                 </el-form-item>
-                <el-form-item 
-                    label="交通方式" 
-                    label-width="80px" 
+                <el-form-item
+                    label="交通方式"
+                    label-width="80px"
                     :prop="'blank_business_component.' + $index + '.transportationWay'"
                     :rules="{
                             required: true,
@@ -486,7 +486,7 @@ export default {
                 if(this.type === 'add') {
                     this.tableData.push(newForm);
                 } else {
-                    this.tableData[this.currentIndex] = newForm;
+                    this.$set(this.tableData, this.currentIndex, newForm);
                 }
                 console.log('this.tableData', this.tableData);
                 this.updateRowInfo()
@@ -522,4 +522,4 @@ export default {
     padding-left: 10px;
     padding-right: 10px;
 }
-</style>
+</style>

+ 38 - 34
src/BIZComponents/processSubmitDialog/components/eventComponent.vue

@@ -43,7 +43,7 @@
                 width="100"
                  v-if="!view">
                 <template slot-scope="scope">
-                    <!-- <el-button @click="editRow(scope.row, scope.$index)" type="text" size="mini">编辑</el-button> -->
+                    <el-button @click="editRow(scope.row, scope.$index)" type="text" size="mini">编辑</el-button>
                     <el-button @click="deleteRow(scope.$index)" type="text" size="mini">删除</el-button>
                 </template>
                 </el-table-column>
@@ -84,7 +84,7 @@
                         >
                         </el-date-picker>
                     </el-form-item>
-        
+
                     <el-form-item
                         label="事件发生的医院及科室"
                         label-width="110px"
@@ -103,9 +103,9 @@
                         ></el-input>
                     </el-form-item>
 
-                    <el-form-item 
-                        label="事件详细描述" 
-                        label-width="110px" 
+                    <el-form-item
+                        label="事件详细描述"
+                        label-width="110px"
                         prop="eventDesc"
                     >
                         <el-input
@@ -116,9 +116,9 @@
                         ></el-input>
                     </el-form-item>
 
-                    <el-form-item 
-                        label="图片上传" 
-                        label-width="110px" 
+                    <el-form-item
+                        label="图片上传"
+                        label-width="110px"
                         prop="eventImage"
                         :rules="{
                                 required: true,
@@ -144,9 +144,9 @@
                         </el-upload>
                     </el-form-item>
 
-                    <el-form-item 
-                        label="其他意见" 
-                        label-width="110px" 
+                    <el-form-item
+                        label="其他意见"
+                        label-width="110px"
                         prop="eventOpinion"
                     >
                         <el-input
@@ -267,14 +267,14 @@ export default {
                 this.$message.error(`最多上传 ${this.limit}个文件`);
                 return Promise.reject(new Error('文件数量超出限制'));
             }
-            
+
             // 3. 文件类型校验(虽然accept属性已限制,但这里再做一层校验确保安全性)
             const isImage = /\.(jpg|jpeg|png|gif)$/i.test(file.name);
             if (!isImage) {
                 this.$message.error('请上传图片格式的文件');
                 return Promise.reject(new Error('文件类型不是图片'));
             }
-            
+
             // 4. 执行文件上传
             return uploadFile({
                 module: this.module,
@@ -282,13 +282,13 @@ export default {
             }).then((res) => {
                 if (res.data) {
                     // 将上传成功的文件添加到表单中
-                    const uploadedFile = { 
-                        ...file, 
-                        url: res.data.storePath, 
+                    const uploadedFile = {
+                        ...file,
+                        url: res.data.storePath,
                         ...res.data,
                         status: 'success' // 标记为成功状态
                     };
-                    
+
                     // 检查文件是否已存在,避免重复添加
                     const existingIndex = this.form.eventImage.findIndex(item => item.uid === file.uid);
                     if (existingIndex === -1) {
@@ -296,7 +296,7 @@ export default {
                     } else {
                         this.form.eventImage.splice(existingIndex, 1, uploadedFile);
                     }
-                    
+
                     return res.data;
                 }
                 return Promise.reject(new Error('上传失败,未返回数据'));
@@ -307,6 +307,10 @@ export default {
         },
         beforeRemove (file) {
             if (file.id) {
+                // 原明细仍可能被取消编辑或被流程引用,编辑时仅移除草稿中的引用。
+                if (this.type === 'edit' && (this.currentItem.eventImage || []).some(item => item.id === file.id)) {
+                    return true;
+                }
                 return removeFile({
                     fileId: file.id
                 }).then(() => {
@@ -370,50 +374,50 @@ export default {
             try {
                 // 1. 先进行表单基本验证
                 await this.validateForm();
-                
+
                 // 2. 额外验证图片上传是否有效
                 // if (!this.form.eventImage || this.form.eventImage.length === 0) {
                 //     this.$message.error('请上传图片');
                 //     return;
                 // }
-                
+
                 // // 3. 检查是否有上传中的图片或上传失败的图片
-                // const hasInvalidFile = this.form.eventImage.some(file => 
+                // const hasInvalidFile = this.form.eventImage.some(file =>
                 //     file.status === 'uploading' || file.status === 'fail'
                 // );
-                
+
                 // if (hasInvalidFile) {
                 //     this.$message.error('存在图片正在上传中或上传失败,请等待上传完成或重新上传');
                 //     return;
                 // }
-                
+
                 // console.log('表单验证通过,图片上传有效');
-                
+
                 // 4. 深拷贝form对象,避免引用问题
                 const newForm = JSON.parse(JSON.stringify(this.form));
-                
+
                 // 5. 过滤出有效的图片数据(只保留成功上传的图片)
-                newForm.eventImage = newForm.eventImage.filter(file => 
+                newForm.eventImage = newForm.eventImage.filter(file =>
                     file.status === 'success' && file.url
                 );
-                
+
                 console.log('newForm', newForm);
-                
+
                 // 6. 更新表格数据
                 if(this.type === 'add') {
                     this.tableData.push(newForm);
                 } else {
-                    this.tableData[this.currentIndex] = newForm;
+                    this.$set(this.tableData, this.currentIndex, newForm);
                 }
-                
+
                 console.log('this.tableData', this.tableData);
-                
+
                 // 7. 更新父组件数据
                 this.updateRowInfo();
-                
+
                 // 8. 保存成功后关闭弹窗并重置表单
                 this.handleClose();
-                
+
                 // 重置form
                 // this.form = {
                 //     eventType: '',
@@ -453,4 +457,4 @@ export default {
     padding-left: 10px;
     padding-right: 10px;
 }
-</style>
+</style>

+ 7 - 7
src/BIZComponents/processSubmitDialog/components/productSpecificationComponent.vue

@@ -26,7 +26,7 @@
                 width="100"
                  v-if="!view">
                 <template slot-scope="scope">
-                    <!-- <el-button @click="editRow(scope.row, scope.$index)" type="text" size="mini">编辑</el-button> -->
+                    <el-button @click="editRow(scope.row, scope.$index)" type="text" size="mini">编辑</el-button>
                     <el-button @click="deleteRow(scope.$index)" type="text" size="mini">删除</el-button>
                 </template>
                 </el-table-column>
@@ -63,7 +63,7 @@
                             placeholder="请输入"
                         ></el-input>
                     </el-form-item>
-        
+
                     <el-form-item
                         label="数量"
                         label-width="110px"
@@ -79,9 +79,9 @@
                             placeholder="请输入"
                         ></el-input>
                     </el-form-item>
-                    <el-form-item 
-                        label="批号" 
-                        label-width="110px" 
+                    <el-form-item
+                        label="批号"
+                        label-width="110px"
                         prop="batchNo"
                         :rules="{
                                 required: true,
@@ -257,7 +257,7 @@ export default {
                 if(this.type === 'add') {
                     this.tableData.push(newForm);
                 } else {
-                    this.tableData[this.currentIndex] = newForm;
+                    this.$set(this.tableData, this.currentIndex, newForm);
                 }
                 console.log('this.tableData', this.tableData);
                 this.updateRowInfo()
@@ -294,4 +294,4 @@ export default {
     padding-left: 10px;
     padding-right: 10px;
 }
-</style>
+</style>

+ 17 - 17
src/BIZComponents/processSubmitDialog/components/reissueComponent.vue

@@ -31,7 +31,7 @@
                 width="100"
                  v-if="!view">
                 <template slot-scope="scope">
-                    <!-- <el-button @click="editRow(scope.row, scope.$index)" type="text" size="mini">编辑</el-button> -->
+                    <el-button @click="editRow(scope.row, scope.$index)" type="text" size="mini">编辑</el-button>
                     <el-button @click="deleteRow(scope.$index)" type="text" size="mini">删除</el-button>
                 </template>
                 </el-table-column>
@@ -72,7 +72,7 @@
                             </el-option>
                         </el-select>
                     </el-form-item>
-        
+
                     <el-form-item
                         label="补发其他规格型号"
                         label-width="110px"
@@ -85,9 +85,9 @@
                             :autosize="{ minRows: 2, maxRows: 4}"
                         ></el-input>
                     </el-form-item>
-                    <el-form-item 
-                        label="收件地址/联系人/电话" 
-                        label-width="110px" 
+                    <el-form-item
+                        label="收件地址/联系人/电话"
+                        label-width="110px"
                         prop="reissueContact"
                         :rules="{
                                 required: true,
@@ -102,9 +102,9 @@
                             :autosize="{ minRows: 2, maxRows: 4}"
                         ></el-input>
                     </el-form-item>
-                    <el-form-item 
-                        label="其他要求" 
-                        label-width="110px" 
+                    <el-form-item
+                        label="其他要求"
+                        label-width="110px"
                         prop="reissueOtherReq"
                     >
                         <el-input
@@ -230,31 +230,31 @@ export default {
             this.tableData.splice(index, 1);
             this.updateRowInfo();
         },
-   
+
         async save() {
             try {
                 // 执行表单验证
                 await this.validateForm();
                 console.log('表单验证通过');
-                
+
                 // 深拷贝form对象,避免引用问题
                 const newForm = JSON.parse(JSON.stringify(this.form));
-                
+
                 // 根据操作类型更新表格数据
                 if(this.type === 'add') {
                     this.tableData.push(newForm);
                 } else if (this.currentIndex !== null && this.currentIndex !== undefined) {
-                    this.tableData[this.currentIndex] = newForm;
+                    this.$set(this.tableData, this.currentIndex, newForm);
                 }
-                
+
                 console.log('this.tableData', this.tableData);
-                
+
                 // 更新父组件数据
                 this.updateRowInfo();
-                
+
                 // 保存后关闭弹窗
                 this.handleClose();
-                
+
                 // 重置form为初始状态,使用formItem作为模板
                 this.form = JSON.parse(JSON.stringify(this.formItem));
             } catch (error) {
@@ -288,4 +288,4 @@ export default {
     padding-left: 10px;
     padding-right: 10px;
 }
-</style>
+</style>

+ 2 - 2
vue.config.js

@@ -44,9 +44,9 @@ module.exports = {
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.3:18086',
-        // target: 'http://aiot.zoomwin.com.cn:51001/api',
+        target: 'http://aiot.zoomwin.com.cn:51001/api',
         // target: 'http://192.168.1.3:18086',
-        target: 'http://192.168.1.147:18086', // 陈兵
+        // target: 'http://192.168.1.147:18086', // 陈兵
         // target: 'http://192.168.1.116:18086', // 赵沙金
         // target: 'http://192.168.1.113:18086', // 郭丹