perf(公告模块): 代码补充
1.系统公告管理pinia代码补充 2.个人公告管理pinia代码补充
This commit is contained in:
parent
8a228763c7
commit
4605b955b0
88
src/store/modules/bulle-mgmt/index.ts
Normal file
88
src/store/modules/bulle-mgmt/index.ts
Normal 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;
|
8
src/store/modules/bulle-mgmt/type.ts
Normal file
8
src/store/modules/bulle-mgmt/type.ts
Normal file
@ -0,0 +1,8 @@
|
||||
// export type bulletinsType = '' | '*' | 'admin' | 'user' | string[];
|
||||
export interface bulletinsStore {
|
||||
title?: string;
|
||||
top?: string[];
|
||||
content?: string;
|
||||
remark?: string;
|
||||
attachmentIds?: string[];
|
||||
}
|
33
src/store/modules/bulletins/index.ts
Normal file
33
src/store/modules/bulletins/index.ts
Normal 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;
|
7
src/store/modules/bulletins/type.ts
Normal file
7
src/store/modules/bulletins/type.ts
Normal file
@ -0,0 +1,7 @@
|
||||
// export type bulletinsType = '' | '*' | 'admin' | 'user' | string[];
|
||||
export interface bulletinsStore {
|
||||
title?: string;
|
||||
state?: string[];
|
||||
publishTimeBegin?: string;
|
||||
publishTimeEnd?: string;
|
||||
}
|
Loading…
Reference in New Issue
Block a user