瀏覽代碼

Merge branch 'ETA1.2.6'

cxmo 1 年之前
父節點
當前提交
56f61ccaf6
共有 2 個文件被更改,包括 109 次插入3 次删除
  1. 16 0
      src/api/modules/businessCustom.js
  2. 93 3
      src/views/business_ETA_manage/businessAuth.vue

+ 16 - 0
src/api/modules/businessCustom.js

@@ -121,5 +121,21 @@ export const businessCustomInterence = {
      */
     setAuthList:(params)=>{
         return http.post('/eta_business/menu/relate/save',params)
+    },
+    /**
+     * 获取商家接口权限
+     * @returns 
+     */
+    getConfigList:(params)=>{
+        return http.get('/eta_business/api/config/list',params)
+    },
+    /**
+     * 设置商家接口权限
+     * @param EtaBusinessId 商家ID
+     * @param List 接口权限列表
+     * @returns 
+     */
+    setConfigList:(params)=>{
+        return http.post('/eta_business/api/config/set',params)
     }
 }

+ 93 - 3
src/views/business_ETA_manage/businessAuth.vue

@@ -7,7 +7,12 @@
                 <el-button type="primary" @click="handleBtnClik('save')">保存</el-button>
             </div>
         </div>
-        <div class="auth-wrap">
+        <div class="model-wrap">
+            <el-button :type="model==='auth'?'primary':''" @click="model='auth'">菜单权限</el-button>
+            <span class="block"></span>
+            <el-button :type="model==='interence'?'primary':''" @click="model='interence'">接口权限</el-button>
+        </div>
+        <div class="auth-wrap" v-show="model==='auth'">
             <el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" style="margin-bottom: 20px;">全选</el-checkbox>
             <el-tree 
                 v-loading="treeLoading"
@@ -21,6 +26,19 @@
                 @check-change="()=>{handleCheckChange()}">
             </el-tree>
         </div>
+        <div class="interence-wrap" v-show="model==='interence'">
+            <div class="interence-item">
+                <span>研报审批</span>
+                <el-radio-group v-model="isApprove">
+                    <el-radio :label="0">否</el-radio>
+                    <el-radio :label="1">是</el-radio>
+                </el-radio-group>
+                <el-checkbox-group v-model="approveList" v-show="isApprove===1">
+                    <el-checkbox :label="2">智能研报</el-checkbox>
+                    <el-checkbox :label="1">研报列表</el-checkbox>
+                </el-checkbox-group>
+            </div>
+        </div>
     </div>
 </template>
 
@@ -34,7 +52,10 @@ export default {
             treeLoading:false,
             checkAll:false,
             isIndeterminate:false,
-            checkList:[],
+            model:'auth',
+            isApprove:'',
+            approveList:[],
+            checkList:[]
         };
     },
     watch:{
@@ -47,9 +68,38 @@ export default {
                     this.$refs.checkboxTree.setCheckedKeys([])
                 }
             }
+        },
+        isApprove(newVal){
+            if(newVal===0){
+                this.approveList=[]
+            }
         }
     },
     methods: {
+        getBusinessConfigList(){
+            const EtaBusinessId = this.$route.query.id
+            if(!EtaBusinessId) return 
+            businessCustomInterence.getConfigList({
+                EtaBusinessId:Number(EtaBusinessId)
+            }).then(res=>{
+                if(res.Ret!==200) return
+                const list = res.Data||[]
+                const approveItem = list.find(i=>i.ConfigCode==='approval_flow')
+                if(!approveItem) return
+                if(!approveItem.ConfigValue.length){
+                    this.isApprove = approveItem.ConfigValue
+                    return
+                }
+                if(Number(approveItem.ConfigValue)===0){
+                    this.isApprove = Number(approveItem.ConfigValue)
+                    return
+                }
+                if(Number(approveItem.ConfigValue)>0){
+                    this.isApprove = 1
+                    this.approveList = approveItem.ConfigValue==3?[1,2]:[Number(approveItem.ConfigValue)]
+                }
+            })
+        },
         getBusinessAuthList(){
             const EtaBusinessId = this.$route.query.id
             if(!EtaBusinessId) return 
@@ -127,6 +177,30 @@ export default {
                 })
                 if(res.Ret!==200) return 
                 this.$message.success('权限设置成功')
+
+                if(typeof(this.isApprove)==='string'){
+                    this.$message.warning('请配置接口权限')
+                    this.model='interence'
+                    return
+                }else{
+                    if(this.isApprove&&!this.approveList.length){
+                        this.$message.warning('请选择接口权限')
+                        return
+                    }
+                    let configValue = ''
+                    if(this.isApprove){
+                        configValue = this.approveList.length>1?"3":this.approveList[0]+"" //3表示全选
+                    }else{
+                        configValue = this.isApprove+""
+                    }
+                    const list = [{ConfigCode:"approval_flow",ConfigValue:configValue}] //目前只有一项
+                    const interenceRes = await businessCustomInterence.setConfigList({
+                        EtaBusinessId:Number(this.$route.query.id),
+                        List:list
+                    })
+                    if(interenceRes.Ret!==200) return 
+                    this.$message.success('接口权限设置成功')
+                }
             }
             this.$router.push('/businessETAList')
         },
@@ -150,6 +224,7 @@ export default {
         }
     },
     mounted(){
+        this.getBusinessConfigList()
         this.getBusinessAuthList()
     }
 };
@@ -272,8 +347,23 @@ export default {
             font-weight: bold;
         }
     }
-    .auth-wrap{
+    .model-wrap{
+        display: flex;
+        gap:20px;
+        align-items: center;
+        .block{
+            display: inline-block;
+            height:20px;
+            width:1px;
+            background-color: #333;
+        }
+    }
+    .auth-wrap,.interence-wrap{
         margin-top:20px;
     }
+    .interence-item{
+        display: flex;
+        gap:25px;
+    }
 }
 </style>