访客模块待完成
This commit is contained in:
321
src/views/system/Repair/addRepair.vue
Normal file
321
src/views/system/Repair/addRepair.vue
Normal file
@@ -0,0 +1,321 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="userid ? '编辑报修' : '添加报修'"></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form class="formBody" label-position="right" ref="formRef" :model="form" :rules="rules" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="关联房屋" prop="houseId">
|
||||
<el-cascader v-model="form.houseId" :options="treedata" @change="handleChangehouse" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="维修项目" prop="maintenanceItemId">
|
||||
<el-cascader
|
||||
:props="{
|
||||
label: 'projectName',
|
||||
value: 'id'
|
||||
}"
|
||||
v-model="form.maintenanceItemId"
|
||||
placeholder="请选择维修项目"
|
||||
:options="maintenanceItemTreeData"
|
||||
@change="handleChangemaintenanceItem"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="问题描述" prop="problem">
|
||||
<el-input type="textarea" :rows="5" v-model.trim="form.problem" placeholder="请输入问题描述" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-form-item label="报修人" prop="residentId">
|
||||
<Holder :userid="form.residentId" @change="handleChangeResident"></Holder>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<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="12">
|
||||
<el-form-item label="预约日期" prop="orderDate">
|
||||
<el-date-picker v-model="form.orderDate" type="date" placeholder="年/月/日" value-format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="问题图片" prop="remark">
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
:action="uploadUrl"
|
||||
list-type="picture-card"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:on-remove="handleRemove"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
</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 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 { addMonthCard, getMonthCard, updateMonthCard } from '@/api/system/MonthCard';
|
||||
import { getVillageTree } from '@/api/system/house';
|
||||
import { getCommunitylistAPI } from '@/api/system/community';
|
||||
import { convertBuildingToTree, hasFormData } from '@/utils/house';
|
||||
import Holder from '@/components/Holder/index.vue';
|
||||
import { UploadProps, UploadUserFile } from 'element-plus';
|
||||
import { addRepair, getRepair, updateRepair, uploadRepairImages } from '@/api/system/Repair';
|
||||
import { getRepairProject, gettreelistRepairProject } from '@/api/system/RepairProject';
|
||||
|
||||
const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/repair/uploadImages';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_pay_method } = toRefs<any>(proxy?.useDict('com_pay_method'));
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
id: null,
|
||||
houseId: null, // 关联房屋id
|
||||
maintenanceItemId: null, // 维修项目id
|
||||
problem: '', // 问题描述
|
||||
residentId: null, // 报修人id(住户表id)
|
||||
phone: null, // 报手机号码
|
||||
problemImageUrl: '', // 问题图片地址
|
||||
problemStatus: '0', // 0 已提交 1已分配 2维修中 3维修完成
|
||||
repairDes: '', // 维修描述
|
||||
repairImageUrl: '', // 维修图片url
|
||||
orderDate: '' // 预约日期
|
||||
});
|
||||
const rules = ref({
|
||||
houseId: [{ required: true, message: '请选择关联房屋', trigger: 'blur' }],
|
||||
maintenanceItemId: [{ required: true, message: '请选择维修项目', trigger: 'blur' }],
|
||||
problem: [{ required: true, message: '请输入问题描述', trigger: 'blur' }]
|
||||
});
|
||||
const userid = ref(null);
|
||||
// 当前小区
|
||||
const currentviliage = ref();
|
||||
// 树形结构
|
||||
const treedata = ref();
|
||||
// 报修项目 tree 结构
|
||||
const maintenanceItemTreeData = ref();
|
||||
function init() {
|
||||
getCommunitylistAPI().then((res) => {
|
||||
currentviliage.value = res.rows.find((item) => item.choiceStatus === 0);
|
||||
getVillageTree(currentviliage.value.villageId).then((res) => {
|
||||
treedata.value = convertBuildingToTree(res.data.buildings);
|
||||
});
|
||||
|
||||
gettreelistRepairProject().then((res) => {
|
||||
maintenanceItemTreeData.value = res.data;
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
form.value.id = userid.value;
|
||||
getRepair(userid.value).then((res) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
fileList.value = form.value.problemImageUrl
|
||||
.split(',')
|
||||
.map((item) => {
|
||||
if (!item) return undefined;
|
||||
return {
|
||||
name: item.split('/').pop(),
|
||||
url: item
|
||||
};
|
||||
})
|
||||
.filter((item) => item);
|
||||
console.log(fileList.value);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
init();
|
||||
|
||||
// ! 上传图片 =--==================================================================
|
||||
const fileList = ref<UploadUserFile[]>([]);
|
||||
|
||||
const dialogImageUrl = ref('');
|
||||
const dialogVisible = ref(false);
|
||||
|
||||
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
console.log(uploadFile, uploadFiles);
|
||||
};
|
||||
|
||||
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
||||
dialogImageUrl.value = uploadFile.url!;
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
// !== 选择报修人 ====================================================================
|
||||
function handleChangeResident(val: string | number) {
|
||||
console.log(val);
|
||||
form.value.residentId = val;
|
||||
}
|
||||
|
||||
// !== 房屋 ===========================================================================
|
||||
function handleChangehouse(val: (string | number)[]) {
|
||||
if (val.length >= 3) {
|
||||
form.value.houseId = val.pop() as number;
|
||||
} else {
|
||||
form.value.houseId = null;
|
||||
}
|
||||
}
|
||||
function handleChangemaintenanceItem(val: (string | number)[]) {
|
||||
console.log(val);
|
||||
if (val.length >= 2) {
|
||||
form.value.maintenanceItemId = val.pop() as number;
|
||||
} else {
|
||||
form.value.maintenanceItemId = null;
|
||||
}
|
||||
}
|
||||
|
||||
// !== 提交 =============================================================================
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
let str = '';
|
||||
if (fileList.value.length > 0) {
|
||||
// 有图片
|
||||
const formdata = new FormData();
|
||||
fileList.value.forEach((item) => {
|
||||
if (item.raw && item.raw instanceof File) {
|
||||
formdata.append('files', item.raw);
|
||||
} else {
|
||||
str += item.url + ',';
|
||||
}
|
||||
});
|
||||
if (!hasFormData(formdata)) return sendForm(str);
|
||||
uploadRepairImages(formdata).then((res) => {
|
||||
const successlist = res.data.success;
|
||||
const errorlist = res.data.error;
|
||||
if (successlist.length > 0) {
|
||||
successlist.forEach((item) => {
|
||||
str += item.url + ',';
|
||||
});
|
||||
}
|
||||
if (errorlist.length > 0) {
|
||||
errorlist.forEach((item) => {
|
||||
fileList.value = fileList.value.filter((file) => file.name !== item);
|
||||
});
|
||||
ElMessage.error('图片上传失败: ' + errorlist.join(','));
|
||||
}
|
||||
sendForm(str);
|
||||
});
|
||||
} else {
|
||||
sendForm(str);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const sendForm = (str: string) => {
|
||||
form.value.problemImageUrl = str;
|
||||
if (userid.value) {
|
||||
updateRepair(form.value).then((res) => {
|
||||
console.log(res);
|
||||
ElMessage.success('编辑成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
addRepair(form.value).then((res) => {
|
||||
console.log(res);
|
||||
ElMessage.success('添加成功');
|
||||
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
};
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.push({
|
||||
path: '/repair/repairlist'
|
||||
});
|
||||
};
|
||||
</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-date-editor.el-input) {
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
&:deep(.el-form-item__content, .el-select, .el-input) {
|
||||
width: 385px !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>
|
||||
182
src/views/system/Repair/addRepairlist.vue
Normal file
182
src/views/system/Repair/addRepairlist.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="userid ? '编辑车辆信息' : '添加车辆信息'"></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form class="formBody" label-position="right" ref="formRef" :model="form" :rules="rules" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="维修项目名" prop="projectName">
|
||||
<el-input v-model.trim="form.projectName" placeholder="请输入维修项目名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="项目类型" prop="projectType">
|
||||
<el-radio-group v-model="form.projectType">
|
||||
<el-radio v-for="item in com_repair_project_types" :key="item.id" :value="item.value">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="项目层级" prop="projectLevel">
|
||||
<el-radio-group v-model="form.projectLevel">
|
||||
<el-radio v-for="item in com_repair_project_level" :key="item.id" :value="item.value">{{ item.label }}</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="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="item in com_repair_project_status" :key="item.id" :value="item.value">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="form.projectLevel === '1'">
|
||||
<el-col :span="11">
|
||||
<el-form-item label="隶属父级" prop="email">
|
||||
<el-select v-model="form.parentId" placeholder="请选择隶属父级" style="width: 240px">
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.projectName" :value="item.id" />
|
||||
</el-select>
|
||||
</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 { addRepairProject, listRepairProject, updateRepairProject } from '@/api/system/RepairProject';
|
||||
import { buildTreeByLevel } from '@/utils';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_repair_project_types } = toRefs<any>(proxy?.useDict('com_repair_project_types'));
|
||||
const { com_repair_project_status } = toRefs<any>(proxy?.useDict('com_repair_project_status'));
|
||||
const { com_repair_project_level } = toRefs<any>(proxy?.useDict('com_repair_project_level'));
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
id: null,
|
||||
projectName: null, // 项目名称
|
||||
parentId: '', // 父级项目id
|
||||
projectType: '0', // 项目类型
|
||||
projectLevel: '0', //项目层级
|
||||
status: '0' //状态
|
||||
});
|
||||
const rules = ref({
|
||||
projectName: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
|
||||
parentId: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
|
||||
projectType: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
|
||||
projectLevel: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
||||
});
|
||||
const userid = ref(null);
|
||||
const options = ref([]);
|
||||
// != ==========================================
|
||||
|
||||
function init() {
|
||||
listRepairProject({ pageSize: 999999999, pageNum: 1 }).then((res) => {
|
||||
const arr = res.rows.filter((ite) => ite.projectLevel === 0);
|
||||
options.value = arr;
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
const find = res.rows.find((item) => item.id === userid.value);
|
||||
if (find) {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...find,
|
||||
projectLevel: String(find.projectLevel)
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
init();
|
||||
// !== 提交 =============================================================================
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
console.log(form.value);
|
||||
if (!userid.value) {
|
||||
addRepairProject(form.value).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
updateRepairProject(form.value).then(() => {
|
||||
ElMessage.success('编辑成功');
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.push({
|
||||
path: '/repair/repairProjectList'
|
||||
});
|
||||
};
|
||||
</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>
|
||||
264
src/views/system/Repair/index.vue
Normal file
264
src/views/system/Repair/index.vue
Normal file
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<div class="h-full flex flex-col p-2">
|
||||
<pageheader title="报修管理"></pageheader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<!-- <el-form-item label="住户类型" prop="houseId">
|
||||
<el-select v-model="queryParams.parkingStatus" placeholder="请选择" clearable>
|
||||
<el-option v-for="dict in com_resident_relationship" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="报修状态" prop="problemStatus">
|
||||
<el-select v-model="queryParams.problemStatus" placeholder="请选择" clearable>
|
||||
<el-option v-for="dict in com_repair_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="预约日期" prop="maintenanceItemId">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="queryParams.orderDate"
|
||||
placeholder="请选择"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
format="YYYY-MM-DD"
|
||||
/>
|
||||
</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 class="flex-1" 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="['repair:repair:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['repair:repair:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['repair:repair: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="repairList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="报修房屋" align="center" prop="name" />
|
||||
<el-table-column label="维修项目" align="center" prop="maintenanceItemPath" />
|
||||
<el-table-column label="问题描述" align="center" prop="problem" />
|
||||
<el-table-column label="报修人" align="center" prop="residentName" />
|
||||
<el-table-column label="维修状态" align="center" prop="problemStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_repair_status" :value="scope.row.problemStatus"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="预约日期" align="center" prop="orderDate" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.orderDate, '{y}-{m}-{d}') }}</span>
|
||||
</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="Pointer" @click="handleShare(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['repair:repair:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['repair:repair: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="Repair" lang="ts">
|
||||
import { listRepair, getRepair, delRepair, addRepair, updateRepair } from '@/api/system/Repair/index';
|
||||
import { RepairVO, RepairQuery, RepairForm } from '@/api/system/Repair/type';
|
||||
import { listRepairProject } from '@/api/system/RepairProject';
|
||||
import { listResident } from '@/api/system/resident';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const { com_repair_status } = toRefs<any>(proxy?.useDict('com_repair_status'));
|
||||
interface repairlistType extends RepairVO {
|
||||
maintenanceItemPath?: string;
|
||||
residentName?: string;
|
||||
}
|
||||
const repairList = ref<repairlistType[]>([]);
|
||||
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 router = useRouter();
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
|
||||
const initFormData: RepairForm = {
|
||||
id: undefined,
|
||||
houseId: undefined,
|
||||
maintenanceItemId: undefined,
|
||||
problem: undefined,
|
||||
residentId: undefined,
|
||||
phone: undefined,
|
||||
orderDate: undefined,
|
||||
problemImageUrl: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined,
|
||||
problemStatus: undefined,
|
||||
repairDes: undefined,
|
||||
repairImageUrl: undefined,
|
||||
repairId: undefined
|
||||
};
|
||||
const data = reactive<PageData<RepairForm, RepairQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
houseId: undefined,
|
||||
maintenanceItemId: undefined,
|
||||
problem: undefined,
|
||||
residentId: undefined,
|
||||
phone: undefined,
|
||||
orderDate: undefined,
|
||||
problemImageUrl: undefined,
|
||||
problemStatus: undefined,
|
||||
repairDes: undefined,
|
||||
repairImageUrl: undefined,
|
||||
repairId: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '报修管理表id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
// != 维修项目u ===========================================================================
|
||||
const RepariPorjectlist = ref([]);
|
||||
const residentlist = ref([]);
|
||||
function init() {
|
||||
listRepairProject().then((res) => {
|
||||
RepariPorjectlist.value = res.rows;
|
||||
});
|
||||
listResident().then((res) => {
|
||||
residentlist.value = res.rows;
|
||||
});
|
||||
}
|
||||
init();
|
||||
|
||||
// != 维修项目u ===========================================================================
|
||||
|
||||
/** 查询报修管理列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listRepair(queryParams.value);
|
||||
repairList.value = res.rows;
|
||||
repairList.value.forEach((item2) => {
|
||||
// 维修项目
|
||||
const find = RepariPorjectlist.value.find((item) => item.id === item2.maintenanceItemId);
|
||||
item2.maintenanceItemPath = '';
|
||||
if (find) {
|
||||
item2.maintenanceItemPath = find.projectName;
|
||||
if (find.parentId) {
|
||||
const find2 = RepariPorjectlist.value.find((item3) => item3.id === find.parentId);
|
||||
console.log(find2);
|
||||
item2.maintenanceItemPath = find2.projectName + ' - ' + item2.maintenanceItemPath;
|
||||
}
|
||||
}
|
||||
// 住户
|
||||
const find2 = residentlist.value.find((item) => item.id === item2.residentId);
|
||||
if (find2) {
|
||||
item2.residentName = find2.name;
|
||||
}
|
||||
});
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: RepairVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/repair/addRepair'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: RepairVO) => {
|
||||
router.push({
|
||||
path: '/repair/addRepair',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
/** 分配人员 */
|
||||
const handleShare = (row) => {
|
||||
router.push({
|
||||
path: '/repair/repairMain',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: RepairVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除报修管理编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delRepair(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-table {
|
||||
height: calc(100% - 80px);
|
||||
}
|
||||
</style>
|
||||
230
src/views/system/Repair/repairMain.vue
Normal file
230
src/views/system/Repair/repairMain.vue
Normal file
@@ -0,0 +1,230 @@
|
||||
<template>
|
||||
<div class="ResidentMainBox p-2 w-full">
|
||||
<PageHeader title="车位详情"></PageHeader>
|
||||
<div class="ResidentMainBody">
|
||||
<el-row :span="24" :gutter="20">
|
||||
<el-col :span="16">
|
||||
<!-- 车位信息 -->
|
||||
<div class="mb-10">
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>车位信息</span>
|
||||
<el-button text type="primary">编辑</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<div class="w-full h-full CarinfoBox">
|
||||
<el-row class="mb-20px">
|
||||
<el-col :span="8">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">报修房屋</div>
|
||||
<div class="main">地下停车场A区</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">维修项目</div>
|
||||
<div class="main">地下停车场A区</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">问题描述</div>
|
||||
<div class="main">地下停车场A区</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="mb-20px">
|
||||
<el-col :span="8">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">报修人</div>
|
||||
<div class="main">地下停车场A区</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">手机号码</div>
|
||||
<div class="main">地下停车场A区</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">预约日期</div>
|
||||
<div class="main">地下停车场A区</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="mb-20px">
|
||||
<el-col :span="8">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">提交人</div>
|
||||
<div class="main">地下停车场A区</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">提交时间</div>
|
||||
<div class="main">地下停车场A区</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">预约日期</div>
|
||||
<div class="main">地下停车场A区</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">附件</div>
|
||||
<div class="main fileImagebox">
|
||||
<el-image class="carinfoImage"></el-image>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>分配工单</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="w-full h-full flex mt-2">
|
||||
<div class="title">维修师傅</div>
|
||||
<div class="preivewBodybox flex-1 ml-5">
|
||||
<div class="">
|
||||
<repairUser :userid="userid"></repairUser>
|
||||
</div>
|
||||
<div class="actions mt-5">
|
||||
<el-button type="primary">审核通过</el-button>
|
||||
<el-button type="danger">审核不通过</el-button>
|
||||
<el-button>返回</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-card style="position: relative">
|
||||
<template #header>
|
||||
<div class="asideCardHeader w-full">
|
||||
<div class="cardSubtitle">
|
||||
<div class="line"></div>
|
||||
<div class="subtitle">审批流程</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="w-full h-50%">
|
||||
<el-steps space="108px" direction="vertical" :active="activeStop">
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>已提交维护信息</span>
|
||||
</template>
|
||||
<template #description> 提交成功 2024/10/29 10:28:28 </template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>待分配 </span>
|
||||
</template>
|
||||
<template #description>等待物业派单中 </template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>维修 </span>
|
||||
</template>
|
||||
<template #description>维修人员进行维修 </template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>完成维修 </span>
|
||||
</template>
|
||||
<template #description>填写维修记录 </template>
|
||||
</el-step>
|
||||
</el-steps>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import repairUser from '@/components/Holder/repairUser.vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const active = ref(6);
|
||||
const activeStop = ref(4);
|
||||
|
||||
const userid = ref();
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.ResidentMainBox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.ResidentMainBody {
|
||||
margin-top: 20px;
|
||||
.CarinfoBox {
|
||||
&.gridbox {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-rows: repeat(4, 1fr);
|
||||
gap: 20px;
|
||||
row-gap: 40px;
|
||||
}
|
||||
.carinfo_item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
.label {
|
||||
font-weight: 600;
|
||||
width: 80px;
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
}
|
||||
.carinfoImage {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.card-header,
|
||||
.subtitle {
|
||||
font-size: 15px;
|
||||
}
|
||||
.repairBox {
|
||||
width: 350px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid rgba(187, 187, 187, 1);
|
||||
}
|
||||
&:deep(div.el-step__head.is-process) {
|
||||
& > div.el-step__line {
|
||||
width: 0;
|
||||
border: 1px dashed gray;
|
||||
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;
|
||||
border: 1px solid var(--el-color-primary);
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
329
src/views/system/Repair/repairlist.vue
Normal file
329
src/views/system/Repair/repairlist.vue
Normal file
@@ -0,0 +1,329 @@
|
||||
<template>
|
||||
<div class="h-full flex flex-col p-2">
|
||||
<pageheader title="报修项目"></pageheader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :inline="true" label-width="100px" :model="queryParams">
|
||||
<el-form-item label="维修项目名" prop="projectName">
|
||||
<el-input v-model="queryParams.projectName" 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 class="flex-1" 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="['repairProject:repairProject:add']">新增维修类</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['repairProject:repairProject:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
class="h-full"
|
||||
:tree-props="{ children: 'children' }"
|
||||
v-loading="loading"
|
||||
border
|
||||
row-key="id"
|
||||
:data="repairProjectList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column type="expand">
|
||||
<template #default="props">
|
||||
<div
|
||||
v-if="props.row.children.length >= 0"
|
||||
:class="{
|
||||
'm-4': props.row.children.length >= 0
|
||||
}"
|
||||
>
|
||||
<el-table :data="props.row.children">
|
||||
<el-table-column label="维修项目名" align="center" prop="projectName" />
|
||||
<el-table-column label="维修类型" align="center" prop="projectType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_repair_project_types" :value="scope.row.projectType"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_repair_project_status" :value="scope.row.status"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维修类名" align="center" prop="projectName" />
|
||||
<el-table-column label="项目类型" align="center" prop="projectType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_repair_project_types" :value="scope.row.projectType"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_repair_project_status" :value="scope.row.status"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="add" @click="handleUpdate(scope.row)"></el-button>
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['repairProject:repairProject:edit']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['repairProject:repairProject: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="repairProjectFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="维修项目名" prop="projectName">
|
||||
<el-input v-model="form.projectName" placeholder="请输入维修项目名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="父级项目id" prop="parentId">
|
||||
<el-input v-model="form.parentId" placeholder="请输入父级项目id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目层级 0,1" prop="projectLevel">
|
||||
<el-input v-model="form.projectLevel" placeholder="请输入项目层级 0,1" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序 " prop="sortOrder">
|
||||
<el-input v-model="form.sortOrder" placeholder="请输入排序 " />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="cretaeTime">
|
||||
<el-date-picker clearable v-model="form.cretaeTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建者" prop="createBy">
|
||||
<el-input v-model="form.createBy" placeholder="请输入创建者" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-date-picker clearable v-model="form.updateTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择更新时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新者" prop="updateBy">
|
||||
<el-input v-model="form.updateBy" 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="RepairProject" lang="ts">
|
||||
import {
|
||||
listRepairProject,
|
||||
getRepairProject,
|
||||
delRepairProject,
|
||||
addRepairProject,
|
||||
updateRepairProject,
|
||||
gettreelistRepairProject
|
||||
} from '@/api/system/RepairProject/index';
|
||||
import { RepairProjectVO, RepairProjectQuery, RepairProjectForm } from '@/api/system/RepairProject/type';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const { com_repair_project_status } = toRefs<any>(proxy?.useDict('com_repair_project_status'));
|
||||
const { com_repair_project_types } = toRefs<any>(proxy?.useDict('com_repair_project_types'));
|
||||
|
||||
const router = useRouter();
|
||||
const repairProjectList = ref<RepairProjectVO[]>([]);
|
||||
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 repairProjectFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: RepairProjectForm = {
|
||||
id: undefined,
|
||||
projectName: undefined,
|
||||
parentId: undefined,
|
||||
projectType: undefined,
|
||||
projectLevel: undefined,
|
||||
sortOrder: undefined,
|
||||
status: undefined,
|
||||
cretaeTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined
|
||||
};
|
||||
const data = reactive<PageData<RepairProjectForm, RepairProjectQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectName: undefined,
|
||||
parentId: undefined,
|
||||
projectType: undefined,
|
||||
projectLevel: undefined,
|
||||
sortOrder: undefined,
|
||||
status: 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 listRepairProject(queryParams.value);
|
||||
let arr = [];
|
||||
arr = res.rows.filter((item) => {
|
||||
item.children = [];
|
||||
if (item.projectLevel === 0) {
|
||||
return {
|
||||
...item
|
||||
};
|
||||
}
|
||||
});
|
||||
res.rows.map((item) => {
|
||||
if (item.projectLevel === 1) {
|
||||
const index = arr.findIndex((ite) => ite.id === item.parentId);
|
||||
if (index !== -1) {
|
||||
arr[index].children.push(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
repairProjectList.value = arr;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
repairProjectFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: RepairProjectVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/repair/addRepairProjectList'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: RepairProjectVO) => {
|
||||
router.push({
|
||||
path: '/repair/addRepairProjectList',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
repairProjectFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateRepairProject(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addRepairProject(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: RepairProjectVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除报修维修项目管理编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delRepairProject(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user