ocpview-plus 1.1.8 → 1.2.0

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.
@@ -18,10 +18,10 @@
18
18
  <Row v-if="showCondition">
19
19
  <ControlBox ref="condition" style="width: 100%;margin-top:10xp;margin-bottom:10px" :config="conditionConfig" ></ControlBox>
20
20
  </Row>
21
- <Row>
21
+ <Row>
22
22
  <Input :placeholder="searchPlaceholder" v-model="searchValue" search style="width: 100%;margin-top:10xp;margin-bottom:10px" @on-search="search" @on-enter="search"/>
23
- </Row>
24
- </div>
23
+ </Row>
24
+ </div>
25
25
  <TreeBox v-show="showTree" ref="tree" :config="myConfig.treeConfig" @onSelectChange="selectChange" />
26
26
  <SimpleViewGrid v-show="!showTree" ref="grid" :config="myConfig.gridConfig" :dictData="dictData" @rowclick="gridClick"/>
27
27
  </Card>
@@ -87,7 +87,7 @@ export default {
87
87
  moduleMethod:{
88
88
  type:Array,
89
89
  default: () => {
90
- return [];
90
+ return [];
91
91
  }
92
92
  }
93
93
  },
@@ -161,7 +161,7 @@ export default {
161
161
  this.setCustomTreeNodeIcon = this.myConfig.treeConfig.setTreeNodeIcon;
162
162
  }
163
163
  this.myConfig.treeConfig.setTreeNodeIcon = this.setTreeNodeIcon;
164
-
164
+
165
165
  // 处理按钮
