From 5931ac5e88e356a8691c38dec352bdd3dea28c7d Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Sat, 04 Nov 2023 23:02:16 +0800
Subject: [PATCH] 住户标签接入完成,资料管理接入

---
 api/house/householdLabel.js                |   21 +
 api/doorplateAddress/doorplateAddress.js   |   15 
 subPackage/house/roomDetails/index.vue     |   61 +++
 pages.json                                 |    9 
 subPackage/house/member/index.vue          |  465 +++++++++++++++++++---------
 api/house/household.js                     |   30 +
 subPackage/house/member/householdLabel.vue |  333 ++++++++++++++++++++
 subPackage/house/roomControl/index.vue     |   10 
 api/house/houseLabel.js                    |    1 
 9 files changed, 774 insertions(+), 171 deletions(-)

diff --git a/api/doorplateAddress/doorplateAddress.js b/api/doorplateAddress/doorplateAddress.js
index 67dfda1..1a2d90f 100644
--- a/api/doorplateAddress/doorplateAddress.js
+++ b/api/doorplateAddress/doorplateAddress.js
@@ -73,4 +73,17 @@
 			...params
 		}
 	})
-}
\ No newline at end of file
+}
+
+// 获取门牌地址详情(简单单表)
+export const getDetail = (params) => {
+	return http.request({
+		url: 'blade-doorplateAddress/doorplateAddress/detail',
+		method: 'GET',
+		params: {
+			...params
+		}
+	})
+}
+
+
diff --git a/api/house/houseLabel.js b/api/house/houseLabel.js
index b3fd26e..f0da74a 100644
--- a/api/house/houseLabel.js
+++ b/api/house/houseLabel.js
@@ -1,5 +1,6 @@
 import http from '@/http/api.js'
 
