Sfoglia il codice sorgente

修改合同、分包合同添加数据先后顺序乱序的问题;

新增项目流转添加等待执行后再新增功能
余思翰 8 mesi fa
parent
commit
e0bf7e0ea4

+ 56
- 23
oa-ui/src/views/flowable/form/business/contractForm.vue Vedi File

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-05-10 15:31:57
3
  * @Date: 2024-05-10 15:31:57
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-09-04 17:19:17
5
+ * @LastEditTime: 2024-09-29 11:01:48
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="app-container">
8
   <div class="app-container">
87
             </el-form-item>
87
             </el-form-item>
88
           </el-row>
88
           </el-row>
89
           <el-form-item label="关联分包合同">
89
           <el-form-item label="关联分包合同">
90
-            <el-button type="primary" size="mini" @click="subOpen = true" icon="el-icon-plus" v-if="taskName == '合同拟稿'">新增分包合同</el-button>
90
+            <el-button type="primary" size="mini" @click="subOpen = true" icon="el-icon-plus"
91
+              v-if="taskName == '合同拟稿'">新增分包合同</el-button>
91
             <el-table v-loading="subloading" border :data="connectSubContractList">
92
             <el-table v-loading="subloading" border :data="connectSubContractList">
92
               <el-table-column type="index" label="序号" width="55" align="center" />
93
               <el-table-column type="index" label="序号" width="55" align="center" />
93
               <el-table-column label="合同名称" align="center" prop="subContractName" />
94
               <el-table-column label="合同名称" align="center" prop="subContractName" />
96
               <el-table-column label="操作" align="center">
97
               <el-table-column label="操作" align="center">
97
                 <template slot-scope="scope">
98
                 <template slot-scope="scope">
98
                   <el-button type="text" icon="el-icon-view" @click="clickSubFn(scope.row)">查看</el-button>
99
                   <el-button type="text" icon="el-icon-view" @click="clickSubFn(scope.row)">查看</el-button>
99
-                  <el-button type="text" style="color:#F56C6C;" icon="el-icon-delete"  v-if="taskName == '合同拟稿'"
100
+                  <el-button type="text" style="color:#F56C6C;" icon="el-icon-delete" v-if="taskName == '合同拟稿'"
100
                     @click="handleDeleteSub(scope.$index, scope.row)">删除</el-button>
101
                     @click="handleDeleteSub(scope.$index, scope.row)">删除</el-button>
101
                 </template>
102
                 </template>
102
               </el-table-column>
103
               </el-table-column>
417
     FileItem,
418
     FileItem,
418
     ChoosePartyA,
419
     ChoosePartyA,
419
     workTable,
420
     workTable,
420
-    paymentTable, projectInfo,ChooseSubcontract,subContract
421
+    paymentTable, projectInfo, ChooseSubcontract, subContract
421
   },
422
   },
422
   props: {
423
   props: {
423
     taskName: {
424
     taskName: {
467
       // 遮罩层
468
       // 遮罩层
468
       loading: true,
469
       loading: true,
469
       projectloading: true,
470
       projectloading: true,
470
-      subloading:true,
471
+      subloading: true,
471
       // 弹出层标题
472
       // 弹出层标题
472
       title: "",
473
       title: "",
473
       // 是否显示弹出层
474
       // 是否显示弹出层
474
       open: false,
475
       open: false,
475
-      subOpen:false,
476
+      subOpen: false,
476
       tbOpen: false,
477
       tbOpen: false,
477
       partyAOpen: false,
478
       partyAOpen: false,
478
       // 表单参数
479
       // 表单参数
491
       meetingOpen: false,
492
       meetingOpen: false,
492
       commentOpen: false,
493
       commentOpen: false,
493
       drawerOpen: false,
494
       drawerOpen: false,
494
-      subInfoOpen:false,
495
+      subInfoOpen: false,
495
       chooseProjectList: [],
496
       chooseProjectList: [],
496
-      connectSubContractList:[],
497
+      connectSubContractList: [],
497
       partyAList: [],
498
       partyAList: [],
498
       projectList: [],
499
       projectList: [],
499
       deptList: [],
500
       deptList: [],
538
       formTotal: 0,
539
       formTotal: 0,
539
       flowData: {},
540
       flowData: {},
540
       clickTd: {},
541
       clickTd: {},
541
-      subContractId:{
542
-        formId:''
542
+      subContractId: {
543
+        formId: ''
543
       }
544
       }
544
     };
545
     };
545
   },
546
   },
