Commit 8b2e2971 authored by 王飞龙's avatar 王飞龙

bug修改

parent 9537cd15
...@@ -88,30 +88,25 @@ ...@@ -88,30 +88,25 @@
>新增设备 >新增设备
</el-button> </el-button>
<el-button <el-button
id="all-choice"
v-hasPermi="['business:device:export']" v-hasPermi="['business:device:export']"
class="fourWordswhiteBtn" class="fourWordswhiteBtn"
@click="checkAll()" @click="checkAll('all-choice')"
><svg-icon style="margin-right: 1px" icon-class="shuaixuan_icon_quanbu" /> ><svg-icon style="margin-right: 1px" icon-class="shuaixuan_icon_quanbu" />
选择全部 选择全部
</el-button> </el-button>
<el-button <el-button
id="re-choice"
v-hasPermi="['business:device:export']" v-hasPermi="['business:device:export']"
class="fourWordswhiteBtn" class="fourWordswhiteBtn"
@click="reverseSelection" @click="reverseSelection('re-choice')"
><svg-icon style="margin-right: 1px" icon-class="shuaixuan_icon_fanxiang" />反向选择 ><svg-icon style="margin-right: 1px" icon-class="shuaixuan_icon_fanxiang" />反向选择
</el-button> </el-button>
<!-- <el-button-->
<!-- v-hasPermi="['business:device:import']"-->
<!-- class="fourWordswhiteBtn"-->
<!-- @click="handleImport"-->
<!-- >-->
<!-- <svg-icon style="margin-right: 1px" icon-class="shaixuan_icon_daoru" />-->
<!-- 批量导入-->
<!-- </el-button>-->
<el-button <el-button
id="export-handle"
v-hasPermi="['business:device:export']" v-hasPermi="['business:device:export']"
class="fourWordswhiteBtn" class="fourWordswhiteBtn"
@click="handleExport" @click="handleExport('export-handle')"
> >
<svg-icon style="margin-right: 1px" icon-class="shaixuan_icon_daochu" /> <svg-icon style="margin-right: 1px" icon-class="shaixuan_icon_daochu" />
批量导出 批量导出
...@@ -672,10 +667,11 @@ export default { ...@@ -672,10 +667,11 @@ export default {
// }) // })
// }, // },
// 选择全部 // 选择全部
checkAll() { checkAll(allChoiceButtonId) {
this.ids = this.idsForever this.ids = this.idsForever
// 调用手动勾选 // 调用手动勾选
this.manualCheck() this.manualCheck()
document.getElementById(allChoiceButtonId).blur()
}, },
// 手动勾选 // 手动勾选
manualCheck() { manualCheck() {
...@@ -693,7 +689,7 @@ export default { ...@@ -693,7 +689,7 @@ export default {
}, },
// 反向选择(把永久临时集合和变化的临时集合做减法重新赋给变化的临时集合赋给) // 反向选择(把永久临时集合和变化的临时集合做减法重新赋给变化的临时集合赋给)
reverseSelection() { reverseSelection(reChoice) {
const temp = [] const temp = []
this.idsForever.forEach(item => { this.idsForever.forEach(item => {
if (!this.ids.includes(item)) { if (!this.ids.includes(item)) {
...@@ -703,6 +699,7 @@ export default { ...@@ -703,6 +699,7 @@ export default {
this.ids = temp this.ids = temp
console.log('反选的数据', this.ids) console.log('反选的数据', this.ids)
this.manualCheck() this.manualCheck()
document.getElementById(reChoice).blur()
}, },
// 表格当前手动勾选的 // 表格当前手动勾选的
selectChange(selection, row) { selectChange(selection, row) {
...@@ -760,7 +757,7 @@ export default { ...@@ -760,7 +757,7 @@ export default {
return formattedDate return formattedDate
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport(exportButtonId) {
if (this.ids.length !== 0) { if (this.ids.length !== 0) {
const exportTable = {} const exportTable = {}
if (this.queryParams.orderByColumn === null) { if (this.queryParams.orderByColumn === null) {
...@@ -774,9 +771,13 @@ export default { ...@@ -774,9 +771,13 @@ export default {
this.download('business/device/export', exportTable, `设备管理-${this.exportFormatTime(new Date())}.xlsx`).then(res => { this.download('business/device/export', exportTable, `设备管理-${this.exportFormatTime(new Date())}.xlsx`).then(res => {
this.$refs.table.clearSelection() this.$refs.table.clearSelection()
this.ids = [] this.ids = []
}).finally(() => {
/* 最后给特定的id进行设置 */
document.getElementById(exportButtonId).blur()
}) })
} else { } else {
this.$modal.msgWarning('请选择至少一条数据导出') this.$modal.msgWarning('请选择至少一条数据导出')
document.getElementById(exportButtonId).blur()
return return
} }
} }
......
...@@ -63,19 +63,22 @@ ...@@ -63,19 +63,22 @@
<el-row> <el-row>
<el-col :span="12" style="padding-bottom: 20px;"> <el-col :span="12" style="padding-bottom: 20px;">
<el-button <el-button
id="all-choice"
class="fourWordswhiteBtn" class="fourWordswhiteBtn"
@click="selectAll()" @click="selectAll('all-choice')"
><svg-icon style="margin-right: 5px" icon-class="shuaixuan_icon_quanbu" /> ><svg-icon style="margin-right: 5px" icon-class="shuaixuan_icon_quanbu" />
选择全部 选择全部
</el-button> </el-button>
<el-button <el-button
id="re-choice"
class="fourWordswhiteBtn" class="fourWordswhiteBtn"
@click="reverseSelect(userList)" @click="reverseSelect('re-choice',userList)"
><svg-icon icon-class="shuaixuan_icon_fanxiang" />反向选择 ><svg-icon icon-class="shuaixuan_icon_fanxiang" />反向选择
</el-button> </el-button>
<el-button <el-button
id="export-handle"
class="fourWordswhiteBtn" class="fourWordswhiteBtn"
@click="handleExport" @click="handleExport('export-handle')"
> <svg-icon icon-class="shaixuan_icon_daochu" /> > <svg-icon icon-class="shaixuan_icon_daochu" />
批量导出 批量导出
</el-button> </el-button>
...@@ -363,7 +366,7 @@ export default { ...@@ -363,7 +366,7 @@ export default {
return formattedDate return formattedDate
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport(exportButtonId) {
if (this.ids.length !== 0) { if (this.ids.length !== 0) {
const exportTable = {} const exportTable = {}
if (this.queryParams.orderByColumn === null) { if (this.queryParams.orderByColumn === null) {
...@@ -376,9 +379,13 @@ export default { ...@@ -376,9 +379,13 @@ export default {
exportTable.useIds = this.ids exportTable.useIds = this.ids
this.download('business/check/exportUse', exportTable, `使用管理-${this.exportFormatTime(new Date())}.xlsx`).then(res => { this.download('business/check/exportUse', exportTable, `使用管理-${this.exportFormatTime(new Date())}.xlsx`).then(res => {
this.$refs.table.clearSelection() this.$refs.table.clearSelection()
}).finally(() => {
/* 最后给特定的id进行设置 */
document.getElementById(exportButtonId).blur()
}) })
} else { } else {
this.$modal.msgWarning('请选择至少一条数据导出') this.$modal.msgWarning('请选择至少一条数据导出')
document.getElementById(exportButtonId).blur()
return return
} }
}, },
...@@ -414,12 +421,13 @@ export default { ...@@ -414,12 +421,13 @@ export default {
* @param selection 已选择内容 * @param selection 已选择内容
* @param all 是否永远进行全选操作 * @param all 是否永远进行全选操作
*/ */
async selectAll(selection = [], all = true) { async selectAll(allChoiceButtonId, selection = [], all = true) {
if (this.userList.length !== selection.length && !all) { if (this.userList.length !== selection.length && !all) {
this.effectTableSelect([]) this.effectTableSelect([])
} else { } else {
await this.changeTableSelect() await this.changeTableSelect()
} }
document.getElementById(allChoiceButtonId).blur()
}, },
/** /**
* 控制table的选择项 * 控制table的选择项
...@@ -441,8 +449,9 @@ export default { ...@@ -441,8 +449,9 @@ export default {
this.effectTableSelect(data) this.effectTableSelect(data)
}, },
// 反向选择 // 反向选择
reverseSelect() { reverseSelect(reChoice) {
this.changeTableSelect(this.ids) this.changeTableSelect(this.ids)
document.getElementById(reChoice).blur()
}, },
// 表格 // 表格
getRowKeys(row) { getRowKeys(row) {
......
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