28169 8 miesięcy temu
rodzic
commit
e2a324465d
1 zmienionych plików z 268 dodań i 0 usunięć
  1. 268 0
      src/xt_pages/stock/stockInventoryModePrint.vue

+ 268 - 0
src/xt_pages/stock/stockInventoryModePrint.vue Wyświetl plik

@@ -0,0 +1,268 @@
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
+                     
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
+                       
32
+                       
33
+                       
34
+                    </tr>
35
+
36
+                    <tr v-for="(item,index) in tableList" :key="index">
37
+                        <td align="center">{{ item.good_name }}</td>
38
+                        <td align="center">{{ item.specification_name }}</td>
39
+                        <td align="center">{{ getInCount(item.good_id) }}</td>
40
+                        <td align="center">{{ getOutCount(item.good_id) }}</td> 
41
+                        <td align="center">{{ getSumCount(item.good_id) }}</td>
42
+                        <td align="center">生产厂商</td>
43
+                       
44
+                        <td align="center">本月入库数量</td>
45
+                        <td align="center">本月出库数量</td>
46
+                        <td align="center">本月剩余库存</td>
47
+                       
48
+                    </tr>
49
+                   
50
+                    </tbody>
51
+                </table>
52
+            </div>
53
+        </div>
54
+    </div>
55
+</template>
56
+
57
+<script>
58
+import print from "print-js"; 
59
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
60
+const moment = require('moment');
61
+import { uParseTime } from '@/utils/tools'
62
+import { getStockInventroyModePrintList } from  "@/api/stock"
63
+  export default {
64
+    components:{
65
+        BreadCrumb
66
+    },
67
+     data(){
68
+       return{
69
+        crumbs: [
70
+            { path: false, name: '库存管理' },
71
+            { path: false, name: '耗材管理' },
72
+            { path: false, name: '耗材模版打印' },
73
+          ],
74
+          tableList:[],
75
+          org_name: this.$store.getters.xt_user.org.org_name,
76
+          start_time:"",
77
+          end_time:"",
78
+          manufacturerList:[],
79
+          infoList:[],
80
+          outinfo:[],
81
+          flowProList:[],
82
+          flowNoProList:[],
83
+          goodInfo:[]
84
+       }
85
+     },
86
+     methods:{
87
+        printAction: function() {
88
+            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;} }';
89
+            printJS({ 
90
+            printable: 'print_content',
91
+            type: 'html',
92
+            documentTitle: '  ',
93
+            style: style,
94
+            scanStyles: false
95
+            })
96
+        },
97
+        getTime(val) {
98
+         if(val < 0){
99
+            return ""
100
+          }
101
+         if(val == ""){
102
+            return ""
103
+          }else {
104
+            return uParseTime(val, '{y}-{m}-{d}')
105
+         }
106
+        },
107
+        getlist(){
108
+          
109
+          var params = {
110
+            start_time:this.$route.query.start_time,
111
+            end_time:this.$route.query.end_time,
112
+          }
113
+          console.log("params-------",params)
114
+          getStockInventroyModePrintList(params).then(response=>{
115
+              if(response.data.state == 1){
116
+                 var list  =  response.data.data.list
117
+
118
+                 console.log("list===============",list)
119
+
120
+                if(list!=null && list.length > 0){
121
+                  let dataInfo = {}
122
+                  list.forEach((item, index) => {
123
+                  let { good_id } = item
124
+                  if (!dataInfo[good_id]) {
125
+                    dataInfo[good_id] = {
126
+                      good_id:item.good_id,
127
+                      child: [],
128
+                      count:0,
129
+                      specification_name:item.specification_name,
130
+                      good_name:item.good_name,
131
+                    }
132
+                  }
133
+                })
134
+                let arr = Object.values(dataInfo)
135
+                
136
+                for(let i=0;i<arr.length;i++){
137
+                   for(let j=0;j<list.length;j++){
138
+                       if(arr[i].good_id == list[j].good_id){
139
+                          arr[i].child.push(list[j])
140
+                       }
141
+                   }
142
+                }
143
+                
144
+                this.tableList = arr
145
+                console.log("arr--------------",arr)
146
+                }
147
+                 var manufacturerList = response.data.data.manufacturerList
148
+                 this.manufacturerList = manufacturerList
149
+
150
+                 this.infoList = response.data.data.infoList
151
+
152
+                 this.outinfo = response.data.data.outinfo
153
+
154
+                 this.flowNoProList = response.data.data.flowNoProList
155
+
156
+                 this.flowProList = response.data.data.flowProList
157
+
158
+                 this.goodInfo = response.data.data.goodInfo
159
+              }
160
+          })
161
+        },
162
+        getManufacturerName(id){
163
+           var manufacturer_name = ""
164
+           for(let i=0;i<this.manufacturerList.length;i++){
165
+             if(id == this.manufacturerList[i].id){
166
+                 manufacturer_name = this.manufacturerList[i].manufacturer_name
167
+             }
168
+           }
169
+           return manufacturer_name
170
+        },
171
+        
172
+        getInCount(good_id){
173
+          
174
+          var newArr =[]
175
+          var total_count =0
176
+          var newArrOne = []
177
+          var total_count_one  = 0
178
+          var total =0
179
+          for(let i=0;i<this.infoList.length;i++){
180
+            if(good_id == this.infoList[i].good_id){
181
+               newArr.push(this.infoList[i])
182
+            }
183
+          }
184
+          if(newArr!=null){
185
+            for(let i=0;i<newArr.length;i++){
186
+                total_count += parseInt(newArr[i].warehousing_count)
187
+            }
188
+          }
189
+
190
+          for(let i=0;i<this.flowProList.length;i++){
191
+            if(good_id == this.flowProList[i].good_id){
192
+               newArrOne.push(this.flowProList[i])
193
+            }
194
+          }
195
+          if(newArrOne!=null){
196
+            for(let i=0;i<newArrOne.length;i++){
197
+               total_count_one += newArrOne[i].count
198
+            }
199
+          }
200
+          total = total_count + total_count_one
201
+          return total
202
+        },
203
+        getOutCount(good_id){
204
+
205
+          var newArr =[]
206
+          var newArrOne = []
207
+          var total_count =0
208
+          var total_count_one  = 0
209
+          var total = 0
210
+          for(let i=0;i<this.outinfo.length;i++){
211
+            if(good_id == this.outinfo[i].good_id){
212
+               newArr.push(this.outinfo[i])
213
+            }
214
+          }
215
+          if(newArr!=null){
216
+            for(let i=0;i<newArr.length;i++){
217
+              total_count += parseInt(newArr[i].count)
218
+            }
219
+          }
220
+
221
+          for(let i=0;i<this.flowNoProList.length;i++){
222
+            if(good_id == this.flowNoProList[i].good_id){
223
+               newArrOne.push(this.flowNoProList[i])
224
+            }
225
+          }
226
+          if(newArrOne!=null){
227
+            for(let i=0;i<newArrOne.length;i++){
228
+               total_count_one += newArrOne[i].count
229
+            }
230
+          }
231
+
232
+
233
+          total = total_count + total_count_one
234
+          return total
235
+        },
236
+        getSumCount(good_id){
237
+          var sum_count = 0
238
+          for(let i=0;i<this.goodInfo.length;i++){
239
+             if(good_id == this.goodInfo[i].id){
240
+                sum_count = this.goodInfo[i].sum_count
241
+             }
242
+          }
243
+          return sum_count
244
+        }
245
+
246
+        
247
+     },
248
+     created(){
249
+        
250
+        this.getlist()
251
+     }
252
+
253
+  } 
254
+</script>
255
+
256
+
257
+<style rel="stylesheet/scss" lang="scss" scoped>
258
+.printTitle{font-size: 22px;text-align: center;}
259
+.flex{display: flex;justify-content: space-between;}
260
+.tableTitle{display: flex;border-top:1px solid #000;border-bottom: 1px solid #000;padding: 10px 0;}
261
+.tableTr{display: flex;border-bottom: 1px dashed #000;padding: 10px 0;}
262
+.tableBottom{display: flex;border-bottom: 1px solid #000;padding: 10px 0;}
263
+.printTable{width:100%;border-collapse: collapse;}
264
+.printTable td{padding:5px;}
265
+.print_head{border: none;display: table-header-group;}
266
+.print_head tr td{text-align: center;border: none;}
267
+.print_body tr td{border:1px solid}
268
+</style>