Преглед изворни кода

Merge branch 'master' of http://120.26.64.82:3000/BFFE/CABaggageData2.0

zhaoke пре 2 година
родитељ
комит
945f04b170

+ 56 - 82
src/components/permissiontree/index.vue

@@ -40,9 +40,9 @@
       </div> -->
       <div class="paren_cont">
         <el-scrollbar style="height: 100%">
-          <el-tree :data="data" show-checkbox @check-change="currentChange" @node-click="handleNodeClick" :defaultProps="defaultProps" node-key="AuthId" default-expand-all ref="tree" highlight-current>
+          <el-tree :data="data" show-checkbox @check-change="currentChange" @node-click="handleNodeClick" :defaultProps="defaultProps" node-key="auth_id" default-expand-all ref="tree" highlight-current>
             <span class="custom-tree-node" slot-scope="{ data }">
-              {{ data.AuthName }}
+              {{ data.auth_name }}
               <div class="logup">
                 <div class="one" v-if="data.AuthList && data.AuthList.ValidBegin"></div>
                 <div class="two" v-if="data.AuthList && data.AuthList.Action == '1'"></div>
@@ -69,6 +69,7 @@
 import { translateDataToTreeAll, deteleObject } from "@/utils/validate";
 import { GetAuthTree } from "@/api/apiAuthority";
 import { GetAuthTreeByGroup } from "@/api/AccountGroup";
