Procházet zdrojové kódy

11月14日 库存扣减更新

XMLWAN před 3 roky
rodič
revize
0c3f7636ec

+ 484 - 0
src/xt_pages/supply/components/addPurchaseOrder.vue Zobrazit soubor

@@ -0,0 +1,484 @@
1
+<template>
2
+<div class="main-contain">
3
+<div class="position">
4
+    <bread-crumb :crumbs="crumbs"></bread-crumb>
5
+</div>
6
+<div class="app-container ">
7
+    <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
8
+    <div>
9
+        <el-select v-model="supplier_name" style="width:140px;margin-right:10px;" placeholder="请选择"
10
+        @change="changeTypeName">
11
+        <el-option
12
+            v-for="item in supplyList"
13
+            :key="item.id"
14
+            :label="item.supplier_name"
15
+            :value="item.id">
16
+        </el-option>
17
+        </el-select>
18
+        <el-date-picker
19
+        size="small"
20
+        v-model="start_time"
21
+        prefix-icon="el-icon-date"
22
+        :editable="false"
23
+        style="width: 196px;"
24
+        type="date"
25
+        placeholder="选择日期时间"
26
+        align="right"
27
+        format="yyyy-MM-dd"
28
+        value-format="yyyy-MM-dd"
29
+        @change="startTimeChange"
30
+        ></el-date-picker>-
31
+        <el-date-picker
32
+            size="small"
33
+            v-model="end_time"
34
+            prefix-icon="el-icon-date"
35
+            :editable="false"
36
+            style="width: 196px;"
37
+            type="date"
38
+            placeholder="选择日期时间"
39
+            align="right"
40
+            format="yyyy-MM-dd"
41
+            value-format="yyyy-MM-dd"
42
+            @change="endTimeChange"
43
+        ></el-date-picker>
44
+        <el-input
45
+        size="small"
46
+        style="width: 200px;margin-left:10px;"
47
+        class="filter-item"
48
+        v-model.trim="keywords"
49
+        placeholder="耗材名称"
50
+        />
51
+        <el-button
52
+        size="small"
53
+        class="filter-item"
54
+        type="primary"
55
+        icon="el-icon-search"
56
+        @click="search"
57
+        >搜索</el-button
58
+        >
59
+    </div>
60
+    <div>
61
+        <el-button size="small" type="primary" @click="savePurchaseOrder">保存</el-button>
62
+    </div>
63
+    </div>
64
+
65
+
66
+    <el-table
67
+    :row-style="{ color: '#303133' }"
68
+    :header-cell-style="{
69
+        backgroundColor: 'rgb(245, 247, 250)',
70
+        color: '#606266'
71
+    }"
72
+    :data="tableList"
73
+    :class="signAndWeighBoxPatients"
74
+    border
75
+    style="width: 100%"
76
+    max-height="450"
77
+    >
78
+    <el-table-column label="商品" align="center" width="200px">
79
+        <template slot-scope="scope">
80
+            <el-select v-model="scope.row.name" style="width:160px;" filterable placeholder="请选择" @change="changeName"   @input="changeGoodName(scope.$index)">
81
+            <el-option
82
+                v-for="(item,index) in tabList"
83
+                :key="index"
84
+                :label="item.supply_name"
85
+                :value="item">
86
+            </el-option>
87
+            </el-select>
88
+        </template>
89
+    </el-table-column>
90
+    <el-table-column label="商品类别" align="center" width="150px">
91
+        <template slot-scope="scope">
92
+            <el-input v-model="scope.row.supply_type" style="width:120px" :disabled="true"></el-input>
93
+        </template>
94
+    </el-table-column>
95
+    <el-table-column label="规格&单位" align="center" width="200px">
96
+        <template slot-scope="scope">
97
+            <el-input v-model="scope.row.supply_specification_name" style="width:150px" :disabled="true"></el-input>
98
+        </template>
99
+        </el-table-column>
100
+    <el-table-column label="可用库存" align="center" width="130px">
101
+        <template slot-scope="scope">
102
+            <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
103
+        </template>
104
+    </el-table-column>
105
+    <el-table-column label="数量" align="center" width="120px">
106
+        <template slot-scope="scope">
107
+        <el-input v-model="scope.row.supply_count" style="width:80px"></el-input>
108
+        </template>
109
+    </el-table-column>
110
+
111
+    <el-table-column label="购货单价" align="center" width="120px">
112
+        <template slot-scope="scope">
113
+        <el-input v-model="scope.row.supply_price" style="width:80px"></el-input>
114
+        </template>
115
+    </el-table-column>
116
+
117
+    <el-table-column label="购货金额" align="center" width="120px">
118
+        <template slot-scope="scope">
119
+          {{calculate(scope.row.supply_count * scope.row.supply_price)}}
120
+        </template>
121
+    </el-table-column>
122
+    
123
+    <el-table-column label="生产厂商" align="center" width="200px">
124
+        <template slot-scope="scope">
125
+        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
126
+        </template>
127
+    </el-table-column>
128
+    
129
+
130
+    <el-table-column label="批准文号" align="center" width="200px">
131
+        <template slot-scope="scope">
132
+        <el-input v-model="scope.row.supply_license_number" style="width:160px"></el-input>
133
+        </template>
134
+    </el-table-column>
135
+
136
+    <el-table-column label="备注" align="center" width="200px">
137
+        <template slot-scope="scope">
138
+        <el-input v-model="scope.row.supply_remake" style="width:160px"></el-input>
139
+        </template>
140
+    </el-table-column>
141
+
142
+    <el-table-column label="操作" align="center" width="150px" fixed="right" >
143
+        <template slot-scope="scope">
144
+        <el-tooltip class="item" effect="dark" content="新增" placement="top" >
145
+            <el-button
146
+                size="mini"
147
+                type="primary"
148
+                icon="el-icon-circle-plus-outline"
149
+                @click="handleEdit(scope.$index, scope.row)">
150
+            </el-button>
151
+       </el-tooltip>
152
+       <el-tooltip class="item" effect="dark" content="删除" placement="top">
153
+            <el-button
154
+                size="mini"
155
+                type="danger"
156
+                icon="el-icon-delete"
157
+                @click="handleDelete(scope.$index, scope.row)">
158
+            </el-button>
159
+        </el-tooltip>
160
+
161
+        </template>
162
+    </el-table-column>
163
+  </el-table>
164
+    
165
+</div>
166
+</div>
167
+</template>
168
+
169
+<script>
170
+import BreadCrumb from "@/xt_pages/components/bread-crumb";
171
+
172
+import {getInitOrder} from "@/api/supply"
173
+export default {
174
+name: "addPurchaseOrder",
175
+created() {
176
+this.org_id =  this.$store.getters.xt_user.org_id
177
+
178
+var start_time =  window.sessionStorage.getItem('start_time')
179
+var end_time =  window.sessionStorage.getItem('end_time')
180
+
181
+if(start_time !=null){
182
+    this.start_time = start_time
183
+}
184
+if(end_time!=null){
185
+    this.end_time = end_time
186
+}
187
+window.sessionStorage.removeItem('start_time')
188
+window.sessionStorage.removeItem('end_time')
189
+},
190
+components: {
191
+BreadCrumb
192
+},
193
+data() {
194
+return {
195
+    crumbs: [
196
+    { path: false, name: "购货订单" },
197
+    { path: "/spply/query", name: "新增购货订单" }
198
+    ],
199
+    keywords: "",
200
+    total: 0,
201
+    multipleSelection: [],
202
+    signAndWeighBoxPatients: "sign-and-weigh-box-patients",
203
+    start_time: "",
204
+    end_time: "",
205
+    page: 1,
206
+    limit: 10,
207
+    goodType: [],
208
+    goodInfo: [],
209
+    org_id:0,
210
+    types:[],
211
+    tableList:[],
212
+    tyep_name:"",
213
+    form:{
214
+    manufacturer_id:"",
215
+    },
216
+    tabList:[],
217
+    manufactuerList:[],
218
+    currentIndex: 0,
219
+    goodTypeList:[],
220
+    drugTypeList:[],
221
+    supplier_name:"",
222
+    supplyList:[],
223
+};
224
+},
225
+methods:{
226
+getInitOrder(){
227
+    getInitOrder().then(response=>{
228
+    if(response.data.state == 1){
229
+        var drugList = response.data.data.drugList
230
+        this.manufactuerList = response.data.data.manufactuerList
231
+        this.goodTypeList = response.data.data.goodTypeList
232
+        this.drugTypeList = response.data.data.drugTypeList
233
+        this.supplyList = response.data.data.supplyList
234
+       for(let i=0;i<drugList.length;i++){
235
+          for(let z=0;z<drugList[i].drug_warehouse_info.length;z++){
236
+            drugList[i].drug_warehouse_info[z].stock_max_number = drugList[i].drug_warehouse_info[z].stock_max_number * drugList[i].min_number
237
+          }   
238
+        for(let j=0;j<this.manufactuerList.length;j++){
239
+            if(drugList[i].manufacturer == this.manufactuerList[j].id){
240
+                drugList[i].manufacturer = this.manufactuerList[j].manufacturer_name
241
+            }
242
+        }  
243
+        for(let y=0;y<this.drugTypeList.length;y++){
244
+            if(drugList[i].drug_type == this.drugTypeList[y].value){
245
+            drugList[i].drug_type = this.drugTypeList[y].name
246
+            }
247
+        }
248
+        drugList[i].supply_name =  drugList[i].drug_name + " " + drugList[i].dose +drugList[i].dose_unit+"*"+drugList[i].min_number+ drugList[i].min_unit+"/"+drugList[i].max_unit + " " + drugList[i].manufacturer
249
+        drugList[i].supply_type = drugList[i].drug_type
250
+        drugList[i].supply_specification_name = drugList[i].dose +drugList[i].dose_unit+"*"+drugList[i].min_number+ drugList[i].min_unit+"/"+drugList[i].max_unit
251
+        drugList[i].supply_total = this.getWarehoseInfo(drugList[i].drug_warehouse_info,drugList[i].max_unit,drugList[i].min_unit,drugList[i].min_number)
252
+        drugList[i].supply_count = ""
253
+        drugList[i].supply_total_price = ""
254
+        drugList[i].supply_manufacturer=  drugList[i].manufacturer
255
+        drugList[i].supply_license_number= drugList[i].number
256
+        drugList[i].supply_remake = ""
257
+        drugList[i].type = 1
258
+        drugList[i].supply_price = ""
259
+        drugList[i].name = drugList[i].drug_name
260
+
261
+        this.tabList.push(drugList[i])
262
+        }
263
+        
264
+        var goodList =  response.data.data.goodList
265
+        for(let i=0;i<goodList.length;i++){
266
+        for(let j=0;j<this.manufactuerList.length;j++){
267
+            if(goodList[i].manufacturer == this.manufactuerList[j].id){
268
+                goodList[i].manufacturer = this.manufactuerList[j].manufacturer_name
269
+            }
270
+        }   
271
+        for(let y=0;y<this.goodTypeList.length;y++){
272
+            if(goodList[i].good_type_id == this.goodTypeList[y].id){
273
+                goodList[i].good_type_id = this.goodTypeList[y].type_name
274
+            }
275
+        } 
276
+        goodList[i].supply_name = goodList[i].good_name + " " + goodList[i].specification_name + " " +goodList[i].manufacturer
277
+        goodList[i].supply_type = goodList[i].good_type_id
278
+        goodList[i].supply_specification_name =goodList[i].specification_name
279
+        goodList[i].supply_price = ""
280
+        goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info)
281
+        goodList[i].supply_count = ""
282
+        goodList[i].supply_total_price = ""
283
+        goodList[i].supply_manufacturer = goodList[i].manufacturer
284
+        goodList[i].supply_license_number = ""
285
+        goodList[i].supply_remake = ""
286
+        goodList[i].type = 2   
287
+        goodList[i].name = goodList[i].good_name
288
+
289
+        this.tabList.push(goodList[i]) 
290
+        }
291
+    }
292
+    })  
293
+},
294
+changeGoodName(val){
295
+    console.log("9媚23323232",val)  
296
+    this.currentIndex = val
297
+},
298
+changeName(val){
299
+    console.log("val23322323",val)
300
+    
301
+    for(let i=0;i<this.tableList.length;i++){
302
+    if(this.currentIndex == i){
303
+        this.tableList[i].id = val.id
304
+        this.tableList[i].type = val.type
305
+        this.tableList[i].name = val.name
306
+        this.tableList[i].supply_name = val.supply_name
307
+        this.tableList[i].supply_type = val.supply_type
308
+        this.tableList[i].supply_specification_name = val.supply_specification_name
309
+        this.tableList[i].supply_total = val.supply_total
310
+        this.tableList[i].supply_count = val.supply_count
311
+        this.tableList[i].supply_price = val.supply_price
312
+        this.tableList[i].supply_total_price = val.supply_total_price
313
+        this.tableList[i].supply_manufacturer = val.supply_manufacturer
314
+        this.tableList[i].supply_license_number = val.supply_license_number
315
+        this.tableList[i].supply_remake = val.supply_remake
316
+    }
317
+    }
318
+    console.log("表哥332322332232323",this.tableList)
319
+},
320
+handleEdit(){
321
+    const tempObj = {}
322
+    tempObj["id"] = ""
323
+    tempObj["name"] = ""
324
+    tempObj['supply_name'] = ""
325
+    tempObj['supply_type'] = ""
326
+    tempObj['supply_specification_name'] = ''
327
+    tempObj['supply_total'] = ''
328
+    tempObj['supply_count'] = ''
329
+    tempObj['supply_price'] = ''
330
+    tempObj['supply_total_price'] = ''
331
+    tempObj['supply_manufacturer'] = ''
332
+    tempObj['supply_license_number'] = ''
333
+    tempObj['supply_remake'] = ''
334
+    tempObj['type'] = 0
335
+    this.tableList.push(tempObj)  
336
+},
337
+handleDelete: function(index, row) {
338
+  if (this.tableList.length <= 1) {
339
+        this.$message.error('只有一条记录的时候无法删除')
340
+        return
341
+   } else {
342
+        this.tableList.splice(index, 1)
343
+   }
344
+},
345
+savePurchaseOrder(){
346
+    console.log("param323322332",this.tableList)
347
+    savePurchaseOrder().then(response=>{
348
+
349
+    })  
350
+},
351
+
352
+changeTypeName(){
353
+
354
+},
355
+startTimeChange(){
356
+
357
+},
358
+endTimeChange(){
359
+
360
+},
361
+search(){
362
+    
363
+},
364
+
365
+getWarehoseInfo(arr,max_unit,min_unit,min_number){
366
+    var total = 0
367
+    var max_str=  ""
368
+    var min_str = ""
369
+    if (arr.length > 0) {
370
+      for(let i=0;i<arr.length;i++){
371
+        total += parseInt(arr[i].stock_max_number)
372
+      }
373
+    }
374
+    if (total < min_number){
375
+        min_str = total + min_unit
376
+    }
377
+    if (total == 0) {
378
+        min_str = ""
379
+        max_str = ""
380
+    }
381
+   if (total >=min_number) {
382
+    if(parseInt(total/min_number)!=0){
383
+        max_str = parseInt(total/min_number) + max_unit
384
+    }
385
+    if(total%min_number!=0){
386
+       min_str = total%min_number + min_unit
387
+    }
388
+  }
389
+ return max_str + min_str
390
+ }, 
391
+getTotalStockCount(arr){
392
+  var total_count = 0
393
+  for(let i=0;i<arr.length;i++){
394
+    total_count += arr[i].stock_count
395
+  }
396
+  return total_count
397
+},
398
+calculate: function(val) {
399
+    if (isNaN(val)) {
400
+        return "";
401
+    }
402
+    if (val == 0) {
403
+        return "";
404
+    }
405
+    return Math.round(parseFloat(val) * 100) / 100;
406
+  },
407
+},
408
+created(){
409
+    const tempObj = {}
410
+    tempObj["id"] = ""
411
+    tempObj["name"] = ""
412
+    tempObj['supply_name'] = ""
413
+    tempObj['supply_type'] = ""
414
+    tempObj['supply_specification_name'] = ''
415
+    tempObj['supply_total'] = ''
416
+    tempObj['supply_count'] = ''
417
+    tempObj['supply_price'] = ''
418
+    tempObj['supply_total_price'] = ''
419
+    tempObj['supply_manufacturer'] = ''
420
+    tempObj['supply_license_number'] = ''
421
+    tempObj['supply_remake'] = ''
422
+    tempObj['type'] = 0
423
+    this.tableList.push(tempObj)  
424
+    this.getInitOrder()  
425
+}
426
+};
427
+</script>
428
+
429
+<style rel="stylesheet/css" lang="scss" scoped>
430
+.information {
431
+border: 1px #dcdfe6 solid;
432
+padding: 30px 20px 30px 20px;
433
+
434
+.border {
435
+border-bottom: 1px #dcdfe6 solid;
436
+margin: 0px 0 20px 0;
437
+}
438
+}
439
+
440
+.title {
441
+background: #409eff;
442
+height: 44px;
443
+line-height: 44px;
444
+padding: 0 0 0 10px;
445
+color: #fff;
446
+margin: 0 0 10px 0;
447
+}
448
+
449
+.edit_separater {
450
+border-top: 1px solid rgb(233, 233, 233);
451
+margin-top: 15px;
452
+margin-bottom: 15px;
453
+}
454
+</style>
455
+
456
+<style>
457
+.sign-and-weigh-box .sign-and-weigh-box-patients .cell {
458
+font-size: 12px;
459
+}
460
+
461
+.sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
462
+background: #6fb5fa;
463
+}
464
+
465
+.count {
466
+color: #bd2c00;
467
+}
468
+.el-table td,
469
+.el-table th.is-leaf,
470
+.el-table--border,
471
+.el-table--group {
472
+border-color: #d0d3da;
473
+}
474
+.el-table--border::after,
475
+.el-table--group::after,
476
+.el-table::before {
477
+background-color: #d0d3da;
478
+}
479
+.el-table__fixed-right{
480
+  width:150px;
481
+  bottom: 20px; 
482
+  height: 200px; 
483
+}
484
+</style>

+ 32 - 0
src/xt_pages/supply/components/addSupply.vue Zobrazit soubor

@@ -0,0 +1,32 @@
1
+<template>
2
+    <el-dialog
3
+    title="提示"
4
+    :visible.sync="dialogVisible"
5
+    width="30%"
6
+    :before-close="handleClose">
7
+    <span>这是一段信息</span>
8
+    <span slot="footer" class="dialog-footer">
9
+        <el-button @click="dialogVisible = false">取 消</el-button>
10
+        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
11
+    </span>
12
+    </el-dialog>
13
+</template>
14
+
15
+<script>
16
+export default {
17
+    
18
+    data(){
19
+        return{
20
+           dialogVisible:false, 
21
+        }
22
+    },
23
+    methods:{
24
+      show(){
25
+        this.dialogVisible = true  
26
+      }
27
+    },
28
+    created(){
29
+
30
+    }
31
+}
32
+</script>

+ 0 - 0
src/xt_pages/supply/components/editSupply.vue Zobrazit soubor