ocpview-plus 1.2.2 → 1.2.3
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/ocpviewplus.min.esm.js +197 -4
- package/dist/ocpviewplus.min.js +1 -1
- package/package.json +1 -1
- package/src/components/conditionbox/conditionfilterbox.vue +1 -1
- package/src/components/masterplate/billdetailform.vue +183 -29
- package/src/components/masterplate/listdetails.vue +26 -27
- package/src/components/masterplate/simpletree.vue +1 -1
- package/src/components/tree/CompatTree.vue +52 -52
- package/src/components/tree/basetree.vue +104 -3
|
@@ -28969,7 +28969,10 @@ const _sfc_main$1n = {
|
|
|
28969
28969
|
};
|
|
28970
28970
|
function _sfc_render$1f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
28971
28971
|
const _component_Tree = resolveComponent("Tree");
|
|
28972
|
-
return openBlock(), createBlock(_component_Tree, {
|
|
28972
|
+
return openBlock(), createBlock(_component_Tree, {
|
|
28973
|
+
data: $props.data,
|
|
28974
|
+
selectable: ""
|
|
28975
|
+
}, {
|
|
28973
28976
|
title: withCtx((slotProps) => [
|
|
28974
28977
|
(openBlock(), createBlock(resolveDynamicComponent({
|
|
28975
28978
|
render: () => $options.renderWrapper(slotProps)
|
|
@@ -29455,7 +29458,8 @@ function _sfc_render$1e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
29455
29458
|
key: 0,
|
|
29456
29459
|
data: $data.data,
|
|
29457
29460
|
render: $options.renderContent,
|
|
29458
|
-
class: "demo-tree-render"
|
|
29461
|
+
class: "demo-tree-render",
|
|
29462
|
+
"onUpdate:data": _cache[0] || (_cache[0] = ($event) => _ctx.treeData = $event)
|
|
29459
29463
|
}, null, 8, ["data", "render"])) : createCommentVNode("", true)
|
|
29460
29464
|
]);
|
|
29461
29465
|
}
|
|
@@ -34218,7 +34222,8 @@ const _sfc_main$16 = {
|
|
|
34218
34222
|
extraHeight: 0,
|
|
34219
34223
|
outsideHeight: 0,
|
|
34220
34224
|
treeData: [],
|
|
34221
|
-
asyncLoad: false
|
|
34225
|
+
asyncLoad: false,
|
|
34226
|
+
_autoExpandId: ""
|
|
34222
34227
|
};
|
|
34223
34228
|
},
|
|
34224
34229
|
created() {
|
|
@@ -34438,10 +34443,26 @@ const _sfc_main$16 = {
|
|
|
34438
34443
|
]
|
|
34439
34444
|
);
|
|
34440
34445
|
},
|
|
34441
|
-
toTreeData() {
|
|
34446
|
+
toTreeData(expandMap = /* @__PURE__ */ new Set(), selectedId = null) {
|
|
34442
34447
|
let pos = {};
|
|
34443
34448
|
let tree = [];
|
|
34444
34449
|
let i = 0;
|
|
34450
|
+
let autoExpandId = this._autoExpandId;
|
|
34451
|
+
let autoExpandParents = /* @__PURE__ */ new Set();
|
|
34452
|
+
if (autoExpandId) {
|
|
34453
|
+
let current = this.data.find(
|
|
34454
|
+
(item) => item[this.myConfig.idField] === autoExpandId
|
|
34455
|
+
);
|
|
34456
|
+
while (current) {
|
|
34457
|
+
autoExpandParents.add(current[this.myConfig.idField]);
|
|
34458
|
+
const parentId = current[this.myConfig.parentField];
|
|
34459
|
+
if (!parentId)
|
|
34460
|
+
break;
|
|
34461
|
+
current = this.data.find(
|
|
34462
|
+
(item) => item[this.myConfig.idField] === parentId
|
|
34463
|
+
);
|
|
34464
|
+
}
|
|
34465
|
+
}
|
|
34445
34466
|
let data = this.$Method.copy(this.data);
|
|
34446
34467
|
data.forEach((el2) => {
|
|
34447
34468
|
this.setSelected(el2);
|
|
@@ -34449,7 +34470,12 @@ const _sfc_main$16 = {
|
|
|
34449
34470
|
let tempData = this.$Method.copy(data);
|
|
34450
34471
|
while (data.length !== 0) {
|
|
34451
34472
|
const index = tempData.findIndex((item) => item[this.myConfig.idField] === data[i][this.myConfig.parentField]);
|
|
34473
|
+
const currentId = data[i][this.myConfig.idField];
|
|
34452
34474
|
if (data[i][this.myConfig.parentField] === this.rootNode[this.myConfig.idField] || index < 0) {
|
|
34475
|
+
if (expandMap.has(currentId)) {
|
|
34476
|
+
data[i].expand = true;
|
|
34477
|
+
}
|
|
34478
|
+
data[i].selected = currentId === selectedId;
|
|
34453
34479
|
tree.push(data[i]);
|
|
34454
34480
|
pos[data[i][this.myConfig.idField]] = [tree.length - 1];
|
|
34455
34481
|
data.splice(i, 1);
|
|
@@ -34461,6 +34487,10 @@ const _sfc_main$16 = {
|
|
|
34461
34487
|
for (var j10 = 1; j10 < posArr.length; j10++) {
|
|
34462
34488
|
obj = obj.children[posArr[j10]];
|
|
34463
34489
|
}
|
|
34490
|
+
if (expandMap.has(currentId)) {
|
|
34491
|
+
data[i].expand = true;
|
|
34492
|
+
}
|
|
34493
|
+
data[i].selected = currentId === selectedId;
|
|
34464
34494
|
obj.children.push(data[i]);
|
|
34465
34495
|
pos[data[i][this.myConfig.idField]] = posArr.concat([obj.children.length - 1]);
|
|
34466
34496
|
data.splice(i, 1);
|
|
@@ -34495,8 +34525,10 @@ const _sfc_main$16 = {
|
|
|
34495
34525
|
} else {
|
|
34496
34526
|
root.render = this.iconRender;
|
|
34497
34527
|
}
|
|
34528
|
+
this._autoExpandId = null;
|
|
34498
34529
|
return [root];
|
|
34499
34530
|
} else {
|
|
34531
|
+
this._autoExpandId = null;
|
|
34500
34532
|
return tree;
|
|
34501
34533
|
}
|
|
34502
34534
|
},
|
|
@@ -34825,7 +34857,56 @@ const _sfc_main$16 = {
|
|
|
34825
34857
|
};
|
|
34826
34858
|
updateNode(this.data);
|
|
34827
34859
|
},
|
|
34860
|
+
saveExpandState() {
|
|
34861
|
+
const expandSet = /* @__PURE__ */ new Set();
|
|
34862
|
+
const loop = (nodes) => {
|
|
34863
|
+
if (!nodes)
|
|
34864
|
+
return;
|
|
34865
|
+
nodes.forEach((node) => {
|
|
34866
|
+
if (node.expand) {
|
|
34867
|
+
expandSet.add(node[this.myConfig.idField]);
|
|
34868
|
+
}
|
|
34869
|
+
if (node.children && node.children.length) {
|
|
34870
|
+
loop(node.children);
|
|
34871
|
+
}
|
|
34872
|
+
});
|
|
34873
|
+
};
|
|
34874
|
+
loop(this.treeData);
|
|
34875
|
+
return expandSet;
|
|
34876
|
+
},
|
|
34828
34877
|
updateNode(data, flag) {
|
|
34878
|
+
const idField = this.myConfig.idField;
|
|
34879
|
+
const parentField = this.myConfig.parentField;
|
|
34880
|
+
const targetId = data[idField];
|
|
34881
|
+
const expandSet = this.saveExpandState();
|
|
34882
|
+
const index = this.data.findIndex(
|
|
34883
|
+
(el2) => el2[idField] === targetId
|
|
34884
|
+
);
|
|
34885
|
+
if (flag === "U") {
|
|
34886
|
+
if (index > -1) {
|
|
34887
|
+
Object.assign(this.data[index], data);
|
|
34888
|
+
} else {
|
|
34889
|
+
this.data.push(data);
|
|
34890
|
+
let parentId = data[parentField];
|
|
34891
|
+
while (parentId) {
|
|
34892
|
+
expandSet.add(parentId);
|
|
34893
|
+
const parent = this.data.find(
|
|
34894
|
+
(el2) => el2[idField] === parentId
|
|
34895
|
+
);
|
|
34896
|
+
if (!parent)
|
|
34897
|
+
break;
|
|
34898
|
+
parentId = parent[parentField];
|
|
34899
|
+
}
|
|
34900
|
+
}
|
|
34901
|
+
}
|
|
34902
|
+
if (flag === "D") {
|
|
34903
|
+
if (index > -1) {
|
|
34904
|
+
this.data.splice(index, 1);
|
|
34905
|
+
}
|
|
34906
|
+
}
|
|
34907
|
+
this.treeData = this.toTreeData(expandSet, targetId);
|
|
34908
|
+
},
|
|
34909
|
+
updateNodeod(data, flag) {
|
|
34829
34910
|
let tmp = data;
|
|
34830
34911
|
if (flag !== "D") {
|
|
34831
34912
|
tmp = this.setSelected(data);
|
|
@@ -34870,6 +34951,7 @@ const _sfc_main$16 = {
|
|
|
34870
34951
|
}
|
|
34871
34952
|
}
|
|
34872
34953
|
}
|
|
34954
|
+
this.treeData = [...this.treeData];
|
|
34873
34955
|
},
|
|
34874
34956
|
setExpend(data) {
|
|
34875
34957
|
let index = this.$refs.tree.flatState.findIndex((el2) => el2.node[this.myConfig.idField] === data[this.myConfig.idField]);
|
|
@@ -38073,6 +38155,7 @@ function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
38073
38155
|
ref: "tree",
|
|
38074
38156
|
data: _ctx.treeData,
|
|
38075
38157
|
class: normalizeClass(_ctx.myConfig.className),
|
|
38158
|
+
"onUpdate:data": _cache[1] || (_cache[1] = ($event) => _ctx.treeData = $event),
|
|
38076
38159
|
"show-checkbox": _ctx.myConfig.showCheckBox,
|
|
38077
38160
|
onOnSelectChange: _ctx.onSelectChange,
|
|
38078
38161
|
onOnCheckChange: _ctx.onCheckChange,
|
|
@@ -46423,6 +46506,116 @@ const _sfc_main$u = {
|
|
|
46423
46506
|
}
|
|
46424
46507
|
},
|
|
46425
46508
|
methods: {
|
|
46509
|
+
loadDynamicConfig() {
|
|
46510
|
+
try {
|
|
46511
|
+
const postData = {
|
|
46512
|
+
modulecode: this.myConfig.modulecode,
|
|
46513
|
+
moduleid: this.myConfig.modulecode
|
|
46514
|
+
};
|
|
46515
|
+
this.asyncPost(
|
|
46516
|
+
this.uiconfig.resources,
|
|
46517
|
+
"uiconfigs.getPageConfig",
|
|
46518
|
+
postData,
|
|
46519
|
+
(data) => {
|
|
46520
|
+
if (!data || !this.uiconfig) {
|
|
46521
|
+
console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
|
|
46522
|
+
return;
|
|
46523
|
+
}
|
|
46524
|
+
this.mergeDynamicConfig(
|
|
46525
|
+
this.uiconfig,
|
|
46526
|
+
data
|
|
46527
|
+
);
|
|
46528
|
+
},
|
|
46529
|
+
function(data) {
|
|
46530
|
+
console.error(data);
|
|
46531
|
+
},
|
|
46532
|
+
function(data) {
|
|
46533
|
+
console.error(data);
|
|
46534
|
+
}
|
|
46535
|
+
);
|
|
46536
|
+
} catch (e10) {
|
|
46537
|
+
console.error("\u52A8\u6001\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25", e10);
|
|
46538
|
+
}
|
|
46539
|
+
},
|
|
46540
|
+
mergeDynamicConfig(localConfig, serverConfig) {
|
|
46541
|
+
if (!localConfig || !serverConfig) {
|
|
46542
|
+
console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
|
|
46543
|
+
return;
|
|
46544
|
+
}
|
|
46545
|
+
if (localConfig.billQueryConfig.gridConfig.items && serverConfig.billQueryConfig.gridConfig.items) {
|
|
46546
|
+
this.mergeFlatItems(
|
|
46547
|
+
localConfig.billQueryConfig.gridConfig.items,
|
|
46548
|
+
serverConfig.billQueryConfig.gridConfig.items
|
|
46549
|
+
);
|
|
46550
|
+
}
|
|
46551
|
+
if (localConfig.detailConfig && serverConfig.detailConfig) {
|
|
46552
|
+
this.mergeDetailConfig(
|
|
46553
|
+
localConfig.detailConfig,
|
|
46554
|
+
serverConfig.detailConfig
|
|
46555
|
+
);
|
|
46556
|
+
}
|
|
46557
|
+
},
|
|
46558
|
+
mergeDetailConfig(localDetail, serverDetail) {
|
|
46559
|
+
if (localDetail.formsConfig.items && serverDetail.formsConfig.items) {
|
|
46560
|
+
this.mergeContainerItems(
|
|
46561
|
+
localDetail.formsConfig.items,
|
|
46562
|
+
serverDetail.formsConfig.items
|
|
46563
|
+
);
|
|
46564
|
+
}
|
|
46565
|
+
if (localDetail.billDetailConfig.items && serverDetail.billDetailConfig.items) {
|
|
46566
|
+
this.mergeContainerItems(
|
|
46567
|
+
localDetail.billDetailConfig.items,
|
|
46568
|
+
serverDetail.billDetailConfig.items
|
|
46569
|
+
);
|
|
46570
|
+
}
|
|
46571
|
+
},
|
|
46572
|
+
mergeContainerItems(localContainers, serverContainers) {
|
|
46573
|
+
const containerMap = this.buildItemMap(localContainers);
|
|
46574
|
+
serverContainers.forEach((serverContainer) => {
|
|
46575
|
+
const localContainer = containerMap.get(serverContainer.name);
|
|
46576
|
+
if (!localContainer) {
|
|
46577
|
+
console.log("2 \u6CA1\u6709\u914D\u7F6Elocalcontainer");
|
|
46578
|
+
return;
|
|
46579
|
+
}
|
|
46580
|
+
Object.assign(localContainer, serverContainer);
|
|
46581
|
+
if (Array.isArray(localContainer.items) && Array.isArray(serverContainer.items)) {
|
|
46582
|
+
this.mergeFlatItems(
|
|
46583
|
+
localContainer.items,
|
|
46584
|
+
serverContainer.items
|
|
46585
|
+
);
|
|
46586
|
+
}
|
|
46587
|
+
});
|
|
46588
|
+
},
|
|
46589
|
+
mergeFlatItems(localItems, serverItems) {
|
|
46590
|
+
const fieldMap = this.buildItemMap(localItems);
|
|
46591
|
+
serverItems.forEach((serverItem) => {
|
|
46592
|
+
const localItem = fieldMap.get(serverItem.name);
|
|
46593
|
+
console.log(serverItem.name, localItem);
|
|
46594
|
+
if (localItem) {
|
|
46595
|
+
console.log("\u5408\u5E76\u524D", localItem);
|
|
46596
|
+
Object.assign(localItem, serverItem);
|
|
46597
|
+
console.log("merge\u540E", JSON.stringify(this.uiconfig));
|
|
46598
|
+
this.uiconfig = Object.assign({}, this.uiconfig);
|
|
46599
|
+
}
|
|
46600
|
+
});
|
|
46601
|
+
},
|
|
46602
|
+
buildItemMap(items, map2 = /* @__PURE__ */ new Map()) {
|
|
46603
|
+
if (!Array.isArray(items))
|
|
46604
|
+
return map2;
|
|
46605
|
+
items.forEach((item) => {
|
|
46606
|
+
if (!item) {
|
|
46607
|
+
console.log("3 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
|
|
46608
|
+
return;
|
|
46609
|
+
}
|
|
46610
|
+
if (item.name) {
|
|
46611
|
+
map2.set(item.name, item);
|
|
46612
|
+
}
|
|
46613
|
+
if (Array.isArray(item.items)) {
|
|
46614
|
+
this.buildItemMap(item.items, map2);
|
|
46615
|
+
}
|
|
46616
|
+
});
|
|
46617
|
+
return map2;
|
|
46618
|
+
},
|
|
46426
46619
|
getCurlAnchorData() {
|
|
46427
46620
|
let tmp = [];
|
|
46428
46621
|
this.anchorData.forEach((el2) => {
|