(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-9b31c83a"],{"048e":function(e,t,a){},"0ce7":function(e,t,a){"use strict";var o=a("048e"),i=a.n(o);i.a},"5f67":function(e,t,a){"use strict";a.r(t);var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"app-container"},[0===e.tabsData.length?a("div",[e._v("\n 无服务\n ")]):a("div",[a("el-tabs",{attrs:{type:"card"},on:{"tab-click":e.selectTab},model:{value:e.tabsActive,callback:function(t){e.tabsActive=t},expression:"tabsActive"}},e._l(e.tabsData,function(e){return a("el-tab-pane",{key:e,attrs:{label:e,name:e}})}),1),e._v(" "),a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:e.searchFormData,size:"mini"},nativeOn:{submit:function(e){e.preventDefault()}}},[a("el-form-item",{attrs:{label:"路由名称"}},[a("el-input",{attrs:{clearable:!0,placeholder:"输入接口名或版本号"},model:{value:e.searchFormData.id,callback:function(t){e.$set(e.searchFormData,"id",t)},expression:"searchFormData.id"}})],1),e._v(" "),a("el-form-item",[a("el-checkbox",{model:{value:e.searchFormData.permission,callback:function(t){e.$set(e.searchFormData,"permission",t)},expression:"searchFormData.permission"}},[e._v("授权接口")])],1),e._v(" "),a("el-form-item",[a("el-checkbox",{model:{value:e.searchFormData.needToken,callback:function(t){e.$set(e.searchFormData,"needToken",t)},expression:"searchFormData.needToken"}},[e._v("需要token")])],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search","native-type":"submit"},on:{click:e.onSearchTable}},[e._v("查询")])],1)],1),e._v(" "),a("el-button",{directives:[{name:"show",rawName:"v-show",value:e.isCustomService,expression:"isCustomService"}],attrs:{type:"primary",size:"mini",icon:"el-icon-plus"},on:{click:function(t){return t.stopPropagation(),e.addRoute(t)}}},[e._v("\n 新建路由\n ")]),e._v(" "),a("el-table",{staticStyle:{"margin-top":"10px"},attrs:{data:e.pageInfo.rows,border:"","highlight-current-row":""}},[a("el-table-column",{attrs:{prop:"name",label:"接口名 (版本号)"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(e.getNameVersion(t.row))+"\n ")]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"roles",label:"访问权限",width:"150","show-overflow-tooltip":!0},scopedSlots:e._u([{key:"default",fn:function(t){return[t.row.permission?a("span",{staticClass:"roles-content",domProps:{innerHTML:e._s(e.roleRender(t.row))},on:{click:function(a){return e.onTableAuth(t.row)}}}):a("span",[e._v("\n (公开)\n ")])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"ignoreValidate",label:"签名校验",width:"120"},scopedSlots:e._u([{key:"default",fn:function(t){return[0===t.row.ignoreValidate?a("span",[e._v("校验")]):e._e(),e._v(" "),1===t.row.ignoreValidate?a("span",{staticStyle:{color:"#E6A23C"}},[e._v("不校验")]):e._e()]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"mergeResult",label:"统一格式输出",width:"120"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.mergeResult?a("span",[e._v("是")]):e._e(),e._v(" "),0===t.row.mergeResult?a("span",{staticStyle:{color:"#E6A23C"}},[e._v("否")]):e._e()]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"needToken",label:"需要token",width:"120"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.needToken?a("span",{staticStyle:{"font-weight":"bold",color:"#303133"}},[e._v("是")]):e._e(),e._v(" "),0===t.row.needToken?a("span",[e._v("否")]):e._e()]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"status",label:"状态",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949","active-value":1,"inactive-value":2},on:{change:function(a){return e.onChangeStatus(t.row)}},model:{value:t.row.status,callback:function(a){e.$set(t.row,"status",a)},expression:"scope.row.status"}})]}}])})],1),e._v(" "),a("el-pagination",{staticStyle:{"margin-top":"5px"},attrs:{background:"","current-page":e.searchFormData.pageIndex,"page-size":e.searchFormData.pageSize,"page-sizes":[10,20,40],total:e.pageInfo.total,layout:"total, sizes, prev, pager, next"},on:{"size-change":e.onSizeChange,"current-change":e.onPageIndexChange}})],1),e._v(" "),a("el-dialog",{attrs:{title:e.routeDialogTitle,visible:e.routeDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(t){e.routeDialogVisible=t},close:e.onCloseRouteDialog}},[a("el-form",{ref:"routeDialogFormRef",attrs:{model:e.routeDialogFormData,rules:e.routeDialogFormRules,"label-width":"180px",size:"mini"}},[a("el-input",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],model:{value:e.routeDialogFormData.id,callback:function(t){e.$set(e.routeDialogFormData,"id",t)},expression:"routeDialogFormData.id"}}),e._v(" "),a("el-form-item",{attrs:{label:"接口名 (版本号)"}},[e._v("\n "+e._s(e.routeDialogFormData.name+(e.routeDialogFormData.version?" ("+e.routeDialogFormData.version+")":""))+"\n ")]),e._v(" "),a("el-form-item",{attrs:{label:"签名校验"}},[e._v("\n "+e._s(e.routeDialogFormData.ignoreValidate?"不校验":"校验")+"\n ")]),e._v(" "),a("el-form-item",{attrs:{label:"统一格式输出"}},[e._v("\n "+e._s(1===e.routeDialogFormData.mergeResult?"是":"否")+"\n ")]),e._v(" "),a("el-form-item",{attrs:{label:"需要token"}},[e._v("\n "+e._s(1===e.routeDialogFormData.needToken?"是":"否")+"\n ")]),e._v(" "),a("el-form-item",{attrs:{label:"状态"}},[a("el-radio-group",{model:{value:e.routeDialogFormData.status,callback:function(t){e.$set(e.routeDialogFormData,"status",t)},expression:"routeDialogFormData.status"}},[a("el-radio",{attrs:{label:1,name:"status"}},[e._v("启用")]),e._v(" "),a("el-radio",{staticStyle:{color:"#F56C6C"},attrs:{label:2,name:"status"}},[e._v("禁用")])],1)],1)],1),e._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.routeDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.onRouteDialogSave}},[e._v("保 存")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"路由授权",visible:e.authDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(t){e.authDialogVisible=t}}},[a("el-form",{attrs:{model:e.authDialogFormData,"label-width":"120px",size:"mini"}},[a("el-form-item",{attrs:{label:"路由ID"}},[a("span",[e._v(e._s(e.authDialogFormData.routeId))])]),e._v(" "),a("el-form-item",{attrs:{label:"角色"}},[a("el-checkbox-group",{model:{value:e.authDialogFormData.roleCode,callback:function(t){e.$set(e.authDialogFormData,"roleCode",t)},expression:"authDialogFormData.roleCode"}},e._l(e.roles,function(t){return a("el-checkbox",{key:t.roleCode,attrs:{label:t.roleCode}},[e._v(e._s(t.description))])}),1)],1)],1),e._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.authDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.onAuthDialogSave}},[e._v("保 存")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"添加服务",visible:e.addServiceDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(t){e.addServiceDialogVisible=t},close:e.closeAddServiceDlg}},[a("el-form",{ref:"addServiceForm",attrs:{model:e.addServiceForm,rules:e.addServiceFormRules,"label-width":"200px"}},[a("el-form-item",{attrs:{label:"服务名(serviceId)",prop:"serviceId"}},[a("el-input",{attrs:{placeholder:"服务名,如:order-service"},model:{value:e.addServiceForm.serviceId,callback:function(t){e.$set(e.addServiceForm,"serviceId",t)},expression:"addServiceForm.serviceId"}})],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.addServiceDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.onAddService}},[e._v("确 定")])],1)],1)],1)},i=[],r=(a("7f7f"),{data:function(){return{tabsData:[],tabsActive:"",serviceTextLimitSize:20,filterText:"",treeData:[],tableData:[],serviceId:"",isCustomService:!1,searchFormData:{id:"",serviceId:"",permission:0,needToken:0,pageIndex:1,pageSize:10},pageInfo:{rows:[],total:0},defaultProps:{children:"children",label:"label"},routeDialogTitle:"修改路由",routeDialogFormData:{id:"",name:"",version:"1.0",uri:"",path:"",status:1,mergeResult:1,ignoreValidate:0},routeDialogFormRules:{name:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}],version:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}],uri:[{required:!0,message:"不能为空",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}],path:[{min:0,max:100,message:"长度不能超过 100 个字符",trigger:"blur"}]},routeDialogVisible:!1,roles:[],authDialogFormData:{routeId:"",roleCode:[]},authDialogVisible:!1,addServiceDialogVisible:!1,addServiceForm:{serviceId:""},addServiceFormRules:{serviceId:[{required:!0,message:"请输入服务名称",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}]}}},watch:{filterText:function(e){this.$refs.serviceTree.filter(e)}},created:function(){this.loadTabs(),this.loadRouteRole()},methods:{loadTabs:function(){this.post("registry.service.list",{},function(e){var t=this;this.tabsData=e.data,this.$nextTick(function(){t.tabsData.length>0&&(t.tabsActive=t.tabsData[0],t.loadRouteData())})})},loadTree:function(){this.post("registry.service.list",{},function(e){var t=this,a=e.data;this.treeData=this.convertToTreeData(a,0),this.$nextTick(function(){t.serviceId&&t.$refs.serviceTree.setCurrentKey(t.serviceId)})})},filterNode:function(e,t){return!e||-1!==t.label.indexOf(e)},onNodeClick:function(e,t,a){e.parentId&&(this.serviceId=e.label,this.searchFormData.serviceId=this.serviceId,this.isCustomService=Boolean(e.custom),this.loadTable())},selectTab:function(){this.loadRouteData()},loadRouteData:function(){this.serviceId=this.tabsActive,this.searchFormData.serviceId=this.serviceId,this.loadTable()},convertToTreeData:function(e,t){for(var a=[],o={label:0===e.length?"无服务":"服务列表",parentId:t},i=[],r=0;r0?t.join(", "):"点击授权"},onRouteDialogSave:function(){var e=this;this.$refs.routeDialogFormRef.validate(function(t){if(t){var a=e.routeDialogFormData.id?"route.status.update":"route.add";e.routeDialogFormData.serviceId=e.serviceId,e.post(a,e.routeDialogFormData,function(){this.routeDialogVisible=!1,this.loadTable()})}})},onAuthDialogSave:function(){this.post("route.role.update",this.authDialogFormData,function(){this.authDialogVisible=!1,this.loadTable()})},addService:function(){this.addServiceDialogVisible=!0},closeAddServiceDlg:function(){this.$refs.addServiceForm.resetFields()},onAddService:function(){var e=this;this.$refs.addServiceForm.validate(function(t){t&&e.post("service.custom.add",e.addServiceForm,function(e){this.addServiceDialogVisible=!1,this.tip("添加成功"),this.loadTree()})})},onDelService:function(e){var t=e.serviceId;this.confirm("确认要删除服务"+t+"吗,【对应的路由配置会一起删除】",function(e){var a={serviceId:t};this.post("service.custom.del",a,function(){e(),this.tip("删除成功"),this.loadTree()})})},onSizeChange:function(e){this.searchFormData.pageSize=e,this.loadTable()},onPageIndexChange:function(e){this.searchFormData.pageIndex=e,this.loadTable()}}}),s=r,l=(a("0ce7"),a("2877")),n=Object(l["a"])(s,o,i,!1,null,null,null);t["default"]=n.exports}}]);