1009
         }
1010
         }
1010
       });
1011
       });
1011
     },
1012
     },
1013
+    // updateContractData() {
1014
+    //   this.workList = this.$refs.workTableRef.workList;
1015
+    //   this.paymentList = this.$refs.paymentRef.paymentList;
1016
+    //   updateContract(this.form).then(response => {
1017
+    //     this.$modal.msgSuccess("修改成功");
1018
+    //     this.open = false;
1019
+    //     delContractWork(this.form.contractId).then(res => {
1020
+    //       for (let work of this.workList) {
1021
+    //         work.contractId = this.form.contractId
1022
+    //         addContractWork(work);
1023
+    //       }
1024
+    //     })
1025
+    //     delContractPayment(this.form.contractId).then(res => {
1026
+    //       for (let payment of this.paymentList) {
1027
+    //         payment.contractId = this.form.contractId
1028
+    //         addContractPayment(payment);
1029
+    //       }
1030
+    //     })
1031
+    //   });
1032
+    // },
1012
     updateContractData() {
1033
     updateContractData() {
1013
       this.workList = this.$refs.workTableRef.workList;
1034
       this.workList = this.$refs.workTableRef.workList;
1014
       this.paymentList = this.$refs.paymentRef.paymentList;
1035
       this.paymentList = this.$refs.paymentRef.paymentList;
1015
       updateContract(this.form).then(response => {
1036
       updateContract(this.form).then(response => {
1016
         this.$modal.msgSuccess("修改成功");
1037
         this.$modal.msgSuccess("修改成功");
1017
         this.open = false;
1038
         this.open = false;
1018
-        delContractWork(this.form.contractId).then(res => {
1019
-          for (let work of this.workList) {
1020
-            work.contractId = this.form.contractId
1021
-            addContractWork(work);
1022
-          }
1023
-        })
1024
-        delContractPayment(this.form.contractId).then(res => {
1025
-          for (let payment of this.paymentList) {
1026
-            payment.contractId = this.form.contractId
1027
-            addContractPayment(payment);
1028
-          }
1029
-        })
1039
+        // 删除合同的工作和支付信息,并等待两个操作完成
1040
+        Promise.all([
1041
+          delContractWork(this.form.contractId),
1042
+          delContractPayment(this.form.contractId)
1043
+        ]).then(([workRes, paymentRes]) => {
1044
+          // 添加工作信息
1045
+          const workPromises = this.workList.map(work => {
1046
+            work.contractId = this.form.contractId;
1047
+            return addContractWork(work);
1048
+          });
1049
+          // 添加支付信息
1050
+          const paymentPromises = this.paymentList.map(payment => {
1051
+            payment.contractId = this.form.contractId;
1052
+            return addContractPayment(payment);
1053
+          });
1054
+          // 等待所有添加操作完成
1055
+          return Promise.all([...workPromises, ...paymentPromises]);
1056
+        }).then(() => {
1057
+          this.$modal.msgSuccess("计划工作量和回款计划添加成功");
1058
+        }).catch(error => {
1059
+          this.$modal.msgError("操作失败: " + error.message);
1060
+        });
1061
+      }).catch(error => {
1062
+        this.$modal.msgError("合同更新失败: " + error.message);
1030
       });
1063
       });
1031
     },
1064
     },
1032
     updateRelatedProject() {
1065
     updateRelatedProject() {
1130
         this.$set(this.form, 'partyAId', val[0].partyAId)
1163
         this.$set(this.form, 'partyAId', val[0].partyAId)
1131
       }
1164
       }
1132
     },
1165
     },
