ocpview-plus 1.2.2 → 1.2.4

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
@@ -50,3 +50,9 @@ tree vue3 升级
50
50
 
51
51
  ### 1.2.2 更新说明
52
52
  datebox format 修复
53
+
54
+ ### 1.2.3 更新说明
55
+ 修复treebox回显
56
+
57
+ ### 1.2.4 更新说明
58
+ 附件按钮只读控制
@@ -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.2";
456
+ const version$2 = "1.2.4";
457
457
  const title = "ocpviewPlus";
458
458
  const description = "A high quality Service UI components Library with Vue.js";
459
459
  const homepage = "";
@@ -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,7 +39094,6 @@ const _sfc_main$K = {
39011
39094
  }
39012
39095
  this.setDictData();
39013
39096
  this.importReset = false;
39014
- console.log("---------- base \u6267\u884C\u5B8C\u6BD5");
39015
39097
  this.$nextTick(() => {
39016
39098
  this.importReset = true;
39017
39099
  });
@@ -39161,116 +39243,6 @@ const _sfc_main$K = {
39161
39243
  Object.assign(items[index], tmp);
39162
39244
  }
39163
39245
  },
39164
- loadDynamicConfig() {
39165
- try {
39166
- const postData = {
39167
- modulecode: this.globalConfig.modulecode,
39168
- moduleid: this.globalConfig.modulecode
39169
- };
39170
- this.asyncPost(
39171
- this.uiconfig.resources,
39172
- "uiconfigs.getPageConfig",
39173
- postData,
39174
- (data) => {
39175
- if (!data || !this.uiconfig) {
39176
- console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
39177
- return;
39178
- }
39179
- this.mergeDynamicConfig(
39180
- this.uiconfig,
39181
- data
39182
- );
39183
- },
39184
- function(data) {
39185
- console.error(data);
39186
- },
39187
- function(data) {
39188
- console.error(data);
39189
- }
39190
- );
39191
- } catch (e10) {
39192
- console.error("\u52A8\u6001\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25", e10);
39193
- }
39194
- },
39195
- mergeDynamicConfig(localConfig, serverConfig) {
39196
- if (!localConfig || !serverConfig) {
39197
- console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
39198
- return;
39199
- }
39200
- if (localConfig.billQueryConfig.gridConfig.items && serverConfig.billQueryConfig.gridConfig.items) {
39201
- this.mergeFlatItems(
39202
- localConfig.billQueryConfig.gridConfig.items,
39203
- serverConfig.billQueryConfig.gridConfig.items
39204
- );
39205
- }
39206
- if (localConfig.detailConfig && serverConfig.detailConfig) {
39207
- this.mergeDetailConfig(
39208
- localConfig.detailConfig,
39209
- serverConfig.detailConfig
39210
- );
39211
- }
39212
- },
39213
- mergeDetailConfig(localDetail, serverDetail) {
39214
- if (localDetail.formsConfig.items && serverDetail.formsConfig.items) {
39215
- this.mergeContainerItems(
39216
- localDetail.formsConfig.items,
39217
- serverDetail.formsConfig.items
39218
- );
39219
- }
39220
- if (localDetail.billDetailConfig.items && serverDetail.billDetailConfig.items) {
39221
- this.mergeContainerItems(
39222
- localDetail.billDetailConfig.items,
39223
- serverDetail.billDetailConfig.items
39224
- );
39225
- }
39226
- },
39227
- mergeContainerItems(localContainers, serverContainers) {
39228
- const containerMap = this.buildItemMap(localContainers);
39229
- serverContainers.forEach((serverContainer) => {
39230
- const localContainer = containerMap.get(serverContainer.name);
39231
- if (!localContainer) {
39232
- console.log("2 \u6CA1\u6709\u914D\u7F6Elocalcontainer");
39233
- return;
39234
- }
39235
- Object.assign(localContainer, serverContainer);
39236
- if (Array.isArray(localContainer.items) && Array.isArray(serverContainer.items)) {
39237
- this.mergeFlatItems(
39238
- localContainer.items,
39239
- serverContainer.items
39240
- );
39241
- }
39242
- });
39243
- },
39244
- mergeFlatItems(localItems, serverItems) {
39245
- const fieldMap = this.buildItemMap(localItems);
39246
- serverItems.forEach((serverItem) => {
39247
- const localItem = fieldMap.get(serverItem.name);
39248
- console.log(serverItem.name, localItem);
39249
- if (localItem) {
39250
- console.log("\u5408\u5E76\u524D", localItem);
39251
- Object.assign(localItem, serverItem);
39252
- console.log("merge\u540E", JSON.stringify(this.uiconfig));
39253
- this.uiconfig = Object.assign({}, this.uiconfig);
39254
- }
39255
- });
39256
- },
39257
- buildItemMap(items, map2 = /* @__PURE__ */ new Map()) {
39258
- if (!Array.isArray(items))
39259
- return map2;
39260
- items.forEach((item) => {
39261
- if (!item) {
39262
- console.log("3 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
39263
- return;
39264
- }
39265
- if (item.name) {
39266
- map2.set(item.name, item);
39267
- }
39268
- if (Array.isArray(item.items)) {
39269
- this.buildItemMap(item.items, map2);
39270
- }
39271
- });
39272
- return map2;
39273
- },
39274
39246
  _isFun(pro) {
39275
39247
  let index = this.eventObject.findIndex((el2) => el2 === pro);
39276
39248
  if (index > -1) {
@@ -39329,6 +39301,7 @@ const _sfc_main$K = {
39329
39301
  return;
39330
39302
  }
39331
39303
  this.$refs.detailappendix.setData(obj.billno, obj.billmoduleid, obj.idkey);
39304
+ this.$refs.detailappendix.setReadOnly(e10.readOnly);
39332
39305
  this.$nextTick(() => {
39333
39306
  if (e10.readOnly) {
39334
39307
  let data2 = this.$refs.detailappendix.getData();
@@ -46423,6 +46396,116 @@ const _sfc_main$u = {
46423
46396
  }
46424
46397
  },
46425
46398
  methods: {
46399
+ loadDynamicConfig() {
46400
+ try {
46401
+ const postData = {
46402
+ modulecode: this.myConfig.modulecode,
46403
+ moduleid: this.myConfig.modulecode
46404
+ };
46405
+ this.asyncPost(
46406
+ this.uiconfig.resources,
46407
+ "uiconfigs.getPageConfig",
46408
+ postData,
46409
+ (data) => {
46410
+ if (!data || !this.uiconfig) {
46411
+ console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
46412
+ return;
46413
+ }
46414
+ this.mergeDynamicConfig(
46415
+ this.uiconfig,
46416
+ data
46417
+ );
46418
+ },
46419
+ function(data) {
46420
+ console.error(data);
46421
+ },
46422
+ function(data) {
46423
+ console.error(data);
46424
+ }
46425
+ );
46426
+ } catch (e10) {
46427
+ console.error("\u52A8\u6001\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25", e10);
46428
+ }
46429
+ },
46430
+ mergeDynamicConfig(localConfig, serverConfig) {
46431
+ if (!localConfig || !serverConfig) {
46432
+ console.log("1 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
46433
+ return;
46434
+ }
46435
+ if (localConfig.billQueryConfig.gridConfig.items && serverConfig.billQueryConfig.gridConfig.items) {
46436
+ this.mergeFlatItems(
46437
+ localConfig.billQueryConfig.gridConfig.items,
46438
+ serverConfig.billQueryConfig.gridConfig.items
46439
+ );
46440
+ }
46441
+ if (localConfig.detailConfig && serverConfig.detailConfig) {
46442
+ this.mergeDetailConfig(
46443
+ localConfig.detailConfig,
46444
+ serverConfig.detailConfig
46445
+ );
46446
+ }
46447
+ },
46448
+ mergeDetailConfig(localDetail, serverDetail) {
46449
+ if (localDetail.formsConfig.items && serverDetail.formsConfig.items) {
46450
+ this.mergeContainerItems(
46451
+ localDetail.formsConfig.items,
46452
+ serverDetail.formsConfig.items
46453
+ );
46454
+ }
46455
+ if (localDetail.billDetailConfig.items && serverDetail.billDetailConfig.items) {
46456
+ this.mergeContainerItems(
46457
+ localDetail.billDetailConfig.items,
46458
+ serverDetail.billDetailConfig.items
46459
+ );
46460
+ }
46461
+ },
46462
+ mergeContainerItems(localContainers, serverContainers) {
46463
+ const containerMap = this.buildItemMap(localContainers);
46464
+ serverContainers.forEach((serverContainer) => {
46465
+ const localContainer = containerMap.get(serverContainer.name);
46466
+ if (!localContainer) {
46467
+ console.log("2 \u6CA1\u6709\u914D\u7F6Elocalcontainer");
46468
+ return;
46469
+ }
46470
+ Object.assign(localContainer, serverContainer);
46471
+ if (Array.isArray(localContainer.items) && Array.isArray(serverContainer.items)) {
46472
+ this.mergeFlatItems(
46473
+ localContainer.items,
46474
+ serverContainer.items
46475
+ );
46476
+ }
46477
+ });
46478
+ },
46479
+ mergeFlatItems(localItems, serverItems) {
46480
+ const fieldMap = this.buildItemMap(localItems);
46481
+ serverItems.forEach((serverItem) => {
46482
+ const localItem = fieldMap.get(serverItem.name);
46483
+ console.log(serverItem.name, localItem);
46484
+ if (localItem) {
46485
+ console.log("\u5408\u5E76\u524D", localItem);
46486
+ Object.assign(localItem, serverItem);
46487
+ console.log("merge\u540E", JSON.stringify(this.uiconfig));
46488
+ this.uiconfig = Object.assign({}, this.uiconfig);
46489
+ }
46490
+ });
46491
+ },
46492
+ buildItemMap(items, map2 = /* @__PURE__ */ new Map()) {
46493
+ if (!Array.isArray(items))
46494
+ return map2;
46495
+ items.forEach((item) => {
46496
+ if (!item) {
46497
+ console.log("3 \u6CA1\u6709\u914D\u7F6E\u6570\u636E");
46498
+ return;
46499
+ }
46500
+ if (item.name) {
46501
+ map2.set(item.name, item);
46502
+ }
46503
+ if (Array.isArray(item.items)) {
46504
+ this.buildItemMap(item.items, map2);
46505
+ }
46506
+ });
46507
+ return map2;
46508
+ },
46426
46509
  getCurlAnchorData() {
46427
46510
  let tmp = [];
46428
46511
  this.anchorData.forEach((el2) => {
@@ -49026,7 +49109,6 @@ const _sfc_main$r = {
49026
49109
  }
49027
49110
  this.billApprovalConfig.resources = this.myConfig.resources;
49028
49111
  this.billApprovalConfig.classPrefix = this.myConfig.classPrefix;
49029
- console.log("------------- listdetail\u6267\u884C\u5B8C\u6BD5");
49030
49112
  },
49031
49113
  methods: {
49032
49114
  setLogName() {