mooho-base-admin-plus 2.5.34 → 2.5.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "2.5.34",
4
+ "version": "2.5.36",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -108,7 +108,10 @@
108
108
  :highlight-row="highlightRow"
109
109
  @on-column-width-resize="columnWidthResize"
110
110
  @on-sort-change="sortChange"
111
- @on-selection-change="onSelectionChange"
111
+ @on-select="onSelect"
112
+ @on-select-cancel="onSelectCancel"
113
+ @on-select-all="onSelectAll"
114
+ @on-select-all-cancel="onSelectAllCancel"
112
115
  @on-drag-drop="(index1, index2) => this.$emit('on-drag-drop', index1, index2)"
113
116
  @on-current-change="(currentRow, oldCurrentRow) => $emit('on-current-change', currentRow, oldCurrentRow)"
114
117
  >
@@ -2173,32 +2176,53 @@
2173
2176
  this.$refs.filterSetting.open(this.tableView, this.copy(this.tableView.filterColumns));
2174
2177
  });
2175
2178
  },
2176
- // 选中变化
2177
- onSelectionChange(selection) {
2179
+ onSelect(selection, row) {
2180
+ row._checked = true;
2181
+ this.selectedData.push(row);
2182
+
2183
+ /**
2184
+ * 选中项变化事件
2185
+ */
2186
+ this.$emit('on-select-change');
2187
+ },
2188
+ onSelectCancel(selection, row) {
2189
+ const index = this.selectedData.findIndex(i => {
2190
+ return i.id == row.id;
2191
+ });
2192
+
2193
+ row._checked = false;
2194
+ this.selectedData.splice(index, 1);
2195
+
2196
+ /**
2197
+ * 选中项变化事件
2198
+ */
2199
+ this.$emit('on-select-change');
2200
+ },
2201
+ onSelectAll(selection) {
2178
2202
  // 当页所有数据
2179
2203
  let allData = this.getDataWithChildren(this.data);
2204
+ this.selectedData.length = 0;
2180
2205
 
2181
2206
  allData.forEach(item => {
2182
- const index = this.selectedData.findIndex(i => {
2183
- return i.id == item.id;
2184
- });
2207
+ item._checked = true;
2208
+ this.selectedData.push(item);
2209
+ });
2185
2210
 
2186
- if (selection.some(i => i.id == item.id)) {
2187
- // 选中
2188
- if (index == -1) {
2189
- item._checked = true;
2190
- this.selectedData.push(item);
2191
- }
2192
- } else {
2193
- // 未选中, 剔除
2211
+ /**
2212
+ * 选中项变化事件
2213
+ */
2214
+ this.$emit('on-select-change');
2215
+ },
2216
+ onSelectAllCancel(selection) {
2217
+ // 当页所有数据
2218
+ let allData = this.getDataWithChildren(this.data);
2194
2219
 
2195
- if (index != -1) {
2196
- item._checked = false;
2197
- this.selectedData.splice(index, 1);
2198
- }
2199
- }
2220
+ allData.forEach(item => {
2221
+ item._checked = false;
2200
2222
  });
2201
2223
 
2224
+ this.selectedData.length = 0;
2225
+
2202
2226
  /**
2203
2227
  * 选中项变化事件
2204
2228
  */
@@ -5,6 +5,7 @@ import util from '../../../../libs/util';
5
5
  import router from '../../../../router';
6
6
  import userApi from '../../../../api/user';
7
7
  import swal from 'sweetalert2';
8
+ import Setting from '../../../../setting';
8
9
 
9
10
  export default {
10
11
  namespaced: true,
@@ -17,7 +18,7 @@ export default {
17
18
  */
18
19
  async login({ dispatch }, { username = '', password = '' } = {}) {
19
20
  const res = await userApi.login({ account: username, password });
20
- dispatch('admin/account/saveLoginData', res, { root: true });
21
+ await dispatch('admin/account/saveLoginData', res, { root: true });
21
22
  },
22
23
  /**
23
24
  * @description 保存登录信息
@@ -38,10 +39,12 @@ export default {
38
39
  // 设置 vuex 用户信息
39
40
  await dispatch('admin/user/set', user, { root: true });
40
41
  await dispatch('admin/user/setData', data, { root: true });
41
- // 用户登录后从持久化数据加载一系列的设置
42
- await dispatch('load');
42
+
43
43
  // 获取动态菜单
44
44
  await dispatch('admin/menu/getMenuList', true, { root: true });
45
+
46
+ // 用户登录后从持久化数据加载一系列的设置
47
+ await dispatch('load', { loadOpenedTabs: Setting.page.loadOpenedTabs });
45
48
  },
46
49
  /**
47
50
  * @description 退出登录
@@ -93,7 +96,7 @@ export default {
93
96
  // 加载用户登录信息
94
97
  await dispatch('admin/user/load', null, { root: true });
95
98
  // 持久化数据加载上次退出时的多页列表
96
- //await dispatch('admin/page/openedLoad', { loadOpenedTabs }, { root: true });
99
+ await dispatch('admin/page/openedLoad', { loadOpenedTabs }, { root: true });
97
100
  }
98
101
  }
99
102
  };
@@ -251,6 +251,10 @@ export default {
251
251
  let path = to.path;
252
252
  let headerName = getHeaderName(path, menuSiderList);
253
253
 
254
+ if (headerName == null) {
255
+ headerName = 'home';
256
+ }
257
+
254
258
  //}
255
259
  // 在 404 时,是没有 headerName 的
256
260
  if (headerName !== null) {
@@ -4,7 +4,6 @@
4
4
  import { cloneDeep, get } from 'lodash';
5
5
  import router from '../../../../router';
6
6
  import Setting from '../../../../setting';
7
- import menuSider from '../../../../menu/sider';
8
7
  import { getAllSiderMenu, includeArray } from '../../../../libs/system';
9
8
 
10
9
  // 判定是否需要缓存
@@ -68,14 +67,20 @@ export default {
68
67
  .filter((opened, index) => valid[index] === 1)
69
68
  // 对 menu 鉴权过滤
70
69
  .filter(opened => {
70
+ let menuSider = rootState.admin.menu.menuSider;
71
+
71
72
  const allSiderMenu = getAllSiderMenu(menuSider);
73
+
72
74
  const find = allSiderMenu.find(item => item.path === opened.fullPath);
73
75
 
74
76
  let state = true;
75
- if (find && find.auth) {
77
+ if (!find) {
78
+ state = false;
79
+ } else if (find && find.auth) {
76
80
  const userInfo = rootState.admin.user.info;
77
81
  // @权限
78
82
  const access = cloneDeep(userInfo.access);
83
+
79
84
  // 给 access 强制加一个 hidden 的权限,否则菜单隐藏后,Tabs 页签会不显示该页签
80
85
  access.push('hidden');
81
86
  // 如果用户当前的权限,不是该 menu 对应的 权限,则过滤这个 Tab