Browse Source

处理文件分享组件table选中错乱问题

han_v2
han2015 6 months ago
parent
commit
6a0327bbf5
  1. 10
      src/views/doc/sharePermission.vue

10
src/views/doc/sharePermission.vue

@ -25,19 +25,23 @@ const tableMembersRef=ref<TableInstance>() //table组件的引用,为了实现
function onNodeClick(data:shareOrgInfo){ function onNodeClick(data:shareOrgInfo){
members.value=[]//tableRef
getArchivesListPage({adminorg:data.id, page:1,pagesize:13}).then(resp=>{ getArchivesListPage({adminorg:data.id, page:1,pagesize:13}).then(resp=>{
if(resp.data.count >200){ if(resp.data.count >200){
ElMessageBox.alert("人数超过200,请按部门分配权限") ElMessageBox.alert("人数超过200,请按部门分配权限")
return return
} }
members.value=resp.data.list members.value=resp.data.list
// //
setTimeout(() => {
members.value.forEach(row => { members.value.forEach(row => {
if (permited.has('p0'+row.keystr)) { if (permited.has('p0'+row.keystr)) {
// row-key , :reserve-selection="true" // row-key , :reserve-selection="true"
tableMembersRef.value!.toggleRowSelection(row) tableMembersRef.value.toggleRowSelection(row,true)
} }
}) })
}, 500)
}) })
} }
@ -80,12 +84,12 @@ function onManualSelect(select:[],row:memberInfo){
function onSelectionAll(news:memberInfo[]){ function onSelectionAll(news:memberInfo[]){
if(news.length>0){ if(news.length>0){
news.forEach((item)=>{ members.value.forEach((item)=>{
permited.add('p0'+item.keystr) permited.add('p0'+item.keystr)
permitedInfos.add(`${item.name}-${item.maindeparmentname}-${item.positionname}`) permitedInfos.add(`${item.name}-${item.maindeparmentname}-${item.positionname}`)
}) })
}else{ }else{
news.forEach((item)=>{ members.value.forEach((item)=>{
permited.delete('p0'+item.keystr) permited.delete('p0'+item.keystr)
permitedInfos.delete(`${item.name}-${item.maindeparmentname}-${item.positionname}`) permitedInfos.delete(`${item.name}-${item.maindeparmentname}-${item.positionname}`)
}) })

Loading…
Cancel
Save