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

@@ -47,8 +47,8 @@
:width="item.width"
:key="`col-${index}`"
:label="item.label"
:sortable="sortableShow(item.prop)"
:prop="propTitle(item.prop)"
:sortable="$tableSet.sortableShow(item.prop,'model')"
:prop="$tableSet.propTitle(item.prop,'model')"
:sort-orders="['ascending', 'descending']">
<template slot-scope="scope" :column="item">
<template v-if="item.prop == 'vendor'" >{{scope.row[item.prop].value}}</template>
@@ -305,27 +305,6 @@
}
this.getTableData();
},
//是否需要排序
sortableShow(prop) {
switch(prop){
case 'id':
case 'name':
case 'type':
case 'vendor':
return'custom';
default : return false;
}
},
// prop字段
propTitle(prop) {
switch(prop){
case 'id': return'mo.id';
case 'name': return'mo.name';
case 'type': return'dictt.value';
case 'vendor': return'dict.value';
default : return prop;
}
},
// 数据排序
tableDataSort(item) {
let orderBy='';