1133
-    async confirmSubContract(val){
1166
+    async confirmSubContract(val) {
1134
       let isSame = this.haveSameIds(val, this.connectSubContractList, 'subContractId');
1167
       let isSame = this.haveSameIds(val, this.connectSubContractList, 'subContractId');
1135
       if (isSame) {
1168
       if (isSame) {
1136
         this.$message.error('请勿重复添加已有的分包合同')
1169
         this.$message.error('请勿重复添加已有的分包合同')

+ 48
- 17
oa-ui/src/views/flowable/form/business/subContract.vue Vedi File

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-05-10 15:31:57
3
  * @Date: 2024-05-10 15:31:57
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-09-05 10:39:05
5
+ * @LastEditTime: 2024-09-29 11:15:09
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="app-container">
8
   <div class="app-container">
813
       return true;
813
       return true;
814
     },
814
     },
815
     // 保存信息
815
     // 保存信息
816
-    saves() {
816
+    async saves() {
817
       this.workList = this.$refs.workTableRef.workList;
817
       this.workList = this.$refs.workTableRef.workList;
818
       this.paymentList = this.$refs.paymentRef.paymentList;
818
       this.paymentList = this.$refs.paymentRef.paymentList;
819
       if (this.formTotal != 0) {
819
       if (this.formTotal != 0) {
841
         })
841
         })
842
         for (let work of this.workList) {
842
         for (let work of this.workList) {
843
           work.contractId = subContractId;
843
           work.contractId = subContractId;
844
-          addContractWork(work);
844
+          await addContractWork(work);
845
         }
845
         }
846
         for (let payment of this.paymentList) {
846
         for (let payment of this.paymentList) {
847
           payment.contractId = subContractId;
847
           payment.contractId = subContractId;
848
-          addContractPayment(payment);
848
+          await addContractPayment(payment);
849
         }
849
         }
850
         const params = { taskId: this.taskForm.taskId };
850
         const params = { taskId: this.taskForm.taskId };
851
         getNextFlowNode(params).then(res => {
851
         getNextFlowNode(params).then(res => {
987
         handleComplete(this.taskForm);
987
         handleComplete(this.taskForm);
988
       }
988
       }
989
     },
989
     },
990
-    updateChooseProjectList() {
990
+    // updateChooseProjectList() {
991
+    //   this.workList = this.$refs.workTableRef.workList;
992
+    //   this.paymentList = this.$refs.paymentRef.paymentList;
993
+    //   const subContractId = this.taskForm.formId
994
+    //   delProjectSubcontract(subContractId).then(() => {
995
+    //     this.chooseProjectList.forEach(item => {
996
+    //       addProjectSubcontract({ subContractId: subContractId, projectId: item.projectId })
997
+    //     })
998
+    //   })
999
+    //   delContractWork(subContractId).then(() => {
1000
+    //     for (let work of this.workList) {
1001
+    //       work.contractId = subContractId;
1002
+    //       addContractWork(work);
1003
+    //     }
1004
+    //   })
1005
+    //   delContractPayment(subContractId).then(() => {
1006
+    //     for (let payment of this.paymentList) {
1007
+    //       payment.contractId = subContractId;
1008
+    //       addContractPayment(payment);
1009
+    //     }
1010
+    //   })
1011
+    // },
1012
+    async updateChooseProjectList() {
991
       this.workList = this.$refs.workTableRef.workList;
1013
       this.workList = this.$refs.workTableRef.workList;
992
       this.paymentList = this.$refs.paymentRef.paymentList;
1014
       this.paymentList = this.$refs.paymentRef.paymentList;
993
-      const subContractId = this.taskForm.formId
994
-      delProjectSubcontract(subContractId).then(() => {
995
-        this.chooseProjectList.forEach(item => {
996
-          addProjectSubcontract({ subContractId: subContractId, projectId: item.projectId })
997
-        })
998
-      })
999
-      delContractWork(subContractId).then(() => {
1015
+      const subContractId = this.taskForm.formId;
1016
+      try {
1017
+        // 删除项目分包合同
1018
+        await delProjectSubcontract(subContractId);
1019
+        // 添加新的项目分包合同
1020
+        for (let item of this.chooseProjectList) {
1021
+          await addProjectSubcontract({ subContractId: subContractId, projectId: item.projectId });
1022
+        }
1023
+        // 删除合同工作
1024
+        await delContractWork(subContractId);
1025
+        // 添加新的合同工作
1000
         for (let work of this.workList) {
1026
         for (let work of this.workList) {
1001
           work.contractId = subContractId;
1027
           work.contractId = subContractId;
1002
-          addContractWork(work);
1028
+          await addContractWork(work);
1003
         }
1029
         }
1004
-      })
1005
-      delContractPayment(subContractId).then(() => {
1030
+        // 删除合同付款
1031
+        await delContractPayment(subContractId);
1032
+        // 添加新的合同付款
1006
         for (let payment of this.paymentList) {
1033
         for (let payment of this.paymentList) {
1007
           payment.contractId = subContractId;
1034
           payment.contractId = subContractId;
1008
-          addContractPayment(payment);
1035
+          await addContractPayment(payment);
1009
         }
1036
         }
1010
-      })
1037
+        this.$modal.msgSuccess("更新成功");
1038
+      } catch (error) {
1039
+        console.error("更新选择项目列表时出错:", error);
1040
+        this.$modal.msgError("更新失败");
1041
+      }
1011
     },
1042
     },
1012
     // 确定合作单位
1043
     // 确定合作单位
1013
     confirmPartners(val) {
1044
     confirmPartners(val) {

+ 8
- 9
oa-ui/src/views/flowable/form/projectProcess/addproject.vue Vedi File

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-03-18 11:00:04
3
  * @Date: 2024-03-18 11:00:04
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-09-06 09:48:03
5
+ * @LastEditTime: 2024-09-29 11:47:57
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="project-wrapper">
8
   <div class="project-wrapper">
120
 <script>
120
 <script>
121
 import { parseTime } from "@/utils/ruoyi";
121
 import { parseTime } from "@/utils/ruoyi";
122
 import { mapGetters } from "vuex";
122
 import { mapGetters } from "vuex";
123
-import { listProject, getProject, addProject, updateProject, delProject, getProjectNmuber,sendMessage } from "@/api/oa/project/project";
123
+import { listProject, getProject, addProject, updateProject, delProject, getProjectNmuber, sendMessage } from "@/api/oa/project/project";
124
 import { listDept } from '@/api/system/dept'
124
 import { listDept } from '@/api/system/dept'
125
 import { getUser } from "@/api/system/user";
125
 import { getUser } from "@/api/system/user";
126
 import { getUsersDeptLeaderByDept } from "@/api/system/post";
126
 import { getUsersDeptLeaderByDept } from "@/api/system/post";
325
       }
325
       }
326
       this.openContract = false;
326
       this.openContract = false;
327
     },
327
     },
