| | |
| | | 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, |
| | |
| | | READ_SCOPE_OPTIONS, |
| | | DEPT_OPTIONS, |
| | | createEmptyForm, |
| | | createInitialMockNotices, |
| | | loadStoredNotices, |
| | | saveStoredNotices, |
| | | nextNoticeNo, |
| | | validateNoticeForm, |
| | | noticeTypeLabel, |
| | |
| | | } from "./noticeAnnouncementUtils.js"; |
| | | |
| | | export function useNoticeAnnouncement() { |
| | | const stored = loadStoredNotices(); |
| | | const allRows = ref(stored?.length ? stored : createInitialMockNotices()); |
| | | const allRows = ref([]); |
| | | |
| | | const searchForm = reactive({ |
| | | keyword: "", |
| | |
| | | }, |
| | | ]); |
| | | |
| | | function persist() { |
| | | saveStoredNotices(allRows.value); |
| | | } |
| | | onMounted(() => { |
| | | loadStoredNotices(); |
| | | }); |
| | | |
| | | function handleQuery() { |
| | | tableLoading.value = true; |
| | |
| | | } |
| | | allRows.value[idx] = { ...prev, ...payload }; |
| | | } |
| | | persist(); |
| | | formDialog.visible = false; |
| | | return { ok: true }; |
| | | } |
| | |
| | | hit.publishTime = now; |
| | | hit.updateTime = now; |
| | | if (hit.noticeType === "emergency") hit.priority = "urgent"; |
| | | persist(); |
| | | return true; |
| | | } catch { |
| | | return false; |
| | |
| | | if (!hit) return; |
| | | hit.publishStatus = "withdrawn"; |
| | | hit.updateTime = dayjs().format("YYYY-MM-DD HH:mm:ss"); |
| | | persist(); |
| | | return true; |
| | | } catch { |
| | | return false; |
| | |
| | | cancelButtonText: "取消", |
| | | }); |
| | | allRows.value = allRows.value.filter((r) => r.id !== row.id); |
| | | persist(); |
| | | return true; |
| | | } catch { |
| | | return false; |