|
@@ -23,7 +23,7 @@
|
|
|
<data-form :fields="formFields" :data="form" :rules="{}" @save="drawerSave" :isNew="drawerIsNew">
|
|
|
<template #custom="{item, form}">
|
|
|
<el-checkbox-group v-model="form.menus">
|
|
|
- <el-checkbox v-for="(i, index) in menuList" :key="index" :label="i._id">{{ i.role_name }}</el-checkbox>
|
|
|
+ <el-checkbox v-for="(i, index) in menuList" :key="index" :label="i.id">{{ i.role_name }}</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
</template>
|
|
|
</data-form>
|
|
@@ -38,6 +38,7 @@ import dataTable from '@/components/data-table.vue';
|
|
|
import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: authUser } = createNamespacedHelpers('authUser');
|
|
|
const { mapActions: role } = createNamespacedHelpers('role');
|
|
|
+const { mapActions: loginMenu } = createNamespacedHelpers('login');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -85,6 +86,7 @@ export default {
|
|
|
methods: {
|
|
|
...authUser(['fetch', 'query', 'update']),
|
|
|
...role({ getRoleList: 'query' }),
|
|
|
+ ...loginMenu(['toGetMenu']),
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
const res = await this.query({ skip, limit, role: '4', pid: this.user.uid, ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
@@ -127,8 +129,15 @@ export default {
|
|
|
this.drawerIsNew = true;
|
|
|
},
|
|
|
async getOtherList() {
|
|
|
- const res = await this.getRoleList();
|
|
|
- if (this.$checkRes(res)) this.$set(this, `menuList`, res.data.reverse());
|
|
|
+ if (this.user.role == '1') {
|
|
|
+ const res = await this.getRoleList({ id: this.user.uid });
|
|
|
+ console.log(res);
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `menuList`, res.data.reverse());
|
|
|
+ } else if (this.user.role == '4') {
|
|
|
+ const res = await this.toGetMenu({ id: this.user.uid });
|
|
|
+ console.log(res);
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `menuList`, res.data.menus.reverse());
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
computed: {
|