feat(system): 优化菜单管理功能

- 修改菜单查询接口,增加按名称搜索功能
- 更新消息管理相关接口路径
- 优化菜单编辑组件,使用树形结构选择父级菜单
- 移除产品 TSL 组件中的冗余代码
This commit is contained in:
Kven 2025-01-13 20:30:03 +08:00
parent 8421ce2836
commit 9f98fe832a
6 changed files with 277 additions and 263 deletions

View File

@ -23,8 +23,14 @@ export interface MenuCreateRecord extends MenuRecord{
type: string;
}
export const queryMenuList = () => {
return axios.get('/api/rest/menu');
export const queryMenuList = (data: string) => {
return axios({
url: '/api/rest/menu/tree',
method: 'get',
params: {
name: data,
},
});
};
export const createMenu = (data: MenuCreateRecord) => {

View File

@ -56,27 +56,27 @@ export type MessageListType = MessagesList[];
// 查看详情
export function queryMessage(id: number) {
return axios.get(`/api/rest/message/self/${id}`);
return axios.get(`/api/rest/notice/self/${id}`);
}
// 分页查询
export function queryMessagesList(data: MessagesRecord) {
return axios({
url: '/api/rest/message/self',
url: '/api/rest/notice/self',
method: 'get',
params: data,
});
}
// 未读消息数量
export function queryMessagesCount() {
return axios.get('/api/rest/message/count-unread');
return axios.get('/api/rest/notice/count-unread');
}
// 已读消息数量
export function queryMessagesReadCount() {
return axios.get('/api/rest/message/acknowledge');
return axios.get('/api/rest/notice/acknowledge');
}
// 批量设置消息已读
export function setMessageStatus(data: MessageStatus) {
return axios.patch<MessageListType>('/api/rest/message/read', data);
return axios.patch<MessageListType>('/api/rest/notice/read', data);
}

View File

@ -71,8 +71,6 @@
</a-tab-pane>
</a-tabs>
</a-card>
</div>
<a-modal
width="900px"
height="500px"
@ -319,8 +317,7 @@
<a-button class="editor-button" type="primary" @click="handleSubmit">确定</a-button>
</template>
</a-modal>
</div>
</template>
<script lang="ts" setup>
@ -371,7 +368,6 @@
const propertyData = ref([]);
const eventData = ref([]);
const keyValue = ref('1');
const paramsData = ref([]);
const dataTypeOptions = computed<SelectOptionData[]>(() => [
{
label: '整型',

View File

@ -26,8 +26,15 @@
field="pid"
label="父级菜单名称"
>
<a-input
<a-tree-select
v-model="formData.pid"
:data="props.menuData"
:field-names="{
key: 'id',
title: 'name',
children: 'children',
}"
:allow-clear="true"
placeholder='请输入父级菜单名称'
/>
</a-form-item>
@ -144,6 +151,9 @@
menu: {
type: Object as PropType<MenuRecord>,
},
menuData: {
type: Object as PropType<MenuRecord>,
},
isCreate: Boolean,
});
const modalTitle = computed(() => {
@ -185,6 +195,8 @@
//
const handleClick = () => {
setVisible(true);
console.log(props.menuData);
console.log(props.menu);
};
//

View File

@ -13,7 +13,7 @@
<a-row :gutter="16">
<a-col :span="12">
<a-form-item
field="title"
field="name"
label="菜单名称"
>
<a-input
@ -47,7 +47,7 @@
<a-row style="margin-bottom: 16px">
<a-col :span="12">
<a-space>
<MenuEdit ref="createRef" :is-create="true" @refresh="search" />
<MenuEdit ref="createRef" :is-create="true" :menuData="renderData" @refresh="search" />
</a-space>
</a-col>
<a-col
@ -132,6 +132,7 @@
<MenuEdit
ref="editRef"
:menu="record"
:menuData="renderData"
:is-create="false"
@refresh="search"
/>
@ -181,7 +182,6 @@
const generateFormModel = () => {
return {
name: '',
type: '',
};
};
@ -221,7 +221,7 @@
const fetchData = async () => {
setLoading(true);
try {
const res = await queryMenuList();
const res = await queryMenuList(formModel.value.name || 'all');
renderData.value = res.data;
} catch (err) {
// you can report use errorHandler or other

View File

@ -193,7 +193,7 @@
},
]);
//
//
const fetchData = async (
params: BulletinsRecord = { size: 10, current: 1 }
) => {