You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ocr-web/dist/js/chunk-48663992.a012085a.js

1 line
9.7 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-48663992"],{c13f:function(e,t,r){"use strict";r("cb76")},cb76:function(e,t,r){},ece6:function(e,t,r){"use strict";r.r(t);var a=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,a){return r("div",[r("a-divider",[e._v(e._s(t.name)+" "),r("a-icon",{attrs:{type:"delete",size:"22"},on:{click:function(t){return e.removePredicate(e.router,a)}}})],1),e.genKeyRouter.includes(t.name)?r("div",[e._l(t.args,(function(n,i){return[i==e.currentTagIndex&&a==e.currentNameIndex?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,i)},keyup:function(r){return!r.type.indexOf("key")&&e._k(r.keyCode,"enter",13,r.key,"Enter")?null:e.handleInputEditConfirm(t,n,i)}}}):r("a-tag",{key:n,attrs:{closable:!0},on:{close:function(){return e.removeTag(t,n)},click:function(t){return e.editTag(n,i,a)}}},[e._v(" "+e._s(n)+" ")])]})),e.inputVisible&&a==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,a)}}},[r("a-icon",{attrs:{type:"plus"}}),e._v(" 新建"+e._s(t.name)+" ")],1)],2):e._e(),e.genKeyRouter.includes(t.name)?e._e():r("div",[e._l(t.args,(function(a,n){return[r("a-row",[r("a-col",{staticStyle:{"margin-top":"2px"},attrs:{span:5}},["header"==n?r("span",[e._v("Header名称")]):e._e(),"regexp"==n?r("span",[e._v("参数值")]):e._e(),"param"==n?r("span",[e._v("参数名")]):e._e(),"name"==n?r("span",[e._v("Cookie名称")]):e._e()]),r("a-col",{attrs:{span:18}},[r("a-input",{staticStyle:{width:"70%","margin-right":"8px","margin-top":"3px"},attrs:{defaultValue:a,placeholder:"参数值"},on:{change:function(r){return e.valueChange(r,t.args,n)}}})],1)],1)]}))],2)],1)})),r("p",{staticClass:"btn",staticStyle:{"padding-top":"10px"}},[r("a-dropdown",[r("a-menu",{attrs:{slot:"overlay"},slot:"overlay"},e._l(e.tagArray,(function(t){return r("a-menu-item",{key:t.name,on:{click:function(r){return e.predicatesHandleMenuClick(t)}}},[e._v(e._s(t.name))])})),1),r("a-button",{staticStyle:{"margin-left":"8px",width:"100%"},attrs:{type:"dashed"}},[e._v(" 添加路由条件 "),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,a){return r("div",[r("a-divider",[e._v(e._s(t.name)+" "),r("a-icon",{attrs:{type:"delete",size:"22"},on:{click:function(t){return e.removeFilter(e.router,a)}}})],1),e._l(t.args,(function(a,n){return r("div",{key:a.key},[r("a-input",{staticStyle:{width:"45%","margin-right":"8px"},attrs:{placeholder:"参数键"},model:{value:a.key,callback:function(t){e.$set(a,"key",t)},expression:"tag.key"}}),r("a-input",{staticStyle:{width:"40%","margin-right":"8px"},attrs:{placeholder:"参数值"},model:{value:a.value,callback:function(t){e.$set(a,"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,n)}}})],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(" 添加参数 ")],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(" 添加过滤器 "),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(" 关闭 ")]),r("a-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("确定")])],1)],1)],1):e._e()},n=[],i=r("0fea");function s(e,t){if(null==e)return{};var r,a,n=o(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function o(e,t){if(null==e)return{};var r,a,n={},i=Object.keys(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}function l(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 m(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)?m(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 m(e)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}var f={name:"GateWayRouteModal",components:{},data:function(){return{layout:"horizontal",labelCol:{span:3},wrapperCol:{span:14},currentNameIndex:0,currentTagIndex:-1,predicates:{},filterArray:[{key:1,name:"限流过滤器"}],tagArray:[{name:"Path",args:[]},{name:"Header",args:{header:"",regexp:""}},{name:"Query",args:{param:"",regexp:""}},{name:"Method",args:[]},{name:"Host",args:[]},{name:"Cookie",args:{name:"",regexp:""}},{name:"After",args:[]},{name:"Before",args:[]},{name:"Between",args:[]},{name:"RemoteAddr",args:[]}],inputVisible:!1,inputValue:"",url:{update:"/sys/gatewayRoute/updateAll",clear:"/sys/gatewayRoute/clearRedis"},router:this.getRouter(),title:"路由编辑",visible:!1,loading:!1,genKeyRouter:["Path","Host","Method","After","Before","Between","RemoteAddr"]}},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:e.args,name:e.name})},editTag:function(e,t,r){this.currentNameIndex=r,this.currentTagIndex=t},valueChange:function(e,t,r){t[r]=e.target.value},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[0].name})},handleInputConfirm:function(e){var t=this.inputValue,r=e.args;t&&-1===r.indexOf(t)&&(e.args=[].concat(l(r),[t])),Object.assign(this,{tags:r,inputVisible:!1,inputValue:""}),this.currentTagIndex=-1},handleInputEditConfirm:function(e,t,r){if(this.inputValue){var a=this.inputValue;e.args[r]=a}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"])),a=r;a.predicates=JSON.stringify(this.router.predicates),a.filters=JSON.stringify(this.router.filters),Object(i["i"])(this.url.update,{router:a}).then((function(t){t.success?(e.close(),e.$emit("ok"),e.$message.success(t.message)):e.$message.error(t.message)}))}}},h=f,y=(r("c13f"),r("2877")),g=Object(y["a"])(h,a,n,!1,null,"95cc2308",null);t["default"]=g.exports}}]);