From 3c738f4fe2762bba8087e5a22fc0dc06560eab0e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Thu, 08 Aug 2024 10:01:17 +0800
Subject: [PATCH] 三色任务与自查任务

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

diff --git a/subPackage/workbench/views/workLog.vue b/subPackage/workbench/views/workLog.vue
index 98847a1..5f69332 100644
--- a/subPackage/workbench/views/workLog.vue
+++ b/subPackage/workbench/views/workLog.vue
@@ -85,10 +85,13 @@
 
 		<u-datetime-picker ref="datetimePicker" :show="showSelectDate" v-model="workTime" mode="datetime"
 			:formatter="formatter" @confirm="confirmDate" @cancel="showSelectDate = false"></u-datetime-picker>
+
 		<u-picker :show="isShowTypePicker" :columns="typeList" :defaultIndex="typeIndex"
 			@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>
+
+		<u-picker :show="isShowLabelPicker" ref="uPicker" @change="changeHandler" :columns="labelList"
+			:defaultIndex="labelIndex" @cancel="isShowLabelPicker = false" @confirm="confirmLabelType()"
+			keyName="name"></u-picker>
 
 		<!-- <footer-btn @click="submitInfo" :text="isEdit?'保存':'提交'" /> -->
 
@@ -214,6 +217,7 @@
 				isShowTypePicker: false,
 				isShowLabelPicker: false,
 				labelList: [],
+				labelListTwo: [],
 				labelIndex: [0],
 				labelName: "",
 				keyword: "",
@@ -275,7 +279,7 @@
 
 			getHouseType(code) {
 				this.houseCode = code
-				// this.getHouseholdList();
+				this.getHouseholdList();
 			},
 
 
@@ -296,10 +300,10 @@
 						// this.info.context = data.context;
 						// this.info.householdId = data.householdId;
 						// this.info.personType = data.personType;
-						console.log(typeof 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.labelName = data.labelName
 						this.getHousehold(data.householdId);
 						this.form.images = this.$setImageUrl(data.url, 2);
 						this.info.id = data.id;
@@ -321,9 +325,12 @@
 
 			getLabelList() {
 				getLabelListByParentId({
-					parentId: 100
+					parentId: 1000
 				}).then(res => {
-					this.labelList = [res.data];
+					// this.labelList = [res.data];
+					// this.labelListTwo = res.data
+					this.labelList.push(res.data)
+					this.labelList.push(res.data[0].children)
 				})
 			},
 
@@ -334,10 +341,15 @@
 					console.log(res);
 					this.address = res.data.currentAddress;
 					this.selectedHousehold = res.data;
+					this.houseCode = res.data.houseCode
+					this.getHouseholdList();
 				})
 			},
 
 			getHouseholdList() {
+				if (!this.houseCode) {
+					return
+				}
 				fetchHousehold({
 					labelId: this.info.personType,
 					searchKey: this.keyword,
@@ -392,14 +404,58 @@
 			},
 
 			//选择重点人群类型
+			// confirmLabelType(e) {
+			// 	this.labelIndex = e.indexs;
+			// 	this.info.personType = e.value[0].id;
+			// 	this.labelName = e.value[0].name;
+			// 	this.isShowLabelPicker = false;
+			// 	this.getHouseholdList();
+			// },
+			// 回调参数为包含columnIndex、value、values
 			confirmLabelType(e) {
+				console.log('confirm', e)
+				// this.show = false
 				this.labelIndex = e.indexs;
-				this.info.personType = e.value[0].id;
-				this.labelName = e.value[0].name;
+				if (e.value[2]) {
+					this.info.personType = e.value[2].id;
+					this.labelName = e.value[2].name;
+				} else {
+					this.info.personType = e.value[1].id;
+					this.labelName = e.value[1].name;
+				}
 				this.isShowLabelPicker = false;
 				this.getHouseholdList();
 			},
 
+			changeHandler(e) {
+				const {
+					columnIndex,
+					value,
+					values, // values为当前变化列的数组内容
+					index,
+					// 微信小程序无法将picker实例传出来,只能通过ref操作
+					picker = this.$refs.uPicker
+				} = e
+				// 当第一列值发生变化时,变化第二列(后一列)对应的选项
+				if (columnIndex === 0) {
+					console.log("****************", e)
+					// picker为选择器this实例,变化第二列对应的选项
+					picker.setColumnValues(1, value[0].children)
+					// picker为选择器this实例,变化第二列对应的选项
+					if (value[0].hasChildren) {
+						picker.setColumnValues(2, value[0].children[0].children)
+					}
+				}
+				if (columnIndex === 1) {
+					console.log("*******1*********", e)
+					// picker为选择器this实例,变化第二列对应的选项
+					if (value[1].hasChildren) {
+						picker.setColumnValues(2, value[1].children)
+					}
+				}
+			},
+
+
 			//搜索住户
 			searchHousehold() {
 				this.getHouseholdList()

--
Gitblit v1.9.3