完成巡检计划

This commit is contained in:
Zy
2026-04-21 14:43:21 +08:00
parent df20099dfd
commit 48852a33ec
7 changed files with 952 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="p-2">
<div class="h-full flex flex-col p-2">
<Pageheader></Pageheader>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
@@ -17,7 +17,7 @@
</div>
</transition>
<el-card shadow="never">
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
@@ -38,13 +38,25 @@
<el-table v-loading="loading" border :data="planList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="巡检计划名称" align="center" prop="planName" />
<el-table-column label="巡检人员" align="center" prop="inspectorIds" />
<el-table-column label="巡检人员" align="center" prop="inspectorNames" show-overflow-tooltip />
<el-table-column label="执行周期" align="center" prop="executeCycle" />
<el-table-column label="执行星期" align="center">
<template #default="scope">
<span v-for="(item, index) in scope.row.executeDayNames" :key="index" class="pl-5px">{{ numToWeek(item) }}</span>
</template>
</el-table-column>
<el-table-column label="任务时间" align="center" prop="taskTime" />
<el-table-column label="巡检设置0-必须拍照1-可以跳检" align="center" prop="inspectSetting" />
<el-table-column label="计划路线" align="center" prop="routeIds" />
<el-table-column label="状态0-关闭1-开启" align="center" prop="status" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="巡检设置" align="center" prop="inspectSetting">
<template #default="scope">
<DictTag :options="com_inspection_plan_setting" :value="scope.row.inspectSetting"></DictTag>
</template>
</el-table-column>
<el-table-column label="计划路线" align="center" prop="routeNames" />
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1" active-text="关闭" inactive-text="开启"></el-switch>
</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">
@@ -65,10 +77,18 @@
<script setup name="Plan" lang="ts">
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from '@/api/system/InspectionPlan/index';
import { PlanVO, PlanQuery, PlanForm } from '@/api/system/InspectionPlan/type';
import { numToWeek } from '@/utils/time';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_plan_setting } = toRefs<any>(proxy?.useDict('com_inspection_plan_setting'));
const planList = ref<PlanVO[]>([]);
interface planlistType extends PlanVO {
routeNames?: string;
inspectorNames?: string;
executeDayNames?: number[];
}
const planList = ref<planlistType[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
@@ -124,6 +144,15 @@ const getList = async () => {
loading.value = true;
const res = await listPlan(queryParams.value);
planList.value = res.rows;
planList.value.forEach((item) => {
item.routeNames = item.routeList.map((item) => item.routeName).join(',');
item.inspectorNames = item.inspectorList.map((item2) => item2.nickName).join(',');
item.executeDayNames = item.executeDay
.split(',')
.sort((a, b) => Number(a) - Number(b))
.map((item) => Number(item));
console.log(item.executeDayNames);
});
total.value = res.total;
loading.value = false;
};
@@ -163,14 +192,14 @@ const router = useRouter();
/** 新增按钮操作 */
const handleAdd = () => {
router.push({
path: '/tool/addInspectionPlan'
path: '/inspection/addPlan'
});
};
/** 修改按钮操作 */
const handleUpdate = async (row?: PlanVO) => {
router.push({
path: '/tool/addInspectionPlan',
path: '/inspection/addPlan',
query: {
id: row.id
}
@@ -197,7 +226,7 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: PlanVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除巡检计划编号为"' + _ids + '"的数据项').finally(() => (loading.value = false));
await proxy?.$modal.confirm('是否确认删除巡检计划?').finally(() => (loading.value = false));
await delPlan(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
@@ -218,3 +247,8 @@ onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>