feat:修改授权

This commit is contained in:
lixg
2022-12-03 19:52:54 +08:00
parent 26b4db6495
commit e117dcdae4
9 changed files with 843 additions and 607 deletions

View File

@@ -118,6 +118,7 @@
columnWidth: 20,
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
preserveSelectedRowKeys: true,
}"
/>
<div class="pa">
@@ -316,6 +317,7 @@
columnWidth: 30,
selectedRowKeys: selectedRowKeys2,
onChange: onSelectChange2,
preserveSelectedRowKeys: true,
}"
/>
<div class="pa" style="margin-top: 20px">
@@ -598,6 +600,14 @@ export default {
type: Number,
default: null,
},
classify: {
type: String,
default: "",
},
selectProjectId: {
type: Number,
default: null,
},
},
setup(props, ctx) {
const store = useStore();
@@ -792,9 +802,35 @@ export default {
deleteAll();
// console.log("expandedKeys", state.expandedKeys);
state.expandedKeys = [];
state.tabledata = [];
//快速选人
state.currentPage = 1;
state.tableDataTotal = 0;
state.nameSearch = ""; //搜索名称
//受众
state.currentPage2 = 1;
state.tableDataTotal2 = 0;
state.audienceName = "";
state.currentPage1 = 1;
state.tableDataTotal1 = 0;
state.selectedKeys = [];
state.selectOrgId = null; //选中的组织id
state.selectOrgName = null; //选中的组织名称
state.searchOrgName = null;
state.isSearchOrg = false;
state.treeData2 = [];
getAudienceInfo();
};
const afterVisibleChange = (bool) => {
console.log("state", bool);
if (bool) {
optionAuthPerm();
}
};
//获取组织树
state.treeData = computed(() => {
@@ -866,12 +902,13 @@ export default {
//分页获取学员
const changePagination = (page) => {
state.currentPage = page;
console.log("1111111");
console.log("1111111", state.selectedRowKeys, state.choosepeople);
getMember(state.selectOrgId);
};
//搜索学员
const handleSearchStu = () => {
deleteDepSelect();
state.currentPage = 1;
state.currentPage2 = 1;
console.log("22222");
getMember();
@@ -891,10 +928,20 @@ export default {
};
//快速选人 选中的数组
const onSelectChange = (selectedRowKeys, item) => {
// console.log("selectedRowKeys changed: ", selectedRowKeys,item);
state.selectedRowKeys.push(selectedRowKeys[selectedRowKeys.length - 1]);
state.choosepeople.unshift(item[item.length - 1]);
console.log("selectedRowKeys changed: ", selectedRowKeys, item);
state.selectedRowKeys = selectedRowKeys;
state.choosepeople = item.reverse();
selectedsHeight();
// if (selectedRowKeys.length > 0 && item.length > 0) {
// state.selectedRowKeys.push(selectedRowKeys[selectedRowKeys.length - 1]);
// state.choosepeople.unshift(item[item.length - 1]);
// // console.log(
// // "selectedRowKeys changed22222: ",
// // state.selectedRowKeys,
// // state.choosepeople
// // );
// }
};
//单个删除选中的人
const deleteChoosePeople = (item) => {
@@ -920,7 +967,7 @@ export default {
resize.listenTo(
document.getElementById("ProjCheckship").querySelector("#selecteds"),
function (ele) {
console.log("ele", ele.offsetHeight);
console.log("ele", ele.clientHeight, ele.offsetHeight);
if (ele.offsetHeight > 160 && !state.showHidden) {
state.showMore = true;
document
@@ -1047,7 +1094,7 @@ export default {
}
}
// console.log("选中的部门2", state.selectedKeys1, state.chooseorganization);
console.log("选中的部门2", state.selectedKeys1, state.chooseorganization);
};
//点击确认添加-判断是否显示确定弹窗
const addOrgModal = () => {
@@ -1070,19 +1117,19 @@ export default {
state.showOrgModal = false;
};
//单个删除选中的
//单个删除选中的组织
const deleteChoosePeople1 = (item) => {
console.log("item", item);
console.log("item", item, state.chooseorganization);
let arr = state.chooseorganization;
for (let i = 0; i < arr.length; i++) {
if (arr[i].key === item.key) {
if (arr[i].id === item.id) {
arr.splice(i, 1);
}
}
state.chooseorganization = arr;
let array = state.selectedKeys1;
for (let i = 0; i < array.length; i++) {
if (array[i] === item.key) {
if (array[i] === item.id) {
array.splice(i, 1);
}
}
@@ -1193,8 +1240,10 @@ export default {
//受众关联 选中的数组
const onSelectChange2 = (selectedRowKeys, item) => {
// console.log("selectedRowKeys changed: ", selectedRowKeys, item);
state.selectedRowKeys2.push(selectedRowKeys[selectedRowKeys.length - 1]);
state.relationpeople.unshift(item[item.length - 1]);
state.selectedRowKeys2 = selectedRowKeys;
state.relationpeople = item.reverse();
// state.selectedRowKeys2.push(selectedRowKeys[selectedRowKeys.length - 1]);
// state.relationpeople.unshift(item[item.length - 1]);
selectedsHeight2();
};
@@ -1331,6 +1380,73 @@ export default {
ctx.emit("update:addAuthList", state.selectAllArr);
closeDrawer();
};
//获取授权 坐回显
const optionAuthPerm = () => {
let obj = {
keyWord: "",
type:
props.classify === "learnPath"
? 1
: props.classify === "project"
? 2
: props.classify === "course"
? 3
: null,
tag: props.authClassify === 1 ? 3 : props.authClassify === 2 ? 4 : "",
opt: 1,
refId: props.selectProjectId,
pageNo: 0,
pageSize: 0,
deptList: [],
groupList: [],
studentList: [],
};
console.log("获取权限名单obj", obj);
api
.optionAuthPerm(obj)
.then((res) => {
// console.log("获取权限名单成功", res);
if (res.data.code === 200) {
let studentArr = res.data.data.studentList;
let selectedRowKeys = [];
let choosepeople = [];
for (let i = 0; i < studentArr.length; i++) {
selectedRowKeys.push(studentArr[i].id);
choosepeople.push(studentArr[i]);
}
//快速选人
state.selectedRowKeys = selectedRowKeys;
state.choosepeople = choosepeople;
let deptArr = res.data.data.deptList;
let selectedKeys1 = [];
let chooseorganization = [];
for (let i = 0; i < deptArr.length; i++) {
selectedKeys1.push(deptArr[i].id);
chooseorganization.push(deptArr[i]);
}
//组织
state.selectedKeys1 = selectedKeys1;
state.chooseorganization = chooseorganization;
state.chooseorganization1 = chooseorganization;
let groupArr = res.data.data.groupList;
let selectedRowKeys2 = [];
let relationpeople = [];
for (let i = 0; i < groupArr.length; i++) {
selectedRowKeys2.push(groupArr[i].id);
relationpeople.push(groupArr[i]);
}
//受众
state.selectedRowKeys2 = selectedRowKeys2;
state.relationpeople = relationpeople;
console.log("获取权限名单成功", res);
}
})
.catch((err) => {
console.log("获取权限名单失败", err);
});
};
return {
...toRefs(state),
@@ -1374,6 +1490,7 @@ export default {
resetOrg,
submitAuth,
optionAuthPerm,
};
},
};
@@ -1904,7 +2021,9 @@ export default {
margin-right: 32px;
margin-left: 32px;
min-height: 100px;
// height: 170px;
// overflow: hidden;
flex-shrink: 0;
.chose {
// width: 64px;
padding-left: 10px;
@@ -1920,6 +2039,7 @@ export default {
color: rgba(56, 139, 225, 1);
font-size: 12px;
position: relative;
flex-shrink: 0;
.ch {
position: absolute;
width: 18px;