feat:将表格中的需要排序的方法 和排序传的字段抽为公共方法

This commit is contained in:
zhangyu
2020-08-07 11:11:43 +08:00
parent 4103243e1c
commit a098fc7be6
16 changed files with 229 additions and 373 deletions

View File

@@ -53,8 +53,8 @@
:label="item.label"
:show-overflow-tooltip="item.prop != 'labels'"
min-width="110px"
:sortable="sortableShow(item.prop)"
:prop="propTitle(item.prop)"
:sortable="$tableSet.sortableShow(item.prop,'alertMessage')"
:prop="$tableSet.propTitle(item.prop,'alertMessage')"
:sort-orders="['ascending', 'descending']"
>
<template slot-scope="scope" :column="item">
@@ -740,31 +740,6 @@
this.$refs.moduleBox.show(false, false);
this.viewAssetState = false;
},
//是否需要排序
sortableShow(prop){
switch(prop){
case 'id':
case 'state':
case 'alertRule':
case 'severity':
case 'startAt':
case 'endAt':
return'custom';
default : return false;
}
},
// prop字段
propTitle(prop){
switch(prop){
case 'id': return'am.id';
case 'state': return'am.state';
case 'alertRule': return'ar.alert_name';
case 'severity': return'am.severity';
case 'startAt': return'am.start_at';
case 'endAt': return'am.end_at';
default : return prop;
}
},
// 数据排序
tableDataSort(item){
this.$emit('tableDataSort',item);