1 line
8.9 KiB
JavaScript
1 line
8.9 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-fab72688"],{"4cfd":function(e,t,r){"use strict";r("d3aa")},d3aa:function(e,t,r){},ece6:function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return e.visible?r("a-drawer",{staticStyle:{overflow:"auto","padding-bottom":"53px"},attrs:{title:e.title,maskClosable:!0,width:"45%",placement:"right",closable:!0,visible:e.visible},on:{close:e.handleCancel}},[r("a-form-model",{ref:"form",attrs:{layout:e.layout,"label-col":e.labelCol,"wrapper-col":e.wrapperCol,model:e.router}},[r("a-form-model-item",{attrs:{label:"路由ID"}},[r("a-input",{attrs:{placeholder:"路由唯一ID"},model:{value:e.router.routerId,callback:function(t){e.$set(e.router,"routerId",t)},expression:"router.routerId"}})],1),r("a-form-model-item",{attrs:{label:"路由名称"}},[r("a-input",{attrs:{placeholder:"路由名称"},model:{value:e.router.name,callback:function(t){e.$set(e.router,"name",t)},expression:"router.name"}})],1),r("a-form-model-item",{attrs:{label:"路由URI"}},[r("a-input",{attrs:{placeholder:"路由URL"},model:{value:e.router.uri,callback:function(t){e.$set(e.router,"uri",t)},expression:"router.uri"}})],1),r("a-form-model-item",{attrs:{label:"路由状态",prop:"status"}},[r("a-switch",{attrs:{"default-checked":""},model:{value:e.router.status,callback:function(t){e.$set(e.router,"status",t)},expression:"router.status"}})],1),r("a-form-model-item",{attrs:{prop:"predicates",label:"路由条件"}},[e._l(e.router.predicates,(function(t,n){return r("div",[r("a-divider",[e._v(e._s(t.name)+"\n "),r("a-icon",{attrs:{type:"delete",size:"22"},on:{click:function(t){return e.removePredicate(e.router,n)}}})],1),r("div",[e._l(t.args,(function(n,a){return[a==e.currentTagIndex?r("a-input",{ref:"input",refInFor:!0,style:{width:"190px"},attrs:{type:"text",size:"small",value:n},on:{change:e.handleInputChange,blur:function(r){return e.handleInputEditConfirm(t,n,a)},keyup:function(r){return!r.type.indexOf("key")&&e._k(r.keyCode,"enter",13,r.key,"Enter")?null:e.handleInputEditConfirm(t,n,a)}}}):r("a-tag",{key:n,attrs:{closable:!0},on:{close:function(){return e.removeTag(t,n)},click:function(t){return e.editTag(n,a)}}},[e._v("\n "+e._s(n)+"\n ")])]})),e.inputVisible&&n==e.currentNameIndex?r("a-input",{ref:"input",refInFor:!0,style:{width:"100px"},attrs:{type:"text",size:"small",value:e.inputValue},on:{change:e.handleInputChange,blur:function(r){return e.handleInputConfirm(t)},keyup:function(r){return!r.type.indexOf("key")&&e._k(r.keyCode,"enter",13,r.key,"Enter")?null:e.handleInputConfirm(t)}}}):r("a-tag",{staticStyle:{background:"#fff",borderStyle:"dashed"},on:{click:function(r){return e.showInput(t,n)}}},[r("a-icon",{attrs:{type:"plus"}}),e._v("\n 新建"+e._s(t.name)+"\n ")],1)],2)],1)})),r("p",{staticClass:"btn",staticStyle:{"padding-top":"10px"}},[r("a-dropdown",[r("a-menu",{attrs:{slot:"overlay"},on:{click:e.predicatesHandleMenuClick},slot:"overlay"},e._l(e.tagArray,(function(t){return r("a-menu-item",{key:t},[e._v(e._s(t))])})),1),r("a-button",{staticStyle:{"margin-left":"8px",width:"100%"},attrs:{type:"dashed"}},[e._v(" 添加路由条件\n "),r("a-icon",{attrs:{type:"down"}})],1)],1)],1)],2),r("a-form-model-item",{attrs:{prop:"predicates",label:"过滤器"}},[e._l(e.router.filters,(function(t,n){return r("div",[r("a-divider",[e._v(e._s(t.name)+"\n "),r("a-icon",{attrs:{type:"delete",size:"22"},on:{click:function(t){return e.removeFilter(e.router,n)}}})],1),e._l(t.args,(function(n,a){return r("div",{key:n.key},[r("a-input",{staticStyle:{width:"45%","margin-right":"8px"},attrs:{placeholder:"参数键"},model:{value:n.key,callback:function(t){e.$set(n,"key",t)},expression:"tag.key"}}),r("a-input",{staticStyle:{width:"40%","margin-right":"8px"},attrs:{placeholder:"参数值"},model:{value:n.value,callback:function(t){e.$set(n,"value",t)},expression:"tag.value"}}),r("a-icon",{staticClass:"dynamic-delete-button",attrs:{type:"minus-circle-o"},on:{click:function(r){return e.removeFilterParams(t,a)}}})],1)})),r("a-button",{staticStyle:{"margin-left":"28%",width:"30%"},attrs:{type:"dashed",size:"small"},on:{click:function(r){return e.addFilterParams(t)}}},[r("a-icon",{attrs:{type:"plus"}}),e._v("\n 添加参数\n ")],1)],2)})),r("p",{staticClass:"btn",staticStyle:{"padding-top":"10px"}},[r("a-dropdown",[r("a-menu",{attrs:{slot:"overlay"},on:{click:e.filterHandleMenuClick},slot:"overlay"},e._l(e.filterArray,(function(t){return r("a-menu-item",{key:t.key,attrs:{name:t.name}},[e._v(e._s(t.name))])})),1),r("a-button",{staticStyle:{"margin-left":"8px",width:"100%"},attrs:{type:"dashed"}},[e._v(" 添加过滤器\n "),r("a-icon",{attrs:{type:"down"}})],1)],1)],1)],2),r("a-row",{staticClass:"drawer-bootom-button",style:{textAlign:"right"}},[r("a-button",{style:{marginRight:"8px"},on:{click:e.handleCancel}},[e._v("\n 关闭\n ")]),r("a-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("确定")])],1)],1)],1):e._e()},a=[],i=r("0fea");function s(e,t){if(null==e)return{};var r,n,a=l(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function l(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}function o(e){return p(e)||d(e)||c(e)||u()}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){if(e){if("string"===typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function d(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function p(e){if(Array.isArray(e))return f(e)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var m={name:"GateWayRouteModal",components:{},data:function(){return{layout:"horizontal",labelCol:{span:3},wrapperCol:{span:14},currentNameIndex:0,currentTagIndex:-1,predicates:{},filterArray:[{key:0,name:"熔断器"},{key:1,name:"限流过滤器"}],tagArray:["Path","Host","Cookie","Header","Method","Query","After","Before","Between","RemoteAddr"],inputVisible:!1,inputValue:"",url:{update:"/sys/gatewayRoute/updateAll",clear:"/sys/gatewayRoute/clearRedis"},router:this.getRouter(),title:"路由编辑",visible:!1,loading:!1}},methods:{getRouter:function(){return{routerId:"",name:"",uri:"",predicates:[],filters:[]}},show:function(e){e?(e.status=Boolean(e.status),this.router=e):(this.router=this.getRouter(),this.inputValue=""),this.visible=!0,this.currentTagIndex=-1,this.currentNameIndex=-1},close:function(){this.reset(),this.$emit("close"),this.$refs["form"].resetFields(),this.visible=!1},removeTag:function(e,t){var r=e.args.filter((function(e){return e!==t}));e.args=r},predicatesHandleMenuClick:function(e){this.router.predicates.push({args:[],name:e.key})},editTag:function(e,t){this.currentTagIndex=t},showInput:function(e,t){this.inputVisible=!0,this.currentNameIndex=t},handleInputChange:function(e){this.inputValue=e.target.value},removePredicate:function(e,t){e.predicates.splice(t,1)},removeFilterParams:function(e,t){e.args.splice(t,1)},removeFilter:function(e,t){e.filters.splice(t,1)},addFilterParams:function(e){e.args.push({key:"key"+e.args.length+1,value:""})},filterHandleMenuClick:function(e){0==e.key&&this.router.filters.push({args:[{key:"name",value:"default"},{key:"fallbackUri",value:"forward:/fallback"}],name:"Hystrix",title:this.filterArray[0].name}),1==e.key&&this.router.filters.push({args:[{key:"key-resolver",value:"#{@ipKeyResolver}"},{key:"redis-rate-limiter.replenishRate",value:20},{key:"redis-rate-limiter.burstCapacity",value:20}],name:"RequestRateLimiter",title:this.filterArray[1].name})},handleInputConfirm:function(e){var t=this.inputValue,r=e.args;t&&-1===r.indexOf(t)&&(e.args=[].concat(o(r),[t])),Object.assign(this,{tags:r,inputVisible:!1,inputValue:""}),this.currentTagIndex=-1},handleInputEditConfirm:function(e,t,r){if(this.inputValue){var n=this.inputValue;e.args[r]=n}this.currentTagIndex=-1},reset:function(){this.expandedKeysss=[],this.checkedKeys=[],this.defaultCheckedKeys=[],this.loading=!1},handleCancel:function(){this.close()},handleSubmit:function(){var e=this,t=this.router,r=(t.predicates,t.filters,s(t,["predicates","filters"])),n=r;n.predicates=JSON.stringify(this.router.predicates),n.filters=JSON.stringify(this.router.filters),Object(i["i"])(this.url.update,{router:n}).then((function(t){t.success?(e.close(),e.$emit("ok"),e.$message.success(t.message)):e.$message.error(t.message)}))}}},y=m,h=(r("4cfd"),r("2877")),g=Object(h["a"])(y,n,a,!1,null,"7df3d545",null);t["default"]=g.exports}}]); |