| | |
| | | }); |
| | | } |
| | | |
| | | // 修改巡检记录 |
| | | export function updateInspectionRecord(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionRecord", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // 删除巡检记录 |
| | | export function deleteInspectionRecord(ids) { |
| | | return request({ |
| | | url: "/safeLineInspectionRecord/" + ids.join(","), |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | | // 批量新增巡检记录 |
| | | export function batchAddInspectionRecords(data) { |
| | | return request({ |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="巡检人" |
| | | prop="inspectorId"> |
| | | prop="inspectorIds"> |
| | | <el-select v-model="form.inspectorIds" |
| | | placeholder="请选择巡检人(可多选)" |
| | | filterable |
| | |
| | | <div class="mb10"> |
| | | <el-button type="primary" |
| | | size="small" |
| | | :disabled="currentInspectionStatus === '已完成'" |
| | | @click="openRecordForm">新增记录</el-button> |
| | | </div> |
| | | <div class="dialog-table-wrapper"> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="checkDesc" label="检查说明" width="200" show-overflow-tooltip /> |
| | | <el-table-column prop="checkTime" label="检查时间" width="180" /> |
| | | <el-table-column label="操作" width="120" fixed="right"> |
| | | <template #default="{ row }"> |
| | | <el-button type="primary" link :disabled="currentInspectionStatus === '已完成'" @click="openEditRecordForm(row)">编辑</el-button> |
| | | <el-button type="danger" link :disabled="currentInspectionStatus === '已完成'" @click="handleDeleteRecord(row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- 新增记录表单 --> |
| | | <el-dialog v-model="recordFormVisible" |
| | | title="新增巡检记录" |
| | | :title="recordForm.id ? '编辑巡检记录' : '新增巡检记录'" |
| | | width="600px" |
| | | append-to-body |
| | | :close-on-click-modal="false"> |
| | |
| | | <div class="mb10"> |
| | | <el-button type="primary" |
| | | size="small" |
| | | :disabled="currentInspectionStatus === '已完成'" |
| | | @click="openHazardForm('add')">上报隐患</el-button> |
| | | </div> |
| | | <div class="dialog-table-wrapper"> |
| | |
| | | <el-table-column prop="rectifyUserName" label="整改责任人" width="120" /> |
| | | <el-table-column label="操作" width="150" fixed="right"> |
| | | <template #default="{ row }"> |
| | | <el-button type="primary" link @click="openHazardForm('edit', row)">编辑</el-button> |
| | | <el-button type="success" link @click="handleRectify(row)" v-if="row.status !== '已整改'">整改</el-button> |
| | | <el-button type="primary" link :disabled="currentInspectionStatus === '已完成'" @click="openHazardForm('edit', row)">编辑</el-button> |
| | | <el-button type="success" link :disabled="currentInspectionStatus === '已完成'" @click="handleRectify(row)" v-if="row.status !== '已整改'">整改</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | completeLineInspection, |
| | | getInspectionRecords, |
| | | addInspectionRecord, |
| | | updateInspectionRecord, |
| | | deleteInspectionRecord, |
| | | getHazardsByInspectionId, |
| | | addInspectionHazard, |
| | | updateInspectionHazard |
| | |
| | | const rules = { |
| | | inspectionCode: [{ required: true, message: "请输入巡检编号", trigger: "blur" }], |
| | | inspectionName: [{ required: true, message: "请输入巡检名称", trigger: "blur" }], |
| | | lineName: [{ required: true, message: "请输入线路名称", trigger: "blur" }] |
| | | lineName: [{ required: true, message: "请输入线路名称", trigger: "blur" }], |
| | | inspectorIds: [{ required: true, message: "请选择巡检人", trigger: "change" }] |
| | | }; |
| | | |
| | | const recordRules = { |
| | |
| | | dialogType: "add", |
| | | // 巡检记录 |
| | | currentInspectionId: null, |
| | | currentInspectionStatus: "", |
| | | recordDialogVisible: false, |
| | | recordFormVisible: false, |
| | | recordList: [], |
| | | recordForm: { |
| | | id: null, |
| | | inspectionId: null, |
| | | checkPoint: "", |
| | | checkContent: "", |
| | |
| | | dialogTitle, |
| | | dialogType, |
| | | currentInspectionId, |
| | | currentInspectionStatus, |
| | | recordDialogVisible, |
| | | recordFormVisible, |
| | | recordList, |
| | |
| | | clickFun: row => { |
| | | openForm("edit", row); |
| | | }, |
| | | show: row => row.status === "待巡检" |
| | | disabled: row => row.status !== "待巡检" |
| | | }, |
| | | { |
| | | name: "巡检记录", |
| | |
| | | clickFun: row => { |
| | | handleDelete(row); |
| | | }, |
| | | show: row => row.status === "待巡检" |
| | | disabled: row => row.status !== "待巡检" |
| | | } |
| | | ] |
| | | } |
| | |
| | | // 打开巡检记录弹窗 |
| | | const openRecordDialog = row => { |
| | | currentInspectionId.value = row.id; |
| | | currentInspectionStatus.value = row.status; |
| | | fetchRecords(row.id); |
| | | recordDialogVisible.value = true; |
| | | }; |
| | |
| | | // 打开记录表单 |
| | | const openRecordForm = () => { |
| | | Object.assign(recordForm.value, { |
| | | id: null, |
| | | inspectionId: currentInspectionId.value, |
| | | checkPoint: "", |
| | | checkContent: "", |
| | |
| | | recordFormVisible.value = true; |
| | | }; |
| | | |
| | | // 打开编辑记录表单 |
| | | const openEditRecordForm = (row) => { |
| | | Object.assign(recordForm.value, { |
| | | id: row.id, |
| | | inspectionId: row.inspectionId, |
| | | checkPoint: row.checkPoint, |
| | | checkContent: row.checkContent, |
| | | checkResult: row.checkResult, |
| | | checkDesc: row.checkDesc, |
| | | checkTime: row.checkTime |
| | | }); |
| | | recordFormVisible.value = true; |
| | | }; |
| | | |
| | | // 删除巡检记录 |
| | | const handleDeleteRecord = (row) => { |
| | | ElMessageBox.confirm("确认删除该巡检记录吗?", "删除", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(async () => { |
| | | const res = await deleteInspectionRecord([row.id]); |
| | | if (res.code === 200) { |
| | | ElMessage.success("删除成功"); |
| | | fetchRecords(currentInspectionId.value); |
| | | } else { |
| | | ElMessage.error(res.msg || "删除失败"); |
| | | } |
| | | }).catch(() => {}); |
| | | }; |
| | | |
| | | // 提交记录表单 |
| | | const submitRecordForm = async () => { |
| | | try { |
| | | await recordFormRef.value.validate(); |
| | | const res = await addInspectionRecord({ ...recordForm.value }); |
| | | const api = recordForm.value.id ? updateInspectionRecord : addInspectionRecord; |
| | | const res = await api({ ...recordForm.value }); |
| | | if (res.code === 200) { |
| | | ElMessage.success("添加成功"); |
| | | ElMessage.success(recordForm.value.id ? "修改成功" : "添加成功"); |
| | | recordFormVisible.value = false; |
| | | fetchRecords(currentInspectionId.value); |
| | | } else { |
| | | ElMessage.error(res.msg || "添加失败"); |
| | | ElMessage.error(res.msg || "操作失败"); |
| | | } |
| | | } catch (error) { |
| | | console.error("表单验证失败:", error); |
| | |
| | | // 打开隐患管理弹窗 |
| | | const openHazardDialog = row => { |
| | | currentInspectionId.value = row.id; |
| | | currentInspectionStatus.value = row.status; |
| | | fetchHazards(row.id); |
| | | hazardDialogVisible.value = true; |
| | | }; |
| | |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="下次检查时间"> |
| | | <el-input :value="computedNextCheckTime" disabled placeholder="根据安装时间+有效期自动计算" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="状态" |
| | | prop="status"> |
| | | <el-select v-model="ledgerForm.status" |
| | |
| | | <el-option label="重大" value="重大" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="计划整改时间"> |
| | | <el-date-picker v-model="rectificationForm.planTime" |
| | | type="datetime" |
| | | placeholder="请选择计划整改时间" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </template> |
| | | <el-form-item label="整改说明" v-if="rectificationDialogTitle === '整改'"> |
| | | <el-input v-model="rectificationForm.rectifyDesc" |
| | |
| | | |
| | | <script setup> |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { onMounted, ref, reactive, toRefs } from "vue"; |
| | | import { onMounted, ref, reactive, toRefs, computed } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { |
| | |
| | | rectificationTableData: [], |
| | | rectificationForm: { |
| | | id: null, inspectionId: null, facilityId: null, problemDesc: "", |
| | | problemLevel: "", rectifyDesc: "", verifyDesc: "" |
| | | problemLevel: "", planTime: "", rectifyDesc: "", verifyDesc: "" |
| | | }, |
| | | rectificationDialogVisible: false, |
| | | rectificationDialogTitle: "", |
| | |
| | | const ledgerFormRef = ref(); |
| | | const inspectionFormRef = ref(); |
| | | const rectificationFormRef = ref(); |
| | | |
| | | // 自动计算下次检查时间 |
| | | const computedNextCheckTime = computed(() => { |
| | | const { installTime, validPeriod } = ledgerForm.value; |
| | | if (!installTime || !validPeriod) return ""; |
| | | const date = new Date(installTime); |
| | | date.setDate(date.getDate() + validPeriod); |
| | | return date.toISOString().split("T")[0]; |
| | | }); |
| | | |
| | | // 设施台账表格列配置 |
| | | const ledgerTableColumn = ref([ |
| | |
| | | clickFun: row => openRectificationForm("add", row), |
| | | show: row => row.checkResult === "异常" |
| | | }, |
| | | { name: "删除", type: "text", style: { color: "#F56C6C" }, clickFun: row => handleDeleteInspection(row) } |
| | | { name: "删除", type: "text", style: { color: "#F56C6C" }, clickFun: row => handleDeleteInspection(row), disabled: row => row.status !== "待巡检" } |
| | | ] |
| | | } |
| | | ]); |
| | |
| | | // 生命周期 |
| | | onMounted(() => { |
| | | getLedgerList(); |
| | | getInspectionList(); |
| | | getRectificationList(); |
| | | }); |
| | | |
| | | // 标签页切换 |
| | |
| | | const submitLedgerForm = async () => { |
| | | try { |
| | | await ledgerFormRef.value.validate(); |
| | | // 自动计算下次检查时间 |
| | | ledgerForm.value.nextCheckTime = computedNextCheckTime.value || null; |
| | | const api = ledgerDialogType.value === "add" ? addFacilityLedger : updateFacilityLedger; |
| | | const res = await api({ ...ledgerForm.value }); |
| | | if (res.code === 200) { |
| | |
| | | if (res.code === 200) { |
| | | ElMessage.success("删除成功"); |
| | | getLedgerList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "删除失败"); |
| | | } |
| | | }).catch(() => {}); |
| | | }; |
| | |
| | | if (res.code === 200) { |
| | | ElMessage.success("删除成功"); |
| | | getInspectionList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "删除失败"); |
| | | } |
| | | }).catch(() => {}); |
| | | }; |
| | |
| | | rectificationDialogTitle.value = "新增整改"; |
| | | Object.assign(rectificationForm.value, { |
| | | id: null, inspectionId: row.id, facilityId: row.facilityId, |
| | | problemDesc: "", problemLevel: "", rectifyDesc: "", verifyDesc: "" |
| | | problemDesc: "", problemLevel: "", planTime: "", rectifyDesc: "", verifyDesc: "" |
| | | }); |
| | | } else if (type === "do") { |
| | | rectificationDialogTitle.value = "整改"; |
| | | Object.assign(rectificationForm.value, { |
| | | id: row.id, inspectionId: row.inspectionId, facilityId: row.facilityId, |
| | | problemDesc: row.problemDesc, problemLevel: row.problemLevel, rectifyDesc: "", verifyDesc: "" |
| | | problemDesc: row.problemDesc, problemLevel: row.problemLevel, planTime: row.planTime || "", |
| | | rectifyDesc: "", verifyDesc: "" |
| | | }); |
| | | } else if (type === "verify") { |
| | | rectificationDialogTitle.value = "验收"; |