bri-components 1.3.40 → 1.3.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.3.40",
3
+ "version": "1.3.42",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -98,7 +98,7 @@
98
98
  return this.$transformDateCompatible(val, this.subType);
99
99
  },
100
100
  set (val) {
101
- this.value[this.controlKey] = this.$transformDate(val, "-", this.subType);
101
+ this.$set(this.value, this.controlKey, this.$transformDate(val, "-", this.subType));
102
102
  }
103
103
  },
104
104
  subType () {
@@ -32,9 +32,10 @@
32
32
  <dsh-cascader-table
33
33
  v-else
34
34
  :canEdit="finalCanEdit"
35
+ :rowDefault="curVal.rowDefault"
36
+ :columns="subForm"
35
37
  :data="curVal"
36
38
  :treeColumns="treeForm"
37
- :subColumns="subForm"
38
39
  :propsObj="propsObj"
39
40
  :parentFormList="allFormList"
40
41
  :parentObj="value"
@@ -64,9 +65,10 @@
64
65
  v-else
65
66
  ref="table"
66
67
  :canEdit="finalCanEdit"
68
+ :rowDefault="curVal.rowDefault"
69
+ :columns="subForm"
67
70
  :data="curVal"
68
71
  :treeColumns="treeForm"
69
- :subColumns="subForm"
70
72
  :propsObj="propsObj"
71
73
  :parentFormList="allFormList"
72
74
  :parentObj="value"
@@ -204,7 +204,7 @@
204
204
  },
205
205
  computed: {
206
206
  showFormList () {
207
- return this.formList.filter(formItem => this.isShow(formItem, this.formData));
207
+ return this.formList.filter(formItem => this.isShow(formItem, this.formData, this.parentObj));
208
208
  }
209
209
  },
210
210
  watch: {
@@ -326,7 +326,7 @@
326
326
  },
327
327
 
328
328
  /* -------- 工具类 -------- */
329
- isShow (formItem, formData) {
329
+ isShow (formItem, formData, parentObj) {
330
330
  // 寻找循环项
331
331
  if (formItem._loop === true) {
332
332
  Object.entries({
@@ -339,7 +339,7 @@
339
339
  });
340
340
  }
341
341
 
342
- return this.$isAdvRelyShow(formItem, formData);
342
+ return this.$isAdvRelyShow(formItem, formData, parentObj);
343
343
  },
344
344
  getRules (formItem) {
345
345
  let rules = [];
@@ -32,7 +32,7 @@
32
32
  <tbody>
33
33
  <tr>
34
34
  <th
35
- v-for="(column, colIndex) in columns"
35
+ v-for="(column, colIndex) in showColumns"
36
36
  :key="column._id"
37
37
  class="table-th bri-table-th"
38
38
  :style="getThStyle(column, 'th')"
@@ -51,7 +51,7 @@
51
51
  menuClass="table-th-dropdown-list"
52
52
  trigger="hover"
53
53
  :list="$getOperationList(getTreeThBtns(column))"
54
- @click="$dispatchEvent($event, column, colIndex, columns)"
54
+ @click="$dispatchEvent($event, column, colIndex, showColumns)"
55
55
  @click.native.stop="0"
56
56
  >
57
57
  <a href="javascript:void(0)">
@@ -92,8 +92,7 @@
92
92
  :class="{
93
93
  [`table-td-${column.colType}`]: true,
94
94
  'bri-table-td': true , // 可以不要,为了position: relative,上面有
95
- 'bri-table-td-edit': canEdit,
96
- 'bri-table-td-show': !canEdit,
95
+ 'bri-table-td-edit': canEdit
97
96
  }"
98
97
  :style="getTdStyle(column, row[column.nodeKey])"
99
98
  :rowspan="getTdRowSpan(column, row[column.nodeKey || column._key])"
@@ -167,7 +166,7 @@
167
166
  v-else
168
167
  class="table-nodata"
169
168
  >
170
- <td :colspan="columns.length">暂无数据…</td>
169
+ <td :colspan="showColumns.length">暂无数据…</td>
171
170
  </tr>
172
171
  </tbody>
173
172
  </table>
@@ -205,7 +204,7 @@
205
204
  <tbody>
206
205
  <tr>
207
206
  <th
208
- v-for="(column, colIndex) in columns"
207
+ v-for="(column, colIndex) in showColumns"
209
208
  :key="column._id"
210
209
  class="table-th bri-table-th"
211
210
  :style="getThStyle(column, 'th')"
@@ -224,7 +223,7 @@
224
223
  menuClass="table-th-dropdown-list"
225
224
  trigger="hover"
226
225
  :list="$getOperationList(getTreeThBtns(column))"
227
- @click="$dispatchEvent($event, column, colIndex, columns)"
226
+ @click="$dispatchEvent($event, column, colIndex, showColumns)"
228
227
  @click.native.stop="0"
229
228
  >
230
229
  <a href="javascript:void(0)">
@@ -265,8 +264,7 @@
265
264
  :class="{
266
265
  [`table-td-${column.colType}`]: true,
267
266
  'bri-table-td': true , // 可以不要,为了position: relative,上面有
268
- 'bri-table-td-edit': canEdit,
269
- 'bri-table-td-show': !canEdit,
267
+ 'bri-table-td-edit': canEdit
270
268
  }"
