Commit 41fec57a authored by 陈浩玮's avatar 陈浩玮

Merge branch 'feature/shuiluo' into 'master'

Feature/shuiluo

See merge request product/kim3-web-vue/starter-web-vue!15
parents 59041a03 091a6d45
...@@ -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,17 +4,34 @@ export function delMenuApi(id) { ...@@ -4,17 +4,34 @@ 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);
} }
export function getRoleApi(id) {
return getReq(`/api/v1/roles/${id}`);
}
export function updateRoleApi(data) { export function updateRoleApi(data) {
return putReq('/api/v1/roles', data); return putReq('/api/v1/roles', data);
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
:tree-data="treeData" :tree-data="treeData"
style="max-height:400px" style="max-height:400px"
class="tw-overflow-y-auto" class="tw-overflow-y-auto"
:expandedKeys.sync="expandedKeys"
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners" v-on="$listeners"
/> />
...@@ -24,6 +25,7 @@ export default { ...@@ -24,6 +25,7 @@ export default {
props: { props: {
value: [Object, Array], value: [Object, Array],
showMenu: Boolean, showMenu: Boolean,
defaultCheckedKeys: Array,
}, },
data() { data() {
return { return {
...@@ -32,11 +34,22 @@ export default { ...@@ -32,11 +34,22 @@ export default {
title: 'menuName', title: 'menuName',
key: 'menuId', key: 'menuId',
}, },
expandedKeys: [],
}; };
}, },
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.expandedKeys = this.defaultCheckedKeys;
},
watch: {
defaultCheckedKeys(val) {
this.$emit('check', val);
this.expandedKeys = val;
},
}, },
methods: { methods: {
......
...@@ -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() {
...@@ -140,6 +140,7 @@ export default { ...@@ -140,6 +140,7 @@ export default {
current: this.initQuery.pageNum, current: this.initQuery.pageNum,
pageSize: this.initQuery.pageSize, pageSize: this.initQuery.pageSize,
total: this.total, total: this.total,
showQuickJumper: true,
}; };
}, },
isRowSelection() { isRowSelection() {
......
...@@ -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:不显示
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
valueFormat="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss"
/> />
</my-form-item> </my-form-item>
<my-form-item label="登录用户"> <my-form-item label="操作用户Id">
<a-input v-model="query.userId" /> <a-input v-model="query.operatorId" />
</my-form-item> </my-form-item>
<my-form-item label="业务模块"> <my-form-item label="业务模块">
<a-select v-model="query.loginType" allowClear> <a-select v-model="query.loginType" allowClear>
...@@ -61,9 +61,6 @@ export default { ...@@ -61,9 +61,6 @@ export default {
}; };
}, },
methods: { methods: {
refreshTable() {
this.$refs.table.getData();
},
showDrawer(type, noFooter) { showDrawer(type, noFooter) {
this.$refs['table'].show({ type, noFooter }); this.$refs['table'].show({ type, noFooter });
}, },
......
...@@ -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);
}); });
......
...@@ -11,15 +11,21 @@ ...@@ -11,15 +11,21 @@
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="菜单权限"> <a-form-model-item label="菜单权限">
<MenuTree v-model="checkedKeys" showMenu ref="menuTree" :disabled="isView" /> <MenuTree
v-model="checkedKeys"
:defaultCheckedKeys="defaultCheckedKeys"
showMenu
ref="menuTree"
:disabled="isView"
/>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
</template> </template>
<script> <script>
import MenuTree from '@/components/menu_tree/index.vue'; import MenuTree from '@/components/menu_tree/index.vue';
import { addRoleApi, getRoleApi, updateRoleApi } from '@/api';
import FormMixin from '@/components/FormMixin'; import FormMixin from '@/components/FormMixin';
import { addRoleApi, updateRoleApi } from '@/api';
export default { export default {
mixins: [FormMixin], mixins: [FormMixin],
...@@ -29,17 +35,23 @@ export default { ...@@ -29,17 +35,23 @@ export default {
form: {}, form: {},
rules: {}, rules: {},
checkedKeys: [], checkedKeys: [],
defaultCheckedKeys: [],
}; };
}, },
computed: {}, computed: {},
methods: { methods: {
add() { submit() {
console.log(1); const query = { ...this.form, functionAuthority: this.checkedKeys.map(i => i.toString()) };
return addRoleApi({ ...this.form, authorityList: this.$refs['menuTree'].get() }); return this.isEdit ? updateRoleApi(query) : addRoleApi(query);
}, },
edit() { setData(data, type) {
console.log(1); this.getData(data.roleId);
return updateRoleApi({ ...this.form, authorityList: this.$refs['menuTree'].get() }); this.type = type;
},
async getData(id) {
const res = await getRoleApi(id);
this.form = res;
this.defaultCheckedKeys = res.menuComponentKeys.map(i => parseInt(i.split('-')[0]));
}, },
}, },
}; };
......
<template>
<my-table url="table" addBtn="addBtn">
<template #search="{query}">
<a-form-model-item label="所属组织">
<a-input v-model="query.name" />
</a-form-model-item>
<a-form-model-item label="所属组织">
<a-input v-model="query.name" />
</a-form-model-item>
<a-form-model-item label="所属组织">
<a-input v-model="query.name" />
</a-form-model-item>
<a-form-model-item label="所属组织">
<a-input v-model="query.name" />
</a-form-model-item>
<a-form-model-item label="所属组织">
<a-input v-model="query.name" />
</a-form-model-item>
<a-form-model-item label="所属组织">
<a-input v-model="query.name" />
</a-form-model-item>
</template>
<template #add>
<a-input v-model="add.name" />
</template>
<a-table-column title="姓名" data-index="name" />
<a-table-column title="操作">
<template #default="row">
<span>
<a> {{ row }}</a>
<a-divider type="vertical" />
<a>Delete</a>
</span>
</template>
</a-table-column>
</my-table>
</template>
<script>
export default {
data: () => ({
add: {},
addBtn: {},
}),
};
</script>
import UserManagement from './UserManagement';
export default UserManagement;
\ No newline at end of file
...@@ -54,6 +54,16 @@ export default { ...@@ -54,6 +54,16 @@ export default {
return this.form.userAvatar ? `${this.$fileUrl}${this.form.userAvatar}` : null; return this.form.userAvatar ? `${this.$fileUrl}${this.form.userAvatar}` : null;
}, },
}, },
mounted() {
if (this.loginId) {
const userInfo = this.$store.state.userInfo;
this.form.userName = userInfo.userName;
this.form.fixedPhone = userInfo.fixedPhone;
this.form.mobilePhone = userInfo.mobilePhone;
this.form.userEmail = userInfo.userEmail;
this.form.userAvatar = userInfo.userAvatar;
}
},
watch: { watch: {
'$store.state.userInfo'(userInfo) { '$store.state.userInfo'(userInfo) {
this.form.userName = userInfo.userName; this.form.userName = userInfo.userName;
......
<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>
...@@ -54,18 +54,5 @@ const routerMap = { ...@@ -54,18 +54,5 @@ const routerMap = {
name: '菜单管理', name: '菜单管理',
component: () => import('@/pages/system/view/menu'), component: () => import('@/pages/system/view/menu'),
}, },
user_management: {
name: '用户管理',
component: () => import('@/pages/system/view/user'),
},
role_management: {
name: '角色管理',
component: () => import('@/pages/system/view/role'),
},
// log_management: {
// name: '日志管理',
// component: () => import('@/pages/system/view/log'),
// },
}; };
export default routerMap; export default routerMap;
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