Skip to content

Commit 1d20fb4

Browse files
committed
增加table有数据源的列可以移除或自定义显示背景颜色及点击事件;增加添加行方法时设置默认字段(解决编辑状态下编辑值可能不刷新的问题)
1 parent 9ff3672 commit 1d20fb4

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed

Vol.Vue/src/components/basic/VolTable.vue

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@
138138
@click="formatterClick(scope.row,column)"
139139
v-html="column.formatter(scope.row,column)"
140140
></div>
141+
<!--2020.09.06增加table有数据源的列,可以移除或自定义显示背景颜色及点击事件-->
142+
<div
143+
v-else-if="(column.bind&&column.normal)"
144+
@click="formatterClick(scope.row,column)"
145+
:style="column.getStyle&&column.getStyle(scope.row,column)"
146+
>{{formatter(scope.row,column,true)}}</div>
141147
<div
142148
v-else-if="column.click"
143149
@click="formatterClick(scope.row,column)"
@@ -297,21 +303,16 @@ export default {
297303
total: 0,
298304
formatConfig: {},
299305
defaultColor: "default",
306+
//2020.09.06调整table列数据源的背景颜色
300307
colors: [
301-
"success",
302-
"primary",
303-
"error",
304-
"warning",
305-
"magenta",
306-
"red",
307-
"volcano",
308-
"orange",
309-
"gold",
310-
"green",
311308
"cyan",
309+
"red",
312310
"blue",
311+
"green",
312+
"magenta",
313313
"geekblue",
314-
"#FFA2D3",
314+
"gold",
315+
"orange",
315316
"default",
316317
],
317318
rule: {
@@ -719,9 +720,12 @@ export default {
719720
row = {};
720721
}
721722
this.columns.forEach((x) => {
722-
if (x.edit && x.edit.type == "switch") {
723-
if (!row.hasOwnProperty(x.field)) {
723+
if (!row.hasOwnProperty(x.field)) {
724+
if (x.edit && x.edit.type == "switch") {
724725
row[x.field] = x.type == "bool" ? false : 0;
726+
} else if (!row.hidden) {
727+
//2020.09.06添加行时,设置默认字段
728+
row[x.field] = undefined;
725729
}
726730
}
727731
});

开发版dev/Vue.NetCore/Vol.Vue/src/components/basic/VolTable.vue

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@
138138
@click="formatterClick(scope.row,column)"
139139
v-html="column.formatter(scope.row,column)"
140140
></div>
141+
<!--2020.09.06增加table有数据源的列,可以移除或自定义显示背景颜色及点击事件-->
142+
<div
143+
v-else-if="(column.bind&&column.normal)"
144+
@click="formatterClick(scope.row,column)"
145+
:style="column.getStyle&&column.getStyle(scope.row,column)"
146+
>{{formatter(scope.row,column,true)}}</div>
141147
<div
142148
v-else-if="column.click"
143149
@click="formatterClick(scope.row,column)"
@@ -297,21 +303,16 @@ export default {
297303
total: 0,
298304
formatConfig: {},
299305
defaultColor: "default",
306+
//2020.09.06调整table列数据源的背景颜色
300307
colors: [
301-
"success",
302-
"primary",
303-
"error",
304-
"warning",
305-
"magenta",
306-
"red",
307-
"volcano",
308-
"orange",
309-
"gold",
310-
"green",
311308
"cyan",
309+
"red",
312310
"blue",
311+
"green",
312+
"magenta",
313313
"geekblue",
314-
"#FFA2D3",
314+
"gold",
315+
"orange",
315316
"default",
316317
],
317318
rule: {
@@ -719,9 +720,12 @@ export default {
719720
row = {};
720721
}
721722
this.columns.forEach((x) => {
722-
if (x.edit && x.edit.type == "switch") {
723-
if (!row.hasOwnProperty(x.field)) {
723+
if (!row.hasOwnProperty(x.field)) {
724+
if (x.edit && x.edit.type == "switch") {
724725
row[x.field] = x.type == "bool" ? false : 0;
726+
} else if (!row.hidden) {
727+
//2020.09.06添加行时,设置默认字段
728+
row[x.field] = undefined;
725729
}
726730
}
727731
});

0 commit comments

Comments
 (0)