房屋详情,单元变更

This commit is contained in:
Zy
2026-05-21 14:13:28 +08:00
parent 9645412534
commit 38274ab612
68 changed files with 1867 additions and 568 deletions

View File

@@ -1,46 +1,67 @@
<template>
<slot name="default" />
<el-dialog append-to-body v-model="dialog.dialogVisible" :title="dialog.dialogTitle" width="1050">
<el-dialog append-to-body v-model="dialog.dialogVisible" :title="dialog.dialogTitle" width="1250">
<nav class="flex flex-items-center mb-8">
<div class="flex flex-items-center">
<!-- <div class="flex flex-items-center">
<div style="width: 70px; text-align: right; padding-right: 10px">房屋类型</div>
<div class="flex-1">
<el-select @change="handleChangeHouse" style="width: 140px" v-model="queryParams.buildingUse">
<el-option v-for="(item, index) in com_build_use" :key="index" :label="item.label" :value="item.value"></el-option>
<el-select @change="handleChangeHouse" style="width: 140px" v-model="queryParams.houseUseTypeId">
<el-option v-for="(item, index) in houseUseTypeList" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
</div> -->
<div class="flex flex-items-center">
<div style="width: 60px; text-align: right; padding-right: 10px">楼栋</div>
<div style="width: 50px; text-align: right; padding-right: 10px">楼栋</div>
<div class="flex-1"></div>
<el-select @change="handleChangebuilding" style="width: 140px" v-model="queryParams.buildingId">
<el-select @change="handleChangebuilding" clearable style="width: 140px" v-model="queryParams.buildingId">
<el-option v-for="(item, index) in buildinglist" :key="index" :label="item.buildingName" :value="item.id"></el-option>
</el-select>
</div>
<div class="flex flex-items-center mr-20px">
<div style="width: 60px; text-align: right; padding-right: 10px">单元</div>
<div style="width: 50px; text-align: right; padding-right: 10px">单元</div>
<div class="flex-1">
<el-select style="width: 140px" v-model="queryParams.unitNo">
<el-option v-for="(item, index) in unitlist" :key="index" :label="`${item.unitNo}单元`" :value="item.unitNo"></el-option>
<el-select @change="handleChangeUnit" clearable style="width: 140px" v-model="queryParams.unitNoId">
<el-option v-for="(item, index) in unitlist" :key="index" :label="item.unitNoName" :value="item.unitNoId"></el-option>
</el-select>
</div>
</div>
<div class="flex flex-items-center mr-20px">
<div style="width: 80px; text-align: right; padding-right: 10px">房屋类型</div>
<div class="flex-1">
<el-select clearable @change="handleHouseUseChange" style="width: 140px" v-model="queryParams.houseUseTypeId">
<el-option v-for="(item, index) in houseUseTypeList" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="flex flex-items-center mr-20px">
<div style="width: 80px; text-align: right; padding-right: 10px">业主名称</div>
<div class="flex-1">
<el-input clearable @clear="handleClear" v-model="queryParams.residentName" placeholder="查找业主"></el-input>
</div>
</div>
<div>
<el-button type="primary" @click="getlist">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</div>
</nav>
<el-table @row-click="handleRowClick" ref="multipleTableRef" :data="tableData" border @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
@row-click="handleRowClick"
ref="multipleTableRef"
:data="tableData"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" width="55" type="index" />
<el-table-column label="小区" align="center" prop="villageName" />
<el-table-column label="楼栋" align="center" prop="buildingName" />
<el-table-column label="单元" align="center" prop="unitNo" />
<el-table-column label="单元" align="center" prop="unitNoName" />
<el-table-column label="房间" align="center" prop="houseNo" />
<el-table-column label="业主" align="center">
<template #default="scope">
<span>{{ scope.row.userName ? scope.row.userName : '---' }}</span>
<span>{{ scope.row.residentName ? scope.row.residentName : '---' }}</span>
</template>
</el-table-column>
</el-table>
@@ -66,18 +87,15 @@
<script setup lang="ts">
import { getBuildinglistAPI, getBuildingOnly, getHouselistAPI } from '@/api/system/house';
import { listHouseUseType } from '@/api/system/houseUse';
import { BillHouse, listBillHouse } from '@/api/system/SdbBill';
import { ref, watch, nextTick, getCurrentInstance, ComponentInternalInstance, toRefs } from 'vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
const { com_build_use } = toRefs<any>(proxy?.useDict('com_build_use'));
// const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
// const { com_build_use } = toRefs<any>(proxy?.useDict('com_build_use'));
const props = defineProps({
userid: {
type: String,
default: ''
},
returnvalue: {
type: String,
default: 'houseId'
@@ -93,7 +111,9 @@ const props = defineProps({
}
});
const { userid, titleName, returnvalue } = toRefs(props);
const { titleName, returnvalue } = toRefs(props);
const showids = ref([]);
// ✅ 手动设置默认值(替代 withDefaults
const emit = defineEmits<{
@@ -108,9 +128,11 @@ const dialog = ref({
const queryParams = ref({
pageNum: 1,
pageSize: 10,
buildingUse: null,
// houseUseTypeId: null,
buildingId: null,
unitNo: null
unitNoId: null,
houseUseTypeId: null,
residentName: ''
});
const multipleTableRef = ref();
@@ -125,13 +147,12 @@ const isMultiple = computed(() => props.isMultiple ?? false);
// 优化 handleUserSelection避免重复查找
const handleUserSelection = () => {
if (!userid.value || !tableData.value.length) return;
if (!tableData.value.length) return;
multipleSelection.value = [];
if (userid.value.trim() !== '') {
const arr = userid.value.split(',');
if (showids.value.length > 0) {
const arr = showids.value;
arr.forEach((item) => {
const target = tableData.value.find((row) => row.userId == item);
const target = tableData.value.find((row) => row.houseId == item);
target && multipleSelection.value.push(target);
});
nextTick(() => {
@@ -146,7 +167,7 @@ const handleUserSelection = () => {
};
// ====================== 方法 ======================
const houseUseTypeList = ref([]);
// 获取列表
function getlist() {
loading.value = true;
@@ -157,7 +178,7 @@ function getlist() {
handleUserSelection();
})
.catch((error) => {
console.error('获取用户列表失败:', error);
console.error('获取列表失败:', error);
})
.finally(() => {
loading.value = false;
@@ -169,17 +190,35 @@ const buildinglist = ref([]);
/** 房屋列表 */
const unitlist = ref([]);
/** 筛选房屋类型 */
function handleChangeHouse(val: string) {
getBuildinglistAPI(val).then((res) => {
/** 获取楼栋 列表 */
function handleChangeHouse() {
getBuildinglistAPI().then((res) => {
buildinglist.value = res.data;
});
}
function handleClear() {
queryParams.value.residentName = '';
getlist();
}
function handleHouseUseChange() {
getlist();
}
/** 单元列表 */
function handleChangebuilding(val: string) {
getHouselistAPI(val).then((res) => {
unitlist.value = res.data.units;
});
queryParams.value.unitNoId = null;
unitlist.value = [];
if (queryParams.value.buildingId) {
getHouselistAPI(val).then((res) => {
unitlist.value = res.data.units;
getlist();
});
}
getlist();
}
function handleChangeUnit() {
getlist();
}
// ==============================================
@@ -221,9 +260,10 @@ function resetQuery() {
queryParams.value = {
pageNum: 1,
pageSize: 10,
buildingUse: null,
houseUseTypeId: null,
buildingId: null,
unitNo: null
unitNoId: null,
residentName: ''
};
getlist();
}
@@ -267,9 +307,18 @@ function confirm() {
}
defineExpose({
open: () => {
open: (showidArray: string[] = []) => {
showids.value = showidArray;
getlist();
dialog.value.dialogVisible = true;
listHouseUseType({
pageNum: 1,
pageSize: 99999
}).then((res) => {
houseUseTypeList.value = res.rows;
});
handleChangeHouse();
}
});
</script>