Ver código fonte

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

陈少旭 1 ano atrás
pai
commit
c51f49ccd7

+ 244 - 0
src/xt_pages/stock/drug_damage_print.vue Ver arquivo

@@ -0,0 +1,244 @@
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>报损日期</td>
22
+                        <td>药品名称</td>
23
+                        <td>规格</td>
24
+                        <td>总损耗数量</td>
25
+                        <td>总报损金额</td>
26
+                        <td>仓库名称</td>
27
+                        <td>操作人</td>
28
+                        
29
+                    </tr>
30
+                    <tr v-for="(item,index) in tableList" :key="index">
31
+                        <td>
32
+                            {{getTime(item.start_time)}}
33
+                        </td>
34
+                        <td>
35
+                            {{item.drug_name}}
36
+                        </td>
37
+                        <td>
38
+                            {{item.specification_name}}
39
+                        </td>
40
+                        <td>
41
+                            {{getTotalCount(item.drug_id,item.max_unit,item.min_unit,item.min_number)}}
42
+                        </td>
43
+                        <td>
44
+                            {{getTotalPrice(item.drug_id,item.min_price)}}
45
+                        </td>
46
+                        <td>
47
+                            {{getHouseName(item.storehouse_id)}}
48
+                        </td>
49
+                        <td>
50
+                            {{getDoctorName(item.creater)}}
51
+                        </td>
52
+                      
53
+                    </tr>
54
+                    </tbody>
55
+                </table>
56
+            </div>
57
+        </div>
58
+    </div>
59
+</template>
60
+
61
+<script>
62
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
63
+const moment = require('moment');
64
+import { uParseTime } from '@/utils/tools'
65
+import { getDrugDamageList } from "@/api/drug/drug"
66
+import print from "print-js";
67
+export default {
68
+    components:{
69
+        BreadCrumb
70
+    },
71
+    data(){
72
+        return{
73
+          crumbs: [
74
+            { path: false, name: '库存管理' },
75
+            { path: false, name: '耗材管理' },
76
+            { path: false, name: '耗材盘点打印' },
77
+          ],
78
+          org_name: this.$store.getters.xt_user.org.org_name,
79
+          ids:"",
80
+          tableList:[],
81
+          manufacturerList:[],
82
+          houseList:[],
83
+          datamageList:[],
84
+          doctorList:[]
85
+        }
86
+    },
87
+    methods:{
88
+        printAction: function() {
89
+            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;} }';
90
+            printJS({ 
91
+            printable: 'print_content',
92
+            type: 'html',
93
+            documentTitle: '  ',
94
+            style: style,
95
+            scanStyles: false
96
+            })
97
+        },
98
+        getTime(val) {
99
+         if(val < 0){
100
+            return ""
101
+          }
102
+         if(val == ""){
103
+            return ""
104
+          }else {
105
+            return uParseTime(val, '{y}-{m}-{d}')
106
+         }
107
+        },
108
+        getlist(){
109
+        var params = {
110
+          limit:this.$route.query.limit,
111
+          page:this.$route.query.page,
112
+          start_time:this.$route.query.start_time,
113
+          end_time:this.$route.query.end_time,
114
+          keyword:this.$route.query.keyword,
115
+          storehouse_id:this.$route.query.storehouse_id,
116
+        }
117
+
118
+        getDrugDamageList(params).then(response=>{
119
+           if(response.data.state == 1){
120
+             this.tableList = response.data.data.list
121
+             this.total = response.data.data.total
122
+             this.doctorList = response.data.data.doctorList
123
+             var datamagelist = response.data.data.damagelist
124
+             this.datamageList = datamagelist
125
+             var obj = {id:0,storehouse_name:"全部"}
126
+             this.houseList = []
127
+             this.houseList.push(obj)
128
+             for(let i=0;i<response.data.data.houseList.length;i++){
129
+              this.houseList.push(response.data.data.houseList[i])
130
+             }
131
+           }
132
+        })
133
+      },
134
+        getManufacturerName(id){
135
+           var name = ""
136
+           for(let i=0;i<this.manufacturerList.length;i++){
137
+              if(id == this.manufacturerList[i].id){
138
+                  name = this.manufacturerList[i].manufacturer_name
139
+              }
140
+           }
141
+           return name
142
+        },
143
+        getHouseName(id){
144
+         var storehouse_name = ""
145
+         for(let i=0;i<this.houseList.length;i++){
146
+           if(id == this.houseList[i].id){
147
+              storehouse_name = this.houseList[i].storehouse_name
148
+           }
149
+         }
150
+         if(storehouse_name == "全部"){
151
+           return ""
152
+         }else{
153
+           return storehouse_name
154
+         }
155
+       },
156
+       getDamageCount(good_id){
157
+        var count = 0
158
+        for(let i=0;i<this.damageList.length;i++){
159
+          if(good_id == this.damageList[i].good_id){
160
+             count = this.damageList[i].count
161
+          }
162
+        }
163
+        return count
164
+      },
165
+      getAllDamageCount(good_id,price){
166
+        var count = 0
167
+        for(let i=0;i<this.damageList.length;i++){
168
+          if(good_id == this.damageList[i].good_id){
169
+             count = this.damageList[i].count
170
+          }
171
+        }
172
+        return (count * price).toFixed(2)
173
+      },
174
+      getStorehouseName(id){
175
+        var storehouse_name = ""
176
+        for(let i=0;i<this.houseList.length;i++){
177
+          if(id == this.houseList[i].id){
178
+            storehouse_name = this.houseList[i].storehouse_name
179
+          }
180
+        }
181
+        if(storehouse_name == "全部"){
182
+          return ""
183
+        }else{
184
+          return storehouse_name
185
+        }
186
+      },
187
+    
188
+      getTotalCount(drugid,max_unit,min_unit,min_number){
189
+
190
+        var total = 0
191
+        var str = ""
192
+        var str_min = ""
193
+        for(let i=0;i<this.datamageList.length;i++){
194
+        if(drugid == this.datamageList[i].drug_id){
195
+            total +=this.datamageList[i].count
196
+        }
197
+        }
198
+        if(parseInt(total/min_number)!=0){
199
+        str = parseInt(total/min_number) + max_unit
200
+        }
201
+        if((total%min_number)!=0){
202
+        str_min = total%min_number + min_unit
203
+        }
204
+        return str+str_min
205
+        },
206
+        getTotalPrice(drugid,minprice){
207
+        var total = 0
208
+        for(let i=0;i<this.datamageList.length;i++){
209
+        if(drugid == this.datamageList[i].drug_id){
210
+            total+=this.datamageList[i].count
211
+        }
212
+        }
213
+        return (total*minprice).toFixed(2)
214
+    },
215
+    getDoctorName(id){
216
+        var user_name = ""
217
+        for(let i=0;i<this.doctorList.length;i++){
218
+          if(id == this.doctorList[i].admin_user_id){
219
+            user_name = this.doctorList[i].user_name
220
+          }
221
+        }
222
+        return user_name
223
+     },
224
+    },
225
+    created(){
226
+
227
+      this.getlist()
228
+    }
229
+}
230
+</script>
231
+
232
+
233
+<style rel="stylesheet/scss" lang="scss" scoped>
234
+.printTitle{font-size: 22px;text-align: center;}
235
+.flex{display: flex;justify-content: space-between;}
236
+.tableTitle{display: flex;border-top:1px solid #000;border-bottom: 1px solid #000;padding: 10px 0;}
237
+.tableTr{display: flex;border-bottom: 1px dashed #000;padding: 10px 0;}
238
+.tableBottom{display: flex;border-bottom: 1px solid #000;padding: 10px 0;}
239
+.printTable{width:100%;border-collapse: collapse;}
240
+.printTable td{padding:5px;}
241
+.print_head{border: none;display: table-header-group;}
242
+.print_head tr td{text-align: center;border: none;}
243
+.print_body tr td{border:1px solid}
244
+</style>

+ 202 - 0
src/xt_pages/stock/print_damage.vue Ver arquivo

@@ -0,0 +1,202 @@
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>报损日期</td>
22
+                        <td>耗材名称</td>
23
+                        <td>耗材规格</td>
24
+                        <td>总损耗数量</td>
25
+                        <td>总报损金额</td>
26
+                        <td>仓库名称</td>
27
+                     
28
+                        
29
+                    </tr>
30
+                    <tr v-for="(item,index) in tableList" :key="index">
31
+                        <td>
32
+                            {{getTime(item.ctime)}}
33
+                        </td>
34
+                        <td>
35
+                           {{item.good_name}}
36
+                        </td>
37
+                        <td>
38
+                          {{item.specification_name}}
39
+                        </td>
40
+                        <td>
41
+                          {{getDamageCount(item.good_id)}}
42
+                        </td>
43
+                        <td>
44
+                            {{getAllDamageCount(item.good_id,item.buy_price)}}   
45
+                        </td>
46
+                        <td>{{getHouseName(item.storehouse_id)}}</td>
47
+                      
48
+                    </tr>
49
+                    </tbody>
50
+                </table>
51
+            </div>
52
+        </div>
53
+    </div>
54
+</template>
55
+
56
+<script>
57
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
58
+const moment = require('moment');
59
+import { uParseTime } from '@/utils/tools'
60
+import { getReportStockList } from "@/api/stock"
61
+import print from "print-js";
62
+export default {
63
+    components:{
64
+        BreadCrumb
65
+    },
66
+    data(){
67
+        return{
68
+          crumbs: [
69
+            { path: false, name: '库存管理' },
70
+            { path: false, name: '耗材管理' },
71
+            { path: false, name: '耗材盘点打印' },
72
+          ],
73
+          org_name: this.$store.getters.xt_user.org.org_name,
74
+          ids:"",
75
+          tableList:[],
76
+          manufacturerList:[],
77
+          houseList:[],
78
+        }
79
+    },
80
+    methods:{
81
+        printAction: function() {
82
+            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;} }';
83
+            printJS({ 
84
+            printable: 'print_content',
85
+            type: 'html',
86
+            documentTitle: '  ',
87
+            style: style,
88
+            scanStyles: false
89
+            })
90
+        },
91
+        getTime(val) {
92
+         if(val < 0){
93
+            return ""
94
+          }
95
+         if(val == ""){
96
+            return ""
97
+          }else {
98
+            return uParseTime(val, '{y}-{m}-{d}')
99
+         }
100
+        },
101
+        getlist(){
102
+          var params = {
103
+            start_time:this.$route.query.start_time,
104
+            end_time:this.$route.query.end_time,
105
+            keyword:this.$route.query.searchKey,
106
+            limit:this.$route.query.limit,
107
+            page:this.$route.query.page,
108
+            storehouse_id:this.$route.query.storehouse_id,
109
+         }
110
+         getReportStockList(params).then(response=>{
111
+          if(response.data.state == 1){
112
+            var list = response.data.data.list
113
+            console.log("list2oo2o2oo2",list)
114
+            this.total = response.data.data.total
115
+            this.tableList = list
116
+            var doctorlist = response.data.data.doctorlist
117
+            this.doctorList = doctorlist
118
+            var damageList =  response.data.data.damageList
119
+            this.damageList = damageList
120
+            var obj = {id:0,storehouse_name:"全部"}
121
+            this.houseList = []
122
+            this.houseList.push(obj)
123
+            for(let i=0;i<response.data.data.houseList.length;i++){
124
+                this.houseList.push(response.data.data.houseList[i])
125
+            }
126
+           }
127
+          })   
128
+        },
129
+        getManufacturerName(id){
130
+           var name = ""
131
+           for(let i=0;i<this.manufacturerList.length;i++){
132
+              if(id == this.manufacturerList[i].id){
133
+                  name = this.manufacturerList[i].manufacturer_name
134
+              }
135
+           }
136
+           return name
137
+        },
138
+        getHouseName(id){
139
+         var storehouse_name = ""
140
+         for(let i=0;i<this.houseList.length;i++){
141
+           if(id == this.houseList[i].id){
142
+              storehouse_name = this.houseList[i].storehouse_name
143
+           }
144
+         }
145
+         if(storehouse_name == "全部"){
146
+           return ""
147
+         }else{
148
+           return storehouse_name
149
+         }
150
+       },
151
+       getDamageCount(good_id){
152
+        var count = 0
153
+        for(let i=0;i<this.damageList.length;i++){
154
+          if(good_id == this.damageList[i].good_id){
155
+             count = this.damageList[i].count
156
+          }
157
+        }
158
+        return count
159
+      },
160
+      getAllDamageCount(good_id,price){
161
+        var count = 0
162
+        for(let i=0;i<this.damageList.length;i++){
163
+          if(good_id == this.damageList[i].good_id){
164
+             count = this.damageList[i].count
165
+          }
166
+        }
167
+        return (count * price).toFixed(2)
168
+      },
169
+      getStorehouseName(id){
170
+        var storehouse_name = ""
171
+        for(let i=0;i<this.houseList.length;i++){
172
+          if(id == this.houseList[i].id){
173
+            storehouse_name = this.houseList[i].storehouse_name
174
+          }
175
+        }
176
+        if(storehouse_name == "全部"){
177
+          return ""
178
+        }else{
179
+          return storehouse_name
180
+        }
181
+      },
182
+    },
183
+    created(){
184
+
185
+      this.getlist()
186
+    }
187
+}
188
+</script>
189
+
190
+
191
+<style rel="stylesheet/scss" lang="scss" scoped>
192
+.printTitle{font-size: 22px;text-align: center;}
193
+.flex{display: flex;justify-content: space-between;}
194
+.tableTitle{display: flex;border-top:1px solid #000;border-bottom: 1px solid #000;padding: 10px 0;}
195
+.tableTr{display: flex;border-bottom: 1px dashed #000;padding: 10px 0;}
196
+.tableBottom{display: flex;border-bottom: 1px solid #000;padding: 10px 0;}
197
+.printTable{width:100%;border-collapse: collapse;}
198
+.printTable td{padding:5px;}
199
+.print_head{border: none;display: table-header-group;}
200
+.print_head tr td{text-align: center;border: none;}
201
+.print_body tr td{border:1px solid}
202
+</style>