Commit 994681fd authored by 水落(YangLei)'s avatar 水落(YangLei)

feat: 菜单管理bug修复

parent a5b6726e
...@@ -30,3 +30,12 @@ $ npm run serve ...@@ -30,3 +30,12 @@ $ npm run serve
css 工具函数 地址 css 工具函数 地址
https://www.tailwindcss.cn/docs/installation#post-css-7 https://www.tailwindcss.cn/docs/installation#post-css-7
已完成:
1、菜单增删改
问题:
1、通知接口 404 导致后续没开发了
2、角色,新增,修改, functionAuthority 菜单权限这个字段不知道怎么传
3、系统日志,没发现api,之前系统也没页面。不知道怎么搞
...@@ -4,14 +4,26 @@ export function delMenuApi(id) { ...@@ -4,14 +4,26 @@ export function delMenuApi(id) {
return delReq(`/api/v1/menus/${id}`); return delReq(`/api/v1/menus/${id}`);
} }
export function getMenuDataApi() { /**
return getReq('/api/v1/menus'); * 缓存下,菜单变化的可能性比较小
*/
let menus = [];
export async function getMenuDataApi(useCache) {
if (menus.length && useCache) return menus;
return getReq('/api/v1/menus').then(res => {
menus = res;
return res;
});
} }
export function addMenuApi(data) { export function addMenuApi(data) {
return postReq('/api/v1/menus', data); return postReq('/api/v1/menus', data);
} }
export function updateMenuApi(data) {
return putReq('/api/v1/menus', data);
}
export function addRoleApi(data) { export function addRoleApi(data) {
return postReq('/api/v1/roles', data); return postReq('/api/v1/roles', data);
} }
......
...@@ -38,7 +38,8 @@ export default { ...@@ -38,7 +38,8 @@ export default {
}; };
}, },
async mounted() { async mounted() {
this.rawData = await getMenuDataApi(); // 使用 缓存
this.rawData = await getMenuDataApi(true);
this.treeData = convertListToTree(this.rawData, !this.showMenu); this.treeData = convertListToTree(this.rawData, !this.showMenu);
this.$emit('check', this.defaultCheckedKeys); this.$emit('check', this.defaultCheckedKeys);
this.expandedKeys = this.defaultCheckedKeys; this.expandedKeys = this.defaultCheckedKeys;
......
...@@ -34,7 +34,6 @@ export default { ...@@ -34,7 +34,6 @@ export default {
}, },
async mounted() { async mounted() {
this.treeData = convertListToTree(await getMenuDataApi(), true); this.treeData = convertListToTree(await getMenuDataApi(), true);
console.log(this.treeData);
}, },
}; };
</script> </script>
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
}, },
watch: { watch: {
addVisible(val) { addVisible(val) {
if (!val && this.addBtn.onCancel) this.addBtn.onCancel(); if (!val && this?.addBtn?.onCancel) this.addBtn.onCancel();
}, },
}, },
mounted() { mounted() {
......
...@@ -18,8 +18,8 @@ const settingConfig = { ...@@ -18,8 +18,8 @@ const settingConfig = {
multiPage: true, //多页签模式,true:开启,false:不开启 multiPage: true, //多页签模式,true:开启,false:不开启
cachePage: true, //是否缓存页面数据,仅多页签模式下生效,true 缓存, false 不缓存 cachePage: true, //是否缓存页面数据,仅多页签模式下生效,true 缓存, false 不缓存
hideSetting: false, //隐藏设置抽屉,true:隐藏,false:不隐藏 hideSetting: false, //隐藏设置抽屉,true:隐藏,false:不隐藏
systemCode: "Akina", //系统编码 systemCode: "Karot", //系统编码
systemName: "Akina Antd Vue Pro", //系统名称 systemName: "Karot文档管理系统", //系统名称
copyright: "2021~ C.T 工作室出品", //copyright copyright: "2021~ C.T 工作室出品", //copyright
asyncRoutes: false, //异步加载路由,true:开启,false:不开启 asyncRoutes: false, //异步加载路由,true:开启,false:不开启
showPageTitle: true, //是否显示页面标题(PageLayout 布局中的页面标题),true:显示,false:不显示 showPageTitle: true, //是否显示页面标题(PageLayout 布局中的页面标题),true:显示,false:不显示
......
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
edit(data) { edit(data) {
this.$refs['table']?.show({ type: 1 }); this.$refs['table']?.show({ type: 1 });
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['addForm'].setEdit(data); this.$refs['addForm'].setEdit({ ...data });
}); });
}, },
}, },
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</template> </template>
<script> <script>
import { addMenuApi } from '@/api'; import { addMenuApi, updateMenuApi } from '@/api';
import MenuTree from '@/components/menu_tree/select.vue'; import MenuTree from '@/components/menu_tree/select.vue';
export default { export default {
...@@ -58,7 +58,8 @@ export default { ...@@ -58,7 +58,8 @@ export default {
methods: { methods: {
async submit() { async submit() {
await this.$refs['form'].validate(); await this.$refs['form'].validate();
return addMenuApi({ ...this.form, parentMenuId: this.form.parentMenuId ?? 0 }); const reqData = { ...this.form, parentMenuId: this.form.parentMenuId ?? 0 };
return this.isEdit ? updateMenuApi(reqData) : addMenuApi(reqData);
}, },
setEdit(data) { setEdit(data) {
this.type = 1; this.type = 1;
......
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
this.$refs['table']?.getData(); this.$refs['table']?.getData();
}, },
view(data, type) { view(data, type) {
this.$refs['table']?.show({ type }); this.$refs['table']?.show({ type, noFooter: type === 2 });
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['form'].setData({ ...data }, type); this.$refs['form'].setData({ ...data }, type);
}); });
......
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
computed: {}, computed: {},
methods: { methods: {
submit() { submit() {
const query = { ...this.form, authorityList: this.$refs['menuTree'].get() }; const query = { ...this.form, functionAuthority: this.checkedKeys.map(i => i.toString()) };
return this.isEdit ? updateRoleApi(query) : addRoleApi(query); return this.isEdit ? updateRoleApi(query) : addRoleApi(query);
}, },
setData(data, type) { setData(data, type) {
......
<template> <template>
<h1>消息仲系</h1> <my-table url="/api/v1/messages/notice">
<a-table-column title="标题" data-index="noticeTitle" />
<a-table-column title="内容" data-index="noticeContent" />
<a-table-column title="创建时间" data-index="createTime" />
<a-table-column title="发送者" data-index="noticeSenderName" />
<a-table-column title="接受者" data-index="noticeReceiverName" />
<a-table-column title="是否已读" data-index="isReadName" />
<a-table-column title="已读时间" data-index="readTime" />
</my-table>
</template> </template>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment