mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-21 22:30:46 +08:00
1 line
6.2 KiB
JavaScript
1 line
6.2 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-36391b77"],{"69a3":function(t,e,n){},"952a":function(t,e,n){"use strict";n("69a3")},ac60:function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:t.addRule}},[n("a-icon",{attrs:{type:"plus"}}),t._v(" New Rule ")],1),n("a-drawer",{attrs:{title:t.formAction+" RMI rule",width:490,visible:t.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:t.closeDrawer}},[n("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"},on:{submit:t.handleSubmit}},[n("BasicRule",{attrs:{form:t.form,readOnly:t.formReadOnly}})],1),n("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[n("a-button",{style:{marginRight:"8px"},on:{click:t.handleCancel}},[t._v(" Cancel ")]),n("a-button",{attrs:{type:"primary",disabled:t.formReadOnly},on:{click:t.handleSubmit}},[t._v(" Submit ")])],1)],1),n("a-table",{attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var a=e.setSelectedKeys,o=e.selectedKeys,i=(e.clearFilters,e.column);return n("div",{staticStyle:{padding:"8px"}},[n("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+i.dataIndex,value:o[0]},on:{change:function(t){return a(t.target.value?[t.target.value]:[])},pressEnter:function(){t.filters[i.dataIndex]=o[0],t.fetch()}}}),n("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[i.dataIndex]=o[0],t.fetch()}}},[t._v(" Search ")])],1)}},{key:"filterIcon",fn:function(t){return n("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(e){return n("span",{},[n("a-tag",{attrs:{color:"#"+(2996213+80*e).toString(16)}},[t._v(" "+t._s(e)+" ")])],1)}},{key:"switchRender",fn:function(e,a,o,i){return n("span",{},[n("a-switch",{attrs:{checked:e},on:{click:function(e){return t.clickSwitch(a,i.dataIndex)}}})],1)}},{key:"valueRender",fn:function(e){return n("span",{},t._l(e.split(","),(function(e){return n("span",{key:e},[t._v(t._s(e)),n("br")])})),0)}},{key:"action",fn:function(e,a,o){return n("span",{},[n("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.viewRule(a)}}},[t._v("View")]),n("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.editRule(a,o)}}},[t._v("Edit")]),n("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(e){return t.deleteRule(a,o)}}},[n("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[t._v("Delete")])],1)],1)}}])})],1)},o=[],i=n("5530"),r=(n("a434"),n("34c6")),c=n("56d7"),s=n("2084"),l="View",d="Edit",u="Create",f=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],p={name:"RmiRules",data:function(){return{store:c["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:c["store"].pageSize,onShowSizeChange:function(t,e){c["store"].pageSize=e}},filters:{},loading:!1,columns:f,form:{},formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(t,e,n){var a=Object(i["a"])({},this.pagination);a.current=t.current,this.pagination=a,this.order="ascend"===n.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(i["a"])(Object(i["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(r["j"])(e).then((function(e){var n=e.data.result;t.data=n.data;var a=Object(i["a"])({},t.pagination);a.total=n.count,t.pagination=a,t.loading=!1})).catch((function(e){t.$notification.error({message:"Unknown error: "+e.response.status,style:{width:"100px",marginLeft:"".concat(-265,"px")},duration:4})}))},clickSwitch:function(t,e){var n=this;t[e]=!t[e],Object(r["o"])(t).then().catch((function(t){n.$notification.error({message:"Edit failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(u)},viewRule:function(t){this.form=t,this.showForm(l)},editRule:function(t){this.form=JSON.parse(JSON.stringify(t)),this.showForm(d)},deleteRule:function(t,e){var n=this;Object(r["e"])(t).then((function(){n.data.splice(e,1)})).catch((function(t){n.$notification.error({message:"Error",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(t){this.formAction=t,this.formReadOnly=t===l,this.formVisible=!0},closeDrawer:function(){this.formVisible=!1},handleSubmit:function(){var t=this;this.$refs.form.validate((function(e){e&&Object(r["o"])(t.form).then((function(){t.closeDrawer(),t.fetch({page:t.pagination.current}),t.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(e){t.$notification.error({message:t.formAction+" failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:s["a"]}},h=p,m=(n("952a"),n("2877")),g=Object(m["a"])(h,a,o,!1,null,"ae6501fc",null);e["default"]=g.exports}}]); |