@ibiz-template/runtime 0.4.11 → 0.4.12
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/index.esm.js +182 -89
- package/dist/index.system.min.js +2 -2
- package/out/config/global-config.d.ts.map +1 -1
- package/out/config/global-config.js +1 -0
- package/out/controller/common/control/control.controller.d.ts +14 -0
- package/out/controller/common/control/control.controller.d.ts.map +1 -1
- package/out/controller/common/control/control.controller.js +21 -0
- package/out/controller/common/control/md-control.controller.d.ts +9 -0
- package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
- package/out/controller/common/control/md-control.controller.js +20 -0
- package/out/controller/common/view/view.controller.d.ts +8 -1
- package/out/controller/common/view/view.controller.d.ts.map +1 -1
- package/out/controller/common/view/view.controller.js +12 -4
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/edit-form/edit-form.controller.js +9 -22
- package/out/controller/control/form/edit-form/edit-form.service.d.ts +3 -2
- package/out/controller/control/form/edit-form/edit-form.service.d.ts.map +1 -1
- package/out/controller/control/form/edit-form/edit-form.service.js +11 -2
- package/out/controller/control/form/form/form.controller.d.ts +0 -7
- package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form/form.controller.js +0 -11
- package/out/controller/control/form/form/form.service.d.ts +24 -0
- package/out/controller/control/form/form/form.service.d.ts.map +1 -0
- package/out/controller/control/form/form/form.service.js +45 -0
- package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-item/form-item.controller.js +0 -5
- package/out/controller/control/form/search-form/search-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/search-form/search-form.controller.js +1 -5
- package/out/controller/control/form/search-form/search-form.service.d.ts +4 -3
- package/out/controller/control/form/search-form/search-form.service.d.ts.map +1 -1
- package/out/controller/control/form/search-form/search-form.service.js +8 -3
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +10 -6
- package/out/interface/common/i-global-config/i-global-view-config.d.ts +7 -0
- package/out/interface/common/i-global-config/i-global-view-config.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-control.controller.d.ts +14 -0
- package/out/interface/controller/controller/control/i-control.controller.d.ts.map +1 -1
- package/out/interface/controller/controller/view/i-view.controller.d.ts +14 -0
- package/out/interface/controller/controller/view/i-view.controller.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-control.state.d.ts +8 -0
- package/out/interface/controller/state/control/i-control.state.d.ts.map +1 -1
- package/out/interface/controller/state/view/i-view.state.d.ts +8 -0
- package/out/interface/controller/state/view/i-view.state.d.ts.map +1 -1
- package/out/interface/service/service/i-auth.service.d.ts +3 -2
- package/out/interface/service/service/i-auth.service.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.d.ts +1 -1
- package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.js +12 -7
- package/out/service/utils/de-cache/de-cache.js +2 -2
- package/out/utils/layout-panel-util/layout-panel-util.d.ts.map +1 -1
- package/out/utils/layout-panel-util/layout-panel-util.js +16 -2
- package/package.json +3 -3
- package/src/config/global-config.ts +1 -0
- package/src/controller/common/control/control.controller.ts +23 -0
- package/src/controller/common/control/md-control.controller.ts +21 -0
- package/src/controller/common/view/view.controller.ts +12 -5
- package/src/controller/control/form/edit-form/edit-form.controller.ts +11 -26
- package/src/controller/control/form/edit-form/edit-form.service.ts +11 -2
- package/src/controller/control/form/form/form.controller.ts +0 -14
- package/src/controller/control/form/form/form.service.ts +63 -0
- package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +0 -5
- package/src/controller/control/form/search-form/search-form.controller.ts +1 -5
- package/src/controller/control/form/search-form/search-form.service.ts +8 -3
- package/src/controller/control/search-bar/search-bar.controller.ts +11 -8
- package/src/interface/common/i-global-config/i-global-view-config.ts +8 -0
- package/src/interface/controller/controller/control/i-control.controller.ts +16 -0
- package/src/interface/controller/controller/view/i-view.controller.ts +16 -0
- package/src/interface/controller/state/control/i-control.state.ts +9 -0
- package/src/interface/controller/state/view/i-view.state.ts +9 -0
- package/src/interface/service/service/i-auth.service.ts +3 -2
- package/src/service/service/auth/v7-auth.service.ts +18 -8
- package/src/service/utils/de-cache/de-cache.ts +2 -2
- package/src/utils/layout-panel-util/layout-panel-util.ts +17 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { IDEEditFormItem, IDEForm } from '@ibiz/model-core';
|
|
2
|
+
import { recursiveIterate } from '@ibiz-template/core';
|
|
3
|
+
import { ControlService } from '../../../../service';
|
|
4
|
+
import { getDefaultValue } from '../../../utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 表单的部件服务
|
|
8
|
+
* @author lxm
|
|
9
|
+
* @date 2023-12-13 03:04:57
|
|
10
|
+
* @export
|
|
11
|
+
* @class FormService
|
|
12
|
+
* @extends {ControlService<T>}
|
|
13
|
+
* @template T
|
|
14
|
+
*/
|
|
15
|
+
export class FormService<
|
|
16
|
+
T extends IDEForm = IDEForm,
|
|
17
|
+
> extends ControlService<T> {
|
|
18
|
+
/**
|
|
19
|
+
* 设置表单项的默认值
|
|
20
|
+
* @author lxm
|
|
21
|
+
* @date 2023-12-13 03:16:19
|
|
22
|
+
* @param {IData} data 表单数据
|
|
23
|
+
* @param {IParams} context 上下文
|
|
24
|
+
* @param {IParams} params 视图参数
|
|
25
|
+
* @param {('create' | 'update')} type 新建还是更新
|
|
26
|
+
*/
|
|
27
|
+
setDefault(
|
|
28
|
+
data: IData,
|
|
29
|
+
context: IParams,
|
|
30
|
+
params: IParams,
|
|
31
|
+
type: 'create' | 'update',
|
|
32
|
+
): void {
|
|
33
|
+
// 递归所有的表单项,设置默认值
|
|
34
|
+
recursiveIterate(
|
|
35
|
+
this.model,
|
|
36
|
+
(item: IDEEditFormItem) => {
|
|
37
|
+
if (item.detailType === 'FORMITEM') {
|
|
38
|
+
const { createDVT, createDV, updateDVT, updateDV, valueFormat } =
|
|
39
|
+
item;
|
|
40
|
+
const valueType = type === 'create' ? createDVT : updateDVT;
|
|
41
|
+
const defaultValue = type === 'create' ? createDV : updateDV;
|
|
42
|
+
const name = item.id!.toLowerCase();
|
|
43
|
+
|
|
44
|
+
const defaultVal = getDefaultValue(
|
|
45
|
+
{
|
|
46
|
+
name,
|
|
47
|
+
valueType,
|
|
48
|
+
defaultValue,
|
|
49
|
+
valueFormat,
|
|
50
|
+
},
|
|
51
|
+
{ data, context, params },
|
|
52
|
+
);
|
|
53
|
+
if (defaultVal !== undefined) {
|
|
54
|
+
data[name] = defaultVal;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
childrenFields: ['deformPages', 'deformTabPages', 'deformDetails'],
|
|
60
|
+
},
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -283,11 +283,6 @@ export class FormItemController
|
|
|
283
283
|
|
|
284
284
|
// 计算启用条件
|
|
285
285
|
this.calcEnableCond();
|
|
286
|
-
|
|
287
|
-
// 触发默认值
|
|
288
|
-
if (state === FormNotifyState.LOAD) {
|
|
289
|
-
this.setDefaultValue(false);
|
|
290
|
-
}
|
|
291
286
|
}
|
|
292
287
|
|
|
293
288
|
protected calcDynamicLogic(names: string[], mustCalc: boolean = false): void {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RuntimeError
|
|
1
|
+
import { RuntimeError } from '@ibiz-template/core';
|
|
2
2
|
import { IDESearchForm } from '@ibiz/model-core';
|
|
3
3
|
import {
|
|
4
4
|
ISearchFormController,
|
|
@@ -77,9 +77,6 @@ export class SearchFormController
|
|
|
77
77
|
async load(): Promise<IData> {
|
|
78
78
|
const queryParams = { ...this.params };
|
|
79
79
|
|
|
80
|
-
// 新建默认值给到graft接口,接口会回来
|
|
81
|
-
const params = await this.getDraftParams();
|
|
82
|
-
Object.assign(queryParams, params);
|
|
83
80
|
await this.evt.emit('onBeforeLoadDraft', { params: queryParams });
|
|
84
81
|
let res;
|
|
85
82
|
try {
|
|
@@ -91,7 +88,6 @@ export class SearchFormController
|
|
|
91
88
|
throw error;
|
|
92
89
|
}
|
|
93
90
|
this.state.data = res.data;
|
|
94
|
-
mergeDefaultInLeft(this.data, params);
|
|
95
91
|
this.state.isLoaded = true;
|
|
96
92
|
this.formStateNotify(FormNotifyState.DRAFT);
|
|
97
93
|
this.actionNotification('GETDRAFTSUCCESS');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IHttpResponse, recursiveIterate } from '@ibiz-template/core';
|
|
2
2
|
import { IDESearchForm, IDEFormDetail } from '@ibiz/model-core';
|
|
3
|
-
import {
|
|
3
|
+
import { ControlVO, UIMapField } from '../../../../service';
|
|
4
|
+
import { FormService } from '../form/form.service';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* 搜索表单服务
|
|
@@ -14,7 +15,7 @@ import { ControlService, ControlVO, UIMapField } from '../../../../service';
|
|
|
14
15
|
*/
|
|
15
16
|
export class SearchFormService<
|
|
16
17
|
T extends IDESearchForm = IDESearchForm,
|
|
17
|
-
> extends
|
|
18
|
+
> extends FormService<T> {
|
|
18
19
|
/**
|
|
19
20
|
* 执行获取草稿方法
|
|
20
21
|
*
|
|
@@ -25,12 +26,16 @@ export class SearchFormService<
|
|
|
25
26
|
* @returns {*} {Promise<IHttpResponse>}
|
|
26
27
|
*/
|
|
27
28
|
async getDraft(
|
|
28
|
-
|
|
29
|
+
context: IParams,
|
|
29
30
|
params: IParams = {},
|
|
30
31
|
): Promise<IHttpResponse<ControlVO>> {
|
|
31
32
|
const tempData = this.getFilteredData({ ...params });
|
|
32
33
|
let res = { ok: true, status: 200, data: tempData } as IHttpResponse;
|
|
33
34
|
res = this.handleResponse(res);
|
|
35
|
+
// 设置默认值
|
|
36
|
+
if (res.ok && res.data) {
|
|
37
|
+
this.setDefault(res.data, context, params, 'create');
|
|
38
|
+
}
|
|
34
39
|
return res as IHttpResponse<ControlVO>;
|
|
35
40
|
}
|
|
36
41
|
|
|
@@ -156,7 +156,7 @@ export class SearchBarController
|
|
|
156
156
|
// 搜索过滤器
|
|
157
157
|
const filters = this.calcFilters();
|
|
158
158
|
if (filters) {
|
|
159
|
-
params.
|
|
159
|
+
params.searchconds = filters;
|
|
160
160
|
}
|
|
161
161
|
return params;
|
|
162
162
|
}
|
|
@@ -218,7 +218,7 @@ export class SearchBarController
|
|
|
218
218
|
}
|
|
219
219
|
});
|
|
220
220
|
if (hasFilter && !hasError) {
|
|
221
|
-
const filter = this.formatFilters(this.state.filterNodes[0]);
|
|
221
|
+
const filter = [this.formatFilters(this.state.filterNodes[0])];
|
|
222
222
|
return filter;
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -233,15 +233,18 @@ export class SearchBarController
|
|
|
233
233
|
formatFilters(node: IFilterNode): IData {
|
|
234
234
|
if (!node.leaf) {
|
|
235
235
|
return {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
condtype: 'GROUP',
|
|
237
|
+
condop: node.logicType,
|
|
238
|
+
bnotmode: false,
|
|
239
|
+
searchcondlist: node.children.map(item => this.formatFilters(item)),
|
|
239
240
|
};
|
|
240
241
|
}
|
|
242
|
+
|
|
241
243
|
return {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
244
|
+
condtype: 'DEFIELD',
|
|
245
|
+
fieldname: node.field,
|
|
246
|
+
condop: node.valueOP,
|
|
247
|
+
value: node.value,
|
|
245
248
|
};
|
|
246
249
|
}
|
|
247
250
|
}
|
|
@@ -60,6 +60,22 @@ export interface IControlController<
|
|
|
60
60
|
*/
|
|
61
61
|
endLoading(): Promise<void>;
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* 部件激活,主要用于用户可见时设置为激活状态
|
|
65
|
+
*
|
|
66
|
+
* @author chitanda
|
|
67
|
+
* @date 2023-12-13 11:12:04
|
|
68
|
+
*/
|
|
69
|
+
onActivated(): void;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 部件暂停激活,主要用于用户不可见时设置为非激活状态
|
|
73
|
+
*
|
|
74
|
+
* @author chitanda
|
|
75
|
+
* @date 2023-12-13 11:12:06
|
|
76
|
+
*/
|
|
77
|
+
onDeactivated(): void;
|
|
78
|
+
|
|
63
79
|
/**
|
|
64
80
|
* 在不改变引用的前提下,更新上下文和导航参数
|
|
65
81
|
* 并处理如自定义导航参数的后续处理
|
|
@@ -162,4 +162,20 @@ export interface IViewController<
|
|
|
162
162
|
* @date 2022-09-19 14:09:09
|
|
163
163
|
*/
|
|
164
164
|
endLoading(): void;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 视图激活,主要用于用户可见时设置为激活状态
|
|
168
|
+
*
|
|
169
|
+
* @author chitanda
|
|
170
|
+
* @date 2023-12-13 11:12:04
|
|
171
|
+
*/
|
|
172
|
+
onActivated(): void;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* 视图暂停激活,主要用于用户不可见时设置为非激活状态
|
|
176
|
+
*
|
|
177
|
+
* @author chitanda
|
|
178
|
+
* @date 2023-12-13 11:12:06
|
|
179
|
+
*/
|
|
180
|
+
onDeactivated(): void;
|
|
165
181
|
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { IControllerState } from '../common/i-controller.state';
|
|
2
2
|
|
|
3
3
|
export interface IControlState extends IControllerState {
|
|
4
|
+
/**
|
|
5
|
+
* 当前部件是否为激活状态(缓存下的激活状态,一般与框架的生命周期相同)
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2023-12-13 11:12:30
|
|
9
|
+
* @type {boolean}
|
|
10
|
+
*/
|
|
11
|
+
activated: boolean;
|
|
12
|
+
|
|
4
13
|
/**
|
|
5
14
|
* 是否是简单模式
|
|
6
15
|
* @author zjm
|
|
@@ -9,6 +9,15 @@ import { IControllerState } from '../common/i-controller.state';
|
|
|
9
9
|
* @class ViewState
|
|
10
10
|
*/
|
|
11
11
|
export interface IViewState extends IControllerState, IViewSession {
|
|
12
|
+
/**
|
|
13
|
+
* 当前视图是否为激活状态(缓存下的激活状态,一般与框架的生命周期相同)
|
|
14
|
+
*
|
|
15
|
+
* @author chitanda
|
|
16
|
+
* @date 2023-12-13 11:12:20
|
|
17
|
+
* @type {boolean}
|
|
18
|
+
*/
|
|
19
|
+
activated: boolean;
|
|
20
|
+
|
|
12
21
|
/**
|
|
13
22
|
* 视图标题
|
|
14
23
|
*
|
|
@@ -11,15 +11,16 @@ export interface IAuthService {
|
|
|
11
11
|
* 登录
|
|
12
12
|
*
|
|
13
13
|
* @author chitanda
|
|
14
|
-
* @date 2023-
|
|
14
|
+
* @date 2023-12-13 15:12:16
|
|
15
15
|
* @param {string} loginName
|
|
16
16
|
* @param {string} password
|
|
17
|
+
* @param {boolean} [remember]
|
|
17
18
|
* @return {*} {Promise<boolean>}
|
|
18
19
|
*/
|
|
19
20
|
login(
|
|
20
21
|
loginName: string,
|
|
21
22
|
password: string,
|
|
22
|
-
|
|
23
|
+
remember?: boolean,
|
|
23
24
|
): Promise<boolean>;
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -12,26 +12,29 @@ import { IAuthService } from '../../../interface';
|
|
|
12
12
|
*/
|
|
13
13
|
export class V7AuthService implements IAuthService {
|
|
14
14
|
async login(
|
|
15
|
-
|
|
15
|
+
loginName: string,
|
|
16
16
|
password: string,
|
|
17
|
-
|
|
17
|
+
remember?: boolean,
|
|
18
18
|
): Promise<boolean> {
|
|
19
19
|
// eslint-disable-next-line no-useless-catch
|
|
20
20
|
try {
|
|
21
21
|
const res = await ibiz.net.post('/v7/login', {
|
|
22
|
-
loginname,
|
|
22
|
+
loginname: loginName,
|
|
23
23
|
password,
|
|
24
|
-
rememberme,
|
|
24
|
+
rememberme: remember,
|
|
25
25
|
});
|
|
26
26
|
const { data } = res;
|
|
27
27
|
if (data && data.token) {
|
|
28
|
-
|
|
28
|
+
if (remember) {
|
|
29
|
+
setCookie(CoreConst.TOKEN_REMEMBER, '1', 7, true);
|
|
30
|
+
}
|
|
31
|
+
setCookie(CoreConst.TOKEN, data.token, remember ? 7 : 0, true);
|
|
29
32
|
const expiredDate =
|
|
30
33
|
new Date().getTime() + (data.expirein || 7199) * 1000;
|
|
31
34
|
setCookie(
|
|
32
35
|
CoreConst.TOKEN_EXPIRES,
|
|
33
36
|
`${expiredDate}`,
|
|
34
|
-
|
|
37
|
+
remember ? 7 : 0,
|
|
35
38
|
true,
|
|
36
39
|
);
|
|
37
40
|
}
|
|
@@ -50,6 +53,7 @@ export class V7AuthService implements IAuthService {
|
|
|
50
53
|
await ibiz.net.get('/v7/logout');
|
|
51
54
|
clearCookie(CoreConst.TOKEN);
|
|
52
55
|
clearCookie(CoreConst.TOKEN_EXPIRES);
|
|
56
|
+
clearCookie(CoreConst.TOKEN_REMEMBER);
|
|
53
57
|
return true;
|
|
54
58
|
} catch (err: unknown) {
|
|
55
59
|
ibiz.notification.error({
|
|
@@ -63,6 +67,7 @@ export class V7AuthService implements IAuthService {
|
|
|
63
67
|
async extendLogin(): Promise<void> {
|
|
64
68
|
const token = getCookie(CoreConst.TOKEN);
|
|
65
69
|
const expirein = getCookie(CoreConst.TOKEN_EXPIRES);
|
|
70
|
+
const remember = getCookie(CoreConst.TOKEN_REMEMBER);
|
|
66
71
|
if (token && expirein) {
|
|
67
72
|
// 计算到过期时间所需的延时毫秒数,预留提前量
|
|
68
73
|
let wait = Number(expirein) - new Date().getTime();
|
|
@@ -71,10 +76,15 @@ export class V7AuthService implements IAuthService {
|
|
|
71
76
|
setTimeout(async () => {
|
|
72
77
|
const res = await ibiz.net.get(`/uaa/refreshtoken2`);
|
|
73
78
|
if (res.ok) {
|
|
74
|
-
setCookie(CoreConst.TOKEN, res.data.token, 0, true);
|
|
79
|
+
setCookie(CoreConst.TOKEN, res.data.token, remember ? 7 : 0, true);
|
|
75
80
|
const expiredDate =
|
|
76
81
|
new Date().getTime() + (res.data.expirein || 7199) * 1000;
|
|
77
|
-
setCookie(
|
|
82
|
+
setCookie(
|
|
83
|
+
CoreConst.TOKEN_EXPIRES,
|
|
84
|
+
`${expiredDate}`,
|
|
85
|
+
remember ? 7 : 0,
|
|
86
|
+
true,
|
|
87
|
+
);
|
|
78
88
|
}
|
|
79
89
|
// 下一次延时做准备
|
|
80
90
|
this.extendLogin();
|
|
@@ -421,10 +421,10 @@ export class DECache {
|
|
|
421
421
|
);
|
|
422
422
|
const unionValues = unionKeys.map(key => {
|
|
423
423
|
if (isNil(data[key])) {
|
|
424
|
-
|
|
424
|
+
return `__empty__`;
|
|
425
425
|
}
|
|
426
426
|
return data[key];
|
|
427
427
|
});
|
|
428
|
-
data.srfkey = unionValues.join('');
|
|
428
|
+
data.srfkey = unionValues.join('||');
|
|
429
429
|
}
|
|
430
430
|
}
|
|
@@ -120,9 +120,24 @@ export class LayoutPanelUtil {
|
|
|
120
120
|
} else if (mainMenuAlign) {
|
|
121
121
|
exTag = mainMenuAlign.toUpperCase();
|
|
122
122
|
}
|
|
123
|
+
// 计算面板标识
|
|
124
|
+
let key: string = '';
|
|
123
125
|
if (exTag !== '') {
|
|
124
|
-
|
|
126
|
+
key = `${viewType}_${viewStyle}_${exTag}`;
|
|
127
|
+
} else {
|
|
128
|
+
key = `${viewType}_${viewStyle}`;
|
|
125
129
|
}
|
|
126
|
-
|
|
130
|
+
// 首页不采用分页导航
|
|
131
|
+
if (
|
|
132
|
+
ibiz.config.view.noNavTabs &&
|
|
133
|
+
[
|
|
134
|
+
'APPINDEXVIEW_DEFAULT',
|
|
135
|
+
'APPINDEXVIEW_DEFAULT_LEFT',
|
|
136
|
+
'APPINDEXVIEW_DEFAULT_TOP',
|
|
137
|
+
].includes(key)
|
|
138
|
+
) {
|
|
139
|
+
key += '_NO_NAV';
|
|
140
|
+
}
|
|
141
|
+
return key;
|
|
127
142
|
}
|
|
128
143
|
}
|