From 7bd95fcba09194d6586bfada084e6b472be13c89 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Mon, 27 May 2024 14:42:10 +0800
Subject: [PATCH] 走访日志优化

---
 subPackage/workbench/views/workLog.vue |   75 +++++++++++++++++++++++++++++++++++--
 1 files changed, 70 insertions(+), 5 deletions(-)

diff --git a/subPackage/workbench/views/workLog.vue b/subPackage/workbench/views/workLog.vue
index 4b6b22d..44c818e 100644
--- a/subPackage/workbench/views/workLog.vue
+++ b/subPackage/workbench/views/workLog.vue
@@ -1,8 +1,18 @@
 <template>
 	<view>
 		<view class="content bgc-ff">
+
+			<view class="top item flex j-c-s-b a-i-c" @click="onScan()" v-if="!currentId">
+				<view class="flex a-i-c">
+					<u-icon name="/static/icon/nav-05.png" width="90rpx" height="90rpx"></u-icon>
+					<text class="f-28 ml-10">扫码获取信息</text>
+				</view>
+				<u-icon name="arrow-right" size="20"></u-icon>
+			</view>
+
 			<u-form labelPosition="left" :model="info" :rules="rules" ref="form" labelWidth="90"
 				:labelStyle="{fontSize:'28rpx'}">
+
 				<u-form-item label="走访类型" prop="type" :borderBottom="false" required @click="isShowTypePicker = true">
 					<u-input v-model="typeName" disabled disabledColor="#fff" border="none" placeholder="请选择"
 						placeholderClass="f-28 c-99" inputAlign="right"></u-input>
@@ -22,7 +32,7 @@
 					<u-icon slot="right" name="arrow-right"></u-icon>
 				</u-form-item>
 				<u-form-item label="手机号" borderBottom required v-if="info.householdId">
-					<u-input v-model="selectedHousehold.phoneNumber" border="none" disabled disabledColor="#f5f5f5"
+					<u-input v-model="selectedHousehold.phoneNumber" border="none" disabled disabledColor="#ffffff"
 						placeholderClass="f-28 c-99" inputAlign="right"></u-input>
 				</u-form-item>
 				<u-form-item label="走访地址" borderBottom required v-if="info.householdId">
@@ -41,9 +51,11 @@
 						inputAlign="right"></u-input>
 				</u-form-item> -->
 				<u-form-item label="内容" borderBottom required prop="context">
-					<u-input type="textarea" v-model="info.context" border="none" placeholderClass="f-28 c-99"
+					<!-- <u-input type="textarea" v-model="info.context" border="none" placeholderClass="f-28 c-99"
 						inputAlign="right" placeholder="请输入内容">
-					</u-input>
+					</u-input> -->
+					<u--textarea v-model="info.context" border="none" placeholderClass="f-28 c-99" inputAlign="right"
+						placeholder="请输入内容"></u--textarea>
 				</u-form-item>
 				<u-form-item label="走访时间" prop="workTime" :borderBottom="false" required @click="showSelectDate = true">
 					<u-input v-model="info.workTime" disabled disabledColor="#ffffff" border="none" placeholder="请选择"
@@ -210,7 +222,8 @@
 				isShowPopup: false,
 				address: "",
 				isEdit: false,
-				id: ""
+				id: "",
+				houseCode: ''
 			}
 		},
 		// onLoad() {
@@ -238,6 +251,33 @@
 		},
 
 		methods: {
+
+			onScan() {
+				uni.scanCode({
+					success: (res) => {
+						let obj = this.getUrlParams(res.result);
+						this.getHouseType(obj.stdId);
+					}
+				})
+			},
+
+
+			getUrlParams(url) {
+				let urlStr = url.split('?')[1]
+				let obj = {};
+				let paramsArr = urlStr.split('&')
+				for (let i = 0, len = paramsArr.length; i < len; i++) {
+					let arr = paramsArr[i].split('=')
+					obj[arr[0]] = arr[1];
+				}
+				return obj
+			},
+
+			getHouseType(code) {
+				this.houseCode = code
+				// this.getHouseholdList();
+			},
+
 
 			getDetail(id) {
 				getWorkLogDetail({
@@ -301,6 +341,7 @@
 				fetchHousehold({
 					labelId: this.info.personType,
 					searchKey: this.keyword,
+					houseCode: this.houseCode,
 					limit: 20
 				}).then(res => {
 					this.houseHoldList = res.data;
@@ -356,7 +397,23 @@
 			selectHousehold(item) {
 				this.selectedHousehold = item;
 				this.info.householdId = item.id;
-				this.address = `${item.townStreetName}${item.neiName}${item.aoiName}${item.address || ""}`
+				if (item.townStreetName === null) {
+					item.townStreetName = ''
+				}
+
+				if (item.neiName === null) {
+					item.neiName = ''
+				}
+
+				if (item.aoiName === null) {
+					item.aoiName = ''
+				}
+
+				if (item.address === null) {
+					item.address = ''
+				}
+				this.address =
+					`${item.townStreetName}${item.neiName}${item.aoiName}${item.address}`
 				this.isShowPopup = false;
 			},
 
@@ -443,8 +500,16 @@
 	.content {
 		margin: 20rpx 30rpx;
 		padding: 0 30rpx;
+
+
 	}
 
+	.top {
+		padding: 20rpx !important;
+	}
+
+
+
 	.row {
 		padding: 20rpx 0;
 		border-bottom: 1px solid

--
Gitblit v1.9.3