From cef1acd01505b160f8cf9d5d01fb03f4feb47438 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 26 一月 2026 17:01:36 +0800
Subject: [PATCH] 运行管理代码整理

---
 src/pages/equipmentManagement/runManagement/index.vue |  250 -------------------------------------------------
 1 files changed, 2 insertions(+), 248 deletions(-)

diff --git a/src/pages/equipmentManagement/runManagement/index.vue b/src/pages/equipmentManagement/runManagement/index.vue
index fee89be..d5eb0ba 100644
--- a/src/pages/equipmentManagement/runManagement/index.vue
+++ b/src/pages/equipmentManagement/runManagement/index.vue
@@ -5,11 +5,9 @@
     <!-- 閫氱煡鍏憡鏉� -->
     <view class="notice-board">
       <!-- 缁熶竴閫氱煡鍖哄煙 -->
-      <view class="notice-section"
-            v-if="totalNoticeCount > 0">
+      <view class="notice-section">
         <view class="section-header">
           <h3>璁惧杩愯璁板綍</h3>
-          <!-- <text class="section-count">{{ totalNoticeCount }}鏉�</text> -->
         </view>
         <view class="notice-cards">
           <!-- 鏀惧亣閫氱煡 -->
@@ -93,50 +91,13 @@
 </template>
 
 <script setup>
-  import { onMounted, ref, reactive, toRefs } from "vue";
-  import { onReachBottom } from "@dcloudio/uni-app";
+  import { onMounted, ref } from "vue";
   import PageHeader from "@/components/PageHeader.vue";
-  import useUserStore from "@/store/modules/user";
-  import {
-    addNotice,
-    delNotice,
-    getCount,
-    listNotice,
-    updateNotice,
-  } from "@/api/collaborativeApproval/noticeManagement.js";
   import {
     getLedgerPage,
     editLedger,
   } from "@/api/equipmentManagement/runManagement.js";
 
-  const userStore = useUserStore();
-
-  // 鍝嶅簲寮忔暟鎹�
-  const data = reactive({
-    searchForm: {
-      title: "",
-      type: undefined,
-      status: undefined,
-    },
-    form: {
-      id: undefined,
-      title: "",
-      type: null,
-      content: "",
-      status: 0,
-      priority: 1,
-      remark: "",
-      expirationDate: "",
-    },
-    rules: {
-      title: [{ required: true, message: "鍏憡鏍囬涓嶈兘涓虹┖", trigger: "blur" }],
-      type: [{ required: true, message: "璇烽�夋嫨鍏憡绫诲瀷", trigger: "change" }],
-      content: [{ required: true, message: "鍏憡鍐呭涓嶈兘涓虹┖", trigger: "blur" }],
-      expirationDate: [
-        { required: true, message: "璇烽�夋嫨鏃ユ湡", trigger: "change" },
-      ],
-    },
-  });
   // 鑾峰彇鏍囩绫诲瀷
   const getTagType = status => {
     switch (status) {
@@ -180,21 +141,6 @@
         return "question-circle";
     }
   };
-
-  const { searchForm, form, rules } = toRefs(data);
-
-  // 椤甸潰鐘舵��
-  const dialogVisible = ref(false);
-  const dialogTitle = ref("");
-  const selectedIds = ref([]);
-  const formRef = ref();
-
-  const priorityOptions = [
-    { label: "鏅��", value: 1 },
-    { label: "閲嶈", value: 2 },
-    { label: "绱ф��", value: 3 },
-  ];
-
   const goBack = () => {
     uni.navigateBack();
   };
@@ -211,23 +157,6 @@
     return currentTime > planTime;
   };
 
-  const onExpireConfirm = e => {
-    if (!e) return;
-    // uview-plus datetime-picker confirm 浜嬩欢杩斿洖鐨� value
-    const value = e.value || e;
-    form.value.expirationDate = value;
-  };
-
-  const getPriorityText = priority => {
-    const priorityMap = { 1: "鏅��", 2: "閲嶈", 3: "绱ф��" };
-    return priorityMap[priority] || "鏅��";
-  };
-
-  const getStatusText = status => {
-    const statusMap = { 0: "鑽夌", 1: "宸插彂甯�", 2: "宸茶繃鏈�" };
-    return statusMap[status] || "鏈煡";
-  };
-
   const isNoticeExpired = notice => {
     if (!notice || !notice.expirationDate) {
       return false;
@@ -242,32 +171,6 @@
     expiration.setHours(23, 59, 59, 999);
 
     return new Date() > expiration;
-  };
-
-  const getNoticeStatus = notice => {
-    const normalizedStatus =
-      notice && notice.status !== undefined && notice.status !== null
-        ? String(notice.status)
-        : "0";
-
-    return isNoticeExpired(notice) ? "2" : normalizedStatus;
-  };
-
-  const openForm = type => {
-    if (type === "add") {
-      dialogTitle.value = "鏂板鍏憡";
-      form.value = {
-        id: undefined,
-        title: "",
-        type: undefined,
-        content: "",
-        status: 0,
-        priority: 1,
-        remark: "",
-        expirationDate: "",
-      };
-    }
-    dialogVisible.value = true;
   };
 
   const handleEdit = async (device, status) => {
@@ -326,167 +229,18 @@
     }
   };
 