+
 // 获取房屋详细信息
 export const getHouseDetail = (houseCode) => {
 	return http.request({
diff --git a/api/house/household.js b/api/house/household.js
new file mode 100644
index 0000000..f83e411
--- /dev/null
+++ b/api/house/household.js
@@ -0,0 +1,30 @@
+import http from '@/http/api.js'
+
+// 住户信息查询
+export const getHouseholdDetail = (param) => {
+	return http.request({
+		url: 'blade-household/household/getDetail',
+		method: 'GET',
+		params: param
+	})
+}
+
+// 住户新增修改
+export const saveOrUpdateHousehold = (data) => {
+	return http.request({
+		url: 'blade-household/household/saveOrUpdateHousehold',
+		method: 'POST',
+		data
+	})
+}
+
+// 住户删除
+export const removeHousehold = (ids) => {
+	return http.request({
+		url: 'blade-household/household/remove',
+		method: 'POST',
+		params: {
+			ids
+		}
+	})
+}
diff --git a/api/house/householdLabel.js b/api/house/householdLabel.js
new file mode 100644
index 0000000..f7bf8e6
--- /dev/null
+++ b/api/house/householdLabel.js
@@ -0,0 +1,21 @@
+import http from '@/http/api.js'
+
+
+
+// 住户标签修改
+export const saveOrUpdateHouseholdLabel = (data) => {
+	return http.request({
+		url: 'blade-householdLabel/householdLabel/saveOrUpdateHouseholdLabel',
+		method: 'POST',
+		data
+	})
+}
+
+// 住户标签撤销
+export const removeHouseholdLabel = (data) => {
+	return http.request({
+		url: 'blade-householdLabel/householdLabel/removeHouseholdLabel',
+		method: 'POST',
+		data
+	})
+}
\ No newline at end of file
diff --git a/pages.json b/pages.json
index 5a841b2..f2927da 100644
--- a/pages.json
+++ b/pages.json
@@ -184,6 +184,15 @@
 					}
 				},
 				{
+					"path": "member/householdLabel",
+					"style": {
+						"navigationBarTitleText": "标签管理",
+						"navigationBarBackgroundColor": "#5887f9",
+						"navigationBarTextStyle": "white",
+						"enablePullDownRefresh": false
+					}
+				},
+				{
 					"path": "roomControl/index",
 					"style": {
 						"navigationBarTitleText": "房屋管理",
diff --git a/subPackage/house/member/householdLabel.vue b/subPackage/house/member/householdLabel.vue
new file mode 100644
index 0000000..bdfa03e
--- /dev/null
+++ b/subPackage/house/member/householdLabel.vue
@@ -0,0 +1,333 @@
+<template>
+	<view class="container">
+		<view class="main">
+			<view class="content">
+				<view class="base b-c-w">
+					<u-icon name="photo"></u-icon> {{ houseAddress}}
+				</view>
+				<view class="l flex-1 flex">
+					<view class="flex_base">
+						<view class="head-img flex_base">
+							<u--image shape="circle" :showLoading="true" src="/static/icon/user-01.png"  width="120rpx"
+								height="120rpx"></u--image>
+						</view>
+					</view>
+					<view class="info">
+						<view>姓名:{{householdInfo.name}}</view>
+						<view class="flex">
+							手机:{{householdInfo.phoneNumber}} <u-icon name="phone-fill" color="#4586FE"></u-icon>
+						</view>
+					</view>
+				</view>
+				<view v-for="(item, index) in labelBtnList" :key="index">
+					<box-title :title="item.name"></box-title>
+					<view class="mt-20 flex label-btn-box b-c-w">
+						<view v-for="(item, index) in item.children" :key="index">
+							<u-button color="#000" size="mini" type="primary" 
+							:style="{background: item.color}"
+							:plain="true" :text="item.name"
+								@click="showLabelPopup(item)"></u-button>
+						</view>
+					</view>
+				</view>
+			</view>
+		</view>
+
+		<u-modal style="flex: none;" :show="popupShow" :closeOnClickOverlay="true" showCancelButton
+			@cancel="popupShow = false" @confirm="popupConfirm">
+			<view class="slot-content">
+				<view class="flex_base">
+					{{ labelModelInfo.title }}
+				</view>
+
+				<u-radio-group class="mt-40" v-model="labelValue" placement="row">
+					<u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in labelList" :key="index"
+						:label="item.name" :name="item.name" :activeColor="item.color" @change="radioChange(item)">
+					</u-radio>
+				</u-radio-group>
+
+				<u--textarea class="mt-40" v-model="remark" placeholder="请输入内容"></u--textarea>
+			</view>
+		</u-modal>
+	</view>
+</template>
+
+<script>
+	import uploadMixin from "@/mixin/uploadMixin";
+
+	import {
+		getLabelListByParentId
+	} from "@/api/label/label.js";
+	import {
+		getDetail
+	} from "@/api/doorplateAddress/doorplateAddress.js";
+	import {saveOrUpdateHouseholdLabel,removeHouseholdLabel} from "@/api/house/householdLabel.js"
+	import { getHouseholdDetail } from "@/api/house/household.js"
+
+	export default {
+		mixins: [uploadMixin],
+		data() {
+			return {
+				houseAddress:"",
+				houseInfo:{},
+				householdInfo:{},
+				houseCode:"",
+				popupShow: false,
+				labelBtnList: [],
+				// 安置房弹框中
+				labelList: [{
+						name: '撤销',
+						disabled: false,
+						color: '#EBEDF0'
+					},
+					{
+						name: '绿',
+						disabled: false,
+						color: '#07C160'
+					},
+					{
+						name: '黄',
+						disabled: false,
+						color: '#FF976A'
+					}, {
+						name: '红',
+						disabled: false,
+						color: '#EE0A24'
+					}
+				],
+				currentLabelInfo: {},
+				currentColorInfo: {},
+				labelModelInfo: {
+					title: '',
+					selectedColor: ''
+				},
+				labelValue: '',
+				remark: '',
+				// 标记
+				number:0
+			}
+		},
+		created() {
+		},
+		mounted() {
+		},
+		onLoad(option) {
+			const data = JSON.parse(option.data);
+			this.householdInfo = data;
+			this.houseCode = data.houseCode
+			this.getDoorPlateAddressDetail()
+		},
+		onShow() {
+			this.getLabelList()
+		},
+		methods: {
+			// 获取房屋详情
+			async getDoorPlateAddressDetail() {
+				const param = {
+					addressCode : this.houseCode
+				}
+				const res = await getDetail(param)
+				this.houseInfo = res.data
+				const aoiName = ( this.houseInfo.aoiName || this.houseInfo.subAoi)
+				const unitName = this.houseInfo.unitName == null ?"":this.houseInfo.unitName
+				this.houseAddress = aoiName + 
+				this.houseInfo.buildingName + unitName + this.houseInfo.houseName + "室"
+				
+			},
+			// 获取房屋标签信息
+			async getLabelList() {
+				const param = {
+					id : this.householdInfo.id
+				}
+				const res = await getHouseholdDetail(param)
+				this.householdInfo = res.data
+				const householdLabelList = this.householdInfo.householdLabelList
+				// 房屋标签处理
+				const labelParam = {
+					parentId:1000
+				}
+				const resLabel = await getLabelListByParentId(labelParam)
+				this.labelBtnList = resLabel.data
+				const labelChildAll = []
+				// 将细类放到一起
+				this.labelBtnList.forEach(e=>{
+					e.children.forEach(f=>{
+						labelChildAll.push(f)
+					})
+				})
+				if(householdLabelList.length>0){
+					labelChildAll.forEach(e=>{
+						householdLabelList.forEach(f=>{
+							if(Number(e.id) == f.labelId){
+								e['color'] = f.color
+								e['remark'] = f.remark
+							}
+						})
+					})
+				}
+			},
+			// 房屋弹窗
+			showLabelPopup(item) {
+				// 先清空
+				this.number = 0
+				this.labelValue = ""
+				this.remark = ""
+				this.popupShow = true
+				this.labelModelInfo.title = item.name
+				this.currentLabelInfo = item
+				// 遍历标签集合
+				this.labelList.forEach(e=>{
+					if(e.color == item.color){
+						this.labelValue = e.name
+						this.remark = item.remark
+						this.number = 1
+					}
+				})
+			},
+			popupConfirm() {
+				this.popupShow = false
+			},
+			radioChange(item) {
+				this.currentColorInfo = item
+			},
+			// 更新房屋标签
+			async popupConfirm() {
+				const {
+					id
+				} = this.currentLabelInfo
+				const {
+					color,
+					name
+				} = this.currentColorInfo
+				let res = null
+				if (name === '撤销') {
+					if(this.number==1){
+						const data = {
+							labelId:id,
+							householdId: this.householdInfo.id
+						}
+						res = await removeHouseholdLabel(data)
+					}else{
+						uni.showToast({
+							title: "无可撤销项",
+							icon: "error",
+							duration: 1500
+						})
+						return
+					}
+				} else {
+					res = await saveOrUpdateHouseholdLabel({
+						householdId: this.householdInfo.id,
+						labelId: id,
+						remark:this.remark,
+						color
+					})
+				}
+				if (res.code !== 200) {
+					uni.showToast({
+						title: "修改失败",
+						icon: "error",
+						duration: 1500
+					})
+					return
+				}
+				// 刷新页面
+				this.getLabelList()
+				this.popupShow = false
+			},
+			
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.container {
+		position: relative;
+		width: 100%;
+		height: 100%;
+		display: flex;
+		flex-direction: column;
+		background: #F9F9FA;
+
+		.main {
+			position: relative;
+			height: 0;
+			flex: 1;
+			display: flex;
+			flex-direction: column;
+
+			.content {
+				height: 0;
+				flex: 1;
+				overflow-y: auto;
+				
+				.base{
+					padding-left: 20rpx;
+					background-color:#ffffff;
+					display: flex;
+					flex-direction: row;
+					align-items: center;
+					height: 90rpx;
+					font-size: 32rpx;
+					letter-spacing: 3rpx;
+					border-bottom: 1rpx solid #EBEDF0;
+				}
+				
+				.l {
+					height: 170rpx;
+					background-color: #ffffff;
+					align-items: center;
+				
+					.head-img {
+						margin-left: 20rpx;
+						width: 124rpx;
+						height: 124rpx;
+						background: #EBEDF0;
+						border-radius: 50%;
+					}
+				
+					.info {
+						margin-left: 20rpx;
+						font-size: 24rpx;
+				
+						&>view {
+							height: 56rpx;
+							line-height: 56rpx;
+						}
+					}
+				}
+
+				.basic-info {
+					.form-item {
+						background-color: #ffffff;
+						padding: 5rpx 20rpx;
+					}
+				}
+
+				.pic {
+					background-color: #ffffff;
+					padding: 40rpx 30rpx;
+				}
+
+				.label-btn-box {
+					display: flex;
+					flex-direction: row;
+					flex-wrap: wrap;
+					padding: 10rpx 0;
+					
+
+					&>view {
+						margin: 10rpx 10rpx;
+						
+						.u-button {
+							padding: 6rpx 8rpx;
+							border-width: 0 !important;
+							background-color: #EFEFF0;
+						}
+					}
+				}
+
+			}
+		}
+	}
+</style>
\ No newline at end of file
diff --git a/subPackage/house/member/index.vue b/subPackage/house/member/index.vue
index 08e58ee..4c4a4c2 100644
--- a/subPackage/house/member/index.vue
+++ b/subPackage/house/member/index.vue
@@ -7,139 +7,141 @@
 						<box-title title="基础信息"></box-title>
 					</view>
 					<view class="event-info">
-						<u-form-item @click="showSelectBus(roleList, '角色', 'roleName')" class="form-item"
-							labelWidth="100" label="角色" required prop="type">
-							<u--input border="none" v-model="roleName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.roleList, '角色', 'roleTypeName','roleType')" class="form-item"
+							labelWidth="100" label="角色" required prop="roleType">
+							<u--input border="none" v-model="roleTypeName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item @click="showSelectBus(relationList, '角色关系', 'relationName')"
-							class="form-item" labelWidth="100" label="角色关系" required prop="type">
-							<u--input border="none" v-model="relationName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.relationshipList, '角色关系', 'relationshipName','relationship')"
+							class="form-item" labelWidth="100" label="角色关系" required prop="relationship">
+							<u--input border="none" v-model="relationshipName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="姓名" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="请输入">
+						<u-form-item class="form-item" labelWidth="100" label="姓名" required prop="name">
+							<u--input border="none" v-model="form.name" placeholder="请输入">
 							</u--input>
 						</u-form-item>
 
 
-						<u-form-item class="form-item" labelWidth="100" label="身份证" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="请输入">
+						<u-form-item class="form-item" labelWidth="100" label="身份证" prop="idCard">
+							<u--input border="none" v-model="form.idCard" placeholder="请输入">
 							</u--input>
 						</u-form-item>
 
-						<u-form-item @click="typeShow = true" class="form-item" labelWidth="100" label="性别" required
-							prop="type">
-							<u--input border="none" v-model="roleName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.genderList, '性别', 'genderName','gender')"
+						 class="form-item" labelWidth="100" label="性别" prop="gender">
+							<u--input border="none" v-model="genderName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="手机号码" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="请输入">
+						<u-form-item class="form-item" labelWidth="100" label="手机号码" prop="phoneNumber">
+							<u--input border="none" v-model="form.phoneNumber" placeholder="请输入">
 							</u--input>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="其他联系方式" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="请输入">
+						<u-form-item class="form-item" labelWidth="100" label="其他联系方式" prop="otherContact">
+							<u--input border="none" v-model="form.otherContact" placeholder="请输入">
 							</u--input>
 						</u-form-item>
 
-						<u-form-item @click="typeShow = true" class="form-item" labelWidth="100" label="是否主要联系人"
-							required prop="type">
-							<u--input border="none" v-model="roleName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.isPrimaryContactList, '是否主要联系人', 'isPrimaryContactName','isPrimaryContact')"
+						class="form-item" labelWidth="110" label="是否主要联系人"
+						 prop="isPrimaryContact">
+							<u--input border="none" v-model="isPrimaryContactName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item @click="typeShow = true" class="form-item" labelWidth="100" label="居住情况" required
-							prop="type">
-							<u--input border="none" v-model="roleName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.residentialStatusList, '居住情况', 'residentialStatusName','residentialStatus')"
+						class="form-item" labelWidth="100" label="居住情况"
+							prop="residentialStatus">
+							<u--input border="none" v-model="residentialStatusName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="港澳台通行证" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="请输入">
+						<u-form-item class="form-item" labelWidth="100" label="港澳台通行证"  prop="hkmtPass">
+							<u--input border="none" v-model="form.hkmtPass" placeholder="请输入">
 							</u--input>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="护照" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="请输入">
+						<u-form-item class="form-item" labelWidth="100" label="护照"  prop="passport">
+							<u--input border="none" v-model="form.passport" placeholder="请输入">
 							</u--input>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="现居住地" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="请输入">
+						<u-form-item class="form-item" labelWidth="100" label="现居住地"  prop="currentAddress">
+							<u--input border="none" v-model="form.currentAddress" placeholder="请输入">
 							</u--input>
 						</u-form-item>
 
-						<u-form-item @click="typeShow = true" class="form-item" labelWidth="100" label="民族" required
-							prop="type">
-							<u--input border="none" v-model="roleName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.ethnicityList, '民族', 'ethnicityName','ethnicity')"
+						class="form-item" labelWidth="100" label="民族" prop="ethnicity">
+							<u--input border="none" v-model="ethnicityName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item @click="typeShow = true" class="form-item" labelWidth="100" label="学历" required
-							prop="type">
-							<u--input border="none" v-model="roleName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.educationList, '学历', 'educationName','education')"
+						class="form-item" labelWidth="100" label="学历" prop="education">
+							<u--input border="none" v-model="educationName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item @click="typeShow = true" class="form-item" labelWidth="100" label="是否党员" required
-							prop="type">
-							<u--input border="none" v-model="roleName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.partyEmberList, '是否党员', 'partyEmberName','partyEmber')"
+						class="form-item" labelWidth="100" label="是否党员" prop="partyEmber">
+							<u--input border="none" v-model="partyEmberName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="工作单位" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="请输入">
+						<u-form-item class="form-item" labelWidth="100" label="工作单位" prop="employer">
+							<u--input border="none" v-model="form.employer" placeholder="请输入">
 							</u--input>
 						</u-form-item>
 
-						<u-form-item @click="typeShow = true" class="form-item" labelWidth="100" label="工作状态" required
-							prop="type">
-							<u--input border="none" v-model="roleName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.workStatusList, '工作状态', 'workStatusName','workStatus')"
+						class="form-item" labelWidth="100" label="工作状态" prop="workStatus">
+							<u--input border="none" v-model="workStatusName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item @click="typeShow = true" class="form-item" labelWidth="100" label="婚姻状态" required
-							prop="type">
-							<u--input border="none" v-model="roleName" disabled disabledColor="#ffffff"
+						<u-form-item @click="showSelectBus(dataList.maritalStatusList, '婚姻状态', 'maritalStatusName','maritalStatus')"
+						class="form-item" labelWidth="100" label="婚姻状态" prop="maritalStatus">
+							<u--input border="none" v-model="maritalStatusName" disabled disabledColor="#ffffff"
 								placeholder="请选择">
 							</u--input>
 							<u-icon slot="right" name="arrow-right"></u-icon>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="户籍登记地" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="请输入">
+						<u-form-item class="form-item" labelWidth="100" label="户籍登记地" prop="hukouRegistration">
+							<u--input border="none" v-model="form.hukouRegistration" placeholder="请输入">
 							</u--input>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="车牌号" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="多个用中划线(-)隔开">
+						<u-form-item class="form-item" labelWidth="100" label="车牌号" prop="cardNumber">
+							<u--input border="none" v-model="form.cardNumber" placeholder="多个用中划线(-)隔开">
 							</u--input>
 						</u-form-item>
 
-						<u-form-item class="form-item" labelWidth="100" label="备注" required prop="location">
-							<u--input border="none" v-model="form.location" placeholder="补充说明">
+						<u-form-item class="form-item" labelWidth="100" label="备注" prop="remark">
+							<u--input border="none" v-model="form.remark" placeholder="补充说明">
 							</u--input>
 						</u-form-item>
 					</view>
@@ -148,14 +150,13 @@
 
 			<view class="btn-group b-c-w">
 				<view>
-					<u-button @click="submit" type="primary" text="添加"></u-button>
+					<u-button @click="submit" type="primary" :text="addOrUpdateTitle" width="120px"></u-button>
 				</view>
 				<view>
 					<u-button @click="navigator" type="primary" :plain="true" text="返回首页"></u-button>
 				</view>
 			</view>
 		</view>
-
 
 		<!-- 事件类型下拉框 -->
 		<select-bus v-if="typeShow" :show="typeShow" v-model="form[selectBusModel]" type="radio"
@@ -167,6 +168,9 @@
 <script>
 	import selectBus from "@/components/my-components/selectBus.vue"
 	import uploadMixin from "@/mixin/uploadMixin";
+	import {
+		saveOrUpdateHousehold,removeHousehold
+	} from '@/api/house/household.js'
 	export default {
 		components: {
 			selectBus
@@ -174,109 +178,183 @@
 		mixins: [uploadMixin],
 		data() {
 			return {
-
+				addOrUpdateTitle:"添加",
+				houseCode:"",
 				form: {
 					roleName: "",
 					relationName: '',
 					location: "",
 					title: "",
+					roleType:null,
 					description: "",
 				},
-				rules: {},
-
+				rules: {
+					// roleType: [{
+					// 	required: true,
+					// 	message: '请选择角色'
+					// }],
+					name: [{
+						required: true,
+						message: '请填写姓名'
+					}],
+				},
 				typeShow: false,
-
 				roleName: "",
-				roleList: [{
-						value: 1,
-						name: '业主',
-					},
-					{
-						value: 2,
-						name: '出租户',
-					},
-					{
-						value: 3,
-						name: '空挂户',
-					},
-				],
-
-				relationName: '',
-				relationList: [{
-						value: 1,
-						name: '业主',
-					},
-					{
-						value: 2,
-						name: '妻子',
-					},
-					{
-						value: 3,
-						name: '丈夫',
-					},
-					{
-						value: 4,
-						name: '女儿',
-					},
-					{
-						value: 5,
-						name: '儿子',
-					},
-					{
-						value: 6,
-						name: '母亲',
-					},
-					{
-						value: 7,
-						name: '父亲',
-					},
-					{
-						value: 8,
-						name: '爷爷',
-					},
-					{
-						value: 9,
-						name: '女婿',
-					},
-					{
-						value: 10,
-						name: '孙子',
-					},
-					{
-						value: 11,
-						name: '孙女',
-					},
-					{
-						value: 12,
-						name: '外公',
-					},
-					{
-						value: 13,
-						name: '外婆',
-					},
-					{
-						value: 14,
-						name: '外孙女',
-					},
-					{
-						value: 15,
-						name: '外孙',
-					},
-					{
-						value: 16,
-						name: '儿媳',
-					},
-					{
-						value: 17,
-						name: '租户',
-					},
-					{
-						value: 18,
-						name: '其他',
-					},
-				],
-
-
+				dataList: {
+					roleList: [{
+							value: "1",
+							name: '业主',
+						},
+						{
+							value: "2",
+							name: '出租户',
+						},
+						{
+							value: "3",
+							name: '空挂户',
+						},
+					],
+					relationshipList: [{
+							value: 1,
+							name: '业主',
+						},
+						{
+							value: 2,
+							name: '妻子',
+						},
+						{
+							value: 3,
+							name: '丈夫',
+						},
+						{
+							value: 4,
+							name: '女儿',
+						},
+						{
+							value: 5,
+							name: '儿子',
+						},
+						{
+							value: 6,
+							name: '母亲',
+						},
+						{
+							value: 7,
+							name: '父亲',
+						},
+						{
+							value: 8,
+							name: '爷爷',
+						},
+						{
+							value: 9,
+							name: '女婿',
+						},
+						{
+							value: 10,
+							name: '孙子',
+						},
+						{
+							value: 11,
+							name: '孙女',
+						},
+						{
+							value: 12,
+							name: '外公',
+						},
+						{
+							value: 13,
+							name: '外婆',
+						},
+						{
+							value: 14,
+							name: '外孙女',
+						},
+						{
+							value: 15,
+							name: '外孙',
+						},
+						{
+							value: 16,
+							name: '儿媳',
+						},
+						{
+							value: 17,
+							name: '租户',
+						},
+						{
+							value: 18,
+							name: '其他',
+						},
+					],
+					genderList:[
+						{
+							value: 1,
+							name: '男',
+						},
+						{
+							value: 0,
+							name: '女',
+						},
+						{
+							value: 2,
+							name: '未知',
+						}
+					],
+					isPrimaryContactList:[
+						{
+							value: 1,
+							name: '是',
+						},
+						{
+							value: 0,
+							name: '否',
+						}
+					],
+					residentialStatusList:[
+						{
+							value: 1,
+							name: '是',
+						},
+						{
+							value: 0,
+							name: '否',
+						}
+					],
+					ethnicityList:[
+						
+					],
+					educationList:[
+						
+					],
+					partyEmberList:[
+						{
+							value: 1,
+							name: '是',
+						},
+						{
+							value: 2,
+							name: '否',
+						}
+					],
+					workStatusList:[
+						
+					],
+					maritalStatusList:[
+						
+					]
+				},
+				roleTypeName: '',
+				relationshipName: '',
+				genderName: '',
+				residentialStatusName:"",
+				isPrimaryContactName: '',
+				ethnicityName: '',
+				educationName: '',
+				partyEmberName: '',
+				workStatusName: '',
+				maritalStatusName: '',
+				// 下拉变量
 				selectBusList: [],
 				selectBusVal: '',
 				selectBusTitle: '',
@@ -287,36 +365,105 @@
 			this.getHeader()
 		},
 		mounted() {
-
 		},
 		onLoad(option) {
-
+			const data = JSON.parse(option.data)
+			this.houseCode = data.houseCode
+			if(data.type == 2){
+				this.addOrUpdateTitle = "保存"
+			}
+			if(data.type == 2){
+				this.addOrUpdateTitle = "修改"
+				this.getHouseholdInfo(data)
+			}
 		},
 		onShow() {
-
 		},
 		methods: {
+			// 获取住户信息
+			getHouseholdInfo(data){
+				this.form = data
+				this.roleTypeName = this.findObjValue(data.roleType, this.dataList.roleList)
+				this.relationshipName = this.findObjValue(data.relationship, this.dataList.relationshipList)
+				this.genderName = this.findObjValue(data.gender, this.dataList.genderList)
+				this.isPrimaryContactName = this.findObjValue(data.isPrimaryContact, this.dataList.isPrimaryContactList)
+				this.ethnicityName = this.findObjValue(data.ethnicity, this.dataList.ethnicityList)
+				this.educationName = this.findObjValue(data.education, this.dataList.educationList)
+				this.partyEmberName = this.findObjValue(data.partyEmber, this.dataList.partyEmberList)
+				this.workStatusName = this.findObjValue(data.workStatus, this.dataList.workStatusList)
+				this.maritalStatusName = this.findObjValue(data.maritalStatus, this.dataList.maritalStatusList)
+			},
 			// 显示选择弹框
-			showSelectBus(data, title, model) {
+			showSelectBus(data, title, model, key) {
 				this.selectBusList = data
 				this.selectBusTitle = title
 				this.selectBusModel = model
+				this.selectBusKey = key
 				this.typeShow = true
 			},
-
 			//类型选择确认
 			typeSelect(item) {
 				this[this.selectBusModel] = item.name
 				this.form[this.selectBusModel] = item.value
 				this.typeShow = !this.typeShow
 			},
-
 			//表单提交
 			submit() {
-
+				this.$refs.form.validate().then(res => {
+					this.saveOrUpdate();
+				})
 			},
+			// 新增更新操作
+			async saveOrUpdate() {
+				this.form['houseCode'] = this.houseCode
+				// 字典解析
+				const roleTypeIndex = this.dataList.roleList.findIndex(item => item.name === this.roleTypeName)
+				const relationshipIndex = this.dataList.relationshipList.findIndex(item => item.name === this.relationshipName)
+				const genderIndex = this.dataList.genderList.findIndex(item => item.name === this.genderName)
+				const isPrimaryContactIndex = this.dataList.isPrimaryContactList.findIndex(item => item.name === this.isPrimaryContactName)
+				const ethnicityIndex = this.dataList.ethnicityList.findIndex(item => item.name === this.ethnicityName)
+				const educationIndex = this.dataList.educationList.findIndex(item => item.name === this.educationName)
+				const partyEmberIndex = this.dataList.partyEmberList.findIndex(item => item.name === this.partyEmberName)
+				const workStatusIndex = this.dataList.workStatusList.findIndex(item => item.name === this.workStatusName)
+				const maritalStatusIndex = this.dataList.maritalStatusList.findIndex(item => item.name === this.maritalStatusName)
+				
+				this.form['roleType'] = roleTypeIndex >0 ? this.dataList.roleList[roleTypeIndex].value : ""
+				this.form['relationship'] = relationshipIndex >0 ? this.dataList.relationshipList[relationshipIndex].value: ""
+				this.form['gender'] = genderIndex >0 ?this.dataList.genderList[genderIndex].value: ""
+				this.form['isPrimaryContact'] = isPrimaryContactIndex >0 ?this.dataList.isPrimaryContactList[isPrimaryContactIndex].value: ""
+				this.form['ethnicity'] = ethnicityIndex >0 ?this.dataList.ethnicityList[ethnicityIndex].value: ""
+				this.form['education'] = educationIndex >0 ?this.dataList.educationList[educationIndex].value: ""
+				this.form['partyEmber'] = partyEmberIndex >0 ?this.dataList.partyEmberList[partyEmberIndex].value:""
+				this.form['workStatus'] = workStatusIndex >0 ?this.dataList.workStatusList[workStatusIndex].value:""
+				this.form['maritalStatus'] = maritalStatusIndex >0 ?this.dataList.maritalStatusList[maritalStatusIndex].value:""
 
-			//跳转到报事列表
+				const res = await saveOrUpdateHousehold(this.form)
+				if (res.code !== 200) {
+					uni.showToast({
+						title: "保存失败",
+						icon: "error",
+						duration: 1500
+					})
+					return
+				}
+				uni.showToast({
+					title: "保存成功",
+					icon: "success",
+					duration: 1500,
+					success: () => {
+						setTimeout(() => {
+							uni.navigateBack()
+						}, 1500)
+					}
+				})
+			},
+			findObjValue(value, obj) {
+				const res = obj.find(item => {
+					return item.value == value
+				})
+				return res.name
+			},
+			// 跳转到首页
 			navigator() {
 				this.$u.func.globalNavigator("/subPackage/bs/views/bsList")
 			},
@@ -357,14 +504,16 @@
 		}
 
 		.box-title {
-			padding: 10px 0;
+			padding: 10px 10px;
 		}
 
 		.event-info {
+			// background-color: #ffffff;
+			padding: 20rpx;
 
 			.form-item {
 				background-color: #ffffff;
-				padding: 5px 10px;
+				padding: 5px 20px;
 				border-bottom: 1px solid #eff1f3;
 			}
 
diff --git a/subPackage/house/roomControl/index.vue b/subPackage/house/roomControl/index.vue
index 669e675..0a74378 100644
--- a/subPackage/house/roomControl/index.vue
+++ b/subPackage/house/roomControl/index.vue
@@ -200,12 +200,12 @@
 						})
 					}
 					// 房屋标签处理
+					const paramLabel = {
+						parentId:1001
+					}
+					const resLabel = await getLabelListByParentId(paramLabel)
+					this.labelBtnList = resLabel.data
 					if(houseLabelVOList.length>0){
-						const param = {
-							parentId:1001
-						}
-						const res = await getLabelListByParentId(param)
-						this.labelBtnList = res.data
 						that.labelBtnList.forEach(e=>{
 							houseLabelVOList.forEach(f=>{
 								if(Number(e.id) == f.labelId){
diff --git a/subPackage/house/roomDetails/index.vue b/subPackage/house/roomDetails/index.vue
index 3f51dee..cf08474 100644
--- a/subPackage/house/roomDetails/index.vue
+++ b/subPackage/house/roomDetails/index.vue
@@ -42,10 +42,12 @@
 						</view>
 						<view class="r flex f-d-c j-c-s-a">
 							<view>
-								<u-button size='small' type="primary" :plain="true" text="资料管理"></u-button>
+								<u-button size='small' type="primary" :plain="true" text="资料管理" 
+								@click="addOrupdateMember(2,item)"></u-button>
 							</view>
 							<view>
-								<u-button size='small' type="primary" :plain="true" text="标签管理"></u-button>
+								<u-button size='small' type="primary" :plain="true" text="标签管理" 
+								@click="goToHouseholdLabel(item)"></u-button>
 							</view>
 						</view>
 					</view>
@@ -55,10 +57,13 @@
 							<u-icon name="photo"></u-icon>
 						</view>
 						<view class="r">
-							<u-icon name="trash-fill" color="red"></u-icon>
+							<u-icon name="trash-fill" color="red" @click="removeHouseholdSub(item)"></u-icon>
 						</view>
 					</view>
+
 				</view>
+				<u-modal :show="isHouseholdModelShow" width="auto" :showCancelButton="true" title="提示" content="请确认是否删除当前住户信息"
+					@cancel="isHouseholdModelShow = false" @confirm="deleteHousehold()"></u-modal>
 
 				<view class="mt-20 rent-out-box">
 					<box-title :title="'出租管理'"></box-title>
@@ -101,7 +106,7 @@
 
 			<view class="edit-btn">
 				<view>
-					<u-button type="primary" text="添加成员" @click="addMember"></u-button>
+					<u-button type="primary" text="添加成员" @click="addOrupdateMember(1,{})"></u-button>
 				</view>
 
 				<view>
@@ -121,11 +126,16 @@
 		deleteRentalInfo,
 		updateDueTime
 	} from "@/api/houseRental/houseRental.js";
+	import {
+		removeHousehold
+	} from '@/api/house/household.js'
 	export default {
 		components: {},
 
 		data() {
 			return {
+				householdId:'',
+				isHouseholdModelShow:false,
 				currentId: '',
 				houseCode: '',
 				houseInfo: {
@@ -170,6 +180,34 @@
 		},
 
 		methods: {
+			// 跳转住户标签管理页面
+			goToHouseholdLabel(data){
+				data['houseCode'] = this.houseCode
+				var navData = JSON.stringify(data);
+				this.$u.func.globalNavigator(`/subPackage/house/member/householdLabel?data=${navData}`)
+			},
+			// 删除住户弹出
+			removeHouseholdSub(data){
+				this.householdId = data.id
+				this.isHouseholdModelShow = true
+			},
+			// 删除住户信息
+			deleteHousehold(){
+				removeHousehold(this.householdId).then(res=>{
+					const {code,data}  = res
+					if (code !== 200) {
+						uni.showToast({
+							title: "删除失败",
+							icon: "error",
+							duration: 1500
+						})
+						return
+					}
+					this.isHouseholdModelShow = false
+					this.getHouseRentInfoList()
+				})
+			},
+			// 获取租户信息
 			async getHouseRentInfoList() {
 				const res = await getHouseRentInfo(this.currentId)
 				if (res.code !== 200) {
@@ -217,9 +255,18 @@
 			addRental() {
 				const url = `/subPackage/bs/views/rentDetail?houseCode=${this.houseCode}`
 				this.$u.func.globalNavigator(url, "navTo")
-			},
-			addMember() {
-				this.$u.func.globalNavigator('/subPackage/house/member/index')
+			},
+			// 用户资料管理页面跳转  1:新增 2:修改
+			addOrupdateMember(type,data={}) {
+				if(type==1){
+					data['type'] = 1
+					data['houseCode'] = this.houseCode
+				}
+				if(type==2){
+					data['type'] = 2
+				}
+				var navData = JSON.stringify(data); 
+				this.$u.func.globalNavigator(`/subPackage/house/member/index?data=${navData}`)
 			},
 			editRent(item) {
 				const { houseCode, id } = item

--
Gitblit v1.9.3