328
-    updatePlanWorkload() {
328
+    async updatePlanWorkload() {
329
       const workList = this.$refs.planworkRef.workList;
329
       const workList = this.$refs.planworkRef.workList;
330
       const projectId = this.taskForm.formId
330
       const projectId = this.taskForm.formId
331
-      delProjectWork(projectId).then(() => {
332
-        workList.forEach(work => {
333
-          work.projectId = projectId;
334
-          addProjectWork(work);
335
-        })
336
-      })
331
+      await delProjectWork(projectId)
332
+      for (let work of workList) {
333
+        work.projectId = projectId;
334
+        await addProjectWork(work);
335
+      }
337
     },
336
     },
338
     // 暂存
337
     // 暂存
339
     async save() {
338
     async save() {

+ 8
- 9
oa-ui/src/views/flowable/form/projectProcess/assessWork.vue Vedi File

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-07-08 16:16:27
3
  * @Date: 2024-07-08 16:16:27
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-09-05 16:54:57
5
+ * @LastEditTime: 2024-09-29 10:40:31
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="app-container">
8
   <div class="app-container">
159
       }
159
       }
160
     },
160
     },
161
     // 更新工作量
161
     // 更新工作量
162
-    updateWorkList() {
163
-      delProjectWork(this.taskForm.formId).then(res => {
164
-        this.workList.forEach(work => {
165
-          work.projectId = this.taskForm.formId;
166
-          addProjectWork(work);
167
-        })
168
-        this.$message.success('保存成功')
169
-      })
162
+    async updateWorkList() {
163
+      await delProjectWork(this.taskForm.formId)
164
+      for (let work of this.workList) {
165
+        work.projectId = this.taskForm.formId;
166
+        await addProjectWork(work);
167
+      }
168
+      this.$message.success('保存成功')
170
     },
169
     },
171
     // 保存按钮
170
     // 保存按钮
