XMLWAN 2 anos atrás
pai
commit
95ea0685e1

+ 8 - 0
src/api/drug/drug.js Ver arquivo

@@ -579,3 +579,11 @@ export function getDrugNewQuery(params) {
579 579
     params: params
580 580
   })
581 581
 }
582
+
583
+export function getDrugWarehouseOutInfoById(params) {
584
+  return request({
585
+    url: '/api/drug/getdrugwarehouseoutinfobyid',
586
+    method: 'get',
587
+    params: params
588
+  })
589
+}

+ 2 - 2
src/xt_pages/data/components/addDrugs.vue Ver arquivo

@@ -168,8 +168,8 @@
168 168
                                   maxlength="30"></el-input>
169 169
                     </el-form-item>
170 170
                        <el-form-item label="库存警戒:">
171
-                            <el-input v-model="form.drug_stock_limit" style="width:160px;" placeholder=""
172
-                                      maxlength="30"></el-input>
171
+                            <el-input v-model="form.drug_stock_limit" style="width:140px;" placeholder=""
172
+                                      maxlength="30"></el-input>{{form.max_unit}}
173 173
                         </el-form-item>
174 174
                         <el-form-item label="产地:" prop="drug_origin_place">
175 175
                             <el-input v-model="form.drug_origin_place" style="width:160px;" placeholder=""

+ 357 - 228
src/xt_pages/stock/drugs/components/drugQuery.vue Ver arquivo

@@ -25,7 +25,7 @@
25 25
               :value="item.id">
26 26
             </el-option>
27 27
           </el-select>
28
-          <el-input v-model="keyword" style="width:200px" placeholder="请输入耗材名称或生产厂商" ></el-input>
28
+          <el-input v-model="keyword" style="width:200px" placeholder="请输入药品名称或生产厂商" ></el-input>
29 29
           <el-button  type="primary" icon="el-icon-search" @click="seach">搜索</el-button>
30 30
          </div>
31 31
         </div>
@@ -42,93 +42,118 @@
42 42
           >
43 43
             <el-table-column label="药品类型" align="center">
44 44
               <template slot-scope="scope">
45
-               
45
+                {{getDrugTypeName(scope.row.drug_type)}}
46 46
               </template>
47 47
             </el-table-column>
48 48
             <el-table-column label="药品名称" align="center">
49 49
               <template slot-scope="scope">
50
-                
50
+                 {{scope.row.drug_name}}
51 51
               </template>
52 52
             </el-table-column>
53 53
             <el-table-column label="规格&单位" align="center">
54 54
                 <template slot-scope="scope">
