|
@@ -23,7 +23,8 @@
|
|
<script>
|
|
<script>
|
|
import { system, personnel, government, record, serve, enterprise, duijiehui, site, user, links, permission, dictionary } from '@/util/role_menu.js';
|
|
import { system, personnel, government, record, serve, enterprise, duijiehui, site, user, links, permission, dictionary } from '@/util/role_menu.js';
|
|
import * as menus from '@/util/role_menu.js';
|
|
import * as menus from '@/util/role_menu.js';
|
|
-import { mapState } from 'vuex';
|
|
|
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
|
+const { mapActions } = createNamespacedHelpers('marketcolumn');
|
|
import _ from 'lodash';
|
|
import _ from 'lodash';
|
|
export default {
|
|
export default {
|
|
name: 'sideMenu',
|
|
name: 'sideMenu',
|
|
@@ -34,36 +35,53 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState({
|
|
|
|
- menuList: state => state.publics.menuList,
|
|
|
|
- }),
|
|
|
|
|
|
+ ...mapState(['user']),
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.serrch();
|
|
this.serrch();
|
|
if (this.menu.length === 0) this.getMenuList();
|
|
if (this.menu.length === 0) this.getMenuList();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ ...mapActions(['fetch', 'create', 'update', 'query']),
|
|
|
|
+ async serrch() {
|
|
|
|
+ const res = await this.query();
|
|
|
|
+ for (const val of this.user.columnid) {
|
|
|
|
+ var result = res.data.filter(item => item.id == val);
|
|
|
|
+ for (const acc of result) {
|
|
|
|
+ if (acc.name == system.name) {
|
|
|
|
+ this.menu.push(system);
|
|
|
|
+ } else if (acc.name == personnel.name) {
|
|
|
|
+ this.menu.push(personnel);
|
|
|
|
+ } else if (acc.name == government.name) {
|
|
|
|
+ this.menu.push(government);
|
|
|
|
+ } else if (acc.name == record.name) {
|
|
|
|
+ this.menu.push(record);
|
|
|
|
+ } else if (acc.name == serve.name) {
|
|
|
|
+ this.menu.push(serve);
|
|
|
|
+ } else if (acc.name == enterprise.name) {
|
|
|
|
+ this.menu.push(enterprise);
|
|
|
|
+ } else if (acc.name == site.name) {
|
|
|
|
+ this.menu.push(site);
|
|
|
|
+ } else if (acc.name == user.name) {
|
|
|
|
+ this.menu.push(user);
|
|
|
|
+ } else if (acc.name == links.name) {
|
|
|
|
+ this.menu.push(links);
|
|
|
|
+ } else if (acc.name == permission.name) {
|
|
|
|
+ this.menu.push(permission);
|
|
|
|
+ } else if (acc.name == dictionary.name) {
|
|
|
|
+ this.menu.push(dictionary);
|
|
|
|
+ }
|
|
|
|
+ console.log(this.menu);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
turnTo(uri) {
|
|
turnTo(uri) {
|
|
this.$router.push({ path: uri });
|
|
this.$router.push({ path: uri });
|
|
},
|
|
},
|
|
- async serrch() {
|
|
|
|
- this.menu.push(system);
|
|
|
|
- this.menu.push(personnel);
|
|
|
|
- this.menu.push(government);
|
|
|
|
- this.menu.push(record);
|
|
|
|
- this.menu.push(serve);
|
|
|
|
- this.menu.push(enterprise);
|
|
|
|
- this.menu.push(duijiehui);
|
|
|
|
- this.menu.push(site);
|
|
|
|
- this.menu.push(user);
|
|
|
|
- this.menu.push(links);
|
|
|
|
- this.menu.push(permission);
|
|
|
|
- this.menu.push(dictionary);
|
|
|
|
|
|
|
|
- this.$set(this, `menu`, this.menu);
|
|
|
|
- },
|
|
|
|
getMenuList() {
|
|
getMenuList() {
|
|
- let res = _.uniqBy(this.menuList, 'menu_id');
|
|
|
|
|
|
+ let res = _.uniqBy(this.menuList, 'menuid');
|
|
for (const item of res) {
|
|
for (const item of res) {
|
|
this.menu.push(_.get(menus, item.code));
|
|
this.menu.push(_.get(menus, item.code));
|
|
}
|
|
}
|