From a7a9f53ef126659f664f5cbfe4eb10bebdfc4a6a Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 19 五月 2026 23:33:56 +0800
Subject: [PATCH] feat: 设备巡检修改
---
src/api/inspectionManagement/index.js | 9
src/views/equipmentManagement/inspectionManagement/components/formDia.vue | 31 +
src/views/equipmentManagement/inspectionManagement/index.vue | 796 +++++++++++++++++++----------------
src/views/equipmentManagement/inspectionManagement/components/viewFiles.vue | 467 +++++++++++----------
4 files changed, 704 insertions(+), 599 deletions(-)
diff --git a/src/api/inspectionManagement/index.js b/src/api/inspectionManagement/index.js
index d0c444a..a92a409 100644
--- a/src/api/inspectionManagement/index.js
+++ b/src/api/inspectionManagement/index.js
@@ -25,6 +25,15 @@
data: query
})
}
+// 宸℃楠屾敹
+export function acceptInspectionTask(data) {
+ return request({
+ url: `/inspectionTask/accept`,
+ method: 'post',
+ data: data
+ })
+}
+
// 瀹氭椂宸℃浠诲姟琛ㄥ垹闄�
export function delTimingTask(query) {
return request({
diff --git a/src/views/equipmentManagement/inspectionManagement/components/formDia.vue b/src/views/equipmentManagement/inspectionManagement/components/formDia.vue
index 264584f..722c7a1 100644
--- a/src/views/equipmentManagement/inspectionManagement/components/formDia.vue
+++ b/src/views/equipmentManagement/inspectionManagement/components/formDia.vue
@@ -23,6 +23,13 @@
</el-select>
</el-form-item>
</el-col>
+ <el-col :span="12">
+ <el-form-item label="宸℃楠屾敹浜�" prop="inspectionAcceptor">
+ <el-select v-model="form.inspectionAcceptor" placeholder="璇烽�夋嫨" clearable>
+ <el-option v-for="item in userList" :label="item.nickName" :value="item.userId" :key="item.userId"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
</el-row>
<el-row>
<el-col :span="12">
@@ -129,6 +136,8 @@
taskName: undefined,
inspector: '',
inspectorIds: '',
+ inspectionAcceptor: undefined,
+ inspectionAcceptorId: undefined,
remarks: '',
frequencyType: '',
frequencyDetail: '',
@@ -139,6 +148,7 @@
rules: {
taskId: [{ required: true, message: "璇烽�夋嫨璁惧", trigger: "change" },],
inspector: [{ required: true, message: "璇疯緭鍏ュ贰妫�浜�", trigger: "blur" },],
+ inspectionAcceptor: [{ required: true, message: "璇烽�夋嫨宸℃楠屾敹浜�", trigger: "change" },],
dateStr: [{ required: true, message: "璇烽�夋嫨鐧昏鏃堕棿", trigger: "change" }],
frequencyType: [{ required: true, message: "璇烽�夋嫨浠诲姟棰戠巼", trigger: "change" }],
frequencyDetail: [
@@ -239,6 +249,10 @@
} else {
form.value.inspector = []
}
+ // 纭繚楠屾敹鍏D鍜屽鍚嶆纭洖鏄�
+ if (form.value.inspectionAcceptorId) {
+ form.value.inspectionAcceptor = form.value.inspectionAcceptorId
+ }
// 纭繚 isActive 鏈夊�硷紝榛樿鍚敤
if (form.value.isActive === undefined || form.value.isActive === null) {
form.value.isActive = 1
@@ -283,6 +297,8 @@
taskName: undefined,
inspector: '',
inspectorIds: '',
+ inspectionAcceptor: undefined,
+ inspectionAcceptorId: undefined,
remarks: '',
frequencyType: '',
frequencyDetail: '',
@@ -302,16 +318,25 @@
form.value.inspectorIds = form.value.inspector.join(',')
delete form.value.inspector
}
-
+
+ // 澶勭悊楠屾敹鍏�
+ if (form.value.inspectionAcceptor) {
+ const selectedUser = userList.value.find(u => u.userId === form.value.inspectionAcceptor)
+ if (selectedUser) {
+ form.value.inspectionAcceptorId = form.value.inspectionAcceptor
+ form.value.inspectionAcceptor = selectedUser.nickName
+ }
+ }
+
if (form.value.frequencyType === 'WEEKLY') {
let frequencyDetail = ''
frequencyDetail = form.value.week + ',' + form.value.time
form.value.frequencyDetail = frequencyDetail
}
-
+
let res = await userStore.getInfo()
form.value.registrantId = res.user.userId
-
+
await addOrEditTimingTask(form.value)
cancel()
proxy.$modal.msgSuccess('鎻愪氦鎴愬姛')
diff --git a/src/views/equipmentManagement/inspectionManagement/components/viewFiles.vue b/src/views/equipmentManagement/inspectionManagement/components/viewFiles.vue
index ba9a120..fa72f01 100644
--- a/src/views/equipmentManagement/inspectionManagement/components/viewFiles.vue
+++ b/src/views/equipmentManagement/inspectionManagement/components/viewFiles.vue
@@ -1,279 +1,242 @@
<template>
<div>
- <el-dialog title="鏌ョ湅闄勪欢"
- v-model="dialogVisitable" width="800px" @close="cancel">
- <div class="upload-container">
- <!-- 鐢熶骇鍓� -->
- <div class="form-container">
- <div class="title">鐢熶骇鍓�</div>
-
- <!-- 鍥剧墖鍒楄〃 -->
- <div style="display: flex; flex-wrap: wrap;">
- <img v-for="(item, index) in beforeProductionImgs" :key="index"
- @click="showMedia(beforeProductionImgs, index, 'image')"
- :src="item" style="max-width: 100px; height: 100px; margin: 5px;" alt="">
- </div>
-
- <!-- 瑙嗛鍒楄〃 -->
- <div style="display: flex; flex-wrap: wrap;">
- <div
- v-for="(videoUrl, index) in beforeProductionVideos"
- :key="index"
- @click="showMedia(beforeProductionVideos, index, 'video')"
- style="position: relative; margin: 10px; cursor: pointer;"
- >
- <div style="width: 160px; height: 90px; background-color: #333; display: flex; align-items: center; justify-content: center;">
- <img src="@/assets/images/video.png" alt="鎾斁" style="width: 30px; height: 30px; opacity: 0.8;" />
- </div>
- <div style="text-align: center; font-size: 12px; color: #666;">鐐瑰嚮鎾斁</div>
- </div>
+ <el-dialog title="宸℃璇︽儏"
+ v-model="dialogVisitable" width="700px" @close="cancel">
+ <div class="detail-container">
+ <!-- 鍩烘湰淇℃伅 -->
+ <div class="info-section">
+ <div class="section-title">鍩烘湰淇℃伅</div>
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="璁惧鍚嶇О">{{ rowData.taskName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="宸℃鍦扮偣">{{ rowData.inspectionLocation || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鎵ц宸℃浜�">{{ rowData.inspector || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="宸℃鏃堕棿">{{ rowData.dateStr || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="宸℃鐘舵��">
+ <el-tag v-if="rowData.inspectionStatus === 1" type="success" size="small">姝e父</el-tag>
+ <el-tag v-else-if="rowData.inspectionStatus === 2" type="danger" size="small">寮傚父</el-tag>
+ <el-tag v-else size="small">鏈贰妫�</el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="鐧昏浜�">{{ rowData.registrant || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="楠屾敹鐘舵��">
+ <el-tag v-if="rowData.acceptStatus === 1" type="success" size="small">宸查�氳繃</el-tag>
+ <el-tag v-else-if="rowData.acceptStatus === 2" type="danger" size="small">宸查��鍥�</el-tag>
+ <el-tag v-else-if="rowData.inspectionStatus > 0" type="warning" size="small">寰呴獙鏀�</el-tag>
+ <span v-else>--</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="楠屾敹浜�">{{ rowData.inspectionAcceptor || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ </div>
+
+ <!-- 寮傚父鎻忚堪 -->
+ <div v-if="rowData.inspectionStatus === 2" class="info-section">
+ <div class="section-title">寮傚父鎻忚堪</div>
+ <div class="exception-content">
+ {{ rowData.inspectionRemark || '鏃�' }}
</div>
</div>
-
- <!-- 鐢熶骇鍚� -->
- <div class="form-container">
- <div class="title">鐢熶骇鍚�</div>
-
- <!-- 鍥剧墖鍒楄〃 -->
- <div style="display: flex; flex-wrap: wrap;">
- <img v-for="(item, index) in afterProductionImgs" :key="index"
- @click="showMedia(afterProductionImgs, index, 'image')"
- :src="item" style="max-width: 100px; height: 100px; margin: 5px;" alt="">
- </div>
-
- <!-- 瑙嗛鍒楄〃 -->
- <div style="display: flex; flex-wrap: wrap;">
- <div
- v-for="(videoUrl, index) in afterProductionVideos"
- :key="index"
- @click="showMedia(afterProductionVideos, index, 'video')"
- style="position: relative; margin: 10px; cursor: pointer;"
- >
- <div style="width: 160px; height: 90px; background-color: #333; display: flex; align-items: center; justify-content: center;">
- <img src="@/assets/images/video.png" alt="鎾斁" style="width: 30px; height: 30px; opacity: 0.8;" />
+
+ <!-- 闄勪欢鍒楄〃 -->
+ <div class="info-section">
+ <div class="section-title">闄勪欢 ({{ attachmentList.length }}涓�)</div>
+ <div v-if="attachmentList.length > 0" class="attachment-list">
+ <div v-for="(file, index) in attachmentList" :key="index" class="attachment-item">
+ <div class="attachment-preview" @click="previewFile(file, index)">
+ <img v-if="isImage(file)" :src="getFileUrl(file)" alt="闄勪欢" />
+ <video v-else-if="isVideo(file)" :src="getFileUrl(file)"></video>
+ <div v-else class="file-icon">
+ <i class="el-icon-document"></i>
+ </div>
</div>
- <div style="text-align: center; font-size: 12px; color: #666;">鐐瑰嚮鎾斁</div>
+ <div class="attachment-info">
+ <span class="file-name">{{ file.originalFilename || file.name || '闄勪欢' }}</span>
+ </div>
</div>
</div>
- </div>
-
- <!-- 鐢熶骇闂 -->
- <div class="form-container">
- <div class="title">鐢熶骇闂</div>
-
- <!-- 鍥剧墖鍒楄〃 -->
- <div style="display: flex; flex-wrap: wrap;">
- <img v-for="(item, index) in productionIssuesImgs" :key="index"
- @click="showMedia(productionIssuesImgs, index, 'image')"
- :src="item" style="max-width: 100px; height: 100px; margin: 5px;" alt="">
- </div>
-
- <!-- 瑙嗛鍒楄〃 -->
- <div style="display: flex; flex-wrap: wrap;">
- <div
- v-for="(videoUrl, index) in productionIssuesVideos"
- :key="index"
- @click="showMedia(productionIssuesVideos, index, 'video')"
- style="position: relative; margin: 10px; cursor: pointer;"
- >
- <div style="width: 160px; height: 90px; background-color: #333; display: flex; align-items: center; justify-content: center;">
- <img src="@/assets/images/video.png" alt="鎾斁" style="width: 30px; height: 30px; opacity: 0.8;" />
- </div>
- <div style="text-align: center; font-size: 12px; color: #666;">鐐瑰嚮鎾斁</div>
- </div>
+ <div v-else class="empty-attachment">
+ 鏆傛棤闄勪欢
</div>
</div>
</div>
+
+ <template #footer>
+ <el-button @click="cancel">鍏抽棴</el-button>
+ </template>
</el-dialog>
-
- <!-- 缁熶竴濯掍綋鏌ョ湅鍣� -->
- <div v-if="isMediaViewerVisible" class="media-viewer-overlay" @click.self="closeMediaViewer">
- <div class="media-viewer-content" @click.stop>
- <!-- 鍥剧墖 -->
- <vue-easy-lightbox
- v-if="mediaType === 'image'"
- :visible="isMediaViewerVisible"
- :imgs="mediaList"
- :index="currentMediaIndex"
- @hide="closeMediaViewer"
- ></vue-easy-lightbox>
-
- <!-- 瑙嗛 -->
- <div v-else-if="mediaType === 'video'" style="position: relative;">
- <video
- :src="mediaList[currentMediaIndex]"
- autoplay
- controls
- style="max-width: 90vw; max-height: 80vh;"
- />
- </div>
- </div>
- </div>
+
+ <!-- 鍥剧墖棰勮 -->
+ <vue-easy-lightbox
+ v-if="showLightbox"
+ :visible="showLightbox"
+ :imgs="previewImages"
+ :index="previewIndex"
+ @hide="closeLightbox"
+ ></vue-easy-lightbox>
+
+ <!-- 瑙嗛棰勮 -->
+ <el-dialog v-if="showVideoDialog" v-model="showVideoDialog" title="瑙嗛棰勮" width="800px" append-to-body>
+ <video
+ ref="videoPlayer"
+ :src="videoUrl"
+ controls
+ autoplay
+ style="width: 100%; max-height: 60vh;"
+ ></video>
+ </el-dialog>
</div>
</template>
+
<script setup>
-import { ref } from 'vue';
+import { ref, getCurrentInstance } from 'vue';
import VueEasyLightbox from 'vue-easy-lightbox';
+
const { proxy } = getCurrentInstance();
// 鎺у埗寮圭獥鏄剧ず
const dialogVisitable = ref(false);
-// 鍥剧墖鏁扮粍
-const beforeProductionImgs = ref([]);
-const afterProductionImgs = ref([]);
-const productionIssuesImgs = ref([]);
+// 琛屾暟鎹�
+const rowData = ref({});
-// 瑙嗛鏁扮粍
-const beforeProductionVideos = ref([]);
-const afterProductionVideos = ref([]);
-const productionIssuesVideos = ref([]);
+// 闄勪欢鍒楄〃
+const attachmentList = ref([]);
-// 濯掍綋鏌ョ湅鍣ㄧ姸鎬�
-const isMediaViewerVisible = ref(false);
-const currentMediaIndex = ref(0);
-const mediaList = ref([]); // 瀛樺偍褰撳墠瑕佹煡鐪嬬殑濯掍綋鍒楄〃锛堝惈鍥剧墖鍜岃棰戝璞★級
-const mediaType = ref('image'); // image | video
+// 鍥剧墖棰勮
+const showLightbox = ref(false);
+const previewImages = ref([]);
+const previewIndex = ref(0);
+
+// 瑙嗛棰勮
+const showVideoDialog = ref(false);
+const videoUrl = ref('');
+
const javaApi = proxy.javaApi;
-// 澶勭悊 URL锛氬皢 Windows 璺緞杞崲涓哄彲璁块棶鐨� URL
+// 澶勭悊鏂囦欢URL
function processFileUrl(fileUrl) {
if (!fileUrl) return '';
-
- // 濡傛灉 URL 鏄� Windows 璺緞鏍煎紡锛堝寘鍚弽鏂滄潬锛夛紝闇�瑕佽浆鎹�
+
if (fileUrl && fileUrl.indexOf('\\') > -1) {
- // 鏌ユ壘 uploads 鍏抽敭瀛楃殑浣嶇疆锛屼粠閭i噷寮�濮嬫彁鍙栫浉瀵硅矾寰�
const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads');
if (uploadsIndex > -1) {
- // 浠� uploads 寮�濮嬫彁鍙栬矾寰勶紝骞跺皢鍙嶆枩鏉犳浛鎹负姝f枩鏉�
const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/');
fileUrl = '/' + relativePath;
} else {
- // 濡傛灉娌℃湁鎵惧埌 uploads锛屾彁鍙栨渶鍚庝竴涓洰褰曞拰鏂囦欢鍚�
const parts = fileUrl.split('\\');
const fileName = parts[parts.length - 1];
fileUrl = '/uploads/' + fileName;
}
}
-
- // 纭繚鎵�鏈夐潪 http 寮�澶寸殑 URL 閮芥嫾鎺� baseUrl
+
if (fileUrl && !fileUrl.startsWith('http')) {
- // 纭繚璺緞浠� / 寮�澶�
if (!fileUrl.startsWith('/')) {
fileUrl = '/' + fileUrl;
}
- // 鎷兼帴 baseUrl
fileUrl = javaApi + fileUrl;
}
-
+
return fileUrl;
}
-// 澶勭悊姣忎竴绫绘暟鎹細鍒嗙鍥剧墖鍜岃棰�
-function processItems(items) {
- const images = [];
- const videos = [];
-
- // 妫�鏌� items 鏄惁瀛樺湪涓斾负鏁扮粍
- if (!items || !Array.isArray(items)) {
- return { images, videos };
+// 鑾峰彇鏂囦欢璁块棶URL
+function getFileUrl(file) {
+ // 浼樺厛浣跨敤 link 瀛楁
+ let url = file?.link;
+ if (!url) {
+ url = file?.url || file?.downloadUrl || file?.tempPath || '';
}
-
- items.forEach(item => {
- if (!item || !item.link) return;
-
- const fileUrl = processFileUrl(item.link);
- // if (!item || !item.url) return;
-
- // // 澶勭悊鏂囦欢 URL
- // const fileUrl = processFileUrl(item.url);
-
- // 鏍规嵁鏂囦欢鎵╁睍鍚嶅垽鏂槸鍥剧墖杩樻槸瑙嗛
- const urlLower = fileUrl.toLowerCase();
- if (urlLower.match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)) {
- images.push(fileUrl);
- } else if (urlLower.match(/\.(mp4|avi|mov|wmv|flv|mkv|webm)$/)) {
- videos.push(fileUrl);
- } else if (item.contentType) {
- // 濡傛灉鏈� contentType锛屼娇鐢� contentType 鍒ゆ柇
- if (item.contentType.startsWith('image/')) {
- images.push(fileUrl);
- } else if (item.contentType.startsWith('video/')) {
- videos.push(fileUrl);
- }
- }
- });
-
- return { images, videos };
+ return processFileUrl(url);
}
-// 鎵撳紑寮圭獥骞跺姞杞芥暟鎹�
-const openDialog = async (row) => {
- // 浣跨敤姝g‘鐨勫瓧娈靛悕锛歝ommonFileListBefore, commonFileListAfter
- // productionIssues 鍙兘涓嶅瓨鍦紝浣跨敤绌烘暟缁�
- const { images: beforeImgs, videos: beforeVids } = processItems(row.commonFileListBefore || []);
- const { images: afterImgs, videos: afterVids } = processItems(row.commonFileListAfter || []);
- const { images: issueImgs, videos: issueVids } = processItems(row.productionIssues || []);
-
- beforeProductionImgs.value = beforeImgs;
- beforeProductionVideos.value = beforeVids;
-
- afterProductionImgs.value = afterImgs;
- afterProductionVideos.value = afterVids;
-
- productionIssuesImgs.value = issueImgs;
- productionIssuesVideos.value = issueVids;
-
+// 鍒ゆ柇鏄惁涓哄浘鐗�
+function isImage(file) {
+ const name = file?.originalFilename || file?.bucketFilename || file?.name || '';
+ const ext = name.split('.').pop()?.toLowerCase();
+ return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(ext);
+}
+
+// 鍒ゆ柇鏄惁涓鸿棰�
+function isVideo(file) {
+ const name = file?.originalFilename || file?.bucketFilename || file?.name || '';
+ const ext = name.split('.').pop()?.toLowerCase();
+ return ['mp4', 'avi', 'mov', 'wmv', 'flv', 'mkv', 'webm'].includes(ext);
+}
+
+// 棰勮鏂囦欢
+function previewFile(file, index) {
+ if (isImage(file)) {
+ // 鍥剧墖棰勮
+ previewImages.value = attachmentList.value
+ .filter(f => isImage(f))
+ .map(f => getFileUrl(f));
+ previewIndex.value = previewImages.value.indexOf(getFileUrl(file));
+ showLightbox.value = true;
+ } else if (isVideo(file)) {
+ // 瑙嗛棰勮
+ videoUrl.value = getFileUrl(file);
+ showVideoDialog.value = true;
+ }
+}
+
+// 鍏抽棴鍥剧墖棰勮
+function closeLightbox() {
+ showLightbox.value = false;
+ previewImages.value = [];
+ previewIndex.value = 0;
+}
+
+// 鎵撳紑寮圭獥
+const openDialog = (row) => {
+ rowData.value = { ...row };
+
+ // 鏀堕泦鎵�鏈夐檮浠�
+ let files = [];
+ if (row?.commonFileList) {
+ files = files.concat(row.commonFileList);
+ }
+ if (row?.commonFileListBefore) {
+ files = files.concat(row.commonFileListBefore);
+ }
+ if (row?.commonFileListAfter) {
+ files = files.concat(row.commonFileListAfter);
+ }
+ attachmentList.value = files;
+
dialogVisitable.value = true;
};
-// 鏄剧ず濯掍綋锛堝浘鐗� or 瑙嗛锛�
-function showMedia(mediaArray, index, type) {
- mediaList.value = mediaArray;
- currentMediaIndex.value = index;
- mediaType.value = type;
- isMediaViewerVisible.value = true;
-}
-
-// 鍏抽棴濯掍綋鏌ョ湅鍣�
-function closeMediaViewer() {
- isMediaViewerVisible.value = false;
- mediaList.value = [];
- mediaType.value = 'image';
-}
-
-// 琛ㄥ崟鍏抽棴鏂规硶
+// 鍏抽棴寮圭獥
const cancel = () => {
dialogVisitable.value = false;
+ showVideoDialog.value = false;
+ rowData.value = {};
+ attachmentList.value = [];
};
defineExpose({ openDialog });
</script>
+
<style scoped lang="scss">
-.upload-container {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 20px;
- border: 1px solid #dcdfe6;
- box-sizing: border-box;
-
- .form-container {
- flex: 1;
- width: 100%;
- margin-bottom: 20px;
+.detail-container {
+ max-height: 60vh;
+ overflow-y: auto;
+}
+
+.info-section {
+ margin-bottom: 20px;
+
+ &:last-child {
+ margin-bottom: 0;
}
}
-.title {
+.section-title {
font-size: 14px;
color: #165dff;
- line-height: 20px;
font-weight: 600;
padding-left: 10px;
position: relative;
- margin: 6px 0;
-
+ margin-bottom: 12px;
+
&::before {
content: "";
position: absolute;
@@ -285,23 +248,81 @@
}
}
-.media-viewer-overlay {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(0, 0, 0, 0.8);
- z-index: 9999;
+.exception-content {
+ padding: 12px;
+ background-color: #fff2f0;
+ border: 1px solid #ffccc7;
+ border-radius: 4px;
+ color: #ff4d4f;
+ font-size: 14px;
+ line-height: 1.6;
+}
+
+.attachment-list {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
+.attachment-item {
+ width: 100px;
+ text-align: center;
+}
+
+.attachment-preview {
+ width: 100px;
+ height: 100px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ overflow: hidden;
+ cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
+ background-color: #f5f7fa;
+ transition: all 0.3s;
+
+ &:hover {
+ border-color: #409eff;
+ transform: scale(1.02);
+ }
+
+ img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
+
+ video {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
+
+ .file-icon {
+ font-size: 32px;
+ color: #909399;
+ }
}
-.media-viewer-content {
- position: relative;
- max-width: 90vw;
- max-height: 90vh;
- overflow: hidden;
+.attachment-info {
+ margin-top: 4px;
+
+ .file-name {
+ font-size: 12px;
+ color: #606266;
+ display: block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
}
-</style>
\ No newline at end of file
+
+.empty-attachment {
+ padding: 30px;
+ text-align: center;
+ color: #909399;
+ background-color: #f5f7fa;
+ border-radius: 4px;
+}
+</style>
diff --git a/src/views/equipmentManagement/inspectionManagement/index.vue b/src/views/equipmentManagement/inspectionManagement/index.vue
index 1be5ad9..423830f 100644
--- a/src/views/equipmentManagement/inspectionManagement/index.vue
+++ b/src/views/equipmentManagement/inspectionManagement/index.vue
@@ -1,37 +1,23 @@
<template>
<div class="app-container">
- <el-form :inline="true"
- :model="queryParams"
- class="search-form">
+ <el-form :inline="true" :model="queryParams" class="search-form">
<el-form-item label="宸℃浠诲姟鍚嶇О">
- <el-input v-model="queryParams.taskName"
- placeholder="璇疯緭鍏ュ贰妫�浠诲姟鍚嶇О"
- clearable
- style="width: 200px " />
+ <el-input v-model="queryParams.taskName" placeholder="璇疯緭鍏ュ贰妫�浠诲姟鍚嶇О" clearable style="width: 200px " />
</el-form-item>
<el-form-item>
- <el-button type="primary"
- @click="handleQuery">鏌ヨ</el-button>
+ <el-button type="primary" @click="handleQuery">鏌ヨ</el-button>
<el-button @click="resetQuery">閲嶇疆</el-button>
</el-form-item>
</el-form>
<el-card>
<div style="display: flex;flex-direction: row;justify-content: space-between;margin-bottom: 10px;">
- <el-radio-group v-model="activeRadio"
- @change="radioChange">
- <el-radio-button v-for="tab in radios"
- :key="tab.name"
- :label="tab.label"
- :value="tab.name" />
+ <el-radio-group v-model="activeRadio" @change="radioChange">
+ <el-radio-button v-for="tab in radios" :key="tab.name" :label="tab.label" :value="tab.name" />
</el-radio-group>
<!-- 鎿嶄綔鎸夐挳鍖� -->
<el-space v-if="activeRadio !== 'task'">
- <el-button type="primary"
- :icon="Plus"
- @click="handleAdd(undefined)">鏂板缓</el-button>
- <el-button type="danger"
- :icon="Delete"
- @click="handleDelete">鍒犻櫎</el-button>
+ <el-button type="primary" :icon="Plus" @click="handleAdd(undefined)">鏂板缓</el-button>
+ <el-button type="danger" :icon="Delete" @click="handleDelete">鍒犻櫎</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
</el-space>
<el-space v-else>
@@ -39,35 +25,33 @@
</el-space>
</div>
<div>
- <PIMTable :table-loading="tableLoading"
- :table-data="tableData"
- :column="tableColumns"
- @selection-change="handleSelectionChange"
- @pagination="handlePagination"
- :is-selection="true"
- :border="true"
- :page="{
- current: pageNum,
- size: pageSize,
- total: total,
- layout: 'total, sizes, prev, pager, next, jumper'
- }"
- :table-style="{ width: '100%', height: 'calc(100vh - 23em)' }">
+ <PIMTable :table-loading="tableLoading" :table-data="tableData" :column="tableColumns"
+ @selection-change="handleSelectionChange" @pagination="handlePagination" :is-selection="true" :border="true"
+ :page="{
+ current: pageNum,
+ size: pageSize,
+ total: total,
+ layout: 'total, sizes, prev, pager, next, jumper'
+ }" :table-style="{ width: '100%', height: 'calc(100vh - 23em)' }">
<template #inspector="{ row }">
<div class="person-tags">
<template v-if="row.inspector && row.inspector.length > 0">
- <el-tag v-for="(person, index) in row.inspector"
- :key="index"
- size="small"
- type="primary"
- class="person-tag">
+ <el-tag v-for="(person, index) in row.inspector" :key="index" size="small" type="primary"
+ class="person-tag">
{{ person }}
</el-tag>
</template>
- <span v-else
- class="no-data">--</span>
+ <span v-else class="no-data">--</span>
</div>
</template>
+
+ <template #acceptStatusSlot="{ row }">
+ <el-tag v-if="row.acceptStatus === 1" type="success">宸查�氳繃</el-tag>
+ <el-tag v-else-if="row.acceptStatus === 2" type="danger">宸查��鍥�</el-tag>
+ <el-tag v-else-if="row.inspectionStatus > 0" type="warning">寰呴獙鏀�</el-tag>
+ <span v-else>--</span>
+ </template>
+
<template #statusRef="{ row }">
<el-tag v-if="row.isActive === true || row.isActive === 1" type="success">鍚敤</el-tag>
<el-tag v-else type="danger">鍋滅敤</el-tag>
@@ -75,364 +59,430 @@
</PIMTable>
</div>
</el-card>
- <form-dia ref="formDia"
- @closeDia="handleQuery"></form-dia>
+ <form-dia ref="formDia" @closeDia="handleQuery"></form-dia>
<view-files ref="viewFiles"></view-files>
</div>
</template>
<script setup>
- import { Delete, Plus } from "@element-plus/icons-vue";
- import { onMounted, ref, reactive, getCurrentInstance, nextTick } from "vue";
- import { ElMessageBox } from "element-plus";
- import dayjs from "dayjs";
+import { Delete, Plus } from "@element-plus/icons-vue";
+import { onMounted, ref, reactive, getCurrentInstance, nextTick } from "vue";
+import { ElMessageBox } from "element-plus";
+import dayjs from "dayjs";
- // 缁勪欢寮曞叆
- import PIMTable from "@/components/PIMTable/PIMTable.vue";
- import FormDia from "@/views/equipmentManagement/inspectionManagement/components/formDia.vue";
- import ViewFiles from "@/views/equipmentManagement/inspectionManagement/components/viewFiles.vue";
+// 缁勪欢寮曞叆
+import PIMTable from "@/components/PIMTable/PIMTable.vue";
+import FormDia from "@/views/equipmentManagement/inspectionManagement/components/formDia.vue";
+import ViewFiles from "@/views/equipmentManagement/inspectionManagement/components/viewFiles.vue";
- // 鎺ュ彛寮曞叆
- import {
- delTimingTask,
- inspectionTaskList,
- timingTaskList,
- addOrEditTimingTask,
- } from "@/api/inspectionManagement/index.js";
+// 鎺ュ彛寮曞叆
+import {
+ delTimingTask,
+ inspectionTaskList,
+ timingTaskList,
+ addOrEditTimingTask,
+ acceptInspectionTask,
+} from "@/api/inspectionManagement/index.js";
- // 鍏ㄥ眬鍙橀噺
- const { proxy } = getCurrentInstance();
- const formDia = ref();
- const viewFiles = ref();
+// 鍏ㄥ眬鍙橀噺
+const { proxy } = getCurrentInstance();
+const formDia = ref();
+const viewFiles = ref();
- // 鏌ヨ鍙傛暟
- const queryParams = reactive({
- taskName: "",
- });
+// 鏌ヨ鍙傛暟
+const queryParams = reactive({
+ taskName: "",
+});
- // 鍗曢�夋閰嶇疆
- const activeRadio = ref("taskManage");
- const radios = reactive([
- { name: "taskManage", label: "宸℃浠诲姟绠$悊" },
- { name: "task", label: "宸℃浠诲姟璁板綍" },
- ]);
+// 鍗曢�夋閰嶇疆
+const activeRadio = ref("taskManage");
+const radios = reactive([
+ { name: "taskManage", label: "宸℃浠诲姟绠$悊" },
+ { name: "task", label: "宸℃浠诲姟璁板綍" },
+]);
- // 琛ㄦ牸鏁版嵁
- const selectedRows = ref([]);
- const tableData = ref([]);
- const operationsArr = ref([]);
- const tableColumns = ref([]);
- const tableLoading = ref(false);
- const total = ref(0);
- const pageNum = ref(1);
- const pageSize = ref(10);
+// 琛ㄦ牸鏁版嵁
+const selectedRows = ref([]);
+const tableData = ref([]);
+const operationsArr = ref([]);
+const tableColumns = ref([]);
+const tableLoading = ref(false);
+const total = ref(0);
+const pageNum = ref(1);
+const pageSize = ref(10);
- // 鍒楅厤缃�
- const columns = ref([
- { prop: "taskName", label: "宸℃浠诲姟鍚嶇О", minWidth: 160 },
- { prop: "remarks", label: "澶囨敞", minWidth: 150 },
- { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 150, slot: "inspector" },
- {
- prop: "frequencyType",
- label: "棰戞",
- minWidth: 150,
- formatData: params => {
- return params === "DAILY"
- ? "姣忔棩"
- : params === "WEEKLY"
+// 鍒楅厤缃�
+const columns = ref([
+ { prop: "taskName", label: "宸℃浠诲姟鍚嶇О", minWidth: 160 },
+ { prop: "remarks", label: "澶囨敞", minWidth: 150 },
+ { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 150, slot: "inspector" },
+ { prop: "inspectionAcceptor", label: "楠屾敹浜�", minWidth: 100 },
+ {
+ prop: "frequencyType",
+ label: "棰戞",
+ minWidth: 100,
+ formatData: params => {
+ return params === "DAILY"
+ ? "姣忔棩"
+ : params === "WEEKLY"
? "姣忓懆"
: params === "MONTHLY"
- ? "姣忔湀"
- : params === "QUARTERLY"
- ? "瀛e害"
- : "";
- },
+ ? "姣忔湀"
+ : params === "QUARTERLY"
+ ? "瀛e害"
+ : "";
},
- {
- prop: "frequencyDetail",
- label: "寮�濮嬫棩鏈熶笌鏃堕棿",
- minWidth: 150,
- formatter: (row, column, cellValue) => {
- // 鍏堝垽鏂槸鍚︽槸瀛楃涓�
- if (typeof cellValue !== "string") return "";
- let val = cellValue;
- const replacements = {
- MON: "鍛ㄤ竴",
- TUE: "鍛ㄤ簩",
- WED: "鍛ㄤ笁",
- THU: "鍛ㄥ洓",
- FRI: "鍛ㄤ簲",
- SAT: "鍛ㄥ叚",
- SUN: "鍛ㄦ棩",
- };
- // 浣跨敤姝e垯涓�娆℃�ф浛鎹㈡墍鏈夊尮閰嶉」
- return val.replace(
- /MON|TUE|WED|THU|FRI|SAT|SUN/g,
- match => replacements[match]
- );
- },
+ },
+ {
+ prop: "frequencyDetail",
+ label: "寮�濮嬫椂闂�",
+ minWidth: 120,
+ formatter: (row, column, cellValue) => {
+ if (typeof cellValue !== "string") return "";
+ let val = cellValue;
+ const replacements = {
+ MON: "鍛ㄤ竴",
+ TUE: "鍛ㄤ簩",
+ WED: "鍛ㄤ笁",
+ THU: "鍛ㄥ洓",
+ FRI: "鍛ㄤ簲",
+ SAT: "鍛ㄥ叚",
+ SUN: "鍛ㄦ棩",
+ };
+ return val.replace(
+ /MON|TUE|WED|THU|FRI|SAT|SUN/g,
+ match => replacements[match]
+ );
},
- { prop: "registrant", label: "鐧昏浜�", minWidth: 100 },
- { prop: "createTime", label: "鐧昏鏃ユ湡", minWidth: 120, formatData: (cell) => cell ? dayjs(cell).format("YYYY-MM-DD HH:MM:ss") : "-" },
- ]);
+ },
+ { prop: "registrant", label: "鐧昏浜�", minWidth: 100 },
+ { prop: "createTime", label: "鐧昏鏃ユ湡", minWidth: 120, formatData: (cell) => cell ? dayjs(cell).format("YYYY-MM-DD") : "-" },
+]);
- const statusColumn = {
- prop: "isActive",
- label: "浠诲姟鐘舵��",
- minWidth: 100,
- align: "center",
- dataType: "slot",
- slot: "statusRef",
- };
+const inspectionStatusColumn = {
+ prop: "inspectionStatus",
+ label: "宸℃鐘舵��",
+ minWidth: 100,
+ dataType: "tag",
+ formatData: params => {
+ if (params === 0) return "鏈贰妫�";
+ if (params === 1) return "姝e父";
+ if (params === 2) return "寮傚父";
+ return "--";
+ },
+ formatType: params => {
+ if (params === 0) return "warning";
+ if (params === 1) return "success";
+ if (params === 2) return "danger";
+ return "info";
+ }
+};
- // 鎿嶄綔鍒楅厤缃�
- const getOperationColumn = operations => {
- if (!operations || operations.length === 0) return null;
+const inspectionAcceptorColumn = { prop: "inspectionAcceptor", label: "楠屾敹浜�", minWidth: 100 };
- const operationList = operations
- .map(op => {
- switch (op) {
- case "edit":
+const acceptStatusColumn = {
+ prop: "acceptStatus",
+ label: "楠屾敹鐘舵��",
+ minWidth: 100,
+ dataType: "slot",
+ slot: "acceptStatusSlot",
+};
+
+const statusColumn = {
+ prop: "isActive",
+ label: "浠诲姟鐘舵��",
+ minWidth: 100,
+ align: "center",
+ dataType: "slot",
+ slot: "statusRef",
+};
+
+// 鎿嶄綔鍒楅厤缃�
+const getOperationColumn = operations => {
+ if (!operations || operations.length === 0) return null;
+
+ const operationList = operations
+ .map(op => {
+ switch (op) {
+ case "edit":
+ return {
+ name: "缂栬緫",
+ clickFun: handleAdd,
+ color: "#409EFF",
+ };
+ case "viewFile":
+ return {
+ name: "宸℃璇︽儏",
+ clickFun: viewFile,
+ color: "#67C23A",
+ };
+ case "accept":
return {
- name: "缂栬緫",
- clickFun: handleAdd,
- color: "#409EFF",
+ name: "楠屾敹",
+ clickFun: handleAccept,
+ color: "#E6A23C",
+ showHide: (row) => row.inspectionStatus > 0 && (!row.acceptStatus || row.acceptStatus === 0),
};
- case "viewFile":
- return {
- name: "鏌ョ湅闄勪欢",
- clickFun: viewFile,
- color: "#67C23A",
- };
- case "toggleActive":
- return {
- name: (row) => row.isActive === true || row.isActive === 1 ? "鍋滅敤" : "鍚敤",
- clickFun: handleToggleActive,
- color: (row) => row.isActive === true || row.isActive === 1 ? "#F56C6C" : "#67C23A",
- };
- default:
- return null;
- }
- })
- .filter(Boolean);
-
- const operationConfig = {
- label: "鎿嶄綔",
- width: 200,
- fixed: "right",
- dataType: "action",
- operation: operationList,
- };
-
- return operationConfig;
- };
-
- onMounted(() => {
- radioChange("taskManage");
- });
-
- // 鍗曢�夊彉鍖�
- const radioChange = value => {
- if (value === "taskManage") {
- const operationColumn = getOperationColumn(["edit", "toggleActive"]);
- tableColumns.value = [
- ...columns.value,
- statusColumn,
- ...(operationColumn ? [operationColumn] : []),
- ];
- operationsArr.value = ["edit", "toggleActive"];
- } else if (value === "task") {
- const operationColumn = getOperationColumn(["viewFile"]);
- tableColumns.value = [
- ...columns.value,
- ...(operationColumn ? [operationColumn] : []),
- ];
- operationsArr.value = ["viewFile"];
- }
- pageNum.value = 1;
- pageSize.value = 10;
- getList();
- };
-
- // 鏌ヨ鎿嶄綔
- const handleQuery = () => {
- pageNum.value = 1;
- pageSize.value = 10;
- getList();
- };
- // 鍒嗛〉澶勭悊
- const handlePagination = val => {
- pageNum.value = val.page;
- pageSize.value = val.limit;
- getList();
- };
- // 鑾峰彇鍒楄〃鏁版嵁
- const getList = () => {
- tableLoading.value = true;
-
- const params = {
- ...queryParams,
- size: pageSize.value,
- current: pageNum.value,
- };
-
- let apiCall;
- if (activeRadio.value === "task") {
- apiCall = inspectionTaskList(params);
- } else {
- apiCall = timingTaskList(params);
- }
-
- apiCall
- .then(res => {
- const rawData = res.data.records || [];
- // 澶勭悊 inspector 瀛楁锛屽皢瀛楃涓茶浆鎹负鏁扮粍锛堥�傜敤浜庢墍鏈夋儏鍐碉級
- tableData.value = rawData.map(item => {
- const processedItem = { ...item };
-
- // 澶勭悊 inspector 瀛楁
- if (processedItem.inspector) {
- if (typeof processedItem.inspector === "string") {
- // 瀛楃涓叉寜閫楀彿鍒嗗壊
- processedItem.inspector = processedItem.inspector
- .split(",")
- .map(s => s.trim())
- .filter(s => s);
- } else if (!Array.isArray(processedItem.inspector)) {
- // 闈炴暟缁勮浆涓烘暟缁�
- processedItem.inspector = [processedItem.inspector];
- }
- } else {
- // 绌哄�艰涓虹┖鏁扮粍
- processedItem.inspector = [];
- }
-
- return processedItem;
- });
- total.value = res.data.total || 0;
- })
- .finally(() => {
- tableLoading.value = false;
- });
- };
-
- // 閲嶇疆鏌ヨ
- const resetQuery = () => {
- for (const key in queryParams) {
- if (!["pageNum", "pageSize"].includes(key)) {
- queryParams[key] = "";
+ case "toggleActive":
+ return {
+ name: (row) => row.isActive === true || row.isActive === 1 ? "鍋滅敤" : "鍚敤",
+ clickFun: handleToggleActive,
+ color: (row) => row.isActive === true || row.isActive === 1 ? "#F56C6C" : "#67C23A",
+ };
+ default:
+ return null;
}
- }
- handleQuery();
- };
-
- // 鏂板 / 缂栬緫
- const handleAdd = row => {
- const type = row ? "edit" : "add";
- nextTick(() => {
- formDia.value?.openDialog(type, row);
- });
- };
-
- // 鏌ョ湅闄勪欢
- const viewFile = row => {
- nextTick(() => {
- viewFiles.value?.openDialog(row);
- });
- };
-
- // 鍒犻櫎鎿嶄綔
- const handleDelete = () => {
- if (!selectedRows.value.length) {
- proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
- return;
- }
-
- const deleteIds = selectedRows.value.map(item => item.id);
-
- proxy.$modal
- .confirm("鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�")
- .then(() => {
- return delTimingTask(deleteIds);
- })
- .then(() => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- handleQuery();
- })
- .catch(() => {});
- };
-
- // 鍚敤/鍋滅敤鍒囨崲
- const handleToggleActive = async (row) => {
- const newStatus = row.isActive === true || row.isActive === 1 ? 0 : 1;
- const actionText = newStatus === 1 ? "鍚敤" : "鍋滅敤";
-
- try {
- await proxy.$modal.confirm(`鏄惁纭${actionText}璇ヤ换鍔★紵`)
- } catch {
- return
- }
-
- try {
- await addOrEditTimingTask({
- id: row.id,
- taskId: row.taskId,
- taskName: row.taskName,
- inspectorIds: row.inspectorIds,
- remarks: row.remarks,
- frequencyType: row.frequencyType,
- frequencyDetail: row.frequencyDetail,
- isActive: newStatus,
- })
- proxy.$modal.msgSuccess(`${actionText}鎴愬姛`)
- handleQuery()
- } catch (error) {
- console.error(`${actionText}澶辫触:`, error)
- }
- };
-
- // 澶氶�夊彉鏇�
- const handleSelectionChange = selection => {
- selectedRows.value = selection;
- };
-
- // 瀵煎嚭
- const handleOut = () => {
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
})
- .then(() => {
- // 鏍规嵁褰撳墠閫変腑鐨勬爣绛鹃〉璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
- if (activeRadio.value === "taskManage") {
- // 淇濆吇浠诲姟绠$悊
- proxy.download("/timingTask/export", {}, "淇濆吇浠诲姟绠$悊.xlsx");
- } else if (activeRadio.value === "task") {
- // 瀹氭椂浠诲姟璁板綍
- proxy.download("/inspectionTask/export", {}, "淇濆吇浠诲姟璁板綍.xlsx");
- }
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
+ .filter(Boolean);
+
+ const operationConfig = {
+ label: "鎿嶄綔",
+ width: 200,
+ fixed: "right",
+ dataType: "action",
+ operation: operationList,
};
+
+ return operationConfig;
+};
+
+onMounted(() => {
+ radioChange("taskManage");
+});
+
+// 鍗曢�夊彉鍖�
+const radioChange = value => {
+ activeRadio.value = value;
+ if (value === "taskManage") {
+ const operationColumn = getOperationColumn(["edit", "toggleActive"]);
+ tableColumns.value = [
+ ...columns.value,
+ statusColumn,
+ ...(operationColumn ? [operationColumn] : []),
+ ];
+ operationsArr.value = ["edit", "toggleActive"];
+ } else if (value === "task") {
+ const operationColumn = getOperationColumn(["viewFile", "accept"]);
+ tableColumns.value = [
+ ...columns.value,
+ inspectionStatusColumn,
+ acceptStatusColumn,
+ ...(operationColumn ? [operationColumn] : []),
+ ];
+ operationsArr.value = ["viewFile", "accept"];
+ }
+ pageNum.value = 1;
+ pageSize.value = 10;
+ getList();
+};
+
+// 鏌ヨ鎿嶄綔
+const handleQuery = () => {
+ pageNum.value = 1;
+ pageSize.value = 10;
+ getList();
+};
+// 鍒嗛〉澶勭悊
+const handlePagination = val => {
+ pageNum.value = val.page;
+ pageSize.value = val.limit;
+ getList();
+};
+// 鑾峰彇鍒楄〃鏁版嵁
+const getList = () => {
+ tableLoading.value = true;
+
+ const params = {
+ ...queryParams,
+ size: pageSize.value,
+ current: pageNum.value,
+ };
+
+ let apiCall;
+ if (activeRadio.value === "task") {
+ apiCall = inspectionTaskList(params);
+ } else {
+ apiCall = timingTaskList(params);
+ }
+
+ apiCall
+ .then(res => {
+ const rawData = res.data.records || [];
+ // 澶勭悊 inspector 瀛楁锛屽皢瀛楃涓茶浆鎹负鏁扮粍锛堥�傜敤浜庢墍鏈夋儏鍐碉級
+ tableData.value = rawData.map(item => {
+ const processedItem = { ...item };
+
+ // 澶勭悊 inspector 瀛楁
+ if (processedItem.inspector) {
+ if (typeof processedItem.inspector === "string") {
+ // 瀛楃涓叉寜閫楀彿鍒嗗壊
+ processedItem.inspector = processedItem.inspector
+ .split(",")
+ .map(s => s.trim())
+ .filter(s => s);
+ } else if (!Array.isArray(processedItem.inspector)) {
+ // 闈炴暟缁勮浆涓烘暟缁�
+ processedItem.inspector = [processedItem.inspector];
+ }
+ } else {
+ // 绌哄�艰涓虹┖鏁扮粍
+ processedItem.inspector = [];
+ }
+
+ return processedItem;
+ });
+ total.value = res.data.total || 0;
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+};
+
+// 閲嶇疆鏌ヨ
+const resetQuery = () => {
+ for (const key in queryParams) {
+ if (!["pageNum", "pageSize"].includes(key)) {
+ queryParams[key] = "";
+ }
+ }
+ handleQuery();
+};
+
+// 鏂板 / 缂栬緫
+const handleAdd = row => {
+ const type = row ? "edit" : "add";
+ nextTick(() => {
+ formDia.value?.openDialog(type, row);
+ });
+};
+
+// 宸℃璇︽儏
+const viewFile = row => {
+ nextTick(() => {
+ viewFiles.value?.openDialog(row);
+ });
+};
+
+ // 楠屾敹鎿嶄綔
+ const handleAccept = (row) => {
+ ElMessageBox.confirm(`璇烽�夋嫨瀵逛换鍔°��${row.taskName}銆戠殑楠屾敹缁撴灉`, "绯荤粺鎻愮ず", {
+ distinguishCancelAndClose: true,
+ confirmButtonText: '楠屾敹閫氳繃',
+ cancelButtonText: '閫�鍥為噸妫�',
+ type: 'warning'
+ }).then(async () => {
+ try {
+ await acceptInspectionTask({ id: row.id, acceptStatus: 1 });
+ proxy.$modal.msgSuccess("宸查獙鏀堕�氳繃");
+ handleQuery();
+ } catch (error) {
+ console.error("楠屾敹澶辫触:", error);
+ }
+ }).catch(async (action) => {
+ if (action === 'cancel') {
+ try {
+ await acceptInspectionTask({ id: row.id, acceptStatus: 2 });
+ proxy.$modal.msgWarning("宸查��鍥烇紝绛夊緟閲嶆柊宸℃");
+ handleQuery();
+ } catch (error) {
+ console.error("閫�鍥炲け璐�:", error);
+ }
+ }
+ });
+ };
+
+// 鍒犻櫎鎿嶄綔
+const handleDelete = () => {
+ if (!selectedRows.value.length) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ return;
+ }
+
+ const deleteIds = selectedRows.value.map(item => item.id);
+
+ proxy.$modal
+ .confirm("鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�")
+ .then(() => {
+ return delTimingTask(deleteIds);
+ })
+ .then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ handleQuery();
+ })
+ .catch(() => { });
+};
+
+// 鍚敤/鍋滅敤鍒囨崲
+const handleToggleActive = async (row) => {
+ const newStatus = row.isActive === true || row.isActive === 1 ? 0 : 1;
+ const actionText = newStatus === 1 ? "鍚敤" : "鍋滅敤";
+
+ try {
+ await proxy.$modal.confirm(`鏄惁纭${actionText}璇ヤ换鍔★紵`)
+ } catch {
+ return
+ }
+
+ try {
+ await addOrEditTimingTask({
+ id: row.id,
+ taskId: row.taskId,
+ taskName: row.taskName,
+ inspectorIds: row.inspectorIds,
+ remarks: row.remarks,
+ frequencyType: row.frequencyType,
+ frequencyDetail: row.frequencyDetail,
+ isActive: newStatus,
+ })
+ proxy.$modal.msgSuccess(`${actionText}鎴愬姛`)
+ handleQuery()
+ } catch (error) {
+ console.error(`${actionText}澶辫触:`, error)
+ }
+};
+
+// 澶氶�夊彉鏇�
+const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+};
+
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // 鏍规嵁褰撳墠閫変腑鐨勬爣绛鹃〉璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
+ if (activeRadio.value === "taskManage") {
+ // 淇濆吇浠诲姟绠$悊
+ proxy.download("/timingTask/export", {}, "淇濆吇浠诲姟绠$悊.xlsx");
+ } else if (activeRadio.value === "task") {
+ // 瀹氭椂浠诲姟璁板綍
+ proxy.download("/inspectionTask/export", {}, "淇濆吇浠诲姟璁板綍.xlsx");
+ }
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
</script>
<style scoped>
- .person-tags {
- display: flex;
- flex-wrap: wrap;
- gap: 4px;
- }
+.person-tags {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 4px;
+}
- .person-tag {
- margin-right: 4px;
- margin-bottom: 2px;
- }
+.person-tag {
+ margin-right: 4px;
+ margin-bottom: 2px;
+}
- .no-data {
- color: #909399;
- font-size: 14px;
- }
+.no-data {
+ color: #909399;
+ font-size: 14px;
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3