@ibiz-template/vue3-util 0.5.7-alpha.1 → 0.5.7-alpha.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/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.d.ts.map +1 -1
- package/es/control/panel/panel/panel.mjs +7 -2
- package/es/control/panel/view-layout-panel/index.mjs +1 -1
- package/es/control/panel/view-layout-panel/view-layout-panel.d.ts.map +1 -1
- package/es/control/panel/view-layout-panel/view-layout-panel.mjs +7 -2
- package/es/panel-component/grid-container/grid-container.d.ts +2 -0
- package/es/panel-component/grid-container/grid-container.d.ts.map +1 -1
- package/es/panel-component/grid-container/grid-container.mjs +1 -1
- package/es/panel-component/grid-container/index.d.ts +2 -0
- package/es/panel-component/grid-container/index.d.ts.map +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/index.d.ts +1 -0
- package/es/panel-component/panel-rawitem/index.d.ts.map +1 -1
- package/es/panel-component/panel-rawitem/panel-rawitem.d.ts +1 -0
- package/es/panel-component/panel-rawitem/panel-rawitem.d.ts.map +1 -1
- package/es/panel-component/panel-rawitem/panel-rawitem.mjs +11 -2
- 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/route/route.d.ts +4 -3
- package/es/util/route/route.d.ts.map +1 -1
- package/es/util/route/route.mjs +19 -5
- 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/index.d.ts +0 -1
- package/es/view/common/index.d.ts.map +1 -1
- package/es/view/common/view.d.ts +0 -1
- package/es/view/common/view.d.ts.map +1 -1
- package/es/view/common/view.mjs +1 -17
- 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/control/panel/panel/panel.tsx +6 -0
- package/src/control/panel/view-layout-panel/view-layout-panel.tsx +6 -0
- package/src/panel-component/panel-rawitem/panel-rawitem.tsx +11 -1
- package/src/util/route/route.ts +30 -5
- package/src/util/store/app-store/app-store.ts +3 -14
- package/src/view/common/view.tsx +0 -24
- 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
|
@@ -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
|
-
}
|