From 0beea067bea14aeaa8ed0d8ee3cf4d2117f3cd2e Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Tue, 14 May 2024 16:14:06 +0800
Subject: [PATCH] 跳转优化

---
 subPackage/workbench/views/workLog.vue |   90 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 74 insertions(+), 16 deletions(-)

diff --git a/subPackage/workbench/views/workLog.vue b/subPackage/workbench/views/workLog.vue
index bf9a7a2..4b6b22d 100644
--- a/subPackage/workbench/views/workLog.vue
+++ b/subPackage/workbench/views/workLog.vue
@@ -15,7 +15,8 @@
 					<u-icon slot="right" name="arrow-right"></u-icon>
 				</u-form-item>
 
-				<u-form-item label="被访人姓名" prop="name" :borderBottom="false" required @click="isShowPopup = true">
+				<u-form-item label="被访人姓名" prop="householdId" :borderBottom="false" required
+					@click="isShowPopup = true">
 					<u-input v-model="selectedHousehold.name" disabled disabledColor="#fff" border="none"
 						placeholder="请选择" placeholderClass="f-28 c-99" inputAlign="right"></u-input>
 					<u-icon slot="right" name="arrow-right"></u-icon>
@@ -39,7 +40,7 @@
 					<u-input v-model="info.phone" border="none" placeholder="请输入手机号" placeholderClass="f-28 c-99"
 						inputAlign="right"></u-input>
 				</u-form-item> -->
-				<u-form-item label="内容" borderBottom required>
+				<u-form-item label="内容" borderBottom required prop="context">
 					<u-input type="textarea" v-model="info.context" border="none" placeholderClass="f-28 c-99"
 						inputAlign="right" placeholder="请输入内容">
 					</u-input>
@@ -76,7 +77,12 @@
 			@cancel="isShowTypePicker = false" @confirm="confirmType()" keyName="dictValue"></u-picker>
 		<u-picker :show="isShowLabelPicker" :columns="labelList" :defaultIndex="labelIndex"
 			@cancel="isShowLabelPicker = false" @confirm="confirmLabelType()" keyName="name"></u-picker>
-		<footer-btn @click="submitInfo" :text="isEdit?'保存':'提交'" />
+
+		<!-- <footer-btn @click="submitInfo" :text="isEdit?'保存':'提交'" /> -->
+
+		<button class="submit-btn" @click="submitInfo">{{isEdit?"保存":"提交"}}</button>
+		<button class="list-btn" @click="navToRecord">走访记录</button>
+
 
 		<u-popup :show="isShowPopup" mode="bottom" :round="10" closeable="true" @close="isShowPopup = false">
 			<view class="popup-content">
@@ -141,7 +147,11 @@
 				info: {
 					// name: "",
 					// phone: "",
-					context: ""
+					type: "",
+					householdId: "",
+					context: "",
+					workTime: "",
+					personType: ""
 				},
 				rules: {
 					// 'name': {
@@ -157,24 +167,30 @@
 					// 	trigger: ['blur', 'change']
 					// },
 
-					'info.type': {
-						type: 'string',
+					type: [{
+						type: 'number',
 						required: true,
 						message: '请选择走访类型',
 						trigger: ['blur', 'change']
-					},
-					'info.householdId': {
+					}],
+					// peopleType: [{
+					// 	type: 'number',
+					// 	required: true,
+					// 	message: '请选择重点人群类型',
+					// 	trigger: ['blur', 'change']
+					// }],
+					householdId: [{
 						type: 'string',
 						required: true,
 						message: '请选择被访问人',
 						trigger: ['blur', 'change']
-					},
-					'info.context': {
+					}],
+					context: [{
 						type: 'string',
 						required: true,
 						message: '请输入工作内容',
 						trigger: ['blur', 'change']
-					},
+					}],
 				},
 				showSelectDate: false,
 				workTime: Number(new Date()),
@@ -216,6 +232,11 @@
 			}
 		},
 
+		onReady() {
+			//onReady 为uni-app支持的生命周期之一
+			this.$refs.form.setRules(this.rules)
+		},
+
 		methods: {
 
 			getDetail(id) {
@@ -230,17 +251,21 @@
 						if (data.workTime) {
 							this.workTime = Number(new Date(data.workTime))
 						}
-						this.info.type = data.type;
-						this.info.workTime = data.workTime;
-						this.info.context = data.context;
-						this.info.householdId = data.householdId;
-						this.info.personType = data.personType;
+						// this.info.type = data.type;
+						// this.info.workTime = data.workTime;
+						// this.info.context = data.context;
+						// this.info.householdId = data.householdId;
+						// this.info.personType = data.personType;
+						console.log(typeof data.personType)
 						this.labelIndex = this.$getIndex(this.labelList[0], data.personType, "id", "name").index;
 						this.labelName = this.$getIndex(this.labelList[0], data.personType, "id", "name").name;
 						this.getHouseholdList();
 						this.getHousehold(data.householdId);
 						this.form.images = this.$setImageUrl(data.url, 2);
 						this.info.id = data.id;
+						for (let i in this.info) {
+							this.$set(this.info, i, data[i])
+						}
 					}
 				})
 			},
@@ -354,6 +379,10 @@
 				this.$refs.form.validate().then(valid => {
 					this.checkImages();
 					this.info.status = 2;
+					if (this.info.type == 2 && !this.info.personType) {
+						this.$showTips("请选择重点人群类型")
+						return
+					}
 					if (this.isEdit) {
 						this.updateWorkLogRequest()
 					} else {
@@ -394,6 +423,13 @@
 				prePage.$vm.getList();
 				uni.navigateBack();
 			},
+
+
+			navToRecord() {
+				uni.navigateTo({
+					url: "/subPackage/workLog/list"
+				})
+			}
 
 		}
 	}
@@ -489,4 +525,26 @@
 		font-size: 28rpx;
 		padding: 2rpx 10rpx;
 	}
+
+	.submit-btn {
+		width: 690rpx;
+		height: 78rpx;
+		line-height: 78rpx;
+		background: linear-gradient(163deg, #01BDFC 0%, #017BFC 100%);
+		border-radius: 8rpx 8rpx 8rpx 8rpx;
+		font-size: 32rpx;
+		color: #fff;
+		margin-top: 50rpx;
+	}
+
+	.list-btn {
+		width: 690rpx;
+		height: 78rpx;
+		line-height: 78rpx;
+		background: linear-gradient(163deg, #c7d7dc 0%, #c3cdd8 100%);
+		border-radius: 8rpx 8rpx 8rpx 8rpx;
+		font-size: 32rpx;
+		color: #fff;
+		margin-top: 50rpx;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3