perf(公告模块): 代码补充

1.系统公告管理pinia代码补充
2.个人公告管理pinia代码补充
This commit is contained in:
Kven 2024-12-23 14:03:00 +08:00
parent 8a228763c7
commit 4605b955b0
4 changed files with 136 additions and 0 deletions

View File

@ -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;

View File

@ -0,0 +1,8 @@
// export type bulletinsType = '' | '*' | 'admin' | 'user' | string[];
export interface bulletinsStore {
title?: string;
top?: string[];
content?: string;
remark?: string;
attachmentIds?: string[];
}

View File

@ -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;

View File

@ -0,0 +1,7 @@
// export type bulletinsType = '' | '*' | 'admin' | 'user' | string[];
export interface bulletinsStore {
title?: string;
state?: string[];
publishTimeBegin?: string;
publishTimeEnd?: string;
}