|
@@ -56,15 +56,14 @@ export default {
|
|
|
storageKey: {
|
|
|
type: String,
|
|
|
},
|
|
|
- showSummary:{
|
|
|
- type:Boolean,
|
|
|
- default:false,
|
|
|
+ showSummary: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
+ height: {
|
|
|
+ type: [String, Number],
|
|
|
+ default: () => "auto",
|
|
|
},
|
|
|
- height:{
|
|
|
- type:[String,Number],
|
|
|
- default:()=>'auto',
|
|
|
- }
|
|
|
-
|
|
|
},
|
|
|
components: {
|
|
|
ElDictTag: () => import("@/components/DictTag/index.vue"),
|
|
@@ -140,7 +139,7 @@ export default {
|
|
|
},
|
|
|
// height:{
|
|
|
// get(){
|
|
|
- // return 100% -
|
|
|
+ // return 100% -
|
|
|
// },
|
|
|
// set(){},
|
|
|
// }
|
|
@@ -164,15 +163,15 @@ export default {
|
|
|
this.filterData = multiFilter(this.$props.value, newValue);
|
|
|
},
|
|
|
},
|
|
|
- value:{
|
|
|
+ value: {
|
|
|
handler: function (newValue) {
|
|
|
- if(this.value.length > 0){
|
|
|
+ if (this.value.length > 0) {
|
|
|
this.$refs.superUxTable && this.$refs.superUxTable.clearSelection();
|
|
|
}
|
|
|
},
|
|
|
immediate: true,
|
|
|
- deep:true
|
|
|
- }
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
//
|
|
@@ -182,7 +181,6 @@ export default {
|
|
|
},
|
|
|
//
|
|
|
onRowClick(row, column, event) {
|
|
|
-
|
|
|
const { radio, checkbox } = this.$props;
|
|
|
// 单选
|
|
|
if (radio) {
|
|
@@ -190,13 +188,13 @@ export default {
|
|
|
}
|
|
|
// 多选
|
|
|
if (checkbox) {
|
|
|
- this.$refs.superUxTable.toggleRowSelection(
|
|
|
- [this.innerValue.find((item) => item.id === row.id)]
|
|
|
- );
|
|
|
+ this.$refs.superUxTable.toggleRowSelection([
|
|
|
+ this.innerValue.find((item) => item.id === row.id),
|
|
|
+ ]);
|
|
|
}
|
|
|
},
|
|
|
// 宽度
|
|
|
- onWidth({ column}) {
|
|
|
+ onWidth({ column }) {
|
|
|
this.innerColumns = this.innerColumns.map(({ item, attr }) => ({
|
|
|
attr,
|
|
|
item: {
|
|
@@ -250,7 +248,6 @@ export default {
|
|
|
}
|
|
|
this.count++;
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
// 过滤
|
|
|
onFilter() {
|
|
@@ -290,37 +287,37 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- getSummaries({ columns, data }){
|
|
|
-
|
|
|
- const means = [] // 合计
|
|
|
+ getSummaries({ columns, data }) {
|
|
|
+ const means = []; // 合计
|
|
|
columns.forEach((column, columnIndex) => {
|
|
|
- if (columnIndex === 0) {
|
|
|
- means.push('合计')
|
|
|
- } else {
|
|
|
- const values = data.map(item => Number(item[column.property]));
|
|
|
-
|
|
|
- let sumColumn = this.showColumns.filter(({item,attr}) => attr.isSummary && item.key === column.property);
|
|
|
+ if (columnIndex === 0) {
|
|
|
+ means.push("合计");
|
|
|
+ } else {
|
|
|
+ const values = data.map((item) => Number(item[column.property]));
|
|
|
+
|
|
|
+ let sumColumn = this.showColumns.filter(
|
|
|
+ ({ item, attr }) => attr.isSummary && item.key === column.property
|
|
|
+ );
|
|
|
|
|
|
- // 合计
|
|
|
- // if (!values.every(value => isNaN(value))) {
|
|
|
- if (sumColumn.length) {
|
|
|
- means[columnIndex] = values.reduce((prev, curr) => {
|
|
|
- const value = Number(curr);
|
|
|
- if (!isNaN(value)) {
|
|
|
- return prev + curr;
|
|
|
- } else {
|
|
|
- return prev;
|
|
|
- }
|
|
|
- }, 0);
|
|
|
- means[columnIndex] = means[columnIndex].toFixed(2);
|
|
|
+ // 合计
|
|
|
+ // if (!values.every(value => isNaN(value))) {
|
|
|
+ if (sumColumn.length) {
|
|
|
+ means[columnIndex] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
} else {
|
|
|
- means[columnIndex] = '';
|
|
|
+ return prev;
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ }, 0);
|
|
|
+ means[columnIndex] = means[columnIndex].toFixed(2);
|
|
|
+ } else {
|
|
|
+ means[columnIndex] = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
// sums[index] = sums[index] && sums[index].toFixed(2); // 保留2位小数,解决小数合计列
|
|
|
- return [means]
|
|
|
-
|
|
|
+ return [means];
|
|
|
},
|
|
|
},
|
|
|
created() {},
|
|
@@ -328,9 +325,9 @@ export default {
|
|
|
this.extendMethod();
|
|
|
},
|
|
|
updated() {
|
|
|
- this.$nextTick(()=>{
|
|
|
+ this.$nextTick(() => {
|
|
|
this.$refs.superUxTable.doLayout();
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
destroyed() {},
|
|
|
};
|
|
@@ -357,7 +354,7 @@ export default {
|
|
|
@header-dragend="onWidth"
|
|
|
@selection-change="onSelectionChange"
|
|
|
:header-row-style="{
|
|
|
- color: '#515a6e' ,
|
|
|
+ color: '#515a6e',
|
|
|
}"
|
|
|
style="flex: 1"
|
|
|
>
|
|
@@ -390,7 +387,7 @@ export default {
|
|
|
:key="item.key + index"
|
|
|
:field="item.key"
|
|
|
:title="item.title"
|
|
|
- :fixed="item.fixed ? 'left' :undefined"
|
|
|
+ :fixed="item.fixed ? 'left' : undefined"
|
|
|
:width="item.width || 180"
|
|
|
resizable
|
|
|
show-overflow
|
|
@@ -500,7 +497,7 @@ export default {
|
|
|
</template>
|
|
|
</ux-table-column>
|
|
|
<slot></slot>
|
|
|
- <!-- </el-table> -->
|
|
|
+ <!-- </el-table> -->
|
|
|
</ux-grid>
|
|
|
<div
|
|
|
style="
|
|
@@ -568,7 +565,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-::v-deep.uxbeautifyTableClass .elx-header--column .elx-resizable.is--line:before{
|
|
|
+::v-deep.uxbeautifyTableClass
|
|
|
+ .elx-header--column
|
|
|
+ .elx-resizable.is--line:before {
|
|
|
height: 100%;
|
|
|
background-color: #dfe6ec;
|
|
|
}
|