优化选中

This commit is contained in:
leave 2020-10-29 10:02:57 +08:00
parent 77670ad094
commit f889b51fef

View File

@ -24,11 +24,13 @@
ref="refChooseTable"
max-height="394"
@selection-change="handleSelectionChange"
:row-key="handleGetRowKeys"
v-if="tableList.length"
>
<el-table-column
type="selection"
width="40"
:reserve-selection="true"
></el-table-column>
<el-table-column
prop="name"
@ -66,13 +68,11 @@
:data="seleactedList"
:show-header="false"
max-height="394"
:row-key="handleGetRowKeys"
v-if="seleactedList.length>0"
>
<el-table-column
type="selection"
width="40"
:reserve-selection="true"
>
<template slot-scope="scope">
<i
@ -141,7 +141,7 @@ export default {
seleactedList: [],
pageInfo: {
currPage: 1,
pageSize: 20,
pageSize: 1,
totalCount: 1,
totalPage: 1
}
@ -153,29 +153,20 @@ export default {
},
watch: {
dialogVisible (newVal, oldVal) {
if (newVal) {
if (this.filtersDic.currPage === undefined || !this.filtersDic.currPage) {
this.filtersDic['currPage'] = this.pageInfo.currPage
}
if (this.filtersDic.pageSize === undefined || !this.filtersDic.pageSize) {
this.filtersDic['pageSize'] = this.pageInfo.pageSize
}
if (newVal !== oldVal && newVal) {
this.handleDataList()
}
}
},
methods: {
handleDataList () {
apiGetEvaluationTeamList(this.filtersDic).then(res => {
let paraDic = Object.assign(this.pageInfo, this.filtersDic)
apiGetEvaluationTeamList(paraDic).then(res => {
this.pageInfo.currPage = res.data.currPage
this.pageInfo.totalCount = res.data.totalCount
this.pageInfo.totalPage = res.data.totalPage
this.tableList = res.data.list
})
// for (let index = 0; index < 100; index++) {
// let dic = { id: index.toString(), name: '12' + index.toString(), count: '12' }
// this.tableList.push(dic)
// }
},
// handleGetRowStyle () {
// return { 'height': '44px' }
@ -190,22 +181,32 @@ export default {
},
handleCancel () {
this.handleClear()
this.tableList = []
this.seleactedList = []
this.pageInfo = {
currPage: 1,
pageSize: 1,
totalCount: 1,
totalPage: 1
}
this.$emit('close')
},
handleSubmit () {
this.$emit('submitClick', this.seleactedList)
this.handleCancel()
},
handleSelectionChange (val) {
this.seleactedList = val
},
handleCurrentChange (val) {
this.pageInfo.currPage = val
this.filtersDic['currPage'] = this.pageInfo.currPage
this.handleDataList()
},
handleClear () {
this.seleactedList = []
this.$refs.refChooseTable.clearSelection()
if (this.seleactedList.length) {
this.$refs.refChooseTable.clearSelection()
this.seleactedList = []
}
},
handleDelete (item, index) {
this.seleactedList.splice(index, 1)