|
@@ -245,12 +245,9 @@ export default {
|
245
|
245
|
connectProjectList: [],
|
246
|
246
|
connectSubContractList: [],
|
247
|
247
|
deleteSubList: [],
|
248
|
|
- projectContractForm: {
|
249
|
|
- projectIds: [],
|
250
|
|
- },
|
251
|
248
|
taskForm: {
|
252
|
249
|
formId: ''
|
253
|
|
- }
|
|
250
|
+ },
|
254
|
251
|
}
|
255
|
252
|
},
|
256
|
253
|
watch: {
|
|
@@ -270,13 +267,18 @@ export default {
|
270
|
267
|
this.connectProjectList = [];
|
271
|
268
|
this.connectSubContractList = [];
|
272
|
269
|
this.deleteSubList = [];
|
273
|
|
- this.projectloading = true;
|
274
|
|
- this.subloading = true;
|
275
|
270
|
listContractComment({ pageNum: 1, pageSize: 100, contractId: contractId }).then(res => {
|
276
|
271
|
if (res.rows && res.rows.length != 0) {
|
277
|
272
|
this.commentList = res.rows;
|
278
|
273
|
}
|
279
|
274
|
})
|
|
275
|
+ this.getProjectContractList();
|
|
276
|
+ this.getContractSubcontractList();
|
|
277
|
+ },
|
|
278
|
+ // 获取关联项目
|
|
279
|
+ getProjectContractList() {
|
|
280
|
+ this.projectloading = true;
|
|
281
|
+ const contractId = this.form.contractId;
|
280
|
282
|
listProjectContract({ contractId: contractId }).then(async res => {
|
281
|
283
|
if (res.rows) {
|
282
|
284
|
let list = []
|
|
@@ -288,11 +290,18 @@ export default {
|
288
|
290
|
this.projectloading = false;
|
289
|
291
|
}
|
290
|
292
|
})
|
|
293
|
+ },
|
|
294
|
+ // 获取关联分包合同
|
|
295
|
+ getContractSubcontractList() {
|
|
296
|
+ this.subloading = true;
|
|
297
|
+ const contractId = this.form.contractId;
|
291
|
298
|
listContractSubcontract({ contractId: contractId }).then(async res => {
|
|
299
|
+ let list = []
|
292
|
300
|
for (let r of res.rows) {
|
293
|
301
|
let obj = await getSubContract(r.subContractId)
|
294
|
|
- this.connectSubContractList.push(obj.data)
|
|
302
|
+ list.push(obj.data)
|
295
|
303
|
}
|
|
304
|
+ this.connectSubContractList = list
|
296
|
305
|
this.subloading = false;
|
297
|
306
|
})
|
298
|
307
|
},
|
|
@@ -306,7 +315,6 @@ export default {
|
306
|
315
|
}
|
307
|
316
|
this.updateContractData();
|
308
|
317
|
this.updateRelatedProject();
|
309
|
|
- this.updateRelatedSub();
|
310
|
318
|
this.$emit('cancel')
|
311
|
319
|
}
|
312
|
320
|
}
|
|
@@ -340,12 +348,19 @@ export default {
|
340
|
348
|
return chooseTender.partyA.partyAName.includes(TARGET_COMPANY) ? '院内' : '院外';
|
341
|
349
|
},
|
342
|
350
|
confirmProject(val) {
|
|
351
|
+ let isSame = this.haveSameIds(val, this.connectProjectList, 'projectId');
|
|
352
|
+ if (isSame) {
|
|
353
|
+ this.$message.error('请勿重复添加已有项目')
|
|
354
|
+ return
|
|
355
|
+ }
|
343
|
356
|
this.open = false
|
344
|
357
|
for (let v of val) {
|
345
|
|
- this.projectContractForm.projectIds.push(v.projectId);
|
346
|
358
|
this.connectProjectList.push(v)
|
347
|
359
|
}
|
348
|
360
|
},
|
|
361
|
+ haveSameIds(arr1, arr2, key) {
|
|
362
|
+ return arr1.some(obj1 => arr2.some(obj2 => obj1[key] === obj2[key]))
|
|
363
|
+ },
|
349
|
364
|
confirmTender(val) {
|
350
|
365
|
this.tbOpen = false
|
351
|
366
|
this.form.amount = val.quote
|
|
@@ -365,11 +380,18 @@ export default {
|
365
|
380
|
this.$set(this.form, 'partyAId', val[0].partyAId)
|
366
|
381
|
}
|
367
|
382
|
},
|
368
|
|
- confirmSubContract(val) {
|
|
383
|
+ async confirmSubContract(val) {
|
|
384
|
+ let isSame = this.haveSameIds(val, this.connectSubContractList, 'subContractId');
|
|
385
|
+ if (isSame) {
|
|
386
|
+ this.$message.error('请勿重复添加已有的分包合同')
|
|
387
|
+ return
|
|
388
|
+ }
|
369
|
389
|
this.subOpen = false
|
370
|
390
|
for (let v of val) {
|
371
|
391
|
this.connectSubContractList.push(v)
|
|
392
|
+ await addContractSubcontract({ contractId: this.form.contractId, subContractId: v.subContractId })
|
372
|
393
|
}
|
|
394
|
+ this.getContractSubcontractList()
|
373
|
395
|
},
|
374
|
396
|
getContractPath(val) {
|
375
|
397
|
let arr = val.split('/upload')
|
|
@@ -398,26 +420,12 @@ export default {
|
398
|
420
|
})
|
399
|
421
|
});
|
400
|
422
|
},
|
401
|
|
- updateRelatedProject() {
|
402
|
|
- delProjectContract(this.form.contractId).then(() => {
|
403
|
|
- for (let projectId of this.projectContractForm.projectIds) {
|
404
|
|
- addProjectContract({ projectId: projectId, contractId: this.form.contractId });
|
405
|
|
- }
|
406
|
|
- })
|
407
|
|
- },
|
408
|
|
- updateRelatedSub() {
|
409
|
|
- let subIds = this.deleteSubList.map(item => item.subContractId);
|
410
|
|
- console.log(subIds);
|
411
|
|
- delContractSubcontract(subIds).then(() => {
|
412
|
|
- this.connectSubContractList.forEach(item => {
|
413
|
|
- item.contractId = this.form.contractId;
|
414
|
|
- let obj = {
|
415
|
|
- contractId: this.form.contractId,
|
416
|
|
- subContractId: item.subContractId
|
417
|
|
- }
|
418
|
|
- addContractSubcontract(obj)
|
419
|
|
- })
|
420
|
|
- })
|
|
423
|
+ async updateRelatedProject() {
|
|
424
|
+ let projectIds = this.connectProjectList.map(item => item.projectId);
|
|
425
|
+ await delProjectContract(this.form.contractId)
|
|
426
|
+ for (let projectId of projectIds) {
|
|
427
|
+ await addProjectContract({ projectId: projectId, contractId: this.form.contractId });
|
|
428
|
+ }
|
421
|
429
|
},
|
422
|
430
|
clickProjectFn(row) {
|
423
|
431
|
this.$router.replace({ query: { ...this.$route.query, projectId: row.projectId } });
|
|
@@ -425,13 +433,13 @@ export default {
|
425
|
433
|
},
|
426
|
434
|
handleDelete(index, row) {
|
427
|
435
|
this.connectProjectList.splice(index, 1)
|
428
|
|
- this.projectContractForm.projectIds.splice(row.contractId)
|
429
|
436
|
},
|
430
|
437
|
clickSubFn(row) {
|
431
|
438
|
this.taskForm.formId = row.subContractId
|
432
|
439
|
this.subInfoOpen = true
|
433
|
440
|
},
|
434
|
441
|
handleDeleteSub(index, row) {
|
|
442
|
+ delContractSubcontract(row.subContractId)
|
435
|
443
|
this.deleteSubList.push(row)
|
436
|
444
|
this.connectSubContractList.splice(index, 1)
|
437
|
445
|
},
|