ocpview-plus 1.2.7 → 1.2.9
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/README.md +0 -18
- package/dist/ocpviewplus.min.esm.js +366 -48
- package/dist/ocpviewplus.min.js +14 -14
- package/package.json +1 -1
- package/src/components/masterplate/billdetailform.vue +153 -0
- package/src/components/masterplate/lefttreerightdetails.vue +1 -1
- package/src/components/tree/CompatTree.vue +267 -22
- package/src/components/tree/basetree.vue +192 -44
package/README.md
CHANGED
|
@@ -7,24 +7,6 @@ ListDetail 模板 EditGrid 屏蔽键盘导航
|
|
|
7
7
|
|
|
8
8
|
### 1.1.0 更新说明
|
|
9
9
|
支持单据明细导出
|
|
10
|
-
用例简介:
|
|
11
|
-
```
|
|
12
|
-
// 按钮配置
|
|
13
|
-
{
|
|
14
|
-
icon: "custom-export",
|
|
15
|
-
name: "billExport",
|
|
16
|
-
text: "导出",
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// 多明细导出配置,若非多明细可不配置
|
|
21
|
-
billImportConfig: {
|
|
22
|
-
typeData: [
|
|
23
|
-
{ code: 'goods_1', name: '单品' },
|
|
24
|
-
{ code: 'comb_2', name: '组合' },
|
|
25
|
-
],
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
10
|
|
|
29
11
|
### 1.1.1 更新说明
|
|
30
12
|
导出默认加mktcode
|
|
@@ -6,7 +6,7 @@ import md5 from "js-md5";
|
|
|
6
6
|
import * as XLSX from "xlsx";
|
|
7
7
|
import * as XLSXS from "xlsx-style-vite";
|
|
8
8
|
import { saveAs } from "file-saver";
|
|
9
|
-
import { watch, effectScope, reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, createVNode, withCtx, withDirectives, createTextVNode, toDisplayString, vShow, createCommentVNode, Fragment, createBlock, renderList, createElementVNode, withKeys, withModifiers, renderSlot, createSlots, normalizeClass, defineComponent, onMounted, onBeforeUnmount, ref, nextTick, h as h$1, toRaw, unref, resolveDynamicComponent, shallowRef, watchEffect, inject, createApp, Teleport, provide, onUnmounted, TransitionGroup, getCurrentInstance, onActivated, onDeactivated } from "vue";
|
|
9
|
+
import { watch, effectScope, reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, createVNode, withCtx, withDirectives, createTextVNode, toDisplayString, vShow, createCommentVNode, Fragment, createBlock, renderList, createElementVNode, withKeys, withModifiers, renderSlot, createSlots, normalizeClass, defineComponent, onMounted, onBeforeUnmount, ref, nextTick, h as h$1, toRaw, unref, resolveDynamicComponent, mergeProps, shallowRef, watchEffect, inject, createApp, Teleport, provide, onUnmounted, TransitionGroup, getCurrentInstance, onActivated, onDeactivated } from "vue";
|
|
10
10
|
import elementResizeDetectorMaker from "element-resize-detector";
|
|
11
11
|
import pako, { gzip } from "pako";
|
|
12
12
|
import Viewer from "viewerjs";
|
|
@@ -453,7 +453,7 @@ common.initEview = function(ViewUI2) {
|
|
|
453
453
|
common.initAnchor(ViewUI2.Anchor);
|
|
454
454
|
};
|
|
455
455
|
const name = "ocpview-plus";
|
|
456
|
-
const version$2 = "1.2.
|
|
456
|
+
const version$2 = "1.2.8";
|
|
457
457
|
const title = "ocpviewPlus";
|
|
458
458
|
const description = "A high quality Service UI components Library with Vue.js";
|
|
459
459
|
const homepage = "";
|
|
@@ -28944,42 +28944,148 @@ function _sfc_render$1h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
28944
28944
|
var ConditionSelectorBox = /* @__PURE__ */ _export_sfc$1(_sfc_main$1p, [["render", _sfc_render$1h]]);
|
|
28945
28945
|
const _sfc_main$1o = {
|
|
28946
28946
|
name: "CompatTree",
|
|
28947
|
-
components: {
|
|
28948
|
-
Tree
|
|
28949
|
-
},
|
|
28947
|
+
components: { Tree },
|
|
28950
28948
|
props: {
|
|
28951
28949
|
data: {
|
|
28952
28950
|
type: Array,
|
|
28953
|
-
|
|
28951
|
+
default: () => []
|
|
28954
28952
|
},
|
|
28955
28953
|
render: {
|
|
28956
28954
|
type: Function,
|
|
28957
28955
|
default: null
|
|
28958
28956
|
}
|
|
28959
28957
|
},
|
|
28958
|
+
data() {
|
|
28959
|
+
return {
|
|
28960
|
+
innerData: []
|
|
28961
|
+
};
|
|
28962
|
+
},
|
|
28963
|
+
watch: {
|
|
28964
|
+
data: {
|
|
28965
|
+
immediate: true,
|
|
28966
|
+
handler(val2) {
|
|
28967
|
+
if (Array.isArray(val2)) {
|
|
28968
|
+
console.log("watch data triggered");
|
|
28969
|
+
this.innerData = [...val2];
|
|
28970
|
+
} else {
|
|
28971
|
+
this.innerData = [];
|
|
28972
|
+
}
|
|
28973
|
+
}
|
|
28974
|
+
}
|
|
28975
|
+
},
|
|
28976
|
+
computed: {
|
|
28977
|
+
flatState() {
|
|
28978
|
+
const list = [];
|
|
28979
|
+
console.log("flatState computing");
|
|
28980
|
+
const walk = (nodes) => {
|
|
28981
|
+
if (!Array.isArray(nodes))
|
|
28982
|
+
return;
|
|
28983
|
+
for (const n10 of nodes) {
|
|
28984
|
+
list.push({ node: n10 });
|
|
28985
|
+
if (Array.isArray(n10.children)) {
|
|
28986
|
+
walk(n10.children);
|
|
28987
|
+
}
|
|
28988
|
+
}
|
|
28989
|
+
};
|
|
28990
|
+
walk(this.innerData);
|
|
28991
|
+
return list;
|
|
28992
|
+
}
|
|
28993
|
+
},
|
|
28960
28994
|
methods: {
|
|
28961
28995
|
renderWrapper(slotProps) {
|
|
28962
28996
|
const nodeRender = slotProps.data.render || this.render;
|
|
28963
28997
|
if (!nodeRender) {
|
|
28964
28998
|
return slotProps.data.title;
|
|
28965
28999
|
}
|
|
28966
|
-
return nodeRender(h$1,
|
|
29000
|
+
return nodeRender(h$1, {
|
|
29001
|
+
root: slotProps.root,
|
|
29002
|
+
node: slotProps.node,
|
|
29003
|
+
data: slotProps.data
|
|
29004
|
+
});
|
|
29005
|
+
},
|
|
29006
|
+
getSelectedNodes() {
|
|
29007
|
+
var _a2, _b2;
|
|
29008
|
+
return ((_b2 = (_a2 = this.$refs.tree) == null ? void 0 : _a2.getSelectedNodes) == null ? void 0 : _b2.call(_a2)) || [];
|
|
29009
|
+
},
|
|
29010
|
+
getCheckedNodes() {
|
|
29011
|
+
var _a2, _b2;
|
|
29012
|
+
return ((_b2 = (_a2 = this.$refs.tree) == null ? void 0 : _a2.getCheckedNodes) == null ? void 0 : _b2.call(_a2)) || [];
|
|
29013
|
+
},
|
|
29014
|
+
expandAll() {
|
|
29015
|
+
var _a2, _b2;
|
|
29016
|
+
(_b2 = (_a2 = this.$refs.tree) == null ? void 0 : _a2.expandAll) == null ? void 0 : _b2.call(_a2);
|
|
29017
|
+
},
|
|
29018
|
+
collapseAll() {
|
|
29019
|
+
var _a2, _b2;
|
|
29020
|
+
(_b2 = (_a2 = this.$refs.tree) == null ? void 0 : _a2.collapseAll) == null ? void 0 : _b2.call(_a2);
|
|
29021
|
+
},
|
|
29022
|
+
setData(data) {
|
|
29023
|
+
this.innerData = Array.isArray(data) ? [...data] : [];
|
|
29024
|
+
},
|
|
29025
|
+
refurbish() {
|
|
29026
|
+
const tmp = [...this.innerData];
|
|
29027
|
+
this.innerData = [];
|
|
29028
|
+
this.$nextTick(() => {
|
|
29029
|
+
this.innerData = tmp;
|
|
29030
|
+
});
|
|
29031
|
+
},
|
|
29032
|
+
getRootNodes() {
|
|
29033
|
+
return this.innerData;
|
|
29034
|
+
},
|
|
29035
|
+
updateNode(data, flag) {
|
|
29036
|
+
const idField = "id";
|
|
29037
|
+
console.log("updateNode called", data, flag);
|
|
29038
|
+
const findNode = (list, id2) => {
|
|
29039
|
+
for (const node of list) {
|
|
29040
|
+
if (node[idField] === id2) {
|
|
29041
|
+
return node;
|
|
29042
|
+
}
|
|
29043
|
+
if (Array.isArray(node.children)) {
|
|
29044
|
+
const res = findNode(node.children, id2);
|
|
29045
|
+
if (res)
|
|
29046
|
+
return res;
|
|
29047
|
+
}
|
|
29048
|
+
}
|
|
29049
|
+
return null;
|
|
29050
|
+
};
|
|
29051
|
+
if (flag === "U") {
|
|
29052
|
+
const node = findNode(this.innerData, data[idField]);
|
|
29053
|
+
if (node) {
|
|
29054
|
+
Object.assign(node, data);
|
|
29055
|
+
}
|
|
29056
|
+
}
|
|
29057
|
+
if (flag === "D") {
|
|
29058
|
+
const removeNode2 = (list, id2) => {
|
|
29059
|
+
const index = list.findIndex(
|
|
29060
|
+
(n10) => n10[idField] === id2
|
|
29061
|
+
);
|
|
29062
|
+
if (index > -1) {
|
|
29063
|
+
list.splice(index, 1);
|
|
29064
|
+
return true;
|
|
29065
|
+
}
|
|
29066
|
+
for (const n10 of list) {
|
|
29067
|
+
if (Array.isArray(n10.children) && removeNode2(n10.children, id2)) {
|
|
29068
|
+
return true;
|
|
29069
|
+
}
|
|
29070
|
+
}
|
|
29071
|
+
return false;
|
|
29072
|
+
};
|
|
29073
|
+
removeNode2(this.innerData, data[idField]);
|
|
29074
|
+
}
|
|
28967
29075
|
}
|
|
28968
29076
|
}
|
|
28969
29077
|
};
|
|
28970
29078
|
function _sfc_render$1g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
28971
29079
|
const _component_Tree = resolveComponent("Tree");
|
|
28972
|
-
return openBlock(), createBlock(_component_Tree, {
|
|
28973
|
-
|
|
28974
|
-
|
|
28975
|
-
}, {
|
|
29080
|
+
return openBlock(), createBlock(_component_Tree, mergeProps({
|
|
29081
|
+
ref: "tree",
|
|
29082
|
+
data: $data.innerData
|
|
29083
|
+
}, _ctx.$attrs), {
|
|
28976
29084
|
title: withCtx((slotProps) => [
|
|
28977
|
-
(openBlock(), createBlock(resolveDynamicComponent({
|
|
28978
|
-
render: () => $options.renderWrapper(slotProps)
|
|
28979
|
-
})))
|
|
29085
|
+
(openBlock(), createBlock(resolveDynamicComponent({ render: () => $options.renderWrapper(slotProps) })))
|
|
28980
29086
|
]),
|
|
28981
29087
|
_: 1
|
|
28982
|
-
},
|
|
29088
|
+
}, 16, ["data"]);
|
|
28983
29089
|
}
|
|
28984
29090
|
var CompatTree = /* @__PURE__ */ _export_sfc$1(_sfc_main$1o, [["render", _sfc_render$1g]]);
|
|
28985
29091
|
var conditionfilterbox_vue_vue_type_style_index_0_lang = "";
|
|
@@ -34447,20 +34553,26 @@ const _sfc_main$17 = {
|
|
|
34447
34553
|
let pos = {};
|
|
34448
34554
|
let tree = [];
|
|
34449
34555
|
let i = 0;
|
|
34450
|
-
|
|
34556
|
+
const idField = this.myConfig.idField;
|
|
34557
|
+
const parentField = this.myConfig.parentField;
|
|
34558
|
+
const rootId = this.rootNode[idField];
|
|
34559
|
+
const focusId = selectedId !== null && selectedId !== void 0 ? selectedId : this._autoExpandId;
|
|
34451
34560
|
let autoExpandParents = /* @__PURE__ */ new Set();
|
|
34452
|
-
if (
|
|
34453
|
-
let current = this.data.find(
|
|
34454
|
-
|
|
34455
|
-
);
|
|
34561
|
+
if (focusId !== null && focusId !== void 0) {
|
|
34562
|
+
let current = this.data.find((item) => item[idField] === focusId);
|
|
34563
|
+
const visited = /* @__PURE__ */ new Set();
|
|
34456
34564
|
while (current) {
|
|
34457
|
-
|
|
34458
|
-
|
|
34459
|
-
|
|
34565
|
+
const cid = current[idField];
|
|
34566
|
+
if (visited.has(cid)) {
|
|
34567
|
+
console.warn("[toTreeData] parent chain cycle detected:", cid);
|
|
34460
34568
|
break;
|
|
34461
|
-
|
|
34462
|
-
|
|
34463
|
-
);
|
|
34569
|
+
}
|
|
34570
|
+
visited.add(cid);
|
|
34571
|
+
autoExpandParents.add(cid);
|
|
34572
|
+
const pid = current[parentField];
|
|
34573
|
+
if (pid == null)
|
|
34574
|
+
break;
|
|
34575
|
+
current = this.data.find((item) => item[idField] === pid);
|
|
34464
34576
|
}
|
|
34465
34577
|
}
|
|
34466
34578
|
let data = this.$Method.copy(this.data);
|
|
@@ -34468,38 +34580,63 @@ const _sfc_main$17 = {
|
|
|
34468
34580
|
this.setSelected(el2);
|
|
34469
34581
|
});
|
|
34470
34582
|
let tempData = this.$Method.copy(data);
|
|
34583
|
+
const applyNodeState = (node) => {
|
|
34584
|
+
const nid = node[idField];
|
|
34585
|
+
if (expandMap.has(nid) || autoExpandParents.has(nid)) {
|
|
34586
|
+
node.expand = true;
|
|
34587
|
+
}
|
|
34588
|
+
node.selected = focusId !== null && focusId !== void 0 && nid === focusId;
|
|
34589
|
+
};
|
|
34590
|
+
let guard = 0;
|
|
34591
|
+
const maxGuard = data.length * 5 + 20;
|
|
34592
|
+
let movedInRound = 0;
|
|
34471
34593
|
while (data.length !== 0) {
|
|
34472
|
-
const
|
|
34473
|
-
const currentId =
|
|
34474
|
-
|
|
34475
|
-
|
|
34476
|
-
|
|
34477
|
-
|
|
34478
|
-
|
|
34479
|
-
tree.
|
|
34480
|
-
pos[data[i][this.myConfig.idField]] = [tree.length - 1];
|
|
34594
|
+
const current = data[i];
|
|
34595
|
+
const currentId = current[idField];
|
|
34596
|
+
const parentId = current[parentField];
|
|
34597
|
+
const index = tempData.findIndex((item) => item[idField] === parentId);
|
|
34598
|
+
if (parentId === rootId || index < 0) {
|
|
34599
|
+
applyNodeState(current);
|
|
34600
|
+
tree.push(current);
|
|
34601
|
+
pos[currentId] = [tree.length - 1];
|
|
34481
34602
|
data.splice(i, 1);
|
|
34482
34603
|
i--;
|
|
34604
|
+
movedInRound++;
|
|
34483
34605
|
} else {
|
|
34484
|
-
|
|
34606
|
+
const posArr = pos[parentId];
|
|
34485
34607
|
if (posArr) {
|
|
34486
34608
|
let obj = tree[posArr[0]];
|
|
34487
|
-
for (
|
|
34609
|
+
for (let j10 = 1; j10 < posArr.length; j10++) {
|
|
34488
34610
|
obj = obj.children[posArr[j10]];
|
|
34489
34611
|
}
|
|
34490
|
-
|
|
34491
|
-
|
|
34492
|
-
|
|
34493
|
-
data[i].selected = currentId === selectedId;
|
|
34494
|
-
obj.children.push(data[i]);
|
|
34495
|
-
pos[data[i][this.myConfig.idField]] = posArr.concat([obj.children.length - 1]);
|
|
34612
|
+
applyNodeState(current);
|
|
34613
|
+
obj.children.push(current);
|
|
34614
|
+
pos[currentId] = posArr.concat([obj.children.length - 1]);
|
|
34496
34615
|
data.splice(i, 1);
|
|
34497
34616
|
i--;
|
|
34617
|
+
movedInRound++;
|
|
34498
34618
|
}
|
|
34499
34619
|
}
|
|
34500
34620
|
i++;
|
|
34501
34621
|
if (i > data.length - 1) {
|
|
34622
|
+
if (movedInRound === 0 && data.length > 0) {
|
|
34623
|
+
console.warn("[toTreeData] unresolved/cyclic nodes, force attach to root level:", data);
|
|
34624
|
+
data.forEach((node) => {
|
|
34625
|
+
applyNodeState(node);
|
|
34626
|
+
const nid = node[idField];
|
|
34627
|
+
tree.push(node);
|
|
34628
|
+
pos[nid] = [tree.length - 1];
|
|
34629
|
+
});
|
|
34630
|
+
data = [];
|
|
34631
|
+
break;
|
|
34632
|
+
}
|
|
34633
|
+
movedInRound = 0;
|
|
34502
34634
|
i = 0;
|
|
34635
|
+
guard++;
|
|
34636
|
+
if (guard > maxGuard) {
|
|
34637
|
+
console.warn("[toTreeData] safety break triggered");
|
|
34638
|
+
break;
|
|
34639
|
+
}
|
|
34503
34640
|
}
|
|
34504
34641
|
}
|
|
34505
34642
|
if (this.myConfig.showRootNode) {
|
|
@@ -34520,11 +34657,7 @@ const _sfc_main$17 = {
|
|
|
34520
34657
|
root = this.setIcon(root);
|
|
34521
34658
|
}
|
|
34522
34659
|
}
|
|
34523
|
-
|
|
34524
|
-
root.render = this.myConfig.nodeRender;
|
|
34525
|
-
} else {
|
|
34526
|
-
root.render = this.iconRender;
|
|
34527
|
-
}
|
|
34660
|
+
root.render = this.myConfig.nodeRender ? this.myConfig.nodeRender : this.iconRender;
|
|
34528
34661
|
this._autoExpandId = null;
|
|
34529
34662
|
return [root];
|
|
34530
34663
|
} else {
|
|
@@ -34838,6 +34971,81 @@ const _sfc_main$17 = {
|
|
|
34838
34971
|
}
|
|
34839
34972
|
}
|
|
34840
34973
|
let responseId = this.myConfig.responseId;
|
|
34974
|
+
this.$refs.tree.flatState.forEach((el2) => {
|
|
34975
|
+
let index = data.findIndex(
|
|
34976
|
+
(el22) => el2.node[responseId] === el22[responseId]
|
|
34977
|
+
);
|
|
34978
|
+
if (index > -1) {
|
|
34979
|
+
if (el2.node[tempName] !== value) {
|
|
34980
|
+
let obj = {};
|
|
34981
|
+
obj[tempName] = value;
|
|
34982
|
+
Object.assign(el2.node, obj);
|
|
34983
|
+
}
|
|
34984
|
+
} else {
|
|
34985
|
+
if (el2.node[tempName] !== !value) {
|
|
34986
|
+
let obj = {};
|
|
34987
|
+
obj[tempName] = !value;
|
|
34988
|
+
Object.assign(el2.node, obj);
|
|
34989
|
+
}
|
|
34990
|
+
}
|
|
34991
|
+
});
|
|
34992
|
+
},
|
|
34993
|
+
setNodese(data = [], name2, value) {
|
|
34994
|
+
let tempName = name2;
|
|
34995
|
+
if (name2 === "readOnly") {
|
|
34996
|
+
tempName = "disabled";
|
|
34997
|
+
} else if (name2 === "selected") {
|
|
34998
|
+
tempName = this.myConfig.multiSelect && this.myConfig.showCheckBox ? "checked" : "selected";
|
|
34999
|
+
}
|
|
35000
|
+
const responseId = this.myConfig.idField || this.myConfig.responseId;
|
|
35001
|
+
const idSet = new Set(
|
|
35002
|
+
(data || []).map((item) => String(item == null ? void 0 : item[responseId]))
|
|
35003
|
+
);
|
|
35004
|
+
const source = Array.isArray(this.data) ? this.data : Array.isArray(this.treeData) ? this.treeData : [];
|
|
35005
|
+
let hitCount = 0;
|
|
35006
|
+
const updateNode = (nodes) => {
|
|
35007
|
+
if (!Array.isArray(nodes))
|
|
35008
|
+
return;
|
|
35009
|
+
nodes.forEach((node) => {
|
|
35010
|
+
const exists = idSet.has(String(node == null ? void 0 : node[responseId]));
|
|
35011
|
+
if (exists)
|
|
35012
|
+
hitCount++;
|
|
35013
|
+
let newValue;
|
|
35014
|
+
if (name2 === "selected" && value === true) {
|
|
35015
|
+
newValue = exists;
|
|
35016
|
+
} else if (exists) {
|
|
35017
|
+
newValue = value;
|
|
35018
|
+
} else {
|
|
35019
|
+
newValue = node[tempName];
|
|
35020
|
+
}
|
|
35021
|
+
if (node[tempName] !== newValue) {
|
|
35022
|
+
node[tempName] = newValue;
|
|
35023
|
+
}
|
|
35024
|
+
if (node.children && node.children.length > 0) {
|
|
35025
|
+
updateNode(node.children);
|
|
35026
|
+
}
|
|
35027
|
+
});
|
|
35028
|
+
};
|
|
35029
|
+
updateNode(source);
|
|
35030
|
+
if (source === this.data)
|
|
35031
|
+
this.data = [...source];
|
|
35032
|
+
if (source === this.treeData)
|
|
35033
|
+
this.treeData = [...source];
|
|
35034
|
+
console.log("[setNodes]", { tempName, responseId, targetIds: [...idSet], hitCount });
|
|
35035
|
+
return hitCount;
|
|
35036
|
+
},
|
|
35037
|
+
setNodes2(data, name2, value) {
|
|
35038
|
+
let tempName = name2;
|
|
35039
|
+
if (name2 === "readOnly") {
|
|
35040
|
+
tempName = "disabled";
|
|
35041
|
+
} else if (name2 === "selected") {
|
|
35042
|
+
if (this.myConfig.multiSelect && this.myConfig.showCheckBox) {
|
|
35043
|
+
tempName = "checked";
|
|
35044
|
+
} else {
|
|
35045
|
+
tempName = "selected";
|
|
35046
|
+
}
|
|
35047
|
+
}
|
|
35048
|
+
let responseId = this.myConfig.idField || this.myConfig.responseId;
|
|
34841
35049
|
const idSet = new Set(
|
|
34842
35050
|
data.map((item) => item[responseId])
|
|
34843
35051
|
);
|
|
@@ -47124,6 +47332,116 @@ const _sfc_main$u = {
|
|
|
47124
47332
|
}
|
|
47125
47333
|
},
|
|
47126
47334
|
methods: {
|
|
47335
|
+
loadDynamicConfig() {
|
|
47336
|
+
try {
|
|
47337
|
+
const postData = {
|
|
47338
|
+
modulecode: this.myConfig.modulecode,
|
|
47339
|
+
moduleid: this.myConfig.modulecode
|
|
47340
|
+
};
|
|
47341
|
+
this.asyncPost(
|
|
47342
|
+
this.uiconfig.resources,
|
|
47343
|
+
"uiconfigs.getPageConfig",
|
|
47344
|
+
postData,
|
|
47345
|
+
(data) => {
|
|
47346
|
+
if (!data || !this.uiconfig) {
|
|
47347
|
+
console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
|
|
47348
|
+
return;
|
|
47349
|
+
}
|
|
47350
|
+
this.mergeDynamicConfig(
|
|
47351
|
+
this.uiconfig,
|
|
47352
|
+
data
|
|
47353
|
+
);
|
|
47354
|
+
},
|
|
47355
|
+
function(data) {
|
|
47356
|
+
console.error(data);
|
|
47357
|
+
},
|
|
47358
|
+
function(data) {
|
|
47359
|
+
console.error(data);
|
|
47360
|
+
}
|
|
47361
|
+
);
|
|
47362
|
+
} catch (e10) {
|
|
47363
|
+
console.error("\u52A8\u6001\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25", e10);
|
|
47364
|
+
}
|
|
47365
|
+
},
|
|
47366
|
+
mergeDynamicConfig(localConfig, serverConfig) {
|
|
47367
|
+
if (!localConfig || !serverConfig) {
|
|
47368
|
+
console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
|
|
47369
|
+
return;
|
|
47370
|
+
}
|
|
47371
|
+
if (localConfig.billQueryConfig.gridConfig.items && serverConfig.billQueryConfig.gridConfig.items) {
|
|
47372
|
+
this.mergeFlatItems(
|
|
47373
|
+
localConfig.billQueryConfig.gridConfig.items,
|
|
47374
|
+
serverConfig.billQueryConfig.gridConfig.items
|
|
47375
|
+
);
|
|
47376
|
+
}
|
|
47377
|
+
if (localConfig.detailConfig && serverConfig.detailConfig) {
|
|
47378
|
+
this.mergeDetailConfig(
|
|
47379
|
+
localConfig.detailConfig,
|
|
47380
|
+
serverConfig.detailConfig
|
|
47381
|
+
);
|
|
47382
|
+
}
|
|
47383
|
+
},
|
|
47384
|
+
mergeDetailConfig(localDetail, serverDetail) {
|
|
47385
|
+
if (localDetail.formsConfig.items && serverDetail.formsConfig.items) {
|
|
47386
|
+
this.mergeContainerItems(
|
|
47387
|
+
localDetail.formsConfig.items,
|
|
47388
|
+
serverDetail.formsConfig.items
|
|
47389
|
+
);
|
|
47390
|
+
}
|
|
47391
|
+
if (localDetail.billDetailConfig.items && serverDetail.billDetailConfig.items) {
|
|
47392
|
+
this.mergeContainerItems(
|
|
47393
|
+
localDetail.billDetailConfig.items,
|
|
47394
|
+
serverDetail.billDetailConfig.items
|
|
47395
|
+
);
|
|
47396
|
+
}
|
|
47397
|
+
},
|
|
47398
|
+
mergeContainerItems(localContainers, serverContainers) {
|
|
47399
|
+
const containerMap = this.buildItemMap(localContainers);
|
|
47400
|
+
serverContainers.forEach((serverContainer) => {
|
|
47401
|
+
const localContainer = containerMap.get(serverContainer.name);
|
|
47402
|
+
if (!localContainer) {
|
|
47403
|
+
console.log("2 \u6CA1\u6709\u914D\u7F6Elocalcontainer");
|
|
47404
|
+
return;
|
|
47405
|
+
}
|
|
47406
|
+
Object.assign(localContainer, serverContainer);
|
|
47407
|
+
if (Array.isArray(localContainer.items) && Array.isArray(serverContainer.items)) {
|
|
47408
|
+
this.mergeFlatItems(
|
|
47409
|
+
localContainer.items,
|
|
47410
|
+
serverContainer.items
|
|
47411
|
+
);
|
|
47412
|
+
}
|
|
47413
|
+
});
|
|
47414
|
+
},
|
|
47415
|
+
mergeFlatItems(localItems, serverItems) {
|
|
47416
|
+
const fieldMap = this.buildItemMap(localItems);
|
|
47417
|
+
serverItems.forEach((serverItem) => {
|
|
47418
|
+
const localItem = fieldMap.get(serverItem.name);
|
|
47419
|
+
console.log(serverItem.name, localItem);
|
|
47420
|
+
if (localItem) {
|
|
47421
|
+
console.log("\u5408\u5E76\u524D", localItem);
|
|
47422
|
+
Object.assign(localItem, serverItem);
|
|
47423
|
+
console.log("merge\u540E", JSON.stringify(this.uiconfig));
|
|
47424
|
+
this.uiconfig = Object.assign({}, this.uiconfig);
|
|
47425
|
+
}
|
|
47426
|
+
});
|
|
47427
|
+
},
|
|
47428
|
+
buildItemMap(items, map2 = /* @__PURE__ */ new Map()) {
|
|
47429
|
+
if (!Array.isArray(items))
|
|
47430
|
+
return map2;
|
|
47431
|
+
items.forEach((item) => {
|
|
47432
|
+
if (!item) {
|
|
47433
|
+
console.log("3 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
|
|
47434
|
+
return;
|
|
47435
|
+
}
|
|
47436
|
+
if (item.name) {
|
|
47437
|
+
map2.set(item.name, item);
|
|
47438
|
+
}
|
|
47439
|
+
if (Array.isArray(item.items)) {
|
|
47440
|
+
this.buildItemMap(item.items, map2);
|
|
47441
|
+
}
|
|
47442
|
+
});
|
|
47443
|
+
return map2;
|
|
47444
|
+
},
|
|
47127
47445
|
getCurlAnchorData() {
|
|
47128
47446
|
let tmp = [];
|
|
47129
47447
|
this.anchorData.forEach((el2) => {
|