import{u as L,E as T,a as K,b as Y}from"./element-plus-53a783a7.js";import"./vue-20eed888.js";import{u as H,b as Q}from"./index-03a63030.js";import{u as X}from"./vue-i18n-d6e8419a.js";import{y as Z}from"./request-6d47a533.js";import{i as ee}from"./interface-6c1bedf7.js";import{d as te,G as ae,r as n,k as l,ah as v,ai as E,o as ie,c as le,e as h,P as C,u as f,L as x,a as I,U as D,i as re,F as se}from"./@vue-e95c845e.js";import{_ as oe}from"./y9plugin-components-412bad23.js";import"./lodash-es-2e98bc53.js";import"./@vueuse-409d7ed5.js";import"./@element-plus-57b52633.js";import"./@popperjs-c75af06c.js";import"./@ctrl-f8748455.js";import"./dayjs-e13f206c.js";import"./axios-db0ed51e.js";import"./async-validator-20f92749.js";import"./memoize-one-297ddbcb.js";import"./normalize-wheel-es-ed76fb12.js";import"./@floating-ui-606f2ab9.js";import"./lodash-11751b8b.js";import"./pinia-22d008e7.js";import"./nprogress-e9cc33fd.js";import"./vue-router-e03c3082.js";/* empty css *//* empty css *//* empty css */import"./y9plugin-sso-6f4b3ca3.js";import"./y9plugin-watermark-e18d3181.js";import"./@intlify-d4a3a758.js";import"./v-viewer-decd5d79.js";import"./viewerjs-c43574b2.js";import"./vxe-table-3ccf2bcd.js";import"./xe-utils-90392958.js";import"./dom-zindex-d72a3c32.js";const w=Z(),ne=async p=>await w({url:"/api/rest/blacklisting/getPage",method:"GET",cType:!1,params:p}),pe=async p=>await w({url:"/api/rest/blacklisting/saveInfo",method:"POST",dataType:"json",cType:!1,data:p}),R=async p=>await w({url:"/api/rest/blacklisting/getInfoById",method:"GET",cType:!1,params:p}),ue=async p=>await w({url:"/api/rest/blacklisting/delInfoById",method:"GET",cType:!1,params:p}),fe=async p=>await w({url:"/api/rest/blacklisting/updateEnable",method:"POST",dataType:"json",cType:!1,data:p}),de=te({__name:"blacklisting",setup(p){const y=ae("sizeObjInfo"),F=H(),{t:a}=X();n();const k=n({}),B=n(),z=n([]);n(!1),n();let r=n({headerBackground:!0,pageConfig:{background:!1,currentPage:1,pageSize:5,total:0,pageSizeOpts:[5,10,15,20,30,40,1e3]},columns:[{type:"index",title:l(()=>a("序号")),width:80,fixed:"left"},{title:l(()=>a("名称")),key:"name"},{width:"320",title:l(()=>a("ip")),key:"ip"},{title:l(()=>a("备注")),key:"notes"},{title:l(()=>a("排序")),key:"sort"},{title:l(()=>a("创建时间")),key:"createTime"},{title:l(()=>a("是否启用")),key:"",render:t=>t.sameId=="25cee41e73dd4281a93a9cb799dd9d12"?v(L,{modelValue:JSON.parse(t.isEnable)}):v(L,{modelValue:JSON.parse(t.isEnable),"onUpdate:modelValue":i=>{let e=new FormData;e.append("id",t.id),e.append("isEnable",i),fe(e).then(s=>{s.status=="success"?t.isEnable=i:T({message:"启用失败,节点信息未补充",type:"success"})})}})},{title:l(()=>a("操作")),width:300,fixed:"right",render:t=>{if(t.sameId!="25cee41e73dd4281a93a9cb799dd9d12")return v("div",[v("span",{onClick:()=>{J(t.id)}},a("详情")),v("span",{class:"leftMargin",onClick:()=>{A(t.id)}},a("编辑")),v("span",{class:"leftMargin",onClick:()=>{U(t.id)}},a("删除"))])}}],tableData:[]});const O=n({filtersValueCallBack:t=>{k.value=t},itemList:[{type:"input",value:"",key:"name",label:l(()=>a("名称")),labelWidth:"82px",span:F.device==="mobile"?24:6},{type:"slot",slotName:"slotSearch",span:6},{type:"slot",slotName:"slotBtns",span:F.device==="mobile"?24:12,justify:"flex-end"}],showBorder:!0,borderRadio:"4px"});async function g(){r.value.loading=!0,k.value.page=r.value.pageConfig.currentPage,k.value.limit=r.value.pageConfig.pageSize;let t=await ne(k.value);r.value.tableData=t.data||[],r.value.pageConfig.total=t.count||0,r.value.loading=!1}function N(t){r.value.tableData=[],r.value.pageConfig.pageSize=t,g()}function q(t){r.value.tableData=[],r.value.pageConfig.currentPage=t,g()}function V(){r.value.pageConfig.currentPage=1,r.value.pageConfig.pageSize=15,r.value.tableData=[],g()}function j(){B.value.elTableFilterRef.onReset(),r.value.pageConfig.currentPage=1,r.value.pageConfig.pageSize=15,r.value.tableData=[],k.value={},g()}function M(){r.value.pageConfig.currentPage=1,r.value.pageConfig.pageSize=15,r.value.tableData=[],g()}M();const _=n(),G=(t,i,e)=>{let s=Q("number",i,!0);s.valid?e():e(new Error(s.msg))};let o=n({show:!1,title:l(()=>a("新增权限配置")),showFooter:!0,onOkLoading:!0,onOk:t=>new Promise(async(i,e)=>{var b;await((b=_.value)==null?void 0:b.elFormRef).validate(async m=>{if(m){let u=_.value.model,c=new FormData;for(let S in u)u[S]!=null&&S!="createTime"&&S!="updateTime"&&c.append(S,u[S]);(await pe(c)).code==0&&(T({message:"数据保存成功",type:"success"}),i(),g()),e()}else e()})})});const W=(t,i,e)=>{if(!/^[0-9.,]+$/.test(i))e(new Error("输入了非法字符请检查"));else{let b=i.split(",");for(let m of b){let u=m.split(".");if(u.length!=4)e(new Error("IP"+m+"输入不合法请检查"));else for(let c of u)c!=null&&c!=""&&c.length!=0?(Number(c)<0||Number(c)>255)&&e(new Error("IP "+m+" 输入不合法请检查")):e(new Error("IP "+m+" 输入不合法请检查"))}e()}};let d=n({model:{isPrimary:"Y",isEnable:!1},rules:{name:[{required:!0,message:l(()=>a("名称不能为空")),trigger:"blur"}],ip:[{required:!0,message:l(()=>a("ip不能为空")),trigger:"blur"},{validator:W,trigger:"blur"}],interfaceIds:[{required:!0,message:l(()=>a("应用接口不能为空")),trigger:"blur"}],sort:[{required:!0,message:l(()=>a("排序不能为空")),trigger:"blur"},{validator:G,trigger:"blur"}]},itemList:[{type:"input",label:l(()=>a("名称")),prop:"name",props:{maxlength:100}},{type:"textarea",label:l(()=>a("ip")),prop:"ip",props:{rows:3,maxlength:300,showWordLimit:!0,placeholder:"请输入IP,多个IP使用英文逗号隔开,例如:123.123.123.123,1.1.1.1"}},{type:"select",label:l(()=>a("应用接口")),prop:"interfaceIds",props:{options:z.value,multiple:!0,clearable:!0}},{type:"textarea",label:l(()=>a("备注")),prop:"notes",props:{rows:3,maxlength:254,showWordLimit:!0}},{type:"input",label:l(()=>a("排序")),prop:"sort",props:{type:"number",max:999,min:0}}],descriptionsFormConfig:{labelWidth:"200px",labelAlign:"center"}});function $(){P(),d.value.model={isEnable:!0};for(let t of d.value.itemList)t.props==null?t.props={disabled:!1}:t.props.disabled=!1;o.value.okText="保存",o.value.title=l(()=>a("新增黑名单信息")),o.value.show=!0}async function A(t){P();let e=await R({id:t});e.data.interfaceIds=e.data.interfaceIds.split(","),e.data.interfaceIds.shift(),d.value.model=e.data;for(let s of d.value.itemList)s.props==null?s.props={disabled:!1}:s.props.disabled=!1;o.value.title=l(()=>a("编辑黑名单信息")),o.value.okText="保存",o.value.show=!0}async function J(t){P();let e=await R({id:t});e.data.interfaceIds=e.data.interfaceIds.split(","),e.data.interfaceIds.shift(),d.value.model=e.data;for(let s of d.value.itemList)s.props==null?s.props={disabled:!0}:s.props.disabled=!0;o.value.okText=!1,o.value.title=l(()=>a("查看黑名单信息")),o.value.show=!0}async function U(t){K.confirm("是否确认删除这条数据","删除数据确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"info",draggable:!0}).then(()=>{ue({id:t}).then(e=>{e.status=="success"?(T({type:"info",message:"删除成功"}),g()):T({type:"warning",message:"删除失败"+e.msg})})}).catch(()=>{})}async function P(){ee({page:1,limit:9999999,mayApply:"发布"}).then(i=>{z.value=[];for(let e of i.data){let s={label:e.interfaceName+"-"+e.version,value:e.id};z.value.push(s)}for(let e of d.value.itemList)e.prop=="interfaceIds"&&(e.props.options=z.value)})}return(t,i)=>{const e=Y,s=E("y9Table"),b=E("y9Form"),m=E("y9Dialog");return ie(),le(se,null,[h(s,{config:f(r),filterConfig:O.value,onOnCurrPageChange:q,ref_key:"filterRef",ref:B,onOnPageSizeChange:N},{slotSearch:C(()=>[h(e,{size:f(y).buttonSize,style:x({fontSize:f(y).baseFontSize}),class:"global-btn-main",type:"primary",onClick:V},{default:C(()=>[i[1]||(i[1]=I("i",{class:"ri-search-line"},null,-1)),I("span",null,D(t.$t("查询")),1)]),_:1},8,["size","style"]),h(e,{size:f(y).buttonSize,style:x({fontSize:f(y).baseFontSize}),class:"el-button el-button--default global-btn-third",onClick:j},{default:C(()=>[i[2]||(i[2]=I("i",{class:"ri-refresh-line"},null,-1)),I("span",null,D(t.$t("重置")),1)]),_:1},8,["size","style"])]),slotBtns:C(()=>[h(e,{size:f(y).buttonSize,style:x({fontSize:f(y).baseFontSize}),class:"global-btn-main",type:"primary",onClick:$},{default:C(()=>[i[3]||(i[3]=I("i",{class:"ri-add-line"},null,-1)),I("span",null,D(t.$t("新增")),1)]),_:1},8,["size","style"])]),_:1},8,["config","filterConfig"]),h(m,{config:f(o),"onUpdate:config":i[0]||(i[0]=u=>re(o)?o.value=u:o=u)},{default:C(()=>[h(b,{ref_key:"ruleFormRef",ref:_,config:f(d)},null,8,["config"])]),_:1},8,["config"])],64)}}});const Ke=oe(de,[["__file","E:/workSpaceJDK11/y9-interface-platform/y9vue-interfacePlatform/src/views/blacklisting/blacklisting.vue"]]);export{Ke as default};