基础菜单页面搭建,开发房屋管理页面、设备页面
This commit is contained in:
@@ -504,7 +504,9 @@ const houseStore = useHouseStore();
|
||||
const userHousePath = ref<CascaderValue>([]);
|
||||
function handleChange(val: CascaderValue) {
|
||||
userHousePath.value = val;
|
||||
EditHouseForm.value.houseId = val[2];
|
||||
// 兼容有单元/无单元两种树结构,最后一级即房屋id
|
||||
const path = Array.isArray(val) ? val : [];
|
||||
EditHouseForm.value.houseId = (path[path.length - 1] ?? '') as string;
|
||||
}
|
||||
// * house
|
||||
|
||||
|
||||
244
src/views/system/Sdb/SdbElectricityShare/index.vue
Normal file
244
src/views/system/Sdb/SdbElectricityShare/index.vue
Normal file
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<pageheader></pageheader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="130px" style="flex-wrap: nowrap">
|
||||
<el-form-item label="公摊电表设备编码" prop="deviceCode">
|
||||
<el-input v-model="queryParams.deviceCode" placeholder="请输入公摊电表设备编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['electricityShare:electricityShare:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['electricityShare:electricityShare:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['electricityShare:electricityShare:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['electricityShare:electricityShare:export']">导出</el-button>
|
||||
</el-col>
|
||||
<!-- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> -->
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="electricityShareList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="主键" align="center" prop="id" v-if="true" /> -->
|
||||
<!-- <el-table-column label="小区id" align="center" prop="villageId" /> -->
|
||||
<!-- <el-table-column label="公摊电表设备id" align="center" prop="deviceId" /> -->
|
||||
<el-table-column label="公摊电表设备编码" align="center" prop="deviceCode" />
|
||||
<el-table-column label="分摊方式" align="center" prop="shareMode" />
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['electricityShare:electricityShare:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['electricityShare:electricityShare:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
<!-- 添加或修改公摊电表配置对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="electricityShareFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="小区id" prop="villageId">
|
||||
<el-input v-model="form.villageId" placeholder="请输入小区id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公摊电表设备id" prop="deviceId">
|
||||
<el-input v-model="form.deviceId" placeholder="请输入公摊电表设备id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公摊电表设备编码" prop="deviceCode">
|
||||
<el-input v-model="form.deviceCode" placeholder="请输入公摊电表设备编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分摊方式" prop="shareMode">
|
||||
<el-input v-model="form.shareMode" placeholder="请输入分摊方式" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</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>
|
||||
|
||||
<script setup name="ElectricityShare" lang="ts">
|
||||
import { listElectricityShare, getElectricityShare, delElectricityShare, addElectricityShare, updateElectricityShare } from '@/api/system/electricityShare/index';
|
||||
import { ElectricityShareVO, ElectricityShareQuery, ElectricityShareForm } from '@/api/system/electricityShare/types';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const electricityShareList = ref<ElectricityShareVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const electricityShareFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: ElectricityShareForm = {
|
||||
id: undefined,
|
||||
villageId: undefined,
|
||||
deviceId: undefined,
|
||||
deviceCode: undefined,
|
||||
shareMode: undefined,
|
||||
status: undefined,
|
||||
remark: undefined,
|
||||
}
|
||||
const data = reactive<PageData<ElectricityShareForm, ElectricityShareQuery>>({
|
||||
form: {...initFormData},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
// villageId: undefined,
|
||||
// deviceId: undefined,
|
||||
deviceCode: undefined,
|
||||
// shareMode: undefined,
|
||||
status: undefined,
|
||||
params: {
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "主键不能为空", trigger: "blur" }
|
||||
],
|
||||
villageId: [
|
||||
{ required: true, message: "小区id不能为空", trigger: "blur" }
|
||||
],
|
||||
deviceId: [
|
||||
{ required: true, message: "公摊电表设备id不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询公摊电表配置列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listElectricityShare(queryParams.value);
|
||||
electricityShareList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {...initFormData};
|
||||
electricityShareFormRef.value?.resetFields();
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ElectricityShareVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加公摊电表配置";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: ElectricityShareVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const res = await getElectricityShare(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改公摊电表配置";
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
electricityShareFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateElectricityShare(form.value).finally(() => buttonLoading.value = false);
|
||||
} else {
|
||||
await addElectricityShare(form.value).finally(() => buttonLoading.value = false);
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ElectricityShareVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除公摊电表配置编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await delElectricityShare(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
await getList();
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('electricityShare/electricityShare/export', {
|
||||
...queryParams.value
|
||||
}, `electricityShare_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
@@ -1,378 +1,149 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader title="房屋信息"></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">
|
||||
<span>基本信息</span>
|
||||
<el-button v-if="HouseInfo.house" v-has-permi="['system:house:edit']" text type="primary" @click="editHouse">编辑</el-button>
|
||||
</div>
|
||||
<div v-if="HouseInfo.house" class="addBuildingFormBody">
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">房号:</div>
|
||||
<div class="value">{{ HouseInfo.house?.buildingName }}-{{ HouseInfo.house?.unitNoName }}-{{ HouseInfo.house?.houseNo ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">所属小区:</div>
|
||||
<div class="value">{{ HouseInfo.house?.villageName ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">楼栋:</div>
|
||||
<div class="value">{{ HouseInfo.house?.buildingName ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">单元:</div>
|
||||
<div class="value">{{ HouseInfo.house?.unitNoName ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">楼层:</div>
|
||||
<div class="value">{{ HouseInfo.house?.floorNo ? HouseInfo.house?.floorNo + ' 层' : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">建筑面积:</div>
|
||||
<div class="value">{{ HouseInfo.house?.houseArea ? `${HouseInfo.house?.houseArea} ㎡` : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">套内面积:</div>
|
||||
<div class="value">{{ HouseInfo.house?.internalArea ? `${HouseInfo.house?.internalArea} ㎡` : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">公摊面积:</div>
|
||||
<div class="value">{{ HouseInfo.house?.shareArea ? `${HouseInfo.house?.shareArea} ㎡` : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">户型:</div>
|
||||
<div class="value">
|
||||
{{ HouseInfo.house?.houseType ? HouseInfo.house?.houseType.split('')[0] : '--' }}室
|
||||
{{ HouseInfo.house?.houseType ? HouseInfo.house?.houseType.split('')[1] : '--' }}厅
|
||||
{{ HouseInfo.house?.houseType ? HouseInfo.house?.houseType.split('')[2] : '--' }}卫
|
||||
<div class="ResidentMainBox p-2 w-full h-full">
|
||||
<PageHeader title="房屋详情"></PageHeader>
|
||||
<div class="ResidentMainBody">
|
||||
<el-card class="h-full">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>基础资料</span>
|
||||
</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 v-if="HouseInfo.storeroom" v-has-permi="['storeroom:storeroom:edit']" text type="primary" @click="editStoreRoom">编辑</el-button>
|
||||
</div>
|
||||
<div v-if="HouseInfo.storeroom" class="">
|
||||
<div class="addBuildingFormBody">
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">楼栋:</div>
|
||||
<div class="value">{{ HouseInfo.storeroom?.buildingName ?? '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">单元:</div>
|
||||
<div class="value">{{ HouseInfo.storeroom?.unitNoName ? `${HouseInfo.storeroom?.unitNoName} 单元` : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">储藏室号:</div>
|
||||
<div class="value">{{ HouseInfo.storeroom?.storeroomNo ? `${HouseInfo.storeroom?.storeroomNo}` : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">建筑面积:</div>
|
||||
<div class="value">{{ HouseInfo.storeroom?.houseArea ? HouseInfo.storeroom?.houseArea + ' ㎡' : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">公摊面积:</div>
|
||||
<div class="value">{{ HouseInfo.storeroom?.shareArea ? HouseInfo.storeroom?.shareArea + ' ㎡' : '--' }}</div>
|
||||
</div>
|
||||
<div class="descriptionsBox">
|
||||
<div class="label">实用面积:</div>
|
||||
<div class="value">{{ HouseInfo.storeroom?.internalArea ? HouseInfo.storeroom?.internalArea + ' ㎡' : '--' }}㎡</div>
|
||||
</div>
|
||||
<div class="descriptionsBox" style="grid-column-start: 1; grid-column-end: 4">
|
||||
<div class="label">备注:</div>
|
||||
<div class="value">{{ HouseInfo.storeroom?.remark ?? '--' }}</div>
|
||||
</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>
|
||||
</div>
|
||||
<div v-if="HouseInfo.parkingList.length > 0" class="">
|
||||
<el-table :data="HouseInfo.parkingList">
|
||||
<el-table-column align="center" label="区域" prop="areaName" />
|
||||
<el-table-column align="center" label="车位编号" prop="parkingCode" />
|
||||
<el-table-column align="center" label="车位面积" prop="parkingArea" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.parkingArea ?? '--' }} /㎡</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="楼层" prop="parkingFloor" width="50" />
|
||||
<el-table-column align="center" label="车位类型" prop="type" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_parking_type" :value="scope.row.type"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="车位状态" prop="parkingStatus" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_parking_status" :value="scope.row.parkingStatus"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="持有人" prop="residentName">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="handleEditUser(scope.row.residentId)">{{ scope.row.residentName }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip />
|
||||
</el-table>
|
||||
</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>
|
||||
</div>
|
||||
<div>
|
||||
<el-table :data="HouseInfo.chargeItemList" style="width: 100%">
|
||||
<el-table-column label="收费项目" prop="itemName" />
|
||||
<el-table-column label="收费标准" prop="name">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.fixedPrice" class="flex">
|
||||
<span>{{ scope.row.fixedPrice }}</span>
|
||||
<span v-if="scope.row.unit">/</span>
|
||||
<dict-tag v-if="scope.row.unit" :options="com_charge_item_unit" :value="scope.row.unit"></dict-tag>
|
||||
</template>
|
||||
<div class="w-full h-full">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">区号:</div>
|
||||
<span> {{ areaNo || '--' }} </span>
|
||||
</div>
|
||||
<span v-else> --- </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始时间" prop="createTime" />
|
||||
<el-table-column label="结束时间" prop="name">
|
||||
<template #default>
|
||||
<span>---</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark" />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 相关住户 -->
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">
|
||||
<span>相关住户</span>
|
||||
</div>
|
||||
<div>
|
||||
<el-table :data="HouseInfo.residentList" style="width: 100%">
|
||||
<el-table-column label="姓名" prop="residentName" />
|
||||
<el-table-column label="性别" prop="gender">
|
||||
<template #default="scope">
|
||||
<DictTag :options="sys_user_sex" :value="scope.row.gender"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="联系电话" prop="phone" />
|
||||
<el-table-column label="身份" prop="ownerRelationship">
|
||||
<template #default="scope">
|
||||
<DictTag :options="com_resident_relationship" :value="scope.row.ownerRelationship"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark" show-overflow-tooltip />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 缴费账单 -->
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">
|
||||
<span>缴费账单</span>
|
||||
</div>
|
||||
<div>
|
||||
<el-table :data="billList" style="width: 100%; max-height: 500px; overflow: auto">
|
||||
<el-table-column label="账单名称" prop="detailsName" />
|
||||
<el-table-column label="账单项目" prop="chargeItemName" />
|
||||
<el-table-column label="金额" prop="money">
|
||||
<template #default="scope">
|
||||
<div class="flex" style="width: 120px; justify-content: start; align-items: center">
|
||||
<div style="width: 80px; text-align: left">
|
||||
{{ scope.row.amount }}
|
||||
</div>
|
||||
<el-tooltip v-if="scope.row.payStatus === '3'" class="box-item" effect="light" placement="top">
|
||||
<el-icon color="#909399"><QuestionFilled /></el-icon>
|
||||
<template #content>
|
||||
<div style="line-height: 1.8; font-size: 13px; width: 180px">
|
||||
<div class="flex justify-between" style="text-align: right">
|
||||
<span>总金额</span>
|
||||
<span>{{ scope.row.amount }}¥</span>
|
||||
</div>
|
||||
<div class="flex justify-between" style="text-align: right">
|
||||
<span>优惠金额</span>
|
||||
<span>− {{ scope.row.singleDiscountAmount }}¥</span>
|
||||
</div>
|
||||
<div class="flex justify-between" style="text-align: right">
|
||||
<span>已交金额</span>
|
||||
<span>− {{ scope.row.paidAmount }}¥</span>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between cursor-pointer"
|
||||
style="margin-top: 6px; border-top: 1px solid #ccc; text-align: right; padding-top: 6px"
|
||||
>
|
||||
<span>待缴金额</span>
|
||||
<span style="font-weight: bold; color: red">{{ scope.row.needPayAmount }}¥</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-tooltip>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">房号:</div>
|
||||
<span> {{ userInfo.houseNo ?? '--' }} </span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付状态" prop="payStatus">
|
||||
<template #default="scope">
|
||||
<DictTag :options="com_pay_status" :value="scope.row.payStatus ?? 0"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">楼层:</div>
|
||||
<span> {{ userInfo.floorNo ? `${userInfo.floorNo} 层` : '--' }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">建筑面积:</div>
|
||||
<span> {{ userInfo.houseArea ? `${userInfo.houseArea} ㎡` : '--' }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">套内面积:</div>
|
||||
<span> {{ userInfo.internalArea ? `${userInfo.internalArea} ㎡` : '--' }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">公摊面积:</div>
|
||||
<span> {{ userInfo.shareArea ? `${userInfo.shareArea} ㎡` : '--' }} </span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">房东姓名:</div>
|
||||
<span> {{ userInfo.landlordName ?? '--' }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">房东电话:</div>
|
||||
<span> {{ userInfo.landlordPhone ?? '--' }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">承租方姓名:</div>
|
||||
<span> {{ userInfo.lesseeName ?? '--' }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">承租方电话:</div>
|
||||
<span> {{ userInfo.lesseePhone ?? '--' }} </span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">备注:</div>
|
||||
<span> {{ userInfo.remark ?? '无' }} </span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="actions">
|
||||
<el-button @click="goBack">返回</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import DictTag from '@/components/DictTag/index.vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { Data, getHouseMain, House } from '@/api/system/house';
|
||||
import { billlistType, billQuery } from '@/api/system/SdbCashier';
|
||||
import { QuestionFilled } from '@element-plus/icons-vue';
|
||||
import { getHouseApi } from '@/api/system/house';
|
||||
import { HouseListVO } from '@/api/system/house/type';
|
||||
import { getHousePathById } from '@/utils/house';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
|
||||
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 { com_parking_type } = toRefs<any>(proxy?.useDict('com_parking_type'));
|
||||
const { com_parking_status } = toRefs<any>(proxy?.useDict('com_parking_status'));
|
||||
const { com_charge_item_unit } = toRefs<any>(proxy?.useDict('com_charge_item_unit'));
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
let routeId = '';
|
||||
const HouseInfo = ref<Data>({
|
||||
billResidentList: [],
|
||||
chargeItemList: [],
|
||||
house: null,
|
||||
parkingList: [],
|
||||
residentList: [],
|
||||
storeroom: null
|
||||
});
|
||||
function editHouse() {
|
||||
router.push({
|
||||
path: '/house/editHouse',
|
||||
query: {
|
||||
id: HouseInfo.value.house.houseId
|
||||
}
|
||||
});
|
||||
}
|
||||
function editStoreRoom() {
|
||||
router.push({
|
||||
path: '/house/EditStoreRoom',
|
||||
query: {
|
||||
id: HouseInfo.value.storeroom.storeroomId
|
||||
const userInfo = ref<HouseListVO>({} as HouseListVO);
|
||||
const userid = ref(null);
|
||||
const route = useRoute();
|
||||
const houseStore = useHouseStore();
|
||||
// 区号(楼栋名称)
|
||||
const areaNo = ref('');
|
||||
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
// 获取房屋信息
|
||||
getHouseApi(userid.value).then((res) => {
|
||||
const house = res.data ?? {};
|
||||
userInfo.value = house;
|
||||
areaNo.value = house.buildingName ?? '';
|
||||
// 接口未返回楼栋名称时,从楼栋树中按房屋路径取楼栋名称
|
||||
if (!areaNo.value) {
|
||||
houseStore.getCurrentVilageTreeHouse().then(() => {
|
||||
const labelPath = getHousePathById(house.houseId, 'label');
|
||||
if (labelPath.length) {
|
||||
areaNo.value = String(labelPath[0]);
|
||||
return;
|
||||
}
|
||||
const building = houseStore.treedata.find(
|
||||
(node: any) => node.type === 'buildingId' && String(node.value) === String(house.buildingId)
|
||||
);
|
||||
areaNo.value = building ? String(building.label) : '';
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleEditUser(id: string) {
|
||||
router.push({
|
||||
// path: '/house/editResident',
|
||||
path: '/house/ResidentMain',
|
||||
query: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
}
|
||||
function init() {
|
||||
if (route.query.id) {
|
||||
routeId = route.query.id as string;
|
||||
getHouseMain(routeId).then((res) => {
|
||||
HouseInfo.value = res.data;
|
||||
getBillByHouse(res.data.house);
|
||||
});
|
||||
}
|
||||
}
|
||||
init();
|
||||
const billList = ref<billlistType[]>([]);
|
||||
const queryParams = ref({
|
||||
pageSize: 10,
|
||||
pageNum: 1
|
||||
});
|
||||
const total = ref(0);
|
||||
function getBillByHouse(info: House) {
|
||||
const obj = {
|
||||
buildingId: info.buildingId,
|
||||
houseId: info.houseId,
|
||||
pageNum: queryParams.value.pageNum,
|
||||
pageSize: queryParams.value.pageSize,
|
||||
unitNoId: info.unitNoId,
|
||||
payStatus: null,
|
||||
villageId: info.villageId
|
||||
};
|
||||
billQuery(obj).then((res) => {
|
||||
billList.value = res.rows;
|
||||
total.value = res.total;
|
||||
});
|
||||
}
|
||||
function getList() {
|
||||
if (HouseInfo.value) {
|
||||
getBillByHouse(HouseInfo.value.house);
|
||||
}
|
||||
/** 返回 */
|
||||
function goBack() {
|
||||
router.back();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.AddBuildingBox {
|
||||
padding: 15px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.AddBuildingBody {
|
||||
margin-top: 20px;
|
||||
.ResidentMainBox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: white;
|
||||
padding: 15px;
|
||||
.title {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding-left: 20px;
|
||||
font-size: 15px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
color: rgba(16, 16, 16, 1);
|
||||
border-bottom: 1px solid #bbbbbb;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.addBuildingFormBody {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-rows: repeat(3, 1fr);
|
||||
&.remarkBuildingFormBody {
|
||||
display: block;
|
||||
.ResidentMainBody {
|
||||
flex: 1;
|
||||
margin-top: 20px;
|
||||
.card-header {
|
||||
font-size: 18px;
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
}
|
||||
.descriptionsBox {
|
||||
.actions {
|
||||
margin-top: 30px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.userinfo_item {
|
||||
margin-bottom: 20px;
|
||||
min-height: 40px;
|
||||
line-height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 10px 0;
|
||||
font-size: 15px;
|
||||
.label {
|
||||
font-size: 14px;
|
||||
.title_item {
|
||||
margin-right: 10px;
|
||||
width: 100px;
|
||||
text-align: right;
|
||||
font-weight: 800;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
margin-left: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
289
src/views/system/house/addResident.vue
Normal file
289
src/views/system/house/addResident.vue
Normal file
@@ -0,0 +1,289 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form class="formBody" label-position="left" ref="formRef" :model="form" :rules="rules" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="区号" prop="buildingId">
|
||||
<el-cascader v-model="userHousePath" :options="treeData" @change="handleChange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="房间号" prop="houseNo">
|
||||
<el-input maxlength="10" show-word-limit v-model.trim="form.houseNo" placeholder="请输入房号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="楼层" prop="floorNo">
|
||||
<el-input-number v-model="form.floorNo" :min="1" :max="999" controls-position="right" placeholder="请输入楼层" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="建筑面积(㎡)" prop="houseArea">
|
||||
<el-input maxlength="10" v-model.trim="form.houseArea" placeholder="请输入建筑面积" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="套内面积(㎡)" prop="internalArea">
|
||||
<el-input maxlength="10" v-model.trim="form.internalArea" placeholder="请输入套内面积" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="公摊面积(㎡)" prop="shareArea">
|
||||
<el-input maxlength="10" v-model.trim="form.shareArea" placeholder="请输入公摊面积" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11"> </el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="房东姓名" prop="landlordName">
|
||||
<el-input maxlength="10" show-word-limit v-model.trim="form.landlordName" placeholder="请输入房东姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="房东电话" prop="landlordPhone">
|
||||
<el-input maxlength="11" v-model.number="form.landlordPhone" placeholder="请输入房东电话" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="承租方姓名" prop="lesseeName">
|
||||
<el-input maxlength="10" show-word-limit v-model.trim="form.lesseeName" placeholder="请输入承租方姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="承租方电话" prop="lesseePhone">
|
||||
<el-input maxlength="11" v-model.number="form.lesseePhone" placeholder="请输入承租方电话" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" maxlength="200" show-word-limit :row="5" v-model.trim="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-top: 30px">
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
<el-button @click="cancelForm">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { CascaderValue } from 'element-plus';
|
||||
import { addHouseAPI, EditHouseApi, getHouseApi } from '@/api/system/house';
|
||||
import { addHouseType } from '@/api/system/house/type';
|
||||
import { validator } from '@/utils/Reg';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
|
||||
interface HouseForm {
|
||||
houseId?: string | null;
|
||||
villageId?: string | null;
|
||||
buildingId?: string | null;
|
||||
unitNoId?: string | null;
|
||||
floorNo?: number | null;
|
||||
houseNo?: string;
|
||||
houseType?: string;
|
||||
houseArea?: string;
|
||||
internalArea?: string;
|
||||
shareArea?: string;
|
||||
houseUseTypeId?: string;
|
||||
houseStatus?: string;
|
||||
residentId?: string | null;
|
||||
landlordName?: string | null;
|
||||
landlordPhone?: string | null;
|
||||
lesseeName?: string | null;
|
||||
lesseePhone?: string | null;
|
||||
status?: string;
|
||||
remark?: string | null;
|
||||
}
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const formRef = ref();
|
||||
const form = ref<HouseForm>({
|
||||
houseId: null,
|
||||
buildingId: null,
|
||||
unitNoId: null,
|
||||
houseNo: '',
|
||||
floorNo: null,
|
||||
houseArea: '',
|
||||
internalArea: '',
|
||||
shareArea: '',
|
||||
landlordName: '',
|
||||
landlordPhone: '',
|
||||
lesseeName: '',
|
||||
lesseePhone: '',
|
||||
remark: ''
|
||||
});
|
||||
const userHousePath = ref<CascaderValue>([]);
|
||||
|
||||
/** 选填手机号校验 */
|
||||
const validatePhone = (_: any, value: string | number, callback: (error?: Error) => void) => {
|
||||
if (value === '' || value === null || value === undefined) {
|
||||
return callback();
|
||||
}
|
||||
return validator(value, 'phone') ? callback() : callback(new Error('请输入正确的手机号码'));
|
||||
};
|
||||
|
||||
const rules = ref({
|
||||
buildingId: [{ required: true, message: '请选择区号', trigger: 'change' }],
|
||||
houseNo: [{ required: true, message: '请输入房号', trigger: 'blur' }],
|
||||
landlordName: [{ required: true, message: '请输入房东姓名', trigger: 'blur' }],
|
||||
landlordPhone: [
|
||||
{ required: true, message: '请输入房东电话', trigger: 'blur' },
|
||||
{ validator: validatePhone, trigger: 'blur' }
|
||||
],
|
||||
lesseePhone: [{ validator: validatePhone, trigger: 'blur' }]
|
||||
});
|
||||
|
||||
// 区号(楼栋)选项,只展示一层
|
||||
const treeData = ref<any[]>([]);
|
||||
function getTree() {
|
||||
houseStore.getCurrentVilageTreeHouse().then((res) => {
|
||||
treeData.value = (res ?? []).map((node: any) => ({
|
||||
label: node.label,
|
||||
value: node.value,
|
||||
type: node.type
|
||||
}));
|
||||
getTreeData();
|
||||
});
|
||||
}
|
||||
getTree();
|
||||
// !== 楼栋房屋 =============================================================================
|
||||
const userid = ref(null);
|
||||
function getTreeData() {
|
||||
// !== 编辑 =============================================================================
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getHouseApi(userid.value).then((res) => {
|
||||
const house = res.data ?? {};
|
||||
form.value = {
|
||||
...house
|
||||
};
|
||||
// 只在区号(楼栋)一层回显,使用树中的原始 value 保证与 options 一致
|
||||
const buildingNode = treeData.value.find((node: any) => String(node.value) === String(house.buildingId));
|
||||
userHousePath.value = buildingNode ? [buildingNode.value] : [];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleChange(val: CascaderValue) {
|
||||
userHousePath.value = val;
|
||||
const path = Array.isArray(val) ? val : [];
|
||||
// 只有区号(楼栋)一级
|
||||
form.value.buildingId = (path[0] ?? null) as string | null;
|
||||
}
|
||||
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
const obj = {
|
||||
...form.value
|
||||
} as unknown as addHouseType;
|
||||
if (userid.value) {
|
||||
EditHouseApi(obj).then(() => {
|
||||
ElMessage.success('修改成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
addHouseAPI(obj).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.back();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.AddBuildingBox {
|
||||
padding: 15px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.AddBuildingBody {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: white;
|
||||
padding: 15px;
|
||||
.title {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding-left: 20px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
color: rgba(16, 16, 16, 1);
|
||||
border-bottom: 1px solid #bbbbbb;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.formBody {
|
||||
width: 1050px;
|
||||
margin: 0 auto;
|
||||
|
||||
&:deep(.el-form-item__content, .el-select, .el-input) {
|
||||
width: 350px !important;
|
||||
margin-right: 10px;
|
||||
.el-cascader {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.el-form-item {
|
||||
margin-bottom: 20px;
|
||||
align-items: center;
|
||||
}
|
||||
.unitBox {
|
||||
.el-input {
|
||||
width: 440px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
.el-button {
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.houseTypebox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.el-input {
|
||||
width: 100px;
|
||||
margin-right: 0;
|
||||
}
|
||||
span {
|
||||
margin: 0 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,120 +0,0 @@
|
||||
<template>
|
||||
<div class="BuildingBox">
|
||||
<div class="buildingheader flex align-center justify-between">
|
||||
<div>楼栋</div>
|
||||
<div>
|
||||
<span class="pointer" @click="handleAddBuilding" v-has-permi="['system:building:add']">+增加楼栋</span>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="flex-1 overflow-y-auto overflow-x-hidden">
|
||||
<li
|
||||
v-for="(item, index) in currentBuildingInfoList"
|
||||
:class="{
|
||||
active: item.id === currentBuildingInfo.id
|
||||
}"
|
||||
:key="index"
|
||||
>
|
||||
<div class="buildingname" :title="item.buildingName ?? ''" @click="switchBuilding(item.id ?? null)">{{ item.buildingName ?? '' }}</div>
|
||||
<div class="buildactions flex align-center justify-around">
|
||||
<el-icon class="pointer hover-color-blue" @click="editBuilding(item.id)" v-has-permi="['system:building:edit']"><Setting /></el-icon>
|
||||
<el-icon class="pointer hover-color-red" @click="deleteBuilding(item.id)" v-has-permi="['system:building:remove']"><Delete /></el-icon>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { deleteBuildingApi } from '@/api/system/house';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { Delete, Setting } from '@element-plus/icons-vue';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { switchBuilding } = houseStore; // 方法
|
||||
const { currentBuildingInfoList, currentBuildingInfo } = storeToRefs(houseStore); // 数据
|
||||
const router = useRouter();
|
||||
|
||||
const handleAddBuilding = () => {
|
||||
router.push({
|
||||
path: '/house/addbuilding'
|
||||
});
|
||||
};
|
||||
const editBuilding = (id: string) => {
|
||||
router.push({
|
||||
path: '/house/editbuilding',
|
||||
query: {
|
||||
buildingId: id
|
||||
}
|
||||
});
|
||||
};
|
||||
const deleteBuilding = (id: string) => {
|
||||
proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').then(() => {
|
||||
deleteBuildingApi(id).then(() => {
|
||||
houseStore.deleteBuildingFun(id);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
$primary_color: #1978fe;
|
||||
.BuildingBox {
|
||||
width: 220px;
|
||||
height: 100%;
|
||||
font-size: 14px;
|
||||
background-color: #fff;
|
||||
border-radius: 2px;
|
||||
color: rgba(0, 0, 0, 1);
|
||||
margin-right: 10px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.buildingheader {
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
padding: 0 15px;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
span {
|
||||
color: $primary_color;
|
||||
}
|
||||
}
|
||||
|
||||
li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
color: rgba(16, 16, 16, 1);
|
||||
position: relative;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
&:hover {
|
||||
background-color: #1978fe0c;
|
||||
}
|
||||
.buildingname {
|
||||
padding: 0 10px 0 5px;
|
||||
cursor: pointer;
|
||||
flex: 1;
|
||||
max-width: 175px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
||||
text-align: right;
|
||||
}
|
||||
.buildactions {
|
||||
width: 75px;
|
||||
font-size: 15px;
|
||||
padding: 15px 10px 15px 0;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: $primary_color;
|
||||
border-bottom: 1px solid $primary_color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,131 +0,0 @@
|
||||
<template>
|
||||
<div class="house-list">
|
||||
<div class="house flex align-center" @contextmenu="handleContextMenu($event, house.houseId)" v-for="house in sortedHouses" :key="house.houseId">
|
||||
<div class="w-full flex items-center justify-between">
|
||||
<el-checkbox :title="house.houseNo" :label="house.houseNo" :value="house.houseId" />
|
||||
<div class="circlebox" @click="handleContextMenu($event, house.houseId)">
|
||||
<div class="circle"></div>
|
||||
<div class="circle"></div>
|
||||
<div class="circle"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { FloorsType } from '@/api/system/house/type';
|
||||
const props = defineProps<{
|
||||
unit: FloorsType[];
|
||||
fIdx: number | string;
|
||||
}>();
|
||||
|
||||
// 使用 computed 获取当前楼层数据,确保响应式
|
||||
const currentFloor = computed(() => {
|
||||
return props.unit.find((item) => item.floorNo === props.fIdx) ?? { floorNo: '', houses: [] };
|
||||
});
|
||||
|
||||
// 存储排序后的结果
|
||||
const sortedHouses = ref(currentFloor.value.houses);
|
||||
|
||||
// 轻量级比较函数:优先尝试数字比较,失败则使用 localeCompare
|
||||
const compareHouseNo = (a: string, b: string) => {
|
||||
// 如果都是纯数字,直接数字比较最快
|
||||
const numA = Number(a);
|
||||
const numB = Number(b);
|
||||
if (!isNaN(numA) && !isNaN(numB)) {
|
||||
return numA - numB;
|
||||
}
|
||||
// 否则使用自然排序
|
||||
return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' });
|
||||
};
|
||||
|
||||
// 监听数据源变化,仅当 houses 数组引用或内容变化时重新排序
|
||||
watch(
|
||||
() => currentFloor.value.houses,
|
||||
(newHouses) => {
|
||||
// 创建副本并排序
|
||||
sortedHouses.value = [...newHouses].sort((a, b) => compareHouseNo(a.houseNo, b.houseNo));
|
||||
},
|
||||
{ immediate: true, deep: false } // deep: false 因为我们要替换整个数组引用
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
contextmenufun: [value: { type: string; value: string }];
|
||||
// 新增事件:通知父组件打开菜单
|
||||
openMenu: [data: { event: MouseEvent; houseId: string }];
|
||||
}>();
|
||||
|
||||
// 处理右键点击,向上传递事件对象和ID
|
||||
const handleContextMenu = (event: MouseEvent, houseId: string) => {
|
||||
event.preventDefault(); // 阻止默认浏览器菜单
|
||||
emit('openMenu', { event, houseId });
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.circlebox {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
$circleSize: 3px;
|
||||
margin-left: 10px;
|
||||
cursor: pointer;
|
||||
.circle {
|
||||
width: $circleSize;
|
||||
height: $circleSize;
|
||||
border-radius: 50%;
|
||||
background-color: #666666;
|
||||
}
|
||||
}
|
||||
|
||||
.house-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
max-height: 400px;
|
||||
overflow: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.house {
|
||||
min-width: 100px;
|
||||
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
margin: 5px;
|
||||
padding: 0 10px;
|
||||
|
||||
&:deep(.el-checkbox) {
|
||||
max-width: 200px;
|
||||
.el-checkbox__label {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.house:hover {
|
||||
background: #e8f3ff;
|
||||
border-color: #409eff;
|
||||
color: #409eff;
|
||||
}
|
||||
.house.checked {
|
||||
background: #e8f3ff;
|
||||
border-color: #409eff;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.dropdownClass {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,168 +0,0 @@
|
||||
<template>
|
||||
<div class="tablebox1 h-full flex-1">
|
||||
<div class="TableBox p-5" 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="楼层\单元" min-width="90">
|
||||
<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>
|
||||
<div class="flex align-center justify-center">
|
||||
<div class="houseName" :title="unit.unitNoName">{{ unit.unitNoName }}</div>
|
||||
<el-button v-has-permi="['unitNo:unitNo:edit']" link type="primary" icon="Edit" @click="HandleEditUnit(unit)"></el-button>
|
||||
<el-button
|
||||
v-has-permi="['unitNo:unitNo:remove']"
|
||||
link
|
||||
type="danger"
|
||||
icon="Delete"
|
||||
style="margin-left: 0"
|
||||
@click="HandleDeleteUnit(unit)"
|
||||
></el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<houseItem @openMenu="handleOpenMenu" :unit="unit.floors" :f-idx="row"></houseItem>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<div v-else class="nodata">暂无房屋</div>
|
||||
<ContextMenu ref="contextMenuRef" :menu="menutlist" @select="contextMenuFun" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { deleteHouseApi } from '@/api/system/house';
|
||||
import houseItem from './houseItem.vue';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { checkPermi } from '@/utils/permission';
|
||||
|
||||
import ContextMenu from '@/components/ContextMenu/index.vue';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const emit = defineEmits(['editUnit', 'deleteUnit']);
|
||||
|
||||
const router = useRouter();
|
||||
const menutlist = [
|
||||
// { label: '编辑', value: 'edit' },
|
||||
// { label: '收费标准', value: 'money' },
|
||||
// { label: '详情', value: 'main' }
|
||||
];
|
||||
|
||||
if (checkPermi(['system:house:edit'])) {
|
||||
menutlist.push({ label: '编辑', value: 'edit' });
|
||||
}
|
||||
if (checkPermi(['system:house:ByIdList'])) {
|
||||
menutlist.push({ label: '详情', value: 'main' });
|
||||
}
|
||||
if (checkPermi(['system:house:remove'])) {
|
||||
menutlist.push({ label: '删除', value: 'delete' });
|
||||
}
|
||||
|
||||
const contextMenuRef = ref();
|
||||
|
||||
// 处理子组件抛出的打开菜单事件
|
||||
const handleOpenMenu = ({ event, houseId }: { event: MouseEvent; houseId: string }) => {
|
||||
// 调用唯一 ContextMenu 实例的 open 方法
|
||||
// 注意:这里需要确保 ContextMenu 组件暴露了 open 方法,或者我们修改 ContextMenu 为受控模式
|
||||
if (contextMenuRef.value) {
|
||||
contextMenuRef.value.open(event, houseId);
|
||||
}
|
||||
};
|
||||
function handleChangeCheckhouses(val: string[]) {
|
||||
houseStore.checkoutHousesFun([]);
|
||||
houseStore.checkoutHousesFun(val);
|
||||
}
|
||||
function contextMenuFun(val: { type: string; value: string }) {
|
||||
switch (val.type) {
|
||||
case 'edit':
|
||||
router.push({
|
||||
path: '/house/editHouse',
|
||||
query: {
|
||||
id: val.value
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'money':
|
||||
break;
|
||||
case 'main':
|
||||
router.push({
|
||||
path: '/house/HouseDetails',
|
||||
query: {
|
||||
id: val.value
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'delete':
|
||||
if (!checkPermi(['house:delete:house'])) {
|
||||
break;
|
||||
}
|
||||
proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').then(() => {
|
||||
deleteHouseApi(val.value).then(() => {
|
||||
houseStore.switchBuilding(houseStore.currentBuildingInfo.id);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function HandleEditUnit(unit) {
|
||||
emit('editUnit', unit.unitNoId);
|
||||
}
|
||||
function HandleDeleteUnit(unit) {
|
||||
emit('deleteUnit', unit.unitNoId);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.tablebox1 {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
.TableBox {
|
||||
height: 100%;
|
||||
.el-checkbox-group {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.el-table {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.houseName {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-weight: 600;
|
||||
max-width: 300px;
|
||||
text-align: left;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
}
|
||||
.nodata {
|
||||
font-size: 1.2rem;
|
||||
color: #ccc;
|
||||
letter-spacing: 2px;
|
||||
text-align: center;
|
||||
padding-top: 200px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,275 +0,0 @@
|
||||
<template>
|
||||
<div class="UnitBox">
|
||||
<div class="Unit_top flex align-center justify-between flex-wrap">
|
||||
<div style="text-wrap: wrap">
|
||||
<span class="text-size-16px text-color-black text-widget-bold mr-30px">
|
||||
<strong>{{ houseStore.currentBuildingInfo?.buildingName }}</strong>
|
||||
</span>
|
||||
<span class="mr-15px"
|
||||
>楼栋朝向:{{ houseStore.currentBuildingInfo?.buildToward ? `${houseStore.currentBuildingInfo?.buildToward}` : ' --' }}</span
|
||||
>
|
||||
<span class="mr-15px">楼高:{{ houseStore.currentBuildingInfo?.buildTall ? `${houseStore.currentBuildingInfo?.buildTall}(m)` : ' --' }}</span>
|
||||
<span class="mr-15px"
|
||||
>楼栋结构:{{ houseStore.currentBuildingInfo?.buildStructure ? `${houseStore.currentBuildingInfo?.buildStructure}` : ' --' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="rightActions flex flex-items-center" style="text-wrap: nowrap">
|
||||
<span v-has-permi="['unitNo:unitNo:add']" class="mr-20px" @click="handleAddUnit">+添加单元</span>
|
||||
<span v-has-permi="['system:house:add']" class="mr-20px" @click="handleAddHouse">+增加房屋</span>
|
||||
<!-- <span class="mr-20px">收费标准设置</span> -->
|
||||
<span v-has-permi="['system:house:remove']" @click="deleteAllHouse">批量删除房屋</span>
|
||||
<el-select v-model="houseUse" class="selectbox" clearable placeholder="筛选房屋类型" @change="handleChangeUse" @clear="handleClearUse">
|
||||
<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" maxlength="15" placeholder="请输入房屋号"></el-input>
|
||||
<el-button style="margin-left: 10px" type="primary" @click="handleSearchHouse">搜索</el-button>
|
||||
<el-button @click="reset">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="UnitBody"> -->
|
||||
<TableUnit @edit-unit="handleEditUnit" @delete-unit="handleDelete"></TableUnit>
|
||||
<!-- </div> -->
|
||||
<!-- 添加或修改单元对话框 -->
|
||||
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="500px">
|
||||
<el-form ref="unitNoFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="单元名称" prop="name">
|
||||
<el-input v-model.trim="form.name" maxlength="6" placeholder="请输入单元名称" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼栋" prop="buildingId">
|
||||
<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>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { deleteHouseApi } from '@/api/system/house';
|
||||
import TableUnit from './components/table.vue';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { listHouseUseType_add_house } from '@/api/system/houseUse';
|
||||
import { addUnitNo, delUnitNo, updateUnitNo } from '@/api/system/houseUnit';
|
||||
import { validator } from '@/utils/Reg';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const router = useRouter();
|
||||
|
||||
const housename = ref('');
|
||||
const houseUse = ref('');
|
||||
const houseUseTypeList = ref([]);
|
||||
|
||||
/**
|
||||
* 获取房屋 类型
|
||||
*/
|
||||
function init() {
|
||||
listHouseUseType_add_house({}).then((res) => {
|
||||
houseUseTypeList.value = res.data;
|
||||
});
|
||||
}
|
||||
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' },
|
||||
{
|
||||
validator: (_: any, value: string, callback: (error?: Error) => void) => {
|
||||
if (!value || value.trim() === '') {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
// 使用 Character 正则验证(只允许字母、数字、中文、下划线、横线)
|
||||
const isValid = validator(value, 'Character');
|
||||
if (!isValid) {
|
||||
callback(new Error('只能输入中文、字母、数字、下划线和横线'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
buildingId: [{ required: true, message: '所属楼栋不能为空', trigger: 'blur' }]
|
||||
};
|
||||
/** 新增按钮操作 */
|
||||
const handleAddUnit = () => {
|
||||
router.push({
|
||||
path: '/house/addUnit'
|
||||
});
|
||||
};
|
||||
/** 修改按钮操作 */
|
||||
const handleEditUnit = (id: string) => {
|
||||
router.push({
|
||||
path: '/house/editUnit',
|
||||
query: {
|
||||
id
|
||||
}
|
||||
});
|
||||
};
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = (id: string) => {
|
||||
proxy?.$modal
|
||||
.confirm('是否确认删除该单元?')
|
||||
.then(() => {
|
||||
delUnitNo(id).then(() => {
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
houseStore.updateCureentBuilding();
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
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() {
|
||||
houseStore.getHouseBybuildingNo(housename.value, houseUse.value);
|
||||
}
|
||||
function reset() {
|
||||
housename.value = '';
|
||||
houseUse.value = '';
|
||||
houseStore.getHouseBybuildingNo(housename.value, houseUse.value);
|
||||
}
|
||||
|
||||
async function deleteAllHouse() {
|
||||
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?');
|
||||
const checkhouse = houseStore.checkoutHouses;
|
||||
if (checkhouse.length > 0) {
|
||||
deleteHouseApi(checkhouse).then(() => {
|
||||
houseStore.switchBuilding(houseStore.currentBuildingInfo.id);
|
||||
ElMessage.success('批量删除成功');
|
||||
});
|
||||
} else {
|
||||
ElMessage.warning('请选择要删除的房屋');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$primary_color: #1978fe;
|
||||
.UnitBox {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
border-radius: 2px;
|
||||
font-size: 14px;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
|
||||
.Unit_top {
|
||||
padding: 20px 20px 0;
|
||||
flex-wrap: wrap;
|
||||
box-sizing: border-box;
|
||||
color: rgba(102, 102, 102, 1);
|
||||
& > div {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.rightActions {
|
||||
color: $primary_color;
|
||||
height: 25px;
|
||||
span {
|
||||
cursor: pointer;
|
||||
}
|
||||
.selectbox {
|
||||
width: 150px;
|
||||
margin: 0 10px;
|
||||
@media (max-width: 1550px) {
|
||||
width: 120px;
|
||||
}
|
||||
@media (max-width: 1400px) {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
s .searchbox {
|
||||
.searchinput {
|
||||
width: 250px;
|
||||
@media (max-width: 1550px) {
|
||||
width: 130px;
|
||||
}
|
||||
@media (max-width: 1400px) {
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.UnitBody {
|
||||
flex: 1;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,72 +1,544 @@
|
||||
<template>
|
||||
<div class="p-2 houselist flex flex-col">
|
||||
<PageHeader>
|
||||
<template #content>
|
||||
<div class="houseAdressBox">
|
||||
<span class="mr-50px">当前小区:{{ currentVilageInfo && currentVilageInfo.villageName }}</span>
|
||||
<span>小区地址: {{ currentVilageInfo && currentVilageInfo.address }}</span>
|
||||
<div class="p-2 h-full flex flex-col">
|
||||
<pageHeader></pageHeader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-position="left" label-width="100" @submit.prevent="handleQuery">
|
||||
<el-form-item label="房东姓名" prop="landlordName">
|
||||
<el-input v-model.trim="queryParams.landlordName" maxlength="10" placeholder="请输入房东姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="承租方姓名" prop="lesseeName">
|
||||
<el-input v-model.trim="queryParams.lesseeName" maxlength="10" placeholder="请输入承租方姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="房间号" prop="houseNo">
|
||||
<el-input v-model.trim="queryParams.houseNo" maxlength="10" placeholder="请输入房间号" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">搜索</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never" style="flex: 1">
|
||||
<div class="residentBody h-full">
|
||||
<div class="treeBox h-full">
|
||||
<div class="treeTitleBox">
|
||||
<span class="treeTitleText">{{ currentVilageInfo.villageName ?? '--' }}</span>
|
||||
<el-button v-has-permi="['system:building:add']" link type="primary" @click="handleAddBuilding">
|
||||
<el-icon><Plus /></el-icon>新增
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="treeBoxBody">
|
||||
<!-- 树状+ -->
|
||||
<el-tree :data="treated" :highlight-current="true" :props="defaultProps" style="max-width: 600px" @node-click="handleNodeClick">
|
||||
<template #default="{ data }">
|
||||
<div class="treeNode">
|
||||
<span class="treeNodeLabel" :title="data.label">{{ data.label }}</span>
|
||||
<span class="treeNodeActions" @click.stop>
|
||||
<el-button v-has-permi="['system:building:edit']" title="编辑" link type="primary" @click="handleEditBuilding(data)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
</el-button>
|
||||
<el-button v-has-permi="['system:building:remove']" title="删除" link type="danger" @click="handleDeleteBuilding(data)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-tree>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1 h-full">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<right-toolbar
|
||||
:disable-delete="multiple"
|
||||
:disable-edit="single"
|
||||
:show-add="checkPermi(['system:house:add'])"
|
||||
:show-delete="checkPermi(['system:house:remove'])"
|
||||
:show-edit="checkPermi(['system:house:edit'])"
|
||||
@update:add="handleAdd"
|
||||
@update:edit="handleUpdate()"
|
||||
@update:delete="handleDelete()"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="houseList" border class="tablebox" @selection-change="handleSelectionChange">
|
||||
<el-table-column align="center" type="selection" width="55" />
|
||||
<el-table-column align="center" label="房间号" min-width="100" prop="houseNo" />
|
||||
<el-table-column align="center" label="楼层" prop="floorNo" width="80" />
|
||||
<!-- <el-table-column align="center" label="房屋类型" min-width="100" prop="houseType" /> -->
|
||||
<el-table-column align="center" label="建筑面积(㎡)" min-width="110" prop="houseArea" />
|
||||
<el-table-column align="center" label="套内面积(㎡)" min-width="110" prop="internalArea" />
|
||||
<el-table-column align="center" label="公摊面积(㎡)" min-width="110" prop="shareArea" />
|
||||
<el-table-column align="center" label="房东" min-width="100" prop="landlordName" />
|
||||
<el-table-column align="center" label="房东电话" min-width="120" prop="landlordPhone" />
|
||||
<el-table-column align="center" label="承租方" min-width="100" prop="lesseeName" />
|
||||
<el-table-column align="center" label="承租方电话" min-width="120" prop="lesseePhone" />
|
||||
<!-- <el-table-column align="center" label="状态" prop="status" width="120">
|
||||
<template #default="scope">
|
||||
<DictTag :options="com_review" :value="scope.row.status"></DictTag>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column align="center" label="备注" min-width="120" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作" min-width="160">
|
||||
<template #default="scope">
|
||||
<el-button v-has-permi="['system:house:ByIdList']" link type="primary" @click="handleMain(scope.row)">详情</el-button>
|
||||
<el-button v-has-permi="['system:house:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-button v-has-permi="['system:house:remove']" link type="primary" @click="handleDelete(scope.row)">删除 </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-show="total > 0"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNum"
|
||||
:total="total"
|
||||
@pagination="handlePagination"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 新增/编辑区 -->
|
||||
<el-dialog v-model="buildingDialog.visible" :title="buildingDialog.title" width="500px" append-to-body>
|
||||
<el-form ref="buildingFormRef" :model="buildingForm" :rules="buildingRules" label-width="90px">
|
||||
<el-form-item label="区名称" prop="buildingName">
|
||||
<el-input v-model.trim="buildingForm.buildingName" maxlength="20" placeholder="请输入区名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼层数" prop="floorCount">
|
||||
<el-input-number v-model="buildingForm.floorCount" :min="1" :max="999" controls-position="right" placeholder="请输入楼层数" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="buildingDialog.visible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="buildingSubmitLoading" @click="submitBuildingForm">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</PageHeader>
|
||||
<div class="houseBody w-full flex align-center justify-center">
|
||||
<building></building>
|
||||
<unit></unit>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import building from './components/building.vue';
|
||||
import unit from './components/unit.vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
<script lang="ts" name="House" setup>
|
||||
import Pagination from '@/components/Pagination/index.vue';
|
||||
import pageHeader from '@/components/Pageheader/index.vue';
|
||||
import RightToolbar from '@/components/RightToolbar/index.vue';
|
||||
|
||||
import { getHouseListAPI, getHouselistAPI, deleteHouseApi, addBuildingApi, editBuildingApi, deleteBuildingApi, getBuildingOnly } from '@/api/system/house';
|
||||
import { HouseListVO, HouseListQuery, addBuildingType } from '@/api/system/house/type';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { checkPermi } from '@/utils/permission';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { currentVilageInfo } = storeToRefs(houseStore);
|
||||
const currentVilageInfo = ref({
|
||||
'villageId': null,
|
||||
'villageName': '',
|
||||
'villageCode': '',
|
||||
'city': '',
|
||||
'address': '',
|
||||
'completDate': '',
|
||||
'houseUse': 0,
|
||||
'villageArea': null,
|
||||
'parkingSpaceCount': null,
|
||||
'villageImageUrl': '',
|
||||
'status': '0',
|
||||
'remark': '',
|
||||
'manageName': '',
|
||||
'managePhone': '',
|
||||
'manageQq': '',
|
||||
'manageVx': '',
|
||||
'manageEmail': ''
|
||||
});
|
||||
|
||||
function init() {
|
||||
houseStore.getviliageinfo(localStorage.getItem('villageid'));
|
||||
houseStore.initHouse();
|
||||
houseStore.getviliageinfo(localStorage.getItem('villageid')).then((res) => {
|
||||
if (res) {
|
||||
currentVilageInfo.value = res;
|
||||
}
|
||||
});
|
||||
}
|
||||
init();
|
||||
|
||||
// 初始化数据
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const router = useRouter();
|
||||
const houseList = ref<HouseListVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<string[]>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
|
||||
const queryParams = ref<HouseListQuery & { pageNum: number; pageSize: number }>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
buildingId: null,
|
||||
unitNoId: null,
|
||||
houseId: null,
|
||||
houseNo: null,
|
||||
landlordName: null,
|
||||
lesseeName: null,
|
||||
houseUseTypeId: null
|
||||
});
|
||||
|
||||
// ! 树形------------------------------------------------------------------------
|
||||
interface Tree {
|
||||
label: string;
|
||||
value: number;
|
||||
type: string;
|
||||
children?: Tree[];
|
||||
}
|
||||
// 从被点击节点向上查找所属楼栋id
|
||||
const getNodeBuildingId = (node: any): string | null => {
|
||||
let current = node;
|
||||
while (current) {
|
||||
if (current.data?.type === 'buildingId') return current.data.value;
|
||||
current = current.parent;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
// 四个参数:对应于节点点击的节点对象,TreeNode 的 node 属性, TreeNode和事件对象
|
||||
const handleNodeClick = (data: Tree, node) => {
|
||||
const buildingId = getNodeBuildingId(node);
|
||||
if (!buildingId) return;
|
||||
queryParams.value = {
|
||||
...queryParams.value,
|
||||
buildingId,
|
||||
unitNoId: data.type === 'unitNoId' ? String(data.value) : null,
|
||||
houseId: data.type === 'houseId' ? String(data.value) : null,
|
||||
houseNo: null,
|
||||
landlordName: null,
|
||||
lesseeName: null,
|
||||
pageNum: 1
|
||||
};
|
||||
getTreeHouseList(buildingId, node);
|
||||
};
|
||||
|
||||
// ! 区(楼栋)新增/编辑/删除------------------------------------------------------------------------
|
||||
const buildingDialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
const buildingFormRef = ref<ElFormInstance>();
|
||||
const buildingSubmitLoading = ref(false);
|
||||
const initBuildingForm = (): addBuildingType & { id?: string } => ({
|
||||
id: '',
|
||||
buildingName: '',
|
||||
floorCount: null,
|
||||
villageId: localStorage.getItem('villageid')
|
||||
});
|
||||
const buildingForm = ref<addBuildingType & { id?: string }>(initBuildingForm());
|
||||
const buildingRules = {
|
||||
buildingName: [{ required: true, message: '请输入区名称', trigger: 'blur' }],
|
||||
floorCount: [{ required: true, message: '请输入楼层数', trigger: 'blur' }]
|
||||
};
|
||||
|
||||
/** 新增区 */
|
||||
const handleAddBuilding = () => {
|
||||
buildingForm.value = initBuildingForm();
|
||||
buildingFormRef.value?.clearValidate();
|
||||
buildingDialog.title = '新增区';
|
||||
buildingDialog.visible = true;
|
||||
};
|
||||
|
||||
/** 编辑区 */
|
||||
const handleEditBuilding = async (data: Tree) => {
|
||||
const res: any = await getBuildingOnly(String(data.value));
|
||||
const building: any = res?.data ?? res;
|
||||
buildingForm.value = {
|
||||
id: building.id ?? String(data.value),
|
||||
buildingName: building.buildingName ?? data.label,
|
||||
floorCount: building.floorCount ?? null,
|
||||
villageId: building.villageId ?? localStorage.getItem('villageid')
|
||||
};
|
||||
buildingFormRef.value?.clearValidate();
|
||||
buildingDialog.title = '编辑区';
|
||||
buildingDialog.visible = true;
|
||||
};
|
||||
|
||||
/** 提交新增/编辑区 */
|
||||
const submitBuildingForm = () => {
|
||||
buildingFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (!valid) return;
|
||||
buildingSubmitLoading.value = true;
|
||||
try {
|
||||
const { id, ...data } = buildingForm.value;
|
||||
if (id) {
|
||||
await editBuildingApi({ ...data, id });
|
||||
proxy?.$modal.msgSuccess('修改成功');
|
||||
} else {
|
||||
await addBuildingApi(data);
|
||||
proxy?.$modal.msgSuccess('新增成功');
|
||||
}
|
||||
buildingDialog.visible = false;
|
||||
better();
|
||||
getList();
|
||||
} finally {
|
||||
buildingSubmitLoading.value = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除区 */
|
||||
const handleDeleteBuilding = (data: Tree) => {
|
||||
proxy?.$modal.confirm(`是否确认删除区「${data.label}」?`).then(async () => {
|
||||
await deleteBuildingApi(String(data.value));
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
if (String(queryParams.value.buildingId) === String(data.value)) {
|
||||
queryParams.value.buildingId = null;
|
||||
queryParams.value.unitNoId = null;
|
||||
queryParams.value.houseId = null;
|
||||
}
|
||||
better();
|
||||
getList();
|
||||
});
|
||||
};
|
||||
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
};
|
||||
// ! 树形------------------------------------------------------------------------
|
||||
const treated = ref([]);
|
||||
function better() {
|
||||
treated.value = [];
|
||||
houseStore.getCurrentVilageTreeHouse().then((res) => {
|
||||
// 左侧树只展示楼栋(区号)一层,不展示单元/房间
|
||||
treated.value = (res ?? []).map((node: any) => ({
|
||||
label: node.label,
|
||||
value: node.value,
|
||||
type: node.type
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
better();
|
||||
|
||||
const treeMode = ref(false);
|
||||
// 最近一次树查询条件,翻页时复用
|
||||
let lastTreeQuery: { buildingId: string; node: any } | null = null;
|
||||
|
||||
/** 左侧树点击:根据楼栋id查询房屋 */
|
||||
const getTreeHouseList = async (buildingId: string, node: any) => {
|
||||
treeMode.value = true;
|
||||
lastTreeQuery = { buildingId, node };
|
||||
loading.value = true;
|
||||
houseList.value = [];
|
||||
try {
|
||||
const res: any = await getHouselistAPI(buildingId, undefined, undefined, queryParams.value.pageNum, queryParams.value.pageSize);
|
||||
const payload = res?.data ?? res;
|
||||
const rows: HouseListVO[] = payload?.houses ?? [];
|
||||
total.value = payload?.total ?? rows.length;
|
||||
houseList.value = rows;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 分页组件回调:树查询复用最近一次楼栋查询,搜索走 /house/list */
|
||||
const handlePagination = () => {
|
||||
if (treeMode.value && lastTreeQuery) {
|
||||
getTreeHouseList(lastTreeQuery.buildingId, lastTreeQuery.node);
|
||||
} else {
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 查询房屋管理列表 */
|
||||
const getList = async () => {
|
||||
treeMode.value = false;
|
||||
lastTreeQuery = null;
|
||||
loading.value = true;
|
||||
houseList.value = [];
|
||||
try {
|
||||
const res: any = await getHouseListAPI(queryParams.value);
|
||||
const payload = res?.data ?? res;
|
||||
const rows: HouseListVO[] = Array.isArray(payload) ? payload : (payload?.rows ?? payload?.list ?? []);
|
||||
total.value = Array.isArray(payload) ? rows.length : (payload?.total ?? rows.length);
|
||||
houseList.value = rows;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
getList();
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
queryParams.value = {
|
||||
...queryParams.value,
|
||||
...{
|
||||
buildingId: null,
|
||||
unitNoId: null,
|
||||
houseId: null
|
||||
}
|
||||
};
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
queryParams.value = {
|
||||
...queryParams.value,
|
||||
...{
|
||||
houseId: null,
|
||||
buildingId: null,
|
||||
unitNoId: null,
|
||||
houseNo: null,
|
||||
landlordName: null,
|
||||
lesseeName: null
|
||||
}
|
||||
};
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: HouseListVO[]) => {
|
||||
ids.value = selection.map((item) => item.houseId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/house/addResident'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = (row?: HouseListVO) => {
|
||||
const _id = row?.houseId || ids.value[0];
|
||||
router.push({
|
||||
path: '/house/addResident',
|
||||
query: {
|
||||
id: _id
|
||||
}
|
||||
});
|
||||
};
|
||||
/** 房屋详情 */
|
||||
const handleMain = (row: HouseListVO) => {
|
||||
router.push({
|
||||
path: '/house/HouseDetails',
|
||||
query: {
|
||||
id: row.houseId
|
||||
}
|
||||
});
|
||||
};
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: HouseListVO) => {
|
||||
const _ids = row?.houseId ? [row.houseId] : ids.value;
|
||||
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
|
||||
await deleteHouseApi(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.houselist {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
.houseBody {
|
||||
flex: 1;
|
||||
margin-top: 10px;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
.houseAdressBox {
|
||||
margin-top: 25px;
|
||||
color: rgba(102, 102, 102, 1);
|
||||
font-size: 14px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.houseTypeBox {
|
||||
margin-top: 20px;
|
||||
.housetype {
|
||||
$activeColor: rgba(26, 117, 255, 1);
|
||||
cursor: pointer;
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
line-height: 20px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
border: 1px solid transparent;
|
||||
margin-left: -1px;
|
||||
.residentBody {
|
||||
display: flex;
|
||||
.treeBox {
|
||||
width: 250px;
|
||||
min-width: 150px;
|
||||
max-width: 250px;
|
||||
margin-right: 10px;
|
||||
|
||||
&:hover,
|
||||
&.active {
|
||||
color: $activeColor;
|
||||
border-bottom-color: $activeColor;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.treeTitleBox {
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
padding: 0 12px 0 20px;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
background-color: rgba(233, 242, 255, 0.5);
|
||||
color: rgba(16, 16, 16, 1);
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.treeTitleText {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.el-button {
|
||||
flex-shrink: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.treeBoxBody {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
margin-top: 10px;
|
||||
|
||||
&:deep(.el-tree-node__content) {
|
||||
margin-bottom: 5px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
.el-tree-node__expand-icon {
|
||||
font-size: 18px;
|
||||
}
|
||||
&:hover {
|
||||
background: #d1e3ff;
|
||||
.el-text {
|
||||
color: #227aff;
|
||||
}
|
||||
.el-tree-node__expand-icon {
|
||||
color: #227aff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.treeNode {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-right: 8px;
|
||||
overflow: hidden;
|
||||
|
||||
.treeNodeLabel {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.treeNodeActions {
|
||||
display: inline-flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
.el-button {
|
||||
margin-left: 4px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tablebox {
|
||||
height: calc(100% - 105px);
|
||||
/* 空数据也不会无限变宽 */
|
||||
:deep(.el-table__empty-block) {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,599 +0,0 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form class="formBody" label-position="right" ref="formRef" :model="form" :rules="rules" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="房屋" prop="houseId">
|
||||
<el-cascader @change="handleChange" v-model="userHousePath" :options="treeData" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="业主姓名" prop="rentalName">
|
||||
<el-input maxlength="20" v-model.trim="form.rentalName" placeholder="请输入业主姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="租赁状态" prop="rentalStatus">
|
||||
<el-select v-model="form.rentalStatus" placeholder="请选择">
|
||||
<el-option v-for="(item, index) in com_rental_status" :key="index" :label="item.label" :value="Number(item.value)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<!-- <el-form-item label="房屋用途" prop="houseUse">-->
|
||||
<!-- <el-select v-model.trim="form.houseUse" placeholder="请选择">-->
|
||||
<!-- <el-option v-for="(item, index) in houseUseTypeList" :key="index" :label="item.name" :value="item.id" />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="租金" prop="rent">
|
||||
<el-input maxlength="8" v-model.number.trim="form.rent" placeholder="请输入租金">
|
||||
<template #suffix>¥</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="租赁方式" prop="rentalType">
|
||||
<el-radio-group v-model="form.rentalType">
|
||||
<el-radio v-for="item in com_rental_method" :key="item.value" :value="item.value">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="房屋朝向" prop="type">
|
||||
<el-select v-model="form.houseFace" placeholder="请选择">
|
||||
<el-option v-for="(item, index) in houseFormat" :key="index" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="房屋面积" prop="houseArea">
|
||||
<el-input maxlength="8" v-model.trim="form.houseArea" placeholder="请输入房屋面积">
|
||||
<template #suffix> ㎡ </template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="房屋楼层" prop="floorNo">
|
||||
<el-input-number :max="1000" v-model.number.trim="form.floorNo" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="入住时间" prop="inTime">
|
||||
<el-date-picker
|
||||
value-format="YYYY-MM-DD"
|
||||
tag-effect="dark"
|
||||
tag-type="primary"
|
||||
v-model="form.inTime"
|
||||
type="date"
|
||||
placeholder="选择入住时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="房屋设施" prop="type">
|
||||
<div class="houseDevicesBox" v-if="houseFacilities.length > 0">
|
||||
<div
|
||||
v-for="item in houseFacilities"
|
||||
:key="item.id"
|
||||
@click="handleClick(item.id)"
|
||||
class="houseDevices_Item"
|
||||
:class="{
|
||||
active: houseDevicesList.includes(item.id)
|
||||
}"
|
||||
>
|
||||
<span class="checked">√</span>
|
||||
<span class="ml-2">{{ item.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span v-else style="color: gray"> 无</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="上传房屋照片">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
accept=".png, .jpg"
|
||||
v-model:file-list="fileList"
|
||||
class="avatar-uploader"
|
||||
:action="uploadUrl"
|
||||
name="files"
|
||||
:multiple="true"
|
||||
:auto-upload="false"
|
||||
list-type="picture-card"
|
||||
:limit="9"
|
||||
:on-exceed="handleExceed"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:on-remove="handleRemove"
|
||||
:on-success="handleAvatarSuccess"
|
||||
:on-change="handleChangeFile"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">jpg/png 文件格式</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<el-dialog v-model="dialogVisible">
|
||||
<img w-full :src="dialogImageUrl" alt="Preview Image" />
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="补充房屋信息" prop="remark">
|
||||
<el-input type="textarea" maxlength="200" show-word-limit :rows="5" v-model.trim="form.supInfo" placeholder="请输入补充房屋信息" />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model.number.trim="form.phone" placeholder="请输入手机号码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="微信" prop="vx">
|
||||
<el-input maxlength="20" v-model.trim="form.vx" placeholder="请输入微信号码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<!-- <el-form-item label="邮箱" prop="email">-->
|
||||
<!-- <el-input v-model.trim="form.email" placeholder="请输入邮箱" />-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item style="margin-top: 30px">
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
<el-button @click="cancelForm">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { CascaderValue, UploadFiles, UploadInstance, UploadProps, UploadUserFile } from 'element-plus';
|
||||
|
||||
import { hasFormData, splitStringUrl } from '@/utils/house';
|
||||
import { addHouseRental, getHouseOwnUser, getHouseRental, updateHouseRental, uploadHouseImage } from '@/api/system/houseRental';
|
||||
import { validator } from '@/utils/Reg';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { listHouseFacilities } from '@/api/system/HouseFacilities';
|
||||
import { Plus } from '@element-plus/icons-vue';
|
||||
import { listHouseUseType_add_house } from '@/api/system/houseUse';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
|
||||
const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/houseRental/uploadImages';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_rental_method } = toRefs<any>(proxy?.useDict('com_rental_method'));
|
||||
const { com_rental_status } = toRefs<any>(proxy?.useDict('com_rental_status'));
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const formRef = ref();
|
||||
// 房屋朝向
|
||||
const houseFormat = ['北', '东北', '东', '东南', '南', '西南', '西', '西北'];
|
||||
const form = ref({
|
||||
id: null,
|
||||
houseId: null,
|
||||
rentalName: '', // 租户姓名
|
||||
rent: null, // 租金
|
||||
houseFace: '', // 房屋朝向
|
||||
rentalType: '0', // 整租合租
|
||||
phone: null, //手机号
|
||||
houseArea: 0, // 房屋面积
|
||||
floorNo: 1, //楼层号
|
||||
inTime: '', //入住时间
|
||||
facilities: '', //房屋设施
|
||||
houseImageUrl: '', //房屋图片
|
||||
supInfo: '', //补充租房信息
|
||||
vx: '', //微信
|
||||
rentalStatus: 1, //租赁状态
|
||||
buildingId: null, //楼栋id
|
||||
unitNoId: null, //单元id
|
||||
email: '' //邮箱
|
||||
});
|
||||
const userHousePath = ref<CascaderValue>([]);
|
||||
const rules = ref({
|
||||
houseId: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
|
||||
rentalName: [
|
||||
{ required: true, message: '请输入名称', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, val: string | number, callback: (arg0?: Error) => void) => {
|
||||
if (val === '' || val === null || val === undefined) {
|
||||
return callback(new Error('请输入名称'));
|
||||
}
|
||||
return validator(val, 'Character') ? callback() : callback(new Error('请输入正确的名称'));
|
||||
}
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, val: string | number) => validator(val, 'phone'),
|
||||
message: '请输入正确的手机号码',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
email: [
|
||||
{ required: false, message: '请输入邮箱', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, val: string | number) => {
|
||||
if (val === '') {
|
||||
return true;
|
||||
}
|
||||
return validator(val, 'email');
|
||||
},
|
||||
message: '请输入正确的邮箱',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
rent: [
|
||||
{
|
||||
required: false,
|
||||
message: '请输入正确的租金',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
validator: (_: any, val: string | number, callback: (arg0?: Error) => void) => {
|
||||
if (val === '' || val === null) {
|
||||
return callback();
|
||||
}
|
||||
if (validator(val, 'money')) {
|
||||
return callback();
|
||||
}
|
||||
return callback(new Error('请输入正确的租金'));
|
||||
}
|
||||
}
|
||||
],
|
||||
vx: [
|
||||
{ required: false, message: '请输入微信号码', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
|
||||
if (value === '' || value === null || value === 0) {
|
||||
return callback();
|
||||
}
|
||||
if (validator(value, 'vx')) {
|
||||
return callback(new Error('请输入正确的微信号码'));
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
],
|
||||
houseArea: [
|
||||
{
|
||||
required: false,
|
||||
message: '请输入房屋面积',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
|
||||
if (value === '' || value === null || value === 0) {
|
||||
return callback();
|
||||
}
|
||||
const val = Number(value);
|
||||
if (Number.isNaN(val)) {
|
||||
return callback(new Error('请输入数字'));
|
||||
}
|
||||
if (val < 0) {
|
||||
return callback(new Error('房屋面积不能小于0'));
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
// ! 编辑租赁-=================================================================================
|
||||
const userid = ref(null);
|
||||
const treeData = ref(null);
|
||||
const houseFacilities = ref([]);
|
||||
// !== 楼栋房屋 =============================================================================
|
||||
async function getTreeData() {
|
||||
const resList = await listHouseFacilities();
|
||||
houseFacilities.value = resList.rows
|
||||
.map((item) => {
|
||||
if (item.status !== '1') return item;
|
||||
return false;
|
||||
})
|
||||
.filter((item) => item !== false);
|
||||
|
||||
treeData.value = await houseStore.getCurrentVilageTreeHouse();
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getHouseRental(userid.value).then((res) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
if (form.value.facilities) houseDevicesList.value = form.value.facilities.split(',').filter((item) => item);
|
||||
if (form.value.houseImageUrl) fileList.value = splitStringUrl(form.value.houseImageUrl);
|
||||
userHousePath.value = [form.value.buildingId, form.value.unitNoId, form.value.houseId];
|
||||
});
|
||||
}
|
||||
}
|
||||
getTreeData();
|
||||
|
||||
const houseUseTypeList = ref([]);
|
||||
function getHouseUseType() {
|
||||
listHouseUseType_add_house().then((res) => {
|
||||
houseUseTypeList.value = res.data;
|
||||
});
|
||||
}
|
||||
getHouseUseType();
|
||||
|
||||
// 获取房屋
|
||||
function handleChange(val: CascaderValue) {
|
||||
userHousePath.value = val;
|
||||
form.value.houseId = val[2];
|
||||
if (val[2]) {
|
||||
getHouseOwnUser(val[2]).then((res) => {
|
||||
if (res.data) {
|
||||
form.value.rentalName = res.data.ownerName ?? '';
|
||||
form.value.houseArea = res.data.houseArea;
|
||||
form.value.floorNo = res.data.floorNo;
|
||||
} else {
|
||||
form.value.floorNo = undefined;
|
||||
form.value.houseArea = undefined;
|
||||
form.value.rentalName = undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// !== 上传文件 =============================================================================
|
||||
const fileList = ref<UploadUserFile[]>([]);
|
||||
const dialogImageUrl = ref('');
|
||||
const dialogVisible = ref(false);
|
||||
// 上传文件成功
|
||||
const uploadRef = ref<UploadInstance>();
|
||||
const handleAvatarSuccess: UploadProps['onSuccess'] = (response) => {
|
||||
if (response.data && response.data.error.length > 0) {
|
||||
ElMessage.error('图片上传失败,请稍后再试');
|
||||
}
|
||||
};
|
||||
|
||||
const blockedExits = ['.exe', '.bat', '.cmd', '.msi'];
|
||||
const allowExits = ['.bmp', '.gif', '.jpg', '.jpeg', '.png'];
|
||||
const handleChangeFile = (uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
||||
const ext = uploadFile.name.toLowerCase().slice(uploadFile.name.lastIndexOf('.'));
|
||||
if (blockedExits.includes(ext)) {
|
||||
ElMessage.warning(`禁止上传 ${ext} 文件`);
|
||||
uploadRef.value.handleRemove(uploadFile);
|
||||
return;
|
||||
}
|
||||
if (!allowExits.includes(ext)) {
|
||||
ElMessage.warning(`只允许上传jpg,jpeg,png等`);
|
||||
uploadRef.value.handleRemove(uploadFile);
|
||||
return;
|
||||
}
|
||||
fileList.value = uploadFiles;
|
||||
};
|
||||
const handleExceed = () => {
|
||||
ElMessage.warning('最多上传9张图片');
|
||||
};
|
||||
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
||||
dialogImageUrl.value = '';
|
||||
dialogImageUrl.value = uploadFile.url;
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
const handleRemove: UploadProps['onRemove'] = (_, uploadFiles) => {
|
||||
fileList.value = uploadFiles;
|
||||
};
|
||||
|
||||
// !== 家电 =============================================================================
|
||||
|
||||
// 家电
|
||||
const houseDevicesList = ref([]);
|
||||
function handleClick(index: number) {
|
||||
if (houseDevicesList.value.includes(index)) {
|
||||
houseDevicesList.value = houseDevicesList.value.filter((item) => item !== index);
|
||||
} else {
|
||||
houseDevicesList.value.push(index);
|
||||
}
|
||||
}
|
||||
|
||||
// !== 提交 =============================================================================
|
||||
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
// 处理家电
|
||||
form.value.facilities = houseDevicesList.value.join(',');
|
||||
let str = '';
|
||||
// 判断有无图片
|
||||
if (fileList.value.length > 0) {
|
||||
const formData = new FormData();
|
||||
fileList.value.forEach((item) => {
|
||||
// 只处理 新增的图片
|
||||
if (item.raw && item.raw instanceof File) {
|
||||
formData.append('files', item.raw);
|
||||
} else {
|
||||
str += item.url + ',';
|
||||
}
|
||||
});
|
||||
if (!hasFormData(formData)) return sendForm(str);
|
||||
uploadHouseImage(formData)
|
||||
.then((res) => {
|
||||
if (res.data.success.length > 0) {
|
||||
const successList = res.data.success;
|
||||
successList.forEach((item) => {
|
||||
str += item.url + ',';
|
||||
});
|
||||
form.value.houseImageUrl = str;
|
||||
}
|
||||
if (res.data.error.length > 0) {
|
||||
const str = res.data.error.join(',');
|
||||
res.data.error.forEach((item) => {
|
||||
fileList.value = fileList.value.filter((file) => file.name !== item);
|
||||
});
|
||||
ElMessage.error('图片:' + str + ' 上传失败!');
|
||||
}
|
||||
sendForm(str);
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err && err.data && err.data.error.length > 0) {
|
||||
const str = err.data.error.join(',');
|
||||
err.data.error.forEach((item: string) => {
|
||||
fileList.value = fileList.value.filter((file) => file.name !== item);
|
||||
});
|
||||
ElMessage.error('图片:' + str + ' 上传失败!,请重新上传');
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
sendForm(str);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const sendForm = (val: string) => {
|
||||
form.value.houseImageUrl = val;
|
||||
// edit or add
|
||||
if (userid.value) {
|
||||
updateHouseRental(form.value).then(() => {
|
||||
ElMessage.success('编辑成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
addHouseRental({
|
||||
...form.value
|
||||
}).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
};
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.back();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.avatar-uploader .avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
}
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed var(--el-border-color);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: var(--el-transition-duration-fast);
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: var(--el-color-primary);
|
||||
}
|
||||
.avatar {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.el-icon.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
.AddBuildingBox {
|
||||
padding: 15px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.AddBuildingBody {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: white;
|
||||
padding: 15px;
|
||||
.title {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding-left: 20px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
color: rgba(16, 16, 16, 1);
|
||||
border-bottom: 1px solid #bbbbbb;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.formBody {
|
||||
width: 1050px;
|
||||
margin: 0 auto;
|
||||
.houseDevicesBox {
|
||||
display: grid;
|
||||
margin-bottom: 20px;
|
||||
gap: 10px 20px;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
grid-template-rows: repeat(2, 1fr);
|
||||
.houseDevices_Item {
|
||||
width: 95px;
|
||||
height: 35px;
|
||||
background-color: #ccc;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
line-height: 35px;
|
||||
cursor: pointer;
|
||||
&.active {
|
||||
background-color: rgb(232, 241, 255);
|
||||
color: #267cff;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:deep(.el-form-item__content, .el-select, .el-input) {
|
||||
width: 350px !important;
|
||||
margin-right: 10px;
|
||||
.el-cascader {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.el-form-item {
|
||||
margin-bottom: 20px;
|
||||
align-items: center;
|
||||
}
|
||||
.el-button {
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,231 +0,0 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader title="房屋租赁管理"></PageHeader>
|
||||
<div class="AddBuildingBody" v-loading="loading">
|
||||
<div class="title flex flex-items-center flex-justify-between">
|
||||
<div>
|
||||
<span>基础资料 </span>
|
||||
<span class="ml-20px color-blue cursor-pointer" @click="hanlededit">编辑</span>
|
||||
</div>
|
||||
<el-button @click="handlBack" class="mr-10px">返回</el-button>
|
||||
</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">房屋:</div>
|
||||
<div class="value">{{ HouseInfo.name }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">业主姓名:</div>
|
||||
<div class="value">{{ HouseInfo.rentalName }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">租金:</div>
|
||||
<div class="value">{{ HouseInfo.rent }}元</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">租赁方式:</div>
|
||||
<div class="value">
|
||||
<DictTag :options="com_rental_method" :value="HouseInfo.rentalType"></DictTag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">房屋朝向:</div>
|
||||
<div class="value">{{ HouseInfo.houseFace }}</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">房屋面积:</div>
|
||||
<div class="value">{{ HouseInfo.houseArea }}㎡</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">房屋楼层:</div>
|
||||
<div class="value">{{ HouseInfo.floorNo }}层</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">入住时间:</div>
|
||||
<div class="value">{{ HouseInfo.inTime }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">房屋设施:</div>
|
||||
<div class="value">
|
||||
<span style="margin-right: 10px" v-for="item in HouseInfo.facilitieslist" :key="item">{{ handlefacilities(item) }} </span>
|
||||
</div>
|
||||
</div>
|
||||
<el-row :span="24">
|
||||
<el-col :span="24">
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">房屋照片:</div>
|
||||
<div class="value">
|
||||
<el-image
|
||||
v-for="(item, index) in HouseInfo.houseImageUrls"
|
||||
:key="index"
|
||||
:zoom-rate="1.2"
|
||||
:max-scale="7"
|
||||
:min-scale="0.2"
|
||||
:src="item"
|
||||
:preview-src-list="HouseInfo.houseImageUrls"
|
||||
show-progress
|
||||
:initial-index="index"
|
||||
class="houseImage"
|
||||
></el-image>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">租房信息:</div>
|
||||
<div class="value">{{ HouseInfo.supInfo }}</div>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">租房电话:</div>
|
||||
<div class="value">{{ HouseInfo.phone }}</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">微信:</div>
|
||||
<div class="value">{{ HouseInfo.vx }}</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import DictTag from '@/components/DictTag/index.vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { getHouseRental } from '@/api/system/houseRental';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { getHousePathById } from '@/utils/house';
|
||||
import { listHouseFacilities } from '@/api/system/HouseFacilities';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_rental_method } = toRefs<any>(proxy?.useDict('com_rental_method'));
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const houseRentalid = ref(null);
|
||||
const HouseInfo = ref({
|
||||
'id': null,
|
||||
'house': '',
|
||||
'name': null,
|
||||
'rentalStatus': null,
|
||||
'rentalName': '',
|
||||
'rent': null,
|
||||
'rentalType': '',
|
||||
'houseFace': '',
|
||||
'houseArea': null,
|
||||
'floorNo': null,
|
||||
'inTime': '',
|
||||
'facilities': '',
|
||||
'houseImageUrl': '',
|
||||
'supInfo': '',
|
||||
'phone': null,
|
||||
'vx': '',
|
||||
'email': '',
|
||||
'houseId': null,
|
||||
'houseUse': '',
|
||||
'pubBy': null,
|
||||
'pubTime': '',
|
||||
'facilitieslist': [],
|
||||
'houseImageUrls': []
|
||||
});
|
||||
const loading = ref(false);
|
||||
const housefacilities = ref([]);
|
||||
async function init() {
|
||||
if (route.query.id) {
|
||||
houseRentalid.value = route.query.id;
|
||||
}
|
||||
loading.value = true;
|
||||
const reslist = await listHouseFacilities();
|
||||
housefacilities.value = reslist.rows;
|
||||
await houseStore.getCurrentVilageTreeHouse();
|
||||
getHouseRental(houseRentalid.value)
|
||||
.then((res) => {
|
||||
HouseInfo.value = res.data;
|
||||
HouseInfo.value.facilitieslist = res.data.facilities.split(',').filter((item) => item);
|
||||
HouseInfo.value.houseImageUrls = HouseInfo.value.houseImageUrl.split(',').filter((item) => item);
|
||||
})
|
||||
.finally(() => (loading.value = false));
|
||||
}
|
||||
init();
|
||||
|
||||
function handlefacilities(id: string) {
|
||||
const find = housefacilities.value.find((item) => item.id === id);
|
||||
return find ? find.name : '';
|
||||
}
|
||||
|
||||
function hanlededit() {
|
||||
router.push({
|
||||
path: '/house/edithouseRental',
|
||||
query: {
|
||||
id: HouseInfo.value.id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handlBack() {
|
||||
router.push({
|
||||
path: '/house/houseRental'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.AddBuildingBox {
|
||||
padding: 15px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.AddBuildingBody {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: white;
|
||||
padding: 15px;
|
||||
.title {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding-left: 20px;
|
||||
font-size: 15px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
color: rgba(16, 16, 16, 1);
|
||||
border-bottom: 1px solid #bbbbbb;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.addBuildingFormBody {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-rows: repeat(4, 1fr);
|
||||
}
|
||||
|
||||
.houseImage {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
margin: 10px 5px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.descriptionsbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
font-size: 15px;
|
||||
.label {
|
||||
width: 100px;
|
||||
text-align: right;
|
||||
font-weight: 800;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,554 +0,0 @@
|
||||
<template>
|
||||
<div class="h-full p-2 flex flex-col">
|
||||
<pageHeader></pageHeader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card>
|
||||
<div class="h-full flex flex-align-center">
|
||||
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-width="80px">
|
||||
<el-form-item label="房屋类型" prop="houseUse">
|
||||
<el-select v-model="queryParams.houseUse" placeholder="选择房屋类型" style="width: 240px">
|
||||
<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="rentalName">
|
||||
<el-input v-model="queryParams.rentalName" clearable maxlength="15" placeholder="请输入" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">搜索</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card class="flex-1" shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<right-toolbar
|
||||
:disable-delete="multiple"
|
||||
:disable-edit="single"
|
||||
:show-add="checkPermi(['houseRental:houseRental:add'])"
|
||||
:show-delete="checkPermi(['houseRental:houseRental:remove'])"
|
||||
:show-edit="checkPermi(['houseRental:houseRental:edit'])"
|
||||
@update:add="handleAdd"
|
||||
@update:edit="handleUpdate()"
|
||||
@update:delete="handleDelete()"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="houseRentalList" border class="h-full" @selection-change="handleSelectionChange">
|
||||
<el-table-column align="center" type="selection" width="55" />
|
||||
<el-table-column align="center" label="房屋信息" prop="name" />
|
||||
<el-table-column align="center" label="租赁状态" prop="rentalStatus">
|
||||
<template #default="{ row }">
|
||||
<DictTag :options="com_rental_status" :value="row.rentalStatus"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="发布人" prop="rentalName" />
|
||||
<el-table-column align="center" label="联系方式" prop="phone" />
|
||||
<el-table-column align="center" label="发布时间" prop="pubTime" />
|
||||
<el-table-column align="center" label="房屋类型" prop="houseUse">
|
||||
<template #default="{ row }">
|
||||
<span>{{ handleHouseUse(row.houseUse) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="租赁方式" prop="rentalType">
|
||||
<template #default="{ row }">
|
||||
<DictTag :options="com_rental_method" :value="row.rentalType"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="状态" prop="status">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.status === '0' ? '下架' : '上架' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
|
||||
<template #default="scope">
|
||||
<el-button v-if="scope.row.status === '0'" link type="primary" @click="sign(scope.row)">签约</el-button>
|
||||
<el-button v-if="scope.row.status === '0'" link type="primary" @click="putOnSale(scope.row)">上架</el-button>
|
||||
<el-button v-else link type="primary" @click="putOnSale(scope.row)">下架</el-button>
|
||||
<el-button link type="primary" @click="handleMain(scope.row)">详情</el-button>
|
||||
<el-button v-has-permi="['houseRental:houseRental:query']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-button v-has-permi="['houseRental:houseRental:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum" :total="total" @pagination="getList" />
|
||||
</el-card>
|
||||
|
||||
<el-dialog v-model="dialog.visible" :title="dialog.title" append-to-body width="680px">
|
||||
<el-form ref="houseRentalFormRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="区域" prop="villageId">
|
||||
<el-input v-model.trim="form.villageName" disabled maxlength="20" placeholder="请输入区域" />
|
||||
</el-form-item>
|
||||
<el-form-item label="承租方" prop="tenantName">
|
||||
<el-input v-model.trim="form.tenantName" maxlength="20" placeholder="请输入承租方" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item label="电话" prop="tenantPhone">
|
||||
<el-input v-model.trim="form.tenantPhone" maxlength="11" placeholder="请输入电话" />
|
||||
</el-form-item>
|
||||
<el-form-item label="房号" prop="houseId">
|
||||
<el-input v-model.trim="form.houseName" disabled maxlength="20" placeholder="请输入房号" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item label="面积" prop="houseArea">
|
||||
<el-input v-model.trim="form.houseArea" disabled maxlength="20" placeholder="请输入面积" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item label="收费模式" prop="chargeMode">
|
||||
<el-select v-model.trim="form.chargeMode" placeholder="请选择收费模式">
|
||||
<el-option v-for="(item, index) in com_house_rental_pricing_model" :key="index" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="收费标准" prop="chargeStandard">
|
||||
<el-select v-model.trim="form.chargeStandard" placeholder="请选择收费标准">
|
||||
<el-option v-for="(item, index) in com_house_rental_pricing" :key="index" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同编号" prop="contractNo">
|
||||
<el-input v-model.trim="form.contractNo" maxlength="20" placeholder="请输入合同编号" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item label="合同状态" prop="contractStatus">
|
||||
<el-input v-model.trim="form.contractStatus" maxlength="40" placeholder="请输入合同状态" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item label="租赁起始日" prop="leaseStartDate">
|
||||
<el-date-picker
|
||||
v-model.trim="form.leaseStartDate"
|
||||
:disabled-date="disabledStartDate"
|
||||
format="YYYY-MM-DD"
|
||||
placeholder="请选择租赁起始日"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="租赁终止日" prop="leaseEndDate">
|
||||
<el-date-picker
|
||||
v-model.trim="form.leaseEndDate"
|
||||
:disabled-date="disabledEndDate"
|
||||
format="YYYY-MM-DD"
|
||||
placeholder="请选择租赁终止日"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="租金" prop="rentAmount">
|
||||
<el-input v-model.trim.number="form.rentAmount" maxlength="8" placeholder="请输入租金">
|
||||
<template #append>
|
||||
<span>元/月</span>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="押金" prop="depositAmount">
|
||||
<el-input v-model.trim.number="form.depositAmount" maxlength="8" placeholder="请输入押金">
|
||||
<template #append>
|
||||
<span>元</span>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同附件">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
v-model:file-list="showImgList"
|
||||
:action="uploadApi"
|
||||
:auto-upload="false"
|
||||
:limit="MAX_UPLOAD_FILES"
|
||||
:multiple="true"
|
||||
:on-preview="handlePreview"
|
||||
:onChange="handleChange"
|
||||
:onExceed="handleExceed"
|
||||
:show-file-list="true"
|
||||
accept=".png,.jpg,.jpeg, .pdf"
|
||||
class="upload-demo"
|
||||
drag
|
||||
name="files"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text"><em>点击</em>或者将文件<em>拖拽</em>到这里上传</div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">支持 .png, .jpg, .pdf</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</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>
|
||||
|
||||
<script lang="ts" name="HouseRental" setup>
|
||||
import pageHeader from '@/components/Pageheader/index.vue';
|
||||
import { changeHouseRedientStatus, delHouseRental, HouseRedientSign, HouseRedientSignUpload, listHouseRental } from '@/api/system/houseRental';
|
||||
import { HouseRentalQuery, HouseRentalSigningVO, HouseRentalVO } from '@/api/system/houseRental/type';
|
||||
import { checkPermi } from '@/utils/permission';
|
||||
import { listHouseUseType_add_house } from '@/api/system/houseUse';
|
||||
import { validator } from '@/utils/Reg';
|
||||
import { UploadFilled } from '@element-plus/icons-vue';
|
||||
import { ElMessage, UploadUserFile } from 'element-plus';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_rental_status, com_rental_method, com_house_rental_pricing_model, com_house_rental_pricing } = toRefs<any>(
|
||||
proxy?.useDict('com_rental_status', 'com_rental_method', 'com_house_rental_pricing_model', 'com_house_rental_pricing')
|
||||
);
|
||||
|
||||
const uploadApi = '/houseRental/uploadImages';
|
||||
const router = useRouter();
|
||||
const houseRentalList = ref<HouseRentalVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const houseRentalFormRef = ref<ElFormInstance>();
|
||||
|
||||
const villageInfo = localStorage.getItem('villageInfo');
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
type HouseRentalFormType = HouseRentalSigningVO & {
|
||||
villageName?: string;
|
||||
houseName?: string;
|
||||
houseArea?: number;
|
||||
contractUrl?: string;
|
||||
};
|
||||
|
||||
const initFormData: HouseRentalFormType = {
|
||||
contractName: '',
|
||||
rentAmount: undefined,
|
||||
depositAmount: undefined,
|
||||
'createTime': undefined,
|
||||
'id': undefined,
|
||||
'rentalId': undefined,
|
||||
'contractNo': undefined,
|
||||
'tenantName': undefined,
|
||||
'tenantPhone': undefined,
|
||||
'chargeMode': undefined,
|
||||
'chargeStandard': undefined,
|
||||
'contractStatus': undefined,
|
||||
'leaseStartDate': undefined,
|
||||
'leaseEndDate': undefined,
|
||||
'houseId': undefined,
|
||||
'villageId': undefined,
|
||||
'contractUrl': undefined,
|
||||
'remark': undefined
|
||||
};
|
||||
|
||||
const data = reactive<PageData<HouseRentalFormType, HouseRentalQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
houseUse: '',
|
||||
rentalName: undefined,
|
||||
rent: undefined,
|
||||
rentalType: undefined,
|
||||
houseFace: undefined,
|
||||
houseArea: undefined,
|
||||
floorNo: undefined,
|
||||
inTime: undefined,
|
||||
facilities: undefined,
|
||||
houseImageUrl: undefined,
|
||||
supInfo: undefined,
|
||||
phone: undefined,
|
||||
vx: undefined,
|
||||
email: undefined,
|
||||
houseId: undefined
|
||||
},
|
||||
rules: {
|
||||
contractNo: [
|
||||
{ required: true, message: '请输入合同编号', trigger: 'blur' },
|
||||
{ min: 1, max: 20, message: '合同编号长度必须在 1 到 20 个字符之间', trigger: 'blur' },
|
||||
{ pattern: /^[a-zA-Z0-9_\-]+$/, message: '合同编号只能包含字母、数字,下划线和短横线', trigger: 'blur' }
|
||||
],
|
||||
tenantName: [
|
||||
{ required: true, message: '请输入承租方姓名', trigger: 'blur' },
|
||||
{ min: 1, max: 20, message: '承租方姓名长度必须在 1 到 20 个字符之间', trigger: 'blur' }
|
||||
],
|
||||
tenantPhone: [
|
||||
{ required: true, message: '请输入承租方联系电话', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, value: string, callback: any) => {
|
||||
if (!validator(value, 'phone')) {
|
||||
callback(new Error('承租方联系电话格式错误'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
chargeMode: [{ required: true, message: '请选择收费模式', trigger: 'change' }],
|
||||
chargeStandard: [{ required: true, message: '请输入收费标准', trigger: 'blur' }],
|
||||
contractStatus: [{ required: true, message: '请选择合同状态', trigger: 'change' }],
|
||||
leaseStartDate: [{ required: true, message: '请选择租赁起始日', trigger: 'change' }],
|
||||
leaseEndDate: [{ required: true, message: '请选择租赁终止日', trigger: 'change' }],
|
||||
houseId: [{ required: true, message: '请选择房屋', trigger: 'change' }],
|
||||
villageId: [{ required: true, message: '请选择小区', trigger: 'change' }],
|
||||
houseArea: [{ required: true, message: '请输入房屋面积', trigger: 'blur' }],
|
||||
rentAmount: [{ required: true, message: '请输入租金', trigger: 'blur' }],
|
||||
depositAmount: [{ required: true, message: '请输入押金', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 获取今日零点时间戳 */
|
||||
const todayStart = new Date();
|
||||
todayStart.setHours(0, 0, 0, 0);
|
||||
const TODAY = todayStart.getTime();
|
||||
|
||||
/**
|
||||
* 起始日禁用规则:
|
||||
* 1. 今日之前不可选
|
||||
* 2. 若已选结束日,则结束日之后不可选
|
||||
*/
|
||||
function disabledStartDate(date: Date): boolean {
|
||||
if (date.getTime() < TODAY) return true;
|
||||
if (!form.value.leaseEndDate) return false;
|
||||
return date.getTime() > new Date(form.value.leaseEndDate).getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束日禁用规则:
|
||||
* 1. 今日之前不可选
|
||||
* 2. 若已选起始日,则起始日之前不可选
|
||||
*/
|
||||
function disabledEndDate(date: Date): boolean {
|
||||
if (date.getTime() < TODAY) return true;
|
||||
if (!form.value.leaseStartDate) return false;
|
||||
return date.getTime() < new Date(form.value.leaseStartDate).getTime();
|
||||
}
|
||||
|
||||
/** 查询房屋租赁管理列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
listHouseRental(queryParams.value)
|
||||
.then((res) => {
|
||||
houseRentalList.value = res.rows;
|
||||
total.value = res.total;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
houseRentalFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
queryParams.value.houseUse = '';
|
||||
queryParams.value.rentalName = '';
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: HouseRentalVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/house/addhouseRental'
|
||||
});
|
||||
};
|
||||
|
||||
function handlePreview(uploadFile: UploadFile) {
|
||||
window.open(uploadFile.url);
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = (row?: HouseRentalVO) => {
|
||||
const id = row?.id || ids.value[0];
|
||||
router.push({
|
||||
path: '/house/edithouseRental',
|
||||
query: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
};
|
||||
/** 详情按钮操作 */
|
||||
const handleMain = (row?: HouseRentalVO) => {
|
||||
router.push({
|
||||
path: '/house/houseMain',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: HouseRentalVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
|
||||
await delHouseRental(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
const houseUseTypeList = ref([]);
|
||||
function getHouseUseType() {
|
||||
listHouseUseType_add_house().then((res) => {
|
||||
houseUseTypeList.value = res.data;
|
||||
});
|
||||
}
|
||||
function handleHouseUse(houseUser: string) {
|
||||
const item = houseUseTypeList.value.find((item) => item.id === houseUser);
|
||||
return item?.name || '';
|
||||
}
|
||||
|
||||
// 签约
|
||||
function sign(row: HouseRentalVO) {
|
||||
clearForm();
|
||||
form.value = {
|
||||
...initFormData,
|
||||
...row.signingList?.[0]
|
||||
};
|
||||
const info = JSON.parse(villageInfo || '{}');
|
||||
form.value.villageName = info.villageName;
|
||||
form.value.houseName = row.name;
|
||||
form.value.houseArea = row.houseArea;
|
||||
|
||||
form.value.tenantPhone = row.signingList.length > 0 ? row.signingList[0].tenantPhone : '';
|
||||
form.value.houseId = row.houseId;
|
||||
form.value.villageId = info.villageId;
|
||||
form.value.rentalId = row.id;
|
||||
if (row.signingList && row.signingList.length > 0) {
|
||||
const names = row.signingList[0].contractName ? row.signingList[0].contractName.split(',') : [];
|
||||
const list = row.signingList[0].contractUrl ? row.signingList[0].contractUrl.split(',') : [];
|
||||
if (list.length > 0) {
|
||||
showImgList.value = list.map((item, index) => {
|
||||
return {
|
||||
uid: index,
|
||||
name: names[index] || (item ? item.split('.com/')[1].split('/')[3] : ''),
|
||||
url: item,
|
||||
isLink: true
|
||||
};
|
||||
});
|
||||
} else {
|
||||
showImgList.value = [];
|
||||
}
|
||||
} else {
|
||||
showImgList.value = [];
|
||||
}
|
||||
dialog.visible = true;
|
||||
dialog.title = '签约';
|
||||
}
|
||||
// 上架
|
||||
function putOnSale(row: HouseRentalVO) {
|
||||
changeHouseRedientStatus(row.id).then(() => {
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
getList();
|
||||
});
|
||||
}
|
||||
const uploadRef = ref();
|
||||
const MAX_UPLOAD_FILES = 9;
|
||||
const showImgList = ref([]);
|
||||
// 超出总数量拦截,不再只限制单次选择
|
||||
const handleExceed = () => {
|
||||
ElMessage.warning(`最多只能上传 ${MAX_UPLOAD_FILES} 个附件`);
|
||||
};
|
||||
const handleChange = (file: UploadUserFile) => {
|
||||
// 过滤上传文件-只允许图片,pdf格式
|
||||
if (!/\.(jpg|jpeg|png|gif|pdf)$/i.test(file.name)) {
|
||||
ElMessage.warning('只允许上传图片,pdf格式');
|
||||
uploadRef.value?.handleRemove(file);
|
||||
return;
|
||||
}
|
||||
// 实时判断当前已存在图片总数
|
||||
if (showImgList.value.length > MAX_UPLOAD_FILES) {
|
||||
ElMessage.warning(`最多上传${MAX_UPLOAD_FILES}个附件,无法继续添加`);
|
||||
// 清除刚选中的文件,防止缓存残留
|
||||
uploadRef.value?.handleRemove(file);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
// 批量上传校验图片数量,前后端数量匹配校验
|
||||
const uploadAllCarousel = async () => {
|
||||
const filterArr = showImgList.value.filter((item) => {
|
||||
return !item.isLink && item.raw;
|
||||
});
|
||||
const oldArr = showImgList.value.filter((item) => item.isLink && !item.raw);
|
||||
if (filterArr.length > 0) {
|
||||
const formData = new FormData();
|
||||
filterArr.forEach((fileItem) => {
|
||||
formData.append('files', fileItem.raw!);
|
||||
});
|
||||
const res = await HouseRedientSignUpload(uploadApi, formData);
|
||||
// 校验后端返回图片数量和本地选中数量一致
|
||||
if (res.code !== 200 || !res.data?.success?.length) {
|
||||
ElMessage.warning(res.msg || '文件上传失败');
|
||||
throw new Error('上传失败');
|
||||
}
|
||||
return [...res.data.success.map((item: any) => item.url), ...oldArr.map((item) => item.url)];
|
||||
} else {
|
||||
return [...oldArr.map((item) => item.url)];
|
||||
}
|
||||
};
|
||||
function submitForm() {
|
||||
houseRentalFormRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
const arr = await uploadAllCarousel();
|
||||
// 拼接最终图片字符串
|
||||
form.value.contractUrl = arr.join(',');
|
||||
form.value.rentAmount = String(form.value.rentAmount) || 0;
|
||||
form.value.depositAmount = String(form.value.depositAmount) || 0;
|
||||
HouseRedientSign(form.value).then(() => {
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
getList();
|
||||
dialog.visible = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function clearForm() {
|
||||
form.value = { ...initFormData };
|
||||
}
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getHouseUseType();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-table {
|
||||
height: calc(100% - 100px);
|
||||
}
|
||||
</style>
|
||||
@@ -1,424 +0,0 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form class="formBody" label-position="left" ref="formRef" :model="form" :rules="rules" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="楼栋房屋" prop="houseId">
|
||||
<el-cascader v-model="userHousePath" :options="treeData" @change="handleChange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="住户姓名" prop="name">
|
||||
<el-input maxlength="10" show-word-limit v-model.trim="form.name" placeholder="请输入住户姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="住户性别" prop="gender">
|
||||
<el-radio-group v-model="form.gender">
|
||||
<el-radio v-for="dist in sys_user_sex" :label="dist.label" :value="dist.value" :key="dist.value"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11"> </el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="证件类型" prop="idCardType">
|
||||
<el-select @change="handleChangeIdCardType" v-model="form.idCardType" placeholder="请选择证件">
|
||||
<el-option v-for="item in com_id_card_type" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="身份证号码" prop="idCard" v-if="form.idCardType === '0'">
|
||||
<el-input maxlength="20" v-model="form.idCard" placeholder="请输入证件号码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="护照号码" prop="idCard" v-if="form.idCardType === '1'">
|
||||
<el-input maxlength="30" v-model="form.idCard" placeholder="请输入证件号码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="港澳通行证号码" prop="idCard" v-if="form.idCardType === '2'">
|
||||
<el-input maxlength="20" v-model="form.idCard" placeholder="请输入证件号码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="年龄" prop="age" v-if="form.idCardType !== '0'">
|
||||
<el-input maxlength="3" v-model.number.trim="form.age" placeholder="年龄" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="与业主的关系" prop="ownerRelationship">
|
||||
<el-select v-model="form.ownerRelationship" class="m-2" placeholder="请选择">
|
||||
<el-option v-for="item in com_resident_relationship" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="手机号码" prop="phone">
|
||||
<el-input v-model.number="form.phone" placeholder="请输入手机号码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="身份证正面照" prop="cardImageFront">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
class="avatar-uploader"
|
||||
:action="uploadUrl"
|
||||
:show-file-list="false"
|
||||
:on-success="handleAvatarSuccess"
|
||||
:on-exceed="handleExceed"
|
||||
:on-error="handleError"
|
||||
:before-upload="handleBeforeUpload"
|
||||
:limit="1"
|
||||
>
|
||||
<img alt="身份证正面照" v-if="form.cardImageFront" :src="form.cardImageFront" class="avatar" />
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="身份证背面照" prop="cardImageBack">
|
||||
<el-upload
|
||||
ref="upload2"
|
||||
class="avatar-uploader"
|
||||
:action="uploadUrl"
|
||||
:show-file-list="false"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed2"
|
||||
:on-success="handleAvatar2Success"
|
||||
:on-error="handleError2"
|
||||
:before-upload="handleBeforeUpload"
|
||||
>
|
||||
<img alt="身份证背面照" v-if="form.cardImageBack" :src="form.cardImageBack" class="avatar" />
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" maxlength="200" show-word-limit :row="5" v-model.trim="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-top: 30px">
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
<el-button @click="cancelForm">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { ResidentForm } from '@/api/system/residentReviewProcess/resident/type';
|
||||
import { CascaderValue, UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
|
||||
import { genFileId } from 'element-plus';
|
||||
import { addResident, getResident, updateResident } from '@/api/system/residentReviewProcess/resident';
|
||||
import { validator } from '@/utils/Reg';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { Plus } from '@element-plus/icons-vue';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/resident/uploadImage';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
|
||||
const { com_resident_relationship, com_id_card_type } = toRefs<any>(proxy?.useDict('com_resident_relationship', 'com_id_card_type'));
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const formRef = ref();
|
||||
const form = ref<ResidentForm>({
|
||||
houseId: null,
|
||||
unitNoId: null,
|
||||
name: '',
|
||||
gender: '0',
|
||||
idCard: '',
|
||||
ownerRelationship: '0', // 与业主关系
|
||||
phone: null, //手机号
|
||||
cardImageFront: '',
|
||||
idCardType: '0', // 证件类型
|
||||
cardImageBack: '',
|
||||
age: 0, //年龄
|
||||
remark: '' //备注
|
||||
});
|
||||
const userHousePath = ref<CascaderValue>([]);
|
||||
const rules = ref({
|
||||
houseId: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
|
||||
name: [
|
||||
{ required: true, message: '请输入名称', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, val: string | number, callback: (arg0?: Error) => void) => {
|
||||
if (val === '' || val === null || val === undefined) {
|
||||
return callback(new Error('请输入名称'));
|
||||
}
|
||||
return validator(val, 'Character') ? callback() : callback(new Error('请输入正确的名称'));
|
||||
}
|
||||
}
|
||||
],
|
||||
age: [
|
||||
{ required: true, message: '请输入年龄', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
|
||||
return validator(value, 'age') ? callback() : callback(new Error('请输入正确的年龄'));
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
gender: [{ required: true, message: '请选择性别', trigger: 'blur' }],
|
||||
cardImageFront: [{ required: true, message: '请上传身份证照片', trigger: 'blur' }],
|
||||
cardImageBack: [{ required: true, message: '请上传身份证照片', trigger: 'blur' }],
|
||||
idCardType: [{ required: true, message: '请选择证件类型', trigger: 'blur' }],
|
||||
idCard: [
|
||||
{
|
||||
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
|
||||
if (form.value.idCardType === '0') {
|
||||
return validator(value, 'idCard') ? callback() : callback(new Error('请输入正确的18位身份证号码'));
|
||||
} else if (form.value.idCardType === '1') {
|
||||
return validator(value, 'passport') ? callback() : callback(new Error('请输入正确的护照号码'));
|
||||
} else if (form.value.idCardType === '2') {
|
||||
return validator(value, 'hongkongPassport') ? callback() : callback(new Error('请输入正确的港澳通行证号码'));
|
||||
}
|
||||
return callback();
|
||||
},
|
||||
required: true,
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
ownerRelationship: [{ required: true, message: '请选择与业主关系', trigger: 'blur' }],
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
|
||||
return validator(value, 'phone') ? callback() : callback(new Error('请输入正确的手机号码'));
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
// 切换证件类型
|
||||
function handleChangeIdCardType() {
|
||||
form.value.idCard = '';
|
||||
}
|
||||
// 总房屋 树状结构
|
||||
const treeData = ref([]);
|
||||
function getTree() {
|
||||
houseStore.getCurrentVilageTreeHouse().then((res) => {
|
||||
treeData.value = res;
|
||||
getTreeData();
|
||||
});
|
||||
}
|
||||
getTree();
|
||||
// !== 楼栋房屋 =============================================================================
|
||||
const userid = ref(null);
|
||||
function getTreeData() {
|
||||
// !== 编辑用户 =============================================================================
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getResident(userid.value).then((res) => {
|
||||
form.value = {
|
||||
...res.data
|
||||
};
|
||||
userHousePath.value = [form.value.buildingId, form.value.unitNoId, form.value.houseId];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleChange(val: CascaderValue) {
|
||||
userHousePath.value = val;
|
||||
form.value.buildingId = val[0];
|
||||
form.value.houseId = val[2];
|
||||
}
|
||||
|
||||
// !== 上传文件 =============================================================================
|
||||
// 上传文件成功
|
||||
const upload = ref<UploadInstance>();
|
||||
const upload2 = ref<UploadInstance>();
|
||||
const handleAvatarSuccess: UploadProps['onSuccess'] = (response) => {
|
||||
if (response.data && response.data.url) {
|
||||
form.value.cardImageFront = response.data.url;
|
||||
}
|
||||
};
|
||||
const handleAvatar2Success: UploadProps['onSuccess'] = (response) => {
|
||||
if (response.code === 500 && response.msg == '不允许重复提交,请稍候再试') {
|
||||
ElMessage.error('上传频率过快,稍后再试');
|
||||
return;
|
||||
}
|
||||
if (response.data && response.data.url) {
|
||||
form.value.cardImageBack = response.data.url;
|
||||
}
|
||||
};
|
||||
const handleExceed: UploadProps['onExceed'] = (files) => {
|
||||
upload.value!.clearFiles();
|
||||
const file = files[0] as UploadRawFile;
|
||||
file.uid = genFileId();
|
||||
upload.value!.handleStart(file);
|
||||
upload.value?.submit();
|
||||
};
|
||||
const handleExceed2: UploadProps['onExceed'] = (files) => {
|
||||
upload2.value!.clearFiles();
|
||||
const file = files[0] as UploadRawFile;
|
||||
file.uid = genFileId();
|
||||
upload2.value!.handleStart(file);
|
||||
upload2.value?.submit();
|
||||
};
|
||||
const handleError: UploadProps['onError'] = () => {};
|
||||
const handleError2: UploadProps['onError'] = () => {};
|
||||
const blockedExits = ['.exe', '.bat', '.cmd', '.msi'];
|
||||
const handleBeforeUpload = (uploadFile: UploadRawFile) => {
|
||||
const ext = uploadFile.name.toLowerCase().slice(uploadFile.name.lastIndexOf('.'));
|
||||
if (blockedExits.includes(ext)) {
|
||||
ElMessage.warning(`禁止上传 ${ext} 文件`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (!form.value.cardImageFront.trim()) {
|
||||
return ElMessage.error('请上传身份证正面照片');
|
||||
}
|
||||
if (!form.value.cardImageBack.trim()) {
|
||||
return ElMessage.error('请上传身份证背面照片');
|
||||
}
|
||||
const obj = {
|
||||
...form.value
|
||||
};
|
||||
if (userid.value) {
|
||||
updateResident(obj).then(() => {
|
||||
ElMessage.success('修改成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
addResident(obj).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.back();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.avatar-uploader {
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
.avatar-uploader .avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
}
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed var(--el-border-color);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: var(--el-transition-duration-fast);
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: var(--el-color-primary);
|
||||
}
|
||||
.avatar {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.el-icon.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
.AddBuildingBox {
|
||||
padding: 15px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.AddBuildingBody {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: white;
|
||||
padding: 15px;
|
||||
.title {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding-left: 20px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
color: rgba(16, 16, 16, 1);
|
||||
border-bottom: 1px solid #bbbbbb;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.formBody {
|
||||
width: 1050px;
|
||||
margin: 0 auto;
|
||||
|
||||
&:deep(.el-form-item__content, .el-select, .el-input) {
|
||||
width: 350px !important;
|
||||
margin-right: 10px;
|
||||
.el-cascader {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.el-form-item {
|
||||
margin-bottom: 20px;
|
||||
align-items: center;
|
||||
}
|
||||
.unitBox {
|
||||
.el-input {
|
||||
width: 440px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
.el-button {
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.houseTypebox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.el-input {
|
||||
width: 100px;
|
||||
margin-right: 0;
|
||||
}
|
||||
span {
|
||||
margin: 0 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,380 +0,0 @@
|
||||
<template>
|
||||
<div class="p-2 h-full flex flex-col">
|
||||
<pageHeader title="住户管理"></pageHeader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-position="left" label-width="100" @submit.prevent="handleQuery">
|
||||
<el-form-item label="与主业主关系" prop="ownerRelationship">
|
||||
<el-select v-model="queryParams.ownerRelationship" placeholder="请选择与主业主关系" style="width: 240px">
|
||||
<el-option v-for="item in com_resident_relationship" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="住户状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请输入住户状态" style="width: 240px">
|
||||
<el-option v-for="item in com_review" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="住户姓名" prop="name">
|
||||
<el-input v-model.trim="queryParams.name" maxlength="10" placeholder="请输入住户姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="房间号" prop="houseName">
|
||||
<el-input v-model.trim="queryParams.houseName" maxlength="10" placeholder="请输入房间号" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">搜索</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never" style="flex: 1">
|
||||
<div class="residentBody h-full">
|
||||
<div class="treeBox h-full">
|
||||
<div class="treeTitleBox">{{ currentVilageInfo.villageName ?? '--' }}</div>
|
||||
<div class="treeBoxBody">
|
||||
<!-- 树状+ -->
|
||||
<el-tree :data="treated" :highlight-current="true" :props="defaultProps" style="max-width: 600px" @node-click="handleNodeClick" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1 h-full">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<right-toolbar
|
||||
:disable-delete="multiple"
|
||||
:disable-edit="single"
|
||||
:show-add="checkPermi(['resident:resident:add'])"
|
||||
:show-delete="checkPermi(['resident:resident:remove'])"
|
||||
:show-edit="checkPermi(['resident:resident:edit'])"
|
||||
@update:add="handleAdd"
|
||||
@update:edit="handleUpdate()"
|
||||
@update:delete="handleDelete()"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="residentList" border class="tablebox" @selection-change="handleSelectionChange">
|
||||
<el-table-column align="center" type="selection" width="55" />
|
||||
<el-table-column align="center" label="姓名" min-width="120" prop="name" />
|
||||
<el-table-column align="center" label="类型" prop="type" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.type === '0'" type="success">业主</el-tag>
|
||||
<el-tag v-else type="danger">租户</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="与主业主关系" min-width="120" prop="ownerRelationship">
|
||||
<template #default="scope">
|
||||
<DictTag :options="com_resident_relationship" :value="scope.row.ownerRelationship"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="状态" prop="status" width="120">
|
||||
<template #default="scope">
|
||||
<DictTag :options="com_review" :value="scope.row.status"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="证件号" min-width="120" prop="idCard" />
|
||||
<el-table-column align="center" label="手机号码" min-width="120" prop="phone" />
|
||||
<el-table-column align="center" label="房间" min-width="120" prop="houseName" />
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作" min-width="120">
|
||||
<template #default="scope">
|
||||
<el-button v-if="scope.row.status !== '1'" v-has-permi="['resident:resident:edit']" link type="primary" @click="handleMain(scope.row)"
|
||||
>审核</el-button
|
||||
>
|
||||
<el-button v-has-permi="['resident:resident:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-button v-has-permi="['resident:resident:remove']" link type="primary" @click="handleDelete(scope.row)">删除 </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-show="total > 0"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNum"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" name="Resident" setup>
|
||||
import Pagination from '@/components/Pagination/index.vue';
|
||||
import pageHeader from '@/components/Pageheader/index.vue';
|
||||
import RightToolbar from '@/components/RightToolbar/index.vue';
|
||||
import DictTag from '@/components/DictTag/index.vue';
|
||||
|
||||
import { listResident, delResident } from '@/api/system/residentReviewProcess/resident';
|
||||
import { ResidentVO, ResidentQuery, ResidentForm } from '@/api/system/residentReviewProcess/resident/type';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { checkPermi } from '@/utils/permission';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const currentVilageInfo = ref({
|
||||
'villageId': null,
|
||||
'villageName': '',
|
||||
'villageCode': '',
|
||||
'city': '',
|
||||
'address': '',
|
||||
'completDate': '',
|
||||
'houseUse': 0,
|
||||
'villageArea': null,
|
||||
'parkingSpaceCount': null,
|
||||
'villageImageUrl': '',
|
||||
'status': '0',
|
||||
'remark': '',
|
||||
'manageName': '',
|
||||
'managePhone': '',
|
||||
'manageQq': '',
|
||||
'manageVx': '',
|
||||
'manageEmail': ''
|
||||
});
|
||||
|
||||
function init() {
|
||||
houseStore.getviliageinfo(localStorage.getItem('villageid')).then((res) => {
|
||||
if (res) {
|
||||
currentVilageInfo.value = res;
|
||||
}
|
||||
});
|
||||
}
|
||||
init();
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_resident_relationship } = toRefs<any>(proxy?.useDict('com_resident_relationship'));
|
||||
const { com_review } = toRefs<any>(proxy?.useDict('com_review'));
|
||||
|
||||
const router = useRouter();
|
||||
const residentList = ref<ResidentVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
|
||||
const initFormData: ResidentForm = {
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
ownerRelationship: undefined,
|
||||
gender: undefined,
|
||||
idCard: undefined,
|
||||
phone: undefined,
|
||||
villageId: undefined,
|
||||
buildingId: undefined,
|
||||
houseId: undefined,
|
||||
status: undefined,
|
||||
cardImageFront: undefined,
|
||||
cardImageBack: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
|
||||
const data = reactive<PageData<ResidentForm, ResidentQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
date: '',
|
||||
ownerRelationship: null,
|
||||
status: null,
|
||||
houseId: null,
|
||||
buildingId: null,
|
||||
unitNoId: null,
|
||||
houseName: null,
|
||||
name: null
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams } = toRefs(data);
|
||||
|
||||
// ! 树形------------------------------------------------------------------------
|
||||
interface Tree {
|
||||
label: string;
|
||||
value: number;
|
||||
type: string;
|
||||
children?: Tree[];
|
||||
}
|
||||
// 四个参数:对应于节点点击的节点对象,TreeNode 的 node 属性, TreeNode和事件对象
|
||||
const handleNodeClick = (data: Tree, node) => {
|
||||
const obj2 = {
|
||||
[data.type]: data.value
|
||||
};
|
||||
if (data.type === 'unitNoId') {
|
||||
obj2[node.parent.data.type] = node.parent.data.value;
|
||||
}
|
||||
queryParams.value = {
|
||||
...queryParams.value,
|
||||
...{
|
||||
houseId: null,
|
||||
buildingId: null,
|
||||
unitNoId: null,
|
||||
houseName: null,
|
||||
name: null
|
||||
},
|
||||
...obj2
|
||||
};
|
||||
getList();
|
||||
};
|
||||
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
};
|
||||
// ! 树形------------------------------------------------------------------------
|
||||
const treated = ref([]);
|
||||
function better() {
|
||||
treated.value = [];
|
||||
houseStore.getCurrentVilageTreeHouse().then((res) => {
|
||||
treated.value = res;
|
||||
});
|
||||
}
|
||||
|
||||
better();
|
||||
|
||||
/** 查询住户管理列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
residentList.value = [];
|
||||
listResident(queryParams.value)
|
||||
.then((res) => {
|
||||
residentList.value = res.rows;
|
||||
total.value = res.total;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
getList();
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
queryParams.value = {
|
||||
...queryParams.value,
|
||||
...{
|
||||
houseId: null,
|
||||
buildingId: null,
|
||||
unitNoId: null
|
||||
}
|
||||
};
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
queryParams.value = {
|
||||
...queryParams.value,
|
||||
...{
|
||||
houseId: null,
|
||||
buildingId: null,
|
||||
unitNoId: null
|
||||
}
|
||||
};
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ResidentVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/house/addResident'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = (row?: ResidentVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
router.push({
|
||||
path: '/house/editResident',
|
||||
query: {
|
||||
id: _id
|
||||
}
|
||||
});
|
||||
};
|
||||
/** 审核/ 用户详情 */
|
||||
const handleMain = (row: ResidentVO) => {
|
||||
router.push({
|
||||
path: '/house/ResidentMain',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ResidentVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
|
||||
await delResident(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.residentBody {
|
||||
display: flex;
|
||||
.treeBox {
|
||||
width: 250px;
|
||||
min-width: 150px;
|
||||
max-width: 250px;
|
||||
margin-right: 10px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.treeTitleBox {
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
padding-left: 20px;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
background-color: rgba(233, 242, 255, 0.5);
|
||||
color: rgba(16, 16, 16, 1);
|
||||
}
|
||||
|
||||
.treeBoxBody {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
margin-top: 10px;
|
||||
|
||||
&:deep(.el-tree-node__content) {
|
||||
margin-bottom: 5px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
.el-tree-node__expand-icon {
|
||||
font-size: 18px;
|
||||
}
|
||||
&:hover {
|
||||
background: #d1e3ff;
|
||||
.el-text {
|
||||
color: #227aff;
|
||||
}
|
||||
.el-tree-node__expand-icon {
|
||||
color: #227aff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tablebox {
|
||||
height: calc(100% - 105px);
|
||||
/* 空数据也不会无限变宽 */
|
||||
:deep(.el-table__empty-block) {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
10
src/views/system/statistics-summary/index.vue
Normal file
10
src/views/system/statistics-summary/index.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<div class="h-full flex flex-col p-2">
|
||||
<pageheader></pageheader>
|
||||
<el-card class="flex-1 mt-2" shadow="never">
|
||||
<!-- TODO: 统计汇总 -->
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="StatisticsSummary"></script>
|
||||
@@ -1,316 +0,0 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="storeRoomId ? '编辑储藏室' : '添加储藏室'"></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" class="formBody" label-position="left" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="楼栋" prop="buildingId">
|
||||
<el-select v-model="form.buildingId" placeholder="请选择楼栋" @change="handleChangeBuild">
|
||||
<el-option v-for="item in BuildingLists" :key="item.id" :label="item.buildingName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="单元" prop="unitNoId">
|
||||
<el-select 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-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="储藏室号" prop="storeroomNo">
|
||||
<el-input v-model.trim="form.storeroomNo" maxlength="15" placeholder="请输入储藏室号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="建筑面积" prop="houseArea">
|
||||
<el-input v-model.trim.number="form.houseArea" maxlength="8" placeholder="请输入建筑面积">
|
||||
<template #append>
|
||||
<span>㎡</span>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="公摊面积" prop="shareArea">
|
||||
<el-input v-model.trim.number="form.shareArea" maxlength="8" placeholder="请输入公摊面积">
|
||||
<template #append>
|
||||
<span>㎡</span>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="实用面积" prop="internalArea">
|
||||
<el-input v-model.trim.number="form.internalArea" maxlength="8" placeholder="请输入实用面积">
|
||||
<template #append>
|
||||
<span>㎡</span>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model.trim="form.remark" :rows="5" maxlength="200" placeholder="请输入备注" show-word-limit type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-top: 30px">
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button @click="cancelForm">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { getBuildinglistAPI } from '@/api/system/house';
|
||||
import { addStoreroom, getStoreroom, updateStoreroom } from '@/api/system/storeroom';
|
||||
import { StoreroomVO } from '@/api/system/storeroom/types';
|
||||
import { getByBUildingidtoUnitNo } from '@/api/system/houseUnit';
|
||||
import { validator } from '@/utils/Reg';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const formRef = ref();
|
||||
const form = ref<StoreroomVO>({
|
||||
id: null,
|
||||
buildingId: '',
|
||||
unitNoId: '',
|
||||
unitName: '',
|
||||
storeroomNo: '',
|
||||
houseArea: null,
|
||||
shareArea: null,
|
||||
internalArea: null,
|
||||
houseId: '',
|
||||
status: 0,
|
||||
remark: ''
|
||||
});
|
||||
const rules = ref({
|
||||
buildingId: [{ required: true, message: '请选择楼栋', trigger: 'blur' }],
|
||||
unitNoId: [{ required: true, message: '请选择单元', trigger: 'blur' }],
|
||||
storeroomNo: [
|
||||
{ required: true, message: '请输入储藏室号', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, val: string | number, callback: (arg0?: Error) => void) => {
|
||||
if (val === '' || val === null || val === undefined) {
|
||||
return callback(new Error('请输入储藏室号'));
|
||||
}
|
||||
return validator(val, 'Character') ? callback() : callback(new Error('请输入中文,字母,数字,-,_等字符'));
|
||||
}
|
||||
}
|
||||
],
|
||||
houseArea: [
|
||||
{ required: true, message: '请输入建筑面积', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, value: string, callback: (arg0?: Error) => void) => {
|
||||
if (value === '' || value === null) {
|
||||
return callback(new Error('请输入建筑面积'));
|
||||
}
|
||||
const val = Number(value);
|
||||
if (Number.isNaN(val)) {
|
||||
return callback(new Error('请输入数字'));
|
||||
}
|
||||
if (val < 0) {
|
||||
return callback(new Error('请输入大于0的数字'));
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
],
|
||||
shareArea: [
|
||||
{ required: false, message: '请输入公摊面积', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
|
||||
if (value === '' || value === null) {
|
||||
return callback();
|
||||
}
|
||||
const val = Number(value);
|
||||
if (Number.isNaN(val)) {
|
||||
return callback(new Error('请输入数字'));
|
||||
}
|
||||
if (val < 0) {
|
||||
return callback(new Error('请输入大于0的数字'));
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
],
|
||||
internalArea: [
|
||||
{ required: false, message: '请输入实用面积', trigger: 'blur' },
|
||||
{
|
||||
validator: (_: any, value: string | number, callback: (arg0?: Error) => void) => {
|
||||
if (value === '' || value === null) {
|
||||
return callback();
|
||||
}
|
||||
const val = Number(value);
|
||||
if (Number.isNaN(val)) {
|
||||
return callback(new Error('请输入数字'));
|
||||
}
|
||||
if (val < 0) {
|
||||
return callback(new Error('请输入大于0的数字'));
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const storeRoomId = ref(null);
|
||||
const units = ref([]);
|
||||
const BuildingLists = ref([]);
|
||||
|
||||
// 获取储藏室信息
|
||||
function getStoreRoomInfo(id: string) {
|
||||
getStoreroom(id).then((res) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data,
|
||||
houseArea: res.data.houseArea === 0 ? null : res.data.houseArea,
|
||||
shareArea: res.data.shareArea === 0 ? null : res.data.shareArea,
|
||||
internalArea: res.data.internalArea === 0 ? null : res.data.internalArea
|
||||
};
|
||||
if (form.value.buildingId) {
|
||||
handleChangeBuild(form.value.buildingId, () => {
|
||||
form.value.unitNoId = res.data.unitNoId;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 根据小区id获取楼栋单元
|
||||
function init() {
|
||||
getBuildinglistAPI().then((res) => {
|
||||
BuildingLists.value = res.data;
|
||||
});
|
||||
}
|
||||
init();
|
||||
onMounted(() => {
|
||||
if (route.query.id) {
|
||||
storeRoomId.value = route.query.id;
|
||||
getStoreRoomInfo(storeRoomId.value);
|
||||
}
|
||||
});
|
||||
// 根据楼栋id获取单元
|
||||
function handleChangeBuild(val: string, callback?: () => void) {
|
||||
getByBUildingidtoUnitNo(val).then((res) => {
|
||||
units.value = res.data;
|
||||
form.value.unitNoId = '';
|
||||
callback && callback();
|
||||
});
|
||||
}
|
||||
const submitForm = () => {
|
||||
if (form.value.houseArea === null || form.value.houseArea === 0) {
|
||||
ElMessage.error('请输入建筑面积');
|
||||
return;
|
||||
}
|
||||
const houseArea = Number(form.value.houseArea) || 0;
|
||||
if (form.value.shareArea || form.value.internalArea) {
|
||||
const shareArea = Number(form.value.shareArea) || 0;
|
||||
const internalArea = Number(form.value.internalArea) || 0;
|
||||
if (shareArea + internalArea != houseArea) {
|
||||
return ElMessage.warning('填写的【实用面积】与【公摊面积】之和 应等于【建筑面积】');
|
||||
}
|
||||
}
|
||||
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
...form.value
|
||||
};
|
||||
if (storeRoomId.value !== null) {
|
||||
updateStoreroom(data).then(() => {
|
||||
ElMessage.success('修改成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
addStoreroom(data).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const cancelForm = () => {
|
||||
router.back();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.AddBuildingBox {
|
||||
padding: 15px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.AddBuildingBody {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: white;
|
||||
padding: 15px;
|
||||
.title {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding-left: 20px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
color: rgba(16, 16, 16, 1);
|
||||
border-bottom: 1px solid #bbbbbb;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.addBuildingFormBody {
|
||||
.formBody {
|
||||
width: 1050px;
|
||||
margin: 0 auto;
|
||||
|
||||
.el-form-item__content,
|
||||
.el-select,
|
||||
.el-input {
|
||||
width: 440px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.el-form-item {
|
||||
margin-bottom: 20px;
|
||||
align-items: center;
|
||||
}
|
||||
.unitBox {
|
||||
.el-input {
|
||||
width: 440px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
.el-button {
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.houseTypebox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.el-input {
|
||||
width: 100px;
|
||||
margin-right: 0;
|
||||
}
|
||||
span {
|
||||
margin: 0 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,203 +0,0 @@
|
||||
<template>
|
||||
<div class="p-2 flex storeRoomBox">
|
||||
<pageHeader></pageHeader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form label-width="100" ref="queryFormRef" @submit.prevent="handleQuery" :model="queryParams" :inline="true">
|
||||
<el-form-item label="储藏室号" prop="storeroomNo">
|
||||
<el-input maxlength="15" v-model="queryParams.storeroomNo" placeholder="请输入储藏室号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">搜索</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<right-toolbar
|
||||
:disable-delete="multiple"
|
||||
:disable-edit="single"
|
||||
:show-add="checkPermi(['storeroom:storeroom:add'])"
|
||||
:show-edit="checkPermi(['storeroom:storeroom:edit'])"
|
||||
:show-delete="checkPermi(['storeroom:storeroom:remove'])"
|
||||
@update:add="handleAdd"
|
||||
@update:edit="handleUpdate()"
|
||||
@update:delete="handleDelete()"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table class="tableBody" v-loading="loading" border :data="storeroomList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="楼栋名" align="center" prop="buildingName" />
|
||||
<el-table-column label="单元号" show-overflow-tooltip align="center" prop="unitName" />
|
||||
<el-table-column label="储藏室号" align="center" prop="storeroomNo" />
|
||||
<el-table-column label="建筑面积(㎡)" align="center" prop="houseArea">
|
||||
<template #default="scope">
|
||||
{{ scope.row.houseArea || '---' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="公摊面积(㎡)" align="center" prop="shareArea">
|
||||
<template #default="scope">
|
||||
{{ scope.row.shareArea || '---' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="实用面积(㎡)" align="center" prop="internalArea">
|
||||
<template #default="scope"> {{ scope.row.internalArea || '---' }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="handleUpdate(scope.row)" v-has-permi="['storeroom:storeroom:edit']">修改</el-button>
|
||||
<el-button link type="primary" @click="handleDelete(scope.row)" v-has-permi="['storeroom:storeroom:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Storeroom" lang="ts">
|
||||
import pageHeader from '@/components/Pageheader/index.vue';
|
||||
import RightToolbar from '@/components/RightToolbar/index.vue';
|
||||
import pagination from '@/components/Pagination/index.vue';
|
||||
|
||||
import { listStoreroom, delStoreroom } from '@/api/system/storeroom';
|
||||
import { StoreroomVO, StoreroomQuery, StoreroomForm } from '@/api/system/storeroom/types';
|
||||
import { checkPermi } from '@/utils/permission';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const router = useRouter();
|
||||
const storeroomList = ref<StoreroomVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
|
||||
const initFormData: StoreroomForm = {
|
||||
id: undefined,
|
||||
buildingId: undefined,
|
||||
unitNo: undefined,
|
||||
storeroomNo: undefined,
|
||||
houseArea: undefined,
|
||||
shareArea: undefined,
|
||||
internalArea: undefined,
|
||||
houseId: undefined,
|
||||
status: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<StoreroomForm, StoreroomQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
buildingId: undefined,
|
||||
unitNo: undefined,
|
||||
storeroomNo: undefined,
|
||||
houseArea: undefined,
|
||||
shareArea: undefined,
|
||||
internalArea: undefined,
|
||||
houseId: undefined,
|
||||
status: undefined
|
||||
},
|
||||
rules: {
|
||||
storeroomNo: [{ required: true, message: '储藏室号不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams } = toRefs(data);
|
||||
|
||||
/** 查询储藏室管理列表 */
|
||||
const getList = () => {
|
||||
loading.value = true;
|
||||
listStoreroom(queryParams.value)
|
||||
.then((res) => {
|
||||
storeroomList.value = res.rows;
|
||||
total.value = res.total;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: StoreroomVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/house/addStoreRoom'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = (row?: StoreroomVO) => {
|
||||
const id = row?.id || ids.value[0];
|
||||
router.push({
|
||||
path: '/house/EditStoreRoom',
|
||||
query: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: StoreroomVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
|
||||
await delStoreroom(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.storeRoomBox {
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
& > .el-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.tableBody {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100% - 80px);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user