166
166
  if (this.myConfig.menuToolbar !== undefined) {
167
167
  this.menuToolbar = Object.assign({}, this.menuToolbar, this.myConfig.menuToolbar);
@@ -173,13 +173,13 @@ export default {
173
173
  this.myConfig.detailConfig.showAnchorLink = false;
174
174
  this.myConfig.detailConfig.response = this.myConfig.response;
175
175
  this.myConfig.detailConfig.adjustHeight = 0;
176
- this.myConfig.detailConfig.resources = this.myConfig.resources;
176
+ this.myConfig.detailConfig.resources = this.myConfig.resources;
177
177
  },
178
178
  methods:{
179
179
  selectChange (e) {
180
180
  let obj = {};
181
181
  let self = this;
182
- obj.onOk = () => {
182
+ obj.onOk = () => {
183
183
  if (e && e.length > 0) {
184
184
  self.$refs.menutoolbar.setAllReadOnly(true);
185
185
  self.treeSeletedNode = self.$Method.copy(e);
@@ -256,7 +256,7 @@ export default {
256
256
  this.$refs.form.setReadOnly(true);
257
257
  this.$refs.menutoolbar.setAllReadOnly(true);
258
258
  }
259
-
259
+
260
260
  return data;
261
261
  },
262
262
  gridClick(e) {
@@ -327,7 +327,7 @@ export default {
327
327
  let rootNode = this.$refs.tree.getRootNode();
328
328
  if (para[this.myConfig.treeConfig.idField] === rootNode[this.myConfig.treeConfig.idField]) {
329
329
  data = this.$Method.copy(rootNode);
330
- this.$refs.menutoolbar.setReadOnly(['addChildData'], false);
330
+ this.$refs.menutoolbar.setReadOnly(['addChildData'], false);
331
331
  } else {
332
332
  data = this.getFormData(para);
333
333
  if (this.$refs.tree.isChildren(para)) {
@@ -339,7 +339,7 @@ export default {
339
339
  if (this.$parent.setBillData) {
340
340
  data = this.$parent.setBillData(data);
341
341
  }
342
- this.$refs.form.setData(data);
342
+ this.$refs.form.setData(data);
343
343
  this.$nextTick(() => {
344
344
  this.$refs.form.setReadOnly(true);
345
345
  });
@@ -394,13 +394,13 @@ export default {
394
394
  this.alert('当前节点不允许修改');
395
395
  return false;
396
396
  }
397
-
397
+
398
398
  this.$refs.form.setReadOnly(false);
399
-
399
+
400
400
  this.$refs.menutoolbar.setReadOnly('editData', true);
401
401
  this.$refs.menutoolbar.setReadOnly('saveData', false);
402
402
  }
403
-
403
+
404
404
  if (this.$parent[methodAfter]) {
405
405
  this.$parent[methodAfter]();
406
406
  }
@@ -415,12 +415,12 @@ export default {
415
415
  flag = this.$refs.form.isEdit();
416
416
  if (flag) {
417
417
  this.alert('存在数据未确认');
418
- return false;
418
+ return false;
419
419
  }
420
420
  let data = this.$refs.form.getChangeData();
421
421
  obj.para = [];
422
422
  obj.para.push(data);
423
-
423
+
424
424
  }
425
425
  if (obj.name === 'delData') {
426
426
  let tempData = this.$refs.form.getData();
@@ -531,20 +531,27 @@ export default {
531
531
  let height2 = this.$refs.head.offsetHeight;
532
532
  this.$refs.form.setOutsideHeight(height2);
533
533
  },
534
- setTreeNodeIcon(params,obj) {
535
- if (params.node && params.node.children && params.node.children.length > 0) {
534
+ setTreeNodeIcon(params, obj) {
535
+
536
+ const hasChildren =
537
+ params.data.children &&
538
+ params.data.children.length > 0
539
+
540
+ if (hasChildren) {
536
541
  if (params.data.expand) {
537
- obj.type = '_custom-wenjianzhankai';
542
+ obj.type = '_custom-wenjianzhankai'
538
543
  } else {
539
- obj.type = '_custom-wenjianshouqi';
544
+ obj.type = '_custom-wenjianshouqi'
540
545
  }
541
546
  } else {
542
- obj.type = '_custom-yemian';
547
+ obj.type = '_custom-yemian'
543
548
  }
544
- if (this.setCustomTreeNodeIcon){
545
- obj = this.setCustomTreeNodeIcon(params,obj)
549
+
550
+ if (this.setCustomTreeNodeIcon) {
551
+ obj = this.setCustomTreeNodeIcon(params, obj)
546
552
  }
547
- return obj;
553
+
554
+ return obj
548
555
  },
549
556
  getSelectedNode() {
550
557
  let obj = {};
@@ -567,7 +574,7 @@ export default {
567
574
  if (this.conditionConfig.onChange) flag = this.conditionConfig.onChange(e);
568
575
  if (flag === undefined) flag = true;
569
576
  if (!flag) return flag;
570
-
577
+
571
578
  this.$nextTick(() => {
572
579
  let tmp = {};
573
580
  let self = this;
@@ -622,4 +629,4 @@ export default {
622
629
 
623
630
  <style>
624
631
 
625
- </style>
632
+ </style>
@@ -68,7 +68,7 @@ export default {
68
68
  moduleMethod:{
69
69
  type:Array,
70
70
  default: () => {
71
- return [];
71
+ return [];
72
72
  }
73
73
  }
74
74
  },
@@ -112,7 +112,7 @@ export default {
112
112
  }
113
113
  });
114
114
 
115
-
115
+
116
116
 
117
117
  // 处理详情
118
118
  if (this.myConfig.detailConfig.showAnchorLink === undefined) {
@@ -126,8 +126,8 @@ export default {
126
126
  this.myConfig.detailConfig.billKey = this.billKey;
127
127
  this.myConfig.detailConfig.adjustHeight = 0;
128
128
  this.myConfig.detailConfig.modulecode = this.myConfig.modulecode;
129
- this.myConfig.detailConfig.resources = this.myConfig.resources;
130
- this.myConfig.detailConfig.response = this.myConfig.response;
129
+ this.myConfig.detailConfig.resources = this.myConfig.resources;
130
+ this.myConfig.detailConfig.response = this.myConfig.response;
131
131
  this.menuToolbar = Object.assign({},this.menutoolbar,this.myConfig.menuToolbar);
132
132
  this.menuToolbar.billisworkflow = this.myConfig.billisworkflow;
133
133
  if (this.myConfig.detailConfig.billapproveurl) {
@@ -152,10 +152,10 @@ export default {
152
152
  }
153
153
  if (this.myConfig.billPrintConfig) {
154
154
  if (this.myConfig.billPrintConfig.showPrint) {
155
- this.menuToolbar.printmodel = this.myConfig.billPrintConfig.showPrint;
155
+ this.menuToolbar.printmodel = this.myConfig.billPrintConfig.showPrint;
156
156
  }
157
157
  if (this.myConfig.billPrintConfig.showContPrint) {
158
- this.menuToolbar.contprintmodel = this.myConfig.billPrintConfig.showContPrint;
158
+ this.menuToolbar.contprintmodel = this.myConfig.billPrintConfig.showContPrint;
159
159
  }
160
160
  }
161
161
 
@@ -165,8 +165,149 @@ export default {
165
165
 
166
166
  this.billApprovalConfig.resources = this.myConfig.resources;
167
167
  this.billApprovalConfig.classPrefix = this.myConfig.classPrefix;
168
+ // this.loadDynamicConfig();
169
+
168
170
  },
169
171
  methods:{
172
+ loadDynamicConfig() {
173
+ try {
174
+ const modulecode = this.$Method.getUrlParam("modulecode")
175
+ const postData = {
176
+ modulecode: modulecode,
177
+ moduleid: modulecode
178
+ };
179
+
180
+ this.asyncPost(
181
+ this.myConfig.resources,
182
+ "uiconfigs.getPageConfig",
183
+ postData,
184
+ (data) => {
185
+ if (!data || !this.myConfig) {
186
+ console.log('1 没有配置数据')
187
+ return;
188
+ }
189
+
190
+ this.mergeDynamicConfig(
191
+ this.myConfig,
192
+ data
193
+ );
194
+ }
195
+ );
196
+ } catch (e) {
197
+ console.error('动态配置加载失败', e);
198
+ }
199
+ },
200
+ mergeDynamicConfig(localConfig, serverConfig) {
201
+ if (!localConfig || !serverConfig) {
202
+ console.log('1 没有配置数据')
203
+ return;
204
+ }
205
+
206
+ // ✅ 1️⃣ 处理 billQueryConfig
207
+ if (
208
+ localConfig.billQueryConfig.gridConfig.items &&
209
+ serverConfig.billQueryConfig.gridConfig.items
210
+ ) {
211
+ this.mergeFlatItems(
212
+ localConfig.billQueryConfig.gridConfig.items,
213
+ serverConfig.billQueryConfig.gridConfig.items
214
+ );
215
+ }
216
+
217
+ // ✅ 2️⃣ 处理 detailConfig
218
+ if (localConfig.detailConfig && serverConfig.detailConfig) {
219
+ this.mergeDetailConfig(
220
+ localConfig.detailConfig,
221
+ serverConfig.detailConfig
222
+ );
223
+ }
224
+ },
225
+
226
+ mergeDetailConfig(localDetail, serverDetail) {
227
+
228
+ // ✅ formsConfig
229
+ if (
230
+ localDetail.formsConfig.items &&
231
+ serverDetail.formsConfig.items
232
+ ) {
233
+ this.mergeContainerItems(
234
+ localDetail.formsConfig.items,
235
+ serverDetail.formsConfig.items
236
+ );
237
+ }
238
+
239
+ // ✅ billDetailConfig
240
+ if (
241
+ localDetail.billDetailConfig.items &&
242
+ serverDetail.billDetailConfig.items
243
+ ) {
244
+ this.mergeContainerItems(
245
+ localDetail.billDetailConfig.items,
246
+ serverDetail.billDetailConfig.items
247
+ );
248
+ }
249
+ },
250
+
251
+ mergeContainerItems(localContainers, serverContainers) {
252
+
253
+ const containerMap = this.buildItemMap(localContainers);
254
+
255
+ serverContainers.forEach(serverContainer => {
256
+
257
+ const localContainer = containerMap.get(serverContainer.name);
258
+ if (!localContainer) {
259
+ console.log('2 没有配置localcontainer')
260
+ return;
261
+ }
262
+
263
+ // ✅ 合并容器自身属性
264
+ Object.assign(localContainer, serverContainer);
265
+
266
+ // ✅ 如果有子字段
267
+ if (
268
+ Array.isArray(localContainer.items) &&
269
+ Array.isArray(serverContainer.items)
270
+ ) {
271
+ this.mergeFlatItems(
272
+ localContainer.items,
273
+ serverContainer.items
274
+ );
275
+ }
276
+ });
277
+ },
278
+
279
+ mergeFlatItems(localItems, serverItems) {
280
+ const fieldMap = this.buildItemMap(localItems);
281
+
282
+ serverItems.forEach(serverItem => {
283
+ const localItem = fieldMap.get(serverItem.name);
284
+ if (localItem) {
285
+ console.log('合并', localItem)
286
+ Object.assign(localItem, serverItem);
287
+ }
288
+ });
289
+ },
290
+
291
+ buildItemMap(items, map = new Map()) {
292
+ if (!Array.isArray(items)) return map;
293
+
294
+ items.forEach(item => {
295
+ if (!item) {
296
+ console.log('3 没有配置数据')
297
+ return;
298
+ }
299
+
300
+ if (item.name) {
301
+ map.set(item.name, item);
302
+ }
303
+
304
+ if (Array.isArray(item.items)) {
305
+ this.buildItemMap(item.items, map);
306
+ }
307
+ });
308
+
309
+ return map;
310
+ },
170
311
  setLogName() {
171
312
  this.logName.push({code:this.myConfig.detailConfig.response,name:'主表'});
172
313
  this.myConfig.detailConfig.formsConfig.items.forEach(el => {
@@ -287,11 +428,11 @@ export default {
287
428
  this.ph_key = '';
288
429
  this.$refs.billqureygrid.refurbish();
289
430
  */
290
- }
431
+ }
291
432
  // 重置
292
433
  if (obj.name === 'resetData') {
293
434
  this.$refs.billqureygrid.getQuick().clearData();
294
- }
435
+ }
295
436
 
296
437
  // 编辑
297
438
  if (obj.name === 'editData') {
@@ -328,15 +469,15 @@ export default {
328
469
  this.logData = null;
329
470
  }
330
471
  }
331
- // 上一单
472
+ // 上一单
332
473
  if (obj.name === 'preBill') {
333
474
  this.preBill();
334
475
  }
335
- // 下一单
476
+ // 下一单
336
477
  if (obj.name === 'nextBill') {
337
478
  this.nextBill();
338
479
  }
339
-
480
+
340
481
  if (this.$parent[methodAfter]) {
341
482
  this.$parent[methodAfter]();
342
483
  }
@@ -352,14 +493,14 @@ export default {
352
493
  flag = this.$refs.form.isEdit();
353
494
  if (flag) {
354
495
  this.alert('存在数据未确认');
355
- return false;
496
+ return false;
356
497
  }
357
498
  obj.para = this.$refs.form.getChangeData();
358
- }
499
+ }
359
500
  if (obj.name === 'saveDetails') {
360
501
  obj.para = this.$refs.form.getChangeData(obj.detailsname);
361
502
  obj.name = 'saveData';
362
- }
503
+ }
363
504
  if (obj.name === 'delData') {
364
505
  if (this.showHead) {
365
506
  obj.para = data;
@@ -375,7 +516,7 @@ export default {
375
516
  obj.para = temp;
376
517
  }
377
518
  }
378
- }
519
+ }
379
520
  if (obj.name === 'copyData') {
380
521
  if (!obj.para) {
381
522
  obj.para = {};
@@ -400,7 +541,7 @@ export default {
400
541
  text = '作废';
401
542
  obj.para ={billno:data.billno};
402
543
  }
403
-
544
+
404
545
  if (obj.name === 'revokeData') {
405
546
  text = '撤回';
406
547
  obj.para ={billno:data.billno};
@@ -410,7 +551,7 @@ export default {
410
551
  if (name) {
411
552
  text = name;
412
553
  }
413
- }
554
+ }
414
555
  let info = '确定是否' + text + '数据?';
415
556
  let self = this;
416
557
  self.$Modal.confirm({
@@ -432,7 +573,7 @@ export default {
432
573
  } else {
433
574
  if (this.$refs.form) {
434
575
  this.$resfs.form.doAnchorClick();
435
- }
576
+ }
436
577
  }
437
578
  },
438
579
  setRowBtnVisible(value) {
@@ -490,7 +631,7 @@ export default {
490
631
  if (this.$parent.setBillData) {
491
632
  data = this.$parent.setBillData(data);
492
633
  }
493
- this.$refs.form.setData(data);
634
+ this.$refs.form.setData(data);
494
635
  this.customPrintData = this.$Method.copy(data);
495
636
  this.$nextTick(() => {
496
637
  this.$refs.form.setReadOnly(true);
@@ -512,7 +653,7 @@ export default {
512
653
  this.getMenuToolbar().setReadOnly(['addData'], false);
513
654
  }
514
655
  }
515
-
656
+
516
657
  if (this.$parent.initFormAfter) {
517
658
  this.$parent.initFormAfter(data);
518
659
  }
@@ -522,9 +663,9 @@ export default {
522
663
  this.$nextTick(() => {
523
664
  this.showHead = true;
524
665
  });
525
- },20);
666
+ },20);
526
667
  });
527
-
668
+
528
669
  },
529
670
  getMenuToolbar() {
530
671
  return this.$refs.menutoolbar;
@@ -569,7 +710,7 @@ export default {
569
710
  formdata = data[self.config.response];
570
711
  });
571
712
  }
572
-
713
+
573
714
  result.billkey = para[this.billKey];
574
715
  result.formdata = formdata;
575
716
  return result;
@@ -629,9 +770,9 @@ export default {
629
770
  }
630
771
  } else {
631
772
  this.setPhkey(this.ph_key);
632
- this.$refs.billqureygrid.refurbish();
773
+ this.$refs.billqureygrid.refurbish();
633
774
  }
634
-
775
+
635
776
  },
636
777
  checkData (obj) {
637
778
  let tempflag = false;
@@ -751,6 +892,7 @@ export default {
751
892
  }
752
893
  },
753
894
  mounted () {
895
+ this.loadDynamicConfig();
754
896
  let billno = this.$Method.getUrlParam('billno');
755
897
  if (billno) {
756
898
  let para = {};
@@ -766,4 +908,4 @@ export default {
766
908
 
767
909
  <style>
768
910
 
769
- </style>
911
+ </style>
@@ -4,7 +4,7 @@
4
4
  <Input ref="condition" :placeholder="searchPlaceholder" v-model="searchValue" search style="width: 100%;margin-top:10xp;margin-bottom:10px" @on-search="search" @on-enter="search"/>
5
5
  </div>
6
6
  <div class="customLayout" :style="style">
7
- <Tree ref="tree" v-show="showTree" :data="treeData" :class="myConfig.className" :show-checkbox="myConfig.showCheckBox" @on-select-change="onSelectChange" @on-check-change="onCheckChange" @on-toggle-expand="onToggleExpand" :load-data="loadData"/>
7
+ <CompatTree ref="tree" v-show="showTree" :data="treeData" :class="myConfig.className" :show-checkbox="myConfig.showCheckBox" @on-select-change="onSelectChange" @on-check-change="onCheckChange" @on-toggle-expand="onToggleExpand" :load-data="loadData"/>
8
8
  <SimpleViewGrid v-show="!showTree" v-if="gridReset" ref="grid" :config="gridConfig" :dictData="dictData" @dbclick="dbclick"/>
9
9
  </div>
10
10
  </Card>
@@ -12,8 +12,10 @@
12
12
  <script>
13
13
  import Base from '@/components/tree/treedatabase.vue';
14
14
  import elementResizeDetectorMaker from 'element-resize-detector';
15
+ import CompatTree from "@/components/tree/CompatTree.vue";
15
16
  export default {
16
17
  name:'mtreedata',
18
+ components: {CompatTree},
17
19
  extends: Base,
18
20
  data () {
19
21
  return {
@@ -25,7 +27,7 @@
25
27
  created () {
26
28
  this.init();
27
29
  if (!this.gridConfig) {
28
- this.gridConfig = {};
30
+ this.gridConfig = {};
29
31
  }
30
32
  if (this.myConfig.multiSelect !== undefined) {
31
33
  this.gridConfig.multiSelect = this.myConfig.multiSelect;
@@ -39,7 +41,7 @@
39
41
  this.gridConfig.items = this.$Method.copy(this.myConfig.items);
40
42
  } else {
41
43
  if (!this.gridConfig.items) {
42
- this.gridConfig.items = [];
44
+ this.gridConfig.items = [];
43
45
  }
44
46
  let code = {
45
47
  label:'编码',
@@ -74,14 +76,14 @@
74
76
  tmp = data;
75
77
  flag = false;
76
78
  }
77
- }
79
+ }
78
80
  if (flag) {
79
81
  data.forEach(el => {
80
82
  if(el[this.myConfig.responseCode].indexOf(this.searchValue) > -1 || el[this.myConfig.responseName].indexOf(this.searchValue) > -1) {
81
83
  tmp.push(el);
82
84
  }
83
85
  });
84
- }
86
+ }
85
87
  this.gridReset = false;
86
88
  this.$nextTick(() => {
87
89
  this.gridReset = true;
@@ -90,20 +92,26 @@
90
92
  this.showTree = false;
91
93
  });
92
94
  });
93
-
95
+
94
96
  }
95
97
  },
96
- setTreeNodeIcon(params,obj) {
97
- if (params.node.children.length > 0) {
98
+ setTreeNodeIcon(params, obj) {
99
+
100
+ const hasChildren =
101
+ params.data.children &&
102
+ params.data.children.length > 0
103
+
104
+ if (hasChildren) {
98
105
  if (params.data.expand) {
99
- obj.type = '_custom-wenjianzhankai';
106
+ obj.type = '_custom-wenjianzhankai'
100
107
  } else {
101
- obj.type = '_custom-wenjianshouqi';
108
+ obj.type = '_custom-wenjianshouqi'
102
109
  }
103
110
  } else {
104
- obj.type = '_custom-yemian';
111
+ obj.type = '_custom-yemian'
105
112
  }
106
- return obj;
113
+
114
+ return obj
107
115
  }
108
116
  },
109
117
  mounted () {
@@ -122,7 +130,7 @@
122
130
 
123
131
  <style>
124
132
  .customLayout{
125
- OVERFLOW-Y: auto;
133
+ OVERFLOW-Y: auto;
126
134
  /*background: url('./images/bg.jpg') no-repeat 4px 5px;*/
127
135
  }
128
136
  </style>
@@ -0,0 +1,52 @@
1
+ <script>
2
+ import { h } from 'vue'
3
+ import { Tree } from 'view-ui-plus'
4
+
5
+ export default {
6
+ name: 'CompatTree',
7
+
8
+ components: {
9
+ Tree
10
+ },
11
+
12
+ props: {
13
+ data: {
14
+ type: Array,
15
+ required: true
16
+ },
17
+ render: {
18
+ type: Function,
19
+ default: null
20
+ }
21
+ },
22
+
23
+ methods: {
24
+
25
+ // 👇 renderWrapper 就放在这里(methods 里)
26
+ renderWrapper(slotProps) {
27
+ const nodeRender =
28
+ slotProps.data.render || this.render
29
+
30
+ if (!nodeRender) {
31
+ return slotProps.data.title
32
+ }
33
+
34
+ return nodeRender(h, slotProps)
35
+ }
36
+
37
+ }
38
+ }
39
+ </script>
40
+
41
+ <template>
42
+ <Tree :data="data">
43
+ <template #title="slotProps">
44
+ <!-- 这里调用 renderWrapper -->
45
+ <component
46
+ :is="{
47
+ render: () => renderWrapper(slotProps)
48
+ }"
49
+ />
50
+ </template>
51
+ </Tree>
52
+ </template>