ocpview-plus 1.2.1 → 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/README.md CHANGED
@@ -47,3 +47,6 @@ PopTextBox 精灵多级参数透传
47
47
 
48
48
  ### 1.2.0 更新说明
49
49
  tree vue3 升级
50
+
51
+ ### 1.2.2 更新说明
52
+ datebox format 修复
@@ -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.0";
456
+ const version$2 = "1.2.2";
457
457
  const title = "ocpviewPlus";
458
458
  const description = "A high quality Service UI components Library with Vue.js";
459
459
  const homepage = "";
@@ -26208,7 +26208,7 @@ const _sfc_main$1A = {
26208
26208
  para.value = this.$Method.formatDate(this.culValue, "yyyy-MM-dd");
26209
26209
  } else {
26210
26210
  if (this.myConfig.format === "MM-dd") {
26211
- para.value = this.$Method.formatDate(this.culValue, "yyyy-MM-dd");
26211
+ para.value = this.$Method.formatDate(this.culValue, "MM-dd");
26212
26212
  } else {
26213
26213
  para.value = this.$Method.formatDate(this.culValue, this.myConfig.format);
26214
26214
  }
@@ -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, { data: $props.data }, {
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,
@@ -39011,6 +39094,7 @@ const _sfc_main$K = {
39011
39094
  }
39012
39095
  this.setDictData();
39013
39096
  this.importReset = false;
39097
+ console.log("---------- base \u6267\u884C\u5B8C\u6BD5");
39014
39098
  this.$nextTick(() => {
39015
39099
  this.importReset = true;
39016
39100
  });
@@ -39179,6 +39263,12 @@ const _sfc_main$K = {
39179
39263
  this.uiconfig,
39180
39264
  data
39181
39265
  );
39266
+ },
39267
+ function(data) {
39268
+ console.error(data);
39269
+ },
39270
+ function(data) {
39271
+ console.error(data);
39182
39272
  }
39183
39273
  );
39184
39274
  } catch (e10) {
@@ -39238,9 +39328,12 @@ const _sfc_main$K = {
39238
39328
  const fieldMap = this.buildItemMap(localItems);
39239
39329
  serverItems.forEach((serverItem) => {
39240
39330
  const localItem = fieldMap.get(serverItem.name);
39331
+ console.log(serverItem.name, localItem);
39241
39332
  if (localItem) {
39242
- console.log("\u5408\u5E76", localItem);
39333
+ console.log("\u5408\u5E76\u524D", localItem);
39243
39334
  Object.assign(localItem, serverItem);
39335
+ console.log("merge\u540E", JSON.stringify(this.uiconfig));
39336
+ this.uiconfig = Object.assign({}, this.uiconfig);
39244
39337
  }
39245
39338
  });
39246
39339
  },
@@ -46413,6 +46506,116 @@ const _sfc_main$u = {
46413
46506
  }
46414
46507
  },
46415
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
+ },
46416
46619
  getCurlAnchorData() {
46417
46620
  let tmp = [];
46418
46621
  this.anchorData.forEach((el2) => {
@@ -49016,110 +49219,9 @@ const _sfc_main$r = {
49016
49219
  }
49017
49220
  this.billApprovalConfig.resources = this.myConfig.resources;
49018
49221
  this.billApprovalConfig.classPrefix = this.myConfig.classPrefix;
49222
+ console.log("------------- listdetail\u6267\u884C\u5B8C\u6BD5");
49019
49223
  },
49020
49224
  methods: {
49021
- loadDynamicConfig() {
49022
- try {
49023
- const modulecode = this.$Method.getUrlParam("modulecode");
49024
- const postData = {
49025
- modulecode,
49026
- moduleid: modulecode
49027
- };
49028
- this.asyncPost(
49029
- this.myConfig.resources,
49030
- "uiconfigs.getPageConfig",
49031
- postData,
49032
- (data) => {
49033
- if (!data || !this.myConfig) {
49034
- console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
49035
- return;
49036
- }
49037
- this.mergeDynamicConfig(
49038
- this.myConfig,
49039
- data
49040
- );
49041
- }
49042
- );
49043
- } catch (e10) {
49044
- console.error("\u52A8\u6001\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25", e10);
49045
- }
49046
- },
49047
- mergeDynamicConfig(localConfig, serverConfig) {
49048
- if (!localConfig || !serverConfig) {
49049
- console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
49050
- return;
49051
- }
49052
- if (localConfig.billQueryConfig.gridConfig.items && serverConfig.billQueryConfig.gridConfig.items) {
49053
- this.mergeFlatItems(
49054
- localConfig.billQueryConfig.gridConfig.items,
49055
- serverConfig.billQueryConfig.gridConfig.items
49056
- );
49057
- }
49058
- if (localConfig.detailConfig && serverConfig.detailConfig) {
49059
- this.mergeDetailConfig(
49060
- localConfig.detailConfig,
49061
- serverConfig.detailConfig
49062
- );
49063
- }
49064
- },
49065
- mergeDetailConfig(localDetail, serverDetail) {
49066
- if (localDetail.formsConfig.items && serverDetail.formsConfig.items) {
49067
- this.mergeContainerItems(
49068
- localDetail.formsConfig.items,
49069
- serverDetail.formsConfig.items
49070
- );
49071
- }
49072
- if (localDetail.billDetailConfig.items && serverDetail.billDetailConfig.items) {
49073
- this.mergeContainerItems(
49074
- localDetail.billDetailConfig.items,
49075
- serverDetail.billDetailConfig.items
49076
- );
49077
- }
49078
- },
49079
- mergeContainerItems(localContainers, serverContainers) {
49080
- const containerMap = this.buildItemMap(localContainers);
49081
- serverContainers.forEach((serverContainer) => {
49082
- const localContainer = containerMap.get(serverContainer.name);
49083
- if (!localContainer) {
49084
- console.log("2 \u6CA1\u6709\u914D\u7F6Elocalcontainer");
49085
- return;
49086
- }
49087
- Object.assign(localContainer, serverContainer);
49088
- if (Array.isArray(localContainer.items) && Array.isArray(serverContainer.items)) {
49089
- this.mergeFlatItems(
49090
- localContainer.items,
49091
- serverContainer.items
49092
- );
49093
- }
49094
- });
49095
- },
49096
- mergeFlatItems(localItems, serverItems) {
49097
- const fieldMap = this.buildItemMap(localItems);
49098
- serverItems.forEach((serverItem) => {
49099
- const localItem = fieldMap.get(serverItem.name);
49100
- if (localItem) {
49101
- console.log("\u5408\u5E76", localItem);
49102
- Object.assign(localItem, serverItem);
49103
- }
49104
- });
49105
- },
49106
- buildItemMap(items, map2 = /* @__PURE__ */ new Map()) {
49107
- if (!Array.isArray(items))
49108
- return map2;
49109
- items.forEach((item) => {
49110
- if (!item) {
49111
- console.log("3 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
49112
- return;
49113
- }
49114
- if (item.name) {
49115
- map2.set(item.name, item);
49116
- }
49117
- if (Array.isArray(item.items)) {
49118
- this.buildItemMap(item.items, map2);
49119
- }
49120
- });
49121
- return map2;
49122
- },
49123
49225
  setLogName() {
49124
49226
  this.logName.push({ code: this.myConfig.detailConfig.response, name: "\u4E3B\u8868" });
49125
49227
  this.myConfig.detailConfig.formsConfig.items.forEach((el2) => {