yyb
9 小时以前 97081b89ee45da49b8dbb4173ab45df031fe3c0d
src/views/officeProcessAutomation/NoticeAnnouncement/notice-manage/useNoticeAnnouncement.js
@@ -1,7 +1,7 @@
import { Search } from "@element-plus/icons-vue";
import dayjs from "dayjs";
import { ElMessageBox } from "element-plus";
import { computed, reactive, ref, watch } from "vue";
import { computed, onMounted, reactive, ref, watch } from "vue";
import {
  NOTICE_TYPE_OPTIONS,
  PRIORITY_OPTIONS,
@@ -9,9 +9,6 @@
  READ_SCOPE_OPTIONS,
  DEPT_OPTIONS,
  createEmptyForm,
  createInitialMockNotices,
  loadStoredNotices,
  saveStoredNotices,
  nextNoticeNo,
  validateNoticeForm,
  noticeTypeLabel,
@@ -21,8 +18,7 @@
} from "./noticeAnnouncementUtils.js";
export function useNoticeAnnouncement() {
  const stored = loadStoredNotices();
  const allRows = ref(stored?.length ? stored : createInitialMockNotices());
  const allRows = ref([]);
  const searchForm = reactive({
    keyword: "",
@@ -152,9 +148,13 @@
    },
  ]);
  function persist() {
    saveStoredNotices(allRows.value);
  }
  onMounted(() => {
    try {
      localStorage.removeItem("oa_notice_announcement_v1");
    } catch {
      /* 清除历史本地演示缓存 */
    }
  });
  function handleQuery() {
    tableLoading.value = true;
@@ -240,7 +240,6 @@
      }
      allRows.value[idx] = { ...prev, ...payload };
    }
    persist();
    formDialog.visible = false;
    return { ok: true };
  }
@@ -259,7 +258,6 @@
      hit.publishTime = now;
      hit.updateTime = now;
      if (hit.noticeType === "emergency") hit.priority = "urgent";
      persist();
      return true;
    } catch {
      return false;
@@ -277,7 +275,6 @@
      if (!hit) return;
      hit.publishStatus = "withdrawn";
      hit.updateTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
      persist();
      return true;
    } catch {
      return false;
@@ -292,7 +289,6 @@
        cancelButtonText: "取消",
      });
      allRows.value = allRows.value.filter((r) => r.id !== row.id);
      persist();
      return true;
    } catch {
      return false;