172
     save() {
171
     save() {

+ 2
- 2
oa-ui/src/views/flowable/form/technicalForm.vue Vedi File

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-07-04 17:37:29
3
  * @Date: 2024-07-04 17:37:29
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-09-27 16:49:03
5
+ * @LastEditTime: 2024-09-27 17:08:06
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="app-container">
8
   <div class="app-container">
108
           </el-row>
108
           </el-row>
109
         </el-form>
109
         </el-form>
110
         <div style="text-align: center;" v-if="taskName">
110
         <div style="text-align: center;" v-if="taskName">
111
-          <el-button type="danger" @click="returnOpen = true">退 回</el-button>
111
+          <el-button type="danger" @click="returnOpen = true" v-show="taskName != '技术交底'">退 回</el-button>
112
           <el-button type="primary" @click="submitForm">提 交</el-button>
112
           <el-button type="primary" @click="submitForm">提 交</el-button>
113
         </div>
113
         </div>
114
       </el-col>
114
       </el-col>

+ 24
- 12
oa-ui/src/views/oa/contract/components/edit.vue Vedi File

406
       updateContract(this.form).then(response => {
406
       updateContract(this.form).then(response => {
407
         this.$modal.msgSuccess("修改成功");
407
         this.$modal.msgSuccess("修改成功");
408
         this.open = false;
408
         this.open = false;
409
-        delContractWork(this.form.contractId).then(res => {
410
-          for (let work of this.workList) {
411
-            work.contractId = this.form.contractId
412
-            addContractWork(work);
413
-          }
414
-        })
415
-        delContractPayment(this.form.contractId).then(res => {
416
-          for (let payment of this.paymentList) {
417
-            payment.contractId = this.form.contractId
418
-            addContractPayment(payment);
419
-          }
420
-        })
409
+        // 删除合同的工作和支付信息,并等待两个操作完成
410
+        Promise.all([
411
+          delContractWork(this.form.contractId),
412
+          delContractPayment(this.form.contractId)
413
+        ]).then(([workRes, paymentRes]) => {
414
+          // 添加工作信息
415
+          const workPromises = this.workList.map(work => {
416
+            work.contractId = this.form.contractId;
417
+            return addContractWork(work);
418
+          });
419
+          // 添加支付信息
420
+          const paymentPromises = this.paymentList.map(payment => {
421
+            payment.contractId = this.form.contractId;
422
+            return addContractPayment(payment);
423
+          });
424
+          // 等待所有添加操作完成
425
+          return Promise.all([...workPromises, ...paymentPromises]);
426
+        }).then(() => {
427
+          this.$modal.msgSuccess("计划工作量和回款计划添加成功");
428
+        }).catch(error => {
429
+          this.$modal.msgError("操作失败: " + error.message);
430
+        });
431
+      }).catch(error => {
432
+        this.$modal.msgError("合同更新失败: " + error.message);
421
       });
433
       });
422
     },
434
     },
423
     async updateRelatedProject() {
435
     async updateRelatedProject() {

+ 58
- 25
oa-ui/src/views/oa/contract/components/subEdit.vue Vedi File

242
       // this.init();
242
       // this.init();
243
       this.getContractSubcontractList();
243
       this.getContractSubcontractList();
244
       this.getProjectSubcontractList();
244
       this.getProjectSubcontractList();
245
+      this.form.partnerId = this.form.partnerId ? this.form.partnerId.split(',') : null;
245
     }
246
     }
246
   },
247
   },
247
   created() {
248
   created() {
256
       this.getContractCommentList();
257
       this.getContractCommentList();
257
       this.getProjectSubcontractList();
258
       this.getProjectSubcontractList();
258
     },
259
     },
