bri-components 1.4.0 → 1.4.2

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.4.0",
3
+ "version": "1.4.2",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -102,7 +102,7 @@
102
102
 
103
103
  const prefixCls = "ivu-upload";
104
104
  const imageType = ["jpg", "png", "gif", "jpeg", "tiff", "swf"];
105
- const documentType = ["txt", "doc", "xls", "ppt", "docx", "xlsx", "pptx", "pdf"];
105
+ const documentType = ["txt", "doc", "xls", "ppt", "docx", "xlsx", "pptx", "pdf", "xmind"];
106
106
  const videoType = ["flv", "rmvb", "mp4", "mvb"];
107
107
  const audioType = ["wma", "mp3", "m4a"];
108
108
  const packageType = ["rar", "zip"];
@@ -163,7 +163,7 @@
163
163
  return this.selfPropsObj._fileType;
164
164
  },
165
165
  showMode () {
166
- return this.isInTable ? "inline" : this.selfPropsObj._showMode;
166
+ return this.isInTable ? this.selfPropsObj._inTableStyle == "list" && !this.finalCanEdit ? "tableList" : "inline" : this.selfPropsObj._showMode;
167
167
  },
168
168
  useType () {
169
169
  return this.selfPropsObj._useType;
@@ -58,6 +58,59 @@
58
58
  </div>
59
59
  </template>
60
60
 
61
+ <!-- 在表格中展开 -->
62
+ <template v-else-if="showMode ==='tableList'">
63
+ <!-- 有值 -->
64
+ <div
65
+ v-if="files.length"
66
+ ref="viewerImage"
67
+ :class="['uploadList-list', `uploadList-list-${propsObj._fileType}`]"
68
+ >
69
+ <div
70
+ v-for="(fileItem, fileIndex) in files"
71
+ :key="fileItem._key || fileItem._id"
72
+ :class="{
73
+ 'item': propsObj._fileType === 'image',
74
+ [`item-${propsObj._fileType}`]: true
75
+ }"
76
+ >
77
+ <!-- 展示图 -->
78
+ <div class="item-show">
79
+ <img
80
+ v-if="fileItem.mimetype.includes('image')"
81
+ :data-original="fileItem.url"
82
+ :src="$imageResize(fileItem.url, imageResizeConfig)"
83
+ :alt="fileItem.name"
84
+ >
85
+ <img
86
+ v-else
87
+ :src="getFileImage(fileItem)"
88
+ :alt="fileItem.name"
89
+ >
90
+ </div>
91
+
92
+ <!-- 展示名称 -->
93
+ <p class="item-name-title">{{ fileItem.name }}</p>
94
+
95
+ <!-- 图标 -->
96
+ <dsh-icons
97
+ class="item-action"
98
+ item-class="item-action-icon"
99
+ :list="$getOperationList(getBtns(fileItem))"
100
+ @click="$dispatchEvent($event, fileItem, fileIndex)"
101
+ ></dsh-icons>
102
+ </div>
103
+ </div>
104
+
105
+ <!-- 无值 -->
106
+ <div
107
+ v-else
108
+ class="uploadList-inline-nodata"
109
+ >
110
+ <span>{{ noDataText }}</span>
111
+ </div>
112
+ </template>
113
+
61
114
  <div
62
115
  v-else-if="propsObj._fileType === 'file'"
63
116
  ref="viewerImage"
@@ -73,7 +126,10 @@
73
126
  'uploadList-fileList-fileName-edit': canEdit
74
127
  }">
75
128
  {{ files.length }}个
76
- <Icon v-if="canEdit" type="ios-arrow-down" />
129
+ <Icon
130
+ v-if="canEdit"
131
+ type="ios-arrow-down"
132
+ />
77
133
  </div>
78
134
 
79
135
  <div
@@ -94,9 +150,7 @@
94
150
  :alt="dropdownItem.name"
95
151
  class="fileItem-img"
96
152
  >
97
- <p
98
- class="fileItem-name-title"
99
- >{{ dropdownItem.name }}</p>
153
+ <p class="fileItem-name-title">{{ dropdownItem.name }}</p>
100
154
  <dsh-icons
101
155
  class="fileItem-action"
102
156
  item-class="fileItem-action-icon"
@@ -298,7 +352,7 @@
298
352
  let lastIndex = fileItem.name.lastIndexOf(".");
299
353
  let formate = fileItem.name.substring(lastIndex);
300
354
 
