xjc 2 سال پیش
والد
کامیت
765ed015e4
3فایلهای تغییر یافته به همراه30 افزوده شده و 18 حذف شده
  1. 1 1
      src/router/index.js
  2. 28 16
      src/views/menu7/menu7-2/index.vue
  3. 1 1
      vue.config.js

+ 1 - 1
src/router/index.js

@@ -269,7 +269,7 @@ export const constantRoutes = [{
         name: 'menu7-1',
         component: () => import('@/views/menu7/menu7-1/index'),
         meta: {
-          title: '系统管理',
+          title: '账号管理',
           icon: ''
         }
       },

+ 28 - 16
src/views/menu7/menu7-2/index.vue

@@ -46,20 +46,21 @@
         </el-form-item>
 
         <el-form-item label="角色权限">
-          <el-select
-            v-model="form.permission_codes"
-            filterable
+          <el-input
             placeholder="请选择"
-            multiple
+            @focus="showPermission=true"
+          ></el-input>
+          <el-tree
+            v-show="showPermission||dialogType=='edit'"
+            :data="roleList"
+            show-checkbox
+            default-expand-all
+            node-key="value"
+            ref="ptree"
+            highlight-current
+            :props="defaultProps"
           >
-            <el-option
-              v-for="item in roleList"
-              :key="item.id"
-              :label="item.name"
-              :value="item.codename"
-            >
-            </el-option>
-          </el-select>
+          </el-tree>
         </el-form-item>
       </el-form>
     </cloudDialog>
@@ -96,9 +97,8 @@ export default {
           {
             id: "1",
             label: "角色权限",
-            prop: "permission_codes",
+            prop: "permission_names",
             show: true,
-            // custom: "status",
           },
         ],
         data: [],
@@ -164,6 +164,11 @@ export default {
           },
         ],
       },
+      defaultProps: {
+        label: "name",
+        children: "children",
+      },
+      showPermission: false,
     };
   },
   computed: {},
@@ -201,6 +206,7 @@ export default {
             this.dialogType = "edit";
             this.dialogConfig.title = "编辑角色";
             this.open("edit");
+
           });
           break;
         case "handleDel":
@@ -236,12 +242,19 @@ export default {
         this.$refs.dialogAdd.config.title = "新增角色";
       } else {
         this.$refs.dialogAdd.config.title = "编辑角色";
+        this.$refs.ptree.setCheckedKeys(this.form.permission_codes);
       }
       this.$refs.dialogAdd.open((cancel) => {
         this.$refs["form"].validate((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 (type == "edit") {
-              this.form.permission_codes = this.form.permission_codes.join(",");
               roleApi.edit(this.form).then((res) => {
                 if (res.mess == "success") {
                   this.getList();
@@ -255,7 +268,6 @@ export default {
                 }
               });
             } else {
-              this.form.permission_codes = this.form.permission_codes.join(",");
               roleApi.add(this.form).then((res) => {
                 if (res.mess == "success") {
                   this.getList();

+ 1 - 1
vue.config.js

@@ -30,7 +30,7 @@ module.exports = {
         proxy: {
             "/": {
                 target: "http://47.108.130.28:8000",
-                // target: "http://192.168.192.131:8000",
+                // target: "http://192.168.117.131:8000",
                 // target: "http://47.104.213.35",
                 changeOrigin: true,
                 // ws: true,//websocket支持