super-page-runtime 2.1.68 → 2.1.72
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.
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { getBaseUrl, getRealRestApiPath } from "./common-util.js";
|
|
2
|
+
import http from "agilebuilder-ui/src/utils/request";
|
|
3
|
+
import "./eventBus.js";
|
|
4
|
+
import { getPermissionCodes } from "./page-init-util.js";
|
|
5
|
+
import "agilebuilder-ui/src/utils/common-util";
|
|
6
|
+
import "agilebuilder-ui/src/utils/util";
|
|
7
|
+
import "element-plus";
|
|
8
|
+
import "agilebuilder-ui/src/utils/auth";
|
|
9
|
+
import "./global-refs.js";
|
|
10
|
+
import "axios";
|
|
11
|
+
import "dayjs";
|
|
12
|
+
import "agilebuilder-ui/src/utils/calculator/calculator-util";
|
|
13
|
+
import "vue";
|
|
14
|
+
import "./events/print-label.js";
|
|
15
|
+
import "./page-store.js";
|
|
16
|
+
import "agilebuilder-ui/src/utils/i18n-util";
|
|
17
|
+
import "vue-i18n";
|
|
18
|
+
import "async-validator";
|
|
19
|
+
function getMenuTreeData(pageContext, configure, parentNodeId, node, loadParams) {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
if (configure && ((_a = configure.props.dataOrigin) == null ? void 0 : _a.optionValueSetType)) {
|
|
23
|
+
if (((_b = configure.props.dataOrigin) == null ? void 0 : _b.optionValueSetType) === "beanName") {
|
|
24
|
+
const backendUrl = pageContext.backendUrl;
|
|
25
|
+
const systemCode = pageContext.systemCode;
|
|
26
|
+
const functionCodes = getPermissionCodes(configure, pageContext);
|
|
27
|
+
let path = getBaseUrl(backendUrl, pageContext.isTest) + "/dsc/commons/load-tree-node";
|
|
28
|
+
path = getRealRestApiPath(path, systemCode, backendUrl, pageContext.isTest);
|
|
29
|
+
const param = {
|
|
30
|
+
pageCode: pageContext.code,
|
|
31
|
+
pageVersion: pageContext.version,
|
|
32
|
+
tableName: pageContext.tableName,
|
|
33
|
+
systemCode,
|
|
34
|
+
functionCode: functionCodes,
|
|
35
|
+
beanName: pageContext.beanName
|
|
36
|
+
};
|
|
37
|
+
if (loadParams) {
|
|
38
|
+
Object.assign(param, loadParams);
|
|
39
|
+
}
|
|
40
|
+
http.post(path, param).then((data) => {
|
|
41
|
+
resolve(data);
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
const runtimeInfo = configure.runtime ? configure.runtime : {};
|
|
45
|
+
const designProperty = runtimeInfo.props;
|
|
46
|
+
if (designProperty && designProperty.staticData) {
|
|
47
|
+
resolve(designProperty.staticData);
|
|
48
|
+
} else {
|
|
49
|
+
resolve([]);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
resolve([]);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
getMenuTreeData
|
|
59
|
+
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, unref,
|
|
1
|
+
import { defineComponent, computed, ref, onMounted, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, createBlock, normalizeStyle, withCtx, createElementVNode, createVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
2
|
import { getFormModelFields } from "../../../../utils/page-init-util.js";
|
|
3
3
|
import { getVariableValue, setVariableValue } from "../../../../utils/page-helper-util.js";
|
|
4
|
+
import { getMenuTreeData } from "../../../../utils/tree-utils.js";
|
|
5
|
+
import { handleAfterInitEvent, handleFormEvent } from "../../../../utils/events/event-util.js";
|
|
6
|
+
const _hoisted_1 = ["title"];
|
|
4
7
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
8
|
__name: "tree-runtime",
|
|
6
9
|
props: {
|
|
7
10
|
pageContext: {},
|
|
8
11
|
configure: {}
|
|
9
12
|
},
|
|
10
|
-
setup(__props) {
|
|
13
|
+
setup(__props, { expose: __expose }) {
|
|
14
|
+
var _a, _b;
|
|
11
15
|
const props = __props;
|
|
12
16
|
const entity = props.pageContext.entity ? props.pageContext.entity : {};
|
|
13
17
|
let dynamicFields = getFormModelFields(props.pageContext, props.configure);
|
|
14
|
-
computed({
|
|
18
|
+
const dynamicModelMethod = computed({
|
|
15
19
|
get() {
|
|
16
20
|
return getVariableValue(entity, dynamicFields);
|
|
17
21
|
},
|
|
@@ -19,26 +23,155 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
19
23
|
setVariableValue(entity, dynamicFields, value);
|
|
20
24
|
}
|
|
21
25
|
});
|
|
26
|
+
const isLazy = ref(((_b = (_a = props.configure.props) == null ? void 0 : _a.base) == null ? void 0 : _b.lazy) ? true : false);
|
|
22
27
|
const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
|
|
23
28
|
const runtimeStyle = runtimeInfo.style;
|
|
24
29
|
const runtimeClass = runtimeInfo.class;
|
|
25
30
|
runtimeInfo.headerStyle;
|
|
31
|
+
const menuTree = ref(null);
|
|
26
32
|
const designProperty = ref(runtimeInfo.props ? runtimeInfo.props : {});
|
|
33
|
+
const defaultProps = ref(
|
|
34
|
+
{
|
|
35
|
+
id: "nodeId",
|
|
36
|
+
label: "name",
|
|
37
|
+
children: "children",
|
|
38
|
+
isLeaf: "leaf",
|
|
39
|
+
disabled: "disabled",
|
|
40
|
+
nodeType: "nodeType",
|
|
41
|
+
iconType: "iconType",
|
|
42
|
+
iconValue: "iconValue"
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
const isShowTree = ref(false);
|
|
46
|
+
const menuData = ref(null);
|
|
47
|
+
const selectNode = ref(null);
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
nextTick(() => {
|
|
50
|
+
const value = dynamicModelMethod.value;
|
|
51
|
+
handleAfterInitEvent(value, props.pageContext, props.configure, {
|
|
52
|
+
componentRef: menuTree.value,
|
|
53
|
+
value,
|
|
54
|
+
entity: props.pageContext.entity.data,
|
|
55
|
+
pageData: props.pageContext.entity.page
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
if (!isLazy.value) {
|
|
60
|
+
getMenuTreeData(props.pageContext, props.configure).then((treeNodes) => {
|
|
61
|
+
menuData.value = treeNodes;
|
|
62
|
+
isShowTree.value = true;
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
isShowTree.value = true;
|
|
66
|
+
}
|
|
67
|
+
function handleNodeClick(data, node, nodeTree) {
|
|
68
|
+
selectNode.value = node;
|
|
69
|
+
handleFormEvent(null, props.pageContext, props.configure, "node-click", {
|
|
70
|
+
data,
|
|
71
|
+
node,
|
|
72
|
+
nodeTree
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function loadNode(node, resolve) {
|
|
76
|
+
const parentId = 0;
|
|
77
|
+
let parentNodeId = "0";
|
|
78
|
+
if (node.level === 0) {
|
|
79
|
+
parentNodeId = parentId + "";
|
|
80
|
+
} else {
|
|
81
|
+
parentNodeId = node.data.nodeId;
|
|
82
|
+
}
|
|
83
|
+
initLoadNode(parentNodeId, node, resolve);
|
|
84
|
+
}
|
|
85
|
+
function initLoadNode(parentNodeId, node, resolve) {
|
|
86
|
+
const param = {
|
|
87
|
+
parentNodeId,
|
|
88
|
+
data: node.data
|
|
89
|
+
// 节点详细信息,json字符串
|
|
90
|
+
};
|
|
91
|
+
getMenuTreeData(props.pageContext, props.configure, parentNodeId, node, param).then(
|
|
92
|
+
(treeNodes) => {
|
|
93
|
+
resolve(treeNodes);
|
|
94
|
+
if (parentNodeId === "0") {
|
|
95
|
+
const rootNodeId = treeNodes[0].nodeId;
|
|
96
|
+
loadRootNode(rootNodeId, node);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function loadRootNode(rootNodeId, node) {
|
|
102
|
+
const param = {
|
|
103
|
+
parentNodeId: rootNodeId,
|
|
104
|
+
data: node.data
|
|
105
|
+
// 节点详细信息,json字符串
|
|
106
|
+
};
|
|
107
|
+
getMenuTreeData(props.pageContext, props.configure, rootNodeId, node, param).then((children) => {
|
|
108
|
+
menuTree.value.updateKeyChildren(rootNodeId, children);
|
|
109
|
+
if (menuTree.value.store.nodesMap[rootNodeId]) {
|
|
110
|
+
menuTree.value.store.nodesMap[rootNodeId].expanded = true;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function getSelectNode() {
|
|
115
|
+
return selectNode.value;
|
|
116
|
+
}
|
|
117
|
+
function expandNode(node) {
|
|
118
|
+
node.loaded = false;
|
|
119
|
+
node.expand();
|
|
120
|
+
}
|
|
121
|
+
__expose({
|
|
122
|
+
getSelectNode,
|
|
123
|
+
expandNode
|
|
124
|
+
});
|
|
27
125
|
return (_ctx, _cache) => {
|
|
126
|
+
const _component_SuperIcon = resolveComponent("SuperIcon");
|
|
127
|
+
const _component_Folder = resolveComponent("Folder");
|
|
128
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
28
129
|
const _component_el_tree = resolveComponent("el-tree");
|
|
29
130
|
return openBlock(), createElementBlock("div", {
|
|
30
131
|
class: normalizeClass(unref(runtimeClass))
|
|
31
132
|
}, [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
133
|
+
isShowTree.value ? (openBlock(), createBlock(_component_el_tree, {
|
|
134
|
+
key: 0,
|
|
135
|
+
ref_key: "menuTree",
|
|
136
|
+
ref: menuTree,
|
|
137
|
+
style: normalizeStyle(unref(runtimeStyle)),
|
|
138
|
+
load: loadNode,
|
|
139
|
+
data: menuData.value,
|
|
140
|
+
props: defaultProps.value,
|
|
35
141
|
"default-expand-all": designProperty.value.defaultExpandAll,
|
|
36
142
|
"expand-on-click-node": designProperty.value.expandOnClickNode,
|
|
37
143
|
indent: designProperty.value.retractWidth ? designProperty.value.retractWidth : 18,
|
|
38
144
|
accordion: designProperty.value.accordion,
|
|
39
|
-
"show-checkbox": designProperty.value.showCheckbox,
|
|
40
|
-
|
|
41
|
-
|
|
145
|
+
"show-checkbox": designProperty.value.showCheckbox ? true : false,
|
|
146
|
+
"highlight-current": "",
|
|
147
|
+
lazy: isLazy.value,
|
|
148
|
+
"node-key": "nodeId",
|
|
149
|
+
onNodeClick: handleNodeClick
|
|
150
|
+
}, {
|
|
151
|
+
default: withCtx(({ node, data }) => [
|
|
152
|
+
createElementVNode("span", {
|
|
153
|
+
title: node.label,
|
|
154
|
+
class: "ellipsis"
|
|
155
|
+
}, [
|
|
156
|
+
data.iconValue ? (openBlock(), createBlock(_component_SuperIcon, {
|
|
157
|
+
key: 0,
|
|
158
|
+
iconType: data.iconType,
|
|
159
|
+
iconValue: data.iconValue
|
|
160
|
+
}, null, 8, ["iconType", "iconValue"])) : designProperty.value.iconValue ? (openBlock(), createBlock(_component_SuperIcon, {
|
|
161
|
+
key: 1,
|
|
162
|
+
iconType: designProperty.value.iconType,
|
|
163
|
+
iconValue: designProperty.value.iconValue
|
|
164
|
+
}, null, 8, ["iconType", "iconValue"])) : (openBlock(), createBlock(_component_el_icon, { key: 2 }, {
|
|
165
|
+
default: withCtx(() => [
|
|
166
|
+
createVNode(_component_Folder)
|
|
167
|
+
]),
|
|
168
|
+
_: 1
|
|
169
|
+
})),
|
|
170
|
+
createElementVNode("span", null, toDisplayString(node.label), 1)
|
|
171
|
+
], 8, _hoisted_1)
|
|
172
|
+
]),
|
|
173
|
+
_: 1
|
|
174
|
+
}, 8, ["style", "data", "props", "default-expand-all", "expand-on-click-node", "indent", "accordion", "show-checkbox", "lazy"])) : createCommentVNode("", true)
|
|
42
175
|
], 2);
|
|
43
176
|
};
|
|
44
177
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "super-page-runtime",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.72",
|
|
4
4
|
"description": "AgileBuilder super page runtime",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/es/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
49
49
|
"@vue/eslint-config-prettier": "^8.0.0",
|
|
50
50
|
"@vue/test-utils": "^2.4.4",
|
|
51
|
-
"agilebuilder-ui": "1.0.
|
|
51
|
+
"agilebuilder-ui": "1.0.93",
|
|
52
52
|
"axios": "^1.6.8",
|
|
53
53
|
"cypress": "^13.6.6",
|
|
54
54
|
"element-plus": "^2.6.1",
|