chenjun 3 år sedan
förälder
incheckning
41643cbbb0

+ 3 - 1
src/components/organization/index.vue

@@ -100,7 +100,9 @@ export default {
     },
   },
   mounted () {
-    this.data = this.formatData(this.data)
+    if(this.data!=null){
+      this.data = this.formatData(this.data)
+    }
   },
   methods: {
     //点击选择

+ 40 - 1
src/components/rolelist/index.vue

@@ -51,6 +51,8 @@
 </template>
 <script>
 import { GetAccountList } from "@/api/Account";
+import { GetRoleByGroup } from "@/api/AccountGroup";
+
 export default {
   props: {
     title: {
@@ -84,7 +86,11 @@ export default {
     roleType: {
       type: String,
       default: "",
-    }
+    },
+    GroupIds:{
+      type: Array,
+      default: () => [],
+    },
   },
   data () {
     return {
@@ -111,6 +117,10 @@ export default {
         if (msg == 'account') {
           this.getRoleData('UserId');
         }
+        if (msg == 'roleByUpId') {
+
+          this.getRoleDataByUpId('roleId');
+        }
       },
       deep: true,
     },
@@ -211,6 +221,35 @@ export default {
         this.loading = false;
       }
     },
+
+    //获取列表2
+    async getRoleDataByUpId (ids) {
+      try {
+        this.loading = true;
+        const obj = {
+          GroupIds:this.GroupIds
+        };
+        let result = null;
+        if(this.roleType == 'roleByUpId'){
+          result = await GetRoleByGroup(obj);
+        }
+        if (result.code === 0) {
+          const datas = result.returnData;
+          this.dataList=datas;
+          this.dataList.forEach(item => {
+            item.name = item.RoleName
+          });
+          this.loading = false;
+        } else {
+          this.$message.error(result.message);
+          this.loading = false;
+        }
+      } catch (error) {
+        console.log("出错了", error);
+        this.loading = false;
+      }
+    },
+
     //滚动加载数据
     load () {
       this.pageNum += 1;

+ 19 - 12
src/views/accountGroupManagement/components/accountGroupAdd.vue

@@ -41,6 +41,7 @@
             <Organization
               title="上级账号组"
               :data="dataObj"
+              :checkedKeys="[GroupId]"
               :defaultProps="defaultProps"
               nodekey="GroupId"
               @getTreeData="getTreeData"
@@ -54,6 +55,8 @@
               @checkChange="checkChange"
               @radioChanges="radioChanges"
               :dataList="roleList"
+              :roleType="roleType"
+              :GroupIds="GroupIds"
               :number="8"
             />
           </div>
@@ -111,7 +114,7 @@ import loginpolicy from "@/components/loginpolicy/index.vue";
 import rolelist from "@/components/rolelist/index.vue";
 import permissionlist from "@/components/permissionlist/index.vue";
 import { QueryRole, RoleAuths } from "@/api/apiAuthority";
-import { AddAccGroup, getUserOne } from "@/api/AccountGroup.js";
+import { SaveGroup, getUserOne } from "@/api/AccountGroup.js";
 import { mapGetters } from "vuex";
 import treeData from "../minixs/treeData";
 export default {
@@ -120,7 +123,7 @@ export default {
     postList: {
       type: String,
     },
-    roleData: {
+    arrs: {
       type: Array,
       default: () => [],
     },
@@ -135,6 +138,7 @@ export default {
   },
   data() {
     return {
+      roleType:"",
       checkedAuthList: [],
       GroupId: this.$route.query.GroupId,
       butPreser: "保存",
@@ -167,17 +171,19 @@ export default {
       queryId: "",
       queryType: "group",
       objID: "",
+      GroupIds:[],
     };
   },
   computed: {
     ...mapGetters(["systemSet"]),
   },
   created() {
-    const { GroupUpid, GroupId } = this.$route.query;
+    const { GroupId } = this.$route.query;
     this.AppId = GroupId;
-    this.UpId = GroupUpid;
-    this.queryId = GroupUpid;
+    this.UpId = GroupId;
+    this.queryId = GroupId;
     let obj;
+    this.getGroupTree();
     if (typeof this.$store.state.app.systemSet == "string") {
       obj = JSON.parse(this.$store.state.app.systemSet);
     } else {
@@ -188,7 +194,8 @@ export default {
     this.OpenGroup = OpenGroup;
     if (OpenRole) {
       this.title = "角色";
-      // this.RoleBox();
+      this.GroupIds=[GroupId];
+
     }
     if (this.UpId == -1) {
       this.queryId = "";
@@ -318,12 +325,9 @@ export default {
     },
     //角色选取
     checkChange(arr) {
-      const datas = [];
+      let datas = [];
       const arrs = [];
-      for (let i = 0; i < arr.length; i++) {
-        datas.push(this.roleList[arr[i]]);
-      }
-
+      datas = arr;
       datas.forEach((item) => {
         const RoleC = {
           IsSelected: 1,
@@ -346,7 +350,7 @@ export default {
         });
       });
       try {
-        const res = await AddAccGroup({
+        const res = await SaveGroup({
           GroupName: this.addFrom.name,
           GroupDesc: this.addFrom.textarea2,
           GroupUpid: this.UpId,
@@ -366,6 +370,9 @@ export default {
       }
     },
   },
+  mounted(){
+    this.roleType = "roleByUpId"
+  }
 };
 </script>
 <style lang="scss">

+ 0 - 8
src/views/accountGroupManagement/components/accountGroupHome.vue

@@ -203,14 +203,6 @@
                           </div>
                         </div>
                       </el-col>
-                      <!-- <el-col :span="8" v-if="data.GroupId != -1">
-                        <span class="msg">岗位:</span>
-                        <span>{{ data.JobCount }}</span>
-                      </el-col>
-                      <el-col :span="8" v-if="data.GroupId != -1">
-                        <span class="msg">职员:</span>
-                        <span>{{ data.OfficerCount }}</span>
-                      </el-col> -->
                       <el-col :span="24" v-if="data.GroupId != -1">
                         <span class="msg">权限:</span>
                         <span style="margin-right: 120px">{{