[update] 修改选人组件的全选
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<j-modal
|
<j-modal
|
||||||
|
:title="$t('userSelect.selectUser')"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:width="1000"
|
:width="1000"
|
||||||
:closable="true"
|
:closable="true"
|
||||||
@@ -8,12 +9,7 @@
|
|||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
switchFullscreen
|
switchFullscreen
|
||||||
:visible="visible">
|
:visible="visible">
|
||||||
<template v-slot:title>
|
<div class="modal-search-wrapper table-page-search-wrapper search-wrap">
|
||||||
<!-- 全选所有 -->
|
|
||||||
<a-checkbox v-if="type === 'checkbox'" v-model="isCheckedAll" class="modal-title-check" @change="checkedAllChange"/>
|
|
||||||
<span>{{ $t('userSelect.selectUser') }}</span>
|
|
||||||
</template>
|
|
||||||
<div class="modal-search-wrapper table-page-search-wrapper">
|
|
||||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
@@ -32,6 +28,8 @@
|
|||||||
</span>
|
</span>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
<!-- 全选所有 -->
|
||||||
|
<a-checkbox v-if="type === 'checkbox'" v-model="isCheckedAll" class="modal-title-check" @change="checkedAllChange"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<a-table
|
<a-table
|
||||||
@@ -101,14 +99,45 @@ export default {
|
|||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
handler (val) {
|
handler (val) {
|
||||||
console.log(val.length, this.ipagination.total)
|
console.log(this.currentQueryAllData, this.dataSourceRight)
|
||||||
if (val.length !== 0 && val.length === this.ipagination.total) {
|
const arrOne = this.currentQueryAllData.map(item => item.contactId)
|
||||||
// 说明都选中了
|
const arrTwo = this.dataSourceRight.map(item => item.contactId)
|
||||||
|
const temp = []
|
||||||
|
for (const item of arrTwo) {
|
||||||
|
arrOne.includes(item) ? temp.push(item) : ''
|
||||||
|
}
|
||||||
|
if (val.length !== 0 && this.dataSourceRight.length >= this.ipagination.total && temp.length === this.currentQueryAllData.length) {
|
||||||
|
// 选中数据长度等于当前表格总长度
|
||||||
this.isCheckedAll = true
|
this.isCheckedAll = true
|
||||||
} else {
|
} else {
|
||||||
this.isCheckedAll = false
|
this.isCheckedAll = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
dataSource: {
|
||||||
|
immediate: true,
|
||||||
|
deep: true,
|
||||||
|
handler (val) {
|
||||||
|
console.log(this.currentQueryAllData, this.dataSourceRight)
|
||||||
|
const arrOne = this.currentQueryAllData.map(item => item.contactId)
|
||||||
|
const arrTwo = this.dataSourceRight.map(item => item.contactId)
|
||||||
|
const temp = []
|
||||||
|
for (const item of arrTwo) {
|
||||||
|
arrOne.includes(item) ? temp.push(item) : ''
|
||||||
|
}
|
||||||
|
if (this.dataSourceRight.length !== 0 && this.dataSourceRight.length >= this.ipagination.total && temp.length === this.currentQueryAllData.length) {
|
||||||
|
// 选中数据长度等于当前表格总长度
|
||||||
|
this.isCheckedAll = true
|
||||||
|
} else {
|
||||||
|
this.isCheckedAll = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryParam: {
|
||||||
|
deep: true,
|
||||||
|
handler (val) {
|
||||||
|
this.isClickedSearch = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -170,7 +199,11 @@ export default {
|
|||||||
url: {
|
url: {
|
||||||
userList: '/laws/system/lawsContactManage/pageMerge',
|
userList: '/laws/system/lawsContactManage/pageMerge',
|
||||||
userListByIds: '/sys/user/queryByIds'
|
userListByIds: '/sys/user/queryByIds'
|
||||||
}
|
},
|
||||||
|
isClickedSearch: false, // 改完搜索条件是否点击过搜索
|
||||||
|
oldQueryParam: {}, // 上一次的搜索条件,用于从一个搜索条件改成另一个搜索条件,但是没有点搜索,这时候全选时传旧的搜索条件
|
||||||
|
oldTotal: 0,
|
||||||
|
currentQueryAllData: [] // 当前查询条件下的所有数据
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -189,40 +222,68 @@ export default {
|
|||||||
checkedAllChange (e) {
|
checkedAllChange (e) {
|
||||||
console.log(e.target.checked)
|
console.log(e.target.checked)
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
this.loadingLeft = true
|
this.checkCurrentAll()
|
||||||
const params = {}
|
|
||||||
params.pageNo = 1
|
|
||||||
params.pageSize = this.ipagination.total + 10
|
|
||||||
params.column = 'createTime'
|
|
||||||
params.order = 'desc'
|
|
||||||
getAction(this.url.userList, params).then(res => {
|
|
||||||
if (res.success) {
|
|
||||||
this.dataSourceRight = res.result.records || []
|
|
||||||
this.selectedRowKeys = (res.result.records || []).map(item => item.contactId)
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
this.loadingLeft = false
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
this.dataSourceRight = []
|
this.dataSourceRight = []
|
||||||
this.selectedRowKeys = []
|
this.selectedRowKeys = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
checkCurrentAll () {
|
||||||
|
this.loadingLeft = true
|
||||||
|
let params
|
||||||
|
if (this.isClickedSearch) {
|
||||||
|
// 点击过搜索了,传搜索条件
|
||||||
|
params = Object.assign({}, this.queryParam)
|
||||||
|
} else {
|
||||||
|
// 没点击过搜索,传旧的搜索条件
|
||||||
|
params = Object.assign({}, this.oldQueryParam)
|
||||||
|
}
|
||||||
|
params.pageNo = 1
|
||||||
|
params.pageSize = this.ipagination.total + 10
|
||||||
|
params.column = 'createTime'
|
||||||
|
params.order = 'desc'
|
||||||
|
getAction(this.url.userList, params).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.dataSourceRight = res.result.records || []
|
||||||
|
this.selectedRowKeys = (res.result.records || []).map(item => item.contactId)
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loadingLeft = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取当前查询条件的所有数据
|
||||||
|
async getCurrentAllData () {
|
||||||
|
const params = Object.assign({}, this.queryParam)
|
||||||
|
params.pageNo = 1
|
||||||
|
params.pageSize = 100000000
|
||||||
|
params.column = 'createTime'
|
||||||
|
params.order = 'desc'
|
||||||
|
await getAction(this.url.userList, params).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.currentQueryAllData = res.result.records || []
|
||||||
|
console.log('00000000000获取完当前所有数据了', this.currentQueryAllData)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
searchReset () {
|
searchReset () {
|
||||||
this.queryParam = {}
|
this.queryParam = {}
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
searchQuery () {
|
searchQuery () {
|
||||||
|
this.isClickedSearch = true
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
// 获取用户左侧树列表
|
// 获取用户左侧树列表
|
||||||
loadData () {
|
async loadData () {
|
||||||
|
this.loadingLeft = true
|
||||||
|
if (this.type === 'checkbox') {
|
||||||
|
await this.getCurrentAllData()
|
||||||
|
}
|
||||||
const params = Object.assign({}, this.queryParam)
|
const params = Object.assign({}, this.queryParam)
|
||||||
params.pageNo = this.ipagination.current
|
params.pageNo = this.ipagination.current
|
||||||
params.pageSize = this.ipagination.pageSize
|
params.pageSize = this.ipagination.pageSize
|
||||||
params.column = 'createTime'
|
params.column = 'createTime'
|
||||||
params.order = 'desc'
|
params.order = 'desc'
|
||||||
this.loadingLeft = true
|
|
||||||
getAction(this.url.userList, params).then((res) => {
|
getAction(this.url.userList, params).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
if (res.result.current > 1 && res.result.records.length === 0) {
|
if (res.result.current > 1 && res.result.records.length === 0) {
|
||||||
@@ -230,6 +291,7 @@ export default {
|
|||||||
this.loadData()
|
this.loadData()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.oldQueryParam = Object.assign({}, this.queryParam)
|
||||||
this.dataSource = res.result.records || []
|
this.dataSource = res.result.records || []
|
||||||
this.ipagination.total = res.result.total
|
this.ipagination.total = res.result.total
|
||||||
} else {
|
} else {
|
||||||
@@ -341,7 +403,8 @@ export default {
|
|||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.modal-title-check {
|
.modal-title-check {
|
||||||
margin-right: 10px;
|
margin-left: 25px;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
.modal-content {
|
.modal-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<j-modal
|
<j-modal
|
||||||
|
:title="$t('userSelect.selectUser')"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:width="1000"
|
:width="1000"
|
||||||
:closable="true"
|
:closable="true"
|
||||||
@@ -8,12 +9,7 @@
|
|||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
switchFullscreen
|
switchFullscreen
|
||||||
:visible="visible">
|
:visible="visible">
|
||||||
<template v-slot:title>
|
<div class="modal-search-wrapper table-page-search-wrapper search-wrap">
|
||||||
<!-- 全选所有 -->
|
|
||||||
<a-checkbox v-if="type === 'checkbox'" v-model="isCheckedAll" class="modal-title-check" @change="checkedAllChange"/>
|
|
||||||
<span>{{ $t('userSelect.selectUser') }}</span>
|
|
||||||
</template>
|
|
||||||
<div class="modal-search-wrapper table-page-search-wrapper">
|
|
||||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
@@ -32,6 +28,8 @@
|
|||||||
</span>
|
</span>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
<!-- 全选所有 -->
|
||||||
|
<a-checkbox v-if="type === 'checkbox'" v-model="isCheckedAll" class="modal-title-check" @change="checkedAllChange"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<a-table
|
<a-table
|
||||||
@@ -128,14 +126,43 @@ export default {
|
|||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
handler (val) {
|
handler (val) {
|
||||||
console.log(val.length, this.ipagination.total)
|
console.log(this.currentQueryAllData)
|
||||||
if (val.length !== 0 && val.length === this.ipagination.total) {
|
const arrOne = this.currentQueryAllData.map(item => item.id)
|
||||||
// 说明都选中了
|
const arrTwo = this.dataSourceRight.map(item => item.id)
|
||||||
|
const temp = []
|
||||||
|
for (const item of arrTwo) {
|
||||||
|
arrOne.includes(item) ? temp.push(item) : ''
|
||||||
|
}
|
||||||
|
if (val.length !== 0 && this.dataSourceRight.length >= this.ipagination.total && temp.length === this.currentQueryAllData.length) {
|
||||||
this.isCheckedAll = true
|
this.isCheckedAll = true
|
||||||
} else {
|
} else {
|
||||||
this.isCheckedAll = false
|
this.isCheckedAll = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
dataSource: {
|
||||||
|
immediate: true,
|
||||||
|
handler (val) {
|
||||||
|
console.log(this.currentQueryAllData)
|
||||||
|
const arrOne = this.currentQueryAllData.map(item => item.id)
|
||||||
|
const arrTwo = this.dataSourceRight.map(item => item.id)
|
||||||
|
const temp = []
|
||||||
|
for (const item of arrTwo) {
|
||||||
|
arrOne.includes(item) ? temp.push(item) : ''
|
||||||
|
}
|
||||||
|
if (this.dataSourceRight.length !== 0 && this.dataSourceRight.length >= this.ipagination.total && temp.length === this.currentQueryAllData.length) {
|
||||||
|
// 选中数据长度和表格总数相等或者和上次查询的总数相等
|
||||||
|
this.isCheckedAll = true
|
||||||
|
} else {
|
||||||
|
this.isCheckedAll = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryParam: {
|
||||||
|
deep: true,
|
||||||
|
handler (val) {
|
||||||
|
this.isClickedSearch = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -197,7 +224,11 @@ export default {
|
|||||||
url: {
|
url: {
|
||||||
userList: '/laws/system/lawsContactManage/page',
|
userList: '/laws/system/lawsContactManage/page',
|
||||||
userListByIds: '/laws/system/lawsContactManage/queryById'
|
userListByIds: '/laws/system/lawsContactManage/queryById'
|
||||||
}
|
},
|
||||||
|
isClickedSearch: false, // 改完搜索条件是否点击过搜索
|
||||||
|
oldQueryParam: {}, // 上一次的搜索条件,用于从一个搜索条件改成另一个搜索条件,但是没有点搜索,这时候全选时传旧的搜索条件
|
||||||
|
oldTotal: 0,
|
||||||
|
currentQueryAllData: [] // 当前查询条件下的所有数据
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -220,40 +251,67 @@ export default {
|
|||||||
checkedAllChange (e) {
|
checkedAllChange (e) {
|
||||||
console.log(e.target.checked)
|
console.log(e.target.checked)
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
this.loadingLeft = true
|
this.checkCurrentAll()
|
||||||
const params = {}
|
|
||||||
params.pageNo = 1
|
|
||||||
params.pageSize = this.ipagination.total + 10
|
|
||||||
params.column = 'createTime'
|
|
||||||
params.order = 'desc'
|
|
||||||
getAction(this.url.userList, params).then(res => {
|
|
||||||
if (res.success) {
|
|
||||||
this.dataSourceRight = res.result.records || []
|
|
||||||
this.selectedRowKeys = (res.result.records || []).map(item => item.id)
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
this.loadingLeft = false
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
this.dataSourceRight = []
|
this.dataSourceRight = []
|
||||||
this.selectedRowKeys = []
|
this.selectedRowKeys = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
checkCurrentAll () {
|
||||||
|
this.loadingLeft = true
|
||||||
|
let params
|
||||||
|
if (this.isClickedSearch) {
|
||||||
|
// 点击过搜索了,传搜索条件
|
||||||
|
params = Object.assign({}, this.queryParam)
|
||||||
|
} else {
|
||||||
|
// 没点击过搜索,传旧的搜索条件
|
||||||
|
params = Object.assign({}, this.oldQueryParam)
|
||||||
|
}
|
||||||
|
params.pageNo = 1
|
||||||
|
params.pageSize = this.ipagination.total + 10
|
||||||
|
params.column = 'createTime'
|
||||||
|
params.order = 'desc'
|
||||||
|
getAction(this.url.userList, params).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.dataSourceRight = res.result.records || []
|
||||||
|
this.selectedRowKeys = (res.result.records || []).map(item => item.id)
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loadingLeft = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取当前查询条件的所有数据
|
||||||
|
async getCurrentAllData () {
|
||||||
|
const params = Object.assign({}, this.queryParam)
|
||||||
|
params.pageNo = 1
|
||||||
|
params.pageSize = 100000000
|
||||||
|
params.column = 'createTime'
|
||||||
|
params.order = 'desc'
|
||||||
|
await getAction(this.url.userList, params).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.currentQueryAllData = res.result.records || []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
searchReset () {
|
searchReset () {
|
||||||
this.queryParam = {}
|
this.queryParam = {}
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
searchQuery () {
|
searchQuery () {
|
||||||
|
this.isClickedSearch = true
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
// 获取用户左侧树列表
|
// 获取用户左侧树列表
|
||||||
loadData () {
|
async loadData () {
|
||||||
|
this.loadingLeft = true
|
||||||
|
if (this.type === 'checkbox') {
|
||||||
|
await this.getCurrentAllData()
|
||||||
|
}
|
||||||
const params = Object.assign({}, this.queryParam)
|
const params = Object.assign({}, this.queryParam)
|
||||||
params.pageNo = this.ipagination.current
|
params.pageNo = this.ipagination.current
|
||||||
params.pageSize = this.ipagination.pageSize
|
params.pageSize = this.ipagination.pageSize
|
||||||
params.column = 'createTime'
|
params.column = 'createTime'
|
||||||
params.order = 'desc'
|
params.order = 'desc'
|
||||||
this.loadingLeft = true
|
|
||||||
getAction(this.url.userList, params).then((res) => {
|
getAction(this.url.userList, params).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
if (res.result.current > 1 && res.result.records.length === 0) {
|
if (res.result.current > 1 && res.result.records.length === 0) {
|
||||||
@@ -261,6 +319,7 @@ export default {
|
|||||||
this.loadData()
|
this.loadData()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.oldQueryParam = Object.assign({}, this.queryParam)
|
||||||
this.dataSource = res.result.records || []
|
this.dataSource = res.result.records || []
|
||||||
this.ipagination.total = res.result.total
|
this.ipagination.total = res.result.total
|
||||||
} else {
|
} else {
|
||||||
@@ -365,7 +424,8 @@ export default {
|
|||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.modal-title-check {
|
.modal-title-check {
|
||||||
margin-right: 10px;
|
margin-left: 25px;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
.modal-content {
|
.modal-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<j-modal
|
<j-modal
|
||||||
|
:title="$t('userSelect.selectUser')"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:width="1200"
|
:width="1200"
|
||||||
:closable="true"
|
:closable="true"
|
||||||
@@ -8,11 +9,6 @@
|
|||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
switchFullscreen
|
switchFullscreen
|
||||||
:visible="visible">
|
:visible="visible">
|
||||||
<template v-slot:title>
|
|
||||||
<!-- 全选所有 -->
|
|
||||||
<a-checkbox v-if="type === 'checkbox'" v-model="isCheckedAll" class="modal-title-check" @change="checkedAllChange"/>
|
|
||||||
<span>{{ $t('userSelect.selectUser') }}</span>
|
|
||||||
</template>
|
|
||||||
<div class="modal-top-wrapper">
|
<div class="modal-top-wrapper">
|
||||||
<div class="modal-left-wrapper">
|
<div class="modal-left-wrapper">
|
||||||
<a-spin :spinning="treeLoading">
|
<a-spin :spinning="treeLoading">
|
||||||
@@ -39,7 +35,7 @@
|
|||||||
</a-spin>
|
</a-spin>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-right-wrapper">
|
<div class="modal-right-wrapper">
|
||||||
<div class="modal-search-wrapper table-page-search-wrapper">
|
<div class="modal-search-wrapper table-page-search-wrapper search-wrap">
|
||||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
@@ -82,6 +78,8 @@
|
|||||||
</span>
|
</span>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
<!-- 全选所有 -->
|
||||||
|
<a-checkbox v-if="type === 'checkbox'" v-model="isCheckedAll" class="modal-title-check" @change="checkedAllChange"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<a-table
|
<a-table
|
||||||
@@ -154,14 +152,44 @@ export default {
|
|||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
handler (val) {
|
handler (val) {
|
||||||
console.log(val.length, this.ipagination.total)
|
console.log(this.currentQueryAllData)
|
||||||
if (val.length !== 0 && val.length === this.ipagination.total) {
|
const arrOne = this.currentQueryAllData.map(item => item.userId)
|
||||||
// 说明都选中了
|
const arrTwo = this.dataSourceRight.map(item => item.userId)
|
||||||
|
const temp = []
|
||||||
|
for (const item of arrTwo) {
|
||||||
|
arrOne.includes(item) ? temp.push(item) : ''
|
||||||
|
}
|
||||||
|
if (val.length !== 0 && this.dataSourceRight.length >= this.ipagination.total && temp.length === this.currentQueryAllData.length) {
|
||||||
|
// 选中数据长度等于当前表格总长度
|
||||||
this.isCheckedAll = true
|
this.isCheckedAll = true
|
||||||
} else {
|
} else {
|
||||||
this.isCheckedAll = false
|
this.isCheckedAll = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
dataSource: {
|
||||||
|
immediate: true,
|
||||||
|
handler (val) {
|
||||||
|
console.log(this.currentQueryAllData)
|
||||||
|
const arrOne = this.currentQueryAllData.map(item => item.userId)
|
||||||
|
const arrTwo = this.dataSourceRight.map(item => item.userId)
|
||||||
|
const temp = []
|
||||||
|
for (const item of arrTwo) {
|
||||||
|
arrOne.includes(item) ? temp.push(item) : ''
|
||||||
|
}
|
||||||
|
if (this.dataSourceRight.length !== 0 && this.dataSourceRight.length >= this.ipagination.total && temp.length === this.currentQueryAllData.length) {
|
||||||
|
// 选中数据长度等于当前表格总长度
|
||||||
|
this.isCheckedAll = true
|
||||||
|
} else {
|
||||||
|
this.isCheckedAll = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryParam: {
|
||||||
|
deep: true,
|
||||||
|
handler (val) {
|
||||||
|
this.isClickedSearch = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -224,7 +252,11 @@ export default {
|
|||||||
url: {
|
url: {
|
||||||
userList: '/act/user/workGroupPage',
|
userList: '/act/user/workGroupPage',
|
||||||
userListByIds: '/sys/user/queryByIds'
|
userListByIds: '/sys/user/queryByIds'
|
||||||
}
|
},
|
||||||
|
isClickedSearch: false, // 改完搜索条件是否点击过搜索
|
||||||
|
oldQueryParam: {}, // 上一次的搜索条件,用于从一个搜索条件改成另一个搜索条件,但是没有点搜索,这时候全选时传旧的搜索条件
|
||||||
|
oldTotal: 0,
|
||||||
|
currentQueryAllData: [] // 当前查询条件下的所有数据
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -288,36 +320,61 @@ export default {
|
|||||||
checkedAllChange (e) {
|
checkedAllChange (e) {
|
||||||
console.log(e.target.checked)
|
console.log(e.target.checked)
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
this.loadingLeft = true
|
this.checkCurrentAll()
|
||||||
const params = {}
|
|
||||||
params.pageNo = 1
|
|
||||||
params.pageSize = this.ipagination.total + 10
|
|
||||||
getAction(this.url.userList, params).then(res => {
|
|
||||||
if (res.success) {
|
|
||||||
this.dataSourceRight = res.result.records || []
|
|
||||||
this.selectedRowKeys = (res.result.records || []).map(item => item.userId)
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
this.loadingLeft = false
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
this.dataSourceRight = []
|
this.dataSourceRight = []
|
||||||
this.selectedRowKeys = []
|
this.selectedRowKeys = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
checkCurrentAll () {
|
||||||
|
this.loadingLeft = true
|
||||||
|
let params
|
||||||
|
if (this.isClickedSearch) {
|
||||||
|
// 点击过搜索了,传搜索条件
|
||||||
|
params = Object.assign({}, this.queryParam)
|
||||||
|
} else {
|
||||||
|
// 没点击过搜索,传旧的搜索条件
|
||||||
|
params = Object.assign({}, this.oldQueryParam)
|
||||||
|
}
|
||||||
|
params.pageNo = 1
|
||||||
|
params.pageSize = this.ipagination.total + 10
|
||||||
|
getAction(this.url.userList, params).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.dataSourceRight = res.result.records || []
|
||||||
|
this.selectedRowKeys = (res.result.records || []).map(item => item.userId)
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loadingLeft = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取当前查询条件的所有数据
|
||||||
|
async getCurrentAllData () {
|
||||||
|
const params = Object.assign({}, this.queryParam)
|
||||||
|
params.pageNo = 1
|
||||||
|
params.pageSize = 100000000
|
||||||
|
await getAction(this.url.userList, params).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.currentQueryAllData = res.result.records || []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
searchReset () {
|
searchReset () {
|
||||||
this.queryParam = {}
|
this.queryParam = {}
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
searchQuery () {
|
searchQuery () {
|
||||||
|
this.isClickedSearch = true
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
// 获取用户左侧树列表
|
// 获取用户左侧树列表
|
||||||
loadData () {
|
async loadData () {
|
||||||
|
this.loadingLeft = true
|
||||||
|
if (this.type === 'checkbox') {
|
||||||
|
await this.getCurrentAllData()
|
||||||
|
}
|
||||||
const params = Object.assign({}, this.queryParam)
|
const params = Object.assign({}, this.queryParam)
|
||||||
params.pageNo = this.ipagination.current
|
params.pageNo = this.ipagination.current
|
||||||
params.pageSize = this.ipagination.pageSize
|
params.pageSize = this.ipagination.pageSize
|
||||||
this.loadingLeft = true
|
|
||||||
getAction(this.url.userList, params).then((res) => {
|
getAction(this.url.userList, params).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
if (res.result.current > 1 && res.result.records.length === 0) {
|
if (res.result.current > 1 && res.result.records.length === 0) {
|
||||||
@@ -325,6 +382,7 @@ export default {
|
|||||||
this.loadData()
|
this.loadData()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.oldQueryParam = Object.assign({}, this.queryParam)
|
||||||
this.dataSource = res.result.records || []
|
this.dataSource = res.result.records || []
|
||||||
this.ipagination.total = res.result.total
|
this.ipagination.total = res.result.total
|
||||||
} else {
|
} else {
|
||||||
@@ -430,8 +488,13 @@ export default {
|
|||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
@import '~@assets/less/common.less';
|
@import '~@assets/less/common.less';
|
||||||
|
.search-wrap {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
.modal-title-check {
|
.modal-title-check {
|
||||||
margin-right: 10px;
|
position: absolute;
|
||||||
|
left: 25px;
|
||||||
|
bottom: 10px;
|
||||||
}
|
}
|
||||||
.modal-top-wrapper {
|
.modal-top-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<j-modal
|
<j-modal
|
||||||
|
:title="$t('userSelect.selectUser')"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:width="1000"
|
:width="1000"
|
||||||
:closable="true"
|
:closable="true"
|
||||||
@@ -8,12 +9,7 @@
|
|||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
switchFullscreen
|
switchFullscreen
|
||||||
:visible="visible">
|
:visible="visible">
|
||||||
<template v-slot:title>
|
<div class="modal-search-wrapper table-page-search-wrapper search-wrap">
|
||||||
<!-- 全选所有 -->
|
|
||||||
<a-checkbox v-if="type === 'checkbox'" v-model="isCheckedAll" class="modal-title-check" @change="checkedAllChange"/>
|
|
||||||
<span>{{ $t('userSelect.selectUser') }}</span>
|
|
||||||
</template>
|
|
||||||
<div class="modal-search-wrapper table-page-search-wrapper">
|
|
||||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
@@ -57,6 +53,8 @@
|
|||||||
</span>
|
</span>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
<!-- 全选所有 -->
|
||||||
|
<a-checkbox v-if="type === 'checkbox'" v-model="isCheckedAll" class="modal-title-check" @change="checkedAllChange">全选</a-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<a-table
|
<a-table
|
||||||
@@ -129,14 +127,44 @@ export default {
|
|||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
handler (val) {
|
handler (val) {
|
||||||
console.log(val.length, this.ipagination.total)
|
console.log(this.currentQueryAllData)
|
||||||
if (val.length !== 0 && val.length === this.ipagination.total) {
|
const arrOne = this.currentQueryAllData.map(item => item.id)
|
||||||
// 说明都选中了
|
const arrTwo = this.dataSourceRight.map(item => item.id)
|
||||||
|
const temp = []
|
||||||
|
for (const item of arrTwo) {
|
||||||
|
arrOne.includes(item) ? temp.push(item) : ''
|
||||||
|
}
|
||||||
|
if (val.length !== 0 && this.dataSourceRight.length >= this.ipagination.total && temp.length === this.currentQueryAllData.length) {
|
||||||
|
// 选中数据长度等于当前表格总长度
|
||||||
this.isCheckedAll = true
|
this.isCheckedAll = true
|
||||||
} else {
|
} else {
|
||||||
this.isCheckedAll = false
|
this.isCheckedAll = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
dataSource: {
|
||||||
|
immediate: true,
|
||||||
|
handler (val) {
|
||||||
|
console.log(this.currentQueryAllData)
|
||||||
|
const arrOne = this.currentQueryAllData.map(item => item.id)
|
||||||
|
const arrTwo = this.dataSourceRight.map(item => item.id)
|
||||||
|
const temp = []
|
||||||
|
for (const item of arrTwo) {
|
||||||
|
arrOne.includes(item) ? temp.push(item) : ''
|
||||||
|
}
|
||||||
|
if (this.dataSourceRight.length !== 0 && this.dataSourceRight.length >= this.ipagination.total && temp.length === this.currentQueryAllData.length) {
|
||||||
|
// 选中数据长度等于当前表格总长度
|
||||||
|
this.isCheckedAll = true
|
||||||
|
} else {
|
||||||
|
this.isCheckedAll = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryParam: {
|
||||||
|
deep: true,
|
||||||
|
handler (val) {
|
||||||
|
this.isClickedSearch = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -196,7 +224,11 @@ export default {
|
|||||||
url: {
|
url: {
|
||||||
userList: '/sys/user/page',
|
userList: '/sys/user/page',
|
||||||
userListByIds: '/sys/user/queryByIds'
|
userListByIds: '/sys/user/queryByIds'
|
||||||
}
|
},
|
||||||
|
isClickedSearch: false, // 改完搜索条件是否点击过搜索
|
||||||
|
oldQueryParam: {}, // 上一次的搜索条件,用于从一个搜索条件改成另一个搜索条件,但是没有点搜索,这时候全选时传旧的搜索条件
|
||||||
|
oldTotal: 0,
|
||||||
|
currentQueryAllData: [] // 当前查询条件下的所有数据
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -234,35 +266,65 @@ export default {
|
|||||||
checkedAllChange (e) {
|
checkedAllChange (e) {
|
||||||
console.log(e.target.checked)
|
console.log(e.target.checked)
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
this.loadingLeft = true
|
this.checkCurrentAll()
|
||||||
const params = {}
|
|
||||||
params.pageNo = 1
|
|
||||||
params.pageSize = this.ipagination.total + 10
|
|
||||||
params.field = 'id,avatar,username,realname,sex_dictText,phone,orgCodeTxt,roleTxt,status_dictText'
|
|
||||||
params.column = 'createTime'
|
|
||||||
params.order = 'desc'
|
|
||||||
getAction(this.url.userList, params).then(res => {
|
|
||||||
if (res.success) {
|
|
||||||
this.dataSourceRight = res.result.records || []
|
|
||||||
this.selectedRowKeys = (res.result.records || []).map(item => item.id)
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
this.loadingLeft = false
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
this.dataSourceRight = []
|
this.dataSourceRight = []
|
||||||
this.selectedRowKeys = []
|
this.selectedRowKeys = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
checkCurrentAll () {
|
||||||
|
this.loadingLeft = true
|
||||||
|
let params
|
||||||
|
if (this.isClickedSearch) {
|
||||||
|
// 点击过搜索了,传搜索条件
|
||||||
|
params = Object.assign({}, this.queryParam)
|
||||||
|
} else {
|
||||||
|
// 没点击过搜索,传旧的搜索条件
|
||||||
|
params = Object.assign({}, this.oldQueryParam)
|
||||||
|
}
|
||||||
|
params.pageNo = 1
|
||||||
|
params.pageSize = this.ipagination.total + 10
|
||||||
|
params.field = 'id,avatar,username,realname,sex_dictText,phone,orgCodeTxt,roleTxt,status_dictText'
|
||||||
|
params.column = 'createTime'
|
||||||
|
params.order = 'desc'
|
||||||
|
getAction(this.url.userList, params).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.dataSourceRight = res.result.records || []
|
||||||
|
this.selectedRowKeys = (res.result.records || []).map(item => item.id)
|
||||||
|
this.oldTotal = res.result.total
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loadingLeft = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取当前查询条件的所有数据
|
||||||
|
async getCurrentAllData () {
|
||||||
|
const params = Object.assign({}, this.queryParam)
|
||||||
|
params.pageNo = 1
|
||||||
|
params.pageSize = 100000000
|
||||||
|
params.field = 'id,avatar,username,realname,sex_dictText,phone,orgCodeTxt,roleTxt,status_dictText'
|
||||||
|
params.column = 'createTime'
|
||||||
|
params.order = 'desc'
|
||||||
|
await getAction(this.url.userList, params).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.currentQueryAllData = res.result.records || []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
searchReset () {
|
searchReset () {
|
||||||
this.queryParam = {}
|
this.queryParam = {}
|
||||||
this.loadData(1)
|
this.loadData(1)
|
||||||
},
|
},
|
||||||
searchQuery () {
|
searchQuery () {
|
||||||
|
this.isClickedSearch = true
|
||||||
this.loadData(1)
|
this.loadData(1)
|
||||||
},
|
},
|
||||||
// 获取用户左侧树列表
|
// 获取用户左侧树列表
|
||||||
loadData (arg) {
|
async loadData (arg) {
|
||||||
|
this.loadingLeft = true
|
||||||
|
if (this.type === 'checkbox') {
|
||||||
|
await this.getCurrentAllData()
|
||||||
|
}
|
||||||
if (arg) {
|
if (arg) {
|
||||||
this.ipagination.current = 1
|
this.ipagination.current = 1
|
||||||
}
|
}
|
||||||
@@ -272,7 +334,6 @@ export default {
|
|||||||
params.field = 'id,avatar,username,realname,sex_dictText,phone,orgCodeTxt,roleTxt,status_dictText'
|
params.field = 'id,avatar,username,realname,sex_dictText,phone,orgCodeTxt,roleTxt,status_dictText'
|
||||||
params.column = 'createTime'
|
params.column = 'createTime'
|
||||||
params.order = 'desc'
|
params.order = 'desc'
|
||||||
this.loadingLeft = true
|
|
||||||
getAction(this.url.userList, params).then((res) => {
|
getAction(this.url.userList, params).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
if (res.result.current > 1 && res.result.records.length === 0) {
|
if (res.result.current > 1 && res.result.records.length === 0) {
|
||||||
@@ -280,6 +341,7 @@ export default {
|
|||||||
this.loadData()
|
this.loadData()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.oldQueryParam = Object.assign({}, this.queryParam)
|
||||||
this.dataSource = res.result.records || []
|
this.dataSource = res.result.records || []
|
||||||
this.ipagination.total = res.result.total
|
this.ipagination.total = res.result.total
|
||||||
} else {
|
} else {
|
||||||
@@ -385,8 +447,13 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
.search-wrap {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
.modal-title-check {
|
.modal-title-check {
|
||||||
margin-right: 10px;
|
position: absolute;
|
||||||
|
left: 25px;
|
||||||
|
bottom: 10px;
|
||||||
}
|
}
|
||||||
.modal-content {
|
.modal-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ export const ConfigurableTableMixin = {
|
|||||||
// debugger;
|
// debugger;
|
||||||
console.log(this.$refs.tableRef.resizing)
|
console.log(this.$refs.tableRef.resizing)
|
||||||
if (this.$refs.tableRef.resizing) {
|
if (this.$refs.tableRef.resizing) {
|
||||||
|
// 解决表格调整列宽触发排序的问题
|
||||||
const classNameOne = window.event.target.parentNode.children[0].children[0].children[1].children[0].children[0].className
|
const classNameOne = window.event.target.parentNode.children[0].children[0].children[1].children[0].children[0].className
|
||||||
const classNameTwo = window.event.target.parentNode.children[0].children[0].children[1].children[0].children[1].className
|
const classNameTwo = window.event.target.parentNode.children[0].children[0].children[1].children[0].children[1].className
|
||||||
const target = window.event.target
|
const target = window.event.target
|
||||||
|
|||||||
Reference in New Issue
Block a user