28169 před 1 měsícem
rodič
revize
c33711eb85

+ 294 - 0
src/xt_pages/stock/drugs/drugNewPrint.vue Zobrazit soubor

@@ -0,0 +1,294 @@
1
+<template>
2
+    <el-dialog
3
+      title="打印"
4
+      :visible.sync="visibility"
5
+      :close-on-click-modal="isClose"
6
+      :close-on-press-escape="isClose"
7
+    >
8
+      <el-button type="primary" @click="print" class="print_style"
9
+        >打印</el-button
10
+      >
11
+      <div id="dialysis-print-box-1" class="dialysis-print-box-1">
12
+        <div class="list_title" style="border-bottom:none;">
13
+          <div style="width:100%;text-align:center;font-size:16px;font-weight:bold;">
14
+            {{org_name}} <span v-if="state=='待发药'">发药单</span> <span v-if="state=='已发药'">领药单</span>
15
+          </div>
16
+        </div>
17
+        <div style="display: flex;">
18
+          <div style="margin-right: 20px;">日期:{{times}}</div>
19
+        </div>
20
+        <div>
21
+          <table class="table" border="1" 
22
+            style="border-collapse: collapse;width: 100%;text-align: center;">
23
+            <tr>
24
+              <td>序号</td>
25
+              <td>医保编码</td>
26
+              <td>药品名称</td>
27
+              <td>规格</td>
28
+              <td>入库数量</td>
29
+              <td>单位</td>
30
+              <td>进货单价</td>
31
+              <td>入库金额</td>
32
+              <td>零售价</td>
33
+              <td>批号</td>
34
+              <td>生产日期</td>
35
+              <td>有效日期</td>
36
+              <td>生产厂家</td>
37
+              <td>进销商</td>
38
+              <td>入库日期</td>
39
+              <td>备注</td>
40
+            </tr>
41
+            <tr v-for="(item,i) in goodList" >
42
+              <td>{{ i+1 }}</td>
43
+              <td>{{ item.social_security_directory_code  }}</td>
44
+              <td>{{item.drug_name }}</td>
45
+              <td>{{ item.specification_name }}</td>
46
+              <td>{{ item.warehousing_count }}</td>
47
+              <td>{{ item.max_unit}}</td>
48
+              <td>
49
+                {{ item.price }}
50
+              </td>
51
+              <td>
52
+               {{ (item.warehousing_count * item.price).toFixed(2) }}
53
+              </td>
54
+              <td>
55
+                {{ item.retail_price }}
56
+              </td>
57
+              <td>{{ item.batch_number }}</td>
58
+              <td>
59
+                {{ getTime(item.product_date) }}
60
+              </td>
61
+              <td>
62
+                {{ getTime(item.expiry_date) }}
63
+              </td>
64
+            
65
+              <td>
66
+                {{ item.manufacturer_name }}
67
+              </td>
68
+              <td>
69
+                {{ item.dealer_name }}
70
+              </td>
71
+              <td>
72
+                {{ getTime(item.ctime) }}
73
+              </td>
74
+              <td>
75
+                {{ item.remark }}
76
+              </td>
77
+            </tr>
78
+          </table>
79
+        </div>
80
+        <div style="display: flex;margin: 10px 0;">
81
+          <div style="flex: 1;">数量合计:
82
+             {{ getSumCount() }}
83
+          </div>
84
+          <div style="flex: 1;">金额合计:
85
+             {{ getSumPrice() }}
86
+          </div>
87
+          <div style="flex: 1;">操作人:</div>
88
+          <div style="flex: 1;">核对人:</div>
89
+        </div>
90
+       
91
+      </div>
92
+    </el-dialog>
93
+  </template>
94
+  <script>
95
+  import Vue from "vue";
96
+  import print from "print-js";
97
+  import printutils from "./print.js";
98
+  import{todaynumber} from '@/api/pharmacy'
99
+  const moment = require("moment");
100
+  import { uParseTime } from "@/utils/tools";
101
+  export default {
102
+    
103
+    data() {
104
+      return {
105
+        visibility: false,
106
+        tableData: [],
107
+        isClose:false,
108
+        name:"",
109
+        DialysisNo:'',
110
+        state:null,
111
+        times: moment().format('YYYY-MM-DD HH:mm:ss'),
112
+        start_time:moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
113
+        org_name: this.$store.getters.xt_user.org.org_name,
114
+        baseList:[],
115
+        Doctor:'',
116
+        patients:{},
117
+        doctors:[],
118
+        Price_zong:0,
119
+        diagnosearr:[],
120
+        diagnosis:'',
121
+        goodList:[],
122
+        manufacturerList:[],
123
+        dealerList:[],
124
+        goodKindList:[],
125
+      };
126
+    },
127
+    props: {
128
+      propForm: {
129
+        type: Object,
130
+      },
131
+    },
132
+    created(){
133
+      this.init();
134
+    },
135
+    methods: {
136
+     pickerOptions(){
137
+
138
+     },
139
+     changeStartTime(){
140
+
141
+     },
142
+     changeEndTime(){
143
+
144
+     },
145
+      getSumCount(){
146
+        var sum_count = 0
147
+        for(let i=0;i<this.tableData.length;i++){
148
+          sum_count+=this.tableData[i].warehousing_count
149
+        }
150
+        return sum_count
151
+      },
152
+      getSumPrice(){
153
+        var all_price = 0
154
+        for(let i=0;i<this.tableData.length;i++){
155
+          all_price+= (this.tableData[i].warehousing_count * this.tableData[i].price)
156
+        }
157
+        if(all_price>0){
158
+           all_price.toFixed(2)
159
+        }else{
160
+          return ""
161
+        }
162
+      },
163
+      getTime: function(val) {
164
+      if (val == 0) {
165
+        return "";
166
+      } else {
167
+        return uParseTime(val, "{y}-{m}-{d}");
168
+      }
169
+     },
170
+      hide: function () {
171
+        this.visibility = false;
172
+        for (let i = 0; i < this.propForm.goods.length; i++) {
173
+          for (let key in this.propForm.goods[i]) {
174
+            if (key != "index") {
175
+              this.propForm.goods[i][key].isSelected = false;
176
+            }
177
+          }
178
+        }
179
+      },
180
+      show: function (tableData) {
181
+        console.log("tableData===========",tableData)
182
+        this.goodList = []
183
+        this.goodList = tableData
184
+        this.visibility = true;
185
+      },
186
+   
187
+      comfirm: function (formName) {
188
+        this.goodInfo = [];
189
+        this.goodInfoTableData = [];
190
+        this.$emit("dialog-comfirm", this.getValue());
191
+        this.$refs.multipleTable.clearSelection();
192
+        this.$refs.table.setCurrentRow(null);
193
+      },
194
+      getValue() {},
195
+  
196
+      // 打印
197
+      print() {
198
+        console.log(this.org_name,'this.org_name')
199
+        Vue.prototype.printJson = printutils.printJson;
200
+          const style ='@media print {.list_title{width:940px;border-bottom:1px solid;display:flex;margin:20px auto} .table tr td{border:1px solid black;padding: 5px 0;border-left: none;border-right: none;}.dialysis-print-box-1 .table{ border-collapse: collapse;width:100%;text_align:center} .dialysis-print-box-1 .table tr td{ border: 1px solid #000 !important; padding: 5px 0;} }';
201
+          printJS({
202
+            printable: "dialysis-print-box-1",
203
+            type: "html",
204
+            style: style,
205
+            scanStyles: false,
206
+          });
207
+
208
+          
209
+      },
210
+      getTime(val) {
211
+          if(val < 0){
212
+            return ""
213
+          }
214
+          if(val == ""){
215
+          return ""
216
+          }else {
217
+          return uParseTime(val, '{y}-{m}-{d} {h}:{i}')
218
+          }
219
+      }, 
220
+      getdoctors(id){
221
+        for(let i in this.doctors){
222
+          if(this.doctors[i].id == id){
223
+            return this.doctors[i].user_name
224
+          }
225
+        }
226
+      }
227
+    },
228
+  };
229
+  </script>
230
+  
231
+  <style lang="scss" scoped>
232
+  /deep/ .el-dialog{
233
+    width: 60%;
234
+  }
235
+  /deep/ .el-table__body-wrapper::-webkit-scrollbar {
236
+    width: 10px;
237
+    height: 10px;
238
+  }
239
+  .print_style {
240
+    position: absolute;
241
+    right: 65px;
242
+    top: 50px;
243
+  }
244
+  
245
+  .list_title {
246
+    width: 940px;
247
+    border-bottom: 1px solid;
248
+    display: flex;
249
+  }
250
+  .table tr td{
251
+   border:1px solid black;
252
+   padding: 5px 0;
253
+   border-left: none;
254
+   border-right: none;
255
+  }
256
+  </style>
257
+  
258
+  <style>
259
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
260
+    font-size: 12px;
261
+  }
262
+  
263
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
264
+    background: #6fb5fa;
265
+  }
266
+  
267
+  .count {
268
+    color: #bd2c00;
269
+  }
270
+  .el-table td,
271
+  .el-table th.is-leaf,
272
+  .el-table--border,
273
+  .el-table--group {
274
+    border-color: #d0d3da;
275
+  }
276
+  .el-table--border::after,
277
+  .el-table--group::after,
278
+  .el-table::before {
279
+    background-color: #d0d3da;
280
+  }
281
+
282
+  /* 仅影响当前组件的表格 */
283
+.dialysis-print-box-1 .table {
284
+  border-collapse: collapse;
285
+  width: 100%;
286
+  text-align: center;
287
+}
288
+
289
+.dialysis-print-box-1 .table tr td {
290
+  border: 1px solid #000 !important; /* 确保所有边框都显示 */
291
+  padding: 5px 0;
292
+}
293
+  </style>
294
+  

