From ac35273efaafe06d249677ba63ae0f60672a3b89 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 30 七月 2026 13:49:33 +0800
Subject: [PATCH] feat: 安全设施巡检调整
---
src/api/safeProduction/safetyFacility.js | 45 ++
src/views/safeProduction/safetyFacility/index.vue | 1041 +++++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 980 insertions(+), 106 deletions(-)
diff --git a/src/api/safeProduction/safetyFacility.js b/src/api/safeProduction/safetyFacility.js
index 20d8778..0c79768 100644
--- a/src/api/safeProduction/safetyFacility.js
+++ b/src/api/safeProduction/safetyFacility.js
@@ -49,6 +49,51 @@
});
}
+// ============ 瀹夊叏璁炬柦瀹氭椂宸℃浠诲姟 ============
+
+// 鑾峰彇瀹夊叏璁炬柦瀹氭椂宸℃浠诲姟鍒楄〃
+export function getFacilityInspectionTaskList(params) {
+ return request({
+ url: "/safeFacilityInspectionTask/page",
+ method: "get",
+ params,
+ });
+}
+
+// 鏍规嵁ID鑾峰彇瀹夊叏璁炬柦瀹氭椂宸℃浠诲姟璇︽儏
+export function getFacilityInspectionTaskById(id) {
+ return request({
+ url: `/safeFacilityInspectionTask/${id}`,
+ method: "get",
+ });
+}
+
+// 鏂板瀹夊叏璁炬柦瀹氭椂宸℃浠诲姟
+export function addFacilityInspectionTask(data) {
+ return request({
+ url: "/safeFacilityInspectionTask",
+ method: "post",
+ data,
+ });
+}
+
+// 淇敼瀹夊叏璁炬柦瀹氭椂宸℃浠诲姟
+export function updateFacilityInspectionTask(data) {
+ return request({
+ url: "/safeFacilityInspectionTask",
+ method: "put",
+ data,
+ });
+}
+
+// 鍒犻櫎瀹夊叏璁炬柦瀹氭椂宸℃浠诲姟
+export function deleteFacilityInspectionTask(ids) {
+ return request({
+ url: "/safeFacilityInspectionTask/" + ids.join(","),
+ method: "delete",
+ });
+}
+
// ============ 瀹夊叏璁炬柦宸℃ ============
// 鑾峰彇瀹夊叏璁炬柦宸℃鍒楄〃
diff --git a/src/views/safeProduction/safetyFacility/index.vue b/src/views/safeProduction/safetyFacility/index.vue
index e7d1347..3f81c80 100644
--- a/src/views/safeProduction/safetyFacility/index.vue
+++ b/src/views/safeProduction/safetyFacility/index.vue
@@ -69,8 +69,63 @@
</div>
</el-tab-pane>
- <!-- 瀹夊叏璁炬柦宸℃ -->
- <el-tab-pane label="瀹夊叏璁炬柦宸℃" name="inspection">
+ <!-- 宸℃浠诲姟 -->
+ <el-tab-pane label="宸℃浠诲姟" name="task">
+ <div class="facility-toolbar">
+ <div class="toolbar-filters">
+ <span class="search_title">宸℃浠诲姟鍚嶇О锛�</span>
+ <el-input v-model="taskSearchForm.inspectionName"
+ style="width: 220px"
+ placeholder="璇疯緭鍏ュ贰妫�浠诲姟鍚嶇О"
+ @change="handleTaskQuery"
+ clearable
+ :prefix-icon="Search" />
+ <span class="search_title ml10">璁炬柦鍚嶇О锛�</span>
+ <el-input v-model="taskSearchForm.facilityName"
+ style="width: 200px"
+ placeholder="璇疯緭鍏ヨ鏂藉悕绉�"
+ @change="handleTaskQuery"
+ clearable
+ :prefix-icon="Search" />
+ <span class="search_title ml10">鏄惁鍚敤锛�</span>
+ <el-select v-model="taskSearchForm.isEnabled"
+ clearable
+ @change="handleTaskQuery"
+ style="width: 150px">
+ <el-option label="鏄�" :value="1" />
+ <el-option label="鍚�" :value="0" />
+ </el-select>
+ <el-button type="primary"
+ @click="handleTaskQuery">
+ 鎼滅储
+ </el-button>
+ <el-button @click="resetTaskQuery">閲嶇疆</el-button>
+ </div>
+ <div class="toolbar-actions">
+ <el-button type="danger"
+ plain
+ :disabled="taskSelectedIds.length === 0"
+ @click="handleBatchDeleteTask">鍒犻櫎</el-button>
+ <el-button type="primary"
+ @click="openTaskDialog('add')">鏂板宸℃浠诲姟</el-button>
+ </div>
+ </div>
+
+ <div class="table_list">
+ <PIMTable rowKey="id"
+ :column="taskTableColumn"
+ :tableData="taskTableData"
+ :page="taskPage"
+ :isSelection="true"
+ @selection-change="handleTaskSelectionChange"
+ :tableLoading="taskTableLoading"
+ @pagination="taskPagination"
+ :total="taskPage.total"></PIMTable>
+ </div>
+ </el-tab-pane>
+
+ <!-- 宸℃璁板綍 -->
+ <el-tab-pane label="宸℃璁板綍" name="inspection">
<div class="facility-toolbar">
<div class="toolbar-filters">
<span class="search_title">宸℃缂栧彿锛�</span>
@@ -151,8 +206,7 @@
<el-form ref="ledgerFormRef"
:model="ledgerForm"
:rules="ledgerRules"
- label-width="120px"
- :disabled="isLedgerView">
+ label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="璁炬柦缂栧彿"
@@ -224,22 +278,6 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏈夋晥鏈�(澶�)"
- prop="validPeriod">
- <el-input-number v-model="ledgerForm.validPeriod"
- :min="0"
- placeholder="璇疯緭鍏ユ湁鏁堟湡"
- style="width: 100%" />
- </el-form-item>
- </el-col>
- </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"
@@ -262,10 +300,242 @@
</el-form>
<template #footer>
<span class="dialog-footer">
- <el-button v-if="!isLedgerView"
- type="primary"
+ <el-button type="primary"
@click="submitLedgerForm">纭畾</el-button>
- <el-button @click="ledgerDialogVisible = false">{{ isLedgerView ? '鍏抽棴' : '鍙栨秷' }}</el-button>
+ <el-button @click="ledgerDialogVisible = false">鍙栨秷</el-button>
+ </span>
+ </template>
+ </el-dialog>
+
+ <!-- 璁炬柦鍙拌处璇︽儏寮圭獥 -->
+ <el-dialog v-model="ledgerDetailVisible"
+ title="璁炬柦璇︽儏"
+ width="760px"
+ class="detail-dialog">
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="璁炬柦缂栧彿">{{ ledgerDetail.facilityCode || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁炬柦鍚嶇О">{{ ledgerDetail.facilityName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁炬柦绫诲瀷">{{ ledgerDetail.facilityType || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瑙勬牸鍨嬪彿">{{ ledgerDetail.facilitySpec || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹夎浣嶇疆">{{ ledgerDetail.installLocation || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹夎鏃堕棿">{{ ledgerDetail.installTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鐢熶骇鏃ユ湡">{{ ledgerDetail.productionDate || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鐘舵��">
+ <el-tag :type="ledgerStatusType(ledgerDetail.status)">{{ ledgerDetail.status || '-' }}</el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="澶囨敞" :span="2">{{ ledgerDetail.remark || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary" @click="ledgerDetailVisible = false">鍏抽棴</el-button>
+ </span>
+ </template>
+ </el-dialog>
+
+ <!-- 宸℃浠诲姟琛ㄥ崟寮圭獥 -->
+ <el-dialog v-model="taskDialogVisible"
+ :title="taskDialogTitle"
+ width="920px"
+ :close-on-click-modal="false"
+ @closed="resetTaskForm">
+ <el-form ref="taskFormRef"
+ :model="taskForm"
+ :rules="taskRules"
+ label-width="120px">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="宸℃浠诲姟鍚嶇О"
+ prop="inspectionName">
+ <el-input v-model="taskForm.inspectionName"
+ placeholder="璇疯緭鍏ュ贰妫�浠诲姟鍚嶇О" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="瀹夊叏璁炬柦"
+ prop="facilityId">
+ <el-select v-model="taskForm.facilityId"
+ placeholder="璇烽�夋嫨瀹夊叏璁炬柦"
+ filterable
+ clearable
+ style="width: 100%"
+ @change="handleTaskFacilityChange">
+ <el-option v-for="item in facilityOptions"
+ :key="item.id"
+ :label="`${item.facilityName}锛�${item.facilityCode || '-'}锛塦"
+ :value="item.id" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="宸℃浜�"
+ prop="inspectorId">
+ <el-select v-model="taskForm.inspectorId"
+ placeholder="璇烽�夋嫨宸℃浜�"
+ filterable
+ clearable
+ style="width: 100%">
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鏄惁鍚敤"
+ prop="isEnabled">
+ <el-radio-group v-model="taskForm.isEnabled">
+ <el-radio :label="1">鏄�</el-radio>
+ <el-radio :label="0">鍚�</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="宸℃椤圭洰"
+ prop="inspectionProject">
+ <el-input v-model="taskForm.inspectionProject"
+ type="textarea"
+ :autosize="{ minRows: 3, maxRows: 6 }"
+ placeholder="璇疯緭鍏ュ贰妫�椤圭洰" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="澶囨敞">
+ <el-input v-model="taskForm.remark"
+ type="textarea"
+ :autosize="{ minRows: 3, maxRows: 6 }"
+ placeholder="璇疯緭鍏ュ娉�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="浠诲姟棰戠巼"
+ prop="frequencyType">
+ <el-select v-model="taskForm.frequencyType"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 100%"
+ @change="handleFrequencyTypeChange">
+ <el-option label="姣忔棩" value="DAILY" />
+ <el-option label="姣忓懆" value="WEEKLY" />
+ <el-option label="姣忔湀" value="MONTHLY" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col v-if="taskForm.frequencyType === 'DAILY'" :span="12">
+ <el-form-item class="frequency-detail-item"
+ label="鎵ц鏃堕棿"
+ prop="frequencyDetail">
+ <el-time-picker v-model="taskForm.frequencyDetail"
+ placeholder="閫夋嫨鏃堕棿"
+ format="HH:mm"
+ value-format="HH:mm"
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col v-if="taskForm.frequencyType === 'WEEKLY'" :span="12">
+ <el-form-item class="frequency-detail-item"
+ label="鎵ц鏃堕棿"
+ prop="frequencyDetail">
+ <div class="frequency-row">
+ <el-select v-model="taskForm.week"
+ class="frequency-day-select"
+ placeholder="璇烽�夋嫨鏄熸湡"
+ clearable>
+ <el-option v-for="item in weekOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ <el-time-picker v-model="taskForm.time"
+ class="frequency-time-picker"
+ placeholder="閫夋嫨鏃堕棿"
+ format="HH:mm"
+ value-format="HH:mm" />
+ </div>
+ </el-form-item>
+ </el-col>
+ <el-col v-if="taskForm.frequencyType === 'MONTHLY'" :span="12">
+ <el-form-item class="frequency-detail-item"
+ label="鎵ц鏃堕棿"
+ prop="frequencyDetail">
+ <div class="frequency-row">
+ <el-select v-model="taskForm.day"
+ class="frequency-day-select"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ clearable>
+ <el-option v-for="item in dayOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ <el-time-picker v-model="taskForm.time"
+ class="frequency-time-picker"
+ placeholder="閫夋嫨鏃堕棿"
+ format="HH:mm"
+ value-format="HH:mm" />
+ </div>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary"
+ @click="submitTaskForm">淇濆瓨</el-button>
+ <el-button @click="taskDialogVisible = false">鍙栨秷</el-button>
+ </span>
+ </template>
+ </el-dialog>
+
+ <!-- 宸℃浠诲姟璇︽儏 -->
+ <el-dialog v-model="taskDetailVisible"
+ title="宸℃浠诲姟璇︽儏"
+ width="860px">
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="宸℃浠诲姟鍚嶇О">{{ taskDetail.inspectionName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹夊叏璁炬柦">{{ taskDetail.facilityName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁炬柦缂栧彿">{{ taskDetail.facilityCode || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="宸℃浜�">{{ taskDetail.inspectorName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鏄惁鍚敤">{{ taskDetail.isEnabled === 1 ? '鏄�' : '鍚�' }}</el-descriptions-item>
+ <el-descriptions-item label="棰戞">{{ frequencyTypeMap[taskDetail.frequencyType] || taskDetail.frequencyType || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鎵ц鏃堕棿">{{ formatFrequencyDetail(taskDetail.frequencyDetail) }}</el-descriptions-item>
+ <el-descriptions-item label="涓嬫鎵ц鏃堕棿">{{ taskDetail.nextExecutionTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="宸℃椤圭洰" :span="2">{{ taskDetail.inspectionProject || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="澶囨敞" :span="2">{{ taskDetail.remark || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary" @click="taskDetailVisible = false">鍏抽棴</el-button>
+ </span>
+ </template>
+ </el-dialog>
+
+ <!-- 鍘嗗彶宸℃璁板綍 -->
+ <el-dialog v-model="taskHistoryVisible"
+ title="鍘嗗彶宸℃璁板綍"
+ width="1100px">
+ <el-descriptions class="history-summary" :column="3" border>
+ <el-descriptions-item label="宸℃浠诲姟鍚嶇О">{{ taskHistoryTask.inspectionName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹夊叏璁炬柦">{{ taskHistoryTask.facilityName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="棰戞">{{ frequencyTypeMap[taskHistoryTask.frequencyType] || taskHistoryTask.frequencyType || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <PIMTable rowKey="id"
+ :column="taskHistoryTableColumn"
+ :tableData="taskHistoryTableData"
+ :page="taskHistoryPage"
+ :isSelection="false"
+ :tableLoading="taskHistoryTableLoading"
+ @pagination="taskHistoryPagination"
+ :total="taskHistoryPage.total"></PIMTable>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary" @click="taskHistoryVisible = false">鍏抽棴</el-button>
</span>
</template>
</el-dialog>
@@ -320,6 +590,13 @@
style="width: 100%"
:disabled="isInspectionBaseReadonly" />
</el-form-item>
+ <el-form-item label="宸℃椤圭洰"
+ class="form-grid-full">
+ <el-input v-model="inspectionForm.inspectionProject"
+ type="textarea"
+ :rows="3"
+ disabled />
+ </el-form-item>
</div>
<template v-if="inspectionDialogType !== 'add'">
<el-form-item label="妫�鏌ョ粨鏋�"
@@ -351,6 +628,45 @@
type="primary"
@click="submitInspectionForm">纭畾</el-button>
<el-button @click="inspectionDialogVisible = false">{{ isInspectionView ? '鍏抽棴' : '鍙栨秷' }}</el-button>
+ </span>
+ </template>
+ </el-dialog>
+
+ <!-- 宸℃璇︽儏寮圭獥 -->
+ <el-dialog v-model="inspectionDetailVisible"
+ title="宸℃璇︽儏"
+ width="920px"
+ class="detail-dialog">
+ <el-descriptions :column="3" border>
+ <el-descriptions-item label="宸℃缂栧彿">{{ inspectionDetail.inspectionCode || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁炬柦鍚嶇О">{{ inspectionDetail.facilityName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="宸℃浜�">{{ inspectionDetail.inspectorName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁″垝宸℃鏃堕棿">{{ inspectionDetail.planTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹為檯宸℃鏃堕棿">{{ inspectionDetail.actualTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鐘舵��">
+ <el-tag :type="inspectionStatusType(inspectionDetail.status)">{{ inspectionDetail.status || '-' }}</el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="妫�鏌ョ粨鏋�">
+ <el-tag :type="inspectionResultType(inspectionDetail.checkResult)">{{ inspectionDetail.checkResult || '鏈~鍐�' }}</el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="宸℃椤圭洰" :span="2">{{ inspectionDetail.inspectionProject || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="妫�鏌ヨ鏄�" :span="3">{{ inspectionDetail.checkDesc || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <div v-if="inspectionDetailImageUrls.length" class="detail-section">
+ <div class="detail-section-title">鐜板満鐓х墖</div>
+ <div class="detail-image-list">
+ <el-image v-for="(url, index) in inspectionDetailImageUrls"
+ :key="`${url}-${index}`"
+ :src="url"
+ :preview-src-list="inspectionDetailImageUrls"
+ :initial-index="index"
+ fit="cover"
+ class="detail-image" />
+ </div>
+ </div>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary" @click="inspectionDetailVisible = false">鍏抽棴</el-button>
</span>
</template>
</el-dialog>
@@ -478,6 +794,50 @@
</span>
</template>
</el-dialog>
+
+ <!-- 鏁存敼璇︽儏寮圭獥 -->
+ <el-dialog v-model="rectificationDetailVisible"
+ title="鏁存敼璇︽儏"
+ width="920px"
+ class="detail-dialog">
+ <el-descriptions :column="3" border>
+ <el-descriptions-item label="宸℃缂栧彿">{{ rectificationDetail.inspectionCode || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁炬柦鍚嶇О">{{ rectificationDetail.facilityName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="闂绛夌骇">
+ <el-tag :type="rectificationLevelType(rectificationDetail.problemLevel)">
+ {{ rectificationDetail.problemLevel || '-' }}
+ </el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="鏁存敼璐d换浜�">{{ rectificationDetail.rectifyUserName || getUserName(rectificationDetail.rectifyUserId) || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁″垝鏁存敼鏃堕棿">{{ rectificationDetail.planTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹為檯鏁存敼鏃堕棿">{{ rectificationDetail.actualTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鐘舵��">
+ <el-tag :type="rectificationStatusType(rectificationDetail.status)">{{ rectificationDetail.status || '-' }}</el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="楠屾敹浜�">{{ rectificationDetail.verifyUserName || getUserName(rectificationDetail.verifyUserId) || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="楠屾敹鏃堕棿">{{ rectificationDetail.verifyTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="闂鎻忚堪" :span="3">{{ rectificationDetail.problemDesc || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鏁存敼璇存槑" :span="3">{{ rectificationDetail.rectifyDesc || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="楠屾敹璇存槑" :span="3">{{ rectificationDetail.verifyDesc || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <div v-if="rectificationDetailImageUrls.length" class="detail-section">
+ <div class="detail-section-title">宸℃寮傚父鍥剧墖</div>
+ <div class="detail-image-list">
+ <el-image v-for="(url, index) in rectificationDetailImageUrls"
+ :key="`${url}-${index}`"
+ :src="url"
+ :preview-src-list="rectificationDetailImageUrls"
+ :initial-index="index"
+ fit="cover"
+ class="detail-image" />
+ </div>
+ </div>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary" @click="rectificationDetailVisible = false">鍏抽棴</el-button>
+ </span>
+ </template>
+ </el-dialog>
</div>
</template>
@@ -494,8 +854,11 @@
addFacilityLedger,
updateFacilityLedger,
deleteFacilityLedger,
+ getFacilityInspectionTaskList,
+ addFacilityInspectionTask,
+ updateFacilityInspectionTask,
+ deleteFacilityInspectionTask,
getFacilityInspectionList,
- addFacilityInspection,
updateFacilityInspection,
deleteFacilityInspection,
getFacilityRectificationList,
@@ -506,6 +869,70 @@
const userStore = useUserStore();
const userList = ref([]);
const currentUserId = computed(() => Number(userStore.id) || null);
+const ENABLED = 1;
+
+const weekOptions = [
+ { label: "鍛ㄤ竴", value: "MON" },
+ { label: "鍛ㄤ簩", value: "TUE" },
+ { label: "鍛ㄤ笁", value: "WED" },
+ { label: "鍛ㄥ洓", value: "THU" },
+ { label: "鍛ㄤ簲", value: "FRI" },
+ { label: "鍛ㄥ叚", value: "SAT" },
+ { label: "鍛ㄦ棩", value: "SUN" }
+];
+
+const dayOptions = Array.from({ length: 31 }, (_, index) => {
+ const value = String(index + 1).padStart(2, "0");
+ return { label: `${index + 1}鏃, value };
+});
+
+const frequencyTypeMap = {
+ DAILY: "姣忔棩",
+ WEEKLY: "姣忓懆",
+ MONTHLY: "姣忔湀"
+};
+
+const weekLabelMap = weekOptions.reduce((map, item) => {
+ map[item.value] = item.label;
+ return map;
+}, {});
+
+const createTaskForm = () => ({
+ id: null,
+ inspectionName: "",
+ facilityId: null,
+ facilityCode: "",
+ facilityName: "",
+ inspectionProject: "",
+ inspectorId: "",
+ frequencyType: "",
+ frequencyDetail: "",
+ week: "",
+ day: "",
+ time: "",
+ isEnabled: ENABLED,
+ remark: ""
+});
+
+const validateFrequencyDetail = (rule, value, callback) => {
+ if (!taskForm.value.frequencyType) {
+ callback(new Error("璇烽�夋嫨浠诲姟棰戠巼"));
+ return;
+ }
+ if (taskForm.value.frequencyType === "DAILY" && !taskForm.value.frequencyDetail) {
+ callback(new Error("璇烽�夋嫨鎵ц鏃堕棿"));
+ return;
+ }
+ if (taskForm.value.frequencyType === "WEEKLY" && (!taskForm.value.week || !taskForm.value.time)) {
+ callback(new Error("璇烽�夋嫨鏄熸湡鍜屾椂闂�"));
+ return;
+ }
+ if (taskForm.value.frequencyType === "MONTHLY" && (!taskForm.value.day || !taskForm.value.time)) {
+ callback(new Error("璇烽�夋嫨鏃ユ湡鍜屾椂闂�"));
+ return;
+ }
+ callback();
+};
// 琛ㄥ崟楠岃瘉瑙勫垯
const ledgerRules = {
@@ -513,6 +940,15 @@
facilityName: [{ required: true, message: "璇疯緭鍏ヨ鏂藉悕绉�", trigger: "blur" }],
facilityType: [{ required: true, message: "璇烽�夋嫨璁炬柦绫诲瀷", trigger: "change" }],
installLocation: [{ required: true, message: "璇疯緭鍏ュ畨瑁呬綅缃�", trigger: "blur" }]
+};
+
+const taskRules = {
+ inspectionName: [{ required: true, message: "璇疯緭鍏ュ贰妫�浠诲姟鍚嶇О", trigger: "blur" }],
+ facilityId: [{ required: true, message: "璇烽�夋嫨瀹夊叏璁炬柦", trigger: "change" }],
+ inspectionProject: [{ required: true, message: "璇疯緭鍏ュ贰妫�椤圭洰", trigger: "blur" }],
+ inspectorId: [{ required: true, message: "璇烽�夋嫨宸℃浜�", trigger: "change" }],
+ frequencyType: [{ required: true, message: "璇烽�夋嫨浠诲姟棰戠巼", trigger: "change" }],
+ frequencyDetail: [{ required: true, validator: validateFrequencyDetail, trigger: "change" }]
};
const inspectionRules = {
@@ -543,24 +979,45 @@
ledgerSelectedIds: [],
ledgerForm: {
id: null, facilityCode: "", facilityName: "", facilityType: "", facilitySpec: "",
- installLocation: "", installTime: "", productionDate: "", validPeriod: null,
+ installLocation: "", installTime: "", productionDate: "",
status: "姝e父", remark: ""
},
ledgerDialogVisible: false,
ledgerDialogTitle: "",
ledgerDialogType: "add",
+ ledgerDetailVisible: false,
+ ledgerDetail: {},
+ // 宸℃浠诲姟
+ taskSearchForm: { inspectionName: "", facilityName: "", isEnabled: "" },
+ taskTableLoading: false,
+ taskPage: { current: 1, size: 20, total: 0 },
+ taskTableData: [],
+ taskSelectedIds: [],
+ taskForm: createTaskForm(),
+ taskDialogVisible: false,
+ taskDialogTitle: "鏂板宸℃浠诲姟",
+ taskDetailVisible: false,
+ taskDetail: {},
+ taskHistoryVisible: false,
+ taskHistoryTask: {},
+ taskHistoryTableLoading: false,
+ taskHistoryPage: { current: 1, size: 10, total: 0 },
+ taskHistoryTableData: [],
+ facilityOptions: [],
// 宸℃璁板綍
inspectionSearchForm: { inspectionCode: "", status: "" },
inspectionTableLoading: false,
inspectionPage: { current: 1, size: 20, total: 0 },
inspectionTableData: [],
inspectionForm: {
- id: null, facilityId: null, inspectionCode: "", inspectionType: "瀹氭湡宸℃",
- facilityCode: "", facilityName: "", planTime: "", checkResult: "", checkDesc: "", storageBlobDTOs: []
+ id: null, scheduleTaskId: null, facilityId: null, inspectionCode: "", inspectionType: "瀹氭湡宸℃",
+ facilityCode: "", facilityName: "", inspectionProject: "", planTime: "", checkResult: "", checkDesc: "", storageBlobDTOs: []
},
inspectionDialogVisible: false,
inspectionDialogTitle: "",
- inspectionDialogType: "add",
+ inspectionDialogType: "do",
+ inspectionDetailVisible: false,
+ inspectionDetail: {},
// 鏁存敼璺熻釜
rectificationSearchForm: { status: "" },
rectificationTableLoading: false,
@@ -575,24 +1032,31 @@
},
rectificationDialogVisible: false,
rectificationDialogTitle: "",
- rectificationDialogType: "add"
+ rectificationDialogType: "add",
+ rectificationDetailVisible: false,
+ rectificationDetail: {}
});
const {
activeTab,
ledgerSearchForm, ledgerTableLoading, ledgerPage, ledgerTableData, ledgerSelectedIds,
- ledgerForm, ledgerDialogVisible, ledgerDialogTitle, ledgerDialogType,
+ ledgerForm, ledgerDialogVisible, ledgerDialogTitle, ledgerDialogType, ledgerDetailVisible, ledgerDetail,
+ taskSearchForm, taskTableLoading, taskPage, taskTableData, taskSelectedIds,
+ taskForm, taskDialogVisible, taskDialogTitle, taskDetailVisible, taskDetail,
+ taskHistoryVisible, taskHistoryTask, taskHistoryTableLoading, taskHistoryPage, taskHistoryTableData,
+ facilityOptions,
inspectionSearchForm, inspectionTableLoading, inspectionPage, inspectionTableData,
- inspectionForm, inspectionDialogVisible, inspectionDialogTitle, inspectionDialogType,
+ inspectionForm, inspectionDialogVisible, inspectionDialogTitle, inspectionDialogType, inspectionDetailVisible, inspectionDetail,
rectificationSearchForm, rectificationTableLoading, rectificationPage, rectificationTableData,
- rectificationForm, rectificationDialogVisible, rectificationDialogTitle, rectificationDialogType
+ rectificationForm, rectificationDialogVisible, rectificationDialogTitle, rectificationDialogType,
+ rectificationDetailVisible, rectificationDetail
} = toRefs(data);
// 琛ㄥ崟寮曠敤
const ledgerFormRef = ref();
+const taskFormRef = ref();
const inspectionFormRef = ref();
const rectificationFormRef = ref();
-const isLedgerView = computed(() => ledgerDialogType.value === "view");
const isInspectionView = computed(() => inspectionDialogType.value === "view");
const isInspectionBaseReadonly = computed(() => inspectionDialogType.value !== "add");
const isRectificationView = computed(() => rectificationDialogType.value === "view");
@@ -627,24 +1091,34 @@
const list = rectificationForm.value.storageBlobVOs || rectificationForm.value.storageBlobDTOs || [];
return list.map(getAttachmentUrl).filter(Boolean);
});
-
-// 鑷姩璁$畻涓嬫妫�鏌ユ椂闂�
-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 inspectionDetailImageUrls = computed(() => {
+ const list = inspectionDetail.value.storageBlobVOs || inspectionDetail.value.storageBlobDTOs || [];
+ return list.map(getAttachmentUrl).filter(Boolean);
});
+const rectificationDetailImageUrls = computed(() => {
+ const list = rectificationDetail.value.storageBlobVOs || rectificationDetail.value.storageBlobDTOs || [];
+ return list.map(getAttachmentUrl).filter(Boolean);
+});
+
+const ledgerStatusType = value => {
+ const map = { 姝e父: "success", 寮傚父: "danger", 鎶ュ簾: "info" };
+ return map[value] || "info";
+};
+const inspectionResultType = value => {
+ const map = { 姝e父: "success", 寮傚父: "danger", 鏈~鍐�: "info" };
+ return map[value || "鏈~鍐�"] || "info";
+};
+const inspectionStatusType = value => value === "寰呭贰妫�" ? "info" : "success";
+const rectificationLevelType = value => value === "閲嶅ぇ" ? "danger" : "warning";
+const rectificationStatusType = value => {
+ const map = { 寰呮暣鏀�: "danger", 鏁存敼涓�: "warning", 宸叉暣鏀�: "success", 宸查獙鏀�: "info" };
+ return map[value] || "info";
+};
const padTime = value => String(value).padStart(2, "0");
const formatDateTime = (date = new Date()) => {
const target = date instanceof Date ? date : new Date(date);
return `${target.getFullYear()}-${padTime(target.getMonth() + 1)}-${padTime(target.getDate())} ${padTime(target.getHours())}:${padTime(target.getMinutes())}:${padTime(target.getSeconds())}`;
-};
-const formatCompactDateTime = (date = new Date()) => {
- const target = date instanceof Date ? date : new Date(date);
- return `${target.getFullYear()}${padTime(target.getMonth() + 1)}${padTime(target.getDate())}${padTime(target.getHours())}${padTime(target.getMinutes())}`;
};
const addDaysDateTime = days => {
const target = new Date();
@@ -652,19 +1126,22 @@
target.setHours(18, 0, 0, 0);
return formatDateTime(target);
};
-const getDefaultPlanTime = row => {
- if (row?.nextCheckTime) return `${row.nextCheckTime} 09:00:00`;
- return formatDateTime();
-};
-const buildInspectionCode = row => {
- const code = row?.facilityCode || "FAC";
- return `XJ-${code}-${formatCompactDateTime()}`;
-};
const getUserName = userId => {
const user = userList.value.find(item => Number(item.userId) === Number(userId));
return user?.nickName || "";
};
-const isScrappedFacility = row => row?.status === "鎶ュ簾";
+const formatFrequencyDetail = value => {
+ if (!value) return "--";
+ if (!value.includes(",")) return value;
+ const [firstPart, timePart] = value.split(",");
+ if (weekLabelMap[firstPart]) {
+ return `${weekLabelMap[firstPart]} ${timePart || ""}`.trim();
+ }
+ if (firstPart) {
+ return `${Number(firstPart)}鏃� ${timePart || ""}`.trim();
+ }
+ return value;
+};
const isPendingInspection = row => row?.status === "寰呭贰妫�";
const isCheckedInspection = row => row?.status === "宸插贰妫�";
const isAbnormalInspection = row => row?.checkResult === "寮傚父";
@@ -674,7 +1151,9 @@
row?.verifyUserId && Number(row.verifyUserId) !== Number(currentUserId.value);
provide("parentMethods", {
- openLedgerDetail: row => openLedgerForm("view", row)
+ openLedgerDetail: row => openLedgerDetail(row),
+ openTaskDetail: row => openTaskDetail(row),
+ openInspectionDetail: row => openInspectionDetail(row)
});
// 璁炬柦鍙拌处琛ㄦ牸鍒楅厤缃�
@@ -690,10 +1169,8 @@
},
{ label: "璁炬柦鍚嶇О", prop: "facilityName", showOverflowTooltip: true, minWidth: 150 , align: "center"},
{ label: "璁炬柦绫诲瀷", prop: "facilityType", showOverflowTooltip: true, minWidth: 120 , align: "center"},
- { label: "瑙勬牸鍨嬪彿", prop: "facilitySpec", showOverflowTooltip: true, minWidth: 120 , align: "center"},
{ label: "瀹夎浣嶇疆", prop: "installLocation", showOverflowTooltip: true, minWidth: 150 , align: "center"},
{ label: "瀹夎鏃堕棿", prop: "installTime", minWidth: 120 , align: "center"},
- { label: "涓嬫妫�鏌ユ椂闂�", prop: "nextCheckTime", minWidth: 120 , align: "center"},
{
label: "鐘舵��", prop: "status", minWidth: 100, dataType: "tag", align: "center",
formatType: params => {
@@ -702,17 +1179,88 @@
}
},
{
- dataType: "action", label: "鎿嶄綔", align: "center", fixed: "right", width: 190,
+ dataType: "action", label: "鎿嶄綔", align: "center", fixed: "right", width: 140,
operation: [
{ name: "缂栬緫", type: "text", clickFun: row => openLedgerForm("edit", row) },
- {
- name: "鍙戣捣宸℃",
- type: "text",
- show: row => !isScrappedFacility(row),
- clickFun: row => openInspectionForm("add", row)
- },
{ name: "鍒犻櫎", type: "text", clickFun: row => handleDeleteLedger(row) }
]
+ }
+]);
+
+// 宸℃浠诲姟琛ㄦ牸鍒楅厤缃�
+const taskTableColumn = ref([
+ {
+ label: "宸℃浠诲姟鍚嶇О",
+ prop: "inspectionName",
+ dataType: "link",
+ linkMethod: "openTaskDetail",
+ showOverflowTooltip: true,
+ minWidth: 170,
+ align: "left"
+ },
+ { label: "璁炬柦鍚嶇О", prop: "facilityName", showOverflowTooltip: true, minWidth: 155, align: "left" },
+ { label: "宸℃椤圭洰", prop: "inspectionProject", showOverflowTooltip: true, minWidth: 190, align: "left" },
+ { label: "鎵ц宸℃浜�", prop: "inspectorName", minWidth: 120, align: "center" },
+ {
+ label: "鏄惁鍚敤",
+ prop: "isEnabled",
+ minWidth: 90,
+ align: "center",
+ dataType: "tag",
+ formatData: value => value === 1 ? "鏄�" : "鍚�",
+ formatType: value => value === 1 ? "success" : "info"
+ },
+ {
+ label: "棰戞",
+ prop: "frequencyType",
+ minWidth: 90,
+ align: "center",
+ formatData: value => frequencyTypeMap[value] || value || "--"
+ },
+ {
+ label: "鎵ц鏃堕棿",
+ prop: "frequencyDetail",
+ minWidth: 120,
+ align: "center",
+ formatData: value => formatFrequencyDetail(value)
+ },
+ { label: "涓嬫鎵ц鏃堕棿", prop: "nextExecutionTime", minWidth: 170, showOverflowTooltip: true, align: "center" },
+ {
+ dataType: "action", label: "鎿嶄綔", align: "center", fixed: "right", width: 220,
+ operation: [
+ { name: "鍘嗗彶宸℃", type: "text", clickFun: row => openTaskHistory(row) },
+ { name: "缂栬緫", type: "text", clickFun: row => openTaskDialog("edit", row) },
+ { name: "鍒犻櫎", type: "text", clickFun: row => handleDeleteTask(row) }
+ ]
+ }
+]);
+
+const taskHistoryTableColumn = ref([
+ {
+ label: "宸℃缂栧彿",
+ prop: "inspectionCode",
+ dataType: "link",
+ linkMethod: "openInspectionDetail",
+ showOverflowTooltip: true,
+ minWidth: 180,
+ align: "center"
+ },
+ { label: "璁炬柦鍚嶇О", prop: "facilityName", showOverflowTooltip: true, minWidth: 150, align: "left" },
+ { label: "宸℃椤圭洰", prop: "inspectionProject", showOverflowTooltip: true, minWidth: 180, align: "left" },
+ { label: "璁″垝宸℃鏃堕棿", prop: "planTime", minWidth: 170, align: "center" },
+ { label: "宸℃浜�", prop: "inspectorName", minWidth: 110, align: "center" },
+ { label: "瀹為檯宸℃鏃堕棿", prop: "actualTime", minWidth: 170, align: "center" },
+ {
+ label: "妫�鏌ョ粨鏋�", prop: "checkResult", minWidth: 100, align: "center", dataType: "tag",
+ formatData: params => params || "鏈~鍐�",
+ formatType: params => {
+ const map = { 姝e父: "success", 寮傚父: "danger", 鏈~鍐�: "info" };
+ return map[params] || "info";
+ }
+ },
+ {
+ label: "鐘舵��", prop: "status", minWidth: 100, align: "center", dataType: "tag",
+ formatType: params => params === "寰呭贰妫�" ? "info" : "success"
}
]);
@@ -720,6 +1268,8 @@
const inspectionTableColumn = ref([
{
label: "宸℃缂栧彿",
+ dataType: "link",
+ linkMethod: "openInspectionDetail",
width: 200,
align: "center",
prop: "inspectionCode",
@@ -733,15 +1283,10 @@
minWidth: 150
},
{
- label: "璁炬柦缂栧彿",
- prop: "facilityCode",
+ label: "宸℃椤圭洰",
+ prop: "inspectionProject",
showOverflowTooltip: true,
- minWidth: 120
- },
- {
- label: "宸℃绫诲瀷",
- prop: "inspectionType",
- minWidth: 100
+ minWidth: 180
},
{
label: "璁″垝宸℃鏃堕棿",
@@ -780,7 +1325,7 @@
},
{
name: "鏌ョ湅", type: "text",
- clickFun: row => openInspectionForm("view", row),
+ clickFun: row => openInspectionDetail(row),
show: isCheckedInspection
},
{
@@ -804,7 +1349,6 @@
},
{ label: "鏁存敼璐d换浜�", prop: "rectifyUserName", minWidth: 120 },
{ label: "璁″垝鏁存敼鏃堕棿", prop: "planTime", minWidth: 180 },
- { label: "瀹為檯鏁存敼鏃堕棿", prop: "actualTime", minWidth: 180 },
{
label: "鐘舵��", prop: "status", minWidth: 100, dataType: "tag",
formatType: params => {
@@ -812,8 +1356,6 @@
return map[params] || "info";
}
},
- { label: "楠屾敹浜�", prop: "verifyUserName", minWidth: 120 },
- { label: "楠屾敹鏃堕棿", prop: "verifyTime", minWidth: 180 },
{
dataType: "action", label: "鎿嶄綔", align: "center", fixed: "right", width: 180,
operation: [
@@ -828,7 +1370,7 @@
show: isRectified,
disabled: isNotAssignedVerifier
},
- { name: "鏌ョ湅", type: "text", clickFun: row => openRectificationForm("view", row) }
+ { name: "鏌ョ湅", type: "text", clickFun: row => openRectificationDetail(row) }
]
}
]);
@@ -836,14 +1378,17 @@
// 鐢熷懡鍛ㄦ湡
onMounted(() => {
getLedgerList();
+ getTaskList();
getInspectionList();
getRectificationList();
+ getFacilityOptionList();
getUserList();
});
// 鏍囩椤靛垏鎹�
const handleTabClick = () => {
if (activeTab.value === "ledger") getLedgerList();
+ else if (activeTab.value === "task") getTaskList();
else if (activeTab.value === "inspection") getInspectionList();
else if (activeTab.value === "rectification") getRectificationList();
};
@@ -851,6 +1396,12 @@
const getUserList = () => {
userListNoPage().then(res => {
userList.value = res.data || [];
+ });
+};
+
+const getFacilityOptionList = () => {
+ getFacilityLedgerList({ current: 1, size: 1000 }).then(res => {
+ facilityOptions.value = (res.data?.records || []).filter(item => item.status !== "鎶ュ簾");
});
};
@@ -892,18 +1443,20 @@
ledgerSelectedIds.value = selection.map(item => item.id);
};
+const openLedgerDetail = row => {
+ ledgerDetail.value = { ...row };
+ ledgerDetailVisible.value = true;
+};
+
const openLedgerForm = (type, row = null) => {
ledgerDialogType.value = type;
if (type === "add") {
ledgerDialogTitle.value = "鏂板璁炬柦";
Object.assign(ledgerForm.value, {
id: null, facilityCode: "", facilityName: "", facilityType: "", facilitySpec: "",
- installLocation: "", installTime: "", productionDate: "", validPeriod: null,
+ installLocation: "", installTime: "", productionDate: "",
status: "姝e父", remark: ""
});
- } else if (type === "view") {
- ledgerDialogTitle.value = "璁炬柦璇︽儏";
- Object.assign(ledgerForm.value, { ...row });
} else {
ledgerDialogTitle.value = "缂栬緫璁炬柦";
Object.assign(ledgerForm.value, { ...row });
@@ -914,14 +1467,13 @@
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) {
ElMessage.success(ledgerDialogType.value === "add" ? "娣诲姞鎴愬姛" : "鏇存柊鎴愬姛");
ledgerDialogVisible.value = false;
getLedgerList();
+ getFacilityOptionList();
} else {
ElMessage.error(res.msg || "鎿嶄綔澶辫触");
}
@@ -938,6 +1490,7 @@
if (res.code === 200) {
ElMessage.success("鍒犻櫎鎴愬姛");
getLedgerList();
+ getFacilityOptionList();
} else {
ElMessage.error(res.msg || "鍒犻櫎澶辫触");
}
@@ -959,10 +1512,220 @@
ElMessage.success("鍒犻櫎鎴愬姛");
ledgerSelectedIds.value = [];
getLedgerList();
+ getFacilityOptionList();
} else {
ElMessage.error(res.msg || "鍒犻櫎澶辫触");
}
}).catch(() => {});
+};
+
+// ============ 宸℃浠诲姟鏂规硶 ============
+
+const handleTaskQuery = () => {
+ taskPage.value.current = 1;
+ getTaskList();
+};
+
+const resetTaskQuery = () => {
+ Object.assign(taskSearchForm.value, {
+ inspectionName: "",
+ facilityName: "",
+ isEnabled: ""
+ });
+ handleTaskQuery();
+};
+
+const getTaskList = () => {
+ taskTableLoading.value = true;
+ getFacilityInspectionTaskList({ ...taskPage.value, ...taskSearchForm.value })
+ .then(res => {
+ taskTableLoading.value = false;
+ taskTableData.value = res.data?.records || [];
+ taskPage.value.total = res.data?.total || 0;
+ })
+ .catch(() => { taskTableLoading.value = false; });
+};
+
+const taskPagination = obj => {
+ taskPage.value.current = obj.page;
+ taskPage.value.size = obj.limit;
+ getTaskList();
+};
+
+const handleTaskSelectionChange = selection => {
+ taskSelectedIds.value = selection.map(item => item.id);
+};
+
+const openTaskDetail = row => {
+ taskDetail.value = { ...row };
+ taskDetailVisible.value = true;
+};
+
+const openTaskDialog = (type, row = null) => {
+ resetTaskForm();
+ taskDialogTitle.value = type === "add" ? "鏂板宸℃浠诲姟" : "缂栬緫宸℃浠诲姟";
+ if (type === "edit" && row) {
+ Object.assign(taskForm.value, {
+ id: row.id,
+ inspectionName: row.inspectionName,
+ facilityId: row.facilityId,
+ facilityCode: row.facilityCode,
+ facilityName: row.facilityName,
+ inspectionProject: row.inspectionProject,
+ inspectorId: row.inspectorId,
+ frequencyType: row.frequencyType,
+ frequencyDetail: row.frequencyDetail,
+ isEnabled: row.isEnabled ?? ENABLED,
+ remark: row.remark
+ });
+ parseFrequencyDetail(row.frequencyType, row.frequencyDetail);
+ }
+ taskDialogVisible.value = true;
+};
+
+const resetTaskForm = () => {
+ Object.assign(taskForm.value, createTaskForm());
+ taskFormRef.value?.clearValidate?.();
+};
+
+const handleTaskFacilityChange = facilityId => {
+ const facility = facilityOptions.value.find(item => Number(item.id) === Number(facilityId));
+ taskForm.value.facilityCode = facility?.facilityCode || "";
+ taskForm.value.facilityName = facility?.facilityName || "";
+};
+
+const handleFrequencyTypeChange = () => {
+ Object.assign(taskForm.value, { frequencyDetail: "", week: "", day: "", time: "" });
+ taskFormRef.value?.clearValidate?.("frequencyDetail");
+};
+
+const parseFrequencyDetail = (frequencyType, frequencyDetail) => {
+ if (!frequencyDetail) return;
+ if (frequencyType === "DAILY") {
+ taskForm.value.frequencyDetail = frequencyDetail;
+ return;
+ }
+ const [firstPart, timePart] = frequencyDetail.split(",");
+ taskForm.value.frequencyDetail = "";
+ taskForm.value.time = timePart || "";
+ if (frequencyType === "WEEKLY") {
+ taskForm.value.week = firstPart || "";
+ }
+ if (frequencyType === "MONTHLY") {
+ taskForm.value.day = String(firstPart || "").padStart(2, "0");
+ }
+};
+
+const buildFrequencyDetail = () => {
+ if (taskForm.value.frequencyType === "DAILY") {
+ return taskForm.value.frequencyDetail;
+ }
+ if (taskForm.value.frequencyType === "WEEKLY") {
+ return `${taskForm.value.week},${taskForm.value.time}`;
+ }
+ if (taskForm.value.frequencyType === "MONTHLY") {
+ return `${taskForm.value.day},${taskForm.value.time}`;
+ }
+ return "";
+};
+
+const submitTaskForm = async () => {
+ try {
+ await taskFormRef.value.validate();
+ const payload = {
+ id: taskForm.value.id,
+ inspectionName: taskForm.value.inspectionName,
+ facilityId: taskForm.value.facilityId,
+ facilityCode: taskForm.value.facilityCode,
+ facilityName: taskForm.value.facilityName,
+ inspectionProject: taskForm.value.inspectionProject,
+ inspectorId: taskForm.value.inspectorId,
+ frequencyType: taskForm.value.frequencyType,
+ frequencyDetail: buildFrequencyDetail(),
+ isEnabled: taskForm.value.isEnabled,
+ remark: taskForm.value.remark
+ };
+ const api = payload.id ? updateFacilityInspectionTask : addFacilityInspectionTask;
+ const res = await api(payload);
+ if (res.code === 200) {
+ ElMessage.success(payload.id ? "淇敼鎴愬姛" : "鏂板鎴愬姛");
+ taskDialogVisible.value = false;
+ activeTab.value = "task";
+ getTaskList();
+ } else {
+ ElMessage.error(res.msg || "鎿嶄綔澶辫触");
+ }
+ } catch (error) {
+ console.error("浠诲姟琛ㄥ崟鏍¢獙澶辫触:", error);
+ }
+};
+
+const handleDeleteTask = row => {
+ ElMessageBox.confirm("纭鍒犻櫎璇ュ畾鏃跺贰妫�浠诲姟鍚楋紵", "鍒犻櫎", {
+ confirmButtonText: "纭", cancelButtonText: "鍙栨秷", type: "warning"
+ }).then(async () => {
+ const res = await deleteFacilityInspectionTask([row.id]);
+ if (res.code === 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getTaskList();
+ } else {
+ ElMessage.error(res.msg || "鍒犻櫎澶辫触");
+ }
+ }).catch(() => {});
+};
+
+const handleBatchDeleteTask = () => {
+ if (taskSelectedIds.value.length === 0) {
+ ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑宸℃浠诲姟");
+ return;
+ }
+ ElMessageBox.confirm("纭鍒犻櫎閫変腑鐨勫畾鏃跺贰妫�浠诲姟鍚楋紵", "鎵归噺鍒犻櫎", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ }).then(async () => {
+ const res = await deleteFacilityInspectionTask(taskSelectedIds.value);
+ if (res.code === 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ taskSelectedIds.value = [];
+ getTaskList();
+ } else {
+ ElMessage.error(res.msg || "鍒犻櫎澶辫触");
+ }
+ }).catch(() => {});
+};
+
+const openTaskHistory = row => {
+ taskHistoryTask.value = { ...row };
+ taskHistoryPage.value.current = 1;
+ taskHistoryVisible.value = true;
+ getTaskHistoryList();
+};
+
+const getTaskHistoryList = () => {
+ if (!taskHistoryTask.value?.id) {
+ taskHistoryTableData.value = [];
+ taskHistoryPage.value.total = 0;
+ return;
+ }
+ taskHistoryTableLoading.value = true;
+ getFacilityInspectionList({
+ current: taskHistoryPage.value.current,
+ size: taskHistoryPage.value.size,
+ scheduleTaskId: taskHistoryTask.value.id
+ })
+ .then(res => {
+ taskHistoryTableLoading.value = false;
+ taskHistoryTableData.value = res.data?.records || [];
+ taskHistoryPage.value.total = res.data?.total || 0;
+ })
+ .catch(() => { taskHistoryTableLoading.value = false; });
+};
+
+const taskHistoryPagination = obj => {
+ taskHistoryPage.value.current = obj.page;
+ taskHistoryPage.value.size = obj.limit;
+ getTaskHistoryList();
};
// ============ 宸℃璁板綍鏂规硶 ============
@@ -997,39 +1760,36 @@
getInspectionList();
};
+const openInspectionDetail = row => {
+ inspectionDetail.value = {
+ ...row,
+ storageBlobDTOs: row.storageBlobVOs || row.storageBlobDTOs || []
+ };
+ inspectionDetailVisible.value = true;
+};
+
const openInspectionForm = (type, row = null) => {
+ if (type === "view") {
+ openInspectionDetail(row);
+ return;
+ }
inspectionDialogType.value = type;
- if (type === "add") {
- inspectionDialogTitle.value = "鍙戣捣宸℃";
- Object.assign(inspectionForm.value, {
- id: null,
- facilityId: row.id,
- facilityCode: row.facilityCode,
- facilityName: row.facilityName,
- inspectionCode: buildInspectionCode(row),
- inspectionType: "瀹氭湡宸℃",
- planTime: getDefaultPlanTime(row),
- checkResult: "",
- checkDesc: "",
- storageBlobDTOs: []
- });
- } else if (type === "do") {
+ if (type === "do") {
inspectionDialogTitle.value = "宸℃";
Object.assign(inspectionForm.value, {
id: row.id,
+ scheduleTaskId: row.scheduleTaskId,
facilityId: row.facilityId,
facilityCode: row.facilityCode,
facilityName: row.facilityName,
inspectionCode: row.inspectionCode,
inspectionType: row.inspectionType,
+ inspectionProject: row.inspectionProject,
planTime: row.planTime,
checkResult: "",
checkDesc: "",
storageBlobDTOs: []
});
- } else {
- inspectionDialogTitle.value = "鏌ョ湅宸℃";
- Object.assign(inspectionForm.value, { ...row, storageBlobDTOs: row.storageBlobVOs || row.storageBlobDTOs || [] });
}
inspectionDialogVisible.value = true;
};
@@ -1053,14 +1813,10 @@
inspectionForm.value.status = "宸插贰妫�";
inspectionForm.value.actualTime = formatDateTime();
}
- const api = inspectionForm.value.id ? updateFacilityInspection : addFacilityInspection;
- const res = await api({ ...inspectionForm.value });
+ const res = await updateFacilityInspection({ ...inspectionForm.value });
if (res.code === 200) {
ElMessage.success("鎿嶄綔鎴愬姛");
inspectionDialogVisible.value = false;
- if (inspectionDialogType.value === "add") {
- activeTab.value = "inspection";
- }
getInspectionList();
if (inspectionDialogType.value === "do" && inspectionForm.value.checkResult === "寮傚父") {
ElMessageBox.confirm("鏈宸℃缁撴灉涓哄紓甯革紝鏄惁绔嬪嵆鍒涘缓鏁存敼璺熻釜锛�", "鍒涘缓鏁存敼", {
@@ -1138,6 +1894,14 @@
return "view";
};
+const openRectificationDetail = row => {
+ rectificationDetail.value = {
+ ...row,
+ storageBlobVOs: row.storageBlobVOs || row.storageBlobDTOs || []
+ };
+ rectificationDetailVisible.value = true;
+};
+
const openRectificationFromInspection = async row => {
const existing = await getExistingRectification(row.id);
activeTab.value = "rectification";
@@ -1153,6 +1917,10 @@
};
const openRectificationForm = (type, row = null) => {
+ if (type === "view") {
+ openRectificationDetail(row);
+ return;
+ }
rectificationDialogType.value = type;
if (type === "add") {
rectificationDialogTitle.value = "鏂板鏁存敼";
@@ -1314,6 +2082,10 @@
padding-top: 6px;
}
+.history-summary {
+ margin-bottom: 16px;
+}
+
.table_list :deep(.link) {
color: var(--el-color-primary);
cursor: pointer;
@@ -1418,6 +2190,63 @@
background: #f8fafc;
}
+.detail-dialog :deep(.el-dialog__body) {
+ padding: 24px 32px 8px;
+}
+
+.detail-dialog :deep(.el-descriptions__label) {
+ width: 130px;
+ color: #4d5b73;
+ font-weight: 600;
+ background: #f4f7fb;
+}
+
+.detail-dialog :deep(.el-descriptions__content) {
+ color: #25324b;
+ word-break: break-word;
+}
+
+.detail-section {
+ margin-top: 18px;
+}
+
+.detail-section-title {
+ margin-bottom: 10px;
+ color: #25324b;
+ font-weight: 600;
+}
+
+.detail-image-list {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 10px;
+}
+
+.detail-image {
+ width: 96px;
+ height: 96px;
+ border: 1px solid #dbe4f0;
+ border-radius: 6px;
+ background: #f8fafc;
+}
+
+.frequency-row {
+ display: flex;
+ width: 100%;
+ align-items: center;
+ gap: 12px;
+}
+
+.frequency-time-picker {
+ min-width: 0;
+ flex: 1;
+}
+
+.frequency-day-select {
+ flex: 0 0 132px;
+ width: 132px;
+}
+
@media (max-width: 900px) {
.inspection-form-grid,
.dialog-summary {
--
Gitblit v1.9.3