Inventory-adjustment-request.vue
31.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
<template>
<div>
<div class="container resource close-left-menu">
<div class="pop-banner clearfix">
<div class="operate-btns" v-show="sh">
<upload-excel-plan :class="['fbtn fb-upload']"
:tag="tagType"
:type="fileType"
:label="fileLabel"
:exceltype="med"
v-on:file-change="getBackTips"
></upload-excel-plan>
<a class="fbtn fb-download" @click='downModel'>下载导入文件</a>
</div>
<!-- <span class="view-title"></span> -->
<h3 class="current-module">库存调整</h3>
</div>
<div class="purchase-add-plan">
<div class="fpart pd-form">
<div class="fheader">
<h4 class="fh-shop">库存调整</h4>
<div class="from-button fr">
<a href="javascript:;" class="green-button icon save" @click='save'>保存<i>|</i></a>
<a href="javascript:;" class="blue-button icon delivery" @click='submit'>提交</a>
</div>
</div>
<div class="group-row group-row-2">
<div class="form-group form-label">
<label for="cn1" class="label">单据单号</label>
<div class="control">
<input type="text" id="cn1" v-model="trmedplan.billno" readonly="readonly" class="inp4">
</div>
</div>
<div class="form-group form-label">
<label for="cn3" class="label">执行状态</label>
<div class="control">
<input type="text" id="cn3" :value="trmedplan.billstate | inventory" readonly="readonly" class="inp4">
</div>
</div>
</div>
<div class="group-row group-row-2">
<div class="form-group form-required form-label">
<label for="cn4" class="label">申领日期</label>
<div>
<input type="text" id="cn4" :value="trmedplan.inputdate | getYMD" readonly="readonly" class="inp4">
</div>
</div>
</div>
<div class="group-row">
<div class="form-group form-required form-label">
<label for="cn13" class="label">备注</label>
<div class="control w1003">
<textarea id="cn13" rows="1" v-model="trmedplan.memo" class="inp2"></textarea>
</div>
</div>
</div>
</div>
<table class="itable itable-thead-13px1 itable-td-long-text1">
<thead id="t_header">
<tr>
<th class="w50 th1">序号</th>
<th class="w120 t-left th1">
<div class="p-lr-10">商品信息</div>
</th>
<th class="w70 th1">批号</th>
<th class="w100 th1">生产日期</th>
<th class="w100 th1">有效期</th>
<th class="w60 th1">原数量</th>
<th class="w80 th1">新数量</th>
<th class="w80 th1">批次号</th>
<th class="w100 th1">供应商</th>
<th class="w80 th1">操作</th>
</tr>
</thead>
<tbody>
<tr v-for='(inx,item) in goodList' track-by="$index">
<td class="td1">
<div>{{$index+1}}</div>
</td>
<td class="t-left pr10 td1">
{{item.goodsname}} <br>
{{item.producer}} <br>
{{item.goodscode}} <br>
{{item.goodsspec}} <br>
{{item.unit}}<br>
{{item.registkey}}
</td>
<td class="td1 pr5"><input type="text" v-model="item.lot" style='width:80px; height: 32px;'></td>
<td class="td1 pr5"><datepicker :target.sync="item.productiondate | getYMD" :width="100%" :readonly="readonlyFlag"></datepicker></td>
<td class="td1"><datepicker :target.sync="item.expiredate | getYMD" :width="100%" :readonly="readonlyFlag"></datepicker></td>
<td class="td1">{{!item.oldqty?'0':item.oldqty}}</td>
<td class="td1"><input type="text" v-model="item.newqty" style='width:50px; height: 32px;' @change="medCheckInfo(item.oldqty,item.newqty,$index, 7)"></td>
<td class="td1 pr5 t-left">{{item.stockbatch}}</td>
<td class="t-left pr10 td1">
<div class="form-group">
<!-- <label class="label">供应商</label> -->
<div class="control w180 h-30 fl">
<input id="cn1" type="text" v-if="item.stockguid == null || item.stockguid == ''" v-model="item.suppliername" @input="setTrue(inx,item.suppliername)" title='请输入供应商查询' placeholder='请输入供应商查询'>
<input id="cn1" type="text" v-else readonly="readonly" v-model="item.suppliername" title='请输入供应商查询' placeholder='请输入供应商查询'>
<div class="select-template" id="{{inx}}" style="display:none;">
<div class="div-select before-none" style="width:100%;">
<ul style="z-index:1;top:0px;width:100%; margin-top: 0px;">
<li v-show="getSups.length > 0" class="div-select-item pl10" v-for="sup in getSups">
<span style="width:100%;" @click="chooseSupplier(inx,sup.supplierguid,sup.medsuppliername)">{{sup.medsuppliername}}</span>
</li>
<li class="div-select-item pl10" v-show="getSups.length==0 || getSups == undefined">
<span style="width:100%;">未查询到结果!</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</td>
<td class="td1">
<a href="javascript:;" class="btn button-red" @click='remove($index)'>删除</a>
</td>
</tr>
<tr>
<td class="t-left" colspan="2">
<div class="control h-30 fl" style="width: 220px;">
<input id="cn1" type="text" v-model="goodsname" v-rule maxlength="50" title='请输入商品名称' @click='state=true' placeholder="商品名称、编号、厂商、注册证号">
<div class="select-template" id="searchMore" v-if='state'>
<div class="div-select before-none" style="width:100%;">
<ul style="z-index:1;top:0px;width:400%; margin-top: 0px;">
<li class="div-select-item pl10 hover-none" style='line-height:20px;height:auto;'>
<table class="itable itable-thead-13px1 itable-td-long-text1">
<thead id="t_header">
</thead>
<tbody>
<tr v-for="item in goodsList" @click='goodsData(item)' track-by="$index">
<td class="w50 td1">
<div>{{$index+1}}</div>
</td>
<td class="t-left w80 td1">
{{item.goodsname}}
</td>
<td class="t-left w80 td1 pr5">{{item.producer}}</td>
<td class="t-left pr10 w80 td1 pr5">{{item.goodscode}}</td>
<td class="t-left w80 td1 pr5">{{item.registkey}}</td>
<td class="t-left w80 td1">{{item.goodsspec}} </td>
<td class="t-left w80 td1">{{item.unit}} </td>
<td class="t-left w80 td1">{{item.lot}}<br>{{item.productiondate | getYMD}}<br>{{item.expiredate | getYMD}}</td>
<td class="t-left w80 td1 pr5">{{item.stockbatch}}</td>
<td class="t-left w80 td1 pr5">{{item.suppliername}}</td>
<td class="t-left w80 td1">{{item.oldqty}} </td>
</tr>
</tbody>
</table>
</li>
<li class="div-select-item pl10" v-show="goodsList.length==0 || goodsList == undefined">
<span style="width:100%;">未查询到结果!</span>
</li>
</ul>
</div>
</div>
</div>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<!--star 9-9 弹出导入提示信息-->
<div class="modal" v-if='errorFlag'>
<div class="container resource">
<div class="audit-detail" style="width:540px; margin:100px auto;">
<span class="close-win" v-on:click="errorFlag=false"></span>
<div class="sdiv-9-9b">
<a class="btn-d btn-d-activate btn-d-lg" href="javascript:;">导入信息提示</a>
</div>
<div class="status-process wbe-0 clearfix pd20" style="padding-top:0px;">
<div class="sp-head sp-headb" v-for="m in errorList">
<span class="sp-col w300 ml-0" >
<span class="control radio-control ">
<span>{{m}}</span>
</span>
</span>
</div>
</div>
<div class="sdiv9-9">
<button v-on:click="errorFlag=false" class="btn button-red mr-20">关闭</button>
</div>
</div>
</div>
</div>
<div class="roll-bg" v-show='requestS'>
<div class="w60" style="margin:0 auto;">
<img src="/images/roll.gif">
</div>
<div class="container resource t-center text-color-red">
正在处理中,请勿关闭!
</div>
</div>
</div>
</template>
<script>
module.exports={
data: function(){
return {
requestS:false,
fileType:'file',
tagType:'a',
med:'checkImpl',
fileLabel:'导入外部文件',
search: {
pageSize: 50,
page: 1,
totalPages: 0,
total: 0,
search_EQ_guid: '',
},
search1: {
pageSize: 5,
page: 1,
totalPages: 0,
total: 0,
search_EQ_guid: '',
},
sh:false,
trmedplan:{
billno:'',
billstate:'',
inputdate:'',
memo:'',
},
goodsname:'',
// 查询的商品列表
goodsList:[],
goodList:[],
errorList:[],
state:false,
detaiList:[],
stockguid:[],
errorFlag:false,
goOnSearch:true,
suppliername:'',
};
},
methods: {
setTrue: function(inx,val){
this.goOnSearch=true;
if(val!='' && this.goOnSearch){
this.getManagesup(val);
$("#"+inx).css("display","block");
}else{
$("#"+inx).css("display","none");
}
},
//加载 医院供应商列表数据
getManagesup:function(supname){
var self = this;
Ajax.post('/procurment/getMedSups',{ 'page': self.search1.page,'pageSize': self.search1.pageSize,'totalPages': self.search1.totalPages,'supname': supname})
.then(function(response){
var data=response.data.data;
if (response.data.errorCode == 0) {
self.$set("getSups",data.list);
self.search.pageNo = data.pageNo;
self.search.totalPages = data.totalPages;
}else{
self.MessageBox({title:'提示', message:response.data.message, type: 'alert'},function(action){
});
}
})
},
// 选择供应商
chooseSupplier: function(index,supguid,suppliername) {
var self = this;
self.goOnSearch = false;
$("#"+index).css("display","none");
self.$set("goodList["+ index +"].supplierguid",supguid);
self.$set("goodList["+ index +"].suppliername",suppliername);
},
getIsAllowdImpl: function(){
var self = this;
Ajax.post('/procurment/isAllowdImpl')
.then(function (response){
var data = response.data;
if(data.data == 'Y'){
self.sh =true;
}else{
self.sh =false;
}
})
},
// 下载模版
downModel:function(){
var self = this;
window.open ('/HosStockCheckImpl.xls');
},
getBackTips:function(data){
var self = this;
console.log(data.data.iCheckList);
if(data.errorCode==0){
self.$set('goodList',data.data.iCheckList);
self.errorFlag=true;
self.$set('errorList',data.data.resList);
}else{
self.errorFlag=true;
self.$set('errorList',data.message);
}
},
remove:function(index){
var self = this;
self.goodList.splice(index,1);
},
// 查询的数据结果出来
goodsData:function(data){
var self = this;
var state=false;
// self.suppliername = [];
if(self.goodList==0){
self.goodList.splice(self.goodList.length,1,data);
}else{
for(var a=0;a<self.goodList.length;a++){
if(self.goodList[a].goodsguid+self.goodList[a].lot==data.goodsguid+data.lot){
self.MessageBox({ title:'提示',message:'该商品已存在',type:'alert' });
state=true;
}
}
if(!state){
self.goodList.splice(self.goodList.length,1,data);
}
}
// self.goodList.splice(self.goodList.length,1,data);
// self.goodList.splice(self.goodList.length,1,data);
self.$set('state',false)
self.goodsname='';
self.$set('goodsList',[]);
},
// 商品名称搜索
mednameGet:function(){
var self = this;
if(self.goodsname==''){
return;
}
Ajax.post('/procurment/getStockDetailList',{'goodsname':self.goodsname})
.then(function (response){
var data = response.data.data;
if(response.data.errorCode == 0){
self.$set('goodsList',data)
}else{
self.MessageBox({ title:'提示',message:data.message,type:'alert' })
}
})
},
// 保存
save:function(){
var self = this;
if(!self.trmedplan.memo){
self.MessageBox({
title: '提示',
message:'备注不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
self.detaiList = [];
for (var i = 0; i < self.goodList.length; i++) {
if(self.goodList[i].suppliername == null || self.goodList[i].suppliername == ''){
self.goodList[i].supplierguid ='';
}
if(self.goodList[i].stockguid == null && !self.goodList[i].supplierguid){
self.MessageBox({
title: '提示',
message:'商品名为'+self.goodList[i].goodsname+'的供应商不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
if(self.goodList[i].lot == null || self.goodList[i].lot == ''){
self.MessageBox({
title: '提示',
message:'商品名为'+self.goodList[i].goodsname+'的批号不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
if(self.goodList[i].newqty != 0){
if(self.goodList[i].newqty == null || self.goodList[i].newqty == ''){
self.MessageBox({
title: '提示',
message:'商品名为'+self.goodList[i].goodsname+'的新数量不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
}
// if(self.goodList[i].productiondate == null || self.goodList[i].productiondate == ''){
// self.MessageBox({
// title: '提示',
// message:'商品名为'+self.goodList[i].goodsname+'的生产日期不能为空!',
// type: 'alert'
// }, function(action) {
// });
// return;
// }
if(self.goodList[i].expiredate == null || self.goodList[i].expiredate == ''){
self.MessageBox({
title: '提示',
message:'商品名为'+self.goodList[i].goodsname+'的有效期不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
self.pkguid = self.goodList[0].guid;
var item ={
rowno:self.goodList[i].rowno,
stockguid:self.goodList[i].stockguid,
batchnoguid:self.goodList[i].batchnoguid,
productiondate:self.goodList[i].productiondate,
expiredate:self.goodList[i].expiredate,
newNumber:self.goodList[i].newqty,
oldqty:self.goodList[i].oldqty,
goodsguid:self.goodList[i].goodsguid,
supplierguid:self.goodList[i].supplierguid,
suppliername:self.goodList[i].suppliername,
lot:self.goodList[i].lot
}
self.detaiList.push(item);
}
self.requestS=true;
Ajax.post('/procurment/savaStockCheck', {'pkguid':self.pkguid,'memo':self.trmedplan.memo,'detais':self.detaiList})
.then(function (response){
var res = response.data.data;
if(response.data.errorCode == 0){
self.requestS=false;
self.MessageBox({
title: '提示',
message:'保存成功!',
type: 'alert'
}, function(action) {
self.$route.router.go('/InventoryAdjustmentDetail/'+res);
});
// self.getDataDetail(res);
// self.getData(res);
}else{
self.requestS=false;
self.MessageBox({ title:'提示',message:response.data.message,type:'alert' })
}
})
},
getDataDetail: function(guid){
var self = this;
Ajax.post('/procurment/getStockCheckDetailList',{'guid':guid})
.then(function (response){
var data = response.data.data;
if(response.data.errorCode == 0){
self.$set('goodList',data.list);
}else{
self.MessageBox({ title:'提示',message:data.message,type:'alert' })
}
})
},
getData: function(guid){
var self = this;
Ajax.post('/procurment/getStockCheckList',{'guid':guid})
.then(function (response){
var data = response.data.data;
if(response.data.errorCode == 0){
for (var i = 0; i < data.list.length; i++) {
self.trmedplan.billno = data.list[0].billno;
self.trmedplan.billstate = data.list[0].billstate;
self.trmedplan.inputdate = data.list[0].inputdate;
self.trmedplan.memo = data.list[0].memo;
}
}else{
self.MessageBox({ title:'提示',message:data.message,type:'alert' })
}
})
},
submit:function(){
var self = this;
if(!self.trmedplan.memo){
self.MessageBox({
title: '提示',
message:'备注不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
self.detaiList =[];
for (var i = 0; i < self.goodList.length; i++) {
if(self.goodList[i].stockguid == null && !self.goodList[i].supplierguid){
self.MessageBox({
title: '提示',
message:'商品名为'+self.goodList[i].goodsname+'的供应商不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
if(self.goodList[i].lot == null || self.goodList[i].lot == ''){
self.MessageBox({
title: '提示',
message:'商品名为'+self.goodList[i].goodsname+'的批号不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
if(self.goodList[i].newqty != 0){
if(self.goodList[i].newqty == null || self.goodList[i].newqty == ''){
self.MessageBox({
title: '提示',
message:'商品名为'+self.goodList[i].goodsname+'的新数量不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
}
// if(self.goodList[i].productiondate == null || self.goodList[i].productiondate == ''){
// self.MessageBox({
// title: '提示',
// message:'商品名为'+self.goodList[i].goodsname+'的生产日期不能为空!',
// type: 'alert'
// }, function(action) {
// });
// return;
// }
if(self.goodList[i].expiredate == null || self.goodList[i].expiredate == ''){
self.MessageBox({
title: '提示',
message:'商品名为'+self.goodList[i].goodsname+'的有效期不能为空!',
type: 'alert'
}, function(action) {
});
return;
}
self.pkguid = self.goodList[0].guid;
var item ={
rowno:self.goodList[i].rowno,
stockguid:self.goodList[i].stockguid,
batchnoguid:self.goodList[i].batchnoguid,
productiondate:self.goodList[i].productiondate,
expiredate:self.goodList[i].expiredate,
newNumber:self.goodList[i].newqty,
oldqty:self.goodList[i].oldqty,
goodsguid:self.goodList[i].goodsguid,
supplierguid:self.goodList[i].supplierguid,
suppliername:self.goodList[i].suppliername,
lot:self.goodList[i].lot
}
self.detaiList.push(item);
}
self.requestS=true;
Ajax.post('/procurment/savaStockCheck', {'pkguid':self.pkguid,'memo':self.trmedplan.memo,'detais':self.detaiList})
.then(function (response){
var res = response.data.data;
if(response.data.errorCode == 0){
self.requestS=false;
self.submitOs(res);
}else{
self.requestS=false;
self.MessageBox({ title:'提示',message:response.data.message,type:'alert' })
}
})
},
submitOs:function(res){
var self = this;
Ajax.post('/procurment/submit', {'guid':res})
.then(function (response){
var res = response.data.data;
if(response.data.errorCode == 0){
self.MessageBox({
title: '提示',
message:'提交成功!',
type: 'alert'
}, function(action) {
//跳转
self.$router.go({
path: '/inventoryAdjustment'
});
});
}else{
self.MessageBox({ title:'提示',message:response.data.message,type:'alert' })
}
})
},
// 验证系数
medCheckInfo: function(po1,po, index, code) {
var self = this;
if(po < 0 || po == po1 || isNaN(po) || !/^\d+$/.test(po)) {
self.MessageBox({
title: '警告',
message: "请输入大于0不等于原数量的正整数!",
type: 'alert'
}, function(action) {
if(action == 'confirm') {
if(code == 7) {
self.$set('goodList[' + index + '].newqty', '');
} else {
self.$set('goodList[' + index + '].newqty', '');
}
}
});
}
},
},
route:{
activate : function(){
var self = this;
// this.getData();
self.trmedplan={
billno:'',
billstate:'',
inputdate:'',
memo:'',
};
self.goodList =[];
self.getIsAllowdImpl();
}
},
watch:{
'goodsname':function(){
var self = this;
self.mednameGet();
},
// 'item.suppliername': function(val){
// }
}
};
</script>