房屋详情,单元变更
This commit is contained in:
@@ -12,11 +12,11 @@
|
||||
<el-form-item label="楼栋名称" prop="buildingName">
|
||||
<el-input v-model.trim="form.buildingName" placeholder="请输入楼栋名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼栋类型" prop="buildingUse">
|
||||
<!-- <el-form-item label="楼栋类型" prop="buildingUse">
|
||||
<el-select v-model="form.buildingUse" placeholder="选择楼栋类型">
|
||||
<el-option v-for="(item, index) in com_build_use" :key="index" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="楼栋朝向" prop="buildToward">
|
||||
<el-input v-model.trim="form.buildToward" placeholder="请输入楼栋朝向" />
|
||||
</el-form-item>
|
||||
@@ -26,9 +26,9 @@
|
||||
<el-form-item label="楼栋结构" prop="buildStructure">
|
||||
<el-input v-model.trim="form.buildStructure" placeholder="请输入楼栋结构" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单元数" prop="unitCount">
|
||||
<!-- <el-form-item label="单元数" prop="unitCount">
|
||||
<el-input-number :min="1" v-model.trim="form.unitCount" placeholder="单元数" />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="楼层" prop="floorCount">
|
||||
<el-input-number :min="1" v-model.trim="form.floorCount" placeholder="楼层数" />
|
||||
</el-form-item>
|
||||
@@ -61,14 +61,14 @@ const form = ref({
|
||||
buildingName: '',
|
||||
buildToward: '',
|
||||
buildTall: '',
|
||||
buildingUse: '0',
|
||||
// buildingUse: '0',
|
||||
buildStructure: '',
|
||||
unitCount: null,
|
||||
floorCount: null
|
||||
// unitCount: null,
|
||||
floorCount: 1
|
||||
});
|
||||
const rules = ref({
|
||||
buildingName: [{ required: true, message: '请输入楼栋名称', trigger: 'blur' }],
|
||||
buildingUse: [{ required: true, message: '请选择楼栋类型', trigger: 'blur' }],
|
||||
// buildingUse: [{ required: true, message: '请选择楼栋类型', trigger: 'blur' }],
|
||||
unitCount: [{ required: true, message: '请输入单元数', trigger: 'blur' }],
|
||||
floorCount: [{ required: true, message: '请输入楼层数', trigger: 'blur' }]
|
||||
});
|
||||
@@ -85,10 +85,10 @@ function getBuildingById() {
|
||||
if (item.id == buildingId) {
|
||||
form.value.buildingName = item.buildingName;
|
||||
form.value.buildToward = item.buildToward;
|
||||
form.value.buildingUse = item.buildingUse;
|
||||
// form.value.buildingUse = item.buildingUse;
|
||||
form.value.buildTall = item.buildTall;
|
||||
form.value.buildStructure = item.buildStructure;
|
||||
form.value.unitCount = item.unitCount;
|
||||
// form.value.unitCount = item.unitCount;
|
||||
form.value.floorCount = item.floorCount;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -10,9 +10,14 @@
|
||||
<el-option v-for="item in houseStore.currentBuildingInfoList" :key="item.id" :label="item.buildingName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单元" prop="unit">
|
||||
<el-select @change="changeUnitNo" v-model.number="form.unitNo" placeholder="请选择">
|
||||
<el-option v-for="item in units" :key="item.no" :label="item.name" :value="item.no" />
|
||||
<el-form-item label="房屋用途" prop="houseUseTypeId">
|
||||
<el-select v-model="form.houseUseTypeId" placeholder="请选择">
|
||||
<el-option v-for="item in houseUseTypeList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单元" prop="unitNoId">
|
||||
<el-select @change="changeUnitNo" v-model="form.unitNoId" placeholder="请选择">
|
||||
<el-option v-for="item in units" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="楼层" prop="floor">
|
||||
@@ -20,6 +25,7 @@
|
||||
<el-option v-for="item in floors" :key="item.no" :label="item.name" :value="item.no" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="房间号" prop="houseNo">
|
||||
<el-input v-model="form.houseNo" placeholder="请输入房间号" />
|
||||
</el-form-item>
|
||||
@@ -51,7 +57,7 @@
|
||||
<span>卫</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="车位号" prop="parkingId">
|
||||
<!-- <el-form-item label="车位号" prop="parkingId">
|
||||
<el-select v-model="form.parkingId" class="m-2" placeholder="请选择车位号">
|
||||
<el-option v-for="item in parkinglist" :key="item.id" :label="item.parkingName" :value="item.id" />
|
||||
</el-select>
|
||||
@@ -60,7 +66,7 @@
|
||||
<el-select v-model="form.storeroomId" class="m-2" placeholder="请选择储藏室">
|
||||
<el-option v-for="item in storeRoomlist" :key="item.id" :label="item.storeroomName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item style="margin-top: 30px">
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
<el-button @click="cancelForm">取消</el-button>
|
||||
@@ -79,6 +85,11 @@ import { addHouseAPI, EditHouseApi, getBuildingOnly, getHouseApi, getHouselistAP
|
||||
import { addHouseType } from '@/api/system/house/type';
|
||||
import { GetVillageListParking, listParking } from '@/api/system/parking';
|
||||
import { GetVillagelistStoreroom, listStoreroom } from '@/api/system/storeroom';
|
||||
import { listHouseUseType } from '@/api/system/houseUse';
|
||||
import { getByBUildingidtoUnitNo } from '@/api/system/houseUnit';
|
||||
|
||||
// const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
// const { com_build_use } = toRefs<any>(proxy?.useDict('com_build_use'));
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
@@ -86,7 +97,8 @@ const houseStore = useHouseStore();
|
||||
const formRef = ref();
|
||||
const form = ref<addHouseType>({
|
||||
buildingId: '',
|
||||
unitNo: '',
|
||||
houseUseTypeId: '', // 房屋用途
|
||||
unitNoId: '',
|
||||
floorNo: '',
|
||||
houseNo: '', // 房间号
|
||||
houseArea: '', //建筑面积
|
||||
@@ -98,9 +110,9 @@ const form = ref<addHouseType>({
|
||||
});
|
||||
const rules = ref({
|
||||
buildingId: [{ required: true, message: '请输入楼栋', trigger: 'blur' }],
|
||||
unitNo: [{ required: true, message: '请选择单元', trigger: 'blur' }],
|
||||
unitNoId: [{ required: true, message: '请选择单元', trigger: 'blur' }],
|
||||
floorNo: [{ required: true, message: '请选择楼层', trigger: 'blur' }],
|
||||
houseUse: [{ required: true, message: '请选择房屋类型', trigger: 'blur' }],
|
||||
houseUseTypeId: [{ required: true, message: '请选择房屋用途', trigger: 'blur' }],
|
||||
buildingName: [{ required: true, message: '请输入房间号', trigger: 'blur' }],
|
||||
buildingArea: [{ required: true, message: '请输入建筑面积', trigger: 'blur' }],
|
||||
internalFloorArea: [{ required: true, message: '请输入套内面积', trigger: 'blur' }],
|
||||
@@ -121,72 +133,94 @@ const queryChangestore = ref({
|
||||
// buildingId
|
||||
buildingId: null,
|
||||
// unitno,
|
||||
unitNo: null
|
||||
unitNoId: null
|
||||
});
|
||||
// TODO 回显 车位,储藏, 以为后端筛选完出没人的房屋
|
||||
const villageid = localStorage.getItem('villageid');
|
||||
async function init() {
|
||||
const res = await GetVillageListParking(villageid);
|
||||
parkinglist.value = res.data;
|
||||
const res1 = await GetVillagelistStoreroom({
|
||||
...queryChangestore.value,
|
||||
villageid: villageid
|
||||
});
|
||||
storeRoomlist.value = res1.data;
|
||||
nextTick(() => geteditinfo());
|
||||
}
|
||||
init();
|
||||
|
||||
function geteditinfo() {
|
||||
const houseUseTypeList = ref([]);
|
||||
async function geteditinfo() {
|
||||
listHouseUseType({
|
||||
pageNum: 1,
|
||||
pageSize: 99999
|
||||
}).then((res) => {
|
||||
houseUseTypeList.value = res.rows;
|
||||
});
|
||||
if (route.query.id) {
|
||||
houseid.value = route.query.id;
|
||||
// const res = await GetVillageListParking(villageid, houseid.value);
|
||||
// parkinglist.value = res.data;
|
||||
// GetVillagelistStoreroom({
|
||||
// ...queryChangestore.value,
|
||||
// villageid: villageid,
|
||||
// houseId: houseid.value
|
||||
// }).then((res1) => {
|
||||
// storeRoomlist.value = res1.data;
|
||||
// });
|
||||
getHouseApi(houseid.value).then((res) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
buildingId: res.data.buildingId, // 楼栋id
|
||||
houseId: res.data.houseId, // 房屋id
|
||||
unitNo: res.data.unitNo,
|
||||
unitNoId: res.data.unitNoId,
|
||||
floorNo: res.data.floorNo,
|
||||
houseNo: res.data.houseNo, // 房间号
|
||||
houseArea: res.data.houseArea, //建筑面积
|
||||
internalArea: res.data.internalArea, //套内面积
|
||||
storeroomId: res.data.storeroomId, //储藏室
|
||||
parkingId: res.data.parkingId, //车位
|
||||
houseUseTypeId: res.data.houseUseTypeId,
|
||||
shareArea: res.data.shareArea // 公摊面积
|
||||
};
|
||||
housetype.value = res.data.houseType.split('');
|
||||
// handlechangeBuild(form.value.buildingId);
|
||||
console.log(housetype.value);
|
||||
changeBuild(res.data.buildingId);
|
||||
});
|
||||
} else {
|
||||
// const res = await GetVillageListParking(villageid);
|
||||
// parkinglist.value = res.data;
|
||||
// const res1 = await GetVillagelistStoreroom({
|
||||
// ...queryChangestore.value,
|
||||
// villageid: villageid
|
||||
// });
|
||||
// storeRoomlist.value = res1.data;
|
||||
}
|
||||
}
|
||||
// 选择楼栋
|
||||
function handlechangeBuild(id: string) {
|
||||
queryChangestore.value.buildingId = id;
|
||||
form.value.unitNo = '';
|
||||
form.value.unitNoId = '';
|
||||
form.value.floorNo = '';
|
||||
getBuildingOnly(id).then((res) => {
|
||||
units.value = Array.from({ length: res.data.unitCount }).map((_, index) => {
|
||||
return {
|
||||
no: index + 1,
|
||||
name: index + 1 + '单元'
|
||||
};
|
||||
});
|
||||
floors.value = Array.from({ length: res.data.floorCount }).map((_, index) => {
|
||||
|
||||
changeBuild(id);
|
||||
// getStoreRoomlist();
|
||||
}
|
||||
|
||||
function changeBuild(id: string) {
|
||||
const arr = houseStore.currentBuildingInfoList;
|
||||
const find = arr.find((item) => item.id === id);
|
||||
if (find) {
|
||||
floors.value = Array.from({ length: find.floorCount }).map((_, index) => {
|
||||
return {
|
||||
no: index + 1,
|
||||
name: index + 1 + '楼'
|
||||
};
|
||||
});
|
||||
}
|
||||
getByBUildingidtoUnitNo(id).then((res) => {
|
||||
units.value = res.data;
|
||||
});
|
||||
getStoreRoomlist();
|
||||
}
|
||||
|
||||
// change unit
|
||||
function changeUnitNo(id: number) {
|
||||
queryChangestore.value.unitNo = id;
|
||||
// change unitNoId
|
||||
function changeUnitNo(id: string) {
|
||||
queryChangestore.value.unitNoId = id;
|
||||
form.value.floorNo = '';
|
||||
getStoreRoomlist();
|
||||
// getStoreRoomlist();
|
||||
}
|
||||
|
||||
// 查询储藏室列表
|
||||
@@ -195,7 +229,7 @@ function getStoreRoomlist() {
|
||||
...queryChangestore.value,
|
||||
villageid: villageid
|
||||
}).then((res) => {
|
||||
form.value.storeroom = '';
|
||||
form.value.storeroomId = '';
|
||||
storeRoomlist.value = [];
|
||||
storeRoomlist.value = res.data;
|
||||
});
|
||||
@@ -231,9 +265,7 @@ const submitForm = () => {
|
||||
};
|
||||
const cancelForm = () => {
|
||||
formRef?.value.resetFields();
|
||||
router.push({
|
||||
path: '/house/houselist'
|
||||
});
|
||||
router.back();
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">
|
||||
<span>基本信息</span>
|
||||
<el-button type="primary" text @click="editHouse">编辑</el-button>
|
||||
<el-button v-hasPermi="['system:house:edit']" type="primary" text v-if="HouseInfo.house" @click="editHouse">编辑</el-button>
|
||||
</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<div class="addBuildingFormBody" v-if="HouseInfo.house">
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">房号:</div>
|
||||
<div class="value">{{ HouseInfo.house?.houseNo ?? '--' }}</div>
|
||||
@@ -21,7 +21,7 @@
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">单元:</div>
|
||||
<div class="value">{{ HouseInfo.house?.unitNo ?? '--' }} 单元</div>
|
||||
<div class="value">{{ HouseInfo.house?.unitNoName ?? '--' }} 单元</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">楼层:</div>
|
||||
@@ -29,11 +29,11 @@
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">建筑面积:</div>
|
||||
<div class="value">{{ HouseInfo.house?.houseArea ?? '--' }}㎡</div>
|
||||
<div class="value">{{ HouseInfo.house?.houseArea ? `${HouseInfo.house?.houseArea} ㎡` : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">公摊面积:</div>
|
||||
<div class="value">{{ HouseInfo.house?.shareArea ?? '--' }}㎡</div>
|
||||
<div class="value">{{ HouseInfo.house?.shareArea ? `${HouseInfo.house?.shareArea} ㎡` : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">户型:</div>
|
||||
@@ -44,14 +44,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="w-full h-full flex flex-center min-h-4rem">
|
||||
<span style="color: #999; font-weight: 500; font-size: 1.1rem; letter-spacing: 10px">暂无信息</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 储藏室信息 -->
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">
|
||||
<span>储藏室信息 </span>
|
||||
<el-button type="primary" text @click="editStoreRoom">编辑</el-button>
|
||||
<el-button v-hasPermi="['storeroom:storeroom:edit']" type="primary" text v-if="HouseInfo.storeroom" @click="editStoreRoom">编辑</el-button>
|
||||
</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<div class="addBuildingFormBody" v-if="HouseInfo.storeroom">
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">楼栋:</div>
|
||||
<div class="value">{{ HouseInfo.storeroom?.buildingName ?? '--' }}</div>
|
||||
@@ -81,53 +84,70 @@
|
||||
<div class="value"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="w-full h-full flex flex-center min-h-4rem">
|
||||
<span style="color: #999; font-weight: 500; font-size: 1.1rem; letter-spacing: 10px">暂无信息</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 车位信息 -->
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">
|
||||
<span>车位信息</span>
|
||||
<el-button type="primary" text @click="handleEditParking" v-if="HouseInfo.parking">编辑</el-button>
|
||||
<el-button v-hasPermi="['parking:parking:edit']" type="primary" text @click="handleEditParking" v-if="HouseInfo.parking">编辑</el-button>
|
||||
</div>
|
||||
<div class="addBuildingFormBody" v-if="HouseInfo.parking">
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">区域:</div>
|
||||
<div class="value">{{ HouseInfo.storeroom?.shareArea ?? '--' }}</div>
|
||||
<div class="value">{{ HouseInfo.parking?.areaName ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">车位编号:</div>
|
||||
<div class="value">18100000000</div>
|
||||
<div class="value">{{ HouseInfo.parking?.parkingCode ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">车位面积:</div>
|
||||
<div class="value">2栋</div>
|
||||
<div class="value">{{ HouseInfo.parking?.parkingArea ?? '--' }} ㎡</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">楼层:</div>
|
||||
<div class="value">2单元</div>
|
||||
<div class="value">{{ HouseInfo.parking?.parkingFloor ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">车位类型:</div>
|
||||
<div class="value">3楼</div>
|
||||
<div class="value">
|
||||
<dict-tag :options="com_parking_type" :value="HouseInfo.parking.type" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">车位状态:</div>
|
||||
<div class="value">112㎡</div>
|
||||
<div class="value">
|
||||
<dict-tag :options="com_parking_status" :value="HouseInfo.parking.parkingStatus" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">持有人:</div>
|
||||
<div class="value">12㎡</div>
|
||||
<div class="value">
|
||||
<span>{{ HouseInfo.parking?.residentName ?? '--' }}</span>
|
||||
<el-button
|
||||
v-hasPermi="['parking:parking:edit']"
|
||||
type="primary"
|
||||
text
|
||||
@click="handleEditUser(HouseInfo.parking.residentId)"
|
||||
v-if="HouseInfo.parking"
|
||||
>编辑</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">添加时间:</div>
|
||||
<div class="value">3室2厅2卫</div>
|
||||
<div class="value">{{ HouseInfo.parking?.createTime ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">添加人:</div>
|
||||
<div class="value">3室2厅2卫</div>
|
||||
<div class="value">{{ HouseInfo.parking?.createName ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">备注:</div>
|
||||
<div class="value"></div>
|
||||
<div class="value">{{ HouseInfo.parking?.remark ?? '--' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="w-full h-full flex flex-center min-h-4rem">
|
||||
@@ -210,32 +230,12 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_resident_relationship } = toRefs<any>(proxy?.useDict('com_resident_relationship'));
|
||||
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
|
||||
const { com_pay_status } = toRefs<any>(proxy?.useDict('com_pay_status'));
|
||||
const tableData = [
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
},
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
}
|
||||
];
|
||||
const { com_parking_type } = toRefs<any>(proxy?.useDict('com_parking_type'));
|
||||
const { com_parking_status } = toRefs<any>(proxy?.useDict('com_parking_status'));
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const routeid = ref('');
|
||||
|
||||
const HouseInfo = ref<Data>({
|
||||
billResidentList: [],
|
||||
chargeItemList: [],
|
||||
@@ -262,12 +262,20 @@ function editStoreRoom() {
|
||||
}
|
||||
function handleEditParking() {
|
||||
router.push({
|
||||
path: '/house/editParking',
|
||||
path: '/carArea/editParking',
|
||||
query: {
|
||||
id: HouseInfo.value.parking.parkingId
|
||||
}
|
||||
});
|
||||
}
|
||||
function handleEditUser(id: string) {
|
||||
router.push({
|
||||
path: '/house/editResident',
|
||||
query: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
}
|
||||
function init() {
|
||||
if (route.query.id) {
|
||||
routeid.value = route.query.id as string;
|
||||
|
||||
@@ -44,13 +44,14 @@ const handleCalp = (event: MouseEvent, houseid: string) => {
|
||||
.house-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
max-height: 300px;
|
||||
gap: 10px;
|
||||
max-height: 400px;
|
||||
overflow: auto;
|
||||
justify-content: space-evenly;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.house {
|
||||
width: 100px;
|
||||
min-width: 100px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border: 1px solid #ddd;
|
||||
|
||||
@@ -1,25 +1,32 @@
|
||||
<template>
|
||||
<div class="TableBox p-5 h-full" v-if="houseStore.currentHouseInfoList !== null">
|
||||
<el-checkbox-group @change="handleChangeCheckhouses" v-model="houseStore.checkoutHouses">
|
||||
<el-table border :data="houseStore.currentFloorInfoList">
|
||||
<el-table-column align="center" fixed label="楼层\单元" max-width="100">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row }}楼</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
min-width="260"
|
||||
align="center"
|
||||
:label="`${unit.unitNo}单元`"
|
||||
v-for="(unit, index) in houseStore.currentHouseInfoList?.units.length > 0 ? houseStore.currentHouseInfoList?.units : []"
|
||||
:key="index"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<houseItem @contextmenufun="contextMenuFun" :menu-list="menutlist" :unit="unit.floors" :f-idx="row"></houseItem>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-checkbox-group>
|
||||
<div class="h-full">
|
||||
<div class="TableBox p-5 h-full" v-if="houseStore.currentHouseInfoList !== null">
|
||||
<el-checkbox-group @change="handleChangeCheckhouses" v-model="houseStore.checkoutHouses">
|
||||
<el-table border :data="houseStore.currentFloorInfoList">
|
||||
<el-table-column align="center" fixed label="楼层\单元" max-width="100">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row }}楼</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
min-width="260"
|
||||
align="center"
|
||||
v-for="(unit, index) in houseStore.currentHouseInfoList?.units.length > 0 ? houseStore.currentHouseInfoList?.units : []"
|
||||
:key="index"
|
||||
>
|
||||
<template #header>
|
||||
<span>{{ unit.unitNoName }}</span>
|
||||
<el-button link type="primary" icon="Edit" @click="HandleEditUnit(unit)"></el-button>
|
||||
<el-button link type="danger" icon="Delete" style="margin-left: 0" @click="HandleDeleteUnit(unit)"></el-button>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<houseItem @contextmenufun="contextMenuFun" :menu-list="menutlist" :unit="unit.floors" :f-idx="row"></houseItem>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<div v-else class="nodata">暂无房屋</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -32,6 +39,8 @@ import { checkPermi } from '@/utils/permission';
|
||||
const houseStore = useHouseStore();
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const emit = defineEmits(['editUnit', 'deleteUnit']);
|
||||
|
||||
const router = useRouter();
|
||||
const menutlist = [
|
||||
// { label: '编辑', value: 'edit' },
|
||||
@@ -85,6 +94,13 @@ function contextMenuFun(val: { type: string; value: string }) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function HandleEditUnit(unit) {
|
||||
emit('editUnit', unit.unitNoId);
|
||||
}
|
||||
function HandleDeleteUnit(unit) {
|
||||
emit('deleteUnit', unit.unitNoId);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -93,4 +109,11 @@ function contextMenuFun(val: { type: string; value: string }) {
|
||||
height: calc(100% - 500px);
|
||||
}
|
||||
}
|
||||
.nodata {
|
||||
font-size: 1.2rem;
|
||||
color: #ccc;
|
||||
letter-spacing: 2px;
|
||||
text-align: center;
|
||||
padding-top: 200px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -28,9 +28,20 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="rightActions flex flex-items-center">
|
||||
<span class="mr-20px" @click="handleAddUnit" v-hasPermi="['system:house:add']">+添加单元</span>
|
||||
<span class="mr-20px" @click="handleAddHouse" v-hasPermi="['system:house:add']">+增加房屋</span>
|
||||
<!-- <span class="mr-20px">收费标准设置</span> -->
|
||||
<span @click="deleteAllhouse" v-hasPermi="['system:house:remove']">删除</span>
|
||||
<el-select
|
||||
clearable
|
||||
@clear="handleClearUse"
|
||||
@change="handleChangeUse"
|
||||
v-model="houseUse"
|
||||
placeholder="筛选房屋类型"
|
||||
style="width: 180px; margin: 0 10px"
|
||||
>
|
||||
<el-option v-for="item in houseUseTypeList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
<div class="searchbox flex flex-items-center">
|
||||
<el-input v-model="housename" class="searchinput" placeholder="请输入房屋号"></el-input>
|
||||
<el-button style="margin-left: 10px" type="primary" @click="handleSearchHouse">搜索</el-button>
|
||||
@@ -39,8 +50,28 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="UnitBody">
|
||||
<TableUnit></TableUnit>
|
||||
<TableUnit @edit-unit="handleEditUnit" @delete-unit="handleDelete"></TableUnit>
|
||||
</div>
|
||||
<!-- 添加或修改单元对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="unitNoFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="单元名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入单元名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼栋" prop="buildingId">
|
||||
<!-- <el-input v-model="form.buildingId" placeholder="请输入楼栋" /> -->
|
||||
<el-select v-model="form.buildingId" placeholder="请选择">
|
||||
<el-option v-for="item in houseStore.currentBuildingInfoList" :key="item.id" :label="item.buildingName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -48,6 +79,9 @@
|
||||
import { deleteHouseApi } from '@/api/system/house';
|
||||
import TableUnit from './components/table.vue';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { listHouseUseType } from '@/api/system/houseUse';
|
||||
import { addUnitNo, delUnitNo, getUnitNo, updateUnitNo } from '@/api/system/houseUnit';
|
||||
import { UnitNoVO } from '@/api/system/houseUnit/type';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
@@ -55,20 +89,117 @@ const houseStore = useHouseStore();
|
||||
const router = useRouter();
|
||||
|
||||
const housename = ref('');
|
||||
const houseUse = ref('');
|
||||
const houseUseTypeList = ref([]);
|
||||
|
||||
/**
|
||||
* 获取房屋 类型
|
||||
*/
|
||||
function init() {
|
||||
listHouseUseType({
|
||||
pageNum: 1,
|
||||
pageSize: 99999
|
||||
}).then((res) => {
|
||||
houseUseTypeList.value = res.rows;
|
||||
});
|
||||
}
|
||||
init();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const unitNoFormRef = ref();
|
||||
const buttonLoading = ref(false);
|
||||
const form = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
buildingId: undefined,
|
||||
villageId: undefined
|
||||
});
|
||||
|
||||
const rules = {
|
||||
name: [{ required: true, message: '单元名称不能为空', trigger: 'blur' }],
|
||||
buildingId: [{ required: true, message: '所属楼栋不能为空', trigger: 'blur' }]
|
||||
};
|
||||
/** 新增按钮操作 */
|
||||
const handleAddUnit = () => {
|
||||
resetForm();
|
||||
dialog.visible = true;
|
||||
dialog.title = '添加单元';
|
||||
};
|
||||
/** 修改按钮操作 */
|
||||
const handleEditUnit = async (id: string) => {
|
||||
resetForm();
|
||||
const res = await getUnitNo(id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改单元';
|
||||
};
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: string) => {
|
||||
await proxy?.$modal.confirm('是否确认删除该单元?');
|
||||
await delUnitNo(id);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
// await getList();
|
||||
houseStore.updateCureentBuilding();
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
unitNoFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateUnitNo(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addUnitNo(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
houseStore.updateCureentBuilding();
|
||||
}
|
||||
});
|
||||
};
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
resetForm();
|
||||
dialog.visible = false;
|
||||
};
|
||||
/** 表单重置 */
|
||||
const resetForm = () => {
|
||||
form.value = { id: undefined, name: undefined, buildingId: undefined, villageId: undefined };
|
||||
unitNoFormRef.value?.resetFields();
|
||||
};
|
||||
/**
|
||||
* 改变房屋类型
|
||||
* @param id
|
||||
*/
|
||||
function handleChangeUse(id?: string) {
|
||||
houseUse.value = id;
|
||||
}
|
||||
function handleClearUse() {
|
||||
houseUse.value = '';
|
||||
handleSearchHouse();
|
||||
}
|
||||
/** 添加房屋 */
|
||||
function handleAddHouse() {
|
||||
router.push({
|
||||
path: '/house/addHouse'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索 房屋
|
||||
*/
|
||||
function handleSearchHouse() {
|
||||
if (housename.value && housename.value.trim()) {
|
||||
houseStore.getHouseBybuildingNo(housename.value);
|
||||
}
|
||||
houseStore.getHouseBybuildingNo(housename.value, houseUse.value);
|
||||
}
|
||||
function reset() {
|
||||
housename.value = '';
|
||||
houseStore.getHouseBybuildingNo(housename.value);
|
||||
houseUse.value = '';
|
||||
houseStore.getHouseBybuildingNo(housename.value, houseUse.value);
|
||||
}
|
||||
|
||||
async function deleteAllhouse() {
|
||||
@@ -109,7 +240,6 @@ $primary_color: #1978fe;
|
||||
}
|
||||
|
||||
.searchbox {
|
||||
margin-left: 30px;
|
||||
.searchinput {
|
||||
width: 250px;
|
||||
@media (max-width: 1200px) {
|
||||
|
||||
@@ -6,19 +6,6 @@
|
||||
<span class="mr-50px">当前小区:{{ currentVilageInfo && currentVilageInfo.villageName }}</span>
|
||||
<span>小区地址:{{ currentVilageInfo && currentVilageInfo.city }} {{ currentVilageInfo && currentVilageInfo.address }}</span>
|
||||
</div>
|
||||
<div class="houseTypeBox flex">
|
||||
<div
|
||||
class="housetype"
|
||||
:class="{
|
||||
active: buildingtype == house.value
|
||||
}"
|
||||
@click="houseStore.switchHouseType(house.value)"
|
||||
v-for="(house, index) in com_build_use"
|
||||
:key="index"
|
||||
>
|
||||
{{ house.label }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</PageHeader>
|
||||
<div class="houseBody w-full flex align-center justify-center">
|
||||
@@ -27,8 +14,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup name="Houselist" lang="ts">
|
||||
// TODO 楼栋类型
|
||||
<script setup lang="ts">
|
||||
import building from './components/building.vue';
|
||||
import unit from './components/unit.vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
@@ -36,10 +22,11 @@ import { useHouseStore } from '@/store/modules/house';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { buildingtype, currentVilageInfo } = storeToRefs(houseStore);
|
||||
function init() {
|
||||
houseStore.initHouse();
|
||||
}
|
||||
init();
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_build_use } = toRefs<any>(proxy?.useDict('com_build_use'));
|
||||
houseStore.initHouse(houseStore.buildingtype);
|
||||
// 初始化数据
|
||||
</script>
|
||||
|
||||
@@ -56,10 +43,9 @@ houseStore.initHouse(houseStore.buildingtype);
|
||||
}
|
||||
.houseAdressBox {
|
||||
margin-top: 25px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
color: rgba(102, 102, 102, 1);
|
||||
font-size: 14px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.houseTypeBox {
|
||||
margin-top: 20px;
|
||||
|
||||
Reference in New Issue
Block a user