修复小区背景颜色,巡检点顺序一致,投诉处理按钮
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="房屋" prop="houseId">
|
||||
<el-cascader @change="handleChange" v-model="userHousepath" :options="treedata" />
|
||||
<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 disabled v-model="form.rentalName" placeholder="请输入业主姓名" />
|
||||
<el-input :disabled="HasName" v-model="form.rentalName" placeholder="请输入业主姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -58,7 +58,7 @@
|
||||
<el-col :span="11">
|
||||
<el-form-item label="房屋朝向" prop="type">
|
||||
<el-select v-model.number="form.houseFace" placeholder="请选择">
|
||||
<el-option v-for="(item, index) in houseformat" :key="index" :label="item" :value="item" />
|
||||
<el-option v-for="(item, index) in houseFormat" :key="index" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -94,14 +94,14 @@
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="房屋设施" prop="type">
|
||||
<div class="housedevicesbox" v-if="housefacilities.length > 0">
|
||||
<div class="houseDevicesBox" v-if="houseFacilities.length > 0">
|
||||
<div
|
||||
v-for="item in housefacilities"
|
||||
v-for="item in houseFacilities"
|
||||
:key="item.id"
|
||||
@click="handleClick(item.id)"
|
||||
class="housedevices_item"
|
||||
class="houseDevices_Item"
|
||||
:class="{
|
||||
active: housedeviceslist.includes(item.id)
|
||||
active: houseDevicesList.includes(item.id)
|
||||
}"
|
||||
>
|
||||
<span class="checked">√</span>
|
||||
@@ -128,6 +128,7 @@
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:on-remove="handleRemove"
|
||||
:on-success="handleAvatarSuccess"
|
||||
:on-change="handleChangeFile"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
<template #tip>
|
||||
@@ -178,9 +179,9 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { CascaderValue, UploadInstance, UploadProps, UploadUserFile } from 'element-plus';
|
||||
import { CascaderValue, UploadFiles, UploadInstance, UploadProps, UploadUserFile } from 'element-plus';
|
||||
|
||||
import { getHousePathById, hasFormData, splitStringUrl } from '@/utils/house';
|
||||
import { hasFormData, splitStringUrl } from '@/utils/house';
|
||||
import { addHouseRental, getHouseOwnUser, getHouseRental, updateHouseRental, uploadHouseImage } from '@/api/system/houseRental';
|
||||
import { validator } from '@/utils/Reg';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
@@ -192,9 +193,6 @@ const houseStore = useHouseStore();
|
||||
const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/houseRental/uploadImages';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_rental_method } = toRefs<any>(proxy?.useDict('com_rental_method'));
|
||||
|
||||
const { com_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'));
|
||||
|
||||
@@ -202,7 +200,7 @@ const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const formRef = ref();
|
||||
const houseformat = ['东', '西', '南', '北'];
|
||||
const houseFormat = ['东', '西', '南', '北'];
|
||||
const form = ref({
|
||||
id: null,
|
||||
houseId: null,
|
||||
@@ -224,14 +222,14 @@ const form = ref({
|
||||
unitNoId: null, //单元id
|
||||
email: '' //邮箱
|
||||
});
|
||||
const userHousepath = ref<CascaderValue>([]);
|
||||
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: (_, val) => validator(val, 'phone'),
|
||||
validator: (_: any, val: string | number) => validator(val, 'phone'),
|
||||
message: '请输入正确的手机号码',
|
||||
trigger: 'blur'
|
||||
}
|
||||
@@ -239,19 +237,19 @@ const rules = ref({
|
||||
});
|
||||
// ! 编辑租赁-=================================================================================
|
||||
const userid = ref(null);
|
||||
const treedata = ref(null);
|
||||
const housefacilities = ref([]);
|
||||
// !== 楼栋房屋 =============================================================================
|
||||
async function gettreedata() {
|
||||
const reslist = await listHouseFacilities();
|
||||
housefacilities.value = reslist.rows
|
||||
const treeData = ref(null);
|
||||
const houseFacilities = ref([]);
|
||||
// !== 楼栋房屋 =============================================================================╬
|
||||
async function getTreeData() {
|
||||
const resList = await listHouseFacilities();
|
||||
houseFacilities.value = resList.rows
|
||||
.map((item) => {
|
||||
if (item.status !== '1') return item;
|
||||
return false;
|
||||
})
|
||||
.filter((item) => item !== false);
|
||||
|
||||
treedata.value = await houseStore.getCurrentVilageTreeHouse();
|
||||
treeData.value = await houseStore.getCurrentVilageTreeHouse();
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getHouseRental(userid.value).then((res) => {
|
||||
@@ -259,22 +257,30 @@ async function gettreedata() {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
if (form.value.facilities) housedeviceslist.value = form.value.facilities.split(',').filter((item) => item);
|
||||
if (form.value.facilities) houseDevicesList.value = form.value.facilities.split(',').filter((item) => item);
|
||||
if (form.value.houseImageUrl) fileList.value = splitStringUrl(form.value.houseImageUrl);
|
||||
handleChange([form.value.buildingId, form.value.unitNoId, form.value.houseId]);
|
||||
});
|
||||
}
|
||||
}
|
||||
gettreedata();
|
||||
getTreeData();
|
||||
|
||||
const HasName = ref(false);
|
||||
// 获取房屋
|
||||
function handleChange(val: CascaderValue) {
|
||||
userHousepath.value = val;
|
||||
userHousePath.value = val;
|
||||
form.value.houseId = val[2];
|
||||
|
||||
getHouseOwnUser(val[2]).then((res) => {
|
||||
form.value.rentalName = res.msg;
|
||||
});
|
||||
form.value.rentalName = '';
|
||||
if (val[2]) {
|
||||
getHouseOwnUser(val[2]).then((res) => {
|
||||
if (res.msg) {
|
||||
form.value.rentalName = res.msg;
|
||||
HasName.value = true;
|
||||
} else {
|
||||
HasName.value = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// !== 上传文件 =============================================================================
|
||||
const fileList = ref<UploadUserFile[]>([]);
|
||||
@@ -282,28 +288,39 @@ const dialogImageUrl = ref('');
|
||||
const dialogVisible = ref(false);
|
||||
// 上传文件成功
|
||||
const uploadRef = ref<UploadInstance>();
|
||||
const handleAvatarSuccess: UploadProps['onSuccess'] = (response, uploadFile) => {
|
||||
const handleAvatarSuccess: UploadProps['onSuccess'] = (response) => {
|
||||
if (response.data && response.data.error.length > 0) {
|
||||
ElMessage.error('图片上传失败,请稍后再试');
|
||||
}
|
||||
};
|
||||
|
||||
const blockedExts = ['.exe', '.bat', '.cmd', '.msi'];
|
||||
const handleChangeFile = (uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
||||
const ext = uploadFile.name.toLowerCase().slice(uploadFile.name.lastIndexOf('.'));
|
||||
if (blockedExts.includes(ext)) {
|
||||
ElMessage.warning(`禁止上传 ${ext} 文件`);
|
||||
fileList.value = uploadFiles.filter((f) => f.uid !== uploadFile.uid);
|
||||
return;
|
||||
}
|
||||
fileList.value = uploadFiles;
|
||||
};
|
||||
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
||||
dialogImageUrl.value = uploadFile.url!;
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
const handleRemove: UploadProps['onRemove'] = (_, uploadFiles) => {
|
||||
fileList.value = uploadFiles;
|
||||
};
|
||||
|
||||
// !== 家电 =============================================================================
|
||||
|
||||
// 家电
|
||||
const housedeviceslist = ref([]);
|
||||
const houseDevicesList = ref([]);
|
||||
function handleClick(index: number) {
|
||||
if (housedeviceslist.value.includes(index)) {
|
||||
housedeviceslist.value = housedeviceslist.value.filter((item) => item !== index);
|
||||
if (houseDevicesList.value.includes(index)) {
|
||||
houseDevicesList.value = houseDevicesList.value.filter((item) => item !== index);
|
||||
} else {
|
||||
housedeviceslist.value.push(index);
|
||||
houseDevicesList.value.push(index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,28 +331,27 @@ const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
// 处理家电
|
||||
form.value.facilities = housedeviceslist.value.join(',');
|
||||
form.value.facilities = houseDevicesList.value.join(',');
|
||||
let str = '';
|
||||
// 判断有无图片
|
||||
if (fileList.value.length > 0) {
|
||||
const formdata = new FormData();
|
||||
const formData = new FormData();
|
||||
fileList.value.forEach((item) => {
|
||||
// 只处理 新增的图片
|
||||
if (item.raw && item.raw instanceof File) {
|
||||
formdata.append('files', item.raw);
|
||||
formData.append('files', item.raw);
|
||||
} else {
|
||||
str += item.url + ',';
|
||||
}
|
||||
});
|
||||
if (!hasFormData(formdata)) return sendForm(str);
|
||||
uploadHouseImage(formdata)
|
||||
if (!hasFormData(formData)) return sendForm(str);
|
||||
uploadHouseImage(formData)
|
||||
.then((res) => {
|
||||
if (res.data.success.length > 0) {
|
||||
const successlist = res.data.success;
|
||||
successlist.forEach((item) => {
|
||||
const successList = res.data.success;
|
||||
successList.forEach((item) => {
|
||||
str += item.url + ',';
|
||||
});
|
||||
//
|
||||
form.value.houseImageUrl = str;
|
||||
}
|
||||
if (res.data.error.length > 0) {
|
||||
@@ -350,7 +366,7 @@ const submitForm = () => {
|
||||
.catch((err) => {
|
||||
if (err && err.data && err.data.error.length > 0) {
|
||||
const str = err.data.error.join(',');
|
||||
err.data.error.forEach((item) => {
|
||||
err.data.error.forEach((item: string) => {
|
||||
fileList.value = fileList.value.filter((file) => file.name !== item);
|
||||
});
|
||||
ElMessage.error('图片:' + str + ' 上传失败!,请重新上传');
|
||||
@@ -380,7 +396,6 @@ const sendForm = (val: string) => {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.back();
|
||||
@@ -445,13 +460,13 @@ const cancelForm = () => {
|
||||
.formBody {
|
||||
width: 1050px;
|
||||
margin: 0 auto;
|
||||
.housedevicesbox {
|
||||
.houseDevicesBox {
|
||||
display: grid;
|
||||
margin-bottom: 20px;
|
||||
gap: 10px 20px;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
grid-template-rows: repeat(2, 1fr);
|
||||
.housedevices_item {
|
||||
.houseDevices_Item {
|
||||
width: 95px;
|
||||
height: 35px;
|
||||
background-color: #ccc;
|
||||
|
||||
Reference in New Issue
Block a user