From 4605b955b0bf780dc5bc2707ec65325523571f77 Mon Sep 17 00:00:00 2001 From: Kven <2955163637@qq.com> Date: Mon, 23 Dec 2024 14:03:00 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E5=85=AC=E5=91=8A=E6=A8=A1=E5=9D=97):=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.系统公告管理pinia代码补充 2.个人公告管理pinia代码补充 --- src/store/modules/bulle-mgmt/index.ts | 88 +++++++++++++++++++++++++++ src/store/modules/bulle-mgmt/type.ts | 8 +++ src/store/modules/bulletins/index.ts | 33 ++++++++++ src/store/modules/bulletins/type.ts | 7 +++ 4 files changed, 136 insertions(+) create mode 100644 src/store/modules/bulle-mgmt/index.ts create mode 100644 src/store/modules/bulle-mgmt/type.ts create mode 100644 src/store/modules/bulletins/index.ts create mode 100644 src/store/modules/bulletins/type.ts diff --git a/src/store/modules/bulle-mgmt/index.ts b/src/store/modules/bulle-mgmt/index.ts new file mode 100644 index 0000000..6ee0642 --- /dev/null +++ b/src/store/modules/bulle-mgmt/index.ts @@ -0,0 +1,88 @@ +import { defineStore } from 'pinia'; +import { + BulletinCreateRecord, + BulletinRecord, + BulletinsRecord, + create, + update, + toggle, + publish, + close, + remove, + queryBulletinListAll, + queryBulletinList, + addAttachments, + queryDeptTreeList, + addAttachment, + deleteAttachment +} from '@/api/bulletin-mgmt'; +import { bulletinsStore } from '@/store/modules/bulle-mgmt/type'; + +const useBulletinStore = defineStore('dept', { + state: ():bulletinsStore => ({ + remark: undefined, + title: undefined, + top: undefined, + content: undefined, + attachmentIds: undefined, + }), + + getters: { + DeptInfo(state: bulletinsStore): bulletinsStore { + return { ...state }; + }, + }, + actions: { + async queryBulletinListAll(id: number) { + return queryBulletinListAll(id); + }, + + async queryBulletinList(params: BulletinsRecord) { + return queryBulletinList(params); + }, + + async removeBulletin(id: number) { + return remove(id); + }, + + async createBulletin(params: BulletinCreateRecord) { + return create(params); + }, + + async updateBulletin(params: BulletinRecord) { + return update(params); + }, + + async toggleBulletin(id: number) { + return toggle(id); + }, + + async publishBulletin(data: number[]) { + return publish(data); + }, + + async closeBulletin(id: number) { + return close(id); + }, + + async addAttachments(data: any) { + return addAttachments(data); + }, + + // 获取部门树 + async queryDeptTreeList() { + return queryDeptTreeList(); + }, + + // 获取附件信息 + async queryAttachmentInfo(id: string) { + return addAttachment(id); + }, + + // 删除附件 + async deleteAttachment(id: string) { + return deleteAttachment(id); + } + }, +}); +export default useBulletinStore; \ No newline at end of file diff --git a/src/store/modules/bulle-mgmt/type.ts b/src/store/modules/bulle-mgmt/type.ts new file mode 100644 index 0000000..e51b348 --- /dev/null +++ b/src/store/modules/bulle-mgmt/type.ts @@ -0,0 +1,8 @@ +// export type bulletinsType = '' | '*' | 'admin' | 'user' | string[]; +export interface bulletinsStore { + title?: string; + top?: string[]; + content?: string; + remark?: string; + attachmentIds?: string[]; +} \ No newline at end of file diff --git a/src/store/modules/bulletins/index.ts b/src/store/modules/bulletins/index.ts new file mode 100644 index 0000000..e2655e6 --- /dev/null +++ b/src/store/modules/bulletins/index.ts @@ -0,0 +1,33 @@ +import { defineStore } from 'pinia'; +import { + queryBulletinsListAll, + queryBulletinsList, + BulletinsRecord +} from '@/api/bulletins'; +import { bulletinsStore } from './type'; + +const useBulletinsStore = defineStore('auth', { + state: (): bulletinsStore => ({ + title: undefined, + state: undefined, + publishTimeBegin: undefined, + publishTimeEnd: undefined, + }), + + getters: { + AuthInfo(state: bulletinsStore): bulletinsStore { + return { ...state }; + }, + }, + actions: { + async getBulletinsList(data: BulletinsRecord) { + return queryBulletinsList(data); + }, + + async getBulletinsListAll(data: number) { + return queryBulletinsListAll(data); + }, + } + }); + +export default useBulletinsStore; \ No newline at end of file diff --git a/src/store/modules/bulletins/type.ts b/src/store/modules/bulletins/type.ts new file mode 100644 index 0000000..f7851d8 --- /dev/null +++ b/src/store/modules/bulletins/type.ts @@ -0,0 +1,7 @@ +// export type bulletinsType = '' | '*' | 'admin' | 'user' | string[]; +export interface bulletinsStore { + title?: string; + state?: string[]; + publishTimeBegin?: string; + publishTimeEnd?: string; +} \ No newline at end of file