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
<template>
<div>
<a-spin tip="加载中..." :spinning="spinning">
<a-card>
<div style="font-size: 18px;font-weight: 600">
<span>叶酸发放登记</span>
</div>
<a-form-model ref="formRef" :model="formData" :rules="formRules" :labelCol="{span: 6}"
:wrapperCol="{span: 16}">
<div style="margin: 30px 0px">
<div class="divider_my"><span class="midText">居民信息</span></div>
</div>
<div style="clear: both"></div>
<a-card size="small" :headStyle="{background: '#FAFAFA'}">
<div slot="title">
<img class="title_img" src="../../../../../static/images/user_info_index.png">
<span class="title_font">女方信息</span>
</div>
<a-button slot="extra">身份证识别</a-button>
<a-row :gutter="16">
<a-col :span="12">
<a-form-model-item label="姓名" prop="sendContact">
<a-input placeholder="请输入姓名" v-model="formData.sendContact"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="证件类型" prop="sendPhone">
<a-select v-model="formData.receiveUnitId" placeholder="请选择"
@click.native="getChildUnitList">
<a-select-option v-for="item in childUnitList"
:key="item.id" :value="item.id"
>
{{item.unitName}}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="证件号码" prop="sendDate">
<a-input placeholder="请输入证件号码" v-model="formData.sendContact"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="是否曾经怀孕" prop="receiveUnitId">
<a-radio-group v-model="formData.sendContact" @change="onChangePregnant">
<a-radio :value="1">
否
</a-radio>
<a-radio :value="2">
是
</a-radio>
</a-radio-group>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="孕次" prop="sendContact" v-if="womanPregnant">
<a-input v-toInt placeholder="请输入" v-model="formData.sendContact"></a-input>
</a-form-model-item>
</a-col>
</a-row>
</a-card>
<a-card size="small" :headStyle="{background: '#FAFAFA'}" style="margin-top: 16px">
<div slot="title">
<img class="title_img" src="../../../../../static/images/user_info_index.png">
<span class="title_font">男方信息</span>
</div>
<a-button slot="extra">身份证识别</a-button>
<a-row :gutter="16">
<a-col :span="12">
<a-form-model-item label="姓名" prop="sendContact">
<a-input placeholder="请输入姓名" v-model="formData.sendContact"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="证件类型" prop="sendPhone">
<a-select v-model="formData.receiveUnitId" placeholder="请选择"
@click.native="getChildUnitList">
<a-select-option v-for="item in childUnitList"
:key="item.id" :value="item.id"
>
{{item.unitName}}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="证件号码" prop="sendDate">
<a-input placeholder="请输入证件号码" v-model="formData.sendContact"></a-input>
</a-form-model-item>
</a-col>
</a-row>
</a-card>
<a-card size="small" :headStyle="{background: '#FAFAFA'}" style="margin-top: 16px">
<div slot="title">
<img class="title_img" src="../../../../../static/images/user_info_index.png">
<span class="title_font">其他信息</span>
</div>
<a-row :gutter="16">
<a-col :span="24">
<a-form-model-item label="联系电话" prop="sendContact" :labelCol="{span: 3}"
:wrapperCol="{span: 8}">
<a-input placeholder="请输入联系电话" v-model="formData.sendContact"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="现住地址" prop="sendPhone" :labelCol="{span: 3}"
:wrapperCol="{span: 20}">
<a-input placeholder="请输入现住地址" v-model="formData.sendPhone"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="详细地址" prop="sendDate" :labelCol="{span: 3}"
:wrapperCol="{span: 20}">
<a-input placeholder="请输入详细地址" v-model="formData.sendPhone"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="签署方式" prop="receiveUnitId">
<a-select v-model="formData.receiveUnitId" placeholder="请选择"
@click.native="getChildUnitList">
<a-select-option v-for="item in childUnitList"
:key="item.id" :value="item.id"
>
{{item.unitName}}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="签署日期" prop="sendContact">
<a-date-picker v-model="formData.produceDate" format="YYYY-MM-DD" style="width: 100%"/>
</a-form-model-item>
</a-col>
<a-col :span="21" :offset="3">
<a-form-model-item :wrapperCol="{span: 23}">
<a-card class="book" :headStyle="{background: '#FAFAFA'}">
<div slot="title" style="text-align: center;padding: 10px 0px">
<span style="color: #262626;font-size: 14px">知情同意书</span>
</div>
</a-card>
</a-form-model-item>
</a-col>
<a-col :span="21" :offset="3">
<a-form-model-item :wrapperCol="{span: 23}">
<div style="border: 1px dashed #EEEEEE">
<div class="sign">签字</div>
<vue-signature-pad
id="signature"
width="100%"
height="200px"
ref="signaturePad"
:options="options"
/>
<div class="opt">
<a-button @click="reWrite">重写</a-button>
<a-button type="primary" @click="save" style="margin-left: 10px">确定签字</a-button>
</div>
</div>
</a-form-model-item>
</a-col>
</a-row>
</a-card>
<div style="margin: 30px 0px">
<div class="divider_my"><span class="midText">发放信息</span></div>
</div>
<div style="clear: both"></div>
<a-col :span="12">
<a-form-model-item label="发放日期" prop="sendContact">
<a-date-picker v-model="formData.produceDate" format="YYYY-MM-DD" style="width: 100%"/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="发放医生" prop="receiveUnitId">
<a-select v-model="formData.receiveUnitId" placeholder="请选择" @click.native="getChildUnitList">
<a-select-option v-for="item in childUnitList"
:key="item.id" :value="item.id"
>
{{item.unitName}}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="21" :offset="3">
<a-form-model-item :wrapperCol="{span: 23}">
<a-button type="primary" @click="openStockModel" style="margin-bottom: 10px">请选择要发放的叶酸种类</a-button>
<a-table :dataSource="formData.detailedList" rowKey="id" :pagination="false" class="modal_table"
bordered>
<a-table-column title="供应商名称" data-index="typeName"></a-table-column>
<a-table-column title="品牌" data-index="factoryName"></a-table-column>
<a-table-column title="批次号" data-index="batchNumber"></a-table-column>
<a-table-column title="当前库存" data-index="stockNum"></a-table-column>
<a-table-column title="发放数量" width="190px" fixed="right">
<template slot-scope="text, record, index">
<a-form-model-item :prop="'detailedList.' + index + '.sendNum'"
:rules="formRules.sendNum" class="tab_input_r">
<a-input type="number"
v-toInt
v-model="record.sendNum"
placeholder="请输入分配数量"
style="width: 150px;margin-top: 20px"
@change="getChangeRecord(record)"
>
</a-input>
</a-form-model-item>
</template>
</a-table-column>
<a-table-column title="操作" align="center" fixed="right" width="70px">
<template slot-scope="text, record, index">
<!-- <a-button type="link" class="table_delbtn" @click="deleteGoodsList(index)">删除</a-button> -->
<a-popconfirm
title="确定移除该物资吗?"
ok-text="是"
cancel-text="否"
@confirm="confirm(index)"
>
<a href="#" class="table_delbtn">删除</a>
</a-popconfirm>
</template>
</a-table-column>
</a-table>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="备注" prop="sendDate" :labelCol="{span: 3}" :wrapperCol="{span: 20}">
<a-textarea placeholder="请输入备注" v-model="formData.sendPhone" :rows="5"></a-textarea>
</a-form-model-item>
</a-col>
</a-form-model>
<div style="text-align: center;margin-top: 16px">
<a-button @click="goBack">取消</a-button>
<a-button type="primary" @click="addMaterialDis" style="margin-left: 8px">发放</a-button>
</div>
</a-card>
</a-spin>
</div>
</template>
<script>
import {checkPhone, closedDetail} from "../../../utils/common";
import moment from 'moment'
let vm = this
let recordInfo = {}
export default {
components: {},
data() {
return {
unitInfo: JSON.parse(window.sessionStorage.getItem('networkInfo')),
routerParams: [],
spinning: false,
// 弹窗内表单
formData: {
detailedList: [],
sendUnitId: undefined,
sendUnitName: undefined,
receiveUnitId: undefined,
sendDate: undefined,
sendContact: undefined,
sendPhone: undefined,
relationType: undefined,
purchasePhone: undefined,
},
childUnitList: [],
formRules: {
sendUnitName: [
{required: true, message: '请选择发货单位'}
],
relationType: [
{required: true, message: '请选择出库类型'}
],
purchasePhone: [
{required: true, message: '请填写收货人电话'},
{validator: checkPhone},
],
receiveUnitId: [
{required: true, message: '请选择收货单位'}
],
sendDate: [
{required: true, message: '请选择出库日期'}
],
sendNum: [
{required: true, message: '请填写分配数量'},
{
validator: (rule, value, callback) => {
if (value == '' || value == undefined) {
callback()
}
if (value <= recordInfo.stockNum) {
callback()
} else {
callback(new Error('超出当前库存!'));
}
},
},
],
sendContact: [
{required: true, message: '请填写发货人'}
],
sendPhone: [
{required: true, message: '请填写联系电话'},
{validator: checkPhone},
],
},
womanPregnant: false,//是否怀孕
options: {
penColor: "#000",//画笔颜色
},
}
},
created() {
this.getSelectedMedical()
this.formData.sendUnitId = this.unitInfo.id
this.formData.sendUnitName = this.unitInfo.unitName
},
methods: {
//------签字-----------
reWrite() {
this.$refs.signaturePad.clearSignature();
},
save() {
const {isEmpty, data} = this.$refs.signaturePad.saveSignature();
console.log(isEmpty);
console.log(data);
},
// 删除药具
confirm(index) {
this.formData.detailedList.splice(index, 1);
},
//获取改变的当前项
getChangeRecord(record) {
recordInfo = record
},
getSelectedMedical() {//获取被选中的药具
let par = {
idList: this.$route.query.selected
}
this.$api.stockManage.fetchMedicalListByIds(par).then(({data = []}) => {
this.formData.detailedList = data
})
},
// 获取当前单位的下级单位
getChildUnitList() {
if (this.formData.relationType == 11) {
let par = {
areaCode: JSON.parse(window.sessionStorage.getItem('networkInfo')).areaCode,
}
this.$api.networkManage.fetchNetworkListByAreaCode(par).then(({code, data}) => {
if (code === 'SUCCESS') {
data.forEach(item => {
item['unitName'] = item.netName
})
this.childUnitList = data;
}
})
} else {
let params = {
id: JSON.parse(window.sessionStorage.getItem('userInfo')).unitId,
};
this.$api.common.fetchUnitInfo(params).then(({code, data}) => {
if (code === 'SUCCESS') {
this.childUnitList = data;
}
});
}
},
addMaterialDis() {//发放
this.$refs.formRef.validate(valid => {
if (valid) {
if (this.formData.detailedList.length === 0) {
this.$message.warning('分配物资不能为空!');
} else {
this.spinning = true;
let reviceUnitName = undefined
let receiveNetworkId = undefined
let receiveNetworkName = undefined
let params = {}
if (this.formData.relationType == 11) {
receiveNetworkId = this.formData.receiveUnitId
receiveNetworkName = this.childUnitList.filter(item => item.id == this.formData.receiveUnitId)[0].unitName
this.formData.receiveUnitId = undefined
reviceUnitName = undefined
params = {
...this.formData,
sendDate: moment(this.formData.sendDate).format('yyyy-MM-DD'),
purchaseUnitId: receiveNetworkId,
purchaseUnitName: receiveNetworkName,
receiveNetworkId: receiveNetworkId,
receiveNetworkName: receiveNetworkName
};
} else {
reviceUnitName = this.childUnitList.filter(item => item.id == this.formData.receiveUnitId)[0].unitName
params = {
...this.formData,
sendDate: moment(this.formData.sendDate).format('yyyy-MM-DD'),
purchaseUnitId: this.formData.receiveUnitId,
purchaseUnitName: reviceUnitName,
receiveUnitName: reviceUnitName
};
}
let detailedList = [];
this.formData.detailedList.forEach(item => {
detailedList.push({
medicalId: item.medicalId,
breedId: item.breedId,
batchId: item.batchId,
batchNumber: item.batchNumber,
produceDate: item.produceDate,
expireDate: item.expireDate,
sendNum: item.sendNum,
matSpecs: item.specs
});
});
params.detailedList = detailedList;
this.$api.stockManage.fetchDispatchGoods(params).then(({code}) => {
this.spinning = false;
if (code === 'SUCCESS') {
this.$message.success('调拨分配成功!');
// window.history.go(-1)
this.goBack()
} else {
// this.$message.error('调拨分配失败!')
}
});
}
} else {
return false;
}
});
},
onChangePregnant(e) {
let val = e.target.value
if (val == 2) {
this.womanPregnant = true
} else {
this.womanPregnant = false
}
},
//打开库存弹框
openStockModel() {
},
goBack() {
closedDetail('/inStock/addMaterialDistribution', '/Home/folviteDistribution')
}
}
}
</script>
<style scoped lang="less">
.title_img {
display: inline-block;
width: 24px;
height: 24px;
margin-top: -5px;
margin-left: 20px;
}
.title_font {
font-family: PingFang SC;
color: #595959;
font-weight: 600;
font-size: 16px;
line-height: 22px;
margin: 16px 0px 16px 18px;
}
</style>
<style lang="less">
.book {
.ant-card-head-title {
padding: 0px!important;
}
}
.sign {
position: absolute;
background: #FFF1F0;
border-radius: 0px 0px 24px 0px;
width: 60px;
height: 40px;
padding: 0px 16px;
}
.opt {
float: right;
margin-top: 10px;
}
</style>