Pārlūkot izejas kodu

修改供应商

huangyw 3 gadus atpakaļ
vecāks
revīzija
e2ce8e2082

+ 59 - 42
src/xt_pages/supply/components/addSupply.vue Parādīt failu

@@ -114,10 +114,7 @@
114 114
           <!-- id填写======================================================= -->
115 115
           <el-table-column label="id" v-if="false">
116 116
             <template slot-scope="scope">
117
-              <el-input
118
-                v-model="scope.row.id"
119
-                style="width: 80px"
120
-              ></el-input>
117
+              <el-input v-model="scope.row.id" style="width: 80px"></el-input>
121 118
               <div style="visibility: hidden">/</div>
122 119
             </template>
123 120
           </el-table-column>
@@ -217,6 +214,7 @@ import {
217 214
   delcontactone,
218 215
   savesupply,
219 216
   updatesupply,
217
+  getexporthistory
220 218
 } from "@/api/supply";
221 219
 import Template from "../../data/template.vue";
222 220
 export default {
@@ -263,7 +261,7 @@ export default {
263 261
       },
264 262
       tableData: [
265 263
         {
266
-          id:"",
264
+          id: "",
267 265
           contacts: "",
268 266
           phone: "",
269 267
           address: "",
@@ -291,23 +289,29 @@ export default {
291 289
   },
292 290
   created() {},
293 291
   methods: {
292
+ 
293
+
294
+
294 295
     show(data, type) {
295 296
       if (type == 1) {
296 297
         this.initSupplierData();
297 298
         this.show_type = 1;
298 299
         this.title = "新增供应商";
299 300
         this.dialogVisible = true;
301
+
302
+
300 303
       } else if (type == 2) {
304
+        // console.log(data,'oop')
301 305
         this.show_type = 2;
302
-        this.supplier_ids = data.ID;
306
+        // this.supplier_ids = data.ID;
303 307
         this.title = "编辑供应商";
304
-        this.supplier.supplierCode = data.SupplierCode;
305
-        this.supplier.supplierName = data.SupplierName;
306
-        this.supplier.supplierType = data.SupplierType;
307
-        this.supplier.vatRate = data.VatRate;
308
-        this.supplier.number = data.Number;
309
-        this.supplier.bank = data.Bank;
310
-        this.supplier.bankAccount = data.BankAccount;
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;
311 315
         this.getcontacts(data.ID);
312 316
         this.dialogVisible = true;
313 317
       }
@@ -384,21 +388,29 @@ export default {
384 388
                   // ...this.recordInfo
385 389
                   id: parseInt(this.supplier_ids),
386 390
                   // id:JSON.parse(this.supplier_ids),
387
-                  suppliertype: "",
388
-                  vatrate: "",
389
-                  number: "",
390
-                  bank: "",
391
-                  bankaccount: "",
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,
392 396
                   contacts: [...this.recordInfo.contacts],
393 397
                 };
394
-                console.log(params, "dhas");
395
-                savesupply(params).then((res) => {});
398
+                savesupply(params).then((res) => {
399
+                  console.log(res, "op");
400
+                  if (res.data.list == "修改成功") {
401
+                    this.$message.success("修改成功");
402
+                    this.closePop()
403
+                  } else {
404
+                    this.$message.error("修改失败");
405
+                    setTimeout(() => {
406
+                      this.closePop()
407
+                    }, 2000);
408
+                  }
409
+                });
396 410
               } else {
397 411
                 return false;
398 412
               }
399 413
             });
400
-
401
-            this.dialogVisible = false;
402 414
           } else {
403 415
             return false;
404 416
           }
@@ -411,27 +423,31 @@ export default {
411 423
                 let params = {
412 424
                   suppliercode: this.supplier.supplierCode,
413 425
                   suppliername: this.supplier.supplierName,
414
-                  // ...this.recordInfo
415
-                  id: parseInt(this.supplier_ids),
416
-                  // id:JSON.parse(this.supplier_ids),
417
-                  suppliertype: "",
418
-                  vatrate: "",
419
-                  number: "",
420
-                  bank: "",
421
-                  bankaccount: "",
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,
422 432
                   contacts: [...this.recordInfo.contacts],
423 433
                 };
424
-                console.log(this.recordInfo, "dhas");
425
-                console.log(typeof this.supplier_ids, "oo");
434
+                console.log(params,'params')
426 435
                 updatesupply(params).then((res) => {
427
-                  console.log(res, "oo");
436
+                  console.log(res, "op");
437
+                  if (res.data.list == "修改成功") {
438
+                    this.$message.success("修改成功");
439
+                    this.closePop()
440
+                  } else {
441
+                    this.$message.error("修改失败");
442
+                    setTimeout(() => {
443
+                      this.closePop()
444
+                    }, 2000);
445
+                  }
428 446
                 });
429 447
               } else {
430 448
                 return false;
431 449
               }
432 450
             });
