瀏覽代碼

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

chenjun 2 年之前
父節點
當前提交
3c50ec6dfe

+ 9 - 2
public/config.js

@@ -14,7 +14,7 @@ PLATFROM_CONFIG.baseURLCA = "http://192.168.3.74:18064"; // 登录后的http请
 
 const DATACONTENT_ID = {
   /***-----登录------***/
-  loginId: 205, //登录-获取权限-id
+  loginId: 36, //登录-获取权限-id
 
   /***-----账号管理------***/
   accountTableId: 38, //账号管理-首页-列表
@@ -26,6 +26,9 @@ const DATACONTENT_ID = {
   roleDetailsId: 222, //角色管理-根据id查详情
   roleAuthId: 42, //角色管理-根据id查权限
 
+  /***-----权限管理------***/
+  authTreeId: 40, //权限管理-权限树
+
   /***-----系统设置------***/
   sysSourceId: 13, //系统设置-数据源-id
   sysProtoTabId: 1, //系统设置-协议管理-表格-id
@@ -77,8 +80,12 @@ const DATACONTENT_ID = {
 const SERVICE_ID = {
   /***-----账号管理------***/
   accountScId: 17, //账号管理-增删改-id
+  roleScId: 16, //账号管理-角色授权-增删改-id
   /***-----角色管理------***/
-  roleScId: 16, //账号管理-增删改-id
+  roleMsgId: 14, //角色管理-增删改-id
+
+  /***-----权限项管理------***/
+  authScId: 13, //权限项管理-增删改-id
 
   sysProtoTabId: 1, //系统设置-协议管理-表格-增删改-id
   sysServiceAddId: 3, //系统设置-服务管理-新增服务-提交-id/服务管理-编辑服务-保存-id

+ 1 - 1
src/api/newLogin.js

@@ -56,7 +56,7 @@ export function permission (params) {
 //token
 export function gettoken (params) {
   return request({
-    url: '/foxlibc/make/code',
+    url: '/foxlibc/application-token',
     method: 'post',
     data: params,
     istoken: true

+ 2 - 2
src/components/competencypop/index.vue

@@ -4,7 +4,7 @@
       <div class="title">权限规则</div>
       <div class="content">
         <el-form label-width="110px" class="from dialog-public-background">
-          <el-form-item>
+          <!-- <el-form-item>
             <el-radio v-model="form.Action" disabled :label="item.id" v-for='(item,index) in option' :key="index">{{item.label}}</el-radio>
           </el-form-item>
           <el-form-item label="时效范围起">
@@ -14,7 +14,7 @@
           <el-form-item label="至">
             <el-date-picker size="small" v-model="form.ValidEnd" disabled @change="setTime" :picker-options="pickerOptionsEnd" type="datetime" placeholder="选择时间">
             </el-date-picker>
-          </el-form-item>
+          </el-form-item> -->
           <el-form-item label="许可查询行">
             <el-input size="small" v-model="form.QueryRow" placeholder="请输入内容" disabled></el-input>
           </el-form-item>

+ 7 - 7
src/components/permissionlist/index.vue

@@ -29,7 +29,7 @@
         <ul>
           <li v-for="(item, index) in dataLists" :key="index">
             <div class="up_type" :class="active === index ? 'up_types' : 'up_type'" @click="upActive(item, index)">
-              {{ item.app_name }}
+              {{ item.AppName }}
             </div>
           </li>
         </ul>
@@ -41,7 +41,7 @@
               <el-col :span="8" v-for="(item, index) in RoleData" :key="index">
                 <div :title="item.auth_name" class="cide">
                   <div class="cide_header">
-                    <p>{{ item.auth_name }}</p>
+                    <p>{{ item.AuthName }}</p>
                     <span @click.stop="upStart(item)">查看</span>
                   </div>
                   <div class="cide_cont">
@@ -141,11 +141,11 @@ export default {
   methods: {
     Roleup (arr) {
       const datas = _.cloneDeep(arr);
-      const arrs = _.unionBy(datas, "app_id");
-      const newDatas = arrs.filter((item) => item.app_id);
+      const arrs = _.unionBy(datas, "AppId");
+      const newDatas = arrs.filter((item) => item.AppId);
       if (newDatas && newDatas.length) {
         this.dataLists = newDatas;
-        const goodDatas = this.getData(newDatas[0].app_id);
+        const goodDatas = this.getData(newDatas[0].AppId);
         this.RoleData = goodDatas;
       } else {
         this.RoleData = [];
@@ -154,12 +154,12 @@ export default {
     },
     upActive (item, index) {
       this.active = index;
-      this.RoleData = this.getData(item.app_id);
+      this.RoleData = this.getData(item.AppId);
     },
     getData (id) {
       const datas = [];
       this.RoleList.forEach((item) => {
-        if (item.app_id === id) {
+        if (item.AppId === id) {
           datas.push(item);
         }
       });

+ 18 - 18
src/components/permissiontree/index.vue

@@ -84,7 +84,7 @@ export default {
     },
     //要查询的查询ID
     queryId: {
-      type: String,
+      type: String | Number,
       default: "",
     },
     queryIds: {
@@ -114,7 +114,7 @@ export default {
       oldType: "",
       queryIdArr: [], //历史查询ID
       MainJobId: "", //主岗ID
-      checkedKeys:[]
+      checkedKeys: []
     };
   },
   watch: {
@@ -172,29 +172,29 @@ export default {
     //获取权限列表
     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);
+        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 () {
       try {
         const res = await Query({
-          id:42,
-          dataContent:[this.searchId]
+          id: DATACONTENT_ID.roleAuthId,
+          dataContent: [this.searchId]
         });
-        if (res.code === "0") {
+        if (res.code == 0) {
           this.checkedKeys = [];
-          res.returnData.listValues.forEach(item=>{
+          res.returnData.listValues.forEach(item => {
             this.checkedKeys.push(item.AuthId)
-            this.AuthArrList.forEach(item2=>{
-              if(item.AuthId == item2.auth_id){
+            this.AuthArrList.forEach(item2 => {
+              if (item.AuthId == item2.auth_id) {
                 item2.AuthList = item
               }
             })

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

@@ -288,7 +288,6 @@ export default {
             item.name = item[names]
           })
           this.dataList = msgs
-          console.log(this.dataList)
           this.total = num
           this.$emit('roleListChange', msgs)
           this.loading = false

+ 4 - 4
src/router/routes/routes-file-four.js

@@ -147,10 +147,10 @@ const accountRoutes = {
             }
           },
           redirect: '/account',
-          meta: {
-            title: '账号管理',
-            roles: ['account_page']
-          },
+          // meta: {
+          //   title: '账号管理',
+          //   roles: ['account_page']
+          // },
           children: [
             {
               path: '/account',

+ 32 - 23
src/views/accountManagement/components/accountAuth.vue

@@ -131,15 +131,16 @@ export default {
         })
         if (res.code == 0) {
           const { listValues } = res.returnData;
-          console.log(listValues)
           if (listValues && listValues.length) {
             this.checkedBoxs = listValues;
             listValues.forEach((item) => {
+              item.flag = true;
               item.RoleId = item.role_id;
             });
             this.radioCheck = listValues;
             this.roleAuths(listValues[0].role_id);
           }
+          this.checkedKeys.push(this.checkedBoxs)
           this.loading = false;
         } else {
           this.$message.error(res.message);
@@ -164,31 +165,39 @@ export default {
     },
     //互斥角色选中回调
     async checkChange (arr) {
-      console.log(arr)
-      let obj = {
-        role_id: arr[arr.length - 1].role_id,
-        user_id: this.roleId
+      this.checkedKeys.push(arr)
+      const data1 = this.checkedKeys[this.checkedKeys.length - 1] //最后一条数据
+      const data2 = this.checkedKeys[this.checkedKeys.length - 2] //倒数第二条数据
+      if (data1.length > data2.length) {
+        this.checksBoxTs(data1, data2, 'add')
+      } else {
+        this.checksBoxTs(data2, data1, 'del')
       }
-      obj.event = 1
-      const result = await GeneralDataReception({
-        serviceId: SERVICE_ID.roleScId,
-        dataContent: JSON.stringify(obj)
-      })
-      if (result.code == 0) {
-        this.$message.success(result.message)
+    },
+    async checksBoxTs (datas, arr, type) {
+      const res = datas.filter(item => !arr.some(p => item.role_id == p.role_id))
+      if (res && res.length) {
+        let obj = {
+          role_id: res[res.length - 1].role_id,
+          user_id: this.roleId
+        }
+        if (type == 'add') {
+          obj.event = 1
+        } else {
+          obj.event = 3
+        }
+        const result = await GeneralDataReception({
+          serviceId: SERVICE_ID.roleScId,
+          dataContent: JSON.stringify(obj)
+        })
+        if (result.code == 0) {
+          this.$message.success(result.message)
+        } else {
+          this.$message.error(result.message)
+        }
       } else {
-        this.$message.error(result.message)
+        this.$message.error('未选中数据')
       }
-      // const arrs = [];
-      // arr.forEach((item) => {
-      //   const obj = {
-      //     DefRoleId: item.role_id,
-      //     IsSelected: 1,
-      //     DefRoleName: item.role_name,
-      //   };
-      //   arrs.push(obj);
-      // });
-      this.checkedBoxs = arr;
     },
     //互斥角色点击回调
     checkClick (item) {

+ 150 - 264
src/views/authorityManagement/components/authorityHome.vue

@@ -16,7 +16,7 @@
         <div class="status1"><span class="icon"></span>API接口</div>
         <div class="status2"><span class="icon"></span>数据读写</div>
       </div>
-      <Search @getSearchData="getSearchData" :isTitle="false" @clearSearchData="clearSearchData" />
+      <!-- <Search @getSearchData="getSearchData" :isTitle="false" @clearSearchData="clearSearchData" /> -->
     </div>
     <!--权限树-->
     <!-- <div class="authority-content">
@@ -29,79 +29,12 @@
           <div class="grid-content">
             <div class="manageTitle">权限树</div>
             <div class="contentTree">
-              <el-tree ref="tree" :data="dataListTree" :props="defaultProps" node-key="AuthId" :filter-node-method="filterNode" highlight-current :default-expanded-keys="[currentKey]" @node-click="handleNodeClick">
+              <el-tree ref="tree" :data="dataListTree" :props="defaultProps" node-key="auth_id" :filter-node-method="filterNode" highlight-current :default-expanded-keys="[currentKey]" @node-click="handleNodeClick">
               </el-tree>
             </div>
           </div>
         </el-col>
         <el-col :span="18" class="bodyPart">
-          <!-- <div class="grid-contentTop">
-            <div class="manageTitle">当前</div>
-            <div class="content">
-              <template v-if="currDataArr.length">
-                <el-row>
-                  <el-col :span="6" v-for="(data, index) in currDataArr" :key="data.AuthId">
-                    <div class="account-left-content-teams">
-                      <div class="team">
-                        <div class="bg" :class="
-                            data.Type == 1 || data.Type == 0
-                              ? 'status1'
-                              : 'status2'
-                          "></div>
-                        <div class="list" :class="data.QueryTarget == 1 ? 'activeStatus' : ''">
-                          <div class="flex info">
-                            <div :title="data.AuthName" class="name">
-                              {{ data.AuthName }}
-                            </div>
-                            <div class="icon">
-                              <el-tooltip effect="dark" content="新增应用" placement="bottom">
-                                <span v-if="data.Type === 0" title="新增应用" @click="renderAdd()" class="cap cap-plus"></span>
-                              </el-tooltip>
-                              <el-tooltip effect="dark" content="修改应用" placement="bottom">
-                                <span v-if="data.Type === 1" title="修改应用" @click="renderEdit(data)" class="cap cap-edit"></span>
-                              </el-tooltip>
-                              <el-tooltip v-is="['authtree_btn_add_auth']" effect="dark" content="新增权限项" placement="bottom">
-                                <span v-if="data.Type === 2" title="新增权限项" @click="renderSub(data)" class="cap cap-sub"></span>
-                              </el-tooltip>
-                              <el-tooltip v-is="['authtree_btn_update_auth']" effect="dark" content="编辑权限项" placement="bottom">
-                                <span v-if="data.Type > 2" title="编辑权限项" @click="renderEdit(data)" class="cap cap-edit"></span>
-                              </el-tooltip>
-                              <el-tooltip v-is="['authtree_btn_add_auth']" effect="dark" content="新增权限项" placement="bottom">
-                                <span v-if="data.Type > 2" title="新增权限项" @click="renderSub(data)" class="cap cap-sub"></span>
-                              </el-tooltip>
-                            </div>
-                          </div>
-                          <div v-if="data.Type > 0" class="flex details">
-                            <div class="details-msg">
-                              状态:<span :class="data.Status === 1 ? 'success' : 'error'">{{ data.Status === 1 ? "启用" : "禁用" }}</span>
-                            </div>
-                            <div v-is="['authtree_btn_state_swatch']" class="details-info">
-                              <el-switch v-model="data.flag" @change="renderChange(data, index)" active-color="#2D67E3">
-                              </el-switch>
-                            </div>
-                          </div>
-                        </div>
-                      </div>
-                      <div v-is="['authtree_btn_del_auth']">
-                        <div v-if="data.Type !== 0 && data.Type !== 2" @click.stop="onNodeClick(data)" class="info-close">
-                          <i class="icon el-icon-close" :class="
-                              data.Type === 1
-                                ? 'close1'
-                                : data.Type > 2
-                                ? 'close2'
-                                : ''
-                            "></i>
-                        </div>
-                      </div>
-                    </div>
-                  </el-col>
-                </el-row>
-              </template>
-              <template v-else>
-                <NoData :imageWidth="180" :imageHeight="130" />
-              </template>
-            </div>
-          </div> -->
           <div class="grid-contentBottom">
             <div class="capTitle flex">
               <div class="manageTitle">下级权限</div>
@@ -112,42 +45,28 @@
             <div class="content">
               <template v-if="childrenData.length">
                 <el-row :gutter="24">
-                  <el-col :span="6" v-for="(data, index) in childrenData" :key="data.AuthId">
+                  <el-col :span="6" v-for="data in childrenData" :key="data.auth_id">
                     <div @click.stop="childrenClick(data)" class="account-left-content-teams">
                       <div class="team">
-                        <div class="bg" :class="data.Type == 1 ? 'status0' : data.Type == 2 ? 'status1' : 'status2'"></div>
+                        <div class="bg" :class="data.auth_type == 1 ? 'status0' : data.auth_type == 2 ? 'status1' : 'status2'"></div>
                         <div class="list" :class="data.QueryTarget == 1 ? 'activeStatus' : ''">
                           <div class="flex info">
-                            <div :title="data.AuthName" class="name">
-                              {{ data.AuthName }}
+                            <div :title="data.auth_name" class="name">
+                              {{ data.auth_name }}
                             </div>
-                            <div class="icon">
-                              <el-tooltip effect="dark" content="新增应用" placement="bottom">
-                                <span v-if="data.Type === 0" title="新增应用" @click="renderAdd()" class="cap cap-plus"></span>
-                              </el-tooltip>
+                            <div v-if="data.auth_type > 0" class="icon">
                               <el-tooltip effect="dark" content="修改应用" placement="bottom">
-                                <span v-if="data.Type === 1" title="修改应用" @click="renderEdit(data)" class="cap cap-edit"></span>
-                              </el-tooltip>
-                              <!-- <el-tooltip v-is="['authtree_btn_add_auth']" effect="dark" content="新增权限项" placement="bottom">
-                                <span v-if="data.Type === 2" title="新增权限项" @click="renderSub(data)" class="cap cap-sub"></span>
-                              </el-tooltip> -->
-                              <el-tooltip v-is="['authtree_btn_add_auth']" effect="dark" content="编辑权限项" placement="bottom">
-                                <span v-if="data.Type === 2" title="编辑权限项" @click="renderEdit(data)" class="cap cap-edit"></span>
-                              </el-tooltip>
-                              <el-tooltip v-is="['authtree_btn_update_auth']" effect="dark" content="编辑权限项" placement="bottom">
-                                <span v-if="data.Type > 2" title="编辑权限项" @click="renderEdit(data)" class="cap cap-edit"></span>
+                                <span title="修改应用" @click="renderEdit(data)" class="cap cap-edit"></span>
                               </el-tooltip>
-                              <!-- <el-tooltip v-is="['authtree_btn_add_auth']" effect="dark" content="新增权限项" placement="bottom">
-                                <span v-if="data.Type > 2" title="新增权限项" @click="renderSub(data)" class="cap cap-sub"></span>
-                              </el-tooltip> -->
                             </div>
                           </div>
-                          <div v-if="data.Type > 0" class="flex details">
+                          <div v-if="data.auth_type > 0" class="flex details">
                             <div class="details-msg">
-                              状态:<span :class="data.Status === 1 ? 'success' : 'error'">{{ data.Status === 1 ? "启用" : "禁用" }}</span>
+                              状态:<span :class="data.auth_status ? 'success' : 'error'">{{ data.auth_status ? "启用" : "禁用" }}</span>
                             </div>
-                            <div v-is="['authtree_btn_state_swatch']" class="details-info">
-                              <el-switch v-model="data.flag" @click.stop.native @change="renderChange(data, index)" active-color="#2D67E3">
+                            <!-- v-is="['authtree_btn_state_swatch']" -->
+                            <div class="details-info">
+                              <el-switch v-model="data.auth_status" @click.stop.native @change="renderChange(data)" active-color="#2D67E3">
                               </el-switch>
                             </div>
                           </div>
@@ -156,12 +75,13 @@
                       <!-- <div v-if="data.Type !== 0 && data.Type !== 2" @click.stop="onNodeClick(data)" class="info-close">
                         <i class="icon el-icon-close" :class="data.Type === 1 ? 'close1' : data.Type > 2 ? 'close2' : ''"></i>
                       </div> -->
-                      <div v-is="['authtree_btn_del_auth']">
-                        <div v-if="data.Type !== 0 && data.Type !== 2" @click.stop="onNodeClick(data)" class="info-close">
+                      <!-- v-is="['authtree_btn_del_auth']" -->
+                      <div>
+                        <div v-if="data.auth_type !== 0" @click.stop="onNodeClick(data)" class="info-close">
                           <i class="icon el-icon-close" :class="
-                              data.Type === 1
+                              data.auth_type === 1
                                 ? 'close1'
-                                : data.Type > 2
+                                : data.auth_type > 2
                                 ? 'close2'
                                 : ''
                             "></i>
@@ -182,7 +102,7 @@
     <!--删除弹框-->
     <Dialog :flag="flag">
       <div class="airportInfoDialog">
-        <div class="title del-title">删除{{ title }}</div>
+        <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>
@@ -198,42 +118,36 @@
         <div class="title">{{ editDialogTitle }}</div>
         <div class="content">
           <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="110px" class="demo-ruleForm">
-            <el-form-item label="权限名称" prop="authName">
-              <el-input v-model="ruleForm.authName" size="medium" placeholder="请输入权限名称" />
+            <el-form-item label="权限名称" prop="auth_name">
+              <el-input v-model="ruleForm.auth_name" size="medium" placeholder="请输入权限名称" />
             </el-form-item>
             <div class="flex">
-              <el-form-item label="权限类型" prop="authType">
-                <el-select size="medium" v-model="ruleForm.authType" placeholder="请选择">
-                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+              <el-form-item label="权限类型" prop="auth_type">
+                <el-select size="medium" v-model="ruleForm.auth_type" placeholder="请选择">
+                  <el-option v-for="(item,index) in optionsType" :key="index" :label="item.label" :value="item.value">
                   </el-option>
                 </el-select>
               </el-form-item>
               <el-form-item label="父级权限" prop="authParent">
-                <el-select size="medium" v-model="ruleForm.authParent" placeholder="请选择">
-                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+                <el-select size="medium" v-model="ruleForm.auth_id" placeholder="请选择">
+                  <el-option v-for="(item,index) in optionsParent" :key="index" :label="item.label" :value="item.value">
                   </el-option>
                 </el-select>
               </el-form-item>
             </div>
-            <div class="flex">
-              <el-form-item label="数据来源类型" prop="authData">
-                <el-select size="medium" v-model="ruleForm.authData" placeholder="请选择">
-                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
-                  </el-option>
-                </el-select>
-              </el-form-item>
-              <el-form-item label="所属应用" prop="authApp">
-                <el-select size="medium" v-model="ruleForm.authApp" placeholder="请选择">
-                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+            <div class="flex-wrap">
+              <el-form-item class="flex1" label="所属应用" prop="app_name">
+                <el-select style="display:block;" size="medium" v-model="ruleForm.app_name" placeholder="请选择">
+                  <el-option v-for="(item,index) in optionsApp" :key="index" :label="item.label" :value="item.value">
                   </el-option>
                 </el-select>
               </el-form-item>
             </div>
-            <el-form-item label="权限标识符" prop="authPoint">
-              <el-input v-model="ruleForm.authPoint" size="medium" type="textarea" :rows="3" placeholder="请输入权限标识符" />
+            <el-form-item label="权限标识符" prop="auth_ident">
+              <el-input v-model="ruleForm.auth_ident" size="medium" type="textarea" :rows="3" placeholder="请输入权限标识符" />
             </el-form-item>
-            <el-form-item label="数据项描述" prop="authDesc">
-              <el-input v-model="ruleForm.authDesc" size="medium" type="textarea" :rows="3" placeholder="请输入数据项描述" />
+            <el-form-item label="数据项描述" prop="auth_comment">
+              <el-input v-model="ruleForm.auth_comment" size="medium" type="textarea" :rows="3" placeholder="请输入数据项描述" />
             </el-form-item>
           </el-form>
         </div>
@@ -257,6 +171,7 @@ import {
   DeleteApp,
   DeleteAuth,
 } from "@/api/apiAuthority";
+import { GeneralDataReception } from '@/api/dataIntegration'
 import treeData from "../minixs/treeData";
 export default {
   name: "Authority",
@@ -271,7 +186,7 @@ export default {
       title: "", //弹框title
       flag: false, //弹框开关
       dataId: null, //tree数据id
-      currData:null,
+      currData: null,
       currDataArr: [],
       currDataArrId: 0,
       childrenData: [],
@@ -279,28 +194,47 @@ export default {
       currentKey: -1,
       defaultProps: {
         children: "children",
-        label: "AuthName",
+        label: "auth_name",
       },
       options: [],
       editDialogVisible: false,
       editDialogTitle: '新增下级权限',
       editType: 'add',
+      delObj: {},
       ruleForm: {
         // 协议信息表单
-        authName: "",
-        authType: "",
-        authDesc: "",
-        authPoint: "",
-        authApp: "",
-        authParent: "",
-        authData: ""
+        auth_name: "",
+        auth_type: "",
+        auth_comment: "",
+        app_name: "",
+        auth_ident: "",
+        auth_type: "",
+        app_name: "",
+        app_id: "",
+        auth_status: true
       },
       rules: {
         // 协议信息表单验证
-        authName: [
+        auth_name: [
           { required: true, message: "请输入权限名称", trigger: "blur" },
         ],
       },
+      optionsType: [
+        {
+          label: '前端权限',
+          value: 1
+        },
+        {
+          label: 'API权限',
+          value: 2
+        },
+        {
+          label: '数据权限',
+          value: 3
+        }
+      ],
+      optionsApp: [],
+      optionsParent: []
     };
   },
   created: function () {
@@ -322,17 +256,42 @@ export default {
   methods: {
     // 新增
     addAuth () {
-      // this.editDialogTitle = '新增下级权限'
-      // this.editDialogVisible = true
-      // this.editType = 'add'
-      this.$router.push({
-          path: "/authority/addPower",
-          query: {
-            AuthId: this.currData.AuthId,
-            Status: this.currData.Status,
-            UpAuthId: this.currData.UpAuthId,
-          },
-        });
+      if (!this.currData) {
+        this.$message.error('请选择权限后再操作')
+        return false
+      }
+      this.ruleForm = {}
+      this.optionsApp = []
+      this.optionsParent = []
+      this.editDialogTitle = '新增下级权限'
+      this.editDialogVisible = true
+      this.editType = 'add'
+      this.optionsApp.push({
+        label: this.currData.app_name,
+        value: this.currData.app_id
+      })
+      this.optionsParent.push({
+        label: this.currData.auth_name,
+        value: this.currData.auth_id
+      })
+    },
+    //增删改
+    async changeAuth (obj, type) {
+      const { code, message } = await GeneralDataReception({
+        serviceId: SERVICE_ID.authScId,
+        dataContent: JSON.stringify(obj)
+      })
+      if (code == 0) {
+        this.$message.success(message)
+        this.getAuthTree()
+      } else {
+        this.$message.error(message)
+      }
+      if (type == 'form') {
+        this.resetForm('ruleForm')
+      } else if (type == 'del') {
+        this.flag = false
+      }
     },
     // 重置
     resetForm (formName) {
@@ -344,9 +303,18 @@ export default {
       this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
           if (this.editType == 'add') {
-            // console.log('新增')
+            this.ruleForm.app_id = this.ruleForm.app_name
+            this.ruleForm.app_name = this.currData.app_name
+            this.ruleForm.auth_status = true
+            this.ruleForm.event = 1
+            if (this.ruleForm.auth_id) {
+              this.ruleForm.up_auth_id = this.ruleForm.auth_id
+              delete this.ruleForm.auth_id
+            }
+            this.changeAuth(this.ruleForm, 'form')
           } else {
-            // console.log('编辑')
+            this.ruleForm.event = 2
+            this.changeAuth(this.ruleForm, 'form')
           }
         } else {
           return false
@@ -355,39 +323,39 @@ export default {
     },
     //树点击
     handleNodeClick (data) {
+      console.log(data)
       const dataNew = _.cloneDeep(data);
       this.currData = dataNew;
-      this.currDataArrId = dataNew.AuthId;
+      this.currDataArrId = dataNew.auth_id;
       this.currDataArr = [];
       this.childrenData = [];
-      this.currDataArr = this.decompose(this.dataArr, "AuthId", dataNew.AuthId);
+      this.currDataArr = this.decompose(this.dataArr, "auth_id", dataNew.auth_id);
       this.childrenData = this.decompose(
         this.dataArr,
-        "UpAuthId",
-        dataNew.AuthId
+        "up_auth_id",
+        dataNew.auth_id
       );
     },
     //下级卡片点击
     childrenClick (data) {
       const dataNew = _.cloneDeep(data);
       this.currData = dataNew;
-      this.currDataArrId = dataNew.AuthId;
+      this.currDataArrId = dataNew.auth_id;
       this.currDataArr = [];
       this.childrenData = [];
-      this.currDataArr = this.decompose(this.dataArr, "AuthId", dataNew.AuthId);
+      this.currDataArr = this.decompose(this.dataArr, "auth_id", dataNew.auth_id);
       this.childrenData = this.decompose(
         this.dataArr,
-        "UpAuthId",
-        dataNew.AuthId
+        "up_auth_id",
+        dataNew.auth_id
       );
-      this.$refs.tree.setCurrentKey(dataNew.AuthId);
-      this.currentKey = dataNew.AuthId;
+      console.log(this.childrenData);
+      this.$refs.tree.setCurrentKey(dataNew.auth_id);
+      this.currentKey = dataNew.auth_id;
     },
     //下级关闭
-    childrenRenderChange (data, index) {
+    childrenRenderChange (data) {
       try {
-        const { OrganId, flag } = data;
-        const Status = flag ? 1 : 0;
         tissueTreeStart({
           OrganId: OrganId,
           Status: Status,
@@ -416,53 +384,42 @@ export default {
     },
     // 修改权限
     renderEdit (data) {
-      // this.editDialogVisible = true;
-      // this.editDialogTitle = '编辑下级权限';
-      // this.editType = 'edit';
-      if (data.Type === 1) {
-        this.$router.push({
-          path: "/authority/appEdit",
-          query: {
-            AuthId: data.AuthId,
-            Status: data.Status,
-            UpAuthId: data.UpAuthId,
-          },
-        });
-      } else if (data.Type > 2) {
-        this.$router.push({
-          path: "/authority/editPower",
-          query: {
-            AuthId: data.AuthId,
-            Status: data.Status,
-            UpAuthId: data.UpAuthId,
-          },
-        });
-      }
+      this.optionsApp = []
+      this.optionsParent = []
+      this.editDialogVisible = true;
+      this.editDialogTitle = '编辑下级权限';
+      this.editType = 'edit';
+      this.ruleForm = data;
+      this.optionsApp.push({
+        label: data.app_name,
+        value: data.app_id
+      })
+      this.optionsParent.push({
+        label: this.currData.auth_name,
+        value: data.auth_id
+      })
     },
     // 权限树
     renderSub (data) {
       this.$router.push({
         path: "/authority/addPower",
         query: {
-          AuthId: data.AuthId,
-          Status: data.Status,
-          UpAuthId: data.UpAuthId,
+          AuthId: data.auth_id,
+          Status: data.auth_status,
+          UpAuthId: data.up_auth_id,
         },
       });
     },
     // 关闭开启
-    renderChange (data, index) {
-      const { AuthId, flag, Type } = data;
-      const Status = flag ? 1 : 0;
-      this.handleChange(AuthId, Status, Type, index);
+    renderChange (data) {
+      data.event = 2;
+      this.changeAuth(data);
     },
     //删除
     remove () {
-      if (this.type === 1) {
-        this.deleteApp(this.dataId);
-      } else {
-        this.deleteAuth(this.dataId);
-      }
+      this.delObj.event = 3
+      this.changeAuth(this.delObj, 'del')
+      this.childrenClick(this.delObj)
     },
     //查询
     getSearchData (val) {
@@ -476,9 +433,8 @@ export default {
     //节点关闭按钮点击
     onNodeClick (data) {
       this.flag = true;
-      this.dataId = data.AuthId;
-      this.title = data.AuthName;
-      this.type = data.Type;
+      this.title = data.auth_name;
+      this.delObj = data;
     },
     //获取指定数据
     decompose (value, key, id) {
@@ -491,79 +447,9 @@ export default {
       }
       return arr;
     },
-    //渲染节点
-    renderContent (h, data) {
-      return (
-        <div class="account-left-content-teams">
-          <div class="team">
-            <div class={[data.Type <= 1 ? "status1" : "status2", "bg"]}></div>
-            <div class={[data.QueryTarget == 1 ? "activeStatus" : "", "list"]}>
-              <div class="flex info">
-                <div class="name">{data.AuthName}</div>
-                <div class="icon">
-                  <span
-                    v-show={data.Type === 0}
-                    onClick={() => this.renderAdd()}
-                    class="cap cap-plus"
-                  ></span>
-                  <span
-                    v-show={data.Type === 1}
-                    onClick={() => this.renderEdit(data)}
-                    class="cap cap-edit"
-                  ></span>
-                  <span
-                    v-show={data.Type === 2}
-                    onClick={() => this.renderSub(data)}
-                    class="cap cap-sub"
-                  ></span>
-                  <span
-                    v-show={data.Type > 2}
-                    onClick={() => this.renderEdit(data)}
-                    class="cap cap-edit"
-                  ></span>
-                  <span
-                    v-show={data.Type > 2}
-                    onClick={() => this.renderSub(data)}
-                    class="cap cap-sub"
-                  ></span>
-                </div>
-              </div>
-              <div v-show={data.Type > 0} class="flex details">
-                <div class="details-msg">
-                  状态:
-                  <span class={[data.Status === 1 ? "success" : "error"]}>
-                    {data.Status === 1 ? "启用" : "禁用"}
-                  </span>
-                </div>
-                <div class="details-info">
-                  <el-switch
-                    v-model={data.flag}
-                    onChange={() => this.renderChange(data)}
-                    active-color="#6F81BC"
-                  ></el-switch>
-                </div>
-              </div>
-            </div>
-          </div>
-          <div
-            v-show={data.Type !== 0 && data.Type !== 2}
-            onClick={() => this.onNodeClick(data)}
-            class="info-close"
-          >
-            <i
-              class={[
-                data.Type === 1 ? "close1" : data.Type > 2 ? "close2" : "",
-                "icon",
-                "el-icon-close",
-              ]}
-            ></i>
-          </div>
-        </div>
-      );
-    },
     //-----------获取数据------------
     //应用状态变更
-    async handleChange (id, val, type, index) {
+    async handleChange (data) {
       try {
         let res = null;
         if (type === 1) {

+ 29 - 76
src/views/authorityManagement/components/authorityRoleHome.vue

@@ -15,30 +15,15 @@
         <!-- <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"
-      >
+      <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">
@@ -51,10 +36,7 @@
                     </div>
                   </div>
                   <div class="info-close">
-                    <i
-                      @click="checkRemove(item, index)"
-                      class="icon el-icon-close"
-                    ></i>
+                    <i @click="checkRemove(item, index)" class="icon el-icon-close"></i>
                   </div>
                 </div>
                 <div class="flex-wrap time">
@@ -92,16 +74,11 @@
       <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
-          >
+          <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>
@@ -111,42 +88,18 @@
       <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 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-input v-model="ruleForm.role_name" size="medium" placeholder="请输入节点名称(必填)" />
             </el-form-item>
             <el-form-item label="角色描述" prop="role_comment">
-              <el-input
-                v-model="ruleForm.role_comment"
-                size="medium"
-                type="textarea"
-                :rows="3"
-                placeholder="请输入跟踪节点描述"
-              />
+              <el-input v-model="ruleForm.role_comment" size="medium" type="textarea" :rows="3" placeholder="请输入跟踪节点描述" />
             </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>
@@ -162,7 +115,7 @@ export default {
   name: "AuthorityRole",
   components: { Search, Dialog },
   mixins: [roleData],
-  data() {
+  data () {
     return {
       arrs: [], //卡片数据
       arr: [],
@@ -194,7 +147,7 @@ export default {
       needPage: 1,
     };
   },
-  created() {
+  created () {
     if (this.$route.query.keyWords) {
       keyWords = this.$route.query.keyWords;
       this.keyWords = keyWords;
@@ -202,43 +155,43 @@ export default {
     this.queryData();
   },
   computed: {
-    noMore() {
+    noMore () {
       return this.pageNum >= this.total;
     },
-    disabled() {
+    disabled () {
       return this.loading || this.noMore;
     },
   },
   methods: {
-    queryData() {
+    queryData () {
       let data = {
-        id: 41,
+        id: DATACONTENT_ID.roleTableId,
         dataContent: [this.keyWords],
         needPage: this.needPage,
       };
       this.gueryRole(data);
     },
     //删除
-    checkRemove(item, index) {
+    checkRemove (item, index) {
       this.flag = true;
       this.index = item;
       this.title = item.role_name;
       this.num = index;
     },
     //确认删除
-    remove() {
+    remove () {
       this.index.event = 3;
       this.editRoles(this.index);
     },
     //角色新增
-    addRole() {
+    addRole () {
       this.editDialogTitle = "新增角色";
       this.editDialogVisible = true;
       this.editType = "add";
       // this.$router.push('/role/addRole')
     },
     //角色编辑
-    editRole(item) {
+    editRole (item) {
       this.editDialogVisible = true;
       this.editType = "edit";
       this.editDialogTitle = "编辑角色";
@@ -246,10 +199,10 @@ export default {
       this.ruleForm = JSON.parse(JSON.stringify(item));
     },
     //新增角色
-    async editRoles(params) {
+    async editRoles (params) {
       try {
         const res = await GeneralDataReception({
-          serviceId: 14,
+          serviceId: SERVICE_ID.roleMsgId,
           dataContent: JSON.stringify(params),
         });
         if (res.code === "0") {
@@ -267,28 +220,28 @@ export default {
       }
     },
     // 角色授权
-    authRole(item) {
+    authRole (item) {
       this.$router.push({
         path: "/role/editRole",
         query: { RoleId: item.role_id },
       });
     },
     //查询
-    getSearchData(val) {
+    getSearchData (val) {
       this.arrs = [];
       this.needPage = 1;
       this.keyWords = val;
       this.queryData()
     },
     //清除查询
-    clearSearchData() {
+    clearSearchData () {
       this.arrs = [];
       this.needPage = 1;
       this.keyWords = "";
       this.queryData()
     },
     // 新增/编辑-确认
-    submitClickHandler() {
+    submitClickHandler () {
       this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
           if (this.editType == "add") {
@@ -305,13 +258,13 @@ export default {
       });
     },
     // 重置
-    resetForm(formName) {
+    resetForm (formName) {
       this.ruleForm = [];
       this.$refs[formName].resetFields();
       this.editDialogVisible = false;
     },
     //滚动加载数据
-    load() {
+    load () {
       this.needPage = this.needPage + 1
       this.queryData()
     },

+ 40 - 47
src/views/authorityManagement/minixs/treeData.js

@@ -8,68 +8,63 @@
  */
 import { translateDataToTreeAll } from '@/utils/validate'
 import { GetAuthTree } from '@/api/apiAuthority'
-
+import { Query } from '@/api/dataIntegration'
 export default {
   data () {
     return {
-      dataList: {}
+      dataList: {},
+      searchinfo: ''
     }
   },
   created () {
     // this.getAuthTree()
   },
   methods: {
-    async getAuthTree (name = '') {
+    async getAuthTree () {
       try {
-        const result = await GetAuthTree({
-          "QueryName": name
+        const result = await Query({
+          id: DATACONTENT_ID.authTreeId,
+          dataContent: [this.searchinfo]
         })
-        if (result.code === 0 && result.returnData.length) {
-          result.returnData.forEach(item => {
-            item.flag = item.Status === 1 ? true : false
-          })
+        if (result.code == 0 && result.returnData.listValues) {
           const obj = {
-            AuthId: -1,
-            AuthName: "所有权限",
-            QueryTarget: 0,
-            Status: 0,
-            UpAuthId: -1,
-            Type: 0,
+            auth_id: -1,
+            auth_name: "所有权限",
+            auth_status: true,
+            up_auth_id: -1,
+            auth_type: 0,
             disabled: true,
-            children: translateDataToTreeAll(result.returnData, 'UpAuthId', 'AuthId')
+            children: translateDataToTreeAll(result.returnData.listValues, 'up_auth_id', 'auth_id')
           }
           this.dataList = obj
-          this.dataArr = result.returnData;
+          this.dataArr = result.returnData.listValues;
           this.dataArr.push({
-            AuthId: -1,
-            AuthName: "所有权限",
-            QueryTarget: 0,
-            Status: 0,
-            UpAuthId: -2,
-            Type: 0,
+            auth_id: -1,
+            auth_name: "所有权限",
+            auth_status: true,
+            up_auth_id: -1,
+            auth_type: 0,
             disabled: true,
             children: []
           }
           )
         } else {
           const obj = {
-            AuthId: -1,
-            AuthName: "所有权限",
-            QueryTarget: 0,
-            Status: 0,
-            UpAuthId: -2,
-            Type: 0,
+            auth_id: -1,
+            auth_name: "所有权限",
+            auth_status: true,
+            up_auth_id: -1,
+            auth_type: 0,
             disabled: true,
             children: []
           }
           this.dataList = obj
           this.dataArr.push({
-            AuthId: -1,
-            AuthName: "所有权限",
-            QueryTarget: 0,
-            Status: 0,
-            UpAuthId: -2,
-            Type: 0,
+            auth_id: -1,
+            auth_name: "所有权限",
+            auth_status: true,
+            up_auth_id: -1,
+            auth_type: 0,
             disabled: true,
             children: []
           }
@@ -77,23 +72,21 @@ export default {
         }
       } catch (error) {
         const obj = {
-          AuthId: -1,
-          AuthName: "所有权限",
-          QueryTarget: 0,
-          Status: 0,
-          UpAuthId: -2,
-          Type: 0,
+          auth_id: -1,
+          auth_name: "所有权限",
+          auth_status: true,
+          up_auth_id: -1,
+          auth_type: 0,
           disabled: true,
           children: []
         }
         this.dataList = obj
         this.dataArr.push({
-          AuthId: -1,
-          AuthName: "所有权限",
-          QueryTarget: 0,
-          Status: 0,
-          UpAuthId: -2,
-          Type: 0,
+          auth_id: -1,
+          auth_name: "所有权限",
+          auth_status: true,
+          up_auth_id: -1,
+          auth_type: 0,
           disabled: true,
           children: []
         }

+ 2 - 2
src/views/login/index.vue

@@ -127,7 +127,7 @@ export default {
         'appSecret': PLATFROM_CONFIG.appSecret
       })
       if (res.code == 0 && res.data) {
-        setCodeToken(res.data);
+        setCodeToken(res.data.appToken);
         setTimeout(() => {
           this.getCheckCode();
           this.getSystemSet();
@@ -237,7 +237,7 @@ export default {
     //获取动态验证码
     async getCheckCode () {
       const res = await GetCheckCode({
-        code: getCodeToken()
+        appToken: getCodeToken()
       });
       if (res.code == 0) {
         this.loginForm.CheckCode = res.data;