浏览代码

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

csx 3 年前
父节点
当前提交
8d9a8a9787

+ 79 - 50
src/api/supply.js 查看文件

157
     url: '/api/supply/getallgoodreturnorderlist',
157
     url: '/api/supply/getallgoodreturnorderlist',
158
     method: 'get',
158
     method: 'get',
159
     params: params
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
 export function updateGoodReturn(data, warehouse_out_id, start_time, rate_of_concession, discount_amount, arrearage, payment, supplier_id, return_number) {
213
 export function updateGoodReturn(data, warehouse_out_id, start_time, rate_of_concession, discount_amount, arrearage, payment, supplier_id, return_number) {
212
   return request({
214
   return request({
247
     params: params
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 查看文件

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

+ 98 - 126
src/xt_pages/supply/components/addPurchaseOrder.vue 查看文件

14
       >
14
       >
15
         <div>
15
         <div>
16
           <span style="color: red">*</span><span>供应商:</span>
16
           <span style="color: red">*</span><span>供应商:</span>
17
-          <el-select cxpib`*+9.`
17
+          <el-select
18
             v-model="supplier_name"
18
             v-model="supplier_name"
19
             style="width: 140px; margin-right: 10px"
19
             style="width: 140px; margin-right: 10px"
20
             placeholder="请选择"
20
             placeholder="请选择"
191
               <div style="visibility: hidden">/</div>
191
               <div style="visibility: hidden">/</div>
192
             </template>
192
             </template>
193
           </el-table-column>
193
           </el-table-column>
194
-          <el-table-column label="数量" align="center" width="140px">
194
+          <el-table-column label="数量" align="center" width="180px">
195
             <template slot="header" slot-scope="scope">
195
             <template slot="header" slot-scope="scope">
196
               <span>数量<span style="color: red">*</span></span>
196
               <span>数量<span style="color: red">*</span></span>
197
             </template>
197
             </template>
199
               <el-form-item
199
               <el-form-item
200
                 :prop="'tableList.' + scope.$index + '.supply_count'"
200
                 :prop="'tableList.' + scope.$index + '.supply_count'"
201
                 :rules="tableRules.supply_count"
201
                 :rules="tableRules.supply_count"
202
+                 placeholder="请输入数量"
202
               >
203
               >
203
                 <el-input
204
                 <el-input
204
                   v-model="scope.row.supply_count"
205
                   v-model="scope.row.supply_count"
205
-                  style="width: 100px"
206
+                  style="width: 140px"
206
                   :disabled="disabled"
207
                   :disabled="disabled"
207
                   placeholder="请输入数量"
208
                   placeholder="请输入数量"
208
                 ></el-input>
209
                 ></el-input>
210
             </template>
211
             </template>
211
           </el-table-column>
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
             <template slot-scope="scope">
215
             <template slot-scope="scope">
215
               <el-input
216
               <el-input
216
                 v-model="scope.row.supply_price"
217
                 v-model="scope.row.supply_price"
217
-                style="width: 140px"
218
+                style="width: 80px"
218
                 :disabled="disabled"
219
                 :disabled="disabled"
219
                  placeholder="请输入购货单价"
220
                  placeholder="请输入购货单价"
220
               ></el-input>
221
               ></el-input>
309
             </template>
310
             </template>
310
           </el-table-column>
311
           </el-table-column>
311
         </el-table>
312
         </el-table>
312
-        <div style="margin-top: 10px">
313
+         <div style="margin-top: 10px">
313
         <el-input
314
         <el-input
314
           type="textarea"
315
           type="textarea"
315
           :rows="2"
316
           :rows="2"
360
 import { getDataConfig } from "@/utils/data";
361
 import { getDataConfig } from "@/utils/data";
361
 export default {
362
 export default {
362
   name: "addPurchaseOrder",
363
   name: "addPurchaseOrder",
364
+
363
   components: {
365
   components: {
364
     BreadCrumb,
366
     BreadCrumb,
365
   },
367
   },
428
     };
430
     };
429
   },
431
   },
430
   methods: {
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
     changeGoodName(val) {
526
     changeGoodName(val) {
553
       this.currentIndex = val;
527
       this.currentIndex = val;
554
     },
528
     },
656
             stockIn: this.recordInfo.tableList,
630
             stockIn: this.recordInfo.tableList,
657
             return_remake:this.return_remark,
631
             return_remake:this.return_remark,
658
           };
632
           };
659
-          
633
+
660
           console.log("params23322323", params);
634
           console.log("params23322323", params);
661
-          
662
           savePurchaseOrder(
635
           savePurchaseOrder(
663
             params,
636
             params,
664
             this.supplier_name,
637
             this.supplier_name,
672
               this.loading = false;
645
               this.loading = false;
673
               this.$message.success("保存成功!");
646
               this.$message.success("保存成功!");
674
               var warehouseInfo = response.data.data.warehouseInfo;
647
               var warehouseInfo = response.data.data.warehouseInfo;
675
-            
676
               if(warehouseInfo.is_check == 1){
648
               if(warehouseInfo.is_check == 1){
677
                 this.Reviewed = true
649
                 this.Reviewed = true
678
               }
650
               }
679
               this.number = warehouseInfo.number;
651
               this.number = warehouseInfo.number;
680
-              this.return_remark = warehouseInfo.return_remake
681
               this.id = warehouseInfo.id;
652
               this.id = warehouseInfo.id;
682
               this.recordInfo.tableList = [];
653
               this.recordInfo.tableList = [];
654
+              this.return_remark = warehouseInfo.return_remake
683
               var orderInfo = response.data.data.orderInfo;
655
               var orderInfo = response.data.data.orderInfo;
684
               for (let i = 0; i < orderInfo.length; i++) {
656
               for (let i = 0; i < orderInfo.length; i++) {
685
                 if (orderInfo[i].is_source == 1) {
657
                 if (orderInfo[i].is_source == 1) {
823
           var end = this.getTimes(this.end_time);
795
           var end = this.getTimes(this.end_time);
824
           const params = {
796
           const params = {
825
             stockIn: this.recordInfo.tableList,
797
             stockIn: this.recordInfo.tableList,
826
-            return_remake:this.return_remake,
798
+            return_remake:this.return_remark,
827
           };
799
           };
828
           console.log("params23232233223", params);
800
           console.log("params23232233223", params);
829
 
801
 
978
   bottom: 20px;
950
   bottom: 20px;
979
   height: 100%;
951
   height: 100%;
980
 }
952
 }
981
-</style>
953
+</style>

+ 132 - 104
src/xt_pages/supply/components/addSupply.vue 查看文件

72
             backgroundColor: 'rgb(245, 247, 250)',
72
             backgroundColor: 'rgb(245, 247, 250)',
73
             color: '#606266',
73
             color: '#606266',
74
           }"
74
           }"
75
-          :data="recordInfo.tableList"
75
+          :data="recordInfo.contacts"
76
           :class="signAndWeighBoxPatients"
76
           :class="signAndWeighBoxPatients"
77
           border
77
           border
78
           style="width: 100%"
78
           style="width: 100%"
85
             </template>
85
             </template>
86
             <template slot-scope="scope">
86
             <template slot-scope="scope">
87
               <el-form-item
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
                 <el-input
91
                 <el-input
92
                   v-model="scope.row.name"
92
                   v-model="scope.row.name"
121
               <span>首要联系人<span style="color: red">*</span></span>
121
               <span>首要联系人<span style="color: red">*</span></span>
122
             </template>
122
             </template>
123
             <template slot-scope="scope">
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
                 <el-select
126
                 <el-select
127
-                  v-model="scope.row.is_first"
127
+                  v-model="scope.row.isfirst"
128
                   style="width: 90px"
128
                   style="width: 90px"
129
                   placeholder="请选择"
129
                   placeholder="请选择"
130
                   @change="changeName($event, scope)"
130
                   @change="changeName($event, scope)"
133
                     v-for="(item, index) in tabList"
133
                     v-for="(item, index) in tabList"
134
                     :key="index"
134
                     :key="index"
135
                     :label="item.label"
135
                     :label="item.label"
136
-                    :value="item"
136
+                    :value="item.value"
137
                   >
137
                   >
138
                   </el-option>
138
                   </el-option>
139
                 </el-select>
139
                 </el-select>
186
 
186
 
187
     <span slot="footer" class="dialog-footer">
187
     <span slot="footer" class="dialog-footer">
188
       <el-button @click="closePop">取 消</el-button>
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
         >确 定</el-button
190
         >确 定</el-button
191
       >
191
       >
192
     </span>
192
     </span>
198
   getSupplierId,
198
   getSupplierId,
199
   getsupplytype,
199
   getsupplytype,
200
   getsupplyandcontactone,
200
   getsupplyandcontactone,
201
+  delcontactone,
202
+  savesupply,
203
+  updatesupply,
201
 } from "@/api/supply";
204
 } from "@/api/supply";
202
 import Template from "../../data/template.vue";
205
 import Template from "../../data/template.vue";
203
 export default {
206
 export default {
204
   data() {
207
   data() {
205
     return {
208
     return {
209
+      show_type: 1,
210
+      supplier_ids: "",
206
       title: "",
211
       title: "",
207
       Template,
212
       Template,
208
       signAndWeighBoxPatients: "sign-and-weigh-box-patients",
213
       signAndWeighBoxPatients: "sign-and-weigh-box-patients",
209
       list: ["001", "002"],
214
       list: ["001", "002"],
210
       // 表单验证规则
215
       // 表单验证规则
211
       rules: {
216
       rules: {
212
-        id: [
217
+        supplierCode: [
213
           {
218
           {
214
             required: true,
219
             required: true,
215
             message: "请填写供应商编号",
220
             message: "请填写供应商编号",
216
             trigger: "blur",
221
             trigger: "blur",
217
           },
222
           },
218
         ],
223
         ],
219
-        name: [
224
+        supplierName: [
220
           {
225
           {
221
             required: true,
226
             required: true,
222
             message: "请填写供应商名称",
227
             message: "请填写供应商名称",
226
       },
231
       },
227
       tabList: [
232
       tabList: [
228
         {
233
         {
229
-          value: 0,
234
+          value: 1,
230
           label: "是",
235
           label: "是",
231
         },
236
         },
232
         {
237
         {
233
-          value: 1,
238
+          value: 0,
234
           label: "否",
239
           label: "否",
235
         },
240
         },
236
       ],
241
       ],
237
       tableRules: {
242
       tableRules: {
238
-        contacts: [
239
-          { required: true, message: "联系人不能为空", trigger: "blur" },
240
-        ],
243
+        name: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
241
       },
244
       },
242
       recordInfo: {
245
       recordInfo: {
243
-        tableList: [{}],
246
+        contacts: [{}],
244
       },
247
       },
245
       tableData: [
248
       tableData: [
246
         {
249
         {
251
           operate: "",
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
       dialogVisible: false,
257
       dialogVisible: false,
266
       supplier: {
258
       supplier: {
267
-        supplierName: "a",
259
+        supplierName: "",
268
         supplierCode: "gsy001",
260
         supplierCode: "gsy001",
269
         supplierType: "",
261
         supplierType: "",
270
-        vatRate: 10,
262
+        vatRate: "",
271
         number: "",
263
         number: "",
272
         bank: "",
264
         bank: "",
273
         bankAccount: "",
265
         bankAccount: "",
285
     show(data, type) {
277
     show(data, type) {
286
       if (type == 1) {
278
       if (type == 1) {
287
         this.initSupplierData();
279
         this.initSupplierData();
280
+        this.show_type = 1;
288
         this.title = "新增供应商";
281
         this.title = "新增供应商";
289
         this.dialogVisible = true;
282
         this.dialogVisible = true;
290
       } else if (type == 2) {
283
       } else if (type == 2) {
284
+        this.show_type = 2;
285
+        this.supplier_ids = data.ID;
291
         this.title = "编辑供应商";
286
         this.title = "编辑供应商";
292
         this.supplier.supplierCode = data.SupplierCode;
287
         this.supplier.supplierCode = data.SupplierCode;
293
         this.supplier.supplierName = data.SupplierName;
288
         this.supplier.supplierName = data.SupplierName;
310
       this.supplier.number = "";
305
       this.supplier.number = "";
311
       this.supplier.bank = "";
306
       this.supplier.bank = "";
312
       this.supplier.bankAccount = "";
307
       this.supplier.bankAccount = "";
313
-      this.recordInfo.tableList = [{}];
308
+      this.recordInfo.contacts = [{}];
314
     },
309
     },
315
 
310
 
316
     // 获取供应商编码接口
311
     // 获取供应商编码接口
317
     initSupplierData() {
312
     initSupplierData() {
318
-      let Arr = [];
319
       getSupplierId().then((res) => {
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
     },
350
     },
377
 
351
 
378
     handleSelect(item) {
352
     handleSelect(item) {
379
-      console.log(item, "l");
380
       this.supplier.name = item.value;
353
       this.supplier.name = item.value;
381
       this.supplier.value = item.name;
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
       this.contactsinfo();
405
       this.contactsinfo();
396
     },
406
     },
402
         label: "是",
412
         label: "是",
403
       };
413
       };
404
       getsupplyandcontactone({ id: val }).then((res) => {
414
       getsupplyandcontactone({ id: val }).then((res) => {
405
-        console.log(res, "oo");
406
         if (res.data.code == 0) {
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
           } else {
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
     changeName(data, scope) {
443
     changeName(data, scope) {
434
       let data1 = {
444
       let data1 = {
435
-        value: 1,
445
+        value: 0,
436
         label: "否",
446
         label: "否",
437
       };
447
       };
438
-
439
       let data2 = {
448
       let data2 = {
440
-        value: 0,
449
+        value: 1,
441
         label: "是",
450
         label: "是",
442
       };
451
       };
443
       let arr = [];
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
         } else {
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
     handleAdd() {
474
     handleAdd() {
468
       let data = {};
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
     contactsinfo() {
503
     contactsinfo() {