bri-components 1.3.96 → 1.3.98

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.
@@ -96,48 +96,6 @@ export default {
96
96
  isEnlarge: false,
97
97
  isEnlargeFlag: true, // 为重渲染膜态框内容而用
98
98
 
99
- topOperationMap: {
100
- canHideOrShow: {
101
- name: "显示/隐藏字段",
102
- type: "canHideOrShow",
103
- // icon: "md-share-alt",
104
- size: "small",
105
- btnType: "text",
106
- event: "toggleHideOrShow"
107
- },
108
- canQuote: {
109
- name: "引用",
110
- type: "canQuote",
111
- icon: "ios-copy",
112
- size: "small",
113
- btnType: "text",
114
- event: "clickQuote"
115
- },
116
- canImport: {
117
- name: "导入",
118
- type: "canImport",
119
- icon: "ios-create-outline",
120
- size: "small",
121
- btnType: "text",
122
- event: "clickImport"
123
- },
124
- canExport: {
125
- name: "导出",
126
- type: "canExport",
127
- icon: "md-share-alt",
128
- size: "small",
129
- btnType: "text",
130
- event: "clickExport"
131
- },
132
- canEnlarge: {
133
- name: "全屏展示",
134
- type: "canEnlarge",
135
- icon: "md-expand",
136
- size: "small",
137
- btnType: "text",
138
- event: "clickEnlarge"
139
- }
140
- },
141
99
  baseOperationMap: {
142
100
  canCreate: {
143
101
  name: "添加一行",
@@ -179,12 +137,56 @@ export default {
179
137
  color: "#E83636",
180
138
  disabled: false,
181
139
  event: "clickDeleteChilds"
182
- },
140
+ }
141
+ },
142
+ otherOperationMap: {
183
143
  changeVal: {
184
144
  name: "改变输入框值",
185
145
  type: "changeVal",
186
146
  event: "changeVal"
187
147
  }
148
+ },
149
+ topOperationMap: {
150
+ canHideOrShow: {
151
+ name: "显示/隐藏字段",
152
+ type: "canHideOrShow",
153
+ // icon: "md-share-alt",
154
+ size: "small",
155
+ btnType: "text",
156
+ event: "toggleHideOrShow"
157
+ },
158
+ canQuote: {
159
+ name: "引用",
160
+ type: "canQuote",
161
+ icon: "ios-copy",
162
+ size: "small",
163
+ btnType: "text",
164
+ event: "clickQuote"
165
+ },
166
+ canImport: {
167
+ name: "导入",
168
+ type: "canImport",
169
+ icon: "ios-create-outline",
170
+ size: "small",
171
+ btnType: "text",
172
+ event: "clickImport"
173
+ },
174
+ canExport: {
175
+ name: "导出",
176
+ type: "canExport",
177
+ icon: "md-share-alt",
178
+ size: "small",
179
+ btnType: "text",
180
+ event: "clickExport"
181
+ },
182
+ canEnlarge: {
183
+ name: "全屏展示",
184
+ type: "canEnlarge",
185
+ icon: "md-expand",
186
+ size: "small",
187
+ btnType: "text",
188
+ event: "clickEnlarge"
189
+ }
188
190
  }
189
191
  };
190
192
  },
