Commit 8886266f by liyuhang19990520

前端

parent a9abcf9b
......@@ -648,13 +648,22 @@ export default {
return newObj;
},
handleCheckAllChange(boo, id) {
console.log(boo, id);
let obj = this.permissionDataList.find((i) => i.id == id);
let sonArr = obj.children.map((i) => i.id);
if (boo) {
let childList = this.checkList.concat(sonArr);
this.checkList = Array.from(new Set(childList));
} else {
this.checkList = this.checkList.filter((x) => sonArr.indexOf(x) < 0);
console.log(this.rolePermissions);
this.checkList = this.checkList.filter((x) => {
let index = this.rolePermissions.findIndex((i) => i.id == x);
if (sonArr.indexOf(x) < 0) {
return x;
}
});
}
},
controlCheckMap() {
......@@ -748,7 +757,7 @@ export default {
});
},
created() {
this.userID = this.$route.query.id;
this.userID = sessionStorage.getItem("GroupPermission");
//人员详情
this.personInfor();
//默认功能权限
......@@ -758,13 +767,13 @@ export default {
},
activated() {
let path = this.$route.path;
let userId = sessionStorage.getItem("GroupPermission");
this.$router.push({
path: path,
query: {
id: this.userID,
id: userId,
},
});
//console.log(this.$route);
},
};
</script>
......
......@@ -521,7 +521,21 @@ export default {
save() {
let self = this;
if (this.customAddUser.length > 0) {
debugger;
if (this.diyRoleItemIndex !== this.customAddUser[0].id) {
let userObj = this.diyRoleList.find(
(i) => i.id == this.diyRoleItemIndex
);
//修改
let obj = {
id: this.diyRoleItemIndex,
name: userObj.value,
permissionIds: this.checkList,
};
this.editUserRole(obj);
return;
}
console.log(this.customAddUser);
let name = this.customAddUser[0].value;
let checkArr = this.checkList;
let params = {
......@@ -562,7 +576,17 @@ export default {
}
});
} else {
this.$message.warning("请添加用户后保存");
//修改
let userObj = this.diyRoleList.find(
(i) => i.id == this.diyRoleItemIndex
);
//修改
let obj = {
id: this.diyRoleItemIndex,
name: userObj.value,
permissionIds: this.checkList,
};
this.editUserRole(obj);
}
},
handleCheckAllChange(boo, id) {
......@@ -680,7 +704,42 @@ export default {
},
//修改名
editName(item) {
this.resetEdit();
if (
this.customAddUser.length > 0 &&
item.id == this.customAddUser[0].id
) {
this.resetEdit();
return;
}
let obj = {
id: item.id,
name: item.value,
permissionIds: this.checkList,
};
this.editUserRole(obj);
},
//修改角色权限并本地赋值
editUserRole(params) {
this.$axios({
method: "put",
url: "/security/roles",
data: params,
}).then((res) => {
if (res.data.code == 200) {
let index = this.diyRoleList.findIndex((i) => i.id == params.id);
let arr = this.checkList.map((i) => {
return {
id: i,
};
});
this.$set(this.diyRoleList[index], "permissions", arr);
setTimeout(() => {
this.$message.success("更新成功");
}, 500);
this.resetEdit();
}
});
},
// 编辑
edit() {
......@@ -719,10 +778,11 @@ export default {
}
this.btnType = "custom";
if (item.id !== this.diyRoleItemIndex) {
this.viewSelect(item);
this.resetEdit();
}
this.diyRoleItemIndex = item.id;
this.viewSelect(item);
this.$forceUpdate();
},
//重置编辑状态
resetEdit(type) {
......
......@@ -45,11 +45,13 @@
</div>
<div class="search-item">
<div class="label">权限:</div>
<el-input
class="search-info"
v-model="searchParams.permissionId"
placeholder="请输入权限"
></el-input>
<SelectCode
width="9.6875"
:form="searchParams"
id="permissionId"
codeUrl="/security/permissions/getAllPermission"
multiple
></SelectCode>
</div>
<div class="clear-btn" @click="clear" v-if="newStr">清空</div>
<div class="btn" @click="search">筛选用户</div>
......@@ -666,7 +668,7 @@ export default {
userGroupId: [],
unitCode: "",
roleId: [],
permissionId: "",
permissionId: [],
},
page: {
total: 10,
......@@ -725,10 +727,15 @@ export default {
let str = "";
console.log(this.searchParams);
for (let key in this.searchParams) {
if (key != "page" && key != "roleId" && key != "userGroupId") {
if (
key != "page" &&
key != "roleId" &&
key != "userGroupId" &&
key != "permissionId"
) {
str += this.searchParams[key].trim();
}
if (key == "userGroupId" || key == "roleId") {
if (key == "userGroupId" || key == "roleId" || key == "permissionId") {
str += this.searchParams[key].join();
}
}
......@@ -838,10 +845,15 @@ export default {
},
clear() {
for (let key in this.searchParams) {
if (key != "page" || key != "userGroupId" || key != "roleId") {
if (
key != "page" ||
key != "userGroupId" ||
key != "roleId" ||
key != "permissionId"
) {
this.$set(this.searchParams, key, "");
}
if (key == "userGroupId" || key == "roleId") {
if (key == "userGroupId" || key == "roleId" || key == "permissionId") {
this.$set(this.searchParams, key, []);
}
}
......@@ -851,7 +863,7 @@ export default {
search() {
let params = {};
for (let key in this.searchParams) {
if (key == "userGroupId" || key == "roleId") {
if (key == "userGroupId" || key == "roleId" || key == "permissionId") {
params[key] = this.searchParams[key].join();
} else {
params[key] = this.searchParams[key];
......
......@@ -65,7 +65,9 @@
</div>
<!-- 有角色 角色长度<5-->
<div v-if="userData.roleNames !== ''" class="info-value">
<div class="info-value">{{ userData.roleNames }}</div>
<div class="info-value" :title="userData.roleNames">
{{ userData.roleNames }}
</div>
<!-- <div
class="tags"
v-for="item in userData.roleNames &&
......@@ -664,7 +666,7 @@ export default {
// //console.info("chuancan", this.$route.params.id);
},
created() {
this.userID = this.$route.query.id;
this.userID = sessionStorage.getItem("UserPermission");
//人员详情
this.personInfor();
//默认功能权限
......@@ -674,10 +676,11 @@ export default {
},
activated() {
let path = this.$route.path;
let userId = sessionStorage.getItem("UserPermission");
this.$router.push({
path: path,
query: {
id: this.userID,
id: userId,
},
});
//console.log(this.$route);
......
......@@ -73,10 +73,13 @@
.search {
width: 100%;
height: 50px;
display: flex;
justify-content: flex-start;
align-items: center !important;
.search-item {
height: auto !important;
width: auto;
height: 32px;
margin: 5px 16px 5px 0;
margin: 5px 10px 5px 0;
.label {
width: auto;
height: 32px;
......@@ -95,8 +98,25 @@
//margin-top: 8px;
}
}
.clear {
width: 38px;
border: none;
height: 22px;
padding: 0;
font-size: 14px;
margin-right: 5px;
font-weight: 350;
color: #333333;
text-align: center;
cursor: pointer;
&:hover {
color: #055fe7;
}
&:active {
color: #055fe7;
}
}
.btn {
position: absolute;
top: 125px;
right: 24px;
width: 95px;
......@@ -201,10 +221,13 @@
.search {
width: 100%;
height: 50px;
justify-content: flex-start;
align-items: center;
display: flex;
.search-item {
height: auto !important;
width: auto;
height: 32px;
margin: 5px 16px 5px 0;
margin: 5px 10px 5px 0;
.label {
width: auto;
height: 32px;
......@@ -233,9 +256,6 @@
font-weight: 350;
color: #333333;
text-align: center;
position: absolute;
top: 130px;
right: 124px;
cursor: pointer;
&:hover {
color: #055fe7;
......@@ -245,9 +265,6 @@
}
}
.btn {
position: absolute;
top: 125px;
right: 24px;
width: 95px;
height: 32px;
background: #055fe7;
......
......@@ -169,6 +169,8 @@
align-items: center;
//border: 1px solid hotpink; width: auto;
.info-item {
display: flex;
align-items: center;
padding: 0 20px 0 20px;
border-right: 1px solid #e6e6e8;
.info-title {
......@@ -179,7 +181,10 @@
line-height: 22px;
}
.info-value {
width: auto;
max-width: 200px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
height: 22px;
font-size: 14px;
color: #333333;
......@@ -196,6 +201,8 @@
}
}
.info-item1 {
display: flex;
align-items: center;
padding: 0 20px 0 20px;
.info-title {
width: auto;
......@@ -205,7 +212,10 @@
line-height: 22px;
}
.info-value {
width: auto;
max-width: 200px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
height: 22px;
font-size: 14px;
color: #333333;
......
......@@ -72,7 +72,7 @@ export default {
return {
btnLoading: false,
isShow: false,
userInfo: { username: "admin", password: "123456" },
userInfo: { username: "admin", password: "admin" },
usernameUrl: require("../../../assets/img/login/user.png"),
passwordUrl: require("../../../assets/img/login/password.png"),
};
......
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