-  const handleDelete = id => {
-    if (!id) return;
-    uni.showModal({
-      title: "鎻愮ず",
-      content: "纭鍒犻櫎杩欐潯鍏憡鍚楋紵",
-      success: res => {
-        if (res.confirm) {
-          delNotice(id).then(() => {
-            uni.showToast({
-              title: "鍒犻櫎鎴愬姛",
-              icon: "success",
-            });
-            resetTable();
-          });
-        }
-      },
-    });
-  };
-
-  // 棰勭暀鎵归噺鍒犻櫎锛堢洰鍓嶆湭瀹炵幇閫変腑閫昏緫锛屼粎鍗犱綅锛�
-  const handleDeleteBatch = () => {
-    if (!selectedIds.value.length) return;
-    uni.showModal({
-      title: "鎻愮ず",
-      content: "纭鍒犻櫎閫変腑鐨勫叕鍛婂悧锛�",
-      success: res => {
-        if (res.confirm) {
-          // 鏍规嵁selectedIds鎵ц鎵归噺鍒犻櫎閫昏緫锛堝彲鎸夐渶鎵╁睍锛�
-        }
-      },
-    });
-  };
-
-  const submitForm = () => {
-    formRef.value.validate(valid => {
-      if (valid) {
-        if (form.value.id) {
-          // 缂栬緫妯″紡
-          updateNotice(form.value).then(res => {
-            uni.showToast({
-              title: "淇敼鎴愬姛",
-              icon: "success",
-            });
-            resetTable();
-          });
-        } else {
-          // 鏂板妯″紡
-          addNotice(form.value).then(res => {
-            uni.showToast({
-              title: "鏂板鎴愬姛",
-              icon: "success",
-            });
-            resetTable();
-          });
-        }
-        dialogVisible.value = false;
-      }
-    });
-  };
-
-  const totalNoticeCount = ref(0);
-  const fetchCount = () => {
-    getCount().then(res => {
-      totalNoticeCount.value = res.data.reduce(
-        (total, item) => total + item.count,
-        0
-      );
-    });
-  };
-
   const holidayNotices = ref([]);
   const maintenanceNotices = ref([]);
-  const holidayNoticePage = ref({
-    total: 0,
-    current: 1,
-    size: 9,
-  });
-
-  const maintenanceNoticePage = ref({
-    total: 0,
-    current: 1,
-    size: 9,
-  });
-
-  const isLoadingMore = ref(false);
 
   const fetchHolidayNotices = (append = false) => {
     getLedgerPage({}).then(res => {
       holidayNotices.value = res?.data?.records || [];
-      // const records = res?.data?.records || [];
-      // holidayNoticePage.value.total = res?.data?.total || 0;
-      // if (append && holidayNotices.value.length) {
-      //   holidayNotices.value = [...holidayNotices.value, ...records];
-      // } else {
-      //   holidayNotices.value = records;
-      // }
     });
-  };
-
-  const fetchMaintenanceNotices = (append = false) => {
-    listNotice({ ...holidayNoticePage.value, type: 2 }).then(res => {
-      const records = res?.data?.records || [];
-      maintenanceNoticePage.value.total = res?.data?.total || 0;
-      if (append && maintenanceNotices.value.length) {
-        maintenanceNotices.value = [...maintenanceNotices.value, ...records];
-      } else {
-        maintenanceNotices.value = records;
-      }
-    });
-  };
-
-  const handleCurrentChange = val => {
-    holidayNoticePage.value.size = val.limit;
-    holidayNoticePage.value.current = val.page;
-    maintenanceNoticePage.value.size = val.limit;
-    maintenanceNoticePage.value.current = val.page;
-    fetchHolidayNotices();
-    fetchMaintenanceNotices();
-  };
-
-  const resetTable = () => {
-    holidayNoticePage.value.current = 1;
-    holidayNoticePage.value.size = 9;
-    maintenanceNoticePage.value.current = 1;
-    maintenanceNoticePage.value.size = 9;
-    fetchHolidayNotices();
-    fetchMaintenanceNotices();
-    fetchCount();
-  };
-
-  const resetForm = () => {
-    formRef.value?.resetFields();
   };
 
   // 鐢熷懡鍛ㄦ湡
   onMounted(() => {
-    fetchCount();
     fetchHolidayNotices();
-    fetchMaintenanceNotices();
-  });
-
-  // 涓婂垝鍔犺浇鏇村
-  onReachBottom(() => {
-    if (isLoadingMore.value) return;
-    isLoadingMore.value = true;
-
-    holidayNoticePage.value.current += 1;
-    maintenanceNoticePage.value.current += 1;
-
-    Promise.all([
-      new Promise(resolve => {
-        fetchHolidayNotices(true);
-        resolve();
-      }),
-      new Promise(resolve => {
-        fetchMaintenanceNotices(true);
-        resolve();
-      }),
-    ]).finally(() => {
-      isLoadingMore.value = false;
-    });
   });
 </script>
 

--
Gitblit v1.9.3