完成访客搭建,完善之前审核界面
This commit is contained in:
@@ -178,14 +178,15 @@
|
||||
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 { CascaderValue, UploadInstance, UploadProps, 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 { getHousePathById, hasFormData, splitStringUrl } from '@/utils/house';
|
||||
import { addHouseRental, getHouseRental, updateHouseRental, uploadHouseImage } from '@/api/system/houseRental';
|
||||
import { validator } from '@/utils/Reg';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { treedata } = storeToRefs(houseStore);
|
||||
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'));
|
||||
@@ -233,32 +234,21 @@ const rules = ref({
|
||||
// ! 编辑租赁-=================================================================================
|
||||
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;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
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();
|
||||
|
||||
@@ -284,6 +274,7 @@ const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
||||
};
|
||||
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
console.log(uploadFile, uploadFiles);
|
||||
fileList.value = uploadFiles;
|
||||
};
|
||||
|
||||
// !== 家电 =============================================================================
|
||||
@@ -321,11 +312,11 @@ const submitForm = () => {
|
||||
if (item.raw && item.raw instanceof File) {
|
||||
formdata.append('files', item.raw);
|
||||
} else {
|
||||
str += item.url;
|
||||
str += item.url + ',';
|
||||
}
|
||||
});
|
||||
console.log(formdata);
|
||||
if (!hasFormData(formdata)) return sendForm();
|
||||
if (!hasFormData(formdata)) return sendForm(str);
|
||||
uploadHouseImage(formdata)
|
||||
.then((res) => {
|
||||
if (res.data.success.length > 0) {
|
||||
@@ -343,7 +334,7 @@ const submitForm = () => {
|
||||
});
|
||||
ElMessage.error('图片:' + str + ' 上传失败!');
|
||||
}
|
||||
sendForm();
|
||||
sendForm(str);
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err && err.data && err.data.error.length > 0) {
|
||||
@@ -356,16 +347,16 @@ const submitForm = () => {
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
sendForm();
|
||||
sendForm(str);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const sendForm = () => {
|
||||
const sendForm = (val: string) => {
|
||||
form.value.houseImageUrl = val;
|
||||
// edit or add
|
||||
if (userid.value) {
|
||||
console.log('edit');
|
||||
console.log(form.value);
|
||||
updateHouseRental(form.value).then(() => {
|
||||
ElMessage.success('编辑成功');
|
||||
cancelForm();
|
||||
@@ -422,6 +413,7 @@ const cancelForm = () => {
|
||||
padding: 15px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.AddBuildingBody {
|
||||
margin-top: 20px;
|
||||
|
||||
197
src/views/system/houseRental/houseMain.vue
Normal file
197
src/views/system/houseRental/houseMain.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader title="房屋租赁管理"></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">
|
||||
<span>基础资料 </span>
|
||||
<span class="ml-20px color-blue cursor-pointer" @click="hanlededit">编辑</span>
|
||||
</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">房屋:</div>
|
||||
<div class="value">{{ HouseInfo.house }}</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">
|
||||
<DictTag :options="com_house_rental_facilities" :value="HouseInfo.facilities"></DictTag>
|
||||
</div>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<div class="descriptionsbox">
|
||||
<div class="label">房屋照片:</div>
|
||||
<div class="value grid grid-cols-4 gap-4">
|
||||
<el-image v-for="(item, index) in HouseInfo.houseImageUrls" :key="index" :src="item" 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 PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { getHouseRental } from '@/api/system/houseRental';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { getHousePathById } from '@/utils/house';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { treedata } = storeToRefs(houseStore);
|
||||
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 route = useRoute();
|
||||
const router = useRouter();
|
||||
const houseRentalid = ref(null);
|
||||
const HouseInfo = ref({
|
||||
'id': '',
|
||||
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': '',
|
||||
houseImageUrls: []
|
||||
});
|
||||
function init() {
|
||||
if (route.query.id) {
|
||||
houseRentalid.value = route.query.id;
|
||||
}
|
||||
getHouseRental(houseRentalid.value).then((res) => {
|
||||
console.log(res);
|
||||
HouseInfo.value = res.data;
|
||||
HouseInfo.value.houseImageUrls = HouseInfo.value.houseImageUrl.split(',').filter((item) => item);
|
||||
const arr = getHousePathById(treedata.value, HouseInfo.value.houseId, 'label');
|
||||
HouseInfo.value.house = arr.join(' - ');
|
||||
});
|
||||
}
|
||||
init();
|
||||
|
||||
function hanlededit() {
|
||||
router.push({
|
||||
path: '/house/addhouseRental',
|
||||
query: {
|
||||
id: HouseInfo.value.id
|
||||
}
|
||||
});
|
||||
}
|
||||
</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;
|
||||
}
|
||||
.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>
|
||||
@@ -46,17 +46,18 @@
|
||||
|
||||
<el-table class="h-full" 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">
|
||||
<el-table-column label="房屋信息" align="center" prop="name" />
|
||||
<el-table-column label="租赁状态" align="center" prop="rentalStatus">
|
||||
<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>
|
||||
<DictTag :options="com_rental_status" :value="row.rentalStatus"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发布人" align="center" prop="rentalName" />
|
||||
<el-table-column label="联系方式" align="center" prop="phone" />
|
||||
<el-table-column label="发布时间" align="center" prop="pubTime" />
|
||||
<el-table-column label="房屋用途" align="center" prop="houseUse">
|
||||
<template #default="{ row }">
|
||||
<DictTag :options="com_house_use" :value="row.houseUse"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="租赁方式" align="center" prop="rentalType">
|
||||
@@ -67,18 +68,9 @@
|
||||
</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>
|
||||
<el-button link type="primary" @click="handleMain(scope.row)" v-hasPermi="['houseRental:houseRental:edit']">详情</el-button>
|
||||
<el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['houseRental:houseRental:edit']">修改</el-button>
|
||||
<el-button link type="primary" @click="handleDelete(scope.row)" v-hasPermi="['houseRental:houseRental:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -90,12 +82,12 @@
|
||||
|
||||
<script setup name="HouseRental" lang="ts">
|
||||
import Pageheader from '@/components/Pageheader/index.vue';
|
||||
import { listHouseRental, delHouseRental, addHouseRental, updateHouseRental } from '@/api/system/houseRental/index';
|
||||
import { listHouseRental, delHouseRental } 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_status } = toRefs<any>(proxy?.useDict('com_rental_status'));
|
||||
const { com_rental_method } = toRefs<any>(proxy?.useDict('com_rental_method'));
|
||||
|
||||
const router = useRouter();
|
||||
@@ -216,6 +208,15 @@ const handleUpdate = async (row?: HouseRentalVO) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
/** 详情按钮操作 */
|
||||
const handleMain = async (row?: HouseRentalVO) => {
|
||||
router.push({
|
||||
path: '/house/houseMain',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: HouseRentalVO) => {
|
||||
@@ -231,4 +232,8 @@ onMounted(() => {
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
<style scoped lang="scss">
|
||||
.el-table {
|
||||
height: calc(100% - 100px);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,362 +0,0 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user