@ibiz-template/vue3-util 0.5.7-alpha.2 → 0.5.7-alpha.4
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/badge/badge.mjs +1 -1
- package/es/common/code-list/code-list.d.ts +2 -2
- package/es/common/code-list/code-list.mjs +1 -1
- package/es/common/control-base/control-base.mjs +1 -1
- package/es/common/control-loading-placeholder/control-loading-placeholder.mjs +1 -1
- package/es/common/control-shell/control-shell.mjs +1 -1
- package/es/common/icon/icon.mjs +1 -1
- package/es/common/router-view/router-view.mjs +1 -1
- package/es/common/view-shell/view-shell.d.ts.map +1 -1
- package/es/common/view-shell/view-shell.mjs +10 -26
- package/es/control/panel/panel/index.mjs +1 -1
- package/es/control/panel/panel/panel.mjs +1 -1
- package/es/control/panel/view-layout-panel/index.mjs +1 -1
- package/es/control/panel/view-layout-panel/view-layout-panel.mjs +1 -1
- package/es/panel-component/grid-container/grid-container.mjs +1 -1
- package/es/panel-component/multi-data-container/multi-data-container.mjs +1 -1
- package/es/panel-component/nav-pos/nav-pos.controller.mjs +1 -1
- package/es/panel-component/nav-pos/nav-pos.mjs +1 -1
- package/es/panel-component/panel-container/panel-container.mjs +1 -1
- package/es/panel-component/panel-container-group/panel-container-group.mjs +1 -1
- package/es/panel-component/panel-container-image/panel-container-image.mjs +1 -1
- package/es/panel-component/panel-ctrl-pos/panel-ctrl-pos.mjs +1 -1
- package/es/panel-component/panel-field/panel-field.mjs +1 -1
- package/es/panel-component/panel-item-render/panel-item-render.mjs +1 -1
- package/es/panel-component/panel-rawitem/panel-rawitem.mjs +1 -1
- package/es/panel-component/panel-tab-page/panel-tab-page.mjs +1 -1
- package/es/panel-component/scroll-container/scroll-container/scroll-container.mjs +1 -1
- package/es/panel-component/scroll-container/scroll-container-item/scroll-container-item.mjs +1 -1
- package/es/panel-component/single-data-container/single-data-container.mjs +1 -1
- package/es/props/editor/autocomplete.d.ts +2 -2
- package/es/props/editor/check-box-list.d.ts +2 -2
- package/es/props/editor/check-box.d.ts +2 -2
- package/es/props/editor/data-picker.d.ts +2 -2
- package/es/props/editor/date-picker.d.ts +2 -2
- package/es/props/editor/date-range.d.ts +2 -2
- package/es/props/editor/dropdown-list.d.ts +2 -2
- package/es/props/editor/list-box.d.ts +2 -2
- package/es/props/editor/number-range.d.ts +2 -2
- package/es/props/editor/radio-button-list.d.ts +2 -2
- package/es/props/editor/rate.d.ts +2 -2
- package/es/props/editor/raw.d.ts +2 -2
- package/es/props/editor/slider.d.ts +2 -2
- package/es/props/editor/span.d.ts +2 -2
- package/es/props/editor/stepper.d.ts +2 -2
- package/es/props/editor/switch.d.ts +2 -2
- package/es/props/editor/text-box.d.ts +2 -2
- package/es/util/store/app-store/app-store.d.ts +3 -82
- package/es/util/store/app-store/app-store.d.ts.map +1 -1
- package/es/util/store/app-store/app-store.mjs +1 -8
- package/es/view/app-redirect-view/app-redirect-view.mjs +1 -1
- package/es/view/common/view.mjs +1 -1
- package/es/view/de-redirect-view/de-redirect-view.mjs +1 -1
- package/es/view/de-redirect-view/index.mjs +1 -1
- package/es/view/portal-view/index.mjs +1 -1
- package/es/view/portal-view/portal-view.mjs +1 -1
- package/es/view/todo-redirect/todo-redirect.mjs +1 -1
- package/package.json +6 -6
- package/src/common/view-shell/view-shell.tsx +11 -35
- package/src/util/store/app-store/app-store.ts +3 -14
- package/es/util/store/async-action/async-action.d.ts +0 -56
- package/es/util/store/async-action/async-action.d.ts.map +0 -1
- package/es/util/store/async-action/async-action.mjs +0 -80
- package/src/util/store/async-action/async-action.ts +0 -122
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import {
|
|
4
4
|
getViewProvider,
|
|
5
5
|
IViewProvider,
|
|
6
|
-
|
|
6
|
+
calcDynaSysParams,
|
|
7
7
|
} from '@ibiz-template/runtime';
|
|
8
8
|
import { defineComponent, h, PropType, ref, resolveComponent } from 'vue';
|
|
9
|
-
import {
|
|
9
|
+
import { IAppView } from '@ibiz/model-core';
|
|
10
10
|
import { RuntimeError } from '@ibiz-template/core';
|
|
11
11
|
import { createUUID } from 'qx-util';
|
|
12
12
|
import { isEmpty, isNil } from 'ramda';
|
|
@@ -42,13 +42,7 @@ export const IBizViewShell = defineComponent({
|
|
|
42
42
|
if (viewModel.dynaSysMode === 1) {
|
|
43
43
|
//* 计算实体资源路径上下文参数
|
|
44
44
|
const appDataEntityId = viewModel.appDataEntityId;
|
|
45
|
-
|
|
46
|
-
if (appDataEntityId) {
|
|
47
|
-
appDe = await ibiz.hub.getAppDataEntity(
|
|
48
|
-
appDataEntityId,
|
|
49
|
-
viewModel.appId,
|
|
50
|
-
);
|
|
51
|
-
} else {
|
|
45
|
+
if (!appDataEntityId) {
|
|
52
46
|
throw new RuntimeError(
|
|
53
47
|
`${viewModel.codeName}无实体,暂不支持加载动态模型`,
|
|
54
48
|
);
|
|
@@ -57,38 +51,20 @@ export const IBizViewShell = defineComponent({
|
|
|
57
51
|
const params = props.params || {};
|
|
58
52
|
|
|
59
53
|
/** 加载动态模型的请求参数 */
|
|
60
|
-
const loadModelParams: IParams =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// 主键
|
|
66
|
-
const srfkey = props.context[appDe.codeName!.toLowerCase()];
|
|
67
|
-
if (srfkey) {
|
|
68
|
-
loadModelParams.srfkey = srfkey;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
54
|
+
const loadModelParams: IParams = await calcDynaSysParams(
|
|
55
|
+
appDataEntityId,
|
|
56
|
+
props.context,
|
|
57
|
+
{ viewParams: params, appId: viewModel.appId },
|
|
58
|
+
);
|
|
71
59
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
loadModelParams.srfparentkey = params.srfparentkey;
|
|
75
|
-
loadModelParams.srfparentdeanme = params.srfparentdeanme;
|
|
76
|
-
} else {
|
|
77
|
-
// 上层资源路径主实体名称和主键
|
|
78
|
-
const match = getMatchResPath(props.context, appDe);
|
|
79
|
-
if (match && match.keys.length > 1) {
|
|
80
|
-
const parentDeKey = match.keys[match.keys.length - 2];
|
|
81
|
-
loadModelParams.srfparentkey =
|
|
82
|
-
params.srfparentkey || props.context[parentDeKey];
|
|
83
|
-
loadModelParams.srfparentdeanme =
|
|
84
|
-
params.srfparentdeanme || parentDeKey;
|
|
85
|
-
}
|
|
60
|
+
if (params.srfdatatype) {
|
|
61
|
+
loadModelParams.srfdatatype = params.srfdatatype;
|
|
86
62
|
}
|
|
87
63
|
|
|
88
64
|
// 如果视图参数中存在 srfwftag 则直接使用视图参数
|
|
89
65
|
if (params.srfwftag) {
|
|
90
66
|
loadModelParams.srfwftag = params.srfwftag;
|
|
91
|
-
} else if (
|
|
67
|
+
} else if (appDataEntityId && viewModel.enableWF) {
|
|
92
68
|
// 处理数据请求的上下文
|
|
93
69
|
const context: IContext = { ...props.context };
|
|
94
70
|
// 存在主键则加载数据计算对应的参数
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import { IPortalAsyncAction } from '@ibiz-template/core';
|
|
2
1
|
import { defineStore } from 'pinia';
|
|
3
|
-
import { reactive
|
|
4
|
-
import { useAsyncAction } from '../async-action/async-action';
|
|
2
|
+
import { reactive } from 'vue';
|
|
5
3
|
|
|
6
|
-
export interface IAppStore {
|
|
7
|
-
allAsyncActions: Ref<IPortalAsyncAction[]>;
|
|
8
|
-
recentAsyncActions: IPortalAsyncAction[];
|
|
9
|
-
}
|
|
4
|
+
export interface IAppStore {}
|
|
10
5
|
|
|
11
6
|
export const useAppStore = defineStore('appStore', () => {
|
|
12
|
-
const
|
|
13
|
-
const appStore = reactive<IAppStore>({
|
|
14
|
-
allAsyncActions,
|
|
15
|
-
get recentAsyncActions() {
|
|
16
|
-
return recentAsyncActions.value;
|
|
17
|
-
},
|
|
18
|
-
});
|
|
7
|
+
const appStore = reactive<IAppStore>({});
|
|
19
8
|
|
|
20
9
|
return { appStore };
|
|
21
10
|
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 使用异步操作消息
|
|
3
|
-
* @author lxm
|
|
4
|
-
* @date 2023-11-14 03:17:28
|
|
5
|
-
* @export
|
|
6
|
-
* @return {*}
|
|
7
|
-
*/
|
|
8
|
-
export declare function useAsyncAction(): {
|
|
9
|
-
allAsyncActions: import("vue").Ref<{
|
|
10
|
-
asyncacitonid: string;
|
|
11
|
-
asyncacitonname: string;
|
|
12
|
-
fulltopictag: string;
|
|
13
|
-
srfdcid: string;
|
|
14
|
-
dcsystemid: string;
|
|
15
|
-
actiontype: string;
|
|
16
|
-
actionstate: 10 | 20 | 30 | 40;
|
|
17
|
-
actionresult?: unknown;
|
|
18
|
-
stepinfo?: string | undefined;
|
|
19
|
-
completionrate?: number | undefined;
|
|
20
|
-
asyncresultdownloadurl?: string | undefined;
|
|
21
|
-
actionparam?: unknown;
|
|
22
|
-
actionparam2?: unknown;
|
|
23
|
-
actionparam3?: unknown;
|
|
24
|
-
actionparam4?: unknown;
|
|
25
|
-
begintime: string;
|
|
26
|
-
endtime: string;
|
|
27
|
-
createman: string;
|
|
28
|
-
createdate: string;
|
|
29
|
-
updateman: string;
|
|
30
|
-
updatedate: string;
|
|
31
|
-
}[]>;
|
|
32
|
-
recentAsyncActions: import("vue").ComputedRef<{
|
|
33
|
-
asyncacitonid: string;
|
|
34
|
-
asyncacitonname: string;
|
|
35
|
-
fulltopictag: string;
|
|
36
|
-
srfdcid: string;
|
|
37
|
-
dcsystemid: string;
|
|
38
|
-
actiontype: string;
|
|
39
|
-
actionstate: 10 | 20 | 30 | 40;
|
|
40
|
-
actionresult?: unknown;
|
|
41
|
-
stepinfo?: string | undefined;
|
|
42
|
-
completionrate?: number | undefined;
|
|
43
|
-
asyncresultdownloadurl?: string | undefined;
|
|
44
|
-
actionparam?: unknown;
|
|
45
|
-
actionparam2?: unknown;
|
|
46
|
-
actionparam3?: unknown;
|
|
47
|
-
actionparam4?: unknown;
|
|
48
|
-
begintime: string;
|
|
49
|
-
endtime: string;
|
|
50
|
-
createman: string;
|
|
51
|
-
createdate: string;
|
|
52
|
-
updateman: string;
|
|
53
|
-
updatedate: string;
|
|
54
|
-
}[]>;
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=async-action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-action.d.ts","sourceRoot":"","sources":["../../../../src/util/store/async-action/async-action.ts"],"names":[],"mappings":"AAiDA;;;;;;GAMG;AACH,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiE7B"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import { isNumber, isNil } from 'lodash-es';
|
|
3
|
-
import { ref, computed, onUnmounted } from 'vue';
|
|
4
|
-
|
|
5
|
-
"use strict";
|
|
6
|
-
function formatAsyncAction(data) {
|
|
7
|
-
const dateFields = [
|
|
8
|
-
"begintime",
|
|
9
|
-
"endtime",
|
|
10
|
-
"createdate",
|
|
11
|
-
"updatedate"
|
|
12
|
-
];
|
|
13
|
-
dateFields.forEach((key) => {
|
|
14
|
-
if (isNumber(data[key])) {
|
|
15
|
-
data[key] = dayjs(data[key]).format("YYYY-MM-DD HH:mm:ss");
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
if (!isNil(data.actionresult)) {
|
|
19
|
-
try {
|
|
20
|
-
const json = JSON.parse(data.actionresult);
|
|
21
|
-
data.actionresult = json;
|
|
22
|
-
} catch (error) {
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (!isNil(data.completionrate)) {
|
|
26
|
-
const num = Number(data.completionrate);
|
|
27
|
-
if (Number.isNaN(num)) {
|
|
28
|
-
data.completionrate = void 0;
|
|
29
|
-
} else {
|
|
30
|
-
data.completionrate = num;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
function useAsyncAction() {
|
|
36
|
-
const allAsyncActions = ref([]);
|
|
37
|
-
const showLength = ref(0);
|
|
38
|
-
const recentAsyncActions = computed(() => {
|
|
39
|
-
return allAsyncActions.value.filter(
|
|
40
|
-
(_item, index) => index < showLength.value
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
const load = async () => {
|
|
44
|
-
const res = await ibiz.asyncAction.fetch();
|
|
45
|
-
res.data.forEach(formatAsyncAction);
|
|
46
|
-
allAsyncActions.value = res.data;
|
|
47
|
-
};
|
|
48
|
-
const asyncActionCallBack = (msg) => {
|
|
49
|
-
if (!msg.data || msg.subtype !== "ASYNCACTION") {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
console.log("\u539F\u59CB\u6570\u636E", msg);
|
|
53
|
-
const asyncAction = formatAsyncAction(msg.data);
|
|
54
|
-
console.log("\u683C\u5F0F\u5316\u540E\u6570\u636E", asyncAction);
|
|
55
|
-
const findIndex = allAsyncActions.value.findIndex(
|
|
56
|
-
(item) => item.asyncacitonid === asyncAction.asyncacitonid
|
|
57
|
-
);
|
|
58
|
-
if (findIndex === -1) {
|
|
59
|
-
allAsyncActions.value.unshift(asyncAction);
|
|
60
|
-
showLength.value += 1;
|
|
61
|
-
} else {
|
|
62
|
-
const isShow = findIndex >= showLength.value;
|
|
63
|
-
if (isShow) {
|
|
64
|
-
allAsyncActions.value.splice(findIndex, 1);
|
|
65
|
-
allAsyncActions.value.unshift(asyncAction);
|
|
66
|
-
showLength.value += 1;
|
|
67
|
-
} else {
|
|
68
|
-
allAsyncActions.value.splice(findIndex, 1, asyncAction);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
load();
|
|
73
|
-
ibiz.mc.command.asyncAction.on(asyncActionCallBack);
|
|
74
|
-
onUnmounted(() => {
|
|
75
|
-
ibiz.mc.command.asyncAction.off(asyncActionCallBack);
|
|
76
|
-
});
|
|
77
|
-
return { allAsyncActions, recentAsyncActions };
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export { useAsyncAction };
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
|
-
|
|
3
|
-
import { IPortalAsyncAction, IPortalMessage } from '@ibiz-template/core';
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
|
-
import { isNil, isNumber } from 'lodash-es';
|
|
6
|
-
import { computed, onUnmounted, ref } from 'vue';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 格式化数据
|
|
10
|
-
* @author lxm
|
|
11
|
-
* @date 2023-11-14 09:02:49
|
|
12
|
-
* @param {IPortalAsyncAction} data
|
|
13
|
-
* @return {*} {IPortalAsyncAction}
|
|
14
|
-
*/
|
|
15
|
-
function formatAsyncAction(data: IPortalAsyncAction): IPortalAsyncAction {
|
|
16
|
-
// 处理时间日期为毫秒值时,转换成字符串。
|
|
17
|
-
const dateFields = [
|
|
18
|
-
'begintime',
|
|
19
|
-
'endtime',
|
|
20
|
-
'createdate',
|
|
21
|
-
'updatedate',
|
|
22
|
-
] as const;
|
|
23
|
-
dateFields.forEach(key => {
|
|
24
|
-
if (isNumber(data[key])) {
|
|
25
|
-
data[key] = dayjs(data[key]).format('YYYY-MM-DD HH:mm:ss');
|
|
26
|
-
}
|
|
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
|
-
|
|
38
|
-
if (!isNil(data.completionrate)) {
|
|
39
|
-
const num = Number(data.completionrate);
|
|
40
|
-
if (Number.isNaN(num)) {
|
|
41
|
-
data.completionrate = undefined;
|
|
42
|
-
} else {
|
|
43
|
-
data.completionrate = num;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 使用异步操作消息
|
|
52
|
-
* @author lxm
|
|
53
|
-
* @date 2023-11-14 03:17:28
|
|
54
|
-
* @export
|
|
55
|
-
* @return {*}
|
|
56
|
-
*/
|
|
57
|
-
export function useAsyncAction() {
|
|
58
|
-
/** 所有消息数据 */
|
|
59
|
-
const allAsyncActions = ref<IPortalAsyncAction[]>([]);
|
|
60
|
-
/** 显示的长度 */
|
|
61
|
-
const showLength = ref(0);
|
|
62
|
-
|
|
63
|
-
/** 显示的消息数据 */
|
|
64
|
-
const recentAsyncActions = computed(() => {
|
|
65
|
-
return allAsyncActions.value.filter(
|
|
66
|
-
(_item, index) => index < showLength.value,
|
|
67
|
-
);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const load = async () => {
|
|
71
|
-
const res = await ibiz.asyncAction.fetch();
|
|
72
|
-
res.data.forEach(formatAsyncAction);
|
|
73
|
-
allAsyncActions.value = res.data;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* 异步消息变更回调处理
|
|
78
|
-
* @author lxm
|
|
79
|
-
* @date 2023-11-14 03:53:08
|
|
80
|
-
*/
|
|
81
|
-
const asyncActionCallBack = (msg: IPortalMessage) => {
|
|
82
|
-
if (!msg.data || msg.subtype !== 'ASYNCACTION') {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
console.log('原始数据', msg);
|
|
86
|
-
|
|
87
|
-
const asyncAction = formatAsyncAction(msg.data as IPortalAsyncAction);
|
|
88
|
-
|
|
89
|
-
console.log('格式化后数据', asyncAction);
|
|
90
|
-
|
|
91
|
-
const findIndex = allAsyncActions.value.findIndex(
|
|
92
|
-
item => item.asyncacitonid === asyncAction.asyncacitonid,
|
|
93
|
-
);
|
|
94
|
-
if (findIndex === -1) {
|
|
95
|
-
// 不存在的数据补充到最开始,并显示长度加一
|
|
96
|
-
allAsyncActions.value.unshift(asyncAction);
|
|
97
|
-
showLength.value += 1;
|
|
98
|
-
} else {
|
|
99
|
-
const isShow = findIndex >= showLength.value;
|
|
100
|
-
// 找的到但是不在显示列表里,移到开头,并增加长度
|
|
101
|
-
if (isShow) {
|
|
102
|
-
allAsyncActions.value.splice(findIndex, 1);
|
|
103
|
-
allAsyncActions.value.unshift(asyncAction);
|
|
104
|
-
showLength.value += 1;
|
|
105
|
-
} else {
|
|
106
|
-
allAsyncActions.value.splice(findIndex, 1, asyncAction);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// *初始化操作
|
|
112
|
-
load();
|
|
113
|
-
|
|
114
|
-
// 监听异步操作消息变更
|
|
115
|
-
ibiz.mc.command.asyncAction.on(asyncActionCallBack);
|
|
116
|
-
// 销毁时删除监听
|
|
117
|
-
onUnmounted(() => {
|
|
118
|
-
ibiz.mc.command.asyncAction.off(asyncActionCallBack);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
return { allAsyncActions, recentAsyncActions };
|
|
122
|
-
}
|