+ 53 - 0
src/xt_pages/stock/drugs/print.js Zobrazit soubor

@@ -0,0 +1,53 @@
1
+import printJS from "print-js";
2
+/**
3
+ * 
4
+ * @param {
5
+ *      title:"", // 表名
6
+ *      serial:false, // 是否需要序号
7
+ *      data:[], // 要打印的数据
8
+ *      fields:[], // 需要打印的字段
9
+ *      properties:[
10
+ *          {
11
+ *              field:"字段名(对应fields)",
12
+ *              displayName:"打印时展⽰的中⽂表头名字",
13
+ *              columnSize:"定义列宽,⽤百分⽐来表⽰⼤⼩,可不传"
14
+ *          }
15
+ *      ],
16
+ * } args
17
+ *  
18
+ */
19
+function printJson(args = {}) {
20
+    let data = [];
21
+    for (let di = 0; di < args.data.length; di++) {
22
+        var obj = {}
23
+        // 如果需要序列号则是列表index+1
24
+        if (args.serial) {
25
+            obj.serial = di + 1
26
+        }
27
+        // 遍历需要打印的字段与列表字段⼀⼀对应,形成键值对
28
+        for (let fi = 0; fi < args.fields.length; fi++) {
29
+            obj[args.fields[fi]] = args.data[di][args.fields[fi]]
30
+        }
31
+        data.push(obj)
32
+    }
33
+    let properties = args.properties;
34
+    if (args.serial) {
35
+        properties.unshift({
36
+            field: "serial",
37
+            displayName: "序号",
38
+        })
39
+    }
40
+    printJS({
41
+        printable: data,
42
+        properties: properties || [],
43
+        header: args.title || "",
44
+        // 样式设置
45
+        type: 'json',  // 打印的格式
46
+        headerStyle:'display:flex;  .list_title{  width: 940px;border-bottom: 1px solid;display: flex;margin: 30px auto;}',
47
+        gridStyle: 'border: 1px solid #000;text-align:center;padding:5px 0;', // 表格样式
48
+        gridHeaderStyle: 'border: 1px solid #000;text-align:center;padding:5px 0;',//表头样式
49
+    });
50
+}
51
+export default {
52
+    printJson
53
+}