车位区域管理完成
This commit is contained in:
159
src/views/system/carArea/addCarArea.vue
Normal file
159
src/views/system/carArea/addCarArea.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="userid ? '编辑房屋租赁' : '添加房屋租赁'"></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form label-position="right" class="formBody" ref="formRef" :model="form" :rules="rules" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="区域名称" prop="houseId">
|
||||
<el-input v-model.trim="form.areaName" placeholder="请输入住户姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="区域编号" prop="rentalName">
|
||||
<el-input v-model.trim="form.areaCode" placeholder="请输入住户姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="区域面积" prop="remark">
|
||||
<el-input v-model.number="form.area" 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="phone">
|
||||
<el-input v-model.number="form.parkingCount" placeholder="请输入手机号码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="email">
|
||||
<el-input type="textarea" :rows="5" v-model.trim="form.remark" 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 { addArea, getArea, updateArea } from '@/api/system/carArea/index';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
id: null,
|
||||
villageId: null,
|
||||
areaName: null,
|
||||
areaCode: null,
|
||||
area: null,
|
||||
parkingCount: null,
|
||||
remark: null
|
||||
});
|
||||
const rules = ref({
|
||||
areaName: [{ required: true, message: '请输入区域名称', trigger: 'blur' }],
|
||||
areaCode: [{ required: true, message: '请输入区域编号', trigger: 'blur' }]
|
||||
});
|
||||
const parkingid = ref(null);
|
||||
|
||||
if (route.query.id) {
|
||||
parkingid.value = route.query.id;
|
||||
getArea(parkingid.value).then((res) => {
|
||||
console.log(res);
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// !== 提交 =============================================================================
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (parkingid.value) {
|
||||
updateArea(form.value).then(() => {
|
||||
ElMessage.success('编辑成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
addArea(form.value).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.push({
|
||||
path: '/carArea/carAreaList'
|
||||
});
|
||||
};
|
||||
</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;
|
||||
}
|
||||
.el-button {
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
175
src/views/system/carArea/index.vue
Normal file
175
src/views/system/carArea/index.vue
Normal file
@@ -0,0 +1,175 @@
|
||||
<template>
|
||||
<div class="p-2 flex w-full h-full flex-column">
|
||||
<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">
|
||||
<el-form-item label="区域名称" prop="areaName">
|
||||
<el-input v-model="queryParams.areaName" placeholder="请输入区域名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="区域编号" prop="areaCode">
|
||||
<el-input v-model="queryParams.areaCode" 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" class="flex-1">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['area:area:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['area:area:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['area:area:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="areaList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="区域名称" align="center" prop="areaName" />
|
||||
<el-table-column label="区域编号" align="center" prop="areaCode" />
|
||||
<el-table-column label="面积" align="center" prop="area" />
|
||||
<el-table-column label="车位数量" align="center" prop="parkingCount" />
|
||||
<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="['area:area:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['area:area: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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Area" lang="ts">
|
||||
import { listArea, getArea, delArea, addArea, updateArea } from '@/api/system/carArea/index';
|
||||
import { AreaVO, AreaQuery, AreaForm } from '@/api/system/carArea/type';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const router = useRouter();
|
||||
const areaList = ref<AreaVO[]>([]);
|
||||
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 initFormData: AreaForm = {
|
||||
id: undefined,
|
||||
areaName: undefined,
|
||||
areaCode: undefined,
|
||||
area: undefined,
|
||||
parkingCount: undefined,
|
||||
remark: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
const data = reactive<PageData<AreaForm, AreaQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
areaName: undefined,
|
||||
areaCode: undefined,
|
||||
area: undefined,
|
||||
parkingCount: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '区域管理表id不能为空', trigger: 'blur' }],
|
||||
areaName: [{ required: true, message: '区域名称不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询车位区域管理列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listArea(queryParams.value);
|
||||
areaList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: AreaVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/carArea/addCarArea'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: AreaVO) => {
|
||||
router.push({
|
||||
path: '/carArea/addCarArea',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: AreaVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除车位区域管理编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delArea(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-table {
|
||||
height: calc(100% - 80px);
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="houseid ? '添加房屋' : '编辑房屋'"></PageHeader>
|
||||
<PageHeader :title="houseid ? '编辑房屋' : '添加房屋'"></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
@@ -20,6 +20,11 @@
|
||||
<el-option v-for="item in floors" :key="item.no" :label="item.name" :value="item.no" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="房屋类型" prop="houseUse">
|
||||
<el-select v-model.number="form.houseUse" class="m-2" placeholder="请选择">
|
||||
<el-option v-for="(item, index) in houseUselist" :key="index" :label="item" :value="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="房间号" prop="houseNo">
|
||||
<el-input v-model="form.houseNo" placeholder="请输入房间号" />
|
||||
</el-form-item>
|
||||
@@ -77,6 +82,7 @@ import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { addHouseAPI, EditHouseApi, getHouseApi, getHouselistAPI } from '@/api/system/house';
|
||||
import { addHouseType } from '@/api/system/house/type';
|
||||
import { houseUselist } from '@/utils/house';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
@@ -90,12 +96,14 @@ const form = ref<addHouseType>({
|
||||
houseArea: '', //建筑面积
|
||||
internalArea: '', //套内面积
|
||||
shareArea: '', // 公摊面积
|
||||
houseUse: 0, // 房屋类型
|
||||
houseType: '' // 房屋户型
|
||||
});
|
||||
const rules = ref({
|
||||
buildingId: [{ required: true, message: '请输入楼栋', trigger: 'blur' }],
|
||||
unitNo: [{ required: true, message: '请选择单元', trigger: 'blur' }],
|
||||
floorNo: [{ required: true, message: '请选择楼层', trigger: 'blur' }],
|
||||
houseUse: [{ required: true, message: '请选择房屋类型', trigger: 'blur' }],
|
||||
buildingName: [{ required: true, message: '请输入房间号', trigger: 'blur' }],
|
||||
buildingArea: [{ required: true, message: '请输入建筑面积', trigger: 'blur' }],
|
||||
internalFloorArea: [{ required: true, message: '请输入套内面积', trigger: 'blur' }],
|
||||
@@ -115,6 +123,7 @@ if (route.query.id) {
|
||||
houseId: res.data.houseId, // 房屋id
|
||||
unitNo: res.data.unitNo,
|
||||
floorNo: res.data.floorNo,
|
||||
houseUse: res.data.houseUse,
|
||||
houseNo: res.data.houseNo, // 房间号
|
||||
houseArea: res.data.houseArea, //建筑面积
|
||||
internalArea: res.data.internalArea, //套内面积
|
||||
|
||||
@@ -14,7 +14,7 @@ import { ref } from 'vue';
|
||||
import type { FloorsType, HouseType } from '@/api/system/house/type';
|
||||
const props = defineProps<{
|
||||
unit: FloorsType[];
|
||||
fIdx: string;
|
||||
fIdx: number | string;
|
||||
menuList: {
|
||||
label: string;
|
||||
value: string;
|
||||
|
||||
485
src/views/system/houseRental/addhouseResident.vue
Normal file
485
src/views/system/houseRental/addhouseResident.vue
Normal file
@@ -0,0 +1,485 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="userid ? '编辑房屋租赁' : '添加房屋租赁'"></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 @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 v-model="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.number="form.rentalStatus" class="m-2" 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.number="form.houseUse" class="m-2" placeholder="请选择">
|
||||
<el-option v-for="(item, index) in com_house_use" :key="index" :label="item.label" :value="Number(item.value)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="租金" prop="rent">
|
||||
<el-input v-model="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="Number(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.number="form.houseFace" class="m-2" 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 v-model.number="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 v-model.number="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">
|
||||
<div
|
||||
v-for="item in com_house_rental_facilities"
|
||||
:key="item.value"
|
||||
@click="handleClick(item.value)"
|
||||
class="housedevices_item"
|
||||
:class="{
|
||||
active: housedeviceslist.includes(item.value)
|
||||
}"
|
||||
>
|
||||
<span class="checked">√</span>
|
||||
<span class="ml-2">{{ item.label }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</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"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:on-remove="handleRemove"
|
||||
:on-success="handleAvatarSuccess"
|
||||
>
|
||||
<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" :rows="5" v-model.number="form.supInfo" placeholder="请输入补充房屋信息" />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model.number="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 v-model.number="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.number="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 { HouseRentalVO } from '@/api/system/houseRental/type';
|
||||
import { CascaderValue, UploadFiles, UploadInstance, UploadProps, UploadRawFile, UploadUserFile } from 'element-plus';
|
||||
|
||||
import { getCommunitylistAPI } from '@/api/system/community';
|
||||
import { getVillageTree } from '@/api/system/house';
|
||||
import { convertBuildingToTree, getHousePathById, hasFormData, splitStringUrl } from '@/utils/house';
|
||||
import { addHouseRental, getHouseRental, updateHouseRental, uploadHouseImage } from '@/api/system/houseRental';
|
||||
|
||||
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_house_rental_facilities } = toRefs<any>(proxy?.useDict('com_house_rental_facilities') || {});
|
||||
const { com_rental_status } = toRefs<any>(proxy?.useDict('com_rental_status'));
|
||||
const { com_house_use } = toRefs<any>(proxy?.useDict('com_house_use'));
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const formRef = ref();
|
||||
const houseformat = ['东', '西', '南', '北'];
|
||||
const form = ref<HouseRentalVO>({
|
||||
id: null,
|
||||
houseId: null,
|
||||
rentalName: '', // 租户姓名
|
||||
rent: null, // 租金
|
||||
houseFace: '', // 房屋朝向
|
||||
rentalType: 0, // 整租合租
|
||||
phone: null, //手机号
|
||||
houseArea: null, // 房屋面积
|
||||
floorNo: null, //楼层号
|
||||
inTime: '', //入住时间
|
||||
facilities: '', //房屋设施
|
||||
houseImageUrl: '', //房屋图片
|
||||
supInfo: '', //补充租房信息
|
||||
vx: '', //微信
|
||||
houseUse: 0, //房屋用途
|
||||
rentalStatus: 0, //租赁状态
|
||||
email: '' //邮箱
|
||||
});
|
||||
const userHousepath = ref<CascaderValue>([]);
|
||||
const rules = ref({
|
||||
houseId: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
|
||||
rentalName: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{
|
||||
validator: (_, value) => {
|
||||
return /^1[3-9]\d{9}$/.test(value);
|
||||
},
|
||||
message: '请输入正确的手机号码',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
// ! 编辑租赁-=================================================================================
|
||||
const userid = ref(null);
|
||||
// !== 楼栋房屋 =============================================================================
|
||||
const treedata = ref([]);
|
||||
function gettreedata() {
|
||||
getCommunitylistAPI().then((res) => {
|
||||
const currentviliage = res.rows.find((item) => item.choiceStatus === 0);
|
||||
if (currentviliage.villageId) {
|
||||
getVillageTree(currentviliage.villageId).then((res) => {
|
||||
treedata.value = convertBuildingToTree(res.data.buildings);
|
||||
console.log(treedata.value);
|
||||
// !== 编辑用户 =============================================================================
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getHouseRental(userid.value).then((res) => {
|
||||
console.log(res);
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
const imgurllist = splitStringUrl(form.value.houseImageUrl);
|
||||
fileList.value = imgurllist;
|
||||
const arr = getHousePathById(treedata.value, form.value.houseId);
|
||||
userHousepath.value = arr;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
gettreedata();
|
||||
|
||||
// 获取房屋
|
||||
function handleChange(val: CascaderValue) {
|
||||
userHousepath.value = val;
|
||||
form.value.houseId = val[2];
|
||||
}
|
||||
// !== 上传文件 =============================================================================
|
||||
const fileList = ref<UploadUserFile[]>([]);
|
||||
const dialogImageUrl = ref('');
|
||||
const dialogVisible = ref(false);
|
||||
// 上传文件成功
|
||||
const uploadRef = ref<UploadInstance>();
|
||||
const handleAvatarSuccess: UploadProps['onSuccess'] = (response, uploadFile) => {
|
||||
if (response.data && response.data.error.length > 0) {
|
||||
ElMessage.error('图片上传失败,请稍后再试');
|
||||
}
|
||||
};
|
||||
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
||||
dialogImageUrl.value = uploadFile.url!;
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
console.log(uploadFile, uploadFiles);
|
||||
};
|
||||
|
||||
// !== 家电 =============================================================================
|
||||
|
||||
// 家电
|
||||
const housedeviceslist = ref([]);
|
||||
watch(
|
||||
() => com_house_rental_facilities.value,
|
||||
(newVal) => {
|
||||
housedeviceslist.value = (newVal || []).map((item) => item.value);
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
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;
|
||||
}
|
||||
});
|
||||
console.log(formdata);
|
||||
if (!hasFormData(formdata)) return sendForm();
|
||||
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();
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err && err.data && err.data.error.length > 0) {
|
||||
const str = err.data.error.join(',');
|
||||
err.data.error.forEach((item) => {
|
||||
fileList.value = fileList.value.filter((file) => file.name !== item);
|
||||
});
|
||||
ElMessage.error('图片:' + str + ' 上传失败!,请重新上传');
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
sendForm();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const sendForm = () => {
|
||||
// edit or add
|
||||
if (userid.value) {
|
||||
console.log('edit');
|
||||
console.log(form.value);
|
||||
updateHouseRental(form.value).then(() => {
|
||||
ElMessage.success('编辑成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
addHouseRental(form.value).then((res) => {
|
||||
ElMessage.success('添加成功');
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.push({
|
||||
path: '/house/houseRental'
|
||||
});
|
||||
};
|
||||
</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%;
|
||||
}
|
||||
.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>
|
||||
245
src/views/system/houseRental/index.vue
Normal file
245
src/views/system/houseRental/index.vue
Normal file
@@ -0,0 +1,245 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<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="120px" ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="房屋用途" prop="houseUse">
|
||||
<el-select v-model="queryParams.houseUse" placeholder="选择房屋用途" style="width: 240px">
|
||||
<el-option v-for="item in com_house_use" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发布人" prop="houseId">
|
||||
<el-input v-model="queryParams.rentalName" 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="['houseRental:houseRental:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['houseRental:houseRental:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['houseRental:houseRental:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="houseRentalList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="房屋信息" align="center" prop="rentalName" />
|
||||
<el-table-column label="租赁状态" align="center" prop="rent" />
|
||||
<el-table-column label="发布人" align="center" prop="rentalName" />
|
||||
<el-table-column label="联系方式" align="center" prop="rent" />
|
||||
<el-table-column label="发布时间" align="center" prop="pubTime" />
|
||||
<el-table-column label="房屋用途" align="center" prop="rent">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.houseUse === 0">普通住宅</span>
|
||||
<span v-else-if="row.houseUse === 1"> 商业用地 </span>
|
||||
<span v-else-if="row.houseUse === 2">商住两用</span>
|
||||
<span v-else>其他</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="租赁方式" align="center" prop="rentalType">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.rentalType === 0">整租</el-tag>
|
||||
<el-tag type="success" v-else>合租</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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="['houseRental:houseRental:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['houseRental:houseRental: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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="HouseRental" lang="ts">
|
||||
import { listHouseRental, delHouseRental, addHouseRental, updateHouseRental } from '@/api/system/houseRental/index';
|
||||
import { HouseRentalVO, HouseRentalQuery, HouseRentalForm } from '@/api/system/houseRental/type';
|
||||
import { getDictLabel } from '@/utils/house';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_house_use } = toRefs<any>(proxy?.useDict('com_house_use'));
|
||||
const { com_rental_method } = toRefs<any>(proxy?.useDict('com_rental_method'));
|
||||
|
||||
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 dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: HouseRentalForm = {
|
||||
id: undefined,
|
||||
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
|
||||
};
|
||||
const data = reactive<PageData<HouseRentalForm, HouseRentalQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
|
||||
houseUse: undefined,
|
||||
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,
|
||||
params: {}
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form } = toRefs(data);
|
||||
|
||||
/** 查询房屋租赁管理列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listHouseRental(queryParams.value);
|
||||
houseRentalList.value = res.rows;
|
||||
total.value = res.total;
|
||||
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();
|
||||
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'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: HouseRentalVO) => {
|
||||
router.push({
|
||||
path: '/house/addhouseRental',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
houseRentalFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateHouseRental(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addHouseRental(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: HouseRentalVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除房屋租赁管理编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delHouseRental(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
362
src/views/system/houseRental/index2.vue
Normal file
362
src/views/system/houseRental/index2.vue
Normal file
@@ -0,0 +1,362 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<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">
|
||||
<el-form-item label="房屋id" prop="houseId">
|
||||
<el-input v-model="queryParams.houseId" placeholder="请输入房屋id" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租户姓名" prop="rentalName">
|
||||
<el-input v-model="queryParams.rentalName" placeholder="请输入租户姓名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租金 单位元" prop="rent">
|
||||
<el-input v-model="queryParams.rent" placeholder="请输入租金 单位元" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租赁状态 0未租 1出租中 2退租" prop="rentalStatus">
|
||||
<el-select v-model="queryParams.rentalStatus" placeholder="请选择租赁状态 0未租 1出租中 2退租" clearable >
|
||||
<el-option v-for="dict in com_rental_status" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="房屋朝向" prop="houseFace">
|
||||
<el-input v-model="queryParams.houseFace" placeholder="请输入房屋朝向" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="房屋面积" prop="houseArea">
|
||||
<el-input v-model="queryParams.houseArea" placeholder="请输入房屋面积" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼层号" prop="floorNo">
|
||||
<el-input v-model="queryParams.floorNo" placeholder="请输入楼层号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入住时间" prop="inTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.inTime"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择入住时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="房屋设施" prop="facilities">
|
||||
<el-input v-model="queryParams.facilities" placeholder="请输入房屋设施" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="房屋照片url( "," 隔开)" prop="houseImageUrl">
|
||||
<el-input v-model="queryParams.houseImageUrl" placeholder="请输入房屋照片url( "," 隔开)" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="补充租房信息" prop="supInfo">
|
||||
<el-input v-model="queryParams.supInfo" placeholder="请输入补充租房信息" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="queryParams.phone" placeholder="请输入手机号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="微信" prop="vx">
|
||||
<el-input v-model="queryParams.vx" placeholder="请输入微信" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="queryParams.email" 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="['houseRental:houseRental:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['houseRental:houseRental:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['houseRental:houseRental:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['houseRental:houseRental: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="houseRentalList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id 房屋租赁表id" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="房屋id" align="center" prop="houseId" />
|
||||
<el-table-column label="租户姓名" align="center" prop="rentalName" />
|
||||
<el-table-column label="租金 单位元" align="center" prop="rent" />
|
||||
<el-table-column label="0 整租 1 合租" align="center" prop="rentalType" />
|
||||
<el-table-column label="租赁状态 0未租 1出租中 2退租" align="center" prop="rentalStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_rental_status" :value="scope.row.rentalStatus"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="房屋朝向" align="center" prop="houseFace" />
|
||||
<el-table-column label="房屋面积" align="center" prop="houseArea" />
|
||||
<el-table-column label="楼层号" align="center" prop="floorNo" />
|
||||
<el-table-column label="入住时间" align="center" prop="inTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.inTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="房屋设施" align="center" prop="facilities">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_house_rental_facilities" :value="scope.row.facilities"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="房屋照片url( "," 隔开)" align="center" prop="houseImageUrl" />
|
||||
<el-table-column label="补充租房信息" align="center" prop="supInfo" />
|
||||
<el-table-column label="手机号" align="center" prop="phone" />
|
||||
<el-table-column label="微信" align="center" prop="vx" />
|
||||
<el-table-column label="邮箱" align="center" prop="email" />
|
||||
<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="['houseRental:houseRental:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['houseRental:houseRental: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="houseRentalFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="房屋id" prop="houseId">
|
||||
<el-input v-model="form.houseId" placeholder="请输入房屋id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租户姓名" prop="rentalName">
|
||||
<el-input v-model="form.rentalName" placeholder="请输入租户姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租金 单位元" prop="rent">
|
||||
<el-input v-model="form.rent" placeholder="请输入租金 单位元" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租赁状态 0未租 1出租中 2退租" prop="rentalStatus">
|
||||
<el-radio-group v-model="form.rentalStatus">
|
||||
<el-radio
|
||||
v-for="dict in com_rental_status"
|
||||
:key="dict.value"
|
||||
:value="parseInt(dict.value)"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="房屋朝向" prop="houseFace">
|
||||
<el-input v-model="form.houseFace" placeholder="请输入房屋朝向" />
|
||||
</el-form-item>
|
||||
<el-form-item label="房屋面积" prop="houseArea">
|
||||
<el-input v-model="form.houseArea" placeholder="请输入房屋面积" />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼层号" prop="floorNo">
|
||||
<el-input v-model="form.floorNo" placeholder="请输入楼层号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入住时间" prop="inTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.inTime"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择入住时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="房屋设施" prop="facilities">
|
||||
<el-input v-model="form.facilities" placeholder="请输入房屋设施" />
|
||||
</el-form-item>
|
||||
<el-form-item label="房屋照片url( "," 隔开)" prop="houseImageUrl">
|
||||
<el-input v-model="form.houseImageUrl" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="补充租房信息" prop="supInfo">
|
||||
<el-input v-model="form.supInfo" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="微信" prop="vx">
|
||||
<el-input v-model="form.vx" placeholder="请输入微信" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="form.email" 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="HouseRental" lang="ts">
|
||||
import { listHouseRental, getHouseRental, delHouseRental, addHouseRental, updateHouseRental } from '@/api/houseRental/houseRental';
|
||||
import { HouseRentalVO, HouseRentalQuery, HouseRentalForm } from '@/api/houseRental/houseRental/types';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_rental_status } = toRefs<any>(proxy?.useDict('com_rental_status'));
|
||||
|
||||
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 dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: HouseRentalForm = {
|
||||
id: undefined,
|
||||
houseId: undefined,
|
||||
rentalName: undefined,
|
||||
rent: undefined,
|
||||
rentalType: undefined,
|
||||
rentalStatus: undefined,
|
||||
houseFace: undefined,
|
||||
houseArea: undefined,
|
||||
floorNo: undefined,
|
||||
inTime: undefined,
|
||||
facilities: undefined,
|
||||
houseImageUrl: undefined,
|
||||
supInfo: undefined,
|
||||
phone: undefined,
|
||||
vx: undefined,
|
||||
email: undefined,
|
||||
}
|
||||
const data = reactive<PageData<HouseRentalForm, HouseRentalQuery>>({
|
||||
form: {...initFormData},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
houseId: undefined,
|
||||
rentalName: undefined,
|
||||
rent: undefined,
|
||||
rentalType: undefined,
|
||||
rentalStatus: undefined,
|
||||
houseFace: undefined,
|
||||
houseArea: undefined,
|
||||
floorNo: undefined,
|
||||
inTime: undefined,
|
||||
facilities: undefined,
|
||||
houseImageUrl: undefined,
|
||||
supInfo: undefined,
|
||||
phone: undefined,
|
||||
vx: undefined,
|
||||
email: undefined,
|
||||
params: {
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "id 房屋租赁表id不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询房屋租赁管理列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listHouseRental(queryParams.value);
|
||||
houseRentalList.value = res.rows;
|
||||
total.value = res.total;
|
||||
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();
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: HouseRentalVO[]) => {
|
||||
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?: HouseRentalVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const res = await getHouseRental(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改房屋租赁管理";
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
houseRentalFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateHouseRental(form.value).finally(() => buttonLoading.value = false);
|
||||
} else {
|
||||
await addHouseRental(form.value).finally(() => buttonLoading.value = false);
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: HouseRentalVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除房屋租赁管理编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await delHouseRental(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
await getList();
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('houseRental/houseRental/export', {
|
||||
...queryParams.value
|
||||
}, `houseRental_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
166
src/views/system/parking/addParking.vue
Normal file
166
src/views/system/parking/addParking.vue
Normal file
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="userid ? '编辑车位' : '添加车位'"></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="areaId">
|
||||
<el-select v-model="form.areaId" placeholder="请选择" clearable>
|
||||
<el-option v-for="dict in com_review" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="车位编号" prop="parkingCode">
|
||||
<el-input v-model.trim="form.parkingCode" placeholder="请输入车位编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="车位面积" prop="parkingArea">
|
||||
<el-input v-model.number="form.parkingArea" placeholder="请输入车位面积" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="所属楼层" prop="parkingFloor">
|
||||
<el-input v-model.number="form.parkingFloor" placeholder="请输入所属楼层" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="车位类型" prop="type">
|
||||
<el-radio-group v-model="form.type">
|
||||
<el-radio :value="1">男</el-radio>
|
||||
<el-radio :value="0">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="车位状态" prop="parkingStatus">
|
||||
<el-select v-model="form.parkingStatus" placeholder="请选择" clearable>
|
||||
<el-option v-for="dict in com_parking_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="持有人" prop="remark">持有人 </el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" :rows="5" v-model.trim="form.remark" 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';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_review } = toRefs<any>(proxy?.useDict('com_review'));
|
||||
const { com_parking_status } = toRefs<any>(proxy?.useDict('com_parking_status'));
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const formRef = ref();
|
||||
const houseformat = ['东', '西', '南', '北'];
|
||||
const form = ref({
|
||||
id: null,
|
||||
areaId: null,
|
||||
parkingArea: null,
|
||||
parkingFloor: null,
|
||||
type: null,
|
||||
parkingStatus: null,
|
||||
remark: null,
|
||||
parkingCode: '' // 租户姓名
|
||||
});
|
||||
const rules = ref({
|
||||
areaId: [{ required: true, message: '请选择车位区域', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '请选择车位类型', trigger: 'blur' }],
|
||||
parkingCode: [{ required: true, message: '请输入车位编号', trigger: 'blur' }]
|
||||
});
|
||||
const userid = ref(null);
|
||||
|
||||
// !== 提交 =============================================================================
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
}
|
||||
});
|
||||
};
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.push({
|
||||
path: '/carArea/parkingList'
|
||||
});
|
||||
};
|
||||
</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;
|
||||
}
|
||||
.el-button {
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
197
src/views/system/parking/index.vue
Normal file
197
src/views/system/parking/index.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<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">
|
||||
<el-form-item label="车位状态" prop="areaId">
|
||||
<el-select v-model="queryParams.checkStatus" placeholder="请选择" clearable>
|
||||
<el-option v-for="dict in com_parking_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="审核状态" prop="checkStatus">
|
||||
<el-select v-model="queryParams.checkStatus" placeholder="请选择" clearable>
|
||||
<el-option v-for="dict in com_review" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="车位编号" prop="parkingCode">
|
||||
<el-input v-model="queryParams.parkingCode" 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="['parking:parking:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['parking:parking:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['parking:parking:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="parkingList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="区域" align="center" prop="areaId" />
|
||||
<el-table-column label="车位编号" align="center" prop="parkingCode" />
|
||||
<el-table-column label="车位面积" align="center" prop="parkingArea" />
|
||||
<el-table-column label="楼层" align="center" prop="parkingArea" />
|
||||
<el-table-column label="车位状态" align="center" prop="parkingStatus" />
|
||||
<el-table-column label="车位类型" align="center" prop="type" />
|
||||
<el-table-column label="持有人" align="center" prop="parkingArea" />
|
||||
<el-table-column label="审核状态" align="center" prop="checkStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_review" :value="scope.row.checkStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['parking:parking:edit']">审核</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['parking:parking:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['parking:parking: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="Parking" lang="ts">
|
||||
import { listParking, getParking, delParking, addParking, updateParking } from '@/api/system/parking/index';
|
||||
import { ParkingVO, ParkingQuery, ParkingForm } from '@/api/system/parking/type';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_review } = toRefs<any>(proxy?.useDict('com_review'));
|
||||
const { com_parking_status } = toRefs<any>(proxy?.useDict('com_parking_status'));
|
||||
|
||||
const router = useRouter();
|
||||
const parkingList = ref<ParkingVO[]>([]);
|
||||
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 parkingFormRef = ref<ElFormInstance>();
|
||||
|
||||
const initFormData: ParkingForm = {
|
||||
id: undefined,
|
||||
areaId: undefined,
|
||||
parkingCode: undefined,
|
||||
parkingArea: undefined,
|
||||
parkingStatus: undefined,
|
||||
type: undefined,
|
||||
residentId: undefined,
|
||||
addTime: undefined,
|
||||
addBy: undefined,
|
||||
checkStatus: undefined,
|
||||
remark: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
const data = reactive<PageData<ParkingForm, ParkingQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
areaId: undefined,
|
||||
parkingCode: undefined,
|
||||
parkingArea: undefined,
|
||||
parkingStatus: undefined,
|
||||
type: undefined,
|
||||
residentId: undefined,
|
||||
addTime: undefined,
|
||||
addBy: undefined,
|
||||
checkStatus: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: 'id车位管理表不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询车位管理列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listParking(queryParams.value);
|
||||
parkingList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ParkingVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/carArea/addParking'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: ParkingVO) => {
|
||||
router.push({
|
||||
path: '/carArea/addParking',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ParkingVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除车位管理编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delParking(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
147
src/views/system/parking/template.vue
Normal file
147
src/views/system/parking/template.vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="userid ? '编辑房屋租赁' : '添加房屋租赁'"></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-input v-model.trim="form.rentalName" placeholder="请输入住户姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="区域编号" prop="rentalName">
|
||||
<el-input v-model.trim="form.rentalName" placeholder="请输入住户姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="区域面积" prop="remark">
|
||||
<el-input type="textarea" :rows="5" v-model.number="form.supInfo" placeholder="请输入补充房屋信息" />
|
||||
</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="24">
|
||||
<el-form-item label="备注" prop="email">
|
||||
<el-input type="textarea" :rows="5" 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';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
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: null, // 房屋面积
|
||||
floorNo: null, //楼层号
|
||||
inTime: '', //入住时间
|
||||
facilities: '', //房屋设施
|
||||
houseImageUrl: '', //房屋图片
|
||||
supInfo: '', //补充租房信息
|
||||
vx: '', //微信
|
||||
houseUse: 0, //房屋用途
|
||||
rentalStatus: 0, //租赁状态
|
||||
email: '' //邮箱
|
||||
});
|
||||
const rules = ref({
|
||||
houseId: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
|
||||
rentalName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
||||
});
|
||||
const userid = ref(null);
|
||||
|
||||
// !== 提交 =============================================================================
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
}
|
||||
});
|
||||
};
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.push({
|
||||
path: '/house/parkingList'
|
||||
});
|
||||
};
|
||||
</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;
|
||||
}
|
||||
.el-button {
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -16,57 +16,63 @@
|
||||
<el-col :span="12">
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">住户姓名:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span> {{ userInfo.name }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">手机号码:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span> {{ userInfo.phone }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">证件类型:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span> 身份证 </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">住户类型:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span v-if="userInfo.type === 0"> 业主 </span>
|
||||
<span v-else-if="userInfo.type === 1"> 亲戚 </span>
|
||||
<span v-else> 租户 </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">住户来源:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span> {{ userInfo.name }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">注册时间:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span> {{ userInfo.name }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="userinfo_item img">
|
||||
<div class="title_item">身份证正面:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<div class="userinfo_itme_img">
|
||||
<el-image class="w-full h-full" fit="fill" :src="userInfo.cardImageFront"></el-image>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">住户编号:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span> {{ userInfo.id }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">住户性别:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span> {{ userInfo.gender === 1 ? '男' : '女' }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">证件号码:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span> {{ userInfo.idCard }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">备注:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<span> {{ userInfo.remark ?? '无' }} </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">提交审核时间:</div>
|
||||
<span> 去丽丽 </span>
|
||||
</div>
|
||||
<div class="userinfo_item">
|
||||
<div class="title_item">身份证正面:</div>
|
||||
<span> 去丽丽 </span>
|
||||
<div class="userinfo_item img">
|
||||
<div class="title_item">身份证背面:</div>
|
||||
<div class="userinfo_itme_img">
|
||||
<el-image class="w-full h-full" fit="fill" :src="userInfo.cardImageFront"></el-image>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -83,7 +89,7 @@
|
||||
<div class="w-full h-full flex mt-2">
|
||||
<div class="title">审批意见</div>
|
||||
<div class="preivewBodybox">
|
||||
<el-input placeholder="请输入" type="textarea" :rows="5"></el-input>
|
||||
<el-input v-model="reviewInfo.propertyReviewFeedback" placeholder="请输入" type="textarea" :rows="5"></el-input>
|
||||
<div class="actions">
|
||||
<el-button type="primary">审核通过</el-button>
|
||||
<el-button type="danger">审核不通过</el-button>
|
||||
@@ -105,10 +111,31 @@
|
||||
</div>
|
||||
</template>
|
||||
<div class="w-full h-50%">
|
||||
<el-steps direction="vertical" :active="0">
|
||||
<el-step title="提交信息" description="2023/4/23 10:28:43" />
|
||||
<el-step title="物业审核" description="2023/4/23 11:10:58" />
|
||||
<el-step title="认证通过" description="2023/4/23 12:35:22" />
|
||||
<el-steps space="200px" direction="vertical" :active="activeStop">
|
||||
<el-step :description="reviewInfo.submitTime">
|
||||
<template #title>
|
||||
<span v-if="active === 0">未提交信息</span>
|
||||
<span v-if="active >= 1">已提交信息</span>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step :description="reviewInfo.propertyTime">
|
||||
<template #title>
|
||||
<span v-if="active <= 2">待审核</span>
|
||||
<span v-if="active === 3">物业审核不通过</span>
|
||||
<span v-if="active >= 4">物业审核通过</span>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step :description="reviewInfo.certificationTime">
|
||||
<template #title>
|
||||
<span v-if="active <= 5">未认证</span>
|
||||
<span v-if="active === 6">已认证</span>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>审核完成</span>
|
||||
</template>
|
||||
</el-step>
|
||||
</el-steps>
|
||||
</div>
|
||||
</el-card>
|
||||
@@ -120,6 +147,100 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { getResident, getresidentReviewlistAPI } from '@/api/system/resident';
|
||||
import { ResidentVO } from '@/api/system/resident/type';
|
||||
|
||||
const userInfo = ref<ResidentVO>({
|
||||
code: null,
|
||||
villageId: '',
|
||||
buildingId: '',
|
||||
'id': null,
|
||||
'name': '',
|
||||
'type': null,
|
||||
'gender': null,
|
||||
'status': null,
|
||||
'idCard': '',
|
||||
'phone': null,
|
||||
'houseId': null,
|
||||
'remark': null,
|
||||
'cardImageFront': '',
|
||||
'cardImageBack': ''
|
||||
});
|
||||
|
||||
const reviewInfo = ref({
|
||||
'id': null,
|
||||
'residentId': null,
|
||||
'submitTime': '',
|
||||
'submitStatus': 1,
|
||||
'propertyTime': null,
|
||||
'propertyStatus': null,
|
||||
'propertyReviewFeedback': '',
|
||||
'certificationTime': null,
|
||||
'certificationStatus': null
|
||||
});
|
||||
/** 住户审核状态 */
|
||||
enum reviewStatus {
|
||||
/** 未提交 */
|
||||
unSubmit = 0,
|
||||
/** 已提交 */
|
||||
Submited = 1,
|
||||
/** 待认证 */
|
||||
awaitReview = 2,
|
||||
/** 认证不通过 */
|
||||
unReviewPass = 3,
|
||||
/** 认证通过 */
|
||||
ReviewPass = 4,
|
||||
/** 未认证 */
|
||||
uncertification = 5,
|
||||
/** 已认证 */
|
||||
Certification = 6
|
||||
}
|
||||
type activeType = reviewStatus;
|
||||
const active = ref<activeType>(6);
|
||||
const activeStop = ref(4);
|
||||
const userid = ref(null);
|
||||
const route = useRoute();
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getResident(userid.value).then((res) => {
|
||||
userInfo.value = res.data;
|
||||
getresidentReviewlistAPI(userid.value).then((res) => {
|
||||
console.log(res);
|
||||
if (res.rows[0]) {
|
||||
reviewInfo.value = res.rows[0];
|
||||
handleActivestaus(reviewInfo.value);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handleActivestaus(rews) {
|
||||
if (rews.submitStatus === reviewStatus.unSubmit) {
|
||||
activeStop.value = 0;
|
||||
active.value = 0;
|
||||
} else if (rews.submitStatus === reviewStatus.Submited) {
|
||||
active.value = 1;
|
||||
activeStop.value = 1;
|
||||
// 待认证
|
||||
if (rews.propertyStatus === 0) {
|
||||
active.value = reviewStatus.awaitReview;
|
||||
} else if (rews.propertyStatus === 1) {
|
||||
active.value = reviewStatus.unReviewPass;
|
||||
} else if (rews.propertyStatus === 2) {
|
||||
active.value = reviewStatus.ReviewPass;
|
||||
activeStop.value = 2;
|
||||
|
||||
if (rews.certificationStatus === 0) {
|
||||
active.value = reviewStatus.uncertification;
|
||||
} else if (rews.certificationStatus === 1) {
|
||||
active.value = reviewStatus.Certification;
|
||||
activeStop.value = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(active.value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -137,15 +258,24 @@ import PageHeader from '@/components/Pageheader/index.vue';
|
||||
}
|
||||
.userinfo_item {
|
||||
margin-bottom: 20px;
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
min-height: 40px;
|
||||
line-height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: peru;
|
||||
font-size: 14px;
|
||||
.title_item {
|
||||
margin-right: 10px;
|
||||
width: 100px;
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
&.img {
|
||||
align-items: flex-start;
|
||||
height: 200px;
|
||||
.userinfo_itme_img {
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,6 +332,9 @@ import PageHeader from '@/components/Pageheader/index.vue';
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
&:deep(.el-step.is-vertical .el-step__line) {
|
||||
top: 20px;
|
||||
}
|
||||
&:deep(div.el-step__head.is-finish) {
|
||||
& > div.el-step__line {
|
||||
width: 0;
|
||||
|
||||
@@ -108,7 +108,7 @@ import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { addHouseAPI, EditHouseApi, getHouseApi, getHouselistAPI, getVillageTree } from '@/api/system/house';
|
||||
import { convertBuildingToTree, getHousePathById, ownerRelationshiplist } from './index';
|
||||
import { convertBuildingToTree, getHousePathById, ownerRelationshiplist } from '@/utils/house';
|
||||
import { ResidentForm } from '@/api/system/resident/type';
|
||||
import { CascaderValue, UploadFiles, UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
|
||||
import { genFileId } from 'element-plus';
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
interface Tree {
|
||||
label: string;
|
||||
value: number;
|
||||
type: string;
|
||||
children?: Tree[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 楼栋/单元/房屋 转 Tree 结构(跳过楼层)
|
||||
* @param buildings 原始楼栋数组
|
||||
* @returns Tree[]
|
||||
*/
|
||||
export function convertBuildingToTree(buildings: any[]): Tree[] {
|
||||
if (!buildings || !Array.isArray(buildings)) return [];
|
||||
|
||||
return buildings.map((building) => {
|
||||
// 1. 楼栋
|
||||
const buildingTree: Tree = {
|
||||
label: building.buildingName || '未知楼栋',
|
||||
type: 'buildingId',
|
||||
value: building.buildingId,
|
||||
children: []
|
||||
};
|
||||
|
||||
// 2. 单元
|
||||
const units = building.units || [];
|
||||
const unitTrees = units.map((unit: any) => {
|
||||
const unitTree: Tree = {
|
||||
label: `${unit.unitNo} 单元`,
|
||||
value: unit.unitNo,
|
||||
type: 'unitNo',
|
||||
children: []
|
||||
};
|
||||
|
||||
// ====================== 关键修改 ======================
|
||||
// 直接从 floors 里把所有 house 全部抽出来,跳过 floor 层级
|
||||
const allHouses: any[] = [];
|
||||
const floors = unit.floors || [];
|
||||
|
||||
floors.forEach((floor: any) => {
|
||||
const houses = floor.houses || [];
|
||||
allHouses.push(...houses); // 把所有房屋合并到一个数组
|
||||
});
|
||||
|
||||
// 房屋直接挂在单元下
|
||||
unitTree.children = allHouses.map((house: any) => ({
|
||||
label: house.houseNo || '未知房屋',
|
||||
value: house.houseId,
|
||||
type: 'houseId'
|
||||
}));
|
||||
// ======================================================
|
||||
|
||||
return unitTree;
|
||||
});
|
||||
|
||||
buildingTree.children = unitTrees;
|
||||
console.log(buildingTree);
|
||||
return buildingTree;
|
||||
});
|
||||
}
|
||||
|
||||
// 证件类型
|
||||
const idCardTypelist = [{}];
|
||||
|
||||
// 与业主关系
|
||||
export const ownerRelationshiplist = [
|
||||
{
|
||||
label: '业主',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: '亲属',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '租户',
|
||||
value: 2
|
||||
}
|
||||
];
|
||||
|
||||
interface Tree {
|
||||
label: string;
|
||||
value: number;
|
||||
type: string;
|
||||
children?: Tree[];
|
||||
}
|
||||
// 只允许 字符串/数字 类型的 key
|
||||
type ValidTreeKey = {
|
||||
[K in keyof Tree]: Tree[K] extends string | number ? K : never;
|
||||
}[keyof Tree];
|
||||
|
||||
/**
|
||||
* 根据 houseId 查找完整路径(楼栋 > 单元 > 楼层 > 房屋)
|
||||
* @param treeData 转换后的树形数据
|
||||
* @param houseId 目标房屋ID
|
||||
* @returns string[] 路径数组,如 ['1号楼', '1单元', '3层', '301']
|
||||
*/
|
||||
export function getHousePathById(treeData: Tree[], houseId: number, response: ValidTreeKey = 'value'): (string | number)[] {
|
||||
const path: (string | number)[] = [];
|
||||
|
||||
// 递归查找
|
||||
function findNode(nodes: Tree[]): boolean {
|
||||
for (const node of nodes) {
|
||||
path.push(node[response]); // 把当前节点加入路径
|
||||
|
||||
// 找到目标房屋
|
||||
if (node.type === 'houseId' && node.value === houseId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 递归子节点
|
||||
if (node.children && node.children.length > 0) {
|
||||
if (findNode(node.children)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
path.pop(); // 回溯,移除当前节点
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
findNode(treeData);
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证身份证号码(18位,支持尾号x/X)
|
||||
* @param idCard 身份证号
|
||||
* @return {boolean} true 符合 false 不符合
|
||||
*/
|
||||
export function validateIdCard(idCard: string): boolean {
|
||||
// 18位身份证正则
|
||||
const reg = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/;
|
||||
return reg.test(idCard.trim());
|
||||
}
|
||||
@@ -99,10 +99,11 @@ import { listResident, getResident, delResident, addResident, updateResident } f
|
||||
import { ResidentVO, ResidentQuery, ResidentForm } from '@/api/system/resident/type';
|
||||
import { getVillageTree } from '@/api/system/house/index';
|
||||
import { getCommunitylistAPI } from '@/api/system/community';
|
||||
import { convertBuildingToTree, getHousePathById } from './index';
|
||||
import { RootTreeType, TreeNode } from 'element-plus';
|
||||
import { convertBuildingToTree, getHousePathById } from '@/utils/house';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_house_rental_facilities } = toRefs<any>(proxy?.useDict('com_house_rental_facilities'));
|
||||
|
||||
const router = useRouter();
|
||||
const residentList = ref<ResidentVO[]>([]);
|
||||
const loading = ref(true);
|
||||
|
||||
Reference in New Issue
Block a user