Commit d0b4af02 authored by caixingbing's avatar caixingbing

*

parent f26896b3
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
border border
fit fit
highlight-current-row highlight-current-row
:default-sort = 'defaultSort'
@sort-change="sortChange" @sort-change="sortChange"
> >
<el-table-column <el-table-column
...@@ -65,6 +66,10 @@ export default { ...@@ -65,6 +66,10 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
defaultSort: {
type: Object,
default: null
},
tableData: { tableData: {
type: Array, type: Array,
default: [] default: []
......
...@@ -79,7 +79,7 @@ export default { ...@@ -79,7 +79,7 @@ export default {
pageSize: 10 pageSize: 10
}, },
formData: [ formData: [
{ type: 3, fieldName: 'keys', value: '', placeholder: '输入企业名称查询', options: []}, { type: 3, fieldName: 'keys', value: '', placeholder: '输入项目/工程名称查询', options: []},
], ],
forData: [ forData: [
{label: '合作项目/工程名称', prop: 'projectAllName', width: '720', slot: true}, {label: '合作项目/工程名称', prop: 'projectAllName', width: '720', slot: true},
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<tables <tables
:indexFixed="true" :indexFixed="true"
:defaultSort="defaultSort"
:tableLoading="tableLoading" :tableLoading="tableLoading"
:tableData="tableData" :tableData="tableData"
:forData="forData" :forData="forData"
...@@ -57,11 +58,12 @@ export default { ...@@ -57,11 +58,12 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}, },
defaultSort: {prop: 'time', order: 'descending'},
forData: [ forData: [
{label: '客户名称', prop: 'companyName', minWidth: '350', slot: true}, {label: '客户名称', prop: 'companyName', minWidth: '350', slot: true},
{label: '合作项目/工程名称', prop: 'projectAllName', minWidth: '400', sortable: 'custom', slot: true}, {label: '合作项目/工程名称', prop: 'projectAllName', minWidth: '400', slot: true, sortable: 'custom', descending: '5', ascending: '6'},
{label: '合作总金额(万元)', prop: 'amount', minWidth: '150', sortable: 'custom'}, {label: '合作总金额(万元)', prop: 'amount', minWidth: '150', sortable: 'custom', descending: '1', ascending: '2'},
{label: '最近一次合作时间', prop: 'time', minWidth: '140', sortable: 'custom'} {label: '最近一次合作时间', prop: 'time', minWidth: '140', sortable: 'custom', descending: '3', ascending: '4'}
], ],
formData: [ formData: [
{ type: 3, fieldName: 'keys', value: '', placeholder: '输入企业名称查询', options: []}, { type: 3, fieldName: 'keys', value: '', placeholder: '输入企业名称查询', options: []},
...@@ -90,32 +92,6 @@ export default { ...@@ -90,32 +92,6 @@ export default {
} }
this.tableDataTotal = res.total this.tableDataTotal = res.total
}, },
//排序-测试
sortChange(e){
this.tableData = []
let sortRule = e.prop+','+e.order
switch (sortRule){
case 'amount,descending':
this.queryParams.sort = 1
break
case 'amount,ascending':
this.queryParams.sort = 2
break
case 'time,descending':
this.queryParams.sort = 3
break
case 'time,ascending':
this.queryParams.sort = 4
break
case 'projectAllName,descending':
this.queryParams.sort = 5
break
case 'projectAllName,ascending':
this.queryParams.sort = 6
break
}
this.handleSearch()
},
handleClick(e, data) { handleClick(e, data) {
this.rowData = data this.rowData = data
this.isDetails = true this.isDetails = true
......
...@@ -70,7 +70,9 @@ export default { ...@@ -70,7 +70,9 @@ export default {
}, },
//排序 //排序
sortChange(e){ sortChange(e){
console.log(e) let item = this.forData.find(item => item.prop === e.prop)
this.queryParams.sort = item[e.order]
this.handleSearch()
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment