Browse Source

Merge branch '20201109_pc_vue_new_branch' of http://git.shengws.com/csx/Vue_New into 20201109_pc_vue_new_branch

csx 3 years ago
parent
commit
8d9a8a9787

+ 79 - 50
src/api/supply.js View File

@@ -157,56 +157,58 @@ export function getAllGoodReturnOrderList(params) {
157 157
     url: '/api/supply/getallgoodreturnorderlist',
158 158
     method: 'get',
159 159
     params: params
160
-  })}
161
-
162
-
163
-  export function getSupplierId(params) {
164
-    return request({
165
-      url: '/api/supply/getsupplycode',
166
-      method: 'get',
167
-      params: params
168
-    })
169
-  }
170
-
171
-  export function getsupplytype(params) {
172
-    return request({
173
-      url: '/api/supply/getsupplytype',
174
-      method: 'get',
175
-      params: params
176
-    })
177
-  }
178
-
179
-  export function getGoodReturnDetail(id, params) {
180
-    return request({
181
-      url: '/api/supply/getgoodreturndetail?id=' + id,
182
-      method: 'get',
183
-      params: params
184
-    })}
185
-
186
-
187
-    export function getexporthistory(params) {
188
-      return request({
189
-        url: '/api/supply/getsupplylist',
190
-        method: 'get',
191
-        params: params
192
-      })
193
-    }
194
-
195
-    export function delsupplys(id, data) {
196
-      return request({
197
-        url: '/api/supply/delsupply?id=' + id,
198
-        method: 'post',
199
-        data: data
200
-      })
201
-    }
202
-
203
-    export function getsupplyandcontactone(params) {
204
-      return request({
205
-        url: '/api/supply/getsupplyandcontactone',
206
-        method: 'get',
207
-        params: params
208
-      })
209
-    }
160
+  })
161
+}
162
+
163
+
164
+export function getSupplierId(params) {
165
+  return request({
166
+    url: '/api/supply/getsupplycode',
167
+    method: 'get',
168
+    params: params
169
+  })
170
+}
171
+
172
+export function getsupplytype(params) {
173
+  return request({
174
+    url: '/api/supply/getsupplytype',
175
+    method: 'get',
176
+    params: params
177
+  })
178
+}
179
+
180
+export function getGoodReturnDetail(id, params) {
181
+  return request({
182
+    url: '/api/supply/getgoodreturndetail?id=' + id,
183
+    method: 'get',
184
+    params: params
185
+  })
186
+}
187
+
188
+
189
+export function getexporthistory(params) {
190
+  return request({
191
+    url: '/api/supply/getsupplylist',
192
+    method: 'get',
193
+    params: params
194
+  })
195
+}
196
+
197
+export function delsupplys(id, data) {
198
+  return request({
199
+    url: '/api/supply/delsupply?id=' + id,
200
+    method: 'post',
201
+    data: data
202
+  })
203
+}
204
+
205
+export function getsupplyandcontactone(params) {
206
+  return request({
207
+    url: '/api/supply/getsupplyandcontactone',
208
+    method: 'get',
209
+    params: params
210
+  })
211
+}
210 212
 
211 213
 export function updateGoodReturn(data, warehouse_out_id, start_time, rate_of_concession, discount_amount, arrearage, payment, supplier_id, return_number) {
212 214
   return request({
@@ -247,3 +249,30 @@ export function getSupplyWarehouseOutById(id, params) {
247 249
     params: params
248 250
   })
249 251
 }
252
+
253
+export function delcontactone(params) {
254
+  return request({
255
+    url: '/api/supply/delcontactone',
256
+    method: 'get',
257
+    params: params
258
+  })
259
+}
260
+
261
+export function savesupply(data) {
262
+  return request({
263
+    url: '/api/supply/savesupply',
264
+    method: 'post',
265
+    data: data
266
+  })
267
+}
268
+
269
+export function updatesupply(data) {
270
+  return request({
271
+    url: '/api/supply/updatesupply',
272
+    method: 'post',
273
+    data: data
274
+  })
275
+}
276
+
277
+
278
+

+ 2 - 2
src/xt_pages/outpatientCharges/statementTemplate/printThree.vue View File

@@ -3,7 +3,7 @@
3 3
         <div v-if="paramsObj.balance_accounts_type != 2" id='prescription-print' class="prescription-print"
4 4
              style="position: relative;">
5 5
             <img style="width:100%;height:80px" v-if="org_id != 10278" src="https://kuyi.shengws.com/bailin/bltotle.jpg" alt="">
6
-            <img style="width:100%;height:80px" v-else src="https://kuyi.shengws.com/beierlog.png" alt="">
6
+            <img style="width:100%;height:80px" v-if="org_id == 10278" src="https://kuyi.shengws.com/beierlog.png" alt="">
7 7
             <div class="printTitle" style="position: absolute;left: 40%;top: 50px;">门诊收费清单</div>
8 8
             <div style="display:flex;">
9 9
                 <div>单据号:<span
@@ -284,7 +284,7 @@
284 284
                 </div>
285 285
             </div>
286 286
             <img style="width:100%;" v-if="org_id != 10278" src="https://kuyi.shengws.com/bailin/blend.jpg" alt="">
287
-            <img style="width:100%;" v-else src="https://kuyi.shengws.com/bailinbeier.png" alt="">
287
+            <img style="width:100%;" v-if="org_id == 10278" src="https://kuyi.shengws.com/bailinbeier.png" alt="">
288 288
         </div>
289 289
     </div>
290 290
 

+ 98 - 126
src/xt_pages/supply/components/addPurchaseOrder.vue View File

@@ -14,7 +14,7 @@
14 14
       >
15 15
         <div>
16 16
           <span style="color: red">*</span><span>供应商:</span>
17
-          <el-select cxpib`*+9.`
17
+          <el-select
18 18
             v-model="supplier_name"
19 19
             style="width: 140px; margin-right: 10px"
20 20
             placeholder="请选择"
@@ -191,7 +191,7 @@
191 191
               <div style="visibility: hidden">/</div>
192 192
             </template>
193 193
           </el-table-column>
194
-          <el-table-column label="数量" align="center" width="140px">
194
+          <el-table-column label="数量" align="center" width="180px">
195 195
             <template slot="header" slot-scope="scope">
196 196
               <span>数量<span style="color: red">*</span></span>
197 197
             </template>
@@ -199,10 +199,11 @@
199 199
               <el-form-item
200 200
                 :prop="'tableList.' + scope.$index + '.supply_count'"
201 201
                 :rules="tableRules.supply_count"
202
+                 placeholder="请输入数量"
202 203
               >
203 204
                 <el-input
204 205
                   v-model="scope.row.supply_count"
205
-                  style="width: 100px"
206
+                  style="width: 140px"
206 207
                   :disabled="disabled"
207 208
                   placeholder="请输入数量"
208 209
                 ></el-input>
@@ -210,11 +211,11 @@
210 211
             </template>
211 212
           </el-table-column>
212 213
 
213
-          <el-table-column label="采购单价" align="center" width="180px">
214
+          <el-table-column label="购货单价" align="center" width="140px">
214 215
             <template slot-scope="scope">
215 216
               <el-input
216 217
                 v-model="scope.row.supply_price"
217
-                style="width: 140px"
218
+                style="width: 80px"
218 219
                 :disabled="disabled"
219 220
                  placeholder="请输入购货单价"
220 221
               ></el-input>
@@ -309,7 +310,7 @@
309 310
             </template>
310 311
           </el-table-column>
311 312
         </el-table>
312
-        <div style="margin-top: 10px">
313
+         <div style="margin-top: 10px">
313 314
         <el-input
314 315
           type="textarea"
315 316
           :rows="2"
@@ -360,6 +361,7 @@ import {
360 361
 import { getDataConfig } from "@/utils/data";
361 362
 export default {
362 363
   name: "addPurchaseOrder",
364
+
363 365
   components: {
364 366
     BreadCrumb,
365 367
   },
@@ -428,127 +430,99 @@ export default {
428 430
     };
429 431
   },
430 432
   methods: {
431
-    getInitOrder() {
432
-      getInitOrder().then((response) => {
433
-        if (response.data.state == 1) {
434
-          var drugList = response.data.data.drugList;
435
-
436
-          this.manufactuerList = response.data.data.manufactuerList;
437
-          this.goodTypeList = response.data.data.goodTypeList;
438
-          this.drugTypeList = response.data.data.drugTypeList;
439
-          this.supplyList = response.data.data.supplyList;
440
-          for (let i = 0; i < drugList.length; i++) {
441
-            for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
442
-              drugList[i].drug_warehouse_info[z].stock_max_number =
443
-                drugList[i].drug_warehouse_info[z].stock_max_number *
444
-                drugList[i].min_number;
433
+   getInitOrder(){
434
+    getInitOrder().then(response=>{
435
+    if(response.data.state == 1){
436
+        var drugList = response.data.data.drugList
437
+        this.manufactuerList = response.data.data.manufactuerList
438
+        this.goodTypeList = response.data.data.goodTypeList
439
+        this.drugTypeList = response.data.data.drugTypeList
440
+        this.supplyList = response.data.data.supplyList
441
+       for(let i=0;i<drugList.length;i++){
442
+          for(let z=0;z<drugList[i].drug_warehouse_info.length;z++){
443
+            if(drugList[i].max_unit == drugList[i].drug_warehouse_info[z].max_unit){
444
+              drugList[i].drug_warehouse_info[z].stock_max_number = drugList[i].drug_warehouse_info[z].stock_max_number * drugList[i].min_number
445 445
             }
446
-            for (let j = 0; j < this.manufactuerList.length; j++) {
447
-              if (drugList[i].manufacturer == this.manufactuerList[j].id) {
448
-                drugList[i].manufacturer =
449
-                  this.manufactuerList[j].manufacturer_name;
450
-              }
451
-            }
452
-            for (let y = 0; y < this.drugTypeList.length; y++) {
453
-              if (drugList[i].drug_type == this.drugTypeList[y].value) {
454
-                drugList[i].drug_type = this.drugTypeList[y].name;
455
-              }
446
+          }
447
+        for(let j=0;j<this.manufactuerList.length;j++){
448
+            if(drugList[i].manufacturer == this.manufactuerList[j].id){
449
+                drugList[i].manufacturer = this.manufactuerList[j].manufacturer_name
456 450
             }
457
-            drugList[i].supply_name =
458
-              drugList[i].drug_name +
459
-              " " +
460
-              drugList[i].dose +
461
-              drugList[i].dose_unit +
462
-              "*" +
463
-              drugList[i].min_number +
464
-              drugList[i].min_unit +
465
-              "/" +
466
-              drugList[i].max_unit +
467
-              " " +
468
-              drugList[i].manufacturer;
469
-            drugList[i].supply_type = drugList[i].drug_type;
470
-            drugList[i].supply_specification_name =
471
-              drugList[i].dose +
472
-              drugList[i].dose_unit +
473
-              "*" +
474
-              drugList[i].min_number +
475
-              drugList[i].min_unit +
476
-              "/" +
477
-              drugList[i].max_unit;
478
-            drugList[i].supply_total = this.getWarehoseInfo(
479
-              drugList[i].drug_warehouse_info,
480
-              drugList[i].max_unit,
481
-              drugList[i].min_unit,
482
-              drugList[i].min_number
483
-            );
484
-            drugList[i].supply_count = "";
485
-            drugList[i].supply_total_price = "";
486
-            drugList[i].supply_manufacturer = drugList[i].manufacturer;
487
-            drugList[i].supply_license_number = drugList[i].number;
488
-            drugList[i].supply_remake = "";
489
-            drugList[i].type = 1;
490
-            drugList[i].supply_price = drugList[i].last_price;
491
-            drugList[i].name = drugList[i].drug_name;
492
-            drugList[i].supply_unit = drugList[i].max_unit;
493
-            drugList[i].unitList = [
494
-              { id: 1, name: "" },
495
-              { id: 2, name: "" },
496
-            ];
497
-            for (let j = 0; j < drugList[i].unitList.length; j++) {
498
-              drugList[i].unitList[0].name = drugList[i].max_unit;
499
-              drugList[i].unitList[1].name = drugList[i].min_unit;
451
+        }
452
+        for(let y=0;y<this.drugTypeList.length;y++){
453
+            if(drugList[i].drug_type == this.drugTypeList[y].value){
454
+            drugList[i].drug_type = this.drugTypeList[y].name
500 455
             }
501
-            this.tabList.push(drugList[i]);
456
+        }
457
+        drugList[i].supply_name =  drugList[i].drug_name + " " + drugList[i].dose +drugList[i].dose_unit+"*"+drugList[i].min_number+ drugList[i].min_unit+"/"+drugList[i].max_unit + " " + drugList[i].manufacturer
458
+        drugList[i].supply_type = drugList[i].drug_type
459
+        drugList[i].supply_specification_name = drugList[i].dose +drugList[i].dose_unit+"*"+drugList[i].min_number+ drugList[i].min_unit+"/"+drugList[i].max_unit
460
+        drugList[i].supply_total = this.getWarehoseInfo(drugList[i].drug_warehouse_info,drugList[i].max_unit,drugList[i].min_unit,drugList[i].min_number)
461
+        drugList[i].supply_count = ""
462
+        drugList[i].supply_total_price = ""
463
+        drugList[i].supply_manufacturer=  drugList[i].manufacturer
464
+        drugList[i].supply_license_number= drugList[i].number
465
+        drugList[i].supply_remake = ""
466
+        drugList[i].type = 1
467
+        drugList[i].supply_price = drugList[i].last_price
468
+        drugList[i].name = drugList[i].drug_name
469
+        if(drugList[i].max_unit!=drugList[i].min_unit){
470
+          drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
471
+        }
472
+        if(drugList[i].max_unit == drugList[i].min_unit){
473
+          drugList[i].unitList = [{id:1,name:""}]
474
+        }
475
+      
476
+        drugList[i].supply_unit = drugList[i].max_unit 
477
+        for(let j=0;j<drugList[i].unitList.length;j++){
478
+          if(drugList[i].max_unit!=drugList[i].min_unit){
479
+            drugList[i].unitList[0].name = drugList[i].max_unit
480
+            drugList[i].unitList[1].name = drugList[i].min_unit
502 481
           }
503
-          this.drugList = drugList;
504
-          var goodList = response.data.data.goodList;
505
-
506
-          for (let i = 0; i < goodList.length; i++) {
507
-            for (let j = 0; j < this.manufactuerList.length; j++) {
508
-              if (goodList[i].manufacturer == this.manufactuerList[j].id) {
509
-                goodList[i].manufacturer =
510
-                  this.manufactuerList[j].manufacturer_name;
511
-              }
512
-            }
513
-            for (let y = 0; y < this.goodTypeList.length; y++) {
514
-              if (goodList[i].good_type_id == this.goodTypeList[y].id) {
515
-                goodList[i].good_type_id = this.goodTypeList[y].type_name;
516
-              }
482
+          if(drugList[i].max_unit ==drugList[i].min_unit){
483
+            drugList[i].unitList[0].name = drugList[i].max_unit
484
+          }
485
+         
486
+        }
487
+        this.tabList.push(drugList[i])
488
+        }
489
+        this.drugList = drugList
490
+        var goodList =  response.data.data.goodList
491
+        for(let i=0;i<goodList.length;i++){
492
+        for(let j=0;j<this.manufactuerList.length;j++){
493
+            if(goodList[i].manufacturer == this.manufactuerList[j].id){
494
+                goodList[i].manufacturer = this.manufactuerList[j].manufacturer_name
517 495
             }
518
-            goodList[i].supply_name =
519
-              goodList[i].good_name +
520
-              " " +
521
-              goodList[i].specification_name +
522
-              " " +
523
-              goodList[i].manufacturer;
524
-            goodList[i].supply_type = goodList[i].good_type_id;
525
-            goodList[i].supply_specification_name =
526
-              goodList[i].specification_name;
527
-            goodList[i].supply_price = goodList[i].buy_price;
528
-            goodList[i].supply_total = this.getTotalStockCount(
529
-              goodList[i].good_warehouse_info
530
-            );
531
-            goodList[i].supply_count = "";
532
-            goodList[i].supply_total_price = "";
533
-            goodList[i].supply_manufacturer = goodList[i].manufacturer;
534
-            goodList[i].supply_license_number = "";
535
-            goodList[i].supply_remake = "";
536
-            goodList[i].type = 2;
537
-            goodList[i].name = goodList[i].good_name;
538
-            goodList[i].supply_unit = goodList[i].packing_unit;
539
-            goodList[i].unitList = [
540
-              { id: 1, name: "" },
541
-              { id: 2, name: "" },
542
-            ];
543
-            for (let j = 0; j < goodList[i].unitList.length; j++) {
544
-              goodList[i].unitList[0].name = goodList[i].packing_unit;
496
+        }
497
+        for(let y=0;y<this.goodTypeList.length;y++){
498
+            if(goodList[i].good_type_id == this.goodTypeList[y].id){
499
+                goodList[i].good_type_id = this.goodTypeList[y].type_name
545 500
             }
546
-            this.tabList.push(goodList[i]);
547
-          }
548
-          this.goodList = goodList;
549 501
         }
550
-      });
551
-    },
502
+        goodList[i].supply_name = goodList[i].good_name + " " + goodList[i].specification_name + " " +goodList[i].manufacturer
503
+        goodList[i].supply_type = goodList[i].good_type_id
504
+        goodList[i].supply_specification_name =goodList[i].specification_name
505
+        goodList[i].supply_price = goodList[i].buy_price
506
+        goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info)
507
+        goodList[i].supply_count = ""
508
+        goodList[i].supply_total_price = ""
509
+        goodList[i].supply_manufacturer = goodList[i].manufacturer
510
+        goodList[i].supply_license_number = ""
511
+        goodList[i].supply_remake = ""
512
+        goodList[i].type = 2
513
+        goodList[i].name = goodList[i].good_name
514
+        goodList[i].unitList =  [{id:1,name:""}]
515
+        goodList[i].supply_unit = goodList[i].packing_unit
516
+        for(let j=0;j<goodList[i].unitList.length;j++){
517
+           goodList[i].unitList[0].name = goodList[i].packing_unit 
518
+        }
519
+        this.tabList.push(goodList[i])
520
+        }
521
+        this.goodList = goodList
522
+        console.log(this.goodList,'oo')
523
+    } 
524
+    })
525
+},
552 526
     changeGoodName(val) {
553 527
       this.currentIndex = val;
554 528
     },
@@ -656,9 +630,8 @@ export default {
656 630
             stockIn: this.recordInfo.tableList,
657 631
             return_remake:this.return_remark,
658 632
           };
659
-          
633
+
660 634
           console.log("params23322323", params);
661
-          
662 635
           savePurchaseOrder(
663 636
             params,
664 637
             this.supplier_name,
@@ -672,14 +645,13 @@ export default {
672 645
               this.loading = false;
673 646
               this.$message.success("保存成功!");
674 647
               var warehouseInfo = response.data.data.warehouseInfo;
675
-            
676 648
               if(warehouseInfo.is_check == 1){
677 649
                 this.Reviewed = true
678 650
               }
679 651
               this.number = warehouseInfo.number;
680
-              this.return_remark = warehouseInfo.return_remake
681 652
               this.id = warehouseInfo.id;
682 653
               this.recordInfo.tableList = [];
654
+              this.return_remark = warehouseInfo.return_remake
683 655
               var orderInfo = response.data.data.orderInfo;
684 656
               for (let i = 0; i < orderInfo.length; i++) {
685 657
                 if (orderInfo[i].is_source == 1) {
@@ -823,7 +795,7 @@ export default {
823 795
           var end = this.getTimes(this.end_time);
824 796
           const params = {
825 797
             stockIn: this.recordInfo.tableList,
826
-            return_remake:this.return_remake,
798
+            return_remake:this.return_remark,
827 799
           };
828 800
           console.log("params23232233223", params);
829 801
 
@@ -978,4 +950,4 @@ export default {
978 950
   bottom: 20px;
979 951
   height: 100%;
980 952
 }
981
-</style>
953
+</style>

+ 132 - 104
src/xt_pages/supply/components/addSupply.vue View File

@@ -72,7 +72,7 @@
72 72
             backgroundColor: 'rgb(245, 247, 250)',
73 73
             color: '#606266',
74 74
           }"
75
-          :data="recordInfo.tableList"
75
+          :data="recordInfo.contacts"
76 76
           :class="signAndWeighBoxPatients"
77 77
           border
78 78
           style="width: 100%"
@@ -85,8 +85,8 @@
85 85
             </template>
86 86
             <template slot-scope="scope">
87 87
               <el-form-item
88
-                :prop="'tableList.' + scope.$index + '.supply_count'"
89
-                :rules="tableRules.contacts"
88
+                :prop="'contacts.' + scope.$index + '.name'"
89
+                :rules="tableRules.name"
90 90
               >
91 91
                 <el-input
92 92
                   v-model="scope.row.name"
@@ -121,10 +121,10 @@
121 121
               <span>首要联系人<span style="color: red">*</span></span>
122 122
             </template>
123 123
             <template slot-scope="scope">
124
-              <el-form-item :prop="'tableList.' + scope.$index + '.name'">
125
-                <!-- :prop="'tableList.' + scope.$index + '.name'"  如需添加可在上方标签加入 -->
124
+              <el-form-item :prop="'contacts.' + scope.$index + '.name'">
125
+                <!-- :prop="'contacts.' + scope.$index + '.name'"  如需添加可在上方标签加入 -->
126 126
                 <el-select
127
-                  v-model="scope.row.is_first"
127
+                  v-model="scope.row.isfirst"
128 128
                   style="width: 90px"
129 129
                   placeholder="请选择"
130 130
                   @change="changeName($event, scope)"
@@ -133,7 +133,7 @@
133 133
                     v-for="(item, index) in tabList"
134 134
                     :key="index"
135 135
                     :label="item.label"
136
-                    :value="item"
136
+                    :value="item.value"
137 137
                   >
138 138
                   </el-option>
139 139
                 </el-select>
@@ -186,7 +186,7 @@
186 186
 
187 187
     <span slot="footer" class="dialog-footer">
188 188
       <el-button @click="closePop">取 消</el-button>
189
-      <el-button type="primary" @click="submitForm('supplier')"
189
+      <el-button type="primary" @click="submitForm('supplier', 'recordInfo')"
190 190
         >确 定</el-button
191 191
       >
192 192
     </span>
@@ -198,25 +198,30 @@ import {
198 198
   getSupplierId,
199 199
   getsupplytype,
200 200
   getsupplyandcontactone,
201
+  delcontactone,
202
+  savesupply,
203
+  updatesupply,
201 204
 } from "@/api/supply";
202 205
 import Template from "../../data/template.vue";
203 206
 export default {
204 207
   data() {
205 208
     return {
209
+      show_type: 1,
210
+      supplier_ids: "",
206 211
       title: "",
207 212
       Template,
208 213
       signAndWeighBoxPatients: "sign-and-weigh-box-patients",
209 214
       list: ["001", "002"],
210 215
       // 表单验证规则
211 216
       rules: {
212
-        id: [
217
+        supplierCode: [
213 218
           {
214 219
             required: true,
215 220
             message: "请填写供应商编号",
216 221
             trigger: "blur",
217 222
           },
218 223
         ],
219
-        name: [
224
+        supplierName: [
220 225
           {
221 226
             required: true,
222 227
             message: "请填写供应商名称",
@@ -226,21 +231,19 @@ export default {
226 231
       },
227 232
       tabList: [
228 233
         {
229
-          value: 0,
234
+          value: 1,
230 235
           label: "是",
231 236
         },
232 237
         {
233
-          value: 1,
238
+          value: 0,
234 239
           label: "否",
235 240
         },
236 241
       ],
237 242
       tableRules: {
238
-        contacts: [
239
-          { required: true, message: "联系人不能为空", trigger: "blur" },
240
-        ],
243
+        name: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
241 244
       },
242 245
       recordInfo: {
243
-        tableList: [{}],
246
+        contacts: [{}],
244 247
       },
245 248
       tableData: [
246 249
         {
@@ -251,23 +254,12 @@ export default {
251 254
           operate: "",
252 255
         },
253 256
       ],
254
-      options: [
255
-        {
256
-          value: "1",
257
-          label: "是",
258
-        },
259
-        {
260
-          value: "2",
261
-          label: "否",
262
-        },
263
-      ],
264
-      value: "",
265 257
       dialogVisible: false,
266 258
       supplier: {
267
-        supplierName: "a",
259
+        supplierName: "",
268 260
         supplierCode: "gsy001",
269 261
         supplierType: "",
270
-        vatRate: 10,
262
+        vatRate: "",
271 263
         number: "",
272 264
         bank: "",
273 265
         bankAccount: "",
@@ -285,9 +277,12 @@ export default {
285 277
     show(data, type) {
286 278
       if (type == 1) {
287 279
         this.initSupplierData();
280
+        this.show_type = 1;
288 281
         this.title = "新增供应商";
289 282
         this.dialogVisible = true;
290 283
       } else if (type == 2) {
284
+        this.show_type = 2;
285
+        this.supplier_ids = data.ID;
291 286
         this.title = "编辑供应商";
292 287
         this.supplier.supplierCode = data.SupplierCode;
293 288
         this.supplier.supplierName = data.SupplierName;
@@ -310,36 +305,15 @@ export default {
310 305
       this.supplier.number = "";
311 306
       this.supplier.bank = "";
312 307
       this.supplier.bankAccount = "";
313
-      this.recordInfo.tableList = [{}];
308
+      this.recordInfo.contacts = [{}];
314 309
     },
315 310
 
316 311
     // 获取供应商编码接口
317 312
     initSupplierData() {
318
-      let Arr = [];
319 313
       getSupplierId().then((res) => {
320
-        Arr = res.data.data;
321
-        Arr.supplycode.forEach((o) => {
322
-          this.supply_code.push(o.supplier_code);
323
-        });
324
-      });
325
-      this.orderIdAdd();
326
-    },
327
-
328
-    // 供应商编码动态递增
329
-    orderIdAdd() {
330
-      let data = this.supply_code;
331
-      let len = 3;
332
-      data.forEach((o, index) => {
333
-        o = o.split("gsy");
334
-        index = index + 1;
335
-        let index1 = index;
336
-        index1 = parseInt(index1, 10);
337
-        index1 = index1.toString();
338
-        while (index1.length < len) index1 = "0" + index1;
339
-        if (o[1] != index1) {
340
-          data.splice(index - 1, 0, `gsy${index1}`);
341
-          // console.log(`gsy${index1}`);
342
-          this.supplier.id = `gsy${index1}`;
314
+        if (res.data.state == 1) {
315
+          this.supplier.supplierCode =
316
+            res.data.data.supplycode[0].supplier_code;
343 317
         }
344 318
       });
345 319
     },
@@ -376,21 +350,57 @@ export default {
376 350
     },
377 351
 
378 352
     handleSelect(item) {
379
-      console.log(item, "l");
380 353
       this.supplier.name = item.value;
381 354
       this.supplier.value = item.name;
382 355
     },
383 356
 
384 357
     //  验证表单内容
385
-    submitForm(formName) {
386
-      this.$refs[formName].validate((valid) => {
387
-        if (valid) {
388
-          alert("submit!");
389
-          this.dialogVisible = false;
390
-        } else {
391
-          return false;
392
-        }
393
-      });
358
+    submitForm(supplier, formName) {
359
+      if (this.show_type == 1) {
360
+        this.$refs[supplier].validate((valid) => {
361
+          if (valid) {
362
+            this.$refs[formName].validate((valid) => {
363
+              if (valid) {
364
+                let params = {
365
+                  ...this.supplier,
366
+                  ...this.recordInfo,
367
+                };
368
+                console.log(params, "dhas");
369
+                savesupply(params).then((res) => {});
370
+              } else {
371
+                return false;
372
+              }
373
+            });
374
+
375
+            this.dialogVisible = false;
376
+          } else {
377
+            return false;
378
+          }
379
+        });
380
+      } else if (this.show_type == 2) {
381
+        this.$refs[supplier].validate((valid) => {
382
+          if (valid) {
383
+            this.$refs[formName].validate((valid) => {
384
+              if (valid) {
385
+                let params = {
386
+                  ...this.supplier,
387
+                  ...this.recordInfo,
388
+                };
389
+                console.log(params, "dhas");
390
+                updatesupply(params).then((res) => {
391
+                  console.log(res, "oo");
392
+                });
393
+              } else {
394
+                return false;
395
+              }
396
+            });
397
+
398
+            this.dialogVisible = false;
399
+          } else {
400
+            return false;
401
+          }
402
+        });
403
+      }
394 404
 
395 405
       this.contactsinfo();
396 406
     },
@@ -402,74 +412,92 @@ export default {
402 412
         label: "是",
403 413
       };
404 414
       getsupplyandcontactone({ id: val }).then((res) => {
405
-        console.log(res, "oo");
406 415
         if (res.data.code == 0) {
407
-          this.recordInfo.tableList = res.data.data.contact;
408
-          if (this.recordInfo.tableList.length == 0) {
409
-            this.recordInfo.tableList = [{}];
410
-            this.recordInfo.tableList[0].is_first = data;
411
-            this.$forceUpdate();
416
+          this.recordInfo.contacts = res.data.data.contact;
417
+          if (this.recordInfo.contacts.length == 0) {
418
+            this.recordInfo.contacts = [{}];
419
+            this.recordInfo.contacts[0].isfirst = data;
420
+          } else if (this.recordInfo.contacts.length == 1) {
421
+            let val = res.data.data.contact[0];
422
+            this.recordInfo.contacts[0].isfirst = data;
423
+            this.recordInfo.contacts[0] = {
424
+              name: val.name,
425
+              address: val.address,
426
+              phone: val.phone,
427
+              isfirst: val.is_first,
428
+            };
412 429
           } else {
413
-            this.recordInfo.tableList.forEach((o) => {
414
-              if (o.is_first == 0) {
415
-                o.is_first = "否";
416
-              } else if (o.is_first == 1) {
417
-                o.is_first = "是";
430
+            this.recordInfo.contacts.forEach((o) => {
431
+              if (o.isfirst == 0) {
432
+                this.tabList.label = "否";
433
+              } else if (o.isfirst == 1) {
434
+                this.tabList.label = "是";
418 435
               }
419 436
             });
420 437
           }
421
-
422
-          console.log(this.recordInfo.tableList, "this.recordInfo.tableList");
423 438
         }
424 439
       });
425
-
426
-      if (this.recordInfo.tableList.length == 1) {
427
-        this.recordInfo.tableList[0].is_first = data;
428
-        this.$forceUpdate();
429
-      }
430 440
     },
431 441
 
432 442
     // 首要联系人选择变更动态展示
433 443
     changeName(data, scope) {
434 444
       let data1 = {
435
-        value: 1,
445
+        value: 0,
436 446
         label: "否",
437 447
       };
438
-
439 448
       let data2 = {
440
-        value: 0,
449
+        value: 1,
441 450
         label: "是",
442 451
       };
443 452
       let arr = [];
444
-      if (this.recordInfo.tableList.length == 1) {
445
-        this.recordInfo.tableList[0] = data2;
446
-        this.$forceUpdate();
447
-      }
448
-      this.recordInfo.tableList.forEach((el, index) => {
449
-        if (scope.$index == index) {
450
-          el.is_first = data;
451
-          // console.log(scope);
452
-          this.$forceUpdate();
453
+      if (this.recordInfo.contacts.length <= 1) {
454
+        this.recordInfo.contacts[0].isfirst = data2.value;
455
+      } else {
456
+        this.recordInfo.contacts.forEach((el, index) => {
457
+          console.log(scope.$index, index, "oo");
458
+          if (scope.$index == index) {
459
+            el.isfirst = data;
460
+          } else {
461
+            el.isfirst = data1.value;
462
+          }
463
+          arr.push(el.isfirst);
464
+        });
465
+        if (arr.includes(1)) {
466
+          return;
453 467
         } else {
454
-          el.is_first = data1;
455
-          this.$forceUpdate();
468
+          this.recordInfo.contacts[0].isfirst = data2.value;
456 469
         }
457
-        arr.push(el.is_first.value);
458
-      });
459
-      if (arr.includes(0)) {
460
-        return;
461
-      } else {
462
-        this.recordInfo.tableList[0].is_first = data2;
463 470
       }
464 471
     },
465 472
 
466 473
     // 添加表单行
467 474
     handleAdd() {
468 475
       let data = {};
469
-      this.recordInfo.tableList.push(data);
476
+      this.recordInfo.contacts.push(data);
470 477
     },
471 478
     // 删除表单行
472
-    handleDelete() {},
479
+    handleDelete(index, data) {
480
+      let params = {
481
+        id: data.id,
482
+      };
483
+
484
+      if (this.show_type == 1) {
485
+        if (this.recordInfo.contacts.length <= 1) {
486
+          return;
487
+        } else {
488
+          this.recordInfo.contacts.splice(index, 1);
489
+        }
490
+      } else if (this.show_type == 2) {
491
+        delcontactone(params).then((res) => {
492
+          if (res.data.data.list == "删除成功") {
493
+            this.$message.success(res.data.data.list);
494
+            this.getcontacts(this.supplier_ids);
495
+          } else {
496
+            this.$message.error(res.data.data.list);
497
+          }
498
+        });
499
+      }
500
+    },
473 501
 
474 502
     //表格判断是否填入信息
475 503
     contactsinfo() {