|
|
|
@ -13,14 +13,15 @@ import { ElDialog, ElMessageBox,TableInstance } from 'element-plus'; |
|
|
|
const props = withDefaults(defineProps<{ |
|
|
|
uid:string, //当前用户的uuid |
|
|
|
uuid:string, //文档的uuid |
|
|
|
confirmFunc?:(data:string[])=>void, //父级组件完全接管提交流程,组件不在做相关处理 |
|
|
|
closeFunc:Function, //父级只需销毁组件 |
|
|
|
confirmFunc?:(data:string[],infos:string[])=>void, //父级组件完全接管提交流程,组件不在做相关处理 |
|
|
|
closeFunc:(refresh?:boolean)=>void, //父级只需销毁组件 |
|
|
|
}>(),{}) |
|
|
|
|
|
|
|
const treeData =ref<shareOrgInfo[]>([]) |
|
|
|
const members=ref<memberInfo[]>([]) |
|
|
|
const permited=new Set() |
|
|
|
const tableMembersRef=ref<TableInstance>() |
|
|
|
const treeData =ref<shareOrgInfo[]>([]) // 组织结构树的数据源 |
|
|
|
const members=ref<memberInfo[]>([]) //tablelist's data |
|
|
|
const permited=new Set<string>() //文档成员的id列表,用集合结构为了快速实现增删修改 |
|
|
|
const permitedInfos=new Set<string>() //文档成员的姓名职位信息集合,为了实现与成员列表的同步修改 |
|
|
|
const tableMembersRef=ref<TableInstance>() //table组件的引用,为了实现初始选中状态 |
|
|
|
|
|
|
|
|
|
|
|
function onNodeClick(data:shareOrgInfo){ |
|
|
|
@ -41,24 +42,26 @@ function onNodeClick(data:shareOrgInfo){ |
|
|
|
} |
|
|
|
|
|
|
|
function onSavePermChange(){ |
|
|
|
let _list = permited.keys().toArray().filter(val=>val!=='') |
|
|
|
let _list = permited.keys().toArray().filter(val=>val!=='') //成员的key |
|
|
|
let _infos = permitedInfos.keys().toArray().filter(val=>val!=='') //成员的姓名和部门信息 |
|
|
|
|
|
|
|
//由父级组件自主处理,并自动清理本弹窗组件 |
|
|
|
if(props.confirmFunc&&_list){ |
|
|
|
props.confirmFunc(_list) |
|
|
|
props.confirmFunc(_list,_infos) |
|
|
|
props.closeFunc() //关闭销毁 |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
//btoa 是浏览器默认base64码工具 |
|
|
|
postPermitedList(props.uid,{ |
|
|
|
permitList: btoa(_list.join("|")), |
|
|
|
permitList: btoa(_list.join("|")), |
|
|
|
permitInfos:_infos.join("|"), |
|
|
|
update: "true", |
|
|
|
uid: props.uid, |
|
|
|
uuid: props.uuid, |
|
|
|
len: _list.length |
|
|
|
}).then(resp=>{ |
|
|
|
props.closeFunc() |
|
|
|
props.closeFunc(true) |
|
|
|
}).catch(()=>{ |
|
|
|
ElMessageBox.alert("处理失败") |
|
|
|
return |
|
|
|
@ -68,8 +71,10 @@ function onSavePermChange(){ |
|
|
|
function onManualSelect(select:[],row:memberInfo){ |
|
|
|
if(permited.has('p0'+row.keystr)){ //取消 |
|
|
|
permited.delete('p0'+row.keystr) |
|
|
|
permitedInfos.delete(`${row.name}-${row.maindeparmentname}-${row.positionname}`) |
|
|
|
}else{ |
|
|
|
permited.add('p0'+row.keystr) //添加 |
|
|
|
permitedInfos.add(`${row.name}-${row.maindeparmentname}-${row.positionname}`) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -77,10 +82,12 @@ function onSelectionAll(news:memberInfo[]){ |
|
|
|
if(news.length>0){ |
|
|
|
news.forEach((item)=>{ |
|
|
|
permited.add('p0'+item.keystr) |
|
|
|
permitedInfos.add(`${item.name}-${item.maindeparmentname}-${item.positionname}`) |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
news.forEach((item)=>{ |
|
|
|
permited.delete('p0'+item.keystr) |
|
|
|
permitedInfos.delete(`${item.name}-${item.maindeparmentname}-${item.positionname}`) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -89,9 +96,12 @@ onMounted(()=>{ |
|
|
|
//在批量分享文件的时候,是没有uuid的,可以避免服务器的错误提示:uuid should not null |
|
|
|
if(props.uuid!==""){ |
|
|
|
getPermitedList(props.uid,{uuid:props.uuid}).then(resp=>{ |
|
|
|
resp.data?.forEach(item=>{ |
|
|
|
resp.data?.permited?.forEach(item=>{ |
|
|
|
permited.add(item) //userUuids constitue the permited list |
|
|
|
}) |
|
|
|
resp.data?.infos?.forEach(item=>{ |
|
|
|
permitedInfos.add(item) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
@ -124,7 +134,7 @@ onMounted(()=>{ |
|
|
|
<div class="tablelist"> |
|
|
|
<el-table ref="tableMembersRef" |
|
|
|
:data="members" |
|
|
|
row-key="keystr" |
|
|
|
:row-key="row => row.keystr" |
|
|
|
style="overflow-y: auto;height: 500px;" |
|
|
|
@select="onManualSelect" |
|
|
|
@select-all="onSelectionAll" |
|
|
|
|