|
@@ -5,17 +5,12 @@
|
|
|
<div v-show="showSearch" class="mb-[10px]">
|
|
|
<el-card shadow="hover">
|
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="100px">
|
|
|
- <el-form-item label="巡检项名称" prop="name">
|
|
|
- <el-input v-model="queryParams.name" placeholder="请输入巡检项名称" clearable @keyup.enter="handleQuery" />
|
|
|
+ <el-form-item label="计划名称" prop="name">
|
|
|
+ <el-input v-model="queryParams.name" placeholder="请输入计划名称" clearable @keyup.enter="handleQuery" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="巡检设备类型" prop="deviceDetailId">
|
|
|
- <el-select v-model="queryParams.deviceDetailId" clearable placeholder="请选择巡检设备类型">
|
|
|
- <el-option v-for="dict in dictGroup.deviceTypeDetailOptions" :key="dict.id"
|
|
|
- :label="`${dict.ext1.brand}${dict.xh}`" :value="dict.id">
|
|
|
- <span style="float: left">{{ dict.ext1.brand }}</span>
|
|
|
- <span style="float: right;color: var(--el-text-color-secondary);font-size: 13px;">
|
|
|
- {{ dict.xh }}
|
|
|
- </span>
|
|
|
+ <el-form-item label="计划状态" prop="status">
|
|
|
+ <el-select v-model="queryParams.status" clearable placeholder="请选择计划状态">
|
|
|
+ <el-option v-for="dict in inspection_status" :key="dict.value" :label="dict.label" :value="dict.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -52,25 +47,31 @@
|
|
|
<el-table-column label="计划编号" align="center" show-overflow-tooltip prop="id" width="150" />
|
|
|
<el-table-column label="计划开始时间" align="center" show-overflow-tooltip prop="startTime" width="150" />
|
|
|
<el-table-column label="计划结束时间" align="center" show-overflow-tooltip prop="endTime" width="150" />
|
|
|
- <el-table-column label="巡检类型" align="center" width="100" >
|
|
|
+ <el-table-column label="巡检类型" align="center" width="100">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="inspection_type" :value="scope.row.inspectionType" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="巡检周期(天)" align="center" show-overflow-tooltip prop="inspectionCycle" width="100" />
|
|
|
- <el-table-column label="巡检员" align="center" show-overflow-tooltip prop="ext1.inspectionPersonName" width="120" />
|
|
|
+ <el-table-column label="巡检员" align="center" show-overflow-tooltip prop="ext1.inspectionPersonName"
|
|
|
+ width="120" />
|
|
|
<el-table-column label="备注" align="center" show-overflow-tooltip prop="remark" width="150" />
|
|
|
- <el-table-column label="计划状态" align="center" prop="status" width="120" >
|
|
|
+ <el-table-column label="计划状态" align="center" width="120">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="inspection_status" :value="scope.row.status" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="已执行任务次数" align="center" show-overflow-tooltip prop="judgeMinValue" width="120" />
|
|
|
<el-table-column label="创建时间" align="center" show-overflow-tooltip prop="createTime" width="120" />
|
|
|
- <el-table-column label="操作" align="center" width="150" fixed="right" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column label="操作" align="center" width="140" fixed="right" class-name="small-padding fixed-width">
|
|
|
<template #default="scope">
|
|
|
- <el-button size="small" link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
|
|
|
- <el-button size="small" link type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
+ <el-button v-if="scope.row.status == 1" size="small" link type="primary"
|
|
|
+ @click="changeStatus(scope.row, '2')">停止</el-button>
|
|
|
+ <template v-else>
|
|
|
+ <el-button size="small" link type="primary" @click="changeStatus(scope.row, '1')">启动</el-button>
|
|
|
+ <el-button size="small" link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
|
|
|
+ <el-button size="small" link type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -89,15 +90,15 @@
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="计划开始时间" prop="startTime"
|
|
|
:rules="[{ required: true, message: '计划开始时间不能为空', trigger: 'change' }]">
|
|
|
- <el-date-picker v-model="form.startTime" style="width: 100%;" value-format="YYYY-MM-DD hh:mm:ss" type="datetime"
|
|
|
- placeholder="请选择开始时间" />
|
|
|
+ <el-date-picker v-model="form.startTime" style="width: 100%;" value-format="YYYY-MM-DD hh:mm:ss"
|
|
|
+ type="datetime" placeholder="请选择开始时间" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="计划结束时间" prop="endTime"
|
|
|
:rules="[{ required: true, message: '计划结束时间不能为空', trigger: 'change' }]">
|
|
|
- <el-date-picker v-model="form.endTime" style="width: 100%;" value-format="YYYY-MM-DD hh:mm:ss" type="datetime"
|
|
|
- placeholder="请选择结束时间" />
|
|
|
+ <el-date-picker v-model="form.endTime" style="width: 100%;" value-format="YYYY-MM-DD hh:mm:ss"
|
|
|
+ type="datetime" placeholder="请选择结束时间" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
@@ -119,9 +120,9 @@
|
|
|
<el-form-item label="巡检范围" prop="inspectionRange"
|
|
|
:rules="[{ required: true, message: '巡检类型不能为空', trigger: 'change' }]">
|
|
|
<el-select v-model="form.inspectionRange" clearable placeholder="请选择巡检范围">
|
|
|
- <el-option label="按设备" value="1"></el-option>
|
|
|
- <el-option label="按道路点位" value="2"></el-option>
|
|
|
- <el-option label="按项目" value="3"></el-option>
|
|
|
+ <el-option label="按设备" :value="1"></el-option>
|
|
|
+ <el-option label="按道路点位" :value="2"></el-option>
|
|
|
+ <el-option label="按项目" :value="3"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -158,7 +159,7 @@
|
|
|
<el-table-column label="设备编号" align="center">
|
|
|
<template #default="scope">
|
|
|
<el-select v-model="scope.row.deviceTypeDetailIds" multiple collapse-tags clearable placeholder="请选择设备编号">
|
|
|
- <el-option v-for="dict in dictGroup.deviceOptions" :key="dict.id" :label="dict.sn" :value="dict.id">
|
|
|
+ <el-option v-for="dict in scope.row.deviceOptions" :key="dict.id" :label="dict.sn" :value="dict.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
@@ -237,7 +238,8 @@ const initFormData = {
|
|
|
inspectionItem: [{
|
|
|
deviceTypeId: undefined,
|
|
|
deviceTypeDetailIds: [],
|
|
|
- items: []
|
|
|
+ items: [],
|
|
|
+ deviceOptions: [],
|
|
|
}],
|
|
|
remark: undefined,
|
|
|
ext1: <any>{
|
|
@@ -252,7 +254,7 @@ const formData = reactive({
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
name: undefined,
|
|
|
- deviceDetailId: undefined,
|
|
|
+ status: undefined,
|
|
|
params: {}
|
|
|
}
|
|
|
});
|
|
@@ -261,7 +263,6 @@ const { queryParams, form } = toRefs(formData);
|
|
|
const { inspection_type } = toRefs<any>(proxy?.useDict('inspection_type'));
|
|
|
const { inspection_status } = toRefs<any>(proxy?.useDict('inspection_status'));
|
|
|
const dictGroup = reactive({
|
|
|
- deviceOptions: [],
|
|
|
deviceTypeOptions: [],
|
|
|
inspectionItemOptions: []
|
|
|
})
|
|
@@ -315,15 +316,23 @@ const handleAdd = () => {
|
|
|
dialog.title = '新增巡检计划';
|
|
|
};
|
|
|
/** 修改按钮操作 */
|
|
|
-const handleUpdate = async (row) => {
|
|
|
+const handleUpdate = (row) => {
|
|
|
reset();
|
|
|
const _id = row?.id || ids.value[0];
|
|
|
- const { data } = await getInspectionTask(_id);
|
|
|
- data.ext1 = data.ext1 && JSON.parse(data.ext1);
|
|
|
- Object.assign(form.value, data);
|
|
|
+ getInspectionTask(_id).then(({ data }) => {
|
|
|
+ data.ext1 = data.ext1 && JSON.parse(data.ext1);
|
|
|
+ data.inspectionItem = data.inspectionItem && JSON.parse(data.inspectionItem);
|
|
|
+ Object.assign(form.value, data);
|
|
|
+ });
|
|
|
dialog.visible = true;
|
|
|
dialog.title = '修改巡检计划';
|
|
|
};
|
|
|
+const changeStatus = async(row, status) => {
|
|
|
+ await updateInspectionTask({ id: row.id, status: status })
|
|
|
+ const msg = status==='2'?'停止成功':'启动成功'
|
|
|
+ proxy?.$modal.msgSuccess(msg);
|
|
|
+ await getList();
|
|
|
+}
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
const submitForm = () => {
|
|
@@ -361,11 +370,11 @@ const handleDelete = async (row) => {
|
|
|
};
|
|
|
const deviceTypeChange = (index, val) => {
|
|
|
form.value.inspectionItem[index].deviceTypeDetailIds = []
|
|
|
- getDeviceList(val)
|
|
|
+ getDeviceList(index, val)
|
|
|
}
|
|
|
-const getDeviceList = async (deviceTypeId) => {
|
|
|
+const getDeviceList = async (index, deviceTypeId) => {
|
|
|
let deviceTypeDetailList = []
|
|
|
- dictGroup.deviceOptions = []
|
|
|
+ form.value.inspectionItem[index].deviceOptions = []
|
|
|
await getDeviceTypeDetailList({ deviceTypeId }).then(({ code, rows }) => {
|
|
|
if (code === 200) {
|
|
|
deviceTypeDetailList = rows
|
|
@@ -374,9 +383,9 @@ const getDeviceList = async (deviceTypeId) => {
|
|
|
deviceTypeDetailList.forEach(async (item) => {
|
|
|
const res = await listDevice({ devTypeDetailId: item.id });
|
|
|
if (res.code === 200) {
|
|
|
- dictGroup.deviceOptions.push(...res.rows.map((item) => ({
|
|
|
- ...item,
|
|
|
- ext1: item.ext1 ? JSON.parse(item.ext1) : null
|
|
|
+ form.value.inspectionItem[index].deviceOptions.push(...res.rows.map((item) => ({
|
|
|
+ id: item.id,
|
|
|
+ sn: item.sn,
|
|
|
})))
|
|
|
}
|
|
|
})
|
|
@@ -433,7 +442,7 @@ const getInspectionTeamList = async () => {
|
|
|
children: item.members.map(el => ({
|
|
|
label: el.userName,
|
|
|
value: el.userId,
|
|
|
- phone:el.phone
|
|
|
+ phone: el.phone
|
|
|
}))
|
|
|
}))
|
|
|
};
|
|
@@ -441,7 +450,8 @@ const addInspectionItem = () => {
|
|
|
form.value.inspectionItem.push({
|
|
|
deviceTypeId: undefined,
|
|
|
deviceTypeDetailIds: [],
|
|
|
- items: []
|
|
|
+ items: [],
|
|
|
+ deviceOptions: []
|
|
|
})
|
|
|
}
|
|
|
const delInspectionItem = (index) => {
|