物业之前,新工作台

This commit is contained in:
Zy
2026-04-16 21:03:35 +08:00
parent cf9a1f1585
commit 4184f1c55d
91 changed files with 1781 additions and 588 deletions

View File

@@ -31,7 +31,7 @@
<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-option v-for="(item, index) in com_house_use" :key="index" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
@@ -48,7 +48,7 @@
<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 v-for="item in com_rental_method" :key="item.value" :value="item.value">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@@ -96,16 +96,16 @@
<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)"
v-for="item in housefacilities"
:key="item.id"
@click="handleClick(item.id)"
class="housedevices_item"
:class="{
active: housedeviceslist.includes(item.value)
active: housedeviceslist.includes(item.id)
}"
>
<span class="checked"></span>
<span class="ml-2">{{ item.label }}</span>
<span class="ml-2">{{ item.name }}</span>
</div>
</div>
</el-form-item>
@@ -184,13 +184,16 @@ 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';
import { listHouseFacilities } from '@/api/system/HouseFacilities';
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'));
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'));
@@ -205,7 +208,7 @@ const form = ref<HouseRentalVO>({
rentalName: '', // 租户姓名
rent: null, // 租金
houseFace: '', // 房屋朝向
rentalType: 0, // 整租合租
rentalType: '0', // 整租合租
phone: null, //手机号
houseArea: null, // 房屋面积
floorNo: null, //楼层号
@@ -214,7 +217,7 @@ const form = ref<HouseRentalVO>({
houseImageUrl: '', //房屋图片
supInfo: '', //补充租房信息
vx: '', //微信
houseUse: 0, //房屋用途
houseUse: '0', //房屋用途
rentalStatus: 0, //租赁状态
email: '' //邮箱
});
@@ -233,12 +236,17 @@ const rules = ref({
});
// ! 编辑租赁-=================================================================================
const userid = ref(null);
const treedata = ref(null);
const housefacilities = ref([]);
// !== 楼栋房屋 =============================================================================
function gettreedata() {
async function gettreedata() {
const reslist = await listHouseFacilities();
housefacilities.value = reslist.rows;
treedata.value = await houseStore.getCurrentVilageTreeHouse();
if (route.query.id) {
userid.value = route.query.id;
getHouseRental(userid.value).then((res) => {
console.log(res);
form.value = {
...form.value,
...res.data
@@ -273,7 +281,6 @@ const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
dialogVisible.value = true;
};
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
console.log(uploadFile, uploadFiles);
fileList.value = uploadFiles;
};
@@ -281,13 +288,6 @@ const handleRemove: UploadProps['onRemove'] = (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);
@@ -302,6 +302,7 @@ function handleClick(index: number) {
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
// 处理家电
form.value.facilities = housedeviceslist.value.join(',');
let str = '';
// 判断有无图片
@@ -315,7 +316,6 @@ const submitForm = () => {
str += item.url + ',';
}
});
console.log(formdata);
if (!hasFormData(formdata)) return sendForm(str);
uploadHouseImage(formdata)
.then((res) => {
@@ -354,15 +354,18 @@ const submitForm = () => {
};
const sendForm = (val: string) => {
form.value.houseImageUrl = val;
form.value.villageId = Number(localStorage.getItem('villageid'));
// edit or add
if (userid.value) {
console.log('edit');
updateHouseRental(form.value).then(() => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addHouseRental(form.value).then((res) => {
addHouseRental({
...form.value,
villageid: Number(localStorage.getItem('villageid'))
}).then(() => {
ElMessage.success('添加成功');
cancelForm();
});