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
<template>
<div>
<mt-header title="填写随访">
<router-link to="/" slot="left">
<mt-button icon="back"></mt-button>
</router-link>
</mt-header>
<div class="remarks">
注:药具领取前需填写之前的使用情况
</div>
<form>
<div class="subject">
<mt-radio
title="使用是否满意"
align="left"
v-model="formData.isAgree"
:options="options1">
</mt-radio>
<div v-if="formData.isAgree==='1'">
<input type="text" v-model.trim="formData.disagreeReason" @blur="blurDisagreeReason" placeholder="请填写原因"/>
<label class="checkMsg" v-if="formData.checkDisagreeReason">请填写不满意原因</label>
</div>
<mt-radio
title="有无不良反应"
align="left"
v-model="formData.isBadReaction"
:options="options2">
</mt-radio>
<div v-if="formData.isBadReaction==='1'" class="badReaction">
<div style="font-weight: bold; color: #888">请选择不良反应(多选):</div>
<div v-for="item in options3" :key="item.value" style="margin-top: 10px">
<input type="checkbox" v-model="formData.badReaction" @change="changeBadReaction" :id="item.value" :value="item.value" class="hidden"/>
<span></span>
<span class="txt">{{item.label}}</span>
</div>
<label class="checkMsg" v-if="formData.checkBadReaction">请选择不良反应</label>
<div v-if="formData.badReaction.includes(5)">
<input type="text" v-model="formData.otherBadReaction" @blur="blurOtherBadReaction" placeholder="请填写其他不良反应"/>
<label class="checkMsg" v-if="formData.checkOtherBadReaction">请填写其他不良反应</label>
</div>
</div>
</div>
</form>
<div class="sub-badReaction">
<mt-button type="primary" @click="subReturnVisit">提 交</mt-button>
</div>
</div>
</template>
<script>
export default {
name: "returnVisit",
data() {
return {
options1: [{label: '满意', value: '0'}, {label: '不满意', value: '1'}],
options2: [{label: '没有', value: '0'}, {label: '不满意', value: '1'}],
options3: [
{label: '恶心呕吐', value: 0},
{label: '阴道点滴出血', value: 1},
{label: '月经过少或闭经', value: 2},
{label: '面部色素沉着', value: 3},
{label: '体重增加', value: 4},
{label: '其他', value: 5}],
formData: {
isAgree:'0',
isBadReaction:'0',
badReaction: [],
checkDisagreeReason:false,
checkOtherBadReaction:false,
checkBadReaction:false
}
}
},
methods:{
blurDisagreeReason(){
this.formData.checkDisagreeReason=this.formData.disagreeReason===''||this.formData.disagreeReason===undefined;
},
blurOtherBadReaction(){
this.formData.checkOtherBadReaction=this.formData.otherBadReaction===''||this.formData.otherBadReaction===undefined;
},
changeBadReaction(){
this.formData.checkBadReaction=this.formData.badReaction.length<1|| this.formData.badReaction===undefined;
},
subReturnVisit(){
let flag=true;
if(this.formData.isAgree==='1'){
this.blurDisagreeReason();
if(this.formData.checkDisagreeReason){
flag=false;
}
}
if(this.formData.isBadReaction==='1'){
this.changeBadReaction();
if(this.formData.checkBadReaction){
flag=false;
}
if(this.formData.badReaction.includes(5)){
this.blurOtherBadReaction();
if(this.formData.checkOtherBadReaction){
flag=false;
}
}
}
/*验证完毕*/
if(flag){
console.log(this.formData);
}else {
return false;
}
}
}
}
</script>
<style>
.checkMsg{
color: red;
}
.remarks {
background-color: #F5F6F8;
padding: 5px 0px 5px 20px;
}
.subject {
padding: 5px 0px 5px 20px;
}
.subject .mint-cell:not(:last-child) {
float: left;
}
.subject input[type=text] {
border: none;
outline: none;
width: 100%;
padding-left: 5px;
border-bottom: 1px solid #F0F0F0;
color: #6E6166;
}
.badReaction {
width: 100%;
border-top: 1px solid #F0F0F0;
padding-top: 10px;
padding-left: 5px;
}
.hidden {
opacity: 0;
position: absolute;
z-index: 11;
}
input[type=checkbox] + span {
display: inline-block;
height: 16px;
width: 16px;
border-radius: 3px;
background-color: white;
border: 1px solid #cccccc;
}
input[type=checkbox]:checked + span {
background-color: #00CA9D;
}
.txt {
position: relative;
top: -3px;
left: 3px;
}
.sub-badReaction {
position: fixed;
z-index: 2;
left: calc(50% - 155px);
bottom: 20px;
}
.sub-badReaction .mint-button {
width: 311px;
height: 44px;
background: linear-gradient(242deg, #dff9b9 -27%, #1bd09f 85%);
border-radius: 22px;
box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.1);
}
</style>