301
- this.$Modal.info({
355
+ this.$Modal.confirm({
302
356
  title: "修改名称",
303
357
  render: (h) => {
304
358
  return h("Input", {
@@ -14,7 +14,7 @@
14
14
  'DshCheckbox-flat-color': useColor,
15
15
  'DshCheckbox-flat-scroll': isHeightAuto
16
16
  ? isUnitUpdate
17
- ? listData.length > 6
17
+ ? listData.length > 3
18
18
  : false
19
19
  : true
20
20
  }"
@@ -14,7 +14,7 @@
14
14
  'DshSelect-flat-color': useColor,
15
15
  'DshSelect-flat-scroll': isHeightAuto
16
16
  ? isUnitUpdate
17
- ? listData.length > 4
17
+ ? listData.length > 3
18
18
  : false
19
19
  : true
20
20
  }"
@@ -52,7 +52,7 @@ export default {
52
52
  return this.selfPropsObj._reverseFilter;
53
53
  },
54
54
  selectFilterVals () {
55
- return this.selfPropsObj._selectFilterVals;
55
+ return this.selfPropsObj._selectFilterVals || []; // 老版级联表格层级属性那用到单选,缺这些属性,会产生undefined,有问题
56
56
  },
57
57
  selectFilterKey () {
58
58
  return this.selfPropsObj._selectFilterKey;
@@ -336,7 +336,7 @@
336
336
  _displayType: "show",
337
337
  canEdit: !["createdAt", "updatedAt", "_creaters"].includes(formData._key)
338
338
  }).forEach(arr => {
339
- if (!this.ignoreProperties.includes(arr[0])) {
339
+ if (!this.ignoreProperties.includes(arr[0]) && arr[1] !== undefined) {
340
340
  this.$set(formItem, arr[0], arr[1]);
341
341
  }
342
342
  });
@@ -11,40 +11,7 @@ export default {
11
11
  },
12
12
  data () {
13
13
  return {
14
- boxWidth: 0,
15
-
16
- baseOperationMap: {
17
- canCreateCol: {
18
- name: "添加一列",
19
- type: "canCreateCol",
20
- icon: "md-add",
21
- event: "clickCreateCol"
22
- },
23
- canDeleteCol: {
24
- name: "删除该列",
25
- type: "canDeleteCol",
26
- icon: "md-trash",
27
- color: "red",
28
- event: "clickDeleteCol"
29
- }
30
- }
31
- // otherOperationMap: {
32
- // canChangeNode: {
33
- // name: "改变节点值",
34
- // type: "canChangeNode",
35
- // event: "changeNode"
36
- // },
37
- // canClickNode: {
38
- // name: "点击节点",
39
- // type: "canClickNode",
40
- // event: "clickNode"
41
- // },
42
- // canBlurNode: {
43
- // name: "节点失去焦点",
44
- // type: "canBlurNode",
45
- // event: "blurNode"
46
- // }
47
- // }
14
+ boxWidth: 0
48
15
  };
49
16
  },
50
17
  computed: {
@@ -64,7 +31,7 @@ export default {
64
31
  // 替换tableBaseMixin里的
65
32
  showCreateBtnColKeys () {
66
33
  return [
67
- ...this.treeForm.map(treeFormItem => treeFormItem._key),
34
+ ...this.treeFormKeys,
68
35
  ...(this.selfPropsObj._showCreateBtnColKeys || [])
69
36
  ];
70
37
  },
@@ -103,35 +70,10 @@ export default {
103
70
  init () {
104
71
  this.treeColumns.forEach((treeFormItem, treeFormIndex) => {
105
72
  this.$set(treeFormItem, "level", treeFormIndex + 1);
106
- this.$set(treeFormItem, "canDelete", true);
73
+ // this.$set(treeFormItem, "canDelete", true);
107
74
  });
108
75
  },
109
76
 
110
- /* ----------- 操作 ---------- */
111
- // 表头操作 -树形表头-添加一列
112
- clickCreateCol (operationItem, col, colIndex) {
113
- this.treeColumns.push({
114
- _id: this.$ObjectID().str,
115
- _key: this.$randomB36("Field"),
116
- _type: "textarea",
117
- _name: `${this.$numToChinese(this.treeColumns.length + 1)}级表头`,
118
- level: this.treeColumns.length + 1,
119
- canDelete: true,
120
- _treeSubForm: []
121
- });
122
- this.tableDataObj._treeForm = this.treeColumns;
123
-
124
- this.change("createCol", null, null, col);
125
- },
126
- // 表头操作 -树形表头-删除一列
127
- clickDeleteCol (operationItem, col, colIndex) {
128
- this.isDeleteColStatus = true; // isDeleteStatus不用在data中定义
129
- this.treeColumns.pop();
130
- this.tableDataObj._treeForm = this.treeColumns;
131
-
132
- this.change("deleteCol", null, null, col);
133
- },
134
-
135
77
  /* ----------- 渲染函数(声明:为了代码更加规范清晰,return的是h相关的函数,则函数名get开头;return的是h的直接调用,函数名不要get开头)---------- */
136
78
  // 表格表头渲染函数
137
79
  tableHeadRender (h) {
@@ -198,9 +140,6 @@ export default {
198
140
  },
199
141
  this.rowColumnsArr[rowIndex].map(column => {
200
142
  return this.tdRender(h, { row: mixedRow[column.nodeKey || column._key], rowIndex, column });
201
- // return ["tree", "summary"].includes(column.colType)
202
- // ? this.treeTdRender(h, { row: mixedRow[column.nodeKey || column._key], rowIndex, column })
203
- // : this.contentTdRender(h, { row: mixedRow[column.nodeKey || column._key], rowIndex, column });
204
143
  })
205
144
  );
206
145
  })
@@ -229,9 +168,7 @@ export default {
229
168
  style: this.getThStyle(column)
230
169
  },
231
170
  [
232
- this.contentThCellRender(h, { column, colIndex }),
233
-
234
- this.treeThDropOperationRender(h, { column, colIndex })
171
+ this.contentThCellRender(h, { column, colIndex })
235
172
  ]);
236
173
  },
237
174
  emptyTdRender (h, { row, rowIndex, column }) {
@@ -261,71 +198,21 @@ export default {
261
198
  },
262
199
  on: {
263
200
  mouseenter: (event) => {
264
- this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
201
+ this.$set(this.hoverRecordMap, `${row._id}`, true);
202
+ // this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
265
203
  },
266
204
  mouseleave: (event) => {
267
- this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, false);
205
+ this.$set(this.hoverRecordMap, `${row._id}`, false);
206
+ // this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, false);
268
207
  }
269
208
  }
270
209
  },
271
210
  column.colType === "summary"
272
211
  ? h("span", this.getSummaryTdVal(row, rowIndex, column))
273
- : column.colType === "tree"
274
- ? this.contentTdCellRender(h, { row, rowIndex, column }, "tree")
275
- : column.colType === "operation"
276
- ? this.operationTdCellRender(h, { row, rowIndex, column })
277
- : this.contentTdCellRender(h, { row, rowIndex, column })
278
- );
279
- },
280
- // 树形表头最末级列的下拉渲染函数
281
- treeThDropOperationRender (h, { column, colIndex }) {
282
- const list = this.$getOperationList(
283
- column.colType === "tree" && column.level === this.treeColumns.length
284
- ? [
285
- ...(column.level < this.maxLevel ? ["canCreateCol"] : []), // 限制最大添加到几级
286
- ...(column.canDelete === true ? ["canDeleteCol"] : []) // 只有一级和最后两级节点数不一致时,不能删
287
- ]
288
- : []
212
+ : column.colType === "operation"
213
+ ? this.operationTdCellRender(h, { row, rowIndex, column })
214
+ : this.contentTdCellRender(h, { row, rowIndex, column })
289
215
  );
290
-
291
- return !this.isSearching &&
292
- list.length
293
- ? h("dsh-dropdown", {
294
- class: "bri-table-dropdown",
295
- props: {
296
- menuClass: "bri-table-dropdown-list",
297
- trigger: "hover",
298
- list: list
299
- },
300
- on: {
301
- click: (operationItem) => {
302
- this.$dispatchEvent(operationItem, column, colIndex);
303
- }
304
- },
305
- nativeOn: {
306
- click: (e) => {
307
- e.stopPropagation();
308
- }
309
- }
310
- }, [
311
- h("a", {
312
- style: {
313
- fontWeight: "500",
314
- color: this.appColor
315
- },
316
- attrs: {
317
- href: "javascript:void(0)"
318
- }
319
- }, [
320
- h("Icon", {
321
- props: {
322
- type: "md-arrow-dropdown-circle",
323
- size: "16"
324
- }
325
- })
326
- ])
327
- ])
328
- : undefined;
329
216
  },
330
217
 
331
218
  /* ----------- 方法 ---------- */
@@ -343,7 +230,7 @@ export default {
343
230
  maxWidth: `${width}px`,
344
231
  paddingTop: !this.headHeightAuto ? "10px" : undefined,
345
232
  paddingBottom: !this.headHeightAuto ? "10px" : undefined,
346
- align: col._align || typeData.align,
233
+ textAlign: col._align || typeData.align,
347
234
  "word-break": "break-all",
348
235
  cursor: "pointer"
349
236
  };
@@ -401,6 +288,18 @@ export default {
401
288
  return (this.getIsDftRow(row) ? !this.dftReadonlyTreeColKeys.includes(col._key) : true) && // 默认行的某列是否可编辑
402
289
  (row.__old__ === true ? !this.oldReadonlyTreeColKeys.includes(col._key) : true); // 老数据行里某些列不可编辑
403
290
  },
291
+ // getNewRowData时,额外补充的行相关的数据(针对层级属性的列)
292
+ getRowOtherDft (level, list) {
293
+ const column = this.treeForm[level - 1];
294
+ const dftVal = column._default;
295
+ const initDftVal = this.initDftValMap[column._type];
296
+
297
+ return {
298
+ name: this.$isEmptyData(dftVal)
299
+ ? initDftVal
300
+ : dftVal
301
+ };
302
+ },
404
303
 
405
304
  /* ----------- 工具方法 ---------- */
406
305
  // 合并表头
@@ -440,54 +339,44 @@ export default {
440
339
  // 转化树数据
441
340
  getCalcuedTree (nodes = [], treeForm = [], subForm = []) {
442
341
  treeForm.forEach((treeFormItem, treeFormIndex) => {
443
- treeFormItem.canDelete = true; // 每次计算,重置一下
342
+ // treeFormItem.canDelete = true; // 每次计算,重置一下
444
343
  treeFormItem.level = treeFormIndex + 1; // treeColumns更新,缺少level
445
344
  });
446
345
 
447
346
  // 循环遍树节点
448
- const loop = (nodes = []) => {
347
+ const loop = (nodes = [], parentNodes = []) => {
449
348
  nodes.forEach(rowItem => {
450
349
  // 初始化树节点的数据,给节点加上一些属性并监测,注入到节点对象中
451
350
  let curCol = treeForm[rowItem.level - 1];
452
351
  this.$setObj(rowItem, {
453
352
  _key: curCol._key,
454
353
  level: curCol.level,
455
- isEdit: false,
456
354
  isLeaf: false,
457
355
  total: 1
458
356
  });
459
357
 
460
358
  // 最后一列(根节点)
461
359
  if (rowItem.level === treeForm.length) {
462
- // 处理删除了最后一列后,把根节点上的subForm属性值全部给上级节点
463
- if (this.isDeleteColStatus) {
464
- let subNode = rowItem.children[0];
465
- subForm.forEach(subFormItem => {
466
- // 用$set也可以
467
- rowItem[subFormItem._key] = subNode[subFormItem._key];
468
- });
469
- }
470
-
471
360
  rowItem.children = [];
472
361
  rowItem.isLeaf = true;
362
+
363
+ // TODO:特殊处理-叶子节点上注入对应表头列们的name值
364
+ const treeNodes = [...parentNodes, rowItem];
365
+ treeForm.forEach((treeFormItem, treeFormIndex) => {
366
+ rowItem[treeFormItem._key] = treeNodes[treeFormIndex].name;
367
+ });
473
368
  }
474
369
  // 非最后一列(最后一列前的列,非根节点),需继续向下循环
475
370
  else {
476
- // 判断是否能删除最后一列(1.判断条件:判断根节点列的前一列的所有节点 都必须只有一个子结点 2.canDelete放在表头treeForm最后一项,默认true)
477
- if (rowItem.level === treeForm.length - 1) {
478
- if (rowItem.children.length > 1) {
479
- treeForm[rowItem.level].canDelete = false;
480
- }
481
- }
482
-
483
371
  // 非最后一列的 正常的非根节点
484
372
  if (rowItem.children && rowItem.children.length) {
485
- loop(rowItem.children);
373
+ loop(rowItem.children, [...parentNodes, rowItem]);
486
374
  }
487
375
  // 非最后一列的 新增的非根节点(此时是新增一列或新增非根节点行) -添加一个子节点,并把该节点上的subForm属性值全部给下级节点
488
376
  // 特别提示:新增的是根节点行,不会走此处代码
489
377
  else {
490
378
  const newNode = this.getNewRowData(rowItem.level + 1, rowItem.children);
379
+
491
380
  subForm.forEach(subFormItem => {
492
381
  // 用$set也可以
493
382
  newNode[subFormItem._key] = rowItem[subFormItem._key];
@@ -495,7 +384,7 @@ export default {
495
384
  });
496
385
  rowItem.children.push(newNode);
497
386
 
498
- loop(rowItem.children);
387
+ loop(rowItem.children, [...parentNodes, rowItem]);
499
388
  }
500
389
  }
501
390
 
@@ -510,7 +399,7 @@ export default {
510
399
  },
511
400
  // 转化渲染使用的columns数组
512
401
  transformRowColumnsArr (nodes = [], treeForm = []) {
513
- let loop = (nodes, rowColumnsArr) => {
402
+ const loop = (nodes = [], rowColumnsArr = []) => {
514
403
  nodes = this.getFilteredNodes(nodes);
515
404
 
516
405
  return nodes.reduce((rowColumnsArr, node, nodeIndex) => {
@@ -528,11 +417,11 @@ export default {
528
417
  }, rowColumnsArr);
529
418
  };
530
419
 
531
- return loop(nodes, []);
420
+ return loop(nodes);
532
421
  },
533
422
  // 转化表格数据
534
423
  transformRows (nodes = [], treeForm = []) {
535
- const loop = (nodes, rows) => {
424
+ const loop = (nodes = [], rows = []) => {
536
425
  nodes = this.getFilteredNodes(nodes);
537
426
 
538
427
  return nodes.reduce((rows, node, nodeIndex) => {
@@ -555,12 +444,16 @@ export default {
555
444
  }
556
445
  }, rows);
557
446
  };
558
- return loop(nodes, []);
447
+ return loop(nodes);
559
448
  },
560
449
  getFilteredNodes (nodes = []) {
561
450
  const loop = (nodes = []) => {
562
451
  return nodes.filter(rowItem => {
563
452
  if (rowItem.children && rowItem.children.length) {
453
+ if (this.isSearching) {
454
+ rowItem.__isSearchShow__ = true;
455
+ }
456
+
564
457
  const children = loop(rowItem.children);
565
458
  return !!children.length;
566
459
  } else {
@@ -571,176 +464,5 @@ export default {
571
464
 
572
465
  return loop(nodes);
573
466
  }
574
- // // 树形、汇总节点操作 -点击
575
- // clickNode (operationItem, row, rowIndex, col) {
576
- // if (col.colType === "tree") {
577
- // if (
578
- // (this.getIsDftRow(row) ? !this.dftReadonlyTreeColKeys.includes(col._key) : true) && // 默认行的某列是否可编辑
579
- // (row.__old__ === true ? !this.oldReadonlyTreeColKeys.includes(col._key) : true) // 老数据行里某些列不可编辑
580
- // ) {
581
- // row.isEdit = true;
582
- // this.$nextTick(() => {
583
- // this.$refs[`${col._id}${row._id}`] && this.$refs[`${col._id}${row._id}`].focus();
584
- // });
585
- // }
586
- // }
587
- // else if (col.colType === "summary") {
588
- // this.$Modal.warning({
589
- // title: "该汇总单元格自动计算,不准手动输入!",
590
- // closable: true,
591
- // onOk: () => { },
592
- // onCancel: () => { }
593
- // });
594
- // }
595
- // },
596
- // // 树形节点操作 -失去焦点
597
- // blurNode (operationItem, row, rowIndex, col) {
598
- // row.isEdit = false;
599
- // },
600
- // // 树形节点操作 -值改变
601
- // changeNode (operationItem, row, rowIndex, col) {
602
- // this.change("changeNode", row, rowIndex, col);
603
- // },
604
-
605
- // // 树节点单元格、汇总单元格渲染函数
606
- // treeTdRender (h, { row, rowIndex, column }) {
607
- // return h("td", {
608
- // class: {
609
- // "bri-table-td": true, // 可以不要,为了position: relative,下面有
610
- // "bri-table-td-edit": this.canEdit,
611
- // "bri-table-td-merge": column.colType === "tree"
612
- // },
613
- // style: this.getTdStyle(row, rowIndex, column),
614
- // attrs: {
615
- // rowspan: this.getTdRowSpan(row, rowIndex, column),
616
- // colspan: this.getTdColSpan(row, rowIndex, column)
617
- // },
618
- // on: {
619
- // click: () => {
620
- // this.$dispatchEvent(this.operationMap.canClickNode, row, rowIndex, column);
621
- // }
622
- // }
623
- // }, [
624
- // column.colType === "tree"
625
- // // 树节点单元格
626
- // ? row.isEdit
627
- // // 编辑状态
628
- // ? h("Input", {
629
- // ref: `${column._id}${row._id}`,
630
- // props: {
631
- // value: row.name,
632
- // type: "textarea",
633
- // autosize: {
634
- // minRows: this.getTdRowSpan(row, rowIndex, column) * 3 - 1,
635
- // maxRows: 100
636
- // }
637
- // },
638
- // on: {
639
- // input: val => {
640
- // row.name = val;
641
- // },
642
- // "on-blur": () => {
643
- // this.$dispatchEvent(this.operationMap.canBlurNode, row, rowIndex, column);
644
- // },
645
- // "on-change": () => {
646
- // this.$dispatchEvent(this.operationMap.canChangeNode, row, rowIndex, column);
647
- // }
648
- // }
649
- // })
650
- // // 查看状态
651
- // : [
652
- // h("bri-tooltip", {
653
- // props: {
654
- // content: this.$transformEnterToBr(row.name),
655
- // transfer: true
656
- // }
657
- // }, [
658
- // h("span", {
659
- // domProps: {
660
- // innerHTML: this.$transformEnterToBr(row.name)
661
- // }
662
- // })
663
- // ]),
664
-
665
- // // 操作下拉
666
- // this.treeTdDropOperationRender(h, { row, rowIndex, column })
667
- // ]
668
- // // 汇总单元格
669
- // : h("span", this.getSummaryTdVal(row, rowIndex, column))
670
- // ]);
671
- // },
672
- // // 普通单元格渲染函数
673
- // contentTdRender (h, { row, rowIndex, column }) {
674
- // return h(
675
- // "td",
676
- // {
677
- // class: this.bodyCellClass({ row, rowIndex, column }),
678
- // style: this.getTdStyle(row, rowIndex, column),
679
- // on: {
680
- // mouseenter: (event) => {
681
- // this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
682
- // },
683
- // mouseleave: (event) => {
684
- // this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, false);
685
- // }
686
- // }
687
- // },
688
- // this.contentTdCellRender(h, { row, rowIndex, column })
689
- // );
690
- // },
691
- // // 树形单元格的下拉渲染函数
692
- // treeTdDropOperationRender (h, { row, rowIndex, column }) {
693
- // const list = this.$getOperationList([
694
- // "canCreate",
695
- // ...(this.getRowDelBtnCanEdit(row, rowIndex) ? ["canDelete"] : []),
696
- // ...(
697
- // row.isLeaf === true
698
- // ? []
699
- // : [
700
- // "canCreateChild",
701
- // ...(this.getRowDelBtnCanEdit(row, rowIndex) ? ["canDeleteChilds"] : [])
702
- // ]
703
- // )
704
- // ]);
705
-
706
- // return !this.isSearching &&
707
- // list.length
708
- // ? h("dsh-dropdown", {
709
- // class: "bri-table-dropdown",
710
- // props: {
711
- // menuClass: "bri-table-dropdown-list",
712
- // trigger: "hover",
713
- // list: list
714
- // },
715
- // on: {
716
- // click: (operationItem) => {
717
- // this.$dispatchEvent(operationItem, row, rowIndex, column);
718
- // }
719
- // },
720
- // nativeOn: {
721
- // click: (e) => {
722
- // e.stopPropagation();
723
- // }
724
- // }
725
- // }, [
726
- // h("a", {
727
- // style: {
728
- // fontWeight: "500",
729
- // color: this.appColor
730
- // },
731
- // attrs: {
732
- // href: "javascript:void(0)"
733
- // }
734
- // }, [
735
- // h("Icon", {
736
- // props: {
737
- // type: "md-arrow-dropdown-circle",
738
- // size: "16"
739
- // }
740
- // })
741
- // ])
742
- // ])
743
- // : undefined;
744
- // }
745
467
  }
746
468
  };
@@ -38,7 +38,7 @@ export default {
38
38
  };
39
39
  }, {
40
40
  _id: this.$ObjectID().str,
41
- __index__: "汇总",
41
+ __treeIndex__: "汇总",
42
42
  __isExpand__: "-",
43
43
  __operation__: "——"
44
44
  })
@@ -97,9 +97,9 @@ export default {
97
97
  indexColumn () {
98
98
  return {
99
99
  title: "序号",
100
- _key: "__index__",
101
- key: "__index__",
102
- field: "__index__",
100
+ _key: "__treeIndex__",
101
+ key: "__treeIndex__",
102
+ field: "__treeIndex__",
103
103
  width: 28 + 16 + (this.maxLevel - 1) * 38,
104
104
  align: "left",
105
105
  fixed: "left",
@@ -126,9 +126,9 @@ export default {
126
126
  }
127
127
  },
128
128
  otherOperationMap: {
129
- changeVal: {
129
+ canChangeVal: {
130
130
  name: "改变输入框值",
131
- type: "changeVal",
131
+ type: "canChangeVal",
132
132
  event: "changeVal"
133
133
  }
134
134
  },
@@ -166,7 +166,7 @@ export default {
166
166
  event: "clickExport"
167
167
  },
168
168
  canEnlarge: {
169
- name: "全屏展示",
169
+ name: "全屏",
170
170
  type: "canEnlarge",
171
171
  icon: "md-expand",
172
172
  size: "small",
@@ -251,14 +251,15 @@ export default {
251
251
  }, // 引用列表筛选条件
252
252
  _isImport: false, // 导入
253
253
  _isExport: false, // 导出
254
+ _useEnlarge: true, // 全屏
254
255
 
255
256
  _default: {
256
257
  rowDefault: {},
257
258
  list: [],
258
259
  tree: []
259
260
  },
260
- ...(this.selfBasePropsObj || {}),
261
261
 
262
+ ...(this.selfBasePropsObj || {}),
262
263
  ...this.propsObj
263
264
  };
264
265
  },
@@ -386,7 +387,7 @@ export default {
386
387
  : this.allListData.length;
387
388
  },
388
389
  rowsNumStr () {
389
- return `当前${this.isSearching ? "筛选" : "全部"}数据, 共 ${this.rowsNum} ${this.showMode === "form" ? "条" : "行"}`;
390
+ return `当前${this.isSearching ? "筛选" : "全部"}数据, 共 ${this.rowsNum} ${this.showMode === "form" ? "条" : "行"};`;
390
391
  },
391
392
 
392
393
  /* 数据 */
@@ -427,14 +428,14 @@ export default {
427
428
  parentDataId () {
428
429
  return this.parentObj._id;
429
430
  },
430
- selfRowDefault () {
431
+ selfRowDft () {
431
432
  return this.selfColumns.reduce((obj, column) => {
432
433
  const dftInRowVal = this.rowDefault[column._key];
433
434
  const dftVal = column._default;
434
435
  const initDftVal = this.initDftValMap[column._type];
435
436
 
436
437
  return Object.assign(obj, {
437
- [column._key]: dftInRowVal === undefined
438
+ [column._key]: this.$isEmptyData(dftInRowVal)
438
439
  ? this.$isEmptyData(dftVal)
439
440
  ? initDftVal
440
441
  : dftVal
@@ -527,25 +528,7 @@ export default {
527
528
  bodyCellSpan: this.bodyCellSpan
528
529
  },
529
530
  eventCustomOption: {
530
- bodyCellEvents: ({ row, rowIndex, column }) => {
531
- return {
532
- click: (event) => {
533
- // console.log("click::", row, rowIndex, column, event);
534
- },
535
- dblclick: (event) => {
536
- // console.log("dblclick::", row, rowIndex, column, event);
537
- },
538
- contextmenu: (event) => {
539
- // console.log("contextmenu::", row, rowIndex, column, event);
540
- },
541
- mouseenter: (event) => {
542
- this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
543
- },
544
- mouseleave: (event) => {
545
- this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, false);
546
- }
547
- };
548
- }
531
+ bodyCellEvents: this.eventCustomOption
549
532
  }
550
533
  };
551
534
  },
@@ -607,6 +590,9 @@ export default {
607
590
  advSearch: this.finalTableAdvSearch
608
591
  };
609
592
  },
593
+ useEnlarge () {
594
+ return this.selfPropsObj._useEnlarge;
595
+ },
610
596
  modalPropsObj () {
611
597
  return {
612
598
  mode: "fullscreen",
@@ -649,22 +635,21 @@ export default {
649
635
  this.allOperationMap,
650
636
  undefined,
651
637
  undefined,
652
- this.canEdit
653
- ? [
654
- ...(this.disabledBtns ? [] : this.baseOperationBtns),
655
- ...this.otherOperationBtns,
656
- ...(this.isQuote ? ["canQuote"] : []),
657
- ...(this.isImport ? ["canImport"] : []),
658
-
659
- ...(this.isExport ? ["canExport"] : []),
660
- ...(this.hideColKeys.length ? ["canHideOrShow"] : []),
661
- "canEnlarge"
662
- ]
663
- : [
664
- ...(this.isExport ? ["canExport"] : []),
665
- ...(this.hideColKeys.length ? ["canHideOrShow"] : []),
666
- "canEnlarge"
667
- ]
638
+ [
639
+ ...(
640
+ this.canEdit
641
+ ? [
642
+ ...(this.disabledBtns ? [] : this.baseOperationBtns),
643
+ ...this.otherOperationBtns,
644
+ ...(this.isQuote ? ["canQuote"] : []),
645
+ ...(this.isImport ? ["canImport"] : [])
646
+ ]
647
+ : []
648
+ ),
649
+ ...(this.isExport ? ["canExport"] : []),
650
+ ...(this.useEnlarge ? ["canEnlarge"] : []),
651
+ ...(this.hideColKeys.length ? ["canHideOrShow"] : [])
652
+ ]
668
653
  );
669
654
  }
670
655
  },
@@ -918,7 +903,7 @@ export default {
918
903
  },
919
904
 
920
905
  /* ----------- 渲染函数(声明:为了代码更加规范清晰,return的是h相关的函数,则函数名get开头;return的是h的直接调用,函数名不要get开头)---------- */
921
- getTableTopRender (isEnlarge = false) {
906
+ getTableTopRender (inEnlarge = false) {
922
907
  return (h, params) => {
923
908
  return h("div", {
924
909
  style: {
@@ -930,43 +915,29 @@ export default {
930
915
  }
931
916
  }, [
932
917
  // 左 -统计,逻辑
933
- this.topSummaryRender(h, params),
918
+ this.topSummaryRender(h),
934
919
 
935
920
  // 右 -功能按钮
936
- isEnlarge ? undefined : this.topOperationRender(h, params)
921
+ this.topOperationRender(h, inEnlarge)
937
922
  ]);
938
923
  };
939
924
  },
940
- topSearchRender (h) {
941
- return this.searchFormList.length
942
- ? h("dsh-default-search", {
943
- props: {
944
- formList: this.searchFormList,
945
- initValue: this.dftAdvSearch.conditions,
946
- labelWidth: this.searchLabelWidth
947
- },
948
- on: {
949
- change: this.searchCb
950
- }
951
- })
952
- : undefined;
953
- },
954
925
  topSummaryRender (h) {
955
- return h("div", {
956
- style: {
957
- "display": "flex",
958
- "flex-direction": "row",
959
- "align-items": "center"
960
- }
961
- }, [
962
- h("span", {
926
+ return this.searchFormList.length
927
+ ? h("div", {
963
928
  style: {
964
- "font-weight": "500"
929
+ "display": "flex",
930
+ "flex-direction": "row",
931
+ "align-items": "center"
965
932
  }
966
- }, this.rowsNumStr + ";"),
933
+ }, [
934
+ h("span", {
935
+ style: {
936
+ "font-weight": "500"
937
+ }
938
+ }, this.rowsNumStr),
967
939
 
968
- this.searchFormList.length
969
- ? h("div", {
940
+ h("div", {
970
941
  style: {
971
942
  "display": "flex",
972
943
  "flex-direction": "row",
@@ -991,30 +962,47 @@ export default {
991
962
  }
992
963
  })
993
964
  ])
994
- : undefined
995
- ]);
996
- },
997
- topOperationRender (h) {
998
- return h("dsh-buttons", {
999
- style: {
1000
- "text-align": "right"
1001
- },
1002
- props: {
1003
- itemClass: undefined,
1004
- list: this.$getOperationList(this.topOperationBtns)
1005
- },
1006
- on: {
1007
- click: (event) => {
1008
- this.$dispatchEvent(event);
1009
- }
1010
- },
1011
- nativeOn: {
1012
- click: (e) => {
1013
- e.stopPropagation();
965
+ ])
966
+ : h("div", "");
967
+ },
968
+ // 全屏里不显示功能按钮
969
+ topOperationRender (h, inEnlarge) {
970
+ return inEnlarge
971
+ ? undefined
972
+ : h("dsh-buttons", {
973
+ style: {
974
+ "text-align": "right"
975
+ },
976
+ props: {
977
+ itemClass: undefined,
978
+ list: this.$getOperationList(this.topOperationBtns)
979
+ },
980
+ on: {
981
+ click: (event) => {
982
+ this.$dispatchEvent(event);
983
+ }
984
+ },
985
+ nativeOn: {
986
+ click: (e) => {
987
+ e.stopPropagation();
988
+ }
1014
989
  }
1015
- }
1016
990
  });
1017
991
  },
992
+ topSearchRender (h) {
993
+ return this.searchFormList.length
994
+ ? h("dsh-default-search", {
995
+ props: {
996
+ formList: this.searchFormList,
997
+ initValue: this.dftAdvSearch.conditions,
998
+ labelWidth: this.searchLabelWidth
999
+ },
1000
+ on: {
1001
+ change: this.searchCb
1002
+ }
1003
+ })
1004
+ : undefined;
1005
+ },
1018
1006
  createBtnRender (h) {
1019
1007
  return !this.isSearching && this.disabledFootCreateBtn !== true
1020
1008
  ? h("dsh-buttons", {
@@ -1042,7 +1030,7 @@ export default {
1042
1030
  headHeightAuto: this.headHeightAuto
1043
1031
  });
1044
1032
  },
1045
- contentTdCellRender (h, { row, rowIndex, column }, position) {
1033
+ contentTdCellRender (h, { row, rowIndex, column }) {
1046
1034
  column = this.$transformDynamicProperty(column, row, this.parentObj);
1047
1035
  column = this.getResetCol(row, rowIndex, column);
1048
1036
  const unitCanEdit = this.getUnitCanEdit(row, rowIndex, column);
@@ -1069,8 +1057,15 @@ export default {
1069
1057
  formData: row,
1070
1058
  formItem: {
1071
1059
  ...column,
1072
- _key: position === "tree" ? "name" : column._key,
1073
- _heightAuto: column._heightAuto || position === "tree"
1060
+ ...(
1061
+ column.colType === "tree"
1062
+ ? {
1063
+ _key: "name",
1064
+ _heightAuto: true,
1065
+ _placeholder: " "
1066
+ }
1067
+ : column
1068
+ )
1074
1069
  },
1075
1070
  allFormList: this.selfColumns,
1076
1071
  inTableType: this.inTableType,
@@ -1081,7 +1076,7 @@ export default {
1081
1076
  },
1082
1077
  on: {
1083
1078
  blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
1084
- change: () => this.$dispatchEvent(this.operationMap.changeVal, row, rowIndex, column, arguments)
1079
+ change: () => this.$dispatchEvent(this.operationMap.canChangeVal, row, rowIndex, column, arguments)
1085
1080
  }
1086
1081
  })
1087
1082
  }
@@ -1092,8 +1087,15 @@ export default {
1092
1087
  formData: row,
1093
1088
  formItem: {
1094
1089
  ...column,
1095
- _key: position === "tree" ? "name" : column._key,
1096
- _heightAuto: column._heightAuto || position === "tree"
1090
+ ...(
1091
+ column.colType === "tree"
1092
+ ? {
1093
+ _key: "name",
1094
+ _heightAuto: true,
1095
+ _placeholder: " "
1096
+ }
1097
+ : column
1098
+ )
1097
1099
  },
1098
1100
  allFormList: this.selfColumns,
1099
1101
  inTableType: this.inTableType,
@@ -1104,7 +1106,7 @@ export default {
1104
1106
  },
1105
1107
  on: {
1106
1108
  blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
1107
- change: () => this.$dispatchEvent(this.operationMap.changeVal, row, rowIndex, column, arguments)
1109
+ change: () => this.$dispatchEvent(this.operationMap.canChangeVal, row, rowIndex, column, arguments)
1108
1110
  }
1109
1111
  }),
1110
1112
 
@@ -1139,12 +1141,15 @@ export default {
1139
1141
  ];
1140
1142
  },
1141
1143
  operationIconRender (h, { row, rowIndex, column }, iconSize = 14) {
1144
+ const baseBool = !this.isSearching &&
1145
+ (this.showCreateBtnColKeys.length ? this.showCreateBtnColKeys.includes(column._key) : ["__index__", "__treeIndex__"].includes(column._key)) &&
1146
+ this.hoverRecordMap[`${row._id}`];
1147
+ // this.hoverRecordMap[`${row._id}dsh${column._key}`]
1148
+
1142
1149
  return [
1143
1150
  // 插入一行图标
1144
1151
  (this.operationMap.canCreate && this.operationMap.canCreate.disabled !== true) &&
1145
- !this.isSearching &&
1146
- (column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
1147
- this.hoverRecordMap[`${row._id}dsh${column._key}`]
1152
+ baseBool
1148
1153
  ? h("div", {
1149
1154
  style: {
1150
1155
  position: "absolute",
@@ -1189,9 +1194,7 @@ export default {
1189
1194
 
1190
1195
  // 添加一行下级图标
1191
1196
  (this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true) &&
1192
- !this.isSearching &&
1193
- (column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
1194
- this.hoverRecordMap[`${row._id}dsh${column._key}`] &&
1197
+ baseBool &&
1195
1198
  row.level < this.maxLevel &&
1196
1199
  !["cascaderTable"].includes(this.inTableType) // 老版级联表格类型不要“添加下级”图标
1197
1200
  ? h("div", {
@@ -1239,9 +1242,7 @@ export default {
1239
1242
 
1240
1243
  // 删除该行图标
1241
1244
  (this.operationMap.canDelete && this.operationMap.canDelete.disabled !== true) &&
1242
- !this.isSearching &&
1243
- (column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
1244
- this.hoverRecordMap[`${row._id}dsh${column._key}`] &&
1245
+ baseBool &&
1245
1246
  this.getRowDelBtnCanEdit(row, rowIndex) &&
1246
1247
  ["cascaderTable"].includes(this.inTableType)
1247
1248
  ? h("div", {
@@ -1293,9 +1294,13 @@ export default {
1293
1294
  ? " bri-table-td-merge"
1294
1295
  : ""
1295
1296
  }` +
1296
- `${this.getRowCanEdit(row, rowIndex)
1297
- ? " bri-table-td-edit"
1298
- : ""
1297
+ `${["__isExpand__"].includes(column._key)
1298
+ ? " bri-table-td-expand"
1299
+ : ["__treeIndex__"].includes(column._key)
1300
+ ? " bri-table-td-treeIndex"
1301
+ : this.getRowCanEdit(row, rowIndex)
1302
+ ? " bri-table-td-edit"
1303
+ : ""
1299
1304
  }` +
1300
1305
  `${this.isSearching
1301
1306
  ? row.__isSearchShow__ === false
@@ -1306,32 +1311,41 @@ export default {
1306
1311
  ? " bri-table-td-visible"
1307
1312
  : ""
1308
1313
  : " bri-table-td-hide"
1309
- }` +
1310
- `${["__isExpand__"].includes(column._key)
1311
- ? " bri-table-td-expand"
1312
- : ["__index__"].includes(column._key)
1313
- ? " bri-table-td-index"
1314
- : ""
1315
1314
  }`;
1316
1315
  },
1316
+ eventCustomOption ({ row, rowIndex, column }) {
1317
+ return {
1318
+ click: (event) => {
1319
+ // console.log("click::", row, rowIndex, column, event);
1320
+ },
1321
+ dblclick: (event) => {
1322
+ // console.log("dblclick::", row, rowIndex, column, event);
1323
+ },
1324
+ contextmenu: (event) => {
1325
+ // console.log("contextmenu::", row, rowIndex, column, event);
1326
+ },
1327
+ mouseenter: (event) => {
1328
+ this.$set(this.hoverRecordMap, `${row._id}`, true);
1329
+ // this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
1330
+ },
1331
+ mouseleave: (event) => {
1332
+ this.$set(this.hoverRecordMap, `${row._id}`, false);
1333
+ // this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, false);
1334
+ }
1335
+ };
1336
+ },
1317
1337
 
1318
1338
  /* ----------- 方法 ---------- */
1319
1339
  // 生成新的一行数据
1320
1340
  getNewRowData (level, list) {
1321
1341
  if (["cascaderTable"].includes(this.controlType)) {
1322
1342
  return {
1323
- ...this.$deepCopy(this.selfRowDefault),
1343
+ ...this.$deepCopy(this.selfRowDft),
1344
+ ...(this.getRowOtherDft ? this.$deepCopy(this.getRowOtherDft(level, list)) : {}),
1324
1345
  _id: this.$ObjectID().str,
1325
1346
  level: level,
1326
1347
  isLeaf: true,
1327
1348
  children: [],
1328
- ...(
1329
- ["treeTable"].includes(this.inTableType)
1330
- ? {}
1331
- : {
1332
- name: `${this.$numToChinese(level)}级节点${list.length + 1}`
1333
- }
1334
- ),
1335
1349
  // __old__: false,
1336
1350
  __isDefault__: this.isDftSet,
1337
1351
  __isRendered__: true,
@@ -1342,7 +1356,7 @@ export default {
1342
1356
  };
1343
1357
  } else {
1344
1358
  return {
1345
- ...this.$deepCopy(this.selfRowDefault),
1359
+ ...this.$deepCopy(this.selfRowDft),
1346
1360
  _id: this.$ObjectID().str,
1347
1361
  // __old__: false,
1348
1362
  __isDefault__: this.isDftSet,
@@ -1425,7 +1439,6 @@ export default {
1425
1439
  return {
1426
1440
  // isShare: this.isShare,
1427
1441
  ...col,
1428
- _optionKind: "dropdown",
1429
1442
  _heightAuto: this.heightAuto
1430
1443
  };
1431
1444
  },
@@ -42,6 +42,9 @@ export default {
42
42
  treeForm () {
43
43
  return this.selfPropsObj._treeForm;
44
44
  },
45
+ treeFormKeys () {
46
+ return this.treeForm.map(treeFormItem => treeFormItem._key);
47
+ },
45
48
  maxLevel () {
46
49
  return this.selfPropsObj._maxLevel || 3;
47
50
  },
@@ -171,7 +171,7 @@
171
171
  &-expand {
172
172
 
173
173
  }
174
- &-index {
174
+ &-treeIndex {
175
175
  padding: 4px 16px 4px 12px!important;
176
176
  }
177
177
  &-operation {