Browse Source

fead:患者填写医院回访

lsw 9 months ago
parent
commit
8316ae9bc9
2 changed files with 28 additions and 5 deletions
  1. 25 5
      app/pages/follow/detail.vue
  2. 3 0
      app/pages/follow/index.vue

+ 25 - 5
app/pages/follow/detail.vue

@@ -10,9 +10,9 @@
 				<text class="dx">({{ item.input }})</text>
 			</view>
 			<view class="mts">
-				<input v-if="item.input == '填空'" v-model="item.s_value" placeholder="请输入" />
-				<input v-if="item.input == '数字'" type="number" v-model="item.s_value" placeholder="请输入" :disabled="look ? true : false" />
-				<textarea v-if="item.input == '多行文本'" v-model="item.s_value" placeholder="请输入" />
+				<input v-if="item.input == '填空'" v-model="item.s_value" placeholder="请输入" :disabled="item.state != 0" />
+				<input v-if="item.input == '数字'" type="number" v-model="item.s_value" placeholder="请输入" :disabled="item.state != 0" />
+				<textarea v-if="item.input == '多行文本'" v-model="item.s_value" placeholder="请输入" :disabled="item.state != 0" />
 				<view class="ops" v-if="item.input == '单选' || item.input == '多选' || item.input == '判断'">
 					<view v-for="(op, i) in item.selects" :key="op.name">
 						<view class="op" :class="{ active: op.check }" @click="check(item, op)">{{ op.name }}</view>
@@ -21,7 +21,7 @@
 			</view>
 		</view>
 		<u-divider text="结束"></u-divider>
-		<button class="btn">立即提交</button>
+		<button class="btn" @click="add()" v-if="item.state == 0">立即提交</button>
 	</view>
 </template>
 
@@ -45,7 +45,7 @@ export default {
 	methods: {
 		//单选或多选
 		check(item, op) {
-			if (this.look) {
+			if (this.item.state != 0) {
 				return;
 			}
 			if (item.input == '单选' || item.input == '判断') {
@@ -54,6 +54,7 @@ export default {
 			} else {
 				op.check = !op.check;
 			}
+			item.s_value = op.check; //选中项
 			this.$forceUpdate();
 		},
 		add() {
@@ -69,6 +70,24 @@ export default {
 				uni.showModal({ content: this.verify.error, showCancel: false });
 				return;
 			}
+			let data = JSON.parse(JSON.stringify(this.item));
+			data.op = JSON.stringify(data.op);
+			this.http.request({
+				url: '/app/follow/push',
+				data: data,
+				method: 'POST',
+				success: (res) => {
+					uni.showModal({
+						title: '提示',
+						content: '感谢您的回访',
+						showCancel: false,
+						success: (res) => {
+							uni.$emit('follow');
+							uni.navigateBack();
+						}
+					});
+				}
+			});
 		}
 	}
 };
@@ -81,6 +100,7 @@ page {
 .title {
 	text-align: center;
 	font-weight: bold;
+	padding-bottom: 10px;
 }
 .item {
 	.mtt {

+ 3 - 0
app/pages/follow/index.vue

@@ -36,6 +36,9 @@ export default {
 	},
 	onLoad(e) {
 		this.getData();
+		uni.$on('follow', (res) => {
+			this.refresh();
+		});
 	},
 	methods: {
 		click(e) {