|
@@ -45,7 +45,7 @@
|
|
<el-input v-model="form.name" placeholder="请输入角色名称"></el-input>
|
|
<el-input v-model="form.name" placeholder="请输入角色名称"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="角色权限">
|
|
|
|
|
|
+ <el-form-item label="角色权限" v-if="form.platform == 'admin'">
|
|
<el-input
|
|
<el-input
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
@focus="showPermission = true"
|
|
@focus="showPermission = true"
|
|
@@ -202,7 +202,9 @@ export default {
|
|
case "handleDetail":
|
|
case "handleDetail":
|
|
roleApi.getDetail(row.id).then((res) => {
|
|
roleApi.getDetail(row.id).then((res) => {
|
|
this.form = res.data;
|
|
this.form = res.data;
|
|
- this.form.permission_codes = res.data.permission_codes.split(",");
|
|
|
|
|
|
+ this.form.permission_codes = res.data.permission_codes
|
|
|
|
+ ? res.data.permission_codes.split(",")
|
|
|
|
+ : [];
|
|
this.dialogType = "edit";
|
|
this.dialogType = "edit";
|
|
this.dialogConfig.title = "编辑角色";
|
|
this.dialogConfig.title = "编辑角色";
|
|
this.open("edit");
|
|
this.open("edit");
|
|
@@ -241,20 +243,27 @@ export default {
|
|
this.$refs.dialogAdd.config.title = "新增角色";
|
|
this.$refs.dialogAdd.config.title = "新增角色";
|
|
} else {
|
|
} else {
|
|
this.$refs.dialogAdd.config.title = "编辑角色";
|
|
this.$refs.dialogAdd.config.title = "编辑角色";
|
|
- this.$nextTick(() => {
|
|
|
|
|
|
+ if(this.form.platform=="admin"){
|
|
|
|
+ this.$nextTick(() => {
|
|
this.$refs.ptree.setCheckedKeys(this.form.permission_codes);
|
|
this.$refs.ptree.setCheckedKeys(this.form.permission_codes);
|
|
});
|
|
});
|
|
|
|
+ }
|
|
}
|
|
}
|
|
this.$refs.dialogAdd.open((cancel) => {
|
|
this.$refs.dialogAdd.open((cancel) => {
|
|
this.$refs["form"].validate((valid) => {
|
|
this.$refs["form"].validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- let selPer = this.$refs.ptree.getCheckedKeys();
|
|
|
|
- let selNodes = [];
|
|
|
|
- this.$refs.ptree.getCheckedNodes().forEach((item) => {
|
|
|
|
- selNodes.push(item.name);
|
|
|
|
- });
|
|
|
|
- this.form.permission_codes = selPer.join(",");
|
|
|
|
- this.form.permission_names = selNodes.join(",");
|
|
|
|
|
|
+ if (this.form.platform == "admin") {
|
|
|
|
+ let selPer = this.$refs.ptree.getCheckedKeys();
|
|
|
|
+ let selNodes = [];
|
|
|
|
+ this.$refs.ptree.getCheckedNodes().forEach((item) => {
|
|
|
|
+ selNodes.push(item.name);
|
|
|
|
+ });
|
|
|
|
+ this.form.permission_codes = selPer.join(",");
|
|
|
|
+ this.form.permission_names = selNodes.join(",");
|
|
|
|
+ }else{
|
|
|
|
+ this.form.permission_codes = "";
|
|
|
|
+ this.form.permission_names = "";
|
|
|
|
+ }
|
|
if (type == "edit") {
|
|
if (type == "edit") {
|
|
roleApi.edit(this.form).then((res) => {
|
|
roleApi.edit(this.form).then((res) => {
|
|
if (res.mess == "success") {
|
|
if (res.mess == "success") {
|