<el-table ref="dragTable" v-loading="listLoading" :data="tableData.rows" height="250" row-key="id" default-expand-all highlight-current-row @selection-change="handleSelectionChange" @row-click="clickRow">
data() {
return {
listLoading: false,
tableData: {
pagination: {
total: 0,
pageNo: 1,
pageSize: 2
},
rows: []
},
currentRow: {},
}
},
clickRow(row) {
if (this.currentRow.id === row.id) {
row = {}
this.currentRow = {}
} else {
this.currentRow = JSON.parse(JSON.stringify(row))
}
this.$emit('selectTableId', row.id)
},
queryEquipmentTableFn(id) {
this.listLoading = true
let params = {
pagesIndex: this.tableData.pagination.pageNo,
pagesSize: this.tableData.pagination.pageSize
}
this.$api.equipmentManage.queryTypeStatisticsList(params)
.then(res => {
if (res.statusCode === 200) {
this.tableData = this.tools.pageToElTableData(res.data)
if (this.currentRow.id) {
let index = this.tableData.rows.findIndex(item => item.id === this.currentRow.id)
this.$refs.dragTable.setCurrentRow(this.tableData.rows[index])
}
this.listLoading = false
} else {
this.$message.error(res.errors)
this.listLoading = false
}
})
},