import{d as W,O as X,r as k,n as J,f as Q,h as i,c as h,e as l,w as r,a as m,t as p,u as s,i as c,N as a,F as C,G as V,I as g,y as Z,R as ee,B as ae,a4 as te,a8 as le,E as se,W as oe,X as re,as as ne,aF as ie,cK as pe,Y as de,$ as ue,ah as ce,aw as me,aj as _e,at as fe,a0 as he,_ as ge}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./el-form-item-4ed993c7.js";import{_ as ve}from"./site_logo-f276251b.js";import{i as be,s as ye,t as xe,v as ke,w as we,x as Pe}from"./site-ac963391.js";import{_ as Ce}from"./edit-site.vue_vue_type_script_setup_true_lang-1328d131.js";import{g as Ve}from"./addon-8fbd8692.js";/* empty css *//* empty css *//* empty css */import"./member_head-a897263d.js";import"./user-1e1ca1a9.js";const De={class:"main-container"},Ee={class:"flex justify-between items-center"},Se={class:"text-[20px]"},Ie={class:"mt-[20px]"},Le={class:"flex items-center"},Te=["src"],$e={key:1,class:"w-[50px] h-[50px] mr-[10px]",src:ve,alt:""},Fe={class:"flex flex flex-col"},Be={class:"flex items-center"},Ue={class:"flex flex flex-col"},Ye={key:0},Ne={key:1},Me={class:"mt-[16px] flex justify-end"},je=W({__name:"list",setup(ze){const D=X(),$=D.meta.title,b=k({all:[]}),E=k([]),o=J({page:1,limit:10,total:0,loading:!0,data:[],searchParam:{keywords:"",group_id:"",app:"all",status:"",create_time:[],expire_time:[]}});o.searchParam.status=D.query.id||"",(async()=>{const n=await(await be({})).data;b.value.all=n,n.forEach((t,d)=>{b.value[t.app]||(b.value[t.app]=[]),b.value[t.app].push(t)})})(),(async()=>{E.value=await(await ye()).data})();const S=k(),F=n=>{n&&(n.resetFields(),_())},B=()=>{o.searchParam.group_id=""},I=k([]);Ve().then(({data:n})=>{I.value=n}).catch();const _=(n=1)=>{o.loading=!0,o.page=n,o.searchParam.app=o.searchParam.app=="all"?"":o.searchParam.app,xe({page:o.page,limit:o.limit,...o.searchParam}).then(t=>{o.loading=!1,o.data=t.data.data,o.total=t.data.total}).catch(()=>{o.loading=!1})};_();const U=Q(),x=k(null),Y=n=>{x.value.setFormData(),x.value.showDialog=!0},N=n=>{U.push({path:"/admin/site/info",query:{id:n.site_id}})},M=n=>{te({message:a("siteUrlDevelopMessage"),grouping:!0,type:"success"})},j=n=>{x.value.setFormData(n),x.value.showDialog=!0},z=n=>{window.localStorage.setItem("site.siteId",n.site_id),window.open(`${location.origin}/site/`)},R=(n,t)=>{n==1&&ke({site_id:t}).then(d=>{_()}),n==3&&we({site_id:t}).then(d=>{_()})},G=n=>{le.confirm(a("siteDeleteTips"),a("warning"),{confirmButtonText:a("confirm"),cancelButtonText:a("cancel"),type:"warning"}).then(()=>{Pe(n.site_id).then(t=>{_()}).catch(()=>{})})};return(n,t)=>{const d=se,H=oe,v=re,y=ne,w=ie,L=pe,O=de,T=ue,f=ce,P=me,q=_e,A=fe,K=he;return i(),h("div",De,[l(T,{class:"box-card !border-none",shadow:"never"},{default:r(()=>[m("div",Ee,[m("span",Se,p(s($)),1),l(d,{type:"primary",class:"w-[100px]",onClick:Y},{default:r(()=>[c(p(s(a)("addSite")),1)]),_:1})]),l(T,{class:"box-card !border-none my-[10px] table-search-wrap",shadow:"never"},{default:r(()=>[l(O,{inline:!0,model:o.searchParam,ref_key:"searchFormRef",ref:S},{default:r(()=>[l(v,{label:s(a)("siteName"),prop:"keywords"},{default:r(()=>[l(H,{modelValue:o.searchParam.keywords,"onUpdate:modelValue":t[0]||(t[0]=e=>o.searchParam.keywords=e),placeholder:s(a)("siteNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(v,{label:s(a)("app"),prop:"app_id"},{default:r(()=>[l(w,{modelValue:o.searchParam.app,"onUpdate:modelValue":t[1]||(t[1]=e=>o.searchParam.app=e),clearable:"",onChange:B,placeholder:s(a)("appIdPlaceholder"),class:"input-width"},{default:r(()=>[l(y,{label:s(a)("selectPlaceholder"),value:"all"},null,8,["label"]),(i(!0),h(C,null,V(Object.values(I.value),(e,u)=>(i(),g(y,{label:e.title,value:e.key,key:u},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),l(v,{label:s(a)("groupId"),prop:"group_id"},{default:r(()=>[l(w,{modelValue:o.searchParam.group_id,"onUpdate:modelValue":t[2]||(t[2]=e=>o.searchParam.group_id=e),clearable:"",placeholder:s(a)("groupIdPlaceholder"),class:"input-width"},{default:r(()=>[l(y,{label:s(a)("selectPlaceholder"),value:""},null,8,["label"]),(i(!0),h(C,null,V(b.value[o.searchParam.app],(e,u)=>(i(),g(y,{label:e.group_name,value:e.group_id,key:u},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),l(v,{label:s(a)("status"),prop:"status"},{default:r(()=>[l(w,{modelValue:o.searchParam.status,"onUpdate:modelValue":t[3]||(t[3]=e=>o.searchParam.status=e),clearable:"",placeholder:s(a)("groupIdPlaceholder"),class:"input-width"},{default:r(()=>[l(y,{label:s(a)("selectPlaceholder"),value:""},null,8,["label"]),(i(!0),h(C,null,V(E.value,(e,u)=>(i(),g(y,{label:e,value:u,key:u},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),l(v,{label:s(a)("createTime"),prop:"create_time"},{default:r(()=>[l(L,{modelValue:o.searchParam.create_time,"onUpdate:modelValue":t[4]||(t[4]=e=>o.searchParam.create_time=e),type:"datetimerange","value-format":"YYYY-MM-DD HH:mm:ss","start-placeholder":s(a)("startDate"),"end-placeholder":s(a)("endDate")},null,8,["modelValue","start-placeholder","end-placeholder"])]),_:1},8,["label"]),l(v,{label:s(a)("expireTime"),prop:"expire_time"},{default:r(()=>[l(L,{modelValue:o.searchParam.expire_time,"onUpdate:modelValue":t[5]||(t[5]=e=>o.searchParam.expire_time=e),type:"datetimerange","value-format":"YYYY-MM-DD HH:mm:ss","start-placeholder":s(a)("startDate"),"end-placeholder":s(a)("endDate")},null,8,["modelValue","start-placeholder","end-placeholder"])]),_:1},8,["label"]),l(v,null,{default:r(()=>[l(d,{type:"primary",onClick:t[6]||(t[6]=e=>_())},{default:r(()=>[c(p(s(a)("search")),1)]),_:1}),l(d,{onClick:t[7]||(t[7]=e=>F(S.value))},{default:r(()=>[c(p(s(a)("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),m("div",Ie,[Z((i(),g(q,{data:o.data,size:"large"},{empty:r(()=>[m("span",null,p(o.loading?"":s(a)("emptyData")),1)]),default:r(()=>[l(f,{prop:"site_id",label:s(a)("siteId"),width:"100","show-overflow-tooltip":!0},null,8,["label"]),l(f,{label:s(a)("siteInfo"),width:"300",align:"left"},{default:r(({row:e})=>[m("div",Le,[e.logo?(i(),h("img",{key:0,class:"w-[50px] h-[50px] mr-[10px]",src:s(ee)(e.logo),alt:""},null,8,Te)):(i(),h("img",$e)),m("div",Fe,[m("span",null,p(e.site_name||""),1)])])]),_:1},8,["label"]),l(f,{label:s(a)("manager"),width:"150",align:"left"},{default:r(({row:e})=>[m("div",Be,[m("div",Ue,[m("span",null,p(e.admin.username||""),1)])])]),_:1},8,["label"]),l(f,{prop:"group_name",label:s(a)("groupId"),width:"150","show-overflow-tooltip":!0},null,8,["label"]),l(f,{prop:"create_time",label:s(a)("createTime"),width:"250","show-overflow-tooltip":!0},null,8,["label"]),l(f,{prop:"expire_time",label:s(a)("expireTime"),width:"250","show-overflow-tooltip":!0},{default:r(({row:e})=>[e.expire_time==0?(i(),h("div",Ye,"永久")):(i(),h("div",Ne,p(e.expire_time),1))]),_:1},8,["label"]),l(f,{label:s(a)("status"),width:"100",align:"center"},{default:r(({row:e})=>[e.status==1?(i(),g(P,{key:0,class:"ml-2",type:"success"},{default:r(()=>[c(p(e.status_name),1)]),_:2},1024)):e.status==3?(i(),g(P,{key:1,class:"ml-2",type:"error"},{default:r(()=>[c(p(e.status_name),1)]),_:2},1024)):(i(),g(P,{key:2,class:"ml-2",type:"error"},{default:r(()=>[c(p(e.status_name),1)]),_:2},1024))]),_:1},8,["label"]),l(f,{label:s(a)("operation"),"min-width":"250",align:"right",fixed:"right"},{default:r(({row:e})=>[l(d,{type:"primary",link:"",onClick:u=>z(e)},{default:r(()=>[c(" 访问站点 ")]),_:2},1032,["onClick"]),e.status==1||e.status==3?(i(),g(d,{key:0,type:"primary",link:"",onClick:u=>R(e.status,e.site_id)},{default:r(()=>[c(p(e.status==1?s(a)("closeTxt"):s(a)("openTxt")),1)]),_:2},1032,["onClick"])):ae("",!0),l(d,{type:"primary",link:"",onClick:u=>j(e)},{default:r(()=>[c(p(s(a)("edit")),1)]),_:2},1032,["onClick"]),l(d,{type:"primary",link:"",onClick:u=>G(e)},{default:r(()=>[c(p(s(a)("delete")),1)]),_:2},1032,["onClick"]),l(d,{type:"primary",link:"",onClick:u=>M(e)},{default:r(()=>[c(p(s(a)("url")),1)]),_:2},1032,["onClick"]),l(d,{type:"primary",link:"",onClick:u=>N(e)},{default:r(()=>[c(p(s(a)("info")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"])]),_:1},8,["data"])),[[K,o.loading]]),m("div",Me,[l(A,{"current-page":o.page,"onUpdate:current-page":t[8]||(t[8]=e=>o.page=e),"page-size":o.limit,"onUpdate:page-size":t[9]||(t[9]=e=>o.limit=e),layout:"total, sizes, prev, pager, next, jumper",total:o.total,onSizeChange:t[10]||(t[10]=e=>_()),onCurrentChange:_},null,8,["current-page","page-size","total"])])])]),_:1}),l(Ce,{ref_key:"addSiteDialog",ref:x,onComplete:t[11]||(t[11]=e=>_())},null,512)])}}});const ha=ge(je,[["__scopeId","data-v-a08a8abe"]]);export{ha as default};