433
-
434
-            this.dialogVisible = false;
435 451
           } else {
436 452
             return false;
437 453
           }
@@ -443,31 +459,33 @@ export default {
443 459
     // 首次打开新增页面判断是否有首要联系人
444 460
     getcontacts(val) {
445 461
       let data = {
446
-        value: 0,
462
+        value: 1,
447 463
         label: "是",
448 464
       };
449 465
       getsupplyandcontactone({ id: val }).then((res) => {
450 466
         if (res.data.code == 0) {
451 467
           this.recordInfo.contacts = res.data.data.contact;
468
+          this.supplier = res.data.data.supply
469
+          this.supplier_ids = res.data.data.supply.ID;
452 470
           if (this.recordInfo.contacts.length == 0) {
453 471
             this.recordInfo.contacts = [{}];
454
-            this.recordInfo.contacts[0].isfirst = data;
472
+            this.recordInfo.contacts[0].isfirst = data.value;
455 473
           } else if (this.recordInfo.contacts.length == 1) {
456 474
             let val = res.data.data.contact[0];
457
-            this.recordInfo.contacts[0].isfirst = data;
475
+            this.recordInfo.contacts[0].isfirst = data.value;
458 476
             this.recordInfo.contacts[0] = {
459 477
               id: val.id,
460 478
               name: val.name,
461 479
               address: val.address,
462 480
               phone: val.phone,
463
-              isfirst: val.is_first,
481
+              // isfirst: val.is_first,
464 482
             };
483
+            this.$forceUpdate()
465 484
           } else {
466 485
             this.recordInfo.contacts.forEach((o) => {
467 486
               if (o.isfirst == 0) {
468
-                this.tabList.label = "否";
469 487
               } else if (o.isfirst == 1) {
470
-                this.tabList.label = "是";
488
+                
471 489
               }
472 490
             });
473 491
           }
@@ -490,7 +508,6 @@ export default {
490 508
         this.recordInfo.contacts[0].isfirst = data2.value;
491 509
       } else {
492 510
         this.recordInfo.contacts.forEach((el, index) => {
493
-          console.log(scope.$index, index, "oo");
494 511
           if (scope.$index == index) {
495 512
             el.isfirst = data;
496 513
           } else {

+ 10 - 1
src/xt_pages/supply/supplyQuery.vue Parādīt failu

@@ -28,13 +28,21 @@
28 28
             </el-option>
29 29
           </el-select>
30 30
 
31
+          <el-input
32
+            size="small"
33
+            style="width: 200px; margin-left: 10px"
34
+            class="filter-item"
35
+            v-model.trim="keywords"
36
+            placeholder="按供应商编号,供应商名称,联系人搜索"
37
+          />
38
+
31 39
           <el-button
32 40
             size="small"
33 41
             class="filter-item"
34 42
             type="primary"
35 43
             icon="el-icon-search"
36 44
             @click="search"
37
-            >搜索</el-button
45
+            >查询</el-button
38 46
           >
39 47
         </div>
40 48
         <div>
@@ -204,6 +212,7 @@ export default {
204 212
       };
205 213
       getexporthistory(params).then((res) => {
206 214
         if (res.data.state == 1) {
215
+          console.log(res.data.data.list, "res.data.data.list");
207 216
           this.tableList = res.data.data.list;
208 217
           this.total = res.data.data.total;
209 218
         }