Commit aad22220 authored by 盖献康's avatar 盖献康

检查管理-选择全部、反向选择

parent 917cad81
......@@ -17,6 +17,14 @@ export function listCheckManage(query) {
})
}
export function selectCheckAll(query) {
return request({
url: '/business/check/checkListAll',
method: 'get',
params: query
})
}
// 查询业务管理-检查管理详细
export function getManage(id) {
return request({
......
......@@ -63,11 +63,13 @@
class="fourWordsBtn"
icon="el-icon-plus"
size="mini"
@click="selectAll()"
>选择全部</el-button>
<el-button
class="fourWordsBtn"
icon="el-icon-edit"
size="mini"
@click="reverseSelect()"
>反向选择</el-button>
<el-button
class="fourWordsBtn"
......@@ -84,8 +86,8 @@
<el-button style="position: relative; float: right;" class="queryBtn" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
</el-row>
<el-table v-loading="loading" :data="manageList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table ref="table" v-loading="loading" :data="manageList" :row-key="getRowKeys" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"/>
<el-table-column label="序号" type="index" align="center" />
<el-table-column label="检查类型" align="center" prop="checkType" width="100">
<template slot-scope="scope">
......@@ -235,7 +237,7 @@
</template>
<script>
import { getManage, delManage, addManage, updateManage, listCheckManage } from '@/api/business/manage'
import { getManage, delManage, addManage, updateManage, listCheckManage, selectCheckAll } from '@/api/business/manage'
import { deviceUseInSubscribeList, listReservationDevice } from '@/api/business/device'
import { listItemByType } from '@/api/business/item'
import { parseTime } from '@/utils/ruoyi'
......@@ -364,6 +366,44 @@ export default {
this.loading = false
})
},
// 表格
getRowKeys(row) {
return row.id
},
/**
* 全部选择
* @param selection 已选择内容
* @param all 是否永远进行全选操作
*/
async selectAll(selection = [], all = true) {
if (this.manageList.length !== selection.length && !all) {
this.effectTableSelect([])
} else {
await this.changeTableSelect()
}
},
/**
* 控制table的选择项
* @param data
*/
effectTableSelect(data = []) {
this.$refs.table.store.states.selection = data
this.$refs.table.store.updateSelectionByRowKey()
this.$refs.table.store.updateAllSelected()
this.$refs.table.$emit('selection-change', data)
},
reverseSelect() {
this.changeTableSelect(this.ids)
},
/**
* 改变table选择项
* @param notIncludeIds 需要排除的id列表
*/
async changeTableSelect(notIncludeIds = []) {
// 获取反选的数据
const { data } = await selectCheckAll({ notIncludeIds })
this.effectTableSelect(data)
},
// 检查日期
changeDate() {
console.log('检查日期', this.form.checkDate)
......
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