feat:将表格中的需要排序的方法 和排序传的字段抽为公共方法
This commit is contained in:
@@ -73,8 +73,8 @@
|
||||
:key="`col-${index}`"
|
||||
:label="item.label"
|
||||
min-width="110px"
|
||||
:sortable="sortableShow(item.prop)"
|
||||
:prop="propTitle(item.prop)"
|
||||
:sortable="$tableSet.sortableShow(item.prop,'project')"
|
||||
:prop="$tableSet.propTitle(item.prop,'project')"
|
||||
:sort-orders="['ascending', 'descending']"
|
||||
>
|
||||
<template slot-scope="scope" :column="item" >
|
||||
@@ -546,33 +546,6 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
//是否需要排序
|
||||
sortableShow(prop){
|
||||
switch(prop){
|
||||
case 'id':
|
||||
case 'asset':
|
||||
case 'port':
|
||||
case 'project':
|
||||
case 'module':
|
||||
case 'type':
|
||||
// case 'path':
|
||||
return'custom';
|
||||
default : return false;
|
||||
}
|
||||
},
|
||||
// prop字段
|
||||
propTitle(prop){
|
||||
switch(prop){
|
||||
case 'id': return'e.id';
|
||||
case 'asset': return'a.host';
|
||||
case 'port': return'e.port';
|
||||
case 'project': return'p.name';
|
||||
case 'module': return'm.name';
|
||||
case 'type': return'm.type';
|
||||
// case 'path': return'e.path';
|
||||
default : return prop;
|
||||
}
|
||||
},
|
||||
// 数据排序
|
||||
tableDataSort(item){
|
||||
let orderBy='';
|
||||
|
||||
Reference in New Issue
Block a user