XMLWAN 3 年之前
父節點
當前提交
a2290360dc
共有 2 個文件被更改,包括 1011 次插入0 次删除
  1. 507 0
      src/xt_pages/stock/cancelStockOrderPrint.vue
  2. 504 0
      src/xt_pages/stock/drugs/cancelDrugOrderPrint.vue

+ 507 - 0
src/xt_pages/stock/cancelStockOrderPrint.vue 查看文件

@@ -0,0 +1,507 @@
1
+<template>
2
+  <div class="main-contain">
3
+    <div class="position">
4
+      <bread-crumb :crumbs='crumbs'></bread-crumb>
5
+      <el-button :loading="loading" size="small" icon="el-icon-printer" @click="printThisPage" type="primary">打印
6
+      </el-button>
7
+    </div>
8
+    <div class="app-container ">
9
+      <div id="dialysis-print-box">
10
+        <div class="dialysis-print-order" v-for="(it,index) in tableList" :key="index">
11
+         <div class="order-yy-name" style="font-size:22px;font-weight:bold;letter-spacing:0px;">{{orgName}}</div>
12
+          <div class="order-title" style="font-weight:500;font-size:18px;">耗材退库登记表</div>
13
+
14
+          <div style="float: left;margin-bottom: 1px;">单据编号:{{it.order_number}}</div>
15
+          <div style="float: right;margin-bottom: 1px;">{{getDateTwo()}}</div>
16
+
17
+          <table class="print-table" border="1">
18
+            <tbody>
19
+            <tr>
20
+              <td style="line-height: 50px" width="230">耗材名称</td>
21
+              <td style="line-height: 50px" width="260">品名/注册证号(备案凭证号)</td>
22
+              <td style="line-height: 50px" width="230">规格型号</td>
23
+              <td style="line-height: 50px" width="200">生产厂商</td>
24
+              <td style="line-height: 50px" width="180">批号(序列号)</td>
25
+              <td style="line-height:50px" width="200">生产日期</td>
26
+              <td style="line-height: 50px" width="200">有效期</td>
27
+              <td style="line-height: 50px" width="200">退库数量</td>
28
+              <td style="line-height: 50px" width="80">单价</td>
29
+              <td style="line-height: 50px" width="80">总金额</td>
30
+            </tr>
31
+
32
+            <tr v-for="(item,i) in it.CancelStockInfo" :key="i">
33
+              <td style="line-height: 50px">
34
+                <span>{{item.GoodInfo.good_name}}</span>
35
+              </td>
36
+             <td style="line-height: 50px">
37
+                <span>{{item.register_account}}</span>
38
+              </td>
39
+              <td style="line-height: 50px">
40
+                  <span>{{item.GoodInfo.specification_name}}/{{item.GoodInfo.packing_unit}}</span>
41
+              </td>
42
+              <td style="line-height: 50px">
43
+                  {{item.manufacturer}}
44
+              </td>
45
+              <td style="line-height: 50px">
46
+                <span>{{item.number}}</span>
47
+              </td>
48
+              <td style="line-height:50px">
49
+                  {{(getTime(item.product_date))}}
50
+              </td>
51
+             <td>{{(getTime(item.expiry_date))}}</td>
52
+             <td  style="line-height:50px">
53
+               {{item.count}}
54
+             </td>
55
+              <td  style="line-height:50px">
56
+               {{item.price}}
57
+             </td>
58
+             <td> {{(item.count * item.price).toFixed(2)}}</td>
59
+            </tr>
60
+             <tr>
61
+               <td style="line-height:50px">合计</td>
62
+               <td colspan="8"></td>
63
+               <td>{{getAllPrince(it.id).toFixed(2)}}</td>
64
+             </tr>
65
+            </tbody>
66
+          </table>
67
+
68
+
69
+          <div v-if="orgId != 10024" style="display:flex;margin-top:1px;float:right;">
70
+            <div style="width:50px;">审批:</div><div style="width:100px;"></div>
71
+            <div style="width:80px;">耗材主任:</div><div style="width:100px;"></div>
72
+            <div style="width:50px;">会计:</div><div style="width:100px;"></div>
73
+            <div style="width:50px;">审核:</div><div style="width:100px;"></div>
74
+            <div style="width:70px;">制单人:</div><div style="width:100px;"></div>
75
+          </div>
76
+          <div v-if="orgId == 10024" style="display:flex;margin-top:1px;float:right;">
77
+            <div style="width:50px;">科室:</div><div style="width:60px;"></div>
78
+            <div style="width:70px;">领料人:</div><div style="width:60px;"></div>
79
+            <div style="width:80px;">审批:</div><div style="width:100px;">肖庆娥</div>
80
+            <div style="width:50px;">会计:</div><div style="width:100px;">徐立琼</div>
81
+            <div style="width:50px;">审核:</div><div style="width:100px;">徐立琼</div>
82
+            <div style="width:70px;">制单人:</div><div style="width:100px;">徐立琼</div>
83
+          </div>
84
+        </div>
85
+
86
+      </div>
87
+
88
+    </div>
89
+  </div>
90
+
91
+</template>
92
+
93
+<script>
94
+  import {getCancelStockOrderPrint } from '@/api/stock'
95
+  import { getDataConfig } from '@/utils/data'
96
+  import { jsGetAge, uParseTime } from '@/utils/tools'
97
+  import BreadCrumb from '@/xt_pages/components/bread-crumb'
98
+  import print from 'print-js'
99
+  import {getBaseDrugLibList} from '@/api/data'
100
+  export default {
101
+    name: 'dialysisPrintOrder',
102
+    components: {
103
+      BreadCrumb
104
+
105
+    },
106
+    data() {
107
+      return {
108
+        crumbs: [
109
+          { path: false, name: '出入库明细' },
110
+          { path: false, name: '打印单' }
111
+        ],
112
+        isEdit: 0,
113
+        checked: false,
114
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
115
+        goodType: [],
116
+        goodInfo: [],
117
+        manufacturer: [],
118
+        dealer: [],
119
+
120
+        warehousingOutInfo: {
121
+          loading: false,
122
+          warehousingOutData: [],
123
+          info: {}
124
+        },
125
+        allPrice:0,
126
+        start_time:"",
127
+        end_time:"",
128
+        list:[],
129
+        is_use:"",
130
+        is_charge:"",
131
+        is_inject:"",
132
+        page:1,
133
+        limit:10000,
134
+        keywords:"",
135
+        orgId:'',
136
+        orgName:"",
137
+        drugOrderList:[],
138
+        manufactureList:[],
139
+        tableList:[],
140
+        loading:false,
141
+        warehouseList:[]
142
+      }
143
+    },
144
+    methods: {
145
+      getDateTwo(){
146
+        var ptime = Math.round(new Date().getTime() / 1000);
147
+        return "打印日期:"+uParseTime(ptime, '{y}-{m}-{d}')
148
+      },
149
+      getTime(value, temp) {
150
+        if (value == 0) {
151
+          return ''
152
+        }
153
+        if (value != undefined) {
154
+          return uParseTime(value, temp)
155
+        }
156
+        return ''
157
+      },
158
+      printThisPage() {
159
+        var ptime = Math.round(new Date().getTime() / 1000);
160
+        this.print_time = uParseTime(ptime, '{y}-{m}-{d} {h}:{i}');
161
+        const style = '@media print {.dialysis-print-order{width:960px;margin:0 auto}.dialysis-print-order .order-yy-name{margin:auto;text-align:center;font-size:20px;letter-spacing:5px;font-weight:bold;}.dialysis-print-order .order-title{margin:auto;text-align:center;font-size:22px;padding:10px 20px 20px 20px}.dialysis-print-order .table-box{width:100%;line-height:23px;font-size:14px}.dialysis-print-order .print-table{width:100%;text-align:center;border-collapse:collapse;line-height:25px;font-size:14px}.dialysis-print-order .print-table-no{width:100%;text-align:center;border-collapse:collapse;font-size:14px}.dialysis-print-order .under-line{border-bottom:1px solid #999;width:95%;text-align:center;margin-left:2px}.dialysis-print-order .title-box{text-align:center;font-size:16px;border:1px solid #666}.dialysis-print-order .radio-lebel-box{font-weight:400;cursor:pointer}.dialysis-print-order .radio-no{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.dialysis-print-order .radio-inner{white-space:nowrap;cursor:pointer;outline:0;display:inline-block;line-height:1;position:relative;vertical-align:middle}.dialysis-print-order .radio-fang{display:inline-block;position:relative;border:1px solid #000;box-sizing:border-box;width:14px;height:14px;background-color:#fff;z-index:1;transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46)}.dialysis-print-order .is-checked-radio::after{content:"√";font-size:15px}}.dialysis-print-order .print-table-no tr td { padding: 8px 5px; line-height: 25px; }.es-img{height: 20px; }.advice-name{text-align: left;}.advice-children{display:flex;} .dialysis-print-order .print-table tr td{padding: 0px 0px;} .print-template-two tr {line-height: 30px;}   .title-box-pro{border: 0 #fff;line-height: 40px;height: 40px;text-align: left;padding-left: 10px !important;}  .text-align-left{text-align: left !important;padding-left:10px !important;font-size: 14px !important;line-height: 25px;}';
162
+        printJS({
163
+          printable: 'dialysis-print-box',
164
+          type: 'html',
165
+          style: style,
166
+          scanStyles: false
167
+        })
168
+      },
169
+
170
+      getUnit(id){
171
+        var name = "";
172
+        for(let i=0;i<this.goodUnit.length;i++){
173
+          if(this.goodUnit[i].id == id){
174
+            name = this.goodUnit[i].name
175
+          }
176
+        }
177
+        return name
178
+      },
179
+    GetOrderDetail: function(order_id) {
180
+            const params = {
181
+            'id': order_id
182
+            };
183
+            getDrugWarehouseOutInfo(params).then(response => {
184
+            if (response.data.state == 0) {
185
+
186
+                this.$message.error(response.data.msg);
187
+                return false
188
+            } else {
189
+              for (let i = 0; i < response.data.data.list.length; i++) {
190
+                this.warehousingOutInfo.warehousingOutData.push(response.data.data.list[i])
191
+               }
192
+               var total_price = 0;
193
+               for(let i=0;i<this.warehousingOutInfo.warehousingOutData.length;i++){
194
+                 total_price += this.warehousingOutInfo.warehousingOutData[i].count * this.warehousingOutInfo.warehousingOutData[i].price
195
+               }
196
+               this.allPrice = total_price;
197
+               this.warehousingOutInfo.info = response.data.data.info;
198
+               this.handleSpanTempArr()
199
+            }
200
+            })
201
+        },
202
+        getList() {
203
+        let params = {
204
+          page: this.page,
205
+          limit: this.limit,
206
+          keyword: this.keywords,
207
+          is_use: this.is_use,
208
+          is_charge: this.is_charge,
209
+          is_inject: this.is_inject
210
+        };
211
+        getBaseDrugLibList(params).then(response => {
212
+          if (response.data.state == 0) {
213
+            this.$message.error(response.data.msg);
214
+            return false
215
+          } else {
216
+            this.total = response.data.data.total;
217
+            this.list = [];
218
+            for (let i = 0; i < response.data.data.list.length; i++) {
219
+              this.list.push(response.data.data.list[i])
220
+            }
221
+            console.log("list222222",this.list)
222
+          }
223
+        })
224
+      },
225
+      getUnit(id){
226
+        var name = "";
227
+        for(let i=0;i<this.list.length;i++){
228
+          if(this.list[i].id == id){
229
+            name = this.list[i].min_unit
230
+          }
231
+        }
232
+        return name
233
+      },
234
+      handleSpanTempArr(){
235
+        this.tempArr = [];
236
+
237
+        for (let i = 0; i < this.warehousingOutInfo.warehousingOutData.length; i++) {
238
+          if (i === 0) {
239
+            this.tempArr.push(1);
240
+            this.pos = 0
241
+          } else {
242
+            // 判断当前元素与上一个元素是否相同
243
+            if (this.warehousingOutInfo.warehousingOutData[i].drug_id === this.warehousingOutInfo.warehousingOutData[i - 1].drug_id) {
244
+              this.tempArr[this.pos] += 1;
245
+              this.tempArr.push(0)
246
+            } else {
247
+              this.tempArr.push(1);
248
+              this.pos = i
249
+            }
250
+          }
251
+        }
252
+
253
+        let sameRowArr = [], sIdx = 0;
254
+        this.warehousingOutInfo.warehousingOutData.forEach((item, index) => {
255
+          item.index = index;
256
+          if (index === 0) {
257
+            sameRowArr.push([index])
258
+          } else {
259
+            if (item.drug_id === this.warehousingOutInfo.warehousingOutData[index - 1].drug_id) {
260
+              sameRowArr[sIdx].push(index)
261
+            } else {
262
+              sIdx = sIdx + 1;
263
+              sameRowArr.push([index])
264
+            }
265
+          }
266
+        });
267
+        this.sameRowArr = sameRowArr
268
+      },
269
+      getDrugWarehouseOrderInfo(){
270
+        getDrugWarehouseOrderInfo().then(response=>{
271
+           if(response.data.state == 1){
272
+             var list =  response.data.data.list
273
+             console.log("入库单详情",list)
274
+             this.drugOrderList = list
275
+           }
276
+        })
277
+      },
278
+      getNumber(id){
279
+        var number = ""
280
+        for(let i=0;i<this.drugOrderList.length;i++){
281
+          if(id == this.drugOrderList[i].drug_id){
282
+              number = this.drugOrderList[i].number
283
+          }
284
+        }
285
+        return number
286
+      },
287
+      getProductDate(id){
288
+        var product_date = ""
289
+        for(let i=0;i<this.drugOrderList.length;i++){
290
+           if(id == this.drugOrderList[i].drug_id){
291
+             product_date = this.drugOrderList[i].product_date
292
+           }
293
+        }
294
+        return this.getTime(product_date)
295
+      },
296
+      getExpiryDate(id){
297
+         var expiry_date = ""
298
+         for(let i=0;i<this.drugOrderList.length;i++){
299
+           if(id == this.drugOrderList[i].drug_id){
300
+             expiry_date = this.drugOrderList[i].expiry_date
301
+           }
302
+        }
303
+        return this.getTime(expiry_date)
304
+      },
305
+      getTime(val) {
306
+         if(val < 0){
307
+           return ""
308
+         }
309
+         if(val == ""){
310
+          return ""
311
+         }else {
312
+          return uParseTime(val, '{y}-{m}-{d}')
313
+         }
314
+      },
315
+
316
+      getCancelStockOrderPrint(id){
317
+        console.log("23232322332",id)
318
+        var params = {
319
+            id:id
320
+        }
321
+        getCancelStockOrderPrint(params).then(response=>{
322
+          if(response.data.state ==1){
323
+            var list =  response.data.data.list
324
+            console.log("list222",list)
325
+            this.tableList = list
326
+          }
327
+         })
328
+       },
329
+      getAllPrince(id){
330
+        var total = 0
331
+        var arr = []
332
+        for(let i=0;i<this.tableList.length;i++){
333
+          arr.push(...this.tableList[i].CancelStockInfo)
334
+        } 
335
+        console.log("arr23223",arr)
336
+        for(let i=0;i<arr.length;i++){
337
+         if(id == arr[i].cancel_stock_id){
338
+           total += arr[i].price * arr[i].count
339
+         }
340
+        }
341
+        
342
+        return total
343
+      }
344
+    },
345
+    created() {
346
+      this.orgName = this.$store.getters.xt_user.org.org_name;
347
+      const order_id = this.$route.query.order_id;
348
+      this.orgId = this.$store.getters.xt_user.org.id;  
349
+      this.getCancelStockOrderPrint(order_id)
350
+    }
351
+
352
+  }
353
+</script>
354
+
355
+<style>
356
+  .dialysis-print-order {
357
+    width: 960px;
358
+    margin: 0 auto
359
+  }
360
+
361
+  .dialysis-print-order .order-yy-name {
362
+    margin: auto;
363
+    text-align: center;
364
+    font-size: 20px;
365
+    letter-spacing: 5px;
366
+  }
367
+
368
+  .dialysis-print-order .order-title {
369
+    margin: auto;
370
+    font-weight: 600;
371
+    text-align: center;
372
+    font-size: 22px;
373
+    padding: 10px 20px 20px 20px;
374
+  }
375
+
376
+  .dialysis-print-order .table-box {
377
+
378
+    width: 100%;
379
+    line-height: 23px;
380
+    font-size: 14px;
381
+  }
382
+
383
+  .dialysis-print-order .print-table {
384
+    width: 100%;
385
+    text-align: center;
386
+    border-collapse: collapse;
387
+    line-height: 40px;
388
+    font-size: 14px;
389
+  }
390
+
391
+  .dialysis-print-order .print-table-no {
392
+    width: 100%;
393
+    text-align: center;
394
+    border-collapse: collapse;
395
+    font-size: 14px;
396
+  }
397
+
398
+  .dialysis-print-order .under-line {
399
+    border-bottom: 1px solid #999;
400
+    width: 95%;
401
+    text-align: center;
402
+    margin-left: 2px;
403
+
404
+
405
+  }
406
+
407
+  .dialysis-print-order .title-box {
408
+    text-align: center;
409
+    font-size: 16px;
410
+  }
411
+
412
+  .dialysis-print-order .radio-lebel-box {
413
+    font-weight: 400;
414
+    cursor: pointer;
415
+  }
416
+
417
+  .dialysis-print-order .radio-no {
418
+    opacity: 0;
419
+    outline: none;
420
+    position: absolute;
421
+    margin: 0;
422
+    width: 0;
423
+    height: 0;
424
+    z-index: -1;
425
+  }
426
+
427
+  .dialysis-print-order .radio-inner {
428
+    white-space: nowrap;
429
+    cursor: pointer;
430
+    outline: none;
431
+    display: inline-block;
432
+    line-height: 1;
433
+    position: relative;
434
+    vertical-align: middle;
435
+  }
436
+
437
+  .dialysis-print-order .radio-fang {
438
+    display: inline-block;
439
+    position: relative;
440
+    border: 1px solid #000;
441
+    box-sizing: border-box;
442
+    width: 14px;
443
+    height: 14px;
444
+    background-color: #fff;
445
+    z-index: 1;
446
+    transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);
447
+  }
448
+
449
+  .dialysis-print-order .is-checked-radio::after {
450
+    content: "√";
451
+    font-size: 15px;
452
+  }
453
+
454
+
455
+  .dialysis-print-order .print-table-no tr td {
456
+    padding: 8px 5px;
457
+    line-height: 25px;
458
+  }
459
+
460
+  .dialysis-print-order .print-table tr td {
461
+    padding: 1px 1px;
462
+    /*line-height: 25px;*/
463
+  }
464
+
465
+  .es-img {
466
+    height: 25px;
467
+  }
468
+
469
+  .advice-name {
470
+    text-align: left;
471
+  }
472
+
473
+  .advice-children {
474
+    display: flex;
475
+  }
476
+
477
+  .title-box-pro {
478
+    border: 0 #fff;
479
+    line-height: 25px;
480
+    height: 25px;
481
+    text-align: left;
482
+    padding-left: 10px !important;
483
+  }
484
+
485
+  .title-box-pro-tr {
486
+    border: 0 #fff;
487
+  }
488
+
489
+  .text-align-left {
490
+    text-align: left !important;
491
+    padding-left: 10px !important;
492
+    font-size: 14px !important;
493
+    line-height: 25px;
494
+  }
495
+
496
+  .print-table-tr-new td {
497
+    line-height: 20px !important;
498
+  }
499
+
500
+  .border-top-solid {
501
+    border: solid 1px #000;
502
+  }
503
+
504
+  .print-template-two tr {
505
+    line-height: 30px;
506
+  }
507
+</style>

