소스 검색

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

csx 2 년 전
부모
커밋
a5a2b9fa1b
3개의 변경된 파일1228개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      src/api/drug/drug.js
  2. 659 0
      src/xt_pages/stock/drugs/components/drugQuery.vue
  3. 553 0
      src/xt_pages/stock/drugs/components/purchaseDrugQuery.vue

+ 16 - 0
src/api/drug/drug.js 파일 보기

@@ -563,3 +563,19 @@ export function getDrugExpiryDateQuery(params) {
563 563
     params: params
564 564
   })
565 565
 }
566
+
567
+export function getPurchaseDrugQuery(params) {
568
+  return request({
569
+    url: '/api/drug/getpurchasedrugquery',
570
+    method: 'get',
571
+    params: params
572
+  })
573
+}
574
+
575
+export function getDrugNewQuery(params) {
576
+  return request({
577
+    url: '/api/drug/getdrugnewquery',
578
+    method: 'get',
579
+    params: params
580
+  })
581
+}

+ 659 - 0
src/xt_pages/stock/drugs/components/drugQuery.vue 파일 보기

@@ -0,0 +1,659 @@
1
+<template>
2
+  <div class="main-contain">
3
+     <div class="app-container ">
4
+        <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
5
+         <div>
6
+          <span>仓库:</span>
7
+          <el-select v-model="storehouse_id" style="width:200px;margin-right:10px;" placeholder="请选择"
8
+          filterable
9
+           @change="changeStorehouseName">
10
+            <el-option
11
+              v-for="item in houseList"
12
+              :key="item.id"
13
+              :label="item.storehouse_name"
14
+              :value="item.id">
15
+            </el-option>
16
+          </el-select>
17
+          <span>库存预警:</span>
18
+          <el-select v-model="good_type" style="width:250px;margin-right:10px;" placeholder="请选择"
19
+          filterable
20
+           @change="changeGoodName">
21
+            <el-option
22
+              v-for="item in goodList"
23
+              :key="item.id"
24
+              :label="item.name"
25
+              :value="item.id">
26
+            </el-option>
27
+          </el-select>
28
+          <el-input v-model="keyword" style="width:200px" placeholder="请输入耗材名称或生产厂商" ></el-input>
29
+          <el-button  type="primary" icon="el-icon-search" @click="seach">搜索</el-button>
30
+         </div>
31
+        </div>
32
+
33
+           <el-table
34
+            :row-style="{ color: '#303133' }"
35
+            :header-cell-style="{
36
+              backgroundColor: 'rgb(245, 247, 250)',
37
+              color: '#606266'
38
+            }"
39
+            :data="tableList"
40
+            :class="signAndWeighBoxPatients"
41
+            border
42
+          >
43
+            <el-table-column label="药品类型" align="center">
44
+              <template slot-scope="scope">
45
+               
46
+              </template>
47
+            </el-table-column>
48
+            <el-table-column label="药品名称" align="center">
49
+              <template slot-scope="scope">
50
+                
51
+              </template>
52
+            </el-table-column>
53
+            <el-table-column label="规格&单位" align="center">
54
+                <template slot-scope="scope">
55
+                 
56
+                </template>
57
+            </el-table-column>
58
+            <el-table-column label="生产厂商" align="center">
59
+              <template slot-scope="scope">
60
+                
61
+              </template>
62
+            </el-table-column>
63
+            <el-table-column label="国家编码" align="center">
64
+              <template slot-scope="scope">
65
+               
66
+              </template>
67
+            </el-table-column>
68
+            <el-table-column label="仓库名称" align="center">
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>
75
+              </template>
76
+            </el-table-column>
77
+        
78
+            <el-table-column label="入库量" align="center">
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>
85
+               </template>
86
+            </el-table-column>
87
+          
88
+            <el-table-column label="出库量" align="center">
89
+              <template slot-scope="scope">
90
+              
91
+             </template>
92
+            </el-table-column>
93
+
94
+            <el-table-column label="退库数量" align="center">
95
+              <template slot-scope="scope">
96
+               
97
+
98
+              </template>
99
+            </el-table-column>
100
+
101
+             <el-table-column label="实际出库" align="center">
102
+              <template slot-scope="scope">
103
+             
104
+             </template>
105
+            </el-table-column>
106
+
107
+            <el-table-column label="剩余库存" align="center">
108
+             
109
+            </el-table-column>
110
+
111
+            <el-table-column label="总库存量" align="center">
112
+            
113
+            </el-table-column>
114
+           
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>
132
+          </el-table>
133
+           <el-pagination
134
+            @size-change="handleSizeChange"
135
+            @current-change="handleCurrentChange"
136
+            :page-sizes="[10, 50, 100,200,500,1000]"
137
+            :page-size="10"
138
+            background
139
+            align="right"
140
+            style="margin-top:20px;"
141
+            layout="total, sizes, prev, pager, next, jumper"
142
+            :total="total"
143
+          >
144
+            </el-pagination>
145
+     </div>
146
+
147
+
148
+
149
+    <el-dialog
150
+      title="出库详情"
151
+      :visible.sync="dialogVisible"
152
+      width="70%">
153
+      <span>
154
+        耗材名称:{{good_name}}
155
+        规格&单位:{{specification_name}}
156
+        查询日期:
157
+          <el-date-picker
158
+            size="small"
159
+            v-model="start_first_time"
160
+            prefix-icon="el-icon-date"
161
+            :editable="false"
162
+            style="width: 150px;"
163
+            type="date"
164
+            placeholder="选择日期时间"
165
+            align="right"
166
+            format="yyyy-MM-dd"
167
+            value-format="yyyy-MM-dd"
168
+            @change="startFirstTimeChange"
169
+           ></el-date-picker> 
170
+            <span>-</span> 
171
+            <el-date-picker
172
+              size="small"
173
+              v-model="end_first_time"
174
+              prefix-icon="el-icon-date"
175
+              :editable="false"
176
+              style="width: 150px;"
177
+              type="date"
178
+              placeholder="选择日期时间"
179
+              align="right"
180
+              format="yyyy-MM-dd"
181
+              value-format="yyyy-MM-dd"
182
+              @change="endEndTimeChange"
183
+          ></el-date-picker>
184
+      </span>
185
+      <el-divider></el-divider>
186
+       <el-table
187
+          :row-style="{ color: '#303133' }"
188
+          :header-cell-style="{
189
+            backgroundColor: 'rgb(245, 247, 250)',
190
+            color: '#606266'
191
+          }"
192
+          :data="tableData"
193
+          :class="signAndWeighBoxPatients"
194
+          border
195
+          >
196
+          <el-table-column label="单据编号" align="center">
197
+            <template slot-scope="scope">
198
+              {{scope.row.warehouse_out_order_number}}
199
+            </template>
200
+          </el-table-column>
201
+          <el-table-column label="操作时间" align="center">
202
+            <template slot-scope="scope">
203
+              {{getTime(scope.row.ctime)}}
204
+            </template>
205
+          </el-table-column>
206
+          <el-table-column label="出库数量" align="center">
207
+              <template slot-scope="scope">
208
+                {{scope.row.count}}
209
+              </template>
210
+          </el-table-column>
211
+          <el-table-column label="库存数量" align="center">
212
+            <template slot-scope="scope">
213
+               
214
+            </template>
215
+          </el-table-column>
216
+          <el-table-column label="使用人" align="center">
217
+            <template slot-scope="scope">
218
+              {{getName(scope.row.patient_id)}}
219
+            </template>
220
+          </el-table-column>
221
+          <el-table-column label="备注" align="center">
222
+            <template slot-scope="scope">
223
+              {{scope.row.remark}}
224
+            </template>
225
+          </el-table-column>
226
+       </el-table>
227
+       <el-pagination
228
+            @size-change="handleSizeChangeOne"
229
+            @current-change="handleCurrentChangeOne"
230
+            :page-sizes="[10, 50, 100,200,500,1000]"
231
+            :page-size="10"
232
+            background
233
+            align="right"
234
+            style="margin-top:20px;"
235
+            layout="total, sizes, prev, pager, next, jumper"
236
+            :total="totalone"
237
+          >
238
+            </el-pagination>
239
+      <span slot="footer" class="dialog-footer">
240
+        <el-button @click="dialogVisible = false">取 消</el-button>
241
+        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
242
+      </span>
243
+    </el-dialog>
244
+
245
+  </div>
246
+</template>
247
+<script>
248
+import { getStorehouseList,getDrugNewQuery,getGoodWarehouseOutInfoById } from "@/api/drug/drug"
249
+import {
250
+  getStockDrugCount
251
+} from "@/api/stock";
252
+import { uParseTime } from '@/utils/tools'
253
+export default {
254
+
255
+  data(){
256
+    return{
257
+     tableList:[],
258
+     goodList:[
259
+      {id:1,name:"全部耗材"},
260
+      {id:2,name:"库存预警"},
261
+     ],
262
+     houseList:[],
263
+     storehouse_id:0,
264
+     good_type:1,
265
+     multipleSelection: [],
266
+     signAndWeighBoxPatients: "sign-and-weigh-box-patients",
267
+     manufacturerList:[],
268
+     limit:10,
269
+     page:1,
270
+     total:0,
271
+     limitone:10,
272
+     pageone:1,
273
+     totalone:0,
274
+     keyword:"",
275
+     goodTypeList:[],
276
+     start_time:"",
277
+     end_time:"",
278
+     countList:[],
279
+     outCountList:[],
280
+     autoCountList:[],
281
+     cancelCountList:[],
282
+     org_id:this.$store.getters.xt_user.org_id,
283
+     dialogVisible:false,
284
+     start_first_time:"",
285
+     end_first_time:"",
286
+     tableData:[],
287
+     good_id:0,
288
+     patientList:[],
289
+     good_name:"",
290
+     specification_name:""
291
+    }
292
+  
293
+  },
294
+  methods:{
295
+    changeStorehouseName(){
296
+
297
+    },
298
+    changeGoodName(){
299
+
300
+    },
301
+    toClick(val){
302
+       var manufacturer_name = ""
303
+       var specification_name = ""
304
+       for(let i=0;i<this.manufacturerList.length;i++){
305
+          if(val.manufacturer == this.manufacturerList[i].id){
306
+            manufacturer_name = this.manufacturerList[i].manufacturer_name
307
+          }
308
+       }
309
+      specification_name = val.specification_name + "/" + val.packing_unit
310
+      var overCount  = this.getOverplus(val.xt_warehouse_info)
311
+      // window.sessionStorage.setItem('start_time',this.start_time)
312
+      // window.sessionStorage.setItem('end_time',this.end_time)
313
+      this.$router.push({path:"/stock/in/stockflow?id="+val.id+"&manufacturer="+manufacturer_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
314
+    },
315
+    toClickOne(val){
316
+    
317
+      var manufacturer_name = ""
318
+      var specification_name = ""
319
+      for(let i=0;i<this.manufacturerList.length;i++){
320
+          if(val.manufacturer == this.manufacturerList[i].id){
321
+            manufacturer_name = this.manufacturerList[i].manufacturer_name
322
+          }
323
+       }
324
+      specification_name = val.specification_name + "/" + val.packing_unit
325
+      var overCount  = this.getOverplus(val.xt_warehouse_info)
326
+      // window.sessionStorage.setItem('start_time',this.start_time)
327
+      // window.sessionStorage.setItem('end_time',this.end_time)
328
+      this.$router.push({path:"/stock/in/stockbatchnumber?id="+val.id+"&manufacturer="+manufacturer_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
329
+    },
330
+
331
+    getStorehouseList(){
332
+      getStorehouseList().then(response=>{
333
+         if(response.data.state == 1){
334
+           var houseList = response.data.data.list
335
+           var obj = {id:0,storehouse_name:"全部"}
336
+           this.houseList.push(obj)
337
+           for(let i=0;i<houseList.length;i++){
338
+             this.houseList.push(houseList[i])
339
+           }
340
+           this.manufacturerList = response.data.data.manufacturerList
341
+           this.goodTypeList = response.data.data.goodTypeList
342
+           this.patientList = response.data.data.patientList
343
+         }
344
+      })
345
+    },
346
+    getlist(){
347
+        var params = {
348
+          storehouse_id:this.storehouse_id,
349
+          good_type:this.good_type,
350
+          keyword:this.keyword,
351
+          page:this.page,
352
+          limit:this.limit,
353
+          start_time:this.start_time,
354
+          end_time:this.end_time,
355
+        }
356
+      getDrugNewQuery(params).then(response=>{
357
+         if(response.data.state == 1){
358
+            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])
366
+                }
367
+              }
368
+              this.tableList = arr
369
+            }
370
+            this.total = response.data.data.total
371
+           
372
+         }
373
+      })
374
+    },
375
+    getManufacturName(id){
376
+      var manufacturer_name = ""
377
+      for(let i=0;i<this.manufacturerList.length;i++){
378
+        if(id == this.manufacturerList[i].id){
379
+           manufacturer_name = this.manufacturerList[i].manufacturer_name
380
+        }
381
+      }
382
+      return manufacturer_name
383
+    },
384
+    handleSizeChange(val) {
385
+      this.limit = val;
386
+      this.getlist()
387
+    },
388
+    handleCurrentChange(val) {
389
+      this.page = val;
390
+      this.getlist()
391
+    },
392
+    handleSizeChangeOne(val) {
393
+      this.limitone = val;
394
+      this.toDialogClick(this.good_id,this.good_name,this.specification_name)
395
+    },
396
+    handleCurrentChangeOne(val) {
397
+      this.pageone = val;
398
+      this.toDialogClick(this.good_id,this.good_name,this.specification_name)
399
+    },
400
+   seach(){
401
+    this.getlist()
402
+   },
403
+   getGoodTypeName(id){
404
+     var type_name = ""
405
+     for(let i=0;i<this.goodTypeList.length;i++){
406
+       if(id == this.goodTypeList[i].id){
407
+         type_name = this.goodTypeList[i].type_name
408
+       }
409
+     }
410
+     return type_name
411
+   },
412
+   getHouseName(id){
413
+     var storehouse_name = ""
414
+     for(let i=0;i<this.houseList.length;i++){
415
+       if(id == this.houseList[i].id){
416
+         storehouse_name = this.houseList[i].storehouse_name
417
+       }
418
+     }
419
+     return storehouse_name
420
+   },
421
+   getWareInfoCount(val,storehouse_id){
422
+     var count = 0
423
+     if(val.length > 0){
424
+       for(let i=0;i<val.length;i++){
425
+         if(val[i].storehouse_id == storehouse_id){
426
+             count +=val[i].warehousing_count
427
+         }
428
+       }
429
+     }
430
+     if(count > 0){
431
+       return count
432
+     }else{
433
+       return ""
434
+     }
435
+   },
436
+   getStockDrugCount(){
437
+        var params ={
438
+           keywords: this.keywords,
439
+           start_time:this.start_time,
440
+           end_time:this.end_time,
441
+        }
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
+      }
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
522
+      }
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
+         }
532
+      }
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
600
+      }
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
608
+     var params = {
609
+       good_id:id,
610
+       limit:this.limitone,
611
+       page:this.pageone,
612
+       start_first_time:this.start_first_time,
613
+       end_first_time:this.end_first_time,
614
+     }
615
+     getGoodWarehouseOutInfoById(params).then(response=>{
616
+       if(response.data.state == 1){
617
+         var list = response.data.data.list
618
+         console.log("list23233233232w",list)
619
+         this.tableData = list
620
+         this.totalone = response.data.data.total
621
+         this.dialogVisible = true
622
+       }
623
+     })
624
+   
625
+   },
626
+   startFirstTimeChange(){
627
+    
628
+   },
629
+   endEndTimeChange(){
630
+
631
+   },
632
+  getTime(val) {
633
+    if(val < 0){
634
+      return ""
635
+    }
636
+   if(val == ""){
637
+     return ""
638
+   }else {
639
+    return uParseTime(val, '{y}-{m}-{d}')
640
+   }
641
+   },
642
+  getName(id){
643
+    var name = ""
644
+    for(let i=0;i<this.patientList.length;i++){
645
+      if(id == this.patientList[i].id){
646
+        name = this.patientList[i].name
647
+      }
648
+    }
649
+    return name
650
+  }
651
+  },
652
+  created(){
653
+    this.getStorehouseList()
654
+    this.getlist()
655
+    this.getStockDrugCount()
656
+  }
657
+}
658
+</script>
659
+

