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