bri-components 1.3.28 → 1.3.29
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
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
},
|
|
186
186
|
// 禁止显示的部门以及部门下人员
|
|
187
187
|
listFilterVals () {
|
|
188
|
-
return this.selfPropsObj._userDepartFilterVals;
|
|
188
|
+
return this.selfPropsObj._userDepartFilterVals || [];
|
|
189
189
|
},
|
|
190
190
|
highSearch () {
|
|
191
191
|
return this.isOnSearch ? true : this.selfPropsObj._highSearch;
|
|
@@ -23,27 +23,26 @@
|
|
|
23
23
|
<tbody>
|
|
24
24
|
<tr>
|
|
25
25
|
<th
|
|
26
|
-
v-for="(
|
|
27
|
-
:key="
|
|
26
|
+
v-for="(column, colIndex) in columns"
|
|
27
|
+
:key="column._id"
|
|
28
28
|
class="table-th bri-table-th"
|
|
29
|
-
:style="getThStyle(
|
|
30
|
-
@click="$dispatchEvent(operationMap.clickTh,
|
|
29
|
+
:style="getThStyle(column, 'th')"
|
|
30
|
+
@click="$dispatchEvent(operationMap.clickTh, column)"
|
|
31
31
|
>
|
|
32
|
-
<dsh-render :render="getHeaderRender(
|
|
32
|
+
<dsh-render :render="getHeaderRender(column)"></dsh-render>
|
|
33
33
|
|
|
34
34
|
<!-- 级联表头 的下拉 -->
|
|
35
35
|
<dsh-dropdown
|
|
36
36
|
v-if="
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
$getOperationList(getColOperationNames(col)).length
|
|
37
|
+
column.colType === 'tree' &&
|
|
38
|
+
column.level === treeColumns.length &&
|
|
39
|
+
$getOperationList(getTreeThBtns(column)).length
|
|
41
40
|
"
|
|
42
41
|
class="table-th-dropdown"
|
|
43
42
|
menuClass="table-th-dropdown-list"
|
|
44
43
|
trigger="hover"
|
|
45
|
-
:list="$getOperationList(
|
|
46
|
-
@click="$dispatchEvent($event,
|
|
44
|
+
:list="$getOperationList(getTreeThBtns(column))"
|
|
45
|
+
@click="$dispatchEvent($event, column, colIndex, columns)"
|
|
47
46
|
@click.native.stop="0"
|
|
48
47
|
>
|
|
49
48
|
<a href="javascript:void(0)">
|
|
@@ -76,53 +75,53 @@
|
|
|
76
75
|
:key="row._id"
|
|
77
76
|
class="table-row"
|
|
78
77
|
>
|
|
79
|
-
<template v-for="
|
|
78
|
+
<template v-for="column in getRowColumns(row, rowIndex)">
|
|
80
79
|
<!-- 树节点单元格、汇总单元格 -->
|
|
81
80
|
<td
|
|
82
|
-
v-if="['tree', 'summary'].includes(
|
|
83
|
-
:key="
|
|
81
|
+
v-if="['tree', 'summary'].includes(column.colType)"
|
|
82
|
+
:key="column._key"
|
|
84
83
|
:class="{
|
|
85
|
-
[`table-td-${
|
|
84
|
+
[`table-td-${column.colType}`]: true,
|
|
86
85
|
'bri-table-td': true , // 可以不要,为了position: relative,上面有
|
|
87
86
|
'bri-table-td-edit': canEdit,
|
|
88
87
|
'bri-table-td-show': !canEdit,
|
|
89
88
|
}"
|
|
90
|
-
:style="getTdStyle(
|
|
91
|
-
:rowspan="geTdRowspan(
|
|
92
|
-
:colspan="geTdColspan(
|
|
93
|
-
@click="$dispatchEvent(operationMap.clickNode,
|
|
89
|
+
:style="getTdStyle(column, row)"
|
|
90
|
+
:rowspan="geTdRowspan(column, row)"
|
|
91
|
+
:colspan="geTdColspan(column, row)"
|
|
92
|
+
@click="$dispatchEvent(operationMap.clickNode, column, row, row[column._key])"
|
|
94
93
|
>
|
|
95
94
|
<!-- 树节点单元格 -->
|
|
96
|
-
<template v-if="
|
|
95
|
+
<template v-if="column.colType === 'tree'">
|
|
97
96
|
<!-- 编辑状态 -->
|
|
98
97
|
<Input
|
|
99
|
-
v-if="row[
|
|
100
|
-
:ref="`${
|
|
101
|
-
v-model="row[
|
|
98
|
+
v-if="row[column._key].isEdit"
|
|
99
|
+
:ref="`${column._id}${row._id}`"
|
|
100
|
+
v-model="row[column._key].name"
|
|
102
101
|
class="textarea"
|
|
103
102
|
type="textarea"
|
|
104
|
-
:autosize="{ minRows: geTdRowspan(
|
|
105
|
-
@on-blur="$dispatchEvent(operationMap.blurNode,
|
|
106
|
-
@on-change="$dispatchEvent(operationMap.changeNode,
|
|
103
|
+
:autosize="{ minRows: geTdRowspan(column, row) * 3 - 1, maxRows: 100 }"
|
|
104
|
+
@on-blur="$dispatchEvent(operationMap.blurNode, column, row, row[column._key])"
|
|
105
|
+
@on-change="$dispatchEvent(operationMap.changeNode, column, row, row[column._key])"
|
|
107
106
|
/>
|
|
108
107
|
|
|
109
108
|
<!-- 查看状态 -->
|
|
110
109
|
<template v-else>
|
|
111
110
|
<bri-tooltip
|
|
112
|
-
:content="enterText(row[
|
|
111
|
+
:content="enterText(row[column._key].name)"
|
|
113
112
|
:transfer="true"
|
|
114
113
|
>
|
|
115
|
-
<span v-html="enterText(row[
|
|
114
|
+
<span v-html="enterText(row[column._key].name)"></span>
|
|
116
115
|
</bri-tooltip>
|
|
117
116
|
|
|
118
117
|
<!-- 操作下拉 -->
|
|
119
118
|
<dsh-dropdown
|
|
120
|
-
v-if="$getOperationList(
|
|
119
|
+
v-if="$getOperationList(getTreeTdBtns(column, row, row[column._key])).length"
|
|
121
120
|
class="table-td-tree-dropdown"
|
|
122
121
|
menuClass="table-td-tree-dropdown-list"
|
|
123
122
|
trigger="hover"
|
|
124
|
-
:list="$getOperationList(
|
|
125
|
-
@click="$dispatchEvent($event, row, rowIndex,
|
|
123
|
+
:list="$getOperationList(getTreeTdBtns(column, row, row[column._key]))"
|
|
124
|
+
@click="$dispatchEvent($event, row, rowIndex, column)"
|
|
126
125
|
@click.native.stop="0"
|
|
127
126
|
>
|
|
128
127
|
<a href="javascript:void(0)">
|
|
@@ -136,28 +135,28 @@
|
|
|
136
135
|
</template>
|
|
137
136
|
|
|
138
137
|
<!-- 汇总单元格 -->
|
|
139
|
-
<template v-else-if="
|
|
140
|
-
<span>{{ getSummaryVal(
|
|
138
|
+
<template v-else-if="column.colType === 'summary'">
|
|
139
|
+
<span>{{ getSummaryVal(column, row) }}</span>
|
|
141
140
|
</template>
|
|
142
141
|
</td>
|
|
143
142
|
|
|
144
143
|
<!-- 普通单元格 -->
|
|
145
144
|
<td
|
|
146
145
|
v-else
|
|
147
|
-
:key="
|
|
146
|
+
:key="column._key + 'data'"
|
|
148
147
|
:class="{
|
|
149
|
-
// [`table-td-${
|
|
148
|
+
// [`table-td-${column.colType}`]: true,
|
|
150
149
|
'bri-table-td': true , // 可以不要,为了position: relative,上面有
|
|
151
150
|
'bri-table-td-edit': canEdit,
|
|
152
151
|
'bri-table-td-show': !canEdit,
|
|
153
152
|
}"
|
|
154
|
-
:style="getTdStyle(
|
|
153
|
+
:style="getTdStyle(column, row)"
|
|
155
154
|
>
|
|
156
155
|
<dsh-list-unit
|
|
157
156
|
:canEdit="canEdit"
|
|
158
|
-
:formData="row[
|
|
157
|
+
:formData="row[column.nodeKey]"
|
|
159
158
|
:formItem="{
|
|
160
|
-
...
|
|
159
|
+
...column,
|
|
161
160
|
_heightAuto: heightAuto
|
|
162
161
|
}"
|
|
163
162
|
:allFormList="subColumns"
|
|
@@ -165,15 +164,15 @@
|
|
|
165
164
|
:parentListData="rows"
|
|
166
165
|
:parentFormList="parentFormList"
|
|
167
166
|
:parentObj="parentObj"
|
|
168
|
-
@blur="controlBlur(null,
|
|
169
|
-
@change="$dispatchEvent(operationMap.changeVal,
|
|
167
|
+
@blur="controlBlur(null, column, row[column.nodeKey], arguments)"
|
|
168
|
+
@change="$dispatchEvent(operationMap.changeVal, column, row[column.nodeKey], arguments)"
|
|
170
169
|
></dsh-list-unit>
|
|
171
170
|
|
|
172
171
|
<span
|
|
173
|
-
v-if="!getColRuleResult(
|
|
172
|
+
v-if="!getColRuleResult(column, row[column.nodeKey], rowIndex).bool"
|
|
174
173
|
class="bri-table-td-tip"
|
|
175
174
|
>
|
|
176
|
-
{{ getColRuleResult(
|
|
175
|
+
{{ getColRuleResult(column, row[column.nodeKey], rowIndex).message }}
|
|
177
176
|
</span>
|
|
178
177
|
</td>
|
|
179
178
|
</template>
|
|
@@ -234,16 +233,6 @@
|
|
|
234
233
|
return {
|
|
235
234
|
widthMap: this.$getModFieldPropertyMap("width"),
|
|
236
235
|
boxWidth: 0,
|
|
237
|
-
getColOperationNames (col) {
|
|
238
|
-
return [
|
|
239
|
-
"createCol",
|
|
240
|
-
...(
|
|
241
|
-
col.level > 1 && col.canDelete === true
|
|
242
|
-
? ["deleteCol"]
|
|
243
|
-
: []
|
|
244
|
-
)
|
|
245
|
-
];
|
|
246
|
-
},
|
|
247
236
|
|
|
248
237
|
allOperationMap: {
|
|
249
238
|
clickTh: {
|
|
@@ -331,38 +320,36 @@
|
|
|
331
320
|
};
|
|
332
321
|
},
|
|
333
322
|
computed: {
|
|
323
|
+
treeData () {
|
|
324
|
+
return this.transforBriTreeData();
|
|
325
|
+
},
|
|
326
|
+
rows () {
|
|
327
|
+
return this.transformRows();
|
|
328
|
+
},
|
|
329
|
+
listData () {
|
|
330
|
+
return this.rows;
|
|
331
|
+
},
|
|
332
|
+
|
|
334
333
|
selfPropsObj () {
|
|
335
334
|
return {
|
|
336
|
-
_useCol: true,
|
|
337
335
|
...this.commonPropsObj,
|
|
338
336
|
|
|
339
337
|
_contentHeight: this.propsObj._contentHeight || 400 // 表格最大高度
|
|
340
338
|
};
|
|
341
339
|
},
|
|
342
|
-
useCol () {
|
|
343
|
-
return this.selfPropsObj._useCol;
|
|
344
|
-
},
|
|
345
340
|
|
|
346
|
-
columns () {
|
|
347
|
-
return this.transformColumns(this.treeColumns);
|
|
348
|
-
},
|
|
349
341
|
filterColumns () {
|
|
350
|
-
return this.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
return this.transforBriTreeData();
|
|
354
|
-
},
|
|
355
|
-
listData () {
|
|
356
|
-
return this.rows;
|
|
342
|
+
return this.subColumns
|
|
343
|
+
.filter(col => col.colType === "data")
|
|
344
|
+
.filter(col => this.$isAdvRelyShow(col, this.listData, this.parentObj, true));
|
|
357
345
|
},
|
|
358
|
-
|
|
359
|
-
return this.
|
|
346
|
+
columns () {
|
|
347
|
+
return this.transformColumns(this.treeColumns);
|
|
360
348
|
},
|
|
361
349
|
// 供表格渲染行使用的columns的数组集合, 每一行columns不一样,组成二重数组
|
|
362
350
|
rowColumnsArr () {
|
|
363
351
|
return this.transformRowColumnsArr();
|
|
364
352
|
},
|
|
365
|
-
|
|
366
353
|
operationMap () {
|
|
367
354
|
return this.canEdit
|
|
368
355
|
? this.$categoryMapToMap(
|
|
@@ -410,10 +397,11 @@
|
|
|
410
397
|
},
|
|
411
398
|
// 整行校验结果
|
|
412
399
|
getRowRuleResult (row, rowIndex) {
|
|
413
|
-
return this.filterColumns.every(
|
|
400
|
+
return this.filterColumns.every(column => this.getColRuleResult(column, row[column.nodeKey], rowIndex).bool);
|
|
414
401
|
},
|
|
415
402
|
// 单元格校验结果
|
|
416
403
|
getColRuleResult (col, row, rowIndex) {
|
|
404
|
+
col = this.$transformFieldProperty(col, row, this.parentObj);
|
|
417
405
|
if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
|
|
418
406
|
return this.$getFieldRuleResult({
|
|
419
407
|
...col,
|
|
@@ -556,10 +544,14 @@
|
|
|
556
544
|
controlBlur (operationItem, col, row, params) {
|
|
557
545
|
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
558
546
|
},
|
|
547
|
+
// 发生变动
|
|
548
|
+
change (...params) {
|
|
549
|
+
this.$emit("change", this.data, ...params);
|
|
550
|
+
},
|
|
559
551
|
|
|
560
552
|
/* ---- 工具方法 ---- */
|
|
561
553
|
// 合并表头
|
|
562
|
-
transformColumns (treeForm = this.treeColumns, subForm = this.
|
|
554
|
+
transformColumns (treeForm = this.treeColumns, subForm = this.filterColumns) {
|
|
563
555
|
return treeForm
|
|
564
556
|
.reduce((arr, treeFormItem, treeFormIndex) => {
|
|
565
557
|
return arr.concat(
|
|
@@ -754,44 +746,6 @@
|
|
|
754
746
|
},
|
|
755
747
|
|
|
756
748
|
/* ----- 模板获值方法 ---- */
|
|
757
|
-
getHeaderRender (column) {
|
|
758
|
-
return (h) => {
|
|
759
|
-
return this.$getHeadRender(h, column, {
|
|
760
|
-
showRequired: this.showRequired,
|
|
761
|
-
showDescription: this.showDescription,
|
|
762
|
-
headHeightAuto: this.headHeightAuto
|
|
763
|
-
});
|
|
764
|
-
};
|
|
765
|
-
},
|
|
766
|
-
getSummaryVal (col, row) {
|
|
767
|
-
if (col._calField && col._operator) {
|
|
768
|
-
const calFieldFormItem = this.subColumns.find(item => item._key === col._calField);
|
|
769
|
-
|
|
770
|
-
if (calFieldFormItem) {
|
|
771
|
-
let loop = (nodes, arr) => {
|
|
772
|
-
return nodes.reduce((arr, node) => {
|
|
773
|
-
if (node.children.length) {
|
|
774
|
-
return loop(node.children, arr);
|
|
775
|
-
} else {
|
|
776
|
-
arr.push(node[col._calField] || 0);
|
|
777
|
-
return arr;
|
|
778
|
-
}
|
|
779
|
-
}, arr);
|
|
780
|
-
};
|
|
781
|
-
let list = loop(row[col.nodeKey].children, []);
|
|
782
|
-
|
|
783
|
-
return this.$calNumList(list, col._operator, calFieldFormItem);
|
|
784
|
-
} else {
|
|
785
|
-
return `来源列${col._calField}被删除`;
|
|
786
|
-
}
|
|
787
|
-
} else {
|
|
788
|
-
return !col._calField && !col._operator
|
|
789
|
-
? "未选择来源列和算法"
|
|
790
|
-
: !col._calField
|
|
791
|
-
? "未选择来源列"
|
|
792
|
-
: "未选择算法";
|
|
793
|
-
}
|
|
794
|
-
},
|
|
795
749
|
getThStyle (col, position) {
|
|
796
750
|
const boxColWidth = this.boxWidth / this.columns.length;
|
|
797
751
|
const defaultWidth = Math.max(boxColWidth, this.widthMap[col._type], (col._name ? col._name.length * 14 : 36) + (col._type === "reference" ? 200 : 26));
|
|
@@ -834,22 +788,70 @@
|
|
|
834
788
|
geTdColspan (col, row) {
|
|
835
789
|
return 1;
|
|
836
790
|
},
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
791
|
+
getHeaderRender (column) {
|
|
792
|
+
return (h) => this.$getHeadRender(h, column, {
|
|
793
|
+
showRequired: this.showRequired,
|
|
794
|
+
showDescription: this.showDescription,
|
|
795
|
+
headHeightAuto: this.headHeightAuto
|
|
796
|
+
});
|
|
797
|
+
},
|
|
798
|
+
getRowColumns (row, rowIndex) {
|
|
799
|
+
const columns = this.rowColumnsArr[rowIndex];
|
|
800
|
+
return columns.map(column =>
|
|
801
|
+
["tree", "summary"].includes(column.colType)
|
|
802
|
+
? column
|
|
803
|
+
: this.$transformFieldProperty(column, row, this.parentObj)
|
|
804
|
+
);
|
|
805
|
+
},
|
|
806
|
+
getSummaryVal (col, row) {
|
|
807
|
+
if (col._calField && col._operator) {
|
|
808
|
+
const calFieldFormItem = this.subColumns.find(item => item._key === col._calField);
|
|
809
|
+
|
|
810
|
+
if (calFieldFormItem) {
|
|
811
|
+
let loop = (nodes, arr) => {
|
|
812
|
+
return nodes.reduce((arr, node) => {
|
|
813
|
+
if (node.children.length) {
|
|
814
|
+
return loop(node.children, arr);
|
|
815
|
+
} else {
|
|
816
|
+
arr.push(node[col._calField] || 0);
|
|
817
|
+
return arr;
|
|
818
|
+
}
|
|
819
|
+
}, arr);
|
|
820
|
+
};
|
|
821
|
+
let list = loop(row[col.nodeKey].children, []);
|
|
822
|
+
|
|
823
|
+
return this.$calNumList(list, col._operator, calFieldFormItem);
|
|
824
|
+
} else {
|
|
825
|
+
return `来源列${col._calField}被删除`;
|
|
826
|
+
}
|
|
841
827
|
} else {
|
|
842
|
-
return
|
|
828
|
+
return !col._calField && !col._operator
|
|
829
|
+
? "未选择来源列和算法"
|
|
830
|
+
: !col._calField
|
|
831
|
+
? "未选择来源列"
|
|
832
|
+
: "未选择算法";
|
|
843
833
|
}
|
|
844
834
|
},
|
|
835
|
+
getTreeThBtns (col) {
|
|
836
|
+
return [
|
|
837
|
+
"createCol",
|
|
838
|
+
...(
|
|
839
|
+
col.level > 1 && col.canDelete === true
|
|
840
|
+
? ["deleteCol"]
|
|
841
|
+
: []
|
|
842
|
+
)
|
|
843
|
+
];
|
|
844
|
+
},
|
|
845
|
+
// 获得节点的 操作下拉列表
|
|
846
|
+
getTreeTdBtns (col, row, nodeData) {
|
|
847
|
+
return nodeData.children.length === 0
|
|
848
|
+
? ["createBrotherNode", "deleteSelfAndChildNodes", "clearNode"]
|
|
849
|
+
: ["createBrotherNode", "createChildNode", "deleteSelfAndChildNodes", "deleteChildNodes", "clearNode", "clearChildNodes"];
|
|
850
|
+
},
|
|
845
851
|
// 回车换行
|
|
846
852
|
enterText (val) {
|
|
847
853
|
let reg = new RegExp(/\n/g);
|
|
848
854
|
return val.replace(reg, "<br/>");
|
|
849
|
-
},
|
|
850
|
-
// 发生变动
|
|
851
|
-
change (...params) {
|
|
852
|
-
this.$emit("change", this.data, ...params);
|
|
853
855
|
}
|
|
854
856
|
}
|
|
855
857
|
};
|
|
@@ -51,7 +51,7 @@ export default {
|
|
|
51
51
|
_showDescription: true, // 表头显示提示
|
|
52
52
|
_headHeightAuto: false, // 表头高度自适应
|
|
53
53
|
_heightAuto: false, // 单元格高度自适应
|
|
54
|
-
_useSelection: false, // 使用选择列
|
|
54
|
+
_useSelection: false, // 使用选择列 -配置端暂时用不到
|
|
55
55
|
_useIndex: true, // 使用序号列
|
|
56
56
|
_useSummary: false, // 使用汇总行
|
|
57
57
|
_disabledBtns: false, // 禁用增删按钮
|