271
269
  :style="getTdStyle(column, row[column.nodeKey])"
272
270
  :rowspan="getTdRowSpan(column, row[column.nodeKey || column._key])"
@@ -340,7 +338,7 @@
340
338
  v-else
341
339
  class="table-nodata"
342
340
  >
343
- <td :colspan="columns.length">暂无数据…</td>
341
+ <td :colspan="showColumns.length">暂无数据…</td>
344
342
  </tr>
345
343
  </tbody>
346
344
  </table>
@@ -368,7 +366,6 @@
368
366
  return {
369
367
  tree: [],
370
368
  list: [],
371
- rowDefault: {},
372
369
  _treeForm: []
373
370
  };
374
371
  }
@@ -378,17 +375,10 @@
378
375
  default () {
379
376
  return [];
380
377
  }
381
- },
382
- subColumns: {
383
- type: Array,
384
- default () {
385
- return [];
386
- }
387
378
  }
388
379
  },
389
380
  data () {
390
381
  return {
391
- widthMap: this.$getModFieldPropertyMap("width"),
392
382
  boxWidth: 0,
393
383
 
394
384
  baseOperationMap: {
@@ -490,10 +480,7 @@
490
480
  };
491
481
  },
492
482
 
493
- filterColumns () {
494
- return this.subColumns.filter(column => this.$isAdvRelyShow(column, this.listData, this.parentObj, true));
495
- },
496
- columns () {
483
+ showColumns () {
497
484
  return this.transformColumns(this.treeColumns);
498
485
  },
499
486
  // 供表格渲染行使用的columns的数组集合, 每一行columns不一样,组成二重数组
@@ -527,7 +514,7 @@
527
514
  loop(node.children);
528
515
  } else {
529
516
  // 根节点下所有表格字段加上监测,注入到节点对象中,必须$set,牵扯_rely值再出现并没有检测
530
- this.subColumns.forEach(subFormItem => {
517
+ this.columns.forEach(subFormItem => {
531
518
  this.$set(node, subFormItem._key, node[subFormItem._key]);
532
519
  });
533
520
  }
@@ -682,7 +669,7 @@
682
669
  );
683
670
  },
684
671
  // 转化树数据
685
- transforBriTreeData (treeForm = this.treeColumns, subForm = this.subColumns) {
672
+ transforBriTreeData (treeForm = this.treeColumns, subForm = this.columns) {
686
673
  treeForm.forEach((treeFormItem, treeFormIndex) => {
687
674
  treeFormItem.canDelete = true; // 每次计算,重置一下
688
675
  treeFormItem.level = treeFormIndex + 1; // treeColumns更新,缺少level
@@ -829,26 +816,19 @@
829
816
  },
830
817
  // 获取节点数据
831
818
  getNewNode (level, list) {
832
- // 新增行里的输入框,第一次输入会失去光标的bug,需要$set
833
- const rowDefault = this.$deepCopy(this.data.rowDefault);
834
- this.subColumns.forEach(subFormItem => {
835
- // 用$set也可以
836
- rowDefault[subFormItem._key] = rowDefault[subFormItem._key];
837
- });
838
-
839
- const levelText = this.$numToChinese(level);
840
819
  return {
820
+ ...this.$deepCopy(this.selfRowDefault),
841
821
  _id: this.$ObjectID().str,
842
- name: `${levelText}级节点${list.length + 1}`,
822
+ name: `${this.$numToChinese(level)}级节点${list.length + 1}`,
843
823
  level: level,
844
- children: [],
845
- ...rowDefault
824
+ // isLeaf: true,
825
+ children: []
846
826
  };
847
827
  },
848
828
 
849
829
  /* ----- 模板获值方法 ---- */
850
830
  getThStyle (col, position) {
851
- const boxColWidth = this.boxWidth / this.columns.length;
831
+ const boxColWidth = this.boxWidth / this.showColumns.length;
852
832
  const defaultWidth = Math.max(boxColWidth, this.widthMap[col._type], (col._name ? col._name.length * 14 : 36) + (col._type === "reference" ? 200 : 26));
853
833
  const width = col._width || defaultWidth;
854
834
 
@@ -899,7 +879,6 @@
899
879
  getTdRender (col, row, rowIndex) {
900
880
  return (h) => {
901
881
  row = row[col.nodeKey];
902
- console.log(row);
903
882
 
904
883
  return h(
905
884
  "td",
@@ -913,7 +892,7 @@
913
892
  },
914
893
  getSummaryVal (col, row) {
915
894
  if (col._calField && col._operator) {
916
- const calFieldFormItem = this.subColumns.find(item => item._key === col._calField);
895
+ const calFieldFormItem = this.columns.find(item => item._key === col._calField);
917
896
 
918
897
  if (calFieldFormItem) {
919
898
  let loop = (nodes, arr) => {
@@ -95,7 +95,7 @@
95
95
  props: {},
96
96
  data () {
97
97
  return {
98
- deleteProperties: ["__treeIndex__", "__old__", "__isExpand__", "__isRendered__", "__isShow__", "__isTmpShow__", "__isSearchingShow__"], // 除了__readonly__和__isQuote__不处理
98
+ deleteProperties: ["__treeIndex__", "__old__", "__isExpand__", "__isRendered__", "__isShow__", "__isTmpShow__", "__isSearchShow__"], // 除了__readonly__和__isQuote__不处理
99
99
  isExpandAction: false,
100
100
 
101
101
  searchMode: "flat", // "flat", "tree"
@@ -121,13 +121,13 @@
121
121
  listData () {
122
122
  return this.allListData.filter(row => {
123
123
  if (this.isSearching) {
124
- // 重置__isSearchingShow__为false
125
- row.__isSearchingShow__ = false;
126
-
127
124
  const bool = this.$isAdvRelyAccord(this.advSearchObj, row);
125
+
126
+ // 重置
127
+ row.__isSearchShow__ = false;
128
128
  if (bool) {
129
129
  row.__isRendered__ = true;
130
- row.__isSearchingShow__ = true;
130
+ row.__isSearchShow__ = true;
131
131
  }
132
132
 
133
133
  return bool || row.__isRendered__;
@@ -138,7 +138,7 @@
138
138
  },
139
139
  showListData () {
140
140
  return this.listData.filter(row =>
141
- this.isSearching ? !!row.__isSearchingShow__ : !!row.__isShow__
141
+ this.isSearching ? !!row.__isSearchShow__ : !!row.__isShow__
142
142
  );
143
143
  },
144
144
  rowsNum () {
@@ -219,11 +219,11 @@
219
219
  `${
220
220
  this.getRowCanEdit(row)
221
221
  ? " bri-table-td-edit"
222
- : " bri-table-td-show"
222
+ : ""
223
223
  }` +
224
224
  `${
225
225
  this.isSearching
226
- ? !row.__isSearchingShow__
226
+ ? !row.__isSearchShow__
227
227
  ? " bri-table-td-hide"
228
228
  : ""
229
229
  : !row.__isShow__
@@ -378,6 +378,7 @@
378
378
  // 展开/隐藏节点
379
379
  toggleExpand (row, bool = true) {
380
380
  this.isExpandAction = true;
381
+ // row.__isExpand__ = bool;
381
382
  this.$set(row, "__isExpand__", bool);
382
383
 
383
384
  this.toggleDescendantsShow(row, bool);
@@ -385,24 +386,29 @@
385
386
 
386
387
  // 点击 -添加一行
387
388
  clickCreate (operationItem, row, rowIndex) {
389
+ const newRow = {
390
+ ...this.$deepCopy(this.selfRowDefault),
391
+ _id: this.$ObjectID().str,
392
+ isLeaf: true,
393
+ children: [],
394
+ // __old__: false,
395
+ __isExpand__: false,
396
+ __isRendered__: true,
397
+ __isShow__: true,
398
+ __isTmpShow__: false,
399
+ __isSearchShow__: false
400
+ };
401
+
388
402
  // !row代表最上级节点
389
403
  if (!row) {
390
404
  this.data.push({
391
- _id: this.$ObjectID().str,
392
- ...this.$deepCopy(this.rowDefault),
393
- level: 1,
394
- isLeaf: true,
395
- children: [],
396
- __isRendered__: true,
397
- __isShow__: true
405
+ ...newRow,
406
+ level: 1
398
407
  });
399
408
  } else {
400
409
  row.children.push({
401
- _id: this.$ObjectID().str,
402
- ...this.$deepCopy(this.rowDefault),
403
- level: row.level + 1,
404
- isLeaf: true,
405
- children: []
410
+ ...newRow,
411
+ level: row.level + 1
406
412
  });
407
413
 
408
414
  this.toggleExpand(row, true);
@@ -424,54 +430,91 @@
424
430
  /* ------ 工具方法 ------- */
425
431
  // 加工树形数据
426
432
  getCalcuedTree (treeData = [], columns) {
427
- const loop = (list = []) =>
428
- list.forEach((node) => {
429
- if (node.children && node.children.length) {
430
- node.isLeaf = false;
431
- loop(node.children);
432
-
433
- columns.reduce((newNode, col) => {
434
- if (col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType)) {
435
- newNode[col._key] = col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType)
433
+ const loop = (list = [], parentRow) =>
434
+ list.forEach((row) => {
435
+ // 递归到叶子节点前 从上往下要处理的
436
+ columns.reduce((newRow, col) => {
437
+ const isNumberSummary = col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType);
438
+ const isDateSummary = col._type === "date" && ![undefined, null, ""].includes(col._writeSort);
439
+
440
+ if (isNumberSummary || isDateSummary) {
441
+ const val = isNumberSummary
442
+ ? newRow[col._key]
443
+ : ["downToUp"].includes(col._writeSort)
444
+ ? newRow[col._key]
445
+ : !parentRow || parentRow[col._key]
446
+ ? newRow[col._key]
447
+ : undefined;
448
+
449
+ this.$set(newRow, col._key, val);
450
+ }
451
+
452
+ return newRow;
453
+ }, row);
454
+
455
+ if (row.children && row.children.length) {
456
+ row.isLeaf = false;
457
+ loop(row.children, row);
458
+
459
+ // 递归到叶子节点后 从下往上要处理的
460
+ columns.reduce((newRow, col) => {
461
+ const isNumberSummary = col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType);
462
+ const isDateSummary = col._type === "date" && ![undefined, null, ""].includes(col._writeSort);
463
+
464
+ if (isNumberSummary || isDateSummary) {
465
+ const val = isNumberSummary
436
466
  ? this.$calNumList(
437
- node.children.map(subNode => subNode[col._key]),
467
+ newRow.children.map(subRow => subRow[col._key]),
438
468
  col._summaryType,
439
469
  { ...col, _defaultDigit: 2 },
440
470
  false
441
471
  )
442
- : newNode[col._key];
472
+ : ["downToUp"].includes(col._writeSort)
473
+ ? this.$calDateList(
474
+ newRow.children.map(subRow => subRow[col._key]),
475
+ col._compareOperator,
476
+ col._dateType
477
+ )
478
+ : newRow[col._key];
479
+
480
+ this.$set(newRow, col._key, val);
443
481
  }
444
482
 
445
- return newNode;
446
- }, node);
483
+ return newRow;
484
+ }, row);
447
485
  } else {
448
- node.isLeaf = true;
486
+ row.isLeaf = true;
449
487
  }
450
488
 
451
489
  // 初次进来把前端存的状态值全部清除(除了__readonly__)
452
490
  if (this.initFlag) {
453
491
  this.deleteProperties.forEach(property => {
454
- delete node[property];
492
+ delete row[property];
455
493
  });
456
494
 
457
- node.__old__ = true; // 老的数据都打上标记 尽管不一定会用
495
+ row.__old__ = true; // 老的数据都打上标记 尽管不一定会用
496
+ // row.__isExpand__ = false;
497
+ // row.__isSearchShow__ = false;
458
498
  // 第一级的需要显示出来
459
- if (node.level == 1) {
460
- node.__isRendered__ = true;
461
- node.__isShow__ = true;
462
- node.__isTmpShow__ = true;
499
+ if (row.level == 1) {
500
+ row.__isRendered__ = true;
501
+ row.__isShow__ = true;
502
+ row.__isTmpShow__ = true;
503
+ } else {
504
+ // row.__isRendered__ = false;
505
+ // row.__isShow__ = false;
506
+ // row.__isTmpShow__ = false;
463
507
  }
464
508
  }
465
509
  });
466
-
467
510
  loop(treeData);
468
- console.log("treeee");
511
+
469
512
  this.initFlag = false;
470
513
  return treeData;
471
514
  },
472
515
  // 获取父节点
473
- getParentNode (curNode, tree = []) {
474
- if (curNode.level === 1) {
516
+ getParentNode (curRow, tree = []) {
517
+ if (curRow.level === 1) {
475
518
  return {
476
519
  children: tree
477
520
  };
@@ -479,13 +522,13 @@
479
522
  let parentNode;
480
523
 
481
524
  const loop = (list = []) => {
482
- return list.some(node => {
483
- if (node.level === curNode.level - 1) {
484
- const isExist = node.children.some(childNode => childNode._id === curNode._id);
485
- parentNode = node;
525
+ return list.some(row => {
526
+ if (row.level === curRow.level - 1) {
527
+ const isExist = row.children.some(childNode => childNode._id === curRow._id);
528
+ parentNode = row;
486
529
  return isExist;
487
530
  } else {
488
- return loop(node.children);
531
+ return loop(row.children);
489
532
  }
490
533
  });
491
534
  };
@@ -495,28 +538,33 @@
495
538
  }
496
539
  },
497
540
  // 切换子孙后代的显示/隐藏
498
- toggleDescendantsShow (node, bool) {
499
- const loop = (node, isFirstSon) => {
500
- if (node.children && node.children.length) {
501
- node.children.forEach(subNode => {
541
+ toggleDescendantsShow (row, bool) {
542
+ const loop = (row, isFirstSon) => {
543
+ if (row.children && row.children.length) {
544
+ row.children.forEach(subRow => {
502
545
  if (isFirstSon) {
503
- this.$set(subNode, "__isRendered__", true);
504
- this.$set(subNode, "__isShow__", bool);
505
- this.$set(subNode, "__isTmpShow__", bool);
546
+ // subRow.__isRendered__ = true;
547
+ // subRow.__isShow__ = bool;
548
+ // subRow.__isTmpShow__ = bool;
549
+ this.$set(subRow, "__isRendered__", true);
550
+ this.$set(subRow, "__isShow__", bool);
551
+ this.$set(subRow, "__isTmpShow__", bool);
506
552
  } else {
507
553
  if (bool) {
508
- this.$set(subNode, "__isShow__", subNode.__isTmpShow__);
554
+ // subRow.__isShow__ = subRow.__isTmpShow__;
555
+ this.$set(subRow, "__isShow__", subRow.__isTmpShow__);
509
556
  } else {
510
- this.$set(subNode, "__isShow__", false);
557
+ // subRow.__isShow__ = false;
558
+ this.$set(subRow, "__isShow__", false);
511
559
  }
512
560
  }
513
561
 
514
- loop(subNode);
562
+ loop(subRow);
515
563
  });
516
564
  }
517
565
  };
518
566
 
519
- loop(node, true);
567
+ loop(row, true);
520
568
  }
521
569
  }
522
570
  };
@@ -2,12 +2,6 @@ export default {
2
2
  mixins: [],
3
3
  components: {},
4
4
  props: {
5
- columns: {
6
- type: Array,
7
- default () {
8
- return [];
9
- }
10
- },
11
5
  data: {
12
6
  type: Array,
13
7
  default () {
@@ -64,9 +58,6 @@ export default {
64
58
  };
65
59
  },
66
60
 
67
- filterColumns () {
68
- return this.columns.filter(col => this.$isAdvRelyShow(col, this.listData, this.parentObj, true));
69
- },
70
61
  showColumns () {
71
62
  return [
72
63
  ...(this.useSelection === true ? [this.selectionColumn] : []),
@@ -12,24 +12,30 @@ export default {
12
12
  type: Boolean,
13
13
  default: true
14
14
  },
15
- rowDefault: {
16
- type: Object,
15
+ oldData: {
16
+ type: Array,
17
17
  default () {
18
- return {};
18
+ return [];
19
19
  }
20
20
  },
21
- propsObj: {
21
+ rowDefault: {
22
22
  type: Object,
23
23
  default () {
24
24
  return {};
25
25
  }
26
26
  },
27
- oldData: {
27
+ columns: {
28
28
  type: Array,
29
29
  default () {
30
30
  return [];
31
31
  }
32
32
  },
33
+ propsObj: {
34
+ type: Object,
35
+ default () {
36
+ return {};
37
+ }
38
+ },
33
39
 
34
40
  parentFormList: {
35
41
  type: Array,
@@ -46,6 +52,9 @@ export default {
46
52
  },
47
53
  data () {
48
54
  return {
55
+ widthMap: this.$getModFieldPropertyMap("width"),
56
+ initDftValMap: this.$getModFieldPropertyMap("initDefaultVal"),
57
+
49
58
  initFlag: true,
50
59
  showRuleMessage: false, // 进行全体校验
51
60
  ruleRecordMap: {}, // 单元格是否发生校验的记录映射
@@ -126,7 +135,16 @@ export default {
126
135
  return this.parentObj._id;
127
136
  },
128
137
  selfRowDefault () {
129
- return this.$filterObj(this.filterColumns, this.rowDefault);
138
+ return this.filterColumns.reduce((obj, column) => {
139
+ const defaultVal = this.rowDefault[column._key];
140
+ const initDftVal = this.initDftValMap[column._type];
141
+
142
+ return Object.assign(obj, {
143
+ [column._key]: this.$isEmptyData(defaultVal)
144
+ ? initDftVal
145
+ : defaultVal
146
+ });
147
+ }, {});
130
148
  },
131
149
  oldListData () {
132
150
  this.oldData.forEach(item => {
@@ -173,6 +191,7 @@ export default {
173
191
  _isImport: false, // 导入
174
192
  _isExport: false, // 导出
175
193
  _isQuote: false, // 引用
194
+ _quoteDataCanEdit: false, // 引用的数据是否能编辑
176
195
  _quoteListFields: [], // 引用列表的显示字段
177
196
  _quoteAdvSearch: {
178
197
  logic: "and",
@@ -228,6 +247,9 @@ export default {
228
247
  isQuote () {
229
248
  return this.selfPropsObj._isQuote;
230
249
  },
250
+ quoteDataCanEdit () {
251
+ return this.selfPropsObj._quoteDataCanEdit;
252
+ },
231
253
  quoteListFields () {
232
254
  return this.selfPropsObj._quoteListFields;
233
255
  },
@@ -243,7 +265,7 @@ export default {
243
265
  return "bri-table-td" +
244
266
  `${this.getRowCanEdit(row)
245
267
  ? " bri-table-td-edit"
246
- : " bri-table-td-show"
268
+ : ""
247
269
  }`;
248
270
  }
249
271
  }
@@ -278,6 +300,10 @@ export default {
278
300
  _key: this.controlKey
279
301
  };
280
302
  },
303
+
304
+ filterColumns () {
305
+ return this.columns.filter(col => this.$isAdvRelyShow(col, this.listData, this.parentObj, true));
306
+ },
281
307
  contentColumns () {
282
308
  return this.filterColumns.map(colItem => ({
283
309
  filter: undefined,
@@ -479,7 +505,7 @@ export default {
479
505
  }))
480
506
  };
481
507
  } else if (["cascaderTable"].includes(this.controlType)) {
482
- const transformData = (data = []) => {
508
+ const transformData = (list = []) => {
483
509
  const loop = (list = []) =>
484
510
  list.map(item => ({
485
511
  ...item,
@@ -487,7 +513,7 @@ export default {
487
513
  __isQuote__: true
488
514
  }));
489
515
 
490
- return loop(data);
516
+ return loop(list);
491
517
  };
492
518
 
493
519
  this.parentObj[this.controlKey] = {
@@ -519,8 +545,8 @@ export default {
519
545
  }
520
546
  },
521
547
  // 导入回调
522
- importCb (data) {
523
- this.parentObj[this.controlKey] = data;
548
+ importCb (dataObj) {
549
+ this.parentObj[this.controlKey] = dataObj;
524
550
  this.change("import");
525
551
  },
526
552
  // 接口 -导出
@@ -567,7 +593,7 @@ export default {
567
593
  });
568
594
  }
569
595
  },
570
- error: data => {
596
+ error: res => {
571
597
  operationItem.disabled = false;
572
598
  this.exportTimer = null;
573
599
  }
@@ -620,13 +646,31 @@ export default {
620
646
  },
621
647
  // 行内容是否可编辑
622
648
  getRowCanEdit (row) {
623
- return this.getRowBtnCanEdit(row) &&
624
- !row.__isQuote__; // 不能为引用过来的数据,引用的可以
649
+ return this.getRowBtnCanEdit(row);
625
650
  },
626
651
  // 列本身是否可编辑
627
652
  getColCanEdit (col, row) {
628
- return (col._oldReadonly ? !row.__old__ : true) && // 老数据行里某些列不可编辑
629
- (["number"].includes(col._type) && ![undefined, null, "", "no"].includes(col._summaryType) ? row.isLeaf !== false : true) && // 级联表格 -“需要计的数字列 且 不是叶子行的”不可编辑(必须用isLeaf !== false判断,因为牵扯内部表格也在用)
653
+ return (
654
+ ["cascaderTable"].includes(this.controlType)
655
+ ? (
656
+ // 树形表格 -“需要计算的数字列 且 不是叶子行的”不可编辑(必须用isLeaf !== false判断,因为牵扯内部表格也在用)
657
+ ["number"].includes(col._type) && ![undefined, null, "", "no"].includes(col._summaryType)
658
+ ? row.isLeaf === true
659
+ : true
660
+ ) && (
661
+ // 树形表格 -“需要限制的日期列 且 不是叶子行的”不可编辑(必须用isLeaf !== false判断,因为牵扯内部表格也在用)
662
+ ["date"].includes(col._type)
663
+ ? ["downToUp"].includes(col._writeSort)
664
+ ? row.isLeaf === true
665
+ : ["upToDown"].includes(col._writeSort)
666
+ ? row.level === 1 || !!this.getParentNode(row, this.allTreeData)[col._key]
667
+ : true
668
+ : true
669
+ )
670
+ : true
671
+ ) &&
672
+ (col._oldReadonly ? !row.__old__ : true) && // 老数据行里某些列不可编辑
673
+ (row.__isQuote__ ? this.quoteDataCanEdit : true) && // 引用过来的数据是否可编辑
630
674
  col._enterType !== "calculate" && // 计算的不可编辑
631
675
  col._readonly !== true; // 不能为只读
632
676
  },
@@ -123,18 +123,16 @@
123
123
  }
124
124
 
125
125
  &-td {
126
+ height: 40px;
127
+ padding: 4px 16px;
126
128
  position: relative;
127
129
 
128
- &-tip {
129
- padding: 0px 0px 0px 16px;
130
- font-size: 12px;
131
- line-height: 1;
132
- color: #ed4014;
133
- position: absolute;
134
- top: calc(100% - 12px);
135
- left: 0px;
136
- }
130
+ &-expand {
137
131
 
132
+ }
133
+ &-index {
134
+ padding: 4px 16px 4px 12px!important;
135
+ }
138
136
  &-operation {
139
137
  .DshButtons-dropdown-more {
140
138
  padding: 0px;
@@ -151,10 +149,16 @@
151
149
  }
152
150
  }
153
151
 
154
- &-show { // 级联表格会生效 自己写的table
155
- height: 40px;
156
- padding: 4px 16px;
152
+ &-tip {
153
+ padding: 0px 0px 0px 16px;
154
+ font-size: 12px;
155
+ line-height: 1;
156
+ color: #ed4014;
157
+ position: absolute;
158
+ top: calc(100% - 12px);
159
+ left: 0px;
157
160
  }
161
+
158
162
  &-edit {
159
163
  padding: 4px 16px 12px 16px!important;
160
164
  }
@@ -174,16 +178,10 @@
174
178
 
175
179
  animation: slideDown .2s linear;
176
180
  }
181
+
177
182
  &-hide {
178
183
  display: none!important;
179
184
  }
180
-
181
- &-index {
182
- padding: 4px 16px 4px 12px!important;
183
- }
184
- &-expand {
185
-
186
- }
187
185
  }
188
186
  }
189
187