参数模板管理;未符合项;参数导出模板管理 表格排序问题

This commit is contained in:
zyx.net
2022-12-23 10:59:20 +08:00
parent 4f8f1626b6
commit 8c0b7bf0c0
4 changed files with 60 additions and 0 deletions
@@ -56,6 +56,7 @@
rowKey="id" rowKey="id"
:data-source="dataSource" :data-source="dataSource"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
@change="tableOnChange"
:columns="columns" :columns="columns"
> >
<span slot="projectName" slot-scope="text,record" :title="text"> <span slot="projectName" slot-scope="text,record" :title="text">
@@ -131,6 +132,8 @@ export default {
toggleSearchStatus: false, toggleSearchStatus: false,
selectedRowKeys: [], selectedRowKeys: [],
selectedRowKeysArray: '', selectedRowKeysArray: '',
orderBy: '1',
orderByField: '',
formInline: {}, formInline: {},
rules: { rules: {
paramsTemplateName:[ paramsTemplateName:[
@@ -159,6 +162,7 @@ export default {
align: 'center', align: 'center',
width: 160, width: 160,
ellipsis: true, ellipsis: true,
sorter:true,
dataIndex: 'region_dictText', dataIndex: 'region_dictText',
}, },
{ {
@@ -166,6 +170,7 @@ export default {
align: 'center', align: 'center',
width: 180, width: 180,
ellipsis: true, ellipsis: true,
sorter:true,
dataIndex: 'paramsTemplateName', dataIndex: 'paramsTemplateName',
scopedSlots: { customRender: 'projectName' } scopedSlots: { customRender: 'projectName' }
}, },
@@ -181,6 +186,7 @@ export default {
align: 'center', align: 'center',
dataIndex: 'createTime', dataIndex: 'createTime',
width: 160, width: 160,
sorter:true,
ellipsis: true, ellipsis: true,
}, },
{ {
@@ -188,6 +194,7 @@ export default {
align: 'center', align: 'center',
width: 160, width: 160,
ellipsis: true, ellipsis: true,
sorter:true,
dataIndex: 'updateTime' dataIndex: 'updateTime'
}, },
{ {
@@ -354,10 +361,27 @@ export default {
this.queryParam[value] = id this.queryParam[value] = id
this.queryParam = { ...this.queryParam } this.queryParam = { ...this.queryParam }
}, },
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
if(sorter.columnKey == 'region_dictText'){
this.orderByField = 'region'
} else if(sorter.columnKey == 'paramsTemplateName') {
this.orderByField = 'params_template_name'
} else if(sorter.columnKey == 'createTime') {
this.orderByField = 'create_time'
} else if(sorter.columnKey == 'updateTime') {
this.orderByField = 'update_time'
} else{
this.orderByField = sorter.columnKey
}
this.getList()
},
getList() { getList() {
let query = { let query = {
pageNo: this.pageNo, pageNo: this.pageNo,
pageSize: this.pageSize, pageSize: this.pageSize,
orderBy: this.orderBy,
orderByField: this.orderByField,
...this.queryParam ...this.queryParam
} }
this.loading = true this.loading = true
@@ -40,6 +40,7 @@
:scroll="{x: '100%',y:'calc(100vh - 160px)'}" :scroll="{x: '100%',y:'calc(100vh - 160px)'}"
rowKey="id" rowKey="id"
:data-source="dataSource" :data-source="dataSource"
@change="tableOnChange"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns" :columns="columns"
> >
@@ -115,6 +116,8 @@ export default {
selectedRowKeys: [], selectedRowKeys: [],
selectedRowKeysArray: '', selectedRowKeysArray: '',
formInline: {}, formInline: {},
orderBy: '1',
orderByField: '',
rules: { rules: {
paramsTemplateName:[ paramsTemplateName:[
{ required: true, message: this.$t('PleaseEnter')+this.$t('templateName'), trigger: 'change' }, { required: true, message: this.$t('PleaseEnter')+this.$t('templateName'), trigger: 'change' },
@@ -150,6 +153,7 @@ export default {
title: this.$t('templateName'), title: this.$t('templateName'),
align: 'center', align: 'center',
dataIndex: 'templateName', dataIndex: 'templateName',
sorter:true,
ellipsis: true, ellipsis: true,
width: 300, width: 300,
scopedSlots: { customRender: 'templateName' } scopedSlots: { customRender: 'templateName' }
@@ -181,6 +185,7 @@ export default {
align: 'center', align: 'center',
width: 180, width: 180,
ellipsis: true, ellipsis: true,
sorter:true,
dataIndex: 'updateTime' dataIndex: 'updateTime'
}, },
{ {
@@ -334,10 +339,23 @@ export default {
this.queryParam[value] = id this.queryParam[value] = id
this.queryParam = { ...this.queryParam } this.queryParam = { ...this.queryParam }
}, },
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
if(sorter.columnKey == 'templateName') {
this.orderByField = 'template_name'
} else if(sorter.columnKey == 'updateTime') {
this.orderByField = 'update_time'
} else{
this.orderByField = sorter.columnKey
}
this.getList()
},
getList() { getList() {
let query = { let query = {
pageNo: this.pageNo, pageNo: this.pageNo,
pageSize: this.pageSize, pageSize: this.pageSize,
orderBy: this.orderBy,
orderByField: this.orderByField,
...this.queryParam ...this.queryParam
} }
this.loading = true this.loading = true
@@ -1511,6 +1511,8 @@
this.orderBy = sorter.order == 'ascend' ? '1' : '2' this.orderBy = sorter.order == 'ascend' ? '1' : '2'
if(sorter.columnKey == 'attestationRank_dictText'){ if(sorter.columnKey == 'attestationRank_dictText'){
this.orderByField = 'attestationRank' this.orderByField = 'attestationRank'
} else if(sorter.columnKey == 'dutyTerritory_dictText'){
this.orderByField = 'dutyTerritory'
} else{ } else{
this.orderByField = sorter.columnKey this.orderByField = sorter.columnKey
} }
@@ -56,6 +56,7 @@
:pagination="false" :pagination="false"
:scroll="{x: '100%'}" :scroll="{x: '100%'}"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
@change="tableOnChange"
:data-source="dataSource" :data-source="dataSource"
:columns="columns" :columns="columns"
> >
@@ -91,6 +92,8 @@
return { return {
queryParam: {}, queryParam: {},
loading: false, loading: false,
orderBy: '1',
orderByField: '',
dataSource: [], dataSource: [],
selectedRowKeys: [], selectedRowKeys: [],
columns: [ columns: [
@@ -100,6 +103,7 @@
dataIndex: 'serialNumber', dataIndex: 'serialNumber',
scopedSlots: { customRender: 'standard' }, scopedSlots: { customRender: 'standard' },
ellipsis: true, ellipsis: true,
sorter:true,
width: 180 width: 180
}, },
{ {
@@ -115,6 +119,7 @@
align: 'center', align: 'center',
dataIndex: 'flowType', dataIndex: 'flowType',
ellipsis: true, ellipsis: true,
sorter:true,
width: 180 width: 180
}, },
{ {
@@ -122,6 +127,7 @@
align: 'center', align: 'center',
dataIndex: 'dutyTerritory', dataIndex: 'dutyTerritory',
ellipsis: true, ellipsis: true,
sorter:true,
width: 180 width: 180
}, },
{ {
@@ -129,6 +135,7 @@
align: 'center', align: 'center',
dataIndex: 'problemType', dataIndex: 'problemType',
ellipsis: true, ellipsis: true,
sorter:true,
width: 180 width: 180
}, },
{ {
@@ -136,6 +143,7 @@
align: 'center', align: 'center',
dataIndex: 'initiator', dataIndex: 'initiator',
ellipsis: true, ellipsis: true,
sorter:true,
width: 140 width: 140
}, },
{ {
@@ -143,6 +151,7 @@
align: 'center', align: 'center',
dataIndex: 'duty', dataIndex: 'duty',
ellipsis: true, ellipsis: true,
sorter:true,
width: 140 width: 140
} }
], ],
@@ -218,11 +227,18 @@
} }
downloadFilePost(this.url.exportData, this.$t('NonConformance') + '.xls', query, this.Deselect) downloadFilePost(this.url.exportData, this.$t('NonConformance') + '.xls', query, this.Deselect)
}, },
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey
this.getList()
},
getList() { getList() {
let query = { let query = {
pageNo: this.pageNo, pageNo: this.pageNo,
pageSize: this.pageSize, pageSize: this.pageSize,
projectLibraryId: this.$route.query.id, projectLibraryId: this.$route.query.id,
orderBy: this.orderBy,
orderByField: this.orderByField,
...this.queryParam ...this.queryParam
} }
this.loading = true this.loading = true