From 6397a0981840576c37eced6e34c924d913ee5373 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期三, 27 五月 2026 16:17:25 +0800
Subject: [PATCH] feat 设备报修添加范围、巡检添加三个状态

---
 src/views/equipmentManagement/repair/Modal/RepairModal.vue                    |   39 ++++++++++++++-----
 src/views/equipmentManagement/repair/index.vue                                |   23 ++++++++++-
 src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue |   49 +++++++++++++++++++-----
 3 files changed, 86 insertions(+), 25 deletions(-)

diff --git a/src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue b/src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue
index f183507..9ac7b07 100644
--- a/src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue
+++ b/src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue
@@ -14,7 +14,7 @@
 
       <div class="exception-section">
         <div class="section-title">鏄惁瀛樺湪寮傚父锛�</div>
-        <el-radio-group v-model="hasException">
+        <el-radio-group v-model="currentHasException">
           <el-radio :value="false">姝e父</el-radio>
           <el-radio :value="true">瀛樺湪寮傚父</el-radio>
         </el-radio-group>
@@ -135,11 +135,27 @@
 const afterModelValue = ref([]);
 const issueModelValue = ref([]);
 const currentUploadType = ref("before");
-const hasException = ref(null);
+const hasExceptionBefore = ref(null);
+const hasExceptionAfter = ref(null);
+const hasExceptionIssue = ref(null);
 const currentTask = ref(null);
 
 const showVideoDialog = ref(false);
 const currentVideoFile = ref(null);
+
+// 鏍规嵁褰撳墠 Tab 鑾峰彇/璁剧疆瀵瑰簲鐨勫紓甯哥姸鎬�
+const currentHasException = computed({
+  get: () => {
+    if (currentUploadType.value === "before") return hasExceptionBefore.value;
+    if (currentUploadType.value === "after") return hasExceptionAfter.value;
+    return hasExceptionIssue.value;
+  },
+  set: (val) => {
+    if (currentUploadType.value === "before") hasExceptionBefore.value = val;
+    else if (currentUploadType.value === "after") hasExceptionAfter.value = val;
+    else hasExceptionIssue.value = val;
+  }
+});
 
 const uploadConfig = {
   action: "/file/upload",
@@ -216,7 +232,9 @@
   afterModelValue.value = [];
   issueModelValue.value = [];
   currentUploadType.value = "before";
-  hasException.value = null;
+  hasExceptionBefore.value = null;
+  hasExceptionAfter.value = null;
+  hasExceptionIssue.value = null;
   currentTask.value = null;
   uploadProgress.value = 0;
   uploading.value = false;
@@ -243,8 +261,12 @@
     : [];
 
   currentUploadType.value = "before";
-  hasException.value =
-    typeof rawTask.hasException === "boolean" ? rawTask.hasException : null;
+  hasExceptionBefore.value =
+    typeof rawTask.hasExceptionBefore === "boolean" ? rawTask.hasExceptionBefore : null;
+  hasExceptionAfter.value =
+    typeof rawTask.hasExceptionAfter === "boolean" ? rawTask.hasExceptionAfter : null;
+  hasExceptionIssue.value =
+    typeof rawTask.hasExceptionIssue === "boolean" ? rawTask.hasExceptionIssue : null;
   uploadFileList.value = [];
   showUploadDialog.value = true;
 };
@@ -427,7 +449,9 @@
 
   return {
     ...rest,
-    hasException: hasException.value,
+    hasExceptionBefore: hasExceptionBefore.value,
+    hasExceptionAfter: hasExceptionAfter.value,
+    hasExceptionIssue: hasExceptionIssue.value,
     tempFileIds,
     commonFileListBefore: buildGroupedFiles(beforeModelValue.value),
     commonFileListAfter: buildGroupedFiles(afterModelValue.value),
@@ -436,14 +460,17 @@
 };
 
 const submitUpload = async () => {
-  if (hasException.value === null) {
-    ElMessage.warning("璇烽�夋嫨鏄惁瀛樺湪寮傚父");
+  // 鍙獙璇佸綋鍓� Tab 鐨勫紓甯哥姸鎬�
+  const currentException = currentHasException.value;
+  if (currentException === null) {
+    ElMessage.warning(`璇烽�夋嫨${getUploadTypeText()}鏄惁瀛樺湪寮傚父`);
     return;
   }
 
-  const files = buildSubmitFiles();
-  if (!files.length) {
-    ElMessage.warning("璇峰厛涓婁紶鏂囦欢");
+  const currentFiles = getCurrentFiles();
+  // 鍙湁閫夋嫨"瀛樺湪寮傚父"鏃舵墠闇�瑕佷笂浼犳枃浠�
+  if (currentException === true && !currentFiles.length) {
+    ElMessage.warning(`${getUploadTypeText()}瀛樺湪寮傚父鏃惰涓婁紶鍥剧墖鎴栬棰慲);
     return;
   }
 
diff --git a/src/views/equipmentManagement/repair/Modal/RepairModal.vue b/src/views/equipmentManagement/repair/Modal/RepairModal.vue
index 106880a..5a3c651 100644
--- a/src/views/equipmentManagement/repair/Modal/RepairModal.vue
+++ b/src/views/equipmentManagement/repair/Modal/RepairModal.vue
@@ -38,14 +38,16 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="12">
-          <el-form-item label="鎶ヤ慨鏃ユ湡">
+        <el-col :span="24">
+          <el-form-item label="鎶ヤ慨鏃堕棿">
             <el-date-picker
-              v-model="form.repairTime"
-              placeholder="璇烽�夋嫨鎶ヤ慨鏃ユ湡"
-              format="YYYY-MM-DD"
-              value-format="YYYY-MM-DD"
-              type="date"
+              v-model="form.repairTimeRange"
+              type="datetimerange"
+              range-separator="鑷�"
+              start-placeholder="寮�濮嬫椂闂�"
+              end-placeholder="缁撴潫鏃堕棿"
+              format="YYYY-MM-DD HH:mm:ss"
+              value-format="YYYY-MM-DD HH:mm:ss"
               clearable
               style="width: 100%"
             />
@@ -120,7 +122,7 @@
   deviceName: undefined, // 璁惧鍚嶇О
   deviceModel: undefined, // 瑙勬牸鍨嬪彿
   repairProject: undefined, // 鎶ヤ慨椤圭洰
-  repairTime: dayjs().format("YYYY-MM-DD"), // 鎶ヤ慨鏃ユ湡锛岄粯璁ゅ綋澶�
+  repairTimeRange: [dayjs().format("YYYY-MM-DD HH:mm:ss"), dayjs().format("YYYY-MM-DD HH:mm:ss")], // 鎶ヤ慨鏃堕棿鑼冨洿锛岄粯璁ゅ綋澶�
   repairName: userStore.nickName, // 鎶ヤ慨浜�
   remark: undefined, // 鏁呴殰鐜拌薄
   status: 0, // 鎶ヤ慨鐘舵��
@@ -136,7 +138,14 @@
   form.deviceName = data.deviceName;
   form.deviceModel = data.deviceModel;
   form.repairProject = data.repairProject;
-  form.repairTime = data.repairTime;
+  // 璁剧疆鏃堕棿鑼冨洿锛屽鏋滃悗绔繑鍥炵殑鏄崟涓椂闂村垯鑼冨洿閫夋嫨
+  if (data.repairTimeStart && data.repairTimeEnd) {
+    form.repairTimeRange = [data.repairTimeStart, data.repairTimeEnd];
+  } else if (data.repairTime) {
+    form.repairTimeRange = [data.repairTime, data.repairTime];
+  } else {
+    form.repairTimeRange = null;
+  }
   form.repairName = data.repairName;
   form.remark = data.remark;
   form.status = data.status;
@@ -145,9 +154,17 @@
 const sendForm = async () => {
   loading.value = true;
   try {
+    // 灏嗘椂闂磋寖鍥存媶鍒嗕负寮�濮嬫椂闂村拰缁撴潫鏃堕棿
+    const submitData = {
+      ...form,
+      repairTimeStart: form.repairTimeRange?.[0] || null,
+      repairTimeEnd: form.repairTimeRange?.[1] || null,
+    };
+    delete submitData.repairTimeRange;
+
     const { code } = id.value
-      ? await editRepair({ id: unref(id), ...form })
-      : await addRepair(form);
+      ? await editRepair({ id: unref(id), ...submitData })
+      : await addRepair(submitData);
     if (code == 200) {
       ElMessage.success(`${id.value ? "缂栬緫" : "鏂板"}鎶ヤ慨鎴愬姛`);
       visible.value = false;
diff --git a/src/views/equipmentManagement/repair/index.vue b/src/views/equipmentManagement/repair/index.vue
index df5a39e..b43ba44 100644
--- a/src/views/equipmentManagement/repair/index.vue
+++ b/src/views/equipmentManagement/repair/index.vue
@@ -102,6 +102,22 @@
           <el-tag v-if="row.status === 1" type="success">瀹岀粨</el-tag>
           <el-tag v-if="row.status === 0" type="warning">寰呯淮淇�</el-tag>
         </template>
+        <template #repairTimeSlot="{ row }">
+          <span v-if="row.repairTimeStart || row.repairTimeEnd">
+            <template v-if="row.repairTimeStart && row.repairTimeEnd">
+              <span v-if="row.repairTimeStart === row.repairTimeEnd">
+                {{ dayjs(row.repairTimeStart).format("YYYY-MM-DD HH:mm:ss") }}
+              </span>
+              <span v-else>
+                {{ dayjs(row.repairTimeStart).format("YYYY-MM-DD HH:mm:ss") }} 鑷� {{ dayjs(row.repairTimeEnd).format("YYYY-MM-DD HH:mm:ss") }}
+              </span>
+            </template>
+            <template v-else>
+              {{ row.repairTimeStart ? dayjs(row.repairTimeStart).format("YYYY-MM-DD HH:mm:ss") : dayjs(row.repairTimeEnd).format("YYYY-MM-DD HH:mm:ss") }}
+            </template>
+          </span>
+          <span v-else>-</span>
+        </template>
         <template #operation="{ row }">
           <el-button
             type="primary"
@@ -193,10 +209,11 @@
         prop: "repairProject",
       },
       {
-        label: "鎶ヤ慨鏃ユ湡",
+        label: "鎶ヤ慨鏃堕棿",
         align: "center",
-        prop: "repairTime",
-        formatData: (cell) => dayjs(cell).format("YYYY-MM-DD"),
+        prop: "repairTimeStart",
+        dataType: "slot",
+        slot: "repairTimeSlot",
       },
       {
         label: "鎶ヤ慨浜�",

--
Gitblit v1.9.3