259
-    getContractCommentList(){
260
+    getContractCommentList() {
260
       const subContractId = this.form.subContractId;
261
       const subContractId = this.form.subContractId;
261
       listContractComment({ pageNum: 1, pageSize: 100, contractId: subContractId }).then(res => {
262
       listContractComment({ pageNum: 1, pageSize: 100, contractId: subContractId }).then(res => {
262
         if (res.rows && res.rows.length != 0) {
263
         if (res.rows && res.rows.length != 0) {
282
     getContractSubcontractList() {
283
     getContractSubcontractList() {
283
       this.contractloading = true;
284
       this.contractloading = true;
284
       const subContractId = this.form.subContractId;
285
       const subContractId = this.form.subContractId;
285
-      if(!subContractId) return
286
+      if (!subContractId) return
286
       listContractSubcontract({ subContractId: subContractId }).then(async res => {
287
       listContractSubcontract({ subContractId: subContractId }).then(async res => {
287
         let list = []
288
         let list = []
288
         for (let r of res.rows) {
289
         for (let r of res.rows) {
289
           let obj = await getContract(r.contractId)
290
           let obj = await getContract(r.contractId)
290
           list.push(obj.data)
291
           list.push(obj.data)
291
         }
292
         }
292
-        console.log(res,subContractId);
293
         this.connectContractList = list
293
         this.connectContractList = list
294
         this.contractloading = false;
294
         this.contractloading = false;
295
       })
295
       })
409
         this.form.contractDocument = ""
409
         this.form.contractDocument = ""
410
       }
410
       }
411
     },
411
     },
412
-    updateSubContractFn() {
413
-      const subContractId = this.form.subContractId
412
+    // updateSubContractFn() {
413
+    //   const subContractId = this.form.subContractId
414
+    //   this.workList = this.$refs.workTableRef.workList;
415
+    //   this.paymentList = this.$refs.paymentRef.paymentList;
416
+    //   updateSubContract(this.form).then(() => {
417
+    //     this.$modal.msgSuccess("修改成功");
418
+    //     delProjectSubcontract(subContractId).then(() => {
419
+    //       this.connectProjectList.forEach(item => {
420
+    //         addProjectSubcontract({ subContractId: subContractId, projectId: item.projectId })
421
+    //       })
422
+    //     })
423
+    //     delContractWork(subContractId).then(() => {
424
+    //       for (let work of this.workList) {
425
+    //         work.contractId = subContractId;
426
+    //         addContractWork(work);
427
+    //       }
428
+    //     })
429
+    //     delContractPayment(subContractId).then(() => {
430
+    //       for (let payment of this.paymentList) {
431
+    //         payment.contractId = subContractId;
432
+    //         addContractPayment(payment);
433
+    //       }
434
+    //     })
435
+    //   })
436
+
437
+    // },
438
+    async updateSubContractFn() {
439
+      const subContractId = this.form.subContractId;
414
       this.workList = this.$refs.workTableRef.workList;
440
       this.workList = this.$refs.workTableRef.workList;
415
       this.paymentList = this.$refs.paymentRef.paymentList;
441
       this.paymentList = this.$refs.paymentRef.paymentList;
416
-      updateSubContract(this.form).then(() => {
442
+      try {
443
+        // 更新子合同
444
+        await updateSubContract(this.form);
417
         this.$modal.msgSuccess("修改成功");
445
         this.$modal.msgSuccess("修改成功");
418
-        delProjectSubcontract(subContractId).then(() => {
419
-          this.connectProjectList.forEach(item => {
420
-            addProjectSubcontract({ subContractId: subContractId, projectId: item.projectId })
421
-          })
422
-        })
423
-        delContractWork(subContractId).then(() => {
424
-          for (let work of this.workList) {
425
-            work.contractId = subContractId;
426
-            addContractWork(work);
427
-          }
428
-        })
429
-        delContractPayment(subContractId).then(() => {
430
-          for (let payment of this.paymentList) {
431
-            payment.contractId = subContractId;
432
-            addContractPayment(payment);
433
-          }
434
-        })
435
-      })
436
-
446
+        // 删除项目分包合同
447
+        await delProjectSubcontract(subContractId);
448
+        // 添加新的项目分包合同
449
+        for (let item of this.connectProjectList) {
450
+          await addProjectSubcontract({ subContractId: subContractId, projectId: item.projectId });
451
+        }
452
+        // 删除合同工作
453
+        await delContractWork(subContractId);
454
+        // 添加新的合同工作
455
+        for (let work of this.workList) {
456
+          work.contractId = subContractId;
457
+          await addContractWork(work);
458
+        }
459
+        // 删除合同付款
460
+        await delContractPayment(subContractId);
461
+        // 添加新的合同付款
462
+        for (let payment of this.paymentList) {
463
+          payment.contractId = subContractId;
464
+          await addContractPayment(payment);
465
+        }
466
+      } catch (error) {
467
+        console.error("更新合同时出错:", error);
468
+        this.$modal.msgError("更新失败");
469
+      }
437
     },
470
     },
438
     updateRelatedProject() {
471
     updateRelatedProject() {
439
       delProjectContract(this.form.contractId).then(() => {
472
       delProjectContract(this.form.contractId).then(() => {

Loading…
Annulla
Salva