55
-                 
55
+                  {{scope.row.dose}}{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
56 56
                 </template>
57 57
             </el-table-column>
58 58
             <el-table-column label="生产厂商" align="center">
59 59
               <template slot-scope="scope">
60
-                
60
+                {{getManufacturName(scope.row.manufacturer)}}
61 61
               </template>
62 62
             </el-table-column>
63 63
             <el-table-column label="国家编码" align="center">
64 64
               <template slot-scope="scope">
65
-               
65
+                {{scope.row.social_security_directory_code}}
66 66
               </template>
67 67
             </el-table-column>
68 68
             <el-table-column label="仓库名称" align="center">
69 69
               <template slot-scope="scope">
70
-                <tr style="background: none" v-for="(item,index) in scope.row.warehouse_info" :key="index">
71
-                  <td style="border-right: none; border-inline-end: none;text-align: center" >
72
-                    
73
-                  </td>
74
-                </tr>
70
+                <tr style="background: none" v-for="(item, index) in scope.row.drug_warehouse" :key="index">
71
+                 <td  style="border-right: none;border-inline-end: none;text-align: center;">
72
+                    {{ getHouseName(item.storehouse_id) }}
73
+                 </td>
74
+               </tr>
75 75
               </template>
76 76
             </el-table-column>
77 77
         
78 78
             <el-table-column label="入库量" align="center">
79 79
               <template slot-scope="scope">
80
-                <tr style="background: none" v-for="(item,index) in scope.row.warehouse_info" :key="index">
81
-                  <td style="border-right: none; border-inline-end: none;text-align: center">
82
-                
83
-                  </td>
84
-                </tr>
80
+               <tr style="background: none" v-for="(item, index) in scope.row.drug_warehouse" :key="index">
81
+              <td style="border-right: none;border-inline-end: none;text-align: center; ">
82
+                {{getWarehoseInfoSeven(scope.row.drug_warehouse_info, scope.row.max_unit, scope.row.min_unit,scope.row.min_number,item.storehouse_id)}}&nbsp;
83
+              </td>
84
+            </tr>
85 85
                </template>
86 86
             </el-table-column>
87 87
           
88 88
             <el-table-column label="出库量" align="center">
89 89
               <template slot-scope="scope">
90
-              
90
+                <tr style="background: none" v-for="(item, index) in scope.row.drug_warehouse" :key="index">
91
+                <td style="border-right: none;border-inline-end: none;text-align: center;">
92
+                   <span style="color:#0099FF" @click="toDialogClick(scope.row.id,scope.row.drug_name,scope.row.dose,scope.row.dose_unit,scope.row.min_number,scope.row.min_unit,scope.row.max_unit)"> {{getOutFlushNight(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number,scope.row.drug_cancel_stock_info,item.storehouse_id)}}&nbsp;</span>
93
+                </td>
94
+              </tr>
91 95
              </template>
92 96
             </el-table-column>
93 97
 
94 98
             <el-table-column label="退库数量" align="center">
95 99
               <template slot-scope="scope">
96
-               
97
-
100
+                <tr style="background: none" v-for="(item, index) in scope.row.drug_warehouse" :key="index">
101
+                    <td style="border-right: none;border-inline-end: none;text-align: center;">
102
+                        {{getOutFlushTen(scope.row.drug_cancel_stock_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number,item.storehouse_id)}}&nbsp;
103
+                    </td>
104
+                </tr>
98 105
               </template>
99 106
             </el-table-column>
100 107
 
101 108
              <el-table-column label="实际出库" align="center">
102 109
               <template slot-scope="scope">
103
-             
110
+                <tr style="background: none" v-for="(item, index) in scope.row.drug_warehouse" :key="index">
111
+                    <td style="border-right: none;border-inline-end: none;text-align: center;">
112
+                    {{getDrugOut(scope.row.drug_warehouse_out,scope.row.max_unit,scope.row.min_unit,scope.row.min_number,item.storehouse_id)}}&nbsp;
113
+                    </td>
114
+                </tr>
104 115
              </template>
105 116
             </el-table-column>
106 117
 
107 118
             <el-table-column label="剩余库存" align="center">
108
-             
119
+              <template slot-scope="scope">
120
+                <tr style="background: none" v-for="(item, index) in scope.row.drug_warehouse" :key="index">
121
+                <td style="border-right: none;border-inline-end: none;text-align: center;">
122
+                  {{getOverFlushInfoEight(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number,item.storehouse_id,scope.row.storehouse_id)}}&nbsp;
123
+                </td>
124
+                </tr>
125
+             </template>
109 126
             </el-table-column>
110 127
 
111 128
             <el-table-column label="总库存量" align="center">
112
-            
129
+             <template slot-scope="scope">
130
+                <div v-if="getWarehoseInfo(scope.row.drug_warehouse_info) > 0">
131
+                 {{getOverFlushInfo(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)? getOverFlushInfo(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number): 0}}
132
+                </div>
133
+              </template>
113 134
             </el-table-column>
114 135
            
115
-            <el-table-column label="操作" align="center" width="200px">
116
-             
117
-              <template slot-scope="scope">
118
-                <el-button
119
-                  size="small"
120
-                  type="primary"
121
-                  @click="toClick(scope.row)"
122
-                >库存流水
123
-                </el-button>
124
-                <el-button
125
-                  size="small"
126
-                  type="primary"
127
-                  @click="toClickOne(scope.row)"
128
-                >批次
129
-                </el-button>
130
-               </template>
131
-            </el-table-column>
136
+            <el-table-column
137
+                prop="drug_name"
138
+                label="操作"
139
+                align="center"
140
+                width="200px"
141
+                >
142
+                <template slot-scope="scope">
143
+                    <el-button
144
+                    size="small"
145
+                    type="primary"
146
+                    @click="handleDetail(scope.row)"
147
+                    >库存流水
148
+                    </el-button>
149
+                    <el-button
150
+                    size="small"
151
+                    type="primary"
152
+                    @click="handleBatch(scope.row)"
153
+                    >批次
154
+                    </el-button>
155
+                </template>
156
+              </el-table-column>
132 157
           </el-table>
133 158
            <el-pagination
134 159
             @size-change="handleSizeChange"
@@ -151,7 +176,7 @@
151 176
       :visible.sync="dialogVisible"
152 177
       width="70%">
153 178
       <span>
154
-        耗材名称:{{good_name}}
179
+        药品名称:{{drug_name}}
155 180
         规格&单位:{{specification_name}}
156 181
         查询日期:
157 182
           <el-date-picker
@@ -213,6 +238,7 @@
213 238
                
214 239
             </template>
215 240
           </el-table-column>
241
+          
216 242
           <el-table-column label="使用人" align="center">
217 243
             <template slot-scope="scope">
218 244
               {{getName(scope.row.patient_id)}}
@@ -245,11 +271,9 @@
245 271
   </div>
246 272
 </template>
247 273
 <script>
248
-import { getStorehouseList,getDrugNewQuery,getGoodWarehouseOutInfoById } from "@/api/drug/drug"
249
-import {
250
-  getStockDrugCount
251
-} from "@/api/stock";
274
+import { getStorehouseList,getDrugNewQuery,getDrugWarehouseOutInfoById } from "@/api/drug/drug"
252 275
 import { uParseTime } from '@/utils/tools'
276
+import { max } from 'moment'
253 277
 export default {
254 278
 
255 279
   data(){
@@ -284,10 +308,11 @@ export default {
284 308
      start_first_time:"",
285 309
      end_first_time:"",
286 310
      tableData:[],
287
-     good_id:0,
311
+     drug_id:0,
288 312
      patientList:[],
289
-     good_name:"",
290
-     specification_name:""
313
+     drug_name:"",
314
+     specification_name:"",
315
+     drugTypeList:[],
291 316
     }
292 317
   
293 318
   },
@@ -356,19 +381,33 @@ export default {
356 381
       getDrugNewQuery(params).then(response=>{
357 382
          if(response.data.state == 1){
358 383
             var list = response.data.data.list
359
-            console.log("list2332233232323232w",list)
360
-            
361
-            if(list.length > 0){
362
-              var arr = []
363
-              for(let i=0;i<list.length;i++){
364
-                if(list[i].xt_warehouse_info.length > 0){
365
-                  arr.push(list[i])
384
+            for (let i = 0; i < list.length; i++) {
385
+              for (let j = 0; j < list[i].drug_warehouse_info.length; j++) {
386
+                if (list[i].max_unit == list[i].drug_warehouse_info[j].max_unit) {
387
+                   list[i].drug_warehouse_info[j].stock_max_number =list[i].min_number *list[i].drug_warehouse_info[j].stock_max_number
388
+                   list[i].drug_warehouse_info[j].warehousing_count =list[i].min_number *list[i].drug_warehouse_info[j].warehousing_count
389
+                 }
366 390
                 }
391
+                for (let y = 0; y < list[i].drug_warehouse_out.length; y++) {
392
+                  if (list[i].drug_warehouse_out[y].count_unit == list[i].max_unit) {
393
+                    list[i].drug_warehouse_out[y].count =list[i].drug_warehouse_out[y].count * list[i].min_number
394
+                  }
395
+                }
396
+                for (let z = 0; z < list[i].drug_cancel_stock_info.length; z++) {
397
+                  if (list[i].drug_cancel_stock_info[z].max_unit == list[i].max_unit) {
398
+                    list[i].drug_cancel_stock_info[z].count =list[i].drug_cancel_stock_info[z].count * list[i].min_number
399
+                   }
400
+                }
401
+            }
402
+            var arr = [];
403
+            for (let i = 0; i < list.length; i++) {
404
+             if (list[i].drug_warehouse_info.length > 0) {
405
+               arr.push(list[i]);
367 406
               }
368
-              this.tableList = arr
369 407
             }
408
+            this.tableList = arr;
370 409
             this.total = response.data.data.total
371
-           
410
+            this.drugTypeList = response.data.data.drugTypeList
372 411
          }
373 412
       })
374 413
     },
@@ -391,11 +430,11 @@ export default {
391 430
     },
392 431
     handleSizeChangeOne(val) {
393 432
       this.limitone = val;
394
-      this.toDialogClick(this.good_id,this.good_name,this.specification_name)
433
+      this.toDialogClick(this.drug_id,this.drug_name,this.specification_name)
395 434
     },
396 435
     handleCurrentChangeOne(val) {
397 436
       this.pageone = val;
398
-      this.toDialogClick(this.good_id,this.good_name,this.specification_name)
437
+      this.toDialogClick(this.drug_id,this.drug_name,this.specification_name)
399 438
     },
400 439
    seach(){
401 440
     this.getlist()
@@ -433,178 +472,37 @@ export default {
433 472
        return ""
434 473
      }
435 474
    },
436
-   getStockDrugCount(){
437
-        var params ={
438
-           keywords: this.keywords,
439
-           start_time:this.start_time,
440
-           end_time:this.end_time,
475
+  getOverFlushInfo(arr, max_unit, min_unit, min_number) {
476
+      var max_str = "";
477
+      var min_str = "";
478
+      var total = 0;
479
+      var newarr = arr;
480
+      if (newarr.length > 0) {
481
+        for (let i = 0; i < newarr.length; i++) {
482
+          total += newarr[i].stock_max_number + newarr[i].stock_min_number;
441 483
         }
442
-      getStockDrugCount(params).then(response=>{
443
-         if(response.data.state == 1){
444
-           var outlist = response.data.data.outList
445
-           this.outCountList = outlist
446
-           var autoCount = response.data.data.autoCount
447
-           this.autoCountList = autoCount
448
-           var totalCount = response.data.data.totalCount
449
-           this.cancelCountList = totalCount
450
-         }
451
-      })
452
-    },
453
-    getWareInfoCountOne(val,storehouse_id){
454
-     var count = 0
455
-     if(val.length > 0){
456
-       for(let i=0;i<val.length;i++){
457
-         if(val[i].storehouse_id == storehouse_id){
458
-             count +=val[i].stock_count
459
-         }
460
-       }
461
-     }
462
-     if(count > 0){
463
-       return count
464
-     }else{
465
-       return ""
466
-     }
467
-   },
468
-   getOutCount(id){
469
-      var count = 0
470
-      for(let i=0;i<this.outCountList.length;i++){
471
-         if(id == this.outCountList[i].good_id){
472
-           count = this.outCountList[i].count
473
-         }
474 484
       }
475
-     return count
476
-   },
477
-   getAutoCount(id){
478
-     var count= 0
479
-     for(let i=0;i<this.autoCountList.length;i++){
480
-       if(id == this.autoCountList[i].good_id){
481
-         count = this.autoCountList[i].count
482
-       }
483
-     }
484
-     return count
485
-   },
486
-   getCancelCount(id){
487
-     var count = 0
488
-     for(let i=0;i<this.cancelCountList.length;i++){
489
-       if(id == this.cancelCountList[i].good_id){
490
-          count = this.cancelCountList[i].count
491
-       }
492
-     }
493
-     return count
494
-   },
495
-   getCancelCountInfo(cancel_stock_info,storehouse_id){
496
-     var count = 0 
497
-     if(cancel_stock_info.length >0){
498
-        for(let i=0;i<cancel_stock_info.length;i++){
499
-          if(storehouse_id ==  cancel_stock_info[i].storehouse_id){
500
-              count += cancel_stock_info[i].count
501
-          }
502
-        }
503
-     }
504
-     return count
505
-   },
506
-   getWareOutInfoCount(warehouse_out_info,storehouse_id){
507
-     var count = 0
508
-     if(warehouse_out_info.length > 0){
509
-       for(let i=0;i<warehouse_out_info.length;i++){
510
-         if(storehouse_id == warehouse_out_info[i].storehouse_id){
511
-            count +=warehouse_out_info[i].count
512
-         }
513
-       }
514
-     }
515
-     return count
516
-   },
517
-   getInCount(id){
518
-      var count= 0
519
-     for(let i=0;i<this.countList.length;i++){
520
-      if(id == this.countList[i].good_id){
521
-          count = this.countList[i].count
485
+      if (total < min_number) {
486
+        min_str = total + min_unit;
522 487
       }
523
-     }
524
-     return count
525
-    },
526
-    getOutCount(id){
527
-      var count = 0
528
-      for(let i=0;i<this.outCountList.length;i++){
529
-         if(id == this.outCountList[i].good_id){
530
-           count = this.outCountList[i].count
531
-         }
488
+      if (total == 0) {
489
+        min_str = "";
490
+        max_str = "";
532 491
       }
533
-     return count
534
-   },
535
-   getAutoCount(id){
536
-     var count= 0
537
-     for(let i=0;i<this.autoCountList.length;i++){
538
-       if(id == this.autoCountList[i].good_id){
539
-         count = this.autoCountList[i].count
540
-       }
541
-     }
542
-     return count
543
-   },
544
-   getCancelCount(id){
545
-     var count = 0
546
-     for(let i=0;i<this.cancelCountList.length;i++){
547
-       if(id == this.cancelCountList[i].good_id){
548
-          count = this.cancelCountList[i].count
549
-       }
550
-     }
551
-     return count
552
-   },
553
-   getStockCount(id){
554
-     var stock_count = 0
555
-     for(let i=0;i<this.countList.length;i++){
556
-       if(id == this.countList[i].good_id){
557
-         stock_count = this.countList[i].stock_count
558
-       }
559
-     }
560
-     return stock_count
561
-   },
562
-   getWareInfo(arr){
563
-     var total = 0
564
-     if(arr.length > 0){
565
-       for(let i=0;i<arr.length;i++){
566
-         total += parseInt(arr[i].warehousing_count)
567
-       }
568
-     }else{
569
-       total = ""
570
-     }
571
-     return total
572
-   },
573
-   getOverplus(arr){
574
-     var total = 0
575
-     if(arr.length > 0){
576
-      for(let i=0;i<arr.length;i++){
577
-        total += arr[i].stock_count
578
-      }
579
-     }else{
580
-       total = ""
581
-     }
582
-     return total
583
-   },
584
-   getCancelInfo(arr){
585
-     var total = 0
586
-     if(arr.length > 0){
587
-      for(let i=0;i<arr.length;i++){
588
-        total += arr[i].count
589
-      }
590
-     }else{
591
-       total = ""
592
-     }
593
-     return total
594
-   },
595
-   getOverFlushInfo(arr){
596
-     var total = 0
597
-     if(arr.length >0){
598
-      for(let i=0;i<arr.length;i++){
599
-        total += arr[i].stock_count
492
+      if (total >= min_number) {
493
+        if (parseInt(total / min_number) != 0) {
494
+          max_str = parseInt(total / min_number) + max_unit;
495
+        }
496
+        if (total % min_number != 0) {
497
+          min_str = (total % min_number) + min_unit;
498
+        }
600 499
       }
601
-     }
602
-     return total
603
-   },
604
-   toDialogClick(id,good_name,specification_name){
605
-    this.good_id = id
606
-    this.good_name = good_name
607
-    this.specification_name = specification_name
500
+      return max_str + min_str;
501
+    },
502
+   toDialogClick(id,drug_name,dose,dose_unit,min_number,min_unit,max_unit){
503
+    this.drug_id = id
504
+    this.drug_name = drug_name
505
+    this.specification_name = dose + dose_unit + "*"+min_number+min_unit +"/"+ max_unit
608 506
      var params = {
609 507
        good_id:id,
610 508
        limit:this.limitone,
@@ -612,7 +510,7 @@ export default {
612 510
        start_first_time:this.start_first_time,
613 511
        end_first_time:this.end_first_time,
614 512
      }
615
-     getGoodWarehouseOutInfoById(params).then(response=>{
513
+     getDrugWarehouseOutInfoById(params).then(response=>{
616 514
        if(response.data.state == 1){
617 515
          var list = response.data.data.list
618 516
          console.log("list23233233232w",list)
@@ -647,12 +545,243 @@ export default {
647 545
       }
648 546
     }
649 547
     return name
650
-  }
548
+  },
549
+  getDrugTypeName(id){
550
+    var type_name = ""
551
+    for(let i=0;i<this.drugTypeList.length;i++){
552
+      if(id == this.drugTypeList[i].value){
553
+        type_name = this.drugTypeList[i].name
554
+      }
555
+    }
556
+    return type_name
557
+  },
558
+  getWarehoseInfoSeven(arr, max_unit, min_unit, min_number, storehouse_id) {
559
+    var total = 0;
560
+    var max_str = "";
561
+    var min_str = "";
562
+    if (arr.length > 0) {
563
+    for (let i = 0; i < arr.length; i++) {
564
+        if (arr[i].storehouse_id == storehouse_id) {
565
+        total += parseInt(arr[i].warehousing_count);
566
+        }
567
+    }
568
+    }
569
+    if (total < min_number) {
570
+    min_str = total + min_unit;
571
+    }
572
+    if (total == 0) {
573
+    min_str = "";
574
+    max_str = "";
575
+    }
576
+    if (total >= min_number) {
577
+    if (parseInt(total / min_number) != 0) {
578
+        max_str = parseInt(total / min_number) + max_unit;
579
+    }
580
+    if (total % min_number != 0) {
581
+        min_str = (total % min_number) + min_unit;
582
+    }
583
+    }
584
+    return max_str + min_str;
585
+   },
586
+   getOutFlushNight(info, max_unit, min_unit,min_number, cancel_info,storehouse_id){
587
+      var str = "";
588
+      var str_min = "";
589
+      //总库存
590
+      var total = 0;
591
+      var out_count = 0;
592
+      var over_count = 0;
593
+      var cancel_count = 0;
594
+      for (let i = 0; i < info.length; i++) {
595
+        if (info[i].storehouse_id == storehouse_id) {
596
+          total += info[i].warehousing_count;
597
+        }
598
+      }
599
+
600
+      for (let j = 0; j < info.length; j++) {
601
+        if (info[j].storehouse_id == storehouse_id) {
602
+          out_count += info[j].stock_max_number + info[j].stock_min_number;
603
+        }
604
+      }
605
+      over_count = total - out_count;
606
+      if (parseInt(over_count / min_number) != 0) {
607
+        str = parseInt(over_count / min_number) + max_unit;
608
+      }
609
+      if (over_count % min_number != 0) {
610
+        str_min = (over_count % min_number) + min_unit;
611
+      }
612
+      return str + str_min;
613
+    },
614
+    getOverFlushInfoEight(arr, max_unit, min_unit, min_number, storehouse_id) {
615
+      var max_str = "";
616
+      var min_str = "";
617
+      var total = 0;
618
+      var newarr = arr;
619
+      
620
+      if (newarr.length > 0) {
621
+        for (let i = 0; i < newarr.length; i++) {
622
+          if (newarr[i].storehouse_id == storehouse_id) {
623
+            total += newarr[i].stock_max_number + newarr[i].stock_min_number;
624
+          }
625
+        }
626
+      }
627
+      if (total < min_number) {
628
+        min_str = total + min_unit;
629
+      }
630
+      if (total == 0) {
631
+        min_str = "";
632
+        max_str = "";
633
+      }
634
+      if (total >= min_number) {
635
+        if (parseInt(total / min_number) != 0) {
636
+          max_str = parseInt(total / min_number) + max_unit;
637
+        }
638
+        if (total % min_number != 0) {
639
+          min_str = (total % min_number) + min_unit;
640
+        }
641
+      }
642
+      
643
+      return max_str + min_str;
644
+    },
645
+ 
646
+   getWarehoseInfo(arr) {
647
+      var total = 0;
648
+      if (arr.length > 0) {
649
+        for (let i = 0; i < arr.length; i++) {
650
+          total += parseInt(arr[i].warehousing_count);
651
+        }
652
+      }
653
+      if (total == 0) {
654
+        total = "";
655
+      }
656
+
657
+      return total;
658
+    },
659
+   getOutFlushTen(info, max_unit, min_unit,min_number,storehouse_id){
660
+      var str = "";
661
+      var str_min = "";
662
+      //总库存
663
+      var total = 0;
664
+      for (let i = 0; i < info.length; i++) {
665
+        if (info[i].storehouse_id == storehouse_id) {
666
+           total += info[i].count;
667
+        }
668
+      }
669
+      if (parseInt(total / min_number) != 0) {
670
+        str = parseInt(total / min_number) + max_unit;
671
+      }
672
+      if (total % min_number != 0) {
673
+        str_min = (total % min_number) + min_unit;
674
+      }
675
+      return str + str_min;
676
+    },
677
+   getDrugOut(info, max_unit, min_unit,min_number,storehouse_id){
678
+   
679
+      var str = "";
680
+      var str_min = "";
681
+      //总库存
682
+      var total = 0;
683
+      for (let i = 0; i < info.length; i++) {
684
+        if (info[i].storehouse_id == storehouse_id) {
685
+          total += info[i].count;
686
+        }
687
+      }
688
+      if (parseInt(total / min_number) != 0) {
689
+        str = parseInt(total / min_number) + max_unit;
690
+      }
691
+      if (total % min_number != 0) {
692
+        str_min = (total % min_number) + min_unit;
693
+      }
694
+      return str + str_min;
695
+   },
696
+  handleDetail(val) {
697
+      var manufacturer_name = "";
698
+      for (let i = 0; i < this.manufacturerList.length; i++) {
699
+        if (val.manufacturer == this.manufacturerList[i].id) {
700
+          manufacturer_name = this.manufacturerList[i].manufacturer_name;
701
+        }
702
+      }
703
+      var unit =
704
+        val.dose +
705
+        val.dose_unit +
706
+        "*" +
707
+        val.min_number +
708
+        val.min_unit +
709
+        "/" +
710
+        val.max_unit;
711
+      var over_plus = this.getOverFlushInfo(
712
+        val.drug_warehouse_info,
713
+        val.max_unit,
714
+        val.min_unit,
715
+        val.min_number
716
+      );
717
+      this.$router.push({
718
+        path:
719
+          "/drugstock/in/drugstockflow?drug_id=" +
720
+          val.id +
721
+          "&manufacturer=" +
722
+          manufacturer_name +
723
+          "&unit=" +
724
+          unit +
725
+          "&min_number=" +
726
+          val.min_number +
727
+          "&max_unit=" +
728
+          val.max_unit +
729
+          "&min_unit=" +
730
+          val.min_unit +
731
+          "&over_plus=" +
732
+          over_plus,
733
+      });
734
+      window.sessionStorage.setItem("start_time", this.start_time);
735
+      window.sessionStorage.setItem("end_time", this.end_time);
736
+    },
737
+    handleBatch(val) {
738
+      console.log("val322332323232", val);
739
+      var manufacturer_name = "";
740
+      for (let i = 0; i < this.manufacturerList.length; i++) {
741
+        if (val.manufacturer == this.manufacturerList[i].id) {
742
+          manufacturer_name = this.manufacturerList[i].manufacturer_name;
743
+        }
744
+      }
745
+      var unit =
746
+        val.dose +
747
+        val.dose_unit +
748
+        "*" +
749
+        val.min_number +
750
+        val.min_unit +
751
+        "/" +
752
+        val.max_unit;
753
+      var over_plus = this.getOverFlushInfo(
754
+        val.drug_warehouse_info,
755
+        val.max_unit,
756
+        val.min_unit,
757
+        val.min_number
758
+      );
759
+
760
+      window.sessionStorage.setItem("start_time", this.start_time);
761
+      window.sessionStorage.setItem("end_time", this.end_time);
762
+      this.$router.push({
763
+        path:
764
+          "/drugstock/in/drugbatchnumber?drug_id=" +
765
+          val.id +
766
+          "&manufacturer=" +
767
+          manufacturer_name +
768
+          "&unit=" +
769
+          unit +
770
+          "&min_number=" +
771
+          val.min_number +
772
+          "&max_unit=" +
773
+          val.max_unit +
774
+          "&min_unit=" +
775
+          val.min_unit +
776
+          "&over_plus=" +
777
+          over_plus,
778
+      });
779
+    },
651 780
   },
652 781
   created(){
653 782
     this.getStorehouseList()
654 783
     this.getlist()
655
-    this.getStockDrugCount()
784
+  
656 785
   }
657 786
 }
658 787
 </script>

+ 288 - 263
src/xt_pages/stock/drugs/components/purchaseDrugQuery.vue Ver arquivo

@@ -36,9 +36,9 @@
36 36
           filterable
37 37
            @change="changeGoodTypeName">
38 38
             <el-option
39
-              v-for="item in goodTypeList"
39
+              v-for="item in drugTypeList"
40 40
               :key="item.id"
41
-              :label="item.type_name"
41
+              :label="item.name"
42 42
               :value="item.id">
43 43
             </el-option>
44 44
           </el-select>
@@ -59,67 +59,67 @@
59 59
           >
60 60
             <el-table-column label="药品类型" align="center">
61 61
               <template slot-scope="scope">
62
-                
62
+                 {{getDrugTypeName(scope.row.drug_type)}}
63 63
               </template>
64 64
             </el-table-column>
65 65
             <el-table-column label="药品名称" align="center">
66 66
               <template slot-scope="scope">
67
-                
67
+                 {{scope.row.drug_name}}
68 68
               </template>
69 69
             </el-table-column>
70 70
             <el-table-column label="规格&单位" align="center">
71 71
                 <template slot-scope="scope">
72
-                
72
+                  {{scope.row.dose}}{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
73 73
                 </template>
74 74
             </el-table-column>
75 75
             <el-table-column label="生产厂商" align="center">
76 76
               <template slot-scope="scope">
77
-               
77
+                 {{getManufacturName(scope.row.manufacturer)}}
78 78
               </template>
79 79
             </el-table-column>
80 80
             <el-table-column label="期初结余" align="center">
81 81
                
82
-                 <el-table-column prop="stockIn" label="数量" width="100">
82
+                 <el-table-column prop="stockIn" label="数量" width="100" align="center">
83 83
                    
84 84
                  </el-table-column>
85 85
               
86
-                <el-table-column prop="buy_price" label="进货金额" width="100">
86
+                <el-table-column prop="last_price" label="进货金额" width="100" align="center">
87 87
                    
88 88
                 </el-table-column>
89
-                <el-table-column prop="stockMoney" label="销售金额" width="100">
89
+                <el-table-column prop="stockMoney" label="销售金额" width="100" align="center">
90 90
                  
91 91
                 </el-table-column>
92 92
              
93 93
             </el-table-column>
94 94
             <el-table-column label="本期增加" align="center">
95 95
              
96
-                <el-table-column prop="stockAdd" label="数量" width="100">
96
+                <el-table-column prop="stockAdd" label="数量" width="100" align="center">
97 97
                 
98 98
                 </el-table-column>
99 99
              
100
-                <el-table-column prop="buy_price" label="进货金额" width="100">
100
+                <el-table-column prop="last_price" label="进货金额" width="100" align="center">
101 101
                   
102 102
                 </el-table-column>
103
-                <el-table-column  prop="addStockMoney" label="销售金额"  width="100">
103
+                <el-table-column  prop="addStockMoney" label="销售金额"  width="100" align="center">
104 104
                 </el-table-column>
105 105
               
106 106
             </el-table-column>
107 107
          
108 108
             <el-table-column label="本期减少" align="center">
109
-               <el-table-column prop="outStock" label="数量" width="100">
109
+               <el-table-column prop="outStock" label="数量" width="100" align="center">
110 110
                 </el-table-column>
111
-                <el-table-column  prop="buy_price"  label="进货金额" width="100">
111
+                <el-table-column  prop="last_price"  label="进货金额" width="100" align="center">
112 112
                 </el-table-column>
113
-                <el-table-column prop="stockOutMoney" label="销售金额" width="100">
113
+                <el-table-column prop="stockOutMoney" label="销售金额" width="100" align="center">
114 114
                 </el-table-column>
115 115
             </el-table-column>
116 116
           
117 117
             <el-table-column label="期末结余" align="center">
118
-              <el-table-column prop="overStock" label="数量" width="100">
118
+              <el-table-column prop="overStock" label="数量" width="100" align="center">
119 119
               </el-table-column>
120
-              <el-table-column prop="buy_price" label="进货金额" width="100">
120
+              <el-table-column prop="last_price" label="进货金额" width="100" align="center">
121 121
               </el-table-column>
122
-              <el-table-column prop="oveMoney" label="销售金额" width="100">
122
+              <el-table-column prop="oveMoney" label="销售金额" width="100" align="center">
123 123
               </el-table-column>
124 124
             </el-table-column>
125 125
 
@@ -147,9 +147,7 @@
147 147
 </template>
148 148
 <script>
149 149
 import { getStorehouseList,getPurchaseDrugQuery } from "@/api/drug/drug"
150
-import {
151
-  getStockDrugCount
152
-} from "@/api/stock";
150
+
153 151
 import { uParseTime } from '@/utils/tools'
154 152
 export default {
155 153
 
@@ -170,7 +168,7 @@ export default {
170 168
      page:1,
171 169
      total:0,
172 170
      keyword:"",
173
-     goodTypeList:[],
171
+     drugTypeList:[],
174 172
      start_time:"",
175 173
      end_time:"",
176 174
      countList:[],
@@ -185,7 +183,8 @@ export default {
185 183
      good_id:0,
186 184
      patientList:[],
187 185
      good_name:"",
188
-     specification_name:""
186
+     specification_name:"",
187
+     
189 188
     }
190 189
   
191 190
   },
@@ -206,12 +205,7 @@ export default {
206 205
              this.houseList.push(houseList[i])
207 206
            }
208 207
            this.manufacturerList = response.data.data.manufacturerList
209
-           var obj = {id:0,type_name:"全部"}
210
-           this.goodTypeList.push(obj)
211
-           var goodTypeList = response.data.data.goodTypeList
212
-           for(let i=0;i<goodTypeList.length;i++){
213
-             this.goodTypeList.push(goodTypeList[i])
214
-            }
208
+        
215 209
            this.patientList = response.data.data.patientList
216 210
          }
217 211
       })
@@ -228,22 +222,49 @@ export default {
228 222
       getPurchaseDrugQuery(params).then(response=>{
229 223
          if(response.data.state == 1){
230 224
             var list = response.data.data.list
231
-            for(let i=0;i<list.length;i++){
232
-               list[i].stockIn = this.getWarehouseInfo(list[i].warehouse_info)
233
-               list[i].stockMoney = (this.getWarehouseInfo(list[i].warehouse_info) * list[i].buy_price).toFixed(2)
234
-               list[i].stockAdd = this.getWarehouseInfoOne(list[i].warehouse_info)
235
-               list[i].addStockMoney = (this.getWarehouseInfoOne(list[i].warehouse_info) *list[i].buy_price).toFixed(2)
236
-
237
-               list[i].outStock = this.getWarehouseOut(list[i].warehouse_out_info)
238
-               list[i].stockOutMoney = (this.getWarehouseOut(list[i].warehouse_out_info)*list[i].buy_price).toFixed(2)
239
-
240
-               list[i].overStock = this.getWarehouseInfo(list[i].warehouse_info)
241
-               list[i].oveMoney = (this.getWarehouseInfo(list[i].warehouse_info)*list[i].buy_price).toFixed(2)
225
+            for (let i = 0; i < list.length; i++) {
226
+              for (let j = 0; j < list[i].drug_warehouse_info.length; j++) {
227
+                if (list[i].max_unit == list[i].drug_warehouse_info[j].max_unit) {
228
+                   list[i].drug_warehouse_info[j].stock_max_number =list[i].min_number *list[i].drug_warehouse_info[j].stock_max_number
229
+                   list[i].drug_warehouse_info[j].warehousing_count =list[i].min_number *list[i].drug_warehouse_info[j].warehousing_count
230
+                 }
231
+                }
232
+                for (let y = 0; y < list[i].drug_warehouse_out.length; y++) {
233
+                  if (list[i].drug_warehouse_out[y].count_unit == list[i].max_unit) {
234
+                    list[i].drug_warehouse_out[y].count =list[i].drug_warehouse_out[y].count * list[i].min_number
235
+                  }
236
+                }
237
+                for (let z = 0; z < list[i].drug_cancel_stock_info.length; z++) {
238
+                  if (list[i].drug_cancel_stock_info[z].max_unit == list[i].max_unit) {
239
+                    list[i].drug_cancel_stock_info[z].count =list[i].drug_cancel_stock_info[z].count * list[i].min_number
240
+                   }
241
+                }
242
+            }
243
+            var arr = [];
244
+            for (let i = 0; i < list.length; i++) {
245
+             if (list[i].drug_warehouse_info.length > 0) {
246
+               arr.push(list[i]);
247
+              }
242 248
             }
243
-            this.tableList = list
249
+            for(let i=0;i<arr.length;i++){
250
+              arr[i].stockIn = this.getDrugWarehouseInfoStart(arr[i].drug_warehouse_info,arr[i].min_number,arr[i].min_unit,arr[i].max_unit,arr[i].drug_warehouse_out)
251
+              arr[i].stockMoney = this.getDrugWarehouseInfoMoneyStart(arr[i].drug_warehouse_info,arr[i].min_number,arr[i].min_unit,arr[i].max_unit,arr[i].last_price,arr[i].drug_warehouse_out)
252
+              arr[i].stockAdd = this.getDrugWarehouseInfoStockAdd(arr[i].drug_warehouse_info,arr[i].min_number,arr[i].min_unit,arr[i].max_unit)
253
+              arr[i].addStockMoney = this.getDrugWarehouseInfoaddMoney(arr[i].drug_warehouse_info,arr[i].min_number,arr[i].min_unit,arr[i].max_unit,arr[i].last_price)
254
+              arr[i].outStock = this.getDrugWarehouseOutInfo(arr[i].drug_warehouse_out,arr[i].min_number,arr[i].min_unit,arr[i].max_unit)
255
+              arr[i].stockOutMoney = this.getDrugWarehouseOutMoney(arr[i].drug_warehouse_out,arr[i].min_number,arr[i].min_unit,arr[i].max_unit,arr[i].last_price)
256
+              arr[i].overStock = this.getDrugWarehouseInfo(arr[i].drug_warehouse_info,arr[i].min_number,arr[i].min_unit,arr[i].max_unit)
257
+              arr[i].oveMoney =  this.getDrugWarehouseInfoMoney(arr[i].drug_warehouse_info,arr[i].min_number,arr[i].min_unit,arr[i].max_unit,arr[i].last_price)
258
+            }
259
+            this.tableList = arr;
244 260
             this.total = response.data.data.total
245
-
246
-           this.manufacturerList = response.data.data.manufacturerList
261
+            this.manufacturerList = response.data.data.manufacturerList
262
+            var drugTypeList = response.data.data.drugTypeList
263
+            var obj = {id:0,name:"全部"}
264
+            this.drugTypeList.push(obj)
265
+            for(let i=0;i<drugTypeList.length;i++){
266
+               this.drugTypeList.push(drugTypeList[i])
267
+            }
247 268
            
248 269
          }
249 270
       })
@@ -265,22 +286,14 @@ export default {
265 286
       this.page = val;
266 287
       this.getlist()
267 288
     },
268
-    handleSizeChangeOne(val) {
269
-      this.limitone = val;
270
-      this.toDialogClick(this.good_id,this.good_name,this.specification_name)
271
-    },
272
-    handleCurrentChangeOne(val) {
273
-      this.pageone = val;
274
-      this.toDialogClick(this.good_id,this.good_name,this.specification_name)
275
-    },
276 289
    seach(){
277 290
     this.getlist()
278 291
    },
279
-   getGoodTypeName(id){
292
+   getDrugTypeName(id){
280 293
      var type_name = ""
281
-     for(let i=0;i<this.goodTypeList.length;i++){
282
-       if(id == this.goodTypeList[i].id){
283
-         type_name = this.goodTypeList[i].type_name
294
+     for(let i=0;i<this.drugTypeList.length;i++){
295
+       if(id == this.drugTypeList[i].value){
296
+         type_name = this.drugTypeList[i].name
284 297
        }
285 298
      }
286 299
      return type_name
@@ -294,189 +307,7 @@ export default {
294 307
      }
295 308
      return storehouse_name
296 309
    },
297
-   getWareInfoCount(val,storehouse_id){
298
-     var count = 0
299
-     if(val.length > 0){
300
-       for(let i=0;i<val.length;i++){
301
-         if(val[i].storehouse_id == storehouse_id){
302
-             count +=val[i].warehousing_count
303
-         }
304
-       }
305
-     }
306
-     if(count > 0){
307
-       return count
308
-     }else{
309
-       return ""
310
-     }
311
-   },
312
-   getStockDrugCount(){
313
-        var params ={
314
-           keywords: this.keywords,
315
-           start_time:this.start_time,
316
-           end_time:this.end_time,
317
-        }
318
-      getStockDrugCount(params).then(response=>{
319
-         if(response.data.state == 1){
320
-           var outlist = response.data.data.outList
321
-           this.outCountList = outlist
322
-           var autoCount = response.data.data.autoCount
323
-           this.autoCountList = autoCount
324
-           var totalCount = response.data.data.totalCount
325
-           this.cancelCountList = totalCount
326
-         }
327
-      })
328
-    },
329
-    getWareInfoCountOne(val,storehouse_id){
330
-     var count = 0
331
-     if(val.length > 0){
332
-       for(let i=0;i<val.length;i++){
333
-         if(val[i].storehouse_id == storehouse_id){
334
-             count +=val[i].stock_count
335
-         }
336
-       }
337
-     }
338
-     if(count > 0){
339
-       return count
340
-     }else{
341
-       return ""
342
-     }
343
-   },
344
-   getOutCount(id){
345
-      var count = 0
346
-      for(let i=0;i<this.outCountList.length;i++){
347
-         if(id == this.outCountList[i].good_id){
348
-           count = this.outCountList[i].count
349
-         }
350
-      }
351
-     return count
352
-   },
353
-   getAutoCount(id){
354
-     var count= 0
355
-     for(let i=0;i<this.autoCountList.length;i++){
356
-       if(id == this.autoCountList[i].good_id){
357
-         count = this.autoCountList[i].count
358
-       }
359
-     }
360
-     return count
361
-   },
362
-   getCancelCount(id){
363
-     var count = 0
364
-     for(let i=0;i<this.cancelCountList.length;i++){
365
-       if(id == this.cancelCountList[i].good_id){
366
-          count = this.cancelCountList[i].count
367
-       }
368
-     }
369
-     return count
370
-   },
371
-   getCancelCountInfo(cancel_stock_info,storehouse_id){
372
-     var count = 0 
373
-     if(cancel_stock_info.length >0){
374
-        for(let i=0;i<cancel_stock_info.length;i++){
375
-          if(storehouse_id ==  cancel_stock_info[i].storehouse_id){
376
-              count += cancel_stock_info[i].count
377
-          }
378
-        }
379
-     }
380
-     return count
381
-   },
382
-   getWareOutInfoCount(warehouse_out_info,storehouse_id){
383
-     var count = 0
384
-     if(warehouse_out_info.length > 0){
385
-       for(let i=0;i<warehouse_out_info.length;i++){
386
-         if(storehouse_id == warehouse_out_info[i].storehouse_id){
387
-            count +=warehouse_out_info[i].count
388
-         }
389
-       }
390
-     }
391
-     return count
392
-   },
393
-   getInCount(id){
394
-      var count= 0
395
-     for(let i=0;i<this.countList.length;i++){
396
-      if(id == this.countList[i].good_id){
397
-          count = this.countList[i].count
398
-      }
399
-     }
400
-     return count
401
-    },
402
-    getOutCount(id){
403
-      var count = 0
404
-      for(let i=0;i<this.outCountList.length;i++){
405
-         if(id == this.outCountList[i].good_id){
406
-           count = this.outCountList[i].count
407
-         }
408
-      }
409
-     return count
410
-   },
411
-   getAutoCount(id){
412
-     var count= 0
413
-     for(let i=0;i<this.autoCountList.length;i++){
414
-       if(id == this.autoCountList[i].good_id){
415
-         count = this.autoCountList[i].count
416
-       }
417
-     }
418
-     return count
419
-   },
420
-   getCancelCount(id){
421
-     var count = 0
422
-     for(let i=0;i<this.cancelCountList.length;i++){
423
-       if(id == this.cancelCountList[i].good_id){
424
-          count = this.cancelCountList[i].count
425
-       }
426
-     }
427
-     return count
428
-   },
429
-   getStockCount(id){
430
-     var stock_count = 0
431
-     for(let i=0;i<this.countList.length;i++){
432
-       if(id == this.countList[i].good_id){
433
-         stock_count = this.countList[i].stock_count
434
-       }
435
-     }
436
-     return stock_count
437
-   },
438
-   getWareInfo(arr){
439
-     var total = 0
440
-     if(arr.length > 0){
441
-       for(let i=0;i<arr.length;i++){
442
-         total += parseInt(arr[i].warehousing_count)
443
-       }
444
-     }else{
445
-       total = ""
446
-     }
447
-     return total
448
-   },
449
-   getOverplus(arr){
450
-     var total = 0
451
-     if(arr.length > 0){
452
-      for(let i=0;i<arr.length;i++){
453
-        total += arr[i].stock_count
454
-      }
455
-     }else{
456
-       total = ""
457
-     }
458
-     return total
459
-   },
460
-   getCancelInfo(arr){
461
-     var total = 0
462
-     if(arr.length > 0){
463
-      for(let i=0;i<arr.length;i++){
464
-        total += arr[i].count
465
-      }
466
-     }else{
467
-       total = ""
468
-     }
469
-     return total
470
-   },
471
-   getOverFlushInfo(arr){
472
-     var total = 0
473
-     if(arr.length >0){
474
-      for(let i=0;i<arr.length;i++){
475
-        total += arr[i].stock_count
476
-      }
477
-     }
478
-     return total
479
-   },
310
+
480 311
   
481 312
    startFirstTimeChange(){
482 313
      this.getlist()
@@ -509,44 +340,238 @@ export default {
509 340
   startTimeChange(){
510 341
 
511 342
   },
512
-  getWarehouseInfo(val){
513
-    var count =0 
514
-    for(let i=0;i<val.length;i++){
515
-      count +=val[i].stock_count
343
+  getDrugWarehouseInfo(arr,min_number,min_unit,max_unit){
344
+   var total = 0
345
+   var max_str = "";
346
+   var min_str = "";
347
+   if(arr.length > 0){
348
+    for(let i=0;i<arr.length;i++){
349
+      total += arr[i].stock_max_number + arr[i].stock_min_number
350
+     }
351
+   }
352
+  if (total < min_number) {
353
+     min_str = total + min_unit;
354
+   }
355
+  if (total == 0) {
356
+     min_str = "";
357
+     max_str = "";
358
+  }
359
+  if (total >= min_number) {
360
+    if (parseInt(total / min_number) != 0) {
361
+      max_str = parseInt(total / min_number) + max_unit;
362
+    }
363
+    if (total % min_number != 0) {
364
+      min_str = (total % min_number) + min_unit;
365
+    }
366
+   }
367
+  return max_str + min_str;  
368
+
369
+  },
370
+  getDrugWarehouseInfoStart(arr,min_number,min_unit,max_unit,outArr){
371
+   var total = 0
372
+   var add_total = 0
373
+   var out_total = 0
374
+   var max_str = "";
375
+   var min_str = "";
376
+   if(arr.length > 0){
377
+    for(let i=0;i<arr.length;i++){
378
+      add_total += arr[i].warehousing_count
379
+     }
380
+   }
381
+   if(outArr.length > 0){
382
+     for(let i=0;i<outArr.length;i++){
383
+      out_total+= outArr[i].count
384
+     }  
385
+   }
386
+   total = add_total - out_total
387
+  if (total < min_number) {
388
+    min_str = total + min_unit;
389
+   }
390
+  if (total == 0) {
391
+     min_str = "";
392
+     max_str = "";
393
+  }
394
+  if (total >= min_number) {
395
+    if (parseInt(total / min_number) != 0) {
396
+      max_str = parseInt(total / min_number) + max_unit;
397
+    }
398
+    if (total % min_number != 0) {
399
+      min_str = (total % min_number) + min_unit;
400
+    }
401
+   }
402
+  return max_str + min_str;  
403
+
404
+  },
405
+ getDrugWarehouseInfoMoneyStart(arr,min_number,min_unit,max_unit,last_price,outArr){
406
+   var total = 0
407
+   var min_str = 0
408
+   var max_str = 0
409
+   var addTotal = 0
410
+   var outTotal = 0
411
+   var total_price = 0
412
+   if(arr.length > 0){
413
+    for(let i=0;i<arr.length;i++){
414
+      addTotal += arr[i].warehousing_count
415
+     }
416
+   }
417
+   if(outArr.length > 0){
418
+     for(let i=0;i<outArr.length;i++){
419
+      outTotal += outArr[i].count
420
+     }
421
+   }
422
+   console.log("adw23223wode",addTotal)
423
+   console.log("233232232tade",outTotal)
424
+   total = addTotal - outTotal
425
+   if (total < min_number) {
426
+      min_str = total 
427
+   }
428
+   if (total >= min_number) {
429
+    if (parseInt(total / min_number) != 0) {
430
+      max_str = parseInt(total / min_number);
431
+    }
432
+    if (total % min_number != 0) {
433
+      min_str = (total % min_number);
434
+    }
435
+   }
436
+ 
437
+   total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
438
+    console.log("total_price",total_price)
439
+   return total_price
440
+  },
441
+  getDrugWarehouseInfoMoney(arr,min_number,min_unit,max_unit,last_price){
442
+   var total = 0
443
+   var min_str = 0
444
+   var max_str = 0
445
+   var total_price = 0
446
+   if(arr.length > 0){
447
+    for(let i=0;i<arr.length;i++){
448
+      total += arr[i].stock_max_number + arr[i].stock_min_number
449
+     }
450
+   }
451
+   if (total < min_number) {
452
+      min_str = total 
453
+   }
454
+   if (total >= min_number) {
455
+    if (parseInt(total / min_number) != 0) {
456
+      max_str = parseInt(total / min_number);
516 457
     }
517
-    if(count > 0 ){
518
-      return count
519
-    }else{
520
-      return count
458
+    if (total % min_number != 0) {
459
+      min_str = (total % min_number);
521 460
     }
461
+   }
462
+ 
463
+   total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
464
+    console.log("total_price",total_price)
465
+   return total_price
522 466
   },
523
-  getWarehouseInfoOne(val){
524
-    var count =0 
525
-    for(let i=0;i<val.length;i++){
526
-      count +=val[i].warehousing_count
467
+  getDrugWarehouseInfoStockAdd(arr,min_number,min_unit,max_unit){
468
+  
469
+   var total = 0
470
+   var max_str = "";
471
+   var min_str = "";
472
+   if(arr.length > 0){
473
+    for(let i=0;i<arr.length;i++){
474
+      total += arr[i].warehousing_count
475
+     }
476
+   }
477
+  if (total < min_number) {
478
+    min_str = total + min_unit;
479
+   }
480
+  if (total == 0) {
481
+     min_str = "";
482
+     max_str = "";
483
+  }
484
+  if (total >= min_number) {
485
+    if (parseInt(total / min_number) != 0) {
486
+      max_str = parseInt(total / min_number) + max_unit;
527 487
     }
528
-    if(count > 0 ){
529
-      return count
530
-    }else{
531
-      return count
488
+    if (total % min_number != 0) {
489
+      min_str = (total % min_number) + min_unit;
532 490
     }
491
+   }
492
+  return max_str + min_str;  
533 493
   },
534
-  getWarehouseOut(val){
535
-    var count = 0
536
-    for(let i=0;i<val.length;i++){
537
-      count +=val[i].count
494
+  getDrugWarehouseInfoaddMoney(arr,min_number,min_unit,max_unit,last_price){
495
+   var total = 0
496
+   var min_str = 0
497
+   var max_str = 0
498
+   var total_price = 0
499
+   if(arr.length > 0){
500
+    for(let i=0;i<arr.length;i++){
501
+      total += arr[i].warehousing_count
502
+     }
503
+   }
504
+   if (total < min_number) {
505
+      min_str = total 
506
+   }
507
+   if (total >= min_number) {
508
+    if (parseInt(total / min_number) != 0) {
509
+      max_str = parseInt(total / min_number);
538 510
     }
539
-    if(count >0){
540
-     return count
541
-    }else{
542
-      return count
511
+    if (total % min_number != 0) {
512
+      min_str = (total % min_number);
543 513
     }
514
+   }
515
+ 
516
+   total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
517
+   return total_price
518
+  },
519
+  getDrugWarehouseOutInfo(arr,min_number,min_unit,max_unit){
520
+   var total = 0
521
+   var max_str = "";
522
+   var min_str = "";
523
+   if(arr.length > 0){
524
+    for(let i=0;i<arr.length;i++){
525
+      total += arr[i].count
526
+     }
527
+   }
528
+  if (total < min_number) {
529
+    min_str = total + min_unit;
530
+   }
531
+  if (total == 0) {
532
+     min_str = "";
533
+     max_str = "";
534
+  }
535
+  if (total >= min_number) {
536
+    if (parseInt(total / min_number) != 0) {
537
+      max_str = parseInt(total / min_number) + max_unit;
538
+    }
539
+    if (total % min_number != 0) {
540
+      min_str = (total % min_number) + min_unit;
541
+    }
542
+   }
543
+  return max_str + min_str;  
544
+  },
545
+  getDrugWarehouseOutMoney(arr,min_number,min_unit,max_unit,last_price){
546
+   var total = 0
547
+   var min_str = 0
548
+   var max_str = 0
549
+   var total_price = 0
550
+   if(arr.length > 0){
551
+    for(let i=0;i<arr.length;i++){
552
+      total += arr[i].count
553
+     }
554
+   }
555
+   if (total < min_number) {
556
+      min_str = total 
557
+   }
558
+   if (total >= min_number) {
559
+    if (parseInt(total / min_number) != 0) {
560
+      max_str = parseInt(total / min_number);
561
+    }
562
+    if (total % min_number != 0) {
563
+      min_str = (total % min_number);
564
+    }
565
+    total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
566
+    return total_price
567
+   }
544 568
   }
569
+  
545 570
   },
546 571
   created(){
547 572
     this.getStorehouseList()
548 573
     this.getlist()
549
-    this.getStockDrugCount()
574
+  
550 575
   }
551 576
 }
552 577
 </script>

+ 6 - 0
src/xt_pages/stock/drugs/drugBatchNumber.vue Ver arquivo

@@ -104,6 +104,12 @@
104 104
             {{ scope.row.price }}
105 105
           </template>
106 106
         </el-table-column>
107
+        <!-- <el-table-column prop="drug_name" label="该批次剩余库存" align="center">
108
+          <template slot-scope="scope">
109
+           <span v-if="scope.row.stock_max_number >0">{{ scope.row.stock_max_number }}{{drug.max_unit}}</span> 
110
+           <span v-if="scope.row.stock_min_number >0">{{scope.row.stock_min_number}}{{drug.min_unit}}</span>
111
+          </template>
112
+        </el-table-column> -->
107 113
          <el-table-column prop="remake" label="备注" align="center">
108 114
           <template slot-scope="scope">
109 115
             {{ scope.row.remark }}

+ 3 - 1
src/xt_pages/stock/drugs/query.vue Ver arquivo

@@ -219,7 +219,8 @@
219 219
                   border-inline-end: none;
220 220
                   text-align: center;
221 221
                 "
222
-              >
222
+              > 
223
+              <span>
223 224
                 {{
224 225
                   getOutFlushNight(
225 226
                     scope.row.drug_warehouse_info,
@@ -230,6 +231,7 @@
230 231
                     item.storehouse_id
231 232
                   )
232 233
                 }}&nbsp;
234
+               </span> 
233 235
               </td>
234 236
             </tr>
235 237
           </template>

+ 11 - 12
src/xt_pages/stock/query/goodNewQuery.vue Ver arquivo

@@ -1,6 +1,8 @@
1 1
 <template>
2 2
   <div class="main-contain">
3
-     <div class="app-container ">
3
+     <div class="app-container "  
4
+        v-loading="loading"
5
+        element-loading-text="拼命加载中">
4 6
         <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
5 7
          <div>
6 8
           <span>仓库:</span>
@@ -145,15 +147,11 @@
145 147
             <el-table-column label="总库存量" align="center">
146 148
               <template slot-scope="scope">
147 149
                 <span v-if="org_id == 3907 || org_id == 9583">
148
-                    {{
149
-                    getWareInfo(scope.row.xt_warehouse_info) -
150
-                    getAutoCount(scope.row.id) -
151
-                    getOutCount(scope.row.id) +
152
-                    getCancelCount(scope.row.id)
153
-                    }}
150
+                    {{getWareInfo(scope.row.xt_warehouse_info) - getAutoCount(scope.row.id) -getOutCount(scope.row.id) +getCancelCount(scope.row.id)}}
154 151
                 </span>
155 152
                 <span v-if="org_id != 3907 && org_id != 9583">
156
-                    {{getOverFlushInfo(scope.row.xt_warehouse_info)}}
153
+                   <span v-if="getOverFlushInfo(scope.row.xt_warehouse_info) <= scope.row.stock_warn_count" style="color:red"> {{getOverFlushInfo(scope.row.xt_warehouse_info)}}</span>
154
+                   <span v-if="getOverFlushInfo(scope.row.xt_warehouse_info) > scope.row.stock_warn_count"> {{getOverFlushInfo(scope.row.xt_warehouse_info)}}</span>
157 155
                 </span>
158 156
                </template>
159 157
             </el-table-column>
@@ -333,7 +331,8 @@ export default {
333 331
      good_id:0,
334 332
      patientList:[],
335 333
      good_name:"",
336
-     specification_name:""
334
+     specification_name:"",
335
+     loading:false,
337 336
     }
338 337
   
339 338
   },
@@ -342,7 +341,7 @@ export default {
342 341
 
343 342
     },
344 343
     changeGoodName(){
345
-
344
+      this.getlist()
346 345
     },
347 346
     toClick(val){
348 347
        var manufacturer_name = ""
@@ -390,6 +389,7 @@ export default {
390 389
       })
391 390
     },
392 391
     getlist(){
392
+       this.loading = true
393 393
         var params = {
394 394
           storehouse_id:this.storehouse_id,
395 395
           good_type:this.good_type,
@@ -402,8 +402,7 @@ export default {
402 402
       getGoodNewQuery(params).then(response=>{
403 403
          if(response.data.state == 1){
404 404
             var list = response.data.data.list
405
-            console.log("list2332233232323232w",list)
406
-            
405
+            this.loading = false
407 406
             if(list.length > 0){
408 407
               var arr = []
409 408
               for(let i=0;i<list.length;i++){

+ 19 - 2
src/xt_pages/stock/query/purchaseStockQuery.vue Ver arquivo

@@ -229,8 +229,8 @@ export default {
229 229
          if(response.data.state == 1){
230 230
             var list = response.data.data.list
231 231
             for(let i=0;i<list.length;i++){
232
-               list[i].stockIn = this.getWarehouseInfo(list[i].warehouse_info)
233
-               list[i].stockMoney = (this.getWarehouseInfo(list[i].warehouse_info) * list[i].buy_price).toFixed(2)
232
+               list[i].stockIn = this.getWarehouseInfoStart(list[i].warehouse_info,list[i].warehouse_out_info)
233
+               list[i].stockMoney = (this.getWarehouseInfoStart(list[i].warehouse_info,list[i].warehouse_out_info) * list[i].buy_price).toFixed(2)
234 234
                list[i].stockAdd = this.getWarehouseInfoOne(list[i].warehouse_info)
235 235
                list[i].addStockMoney = (this.getWarehouseInfoOne(list[i].warehouse_info) *list[i].buy_price).toFixed(2)
236 236
 
@@ -508,6 +508,23 @@ export default {
508 508
   },
509 509
   startTimeChange(){
510 510
 
511
+  },
512
+  getWarehouseInfoStart(arr1,arr2){
513
+    var count =0
514
+    var addCount = 0 
515
+    var outCount = 0
516
+    for(let i=0;i<arr1.length;i++){
517
+      addCount +=arr1[i].warehousing_count
518
+    }
519
+    for(let i=0;i<arr2.length;i++){
520
+      outCount +=arr2[i].count
521
+    }
522
+    count = addCount - outCount
523
+    if(count > 0 ){
524
+      return count
525
+    }else{
526
+      return count
527
+    }
511 528
   },
512 529
   getWarehouseInfo(val){
513 530
     var count =0