match-goodH.vue
15.3 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
<template>
<div class="container resource close-left-menu">
<div class="pop-banner clearfix">
<div class="operate-btns">
</div>
<h3 class="current-module">医院商品对码</h3>
</div>
<ul class="nav-code mb-20 pl0" style="margin-top: -25px;">
<li class="code1" @click="search.mark='N'" :class="search.mark=='N'?'active':''"> 未对码</li>
<li class="code2" @click="search.mark='Y'" :class="search.mark=='Y'?'active':''"> 已对码</li>
</ul>
<div class="fast-search-form pd-form code-form">
<div class="group-row">
<div class="dis-inline ">
<div style="position: relative">
<input type="text" v-model="search.medname" :disabled="disabled" placeholder='医院名称'
class="inp4" @focus='clickHint' @blur="closeHintsBox">
<div class="hintsbox" v-if="showHints">
<ul class="hintslist">
<li v-for="(index,item) in getDistributions" ref="hint" class="hint"
@click="fillInput(item)"><span class="dis-inline" style="max-width: 190px"> {{item.name}}</span>
<span class="dis-inline fr"
v-if="search.mark=='N'">【{{item.wdmgods}}】</span>
</li>
</ul>
</div>
</div>
</div>
<div class="dis-inline">
<div class="control">
<input type="text" value="" id="in3" placeholder='商品名称,规格,生产厂商,注册证号'
v-model="search.goodsname">
</div>
</div>
<div class="dis-inline " style="width: 200px!important;">
<div class="control">
<select v-model="search.goodscate">
<option value="">---请选择商品大类---</option>
<option v-for="item in ctns.goodscate" :value="item.value">{{ item.label }}</option>
</select>
</div>
</div>
</div>
<div class="group-row" style="float:right;height: 28px;">
<button class="fast-search-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle"
@click="getfmedgoodsFn(true)">
查 询
</button>
</div>
<table class="itable itable-thead-13px codebox">
<thead>
<tr>
<th class="w50">序号</th>
<th class="w100">商品编码</th>
<th class="w150">商品名称</th>
<th class="w40">商品规格</th>
<th class="w150">生产厂商</th>
<th class="w70">注册证号/批准文号</th>
<th class="w50">包装单位</th>
<th class="w50">商品大类</th>
<th v-if="search.mark=='Y'" class="w100">操作</th>
</tr>
</thead>
<tbody>
<tr v-if="getmfmedgoods.length==0">
<td colspan="11">暂无数据!</td>
</tr>
<tr v-for="sup in getmfmedgoods">
<td>
<div class="control radio-control">
<input type="radio" :id="sup.guid" name="radio1"
v-model="checkGuid" value="{{sup.guid}}"
style="opacity: 0;"
v-on:click="getSupDoods(sup)">
<label class="radio mr-0" :for="sup.guid">
{{ $index + 1 }}
</label>
</div>
</td>
<td class=" pl10 pr10">{{sup.goodscode}}</td>
<td class="t-left pl10 pr10">{{sup.goodsname}}</td>
<td>{{sup.goodsspec}}</td>
<td>{{sup.producer}}</td>
<td>{{sup.registkey}}</td>
<td>{{sup.minunitstyle}}</td>
<td>{{sup.goodscate|GOODSCATE}}</td>
<td v-if="search.mark=='Y'">
<a href="javascript:;" class="btn button-green"
v-on:click="cancelMatched(sup.guid)">取消配对</a>
</td>
</tr>
</tbody>
</table>
<div style="padding: 10px 0;">
<em class="page pb10 " style="color: #606f7a;position: absolute;">明细条目数【{{ search.total }}】</em>
<pagination @page-change="getfmedgoodsFn()" :page-no.sync="search.page"
:total-pages.sync="search.totalPages" style="margin: 0">
</pagination>
</div>
</div>
<div class="fheader mb-0" style="height: auto;margin-top: -30px">
<h4 class="fh-good">主数据商品</h4>
</div>
<table class="itable itable-thead-13px codebox">
<thead>
<tr>
<th v-if="search.mark=='N'" class="w30"></th>
<th class="w80">商品编码</th>
<th class="w100">商品名称</th>
<th class="w30">商品规格</th>
<th class="w80">生产厂商</th>
<th class="w50">注册证号/批准文号</th>
<th class="w30">包装单位</th>
<!--<th class="w50">商品大类</th>-->
</tr>
</thead>
<tbody v-if="search.mark=='N'">
<tr v-if="getDMResultList.length==0">
<td colspan="11">暂无数据!</td>
</tr>
<tr v-for="supGoods in getDMResultList">
<td>
<a href="javascript:;" class="btn button-green"
v-on:click="clickMatch(supGoods.guid)">配对</a>
</td>
<td>
{{{ supGoods.goodsCode }}}
</td>
<td class="pl10 t-left pr10">
{{{ supGoods.goodsName}}}
</td>
<td>
{{{ supGoods.goodsSpec }}}
</td>
<td>
{{{supGoods.producer}}}
</td>
<td class="t-left pr5">
{{{supGoods.registKey}}}
</td>
<td>
{{{supGoods.minUnitStyle}}}
</td>
<!--<td>-->
<!--{{{supGoods.goodscate|GOODSCATE}}}-->
<!--</td>-->
</tr>
</tbody>
<tbody v-else>
<tr v-if="getDMResultList.length==0">
<td colspan="11">暂无数据!</td>
</tr>
<tr v-for="suplist in getDMResultList">
<td>{{suplist.goodscode}}</td>
<td class="t-left pr10 pl10">{{suplist.goodsname}}</td>
<td>{{suplist.goodsspec}}</td>
<td>{{suplist.producer}}</td>
<td>{{suplist.registkey}}</td>
<td>{{suplist.minunitstyle}}</td>
</tr>
</tbody>
</table>
</div>
</template>
<script>
module.exports = {
data: function () {
return {
getDistributions: [], //医院
showHints: false,
search: {
pageSize: 5,
page: 1,
total: 0,
totalPages: 0,
goodsname: '',
medguid: '',
medname: '',
mark: 'N',
goodscate: '',
},
getmfmedgoods: [], //医院商品数据
getDMResultList: [], //主数据对码商品明细
checkGuid: '',
};
},
watch: {
'search.mark': function () {
if (this.search.medname) {
this.getfmedgoodsFn(true);
}
this.getmfmedgoods = [];
this.getDMResultList = [];
this.checkGuid = '';
},
'search.medname': function (val, oldVal) {
this.search.medguid = '';
this.search.page = 1;
this.search.total = 0;
this.search.totalPages = 0;
this.search.goodscate = '';
this.search.goodsname = '';
this.getmfmedgoods = [];
this.showHints = true;
this.getManagemeds();
this.getDMResultList = [];
},
'search.goodscate': function () {
if (this.search.medguid) {
this.getfmedgoodsFn(true);
}
}
},
methods: {
clickHint: function () {
if (this.search.medname.length == 0) {
this.showHints = true;
this.getManagemeds();
}
},
//加载医院下拉框
getManagemeds: function () {
var self = this;
Ajax.post('/dataadmin/getmfmedforoperator', {
mark: self.search.mark,
name: self.search.medname,
}).then(function (response) {
var data = response.data.data;
self.$set("getDistributions", data);
})
},
//关闭候选框
closeHintsBox: function () {
var self = this;
setTimeout(function () {
self.showHints = false;
}, 500)
},
// 点击候选框
fillInput: function (item) {
this.search.medname = item.name;
this.closeHintsBox();
var self = this
setTimeout(function () {
self.search.medguid = item.guid;
self.getfmedgoodsFn(true);
}, 500)
},
//医院商品 加载数据
getfmedgoodsFn: function (val) {
var self = this;
if (val) {
self.search.page = 1;
}
if (!self.search.medguid) {
layer.msg('请选择医院');
return;
}
Ajax.post('/dataadmin/getmfmedgoods', self.search)
.then(function (response) {
var data = response.data.data;
self.$set("getmfmedgoods", data.list);
self.search.totalPages = data.totalPages;
self.search.total = data.total;
})
},
//医院供应商配对 x
getSupDoods: function (sup) {
console.log(this.search.mark)
if (this.search.mark == "N") {
this.getmedmasterdata(sup);
} else {
this.getmfmsdgoodsbyguid(sup.masterguid);
}
},
//对码商品列表 x
getmedmasterdata: function (sup) {
var self = this;
var param = {
bigUintQty: sup.bigunitqty,
bigUintStyle: sup.bigunitstyle,
from: 0,
goodScode: sup.goodscode,
goodsName: sup.goodsname,
goodsSpec: sup.goodsspec,
minUnitQty: sup.minunitqty,
minUnitStyle: sup.minunitstyle,
producer: sup.producer,
registKey: sup.registkey,
medguid: self.search.medguid
}
Ajax.post('/dataadmin/getmedmasterdata', param)
.then(function (response) {
var data = response.data.data;
self.$set("getDMResultList", data);
})
},
// 主数据对码
clickMatch: function (goodsguid) {
var self = this;
self.MessageBox({
title: '提示',
message: '请确定是否对码',
type: 'success',
showCancelButton: true
}, function (action) {
if (action == 'confirm') {
Ajax.post('/dataadmin/getmfmedgoodsdm', {
masterguid: goodsguid,
guid: self.checkGuid,
})
.then(function (response) {
var data = response.data.data;
if (response.data.errorCode == 0) {
layer.msg(response.data.message);
self.$set("getDMResultList", []);
self.getfmedgoodsFn();
} else {
layer.msg(response.data.message);
// self.MessageBox({
// title: '提示',
// message: response.data.message,
// type: 'alert'
// }, function (action) {
// });
}
})
}
})
},
//主数据商品 已对码商品信息
getmfmsdgoodsbyguid: function (goodsguid) {
var self = this;
Ajax.post('/dataadmin/getmfmsdgoodsbyguid', {
'goodsguid': goodsguid,
})
.then(function (response) {
var data = response.data.data;
self.$set("getDMResultList", data);
})
},
//取消配对
cancelMatched: function (guid) {
var self = this;
Ajax.post('/dataadmin/opeabrogatedm', {
'guid': guid,
})
.then(function (response) {
var data = response.data.data;
if (response.data.errorCode == 0) {
layer.msg(response.data.message);
self.$set("getDMResultList", []);
self.getfmedgoodsFn();
} else {
layer.msg(response.data.message);
}
})
},
},
route: {
activate: function () {
this.search.medname = '';
this.search.guid = '';
this.getmfmedgoods = [];
this.getDMResultList = [];
this.checkGuid = '';
this.getManagemeds();
}
}
};
</script>