hospital-create.vue
10.9 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
<!--医院对账单 - 列表-->
<template>
<div class="container resource close-left-menu">
<div class="pop-banner clearfix">
<h3 class="current-module">缺货登记</h3>
</div>
<div class="order-orderlist-view clearfix">
<div class="pd-form form-label4em mb-40 fast-search-form">
<div class="group-row">
<div class="form-group form-label">
<div class="control">
<input type="text" maxlength="17" v-rule v-model="search.billno" title='申领单号' placeholder="申领单号"></div>
</div>
<div class="form-group form-label">
<div class="control">
<input type="text" maxlength="50" v-rule v-model="search.goodsinfo" title='商品名称、编号、厂商、注册证号'
placeholder="商品名称、编号、厂商、注册证号"></div>
</div>
</div>
<div class="group-row">
<div class="form-group form-label">
<!-- <label for="cn1" class="label">结算日期</label> -->
<div class="control control-date" style="height:34px;overflow: inherit;">
<div style="width:44%;float:left;">
<datepicker :target.sync="search.startdate" :readonly="readonlyFlag" placeholder="开始日期" title='开始日期' styleobj="width:100% !important;border-radius:8px 0px 0px 8px !important;"></datepicker>
</div>
<div class="text-and">至</div>
<div style="width:48%;float:left;">
<datepicker :target.sync="search.enddate" :readonly="readonlyFlag" title='结束日期' placeholder="结束日期" styleobj="width:100% !important;border-radius:0px 8px 8px 0px !important;"></datepicker>
</div>
</div>
</div>
<div class="form-group form-label">
<label for="cn4" class="label">科室</label>
<div class="control">
<select v-model="search.deptguid" id='cn4' class="inp2">
<option value="">请选择</option>
<option v-for='item in deptlist' :value="item.value">{{item.label}}</option>
</select>
</div>
</div>
</div>
<div class="group-row t-right">
<button v-on:click="getData(false)" class="fast-search-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle">查 询</button>
</div>
</div>
<div class="m-20-0">
<button class="btn button-green" @click='create'>生成缺货登记</button>
</div>
<table class="itable itable-td-long-text mb-20">
<thead id="t_header">
<tr>
<th class="w60">序号</th>
<th class="w100">申领日期</th>
<th class="w100">单据编号</th>
<th class="w80">申领科室</th>
<!-- <th class="w100">供应商</th> -->
<th class="w80">商品编码</th>
<th class="w100">商品</th>
<th class="w80">单位</th>
<th class="w80">申领数</th>
<th class="w80">库存缺货数</th>
<th class="w80">缺货原因</th>
<th class="w80">采购数量</th>
</tr>
</thead>
<tbody class="txt_v">
<tr v-if="list.length==0">
<td colspan="15" >
暂无符合条件的记录
</td>
</tr>
<tr v-else v-for='item in list'>
<td>
<div class="checkbox-control">
<input type="checkbox" :id="item.guid+item.rowno" v-model='item.checkced'>
<label class="checkbox" :for="item.guid+item.rowno">{{$index+1}}</label>
</div>
</td>
<td>{{item.applydate | getYMD}}</td>
<td class="t-left pr10">{{item.billno}}</td>
<td class="pr10">{{item.meddeptname}}</td>
<!-- <td class="t-left pr10">
<select v-model='item.supplierguid'>
<option v-for='supplier in item.supplierList' :value='supplier.VALUE'>{{supplier.label}}</option>
</select>
</td> -->
<td class='t-left pr10'>{{item.goodscode}}</td>
<td class="t-left pr10">{{item.goodsname}} <br> {{item.goodsspec}} <br>{{item.producer}}</td>
<td>{{item.unit}}</td>
<td>{{item.applyqty}}</td>
<td>{{item.osqty}}</td>
<td>{{item.osmemo}}</td>
<td><input type="text" v-model='item.poqty'></td>
</tr>
</tbody>
</table>
<pagination
@page-change="getData(true)"
:page-no.sync="search.page"
:total-pages.sync="search.totalPages">
</pagination>
</div>
</div>
</template>
<script >
module.exports = {
data: function () {
return {
list:[],
// 明细数据
mxList: [],
// 查询条件
search: {
pageSize: 50,
page: 1,
totalPages: 0,
total: 0,
billno: '',
goodsinfo:'',
billstate:'',
startdate: '',
enddate: '',
deptguid:'',
goodscate:''
},
readonlyFlag:false,
goodscateList: [],
deptlist:[]
};
},
methods: {
// 获取当前时间和之前一个月时间
Date:function(){
var self = this;
// 结束日趋
var nowdate = new Date();
var y = nowdate.getFullYear();
var m = nowdate.getMonth()+1;
m=m<10?'0'+m:m;
var d = nowdate.getDate();
d=d<10?'0'+d:d;
self.search.enddate = y+'-'+m+'-'+d;
// 开始日期
nowdate.setMonth(nowdate.getMonth()-1);
var yn = nowdate.getFullYear();
var mn = nowdate.getMonth()+1;
mn=mn<10?'0'+mn:mn;
var dn= nowdate.getDate();
dn=dn<10?'0'+dn:dn;
self.search.startdate = yn+'-'+mn+'-'+dn;
},
getData: function (falg) {
var self = this;
self.list=[];
if(!falg){
self.search.page=1;
}
Ajax.post('/billType/findApplyByOs', self.search)
.then(function (response){
var res = response.data.data;
if(response.data.errorCode==0){
for(var a=0;a<res.list.length;a++){
res.list[a].checkced = false;
// res.list[a].supplierguid=res.list[a].supplierList[0].VALUE;
}
self.$set('list',res.list);
self.search.totalPages = res.totalPages;
self.search.total = res.total;
}
})
},
// 科室查询
depart:function(state){
var self = this;
self.search.parameter_category=state;
Ajax.get('/util/departmentsInfo',self.search)
.then(function (response){
var data = response.data.data;
if(response.data.errorCode==0){
self.$set('deptlist',response.data.data);
}
})
},
create:function(){
var self = this;
var arr=[];
for(var a=0;a<self.list.length;a++){
if(!!self.list[a].checkced){
if(!self.list[a].poqty || self.list[a].poqty==0){
self.MessageBox({ title: '提示',message:'请填写大于0的采购数量',type: 'alert'});
return;
}else{
for(var i=0;i<self.list[a].supplierList.length;i++){
if(self.list[a].supplierList[i].VALUE==self.list[a].supplierguid){
self.list[a].suppliername=self.list[a].supplierList[i].label;
}
}
arr.push(self.list[a]);
}
}
}
if(arr.length==0){
self.MessageBox({ title: '提示',message:'请至少勾选一条缺货单!',type: 'alert'});
return;
}
Ajax.post('/billType/saveApplyOs',JSON.stringify(arr))
.then(function (response){
var res = response.data.data;
if(response.data.errorCode==0){
self.MessageBox({ title: '提示',message:'保存成功',type: 'alert'},function(){
self.$router.go({ 'path': '/hospitalStockout' });
});
}else{
self.MessageBox({ title: '提示',message:response.data.message,type: 'alert'});
}
})
},
// selectname:function(supplierguid,index){
// var self = this;
// for(let j = 0; j < self.findTptrmedPlanDetailList[i].supplierList.length; j++) {
// if(self.findTptrmedPlanDetailList[i].supplierguid == self.findTptrmedPlanDetailList[i].supplierList[j].VALUE) {
// self.$set("findTptrmedPlanDetailList[" + i + "].priority", self.findTptrmedPlanDetailList[i].supplierList[j].priority);
// }
// }
// }
},
route: {
activate: function () {
this.Date();
this.depart(2);
this.getData(false);
}
},
};
</script>