yyb
4 小时以前 0a58164ce2ea3f1a2b46781757d78b94b212883b
src/views/officeProcessAutomation/EnterpriseNews/news-manage/useEnterpriseNews.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 {
  NEWS_TYPE_OPTIONS,
  PUBLISH_STATUS_OPTIONS,
@@ -11,7 +11,6 @@
  DEPT_OPTIONS,
  createEmptyForm,
  loadStoredNews,
  saveStoredNews,
  getUnreadEmployees,
  readRate,
  nextNewsNo,
@@ -22,8 +21,7 @@
} from "./enterpriseNewsUtils.js";
export function useEnterpriseNews() {
  const stored = loadStoredNews();
  const allRows = ref(stored?.length ? stored : []);
  const allRows = ref([]);
  const searchForm = reactive({
    keyword: "",
@@ -176,9 +174,9 @@
    },
  ]);
  function persist() {
    saveStoredNews(allRows.value);
  }
  onMounted(() => {
    loadStoredNews();
  });
  function handleQuery() {
    tableLoading.value = true;
@@ -255,7 +253,6 @@
      if (!hit.readRecords?.length) {
        hit.readRecords = [];
      }
      persist();
      return true;
    } catch {
      return false;
@@ -306,7 +303,6 @@
      }
      allRows.value[idx] = { ...prev, ...payload };
    }
    persist();
    formDialog.visible = false;
    return { ok: true };
  }
@@ -316,7 +312,6 @@
    if (hit) {
      hit.publishStatus = "archived";
      hit.updateTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
      persist();
    }
  }
@@ -355,7 +350,6 @@
    });
    hit.readRecords = records;
    hit.updateTime = now;
    persist();
    unreadDialog.visible = false;
    return { ok: true, count: selectedIds.length };
  }
@@ -370,7 +364,6 @@
    } else {
      hit.likes.push({ userId, name: userName, time: dayjs().format("YYYY-MM-DD HH:mm:ss") });
    }
    persist();
    if (detailRow.value?.id === row.id) {
      detailRow.value = { ...hit };
    }
@@ -389,7 +382,6 @@
      content: text,
      time: dayjs().format("YYYY-MM-DD HH:mm:ss"),
    });
    persist();
    if (detailRow.value?.id === row.id) {
      detailRow.value = { ...hit };
    }