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
<template>
<div>
<van-form ref='form'>
<div class='label-title' v-if='showPush'>请选择推送渠道</div>
<van-field
v-model='form.isSmsIsWxStr'
style='padding: 0px'
:rules='rules.isSmsIsWxStr'
>
<template #input>
<div class='w-full'>
<checkBtn class='mt-3'
column-1
text-align='left'
:options='vxList'
v-model:value='checkVx'
:fieldNames="{text: 'name', value: 'value'}"
></checkBtn>
<div class='push-lab'>随访信息将通过小程序消息推送给居民</div>
<checkBtn class='mt-3'
column-1
text-align='left'
:options='messageList'
v-model:value='checkMessage'
:fieldNames="{text: 'name', value: 'value'}"
></checkBtn>
<div class='push-lab'>随访信息将通过短信方式发送给居民</div>
</div>
</template>
</van-field>
<div :class="['label-title', {'mt-5': showPush}]">随访单位</div>
<van-field
v-model='form.visitUnitName'
is-link
readonly
placeholder='随访单位'
class='input-back mt-2 form-input'
:rules='rules.visitUnitName'
@click='show1 = true'
/>
<DocUnit v-model:show='show1' v-model:value='form.visitUnitId' @change='changeUnit' />
<div class='label-title mt-5'>随访科室</div>
<van-field
v-model='form.visitOfficeName'
is-link
readonly
placeholder='随访科室'
class='input-back mt-2 form-input'
:rules='rules.visitOfficeName'
@click='show2 = true'
/>
<DocOffice v-model:show='show2' v-model:value='form.visitOfficeId' @change='changeOffice'
:unitId='form.visitUnitId' />
<div class='label-title mt-5'>随访医生</div>
<van-field
v-model='form.visitDoctorName'
is-link
readonly
placeholder='随访医生'
class='input-back mt-2 form-input'
:rules='rules.visitDoctorName'
@click='show3 = true'
/>
<DocOfficeDoctor v-model:show='show3' v-model:value='form.visitDoctorId' @change='changeDoctor'
:unitId='form.visitUnitId' :officeId='form.visitOfficeId' />
</van-form>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { useStore } from '@/doctor/store'
import DocUnit from '@/doctor/components/docUnit/DocUnit'
import DocOffice from '@/doctor/components/docOffice/DocOffice'
import DocOfficeDoctor from '@/doctor/components/docOfficeDoctor/DocOfficeDoctor'
import CheckBtn from '@/doctor/components/checkBtn/CheckBtn'
export default {
name: 'CommonBottom',
components: { CheckBtn, DocOfficeDoctor, DocOffice, DocUnit },
props: {
info: {
default: () => {
return {}
}
},
firstForm: {
default: () => {
return {}
}
},
modeEnumList: {
default: () => {
return {}
}
}
},
data() {
return {
store: useStore(),
show1: false,
show2: false,
show3: false,
vxList:[],
checkVx: undefined,
messageList: [],
checkMessage: undefined,
form: {
isSmsIsWx: []
},
rules: {
isSmsIsWxStr: [{ required: true, message: '请选择' }],
visitUnitName: [{ required: true, message: '请选择' }],
visitOfficeName: [{ required: true, message: '请选择' }],
visitDoctorName: [{ required: true, message: '请选择' }],
}
}
},
watch: {
'info': {
handler() {
this.form = this.setForm(this.info)
},
immediate: true
},
'firstForm.residentsRecord': {
handler() {
this.vxList = this.getVxEnum(this.firstForm)
this.messageList = this.getMessageEnum(this.firstForm.residentsRecord)
},
immediate: true,
deep:true
},
'checkMessage': {
handler() {
this.form.isSms = 2
if (this.checkMessage) {
this.form.isSms = 1
this.form.isSmsIsWx.push(1)
this.form.isSmsIsWxStr = 1
} else {
this.form.isSmsIsWx = this.form.isSmsIsWx.filter(item => item !=1)
//判断推送渠道是否存在值
if (!this.checkVx) {
this.form.isSmsIsWxStr = ''
}
}
}
},
'checkVx': {
handler() {
this.form.isWx = 2
if (this.checkVx) {
this.form.isWx = 1
this.form.isSmsIsWx.push(2)
this.form.isSmsIsWxStr = 2
} else {
this.form.isSmsIsWx = this.form.isSmsIsWx.filter(item => item !=2)
//判断推送渠道是否存在值
if (!this.checkMessage) {
this.form.isSmsIsWxStr = ''
}
}
}
},
},
computed: {
authInfo() {
return this.store.$state.authInfo
},
//是否显示推送渠道
showPush() {
let res = false
let list = []
if (this.firstForm.visitWayRules) {
list = this.firstForm.visitWayRules.split(',').map(item => Number(item))
}
if (list && list.length && (list.includes(2) || list.includes(3) || list.includes(4))) {
res = true
}
return res
}
},
methods: {
//微信
getVxEnum(patientInfo = {}) {
return [{ name: `微信 ${patientInfo.sendNumber ? `(${this.$phoneHide(patientInfo.sendNumber)}已注册小程序)` : `(未注册小程序)`}`, value:2 }]
},
getMessageEnum(patientInfo = {}) {
return [{ name: `短信 ${patientInfo.telephone ? `(手机号 ${this.$phoneHide(patientInfo.telephone)})` : `(手机号 不存在)`}`, value: 1 }]
},
setForm(info) {
const form = {
visitDate: new dayjs(),
createDate: new dayjs(),
// 随访单位
visitUnitId: this.authInfo.unitId,
visitUnitName: this.authInfo.unitName,
// 随访科室
visitOfficeId: this.authInfo.officeId,
visitOfficeName: this.authInfo.officeName,
// 随访医生
visitDoctorId: this.authInfo.relationId,
visitDoctorName: this.authInfo.nickName,
// 录入单位
createUnitId: this.authInfo.unitId,
createUnitName: this.authInfo.unitName,
// 录入科室
createOfficeId: this.authInfo.officeId,
createOfficeName: this.authInfo.officeName,
// 录入医生
createDoctorId: this.authInfo.relationId,
createDoctorName: this.authInfo.nickName,
isSms: 2,
isWx: 2,
isSmsIsWx: [],
}
Reflect.ownKeys(form).forEach(key => {
if (info[key] != undefined) {
form[key] = info[key]
}
})
return form
},
changeUnit(val) {
this.form.visitUnitName = val.unitName
this.form.visitUnitId = val.id
this.form.visitOfficeId = undefined
this.form.visitOfficeName = undefined
this.form.visitDoctorId = undefined
this.form.visitDoctorName = undefined
this.show1 = false
},
changeOffice(val) {
this.form.visitOfficeId = val.id
this.form.visitOfficeName = val.officeName
this.form.visitDoctorId = undefined
this.form.visitDoctorName = undefined
this.show2 = false
},
changeDoctor(val) {
this.form.visitDoctorId = val.id
this.form.visitDoctorName = val.staffName
this.show3 = false
},
onSubmit() {
return new Promise((resolve, reject) => {
this.$refs.form.validate().then(() => {
let par = {
...this.form
}
resolve(par)
}).catch((e) => {
console.warn('ArchiveCommon error', e)
})
})
}
}
}
</script>
<style scoped lang='less'>
.title {
font-weight: bold;
margin-bottom: 20px;
}
.label-title {
font-size: 13px;
color: #595959;
font-weight: 500;
&::after {
content: "*";
color: red;
font-weight: bold;
margin-left: 4px;
}
}
.push-lab {
line-height: 20px;
color: #8C8C8C;
font-size: 12px
}
.no-req-label {
font-size: 13px;
color: #595959;
font-weight: 500;
}
.form-input {
padding: 8px 12px;
border-radius: 8px;
}
.input-back {
background: #FAFAFA;
}
.tel-back {
background: #F5F5F5;
padding: 8px;
border-radius: 0px 0px 8px 8px;
}
.tel {
background: #FFFFFF;
padding: 8px;
border-radius: 8px;
}
.tel-label {
color: #607FF0;
font-weight: bold;
}
.p-12-0 {
padding: 12px 0px;
}
:deep(.van-cell-group--inset) {
overflow: visible;
}
:deep(.van-cell) {
overflow: visible;
}
:deep(.van-field__error-message) {
position: absolute;
}
:deep(.van-cell:after) {
border-bottom: 0px;
}
</style>