Merge branch 'dev_兴盛旺海' of http://114.132.189.42:9002/r/product-inventory-management into dev_兴盛旺海
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | /** |
| | | * 鿣䏿¥APIæ¥å£ |
| | | */ |
| | | |
| | | // è·å鿣䏿¥å表 |
| | | export function getHazardReportList(params) { |
| | | return request({ |
| | | url: "/device/hazardReport/list", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢éæ£ä¸æ¥ |
| | | export function addHazardReport(data) { |
| | | return request({ |
| | | url: "/device/hazardReport/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // è®°å½æ´æ¹ç»æ |
| | | export function rectifyHazardReport(data) { |
| | | return request({ |
| | | url: "/device/hazardReport/rectify", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // è®°å½éªæ¶ç»æ |
| | | export function acceptHazardReport(data) { |
| | | return request({ |
| | | url: "/device/hazardReport/accept", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤éæ£ä¸æ¥è®°å½ |
| | | export function deleteHazardReport(ids) { |
| | | return request({ |
| | | url: "/device/hazardReport/delete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | // 导åºéæ£ä¸æ¥è®°å½ |
| | | export function exportHazardReport(params) { |
| | | return request({ |
| | | url: "/device/hazardReport/export", |
| | | method: "post", |
| | | params, |
| | | responseType: 'blob', |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | /** |
| | | * 线路巡æ£APIæ¥å£ |
| | | */ |
| | | |
| | | // è·å线路巡æ£å表 |
| | | export function getLineInspectionList(params) { |
| | | return request({ |
| | | url: "/safeLineInspection/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®IDè·å线路巡æ£è¯¦æ
|
| | | export function getLineInspectionById(id) { |
| | | return request({ |
| | | url: `/safeLineInspection/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢çº¿è·¯å·¡æ£ |
| | | export function addLineInspection(data) { |
| | | return request({ |
| | | url: "/safeLineInspection", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹çº¿è·¯å·¡æ£ |
| | | export function updateLineInspection(data) { |
| | | return request({ |
| | | url: "/safeLineInspection", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤çº¿è·¯å·¡æ£ |
| | | export function deleteLineInspection(ids) { |
| | | return request({ |
| | | url: "/safeLineInspection/" + ids.join(","), |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | | // å®æå·¡æ£ |
| | | export function completeLineInspection(id) { |
| | | return request({ |
| | | url: `/safeLineInspection/complete/${id}`, |
| | | method: "put", |
| | | }); |
| | | } |
| | | |
| | | // è·åå·¡æ£è®°å½å表 |
| | | export function getInspectionRecords(inspectionId) { |
| | | return request({ |
| | | url: `/safeLineInspectionRecord/list/${inspectionId}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢å·¡æ£è®°å½ |
| | | export function addInspectionRecord(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionRecord", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // æ¹éæ°å¢å·¡æ£è®°å½ |
| | | export function batchAddInspectionRecords(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionRecord/batch", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // è·åå·¡æ£éæ£å表 |
| | | export function getInspectionHazards(params) { |
| | | return request({ |
| | | url: "/safeLineInspectionHazard/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®å·¡æ£ä»»å¡IDè·å鿣å表 |
| | | export function getHazardsByInspectionId(inspectionId) { |
| | | return request({ |
| | | url: `/safeLineInspectionHazard/list/${inspectionId}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢éæ£ |
| | | export function addInspectionHazard(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionHazard", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹éæ£ |
| | | export function updateInspectionHazard(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionHazard", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤éæ£ |
| | | export function deleteInspectionHazard(ids) { |
| | | return request({ |
| | | url: "/safeLineInspectionHazard/" + ids.join(","), |
| | | method: "delete", |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | /** |
| | | * å®å
¨è®¾æ½å·¡æ£APIæ¥å£ |
| | | */ |
| | | |
| | | // ============ å®å
¨è®¾æ½å°è´¦ ============ |
| | | |
| | | // è·åå®å
¨è®¾æ½å°è´¦å表 |
| | | export function getFacilityLedgerList(params) { |
| | | return request({ |
| | | url: "/safeFacilityLedger/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®IDè·åå®å
¨è®¾æ½å°è´¦è¯¦æ
|
| | | export function getFacilityLedgerById(id) { |
| | | return request({ |
| | | url: `/safeFacilityLedger/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢å®å
¨è®¾æ½å°è´¦ |
| | | export function addFacilityLedger(data) { |
| | | return request({ |
| | | url: "/safeFacilityLedger", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹å®å
¨è®¾æ½å°è´¦ |
| | | export function updateFacilityLedger(data) { |
| | | return request({ |
| | | url: "/safeFacilityLedger", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤å®å
¨è®¾æ½å°è´¦ |
| | | export function deleteFacilityLedger(ids) { |
| | | return request({ |
| | | url: "/safeFacilityLedger/" + ids.join(","), |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | | // ============ å®å
¨è®¾æ½å·¡æ£ ============ |
| | | |
| | | // è·åå®å
¨è®¾æ½å·¡æ£å表 |
| | | export function getFacilityInspectionList(params) { |
| | | return request({ |
| | | url: "/safeFacilityInspection/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®IDè·åå®å
¨è®¾æ½å·¡æ£è¯¦æ
|
| | | export function getFacilityInspectionById(id) { |
| | | return request({ |
| | | url: `/safeFacilityInspection/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢å®å
¨è®¾æ½å·¡æ£ |
| | | export function addFacilityInspection(data) { |
| | | return request({ |
| | | url: "/safeFacilityInspection", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹å®å
¨è®¾æ½å·¡æ£ |
| | | export function updateFacilityInspection(data) { |
| | | return request({ |
| | | url: "/safeFacilityInspection", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤å®å
¨è®¾æ½å·¡æ£ |
| | | export function deleteFacilityInspection(ids) { |
| | | return request({ |
| | | url: "/safeFacilityInspection/" + ids.join(","), |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | | // ============ å®å
¨è®¾æ½æ´æ¹ ============ |
| | | |
| | | // è·åå®å
¨è®¾æ½æ´æ¹å表 |
| | | export function getFacilityRectificationList(params) { |
| | | return request({ |
| | | url: "/safeFacilityRectification/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®IDè·åå®å
¨è®¾æ½æ´æ¹è¯¦æ
|
| | | export function getFacilityRectificationById(id) { |
| | | return request({ |
| | | url: `/safeFacilityRectification/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢å®å
¨è®¾æ½æ´æ¹ |
| | | export function addFacilityRectification(data) { |
| | | return request({ |
| | | url: "/safeFacilityRectification", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹å®å
¨è®¾æ½æ´æ¹ |
| | | export function updateFacilityRectification(data) { |
| | | return request({ |
| | | url: "/safeFacilityRectification", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤å®å
¨è®¾æ½æ´æ¹ |
| | | export function deleteFacilityRectification(ids) { |
| | | return request({ |
| | | url: "/safeFacilityRectification/" + ids.join(","), |
| | | method: "delete", |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="hazard-report"> |
| | | <!-- æç´¢åºå --> |
| | | <div class="search-area"> |
| | | <el-form :inline="true" :model="searchForm"> |
| | | <el-form-item label="䏿¥ç±»å"> |
| | | <el-select v-model="searchForm.reportType" placeholder="è¯·éæ©ç±»å" clearable> |
| | | <el-option label="线路巡æ£" value="线路巡æ£" /> |
| | | <el-option label="å®å
¨è®¾æ½å·¡æ£" value="å®å
¨è®¾æ½å·¡æ£" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="严éç¨åº¦"> |
| | | <el-select v-model="searchForm.severity" placeholder="è¯·éæ©ç¨åº¦" clearable> |
| | | <el-option label="轻微" value="轻微" /> |
| | | <el-option label="ä¸è¬" value="ä¸è¬" /> |
| | | <el-option label="严é" value="严é" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ´æ¹ç¶æ"> |
| | | <el-select v-model="searchForm.rectificationStatus" placeholder="è¯·éæ©ç¶æ" clearable> |
| | | <el-option label="å¾
æ´æ¹" value="å¾
æ´æ¹" /> |
| | | <el-option label="æ´æ¹ä¸" value="æ´æ¹ä¸" /> |
| | | <el-option label="已宿" value="已宿" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="䏿¥äºº"> |
| | | <el-input v-model="searchForm.reporter" placeholder="请è¾å
¥ä¸æ¥äºº" clearable /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch">æç´¢</el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <!-- æä½æé® --> |
| | | <div class="actions"> |
| | | <el-button type="primary" @click="handleAdd">䏿¥éæ£</el-button> |
| | | <el-button type="success" @click="handleExport">导åº</el-button> |
| | | </div> |
| | | |
| | | <!-- 鿣å表 --> |
| | | <el-table :data="reportList" style="width: 100%; margin-top: 10px;" border> |
| | | <el-table-column prop="reportType" label="䏿¥ç±»å" width="150" /> |
| | | <el-table-column prop="facilityName" label="å
³è设æ½" width="150" /> |
| | | <el-table-column prop="hazardDescription" label="鿣æè¿°" min-width="200" show-overflow-tooltip /> |
| | | <el-table-column prop="severity" label="严éç¨åº¦" width="120"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="getSeverityType(row.severity)"> |
| | | {{ row.severity }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="reporter" label="䏿¥äºº" width="120" /> |
| | | <el-table-column prop="reportTime" label="䏿¥æ¶é´" width="180" /> |
| | | <el-table-column prop="rectificationStatus" label="æ´æ¹ç¶æ" width="120"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="getRectificationStatusType(row.rectificationStatus)"> |
| | | {{ row.rectificationStatus }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="rectificationPerson" label="æ´æ¹è´£ä»»äºº" width="120" /> |
| | | <el-table-column label="æä½" width="280" fixed="right"> |
| | | <template #default="{ row }"> |
| | | <el-button |
| | | v-if="row.rectificationStatus === 'å¾
æ´æ¹'" |
| | | type="warning" |
| | | link |
| | | @click="handleRectify(row)" |
| | | > |
| | | æ´æ¹ |
| | | </el-button> |
| | | <el-button |
| | | v-if="row.rectificationStatus === '已宿' && !row.acceptancePerson" |
| | | type="success" |
| | | link |
| | | @click="handleAccept(row)" |
| | | > |
| | | éªæ¶ |
| | | </el-button> |
| | | <el-button type="primary" link @click="handleView(row)">æ¥ç</el-button> |
| | | <el-button type="danger" link @click="handleDelete(row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- å页 --> |
| | | <div class="pagination"> |
| | | <el-pagination |
| | | v-model:current-page="pagination.currentPage" |
| | | v-model:page-size="pagination.pageSize" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | :total="pagination.total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | |
| | | <!-- 䏿¥éæ£å¯¹è¯æ¡ --> |
| | | <el-dialog title="䏿¥éæ£" v-model="showAddDialog" width="600px"> |
| | | <el-form :model="addForm" :rules="addFormRules" ref="addFormRef" label-width="100px"> |
| | | <el-form-item label="䏿¥ç±»å" prop="reportType"> |
| | | <el-select v-model="addForm.reportType" placeholder="è¯·éæ©ç±»å"> |
| | | <el-option label="线路巡æ£" value="线路巡æ£" /> |
| | | <el-option label="å®å
¨è®¾æ½å·¡æ£" value="å®å
¨è®¾æ½å·¡æ£" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å
³è设æ½"> |
| | | <el-select v-model="addForm.facilityId" placeholder="è¯·éæ©è®¾æ½" clearable> |
| | | <el-option |
| | | v-for="item in facilityOptions" |
| | | :key="item.id" |
| | | :label="item.facilityName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="鿣æè¿°" prop="hazardDescription"> |
| | | <el-input type="textarea" v-model="addForm.hazardDescription" placeholder="请è¾å
¥éæ£æè¿°" /> |
| | | </el-form-item> |
| | | <el-form-item label="严éç¨åº¦" prop="severity"> |
| | | <el-select v-model="addForm.severity" placeholder="è¯·éæ©ç¨åº¦"> |
| | | <el-option label="轻微" value="轻微" /> |
| | | <el-option label="ä¸è¬" value="ä¸è¬" /> |
| | | <el-option label="严é" value="严é" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="䏿¥äºº" prop="reporter"> |
| | | <el-input v-model="addForm.reporter" placeholder="请è¾å
¥ä¸æ¥äºº" /> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨"> |
| | | <el-input type="textarea" v-model="addForm.remarks" placeholder="请è¾å
¥å¤æ³¨" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" @click="submitAddForm">ç¡®å®</el-button> |
| | | <el-button @click="showAddDialog = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- æ´æ¹å¯¹è¯æ¡ --> |
| | | <el-dialog title="è®°å½æ´æ¹ç»æ" v-model="showRectifyDialog" width="500px"> |
| | | <el-form :model="rectifyForm" label-width="100px"> |
| | | <el-form-item label="鿣æè¿°"> |
| | | <el-input type="textarea" v-model="rectifyForm.hazardDescription" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="æ´æ¹è´£ä»»äºº"> |
| | | <el-input v-model="rectifyForm.rectificationPerson" placeholder="请è¾å
¥æ´æ¹è´£ä»»äºº" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ´æ¹æè¿°"> |
| | | <el-input type="textarea" v-model="rectifyForm.rectificationDescription" placeholder="请è¾å
¥æ´æ¹æªæ½" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" @click="submitRectify">ç¡®å®</el-button> |
| | | <el-button @click="showRectifyDialog = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- éªæ¶å¯¹è¯æ¡ --> |
| | | <el-dialog title="è®°å½éªæ¶ç»æ" v-model="showAcceptDialog" width="500px"> |
| | | <el-form :model="acceptForm" label-width="100px"> |
| | | <el-form-item label="æ´æ¹æè¿°"> |
| | | <el-input type="textarea" v-model="acceptForm.rectificationDescription" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="éªæ¶äºº"> |
| | | <el-input v-model="acceptForm.acceptancePerson" placeholder="请è¾å
¥éªæ¶äºº" /> |
| | | </el-form-item> |
| | | <el-form-item label="éªæ¶ç»æ"> |
| | | <el-radio-group v-model="acceptForm.acceptanceResult"> |
| | | <el-radio label="éè¿">éè¿</el-radio> |
| | | <el-radio label="ä¸éè¿">ä¸éè¿</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" @click="submitAccept">ç¡®å®</el-button> |
| | | <el-button @click="showAcceptDialog = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- æ¥ç详æ
å¯¹è¯æ¡ --> |
| | | <el-dialog title="éæ£è¯¦æ
" v-model="showViewDialog" width="600px"> |
| | | <el-descriptions :column="2" border> |
| | | <el-descriptions-item label="䏿¥ç±»å">{{ viewData.reportType }}</el-descriptions-item> |
| | | <el-descriptions-item label="å
³è设æ½">{{ viewData.facilityName }}</el-descriptions-item> |
| | | <el-descriptions-item label="鿣æè¿°" :span="2">{{ viewData.hazardDescription }}</el-descriptions-item> |
| | | <el-descriptions-item label="严éç¨åº¦">{{ viewData.severity }}</el-descriptions-item> |
| | | <el-descriptions-item label="䏿¥äºº">{{ viewData.reporter }}</el-descriptions-item> |
| | | <el-descriptions-item label="䏿¥æ¶é´">{{ viewData.reportTime }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ´æ¹ç¶æ">{{ viewData.rectificationStatus }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ´æ¹è´£ä»»äºº">{{ viewData.rectificationPerson }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ´æ¹æ¶é´">{{ viewData.rectificationTime }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ´æ¹æè¿°" :span="2">{{ viewData.rectificationDescription }}</el-descriptions-item> |
| | | <el-descriptions-item label="éªæ¶äºº">{{ viewData.acceptancePerson }}</el-descriptions-item> |
| | | <el-descriptions-item label="éªæ¶æ¶é´">{{ viewData.acceptanceTime }}</el-descriptions-item> |
| | | <el-descriptions-item label="éªæ¶ç»æ">{{ viewData.acceptanceResult }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="showViewDialog = false">å
³é</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { |
| | | getHazardReportList, |
| | | addHazardReport, |
| | | rectifyHazardReport, |
| | | acceptHazardReport, |
| | | deleteHazardReport, |
| | | exportHazardReport |
| | | } from '@/api/safeProduction/hazardReport' |
| | | import { getSafetyFacilityList } from '@/api/equipmentManagement/safetyFacility' |
| | | |
| | | // æç´¢è¡¨å |
| | | const searchForm = reactive({ |
| | | reportType: '', |
| | | severity: '', |
| | | rectificationStatus: '', |
| | | reporter: '' |
| | | }) |
| | | |
| | | // åé¡µæ°æ® |
| | | const pagination = reactive({ |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | total: 0 |
| | | }) |
| | | |
| | | // åè¡¨æ°æ® |
| | | const reportList = ref([]) |
| | | |
| | | // 设æ½é项 |
| | | const facilityOptions = ref([]) |
| | | |
| | | // å¯¹è¯æ¡ç¶æ |
| | | const showAddDialog = ref(false) |
| | | const showRectifyDialog = ref(false) |
| | | const showAcceptDialog = ref(false) |
| | | const showViewDialog = ref(false) |
| | | |
| | | // 䏿¥è¡¨å |
| | | const addForm = reactive({ |
| | | reportType: '', |
| | | facilityId: null, |
| | | hazardDescription: '', |
| | | severity: '', |
| | | reporter: '', |
| | | remarks: '' |
| | | }) |
| | | |
| | | // 䏿¥è¡¨åéªè¯è§å |
| | | const addFormRules = reactive({ |
| | | reportType: [{ required: true, message: 'è¯·éæ©ä¸æ¥ç±»å', trigger: 'change' }], |
| | | hazardDescription: [{ required: true, message: '请è¾å
¥éæ£æè¿°', trigger: 'blur' }], |
| | | severity: [{ required: true, message: 'è¯·éæ©ä¸¥éç¨åº¦', trigger: 'change' }], |
| | | reporter: [{ required: true, message: '请è¾å
¥ä¸æ¥äºº', trigger: 'blur' }] |
| | | }) |
| | | |
| | | const addFormRef = ref(null) |
| | | |
| | | // æ´æ¹è¡¨å |
| | | const rectifyForm = reactive({ |
| | | id: null, |
| | | hazardDescription: '', |
| | | rectificationPerson: '', |
| | | rectificationDescription: '' |
| | | }) |
| | | |
| | | // éªæ¶è¡¨å |
| | | const acceptForm = reactive({ |
| | | id: null, |
| | | rectificationDescription: '', |
| | | acceptancePerson: '', |
| | | acceptanceResult: 'éè¿' |
| | | }) |
| | | |
| | | // æ¥çæ°æ® |
| | | const viewData = ref({}) |
| | | |
| | | // è·å严éç¨åº¦æ ç¾ç±»å |
| | | const getSeverityType = (severity) => { |
| | | const map = { |
| | | '轻微': 'info', |
| | | 'ä¸è¬': 'warning', |
| | | '严é': 'danger' |
| | | } |
| | | return map[severity] || 'info' |
| | | } |
| | | |
| | | // è·åæ´æ¹ç¶ææ ç¾ç±»å |
| | | const getRectificationStatusType = (status) => { |
| | | const map = { |
| | | 'å¾
æ´æ¹': 'danger', |
| | | 'æ´æ¹ä¸': 'warning', |
| | | '已宿': 'success' |
| | | } |
| | | return map[status] || 'info' |
| | | } |
| | | |
| | | // è·å鿣å表 |
| | | const fetchList = async () => { |
| | | try { |
| | | const params = { |
| | | ...searchForm, |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize |
| | | } |
| | | const res = await getHazardReportList(params) |
| | | if (res.code === 200) { |
| | | reportList.value = res.data.records || [] |
| | | pagination.total = res.data.total || 0 |
| | | } else { |
| | | ElMessage.error(res.message || 'è·åå表失败') |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error('è·åå表失败') |
| | | } |
| | | } |
| | | |
| | | // è·å设æ½å表 |
| | | const fetchFacilityOptions = async () => { |
| | | try { |
| | | const res = await getSafetyFacilityList({ size: 1000 }) |
| | | if (res.code === 200) { |
| | | facilityOptions.value = res.data.records || [] |
| | | } |
| | | } catch (error) { |
| | | console.error('è·å设æ½å表失败') |
| | | } |
| | | } |
| | | |
| | | // æç´¢ |
| | | const handleSearch = () => { |
| | | pagination.currentPage = 1 |
| | | fetchList() |
| | | } |
| | | |
| | | // éç½®æç´¢ |
| | | const resetSearch = () => { |
| | | Object.assign(searchForm, { |
| | | reportType: '', |
| | | severity: '', |
| | | rectificationStatus: '', |
| | | reporter: '' |
| | | }) |
| | | handleSearch() |
| | | } |
| | | |
| | | // 䏿¥éæ£ |
| | | const handleAdd = () => { |
| | | Object.assign(addForm, { |
| | | reportType: '', |
| | | facilityId: null, |
| | | hazardDescription: '', |
| | | severity: '', |
| | | reporter: '', |
| | | remarks: '' |
| | | }) |
| | | showAddDialog.value = true |
| | | } |
| | | |
| | | // æ´æ¹ |
| | | const handleRectify = (row) => { |
| | | Object.assign(rectifyForm, { |
| | | id: row.id, |
| | | hazardDescription: row.hazardDescription, |
| | | rectificationPerson: '', |
| | | rectificationDescription: '' |
| | | }) |
| | | showRectifyDialog.value = true |
| | | } |
| | | |
| | | // éªæ¶ |
| | | const handleAccept = (row) => { |
| | | Object.assign(acceptForm, { |
| | | id: row.id, |
| | | rectificationDescription: row.rectificationDescription, |
| | | acceptancePerson: '', |
| | | acceptanceResult: 'éè¿' |
| | | }) |
| | | showAcceptDialog.value = true |
| | | } |
| | | |
| | | // æ¥ç详æ
|
| | | const handleView = (row) => { |
| | | viewData.value = { ...row } |
| | | showViewDialog.value = true |
| | | } |
| | | |
| | | // å é¤ |
| | | const handleDelete = async (row) => { |
| | | try { |
| | | await ElMessageBox.confirm('确认å é¤è¯¥éæ£è®°å½åï¼', 'æç¤º', { |
| | | type: 'warning' |
| | | }) |
| | | const res = await deleteHazardReport([row.id]) |
| | | if (res.code === 200) { |
| | | ElMessage.success('å 餿å') |
| | | fetchList() |
| | | } else { |
| | | ElMessage.error(res.message || 'å é¤å¤±è´¥') |
| | | } |
| | | } catch (error) { |
| | | // åæ¶å é¤ |
| | | } |
| | | } |
| | | |
| | | // æäº¤ä¸æ¥è¡¨å |
| | | const submitAddForm = async () => { |
| | | if (!addFormRef.value) return |
| | | try { |
| | | await addFormRef.value.validate() |
| | | const res = await addHazardReport(addForm) |
| | | if (res.code === 200) { |
| | | ElMessage.success('䏿¥æå') |
| | | showAddDialog.value = false |
| | | fetchList() |
| | | } else { |
| | | ElMessage.error(res.message || '䏿¥å¤±è´¥') |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error('请填å宿´è¡¨åä¿¡æ¯') |
| | | } |
| | | } |
| | | |
| | | // æäº¤æ´æ¹ |
| | | const submitRectify = async () => { |
| | | try { |
| | | const res = await rectifyHazardReport(rectifyForm) |
| | | if (res.code === 200) { |
| | | ElMessage.success('æ´æ¹è®°å½æå') |
| | | showRectifyDialog.value = false |
| | | fetchList() |
| | | } else { |
| | | ElMessage.error(res.message || 'æä½å¤±è´¥') |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error('æä½å¤±è´¥') |
| | | } |
| | | } |
| | | |
| | | // æäº¤éªæ¶ |
| | | const submitAccept = async () => { |
| | | try { |
| | | const res = await acceptHazardReport(acceptForm) |
| | | if (res.code === 200) { |
| | | ElMessage.success('éªæ¶è®°å½æå') |
| | | showAcceptDialog.value = false |
| | | fetchList() |
| | | } else { |
| | | ElMessage.error(res.message || 'æä½å¤±è´¥') |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error('æä½å¤±è´¥') |
| | | } |
| | | } |
| | | |
| | | // å¯¼åº |
| | | const handleExport = async () => { |
| | | try { |
| | | const res = await exportHazardReport(searchForm) |
| | | const blob = new Blob([res]) |
| | | const url = window.URL.createObjectURL(blob) |
| | | const link = document.createElement('a') |
| | | link.href = url |
| | | link.download = '鿣䏿¥è®°å½.xlsx' |
| | | link.click() |
| | | window.URL.revokeObjectURL(url) |
| | | ElMessage.success('å¯¼åºæå') |
| | | } catch (error) { |
| | | ElMessage.error('导åºå¤±è´¥') |
| | | } |
| | | } |
| | | |
| | | // å页大尿¹å |
| | | const handleSizeChange = (val) => { |
| | | pagination.pageSize = val |
| | | fetchList() |
| | | } |
| | | |
| | | // å½å页æ¹å |
| | | const handleCurrentChange = (val) => { |
| | | pagination.currentPage = val |
| | | fetchList() |
| | | } |
| | | |
| | | onMounted(() => { |
| | | fetchList() |
| | | fetchFacilityOptions() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .hazard-report { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .search-area { |
| | | background: #f5f7fa; |
| | | padding: 20px; |
| | | border-radius: 4px; |
| | | margin-bottom: 15px; |
| | | } |
| | | |
| | | .actions { |
| | | margin-bottom: 15px; |
| | | } |
| | | |
| | | .pagination { |
| | | margin-top: 20px; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form mb20"> |
| | | <div> |
| | | <span class="search_title">å·¡æ£ç¼å·ï¼</span> |
| | | <el-input v-model="searchForm.inspectionCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥å·¡æ£ç¼å·" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title ml10">å·¡æ£åç§°ï¼</span> |
| | | <el-input v-model="searchForm.inspectionName" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥å·¡æ£åç§°" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title ml10">线路åç§°ï¼</span> |
| | | <el-input v-model="searchForm.lineName" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥çº¿è·¯åç§°" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title ml10">ç¶æï¼</span> |
| | | <el-select v-model="searchForm.status" |
| | | clearable |
| | | @change="handleQuery" |
| | | style="width: 150px"> |
| | | <el-option label="å¾
å·¡æ£" value="å¾
å·¡æ£" /> |
| | | <el-option label="å·¡æ£ä¸" value="å·¡æ£ä¸" /> |
| | | <el-option label="已宿" value="已宿" /> |
| | | </el-select> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px"> |
| | | æç´¢ |
| | | </el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" |
| | | @click="openForm('add')">æ°å¢å·¡æ£ä»»å¡</el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total"></PIMTable> |
| | | </div> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å·¡æ£ä»»å¡å¼¹çª --> |
| | | <el-dialog v-model="dialogVisible" |
| | | :title="dialogTitle" |
| | | width="800px" |
| | | :close-on-click-modal="false"> |
| | | <el-form ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="120px"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¡æ£ç¼å·" |
| | | prop="inspectionCode"> |
| | | <el-input v-model="form.inspectionCode" |
| | | placeholder="请è¾å
¥å·¡æ£ç¼å·" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¡æ£åç§°" |
| | | prop="inspectionName"> |
| | | <el-input v-model="form.inspectionName" |
| | | placeholder="请è¾å
¥å·¡æ£åç§°" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="线路åç§°" |
| | | prop="lineName"> |
| | | <el-input v-model="form.lineName" |
| | | placeholder="请è¾å
¥çº¿è·¯åç§°" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¡æ£ç±»å" |
| | | prop="inspectionType"> |
| | | <el-select v-model="form.inspectionType" |
| | | placeholder="è¯·éæ©å·¡æ£ç±»å" |
| | | style="width: 100%"> |
| | | <el-option label="宿巡æ£" value="宿巡æ£" /> |
| | | <el-option label="临æ¶å·¡æ£" value="临æ¶å·¡æ£" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计åå·¡æ£æ¶é´" |
| | | prop="planTime"> |
| | | <el-date-picker v-model="form.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> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¡æ£äºº" |
| | | prop="inspectorId"> |
| | | <el-select v-model="form.inspectorIds" |
| | | placeholder="è¯·éæ©å·¡æ£äººï¼å¯å¤éï¼" |
| | | filterable |
| | | multiple |
| | | collapse-tags |
| | | collapse-tags-tooltip |
| | | 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-row> |
| | | <el-form-item label="夿³¨" |
| | | prop="remark"> |
| | | <el-input v-model="form.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="submitForm">ç¡®å®</el-button> |
| | | <el-button @click="dialogVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- å·¡æ£è®°å½å¼¹çª --> |
| | | <el-dialog ref="recordDialogRef" |
| | | v-model="recordDialogVisible" |
| | | title="å·¡æ£è®°å½" |
| | | width="70vw" |
| | | :close-on-click-modal="false" |
| | | @open="onRecordDialogOpen"> |
| | | <div class="mb10"> |
| | | <el-button type="primary" |
| | | size="small" |
| | | @click="openRecordForm">æ°å¢è®°å½</el-button> |
| | | </div> |
| | | <div class="dialog-table-wrapper"> |
| | | <el-table :data="recordList" |
| | | border |
| | | style="width: 100%"> |
| | | <el-table-column prop="checkPoint" label="æ£æ¥ç¹" width="150" show-overflow-tooltip /> |
| | | <el-table-column prop="checkContent" label="æ£æ¥å
容" min-width="200" show-overflow-tooltip /> |
| | | <el-table-column prop="checkResult" label="æ£æ¥ç»æ" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="row.checkResult === 'æ£å¸¸' ? 'success' : 'danger'"> |
| | | {{ row.checkResult }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="checkDesc" label="æ£æ¥è¯´æ" width="200" show-overflow-tooltip /> |
| | | <el-table-column prop="checkTime" label="æ£æ¥æ¶é´" width="180" /> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- æ°å¢è®°å½è¡¨å --> |
| | | <el-dialog v-model="recordFormVisible" |
| | | title="æ°å¢å·¡æ£è®°å½" |
| | | width="600px" |
| | | append-to-body |
| | | :close-on-click-modal="false"> |
| | | <el-form ref="recordFormRef" |
| | | :model="recordForm" |
| | | :rules="recordRules" |
| | | label-width="100px"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æ¥ç¹" |
| | | prop="checkPoint"> |
| | | <el-input v-model="recordForm.checkPoint" |
| | | placeholder="请è¾å
¥æ£æ¥ç¹" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£æ¥ç»æ" |
| | | prop="checkResult"> |
| | | <el-radio-group v-model="recordForm.checkResult"> |
| | | <el-radio label="æ£å¸¸">æ£å¸¸</el-radio> |
| | | <el-radio label="å¼å¸¸">å¼å¸¸</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-form-item label="æ£æ¥å
容" |
| | | prop="checkContent"> |
| | | <el-input v-model="recordForm.checkContent" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥æ£æ¥å
容" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ£æ¥è¯´æ"> |
| | | <el-input v-model="recordForm.checkDesc" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="请è¾å
¥æ£æ¥è¯´æ" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ£æ¥æ¶é´"> |
| | | <el-date-picker v-model="recordForm.checkTime" |
| | | type="datetime" |
| | | placeholder="è¯·éæ©æ£æ¥æ¶é´" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="submitRecordForm">ç¡®å®</el-button> |
| | | <el-button @click="recordFormVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </el-dialog> |
| | | |
| | | <!-- éæ£ç®¡çå¼¹çª --> |
| | | <el-dialog ref="hazardDialogRef" |
| | | v-model="hazardDialogVisible" |
| | | title="éæ£ç®¡ç" |
| | | width="75vw" |
| | | :close-on-click-modal="false" |
| | | @open="onHazardDialogOpen"> |
| | | <div class="mb10"> |
| | | <el-button type="primary" |
| | | size="small" |
| | | @click="openHazardForm('add')">䏿¥éæ£</el-button> |
| | | </div> |
| | | <div class="dialog-table-wrapper"> |
| | | <el-table :data="hazardList" |
| | | border |
| | | style="width: 100%"> |
| | | <el-table-column prop="hazardCode" label="鿣ç¼å·" width="120" show-overflow-tooltip /> |
| | | <el-table-column prop="hazardDesc" label="鿣æè¿°" min-width="200" show-overflow-tooltip /> |
| | | <el-table-column prop="hazardLevel" label="鿣ç级" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="row.hazardLevel === 'é大' ? 'danger' : 'warning'"> |
| | | {{ row.hazardLevel }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="hazardLocation" label="鿣ä½ç½®" width="150" show-overflow-tooltip /> |
| | | <el-table-column prop="status" label="ç¶æ" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="getHazardStatusType(row.status)"> |
| | | {{ row.status }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <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> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- éæ£è¡¨å --> |
| | | <el-dialog v-model="hazardFormVisible" |
| | | :title="hazardDialogTitle" |
| | | width="600px" |
| | | append-to-body |
| | | :close-on-click-modal="false"> |
| | | <el-form ref="hazardFormRef" |
| | | :model="hazardForm" |
| | | :rules="hazardRules" |
| | | label-width="100px"> |
| | | <el-form-item label="鿣æè¿°" |
| | | prop="hazardDesc"> |
| | | <el-input v-model="hazardForm.hazardDesc" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥éæ£æè¿°" /> |
| | | </el-form-item> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="鿣ç级" |
| | | prop="hazardLevel"> |
| | | <el-select v-model="hazardForm.hazardLevel" |
| | | placeholder="è¯·éæ©éæ£ç级" |
| | | style="width: 100%"> |
| | | <el-option label="ä¸è¬" value="ä¸è¬" /> |
| | | <el-option label="é大" value="é大" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="鿣ä½ç½®" |
| | | prop="hazardLocation"> |
| | | <el-input v-model="hazardForm.hazardLocation" |
| | | placeholder="请è¾å
¥éæ£ä½ç½®" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="submitHazardForm">ç¡®å®</el-button> |
| | | <el-button @click="hazardFormVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- æ´æ¹è¡¨å --> |
| | | <el-dialog v-model="rectifyFormVisible" |
| | | title="æ´æ¹" |
| | | width="500px" |
| | | append-to-body |
| | | :close-on-click-modal="false"> |
| | | <el-form ref="rectifyFormRef" |
| | | :model="rectifyForm" |
| | | label-width="100px"> |
| | | <el-form-item label="æ´æ¹è¯´æ" |
| | | prop="rectifyDesc"> |
| | | <el-input v-model="rectifyForm.rectifyDesc" |
| | | type="textarea" |
| | | :rows="4" |
| | | placeholder="请è¾å
¥æ´æ¹è¯´æ" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="submitRectifyForm">ç¡®å®</el-button> |
| | | <el-button @click="rectifyFormVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { nextTick, onMounted, ref, reactive, toRefs } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { |
| | | getLineInspectionList, |
| | | addLineInspection, |
| | | updateLineInspection, |
| | | deleteLineInspection, |
| | | completeLineInspection, |
| | | getInspectionRecords, |
| | | addInspectionRecord, |
| | | getHazardsByInspectionId, |
| | | addInspectionHazard, |
| | | updateInspectionHazard |
| | | } from "@/api/safeProduction/lineInspection"; |
| | | |
| | | // 表åéªè¯è§å |
| | | const rules = { |
| | | inspectionCode: [{ required: true, message: "请è¾å
¥å·¡æ£ç¼å·", trigger: "blur" }], |
| | | inspectionName: [{ required: true, message: "请è¾å
¥å·¡æ£åç§°", trigger: "blur" }], |
| | | lineName: [{ required: true, message: "请è¾å
¥çº¿è·¯åç§°", trigger: "blur" }] |
| | | }; |
| | | |
| | | const recordRules = { |
| | | checkPoint: [{ required: true, message: "请è¾å
¥æ£æ¥ç¹", trigger: "blur" }], |
| | | checkContent: [{ required: true, message: "请è¾å
¥æ£æ¥å
容", trigger: "blur" }], |
| | | checkResult: [{ required: true, message: "è¯·éæ©æ£æ¥ç»æ", trigger: "change" }] |
| | | }; |
| | | |
| | | const hazardRules = { |
| | | hazardDesc: [{ required: true, message: "请è¾å
¥éæ£æè¿°", trigger: "blur" }], |
| | | hazardLevel: [{ required: true, message: "è¯·éæ©éæ£ç级", trigger: "change" }], |
| | | hazardLocation: [{ required: true, message: "请è¾å
¥éæ£ä½ç½®", trigger: "blur" }] |
| | | }; |
| | | |
| | | // ååºå¼æ°æ® |
| | | const data = reactive({ |
| | | searchForm: { |
| | | inspectionCode: "", |
| | | inspectionName: "", |
| | | lineName: "", |
| | | status: "" |
| | | }, |
| | | tableLoading: false, |
| | | page: { |
| | | current: 1, |
| | | size: 20, |
| | | total: 0 |
| | | }, |
| | | tableData: [], |
| | | selectedIds: [], |
| | | form: { |
| | | id: null, |
| | | inspectionCode: "", |
| | | inspectionName: "", |
| | | lineName: "", |
| | | inspectionType: "", |
| | | planTime: "", |
| | | inspectorId: "", |
| | | inspectorIds: [], |
| | | remark: "" |
| | | }, |
| | | dialogVisible: false, |
| | | dialogTitle: "", |
| | | dialogType: "add", |
| | | // å·¡æ£è®°å½ |
| | | currentInspectionId: null, |
| | | recordDialogVisible: false, |
| | | recordFormVisible: false, |
| | | recordList: [], |
| | | recordForm: { |
| | | inspectionId: null, |
| | | checkPoint: "", |
| | | checkContent: "", |
| | | checkResult: "æ£å¸¸", |
| | | checkDesc: "", |
| | | checkTime: "" |
| | | }, |
| | | // éæ£ç®¡ç |
| | | hazardDialogVisible: false, |
| | | hazardFormVisible: false, |
| | | hazardDialogTitle: "䏿¥éæ£", |
| | | hazardList: [], |
| | | hazardForm: { |
| | | id: null, |
| | | inspectionId: null, |
| | | hazardDesc: "", |
| | | hazardLevel: "", |
| | | hazardLocation: "" |
| | | }, |
| | | rectifyFormVisible: false, |
| | | rectifyForm: { |
| | | id: null, |
| | | rectifyDesc: "" |
| | | } |
| | | }); |
| | | |
| | | const { |
| | | searchForm, |
| | | tableLoading, |
| | | page, |
| | | tableData, |
| | | selectedIds, |
| | | form, |
| | | dialogVisible, |
| | | dialogTitle, |
| | | dialogType, |
| | | currentInspectionId, |
| | | recordDialogVisible, |
| | | recordFormVisible, |
| | | recordList, |
| | | recordForm, |
| | | hazardDialogVisible, |
| | | hazardFormVisible, |
| | | hazardDialogTitle, |
| | | hazardList, |
| | | hazardForm, |
| | | rectifyFormVisible, |
| | | rectifyForm |
| | | } = toRefs(data); |
| | | |
| | | // 表åå¼ç¨ |
| | | const formRef = ref(); |
| | | const recordFormRef = ref(); |
| | | const hazardFormRef = ref(); |
| | | const rectifyFormRef = ref(); |
| | | const userList = ref([]); |
| | | |
| | | // è¡¨æ ¼åé
ç½® |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "å·¡æ£ç¼å·", |
| | | prop: "inspectionCode", |
| | | showOverflowTooltip: true, |
| | | minWidth: 150 |
| | | }, |
| | | { |
| | | label: "å·¡æ£åç§°", |
| | | prop: "inspectionName", |
| | | showOverflowTooltip: true, |
| | | minWidth: 180 |
| | | }, |
| | | { |
| | | label: "线路åç§°", |
| | | prop: "lineName", |
| | | showOverflowTooltip: true, |
| | | minWidth: 150 |
| | | }, |
| | | { |
| | | label: "å·¡æ£ç±»å", |
| | | prop: "inspectionType", |
| | | showOverflowTooltip: true, |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | label: "计åå·¡æ£æ¶é´", |
| | | prop: "planTime", |
| | | showOverflowTooltip: true, |
| | | minWidth: 180 |
| | | }, |
| | | { |
| | | label: "å·¡æ£äºº", |
| | | prop: "inspectorName", |
| | | showOverflowTooltip: true, |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | label: "ç¶æ", |
| | | prop: "status", |
| | | minWidth: 100, |
| | | dataType: "tag", |
| | | formatType: params => { |
| | | const typeMap = { |
| | | å¾
å·¡æ£: "info", |
| | | å·¡æ£ä¸: "warning", |
| | | 已宿: "success" |
| | | }; |
| | | return typeMap[params] || "info"; |
| | | } |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 350, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: row => { |
| | | openForm("edit", row); |
| | | }, |
| | | show: row => row.status === "å¾
å·¡æ£" |
| | | }, |
| | | { |
| | | name: "å·¡æ£è®°å½", |
| | | type: "text", |
| | | clickFun: row => { |
| | | openRecordDialog(row); |
| | | } |
| | | }, |
| | | { |
| | | name: "éæ£ç®¡ç", |
| | | type: "text", |
| | | clickFun: row => { |
| | | openHazardDialog(row); |
| | | } |
| | | }, |
| | | { |
| | | name: "宿巡æ£", |
| | | type: "text", |
| | | style: { color: "#67C23A" }, |
| | | clickFun: row => { |
| | | handleComplete(row); |
| | | }, |
| | | show: row => row.status === "å·¡æ£ä¸" |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | type: "text", |
| | | style: { color: "#F56C6C" }, |
| | | clickFun: row => { |
| | | handleDelete(row); |
| | | }, |
| | | show: row => row.status === "å¾
å·¡æ£" |
| | | } |
| | | ] |
| | | } |
| | | ]); |
| | | |
| | | // çå½å¨æ |
| | | onMounted(() => { |
| | | getList(); |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data; |
| | | }); |
| | | }); |
| | | |
| | | // å¼¹çªåºå®é«åº¦å¤ç |
| | | const setDialogFixedHeight = () => { |
| | | setTimeout(() => { |
| | | // ç´æ¥å¨ body 䏿¾ææ el-dialogï¼teleport 渲æå° bodyï¼ |
| | | const dialogs = document.body.querySelectorAll('.el-dialog'); |
| | | const dialog = dialogs[dialogs.length - 1]; // æåä¸ä¸ªå°±æ¯åæå¼ç |
| | | if (!dialog) return; |
| | | Object.assign(dialog.style, { |
| | | height: '70vh', |
| | | maxHeight: '70vh', |
| | | overflow: 'hidden', |
| | | display: 'flex', |
| | | flexDirection: 'column' |
| | | }); |
| | | const body = dialog.querySelector('.el-dialog__body'); |
| | | if (body) { |
| | | Object.assign(body.style, { flex: '1', overflow: 'hidden' }); |
| | | } |
| | | const wrapper = dialog.querySelector('.dialog-table-wrapper'); |
| | | if (wrapper) { |
| | | Object.assign(wrapper.style, { flex: '1', overflowY: 'auto' }); |
| | | } |
| | | }, 100); |
| | | }; |
| | | |
| | | const recordDialogRef = ref(null); |
| | | const hazardDialogRef = ref(null); |
| | | |
| | | const onRecordDialogOpen = () => setDialogFixedHeight(); |
| | | const onHazardDialogOpen = () => setDialogFixedHeight(); |
| | | const handleQuery = () => { |
| | | page.value.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | getLineInspectionList({ ...page.value, ...searchForm.value }) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.value.total = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // å页å¤ç |
| | | const pagination = obj => { |
| | | page.value.current = obj.page; |
| | | page.value.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | |
| | | // éæ©ååå¤ç |
| | | const handleSelectionChange = selection => { |
| | | selectedIds.value = selection.map(item => item.id); |
| | | }; |
| | | |
| | | // è·åéæ£ç¶æç±»å |
| | | const getHazardStatusType = status => { |
| | | const map = { |
| | | å¾
æ´æ¹: "danger", |
| | | æ´æ¹ä¸: "warning", |
| | | å·²æ´æ¹: "success" |
| | | }; |
| | | return map[status] || "info"; |
| | | }; |
| | | |
| | | // æå¼è¡¨å |
| | | const openForm = (type, row = null) => { |
| | | dialogType.value = type; |
| | | if (type === "add") { |
| | | dialogTitle.value = "æ°å¢å·¡æ£ä»»å¡"; |
| | | Object.assign(form.value, { |
| | | id: null, |
| | | inspectionCode: "", |
| | | inspectionName: "", |
| | | lineName: "", |
| | | inspectionType: "", |
| | | planTime: "", |
| | | inspectorId: "", |
| | | inspectorIds: [], |
| | | remark: "" |
| | | }); |
| | | } else if (type === "edit" && row) { |
| | | dialogTitle.value = "ç¼è¾å·¡æ£ä»»å¡"; |
| | | // å°éå·åéçIDå符串转æ¢ä¸ºæ°ç» |
| | | const inspectorIds = row.inspectorId |
| | | ? row.inspectorId.split(",").map(id => parseInt(id.trim())).filter(id => !isNaN(id)) |
| | | : []; |
| | | Object.assign(form.value, { |
| | | id: row.id, |
| | | inspectionCode: row.inspectionCode, |
| | | inspectionName: row.inspectionName, |
| | | lineName: row.lineName, |
| | | inspectionType: row.inspectionType, |
| | | planTime: row.planTime, |
| | | inspectorId: row.inspectorId, |
| | | inspectorIds: inspectorIds, |
| | | remark: row.remark |
| | | }); |
| | | } |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = async () => { |
| | | try { |
| | | await formRef.value.validate(); |
| | | // å°æ°ç»è½¬æ¢ä¸ºéå·åéçå符串 |
| | | const submitData = { |
| | | ...form.value, |
| | | inspectorId: form.value.inspectorIds ? form.value.inspectorIds.join(",") : "" |
| | | }; |
| | | delete submitData.inspectorIds; |
| | | |
| | | const api = dialogType.value === "add" ? addLineInspection : updateLineInspection; |
| | | const res = await api(submitData); |
| | | if (res.code === 200) { |
| | | ElMessage.success(dialogType.value === "add" ? "æ·»å æå" : "æ´æ°æå"); |
| | | dialogVisible.value = false; |
| | | getList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "æä½å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | console.error("表åéªè¯å¤±è´¥:", error); |
| | | } |
| | | }; |
| | | |
| | | // å é¤ |
| | | const handleDelete = row => { |
| | | ElMessageBox.confirm("确认å é¤è¯¥å·¡æ£ä»»å¡åï¼", "å é¤", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }) |
| | | .then(async () => { |
| | | const res = await deleteLineInspection([row.id]); |
| | | if (res.code === 200) { |
| | | ElMessage.success("å 餿å"); |
| | | getList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "å é¤å¤±è´¥"); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // å®æå·¡æ£ |
| | | const handleComplete = row => { |
| | | ElMessageBox.confirm("ç¡®è®¤å®æè¯¥å·¡æ£ä»»å¡åï¼", "宿巡æ£", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }) |
| | | .then(async () => { |
| | | const res = await completeLineInspection(row.id); |
| | | if (res.code === 200) { |
| | | ElMessage.success("å·¡æ£å·²å®æ"); |
| | | getList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "æä½å¤±è´¥"); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // æå¼å·¡æ£è®°å½å¼¹çª |
| | | const openRecordDialog = row => { |
| | | currentInspectionId.value = row.id; |
| | | fetchRecords(row.id); |
| | | recordDialogVisible.value = true; |
| | | }; |
| | | |
| | | // è·åå·¡æ£è®°å½ |
| | | const fetchRecords = async inspectionId => { |
| | | const res = await getInspectionRecords(inspectionId); |
| | | if (res.code === 200) { |
| | | recordList.value = res.data || []; |
| | | } |
| | | }; |
| | | |
| | | // æå¼è®°å½è¡¨å |
| | | const openRecordForm = () => { |
| | | Object.assign(recordForm.value, { |
| | | inspectionId: currentInspectionId.value, |
| | | checkPoint: "", |
| | | checkContent: "", |
| | | checkResult: "æ£å¸¸", |
| | | checkDesc: "", |
| | | checkTime: "" |
| | | }); |
| | | recordFormVisible.value = true; |
| | | }; |
| | | |
| | | // æäº¤è®°å½è¡¨å |
| | | const submitRecordForm = async () => { |
| | | try { |
| | | await recordFormRef.value.validate(); |
| | | const res = await addInspectionRecord({ ...recordForm.value }); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ·»å æå"); |
| | | recordFormVisible.value = false; |
| | | fetchRecords(currentInspectionId.value); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ·»å 失败"); |
| | | } |
| | | } catch (error) { |
| | | console.error("表åéªè¯å¤±è´¥:", error); |
| | | } |
| | | }; |
| | | |
| | | // æå¼éæ£ç®¡çå¼¹çª |
| | | const openHazardDialog = row => { |
| | | currentInspectionId.value = row.id; |
| | | fetchHazards(row.id); |
| | | hazardDialogVisible.value = true; |
| | | }; |
| | | |
| | | // è·å鿣å表 |
| | | const fetchHazards = async inspectionId => { |
| | | const res = await getHazardsByInspectionId(inspectionId); |
| | | if (res.code === 200) { |
| | | hazardList.value = res.data || []; |
| | | } |
| | | }; |
| | | |
| | | // æå¼éæ£è¡¨å |
| | | const openHazardForm = (type, row = null) => { |
| | | if (type === "add") { |
| | | hazardDialogTitle.value = "䏿¥éæ£"; |
| | | Object.assign(hazardForm.value, { |
| | | id: null, |
| | | inspectionId: currentInspectionId.value, |
| | | hazardDesc: "", |
| | | hazardLevel: "", |
| | | hazardLocation: "" |
| | | }); |
| | | } else { |
| | | hazardDialogTitle.value = "ç¼è¾éæ£"; |
| | | Object.assign(hazardForm.value, { |
| | | id: row.id, |
| | | inspectionId: row.inspectionId, |
| | | hazardDesc: row.hazardDesc, |
| | | hazardLevel: row.hazardLevel, |
| | | hazardLocation: row.hazardLocation |
| | | }); |
| | | } |
| | | hazardFormVisible.value = true; |
| | | }; |
| | | |
| | | // æäº¤éæ£è¡¨å |
| | | const submitHazardForm = async () => { |
| | | try { |
| | | await hazardFormRef.value.validate(); |
| | | const api = hazardForm.value.id ? updateInspectionHazard : addInspectionHazard; |
| | | const res = await api({ ...hazardForm.value }); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æä½æå"); |
| | | hazardFormVisible.value = false; |
| | | fetchHazards(currentInspectionId.value); |
| | | } else { |
| | | ElMessage.error(res.msg || "æä½å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | console.error("表åéªè¯å¤±è´¥:", error); |
| | | } |
| | | }; |
| | | |
| | | // æ´æ¹ |
| | | const handleRectify = row => { |
| | | Object.assign(rectifyForm.value, { |
| | | id: row.id, |
| | | rectifyDesc: "" |
| | | }); |
| | | rectifyFormVisible.value = true; |
| | | }; |
| | | |
| | | // æäº¤æ´æ¹è¡¨å |
| | | const submitRectifyForm = async () => { |
| | | const res = await updateInspectionHazard({ |
| | | id: rectifyForm.value.id, |
| | | status: "å·²æ´æ¹", |
| | | rectifyDesc: rectifyForm.value.rectifyDesc |
| | | }); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ´æ¹æå"); |
| | | rectifyFormVisible.value = false; |
| | | fetchHazards(currentInspectionId.value); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ´æ¹å¤±è´¥"); |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .search_title { |
| | | font-size: 14px; |
| | | color: #606266; |
| | | } |
| | | |
| | | .mb10 { |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .mb20 { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 10px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-tabs v-model="activeTab" @tab-click="handleTabClick"> |
| | | <!-- å®å
¨è®¾æ½å°è´¦ --> |
| | | <el-tab-pane label="å®å
¨è®¾æ½å°è´¦" name="ledger"> |
| | | <div class="search_form mb20"> |
| | | <div> |
| | | <span class="search_title">设æ½ç¼å·ï¼</span> |
| | | <el-input v-model="ledgerSearchForm.facilityCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥è®¾æ½ç¼å·" |
| | | @change="handleLedgerQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title ml10">设æ½åç§°ï¼</span> |
| | | <el-input v-model="ledgerSearchForm.facilityName" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥è®¾æ½åç§°" |
| | | @change="handleLedgerQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title ml10">设æ½ç±»åï¼</span> |
| | | <el-select v-model="ledgerSearchForm.facilityType" |
| | | clearable |
| | | @change="handleLedgerQuery" |
| | | style="width: 150px"> |
| | | <el-option label="æ¶é²å¨æ" value="æ¶é²å¨æ" /> |
| | | <el-option label="å®å
¨è®¾å¤" value="å®å
¨è®¾å¤" /> |
| | | <el-option label="鲿¤ç¨å" value="鲿¤ç¨å" /> |
| | | <el-option label="çæ§è®¾å¤" value="çæ§è®¾å¤" /> |
| | | </el-select> |
| | | <span class="search_title ml10">ç¶æï¼</span> |
| | | <el-select v-model="ledgerSearchForm.status" |
| | | clearable |
| | | @change="handleLedgerQuery" |
| | | style="width: 120px"> |
| | | <el-option label="æ£å¸¸" value="æ£å¸¸" /> |
| | | <el-option label="å¼å¸¸" value="å¼å¸¸" /> |
| | | <el-option label="æ¥åº" value="æ¥åº" /> |
| | | </el-select> |
| | | <el-button type="primary" |
| | | @click="handleLedgerQuery" |
| | | style="margin-left: 10px"> |
| | | æç´¢ |
| | | </el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" |
| | | @click="openLedgerForm('add')">æ°å¢è®¾æ½</el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="ledgerTableColumn" |
| | | :tableData="ledgerTableData" |
| | | :page="ledgerPage" |
| | | :isSelection="true" |
| | | @selection-change="handleLedgerSelectionChange" |
| | | :tableLoading="ledgerTableLoading" |
| | | @pagination="ledgerPagination" |
| | | :total="ledgerPage.total"></PIMTable> |
| | | </div> |
| | | </el-tab-pane> |
| | | |
| | | <!-- å®å
¨è®¾æ½å·¡æ£ --> |
| | | <el-tab-pane label="å®å
¨è®¾æ½å·¡æ£" name="inspection"> |
| | | <div class="search_form mb20"> |
| | | <div> |
| | | <span class="search_title">å·¡æ£ç¼å·ï¼</span> |
| | | <el-input v-model="inspectionSearchForm.inspectionCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥å·¡æ£ç¼å·" |
| | | @change="handleInspectionQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title ml10">ç¶æï¼</span> |
| | | <el-select v-model="inspectionSearchForm.status" |
| | | clearable |
| | | @change="handleInspectionQuery" |
| | | style="width: 150px"> |
| | | <el-option label="å¾
å·¡æ£" value="å¾
å·¡æ£" /> |
| | | <el-option label="已巡æ£" value="已巡æ£" /> |
| | | </el-select> |
| | | <el-button type="primary" |
| | | @click="handleInspectionQuery" |
| | | style="margin-left: 10px"> |
| | | æç´¢ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="inspectionTableColumn" |
| | | :tableData="inspectionTableData" |
| | | :page="inspectionPage" |
| | | :isSelection="false" |
| | | :tableLoading="inspectionTableLoading" |
| | | @pagination="inspectionPagination" |
| | | :total="inspectionPage.total"></PIMTable> |
| | | </div> |
| | | </el-tab-pane> |
| | | |
| | | <!-- æ´æ¹è·è¸ª --> |
| | | <el-tab-pane label="æ´æ¹è·è¸ª" name="rectification"> |
| | | <div class="search_form mb20"> |
| | | <div> |
| | | <span class="search_title">ç¶æï¼</span> |
| | | <el-select v-model="rectificationSearchForm.status" |
| | | clearable |
| | | @change="handleRectificationQuery" |
| | | style="width: 150px"> |
| | | <el-option label="å¾
æ´æ¹" value="å¾
æ´æ¹" /> |
| | | <el-option label="æ´æ¹ä¸" value="æ´æ¹ä¸" /> |
| | | <el-option label="å·²æ´æ¹" value="å·²æ´æ¹" /> |
| | | <el-option label="å·²éªæ¶" value="å·²éªæ¶" /> |
| | | </el-select> |
| | | <el-button type="primary" |
| | | @click="handleRectificationQuery" |
| | | style="margin-left: 10px"> |
| | | æç´¢ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="rectificationTableColumn" |
| | | :tableData="rectificationTableData" |
| | | :page="rectificationPage" |
| | | :isSelection="false" |
| | | :tableLoading="rectificationTableLoading" |
| | | @pagination="rectificationPagination" |
| | | :total="rectificationPage.total"></PIMTable> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | |
| | | <!-- 设æ½å°è´¦è¡¨åå¼¹çª --> |
| | | <el-dialog v-model="ledgerDialogVisible" |
| | | :title="ledgerDialogTitle" |
| | | width="800px" |
| | | :close-on-click-modal="false"> |
| | | <el-form ref="ledgerFormRef" |
| | | :model="ledgerForm" |
| | | :rules="ledgerRules" |
| | | label-width="120px"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设æ½ç¼å·" |
| | | prop="facilityCode"> |
| | | <el-input v-model="ledgerForm.facilityCode" |
| | | placeholder="请è¾å
¥è®¾æ½ç¼å·" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设æ½åç§°" |
| | | prop="facilityName"> |
| | | <el-input v-model="ledgerForm.facilityName" |
| | | placeholder="请è¾å
¥è®¾æ½åç§°" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设æ½ç±»å" |
| | | prop="facilityType"> |
| | | <el-select v-model="ledgerForm.facilityType" |
| | | placeholder="è¯·éæ©è®¾æ½ç±»å" |
| | | style="width: 100%"> |
| | | <el-option label="æ¶é²å¨æ" value="æ¶é²å¨æ" /> |
| | | <el-option label="å®å
¨è®¾å¤" value="å®å
¨è®¾å¤" /> |
| | | <el-option label="鲿¤ç¨å" value="鲿¤ç¨å" /> |
| | | <el-option label="çæ§è®¾å¤" value="çæ§è®¾å¤" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è§æ ¼åå·" |
| | | prop="facilitySpec"> |
| | | <el-input v-model="ledgerForm.facilitySpec" |
| | | placeholder="请è¾å
¥è§æ ¼åå·" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å®è£
ä½ç½®" |
| | | prop="installLocation"> |
| | | <el-input v-model="ledgerForm.installLocation" |
| | | placeholder="请è¾å
¥å®è£
ä½ç½®" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å®è£
æ¶é´" |
| | | prop="installTime"> |
| | | <el-date-picker v-model="ledgerForm.installTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©å®è£
æ¶é´" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="çäº§æ¥æ" |
| | | prop="productionDate"> |
| | | <el-date-picker v-model="ledgerForm.productionDate" |
| | | type="date" |
| | | placeholder="è¯·éæ©çäº§æ¥æ" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 100%" /> |
| | | </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="ç¶æ" |
| | | prop="status"> |
| | | <el-select v-model="ledgerForm.status" |
| | | placeholder="è¯·éæ©ç¶æ" |
| | | style="width: 100%"> |
| | | <el-option label="æ£å¸¸" value="æ£å¸¸" /> |
| | | <el-option label="å¼å¸¸" value="å¼å¸¸" /> |
| | | <el-option label="æ¥åº" value="æ¥åº" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-form-item label="夿³¨" |
| | | prop="remark"> |
| | | <el-input v-model="ledgerForm.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="submitLedgerForm">ç¡®å®</el-button> |
| | | <el-button @click="ledgerDialogVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- å·¡æ£è¡¨åå¼¹çª --> |
| | | <el-dialog v-model="inspectionDialogVisible" |
| | | :title="inspectionDialogTitle" |
| | | width="600px" |
| | | :close-on-click-modal="false"> |
| | | <el-form ref="inspectionFormRef" |
| | | :model="inspectionForm" |
| | | :rules="inspectionRules" |
| | | label-width="120px"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¡æ£ç¼å·" |
| | | prop="inspectionCode"> |
| | | <el-input v-model="inspectionForm.inspectionCode" |
| | | placeholder="请è¾å
¥å·¡æ£ç¼å·" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¡æ£ç±»å" |
| | | prop="inspectionType"> |
| | | <el-select v-model="inspectionForm.inspectionType" |
| | | placeholder="è¯·éæ©å·¡æ£ç±»å" |
| | | style="width: 100%"> |
| | | <el-option label="宿巡æ£" value="宿巡æ£" /> |
| | | <el-option label="临æ¶å·¡æ£" value="临æ¶å·¡æ£" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-form-item label="计åå·¡æ£æ¶é´" |
| | | prop="planTime"> |
| | | <el-date-picker v-model="inspectionForm.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 v-if="inspectionDialogTitle === 'å·¡æ£'"> |
| | | <el-form-item label="æ£æ¥ç»æ" |
| | | prop="checkResult"> |
| | | <el-radio-group v-model="inspectionForm.checkResult"> |
| | | <el-radio label="æ£å¸¸">æ£å¸¸</el-radio> |
| | | <el-radio label="å¼å¸¸">å¼å¸¸</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="æ£æ¥è¯´æ"> |
| | | <el-input v-model="inspectionForm.checkDesc" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥æ£æ¥è¯´æ" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="submitInspectionForm">ç¡®å®</el-button> |
| | | <el-button @click="inspectionDialogVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- æ´æ¹è¡¨åå¼¹çª --> |
| | | <el-dialog v-model="rectificationDialogVisible" |
| | | :title="rectificationDialogTitle" |
| | | width="600px" |
| | | :close-on-click-modal="false"> |
| | | <el-form ref="rectificationFormRef" |
| | | :model="rectificationForm" |
| | | label-width="120px"> |
| | | <template v-if="rectificationDialogTitle !== 'éªæ¶'"> |
| | | <el-form-item label="é®é¢æè¿°"> |
| | | <el-input v-model="rectificationForm.problemDesc" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥é®é¢æè¿°" /> |
| | | </el-form-item> |
| | | <el-form-item label="é®é¢ç级"> |
| | | <el-select v-model="rectificationForm.problemLevel" |
| | | placeholder="è¯·éæ©é®é¢ç级" |
| | | style="width: 100%"> |
| | | <el-option label="ä¸è¬" value="ä¸è¬" /> |
| | | <el-option label="é大" value="é大" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </template> |
| | | <el-form-item label="æ´æ¹è¯´æ" v-if="rectificationDialogTitle === 'æ´æ¹'"> |
| | | <el-input v-model="rectificationForm.rectifyDesc" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥æ´æ¹è¯´æ" /> |
| | | </el-form-item> |
| | | <el-form-item label="éªæ¶è¯´æ" v-if="rectificationDialogTitle === 'éªæ¶'"> |
| | | <el-input v-model="rectificationForm.verifyDesc" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥éªæ¶è¯´æ" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="submitRectificationForm">ç¡®å®</el-button> |
| | | <el-button @click="rectificationDialogVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { onMounted, ref, reactive, toRefs } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { |
| | | getFacilityLedgerList, |
| | | addFacilityLedger, |
| | | updateFacilityLedger, |
| | | deleteFacilityLedger, |
| | | getFacilityInspectionList, |
| | | addFacilityInspection, |
| | | updateFacilityInspection, |
| | | deleteFacilityInspection, |
| | | getFacilityRectificationList, |
| | | addFacilityRectification, |
| | | updateFacilityRectification |
| | | } from "@/api/safeProduction/safetyFacility"; |
| | | |
| | | // 表åéªè¯è§å |
| | | const ledgerRules = { |
| | | facilityCode: [{ required: true, message: "请è¾å
¥è®¾æ½ç¼å·", trigger: "blur" }], |
| | | facilityName: [{ required: true, message: "请è¾å
¥è®¾æ½åç§°", trigger: "blur" }], |
| | | facilityType: [{ required: true, message: "è¯·éæ©è®¾æ½ç±»å", trigger: "change" }], |
| | | installLocation: [{ required: true, message: "请è¾å
¥å®è£
ä½ç½®", trigger: "blur" }] |
| | | }; |
| | | |
| | | const inspectionRules = { |
| | | inspectionCode: [{ required: true, message: "请è¾å
¥å·¡æ£ç¼å·", trigger: "blur" }] |
| | | }; |
| | | |
| | | // ååºå¼æ°æ® |
| | | const data = reactive({ |
| | | activeTab: "ledger", |
| | | // 设æ½å°è´¦ |
| | | ledgerSearchForm: { facilityCode: "", facilityName: "", facilityType: "", status: "" }, |
| | | ledgerTableLoading: false, |
| | | ledgerPage: { current: 1, size: 20, total: 0 }, |
| | | ledgerTableData: [], |
| | | ledgerSelectedIds: [], |
| | | ledgerForm: { |
| | | id: null, facilityCode: "", facilityName: "", facilityType: "", facilitySpec: "", |
| | | installLocation: "", installTime: "", productionDate: "", validPeriod: null, |
| | | status: "æ£å¸¸", remark: "" |
| | | }, |
| | | ledgerDialogVisible: false, |
| | | ledgerDialogTitle: "", |
| | | ledgerDialogType: "add", |
| | | // å·¡æ£è®°å½ |
| | | inspectionSearchForm: { inspectionCode: "", status: "" }, |
| | | inspectionTableLoading: false, |
| | | inspectionPage: { current: 1, size: 20, total: 0 }, |
| | | inspectionTableData: [], |
| | | inspectionForm: { |
| | | id: null, facilityId: null, inspectionCode: "", inspectionType: "宿巡æ£", |
| | | planTime: "", checkResult: "", checkDesc: "" |
| | | }, |
| | | inspectionDialogVisible: false, |
| | | inspectionDialogTitle: "", |
| | | inspectionDialogType: "add", |
| | | // æ´æ¹è·è¸ª |
| | | rectificationSearchForm: { status: "" }, |
| | | rectificationTableLoading: false, |
| | | rectificationPage: { current: 1, size: 20, total: 0 }, |
| | | rectificationTableData: [], |
| | | rectificationForm: { |
| | | id: null, inspectionId: null, facilityId: null, problemDesc: "", |
| | | problemLevel: "", rectifyDesc: "", verifyDesc: "" |
| | | }, |
| | | rectificationDialogVisible: false, |
| | | rectificationDialogTitle: "", |
| | | rectificationDialogType: "add" |
| | | }); |
| | | |
| | | const { |
| | | activeTab, |
| | | ledgerSearchForm, ledgerTableLoading, ledgerPage, ledgerTableData, ledgerSelectedIds, |
| | | ledgerForm, ledgerDialogVisible, ledgerDialogTitle, ledgerDialogType, |
| | | inspectionSearchForm, inspectionTableLoading, inspectionPage, inspectionTableData, |
| | | inspectionForm, inspectionDialogVisible, inspectionDialogTitle, inspectionDialogType, |
| | | rectificationSearchForm, rectificationTableLoading, rectificationPage, rectificationTableData, |
| | | rectificationForm, rectificationDialogVisible, rectificationDialogTitle, rectificationDialogType |
| | | } = toRefs(data); |
| | | |
| | | // 表åå¼ç¨ |
| | | const ledgerFormRef = ref(); |
| | | const inspectionFormRef = ref(); |
| | | const rectificationFormRef = ref(); |
| | | |
| | | // 设æ½å°è´¦è¡¨æ ¼åé
ç½® |
| | | const ledgerTableColumn = ref([ |
| | | { label: "设æ½ç¼å·", prop: "facilityCode", showOverflowTooltip: true, minWidth: 120 }, |
| | | { label: "设æ½åç§°", prop: "facilityName", showOverflowTooltip: true, minWidth: 150 }, |
| | | { label: "设æ½ç±»å", prop: "facilityType", showOverflowTooltip: true, minWidth: 100 }, |
| | | { label: "è§æ ¼åå·", prop: "facilitySpec", showOverflowTooltip: true, minWidth: 120 }, |
| | | { label: "å®è£
ä½ç½®", prop: "installLocation", showOverflowTooltip: true, minWidth: 150 }, |
| | | { label: "å®è£
æ¶é´", prop: "installTime", minWidth: 120 }, |
| | | { label: "䏿¬¡æ£æ¥æ¶é´", prop: "nextCheckTime", minWidth: 120 }, |
| | | { |
| | | label: "ç¶æ", prop: "status", minWidth: 80, dataType: "tag", |
| | | formatType: params => { |
| | | const map = { æ£å¸¸: "success", å¼å¸¸: "danger", æ¥åº: "info" }; |
| | | return map[params] || "info"; |
| | | } |
| | | }, |
| | | { |
| | | dataType: "action", label: "æä½", align: "center", fixed: "right", width: 200, |
| | | operation: [ |
| | | { name: "ç¼è¾", type: "text", clickFun: row => openLedgerForm("edit", row) }, |
| | | { name: "åèµ·å·¡æ£", type: "text", clickFun: row => openInspectionForm("add", row) }, |
| | | { name: "å é¤", type: "text", style: { color: "#F56C6C" }, clickFun: row => handleDeleteLedger(row) } |
| | | ] |
| | | } |
| | | ]); |
| | | |
| | | // å·¡æ£è®°å½è¡¨æ ¼åé
ç½® |
| | | const inspectionTableColumn = ref([ |
| | | { label: "å·¡æ£ç¼å·", prop: "inspectionCode", showOverflowTooltip: true, minWidth: 150 }, |
| | | { label: "设æ½åç§°", prop: "facilityName", showOverflowTooltip: true, minWidth: 150 }, |
| | | { label: "设æ½ç¼å·", prop: "facilityCode", showOverflowTooltip: true, minWidth: 120 }, |
| | | { label: "å·¡æ£ç±»å", prop: "inspectionType", minWidth: 100 }, |
| | | { label: "计åå·¡æ£æ¶é´", prop: "planTime", minWidth: 180 }, |
| | | { label: "å·¡æ£äºº", prop: "inspectorName", minWidth: 100 }, |
| | | { label: "å®é
å·¡æ£æ¶é´", prop: "actualTime", minWidth: 180 }, |
| | | { |
| | | label: "æ£æ¥ç»æ", prop: "checkResult", minWidth: 100, dataType: "tag", |
| | | formatType: params => params === "æ£å¸¸" ? "success" : "danger" |
| | | }, |
| | | { |
| | | label: "ç¶æ", prop: "status", minWidth: 100, dataType: "tag", |
| | | formatType: params => params === "å¾
å·¡æ£" ? "info" : "success" |
| | | }, |
| | | { |
| | | dataType: "action", label: "æä½", align: "center", fixed: "right", width: 200, |
| | | operation: [ |
| | | { |
| | | name: "å·¡æ£", type: "text", |
| | | clickFun: row => openInspectionForm("do", row), |
| | | show: row => row.status === "å¾
å·¡æ£" |
| | | }, |
| | | { |
| | | name: "æ¥ç", type: "text", |
| | | clickFun: row => openInspectionForm("view", row), |
| | | show: row => row.status !== "å¾
å·¡æ£" |
| | | }, |
| | | { |
| | | name: "æ´æ¹", type: "text", |
| | | clickFun: row => openRectificationForm("add", row), |
| | | show: row => row.checkResult === "å¼å¸¸" |
| | | }, |
| | | { name: "å é¤", type: "text", style: { color: "#F56C6C" }, clickFun: row => handleDeleteInspection(row) } |
| | | ] |
| | | } |
| | | ]); |
| | | |
| | | // æ´æ¹è·è¸ªè¡¨æ ¼åé
ç½® |
| | | const rectificationTableColumn = ref([ |
| | | { label: "设æ½åç§°", prop: "facilityName", showOverflowTooltip: true, minWidth: 150 }, |
| | | { label: "é®é¢æè¿°", prop: "problemDesc", showOverflowTooltip: true, minWidth: 200 }, |
| | | { |
| | | label: "é®é¢ç级", prop: "problemLevel", minWidth: 100, dataType: "tag", |
| | | formatType: params => params === "é大" ? "danger" : "warning" |
| | | }, |
| | | { label: "æ´æ¹è´£ä»»äºº", prop: "rectifyUserName", minWidth: 120 }, |
| | | { label: "è®¡åæ´æ¹æ¶é´", prop: "planTime", minWidth: 180 }, |
| | | { |
| | | label: "ç¶æ", prop: "status", minWidth: 100, dataType: "tag", |
| | | formatType: params => { |
| | | const map = { å¾
æ´æ¹: "danger", æ´æ¹ä¸: "warning", å·²æ´æ¹: "success", å·²éªæ¶: "info" }; |
| | | return map[params] || "info"; |
| | | } |
| | | }, |
| | | { label: "éªæ¶äºº", prop: "verifyUserName", minWidth: 120 }, |
| | | { |
| | | dataType: "action", label: "æä½", align: "center", fixed: "right", width: 200, |
| | | operation: [ |
| | | { |
| | | name: "æ´æ¹", type: "text", |
| | | clickFun: row => openRectificationForm("do", row), |
| | | show: row => row.status === "å¾
æ´æ¹" || row.status === "æ´æ¹ä¸" |
| | | }, |
| | | { |
| | | name: "éªæ¶", type: "text", |
| | | clickFun: row => openRectificationForm("verify", row), |
| | | show: row => row.status === "å·²æ´æ¹" |
| | | }, |
| | | { name: "æ¥ç", type: "text", clickFun: row => openRectificationForm("view", row) } |
| | | ] |
| | | } |
| | | ]); |
| | | |
| | | // çå½å¨æ |
| | | onMounted(() => { |
| | | getLedgerList(); |
| | | }); |
| | | |
| | | // æ ç¾é¡µåæ¢ |
| | | const handleTabClick = () => { |
| | | if (activeTab.value === "ledger") getLedgerList(); |
| | | else if (activeTab.value === "inspection") getInspectionList(); |
| | | else if (activeTab.value === "rectification") getRectificationList(); |
| | | }; |
| | | |
| | | // ============ 设æ½å°è´¦æ¹æ³ ============ |
| | | |
| | | const handleLedgerQuery = () => { |
| | | ledgerPage.value.current = 1; |
| | | getLedgerList(); |
| | | }; |
| | | |
| | | const getLedgerList = () => { |
| | | ledgerTableLoading.value = true; |
| | | getFacilityLedgerList({ ...ledgerPage.value, ...ledgerSearchForm.value }) |
| | | .then(res => { |
| | | ledgerTableLoading.value = false; |
| | | ledgerTableData.value = res.data.records; |
| | | ledgerPage.value.total = res.data.total; |
| | | }) |
| | | .catch(() => { ledgerTableLoading.value = false; }); |
| | | }; |
| | | |
| | | const ledgerPagination = obj => { |
| | | ledgerPage.value.current = obj.page; |
| | | ledgerPage.value.size = obj.limit; |
| | | getLedgerList(); |
| | | }; |
| | | |
| | | const handleLedgerSelectionChange = selection => { |
| | | ledgerSelectedIds.value = selection.map(item => item.id); |
| | | }; |
| | | |
| | | 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, |
| | | status: "æ£å¸¸", remark: "" |
| | | }); |
| | | } else { |
| | | ledgerDialogTitle.value = "ç¼è¾è®¾æ½"; |
| | | Object.assign(ledgerForm.value, { ...row }); |
| | | } |
| | | ledgerDialogVisible.value = true; |
| | | }; |
| | | |
| | | const submitLedgerForm = async () => { |
| | | try { |
| | | await ledgerFormRef.value.validate(); |
| | | 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(); |
| | | } else { |
| | | ElMessage.error(res.msg || "æä½å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | console.error("表åéªè¯å¤±è´¥:", error); |
| | | } |
| | | }; |
| | | |
| | | const handleDeleteLedger = row => { |
| | | ElMessageBox.confirm("确认å é¤è¯¥è®¾æ½åï¼", "å é¤", { |
| | | confirmButtonText: "确认", cancelButtonText: "åæ¶", type: "warning" |
| | | }).then(async () => { |
| | | const res = await deleteFacilityLedger([row.id]); |
| | | if (res.code === 200) { |
| | | ElMessage.success("å 餿å"); |
| | | getLedgerList(); |
| | | } |
| | | }).catch(() => {}); |
| | | }; |
| | | |
| | | // ============ å·¡æ£è®°å½æ¹æ³ ============ |
| | | |
| | | const handleInspectionQuery = () => { |
| | | inspectionPage.value.current = 1; |
| | | getInspectionList(); |
| | | }; |
| | | |
| | | const getInspectionList = () => { |
| | | inspectionTableLoading.value = true; |
| | | getFacilityInspectionList({ ...inspectionPage.value, ...inspectionSearchForm.value }) |
| | | .then(res => { |
| | | inspectionTableLoading.value = false; |
| | | inspectionTableData.value = res.data.records; |
| | | inspectionPage.value.total = res.data.total; |
| | | }) |
| | | .catch(() => { inspectionTableLoading.value = false; }); |
| | | }; |
| | | |
| | | const inspectionPagination = obj => { |
| | | inspectionPage.value.current = obj.page; |
| | | inspectionPage.value.size = obj.limit; |
| | | getInspectionList(); |
| | | }; |
| | | |
| | | const openInspectionForm = (type, row = null) => { |
| | | inspectionDialogType.value = type; |
| | | if (type === "add") { |
| | | inspectionDialogTitle.value = "åèµ·å·¡æ£"; |
| | | Object.assign(inspectionForm.value, { |
| | | id: null, facilityId: row.id, inspectionCode: "", inspectionType: "宿巡æ£", |
| | | planTime: "", checkResult: "", checkDesc: "" |
| | | }); |
| | | } else if (type === "do") { |
| | | inspectionDialogTitle.value = "å·¡æ£"; |
| | | Object.assign(inspectionForm.value, { |
| | | id: row.id, facilityId: row.facilityId, inspectionCode: row.inspectionCode, |
| | | inspectionType: row.inspectionType, planTime: row.planTime, checkResult: "", checkDesc: "" |
| | | }); |
| | | } else { |
| | | inspectionDialogTitle.value = "æ¥çå·¡æ£"; |
| | | Object.assign(inspectionForm.value, { ...row }); |
| | | } |
| | | inspectionDialogVisible.value = true; |
| | | }; |
| | | |
| | | const submitInspectionForm = async () => { |
| | | try { |
| | | await inspectionFormRef.value.validate(); |
| | | if (inspectionDialogTitle.value === "å·¡æ£") { |
| | | inspectionForm.value.status = "已巡æ£"; |
| | | inspectionForm.value.actualTime = new Date().toISOString().replace("T", " ").substring(0, 19); |
| | | } |
| | | const api = inspectionForm.value.id ? updateFacilityInspection : addFacilityInspection; |
| | | const res = await api({ ...inspectionForm.value }); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æä½æå"); |
| | | inspectionDialogVisible.value = false; |
| | | getInspectionList(); |
| | | } |
| | | } catch (error) { |
| | | console.error("表åéªè¯å¤±è´¥:", error); |
| | | } |
| | | }; |
| | | |
| | | const handleDeleteInspection = row => { |
| | | ElMessageBox.confirm("确认å é¤è¯¥å·¡æ£è®°å½åï¼", "å é¤", { |
| | | confirmButtonText: "确认", cancelButtonText: "åæ¶", type: "warning" |
| | | }).then(async () => { |
| | | const res = await deleteFacilityInspection([row.id]); |
| | | if (res.code === 200) { |
| | | ElMessage.success("å 餿å"); |
| | | getInspectionList(); |
| | | } |
| | | }).catch(() => {}); |
| | | }; |
| | | |
| | | // ============ æ´æ¹è·è¸ªæ¹æ³ ============ |
| | | |
| | | const handleRectificationQuery = () => { |
| | | rectificationPage.value.current = 1; |
| | | getRectificationList(); |
| | | }; |
| | | |
| | | const getRectificationList = () => { |
| | | rectificationTableLoading.value = true; |
| | | getFacilityRectificationList({ ...rectificationPage.value, ...rectificationSearchForm.value }) |
| | | .then(res => { |
| | | rectificationTableLoading.value = false; |
| | | rectificationTableData.value = res.data.records; |
| | | rectificationPage.value.total = res.data.total; |
| | | }) |
| | | .catch(() => { rectificationTableLoading.value = false; }); |
| | | }; |
| | | |
| | | const rectificationPagination = obj => { |
| | | rectificationPage.value.current = obj.page; |
| | | rectificationPage.value.size = obj.limit; |
| | | getRectificationList(); |
| | | }; |
| | | |
| | | const openRectificationForm = (type, row = null) => { |
| | | rectificationDialogType.value = type; |
| | | if (type === "add") { |
| | | rectificationDialogTitle.value = "æ°å¢æ´æ¹"; |
| | | Object.assign(rectificationForm.value, { |
| | | id: null, inspectionId: row.id, facilityId: row.facilityId, |
| | | problemDesc: "", problemLevel: "", 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: "" |
| | | }); |
| | | } else if (type === "verify") { |
| | | rectificationDialogTitle.value = "éªæ¶"; |
| | | Object.assign(rectificationForm.value, { |
| | | id: row.id, inspectionId: row.inspectionId, facilityId: row.facilityId, |
| | | problemDesc: row.problemDesc, problemLevel: row.problemLevel, |
| | | rectifyDesc: row.rectifyDesc, verifyDesc: "" |
| | | }); |
| | | } else { |
| | | rectificationDialogTitle.value = "æ¥çæ´æ¹"; |
| | | Object.assign(rectificationForm.value, { ...row }); |
| | | } |
| | | rectificationDialogVisible.value = true; |
| | | }; |
| | | |
| | | const submitRectificationForm = async () => { |
| | | if (rectificationDialogType.value === "view") { |
| | | rectificationDialogVisible.value = false; |
| | | return; |
| | | } |
| | | if (rectificationDialogTitle.value === "æ´æ¹") { |
| | | rectificationForm.value.status = "å·²æ´æ¹"; |
| | | rectificationForm.value.actualTime = new Date().toISOString().replace("T", " ").substring(0, 19); |
| | | } else if (rectificationDialogTitle.value === "éªæ¶") { |
| | | rectificationForm.value.status = "å·²éªæ¶"; |
| | | rectificationForm.value.verifyTime = new Date().toISOString().replace("T", " ").substring(0, 19); |
| | | } |
| | | const api = rectificationForm.value.id ? updateFacilityRectification : addFacilityRectification; |
| | | const res = await api({ ...rectificationForm.value }); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æä½æå"); |
| | | rectificationDialogVisible.value = false; |
| | | getRectificationList(); |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .search_title { |
| | | font-size: 14px; |
| | | color: #606266; |
| | | } |
| | | |
| | | .mb20 { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 10px; |
| | | } |
| | | </style> |