midway-fatcms 0.0.1-beta.63 → 0.0.1-beta.64
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/dist/libs/utils/parseConfig.d.ts +1 -0
- package/dist/libs/utils/parseConfig.js +3 -0
- package/dist/models/bizmodels.d.ts +7 -2
- package/dist/service/AuthService.d.ts +1 -1
- package/dist/service/AuthService.js +5 -1
- package/dist/service/EnumInfoService.js +1 -1
- package/dist/service/crudstd/CrudStdService.d.ts +1 -0
- package/dist/service/crudstd/CrudStdService.js +13 -2
- package/package.json +1 -1
- package/src/libs/utils/parseConfig.ts +4 -0
- package/src/models/bizmodels.ts +8 -2
- package/src/service/AuthService.ts +6 -1
- package/src/service/EnumInfoService.ts +1 -1
- package/src/service/crudstd/CrudStdService.ts +15 -2
|
@@ -14,6 +14,9 @@ function parseTreeTableToIEnumInfo(dataSource) {
|
|
|
14
14
|
label: label || nodeName,
|
|
15
15
|
value: value || key,
|
|
16
16
|
};
|
|
17
|
+
if (item && typeof item.style === 'string' && item.style) {
|
|
18
|
+
enumInfo.style = item.style.trim();
|
|
19
|
+
}
|
|
17
20
|
if (children) {
|
|
18
21
|
enumInfo.children = children;
|
|
19
22
|
}
|
|
@@ -17,6 +17,7 @@ export interface ITableBaseInfo {
|
|
|
17
17
|
export interface IStdCrudCfgObj {
|
|
18
18
|
tableBaseInfo: ITableBaseInfo;
|
|
19
19
|
authSetting: any;
|
|
20
|
+
kanbanAuthSetting: any;
|
|
20
21
|
actionColumns?: any[];
|
|
21
22
|
queryFormFields?: any[];
|
|
22
23
|
tableColumns?: any[];
|
|
@@ -29,9 +30,13 @@ export interface ICrudStdAppInfo {
|
|
|
29
30
|
actionsMap?: any;
|
|
30
31
|
status: number;
|
|
31
32
|
}
|
|
33
|
+
export interface ISettingKeyActionCfg {
|
|
34
|
+
settingKey: string;
|
|
35
|
+
hasOperationPerm: boolean;
|
|
36
|
+
}
|
|
32
37
|
export interface ICrudStdAppInfoForSettingKey extends ICrudStdAppInfo {
|
|
33
|
-
settingKeyActionCfg?:
|
|
34
|
-
buttonSettingKeyActionCfg?:
|
|
38
|
+
settingKeyActionCfg?: ISettingKeyActionCfg;
|
|
39
|
+
buttonSettingKeyActionCfg?: ISettingKeyActionCfg;
|
|
35
40
|
authConfig?: string[];
|
|
36
41
|
authType?: string;
|
|
37
42
|
}
|
|
@@ -39,7 +39,7 @@ export declare class AuthService {
|
|
|
39
39
|
* @param loginName
|
|
40
40
|
* @param workbenchCode
|
|
41
41
|
*/
|
|
42
|
-
createUserSession(loginName: string, workbenchCode: string): Promise<{
|
|
42
|
+
createUserSession(loginName: string, workbenchCode: string, bizExt?: any): Promise<{
|
|
43
43
|
sessionId: string;
|
|
44
44
|
loginName: string;
|
|
45
45
|
accountId: any;
|
|
@@ -107,7 +107,7 @@ let AuthService = class AuthService {
|
|
|
107
107
|
* @param loginName
|
|
108
108
|
* @param workbenchCode
|
|
109
109
|
*/
|
|
110
|
-
async createUserSession(loginName, workbenchCode) {
|
|
110
|
+
async createUserSession(loginName, workbenchCode, bizExt) {
|
|
111
111
|
const userAccount = await this.queryUserAccountByLoginName(loginName);
|
|
112
112
|
if (!userAccount) {
|
|
113
113
|
throw new exceptions_1.CommonException('USER_ACCOUNT_NOT_EXIST', '用户账号不存在');
|
|
@@ -126,7 +126,11 @@ let AuthService = class AuthService {
|
|
|
126
126
|
accountId,
|
|
127
127
|
workbenchCode,
|
|
128
128
|
accountType: userSession_1.SYS_ACCOUNT_TYPE,
|
|
129
|
+
bizExt: {},
|
|
129
130
|
};
|
|
131
|
+
if (bizExt && typeof bizExt === 'object') {
|
|
132
|
+
sessionInfo.bizExt = bizExt;
|
|
133
|
+
}
|
|
130
134
|
await this.userSessionService.saveUserSession(sessionInfo);
|
|
131
135
|
return {
|
|
132
136
|
sessionId,
|
|
@@ -86,7 +86,7 @@ let EnumInfoService = class EnumInfoService {
|
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
88
|
const rows = (0, parseConfig_1.parseConfigContentToEnumInfo)(obj);
|
|
89
|
-
return rows.map(e => ({ label: e.label, value: e.value, children: e.children })).filter(filterEmpty);
|
|
89
|
+
return rows.map(e => ({ label: e.label, value: e.value, style: e.style, children: e.children })).filter(filterEmpty);
|
|
90
90
|
}
|
|
91
91
|
async queryEnumInfoItemByDict(code) {
|
|
92
92
|
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
@@ -28,6 +28,7 @@ const MixinUtils_1 = require("../../libs/crud-pro/utils/MixinUtils");
|
|
|
28
28
|
exports.SPECIAL_SETTING_KEY = {
|
|
29
29
|
QUERY_LIST: 'QUERY_LIST',
|
|
30
30
|
QUERY_ONE: 'QUERY_ONE',
|
|
31
|
+
KANBAN_VIEW_STATUS_UPDATE: 'KANBAN_VIEW_STATUS_UPDATE', // 看板视图中更新状态
|
|
31
32
|
};
|
|
32
33
|
function isNotEmptyStr(str) {
|
|
33
34
|
return typeof str === 'string' && str.trim().length > 0;
|
|
@@ -59,6 +60,7 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
|
|
|
59
60
|
* 执行普通CRUD
|
|
60
61
|
*/
|
|
61
62
|
async executeStdQuery(stdAction, params, sqlSimpleName) {
|
|
63
|
+
var _a;
|
|
62
64
|
const appCode = stdAction.appCode;
|
|
63
65
|
const appInfo = await this.getParsedCrudStdAppForSettingKey(stdAction);
|
|
64
66
|
const stdCrudCfgObj = appInfo.stdCrudCfgObj;
|
|
@@ -79,7 +81,7 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
|
|
|
79
81
|
if (typeof maxLimit === 'number' && maxLimit > 0) {
|
|
80
82
|
cfgModel.maxLimit = maxLimit;
|
|
81
83
|
}
|
|
82
|
-
if (!appInfo.settingKeyActionCfg.hasOperationPerm) {
|
|
84
|
+
if (!((_a = appInfo.settingKeyActionCfg) === null || _a === void 0 ? void 0 : _a.hasOperationPerm)) {
|
|
83
85
|
throw new devops_1.BizException('没有权限');
|
|
84
86
|
}
|
|
85
87
|
// 软删除操作。
|
|
@@ -163,7 +165,16 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
|
|
|
163
165
|
}
|
|
164
166
|
const actionsMap = appInfo.actionsMap;
|
|
165
167
|
const appSchema = appInfo.stdCrudCfgObj;
|
|
166
|
-
|
|
168
|
+
// 看板视图中更新状态
|
|
169
|
+
if (settingKey === exports.SPECIAL_SETTING_KEY.KANBAN_VIEW_STATUS_UPDATE) {
|
|
170
|
+
const kanbanAuthSettingValues = _.get(appSchema, 'kanbanAuthSetting.values');
|
|
171
|
+
const { update_auth_type, update_auth_config_by_func_code, update_auth_config_by_role_code } = (kanbanAuthSettingValues || {});
|
|
172
|
+
const authConfig = update_auth_type === 'byFuncCode' ? update_auth_config_by_func_code : update_auth_config_by_role_code;
|
|
173
|
+
const hasOperationPerm = this.ctx.userSession.isAuthPass(update_auth_type, authConfig);
|
|
174
|
+
appInfo.settingKeyActionCfg = { settingKey, hasOperationPerm };
|
|
175
|
+
}
|
|
176
|
+
// 列表查询或详情查询
|
|
177
|
+
else if (settingKey === exports.SPECIAL_SETTING_KEY.QUERY_LIST || settingKey === exports.SPECIAL_SETTING_KEY.QUERY_ONE) {
|
|
167
178
|
const authSettingValues = _.get(appSchema, 'authSetting.values');
|
|
168
179
|
const { auth_type, auth_config_by_func_code, auth_config_by_role_code } = authSettingValues || {};
|
|
169
180
|
const authConfig = auth_type === 'byFuncCode' ? auth_config_by_func_code : auth_config_by_role_code;
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { parseJsonObject } from './functions';
|
|
|
4
4
|
interface IEnumInfo {
|
|
5
5
|
label: string;
|
|
6
6
|
value: string | number;
|
|
7
|
+
style?: string;
|
|
7
8
|
children?: IEnumInfo[];
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -18,6 +19,9 @@ function parseTreeTableToIEnumInfo(dataSource: any[]): IEnumInfo[] {
|
|
|
18
19
|
label: label || nodeName,
|
|
19
20
|
value: value || key,
|
|
20
21
|
};
|
|
22
|
+
if (item && typeof item.style === 'string' && item.style) {
|
|
23
|
+
enumInfo.style = item.style.trim();
|
|
24
|
+
}
|
|
21
25
|
if (children) {
|
|
22
26
|
enumInfo.children = children;
|
|
23
27
|
}
|
package/src/models/bizmodels.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface ITableBaseInfo {
|
|
|
20
20
|
export interface IStdCrudCfgObj {
|
|
21
21
|
tableBaseInfo: ITableBaseInfo;
|
|
22
22
|
authSetting: any;
|
|
23
|
+
kanbanAuthSetting: any;
|
|
23
24
|
actionColumns?: any[];
|
|
24
25
|
queryFormFields?: any[];
|
|
25
26
|
tableColumns?: any[];
|
|
@@ -34,9 +35,14 @@ export interface ICrudStdAppInfo {
|
|
|
34
35
|
status: number;
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
export interface ISettingKeyActionCfg {
|
|
39
|
+
settingKey: string;
|
|
40
|
+
hasOperationPerm: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
export interface ICrudStdAppInfoForSettingKey extends ICrudStdAppInfo {
|
|
38
|
-
settingKeyActionCfg?:
|
|
39
|
-
buttonSettingKeyActionCfg?:
|
|
44
|
+
settingKeyActionCfg?: ISettingKeyActionCfg;
|
|
45
|
+
buttonSettingKeyActionCfg?: ISettingKeyActionCfg;
|
|
40
46
|
authConfig?: string[];
|
|
41
47
|
authType?: string;
|
|
42
48
|
}
|
|
@@ -130,7 +130,7 @@ export class AuthService {
|
|
|
130
130
|
* @param loginName
|
|
131
131
|
* @param workbenchCode
|
|
132
132
|
*/
|
|
133
|
-
public async createUserSession(loginName: string, workbenchCode: string) {
|
|
133
|
+
public async createUserSession(loginName: string, workbenchCode: string, bizExt?: any) {
|
|
134
134
|
const userAccount = await this.queryUserAccountByLoginName(loginName);
|
|
135
135
|
|
|
136
136
|
if (!userAccount) {
|
|
@@ -152,8 +152,13 @@ export class AuthService {
|
|
|
152
152
|
accountId,
|
|
153
153
|
workbenchCode,
|
|
154
154
|
accountType: SYS_ACCOUNT_TYPE,
|
|
155
|
+
bizExt: {},
|
|
155
156
|
};
|
|
156
157
|
|
|
158
|
+
if (bizExt && typeof bizExt === 'object') {
|
|
159
|
+
sessionInfo.bizExt = bizExt;
|
|
160
|
+
}
|
|
161
|
+
|
|
157
162
|
await this.userSessionService.saveUserSession(sessionInfo);
|
|
158
163
|
|
|
159
164
|
return {
|
|
@@ -104,7 +104,7 @@ export class EnumInfoService {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
const rows = parseConfigContentToEnumInfo(obj);
|
|
107
|
-
return rows.map(e => ({ label: e.label, value: e.value, children: e.children })).filter(filterEmpty);
|
|
107
|
+
return rows.map(e => ({ label: e.label, value: e.value, style: e.style, children: e.children })).filter(filterEmpty);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
private async queryEnumInfoItemByDict(code: string): Promise<IEnumInfo[]> {
|
|
@@ -22,6 +22,7 @@ import { MixinUtils } from '@/libs/crud-pro/utils/MixinUtils';
|
|
|
22
22
|
export const SPECIAL_SETTING_KEY = {
|
|
23
23
|
QUERY_LIST: 'QUERY_LIST',
|
|
24
24
|
QUERY_ONE: 'QUERY_ONE',
|
|
25
|
+
KANBAN_VIEW_STATUS_UPDATE: 'KANBAN_VIEW_STATUS_UPDATE', // 看板视图中更新状态
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
export interface ICrudStdActionParams {
|
|
@@ -115,7 +116,7 @@ export class CrudStdService extends ApiBaseService {
|
|
|
115
116
|
cfgModel.maxLimit = maxLimit;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
if (!appInfo.settingKeyActionCfg
|
|
119
|
+
if (!appInfo.settingKeyActionCfg?.hasOperationPerm) {
|
|
119
120
|
throw new BizException('没有权限');
|
|
120
121
|
}
|
|
121
122
|
|
|
@@ -225,7 +226,19 @@ export class CrudStdService extends ApiBaseService {
|
|
|
225
226
|
const actionsMap = appInfo.actionsMap;
|
|
226
227
|
const appSchema = appInfo.stdCrudCfgObj;
|
|
227
228
|
|
|
228
|
-
|
|
229
|
+
|
|
230
|
+
// 看板视图中更新状态
|
|
231
|
+
if (settingKey === SPECIAL_SETTING_KEY.KANBAN_VIEW_STATUS_UPDATE) {
|
|
232
|
+
|
|
233
|
+
const kanbanAuthSettingValues = _.get(appSchema, 'kanbanAuthSetting.values');
|
|
234
|
+
const { update_auth_type, update_auth_config_by_func_code, update_auth_config_by_role_code } = (kanbanAuthSettingValues || {});
|
|
235
|
+
const authConfig = update_auth_type === 'byFuncCode' ? update_auth_config_by_func_code : update_auth_config_by_role_code;
|
|
236
|
+
const hasOperationPerm = this.ctx.userSession.isAuthPass(update_auth_type as any, authConfig);
|
|
237
|
+
appInfo.settingKeyActionCfg = { settingKey, hasOperationPerm };
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
// 列表查询或详情查询
|
|
241
|
+
else if (settingKey === SPECIAL_SETTING_KEY.QUERY_LIST || settingKey === SPECIAL_SETTING_KEY.QUERY_ONE) {
|
|
229
242
|
const authSettingValues = _.get(appSchema, 'authSetting.values');
|
|
230
243
|
const { auth_type, auth_config_by_func_code, auth_config_by_role_code } = authSettingValues || {};
|
|
231
244
|
const authConfig = auth_type === 'byFuncCode' ? auth_config_by_func_code : auth_config_by_role_code;
|