+import { Query, GeneralDataReception } from "@/api/dataIntegration";
 import { organizationUptree, postUptree } from "@/api/postInterface";
 export default {
   props: {
@@ -76,11 +77,6 @@ export default {
       type: String,
       default: "",
     },
-    checkedKeys: {
-      //已选中
-      type: Array,
-      default: () => [],
-    },
     //查询类型:queryType: all/获取全部权限树;job/根据岗位获取权限树;origin/根据组织获取权限树;group/根据帐号组获取权限树;
     queryType: {
       type: String,
@@ -118,13 +114,14 @@ export default {
       oldType: "",
       queryIdArr: [], //历史查询ID
       MainJobId: "", //主岗ID
+      checkedKeys:[]
     };
   },
   watch: {
     checkedKeys: {
       handler (val) {
         this.checkedList = val;
-        this.$refs.tree.setCheckedKeys(val);
+        this.$refs.tree.setCheckedKeys(this.checkedList);
       },
       deep: true,
     },
@@ -142,31 +139,10 @@ export default {
     },
     queryId: {
       handler (val) {
-        if (this.queryType == "job") {
-          this.setDisabledAll();
-          let ids = val.split(",");
-          this.queryIdArr = [];
-          this.$refs.tree.setCheckedKeys([]);
-          if (this.isMainJob == true) {
-            this.MainJobId = val;
-          }
-          if (this.MainJobId != "") {
-            this.queryIdArr.push(this.MainJobId);
-          }
-          for (let i = 0; i < ids.length; i++) {
-            if (_.indexOf(this.queryIdArr, ids[i]) == -1) {
-              this.queryIdArr.push(ids[i]);
-            }
-          }
-          for (let j = 0; j < this.queryIdArr.length; j++) {
-            this.searchId = this.queryIdArr[j];
-            this.getDefaultDataList();
-          }
-        } else {
-          this.searchId = val;
-          this.getDefaultDataList();
-        }
+        this.searchId = val;
+        this.getDefaultDataList();
       },
+      immediate: true,
       deep: true,
     },
     queryIds: {
@@ -194,54 +170,52 @@ export default {
       }, 100);
     },
     //获取权限列表
-    getDataList () {
-      GetAuthTree({ QueryName: "" }).then((result) => {
-        this.getDefaultDataList();
-        this.setData(result);
-      });
+    async getDataList () {
+      const res = await Query({
+          id:40,
+          dataContent:[""]
+        });
+        if (res.code === "0") {
+          this.setData(res.returnData.listValues);
+        } else {
+          this.$message.error(res.message);
+          this.loading = false;
+        }
+        this.setData(res);
     },
     async getDefaultDataList () {
-      if (this.queryType == "all" && this.searchId != "") {
-        //获取全部权限树
-        GetAuthTree({ QueryName: "" }).then((result) => {
-          this.setUnDisabledData(result.returnData);
+      try {
+        const res = await Query({
+          id:42,
+          dataContent:[this.searchId]
         });
-      } else if (this.queryType == "job") {
-        //根据岗位获取权限树
-        postUptree({ JobId: this.searchId }).then((result) => {
-          this.setUnDisabledData(result.returnData);
-        });
-      } else if (this.queryType == "origin") {
-        //根据组织获取权限树
-        this.AuthList = [];
-        this.$refs.tree.setCheckedKeys([]);
-        organizationUptree({ OrganId: this.searchId }).then((result) => {
-          this.setUnDisabledData(result.returnData);
-        });
-      } else if (this.queryType == "group") {
-        //根据帐号组获取权限树
-        if (this.searchId) {
-          GetAuthTreeByGroup({ GroupIds: [this.searchId] }).then((result) => {
-            this.setUnDisabledData(result.returnData);
-          });
-        } else if (this.queryIds.length) {
-          GetAuthTreeByGroup({ GroupIds: this.queryIds }).then((result) => {
-            this.setUnDisabledData(result.returnData);
-          });
+        if (res.code === "0") {
+          this.checkedKeys = [];
+          res.returnData.listValues.forEach(item=>{
+            this.checkedKeys.push(item.AuthId)
+            this.AuthArrList.forEach(item2=>{
+              if(item.AuthId == item2.auth_id){
+                item2.AuthList = item
+              }
+            })
+          })
+          this.toTree()
+        } else {
+          this.$message.error(res.message);
+          this.loading = false;
         }
+      } catch (error) {
+        console.log("出错了", error);
       }
     },
     setData (result) {
-      if (result.code === 0 && result.returnData.length) {
+      if (result.code === "0" && result.returnData.listValues.length) {
         this.AuthArrList = [];
-        result.returnData.forEach((item) => {
-          item.flag = item.Status === 1 ? true : false;
+        result.returnData.listValues.forEach((item) => {
+          item.flag = item.auth_status === true ? true : false;
           item["AuthList"] = null;
-          if (this.queryType != "all") {
-            item["disabled"] = true;
-          }
         });
-        this.AuthArrList = _.cloneDeep(result.returnData);
+        this.AuthArrList = _.cloneDeep(result.returnData.listValues);
         this.toTree();
       } else {
         this.$message.error(result.message);
@@ -253,16 +227,14 @@ export default {
       this.dataObj = {};
       this.treeTitles = [];
       let arr = null;
-      arr = translateDataToTreeAll(this.AuthArrList, "UpAuthId", "AuthId");
+      arr = translateDataToTreeAll(this.AuthArrList, "up_auth_id", "auth_id");
       let items = null;
       items = {
-        AuthId: 0,
-        AuthName: "所有权限",
-        QueryTarget: 0,
-        Status: 0,
-        UpAuthId: 0,
-        Type: 0,
-        disabled: true,
+        auth_id: 0,
+        auth_name: "所有权限",
+        auth_status: 0,
+        up_auth_id: 0,
+        auth_type: 0,
         children: arr,
       };
       this.dataObj = _.cloneDeep(items);
@@ -277,6 +249,7 @@ export default {
       delete obj.children;
       datas.unshift(obj);
       this.treeTitles = datas;
+      console.log(datas)
       if (this.$refs.tree) {
         this.$refs.tree.setCheckedKeys(this.checkedList);
       }
@@ -321,7 +294,7 @@ export default {
     //获取指定数据
     decompose (data, id) {
       for (let i = 0; i < data.length; i++) {
-        if (data[i].AuthId == id) {
+        if (data[i].auth_id == id) {
           this.data = [data[i]];
         } else if (data[i].children && data[i].children.length > 0) {
           this.decompose(data[i].children, id);
@@ -334,7 +307,7 @@ export default {
         this.AuthArrList.forEach((item1) => {
           item1["AuthList"] = null;
           this.AuthList.forEach((item2) => {
-            if (item1.AuthId == item2.AuthId) {
+            if (item1.auth_id == item2.auth_id) {
               item1.AuthList = item2;
             }
           });
@@ -360,12 +333,13 @@ export default {
     handleNodeClick (data) {
       // this.toTree();
       const arr = this.$store.getters.authArrs;
+      console.log(arr)
       arr.push(data);
-      const datas = _.unionBy(arr, "AuthId");
+      const datas = _.unionBy(arr, "auth_id");
       const newDatas = _.cloneDeep(datas);
       this.$store.dispatch("auth/changeAuthMsg", newDatas);
       this.$store.dispatch("auth/changeAuthArrs", datas);
-      this.$store.dispatch("auth/changeAuthId", data.AuthId);
+      this.$store.dispatch("auth/changeAuthId", data.auth_id);
     },
     async setDisabledAll () {
       this.AuthArrList.forEach((item) => {

+ 21 - 47
src/views/authorityManagement/components/authorityRoleEdit.vue

@@ -22,29 +22,24 @@
                 <el-radio v-model="radio" :label="0">否</el-radio>
               </span>
             </div> -->
-            <div v-is="['role_edit save']" class="btn">
-              <!-- <el-button class="r24" @click="removeRole" type="danger">删除</el-button> -->
+            <div class="btn">
               <el-button @click="saveBtn('form')" size="small" type="primary">保存</el-button>
             </div>
           </div>
           <div class="addApp-form-content dialog-public-background">
             <el-form :inline="true" label-width="80px" ref="form" :rules="rules" class="form" :model="form">
               <el-form-item prop="name" label="角色名称">
-                <el-input disabled placeholder="请输入角色名称" maxlength="32" v-model="form.name"></el-input>
+                <el-input placeholder="请输入角色名称" maxlength="32" v-model="form.role_name" disabled></el-input>
               </el-form-item>
               <el-form-item label="角色描述">
-                <el-input style="width: 340px" disabled type="textarea" :rows="3" maxlength="200" placeholder="请输入描述" v-model="form.app"></el-input>
-              </el-form-item>
-              <el-form-item label="是否启用">
-                <el-radio disabled v-model="radio" :label="1">是</el-radio>
-                <el-radio disabled v-model="radio" :label="0">否</el-radio>
+                <el-input style="width: 340px" type="textarea" :rows="3" maxlength="200" placeholder="请输入描述" v-model="form.role_comment" disabled></el-input>
               </el-form-item>
             </el-form>
           </div>
         </div>
       </div>
       <div class="r24 flex1 part">
-        <Permissiontree v-loading="loading" element-loading-text="数据加载中" @getTreeData="getTreeData" :checkedKeys="checkedKeys" title="权限树" />
+        <Permissiontree v-loading="loading" element-loading-text="数据加载中" :queryId="roleId" @getTreeData="getTreeData" :checkedKeys="checkedKeys" title="权限树" />
       </div>
       <div class="flex1 part">
         <Rulesofcompetency v-loading="loading" element-loading-text="数据加载中" :authList="authList" :authTo="authTo" title="权限规则" />
@@ -87,6 +82,7 @@ import Rulesofcompetency from "@/components/rulesofcompetency";
 import Permissiontree from "@/components/permissiontree";
 import Rolelist from "@/components/rolelist";
 import { RoleDetails, EditRole, RoleAuths } from "@/api/apiAuthority";
+import { Query, GeneralDataReception } from "@/api/dataIntegration";
 import roleData from "../minixs/roleData";
 export default {
   name: "AuthorityRoleEdit",
@@ -129,6 +125,7 @@ export default {
     this.roleId = RoleId;
     this.Status = Status;
     this.roleDetails(RoleId);
+    // this.roleAuths(RoleId)
   },
   mounted () {
     this.roleType = "onlyRole";
@@ -138,31 +135,12 @@ export default {
     async roleDetails (id) {
       try {
         this.loading = true;
-        const res = await RoleDetails({
-          RoleId: id,
+        const res = await Query({
+          id:48,
+          dataContent:[id]
         });
-        if (res.code === 0) {
-          const { RoleName, RoleDesc, AuthList, RoleStatus, DefRoleList } =
-            res.returnData;
-          this.form.name = RoleName;
-          this.form.app = RoleDesc;
-          this.radio = RoleStatus;
-          if (AuthList && AuthList.length) {
-            AuthList.forEach((item) => {
-              this.authId.push(item.AuthId);
-            });
-            this.checkedKeys = this.authId;
-            this.authList = _.cloneDeep(AuthList);
-            this.authTo = AuthList[0];
-          }
-          if (DefRoleList && DefRoleList.length) {
-            this.checkedBoxs = DefRoleList;
-            DefRoleList.forEach((item) => {
-              item.RoleId = item.DefRoleId;
-            });
-            this.radioCheck = DefRoleList;
-            this.roleAuths(DefRoleList[0].DefRoleId);
-          }
+        if (res.code === "0") {
+          this.form = res.returnData.listValues[0];
           this.loading = false;
         } else {
           this.$message.error(res.message);
@@ -198,27 +176,23 @@ export default {
       });
       this.checkedBoxs = arrs;
     },
-    //互斥角色点击回调
-    checkClick (item) {
-      this.roleAuths(item.RoleId);
-    },
     async roleAuths (id) {
       try {
-        let params = {
-          RoleId: id,
-        };
-        this.permission = true;
-        const res = await RoleAuths(params);
-        if (res.code === 0) {
-          this.RoleList = res.returnData;
-          this.permission = false;
+        const res = await Query({
+          id:42,
+          dataContent:[id]
+        });
+        if (res.code === "0") {
+          this.checkedKeys = [];
+          res.returnData.listValues.forEach(item=>{
+            this.checkedKeys.push(item.AuthId)
+          })
         } else {
           this.$message.error(res.message);
-          this.permission = false;
+          this.loading = false;
         }
       } catch (error) {
         console.log("出错了", error);
-        this.permission = false;
       }
     },
     //保存

+ 180 - 195
src/views/authorityManagement/components/authorityRoleHome.vue

@@ -10,44 +10,62 @@
   <div class="authorityRoleHome">
     <!--状态和搜索-->
     <div class="authority-head flex">
-      <!-- <div class="status flex-wrap">
+      <div class="status flex-wrap">
         <div class="manageTitle">角色管理</div>
-        <div class="status1"><span class="icon"></span>存在互斥</div>
-        <div class="status2"><span class="icon"></span>不存在互斥</div>
-      </div> -->
-      <Search @getSearchData="getSearchData" @clearSearchData="clearSearchData" :isTitle="false" :isSlot="true">
-        <button v-is="['role_add']" @click="addRole" class="btnAdd">新增</button>
+        <!-- <div class="status1"><span class="icon"></span>存在互斥</div>
+        <div class="status2"><span class="icon"></span>不存在互斥</div> -->
+      </div>
+      <Search
+        @getSearchData="getSearchData"
+        @clearSearchData="clearSearchData"
+        :isTitle="false"
+        :isSlot="true"
+      >
+        <button @click="addRole" class="btnAdd">新增</button>
       </Search>
     </div>
     <!--列表-->
     <div class="role-content scrollbar infinite-list-wrapper">
       <template v-if="arrs.length">
-        <el-row v-infinite-scroll="load" :infinite-scroll-distance="20" infinite-scroll-disabled="disabled" :gutter="24">
-          <el-col v-for="(item,index) in arrs" class="account-left-content-teams" :lg="4" :key="index">
+        <el-row
+          v-infinite-scroll="load"
+          :infinite-scroll-distance="20"
+          infinite-scroll-disabled="disabled"
+          :gutter="24"
+        >
+          <el-col
+            v-for="(item, index) in arrs"
+            class="account-left-content-teams"
+            :lg="4"
+            :key="index"
+          >
             <div class="team">
               <!-- <div :class="'status'+ item.IsDef" class="bg"></div> -->
               <div class="list">
                 <div class="flex info">
                   <div class="info-avoutr">
                     <div class="msg flex-wrap">
-                      <p :title="item.RoleName" class="name">{{item.RoleName}}</p>
-                      <div v-is="['role_edit']" @click="editRole(item)" class="cap cap-edit"></div>
+                      <p :title="item.role_name" class="name">{{ item.role_name }}</p>
+                      <div @click="editRole(item)" class="cap cap-edit"></div>
                       <div @click="authRole(item)" class="cap cap-auth"></div>
                     </div>
                   </div>
-                  <div v-is="['role_delete']" class="info-close">
-                    <i @click="checkRemove(item,index)" class="icon el-icon-close"></i>
+                  <div class="info-close">
+                    <i
+                      @click="checkRemove(item, index)"
+                      class="icon el-icon-close"
+                    ></i>
                   </div>
                 </div>
                 <div class="flex-wrap time">
                   <div class="time-msg">账号数:</div>
-                  <div class="time-info glr">{{item.UserCount}}</div>
+                  <div class="time-info glr">{{ item.UserCount }}</div>
                 </div>
                 <div class="flex-wrap ip">
                   <div class="ip-msg">权限项数:</div>
-                  <div class="ip-info glr">{{item.AuthCount}}</div>
+                  <div class="ip-info glr">{{ item.AuthCount }}</div>
                 </div>
-                <div class="flex details">
+                <!-- <div class="flex details">
                   <div class="details-msg">
                     状态:<span :class="item.Status == 1 ? 'success' : 'error'">{{item.Status == 1 ? '启用' : '停用'}}</span>
                   </div>
@@ -55,7 +73,7 @@
                     <el-switch v-model="item.isauto" @change="handleChange(item)" active-color="#2D67E3">
                     </el-switch>
                   </div>
-                </div>
+                </div> -->
               </div>
             </div>
           </el-col>
@@ -73,9 +91,17 @@
     <Dialog :flag="flag">
       <div class="airportInfoDialog">
         <div class="title del-title">删除角色</div>
-        <div class="content del-content"><span class="el-icon-error error r10"></span>您是否确认删除<span class="error l10">{{ title }}</span> ?</div>
+        <div class="content del-content">
+          <span class="el-icon-error error r10"></span>您是否确认删除<span
+            class="error l10"
+            >{{ title }}</span
+          >
+          ?
+        </div>
         <div class="foot right Delfoot t30">
-          <el-button size="medium" class="r24" @click="remove" type="danger">删除</el-button>
+          <el-button size="medium" class="r24" @click="remove" type="danger"
+            >删除</el-button
+          >
           <el-button size="medium" @click="flag = false">取消</el-button>
         </div>
       </div>
@@ -85,22 +111,42 @@
       <div class="airportInfoDialog dialog-public-background">
         <div class="title">{{ editDialogTitle }}</div>
         <div class="content">
-          <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="130px" class="demo-ruleForm">
-            <el-form-item label="角色名称" prop="RoleName">
-              <el-input v-model="ruleForm.RoleName" size="medium" placeholder="请输入节点名称(必填)" />
+          <el-form
+            ref="ruleForm"
+            :model="ruleForm"
+            :rules="rules"
+            label-width="130px"
+            class="demo-ruleForm"
+          >
+            <el-form-item label="角色名称" prop="role_name">
+              <el-input
+                v-model="ruleForm.role_name"
+                size="medium"
+                placeholder="请输入节点名称(必填)"
+              />
             </el-form-item>
-            <el-form-item label="角色描述" prop="RoleDesc">
-              <el-input v-model="ruleForm.RoleDesc" size="medium" type="textarea" :rows="3" placeholder="请输入跟踪节点描述" />
+            <el-form-item label="角色描述" prop="role_comment">
+              <el-input
+                v-model="ruleForm.role_comment"
+                size="medium"
+                type="textarea"
+                :rows="3"
+                placeholder="请输入跟踪节点描述"
+              />
             </el-form-item>
-            <!-- <el-form-item label="是否启用" prop="RoleStatus">
-              <el-radio v-model="ruleForm.RoleStatus" :label="1">是</el-radio>
-              <el-radio v-model="ruleForm.RoleStatus" :label="0">否</el-radio>
-            </el-form-item> -->
           </el-form>
         </div>
         <div class="foot center t30">
-          <el-button size="medium" type="primary" class="r25 r26" @click="submitClickHandler()">提交</el-button>
-          <el-button size="medium" class="r26" @click="resetForm('ruleForm')">取消</el-button>
+          <el-button
+            size="medium"
+            type="primary"
+            class="r25 r26"
+            @click="submitClickHandler()"
+            >提交</el-button
+          >
+          <el-button size="medium" class="r26" @click="resetForm('ruleForm')"
+            >取消</el-button
+          >
         </div>
       </div>
     </Dialog>
@@ -108,230 +154,169 @@
 </template>
 
 <script>
-import Search from '@/layout/components/Search'
-import Dialog from '@/layout/components/Dialog'
-import roleData from '../minixs/roleData'
-import { UpdateStatus, SaveRole, RoleDetails, EditRole } from '@/api/apiAuthority'
+import Search from "@/layout/components/Search";
+import Dialog from "@/layout/components/Dialog";
+import roleData from "../minixs/roleData";
+import { Query, GeneralDataReception } from "@/api/dataIntegration";
 export default {
-  name: 'AuthorityRole',
+  name: "AuthorityRole",
   components: { Search, Dialog },
   mixins: [roleData],
-  data () {
+  data() {
     return {
       arrs: [], //卡片数据
       arr: [],
       arrsCopy: [],
       flag: false,
-      title: '',
+      title: "",
       index: null,
       num: null,
       pageNum: 1,
       PageSize: 20,
       loading: false,
-      keyWords: '',
+      keyWords: "",
       total: null,
       search: null,
       editDialogVisible: false,
-      editDialogTitle: '新增角色',
-      editType: 'add',
+      editDialogTitle: "新增角色",
+      editType: "add",
       ruleForm: {
         // 协议信息表单
-        RoleName: "",
-        RoleStatus: "",
-        RoleDesc: "",
+        role_name: "",
+        role_comment: "",
       },
       rules: {
         // 协议信息表单验证
-        RoleName: [
-          { required: true, message: "请输入角色名称", trigger: "blur" },
-        ],
+        role_name: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
       },
       ruleFormObj: {},
-      roleId: ''
-    }
+      roleId: "",
+      needPage: 1,
+    };
   },
-  created () {
+  created() {
     if (this.$route.query.keyWords) {
-      keyWords = this.$route.query.keyWords
-      this.keyWords = keyWords
+      keyWords = this.$route.query.keyWords;
+      this.keyWords = keyWords;
     }
-    this.gueryRole({
-      QueryName: this.keyWords,
-      PageSize: this.PageSize,
-      PageIndex: this.pageNum
-    });
+    this.queryData();
   },
   computed: {
-    noMore () {
-      return this.pageNum >= this.total
+    noMore() {
+      return this.pageNum >= this.total;
+    },
+    disabled() {
+      return this.loading || this.noMore;
     },
-    disabled () {
-      return this.loading || this.noMore
-    }
   },
   methods: {
+    queryData() {
+      let data = {
+        id: 41,
+        dataContent: [this.keyWords],
+        needPage: this.needPage,
+      };
+      this.gueryRole(data);
+    },
     //删除
-    checkRemove (item, index) {
-      this.flag = true
-      this.index = item
-      this.title = item.RoleName
-      this.num = index
+    checkRemove(item, index) {
+      this.flag = true;
+      this.index = item;
+      this.title = item.role_name;
+      this.num = index;
     },
     //确认删除
-    remove () {
-      this.deleteRole(this.index.RoleId, this.num)
+    remove() {
+      this.index.event = 3;
+      this.editRoles(this.index);
     },
     //角色新增
-    addRole () {
-      this.editDialogTitle = '新增角色'
-      this.editDialogVisible = true
-      this.editType = 'add'
+    addRole() {
+      this.editDialogTitle = "新增角色";
+      this.editDialogVisible = true;
+      this.editType = "add";
       // this.$router.push('/role/addRole')
     },
     //角色编辑
-    editRole (item) {
-      this.editDialogVisible = true
-      this.editType = 'edit'
-      this.editDialogTitle = '编辑角色'
-      this.roleId = item.RoleId
-      this.roleDetails(item.RoleId)
-      // this.$router.push({ path: '/role/editRole', query: { RoleId: item.RoleId, Status: item.Status } })
+    editRole(item) {
+      this.editDialogVisible = true;
+      this.editType = "edit";
+      this.editDialogTitle = "编辑角色";
+      this.roleId = item.role_id;
+      this.ruleForm = JSON.parse(JSON.stringify(item));
     },
-    // 角色授权
-    authRole (item) {
-      this.$router.push({ path: '/role/editRole', query: { RoleId: item.RoleId, Status: item.Status } })
-    },
-    //查询
-    getSearchData (val) {
-      this.arrs = []
-      this.dataList = []
-      this.pageNum = 1
-      this.keyWords = val
-      this.gueryRole({
-        QueryName: val,
-        PageSize: this.PageSize,
-        PageIndex: this.pageNum
-      })
-    },
-    //清除查询
-    clearSearchData () {
-      this.arrs = []
-      this.dataList = []
-      this.pageNum = 1
-      this.keyWords = ''
-      this.gueryRole({
-        QueryName: this.keyWords,
-        PageSize: this.PageSize,
-        PageIndex: this.pageNum
-      })
-    },
-    //状态变更
-    async handleChange (item) {
+    //新增角色
+    async editRoles(params) {
       try {
-        const { RoleId, isauto } = item
-        const Status = isauto ? 1 : 0
-        const res = await UpdateStatus({
-          RoleId: RoleId,
-          RoleStatus: Status
-        })
-        if (res.code === 0) {
-          this.$message.success(res.message)
-          this.arrs.forEach(item => {
-            if (item.RoleId == RoleId) {
-              item.isauto = isauto
-              item.Status = Status
-            }
-          })
+        const res = await GeneralDataReception({
+          serviceId: 14,
+          dataContent: JSON.stringify(params),
+        });
+        if (res.code === "0") {
+          this.flag = false;
+          this.$message.success(res.message);
+          this.needPage = 1;
+          this.queryData()
         } else {
-          this.$message.error(res.message)
+          this.flag = false;
+          this.$message.error(res.message);
         }
       } catch (error) {
-        console.log('出错了', error)
+        this.flag = false;
+        console.log("出错了", error);
       }
     },
+    // 角色授权
+    authRole(item) {
+      this.$router.push({
+        path: "/role/editRole",
+        query: { RoleId: item.role_id },
+      });
+    },
+    //查询
+    getSearchData(val) {
+      this.arrs = [];
+      this.needPage = 1;
+      this.keyWords = val;
+      this.queryData()
+    },
+    //清除查询
+    clearSearchData() {
+      this.arrs = [];
+      this.needPage = 1;
+      this.keyWords = "";
+      this.queryData()
+    },
     // 新增/编辑-确认
-    submitClickHandler () {
+    submitClickHandler() {
       this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
-          if (this.editType == 'add') {
-            this.saveRole()
+          if (this.editType == "add") {
+            this.ruleForm.event = 1;
+            this.editRoles(this.ruleForm);
           } else {
-            this.editRoleFunc()
+            this.ruleForm.event = 2;
+            this.editRoles(this.ruleForm);
           }
+          this.resetForm("ruleForm");
         } else {
-          return false
+          return false;
         }
       });
     },
     // 重置
-    resetForm (formName) {
-      this.$refs[formName].resetFields()
-      this.editDialogVisible = false
-    },
-    //新增保存
-    async saveRole () {
-      try {
-        const res = await SaveRole(this.ruleForm);
-        if (res.code === 0) {
-          this.$message.success(res.message);
-          this.resetForm('ruleForm');
-          this.gueryRole({
-            QueryName: this.keyWords,
-            PageSize: this.PageSize,
-            PageIndex: this.pageNum
-          });
-        } else {
-          this.$message.error(res.message);
-        }
-      } catch (error) {
-        console.log("出错了", error);
-      }
-    },
-    //角色明细
-    async roleDetails (id) {
-      try {
-        const res = await RoleDetails({
-          RoleId: id,
-        });
-        if (res.code === 0) {
-          this.ruleForm = res.returnData;
-        } else {
-          this.$message.error(res.message);
-        }
-      } catch (error) {
-        console.log("出错了", error);
-      }
-    },
-    //确认保存
-    async editRoleFunc () {
-      try {
-        const res = await EditRole(this.ruleForm);
-        if (res.code === 0) {
-          this.$message.success(res.message);
-          this.resetForm('ruleForm');
-          this.gueryRole({
-            QueryName: this.keyWords,
-            PageSize: this.PageSize,
-            PageIndex: this.pageNum
-          });
-        } else {
-          this.$message.error(res.message);
-        }
-      } catch (error) {
-        console.log("出错了", error);
-      }
+    resetForm(formName) {
+      this.ruleForm = [];
+      this.$refs[formName].resetFields();
+      this.editDialogVisible = false;
     },
     //滚动加载数据
-    load () {
-      this.pageNum += 1
-      this.gueryRole({
-        QueryName: this.keyWords,
-        PageSize: this.PageSize,
-        PageIndex: this.pageNum
-      });
-    }
-  }
-}
+    load() {
+      this.needPage = this.needPage + 1
+      this.queryData()
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>

+ 7 - 11
src/views/authorityManagement/minixs/roleData.js

@@ -7,6 +7,7 @@
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\roleData.js
  */
 import { QueryRole, DeleteRole } from '@/api/apiAuthority'
+import { Query,GeneralDataReception } from '@/api/dataIntegration'
 
 export default {
   data () {
@@ -22,17 +23,11 @@ export default {
     async gueryRole (obj) {
       try {
         this.loading = true
-        const res = await QueryRole(obj)
-        if (res.code === 0) {
-          const datas = res.returnData.records
-          const num = res.returnData.pages
-          datas.forEach(item => {
-            item.isauto = item.Status == 1 ? true : false
-          })
-          this.dataList.push(datas)
-          const arrs = this.dataList.flat()
-          const msgs = _.unionBy(arrs, "RoleId")
-          this.arrs = msgs
+        const res = await Query(obj)
+        console.log(res)
+        if (res.code === "0") {
+
+          this.arrs = res.returnData.listValues
           this.total = num
           this.loading = false
         } else {
@@ -44,6 +39,7 @@ export default {
         this.loading = false
       }
     },
+
     //删除角色
     async deleteRole (id, num) {
       try {