|
@@ -0,0 +1,284 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="main-contain">
|
|
3
|
+ <div class="position">
|
|
4
|
+ <bread-crumb :crumbs="crumbs"></bread-crumb>
|
|
5
|
+ <el-row style="float:right;">
|
|
6
|
+ <el-col :span="24">
|
|
7
|
+ <el-button size="small" icon="el-icon-printer" type="primary" @click="printAction">打印</el-button>
|
|
8
|
+ </el-col>
|
|
9
|
+ </el-row>
|
|
10
|
+ </div>
|
|
11
|
+ <div class="app-container" style="background-color: white;">
|
|
12
|
+ <div id="print_content">
|
|
13
|
+
|
|
14
|
+ <table class="printTable" border="0" cellspacing="0" align="center">
|
|
15
|
+ <thead class="print_head">
|
|
16
|
+ <tr><td colspan="11">{{org_name}}</td></tr>
|
|
17
|
+ <tr><td colspan="11">药品盘点</td></tr>
|
|
18
|
+ </thead>
|
|
19
|
+ <tbody class="print_body">
|
|
20
|
+ <tr>
|
|
21
|
+ <td align="center">盘点时间</td>
|
|
22
|
+ <td align="center">药品名称</td>
|
|
23
|
+ <td align="center">规格</td>
|
|
24
|
+ <td align="center">进价</td>
|
|
25
|
+ <td align="center">批号</td>
|
|
26
|
+ <td align="center">生产厂商</td>
|
|
27
|
+ <td align="center">有效日期</td>
|
|
28
|
+ <td align="center">仓库名称</td>
|
|
29
|
+ <td align="center">盘点前数量</td>
|
|
30
|
+ <td align="center">盘点后数量</td>
|
|
31
|
+ <td align="center">盘点类型</td>
|
|
32
|
+ <td align="center">盘点人</td>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+ </tr>
|
|
36
|
+ <tr v-for="(item,index) in tableData" :key="index">
|
|
37
|
+ <td align="center">{{ getTime(item.record_date) }}</td>
|
|
38
|
+ <td align="center">{{item.drug_name}}</td>
|
|
39
|
+ <td align="center">{{item.specification_name}}</td>
|
|
40
|
+ <td align="center">{{ item.price }}</td>
|
|
41
|
+ <td align="center">{{item.batch_number }}</td>
|
|
42
|
+ <td align="center">{{ item.manufacturer_name }}</td>
|
|
43
|
+ <td align="center">{{ getTime(item.expiry_date) }}</td>
|
|
44
|
+ <td align="center">{{ getHouseName(item.storehouse_id) }}</td>
|
|
45
|
+ <td align="center">
|
|
46
|
+ {{ item.stock_max_number }}
|
|
47
|
+ <span v-if="item.stock_max_number>0">{{ item.max_unit }}</span>
|
|
48
|
+ {{ item.stock_min_number }}
|
|
49
|
+ <span v-if="item.stock_min_number>0">{{ item.min_unit }}</span>
|
|
50
|
+ </td>
|
|
51
|
+ <td align="center">
|
|
52
|
+ {{ item.last_stock_max_number }}
|
|
53
|
+ <span v-if="item.last_stock_max_number>0">{{ item.max_unit }}</span>
|
|
54
|
+ {{ item.last_stock_min_number }}
|
|
55
|
+ <span v-if="item.last_stock_min_number>0">{{ item.min_unit }}</span>
|
|
56
|
+ </td>
|
|
57
|
+ <td align="center">
|
|
58
|
+ <span v-if="item.reason == 10">盘盈</span>
|
|
59
|
+ <span v-if="item.reason == 11">盘亏</span>
|
|
60
|
+ </td>
|
|
61
|
+ <td align="center">
|
|
62
|
+ {{getName(item.creater)}}
|
|
63
|
+ </td>
|
|
64
|
+
|
|
65
|
+ </tr>
|
|
66
|
+ </tbody>
|
|
67
|
+ </table>
|
|
68
|
+ </div>
|
|
69
|
+ </div>
|
|
70
|
+ </div>
|
|
71
|
+</template>
|
|
72
|
+
|
|
73
|
+<script>
|
|
74
|
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
|
75
|
+const moment = require('moment');
|
|
76
|
+import { uParseTime } from '@/utils/tools'
|
|
77
|
+import { getInventoryRecordPrintList } from "@/api/drug/drug"
|
|
78
|
+import print from "print-js";
|
|
79
|
+import { min } from 'moment';
|
|
80
|
+export default {
|
|
81
|
+ components:{
|
|
82
|
+ BreadCrumb
|
|
83
|
+ },
|
|
84
|
+ data(){
|
|
85
|
+ return{
|
|
86
|
+ crumbs: [
|
|
87
|
+ { path: false, name: '库存管理' },
|
|
88
|
+ { path: false, name: '耗材管理' },
|
|
89
|
+ { path: false, name: '耗材盘点打印' },
|
|
90
|
+ ],
|
|
91
|
+ org_name: this.$store.getters.xt_user.org.org_name,
|
|
92
|
+ ids:"",
|
|
93
|
+ tableData:[],
|
|
94
|
+ manufacturerList:[],
|
|
95
|
+ houseList:[],
|
|
96
|
+ inventoryList:[],
|
|
97
|
+ doctorList:[],
|
|
98
|
+ }
|
|
99
|
+ },
|
|
100
|
+ methods:{
|
|
101
|
+ printAction: function() {
|
|
102
|
+ const style = '@page{size:landscape;margin: 10mm;} @media print { print_content{width:960px;margin:0} .flex{display: flex;justify-content: space-between;} .printTable{width:100%;border-collapse: collapse;border:0px;margin:10px 0;} .printTable thead{text-align:center}.printTable td{padding:5px;} .print_body tr td{border: 1px solid;font-size:12px;border-collapse:collapse;} }';
|
|
103
|
+ printJS({
|
|
104
|
+ printable: 'print_content',
|
|
105
|
+ type: 'html',
|
|
106
|
+ documentTitle: ' ',
|
|
107
|
+ style: style,
|
|
108
|
+ scanStyles: false
|
|
109
|
+ })
|
|
110
|
+ },
|
|
111
|
+ getTime(val) {
|
|
112
|
+ if(val < 0){
|
|
113
|
+ return ""
|
|
114
|
+ }
|
|
115
|
+ if(val == ""){
|
|
116
|
+ return ""
|
|
117
|
+ }else {
|
|
118
|
+ return uParseTime(val, '{y}-{m}-{d}')
|
|
119
|
+ }
|
|
120
|
+ },
|
|
121
|
+ getlist(){
|
|
122
|
+ var params = {
|
|
123
|
+ limit:this.$route.query.limit,
|
|
124
|
+ page:this.$route.query.page,
|
|
125
|
+ keyword:this.$route.query.drug_name,
|
|
126
|
+ storehouse_id:this.$route.query.storehouse_id,
|
|
127
|
+ ids:this.$route.query.ids,
|
|
128
|
+ start_time:this.$route.query.start_time,
|
|
129
|
+ end_time:this.$route.query.end_time,
|
|
130
|
+ }
|
|
131
|
+ getInventoryRecordPrintList(params).then(response=>{
|
|
132
|
+ if(response.data.state == 1){
|
|
133
|
+ this.total = response.data.data.total
|
|
134
|
+ this.tableData = response.data.data.list
|
|
135
|
+ this.houseList = response.data.data.houseList
|
|
136
|
+ this.doctorList = response.data.data.doclist
|
|
137
|
+
|
|
138
|
+ }
|
|
139
|
+ })
|
|
140
|
+ },
|
|
141
|
+ getManufacturerName(id){
|
|
142
|
+
|
|
143
|
+ var name = ""
|
|
144
|
+ for(let i=0;i<this.manufacturerList.length;i++){
|
|
145
|
+ if(id == this.manufacturerList[i].id){
|
|
146
|
+ name = this.manufacturerList[i].manufacturer_name
|
|
147
|
+ }
|
|
148
|
+ }
|
|
149
|
+ return name
|
|
150
|
+ },
|
|
151
|
+ getNumber(id){
|
|
152
|
+ var number = ""
|
|
153
|
+ for(let i=0;i<this.inventoryList.length;i++){
|
|
154
|
+ if(id == this.inventoryList[i].id){
|
|
155
|
+ number = this.inventoryList[i].drug_warehouse_info.batch_number
|
|
156
|
+ }
|
|
157
|
+ }
|
|
158
|
+ return number
|
|
159
|
+ },
|
|
160
|
+ getPrice(id){
|
|
161
|
+ var price = 0
|
|
162
|
+ for(let i=0;i<this.inventoryList.length;i++){
|
|
163
|
+ if(id == this.inventoryList[i].id){
|
|
164
|
+ price = this.inventoryList[i].drug_warehouse_info.price
|
|
165
|
+ }
|
|
166
|
+ }
|
|
167
|
+ if(price > 0){
|
|
168
|
+ return price
|
|
169
|
+ }
|
|
170
|
+
|
|
171
|
+ },
|
|
172
|
+ getHouseName(id){
|
|
173
|
+ var storehouse_name = ""
|
|
174
|
+ for(let i=0;i<this.houseList.length;i++){
|
|
175
|
+ if(id == this.houseList[i].id){
|
|
176
|
+ storehouse_name = this.houseList[i].storehouse_name
|
|
177
|
+ }
|
|
178
|
+ }
|
|
179
|
+ if(storehouse_name == "全部"){
|
|
180
|
+ return ""
|
|
181
|
+ }else{
|
|
182
|
+ return storehouse_name
|
|
183
|
+ }
|
|
184
|
+ },
|
|
185
|
+ getCount(stock_max_number,stock_min_number,last_stock_max_number,last_stock_min_number,min_number,id){
|
|
186
|
+
|
|
187
|
+ var cha_count = 0
|
|
188
|
+ var befor_total_count = 0
|
|
189
|
+ var after_total_count = 0
|
|
190
|
+ var befor_total_count = stock_max_number * min_number + stock_min_number
|
|
191
|
+ var after_total_count = last_stock_max_number * min_number + last_stock_min_number
|
|
192
|
+ var retail_price = 0
|
|
193
|
+ var price = 0
|
|
194
|
+ var max_count = 0
|
|
195
|
+ var min_count = 0
|
|
196
|
+ var total_price = 0
|
|
197
|
+ for(let i=0;i<this.inventoryList.length;i++){
|
|
198
|
+ if(id == this.inventoryList[i].id){
|
|
199
|
+ retail_price = this.inventoryList[i].drug_warehouse_info.retail_price
|
|
200
|
+ price = this.inventoryList[i].drug_warehouse_info.price
|
|
201
|
+ }
|
|
202
|
+ }
|
|
203
|
+
|
|
204
|
+ //如果透前数量大于透后数量 盘亏
|
|
205
|
+ if(befor_total_count > after_total_count){
|
|
206
|
+ cha_count = befor_total_count - after_total_count
|
|
207
|
+ }
|
|
208
|
+ max_count = cha_count/min_number
|
|
209
|
+ min_count = cha_count%min_number
|
|
210
|
+ console.log("price",price/min_number)
|
|
211
|
+ console.log("max_count23323232",max_count)
|
|
212
|
+ console.log("min_count33333",min_count)
|
|
213
|
+ console.log("min_number2332233232",min_number)
|
|
214
|
+
|
|
215
|
+ total_price = Math.floor(max_count) * price + min_count * (price/min_number)
|
|
216
|
+
|
|
217
|
+ if(total_price > 0){
|
|
218
|
+ return total_price.toFixed(2)
|
|
219
|
+ }else{
|
|
220
|
+ return ""
|
|
221
|
+ }
|
|
222
|
+ return cha_count
|
|
223
|
+ },
|
|
224
|
+ getCountOne(stock_max_number,stock_min_number,last_stock_max_number,last_stock_min_number,min_number,id){
|
|
225
|
+ var cha_count = 0
|
|
226
|
+ var befor_total_count = 0
|
|
227
|
+ var after_total_count = 0
|
|
228
|
+ var befor_total_count = stock_max_number * min_number + stock_min_number
|
|
229
|
+ var after_total_count = last_stock_max_number * min_number + last_stock_min_number
|
|
230
|
+ var retail_price = 0
|
|
231
|
+ var price = 0
|
|
232
|
+ var max_count = 0
|
|
233
|
+ var min_count = 0
|
|
234
|
+ var total_price = 0
|
|
235
|
+ for(let i=0;i<this.inventoryList.length;i++){
|
|
236
|
+ if(id == this.inventoryList[i].id){
|
|
237
|
+ retail_price = this.inventoryList[i].drug_warehouse_info.retail_price
|
|
238
|
+ price = this.inventoryList[i].drug_warehouse_info.price
|
|
239
|
+ }
|
|
240
|
+ }
|
|
241
|
+ //如果透前数量大于透后数量 盘盈
|
|
242
|
+ if(befor_total_count < after_total_count){
|
|
243
|
+ cha_count = after_total_count - befor_total_count
|
|
244
|
+ }
|
|
245
|
+ max_count = cha_count/min_number
|
|
246
|
+ min_count = cha_count%min_number
|
|
247
|
+ total_price = Math.floor(max_count) *price + min_count * (price/min_number)
|
|
248
|
+ if(total_price > 0){
|
|
249
|
+ return total_price.toFixed(2)
|
|
250
|
+ }else{
|
|
251
|
+ return ""
|
|
252
|
+ }
|
|
253
|
+
|
|
254
|
+ },
|
|
255
|
+ getName(admin_user_id){
|
|
256
|
+ var user_name = ""
|
|
257
|
+ for(let i=0;i<this.doctorList.length;i++){
|
|
258
|
+ if(admin_user_id == this.doctorList[i].admin_user_id){
|
|
259
|
+ user_name = this.doctorList[i].user_name
|
|
260
|
+ }
|
|
261
|
+ }
|
|
262
|
+ return user_name
|
|
263
|
+ }
|
|
264
|
+ },
|
|
265
|
+ created(){
|
|
266
|
+
|
|
267
|
+ this.getlist()
|
|
268
|
+ }
|
|
269
|
+}
|
|
270
|
+</script>
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+<style rel="stylesheet/scss" lang="scss" scoped>
|
|
274
|
+.printTitle{font-size: 22px;text-align: center;}
|
|
275
|
+.flex{display: flex;justify-content: space-between;}
|
|
276
|
+.tableTitle{display: flex;border-top:1px solid #000;border-bottom: 1px solid #000;padding: 10px 0;}
|
|
277
|
+.tableTr{display: flex;border-bottom: 1px dashed #000;padding: 10px 0;}
|
|
278
|
+.tableBottom{display: flex;border-bottom: 1px solid #000;padding: 10px 0;}
|
|
279
|
+.printTable{width:100%;border-collapse: collapse;}
|
|
280
|
+.printTable td{padding:5px;}
|
|
281
|
+.print_head{border: none;display: table-header-group;}
|
|
282
|
+.print_head tr td{text-align: center;border: none;}
|
|
283
|
+.print_body tr td{border:1px solid}
|
|
284
|
+</style>
|