+ 504 - 0
src/xt_pages/stock/drugs/cancelDrugOrderPrint.vue 查看文件

@@ -0,0 +1,504 @@
1
+<template>
2
+  <div class="main-contain">
3
+    <div class="position">
4
+      <bread-crumb :crumbs='crumbs'></bread-crumb>
5
+      <el-button :loading="loading" size="small" icon="el-icon-printer" @click="printThisPage" type="primary">打印
6
+      </el-button>
7
+    </div>
8
+    <div class="app-container ">
9
+      <div id="dialysis-print-box">
10
+        <div class="dialysis-print-order" v-for="(it,index) in tableList" :key="index">
11
+         <div class="order-yy-name" style="font-size:22px;font-weight:bold;letter-spacing:0px;">{{orgName}}</div>
12
+          <div class="order-title" style="font-weight:500;font-size:18px;">药品出库登记表</div>
13
+
14
+          <div style="float: left;margin-bottom: 1px;">单据编号:{{it.order_number}}</div>
15
+          <div style="float: right;margin-bottom: 1px;">{{getDateTwo()}}</div>
16
+
17
+          <table class="print-table" border="1">
18
+            <tbody>
19
+            <tr>
20
+              <td style="line-height: 50px" width="230">药品名称</td>
21
+              <td style="line-height: 50px" width="260">品名/注册证号(备案凭证号)</td>
22
+              <td style="line-height: 50px" width="230">规格型号</td>
23
+              <td style="line-height: 50px" width="200">生产厂商</td>
24
+              <td style="line-height: 50px" width="180">批号(序列号)</td>
25
+              <td style="line-height:50px" width="200">生产日期</td>
26
+              <td style="line-height: 50px" width="200">有效期</td>
27
+              <td style="line-height: 50px" width="200">退库数量</td>
28
+              <td style="line-height: 50px" width="80">单价</td>
29
+              <td style="line-height: 50px" width="80">总金额</td>
30
+            </tr>
31
+
32
+            <tr v-for="(item,i) in it.drugCancelStockInfo" :key="i">
33
+              <td style="line-height: 50px">
34
+                <span>{{item.BaseDrugLib.drug_name}}</span>
35
+              </td>
36
+              <td>
37
+                <span>{{item.register_account}}</span>
38
+              </td>
39
+              <td>
40
+                <span>{{item.BaseDrugLib.dose}}{{item.BaseDrugLib.dose_unit}}*{{item.BaseDrugLib.min_number}}{{item.BaseDrugLib.min_unit}}/{{item.BaseDrugLib.max_unit}}</span>
41
+              </td>
42
+              <td>{{item.manufacturer}}</td>
43
+              <td>{{item.batch_number}}</td>
44
+              <td>{{getTime(item.product_date,"{y}-{h}-{d}")}}</td>
45
+              <td>{{getTime(item.expiry_date,"{y}-{h}-{d}")}}</td>
46
+              <td>{{item.count}}</td>
47
+              <td>{{item.price}}</td>
48
+              <td>{{(item.count * item.price).toFixed(2)}}</td>
49
+            </tr>
50
+             <tr>
51
+               <td style="line-height:50px">合计</td>
52
+               <td colspan="8"></td>
53
+               <td>{{getAllPrince(it.id).toFixed(2)}}</td>
54
+             </tr>
55
+            </tbody>
56
+          </table>
57
+
58
+
59
+          <div v-if="orgId != 10024" style="display:flex;margin-top:1px;float:right;">
60
+            <div style="width:50px;">审批:</div><div style="width:100px;"></div>
61
+            <div style="width:80px;">药材主任:</div><div style="width:100px;"></div>
62
+            <div style="width:50px;">会计:</div><div style="width:100px;"></div>
63
+            <div style="width:50px;">审核:</div><div style="width:100px;"></div>
64
+            <div style="width:70px;">制单人:</div><div style="width:100px;"></div>
65
+          </div>
66
+          <div v-if="orgId == 10024" style="display:flex;margin-top:1px;float:right;">
67
+            <div style="width:50px;">科室:</div><div style="width:60px;"></div>
68
+            <div style="width:70px;">领料人:</div><div style="width:60px;"></div>
69
+            <div style="width:80px;">审批:</div><div style="width:100px;">肖庆娥</div>
70
+            <div style="width:50px;">会计:</div><div style="width:100px;">徐立琼</div>
71
+            <div style="width:50px;">审核:</div><div style="width:100px;">徐立琼</div>
72
+            <div style="width:70px;">制单人:</div><div style="width:100px;">徐立琼</div>
73
+          </div>
74
+        </div>
75
+
76
+      </div>
77
+
78
+    </div>
79
+  </div>
80
+
81
+</template>
82
+
83
+<script>
84
+ import {getCancelDrugOrderPrint } from '@/api/drug/drug_stock'
85
+  import { getDataConfig } from '@/utils/data'
86
+  import { jsGetAge, uParseTime } from '@/utils/tools'
87
+  import BreadCrumb from '@/xt_pages/components/bread-crumb'
88
+  import print from 'print-js'
89
+  import {getBaseDrugLibList} from '@/api/data'
90
+  export default {
91
+    name: 'dialysisPrintOrder',
92
+    components: {
93
+      BreadCrumb
94
+
95
+    },
96
+    data() {
97
+      return {
98
+        crumbs: [
99
+          { path: false, name: '出入库明细' },
100
+          { path: false, name: '打印单' }
101
+        ],
102
+        isEdit: 0,
103
+        checked: false,
104
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
105
+        goodType: [],
106
+        goodInfo: [],
107
+        manufacturer: [],
108
+        dealer: [],
109
+
110
+        warehousingOutInfo: {
111
+          loading: false,
112
+          warehousingOutData: [],
113
+          info: {}
114
+        },
115
+        allPrice:0,
116
+        start_time:"",
117
+        end_time:"",
118
+        list:[],
119
+        is_use:"",
120
+        is_charge:"",
121
+        is_inject:"",
122
+        page:1,
123
+        limit:10000,
124
+        keywords:"",
125
+        orgId:'',
126
+        orgName:"",
127
+        drugOrderList:[],
128
+        manufactureList:[],
129
+        tableList:[],
130
+        loading:false,
131
+        warehouseList:[]
132
+      }
133
+    },
134
+    methods: {
135
+      getDateTwo(){
136
+        var ptime = Math.round(new Date().getTime() / 1000);
137
+        return "打印日期:"+uParseTime(ptime, '{y}-{m}-{d}')
138
+      },
139
+      getTime(value, temp) {
140
+        if (value == 0) {
141
+          return ''
142
+        }
143
+        if (value != undefined) {
144
+          return uParseTime(value, temp)
145
+        }
146
+        return ''
147
+      },
148
+      printThisPage() {
149
+        var ptime = Math.round(new Date().getTime() / 1000);
150
+        this.print_time = uParseTime(ptime, '{y}-{m}-{d} {h}:{i}');
151
+        const style = '@media print {.dialysis-print-order{width:960px;margin:0 auto}.dialysis-print-order .order-yy-name{margin:auto;text-align:center;font-size:20px;letter-spacing:5px;font-weight:bold;}.dialysis-print-order .order-title{margin:auto;text-align:center;font-size:22px;padding:10px 20px 20px 20px}.dialysis-print-order .table-box{width:100%;line-height:23px;font-size:14px}.dialysis-print-order .print-table{width:100%;text-align:center;border-collapse:collapse;line-height:25px;font-size:14px}.dialysis-print-order .print-table-no{width:100%;text-align:center;border-collapse:collapse;font-size:14px}.dialysis-print-order .under-line{border-bottom:1px solid #999;width:95%;text-align:center;margin-left:2px}.dialysis-print-order .title-box{text-align:center;font-size:16px;border:1px solid #666}.dialysis-print-order .radio-lebel-box{font-weight:400;cursor:pointer}.dialysis-print-order .radio-no{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.dialysis-print-order .radio-inner{white-space:nowrap;cursor:pointer;outline:0;display:inline-block;line-height:1;position:relative;vertical-align:middle}.dialysis-print-order .radio-fang{display:inline-block;position:relative;border:1px solid #000;box-sizing:border-box;width:14px;height:14px;background-color:#fff;z-index:1;transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46)}.dialysis-print-order .is-checked-radio::after{content:"√";font-size:15px}}.dialysis-print-order .print-table-no tr td { padding: 8px 5px; line-height: 25px; }.es-img{height: 20px; }.advice-name{text-align: left;}.advice-children{display:flex;} .dialysis-print-order .print-table tr td{padding: 0px 0px;} .print-template-two tr {line-height: 30px;}   .title-box-pro{border: 0 #fff;line-height: 40px;height: 40px;text-align: left;padding-left: 10px !important;}  .text-align-left{text-align: left !important;padding-left:10px !important;font-size: 14px !important;line-height: 25px;}';
152
+        printJS({
153
+          printable: 'dialysis-print-box',
154
+          type: 'html',
155
+          style: style,
156
+          scanStyles: false
157
+        })
158
+      },
159
+
160
+      getUnit(id){
161
+        var name = "";
162
+        for(let i=0;i<this.goodUnit.length;i++){
163
+          if(this.goodUnit[i].id == id){
164
+            name = this.goodUnit[i].name
165
+          }
166
+        }
167
+        return name
168
+      },
169
+    GetOrderDetail: function(order_id) {
170
+            const params = {
171
+            'id': order_id
172
+            };
173
+            getDrugWarehouseOutInfo(params).then(response => {
174
+            if (response.data.state == 0) {
175
+
176
+                this.$message.error(response.data.msg);
177
+                return false
178
+            } else {
179
+              for (let i = 0; i < response.data.data.list.length; i++) {
180
+                this.warehousingOutInfo.warehousingOutData.push(response.data.data.list[i])
181
+               }
182
+               var total_price = 0;
183
+               for(let i=0;i<this.warehousingOutInfo.warehousingOutData.length;i++){
184
+                 total_price += this.warehousingOutInfo.warehousingOutData[i].count * this.warehousingOutInfo.warehousingOutData[i].price
185
+               }
186
+               this.allPrice = total_price;
187
+               this.warehousingOutInfo.info = response.data.data.info;
188
+               this.handleSpanTempArr()
189
+            }
190
+            })
191
+        },
192
+        getList() {
193
+        let params = {
194
+          page: this.page,
195
+          limit: this.limit,
196
+          keyword: this.keywords,
197
+          is_use: this.is_use,
198
+          is_charge: this.is_charge,
199
+          is_inject: this.is_inject
200
+        };
201
+        getBaseDrugLibList(params).then(response => {
202
+          if (response.data.state == 0) {
203
+            this.$message.error(response.data.msg);
204
+            return false
205
+          } else {
206
+            this.total = response.data.data.total;
207
+            this.list = [];
208
+            for (let i = 0; i < response.data.data.list.length; i++) {
209
+              this.list.push(response.data.data.list[i])
210
+            }
211
+            console.log("list222222",this.list)
212
+          }
213
+        })
214
+      },
215
+      getUnit(id){
216
+        var name = "";
217
+        for(let i=0;i<this.list.length;i++){
218
+          if(this.list[i].id == id){
219
+            name = this.list[i].min_unit
220
+          }
221
+        }
222
+        return name
223
+      },
224
+      handleSpanTempArr(){
225
+        this.tempArr = [];
226
+
227
+        for (let i = 0; i < this.warehousingOutInfo.warehousingOutData.length; i++) {
228
+          if (i === 0) {
229
+            this.tempArr.push(1);
230
+            this.pos = 0
231
+          } else {
232
+            // 判断当前元素与上一个元素是否相同
233
+            if (this.warehousingOutInfo.warehousingOutData[i].drug_id === this.warehousingOutInfo.warehousingOutData[i - 1].drug_id) {
234
+              this.tempArr[this.pos] += 1;
235
+              this.tempArr.push(0)
236
+            } else {
237
+              this.tempArr.push(1);
238
+              this.pos = i
239
+            }
240
+          }
241
+        }
242
+
243
+        let sameRowArr = [], sIdx = 0;
244
+        this.warehousingOutInfo.warehousingOutData.forEach((item, index) => {
245
+          item.index = index;
246
+          if (index === 0) {
247
+            sameRowArr.push([index])
248
+          } else {
249
+            if (item.drug_id === this.warehousingOutInfo.warehousingOutData[index - 1].drug_id) {
250
+              sameRowArr[sIdx].push(index)
251
+            } else {
252
+              sIdx = sIdx + 1;
253
+              sameRowArr.push([index])
254
+            }
255
+          }
256
+        });
257
+        this.sameRowArr = sameRowArr
258
+      },
259
+      getDrugWarehouseOrderInfo(){
260
+        getDrugWarehouseOrderInfo().then(response=>{
261
+           if(response.data.state == 1){
262
+             var list =  response.data.data.list
263
+             console.log("入库单详情",list)
264
+             this.drugOrderList = list
265
+           }
266
+        })
267
+      },
268
+      getNumber(id){
269
+        var number = ""
270
+        for(let i=0;i<this.drugOrderList.length;i++){
271
+          if(id == this.drugOrderList[i].drug_id){
272
+              number = this.drugOrderList[i].number
273
+          }
274
+        }
275
+        return number
276
+      },
277
+      getProductDate(id){
278
+        var product_date = ""
279
+        for(let i=0;i<this.drugOrderList.length;i++){
280
+           if(id == this.drugOrderList[i].drug_id){
281
+             product_date = this.drugOrderList[i].product_date
282
+           }
283
+        }
284
+        return this.getTime(product_date)
285
+      },
286
+      getExpiryDate(id){
287
+         var expiry_date = ""
288
+         for(let i=0;i<this.drugOrderList.length;i++){
289
+           if(id == this.drugOrderList[i].drug_id){
290
+             expiry_date = this.drugOrderList[i].expiry_date
291
+           }
292
+        }
293
+        return this.getTime(expiry_date)
294
+      },
295
+      getTime(val) {
296
+         if(val < 0){
297
+           return ""
298
+         }
299
+         if(val == ""){
300
+          return ""
301
+         }else {
302
+          return uParseTime(val, '{y}-{m}-{d}')
303
+         }
304
+      },
305
+
306
+        getCancelDrugOrderPrint(order_id){
307
+        var params = {
308
+            order_id:order_id
309
+        }
310
+        getCancelDrugOrderPrint(params).then(response=>{
311
+            if(response.data.state ==1){
312
+            var list =  response.data.data.list
313
+            console.log("list222",list)
314
+            this.tableList = list
315
+            }
316
+        })
317
+        },
318
+      // getAllPrince(id){
319
+      //   var count = 0
320
+      //   for(let i=0;i<this.warehouseList.length;i++){
321
+      //     if(id == this.warehouseList[i].warehouse_out_id){
322
+      //        count +=this.warehouseList[i].count * this.warehouseList[i].last_price
323
+      //     }
324
+      //   }
325
+      //   return count
326
+      // }
327
+     getAllPrince(id){
328
+        var total = 0
329
+        var arr = []
330
+        for(let i=0;i<this.tableList.length;i++){
331
+          arr.push(...this.tableList[i].drugCancelStockInfo)
332
+        } 
333
+        console.log("arr23223",arr)
334
+        for(let i=0;i<arr.length;i++){
335
+         if(id == arr[i].cancel_stock_id){
336
+           total += arr[i].price * arr[i].count
337
+         }
338
+        }
339
+        return total
340
+      }
341
+    },
342
+    created() {
343
+      this.orgName = this.$store.getters.xt_user.org.org_name;
344
+      const order_id = this.$route.query.order_id;
345
+      this.orgId = this.$store.getters.xt_user.org.id;  
346
+      this.getCancelDrugOrderPrint(order_id)
347
+    }
348
+
349
+  }
350
+</script>
351
+
352
+<style>
353
+  .dialysis-print-order {
354
+    width: 960px;
355
+    margin: 0 auto
356
+  }
357
+
358
+  .dialysis-print-order .order-yy-name {
359
+    margin: auto;
360
+    text-align: center;
361
+    font-size: 20px;
362
+    letter-spacing: 5px;
363
+  }
364
+
365
+  .dialysis-print-order .order-title {
366
+    margin: auto;
367
+    font-weight: 600;
368
+    text-align: center;
369
+    font-size: 22px;
370
+    padding: 10px 20px 20px 20px;
371
+  }
372
+
373
+  .dialysis-print-order .table-box {
374
+
375
+    width: 100%;
376
+    line-height: 23px;
377
+    font-size: 14px;
378
+  }
379
+
380
+  .dialysis-print-order .print-table {
381
+    width: 100%;
382
+    text-align: center;
383
+    border-collapse: collapse;
384
+    line-height: 40px;
385
+    font-size: 14px;
386
+  }
387
+
388
+  .dialysis-print-order .print-table-no {
389
+    width: 100%;
390
+    text-align: center;
391
+    border-collapse: collapse;
392
+    font-size: 14px;
393
+  }
394
+
395
+  .dialysis-print-order .under-line {
396
+    border-bottom: 1px solid #999;
397
+    width: 95%;
398
+    text-align: center;
399
+    margin-left: 2px;
400
+
401
+
402
+  }
403
+
404
+  .dialysis-print-order .title-box {
405
+    text-align: center;
406
+    font-size: 16px;
407
+  }
408
+
409
+  .dialysis-print-order .radio-lebel-box {
410
+    font-weight: 400;
411
+    cursor: pointer;
412
+  }
413
+
414
+  .dialysis-print-order .radio-no {
415
+    opacity: 0;
416
+    outline: none;
417
+    position: absolute;
418
+    margin: 0;
419
+    width: 0;
420
+    height: 0;
421
+    z-index: -1;
422
+  }
423
+
424
+  .dialysis-print-order .radio-inner {
425
+    white-space: nowrap;
426
+    cursor: pointer;
427
+    outline: none;
428
+    display: inline-block;
429
+    line-height: 1;
430
+    position: relative;
431
+    vertical-align: middle;
432
+  }
433
+
434
+  .dialysis-print-order .radio-fang {
435
+    display: inline-block;
436
+    position: relative;
437
+    border: 1px solid #000;
438
+    box-sizing: border-box;
439
+    width: 14px;
440
+    height: 14px;
441
+    background-color: #fff;
442
+    z-index: 1;
443
+    transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);
444
+  }
445
+
446
+  .dialysis-print-order .is-checked-radio::after {
447
+    content: "√";
448
+    font-size: 15px;
449
+  }
450
+
451
+
452
+  .dialysis-print-order .print-table-no tr td {
453
+    padding: 8px 5px;
454
+    line-height: 25px;
455
+  }
456
+
457
+  .dialysis-print-order .print-table tr td {
458
+    padding: 1px 1px;
459
+    /*line-height: 25px;*/
460
+  }
461
+
462
+  .es-img {
463
+    height: 25px;
464
+  }
465
+
466
+  .advice-name {
467
+    text-align: left;
468
+  }
469
+
470
+  .advice-children {
471
+    display: flex;
472
+  }
473
+
474
+  .title-box-pro {
475
+    border: 0 #fff;
476
+    line-height: 25px;
477
+    height: 25px;
478
+    text-align: left;
479
+    padding-left: 10px !important;
480
+  }
481
+
482
+  .title-box-pro-tr {
483
+    border: 0 #fff;
484
+  }
485
+
486
+  .text-align-left {
487
+    text-align: left !important;
488
+    padding-left: 10px !important;
489
+    font-size: 14px !important;
490
+    line-height: 25px;
491
+  }
492
+
493
+  .print-table-tr-new td {
494
+    line-height: 20px !important;
495
+  }
496
+
497
+  .border-top-solid {
498
+    border: solid 1px #000;
499
+  }
500
+
501
+  .print-template-two tr {
502
+    line-height: 30px;
503
+  }
504
+</style>