zhaoke 3 лет назад
Родитель
Сommit
8aa1a3cd3d

+ 2 - 0
public/config.js

@@ -4,6 +4,8 @@ PLATFROM_CONFIG.baseUrl = "https://authgateway.fsjtkj.cn/" // http请求地址
 PLATFROM_CONFIG.socketUrl = "wss://auth.fsjtkj.cn/websocket" // websocket请求地址
 PLATFROM_CONFIG.appSecret = "40t7vcbi5bc1twyihd2dum82yn1mt1kj" //appSecret
 PLATFROM_CONFIG.appId = "unsk1w37910olf8j" //appid
+PLATFROM_CONFIG.gatewayApiUrl = "106.14.243.117:8089" // 网关测试连接地址
+PLATFROM_CONFIG.gatewayUrl = "http://106.14.243.117:8089" //网关http请求地址
 // does job show yes/no 显示/不显示职务
 PLATFROM_CONFIG.doesJobShow = false
 

+ 66 - 11
src/api/fusing.js

@@ -1,7 +1,7 @@
-import request from '@/utils/request'
+import request from '@/utils/request-gat'
 
 //熔断列表查询
-export function GetFusingList(params) {
+export function GetFusingList (params) {
   return request({
     url: '/api/Fusing/GetFusingList',
     method: 'post',
@@ -10,7 +10,7 @@ export function GetFusingList(params) {
 }
 
 //新增熔断
-export function addFusingList(params) {
+export function addFusingList (params) {
   return request({
     url: '/api/Fusing/EditFusingInfo',
     method: 'post',
@@ -19,7 +19,7 @@ export function addFusingList(params) {
 }
 
 //熔断详情
-export function GetFusingById(params) {
+export function GetFusingById (params) {
   return request({
     url: '/api/Fusing/GetFusingById',
     method: 'post',
@@ -28,7 +28,7 @@ export function GetFusingById(params) {
 }
 
 //删除熔断
-export function DeleteFusingInfo(params) {
+export function DeleteFusingInfo (params) {
   return request({
     url: '/api/Fusing/DeleteFusingInfo',
     method: 'post',
@@ -37,7 +37,7 @@ export function DeleteFusingInfo(params) {
 }
 
 //状态变更
-export function UpdateFusingStatusPatch(params) {
+export function UpdateFusingStatusPatch (params) {
   return request({
     url: '/api/Fusing/UpdateFusingStatusPatch',
     method: 'post',
@@ -45,8 +45,45 @@ export function UpdateFusingStatusPatch(params) {
   })
 }
 
+//业务服务列表信息
+export function GateWayBusinessGetList (params) {
+  return request({
+    url: '/api/Business/GateWayBusinessGetList',
+    method: 'post',
+    data: params
+  })
+}
+
+//熔断规则批量关联路由信息
+export function ChangeBusinessFusingRelation (params) {
+  return request({
+    url: '/api/Fusing/ChangeBusinessFusingRelation',
+    method: 'post',
+    data: params
+  })
+}
+
+//选中路由信息
+export function GetRelBusinessByFusing (params) {
+  return request({
+    url: '/api/Fusing/GetRelBusinessByFusing',
+    method: 'post',
+    data: params
+  })
+}
+
+//未选中路由信息
+export function GetBusinessByFusing (params) {
+  return request({
+    url: '/api/Fusing/GetBusinessByFusing',
+    method: 'post',
+    data: params
+  })
+}
+
+
 //限流列表查询
-export function GetLimitList(params) {
+export function GetLimitList (params) {
   return request({
     url: '/api/Limit/GetLimitList',
     method: 'post',
@@ -55,7 +92,7 @@ export function GetLimitList(params) {
 }
 
 //新增限流
-export function EditLimitInfo(params) {
+export function EditLimitInfo (params) {
   return request({
     url: '/api/Limit/EditLimitInfo',
     method: 'post',
@@ -64,7 +101,7 @@ export function EditLimitInfo(params) {
 }
 
 //删除限流
-export function DeleteLimitInfo(params) {
+export function DeleteLimitInfo (params) {
   return request({
     url: '/api/Limit/DeleteLimitInfo',
     method: 'post',
@@ -73,7 +110,7 @@ export function DeleteLimitInfo(params) {
 }
 
 //状态变更
-export function UpdateLimitStatusPatch(params) {
+export function UpdateLimitStatusPatch (params) {
   return request({
     url: '/api/Limit/UpdateLimitStatusPatch',
     method: 'post',
@@ -82,10 +119,28 @@ export function UpdateLimitStatusPatch(params) {
 }
 
 //限流详情
-export function GetLimitById(params) {
+export function GetLimitById (params) {
   return request({
     url: '/api/Limit/GetLimitById',
     method: 'post',
     data: params
   })
+}
+
+//限流规则批量关联路由信息
+export function ChangeBusinessLimitRelation (params) {
+  return request({
+    url: '/api/Limit/ChangeBusinessLimitRelation',
+    method: 'post',
+    data: params
+  })
+}
+
+//根据限流规则获取路由信息
+export function GetbusinessByLimit (params) {
+  return request({
+    url: '/api/Limit/GetbusinessByLimit',
+    method: 'post',
+    data: params
+  })
 }

+ 22 - 22
src/api/gat-interface.js

@@ -1,4 +1,4 @@
-import request from '@/utils/request'
+import request from '@/utils/request-gat'
 
 /**
  * 
@@ -9,7 +9,7 @@ export function gateWayBServerGetList (params) {
   return request({
     url: '/api/BServer/GateWayBServerGetList',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -18,7 +18,7 @@ export function gateWayBServerGetById (params) {
   return request({
     url: '/api/BServer/GateWayBServerGetById',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -27,7 +27,7 @@ export function gateWayBServerDeleteById (params) {
   return request({
     url: '/api/BServer/GateWayBServerDeleteById',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -36,7 +36,7 @@ export function gateWayBServerEdit (params) {
   return request({
     url: '/api/BServer/GateWayBServerEdit',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -45,7 +45,7 @@ export function gateWayBServerStatusEdit (params) {
   return request({
     url: '/api/BServer/GateWayBServerStatusEdit',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -54,7 +54,7 @@ export function gateWayRelationBServerGetByBusiness (params) {
   return request({
     url: '/api/BServer/GateWayRelationBServerGetByBusiness',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -63,7 +63,7 @@ export function gateWayBServerGetByBusiness (params) {
   return request({
     url: '/api/BServer/GateWayBServerGetByBusiness',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -72,7 +72,7 @@ export function gateWayBusinessBServerRelationByBServer (params) {
   return request({
     url: '/api/BServer/GateWayBusinessBServerRelationByBServer',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -85,7 +85,7 @@ export function asyncTest (params) {
   return request({
     url: '/api/Business/AsyncTest',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -94,7 +94,7 @@ export function gateWayApiDocumentList (params) {
   return request({
     url: '/api/Business/GateWayApiDocumentList',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -103,7 +103,7 @@ export function gateWayBusinessGetList (params) {
   return request({
     url: '/api/Business/GateWayBusinessGetList',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -112,7 +112,7 @@ export function gateWayBusinessGetById (params) {
   return request({
     url: '/api/Business/GateWayBusinessGetById',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -121,7 +121,7 @@ export function gateWayBusinessAllGetById (params) {
   return request({
     url: '/api/Business/GateWayBusinessAllGetById',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -130,7 +130,7 @@ export function gateWayBusinessDeleteById (params) {
   return request({
     url: '/api/Business/GateWayBusinessDeleteById',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -139,7 +139,7 @@ export function gateWayBusinessAllEdit (params) {
   return request({
     url: '/api/Business/GateWayBusinessAllEdit',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -148,7 +148,7 @@ export function gateWayBusinessStatusEdit (params) {
   return request({
     url: '/api/Business/GateWayBusinessStatusEdit',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -157,7 +157,7 @@ export function gateWayRelBusinessGetByBServer (params) {
   return request({
     url: '/api/Business/GateWayRelBusinessGetByBServer',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -166,7 +166,7 @@ export function gateWayBusinessGetByBServer (params) {
   return request({
     url: '/api/Business/GateWayBusinessGetByBServer',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -175,7 +175,7 @@ export function gateWayBusinessBServerRelationByBusiness (params) {
   return request({
     url: '/api/Business/GateWayBusinessBServerRelationByBusiness',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -188,7 +188,7 @@ export function parameterGetListAll (params) {
   return request({
     url: '/api/Parameter/ParameterGetListAll',
     method: 'post',
-    params
+    data: params
   })
 }
 
@@ -197,6 +197,6 @@ export function parameterEditByBusinessId (params) {
   return request({
     url: '/api/Parameter/ParameterEditByBusinessId',
     method: 'post',
-    params
+    data: params
   })
 }

+ 2 - 1
src/store/getters.js

@@ -29,6 +29,7 @@ const getters = {
   authId: state => state.auth.authId,
   authMsg: state => state.auth.authMsg,
   userRole: state => state.app.OpenRole,
-  permission_routes: state => state.permission.routes
+  permission_routes: state => state.permission.routes,
+  interfaceDatas: state => state.user.interfaceDatas
 }
 export default getters

+ 31 - 1
src/store/modules/user.js

@@ -8,6 +8,7 @@ const getDefaultState = () => {
     name: '',
     avatar: '',
     roles: [],
+    interfaceDatas: [],
     firstLogin: getToken('FirstLogin') ? JSON.parse(getToken('FirstLogin')) : false,
     UserType: sessionStorage.getItem('UserType') ? sessionStorage.getItem('UserType') : '',
     UserId: sessionStorage.getItem('User_Id') ? sessionStorage.getItem('User_Id') : '',
@@ -46,6 +47,26 @@ const mutations = {
   SET_LOGIN: (state, login) => {
     state.firstLogin = login
   },
+  SET_INTERFACE: (state, interfaceDatas) => {
+    interfaceDatas.forEach((item) => {
+      state.interfaceDatas.push(item);
+    });
+    state.interfaceDatas = _.uniqBy(state.interfaceDatas, "bserverid");
+  },
+  REST_INTERFACE: (state, obj) => {
+    state.interfaceDatas.forEach((item, index) => {
+      if (item.bserverid == obj.bserverid) {
+        state.interfaceDatas.splice(index, 1, obj);
+      }
+    });
+  },
+  REMOVE_INTERFACE: (state, obj) => {
+    state.interfaceDatas.forEach((item, index) => {
+      if (item.bserverid == obj.bserverid) {
+        state.interfaceDatas.splice(index, 1);
+      }
+    });
+  },
 }
 
 const actions = {
@@ -150,7 +171,16 @@ const actions = {
   },
   setPowerList ({ commit }, arr) {
     commit('SET_UserPoewrList', arr);
-  }
+  },
+  setFaceDatas ({ commit }, device) {
+    commit("SET_INTERFACE", device);
+  },
+  restFaceDatas ({ commit }, device) {
+    commit("REST_INTERFACE", device);
+  },
+  removeFaceDatas ({ commit }, device) {
+    commit("REMOVE_INTERFACE", device);
+  },
 }
 
 export default {

+ 2 - 2
src/utils/request-gat.js

@@ -14,7 +14,7 @@ import { Loading } from 'element-ui'
 // create an axios instance
 const service = axios.create({
   //baseURL: baseURL, // url = base url + request url
-  baseURL: 'http://106.14.243.117:8089',
+  baseURL: PLATFROM_CONFIG.gatewayUrl,
   // withCredentials: true, // send cookies when cross-domain requests
   timeout: 30000, // request timeout
   headers: {
@@ -118,7 +118,7 @@ service.interceptors.response.use(
       }
       service(config)
     }
-    if (res.code == 0 || res.code == -1) {
+    if (res.success) {
       flag = false
       loadingInstance.close()
       return res

+ 321 - 69
src/views/gateway/circuit-break/index.vue

@@ -7,90 +7,97 @@
         @getSearchData="getSearchData"
         @clearSearchData="clearSearchData"
       >
-        <button
-          class="btnAdd"
-          @click="(dialogAddShow = true), (upName = '新增')"
-        >
-          新增
-        </button>
+        <button class="btnAdd" @click="newadd()">新增</button>
       </Search>
     </div>
     <div class="gateway-circuit-break-content">
       <template v-if="circuitBreakList.length">
-        <el-row :gutter="24">
+        <el-row :gutter="24" v-infinite-scroll="load">
           <el-col
-            v-for="(
-              {
-                searchId,
-                name,
-                fusingtime,
-                businessouttime,
-                maxerror,
-                interfaceBinding,
-              },
-              index
-            ) in circuitBreakList"
-            :key="searchId"
+            v-for="(item, index) in circuitBreakList"
+            :key="index"
             :xs="24"
             :md="12"
             :lg="6"
             :xl="6"
           >
             <NormalCard
-              :title="name"
-              :flag.sync="circuitBreakList[index].flag"
-              @update="update(searchId, circuitBreakList[index].flag)"
-              @close-click="removeCard(searchId)"
-              @editdate="editClickHandler(searchId)"
+              :title="item.fusingname"
+              :flag="item.fusingstatus == 0 ? false : true"
+              @close-click="removeCard(item.fusingid)"
+              @editdate="editClickHandler(item.fusingid)"
             >
               <template #default>
                 <el-row :gutter="16">
                   <el-col :span="7" class="card-content-left"
                     >熔断时间:</el-col
                   >
-                  <el-col :span="5" class="card-content-right">{{
-                    fusingtime
+                  <el-col :span="15" class="card-content-right">{{
+                    item.fusingtime
                   }}</el-col>
-                  <el-col :span="7" class="card-content-left"
+                  <!-- <el-col :span="7" class="card-content-left"
                     >接口关联:</el-col
                   >
                   <el-col :span="5" class="card-content-right">{{
-                    interfaceBinding
-                  }}</el-col>
+                    item.interfaceBinding
+                  }}</el-col> -->
                   <el-col :span="7" class="card-content-left"
                     >超时时间:</el-col
                   >
                   <el-col :span="17" class="card-content-right">{{
-                    businessouttime
+                    item.businessouttime
                   }}</el-col>
                   <el-col :span="7" class="card-content-left"
                     >熔断标准:</el-col
                   >
                   <el-col :span="17" class="card-content-right">{{
-                    maxerror
+                    item.maxerror
                   }}</el-col>
                 </el-row>
+                <div class="card-switch">
+                  <p :class="item.fusingstatus == 1 ? 'start_up' : 'close'">
+                    {{ item.fusingstatus == 1 ? "开启" : "关闭" }}
+                  </p>
+                  <el-switch
+                    v-model="item.fusingstatuse"
+                    active-color="#6F81BC"
+                    @change="update(item.fusingid, item.fusingstatuse)"
+                  />
+                </div>
               </template>
             </NormalCard>
           </el-col>
         </el-row>
       </template>
       <template v-else>
-        <el-empty description="暂无数据" />
+        <!-- <el-empty description="暂无数据" /> -->
       </template>
     </div>
     <Dialog
       :flag="dialogAddShow"
-      width="630px"
+      width="800px"
       @close-dialog="dialogAddShow = false"
     >
       <div class="dialog-add-title">{{ upName }}熔断配置</div>
       <div class="dialog-add-content">
-        <el-form :model="circuitBreakAddForm" label-width="auto">
+        <el-form
+          :model="circuitBreakAddForm"
+          label-width="auto"
+          ref="circuitBreakAddForm"
+        >
           <el-row :gutter="24">
+            <el-col :span="12">
+              <el-form-item label="熔断名称">
+                <el-input
+                  v-model="circuitBreakAddForm.fusingname"
+                  placeholder="请输入熔断名称"
+                />
+              </el-form-item>
+            </el-col>
             <el-col :span="12">
               <el-form-item label="熔断时间">
                 <el-input
+                  oninput="value=value.replace(/^\.+|[^\d.]/g,'')"
                   v-model="circuitBreakAddForm.circuitBreakDuration"
                   placeholder="请输入熔断时间"
                 />
@@ -99,6 +106,7 @@
             <el-col :span="12">
               <el-form-item label="服务超时时间">
                 <el-input
+                  oninput="value=value.replace(/^\.+|[^\d.]/g,'')"
                   v-model="circuitBreakAddForm.timeoutPeriod"
                   placeholder="请输入服务超时时间"
                 />
@@ -107,6 +115,7 @@
             <el-col :span="12">
               <el-form-item label="达成熔断标准">
                 <el-input
+                  oninput="value=value.replace(/^\.+|[^\d.]/g,'')"
                   v-model="circuitBreakAddForm.circuitBreakStandard"
                   placeholder="请输入次数(次)"
                 />
@@ -120,7 +129,7 @@
                 />
               </el-form-item>
             </el-col>
-            <el-col :span="12">
+            <!-- <el-col :span="12">
               <el-form-item label="是否启用">
                 <el-radio-group
                   v-model="circuitBreakAddForm.enable"
@@ -130,7 +139,7 @@
                   <el-radio :label="false">否</el-radio>
                 </el-radio-group>
               </el-form-item>
-            </el-col>
+            </el-col> -->
           </el-row>
           <el-form-item label="熔断规则描述">
             <el-input
@@ -139,6 +148,46 @@
             />
           </el-form-item>
         </el-form>
+        <div class="routing-protocol">
+          <div class="dialog-add-title">熔断策略-绑定路由协议</div>
+          <el-input
+            @clear="clearSearch"
+            clearable
+            v-model="searchInfos"
+            @keyup.enter.native="searchUp"
+            style="width: 40%"
+          >
+            <el-button slot="prepend" icon="el-icon-search"></el-button>
+          </el-input>
+        </div>
+        <el-table
+          class="table"
+          :data="interfaceDatas"
+          height="380px"
+          stripe
+          style="width: 100%"
+        >
+          <el-table-column prop="" width="90">
+            <template slot-scope="scope">
+              <el-checkbox
+                v-model="scope.row.start"
+                @change="upstart(scope.row)"
+              ></el-checkbox>
+            </template>
+          </el-table-column>
+          <el-table-column prop="businessname" label="路由名称">
+          </el-table-column>
+          <el-table-column prop="businessmethod" label="方法" width="150">
+          </el-table-column>
+          <el-table-column
+            prop="businessrequesttype"
+            label="请求方式"
+            width="90"
+          >
+          </el-table-column>
+          <el-table-column prop="businesstime" label="创建时间">
+          </el-table-column>
+        </el-table>
       </div>
       <div class="dialog-add-bottom fc">
         <el-button
@@ -148,9 +197,7 @@
           class="r24 blubtn"
           >提交</el-button
         >
-        <el-button size="medium" class="wbtn" @click="dialogAddShow = false"
-          >取消</el-button
-        >
+        <el-button size="medium" class="wbtn" @click="deles()">取消</el-button>
       </div>
     </Dialog>
     <Dialog :flag="dialogVisible">
@@ -181,6 +228,9 @@ import {
   DeleteFusingInfo,
   UpdateFusingStatusPatch,
   GetFusingById,
+  GateWayBusinessGetList,
+  ChangeBusinessFusingRelation,
+  GetBusinessByFusing,
 } from "@/api/fusing";
 
 export default {
@@ -192,19 +242,10 @@ export default {
   },
   data() {
     return {
-      circuitBreakList: [
-        {
-          searchId: 0,
-          name: "熔断规则名称",
-          fusingtime: 2,
-          businessouttime: 2,
-          maxerror: 3,
-          businesserrorresponse: 2,
-          fusingdescribe: 2,
-          flag: true,
-        },
-      ],
+      circuitBreakList: [],
       circuitBreakAddForm: {
+        fusingid: "",
+        fusingname: "",
         circuitBreakDuration: "",
         timeoutPeriod: "",
         circuitBreakStandard: "",
@@ -220,8 +261,16 @@ export default {
       pages: null,
       loading: false,
       searchInfo: "",
+      searchInfos: "",
       searchId: "",
       upName: "",
+      input: "",
+      interfaceDatas: [],
+      selectedList: [],
+      selectedLister: [],
+      delList: [],
+      delLister: [],
+      fusingider: "",
     };
   },
   created() {
@@ -231,11 +280,14 @@ export default {
     // 查询
     getSearchData(val) {
       this.searchInfo = val;
+      this.circuitBreakList = [];
       this.pageInit();
     },
     // 清除查询
     clearSearchData() {
       this.searchInfo = "";
+      this.circuitBreakList = [];
+      this.pageInit();
     },
     // 滚动加载
     load() {
@@ -245,7 +297,7 @@ export default {
     // 回到第一页
     pageInit() {
       this.PageIndex = 1;
-      this.accountArr = [];
+      this.circuitBreakList = [];
       this.accountList();
     },
     //查询熔断列表
@@ -257,12 +309,12 @@ export default {
           PageIndex: this.PageIndex,
           PageSize: this.PageSize,
         });
-        if (result.code === 0) {
+        if (result.success) {
           this.loading = false;
-          const newDatas = result.returnData.data;
-          // console.log(newDatas[0])
+          const newDatas = result.data;
           // this.pages = result.returnData.pages;
           newDatas.forEach((element) => {
+            element.fusingstatuse = element.fusingstatus == 1 ? true : false;
             this.circuitBreakList.push(element);
           });
         } else {
@@ -272,6 +324,12 @@ export default {
         console.log("出错了", error);
       }
     },
+    //新增——弹窗
+    async newadd() {
+      this.dialogAddShow = true;
+      this.upName = "新增";
+      this.routList();
+    },
     //新增熔断
     async onSubmit() {
       try {
@@ -279,16 +337,15 @@ export default {
           fusingid: this.circuitBreakAddForm.fusingid
             ? this.circuitBreakAddForm.fusingid
             : "",
+          fusingname: this.circuitBreakAddForm.fusingname,
           fusingtime: this.circuitBreakAddForm.circuitBreakDuration,
           businessouttime: this.circuitBreakAddForm.timeoutPeriod,
           maxerror: this.circuitBreakAddForm.circuitBreakStandard,
           businesserrorresponse: this.circuitBreakAddForm.errorCode,
           fusingdescribe: this.circuitBreakAddForm.description,
         });
-        if (result.code === 0) {
-          this.dialogAddShow = false;
-          this.circuitBreakAddForm = {};
-          this.pageInit();
+        if (result.success) {
+          this.relationRou(result.data);
         } else {
           this.$message.error(result.message);
         }
@@ -296,10 +353,32 @@ export default {
         console.log("出错了", error);
       }
     },
+    //情空
+    empty() {
+      this.circuitBreakAddForm = {
+        fusingid: "",
+        fusingname: "",
+        circuitBreakDuration: "",
+        timeoutPeriod: "",
+        circuitBreakStandard: "",
+        errorCode: "",
+        enable: true,
+        description: "",
+      };
+      this.delList = [];
+      this.delLister = [];
+      this.selectedList = [];
+      this.selectedLister = [];
+      this.fusingider = "";
+    },
+    deles() {
+      this.dialogAddShow = false;
+      this.empty();
+    },
     //删除-弹窗
-    removeCard(searchId) {
+    removeCard(fusingid) {
       this.dialogVisible = true;
-      this.searchId = searchId;
+      this.searchId = fusingid;
       // this.circuitBreakList.splice(index, 1);
     },
     //删除-接口
@@ -308,7 +387,7 @@ export default {
         const result = await DeleteFusingInfo({
           searchId: this.searchId,
         });
-        if (result.code === 0) {
+        if (result.success) {
           this.dialogVisible = false;
           this.pageInit();
         } else {
@@ -319,13 +398,13 @@ export default {
       }
     },
     //状态变更
-    async update(searchId, data) {
+    async update(fusingid, fusingstatus) {
       try {
         const result = await UpdateFusingStatusPatch({
-          edittype: data ? 1 : 0,
-          idlist: [searchId],
+          edittype: fusingstatus == true ? 1 : 0,
+          idlist: [fusingid],
         });
-        if (result.code === 0) {
+        if (result.success) {
           this.pageInit();
         } else {
           this.$message.error(result.message);
@@ -335,14 +414,16 @@ export default {
       }
     },
     //编辑详情
-    async editClickHandler(searchId) {
+    async editClickHandler(fusingid) {
+      this.fusingider = fusingid;
       this.upName = "编辑";
       this.dialogAddShow = true;
       try {
         const result = await GetFusingById({
-          searchId: searchId,
+          searchId: fusingid,
         });
-        if (result.code === 0) {
+        if (result.success) {
+          this.circuitBreakAddForm.fusingname = result.data.fusingname;
           this.circuitBreakAddForm.circuitBreakDuration =
             result.data.fusingtime;
           this.circuitBreakAddForm.timeoutPeriod = result.data.businessouttime;
@@ -351,6 +432,148 @@ export default {
             result.data.businesserrorresponse;
           this.circuitBreakAddForm.description = result.data.fusingdescribe;
           this.circuitBreakAddForm.fusingid = result.data.fusingid;
+          this.selectRoute(fusingid);
+        } else {
+          this.$message.error(result.message);
+        }
+      } catch (error) {
+        console.log("出错了", error);
+      }
+    },
+    //编辑-路由列表
+    async selectRoute(fusingid) {
+      try {
+        const rel = await GetBusinessByFusing({
+          searchId: fusingid,
+          keyword: this.searchInfos,
+          PageIndex: this.PageIndex,
+          PageSize: this.PageSize,
+        });
+        if (rel.success) {
+          rel.data.forEach((element) => {
+            if (element.relation == 1) {
+              element.start = true;
+            } else {
+              element.start = false;
+            }
+          });
+          if (this.selectedList.length > 0) {
+            this.selectedList.forEach((element) => {
+              rel.data.forEach((res) => {
+                if (res.businessid == element) {
+                  res.start = true;
+                }
+              });
+            });
+          } else if (this.selectedList.length == 0) {
+            this.interfaceDatas.forEach((element) => {
+              if (element.relation == 1) {
+                this.selectedList.push(element.businessid);
+              }
+            });
+          }
+          this.interfaceDatas = rel.data;
+        } else {
+          this.$message.error(rel.message);
+        }
+      } catch (error) {
+        console.log("出错了", error);
+      }
+    },
+    clearSearch() {
+      this.searchInfos = "";
+      this.routList();
+    },
+    searchUp() {
+      if (this.upName == "新增") {
+        this.routList();
+      } else {
+        this.selectRoute(this.fusingider);
+      }
+    },
+    //新增-路由列表
+    async routList() {
+      try {
+        const result = await GateWayBusinessGetList({
+          keyword: this.searchInfos,
+          PageIndex: this.PageIndex,
+          PageSize: this.PageSize,
+        });
+        if (result.success) {
+          result.data.forEach((element) => {
+            element.start = false;
+          });
+          if (this.selectedList.length > 0) {
+            this.selectedList.forEach((element) => {
+              result.data.forEach((res) => {
+                if (res.businessid == element) {
+                  res.start = true;
+                }
+              });
+            });
+          }
+          this.interfaceDatas = result.data;
+        } else {
+          this.$message.error(result.message);
+        }
+      } catch (error) {
+        console.log("出错了", error);
+      }
+    },
+    //选中
+    upstart(row) {
+      if (this.upName == "新增") {
+        if (row.start == true) {
+          this.selectedList.push(row.businessid);
+        } else {
+          this.selectedList = this.selectedList.filter(
+            (i) => i != row.businessid
+          );
+        }
+      } else {
+        this.selectedLister = [];
+        if (row.start == true) {
+          this.selectedList.push(row.businessid);
+        } else {
+          this.selectedList = this.selectedList.filter(
+            (i) => i != row.businessid
+          );
+        }
+        let arr = [];
+        arr = this.interfaceDatas.filter(
+          (i) => i.relation == 0 && i.start == true
+        );
+        this.selectedLister = [];
+        arr.forEach((element) => {
+          this.selectedLister.push(element.businessid);
+        });
+        // this.selectedList = Array.from(new Set(this.selectedLister));
+        let arrs = [];
+        arrs = this.interfaceDatas.filter(
+          (i) => i.relation == 1 && i.start == false
+        );
+        this.delList = [];
+        arrs.forEach((element) => {
+          this.delList.push(element.businessid);
+        });
+        // this.delList = Array.from(new Set(this.delLister));
+      }
+    },
+    //关联路由
+    async relationRou(data) {
+      try {
+        const result = await ChangeBusinessFusingRelation({
+          bindingid: data.toString(),
+          businesslist:
+            this.upName == "新增" ? this.selectedList : this.selectedLister,
+          businessbindedlist: this.delList,
+        });
+        if (result.success) {
+          this.dialogAddShow = false;
+          this.empty();
+          // this.circuitBreakAddForm = {};
+          this.pageInit();
+          this.$message.success(result.message);
         } else {
           this.$message.error(result.message);
         }
@@ -377,6 +600,35 @@ export default {
 ::v-deep .el-button--primary {
   border-color: #6f80bc;
 }
+::v-deep .table {
+  .el-table__header {
+    th {
+      background-color: #5c6789;
+      color: #fff;
+      border-right: none;
+      &:first-child {
+        border-radius: 8px 0 0 0;
+      }
+      &:last-child {
+        display: none;
+      }
+      &:nth-last-child(2) {
+        border-radius: 0 8px 0 0;
+      }
+    }
+  }
+}
+.routing-protocol {
+  display: flex;
+  justify-content: space-between;
+  padding-bottom: 24px;
+  ::v-deep .el-input__inner {
+    border-left: none !important;
+    border-radius: 0 !important;
+    padding: 0;
+    font-size: 16px;
+  }
+}
 .gateway-circuit-break-content {
   margin-top: 32px;
   height: calc(100vh - 224px);

+ 10 - 13
src/views/gateway/components/NormalCard/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div :class="['normal-card', { disabled: !flag }]">
     <div class="card-head">
-      <div class="card-title">{{ title }}</div>
+      <div :title="title" class="card-title">{{ title }}</div>
       <div class="cap cap-edit" @click="editClickHandler"></div>
       <div class="card-close">
         <i class="icon el-icon-close" @click="closeClickHandler" />
@@ -10,14 +10,6 @@
     <div class="card-content">
       <slot />
     </div>
-    <div class="card-switch">
-      <p :class="flag ? 'start_up' : 'close'">{{ flag ? "开启" : "关闭" }}</p>
-      <el-switch
-        :value="flag"
-        active-color="#6F81BC"
-        @change="switchChangeHandler"
-      />
-    </div>
   </div>
 </template>
 
@@ -27,7 +19,7 @@ export default {
   props: {
     title: {
       type: String,
-      default: "名称",
+      default: "",
     },
     description: {
       type: String,
@@ -43,14 +35,15 @@ export default {
     },
   },
   methods: {
-    switchChangeHandler(val) {
+    switchChangeHandler (val) {
+      console.log(val)
       this.$emit("update:flag", val);
       this.$emit("update", val);
     },
-    closeClickHandler() {
+    closeClickHandler () {
       this.$emit("close-click");
     },
-    editClickHandler() {
+    editClickHandler () {
       this.$emit("editdate");
     },
   },
@@ -116,6 +109,10 @@ export default {
       font-family: Microsoft YaHei;
       font-weight: bold;
       color: #303133;
+      max-width: 50%;
+      white-space: nowrap;
+      overflow: hidden;
+      text-overflow: ellipsis;
     }
 
     .card-close {

+ 143 - 102
src/views/gateway/document/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="gateway-document">
     <div class="gateway-document-head">
-      <Search placeholder="请输入您要搜索的内容" />
+      <Search placeholder="请输入您要搜索的内容"  @getSearchData = "getSearchData" @clearSearchData="clearSearchData"/>
     </div>
     <div class="gateway-document-content">
       <el-collapse
@@ -10,9 +10,9 @@
         @change="showParams = '入参'"
       >
         <el-collapse-item
-          v-for="{id, name, protocol, type, time, method, description, params } in documentList"
-          :key="id"
-          :name="name"
+          v-for="item in documentList"
+          :key="item.busiid"
+          :name="item.businame"
         >
           <template #title>
             <el-row
@@ -21,16 +21,20 @@
             >
               <el-col
                 :span="1"
-                :class="['icon', activeName === name ? 'el-icon-arrow-up' : 'el-icon-arrow-down']"
+                :class="['icon', activeName === item.businame ? 'el-icon-arrow-up' : 'el-icon-arrow-down']"
               />
-              <el-col :span="4">{{ id }}</el-col>
+              <el-col :span="4">{{ item.busiid }}</el-col>
               <el-col
                 :span="1"
-                class="icon el-icon-copy-document"
-              />
-              <el-col :span="6">{{ name }}</el-col>
-              <el-col :span="4">{{ protocol }}</el-col>
-              <el-col :span="8">{{ type }}</el-col>
+              >
+                <i
+                  class="icon el-icon-copy-document"
+                  @click="copyBtn(item.busiid)"
+                ></i>
+              </el-col>
+              <el-col :span="11">{{ item.businame }}</el-col>
+              <el-col :span="4">{{ item.protocol }}</el-col>
+              <el-col :span="3">{{ item.requesttype }}</el-col>
             </el-row>
           </template>
           <div class="item-title">基本信息</div>
@@ -40,31 +44,31 @@
           >
             <el-col :span="8">
               <span class="item-content-left">名称:</span>
-              <span class="item-content-right">{{ name }}</span>
+              <span class="item-content-right">{{ item.businame }}</span>
             </el-col>
             <el-col :span="8">
-              <span class="item-content-left">ID:</span>
-              <span class="item-content-right">{{ id }}</span>
+              <span class="item-content-left">服务ID:</span>
+              <span class="item-content-right">{{ item.busiid }}</span>
             </el-col>
             <el-col :span="8">
-              <span class="item-content-left">时间:</span>
-              <span class="item-content-right">{{ time }}</span>
+              <span class="item-content-left">添加时间:</span>
+              <span class="item-content-right">{{ item.addtime }}</span>
             </el-col>
             <el-col :span="8">
               <span class="item-content-left">协议:</span>
-              <span class="item-content-right">{{ protocol }}</span>
+              <span class="item-content-right">{{ item.protocol }}</span>
             </el-col>
             <el-col :span="8">
               <span class="item-content-left">请求方式:</span>
-              <span class="item-content-right">{{ type }}</span>
+              <span class="item-content-right">{{ item.requesttype }}</span>
             </el-col>
             <el-col :span="8">
               <span class="item-content-left">方法:</span>
-              <span class="item-content-right">{{ method }}</span>
+              <span class="item-content-right">{{ item.method }}</span>
             </el-col>
             <el-col :span="8">
               <span class="item-content-left">描述:</span>
-              <span class="item-content-right">{{ description }}</span>
+              <span class="item-content-right">{{ item.busidesc }}</span>
             </el-col>
           </el-row>
           <div class="item-content-params-tabs">
@@ -80,7 +84,7 @@
           </div>
           <el-table
             v-show="showParams === '入参'"
-            :data="params.input"
+            :data="item.inparams"
             height="253"
           >
             <template #empty>
@@ -91,45 +95,47 @@
               <p>暂无数据</p>
             </template>
             <el-table-column
-              prop="name"
-              label="名称"
+              prop="paramname"
+              label="参数名称"
             />
             <el-table-column
-              prop="type"
-              label="类型"
+              prop="paramtype"
+              label="参数类型"
             />
             <el-table-column
-              prop="length"
-              label="长度"
+              prop="paramlength"
+              label="参数长度"
             />
             <el-table-column
-              prop="default"
+              prop="paramdefault"
               label="默认值"
             />
             <el-table-column
-              prop="reference"
+              prop="paramrefer"
               label="参考值"
             />
             <el-table-column
-              prop="required"
+              prop="paramifcannull"
               label="是否必填"
             >
-              <template slot-scope="scope">{{ scope.row.required ? '是' : '否' }}</template>
+              <template slot-scope="scope">{{ scope.row.paramifcannull ? '是' : '否' }}</template>
             </el-table-column>
             <el-table-column
-              prop="superior"
-              label="上级参数"
+              prop="paramifheader"
+              label="是否头部信息"
             >
-              <template slot-scope="scope">{{ scope.row.superior ? scope.row.superior : '无' }}</template>
+              <template slot-scope="scope">{{ scope.row.paramifheader ? '是' : '否' }}</template>
             </el-table-column>
             <el-table-column
-              prop="description"
-              label="描述"
-            />
+              prop="paramupname"
+              label="上级参数"
+            >
+              <template slot-scope="scope">{{ scope.row.paramupname ? scope.row.paramupname : '无' }}</template>
+            </el-table-column>
           </el-table>
           <el-table
             v-show="showParams === '出参'"
-            :data="params.output"
+            :data="item.outparams"
             height="253"
           >
             <template #empty>
@@ -140,38 +146,73 @@
               <p>暂无数据</p>
             </template>
             <el-table-column
-              prop="name"
-              label="名称"
+              prop="paramname"
+              label="参数名称"
             />
             <el-table-column
-              prop="type"
-              label="类型"
+              prop="paramtype"
+              label="参数类型"
             />
             <el-table-column
-              prop="length"
-              label="长度"
+              prop="paramlength"
+              label="参数长度"
             />
             <el-table-column
-              prop="default"
+              prop="paramdefault"
               label="默认值"
             />
             <el-table-column
-              prop="reference"
+              prop="paramrefer"
               label="参考值"
             />
-            <!-- <el-table-column
-              prop="required"
+            <el-table-column
+              prop="paramifcannull"
               label="是否必填"
-            /> -->
+            >
+              <template slot-scope="scope">{{ scope.row.paramifcannull ? '是' : '否' }}</template>
+            </el-table-column>
+            <el-table-column
+              prop="paramifheader"
+              label="是否头部信息"
+            >
+            <template slot-scope="scope">{{ scope.row.paramifheader ? '是' : '否' }}</template>
+            </el-table-column>
             <el-table-column
-              prop="superior"
+              prop="paramupname"
               label="上级参数"
             >
-              <template slot-scope="scope">{{ scope.row.superior ? scope.row.superior : '无' }}</template>
+              <template slot-scope="scope">{{ scope.row.paramupname ? scope.row.paramupname : '无' }}</template>
             </el-table-column>
+          </el-table>
+          <div class="item-content-params-tabs">
+            <div class="item-title">服务器列表</div>
+          </div>
+          <el-table
+            :data="item.bservers"
+            height="253"
+          >
+            <template #empty>
+              <img
+                src="@/assets/gateway/pic_empty.png"
+                alt="暂无数据"
+              >
+              <p>暂无数据</p>
+            </template>
+            <el-table-column
+              prop="bservername"
+              label="服务器名称"
+            />
             <el-table-column
-              prop="description"
-              label="描述"
+              prop="bserverurl"
+              label="服务器地址"
+            />
+            <el-table-column
+              prop="bserverport"
+              label="服务器端口"
+            />
+            <el-table-column
+              prop="bserverdescribe"
+              label="服务器描述"
             />
           </el-table>
         </el-collapse-item>
@@ -182,7 +223,7 @@
 
 <script>
 import Search from '@/layout/components/Search'
-import { getGatewayDocumentList } from '@/api/gateway'
+import { gateWayApiDocumentList } from '@/api/gat-interface'
 
 export default {
   components: {
@@ -190,56 +231,57 @@ export default {
   },
   data() {
     return {
-      documentList: [
-        {
-          id: 265912187337728,
-          name: '/api/msgTemplateSetting/stopstart',
-          protocol: 'http',
-          type: 'post',
-          time: '2021/10/10 12:30:30',
-          method: '/api/msgTemplateSetting/stopstart',
-          description: '/api/msgTemplateSetting/stopstart',
-          params: {
-            input: [
-              // {
-              //   name: '参数1',
-              //   type: 'string',
-              //   length: 10,
-              //   default: '1234567890',
-              //   reference: '1234567890',
-              //   required: true,
-              //   superior: '',
-              //   description: '1234567890'
-              // }
-            ],
-            output: [
-              {
-                name: '参数1',
-                type: 'string',
-                length: 10,
-                default: '1234567890',
-                reference: '1234567890',
-                superior: '',
-                description: '1234567890'
-              }
-            ]
-          }
-        }
-      ],
+      documentList: [],
       activeName: '',
-      showParams: '入参'
+      showParams: '入参',
+      pageIndex: 1,
+      pageSize: 10,
+      keyword: '',
+      searchType: 1
     }
   },
   created() {
     this.fetchData()
   },
   methods: {
-    fetchData() {
-      this.listLoading = true
-      getGatewayDocumentList().then(response => {
-        this.documentList.push(...response.data.items)
+    copyBtn(data, event) {
+      //阻止冒泡
+      event || (event = window.event);
+      event.stopPropagation
+        ? event.stopPropagation()
+        : (event.cancelBubble = true);
+      this.$copyText(data).then(
+        (e) => {
+          this.$message.success("复制成功!");
+        },
+        (err) => {
+          this.$message.error("复制失败!");
+        }
+      );
+    },
+    async fetchData() {
+      try {
+        this.listLoading = true
+        const res = await gateWayApiDocumentList({
+          pageIndex: this.pageIndex,
+          pageSize: this.pageSize,
+          keyword: this.keyword,
+          searchType: this.searchType
+        })
         this.listLoading = false
-      })
+        this.documentList = JSON.parse(JSON.stringify(res.data));
+      } catch (error) {
+        this.listLoading = false
+      }
+      this.listLoading = true
+    },
+    getSearchData(data){
+      this.keyword = data.trim();
+      this.fetchData()
+    },
+    clearSearchData(){
+      this.keyword = "";
+      this.fetchData()
     }
   }
 }
@@ -254,7 +296,7 @@ export default {
 .gateway-document-content {
   margin-top: 32px;
   padding: 32px;
-  height: calc(100vh - 224px);
+  // height: calc(100vh - 250px);
   overflow: auto;
   display: flex;
   flex-wrap: wrap;
@@ -298,17 +340,18 @@ export default {
 
       .el-collapse-item__content {
         background-color: #f5f7fa;
-        padding: 48px 48px 0;
-
+        // padding: 48px 48px 0;
+        padding:38px 0 15px 0 ;
         .item-title {
           font-size: 18px;
           font-weight: bold;
           color: #303133;
+          padding:0 48px;
         }
 
         .item-content {
           margin-top: 48px;
-
+          padding:0 48px;
           .item-content-left {
             margin-right: 15px;
             font-weight: 400;
@@ -325,7 +368,6 @@ export default {
           margin-top: 48px;
           display: flex;
           justify-content: flex-start;
-
           .item-title {
             margin-right: 35px;
           }
@@ -337,7 +379,6 @@ export default {
           .el-table__header-wrapper {
             height: 48px;
             border-radius: 6px;
-
             .el-table__cell {
               color: #fff;
               background-color: #5c6789;

+ 1 - 1
src/views/gateway/index.vue

@@ -62,7 +62,7 @@ export default {
   font-size: 16px;
 
   .gateway-left {
-    padding: 32px 42px 0 0;
+    padding: 32px 42px 0 42px;
     margin-right: 20.1vw;
 
     &.without-right-nav {

+ 9 - 36
src/views/gateway/interface-add/Interfaceadd/index.vue

@@ -1,12 +1,6 @@
 <template>
   <div class="bf-Interfaceadd">
-    <el-dialog
-      title=""
-      :visible.sync="dialogVisibleadd"
-      :modal-append-to-body="false"
-      :before-close="handleClose"
-      :width="isWidth"
-    >
+    <el-dialog title="" :visible.sync="dialogVisibleadd" :modal-append-to-body="false" :before-close="handleClose" :width="isWidth">
       <div class="Interfaceadd_header">
         <div class="left">
           <p>调用规则管理</p>
@@ -14,46 +8,25 @@
       </div>
       <div class="planbute">
         <p>参数名</p>
-        <el-input
-          v-model="input"
-          placeholder="请输入内容"
-        />
+        <el-input v-model="input" placeholder="请输入内容" />
       </div>
       <div class="planbute">
         <p>默认值</p>
-        <el-input
-          v-model="input2"
-          placeholder="请输入内容"
-        />
+        <el-input v-model="input2" placeholder="请输入内容" />
       </div>
       <div class="planbute">
         <p>数据类型</p>
-        <el-input
-          v-model="input3"
-          placeholder="请输入内容"
-        />
+        <el-input v-model="input3" placeholder="请输入内容" />
       </div>
       <div class="planbutelast">
         <p>参数位置</p>
-        <el-input
-          v-model="input4"
-          placeholder="请输入内容"
-        />
+        <el-input v-model="input4" placeholder="请输入内容" />
       </div>
       <div class="isfooterup">
         <!-- <div class="but">提交</div>
                 <div class="buts" @click="handleClose">取消</div> -->
-        <Bfbutton
-          :but-name="butName"
-          class="but"
-          :type="9"
-        />
-        <Bfbutton
-          :but-name="butNames"
-          class="buts"
-          :type="8"
-          @click.native="handleClose"
-        />
+        <Bfbutton :but-name="butName" class="but" :type="9" />
+        <Bfbutton :but-name="butNames" class="buts" :type="8" @click.native="handleClose" />
       </div>
     </el-dialog>
   </div>
@@ -70,7 +43,7 @@ export default {
       type: Boolean
     }
   },
-  data() {
+  data () {
     return {
       isWidth: '25%',
       butName: '提交',
@@ -82,7 +55,7 @@ export default {
     }
   },
   methods: {
-    handleClose() {
+    handleClose () {
       this.$emit('newAdd')
     }
   }

+ 166 - 154
src/views/gateway/interface-add/Interfaceconfiguration/index.vue

@@ -3,220 +3,107 @@
     <div class="configure_header">
       <p>接口配置</p>
       <div class="right">
-        <Bfbutton
-          class="but"
-          :but-name="butCancel"
-          :type="8"
-          @click.native="$router.back()"
-        />
-        <Bfbutton
-          class="but"
-          :but-name="butReset"
-          :type="8"
-        />
-        <Bfbutton
-          class="but"
-          :but-name="butTest"
-          :type="8"
-          @click.native="tsetUp"
-        />
-        <Bfbutton
-          class="but"
-          :but-name="butPreser"
-          :type="9"
-        />
+        <el-button size="small" @click.native="$router.back()" class="btn-default">取消</el-button>
+        <el-button size="small" @click="restBut" class="btn-default">重置</el-button>
+        <el-button size="small" @click="tsetUp" class="btn-default">测试</el-button>
+        <el-button size="small" @click="testSave" type="primary">保存</el-button>
       </div>
     </div>
     <div class="Interface_drop">
       <div class="attribute">
-        <p>属性方式</p>
-        <el-input
-          v-model="input"
-          placeholder="请输入内容"
-        />
+        <p>接口名称</p>
+        <el-input v-model="input" placeholder="请输入内容" />
       </div>
       <div class="source">
-        <p>关联源数据</p>
-        <el-select
-          v-model="value"
-          placeholder="请选择"
-        >
-          <el-option
-            v-for="item in options"
-            :key="item.id"
-            :label="item.label"
-            :value="item.label"
-          />
+        <p>协议类型</p>
+        <el-select v-model="value" placeholder="请选择">
+          <el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.label" />
         </el-select>
       </div>
-      <div class="source">
-        <p>关联元数据</p>
-        <el-select
-          v-model="value"
-          placeholder="请选择"
-        >
-          <el-option
-            v-for="item in options"
-            :key="item.id"
-            :label="item.label"
-            :value="item.label"
-          />
-        </el-select>
-      </div>
-      <div class="source">
-        <p>调用规则</p>
-        <el-select
-          v-model="value"
-          placeholder="请选择"
-        >
-          <el-option
-            v-for="item in options"
-            :key="item.id"
-            :label="item.label"
-            :value="item.label"
-          />
-        </el-select>
-      </div>
-    </div>
-    <div class="agreement">
-      <p>协议类型</p>
-      <el-radio
-        v-for="(item,index) in optioner"
-        :key="index"
-        v-model="radio"
-        :label="item.id"
-        @change="onChange(index)"
-      >{{ item.label }}</el-radio>
     </div>
     <div class="boder" />
-    <div class="displaytitle">
-      <div
-        v-for="(item,index) in optioner"
-        :key="index"
-        class="displaytitle_cont"
-      >
-        <div :class="active === index ? 'upChilder' : 'upChild'">{{ item.label }}</div>
-      </div>
+    <div class="configure_header">
+      <p>协议配置</p>
     </div>
     <div class="request_path">
       <div class="attribute">
         <p>请求路径</p>
-        <el-input
-          v-model="inputpath"
-          placeholder="请输入内容"
-        />
+        <el-input v-model="inputpath" placeholder="请输入内容" />
       </div>
     </div>
     <div class="request_type">
       <p>请求类型</p>
-      <el-radio
-        v-for="(item,index) in optiontype"
-        :key="index"
-        v-model="radios"
-        :label="item.id"
-      >{{ item.label }}</el-radio>
+      <el-radio v-for="(item,index) in optiontype" :key="index" v-model="radios" :label="item.label">{{ item.label }}</el-radio>
     </div>
     <div class="data_type">
       <p>请求数据类型</p>
-      <el-radio
-        v-for="(item,index) in optionDateType"
-        :key="index"
-        v-model="radiotype"
-        :label="item.id"
-      >{{ item.label }}</el-radio>
+      <el-radio v-for="(item,index) in optionDateType" :key="index" v-model="radiotype" :label="item.label">{{ item.label }}</el-radio>
     </div>
-    <Testpop
-      :dialog-visibletest="dialogVisibletest"
-      @testClose="testClose"
-    />
+    <Testpop :dialogVisibletest="dialogVisibletest" @handleMdClose="handleMdClose" @testClose="testClose" />
   </div>
 </template>
 <script>
 import './Interfaceconfiguration.scss'
 import Bfbutton from '@/components/bfbutton/index.vue'
 import Testpop from '../testpop/index.vue'
+import axios from 'axios'
+import { gateWayBusinessAllEdit, gateWayBusinessGetById } from '@/api/gat-interface'
 export default {
   components: {
     Bfbutton,
     Testpop
   },
-  data() {
+  data () {
     return {
       input: '',
       inputpath: '',
       value: '',
       radio: 1,
-      radios: 1,
-      radiotype: 1,
+      radios: '',
+      radiotype: '',
       active: 0,
       dialogVisibletest: false,
       options: [
         {
-          label: '选项一',
-          id: 1
-        },
-        {
-          label: '选项二',
-          id: 2
-        },
-        {
-          label: '选项三',
-          id: 3
-        }
-      ],
-      optioner: [
-        {
-          label: 'http/https',
+          label: 'http',
           id: 1
         },
         {
-          label: 'MQ',
+          label: 'https',
           id: 2
         },
-        {
-          label: 'FTP',
-          id: 3
-        },
-        {
-          label: '脚本',
-          id: 4
-        },
-        {
-          label: '自定义',
-          id: 5
-        }
       ],
       optiontype: [
         {
-          label: 'POST',
+          label: 'post',
           id: 1
         },
         {
-          label: 'GET',
+          label: 'get',
           id: 2
         },
         {
-          label: 'HEAD',
+          label: 'head',
           id: 3
         },
         {
-          label: 'PUT',
+          label: 'put',
           id: 4
         },
         {
-          label: 'DELETE',
+          label: 'delete',
           id: 5
         },
         {
-          label: 'OPTIONS',
+          label: 'options',
           id: 6
         },
         {
-          label: 'TRACE',
+          label: 'trace',
           id: 7
         },
         {
-          label: 'CONNECT',
+          label: 'connect',
           id: 8
         }
       ],
@@ -238,24 +125,149 @@ export default {
           id: 4
         }
       ],
-      butCancel: '取消',
-      butReset: '重置',
-      butTest: '测试',
-      butPreser: '保存'
+      businessid: ''
+    }
+  },
+  created () {
+    const { id } = this.$route.query
+    if (id) {
+      this.businessid = id
+      this.getInfo(id)
     }
+    this.$store.state.user.interfaceDatas = []
   },
   methods: {
-    onChange(index) {
-      // console.log(item)
-      this.active = index
+    //获取编辑信息
+    async getInfo (id) {
+      const { success, message, data } = await gateWayBusinessGetById({
+        searchId: id
+      })
+      if (success && data) {
+        const { businessmethod, businessname, businessprotocol, businessrequesttype, businesscontenttype } = data
+        this.input = businessname
+        this.value = businessprotocol
+        this.inputpath = businessmethod
+        this.radios = businessrequesttype
+        this.radiotype = businesscontenttype
+      } else {
+        this.$message.error(message)
+      }
     },
     // 打开弹窗
-    tsetUp() {
-      this.dialogVisibletest = !this.dialogVisibletest
+    tsetUp () {
+      const apiType = this.value
+      const apiPath = this.inputpath
+      const mthType = this.radios
+      const mthApp = this.radiotype
+      if (!apiType) {
+        this.$message.error('请选择协议类型')
+        return false
+      } else if (!apiPath) {
+        this.$message.error('请输入请求路径')
+        return false
+      } else if (!mthType) {
+        this.$message.error('请选择请求类型')
+        return false
+      } else if (!mthApp) {
+        this.$message.error('请选择请求数据类型')
+        return false
+      }
+      this.dialogVisibletest = true
     },
-    // 弹窗取消
-    testClose() {
+    //弹框关闭
+    handleMdClose (val) {
+      this.dialogVisibletest = val
+    },
+    // 弹窗确定
+    testClose (val) {
+      const apiUrl = PLATFROM_CONFIG.gatewayApiUrl
+      const apiName = this.input
+      const apiType = this.value
+      const apiPath = this.inputpath
+      const mthType = this.radios
+      const mthApp = this.radiotype
+      const axiosSercive = axios.create({
+        baseURL: apiType + '://' + apiUrl,
+        timeout: 30000,
+        headers: { 'Content-Type': mthApp },
+      })
+      const reqObj = {
+        method: mthType,
+        url: apiPath
+      }
+      if (val) {
+        if (mthType == 'POST' || mthType == 'PUT' || mthType == 'PATCH') {
+          reqObj.data = JSON.parse(JSON.stringify(val))
+        } else {
+          reqObj.params = JSON.parse(JSON.stringify(val))
+        }
+      }
+      axiosSercive(reqObj).then(res => {
+        const { message, success } = res
+        if (success) {
+          this.$message.success(message)
+        } else {
+          this.$message.error(message)
+        }
+      }).catch(err => {
+        this.$message.error(err)
+      })
       this.dialogVisibletest = false
+    },
+    //重置
+    restBut () {
+      this.input = ''
+      this.value = ''
+      this.inputpath = ''
+      this.radios = ''
+      this.radiotype = ''
+    },
+    //保存
+    async testSave () {
+      const apiType = this.value
+      const apiPath = this.inputpath
+      const mthType = this.radios
+      const mthApp = this.radiotype
+      const apiName = this.input
+      if (!apiName) {
+        this.$message.error('请输入接口名称')
+        return false
+      }
+      else if (!apiType) {
+        this.$message.error('请选择协议类型')
+        return false
+      } else if (!apiPath) {
+        this.$message.error('请输入请求路径')
+        return false
+      } else if (!mthType) {
+        this.$message.error('请选择请求类型')
+        return false
+      } else if (!mthApp) {
+        this.$message.error('请选择请求数据类型')
+        return false
+      }
+      const { success, message } = await gateWayBusinessAllEdit({
+        businesstype: this.value,
+        businessinfo: {
+          businessid: this.businessid ?? '',
+          devid: '',
+          businessname: this.input,
+          businessdescribe: '',
+          businesstag: '',
+          businessmethod: this.inputpath,
+          businessrequesttype: this.radios,
+          businesscontenttype: this.radiotype
+        },
+        paramtersin: [],
+        paramtersout: [],
+        bservers: this.$store.state.user.interfaceDatas
+      })
+      if (success) {
+        this.$message.success(message)
+        this.$router.back()
+      } else {
+        this.$message.error(message)
+      }
     }
   }
 }

+ 30 - 45
src/views/gateway/interface-add/Interfaceparameter/index.vue

@@ -4,82 +4,51 @@
       <div class="left">
         <p>接口参数配置</p>
         <div class="parameter">
-          <div
-            v-for="(item,index) in option"
-            :key="index"
-            :class="active === index ? 'childer' : 'child'"
-            @click="upClick(index)"
-          >{{ item.name }}</div>
+          <div v-for="(item,index) in option" :key="index" :class="active === index ? 'childer' : 'child'" @click="upClick(index)">{{ item.name }}</div>
         </div>
       </div>
       <div class="right">
-        <Bfbutton
-          :but-name="butName"
-          class="imports"
-          :type="4"
-        />
+        <Bfbutton :but-name="butName" class="imports" :type="4" />
         <!-- <div class="imports">导入</div> -->
-        <Bfbutton
-          :but-name="butNames"
-          :type="10"
-          class="newadd"
-          @click.native="newAdd"
-        />
+        <Bfbutton :but-name="butNames" :type="10" class="newadd" @click.native="newAdd" />
         <!-- <div class="newadd" @click="newAdd">新增</div> -->
       </div>
     </div>
     <div class="listheader">
       <ul>
-        <li
-          v-for="(item,index) in listHeader"
-          :key="index"
-        >{{ item.name }}</li>
+        <li v-for="(item,index) in listHeader" :key="index">{{ item.name }}</li>
       </ul>
     </div>
     <div class="content">
       <el-scrollbar style="height:100%">
-        <ul
-          v-for="(item,index) in list"
-          :key="index"
-        >
+        <ul v-for="(item,index) in list" :key="index">
           <li>{{ item.name }}</li>
           <li>{{ item.value1 }}</li>
           <li>{{ item.value2 }}</li>
           <li>{{ item.value3 }}</li>
           <li>
             <!-- <div class="edit">编辑</div> -->
-            <Bfbutton
-              class="edit"
-              :but-name="butNameer"
-              :type="5"
-            />
-            <Bfbutton
-              :but-name="butNameers"
-              :type="6"
-              class="deleter"
-              @click.native="eledele"
-            />
+            <Bfbutton class="edit" :but-name="butNameer" :type="5" />
+            <Bfbutton :but-name="butNameers" :type="6" class="deleter" @click.native="eledele" />
             <!-- <div class="deleter" @click="eledele">删除</div> -->
           </li>
         </ul>
       </el-scrollbar>
     </div>
-    <Deletepopup
-      :dialog-visibledele="dialogVisibledele"
-      @delepop="delepop"
-    />
+    <Deletepopup :dialog-visibledele="dialogVisibledele" @delepop="delepop" />
   </div>
 </template>
 <script>
 import './Interfaceparameter.scss'
 import Deletepopup from '@/components/deletepopup/index.vue'
 import Bfbutton from '@/components/bfbutton/index.vue'
+import { parameterGetListAll } from '@/api/gat-interface'
 export default {
   components: {
     Deletepopup,
     Bfbutton
   },
-  data() {
+  data () {
     return {
       active: 0,
       butName: '导入',
@@ -153,16 +122,32 @@ export default {
     }
   },
   methods: {
-    upClick(index) {
+    async fetchData (id, inout) {
+      try {
+        const { success, data } = await parameterGetListAll({
+          id,
+          inout
+        })
+        console.log(data)
+        if (success) {
+          this.list = data
+        } else {
+          this.interfaceList = []
+        }
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    upClick (index) {
       this.active = index
     },
-    newAdd() {
+    newAdd () {
       this.$emit('newAdd')
     },
-    eledele() {
+    eledele () {
       this.dialogVisibledele = !this.dialogVisibledele
     },
-    delepop() {
+    delepop () {
       this.dialogVisibledele = !this.dialogVisibledele
     }
   }

+ 82 - 120
src/views/gateway/interface-add/associatedserver/index.vue

@@ -1,12 +1,6 @@
 <template>
   <div class="bf-associatedserver">
-    <el-dialog
-      title=""
-      :visible.sync="dialogVisibleass"
-      :modal-append-to-body="false"
-      :before-close="handleClose"
-      :width="isWidth"
-    >
+    <el-dialog title="" :visible.sync="dialogVisibleass" :modal-append-to-body="false" :before-close="handleClose" :width="isWidth">
       <div class="associatedserver_header">
         <div class="left">
           <p>关联服务器</p>
@@ -14,146 +8,114 @@
       </div>
       <div class="associatedserver_content">
         <el-scrollbar style="height:100%">
-          <div
-            v-for="(item,index) in optioner"
-            :key="index"
-            class="Server_card"
-          >
-            <div class="Server_header">
-              <p>{{ item.label }}</p>
-              <el-radio
-                v-model="radio"
-                :label="item.id"
-              />
+          <el-checkbox-group v-model="checkList">
+            <div v-for="(item,index) in optioner" :key="index" class="Server_card">
+              <div class="Server_header">
+                <p>{{ item.bservername }}</p>
+                <el-checkbox :label="item.bserverid"></el-checkbox>
+              </div>
+              <div class="Server_content">
+                <p>地址</p>
+                <span>{{ item.bserverurl }}</span>
+              </div>
+              <div class="Server_content">
+                <p>端口号</p>
+                <span>{{ item.bserverport }}</span>
+              </div>
             </div>
-            <div class="Server_content">
-              <p>地址</p>
-              <span>{{ item.address }}</span>
-            </div>
-            <div class="Server_content">
-              <p>端口号</p>
-              <span>{{ item.port }}</span>
-            </div>
-          </div>
+          </el-checkbox-group>
         </el-scrollbar>
         <!-- <el-radio v-model="radio" :label="item.id" v-for="(item,index) in optioner" :key="index">{{item.label}}</el-radio> -->
       </div>
       <div class="isfooterup">
-        <Bfbutton
-          :but-name="butName"
-          class="but"
-          :type="9"
-        />
-        <Bfbutton
-          :but-name="butNames"
-          :type="8"
-          class="buts"
-          @click.native="handleClose"
-        />
+        <el-button size="small" @click="handleClick" type="primary">确定</el-button>
+        <el-button size="small" @click.native="handleClose">取消</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 <script>
 import './associatedserver.scss'
-import Bfbutton from '@/components/bfbutton/index.vue'
+import { gateWayBServerGetList, gateWayBusinessBServerRelationByBusiness } from '@/api/gat-interface'
 export default {
-  components: {
-    Bfbutton
-  },
+  name: 'associatedserver',
   props: {
     dialogVisibleass: {
       type: Boolean
+    },
+  },
+  watch: {
+    dialogVisibleass: {
+      handler (val) {
+        if (val) {
+          this.checkList = []
+          this.fetchData()
+        }
+      },
+      deep: true
     }
   },
-  data() {
+  data () {
     return {
       isWidth: '54.5%',
       butName: '提交',
       butNames: '取消',
       radio: 1,
-      optioner: [
-        {
-          label: '服务器名称',
-          id: 1,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 2,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 3,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 4,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 5,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 6,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 7,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 8,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 9,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 10,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 11,
-          address: '192.168.192.192',
-          port: '8080'
-        },
-        {
-          label: '服务器名称',
-          id: 12,
-          address: '192.168.192.192',
-          port: '8080'
-        }
-      ]
+      pageIndex: 1,
+      pageSize: 10000000,
+      keyword: '',
+      searchType: 1,
+      optioner: [],
+      checkList: [],
+      datas: []
     }
   },
   methods: {
-    handleClose() {
-      this.$emit('assAdd')
+    //列表
+    async fetchData () {
+      try {
+        const { success, data } = await gateWayBServerGetList({
+          pageIndex: this.pageIndex,
+          pageSize: this.pageSize,
+          keyword: this.keyword
+        })
+        if (success) {
+          this.optioner = data
+        } else {
+          this.optioner = []
+        }
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    //关联
+    relationData () {
+      this.optioner.forEach(item => {
+        this.checkList.forEach(p => {
+          if (p == item.bserverid) {
+            this.datas.push(item)
+          }
+        })
+      })
+    },
+    handleClose () {
+      this.$emit('assAdd', false)
+    },
+    handleClick () {
+      this.relationData()
+      this.handleClose()
+      setTimeout(() => {
+        this.$emit('getData', this.datas)
+      }, 100);
     }
   }
 }
 </script>
-<style lang="scss">
+
+<style lang="scss" scoped>
+.bf-associatedserver {
+  ::v-deep .el-checkbox__label {
+    display: none;
+  }
+}
 </style>

+ 7 - 27
src/views/gateway/interface-add/index.vue

@@ -3,27 +3,11 @@
     <!-- 接口配置 -->
     <Interfaceconfiguration />
     <!-- 接口参数配置 -->
-    <Interfaceparameter @new-add="newAdd" />
+    <!-- <Interfaceparameter @new-add="newAdd" /> -->
     <!-- 服务器配置 -->
-    <Serverconfiguration
-      @serve-add="serveAdd"
-      @ass-add="assAdd"
-    />
+    <Serverconfiguration @serve-add="serveAdd" @ass-add="assAdd" />
     <!-- 接口参数新增弹窗 -->
-    <Interfaceadd
-      :dialog-visibleadd="dialogVisibleadd"
-      @new-add="newAdd"
-    />
-    <!-- 服务器新增 -->
-    <Theserverpop
-      :dialog-visibleserve="dialogVisibleserve"
-      @serve-add="serveAdd"
-    />
-    <!-- 关联服务器 -->
-    <Associatedserver
-      :dialog-visibleass="dialogVisibleass"
-      @ass-add="assAdd"
-    />
+    <!-- <Interfaceadd :dialog-visibleadd="dialogVisibleadd" @new-add="newAdd" /> -->
   </div>
 </template>
 <script>
@@ -31,18 +15,14 @@ import Interfaceconfiguration from './Interfaceconfiguration/index.vue'
 import Interfaceparameter from './Interfaceparameter/index.vue'
 import Serverconfiguration from './serverconfiguration/index.vue'
 import Interfaceadd from './Interfaceadd/index.vue'
-import Theserverpop from './theserverpop/index.vue'
-import Associatedserver from './associatedserver/index.vue'
 export default {
   components: {
     Interfaceconfiguration,
     Interfaceparameter,
     Serverconfiguration,
     Interfaceadd,
-    Theserverpop,
-    Associatedserver
   },
-  data() {
+  data () {
     return {
       dialogVisibleadd: false,
       dialogVisibleserve: false,
@@ -50,13 +30,13 @@ export default {
     }
   },
   methods: {
-    newAdd() {
+    newAdd () {
       this.dialogVisibleadd = !this.dialogVisibleadd
     },
-    serveAdd() {
+    serveAdd () {
       this.dialogVisibleserve = !this.dialogVisibleserve
     },
-    assAdd() {
+    assAdd () {
       this.dialogVisibleass = !this.dialogVisibleass
     }
   }

+ 195 - 113
src/views/gateway/interface-add/serverconfiguration/index.vue

@@ -5,152 +5,234 @@
         <p>服务器配置</p>
       </div>
       <div class="right">
-        <!-- <div class="relation_server" @click="newAss">关联服务器</div>
-                <div class="add_server" @click="newServe">新增服务器</div> -->
-        <Bfbutton
-          :but-name="butName"
-          :type="4"
-          class="relation_server"
-          @click.native="newAss"
-        />
-        <Bfbutton
-          :but-name="butNames"
-          :type="10"
-          class="add_server"
-          @click.native="newServe"
-        />
+        <el-button size="small" class="btn-default" @click="newAss"
+          >关联服务器</el-button
+        >
+        <el-button size="small" @click="newServe" type="primary"
+          >新增服务器</el-button
+        >
       </div>
     </div>
-    <div class="listheader">
-      <ul>
-        <li
-          v-for="(item,index) in listHeader"
-          :key="index"
-        >{{ item.name }}</li>
-      </ul>
+    <div class="serverconfiguration_table">
+      <el-table
+        class="table"
+        :data="interfaceDatas"
+        height="400px"
+        stripe
+        style="width: 100%"
+      >
+        <el-table-column prop="bservername" label="服务器名称">
+        </el-table-column>
+        <el-table-column prop="bserverurl" label="地址"> </el-table-column>
+        <el-table-column prop="bserverport" label="端口号"> </el-table-column>
+        <el-table-column prop="bserverdescribe" label="描述"> </el-table-column>
+        <el-table-column label="操作">
+          <template slot-scope="scope">
+            <el-button
+              size="small"
+              @click="handleEdit(scope.row)"
+              type="primary"
+              >编辑</el-button
+            >
+            <el-button
+              size="small"
+              @click="handleRemove(scope.row)"
+              type="danger"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
     </div>
-    <div class="content">
-      <el-scrollbar style="height:100%">
-        <ul
-          v-for="(item,index) in list"
-          :key="index"
-        >
-          <li>{{ item.name }}</li>
-          <li>{{ item.value1 }}</li>
-          <li>{{ item.value2 }}</li>
-          <li>{{ item.value3 }}</li>
-          <li>
-            <!-- <div class="edit">编辑</div>
-                        <div class="deleter"  @click="eledele">删除</div> -->
-            <Bfbutton
-              class="edit"
-              :but-name="butNameer"
-              :type="5"
-            />
-            <Bfbutton
-              class="deleter"
-              :but-name="butNameers"
-              :type="6"
-              @click.native="eledele"
-            />
-          </li>
-        </ul>
-      </el-scrollbar>
-    </div>
-    <Deletepopup
-      :dialog-visibledele="dialogVisibledele"
-      @delepop="delepop"
+    <!-- 服务器新增 -->
+    <Theserverpop
+      :dialog-visibleserve="dialogVisibleserve"
+      :title="fmTilte"
+      :form="fmObj"
+      @serveData="serveData"
+      @serveAdd="serveAdd"
+    />
+    <!-- 关联服务器 -->
+    <Associatedserver
+      :dialog-visibleass="dialogVisibleass"
+      @getData="getData"
+      @assAdd="assAdd"
     />
+    <!-- 删除服务器 -->
+    <Dialog :flag="flag">
+      <div class="airportInfoDialog">
+        <div class="title">删除服务器</div>
+        <div class="content">是否确认删除{{ rmObj.bservername }}?</div>
+        <div class="foot right t30">
+          <el-button size="medium" class="r24" @click="remove" type="danger"
+            >删除</el-button
+          >
+          <el-button size="medium" @click="flag = false">取消</el-button>
+        </div>
+      </div>
+    </Dialog>
   </div>
 </template>
 <script>
-import './serverconfiguration.scss'
-import Deletepopup from '@/components/deletepopup/index.vue'
-import Bfbutton from '@/components/bfbutton/index.vue'
+import "./serverconfiguration.scss";
+import { mapGetters } from "vuex";
+import Dialog from "@/layout/components/Dialog";
+import Bfbutton from "@/components/bfbutton/index.vue";
+import Theserverpop from "../theserverpop/index.vue";
+import Associatedserver from "../associatedserver/index.vue";
+import {
+  gateWayRelationBServerGetByBusiness,
+  gateWayBServerDeleteById,
+} from "@/api/gat-interface";
 export default {
+  name: "serverconfiguration",
   components: {
-    Deletepopup,
-    Bfbutton
+    Dialog,
+    Bfbutton,
+    Theserverpop,
+    Associatedserver,
   },
   data() {
     return {
-      butName: '关联服务器',
-      butNames: '新增服务器',
-      butNameer: '编辑',
-      butNameers: '删除',
+      butName: "关联服务器",
+      butNames: "新增服务器",
+      butNameer: "编辑",
+      butNameers: "删除",
       listHeader: [
         {
-          name: '服务器名称'
-        },
-        {
-          name: '地址'
-        },
-        {
-          name: '端口号'
+          name: "服务器名称",
         },
         {
-          name: '描述'
+          name: "地址",
         },
         {
-          name: '操作'
-        }
-      ],
-      list: [
-        {
-          name: '192.168.0.0.1',
-          value1: '8080',
-          value2: 'XXX服务器',
-          value3: 'XXX服务器用于XX服务部署'
+          name: "端口号",
         },
         {
-          name: '192.168.0.0.1',
-          value1: '8080',
-          value2: 'XXX服务器',
-          value3: 'XXX服务器用于XX服务部署'
+          name: "描述",
         },
         {
-          name: '192.168.0.0.1',
-          value1: '8080',
-          value2: 'XXX服务器',
-          value3: 'XXX服务器用于XX服务部署'
+          name: "操作",
         },
-        {
-          name: '192.168.0.0.1',
-          value1: '8080',
-          value2: 'XXX服务器',
-          value3: 'XXX服务器用于XX服务部署'
-        },
-        {
-          name: '192.168.0.0.1',
-          value1: '8080',
-          value2: 'XXX服务器',
-          value3: 'XXX服务器用于XX服务部署'
-        },
-        {
-          name: '192.168.0.0.1',
-          value1: '8080',
-          value2: 'XXX服务器',
-          value3: 'XXX服务器用于XX服务部署'
-        }
       ],
-      dialogVisibledele: false
+      tableData: [],
+      dialogVisibledele: false,
+      dialogVisibleserve: false,
+      dialogVisibleass: false,
+      pageIndex: 1,
+      pageSize: 10,
+      keyword: "",
+      searchType: 1,
+      fmObj: {},
+      fmTilte: "服务器新增",
+      flag: false,
+      rmObj: {},
+      pageIndex: 1,
+      pageSize: 10,
+      keyword: "",
+    };
+  },
+  created() {
+    const { id } = this.$route.query;
+    if (id) {
+      this.$store.state.user.interfaceDatas = [];
+      this.fetchData(id);
     }
   },
+  computed: {
+    ...mapGetters(["interfaceDatas"]),
+  },
   methods: {
+    async fetchData(id) {
+      try {
+        const { success, data } = await gateWayRelationBServerGetByBusiness({
+          searchId: id,
+          pageIndex: this.pageIndex,
+          pageSize: this.pageSize,
+          keyword: this.keyword,
+        });
+        if (success && data) {
+          this.tableData = data;
+          this.$store.dispatch("user/setFaceDatas", this.tableData);
+        } else {
+          this.tableData = [];
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    getData(arrs) {
+      this.tableData = arrs;
+      this.tableData = _.uniqBy(this.tableData, "bserverid");
+      this.$store.dispatch("user/setFaceDatas", this.tableData);
+    },
     newServe() {
-      this.$emit('serveAdd')
+      this.dialogVisibleserve = true;
+      this.fmTilte = "服务器新增";
+      this.fmObj = {};
     },
     newAss() {
-      this.$emit('assAdd')
+      this.dialogVisibleass = true;
+    },
+    serveAdd(val) {
+      this.dialogVisibleserve = val;
+    },
+    assAdd(val) {
+      this.dialogVisibleass = val;
+    },
+    handleEdit(row) {
+      this.dialogVisibleserve = true;
+      this.fmTilte = "服务器编辑";
+      this.fmObj = _.cloneDeep(row);
     },
-    eledele() {
-      this.dialogVisibledele = !this.dialogVisibledele
+    handleRemove(row) {
+      this.flag = true;
+      this.rmObj = row;
     },
-    delepop() {
-      this.dialogVisibledele = !this.dialogVisibledele
+    serveData(obj) {
+      this.tableData.push(obj);
+      this.tableData = _.uniqBy(this.tableData, "bserverid");
+      this.$store.dispatch("user/setFaceDatas", this.tableData);
+    },
+    remove() {
+      this.$store.dispatch("user/removeFaceDatas", this.rmObj);
+      // this.removeQd(this.rmObj.bserverid)
+      this.flag = false;
+    },
+    async removeQd(id) {
+      const { message, success } = await gateWayBServerDeleteById({
+        searchId: id,
+      });
+      if (success) {
+        this.fetchData();
+        this.$message.success(message);
+      } else {
+        this.$message.error(message);
+      }
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.serverconfiguration_table {
+  padding: 0 32px;
+  ::v-deep .table {
+    .el-table__header {
+      th {
+        background-color: #5c6789;
+        color: #fff;
+        border-right: none;
+        &:first-child {
+          border-radius: 8px 0 0 0;
+        }
+        &:last-child {
+          display: none;
+        }
+        &:nth-last-child(2) {
+          border-radius: 0 8px 0 0;
+        }
+      }
     }
   }
 }
-</script>
-<style lang="scss">
 </style>

+ 11 - 22
src/views/gateway/interface-add/testpop/index.vue

@@ -1,32 +1,17 @@
 <template>
   <div class="bf-testpop">
-    <el-dialog
-      title=""
-      :visible.sync="dialogVisibletest"
-      :modal-append-to-body="false"
-      :before-close="handleClose"
-      :width="isWidth"
-    >
+    <el-dialog title="" :visible.sync="dialogVisibletest" :before-close="handleClose" :width="isWidth">
       <div class="planningpop_header">
         <div class="left">
           <p>接口配置测试</p>
         </div>
       </div>
       <div class="planningpop_content">
-        <el-input
-          v-model="textarea"
-          type="textarea"
-          :rows="7"
-          placeholder="请输入内容"
-        />
+        <el-input v-model="textarea" type="textarea" :rows="7" placeholder='例如:{"id":"1"}' />
       </div>
       <div class="footer">
-        <Bfbutton
-          class="but"
-          :but-name="butCancel"
-          :type="9"
-          @click.native="handleClose"
-        />
+        <el-button size="small" @click="handleClick" type="primary">确定</el-button>
+        <el-button size="small" @click="handleClose">取消</el-button>
       </div>
     </el-dialog>
   </div>
@@ -42,7 +27,7 @@ export default {
       type: Boolean
     }
   },
-  data() {
+  data () {
     return {
       isWidth: '33%',
       textarea: '',
@@ -50,8 +35,12 @@ export default {
     }
   },
   methods: {
-    handleClose() {
-      this.$emit('testClose')
+    handleClose () {
+      this.textarea = ''
+      this.$emit('handleMdClose', false)
+    },
+    handleClick () {
+      this.$emit('testClose', this.textarea)
     }
   }
 }

+ 45 - 61
src/views/gateway/interface-add/theserverpop/index.vue

@@ -1,89 +1,73 @@
 <template>
   <div class="bf-theserverpop">
-    <el-dialog
-      title=""
-      :visible.sync="dialogVisibleserve"
-      :modal-append-to-body="false"
-      :before-close="handleClose"
-      :width="isWidth"
-    >
+    <el-dialog title="" :visible.sync="dialogVisibleserve" :modal-append-to-body="false" :before-close="handleClose" :width="isWidth">
       <div class="theserverpop_header">
         <div class="left">
-          <p>服务器新增</p>
+          <p>{{title}}</p>
         </div>
       </div>
-      <div class="planbute">
-        <p>服务器名称</p>
-        <el-input
-          v-model="input"
-          placeholder="请输入内容"
-        />
-      </div>
-      <div class="planbute">
-        <p>地址</p>
-        <el-input
-          v-model="input2"
-          placeholder="请输入内容"
-        />
-      </div>
-      <div class="planbute">
-        <p>端口号</p>
-        <el-input
-          v-model="input3"
-          placeholder="请输入内容"
-        />
-      </div>
-      <div class="planbutelast">
-        <p>描述</p>
-        <el-input
-          v-model="input4"
-          placeholder="请输入内容"
-        />
+      <div class="theserverpop_form">
+        <el-form ref="form" :model="form" label-width="100px">
+          <el-form-item label="服务器名称">
+            <el-input size="small" v-model="form.bservername"></el-input>
+          </el-form-item>
+          <el-form-item label="地址">
+            <el-input size="small" v-model="form.bserverurl"></el-input>
+          </el-form-item>
+          <el-form-item label="端口号">
+            <el-input size="small" v-model="form.bserverport"></el-input>
+          </el-form-item>
+          <el-form-item label="描述">
+            <el-input size="small" v-model="form.bserverdescribe"></el-input>
+          </el-form-item>
+        </el-form>
       </div>
       <div class="isfooterup">
-        <!-- <div class="but">提交</div>
-                <div class="buts" @click="handleClose">取消</div> -->
-        <Bfbutton
-          :but-name="butName"
-          :type="9"
-          class="but"
-        />
-        <Bfbutton
-          :but-name="butNames"
-          :type="8"
-          class="buts"
-          @click.native="handleClose"
-        />
+        <el-button size="small" @click="handleClick" type="primary">确定</el-button>
+        <el-button size="small" @click.native="handleClose">取消</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 <script>
 import './theserverpop.scss'
-import Bfbutton from '@/components/bfbutton/index.vue'
+import { gateWayBServerEdit } from '@/api/gat-interface'
 export default {
-  components: {
-    Bfbutton
-  },
   props: {
     dialogVisibleserve: {
       type: Boolean
+    },
+    form: {
+      type: Object,
+      default: () => { }
+    },
+    title: {
+      type: String,
+      default: '服务器新增'
     }
   },
-  data() {
+  data () {
     return {
       isWidth: '25%',
-      butName: '提交',
-      butNames: '取消',
-      input: '',
-      input2: '',
-      input3: '',
-      input4: ''
     }
   },
   methods: {
-    handleClose() {
-      this.$emit('serveAdd')
+    handleClose () {
+      this.$emit('serveAdd', false)
+    },
+    async handleQd () {
+      const { success, message } = await gateWayBServerEdit(this.form)
+      if (success) {
+        this.handleClose()
+        this.$store.dispatch('user/restFaceDatas', this.form)
+        // this.$emit('serveData', this.form)
+        this.$message.success(message)
+      } else {
+        this.$message.error(message)
+      }
+    },
+    handleClick () {
+      this.handleQd()
     }
   }
 }

+ 1 - 2
src/views/gateway/interface-add/theserverpop/theserverpop.scss

@@ -13,7 +13,6 @@
         padding: 0 48px 0 48px;
         >.theserverpop_header{
             width: 100%;
-            height: 120px;
             display: flex;
             >.left{
                 width: 100%;
@@ -96,10 +95,10 @@
         }
         >.isfooterup{
             width: 100%;
-            height: 128px;
             display: flex;
             align-items: center;
             justify-content: center;
+            padding-bottom: 32px;
             >.but{
                 // padding: 0 24px 0 24px;
                 height: 32px;

+ 101 - 24
src/views/gateway/interface/index.vue

@@ -1,22 +1,26 @@
 <template>
   <div class="gateway-interface">
     <div class="gateway-interface-head">
-      <Search placeholder="请输入您要搜索的内容">
+      <Search :isSlot="true" @getSearchData="getSearchData" @clearSearchData="clearSearchData" placeholder="请输入您要搜索的内容">
         <button class="btnAdd" @click="$router.push('interface-add')">新增</button>
       </Search>
     </div>
-    <div class="gateway-interface-content">
+    <div v-loading="listLoading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" class="gateway-interface-content">
       <template v-if="interfaceList.length">
-        <el-row :gutter="24">
-          <el-col v-for="({ id, name, description, protocol }, index) in interfaceList" :key="id" :xs="24" :md="12" :lg="8" :xl="6">
-            <NormalCard :title="name" :flag.sync="interfaceList[index].flag" @close-click="removeCard(index)">
+        <el-row v-infinite-scroll="load" :gutter="24">
+          <el-col v-for="(item, index) in interfaceList" :key="index" :xs="24" :md="12" :lg="8" :xl="6">
+            <NormalCard :title="item.businessname" @editdate="editCard(item)" @close-click="removeCard(item)">
               <template #default>
                 <el-row :gutter="25">
                   <el-col :span="6" class="card-content-left">描述:</el-col>
-                  <el-col :span="18" class="card-content-right">{{ description }}</el-col>
+                  <el-col :span="18" class="card-content-right">{{ item.businessmethod }}</el-col>
                   <el-col :span="6" class="card-content-left">协议:</el-col>
-                  <el-col :span="18" class="card-content-right">{{ protocol }}</el-col>
+                  <el-col :span="18" class="card-content-right">{{ item.businessrequesttype }}</el-col>
                 </el-row>
+                <div class="card-switch">
+                  <p :class="flag ? 'start_up' : 'close'">{{ item.flag ? "开启" : "关闭" }}</p>
+                  <el-switch v-model="item.flag" active-color="#6F81BC" @change="switchChangeHandler(item)" />
+                </div>
               </template>
             </NormalCard>
           </el-col>
@@ -26,46 +30,119 @@
         <el-empty description="暂无数据" />
       </template>
     </div>
+    <!--删除弹框-->
+    <Dialog :flag="flag">
+      <div class="airportInfoDialog">
+        <div class="title">删除接口配置</div>
+        <div class="content">是否确认删除{{ title }}?</div>
+        <div class="foot right t30">
+          <el-button size="medium" class="r24" @click="remove" type="danger">删除</el-button>
+          <el-button size="medium" @click="flag = false">取消</el-button>
+        </div>
+      </div>
+    </Dialog>
   </div>
 </template>
 
 <script>
 import Search from '@/layout/components/Search'
+import Dialog from '@/layout/components/Dialog'
 import NormalCard from '../components/NormalCard'
-import { getGatewayInterfaceList } from '@/api/gateway'
-
+import { gateWayBusinessGetList, gateWayBusinessDeleteById, gateWayBusinessStatusEdit } from '@/api/gat-interface'
 export default {
   name: 'GatewayInterface',
   components: {
     Search,
+    Dialog,
     NormalCard
   },
   data () {
     return {
-      interfaceList: [
-        {
-          id: 0,
-          name: '名称',
-          description: '/api/msgTemplateSetting/stopstart',
-          protocol: 'http',
-          flag: true
-        }
-      ]
+      interfaceList: [],
+      pageIndex: 1,
+      pageSize: 20,
+      keyword: '',
+      searchType: 1,
+      title: '',
+      flag: false,
+      rmObj: {},
+      listLoading: false
     }
   },
   created () {
     this.fetchData()
   },
   methods: {
-    fetchData () {
-      this.listLoading = true
-      getGatewayInterfaceList().then(response => {
-        this.interfaceList.push(...response.data.items)
+    async fetchData () {
+      try {
+        this.listLoading = true
+        const { success, data } = await gateWayBusinessGetList({
+          pageIndex: this.pageIndex,
+          pageSize: this.pageSize,
+          keyword: this.keyword
+        })
+        if (success) {
+          data.forEach(item => {
+            item.flag = item.businessstatus == 2 ? true : false
+            this.interfaceList.push(item)
+          });
+          // this.interfaceList = data
+        } else {
+          this.interfaceList = []
+        }
         this.listLoading = false
+      } catch (error) {
+        this.listLoading = false
+      }
+    },
+    //搜索
+    getSearchData (val) {
+      this.keyword = val
+      this.fetchData()
+    },
+    //清除搜索
+    clearSearchData () {
+      this.keyword = ''
+      this.fetchData()
+    },
+    removeCard (item) {
+      this.flag = true
+      this.title = item.businessname
+      this.rmObj = item
+    },
+    editCard (item) {
+      this.$router.push({ path: '/gateway/interface-add', query: { id: item.businessid } })
+    },
+    //删除
+    async remove () {
+      const { success, message } = await gateWayBusinessDeleteById({
+        searchId: this.rmObj.businessid
+      })
+      if (success) {
+        this.fetchData()
+        this.$message.success(message)
+      } else {
+        this.$message.error(message)
+      }
+      this.flag = false
+    },
+    //状态切换
+    async switchChangeHandler (item) {
+      const { success, message } = await gateWayBusinessStatusEdit({
+        edittype: item.flag ? 2 : 1,
+        idlist: [item.businessid]
       })
+      if (success) {
+        this.fetchData()
+        this.$message.success(message)
+      } else {
+        this.$message.error(message)
+      }
     },
-    removeCard (index) {
-      this.interfaceList.splice(index, 1)
+    //加载
+    load () {
+      this.pageIndex += 1
+      this.fetchData()
     }
   }
 }

+ 101 - 56
src/views/gateway/limit/index.vue

@@ -17,50 +17,57 @@
     </div>
     <div class="gateway-limit-content">
       <template v-if="limitList.length">
-        <el-row :gutter="24">
+        <el-row :gutter="24" v-infinite-scroll="load">
           <el-col
-            v-for="(
-              { searchId, name, visitTimes, apiunittime, inBlacklist }, index
-            ) in limitList"
-            :key="searchId"
+            v-for="(item, index) in limitList"
+            :key="index"
             :xs="24"
             :md="12"
             :lg="6"
             :xl="6"
           >
             <NormalCard
-              :title="name"
-              :flag.sync="limitList[index].flag"
-              @update="update(searchId, limitList[index].flag)"
-              @close-click="removeCard(searchId)"
-              @editdate="editClickHandler(searchId)"
+              :title="item.trafficname"
+              :flag="item.trafficstatus == 0 ? false : true"
+              @close-click="removeCard(item.trafficid)"
+              @editdate="editClickHandler(item.trafficid)"
             >
               <el-row :gutter="16">
                 <el-col :span="12" class="card-content-left"
                   >IP访问单位次数:</el-col
                 >
                 <el-col :span="12" class="card-content-right">{{
-                  visitTimes
+                  item.apiunittimecount
                 }}</el-col>
                 <el-col :span="12" class="card-content-left"
                   >IP访问单位时间:</el-col
                 >
                 <el-col :span="12" class="card-content-right">{{
-                  apiunittime
+                  item.apiunittime
                 }}</el-col>
                 <el-col :span="12" class="card-content-left"
                   >是否加入黑名单:</el-col
                 >
                 <el-col :span="12" class="card-content-right">{{
-                  inBlacklist ? "是" : "否"
+                  item.iptoblack == 1 ? "是" : "否"
                 }}</el-col>
               </el-row>
+              <div class="card-switch">
+                <p :class="item.trafficstatus == 1 ? 'start_up' : 'close'">
+                  {{ item.trafficstatus == 1 ? "开启" : "关闭" }}
+                </p>
+                <el-switch
+                  v-model="item.trafficstatuse"
+                  active-color="#6F81BC"
+                  @change="update(item.trafficid, item.trafficstatuse)"
+                />
+              </div>
             </NormalCard>
           </el-col>
         </el-row>
       </template>
       <template v-else>
-        <el-empty description="暂无数据" />
+        <!-- <el-empty description="暂无数据" /> -->
       </template>
     </div>
     <Dialog
@@ -72,6 +79,14 @@
       <div class="dialog-add-content">
         <el-form :model="limitAddForm" label-width="auto">
           <el-row :gutter="24">
+            <el-col :span="12">
+              <el-form-item label="限流名称">
+                <el-input
+                  v-model="limitAddForm.trafficname"
+                  placeholder="请输入限流时间"
+                />
+              </el-form-item>
+            </el-col>
             <el-col :span="12">
               <el-form-item label="IP单位访问时间">
                 <el-input
@@ -88,7 +103,7 @@
                 />
               </el-form-item>
             </el-col>
-            <el-col :span="12">
+            <!-- <el-col :span="12">
               <el-form-item label="是否加入黑名单">
                 <el-radio-group v-model="limitAddForm.inBlacklist">
                   <el-radio :label="true">是</el-radio>
@@ -98,12 +113,15 @@
             </el-col>
             <el-col :span="12">
               <el-form-item label="是否启用">
-                <el-radio-group v-model="limitAddForm.enable" :disabled="true">
+                <el-radio-group
+                  v-model="limitAddForm.trafficstatus"
+                  :disabled="true"
+                >
                   <el-radio :label="false">是</el-radio>
                   <el-radio :label="true">否</el-radio>
                 </el-radio-group>
               </el-form-item>
-            </el-col>
+            </el-col> -->
           </el-row>
           <el-form-item label="限流规则描述">
             <el-input
@@ -113,14 +131,15 @@
           </el-form-item>
         </el-form>
       </div>
-      <div class="dialog-add-bottom center">
-        <el-button size="medium" type="primary" @click="dialogAddShow = false"
-          >提交</el-button
-        >
+      <div class="dialog-add-bottom fc">
         <el-button
           size="medium"
-          class="btn-cancel"
-          @click="dialogAddShow = false"
+          type="primary"
+          @click="onSubmit"
+          class="r24 blubtn"
+          >提交</el-button
+        >
+        <el-button size="medium" class="btn-cancel" @click="deles()"
           >取消</el-button
         >
       </div>
@@ -133,7 +152,6 @@
           <el-button size="medium" type="danger" class="r24" @click="del()"
             >删除</el-button
           >
-
           <el-button size="medium" @click="dialogVisible = false"
             >取消</el-button
           >
@@ -153,7 +171,7 @@ import {
   DeleteLimitInfo,
   UpdateLimitStatusPatch,
   GetLimitById,
-} from "@/api/gateway";
+} from "@/api/fusing";
 
 export default {
   name: "GatewayLimit",
@@ -164,21 +182,14 @@ export default {
   },
   data() {
     return {
-      limitList: [
-        {
-          id: 0,
-          name: "访问规则名称",
-          visitTimes: 21090,
-          apiunittime: 21,
-          inBlackList: true,
-          flag: true,
-        },
-      ],
+      limitList: [],
       limitAddForm: {
+        trafficid: "",
+        trafficname: "",
         apiunittime: "",
         apiunittimecount: "",
-        iptoblack: true,
-        enable: true,
+        trafficstatus: false,
+        inBlacklist: false,
         trafficdescrible: "",
       },
       dialogAddShow: false,
@@ -200,11 +211,14 @@ export default {
     // 查询
     getSearchData(val) {
       this.searchInfo = val;
+      this.limitList = [];
       this.pageInit();
     },
     // 清除查询
     clearSearchData() {
       this.searchInfo = "";
+      this.limitList = [];
+      this.pageInit();
     },
     // 滚动加载
     load() {
@@ -220,13 +234,13 @@ export default {
           PageIndex: this.PageIndex,
           PageSize: this.PageSize,
         });
-        if (result.code === 0) {
+        if (result.success) {
           this.loading = false;
-          const newDatas = result.returnData.data;
-          // console.log(newDatas[0])
+          const newDatas = result.data;
           // this.pages = result.returnData.pages;
           newDatas.forEach((element) => {
-            this.circuitBreakList.push(element);
+            element.trafficstatuse = element.trafficstatus == 1 ? true : false;
+            this.limitList.push(element);
           });
         } else {
           this.$message.error(result.message);
@@ -238,24 +252,25 @@ export default {
     // 回到第一页
     pageInit() {
       this.PageIndex = 1;
-      this.accountArr = [];
+      this.limitList = [];
       this.accountList();
     },
-    //新增熔断
+    //新增
     async onSubmit() {
       try {
         const result = await EditLimitInfo({
+          trafficname: this.limitAddForm.trafficname,
           trafficid: this.limitAddForm.trafficid
             ? this.limitAddForm.trafficid
             : "",
           apiunittime: this.limitAddForm.apiunittime,
           apiunittimecount: this.limitAddForm.apiunittimecount,
-          iptoblack: this.limitAddForm.inBlacklist ? 1 : 0,
+          iptoblack: 0,
           trafficdescrible: this.limitAddForm.trafficdescrible,
         });
-        if (result.code === 0) {
+        if (result.success) {
           this.dialogAddShow = false;
-          this.limitAddForm = {};
+          this.empty();
           this.pageInit();
         } else {
           this.$message.error(result.message);
@@ -264,6 +279,22 @@ export default {
         console.log("出错了", error);
       }
     },
+    //情空
+    empty() {
+      this.limitAddForm = {
+        trafficid: "",
+        trafficname: "",
+        apiunittime: "",
+        apiunittimecount: "",
+        trafficstatus: false,
+        inBlacklist: false,
+        trafficdescrible: "",
+      };
+    },
+    deles() {
+      this.dialogAddShow = false;
+      this.empty();
+    },
     //删除-弹窗
     removeCard(searchId) {
       this.dialogVisible = true;
@@ -276,7 +307,7 @@ export default {
         const result = await DeleteLimitInfo({
           searchId: this.searchId,
         });
-        if (result.code === 0) {
+        if (result.success) {
           this.dialogVisible = false;
           this.pageInit();
         } else {
@@ -287,13 +318,13 @@ export default {
       }
     },
     //状态变更
-    async update(searchId, data) {
+    async update(trafficid, trafficstatus) {
       try {
         const result = await UpdateLimitStatusPatch({
-          edittype: data ? 1 : 0,
-          idlist: [searchId],
+          edittype: trafficstatus == true ? 1 : 0,
+          idlist: [trafficid],
         });
-        if (result.code === 0) {
+        if (result.success) {
           this.pageInit();
         } else {
           this.$message.error(result.message);
@@ -303,18 +334,23 @@ export default {
       }
     },
     //编辑详情
-    async editClickHandler(searchId) {
+    async editClickHandler(trafficid) {
       this.upName = "编辑";
       this.dialogAddShow = true;
       try {
         const result = await GetLimitById({
-          searchId: searchId,
+          searchId: trafficid,
         });
-        if (result.code === 0) {
+        if (result.success) {
           this.limitAddForm.trafficid = result.data.trafficid;
+          this.limitAddForm.trafficname = result.data.trafficname;
           this.limitAddForm.apiunittime = result.data.apiunittime;
+          this.limitAddForm.inBlacklist =
+            result.data.iptoblack == 0 ? false : true;
+          this.limitAddForm.trafficstatus = result.data.trafficstatus
+            ? false
+            : true;
           this.limitAddForm.apiunittimecount = result.data.apiunittimecount;
-          this.limitAddForm.iptoblack = result.data.iptoblack;
           this.limitAddForm.trafficdescrible = result.data.trafficdescrible;
         } else {
           this.$message.error(result.message);
@@ -332,7 +368,16 @@ export default {
   display: flex;
   justify-content: flex-end;
 }
-
+::v-deep .el-radio__input.is-checked .el-radio__inner {
+  border-color: #6f80bc;
+  background: #6f80bc;
+}
+::v-deep .el-radio__input.is-checked + .el-radio__label {
+  color: #303133;
+}
+::v-deep .el-button--primary {
+  border-color: #6f80bc;
+}
 .gateway-limit-content {
   margin-top: 32px;
   height: calc(100vh - 224px);