@@ -201,6 +203,10 @@ export default {
201
203
  controlKey () {
202
204
  return this.propsObj._key;
203
205
  },
206
+ // 是否在设置默认值下
207
+ isDftSet () {
208
+ return this.controlKey === "_default";
209
+ },
204
210
  controlType () {
205
211
  return this.propsObj._type;
206
212
  },
@@ -216,15 +222,6 @@ export default {
216
222
  allScreenKey () {
217
223
  return this.propsObj.allScreenKey;
218
224
  },
219
- selfColumns () {
220
- return this.columns;
221
- },
222
- mergeRowColumns () {
223
- return this.selfColumns.filter(column => column._mergeRow === true);
224
- },
225
- filterColumns () {
226
- return this.selfColumns.filter(col => this.$isAdvRelyShow(col, this.allListData, this.parentObj, true));
227
- },
228
225
 
229
226
  commonPropsObj () {
230
227
  return {
@@ -239,13 +236,17 @@ export default {
239
236
  _useSelection: false, // 使用选择列 -配置端暂时用不到
240
237
  _useIndex: true, // 使用序号列
241
238
  _useSummary: false, // 使用汇总行
239
+ _mergeRowColKeys: [], // 合并行的列
240
+
242
241
  _disabledBtns: false, // 禁用增删按钮
243
- // _disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
242
+ _showCreateBtnColKeys: [], // 显示添加图标的列
244
243
  _disabledFootCreateBtn: false, // 禁用底部新增按钮
245
- _disabledDeleteDftRow: false, // 默认数据行禁止删除
246
- _disabledOldDataRow: false, // 置灰老数据行包含删除
247
- _showCreateBtnColKeys: [], // 显示插入一行按钮的列
248
- _hideColKeys: [], // 隐藏/查看列字段的keys
244
+ _disabledDeleteDftRow: false, // 默认的数据行禁止删除
245
+ _disabledDeleteOldRow: false, // 保存的数据行禁止删除
246
+ _dftReadonly: false, // 默认的数据只读
247
+ _dftReadonlyColKeys: [], // 默认的数据只读的列
248
+ _oldReadonly: false, // 保存的数据只读
249
+ _oldReadonlyColKeys: [], // 保存的数据只读的列
249
250
 
250
251
  _searchList: [], // 作为搜索的字段
251
252
  _searchLabelWidth: 100, // 搜索的label宽度
@@ -254,8 +255,7 @@ export default {
254
255
  conditions: []
255
256
  }, // 筛选默认值(cascaderTable和flatTable组件里默认值情使用时,以及modSetForm里,会重置_tableAdvSearch)
256
257
 
257
- _isImport: false, // 导入
258
- _isExport: false, // 导出
258
+ _hideColKeys: [], // 隐藏/查看列字段的keys
259
259
  _isQuote: false, // 引用
260
260
  _quoteDisabledColKeys: [], // 引用数据行不可编辑咧
261
261
  _quoteListFields: [], // 引用列表的显示字段
@@ -263,8 +263,16 @@ export default {
263
263
  logic: "and",
264
264
  conditions: []
265
265
  }, // 引用列表筛选条件
266
- ...this.propsObj,
266
+ _isImport: false, // 导入
267
+ _isExport: false, // 导出
267
268
 
269
+ _default: {
270
+ rowDefault: {},
271
+ list: [],
272
+ tree: []
273
+ },
274
+
275
+ ...this.propsObj,
268
276
  _contentHeight: this.propsObj._contentHeight || 500 // 表格最大高度
269
277
  };
270
278
  },
@@ -312,26 +320,37 @@ export default {
312
320
  useSummary () {
313
321
  return this.selfPropsObj._useSummary;
314
322
  },
323
+ mergeRowColKeys () {
324
+ return this.selfPropsObj._mergeRowColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
325
+ },
326
+
315
327
  disabledBtns () {
316
- return this.controlKey === "_default" ? false : this.selfPropsObj._disabledBtns;
328
+ return this.isDftSet ? false : this.selfPropsObj._disabledBtns;
329
+ },
330
+ showCreateBtnColKeys () {
331
+ return this.selfPropsObj._showCreateBtnColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
317
332
  },
318
- // disabledCreateBtn () {
319
- // return this.selfPropsObj._disabledCreateBtn;
320
- // },
321
333
  disabledFootCreateBtn () {
322
- return this.selfPropsObj._disabledFootCreateBtn;
334
+ return this.isDftSet ? false : this.selfPropsObj._disabledFootCreateBtn;
323
335
  },
324
336
  disabledDeleteDftRow () {
325
- return this.selfPropsObj._disabledDeleteDftRow;
337
+ return this.isDftSet ? false : this.selfPropsObj._disabledDeleteDftRow;
326
338
  },
327
- disabledOldDataRow () {
328
- return this.controlKey === "_default" ? false : this.selfPropsObj._disabledOldDataRow;
339
+ disabledDeleteOldRow () {
340
+ return this.isDftSet ? false : this.selfPropsObj._disabledDeleteOldRow;
329
341
  },
330
- showCreateBtnColKeys () {
331
- return this.selfPropsObj._showCreateBtnColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
342
+
343
+ dftReadonly () {
344
+ return this.isDftSet ? false : this.selfPropsObj._dftReadonly;
332
345
  },
333
- hideColKeys () {
334
- return this.selfPropsObj._hideColKeys;
346
+ dftReadonlyColKeys () {
347
+ return this.isDftSet ? [] : this.selfPropsObj._dftReadonlyColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
348
+ },
349
+ oldReadonly () {
350
+ return this.isDftSet ? false : this.selfPropsObj._oldReadonly;
351
+ },
352
+ oldReadonlyColKeys () {
353
+ return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
335
354
  },
336
355
 
337
356
  searchLabelWidth () {
@@ -410,16 +429,7 @@ export default {
410
429
  },
411
430
  renderedListData () {
412
431
  return this.allListData.filter(rowItem => {
413
- if (this.isSearching) {
414
- const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch, rowItem);
415
-
416
- // 重置
417
- rowItem.__isSearchShow__ = false;
418
- if (bool) {
419
- rowItem.__isRendered__ = true;
420
- rowItem.__isSearchShow__ = true;
421
- }
422
- }
432
+ this.dealSearchShow(rowItem);
423
433
 
424
434
  return rowItem.__isRendered__;
425
435
  });
@@ -459,6 +469,76 @@ export default {
459
469
  return !!this.compareListData.length;
460
470
  },
461
471
 
472
+ /* 列 */
473
+ selfColumns () {
474
+ return this.columns;
475
+ },
476
+ mergeRowColumns () {
477
+ return this.selfColumns.filter(colItem => this.mergeRowColKeys.includes(colItem._key));
478
+ },
479
+ filterColumns () {
480
+ return this.selfColumns.filter(colItem => this.$isAdvRelyShow(colItem, this.allListData, this.parentObj, true));
481
+ },
482
+ contentColumns () {
483
+ return this.filterColumns.map(colItem => ({
484
+ filter: undefined,
485
+ sortBy: undefined,
486
+ renderHeaderCell: ({ column }, h) => {
487
+ return this.contentThCellRender(h, { column });
488
+ },
489
+ renderBodyCell: ({ row, rowIndex, column }, h) => {
490
+ return this.contentTdCellRender(h, { row, rowIndex, column });
491
+ },
492
+ ...colItem
493
+ }));
494
+ },
495
+ showContentColumns () {
496
+ return this.contentColumns.filter(colItem =>
497
+ this.hideStatus === true
498
+ ? !this.hideColKeys.includes(colItem._key)
499
+ : true
500
+ );
501
+ },
502
+ selectionColumn () {
503
+ return {
504
+ _key: "__selection__",
505
+ key: "__selection__",
506
+ field: "__selection__",
507
+ type: "checkbox",
508
+ width: 66,
509
+ align: "center",
510
+ fixed: "left"
511
+ };
512
+ },
513
+ operationColumn () {
514
+ return {
515
+ title: "操作",
516
+ _key: "__operation__",
517
+ key: "__operation__",
518
+ field: "__operation__",
519
+ align: "center",
520
+ fixed: "right",
521
+ width: 100,
522
+ renderBodyCell: ({ row, rowIndex, column }, h) => {
523
+ const operationList = this.$getOperationList(["canDelete"]);
524
+
525
+ return h("dsh-buttons", {
526
+ props: {
527
+ list: operationList.map(btnItem => ({
528
+ ...btnItem,
529
+ disabled: !this.getRowBtnCanEdit(row, rowIndex)
530
+ }))
531
+ },
532
+ on: {
533
+ click: (operationItem) => {
534
+ this.$dispatchEvent(operationItem, row, rowIndex);
535
+ }
536
+ }
537
+ });
538
+ }
539
+ };
540
+ },
541
+
462
542
  tablePropsObj () {
463
543
  return {
464
544
  // rowStyleOption: {
@@ -475,13 +555,14 @@ export default {
475
555
  cellSpanOption: {
476
556
  bodyCellSpan: ({ row, rowIndex, column }) => {
477
557
  // 合并单元格(单元格值为空时不合并)
478
- if (column._mergeRow === true) {
558
+ if (this.mergeRowColKeys.includes(column._key)) {
479
559
  if (this.$isEmptyData(row[column._key])) {
480
560
  return {
481
561
  rowspan: 1,
482
562
  colspan: 1
483
563
  };
484
- } else {
564
+ }
565
+ else {
485
566
  if (
486
567
  rowIndex !== 0 &&
487
568
  row[column._key] === this.showListData[rowIndex - 1][column._key]
@@ -529,7 +610,7 @@ export default {
529
610
  return {
530
611
  bodyCellClass: ({ row, rowIndex, column }) => {
531
612
  return "bri-table-td" +
532
- `${column._mergeRow
613
+ `${this.mergeRowColKeys.includes(column._key)
533
614
  ? " bri-table-td-merge"
534
615
  : ""
535
616
  }` +
@@ -556,157 +637,14 @@ export default {
556
637
  }
557
638
  };
558
639
  },
559
- contentColumns () {
560
- return this.filterColumns.map(colItem => ({
561
- filter: undefined,
562
- sortBy: undefined,
563
- renderHeaderCell: ({ column }, h) => {
564
- column = this.$transformDynamicProperty(column, undefined, this.parentObj);
565
640
 
566
- return this.$getHeadRender(h, column, {
567
- showRequired: this.showRequired,
568
- showDescription: this.showDescription,
569
- headHeightAuto: this.headHeightAuto
570
- });
571
- },
572
- renderBodyCell: ({ row, rowIndex, column }, h) => {
573
- column = this.$transformDynamicProperty(column, row, this.parentObj);
574
- column = this.getResetCol(column, row, rowIndex);
575
- const unitCanEdit = this.getUnitCanEdit(column, row, rowIndex);
576
- const ruleResultObj = this.getColRuleResult(column, row, rowIndex);
577
-
578
- return [
579
- this.isShowCompare(column, row, rowIndex)
580
- ? h("Tooltip", {
581
- style: {
582
- width: "100%"
583
- },
584
- props: {
585
- content: this.$isEmptyData(this.compareListData[rowIndex][column._key])
586
- ? ""
587
- : this.compareListData[rowIndex][column._key],
588
- transfer: true,
589
- maxWidth: 200,
590
- placement: "top"
591
- },
592
- scopedSlots: {
593
- default: props => h("dsh-list-unit", {
594
- props: {
595
- canEdit: unitCanEdit,
596
- formData: row,
597
- formItem: column,
598
- allFormList: this.selfColumns,
599
- inTableType: this.inTableType,
600
- allListRows: this.allListData,
601
- rowIndex: rowIndex,
602
- parentFormList: this.allFormList,
603
- parentObj: this.parentObj
604
- },
605
- on: {
606
- blur: () => this.controlBlur(null, column, row, rowIndex, arguments),
607
- change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
608
- }
609
- })
610
- }
611
- })
612
- : h("dsh-list-unit", {
613
- props: {
614
- canEdit: unitCanEdit,
615
- formData: row,
616
- formItem: column,
617
- allFormList: this.selfColumns,
618
- inTableType: this.inTableType,
619
- allListRows: this.allListData,
620
- rowIndex: rowIndex,
621
- parentFormList: this.allFormList,
622
- parentObj: this.parentObj
623
- },
624
- on: {
625
- blur: () => this.controlBlur(null, column, row, rowIndex, arguments),
626
- change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
627
- }
628
- }),
629
-
630
- // 校验文字
631
- !ruleResultObj.bool
632
- ? h("span", {
633
- class: "bri-table-td-tip"
634
- }, ruleResultObj.message)
635
- : undefined,
636
-
637
- // 添加符
638
- ...this.createIconRender(h, { row, rowIndex, column }, 12)
639
- ];
640
- },
641
- ...colItem
642
- }));
643
- },
644
- selectionColumn () {
645
- return {
646
- _key: "__selection__",
647
- key: "__selection__",
648
- field: "__selection__",
649
- type: "checkbox",
650
- width: 66,
651
- align: "center",
652
- fixed: "left"
653
- };
654
- },
655
- operationColumn () {
656
- return {
657
- title: "操作",
658
- _key: "__operation__",
659
- key: "__operation__",
660
- field: "__operation__",
661
- align: "center",
662
- fixed: "right",
663
- width: 100,
664
- renderBodyCell: ({ row, rowIndex, column }, h) => {
665
- const operationList = this.$getOperationList(["canDelete"]);
666
-
667
- return h("dsh-buttons", {
668
- props: {
669
- list: operationList.map(btnItem => ({
670
- ...btnItem,
671
- disabled: !this.getRowBtnCanEdit(row, rowIndex) ||
672
- (this.disabledDeleteDftRow ? this.getRowIsDftDisabled(row, rowIndex) : false)
673
- }))
674
- },
675
- on: {
676
- click: (operationItem) => {
677
- this.$dispatchEvent(operationItem, row, rowIndex);
678
- }
679
- }
680
- });
681
- }
682
- };
683
- },
684
-
685
- isImport () {
686
- return this.selfPropsObj._isImport;
687
- },
688
- importParams () {
689
- return {
690
- _id: this.parentDataId,
691
- _key: this.controlKey,
692
- importType: this.inTableType
693
- };
694
- },
695
- isExport () {
696
- return this.selfPropsObj._isExport;
697
- },
698
- exportParams () {
699
- return {
700
- screenKey: this.screenKey,
701
- _id: this.parentDataId,
702
- _key: this.controlKey,
703
- advSearch: this.finalTableAdvSearch
704
- };
641
+ hideColKeys () {
642
+ return this.selfPropsObj._hideColKeys;
705
643
  },
706
644
  isQuote () {
707
645
  return this.selfPropsObj._isQuote;
708
646
  },
709
- quoteDisabledColKeys () {
647
+ quoteReadonlyColKeys () {
710
648
  return this.selfPropsObj._quoteDisabledColKeys;
711
649
  },
712
650
  quoteListFields () {
@@ -736,6 +674,27 @@ export default {
736
674
  }
737
675
  };
738
676
  },
677
+ isImport () {
678
+ return this.selfPropsObj._isImport;
679
+ },
680
+ importParams () {
681
+ return {
682
+ _id: this.parentDataId,
683
+ _key: this.controlKey,
684
+ importType: this.inTableType
685
+ };
686
+ },
687
+ isExport () {
688
+ return this.selfPropsObj._isExport;
689
+ },
690
+ exportParams () {
691
+ return {
692
+ screenKey: this.screenKey,
693
+ _id: this.parentDataId,
694
+ _key: this.controlKey,
695
+ advSearch: this.finalTableAdvSearch
696
+ };
697
+ },
739
698
  modalPropsObj () {
740
699
  return {
741
700
  mode: "fullscreen",
@@ -743,21 +702,21 @@ export default {
743
702
  };
744
703
  },
745
704
 
746
- topOperationBtns () {
747
- return Object.keys(this.topOperationMap);
748
- },
749
705
  baseOperationBtns () {
750
706
  return Object.keys(this.baseOperationMap);
751
707
  },
708
+ otherOperationBtns () {
709
+ return Object.keys(this.otherOperationMap);
710
+ },
711
+ topOperationBtns () {
712
+ return Object.keys(this.topOperationMap);
713
+ },
752
714
  allOperationMap () {
753
715
  return {
754
- ...(this.topOperationMap || {}),
755
716
  ...(this.baseOperationMap || {}),
717
+ ...(this.otherOperationMap || {}),
718
+ ...(this.topOperationMap || {}),
756
719
 
757
- canHideOrShow: {
758
- ...this.topOperationMap.canHideOrShow,
759
- name: this.hideStatus ? "显示字段" : "隐藏字段"
760
- },
761
720
  canCreate: {
762
721
  ...this.baseOperationMap.canCreate,
763
722
  name: this.showMode === "form"
@@ -771,6 +730,10 @@ export default {
771
730
  ? this.baseOperationMap.canCreateChild.name.replace("行", "条")
772
731
  : this.baseOperationMap.canCreateChild.name
773
732
  // disabled: !!this.disabledCreateBtn
733
+ },
734
+ canHideOrShow: {
735
+ ...this.topOperationMap.canHideOrShow,
736
+ name: this.hideStatus ? "显示字段" : "隐藏字段"
774
737
  }
775
738
  };
776
739
  },
@@ -781,16 +744,18 @@ export default {
781
744
  undefined,
782
745
  this.canEdit
783
746
  ? [
784
- ...(this.hideColKeys.length ? ["canHideOrShow"] : []),
747
+ ...(this.disabledBtns ? [] : this.baseOperationBtns),
748
+ ...this.otherOperationBtns,
785
749
  ...(this.isQuote ? ["canQuote"] : []),
786
750
  ...(this.isImport ? ["canImport"] : []),
751
+
787
752
  ...(this.isExport ? ["canExport"] : []),
788
- "canEnlarge",
789
- ...(this.disabledBtns ? ["changeVal"] : this.baseOperationBtns)
753
+ ...(this.hideColKeys.length ? ["canHideOrShow"] : []),
754
+ "canEnlarge"
790
755
  ]
791
756
  : [
792
- ...(this.hideColKeys.length ? ["canHideOrShow"] : []),
793
757
  ...(this.isExport ? ["canExport"] : []),
758
+ ...(this.hideColKeys.length ? ["canHideOrShow"] : []),
794
759
  "canEnlarge"
795
760
  ]
796
761
  );
@@ -844,14 +809,14 @@ export default {
844
809
  changeSelect (list) {
845
810
  this.$emit("changeSelect", list);
846
811
  },
847
- // 表单控件失去焦点
848
- controlBlur (operationItem, col, row, rowIndex, params) {
812
+ // 输入框失去焦点
813
+ controlBlur (operationItem, row, rowIndex, col, params) {
849
814
  this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
850
815
  },
851
816
  // 输入框值改变
852
- changeVal (operationItem, col, row, rowIndex, params) {
817
+ changeVal (operationItem, row, rowIndex, col, params) {
853
818
  this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
854
- this.change("changeVal", col, row, rowIndex, ...params);
819
+ this.change("changeVal", row, rowIndex, col, ...params);
855
820
  },
856
821
 
857
822
  /* ----------- 隐藏/显示字段 ---------- */
@@ -862,9 +827,9 @@ export default {
862
827
  } else {
863
828
  this.$refs.briTable.hideColumnsByKeys(this.hideColKeys);
864
829
  }
865
-
866
- this.hideStatus = !this.hideStatus;
867
830
  }
831
+
832
+ this.hideStatus = !this.hideStatus;
868
833
  },
869
834
 
870
835
  /* ----------- 引用 ---------- */
@@ -1042,7 +1007,7 @@ export default {
1042
1007
  this.isEnlarge = true;
1043
1008
  },
1044
1009
 
1045
- /* ----------- 渲染函数 ---------- */
1010
+ /* ----------- 渲染函数(声明:为了代码更加规范清晰,return的是h相关的函数,则函数名get开头;return的是h的直接调用,函数名不要get开头)---------- */
1046
1011
  getTableTopRender (isEnlarge = false) {
1047
1012
  return (h, params) => {
1048
1013
  return h("div", {
@@ -1062,7 +1027,7 @@ export default {
1062
1027
  ]);
1063
1028
  };
1064
1029
  },
1065
- topSearchRender (h, params) {
1030
+ topSearchRender (h) {
1066
1031
  return this.searchFormList.length
1067
1032
  ? h("dsh-default-search", {
1068
1033
  props: {
@@ -1076,7 +1041,7 @@ export default {
1076
1041
  })
1077
1042
  : undefined;
1078
1043
  },
1079
- topSummaryRender (h, params) {
1044
+ topSummaryRender (h) {
1080
1045
  return h("div", {
1081
1046
  style: {
1082
1047
  "display": "flex",
@@ -1118,7 +1083,7 @@ export default {
1118
1083
  : undefined
1119
1084
  ]);
1120
1085
  },
1121
- topOperationRender (h, params) {
1086
+ topOperationRender (h) {
1122
1087
  return h("dsh-buttons", {
1123
1088
  style: {
1124
1089
  "text-align": "right"
@@ -1131,10 +1096,93 @@ export default {
1131
1096
  click: (event) => {
1132
1097
  this.$dispatchEvent(event);
1133
1098
  }
1099
+ },
1100
+ nativeOn: {
1101
+ click: (e) => {
1102
+ e.stopPropagation();
1103
+ }
1134
1104
  }
1135
1105
  });
1136
1106
  },
1137
- createBtnRender (h, params) {
1107
+ contentThCellRender (h, { column }) {
1108
+ column = this.$transformDynamicProperty(column, undefined, this.parentObj);
1109
+
1110
+ return this.$getHeadRender(h, column, {
1111
+ showRequired: this.showRequired,
1112
+ showDescription: this.showDescription,
1113
+ headHeightAuto: this.headHeightAuto
1114
+ });
1115
+ },
1116
+ contentTdCellRender (h, { row, rowIndex, column }) {
1117
+ column = this.$transformDynamicProperty(column, row, this.parentObj);
1118
+ column = this.getResetCol(row, rowIndex, column);
1119
+ const unitCanEdit = this.getUnitCanEdit(row, rowIndex, column);
1120
+ const ruleResultObj = this.getColRuleResult(row, rowIndex, column);
1121
+
1122
+ return [
1123
+ this.isShowCompare(row, rowIndex, column)
1124
+ ? h("Tooltip", {
1125
+ style: {
1126
+ width: "100%"
1127
+ },
1128
+ props: {
1129
+ content: this.$isEmptyData(this.compareListData[rowIndex][column._key])
1130
+ ? ""
1131
+ : this.compareListData[rowIndex][column._key],
1132
+ transfer: true,
1133
+ maxWidth: 200,
1134
+ placement: "top"
1135
+ },
1136
+ scopedSlots: {
1137
+ default: props => h("dsh-list-unit", {
1138
+ props: {
1139
+ canEdit: unitCanEdit,
1140
+ formData: row,
1141
+ formItem: column,
1142
+ allFormList: this.selfColumns,
1143
+ inTableType: this.inTableType,
1144
+ allListRows: this.allListData,
1145
+ rowIndex: rowIndex,
1146
+ parentFormList: this.allFormList,
1147
+ parentObj: this.parentObj
1148
+ },
1149
+ on: {
1150
+ blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
1151
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, row, rowIndex, column, arguments)
1152
+ }
1153
+ })
1154
+ }
1155
+ })
1156
+ : h("dsh-list-unit", {
1157
+ props: {
1158
+ canEdit: unitCanEdit,
1159
+ formData: row,
1160
+ formItem: column,
1161
+ allFormList: this.selfColumns,
1162
+ inTableType: this.inTableType,
1163
+ allListRows: this.allListData,
1164
+ rowIndex: rowIndex,
1165
+ parentFormList: this.allFormList,
1166
+ parentObj: this.parentObj
1167
+ },
1168
+ on: {
1169
+ blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
1170
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, row, rowIndex, column, arguments)
1171
+ }
1172
+ }),
1173
+
1174
+ // 校验文字
1175
+ !ruleResultObj.bool
1176
+ ? h("span", {
1177
+ class: "bri-table-td-tip"
1178
+ }, ruleResultObj.message)
1179
+ : undefined,
1180
+
1181
+ // 添加符
1182
+ ...this.createIconRender(h, { row, rowIndex, column }, 12)
1183
+ ];
1184
+ },
1185
+ createBtnRender (h) {
1138
1186
  return !this.isSearching && this.disabledFootCreateBtn !== true
1139
1187
  ? h("dsh-buttons", {
1140
1188
  style: {
@@ -1269,7 +1317,7 @@ export default {
1269
1317
  }
1270
1318
  ),
1271
1319
  // __old__: false,
1272
- __isDefault__: this.controlKey === "_default",
1320
+ __isDefault__: this.isDftSet,
1273
1321
  __isRendered__: true,
1274
1322
  __isShow__: true,
1275
1323
  __isTmpShow__: true,
@@ -1281,7 +1329,7 @@ export default {
1281
1329
  ...this.$deepCopy(this.selfRowDefault),
1282
1330
  _id: this.$ObjectID().str,
1283
1331
  // __old__: false,
1284
- __isDefault__: this.controlKey === "_default",
1332
+ __isDefault__: this.isDftSet,
1285
1333
  __isRendered__: true,
1286
1334
  __isShow__: true,
1287
1335
  __isTmpShow__: true,
@@ -1292,36 +1340,40 @@ export default {
1292
1340
  },
1293
1341
  // 整行校验结果
1294
1342
  getRowRuleResult (row, rowIndex) {
1295
- return this.filterColumns.every(column => this.getColRuleResult(column, row, rowIndex).bool);
1343
+ return this.filterColumns.every(colItem => this.getColRuleResult(row, rowIndex, colItem).bool);
1296
1344
  },
1297
1345
  getRowFormList (row, rowIndex) {
1298
- return this.selfColumns.map(column => {
1299
- column = this.$transformDynamicProperty(column, row, this.parentObj);
1300
- const unitCanEdit = this.getColCanEdit(column, row, rowIndex);
1346
+ return this.selfColumns.map(colItem => {
1347
+ colItem = this.$transformDynamicProperty(colItem, row, this.parentObj);
1348
+ const unitCanEdit = this.getColCanEdit(row, rowIndex, colItem);
1301
1349
 
1302
1350
  return {
1303
- ...column,
1351
+ ...colItem,
1304
1352
  canEdit: unitCanEdit
1305
1353
  };
1306
1354
  });
1307
1355
  },
1308
- // 是否禁止操作 在关于默认行方面
1309
- getRowIsDftDisabled (row, rowIndex) {
1310
- return this.controlKey === "_default" ? false : row.__isDefault__;
1356
+ // 是否默认行
1357
+ getIsDftRow (row, rowIndex) {
1358
+ return this.isDftSet ? false : row.__isDefault__;
1311
1359
  },
1312
- // 行按钮是否可编辑(删除按钮可编辑 不代表行内容是可编辑的)
1360
+ // 行按钮是否可操作(删除按钮可编辑 不代表行内容是可编辑的)
1313
1361
  getRowBtnCanEdit (row, rowIndex) {
1314
1362
  return this.canEdit && // 是编辑状态
1315
- (this.disabledOldDataRow ? row.__old__ !== true : true) && // 老数据行不置灰/置灰时是新增数据
1363
+ (this.disabledDeleteDftRow ? row.__isDefault__ !== true : true) && // 默认数据可删除
1364
+ (this.disabledDeleteOldRow ? row.__old__ !== true : true) && // 老数据可删除
1316
1365
  row.__readonly__ !== true; // 不能为只读数据
1317
1366
  },
1318
1367
  // 行内容是否可编辑
1319
1368
  getRowCanEdit (row, rowIndex) {
1320
- return this.getRowBtnCanEdit(row, rowIndex);
1369
+ return this.canEdit && // 是编辑状态
1370
+ (this.getIsDftRow(row) ? !this.dftReadonly : true) && // 默认数据可编辑
1371
+ (row.__old__ === true ? !this.oldReadonly : true) && // 老数据可编辑
1372
+ row.__readonly__ !== true; // 不能为只读数据
1321
1373
  },
1322
1374
 
1323
1375
  // 单元格校验结果
1324
- getColRuleResult (col, row, rowIndex) {
1376
+ getColRuleResult (row, rowIndex, col) {
1325
1377
  col = this.$transformDynamicProperty(col, row, this.parentObj);
1326
1378
 
1327
1379
  // 未触发校验时 不显示错误
@@ -1342,7 +1394,7 @@ export default {
1342
1394
  }
1343
1395
  },
1344
1396
  // 单元格是否显示对比
1345
- isShowCompare (col, row, rowIndex) {
1397
+ isShowCompare (row, rowIndex, col) {
1346
1398
  const oldRow = this.compareListData[rowIndex] || {};
1347
1399
  const curVal = row[col._key];
1348
1400
  const oldVal = oldRow[col._key];
@@ -1353,7 +1405,7 @@ export default {
1353
1405
  curVal !== oldVal;
1354
1406
  },
1355
1407
  // 加工单元格对应的配置
1356
- getResetCol (col, row, rowIndex) {
1408
+ getResetCol (row, rowIndex, col) {
1357
1409
  let resetMap = {
1358
1410
  select: {
1359
1411
  _optionKind: "dropdown"
@@ -1370,7 +1422,7 @@ export default {
1370
1422
  };
1371
1423
  },
1372
1424
  // 列本身是否可编辑
1373
- getColCanEdit (col, row, rowIndex) {
1425
+ getColCanEdit (row, rowIndex, col) {
1374
1426
  return (
1375
1427
  ["treeTable"].includes(this.inTableType) && ["number", "date"].includes(col._type)
1376
1428
  ? col._summaryType
@@ -1385,17 +1437,18 @@ export default {
1385
1437
  : true
1386
1438
  ) &&
1387
1439
  !(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(col._key)) && // 层级表格的固定字段不可编辑
1388
- (col._oldReadonly ? row.__old__ !== true : true) && // 老数据行里某些列不可编辑
1389
- (row.__isQuote__ ? !this.quoteDisabledColKeys.includes(col._key) : true) && // 引用过来的数据是否可编辑
1440
+ (col._oldReadonly ? row.__old__ !== true : true) && // 某些列在老数据行里不可编辑
1441
+ (this.getIsDftRow(row) ? !this.dftReadonlyColKeys.includes(col._key) : true) && // 默认行的某列是否可编辑
1442
+ (row.__old__ === true ? !this.oldReadonlyColKeys.includes(col._key) : true) && // 老数据行里某些列不可编辑
1443
+ (row.__isQuote__ ? !this.quoteReadonlyColKeys.includes(col._key) : true) && // 引用过来的数据是否可编辑
1390
1444
  !["calculate"].includes(col._enterType) && // 计算的不可编辑
1391
1445
  col._readonly !== true && // 只读
1392
- (!this.getRowIsDftDisabled(row) || col._readonlyOnDftRow !== true) && // 默认行的某列是否可编辑
1393
1446
  col.canEdit !== false; // 字段本身编辑权限 考虑为undefined时候
1394
1447
  },
1395
1448
  // 单元格最终编辑状态
1396
- getUnitCanEdit (col, row, rowIndex) {
1449
+ getUnitCanEdit (row, rowIndex, col) {
1397
1450
  return this.getRowCanEdit(row, rowIndex) &&
1398
- this.getColCanEdit(col, row, rowIndex) &&
1451
+ this.getColCanEdit(row, rowIndex, col) &&
1399
1452
  this.$isAdvRelyShow(col, row, this.parentObj, true);
1400
1453
  },
1401
1454
 
@@ -1426,13 +1479,14 @@ export default {
1426
1479
  }
1427
1480
  },
1428
1481
  // 初始化时 修复数据
1429
- fixRowItem (row) {
1482
+ fixRowItem (row, levelNum) {
1430
1483
  if (this.initFlag) {
1431
1484
  // TODO:修正数据level属性,后期可以删除
1432
1485
  if (["cascaderTable"].includes(this.controlType)) {
1433
1486
  row.level = row.level || levelNum;
1434
1487
  }
1435
1488
 
1489
+ // 配置端设置的地方,不会运行下面的,因为_default被过滤掉没值,defaultListDataIds就是空的
1436
1490
  if (row._id) {
1437
1491
  if (this.defaultListDataIds.includes(row._id)) {
1438
1492
  row.__isDefault__ = true;
@@ -1444,8 +1498,8 @@ export default {
1444
1498
  row._id = this.$ObjectID().str;
1445
1499
  }
1446
1500
 
1447
- row.__old__ = this.controlKey === "_default" ? false : !this.parentObj.__isCreate__; // 标记老数据
1448
- row.__isDefault__ = this.controlKey === "_default" ? true : !!row.__isDefault__; // 标记默认数据(配置端默认值)
1501
+ row.__old__ = this.isDftSet ? false : !this.parentObj.__isCreate__; // 标记老数据
1502
+ row.__isDefault__ = this.isDftSet ? true : !!row.__isDefault__; // 标记默认数据(配置端默认值)
1449
1503
 
1450
1504
  // 初次进来 把关于展示的状态值全部清除
1451
1505
  this.resetProperties.forEach(property => {
@@ -1472,6 +1526,23 @@ export default {
1472
1526
  row.__isExpand__ = false;
1473
1527
  }
1474
1528
  }
1529
+ },
1530
+ dealSearchShow (rowItem) {
1531
+ if (this.isSearching) {
1532
+ const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch, rowItem);
1533
+
1534
+ // 重置
1535
+ rowItem.__isSearchShow__ = false;
1536
+ if (bool) {
1537
+ rowItem.__isRendered__ = true;
1538
+ rowItem.__isSearchShow__ = true;
1539
+ }
1540
+
1541
+ return bool;
1542
+ }
1543
+ else {
1544
+ return true;
1545
+ }
1475
1546
  }
1476
1547
  }
1477
1548
  };