|
|
@@ -6,6 +6,7 @@ export default {
|
|
|
namespace: 'authority',
|
|
|
state: {
|
|
|
originData: {
|
|
|
+ panelLoading: false,
|
|
|
tabActiveKey: 'userGroup',
|
|
|
menuSelectedKeys: [],
|
|
|
groupFilterLabel: '',
|
|
|
@@ -36,11 +37,15 @@ export default {
|
|
|
effects: {
|
|
|
*fetchDashboardTree(action, { put, call, select }) {
|
|
|
try{
|
|
|
- const { dtype, code } = action;
|
|
|
+ const { dtype, code, silent } = action;
|
|
|
+ if(!silent) {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: true });
|
|
|
+ }
|
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.ACCESS_DASHBOARD_TREE + '/' + dtype + '/' + code,
|
|
|
method: 'GET'
|
|
|
})
|
|
|
+
|
|
|
if(!res.err && res.data.code > 0) {
|
|
|
const list = res.data.data || [];
|
|
|
const dashboardList = list.map(l => l.id + '');
|
|
|
@@ -54,11 +59,16 @@ export default {
|
|
|
}catch(e) {
|
|
|
message.error('获取报表目录失败: ' + e.message);
|
|
|
return false;
|
|
|
+ }finally {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: false });
|
|
|
}
|
|
|
},
|
|
|
*add(action, { select, put, call }) {
|
|
|
try {
|
|
|
- const { dtype, code, dashboardCode } = action;
|
|
|
+ const { dtype, code, dashboardCode, silent } = action;
|
|
|
+ if(!silent) {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: true });
|
|
|
+ }
|
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.ACCESS_ADD,
|
|
|
method: 'POST',
|
|
|
@@ -75,11 +85,16 @@ export default {
|
|
|
}
|
|
|
}catch(e) {
|
|
|
message.error('设置权限失败: ' + e.message);
|
|
|
+ }finally {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: false });
|
|
|
}
|
|
|
},
|
|
|
*addAll(action, { select, put, call }) {
|
|
|
try {
|
|
|
- const { dtype, code, dashboardCodes } = action;
|
|
|
+ const { dtype, code, dashboardCodes, silent } = action;
|
|
|
+ if(!silent) {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: true });
|
|
|
+ }
|
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.ACCESS_ADD_ALL,
|
|
|
method: 'POST',
|
|
|
@@ -96,11 +111,16 @@ export default {
|
|
|
}
|
|
|
}catch(e) {
|
|
|
message.error('设置权限失败: ' + e.message);
|
|
|
+ }finally {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: false });
|
|
|
}
|
|
|
},
|
|
|
*remove(action, { select, put, call }) {
|
|
|
try {
|
|
|
- const { dtype, code, dashboardCode } = action;
|
|
|
+ const { dtype, code, dashboardCode, silent } = action;
|
|
|
+ if(!silent) {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: true });
|
|
|
+ }
|
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.ACCESS_REMOVE,
|
|
|
method: 'POST',
|
|
|
@@ -117,11 +137,16 @@ export default {
|
|
|
}
|
|
|
}catch(e) {
|
|
|
message.error('设置权限失败: ' + e.message);
|
|
|
+ }finally {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: false });
|
|
|
}
|
|
|
},
|
|
|
*removeAll(action, { select, put, call }) {
|
|
|
try {
|
|
|
- const { dtype, code, dashboardCodes } = action;
|
|
|
+ const { dtype, code, dashboardCodes, silent } = action;
|
|
|
+ if(!silent) {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: true });
|
|
|
+ }
|
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.ACCESS_REMOVE_ALL,
|
|
|
method: 'POST',
|
|
|
@@ -138,6 +163,19 @@ export default {
|
|
|
}
|
|
|
}catch(e) {
|
|
|
message.error('设置权限失败: ' + e.message);
|
|
|
+ }finally {
|
|
|
+ yield put({ type: 'setField', name: 'panelLoading', value: false });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ *batchActions(action, { select, put, call}) {
|
|
|
+ try {
|
|
|
+ const { actions } = action;
|
|
|
+ for(let i = 0; i < actions.length; i++) {
|
|
|
+ let act = actions[i];
|
|
|
+ yield put({ ...act });
|
|
|
+ }
|
|
|
+ }catch(e) {
|
|
|
+ message.error(e.message);
|
|
|
}
|
|
|
}
|
|
|
},
|