@ibiz-template/vue3-util 0.5.3-beta.0 → 0.5.3-beta.10
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.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/es/common/view-shell/view-shell.d.ts.map +1 -1
- package/es/common/view-shell/view-shell.mjs +50 -44
- package/es/index.mjs +1 -0
- package/es/panel-component/index.d.ts +1 -0
- package/es/panel-component/index.d.ts.map +1 -1
- package/es/panel-component/index.mjs +1 -0
- package/es/panel-component/nav-pos/nav-pos.mjs +1 -1
- package/es/panel-component/panel-item-render/index.d.ts +25 -0
- package/es/panel-component/panel-item-render/index.d.ts.map +1 -0
- package/es/panel-component/panel-item-render/index.mjs +19 -0
- package/es/panel-component/panel-item-render/panel-item-render.controller.d.ts +32 -0
- package/es/panel-component/panel-item-render/panel-item-render.controller.d.ts.map +1 -0
- package/es/panel-component/panel-item-render/panel-item-render.controller.mjs +29 -0
- package/es/panel-component/panel-item-render/panel-item-render.d.ts +27 -0
- package/es/panel-component/panel-item-render/panel-item-render.d.ts.map +1 -0
- package/es/panel-component/panel-item-render/panel-item-render.mjs +47 -0
- package/es/panel-component/panel-item-render/panel-item-render.provider.d.ts +17 -0
- package/es/panel-component/panel-item-render/panel-item-render.provider.d.ts.map +1 -0
- package/es/panel-component/panel-item-render/panel-item-render.provider.mjs +15 -0
- package/es/plugin/plugin-factory/plugin-factory.d.ts +15 -4
- package/es/plugin/plugin-factory/plugin-factory.d.ts.map +1 -1
- package/es/plugin/plugin-factory/plugin-factory.mjs +58 -10
- package/es/util/route/route.d.ts.map +1 -1
- package/es/util/route/route.mjs +8 -3
- package/es/util/store/async-action/async-action.d.ts.map +1 -1
- package/es/util/store/async-action/async-action.mjs +10 -2
- package/lib/index.cjs +17 -15
- package/package.json +6 -6
- package/src/common/view-shell/view-shell.tsx +74 -55
- package/src/panel-component/index.ts +1 -0
- package/src/panel-component/nav-pos/nav-pos.tsx +1 -1
- package/src/panel-component/panel-item-render/index.ts +18 -0
- package/src/panel-component/panel-item-render/panel-item-render.controller.ts +52 -0
- package/src/panel-component/panel-item-render/panel-item-render.provider.ts +30 -0
- package/src/panel-component/panel-item-render/panel-item-render.tsx +50 -0
- package/src/plugin/plugin-factory/plugin-factory.ts +67 -10
- package/src/util/route/route.ts +10 -5
- package/src/util/store/async-action/async-action.ts +14 -2
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
/* eslint-disable vue/no-mutating-props */
|
|
3
3
|
import {
|
|
4
|
-
convertNavData,
|
|
5
|
-
getControl,
|
|
6
4
|
getViewProvider,
|
|
7
5
|
IViewProvider,
|
|
8
|
-
|
|
6
|
+
getMatchResPath,
|
|
9
7
|
} from '@ibiz-template/runtime';
|
|
10
8
|
import { defineComponent, h, PropType, ref, resolveComponent } from 'vue';
|
|
11
|
-
import {
|
|
9
|
+
import { IAppDataEntity, IAppView } from '@ibiz/model-core';
|
|
12
10
|
import { RuntimeError } from '@ibiz-template/core';
|
|
13
|
-
import { createUUID
|
|
11
|
+
import { createUUID } from 'qx-util';
|
|
14
12
|
import { isEmpty, isNil } from 'ramda';
|
|
15
13
|
import { useNamespace } from '../../use';
|
|
16
14
|
import './view-shell.scss';
|
|
@@ -42,73 +40,94 @@ export const IBizViewShell = defineComponent({
|
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
if (viewModel.dynaSysMode === 1) {
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
let
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
//* 计算实体资源路径上下文参数
|
|
44
|
+
const appDataEntityId = viewModel.appDataEntityId;
|
|
45
|
+
let appDe: IAppDataEntity | undefined;
|
|
46
|
+
if (appDataEntityId) {
|
|
47
|
+
appDe = await ibiz.hub.getAppDataEntity(
|
|
48
|
+
appDataEntityId,
|
|
49
|
+
viewModel.appId,
|
|
50
|
+
);
|
|
51
|
+
} else {
|
|
52
|
+
throw new RuntimeError(
|
|
53
|
+
`${viewModel.codeName}无实体,暂不支持加载动态模型`,
|
|
53
54
|
);
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
/** 加载动态模型的请求参数 */
|
|
58
|
+
const loadModelParams: IParams = {};
|
|
59
|
+
// * 计算资源路径上下文参数
|
|
60
|
+
// 主键
|
|
61
|
+
const srfkey = props.context[appDe.codeName!.toLowerCase()];
|
|
62
|
+
if (srfkey) {
|
|
63
|
+
loadModelParams.srfkey = srfkey;
|
|
64
|
+
}
|
|
65
|
+
// 上层资源路径主实体名称和主键
|
|
66
|
+
const match = getMatchResPath(props.context, appDe);
|
|
67
|
+
if (match && match.keys.length > 1) {
|
|
68
|
+
const parentDeKey = match.keys[match.keys.length - 2];
|
|
69
|
+
loadModelParams.srfparentkey = props.context[parentDeKey];
|
|
70
|
+
loadModelParams.srfparentdeanme = parentDeKey;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
// 工作流视图加载数据补充srfwftag
|
|
74
|
+
if (appDe && viewModel.enableWF) {
|
|
75
|
+
// 处理数据请求的上下文
|
|
76
|
+
const context: IContext = { ...props.context };
|
|
77
|
+
// 存在主键则加载数据计算对应的参数
|
|
78
|
+
if (loadModelParams.srfkey) {
|
|
79
|
+
const noSrfSessionId =
|
|
80
|
+
isNil(props.context.srfsessionid) ||
|
|
81
|
+
isEmpty(props.context.srfsessionid);
|
|
82
|
+
const id = createUUID();
|
|
83
|
+
// 只要上下文中无 srfsessionid 则生成一个
|
|
84
|
+
if (noSrfSessionId) {
|
|
85
|
+
// 生成一个界面域,界面域标识为当前控制器实例的标识
|
|
86
|
+
const domain = ibiz.uiDomainManager.create(id);
|
|
87
|
+
context.srfsessionid = domain.id;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const app = ibiz.hub.getApp(viewModel.appId);
|
|
91
|
+
const service = await app.deService.getService(
|
|
92
|
+
props.context,
|
|
93
|
+
appDataEntityId!,
|
|
94
|
+
);
|
|
95
|
+
const res = await service.get(context, props.params || {});
|
|
96
|
+
if (res.ok && res.data) {
|
|
97
|
+
const { srfwftag, processdefinitionkey, taskdefinitionkey } =
|
|
98
|
+
res.data;
|
|
99
|
+
if (srfwftag) {
|
|
100
|
+
loadModelParams.srfwftag = srfwftag;
|
|
83
101
|
}
|
|
84
102
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
params.srfwftag = srfwftag;
|
|
103
|
+
// *动态工作流编辑视图从数据里额外获取参数
|
|
104
|
+
if (
|
|
105
|
+
['DEWFDYNAEDITVIEW3', 'DEWFDYNAEDITVIEW'].includes(
|
|
106
|
+
viewModel.viewType!,
|
|
107
|
+
)
|
|
108
|
+
) {
|
|
109
|
+
const viewParams = props.params!;
|
|
110
|
+
// 如果视图参数中没有获取到对应流程实例标识与步骤标识,则从请求回来的数据中获取对应信息
|
|
111
|
+
if (isNil(viewParams.processDefinitionKey)) {
|
|
112
|
+
viewParams.processDefinitionKey = processdefinitionkey;
|
|
113
|
+
}
|
|
114
|
+
if (isNil(viewParams.taskDefinitionKey)) {
|
|
115
|
+
viewParams.taskDefinitionKey = taskdefinitionkey;
|
|
99
116
|
}
|
|
100
117
|
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (noSrfSessionId) {
|
|
101
121
|
ibiz.uiDomainManager.destroy(id);
|
|
102
122
|
}
|
|
103
|
-
} else {
|
|
104
|
-
throw new RuntimeError('未找到数据控件');
|
|
105
123
|
}
|
|
106
124
|
}
|
|
107
125
|
|
|
126
|
+
// *加载动态模型
|
|
108
127
|
viewModelData.value = await ibiz.hub.loadAppView(
|
|
109
128
|
viewModel.appId,
|
|
110
129
|
viewModel.id!,
|
|
111
|
-
|
|
130
|
+
loadModelParams,
|
|
112
131
|
);
|
|
113
132
|
} else {
|
|
114
133
|
viewModelData.value = viewModel;
|
|
@@ -92,7 +92,7 @@ export const NavPos = defineComponent({
|
|
|
92
92
|
? h(resolveComponent('IBizViewShell'), {
|
|
93
93
|
context: navViewMsgs[currentKey].context,
|
|
94
94
|
params: navViewMsgs[currentKey].params,
|
|
95
|
-
key:
|
|
95
|
+
key: currentKey,
|
|
96
96
|
viewId: navViewMsgs[currentKey].viewId,
|
|
97
97
|
onCreated: this.onViewCreated,
|
|
98
98
|
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { registerPanelItemProvider } from '@ibiz-template/runtime';
|
|
2
|
+
import { App } from 'vue';
|
|
3
|
+
import { withInstall } from '../../util';
|
|
4
|
+
import { PanelItemRender } from './panel-item-render';
|
|
5
|
+
import { PanelItemRenderProvider } from './panel-item-render.provider';
|
|
6
|
+
|
|
7
|
+
export const IBizPanelItemRender = withInstall(
|
|
8
|
+
PanelItemRender,
|
|
9
|
+
function (v: App) {
|
|
10
|
+
v.component(PanelItemRender.name, PanelItemRender);
|
|
11
|
+
registerPanelItemProvider(
|
|
12
|
+
'PREDEFINE_RENDER',
|
|
13
|
+
() => new PanelItemRenderProvider(),
|
|
14
|
+
);
|
|
15
|
+
},
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export default IBizPanelItemRender;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IControlRender, IPanelContainer } from '@ibiz/model-core';
|
|
2
|
+
import {
|
|
3
|
+
PanelItemController,
|
|
4
|
+
ScriptFactory,
|
|
5
|
+
ViewLayoutPanelController,
|
|
6
|
+
} from '@ibiz-template/runtime';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 面板绘制器控制器
|
|
10
|
+
*
|
|
11
|
+
* @author zk
|
|
12
|
+
* @date 2024-01-15 06:01:08
|
|
13
|
+
* @export
|
|
14
|
+
* @class PanelItemRenderController
|
|
15
|
+
* @extends {PanelItemController<IPanelContainer>}
|
|
16
|
+
*/
|
|
17
|
+
export class PanelItemRenderController extends PanelItemController<IPanelContainer> {
|
|
18
|
+
/**
|
|
19
|
+
* 面板控制器
|
|
20
|
+
*
|
|
21
|
+
* @author lxm
|
|
22
|
+
* @date 2022-08-24 22:08:59
|
|
23
|
+
* @type {PanelController}
|
|
24
|
+
*/
|
|
25
|
+
declare panel: ViewLayoutPanelController;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 获取面板绘制器自定义html
|
|
29
|
+
*
|
|
30
|
+
* @author zk
|
|
31
|
+
* @date 2024-01-15 01:01:11
|
|
32
|
+
* @export
|
|
33
|
+
* @param {IControlRender[]} controlRenders
|
|
34
|
+
* @return {*} {(string | undefined)}
|
|
35
|
+
*/
|
|
36
|
+
getPanelItemCustomHtml(
|
|
37
|
+
controlRenders: IControlRender[],
|
|
38
|
+
data: IData | undefined,
|
|
39
|
+
): string | undefined {
|
|
40
|
+
if (controlRenders.length === 0) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const controlRender = controlRenders[0];
|
|
44
|
+
if (controlRender.layoutPanelModel) {
|
|
45
|
+
return ScriptFactory.execScriptFn(
|
|
46
|
+
{ data: data || {} },
|
|
47
|
+
controlRender.layoutPanelModel,
|
|
48
|
+
{ singleRowReturn: true, isAsync: false },
|
|
49
|
+
) as string;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IPanelItemProvider,
|
|
3
|
+
PanelController,
|
|
4
|
+
PanelItemController,
|
|
5
|
+
} from '@ibiz-template/runtime';
|
|
6
|
+
import { IPanelContainer } from '@ibiz/model-core';
|
|
7
|
+
import { PanelItemRenderController } from './panel-item-render.controller';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 面板绘制器适配器
|
|
11
|
+
*
|
|
12
|
+
* @author zk
|
|
13
|
+
* @date 2024-01-15 06:01:32
|
|
14
|
+
* @export
|
|
15
|
+
* @class PanelItemRenderProvider
|
|
16
|
+
* @implements {IPanelItemProvider}
|
|
17
|
+
*/
|
|
18
|
+
export class PanelItemRenderProvider implements IPanelItemProvider {
|
|
19
|
+
component: string = 'IBizPanelItemRender';
|
|
20
|
+
|
|
21
|
+
async createController(
|
|
22
|
+
panelItem: IPanelContainer,
|
|
23
|
+
panel: PanelController,
|
|
24
|
+
parent: PanelItemController | undefined,
|
|
25
|
+
): Promise<PanelItemRenderController> {
|
|
26
|
+
const c = new PanelItemRenderController(panelItem, panel, parent);
|
|
27
|
+
await c.init();
|
|
28
|
+
return c;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { IPanelContainer } from '@ibiz/model-core';
|
|
2
|
+
import { computed, defineComponent, PropType } from 'vue';
|
|
3
|
+
import { useNamespace } from '../../use';
|
|
4
|
+
import { PanelItemRenderController } from './panel-item-render.controller';
|
|
5
|
+
|
|
6
|
+
export const PanelItemRender = defineComponent({
|
|
7
|
+
name: 'IBizPanelItemRender',
|
|
8
|
+
props: {
|
|
9
|
+
modelData: {
|
|
10
|
+
type: Object as PropType<IPanelContainer>,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
controller: {
|
|
14
|
+
type: PanelItemRenderController,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
setup(props) {
|
|
19
|
+
const ns = useNamespace('panel-item-render');
|
|
20
|
+
|
|
21
|
+
const nsType = useNamespace(
|
|
22
|
+
`panel-${props.modelData.itemType?.toLowerCase()}`,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const { id } = props.modelData;
|
|
26
|
+
|
|
27
|
+
// 类名控制
|
|
28
|
+
const classArr = computed(() => {
|
|
29
|
+
const result: Array<string | false> = [
|
|
30
|
+
ns.b(),
|
|
31
|
+
ns.m(id),
|
|
32
|
+
nsType.b(),
|
|
33
|
+
ns.is('hidden', !props.controller.state.visible),
|
|
34
|
+
];
|
|
35
|
+
return result;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const htmlCode = computed(() => {
|
|
39
|
+
return props.controller.getPanelItemCustomHtml(
|
|
40
|
+
props.modelData.controlRenders!,
|
|
41
|
+
props.controller.data,
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return { ns, classArr, htmlCode };
|
|
46
|
+
},
|
|
47
|
+
render() {
|
|
48
|
+
return <div class={this.classArr} v-html={this.htmlCode}></div>;
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -2,6 +2,7 @@ import { RuntimeError, RuntimeModelError } from '@ibiz-template/core';
|
|
|
2
2
|
import {
|
|
3
3
|
IPluginFactory,
|
|
4
4
|
IPluginItem,
|
|
5
|
+
ISystemImportMap,
|
|
5
6
|
RemotePluginConfig,
|
|
6
7
|
RemotePluginItem,
|
|
7
8
|
} from '@ibiz-template/runtime';
|
|
@@ -259,6 +260,14 @@ export class PluginFactory implements IPluginFactory {
|
|
|
259
260
|
configData as RemotePluginConfig,
|
|
260
261
|
);
|
|
261
262
|
if (remotePlugin) {
|
|
263
|
+
if (remotePlugin.config['systemjs-importmap']) {
|
|
264
|
+
const importMap = this.handleSystemImportMap(
|
|
265
|
+
remotePlugin.config['systemjs-importmap'],
|
|
266
|
+
);
|
|
267
|
+
if (importMap) {
|
|
268
|
+
System.addImportMap(importMap);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
262
271
|
try {
|
|
263
272
|
await this.loadScript(remotePlugin);
|
|
264
273
|
this.pluginCache.set(rtObjectName, remotePlugin);
|
|
@@ -324,24 +333,28 @@ export class PluginFactory implements IPluginFactory {
|
|
|
324
333
|
* 编译请求文件地址
|
|
325
334
|
*
|
|
326
335
|
* @author chitanda
|
|
327
|
-
* @date
|
|
336
|
+
* @date 2024-01-11 16:01:19
|
|
328
337
|
* @protected
|
|
329
|
-
* @param {string}
|
|
338
|
+
* @param {string} pathUrl
|
|
339
|
+
* @param {string} [baseUrl=ibiz.env.pluginBaseUrl]
|
|
330
340
|
* @return {*} {string}
|
|
331
341
|
*/
|
|
332
|
-
protected parseUrl(
|
|
333
|
-
|
|
334
|
-
|
|
342
|
+
protected parseUrl(
|
|
343
|
+
pathUrl: string,
|
|
344
|
+
baseUrl: string = ibiz.env.pluginBaseUrl,
|
|
345
|
+
): string {
|
|
346
|
+
if (this.urlReg.test(pathUrl)) {
|
|
347
|
+
return pathUrl;
|
|
335
348
|
}
|
|
336
349
|
let url: string = '';
|
|
337
|
-
if (this.urlReg.test(
|
|
338
|
-
if (
|
|
339
|
-
url =
|
|
350
|
+
if (this.urlReg.test(baseUrl)) {
|
|
351
|
+
if (pathUrl.startsWith('/')) {
|
|
352
|
+
url = baseUrl + pathUrl;
|
|
340
353
|
} else {
|
|
341
|
-
url = `${
|
|
354
|
+
url = `${baseUrl}/${pathUrl}`;
|
|
342
355
|
}
|
|
343
356
|
} else {
|
|
344
|
-
url = `${join(
|
|
357
|
+
url = `${join(baseUrl, pathUrl)}`;
|
|
345
358
|
}
|
|
346
359
|
const { origin, pathname } = window.location;
|
|
347
360
|
if (pathname.endsWith('/') && url.startsWith('/')) {
|
|
@@ -352,4 +365,48 @@ export class PluginFactory implements IPluginFactory {
|
|
|
352
365
|
}
|
|
353
366
|
return url;
|
|
354
367
|
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* 处理 systemjs importmap 配置
|
|
371
|
+
*
|
|
372
|
+
* @author chitanda
|
|
373
|
+
* @date 2024-01-11 20:01:07
|
|
374
|
+
* @protected
|
|
375
|
+
* @param {ISystemImportMap} importMap
|
|
376
|
+
* @return {*} {IParams}
|
|
377
|
+
*/
|
|
378
|
+
protected handleSystemImportMap(
|
|
379
|
+
importMap: ISystemImportMap,
|
|
380
|
+
): ISystemImportMap | null {
|
|
381
|
+
if (importMap) {
|
|
382
|
+
if (importMap.imports) {
|
|
383
|
+
const imps = importMap.imports;
|
|
384
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
385
|
+
for (const key in imps) {
|
|
386
|
+
if (Object.prototype.hasOwnProperty.call(imps, key)) {
|
|
387
|
+
const url = imps[key];
|
|
388
|
+
imps[key] = this.parseUrl(url, importMap.baseUrl);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if (importMap.styles) {
|
|
393
|
+
const styles = importMap.styles;
|
|
394
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
395
|
+
for (const key in styles) {
|
|
396
|
+
if (Object.prototype.hasOwnProperty.call(styles, key)) {
|
|
397
|
+
const urls = styles[key];
|
|
398
|
+
if (typeof urls === 'string') {
|
|
399
|
+
styles[key] = this.parseUrl(urls, importMap.baseUrl);
|
|
400
|
+
} else {
|
|
401
|
+
styles[key] = urls.map(url =>
|
|
402
|
+
this.parseUrl(url, importMap.baseUrl),
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return importMap;
|
|
409
|
+
}
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
355
412
|
}
|
package/src/util/route/route.ts
CHANGED
|
@@ -162,7 +162,12 @@ export function routePath2string(routePath: IRoutePath): string {
|
|
|
162
162
|
*/
|
|
163
163
|
export function getOwnRouteContext(context: IContext): IParams {
|
|
164
164
|
const ownContext = context.getOwnContext();
|
|
165
|
-
const excludeKeys = [
|
|
165
|
+
const excludeKeys = [
|
|
166
|
+
'srfsessionid',
|
|
167
|
+
'srfappid',
|
|
168
|
+
'currentSrfNav',
|
|
169
|
+
'toRouteDepth',
|
|
170
|
+
];
|
|
166
171
|
Object.keys(ownContext).forEach(key => {
|
|
167
172
|
if (excludeKeys.includes(key)) {
|
|
168
173
|
delete ownContext[key];
|
|
@@ -258,8 +263,8 @@ export async function generateRoutePath(
|
|
|
258
263
|
let depth = context.srfdefaulttoroutedepth || 2; // 默认层级看上下文的srfdefaulttoroutedepth,如果没有就是2
|
|
259
264
|
if (context.toRouteDepth) {
|
|
260
265
|
depth = context.toRouteDepth;
|
|
261
|
-
//
|
|
262
|
-
|
|
266
|
+
// 使用完后转为undefined,避免添加到上下文里
|
|
267
|
+
context.toRouteDepth = undefined;
|
|
263
268
|
} else if (ibiz.env.isMob) {
|
|
264
269
|
// 移动端默认补充home层级
|
|
265
270
|
routePath.pathNodes[0] = {
|
|
@@ -275,8 +280,8 @@ export async function generateRoutePath(
|
|
|
275
280
|
const currentNode = routePath.pathNodes[routePath.pathNodes.length - 1];
|
|
276
281
|
currentNode.params = currentNode.params || {};
|
|
277
282
|
currentNode.srfnav = context.currentSrfNav;
|
|
278
|
-
//
|
|
279
|
-
|
|
283
|
+
// 使用完后转为undefined,避免添加到上下文里
|
|
284
|
+
context.currentSrfNav = undefined;
|
|
280
285
|
}
|
|
281
286
|
|
|
282
287
|
// 重定向视图跳转的一级首页路由
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { IPortalAsyncAction, IPortalMessage } from '@ibiz-template/core';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
|
-
import { isNumber } from 'lodash-es';
|
|
5
|
+
import { isNil, isNumber } from 'lodash-es';
|
|
6
6
|
import { computed, onUnmounted, ref } from 'vue';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -25,6 +25,16 @@ function formatAsyncAction(data: IPortalAsyncAction): IPortalAsyncAction {
|
|
|
25
25
|
data[key] = dayjs(data[key]).format('YYYY-MM-DD HH:mm:ss');
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
+
|
|
29
|
+
if (!isNil(data.actionresult)) {
|
|
30
|
+
try {
|
|
31
|
+
const json = JSON.parse(data.actionresult as string);
|
|
32
|
+
data.actionresult = json;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// 不是对象类型就是字符串。
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
28
38
|
return data;
|
|
29
39
|
}
|
|
30
40
|
|
|
@@ -50,6 +60,7 @@ export function useAsyncAction() {
|
|
|
50
60
|
|
|
51
61
|
const load = async () => {
|
|
52
62
|
const res = await ibiz.asyncAction.fetch();
|
|
63
|
+
res.data.forEach(formatAsyncAction);
|
|
53
64
|
allAsyncActions.value = res.data;
|
|
54
65
|
};
|
|
55
66
|
|
|
@@ -63,10 +74,11 @@ export function useAsyncAction() {
|
|
|
63
74
|
return;
|
|
64
75
|
}
|
|
65
76
|
const asyncAction = formatAsyncAction(msg.data as IPortalAsyncAction);
|
|
77
|
+
|
|
66
78
|
const findIndex = allAsyncActions.value.findIndex(
|
|
67
79
|
item => item.asyncacitonid === asyncAction.asyncacitonid,
|
|
68
80
|
);
|
|
69
|
-
if (findIndex
|
|
81
|
+
if (findIndex === -1) {
|
|
70
82
|
// 不存在的数据补充到最开始,并显示长度加一
|
|
71
83
|
allAsyncActions.value.unshift(asyncAction);
|
|
72
84
|
showLength.value += 1;
|