|
@@ -137,7 +137,7 @@
|
137
|
137
|
<el-form-item :prop="'contacts.' + scope.$index + '.name'">
|
138
|
138
|
<!-- :prop="'contacts.' + scope.$index + '.name'" 如需添加可在上方标签加入 -->
|
139
|
139
|
<el-select
|
140
|
|
- v-model="scope.row.isfirst"
|
|
140
|
+ v-model="scope.row.is_first"
|
141
|
141
|
style="width: 90px"
|
142
|
142
|
placeholder="请选择"
|
143
|
143
|
@change="changeName($event, scope)"
|
|
@@ -214,7 +214,7 @@ import {
|
214
|
214
|
delcontactone,
|
215
|
215
|
savesupply,
|
216
|
216
|
updatesupply,
|
217
|
|
- getexporthistory
|
|
217
|
+ getexporthistory,
|
218
|
218
|
} from "@/api/supply";
|
219
|
219
|
import Template from "../../data/template.vue";
|
220
|
220
|
export default {
|
|
@@ -273,8 +273,8 @@ export default {
|
273
|
273
|
supplier: {
|
274
|
274
|
supplierName: "",
|
275
|
275
|
supplierCode: "gsy001",
|
276
|
|
- supplierType: "",
|
277
|
|
- vatRate: "",
|
|
276
|
+ supplierType: 0,
|
|
277
|
+ vatRate: 0,
|
278
|
278
|
number: "",
|
279
|
279
|
bank: "",
|
280
|
280
|
bankAccount: "",
|
|
@@ -289,29 +289,24 @@ export default {
|
289
|
289
|
},
|
290
|
290
|
created() {},
|
291
|
291
|
methods: {
|
292
|
|
-
|
293
|
|
-
|
294
|
|
-
|
295
|
292
|
show(data, type) {
|
296
|
293
|
if (type == 1) {
|
297
|
294
|
this.initSupplierData();
|
298
|
295
|
this.show_type = 1;
|
299
|
296
|
this.title = "新增供应商";
|
300
|
297
|
this.dialogVisible = true;
|
301
|
|
-
|
302
|
|
-
|
303
|
298
|
} else if (type == 2) {
|
304
|
299
|
// console.log(data,'oop')
|
305
|
300
|
this.show_type = 2;
|
306
|
|
- // this.supplier_ids = data.ID;
|
|
301
|
+ this.supplier_ids = data.ID;
|
307
|
302
|
this.title = "编辑供应商";
|
308
|
|
- // this.supplier.supplierCode = data.SupplierCode;
|
309
|
|
- // this.supplier.supplierName = data.SupplierName;
|
310
|
|
- // this.supplier.supplierType = data.SupplierType;
|
311
|
|
- // this.supplier.vatRate = data.VatRate;
|
312
|
|
- // this.supplier.number = data.Number;
|
313
|
|
- // this.supplier.bank = data.Bank;
|
314
|
|
- // this.supplier.bankAccount = data.BankAccount;
|
|
303
|
+ this.supplier.supplierCode = data.SupplierCode;
|
|
304
|
+ this.supplier.supplierName = data.SupplierName;
|
|
305
|
+ this.supplier.supplierType = data.SupplierType;
|
|
306
|
+ this.supplier.vatRate = data.VatRate;
|
|
307
|
+ this.supplier.number = data.Number;
|
|
308
|
+ this.supplier.bank = data.Bank;
|
|
309
|
+ this.supplier.bankAccount = data.BankAccount;
|
315
|
310
|
this.getcontacts(data.ID);
|
316
|
311
|
this.dialogVisible = true;
|
317
|
312
|
}
|
|
@@ -383,27 +378,24 @@ export default {
|
383
|
378
|
this.$refs[formName].validate((valid) => {
|
384
|
379
|
if (valid) {
|
385
|
380
|
let params = {
|
386
|
|
- suppliercode: this.supplier.supplierCode,
|
387
|
|
- suppliername: this.supplier.supplierName,
|
388
|
|
- // ...this.recordInfo
|
389
|
|
- id: parseInt(this.supplier_ids),
|
390
|
|
- // id:JSON.parse(this.supplier_ids),
|
391
|
|
- suppliertype: this.supplier.supplierType,
|
392
|
|
- vatrate: this.supplier.vatRate,
|
393
|
|
- number: this.supplier.number,
|
394
|
|
- bank: this.supplier.bank,
|
395
|
|
- bankaccount: this.supplier.bankAccount,
|
|
381
|
+ suppliercode: this.supplier.supplierCode || "",
|
|
382
|
+ suppliername: this.supplier.supplierName || "",
|
|
383
|
+ suppliertype: this.supplier.supplierType || 0,
|
|
384
|
+ vatrate: this.supplier.vatRate || 0,
|
|
385
|
+ number: this.supplier.number || "",
|
|
386
|
+ bank: this.supplier.bank || "",
|
|
387
|
+ bankaccount: this.supplier.bankAccount || "",
|
396
|
388
|
contacts: [...this.recordInfo.contacts],
|
397
|
389
|
};
|
398
|
390
|
savesupply(params).then((res) => {
|
399
|
391
|
console.log(res, "op");
|
400
|
392
|
if (res.data.list == "修改成功") {
|
401
|
393
|
this.$message.success("修改成功");
|
402
|
|
- this.closePop()
|
|
394
|
+ this.closePop();
|
403
|
395
|
} else {
|
404
|
396
|
this.$message.error("修改失败");
|
405
|
397
|
setTimeout(() => {
|
406
|
|
- this.closePop()
|
|
398
|
+ this.closePop();
|
407
|
399
|
}, 2000);
|
408
|
400
|
}
|
409
|
401
|
});
|
|
@@ -421,26 +413,26 @@ export default {
|
421
|
413
|
this.$refs[formName].validate((valid) => {
|
422
|
414
|
if (valid) {
|
423
|
415
|
let params = {
|
424
|
|
- suppliercode: this.supplier.supplierCode,
|
425
|
|
- suppliername: this.supplier.supplierName,
|
426
|
|
- id: this.supplier_ids,
|
427
|
|
- suppliertype: this.supplier.supplierType,
|
428
|
|
- vatrate: this.supplier.vatRate,
|
429
|
|
- number: this.supplier.number,
|
430
|
|
- bank: this.supplier.bank,
|
431
|
|
- bankaccount: this.supplier.bankAccount,
|
|
416
|
+ suppliercode: this.supplier.supplierCode || "",
|
|
417
|
+ suppliername: this.supplier.supplierName || "",
|
|
418
|
+ id: this.supplier_ids || "",
|
|
419
|
+ suppliertype: this.supplier.supplierType || "",
|
|
420
|
+ vatrate: this.supplier.vatRate || 0,
|
|
421
|
+ number: this.supplier.number || "",
|
|
422
|
+ bank: this.supplier.bank || "",
|
|
423
|
+ bankaccount: this.supplier.bankAccount || "",
|
432
|
424
|
contacts: [...this.recordInfo.contacts],
|
433
|
425
|
};
|
434
|
|
- console.log(params,'params')
|
|
426
|
+ console.log(params, "params");
|
435
|
427
|
updatesupply(params).then((res) => {
|
436
|
428
|
console.log(res, "op");
|
437
|
429
|
if (res.data.list == "修改成功") {
|
438
|
430
|
this.$message.success("修改成功");
|
439
|
|
- this.closePop()
|
|
431
|
+ this.closePop();
|
440
|
432
|
} else {
|
441
|
433
|
this.$message.error("修改失败");
|
442
|
434
|
setTimeout(() => {
|
443
|
|
- this.closePop()
|
|
435
|
+ this.closePop();
|
444
|
436
|
}, 2000);
|
445
|
437
|
}
|
446
|
438
|
});
|
|
@@ -456,7 +448,7 @@ export default {
|
456
|
448
|
this.contactsinfo();
|
457
|
449
|
},
|
458
|
450
|
|
459
|
|
- // 首次打开新增页面判断是否有首要联系人
|
|
451
|
+ // 获取供应商与联系人 首次打开新增页面判断是否有首要联系人
|
460
|
452
|
getcontacts(val) {
|
461
|
453
|
let data = {
|
462
|
454
|
value: 1,
|
|
@@ -465,27 +457,24 @@ export default {
|
465
|
457
|
getsupplyandcontactone({ id: val }).then((res) => {
|
466
|
458
|
if (res.data.code == 0) {
|
467
|
459
|
this.recordInfo.contacts = res.data.data.contact;
|
468
|
|
- this.supplier = res.data.data.supply
|
469
|
|
- this.supplier_ids = res.data.data.supply.ID;
|
|
460
|
+ console.log(this.recordInfo.contacts,'supply')
|
470
|
461
|
if (this.recordInfo.contacts.length == 0) {
|
471
|
462
|
this.recordInfo.contacts = [{}];
|
472
|
|
- this.recordInfo.contacts[0].isfirst = data.value;
|
|
463
|
+ this.recordInfo.contacts[0].is_first = data.value;
|
473
|
464
|
} else if (this.recordInfo.contacts.length == 1) {
|
474
|
465
|
let val = res.data.data.contact[0];
|
475
|
|
- this.recordInfo.contacts[0].isfirst = data.value;
|
|
466
|
+ this.recordInfo.contacts[0].is_first = data.value;
|
476
|
467
|
this.recordInfo.contacts[0] = {
|
477
|
468
|
id: val.id,
|
478
|
469
|
name: val.name,
|
479
|
470
|
address: val.address,
|
480
|
471
|
phone: val.phone,
|
481
|
|
- // isfirst: val.is_first,
|
482
|
472
|
};
|
483
|
|
- this.$forceUpdate()
|
|
473
|
+ this.$forceUpdate();
|
484
|
474
|
} else {
|
485
|
475
|
this.recordInfo.contacts.forEach((o) => {
|
486
|
476
|
if (o.isfirst == 0) {
|
487
|
477
|
} else if (o.isfirst == 1) {
|
488
|
|
-
|
489
|
478
|
}
|
490
|
479
|
});
|
491
|
480
|
}
|
|
@@ -505,20 +494,20 @@ export default {
|
505
|
494
|
};
|
506
|
495
|
let arr = [];
|
507
|
496
|
if (this.recordInfo.contacts.length <= 1) {
|
508
|
|
- this.recordInfo.contacts[0].isfirst = data2.value;
|
|
497
|
+ this.recordInfo.contacts[0].is_first = data2.value;
|
509
|
498
|
} else {
|
510
|
499
|
this.recordInfo.contacts.forEach((el, index) => {
|
511
|
500
|
if (scope.$index == index) {
|
512
|
|
- el.isfirst = data;
|
|
501
|
+ el.is_first = data;
|
513
|
502
|
} else {
|
514
|
|
- el.isfirst = data1.value;
|
|
503
|
+ el.is_first = data1.value;
|
515
|
504
|
}
|
516
|
|
- arr.push(el.isfirst);
|
|
505
|
+ arr.push(el.is_first);
|
517
|
506
|
});
|
518
|
507
|
if (arr.includes(1)) {
|
519
|
508
|
return;
|
520
|
509
|
} else {
|
521
|
|
- this.recordInfo.contacts[0].isfirst = data2.value;
|
|
510
|
+ this.recordInfo.contacts[0].is_first = data2.value;
|
522
|
511
|
}
|
523
|
512
|
}
|
524
|
513
|
},
|