+ 553 - 0
src/xt_pages/stock/drugs/components/purchaseDrugQuery.vue 파일 보기

@@ -0,0 +1,553 @@
1
+<template>
2
+  <div class="main-contain">
3
+     <div class="app-container ">
4
+        <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
5
+         <div>
6
+          <span>操作时间:</span>
7
+          <el-date-picker
8
+            size="small"
9
+            v-model="start_time"
10
+            prefix-icon="el-icon-date"
11
+            :editable="false"
12
+            style="width: 150px;"
13
+            type="date"
14
+            placeholder="选择日期时间"
15
+            align="right"
16
+            format="yyyy-MM-dd"
17
+            value-format="yyyy-MM-dd"
18
+            @change="startTimeChange"
19
+           ></el-date-picker> 
20
+            <span>-</span> 
21
+            <el-date-picker
22
+              size="small"
23
+              v-model="end_time"
24
+              prefix-icon="el-icon-date"
25
+              :editable="false"
26
+              style="width: 150px;"
27
+              type="date"
28
+              placeholder="选择日期时间"
29
+              align="right"
30
+              format="yyyy-MM-dd"
31
+              value-format="yyyy-MM-dd"
32
+              @change="endTimeChange"
33
+          ></el-date-picker>  
34
+          <span>药品类型:</span>
35
+          <el-select v-model="good_type" style="width:200px;margin-right:10px;" placeholder="请选择"
36
+          filterable
37
+           @change="changeGoodTypeName">
38
+            <el-option
39
+              v-for="item in goodTypeList"
40
+              :key="item.id"
41
+              :label="item.type_name"
42
+              :value="item.id">
43
+            </el-option>
44
+          </el-select>
45
+          <el-input v-model="keyword" style="width:200px" placeholder="请输入药品名称或生产厂商" ></el-input>
46
+          <el-button  type="primary" icon="el-icon-search" @click="seach">搜索</el-button>
47
+         </div>
48
+        </div>
49
+
50
+           <el-table
51
+            :row-style="{ color: '#303133' }"
52
+            :header-cell-style="{
53
+              backgroundColor: 'rgb(245, 247, 250)',
54
+              color: '#606266'
55
+            }"
56
+            :data="tableList"
57
+            :class="signAndWeighBoxPatients"
58
+            border
59
+          >
60
+            <el-table-column label="药品类型" align="center">
61
+              <template slot-scope="scope">
62
+                
63
+              </template>
64
+            </el-table-column>
65
+            <el-table-column label="药品名称" align="center">
66
+              <template slot-scope="scope">
67
+                
68
+              </template>
69
+            </el-table-column>
70
+            <el-table-column label="规格&单位" align="center">
71
+                <template slot-scope="scope">
72
+                
73
+                </template>
74
+            </el-table-column>
75
+            <el-table-column label="生产厂商" align="center">
76
+              <template slot-scope="scope">
77
+               
78
+              </template>
79
+            </el-table-column>
80
+            <el-table-column label="期初结余" align="center">
81
+               
82
+                 <el-table-column prop="stockIn" label="数量" width="100">
83
+                   
84
+                 </el-table-column>
85
+              
86
+                <el-table-column prop="buy_price" label="进货金额" width="100">
87
+                   
88
+                </el-table-column>
89
+                <el-table-column prop="stockMoney" label="销售金额" width="100">
90
+                 
91
+                </el-table-column>
92
+             
93
+            </el-table-column>
94
+            <el-table-column label="本期增加" align="center">
95
+             
96
+                <el-table-column prop="stockAdd" label="数量" width="100">
97
+                
98
+                </el-table-column>
99
+             
100
+                <el-table-column prop="buy_price" label="进货金额" width="100">
101
+                  
102
+                </el-table-column>
103
+                <el-table-column  prop="addStockMoney" label="销售金额"  width="100">
104
+                </el-table-column>
105
+              
106
+            </el-table-column>
107
+         
108
+            <el-table-column label="本期减少" align="center">
109
+               <el-table-column prop="outStock" label="数量" width="100">
110
+                </el-table-column>
111
+                <el-table-column  prop="buy_price"  label="进货金额" width="100">
112
+                </el-table-column>
113
+                <el-table-column prop="stockOutMoney" label="销售金额" width="100">
114
+                </el-table-column>
115
+            </el-table-column>
116
+          
117
+            <el-table-column label="期末结余" align="center">
118
+              <el-table-column prop="overStock" label="数量" width="100">
119
+              </el-table-column>
120
+              <el-table-column prop="buy_price" label="进货金额" width="100">
121
+              </el-table-column>
122
+              <el-table-column prop="oveMoney" label="销售金额" width="100">
123
+              </el-table-column>
124
+            </el-table-column>
125
+
126
+          
127
+          </el-table>
128
+           <el-pagination
129
+            @size-change="handleSizeChange"
130
+            @current-change="handleCurrentChange"
131
+            :page-sizes="[10, 50, 100,200,500,1000]"
132
+            :page-size="10"
133
+            background
134
+            align="right"
135
+            style="margin-top:20px;"
136
+            layout="total, sizes, prev, pager, next, jumper"
137
+            :total="total"
138
+          >
139
+            </el-pagination>
140
+     </div>
141
+
142
+
143
+
144
+  
145
+
146
+  </div>
147
+</template>
148
+<script>
149
+import { getStorehouseList,getPurchaseDrugQuery } from "@/api/drug/drug"
150
+import {
151
+  getStockDrugCount
152
+} from "@/api/stock";
153
+import { uParseTime } from '@/utils/tools'
154
+export default {
155
+
156
+  data(){
157
+    return{
158
+     tableList:[],
159
+     goodList:[
160
+      {id:1,name:"全部耗材"},
161
+      {id:2,name:"库存预警"},
162
+     ],
163
+     houseList:[],
164
+     storehouse_id:0,
165
+     good_type:0,
166
+     multipleSelection: [],
167
+     signAndWeighBoxPatients: "sign-and-weigh-box-patients",
168
+     manufacturerList:[],
169
+     limit:10,
170
+     page:1,
171
+     total:0,
172
+     keyword:"",
173
+     goodTypeList:[],
174
+     start_time:"",
175
+     end_time:"",
176
+     countList:[],
177
+     outCountList:[],
178
+     autoCountList:[],
179
+     cancelCountList:[],
180
+     org_id:this.$store.getters.xt_user.org_id,
181
+     dialogVisible:false,
182
+     start_first_time:"",
183
+     end_first_time:"",
184
+     tableData:[],
185
+     good_id:0,
186
+     patientList:[],
187
+     good_name:"",
188
+     specification_name:""
189
+    }
190
+  
191
+  },
192
+  methods:{
193
+    changeStorehouseName(){
194
+
195
+    },
196
+    changeGoodTypeName(){
197
+      this.getlist()
198
+    },
199
+    getStorehouseList(){
200
+      getStorehouseList().then(response=>{
201
+         if(response.data.state == 1){
202
+           var houseList = response.data.data.list
203
+           var obj = {id:0,storehouse_name:"全部"}
204
+           this.houseList.push(obj)
205
+           for(let i=0;i<houseList.length;i++){
206
+             this.houseList.push(houseList[i])
207
+           }
208
+           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
+            }
215
+           this.patientList = response.data.data.patientList
216
+         }
217
+      })
218
+    },
219
+    getlist(){
220
+        var params = {
221
+          good_type:this.good_type,
222
+          keyword:this.keyword,
223
+          page:this.page,
224
+          limit:this.limit,
225
+          start_time:this.start_time,
226
+          end_time:this.end_time,
227
+        }
228
+      getPurchaseDrugQuery(params).then(response=>{
229
+         if(response.data.state == 1){
230
+            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)
242
+            }
243
+            this.tableList = list
244
+            this.total = response.data.data.total
245
+
246
+           this.manufacturerList = response.data.data.manufacturerList
247
+           
248
+         }
249
+      })
250
+    },
251
+    getManufacturName(id){
252
+      var manufacturer_name = ""
253
+      for(let i=0;i<this.manufacturerList.length;i++){
254
+        if(id == this.manufacturerList[i].id){
255
+           manufacturer_name = this.manufacturerList[i].manufacturer_name
256
+        }
257
+      }
258
+      return manufacturer_name
259
+    },
260
+    handleSizeChange(val) {
261
+      this.limit = val;
262
+      this.getlist()
263
+    },
264
+    handleCurrentChange(val) {
265
+      this.page = val;
266
+      this.getlist()
267
+    },
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
+   seach(){
277
+    this.getlist()
278
+   },
279
+   getGoodTypeName(id){
280
+     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
284
+       }
285
+     }
286
+     return type_name
287
+   },
288
+   getHouseName(id){
289
+     var storehouse_name = ""
290
+     for(let i=0;i<this.houseList.length;i++){
291
+       if(id == this.houseList[i].id){
292
+         storehouse_name = this.houseList[i].storehouse_name
293
+       }
294
+     }
295
+     return storehouse_name
296
+   },
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
+   },
480
+  
481
+   startFirstTimeChange(){
482
+     this.getlist()
483
+   },
484
+   endEndTimeChange(){
485
+     this.getlist()
486
+   },
487
+  getTime(val) {
488
+    if(val < 0){
489
+      return ""
490
+    }
491
+   if(val == ""){
492
+     return ""
493
+   }else {
494
+    return uParseTime(val, '{y}-{m}-{d}')
495
+   }
496
+   },
497
+  getName(id){
498
+    var name = ""
499
+    for(let i=0;i<this.patientList.length;i++){
500
+      if(id == this.patientList[i].id){
501
+        name = this.patientList[i].name
502
+      }
503
+    }
504
+    return name
505
+  },
506
+  endTimeChange(){
507
+
508
+  },
509
+  startTimeChange(){
510
+
511
+  },
512
+  getWarehouseInfo(val){
513
+    var count =0 
514
+    for(let i=0;i<val.length;i++){
515
+      count +=val[i].stock_count
516
+    }
517
+    if(count > 0 ){
518
+      return count
519
+    }else{
520
+      return count
521
+    }
522
+  },
523
+  getWarehouseInfoOne(val){
524
+    var count =0 
525
+    for(let i=0;i<val.length;i++){
526
+      count +=val[i].warehousing_count
527
+    }
528
+    if(count > 0 ){
529
+      return count
530
+    }else{
531
+      return count
532
+    }
533
+  },
534
+  getWarehouseOut(val){
535
+    var count = 0
536
+    for(let i=0;i<val.length;i++){
537
+      count +=val[i].count
538
+    }
539
+    if(count >0){
540
+     return count
541
+    }else{
542
+      return count
543
+    }
544
+  }
545
+  },
546
+  created(){
547
+    this.getStorehouseList()
548
+    this.getlist()
549
+    this.getStockDrugCount()
550
+  }
551
+}
552
+</script>
553
+