|
@@ -35,7 +35,10 @@
|
35
|
35
|
</el-col>
|
36
|
36
|
<el-col span="6">
|
37
|
37
|
<el-form-item label="增值税税率" prop="vatRate">
|
38
|
|
- <el-input v-model="supplier.vatRate"></el-input>
|
|
38
|
+ <el-input
|
|
39
|
+ v-model="supplier.vatRate"
|
|
40
|
+ @keyup.native="supplier.vatRate = oninput(supplier.vatRate)"
|
|
41
|
+ ></el-input>
|
39
|
42
|
</el-form-item>
|
40
|
43
|
</el-col>
|
41
|
44
|
</el-row>
|
|
@@ -111,6 +114,13 @@
|
111
|
114
|
<div style="visibility: hidden">/</div>
|
112
|
115
|
</template>
|
113
|
116
|
</el-table-column>
|
|
117
|
+ <!-- id填写======================================================= -->
|
|
118
|
+ <el-table-column label="id" v-if="false">
|
|
119
|
+ <template slot-scope="scope">
|
|
120
|
+ <el-input v-model="scope.row.id" style="width: 80px"></el-input>
|
|
121
|
+ <div style="visibility: hidden">/</div>
|
|
122
|
+ </template>
|
|
123
|
+ </el-table-column>
|
114
|
124
|
<!-- 联系地址填写 -->
|
115
|
125
|
<el-table-column label="联系地址" align="center" width="130px">
|
116
|
126
|
<template slot-scope="scope">
|
|
@@ -130,7 +140,7 @@
|
130
|
140
|
<el-form-item :prop="'contacts.' + scope.$index + '.name'">
|
131
|
141
|
<!-- :prop="'contacts.' + scope.$index + '.name'" 如需添加可在上方标签加入 -->
|
132
|
142
|
<el-select
|
133
|
|
- v-model="scope.row.isfirst"
|
|
143
|
+ v-model="scope.row.is_first"
|
134
|
144
|
style="width: 90px"
|
135
|
145
|
placeholder="请选择"
|
136
|
146
|
@change="changeName($event, scope)"
|
|
@@ -207,6 +217,7 @@ import {
|
207
|
217
|
delcontactone,
|
208
|
218
|
savesupply,
|
209
|
219
|
updatesupply,
|
|
220
|
+ getexporthistory,
|
210
|
221
|
} from "@/api/supply";
|
211
|
222
|
import Template from "../../data/template.vue";
|
212
|
223
|
export default {
|
|
@@ -253,6 +264,7 @@ export default {
|
253
|
264
|
},
|
254
|
265
|
tableData: [
|
255
|
266
|
{
|
|
267
|
+ id: "",
|
256
|
268
|
contacts: "",
|
257
|
269
|
phone: "",
|
258
|
270
|
address: "",
|
|
@@ -264,8 +276,8 @@ export default {
|
264
|
276
|
supplier: {
|
265
|
277
|
supplierName: "",
|
266
|
278
|
supplierCode: "gsy001",
|
267
|
|
- supplierType: "",
|
268
|
|
- vatRate: "",
|
|
279
|
+ supplierType: 0,
|
|
280
|
+ vatRate: 0,
|
269
|
281
|
number: "",
|
270
|
282
|
bank: "",
|
271
|
283
|
bankAccount: "",
|
|
@@ -287,6 +299,7 @@ export default {
|
287
|
299
|
this.title = "新增供应商";
|
288
|
300
|
this.dialogVisible = true;
|
289
|
301
|
} else if (type == 2) {
|
|
302
|
+ // console.log(data,'oop')
|
290
|
303
|
this.show_type = 2;
|
291
|
304
|
this.supplier_ids = data.ID;
|
292
|
305
|
this.title = "编辑供应商";
|
|
@@ -301,6 +314,32 @@ export default {
|
301
|
314
|
this.dialogVisible = true;
|
302
|
315
|
}
|
303
|
316
|
},
|
|
317
|
+
|
|
318
|
+ oninput(num) {
|
|
319
|
+ var str = num;
|
|
320
|
+ var len1 = str.substr(0, 1);
|
|
321
|
+ var len2 = str.substr(1, 1);
|
|
322
|
+ //如果第一位是0,第二位不是点,就用数字把点替换掉
|
|
323
|
+ if (str.length > 1 && len1 == 0 && len2 != ".") {
|
|
324
|
+ str = str.substr(1, 1);
|
|
325
|
+ }
|
|
326
|
+ //第一位不能是.
|
|
327
|
+ if (len1 == ".") {
|
|
328
|
+ str = "";
|
|
329
|
+ }
|
|
330
|
+ //限制只能输入一个小数点
|
|
331
|
+ if (str.indexOf(".") != -1) {
|
|
332
|
+ var str_ = str.substr(str.indexOf(".") + 1);
|
|
333
|
+ if (str_.indexOf(".") != -1) {
|
|
334
|
+ str = str.substr(0, str.indexOf(".") + str_.indexOf(".") + 1);
|
|
335
|
+ }
|
|
336
|
+ }
|
|
337
|
+ //正则替换
|
|
338
|
+ str = str.replace(/[^\d^\.]+/g, ""); // 保留数字和小数点
|
|
339
|
+ str = str.replace(/\.\d\d\d\d$/, ""); // 小数点后只能输两位
|
|
340
|
+ return str;
|
|
341
|
+ },
|
|
342
|
+
|
304
|
343
|
closePop() {
|
305
|
344
|
this.dialogVisible = false;
|
306
|
345
|
this.supply_code = [];
|
|
@@ -367,27 +406,43 @@ export default {
|
367
|
406
|
if (valid) {
|
368
|
407
|
this.$refs[formName].validate((valid) => {
|
369
|
408
|
if (valid) {
|
|
409
|
+ this.recordInfo.contacts.forEach((el) => {
|
|
410
|
+ if (!el.phone) {
|
|
411
|
+ el.phone = "";
|
|
412
|
+ }
|
|
413
|
+ if (!el.address) {
|
|
414
|
+ el.address = "";
|
|
415
|
+ }
|
|
416
|
+ if (!el.id) {
|
|
417
|
+ el.id = 0;
|
|
418
|
+ }
|
|
419
|
+ });
|
370
|
420
|
let params = {
|
371
|
|
- suppliercode: this.supplier.supplierCode,
|
372
|
|
- suppliername: this.supplier.supplierName,
|
373
|
|
- // ...this.recordInfo
|
374
|
|
- id: parseInt(this.supplier_ids),
|
375
|
|
- // id:JSON.parse(this.supplier_ids),
|
376
|
|
- suppliertype: "",
|
377
|
|
- vatrate: "",
|
378
|
|
- number: "",
|
379
|
|
- bank: "",
|
380
|
|
- bankaccount: "",
|
|
421
|
+ suppliercode: this.supplier.supplierCode || "",
|
|
422
|
+ suppliername: this.supplier.supplierName || "",
|
|
423
|
+ suppliertype: this.supplier.supplierType || 0,
|
|
424
|
+ vatrate: this.supplier.vatRate || 0,
|
|
425
|
+ number: this.supplier.number || "",
|
|
426
|
+ bank: this.supplier.bank || "",
|
|
427
|
+ bankaccount: this.supplier.bankAccount || "",
|
381
|
428
|
contacts: [...this.recordInfo.contacts],
|
382
|
429
|
};
|
383
|
|
- console.log(params, "dhas");
|
384
|
|
- savesupply(params).then((res) => {});
|
|
430
|
+ savesupply(params).then((res) => {
|
|
431
|
+ if (res.data.state == 1) {
|
|
432
|
+ this.$message.success("修改成功");
|
|
433
|
+ this.closePop();
|
|
434
|
+ this.$emit("init");
|
|
435
|
+ } else {
|
|
436
|
+ this.$message.error("修改失败");
|
|
437
|
+ setTimeout(() => {
|
|
438
|
+ this.closePop();
|
|
439
|
+ }, 2000);
|
|
440
|
+ }
|
|
441
|
+ });
|
385
|
442
|
} else {
|
386
|
443
|
return false;
|
387
|
444
|
}
|
388
|
445
|
});
|
389
|
|
-
|
390
|
|
- this.dialogVisible = false;
|
391
|
446
|
} else {
|
392
|
447
|
return false;
|
393
|
448
|
}
|
|
@@ -397,30 +452,45 @@ export default {
|
397
|
452
|
if (valid) {
|
398
|
453
|
this.$refs[formName].validate((valid) => {
|
399
|
454
|
if (valid) {
|
|
455
|
+ this.recordInfo.contacts.forEach((el) => {
|
|
456
|
+ if (!el.phone) {
|
|
457
|
+ el.phone = "";
|
|
458
|
+ }
|
|
459
|
+ if (!el.address) {
|
|
460
|
+ el.address = "";
|
|
461
|
+ }
|
|
462
|
+ if (!el.id) {
|
|
463
|
+ el.id = 0;
|
|
464
|
+ }
|
|
465
|
+ });
|
400
|
466
|
let params = {
|
401
|
|
- suppliercode: this.supplier.supplierCode,
|
402
|
|
- suppliername: this.supplier.supplierName,
|
403
|
|
- // ...this.recordInfo
|
404
|
|
- id: parseInt(this.supplier_ids),
|
405
|
|
- // id:JSON.parse(this.supplier_ids),
|
406
|
|
- suppliertype: "",
|
407
|
|
- vatrate: "",
|
408
|
|
- number: "",
|
409
|
|
- bank: "",
|
410
|
|
- bankaccount: "",
|
|
467
|
+ suppliercode: this.supplier.supplierCode || "",
|
|
468
|
+ suppliername: this.supplier.supplierName || "",
|
|
469
|
+ id: this.supplier.id|| 0,
|
|
470
|
+ suppliertype: this.supplier.supplierType || "",
|
|
471
|
+ vatrate: this.supplier.vatRate || 0,
|
|
472
|
+ number: this.supplier.number || "",
|
|
473
|
+ bank: this.supplier.bank || "",
|
|
474
|
+ bankaccount: this.supplier.bankAccount || "",
|
411
|
475
|
contacts: [...this.recordInfo.contacts],
|
412
|
476
|
};
|
413
|
|
- console.log(this.recordInfo, "dhas");
|
414
|
|
- console.log(typeof this.supplier_ids, "oo");
|
|
477
|
+
|
415
|
478
|
updatesupply(params).then((res) => {
|
416
|
|
- console.log(res, "oo");
|
|
479
|
+ if (res.data.state == 1) {
|
|
480
|
+ this.$message.success("修改成功");
|
|
481
|
+ this.closePop();
|
|
482
|
+ this.$emit("init");
|
|
483
|
+ } else {
|
|
484
|
+ this.$message.error("修改失败");
|
|
485
|
+ setTimeout(() => {
|
|
486
|
+ this.closePop();
|
|
487
|
+ }, 2000);
|
|
488
|
+ }
|
417
|
489
|
});
|
418
|
490
|
} else {
|
419
|
491
|
return false;
|
420
|
492
|
}
|
421
|
493
|
});
|
422
|
|
-
|
423
|
|
- this.dialogVisible = false;
|
424
|
494
|
} else {
|
425
|
495
|
return false;
|
426
|
496
|
}
|
|
@@ -429,10 +499,10 @@ export default {
|
429
|
499
|
this.contactsinfo();
|
430
|
500
|
},
|
431
|
501
|
|
432
|
|
- // 首次打开新增页面判断是否有首要联系人
|
|
502
|
+ // 获取供应商与联系人 首次打开新增页面判断是否有首要联系人
|
433
|
503
|
getcontacts(val) {
|
434
|
504
|
let data = {
|
435
|
|
- value: 0,
|
|
505
|
+ value: 1,
|
436
|
506
|
label: "是",
|
437
|
507
|
};
|
438
|
508
|
getsupplyandcontactone({ id: val }).then((res) => {
|
|
@@ -440,22 +510,21 @@ export default {
|
440
|
510
|
this.recordInfo.contacts = res.data.data.contact;
|
441
|
511
|
if (this.recordInfo.contacts.length == 0) {
|
442
|
512
|
this.recordInfo.contacts = [{}];
|
443
|
|
- this.recordInfo.contacts[0].isfirst = data;
|
|
513
|
+ this.recordInfo.contacts[0].is_first = data.value;
|
444
|
514
|
} else if (this.recordInfo.contacts.length == 1) {
|
445
|
515
|
let val = res.data.data.contact[0];
|
446
|
|
- this.recordInfo.contacts[0].isfirst = data;
|
|
516
|
+ this.recordInfo.contacts[0].is_first = data.value;
|
447
|
517
|
this.recordInfo.contacts[0] = {
|
|
518
|
+ id: val.id,
|
448
|
519
|
name: val.name,
|
449
|
520
|
address: val.address,
|
450
|
521
|
phone: val.phone,
|
451
|
|
- isfirst: val.is_first,
|
452
|
522
|
};
|
|
523
|
+ this.$forceUpdate();
|
453
|
524
|
} else {
|
454
|
525
|
this.recordInfo.contacts.forEach((o) => {
|
455
|
526
|
if (o.isfirst == 0) {
|
456
|
|
- this.tabList.label = "否";
|
457
|
527
|
} else if (o.isfirst == 1) {
|
458
|
|
- this.tabList.label = "是";
|
459
|
528
|
}
|
460
|
529
|
});
|
461
|
530
|
}
|
|
@@ -475,21 +544,20 @@ export default {
|
475
|
544
|
};
|
476
|
545
|
let arr = [];
|
477
|
546
|
if (this.recordInfo.contacts.length <= 1) {
|
478
|
|
- this.recordInfo.contacts[0].isfirst = data2.value;
|
|
547
|
+ this.recordInfo.contacts[0].is_first = data2.value;
|
479
|
548
|
} else {
|
480
|
549
|
this.recordInfo.contacts.forEach((el, index) => {
|
481
|
|
- console.log(scope.$index, index, "oo");
|
482
|
550
|
if (scope.$index == index) {
|
483
|
|
- el.isfirst = data;
|
|
551
|
+ el.is_first = data;
|
484
|
552
|
} else {
|
485
|
|
- el.isfirst = data1.value;
|
|
553
|
+ el.is_first = data1.value;
|
486
|
554
|
}
|
487
|
|
- arr.push(el.isfirst);
|
|
555
|
+ arr.push(el.is_first);
|
488
|
556
|
});
|
489
|
557
|
if (arr.includes(1)) {
|
490
|
558
|
return;
|
491
|
559
|
} else {
|
492
|
|
- this.recordInfo.contacts[0].isfirst = data2.value;
|
|
560
|
+ this.recordInfo.contacts[0].is_first = data2.value;
|
493
|
561
|
}
|
494
|
562
|
}
|
495
|
563
|
},
|
|
@@ -535,6 +603,7 @@ export default {
|
535
|
603
|
if (
|
536
|
604
|
i.contacts != "" &&
|
537
|
605
|
i.phone != "" &&
|
|
606
|
+ i.id != "" &&
|
538
|
607
|
i.address != "" &&
|
539
|
608
|
i.FirstConcats != ""
|
540
|
609
|
) {
|
|
@@ -593,4 +662,4 @@ export default {
|
593
|
662
|
/deep/ .el-form-item__error {
|
594
|
663
|
// display: none !important;
|
595
|
664
|
}
|
596
|
|
-</style>
|
|
665
|
+</style>
|