bri-components 1.3.37 → 1.3.39
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 +1 -1
- package/src/components/list/DshCascaderTable.vue +49 -128
- package/src/components/list/DshTreeTable.vue +2 -2
- package/src/components/list/mixins/flatTableMixin.js +3 -141
- package/src/components/list/mixins/tableBaseMixin.js +150 -3
- package/src/components/small/DshModal.vue +1 -1
- package/src/styles/components/small/DshModal.less +9 -1
- package/src/styles/global/base.less +9 -0
- package/src/utils/table.js +2 -1
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
:style="getThStyle(column, 'th')"
|
|
39
39
|
@click="$dispatchEvent(operationMap.clickTh, column)"
|
|
40
40
|
>
|
|
41
|
-
<dsh-render :render="
|
|
41
|
+
<dsh-render :render="getThRender(column)"></dsh-render>
|
|
42
42
|
|
|
43
43
|
<!-- 级联表头 的下拉 -->
|
|
44
44
|
<dsh-dropdown
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
:key="row._id"
|
|
85
85
|
class="table-row"
|
|
86
86
|
>
|
|
87
|
-
<template v-for="column in
|
|
87
|
+
<template v-for="column in rowColumnsArr[rowIndex]">
|
|
88
88
|
<!-- 树节点单元格、汇总单元格 -->
|
|
89
89
|
<td
|
|
90
90
|
v-if="['tree', 'summary'].includes(column.colType)"
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
'bri-table-td-edit': canEdit,
|
|
96
96
|
'bri-table-td-show': !canEdit,
|
|
97
97
|
}"
|
|
98
|
-
:style="getTdStyle(column, row)"
|
|
99
|
-
:rowspan="
|
|
100
|
-
:colspan="
|
|
98
|
+
:style="getTdStyle(column, row[column.nodeKey])"
|
|
99
|
+
:rowspan="getTdRowSpan(column, row[column.nodeKey || column._key])"
|
|
100
|
+
:colspan="getTdColSpan(column, row[column.nodeKey])"
|
|
101
101
|
@click="$dispatchEvent(operationMap.clickNode, column, row, row[column._key])"
|
|
102
102
|
>
|
|
103
103
|
<!-- 树节点单元格 -->
|
|
@@ -109,7 +109,10 @@
|
|
|
109
109
|
v-model="row[column._key].name"
|
|
110
110
|
class="textarea"
|
|
111
111
|
type="textarea"
|
|
112
|
-
:autosize="{
|
|
112
|
+
:autosize="{
|
|
113
|
+
minRows: getTdRowSpan(column, row[column.nodeKey || column._key]) * 3 - 1,
|
|
114
|
+
maxRows: 100
|
|
115
|
+
}"
|
|
113
116
|
@on-blur="$dispatchEvent(operationMap.blurNode, column, row, row[column._key])"
|
|
114
117
|
@on-change="$dispatchEvent(operationMap.changeNode, column, row, row[column._key])"
|
|
115
118
|
/>
|
|
@@ -145,45 +148,16 @@
|
|
|
145
148
|
|
|
146
149
|
<!-- 汇总单元格 -->
|
|
147
150
|
<template v-else-if="column.colType === 'summary'">
|
|
148
|
-
<span>{{ getSummaryVal(column, row) }}</span>
|
|
151
|
+
<span>{{ getSummaryVal(column, row[column.nodeKey]) }}</span>
|
|
149
152
|
</template>
|
|
150
153
|
</td>
|
|
151
154
|
|
|
152
155
|
<!-- 普通单元格 -->
|
|
153
|
-
<
|
|
156
|
+
<dsh-render
|
|
154
157
|
v-else
|
|
155
158
|
:key="column._key + 'data'"
|
|
156
|
-
:
|
|
157
|
-
|
|
158
|
-
'bri-table-td': true , // 可以不要,为了position: relative,上面有
|
|
159
|
-
'bri-table-td-edit': canEdit,
|
|
160
|
-
'bri-table-td-show': !canEdit,
|
|
161
|
-
}"
|
|
162
|
-
:style="getTdStyle(column, row)"
|
|
163
|
-
>
|
|
164
|
-
<dsh-list-unit
|
|
165
|
-
:canEdit="canEdit"
|
|
166
|
-
:formData="row[column.nodeKey]"
|
|
167
|
-
:formItem="{
|
|
168
|
-
...column,
|
|
169
|
-
_heightAuto: heightAuto
|
|
170
|
-
}"
|
|
171
|
-
:allFormList="subColumns"
|
|
172
|
-
:rowIndex="rowIndex"
|
|
173
|
-
:parentListData="rows"
|
|
174
|
-
:parentFormList="parentFormList"
|
|
175
|
-
:parentObj="parentObj"
|
|
176
|
-
@blur="controlBlur(null, column, row[column.nodeKey], arguments)"
|
|
177
|
-
@change="$dispatchEvent(operationMap.changeVal, column, row[column.nodeKey], arguments)"
|
|
178
|
-
></dsh-list-unit>
|
|
179
|
-
|
|
180
|
-
<span
|
|
181
|
-
v-if="!getColRuleResult(column, row[column.nodeKey], rowIndex).bool"
|
|
182
|
-
class="bri-table-td-tip"
|
|
183
|
-
>
|
|
184
|
-
{{ getColRuleResult(column, row[column.nodeKey], rowIndex).message }}
|
|
185
|
-
</span>
|
|
186
|
-
</td>
|
|
159
|
+
:render="getTdRender(column, row, rowIndex)"
|
|
160
|
+
></dsh-render>
|
|
187
161
|
</template>
|
|
188
162
|
</tr>
|
|
189
163
|
</template>
|
|
@@ -237,7 +211,7 @@
|
|
|
237
211
|
:style="getThStyle(column, 'th')"
|
|
238
212
|
@click="$dispatchEvent(operationMap.clickTh, column)"
|
|
239
213
|
>
|
|
240
|
-
<dsh-render :render="
|
|
214
|
+
<dsh-render :render="getThRender(column)"></dsh-render>
|
|
241
215
|
|
|
242
216
|
<!-- 级联表头 的下拉 -->
|
|
243
217
|
<dsh-dropdown
|
|
@@ -283,7 +257,7 @@
|
|
|
283
257
|
:key="row._id"
|
|
284
258
|
class="table-row"
|
|
285
259
|
>
|
|
286
|
-
<template v-for="column in
|
|
260
|
+
<template v-for="column in rowColumnsArr[rowIndex]">
|
|
287
261
|
<!-- 树节点单元格、汇总单元格 -->
|
|
288
262
|
<td
|
|
289
263
|
v-if="['tree', 'summary'].includes(column.colType)"
|
|
@@ -294,9 +268,9 @@
|
|
|
294
268
|
'bri-table-td-edit': canEdit,
|
|
295
269
|
'bri-table-td-show': !canEdit,
|
|
296
270
|
}"
|
|
297
|
-
:style="getTdStyle(column, row)"
|
|
298
|
-
:rowspan="
|
|
299
|
-
:colspan="
|
|
271
|
+
:style="getTdStyle(column, row[column.nodeKey])"
|
|
272
|
+
:rowspan="getTdRowSpan(column, row[column.nodeKey || column._key])"
|
|
273
|
+
:colspan="getTdColSpan(column, row[column.nodeKey])"
|
|
300
274
|
@click="$dispatchEvent(operationMap.clickNode, column, row, row[column._key])"
|
|
301
275
|
>
|
|
302
276
|
<!-- 树节点单元格 -->
|
|
@@ -308,7 +282,10 @@
|
|
|
308
282
|
v-model="row[column._key].name"
|
|
309
283
|
class="textarea"
|
|
310
284
|
type="textarea"
|
|
311
|
-
:autosize="{
|
|
285
|
+
:autosize="{
|
|
286
|
+
minRows: getTdRowSpan(column, row[column.nodeKey || column._key]) * 3 - 1,
|
|
287
|
+
maxRows: 100
|
|
288
|
+
}"
|
|
312
289
|
@on-blur="$dispatchEvent(operationMap.blurNode, column, row, row[column._key])"
|
|
313
290
|
@on-change="$dispatchEvent(operationMap.changeNode, column, row, row[column._key])"
|
|
314
291
|
/>
|
|
@@ -344,45 +321,16 @@
|
|
|
344
321
|
|
|
345
322
|
<!-- 汇总单元格 -->
|
|
346
323
|
<template v-else-if="column.colType === 'summary'">
|
|
347
|
-
<span>{{ getSummaryVal(column, row) }}</span>
|
|
324
|
+
<span>{{ getSummaryVal(column, row[column.nodeKey]) }}</span>
|
|
348
325
|
</template>
|
|
349
326
|
</td>
|
|
350
327
|
|
|
351
328
|
<!-- 普通单元格 -->
|
|
352
|
-
<
|
|
329
|
+
<dsh-render
|
|
353
330
|
v-else
|
|
354
331
|
:key="column._key + 'data'"
|
|
355
|
-
:
|
|
356
|
-
|
|
357
|
-
'bri-table-td': true , // 可以不要,为了position: relative,上面有
|
|
358
|
-
'bri-table-td-edit': canEdit,
|
|
359
|
-
'bri-table-td-show': !canEdit,
|
|
360
|
-
}"
|
|
361
|
-
:style="getTdStyle(column, row)"
|
|
362
|
-
>
|
|
363
|
-
<dsh-list-unit
|
|
364
|
-
:canEdit="canEdit"
|
|
365
|
-
:formData="row[column.nodeKey]"
|
|
366
|
-
:formItem="{
|
|
367
|
-
...column,
|
|
368
|
-
_heightAuto: heightAuto
|
|
369
|
-
}"
|
|
370
|
-
:allFormList="subColumns"
|
|
371
|
-
:rowIndex="rowIndex"
|
|
372
|
-
:parentListData="rows"
|
|
373
|
-
:parentFormList="parentFormList"
|
|
374
|
-
:parentObj="parentObj"
|
|
375
|
-
@blur="controlBlur(null, column, row[column.nodeKey], arguments)"
|
|
376
|
-
@change="$dispatchEvent(operationMap.changeVal, column, row[column.nodeKey], arguments)"
|
|
377
|
-
></dsh-list-unit>
|
|
378
|
-
|
|
379
|
-
<span
|
|
380
|
-
v-if="!getColRuleResult(column, row[column.nodeKey], rowIndex).bool"
|
|
381
|
-
class="bri-table-td-tip"
|
|
382
|
-
>
|
|
383
|
-
{{ getColRuleResult(column, row[column.nodeKey], rowIndex).message }}
|
|
384
|
-
</span>
|
|
385
|
-
</td>
|
|
332
|
+
:render="getTdRender(column, row, rowIndex)"
|
|
333
|
+
></dsh-render>
|
|
386
334
|
</template>
|
|
387
335
|
</tr>
|
|
388
336
|
</template>
|
|
@@ -587,32 +535,7 @@
|
|
|
587
535
|
};
|
|
588
536
|
loop(this.data.tree);
|
|
589
537
|
},
|
|
590
|
-
|
|
591
|
-
getColRuleResult (col, row, rowIndex) {
|
|
592
|
-
col = this.$transformFieldProperty(col, row, this.parentObj);
|
|
593
|
-
|
|
594
|
-
if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
|
|
595
|
-
return this.$getFieldRuleResult({
|
|
596
|
-
...col,
|
|
597
|
-
_regStr: col._regStr && [";", ";"].some(symbol => col._regStr.includes(symbol))
|
|
598
|
-
? col._regStr
|
|
599
|
-
.replace(/\n/g, "")
|
|
600
|
-
.split(";")
|
|
601
|
-
.reduce((arr, item) => arr.concat(item.split(";")), [])[rowIndex]
|
|
602
|
-
: col._regStr,
|
|
603
|
-
_regMessage: col._regMessage && [";", ";"].some(symbol => col._regMessage.includes(symbol))
|
|
604
|
-
? col._regMessage
|
|
605
|
-
.replace(/\n/g, "")
|
|
606
|
-
.split(";")
|
|
607
|
-
.reduce((arr, item) => arr.concat(item.split(";")), [])[rowIndex]
|
|
608
|
-
: col._regMessage
|
|
609
|
-
}, row);
|
|
610
|
-
} else {
|
|
611
|
-
return {
|
|
612
|
-
bool: true
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
},
|
|
538
|
+
|
|
616
539
|
// 点击表头
|
|
617
540
|
clickTh (operationItem, col) {
|
|
618
541
|
this.$emit("clickTh", col);
|
|
@@ -724,15 +647,6 @@
|
|
|
724
647
|
|
|
725
648
|
this.change("clearChildNodes", col, row, nodeData);
|
|
726
649
|
},
|
|
727
|
-
// 输入框值改变
|
|
728
|
-
changeVal (operationItem, col, row, params) {
|
|
729
|
-
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
730
|
-
this.change("changeVal", col, row, params);
|
|
731
|
-
},
|
|
732
|
-
// 表单控件失去焦点
|
|
733
|
-
controlBlur (operationItem, col, row, params) {
|
|
734
|
-
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
735
|
-
},
|
|
736
650
|
// 发生变动
|
|
737
651
|
change (...params) {
|
|
738
652
|
this.$emit("change", this.data, ...params);
|
|
@@ -740,7 +654,7 @@
|
|
|
740
654
|
|
|
741
655
|
/* ---- 工具方法 ---- */
|
|
742
656
|
// 合并表头
|
|
743
|
-
transformColumns (treeForm = this.treeColumns, subForm = this.
|
|
657
|
+
transformColumns (treeForm = this.treeColumns, subForm = this.contentColumns) {
|
|
744
658
|
return treeForm
|
|
745
659
|
.reduce((arr, treeFormItem, treeFormIndex) => {
|
|
746
660
|
return arr.concat(
|
|
@@ -966,29 +880,36 @@
|
|
|
966
880
|
getTdStyle (col, row) {
|
|
967
881
|
return {
|
|
968
882
|
...this.getThStyle(col),
|
|
969
|
-
backgroundColor: row
|
|
883
|
+
backgroundColor: row ? "" : "#fff"
|
|
970
884
|
};
|
|
971
885
|
},
|
|
972
|
-
|
|
973
|
-
return row
|
|
886
|
+
getTdRowSpan (col, row) {
|
|
887
|
+
return row.total || 1;
|
|
974
888
|
},
|
|
975
|
-
|
|
889
|
+
getTdColSpan (col, row) {
|
|
976
890
|
return 1;
|
|
977
891
|
},
|
|
978
|
-
|
|
979
|
-
return (h) => this.$getHeadRender(h,
|
|
892
|
+
getThRender (col) {
|
|
893
|
+
return (h) => this.$getHeadRender(h, col, {
|
|
980
894
|
showRequired: this.showRequired,
|
|
981
895
|
showDescription: this.showDescription,
|
|
982
896
|
headHeightAuto: this.headHeightAuto
|
|
983
897
|
});
|
|
984
898
|
},
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
899
|
+
getTdRender (col, row, rowIndex) {
|
|
900
|
+
return (h) => {
|
|
901
|
+
row = row[col.nodeKey];
|
|
902
|
+
console.log(row);
|
|
903
|
+
|
|
904
|
+
return h(
|
|
905
|
+
"td",
|
|
906
|
+
{
|
|
907
|
+
class: this.tablePropsObj.cellStyleOption.bodyCellClass({ column: col, row, rowIndex }),
|
|
908
|
+
style: this.getTdStyle(col, row)
|
|
909
|
+
},
|
|
910
|
+
col ? col.renderBodyCell({ column: col, row, rowIndex }, h) : undefined
|
|
911
|
+
);
|
|
912
|
+
};
|
|
992
913
|
},
|
|
993
914
|
getSummaryVal (col, row) {
|
|
994
915
|
if (col._calField && col._operator) {
|
|
@@ -1005,7 +926,7 @@
|
|
|
1005
926
|
}
|
|
1006
927
|
}, arr);
|
|
1007
928
|
};
|
|
1008
|
-
let list = loop(row
|
|
929
|
+
let list = loop(row.children, []);
|
|
1009
930
|
|
|
1010
931
|
return this.$calNumList(list, col._operator, calFieldFormItem);
|
|
1011
932
|
} else {
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
props: {},
|
|
96
96
|
data () {
|
|
97
97
|
return {
|
|
98
|
-
deleteProperties: ["__treeIndex__", "__old__", "__isExpand__", "__isRendered__", "__isShow__", "__isTmpShow__", "__isSearchingShow__"], // 除了
|
|
98
|
+
deleteProperties: ["__treeIndex__", "__old__", "__isExpand__", "__isRendered__", "__isShow__", "__isTmpShow__", "__isSearchingShow__"], // 除了__readonly__和__isQuote__不处理
|
|
99
99
|
isExpandAction: false,
|
|
100
100
|
|
|
101
101
|
searchMode: "flat", // "flat", "tree"
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
return this.selfPropsObj._searchLabelWidth;
|
|
195
195
|
},
|
|
196
196
|
searchFormList () {
|
|
197
|
-
return this.selfPropsObj._searchFields
|
|
197
|
+
return this.selfPropsObj._searchFields || [] // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
|
|
198
198
|
.map(fieldKey => this.columns.find(column => column._key === fieldKey))
|
|
199
199
|
.filter(column => !!column)
|
|
200
200
|
.map(column => {
|
|
@@ -13,12 +13,6 @@ export default {
|
|
|
13
13
|
default () {
|
|
14
14
|
return [];
|
|
15
15
|
}
|
|
16
|
-
},
|
|
17
|
-
oldData: {
|
|
18
|
-
type: Array,
|
|
19
|
-
default () {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
16
|
}
|
|
23
17
|
},
|
|
24
18
|
model: {
|
|
@@ -41,15 +35,6 @@ export default {
|
|
|
41
35
|
this.initFlag = true;
|
|
42
36
|
return this.data;
|
|
43
37
|
},
|
|
44
|
-
oldListData () {
|
|
45
|
-
this.oldData.forEach(item => {
|
|
46
|
-
!item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
47
|
-
});
|
|
48
|
-
return this.oldData;
|
|
49
|
-
},
|
|
50
|
-
useCampare () {
|
|
51
|
-
return !!this.oldListData.length;
|
|
52
|
-
},
|
|
53
38
|
footerData () {
|
|
54
39
|
return this.useSummary && this.listData.length
|
|
55
40
|
? [
|
|
@@ -78,20 +63,6 @@ export default {
|
|
|
78
63
|
...this.commonPropsObj
|
|
79
64
|
};
|
|
80
65
|
},
|
|
81
|
-
tablePropsObj () {
|
|
82
|
-
return {
|
|
83
|
-
maxHeight: this.contentHeight,
|
|
84
|
-
cellStyleOption: {
|
|
85
|
-
bodyCellClass: ({ row, column, rowIndex }) => {
|
|
86
|
-
return "bri-table-td" +
|
|
87
|
-
`${this.getRowCanEdit(row)
|
|
88
|
-
? " bri-table-td-edit"
|
|
89
|
-
: " bri-table-td-show"
|
|
90
|
-
}`;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
},
|
|
95
66
|
|
|
96
67
|
filterColumns () {
|
|
97
68
|
return this.columns.filter(col => this.$isAdvRelyShow(col, this.listData, this.parentObj, true));
|
|
@@ -124,7 +95,7 @@ export default {
|
|
|
124
95
|
width: 76,
|
|
125
96
|
align: "center",
|
|
126
97
|
fixed: "left",
|
|
127
|
-
renderBodyCell: ({
|
|
98
|
+
renderBodyCell: ({ column, row, rowIndex }) => ++rowIndex
|
|
128
99
|
};
|
|
129
100
|
},
|
|
130
101
|
operationColumn () {
|
|
@@ -136,14 +107,14 @@ export default {
|
|
|
136
107
|
align: "center",
|
|
137
108
|
fixed: "right",
|
|
138
109
|
width: 100,
|
|
139
|
-
renderBodyCell: ({
|
|
110
|
+
renderBodyCell: ({ column, row, rowIndex }, h) => {
|
|
140
111
|
const operationList = this.$getOperationList(["canDelete"]);
|
|
141
112
|
|
|
142
113
|
return h("dsh-buttons", {
|
|
143
114
|
props: {
|
|
144
115
|
list: operationList.map(btnItem => ({
|
|
145
116
|
...btnItem,
|
|
146
|
-
disabled: !this.
|
|
117
|
+
disabled: !this.getRowBtnCanEdit(row)
|
|
147
118
|
}))
|
|
148
119
|
},
|
|
149
120
|
on: {
|
|
@@ -154,84 +125,6 @@ export default {
|
|
|
154
125
|
});
|
|
155
126
|
}
|
|
156
127
|
};
|
|
157
|
-
},
|
|
158
|
-
contentColumns () {
|
|
159
|
-
return this.filterColumns.map(colItem => ({
|
|
160
|
-
filter: undefined,
|
|
161
|
-
sortBy: undefined,
|
|
162
|
-
renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
163
|
-
column = this.$transformFieldProperty(column, row, this.parentObj);
|
|
164
|
-
column = this.resetCol(column, row);
|
|
165
|
-
const unitCanEdit = this.getUnitCanEdit(column, row);
|
|
166
|
-
|
|
167
|
-
return [
|
|
168
|
-
this.isShowCompare(column, row, this.oldListData[rowIndex])
|
|
169
|
-
? h("Tooltip", {
|
|
170
|
-
style: {
|
|
171
|
-
width: "100%"
|
|
172
|
-
},
|
|
173
|
-
props: {
|
|
174
|
-
content: this.$isEmptyData(this.oldListData[rowIndex][column._key])
|
|
175
|
-
? ""
|
|
176
|
-
: this.oldListData[rowIndex][column._key],
|
|
177
|
-
transfer: true,
|
|
178
|
-
maxWidth: 200,
|
|
179
|
-
placement: "top"
|
|
180
|
-
},
|
|
181
|
-
scopedSlots: {
|
|
182
|
-
default: props => h("dsh-list-unit", {
|
|
183
|
-
props: {
|
|
184
|
-
canEdit: unitCanEdit,
|
|
185
|
-
formData: row,
|
|
186
|
-
formItem: column,
|
|
187
|
-
rowIndex: rowIndex,
|
|
188
|
-
allFormList: this.columns,
|
|
189
|
-
parentListData: this.listData,
|
|
190
|
-
parentFormList: this.parentFormList,
|
|
191
|
-
parentObj: this.parentObj
|
|
192
|
-
},
|
|
193
|
-
on: {
|
|
194
|
-
blur: () => this.controlBlur(null, column, row, arguments),
|
|
195
|
-
change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
|
|
196
|
-
}
|
|
197
|
-
})
|
|
198
|
-
}
|
|
199
|
-
})
|
|
200
|
-
: h("dsh-list-unit", {
|
|
201
|
-
props: {
|
|
202
|
-
canEdit: unitCanEdit,
|
|
203
|
-
formData: row,
|
|
204
|
-
formItem: column,
|
|
205
|
-
rowIndex: rowIndex,
|
|
206
|
-
allFormList: this.columns,
|
|
207
|
-
parentListData: this.listData,
|
|
208
|
-
parentFormList: this.parentFormList,
|
|
209
|
-
parentObj: this.parentObj
|
|
210
|
-
},
|
|
211
|
-
on: {
|
|
212
|
-
blur: () => this.controlBlur(null, column, row, arguments),
|
|
213
|
-
change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
|
|
214
|
-
}
|
|
215
|
-
}),
|
|
216
|
-
|
|
217
|
-
!this.getColRuleResult(column, row).bool
|
|
218
|
-
? h("span", {
|
|
219
|
-
class: "bri-table-td-tip"
|
|
220
|
-
}, this.getColRuleResult(column, row).message)
|
|
221
|
-
: undefined
|
|
222
|
-
];
|
|
223
|
-
},
|
|
224
|
-
renderHeaderCell: ({ column }, h) => {
|
|
225
|
-
column = this.$transformFieldProperty(column, undefined, this.parentObj);
|
|
226
|
-
|
|
227
|
-
return this.$getHeadRender(h, column, {
|
|
228
|
-
showRequired: this.showRequired,
|
|
229
|
-
showDescription: this.showDescription,
|
|
230
|
-
headHeightAuto: this.headHeightAuto
|
|
231
|
-
});
|
|
232
|
-
},
|
|
233
|
-
...colItem
|
|
234
|
-
}));
|
|
235
128
|
}
|
|
236
129
|
},
|
|
237
130
|
created () { },
|
|
@@ -263,39 +156,8 @@ export default {
|
|
|
263
156
|
changeSelect (list) {
|
|
264
157
|
this.$emit("changeSelect", list);
|
|
265
158
|
},
|
|
266
|
-
// 表单控件值改变
|
|
267
|
-
changeVal (operationItem, col, row, rowIndex, params) {
|
|
268
|
-
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
269
|
-
this.change("changeVal", col, row, rowIndex, ...params);
|
|
270
|
-
},
|
|
271
|
-
// 表单控件失去焦点
|
|
272
|
-
controlBlur (operationItem, col, row, params) {
|
|
273
|
-
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
274
|
-
},
|
|
275
159
|
change (...params) {
|
|
276
160
|
this.$emit("change", { list: this.listData, rowDefault: this.rowDefault }, ...params);
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
resetCol (col, row) {
|
|
280
|
-
let resetMap = {
|
|
281
|
-
select: {
|
|
282
|
-
_optionKind: "dropdown"
|
|
283
|
-
},
|
|
284
|
-
checkbox: {
|
|
285
|
-
_optionKind: "dropdown"
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
return {
|
|
289
|
-
...col,
|
|
290
|
-
...(resetMap[col._type] || {}),
|
|
291
|
-
// isShare: this.isShare,
|
|
292
|
-
_heightAuto: this.heightAuto
|
|
293
|
-
};
|
|
294
|
-
},
|
|
295
|
-
isShowCompare (col, row, oldRow = {}) {
|
|
296
|
-
return this.useCampare && ["number"].includes(col._type) &&
|
|
297
|
-
!(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
|
|
298
|
-
row[col._key] !== oldRow[col._key];
|
|
299
161
|
}
|
|
300
162
|
}
|
|
301
163
|
};
|
|
@@ -24,6 +24,12 @@ export default {
|
|
|
24
24
|
return {};
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
+
oldData: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default () {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
},
|
|
27
33
|
|
|
28
34
|
parentFormList: {
|
|
29
35
|
type: Array,
|
|
@@ -122,6 +128,15 @@ export default {
|
|
|
122
128
|
selfRowDefault () {
|
|
123
129
|
return this.$filterObj(this.filterColumns, this.rowDefault);
|
|
124
130
|
},
|
|
131
|
+
oldListData () {
|
|
132
|
+
this.oldData.forEach(item => {
|
|
133
|
+
!item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
134
|
+
});
|
|
135
|
+
return this.oldData;
|
|
136
|
+
},
|
|
137
|
+
useCampare () {
|
|
138
|
+
return !!this.oldListData.length;
|
|
139
|
+
},
|
|
125
140
|
|
|
126
141
|
controlKey () {
|
|
127
142
|
return this.propsObj._key;
|
|
@@ -220,6 +235,20 @@ export default {
|
|
|
220
235
|
return this.$transformAdvSearch(this.selfPropsObj._quoteAdvSearch, this.parentFormList, this.parentObj);
|
|
221
236
|
},
|
|
222
237
|
|
|
238
|
+
tablePropsObj () {
|
|
239
|
+
return {
|
|
240
|
+
maxHeight: this.contentHeight,
|
|
241
|
+
cellStyleOption: {
|
|
242
|
+
bodyCellClass: ({ column, row, rowIndex }) => {
|
|
243
|
+
return "bri-table-td" +
|
|
244
|
+
`${this.getRowCanEdit(row)
|
|
245
|
+
? " bri-table-td-edit"
|
|
246
|
+
: " bri-table-td-show"
|
|
247
|
+
}`;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
},
|
|
223
252
|
modalPropsObj () {
|
|
224
253
|
return {
|
|
225
254
|
title: this.controlName,
|
|
@@ -251,6 +280,85 @@ export default {
|
|
|
251
280
|
_key: this.controlKey
|
|
252
281
|
};
|
|
253
282
|
},
|
|
283
|
+
contentColumns () {
|
|
284
|
+
return this.filterColumns.map(colItem => ({
|
|
285
|
+
filter: undefined,
|
|
286
|
+
sortBy: undefined,
|
|
287
|
+
renderBodyCell: ({ column, row, rowIndex }, h) => {
|
|
288
|
+
column = this.$transformFieldProperty(column, row, this.parentObj);
|
|
289
|
+
column = this.resetCol(column, row);
|
|
290
|
+
const unitCanEdit = this.getUnitCanEdit(column, row);
|
|
291
|
+
|
|
292
|
+
return [
|
|
293
|
+
this.isShowCompare(column, row, this.oldListData[rowIndex])
|
|
294
|
+
? h("Tooltip", {
|
|
295
|
+
style: {
|
|
296
|
+
width: "100%"
|
|
297
|
+
},
|
|
298
|
+
props: {
|
|
299
|
+
content: this.$isEmptyData(this.oldListData[rowIndex][column._key])
|
|
300
|
+
? ""
|
|
301
|
+
: this.oldListData[rowIndex][column._key],
|
|
302
|
+
transfer: true,
|
|
303
|
+
maxWidth: 200,
|
|
304
|
+
placement: "top"
|
|
305
|
+
},
|
|
306
|
+
scopedSlots: {
|
|
307
|
+
default: props => h("dsh-list-unit", {
|
|
308
|
+
props: {
|
|
309
|
+
canEdit: unitCanEdit,
|
|
310
|
+
formData: row,
|
|
311
|
+
formItem: column,
|
|
312
|
+
rowIndex: rowIndex,
|
|
313
|
+
allFormList: this.columns,
|
|
314
|
+
parentListData: this.listData,
|
|
315
|
+
parentFormList: this.parentFormList,
|
|
316
|
+
parentObj: this.parentObj
|
|
317
|
+
},
|
|
318
|
+
on: {
|
|
319
|
+
blur: () => this.controlBlur(null, column, row, rowIndex, arguments),
|
|
320
|
+
change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
|
|
321
|
+
}
|
|
322
|
+
})
|
|
323
|
+
}
|
|
324
|
+
})
|
|
325
|
+
: h("dsh-list-unit", {
|
|
326
|
+
props: {
|
|
327
|
+
canEdit: unitCanEdit,
|
|
328
|
+
formData: row,
|
|
329
|
+
formItem: column,
|
|
330
|
+
rowIndex: rowIndex,
|
|
331
|
+
allFormList: this.columns,
|
|
332
|
+
parentListData: this.listData,
|
|
333
|
+
parentFormList: this.parentFormList,
|
|
334
|
+
parentObj: this.parentObj
|
|
335
|
+
},
|
|
336
|
+
on: {
|
|
337
|
+
blur: () => this.controlBlur(null, column, row, rowIndex, arguments),
|
|
338
|
+
change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
|
|
339
|
+
}
|
|
340
|
+
}),
|
|
341
|
+
|
|
342
|
+
// 校验文字
|
|
343
|
+
!this.getColRuleResult(column, row, rowIndex).bool
|
|
344
|
+
? h("span", {
|
|
345
|
+
class: "bri-table-td-tip"
|
|
346
|
+
}, this.getColRuleResult(column, row, rowIndex).message)
|
|
347
|
+
: undefined
|
|
348
|
+
];
|
|
349
|
+
},
|
|
350
|
+
renderHeaderCell: ({ column }, h) => {
|
|
351
|
+
column = this.$transformFieldProperty(column, undefined, this.parentObj);
|
|
352
|
+
|
|
353
|
+
return this.$getHeadRender(h, column, {
|
|
354
|
+
showRequired: this.showRequired,
|
|
355
|
+
showDescription: this.showDescription,
|
|
356
|
+
headHeightAuto: this.headHeightAuto
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
...colItem
|
|
360
|
+
}));
|
|
361
|
+
},
|
|
254
362
|
|
|
255
363
|
topOperationBtns () {
|
|
256
364
|
return Object.keys(this.topOperationMap);
|
|
@@ -311,6 +419,15 @@ export default {
|
|
|
311
419
|
this.ruleRecordMap = {};
|
|
312
420
|
},
|
|
313
421
|
|
|
422
|
+
// 表单控件失去焦点
|
|
423
|
+
controlBlur (operationItem, col, row, rowIndex, params) {
|
|
424
|
+
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
425
|
+
},
|
|
426
|
+
// 输入框值改变
|
|
427
|
+
changeVal (operationItem, col, row, rowIndex, params) {
|
|
428
|
+
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
429
|
+
this.change("changeVal", col, row, rowIndex, ...params);
|
|
430
|
+
},
|
|
314
431
|
// 点击引用
|
|
315
432
|
clickQuote () {
|
|
316
433
|
this.dshRenderName = "quoteModalRender";
|
|
@@ -360,7 +477,7 @@ export default {
|
|
|
360
477
|
...dataObj[this.controlKey],
|
|
361
478
|
list: dataObj[this.controlKey].list.map(item => ({
|
|
362
479
|
...item,
|
|
363
|
-
|
|
480
|
+
__isQuote__: true
|
|
364
481
|
}))
|
|
365
482
|
};
|
|
366
483
|
} else if (["cascaderTable"].includes(this.controlType)) {
|
|
@@ -369,7 +486,7 @@ export default {
|
|
|
369
486
|
list.map(item => ({
|
|
370
487
|
...item,
|
|
371
488
|
children: item.children && item.children.length ? loop(item.children) : item.children,
|
|
372
|
-
|
|
489
|
+
__isQuote__: true
|
|
373
490
|
}));
|
|
374
491
|
|
|
375
492
|
return loop(data);
|
|
@@ -460,6 +577,27 @@ export default {
|
|
|
460
577
|
},
|
|
461
578
|
|
|
462
579
|
/* --------------- 工具方法 ------------- */
|
|
580
|
+
resetCol (col, row) {
|
|
581
|
+
let resetMap = {
|
|
582
|
+
select: {
|
|
583
|
+
_optionKind: "dropdown"
|
|
584
|
+
},
|
|
585
|
+
checkbox: {
|
|
586
|
+
_optionKind: "dropdown"
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
return {
|
|
590
|
+
...col,
|
|
591
|
+
...(resetMap[col._type] || {}),
|
|
592
|
+
// isShare: this.isShare,
|
|
593
|
+
_heightAuto: this.heightAuto
|
|
594
|
+
};
|
|
595
|
+
},
|
|
596
|
+
isShowCompare (col, row, oldRow = {}) {
|
|
597
|
+
return this.useCampare && ["number"].includes(col._type) &&
|
|
598
|
+
!(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
|
|
599
|
+
row[col._key] !== oldRow[col._key];
|
|
600
|
+
},
|
|
463
601
|
// 整行校验结果
|
|
464
602
|
getRowRuleResult (row, rowIndex) {
|
|
465
603
|
return this.filterColumns.every(column => this.getColRuleResult(column, row, rowIndex).bool);
|
|
@@ -467,6 +605,7 @@ export default {
|
|
|
467
605
|
// 单元格校验结果
|
|
468
606
|
getColRuleResult (col, row, rowIndex) {
|
|
469
607
|
col = this.$transformFieldProperty(col, row, this.parentObj);
|
|
608
|
+
|
|
470
609
|
if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
|
|
471
610
|
return this.$getFieldRuleResult(col, row);
|
|
472
611
|
} else {
|
|
@@ -475,17 +614,25 @@ export default {
|
|
|
475
614
|
};
|
|
476
615
|
}
|
|
477
616
|
},
|
|
478
|
-
|
|
617
|
+
// 行按钮是否可编辑(删除按钮可编辑 不代表行内容是可编辑的)
|
|
618
|
+
getRowBtnCanEdit (row) {
|
|
479
619
|
return this.canEdit && // 是编辑状态
|
|
480
620
|
(this.disabledOldDataRow ? !row.__old__ : true) && // 老数据行不置灰/置灰时是新增数据
|
|
481
621
|
!row.__readonly__; // 不能为只读数据
|
|
482
622
|
},
|
|
623
|
+
// 行内容是否可编辑
|
|
624
|
+
getRowCanEdit (row) {
|
|
625
|
+
return this.getRowBtnCanEdit(row) &&
|
|
626
|
+
!row.__isQuote__; // 不能为引用过来的数据,引用的可以
|
|
627
|
+
},
|
|
628
|
+
// 列本身是否可编辑
|
|
483
629
|
getColCanEdit (col, row) {
|
|
484
630
|
return (col._oldReadonly ? !row.__old__ : true) && // 老数据行里某些列不可编辑
|
|
485
631
|
(["number"].includes(col._type) && ![undefined, null, "", "no"].includes(col._summaryType) ? row.isLeaf !== false : true) && // 级联表格 -“需要计的数字列 且 不是叶子行的”不可编辑(必须用isLeaf !== false判断,因为牵扯内部表格也在用)
|
|
486
632
|
col._enterType !== "calculate" && // 计算的不可编辑
|
|
487
633
|
col._readonly !== true; // 不能为只读
|
|
488
634
|
},
|
|
635
|
+
// 单元格最终编辑状态
|
|
489
636
|
getUnitCanEdit (col, row) {
|
|
490
637
|
return this.getRowCanEdit(row) &&
|
|
491
638
|
this.getColCanEdit(col, row) &&
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
type: String,
|
|
65
65
|
default: "default",
|
|
66
66
|
validator (val) {
|
|
67
|
-
return ["small", "default", "middle", "large", "custom", "auto"].includes(val);
|
|
67
|
+
return ["small", "default", "middle", "large", "custom", "auto", "fullscreen"].includes(val);
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
propsObj: {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
&-small,
|
|
17
17
|
&-middle,
|
|
18
18
|
&-large,
|
|
19
|
-
&-
|
|
19
|
+
&-fullscreen {
|
|
20
20
|
.ivu-modal-wrap {
|
|
21
21
|
.ivu-modal {
|
|
22
22
|
margin: auto;
|
|
@@ -160,6 +160,14 @@
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
+
|
|
164
|
+
&-fullscreen {
|
|
165
|
+
.ivu-modal-fullscreen {
|
|
166
|
+
.ivu-modal-body {
|
|
167
|
+
position: static;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
163
171
|
}
|
|
164
172
|
|
|
165
173
|
.ivu-modal-mask {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
background-clip: border-box;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
|
|
15
16
|
// 宽度为6
|
|
16
17
|
.bri-scrollbar6 {
|
|
17
18
|
&::-webkit-scrollbar {
|
|
@@ -34,4 +35,12 @@
|
|
|
34
35
|
background-color: #f75252;
|
|
35
36
|
font-size: 12px;
|
|
36
37
|
color: #ffffff;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.bri-badge-small {
|
|
41
|
+
height: 16px;
|
|
42
|
+
line-height: 14px;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
min-width: 16px;
|
|
45
|
+
padding: 0 4px;
|
|
37
46
|
}
|
package/src/utils/table.js
CHANGED
|
@@ -12,7 +12,8 @@ const getHeadRender = function (h, column, {
|
|
|
12
12
|
paddingLeft: "8px",
|
|
13
13
|
paddingRight: column._description ? "26px" : "8px",
|
|
14
14
|
verticalAlign: "middle",
|
|
15
|
-
position: "relative"
|
|
15
|
+
position: "relative",
|
|
16
|
+
marginRight: ["number", "date"].includes(column._type) && column.align === "right" ? "10px" : 0
|
|
16
17
|
}
|
|
17
18
|
}, [
|
|
18
19
|
showRequired && column._required && h("i", {
|