import{_ as e,c as t,f as a,h as l,u as i}from"./public.js?v=1763625242172";import{c as n,l as s}from"./page_layout.js?v=1763625242172";import{k as c,l as r,n as o,g as u}from"./setting.js?v=1763625242172";import{_ as f}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{k as p,P as d,r as m,e as y,R as g,S as _,X as v,a3 as b,U as w,V as x,a4 as h,N as S,j as q}from"./vue.js?v=1763625242172";import{au as W,dP as j,df as k,aC as E}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";const U={class:"p-20px"},P={class:"w-220px"},$={class:"ml-8px text-desc"},C={class:"w-220px mr-8px"},R={class:"text-desc"},B={class:"w-220px mr-8px"},L={class:"text-desc"},A=p({__name:"form",props:{isEdit:{type:Boolean,default:!1},row:{}},emits:["refresh"],setup(t,{expose:a,emit:l}){const i=t,n=l,{t:s}=d(),o=m(null),u=y({url:"",frequency:30,cycle:60}),p={url:{trigger:["blur","input"],validator:()=>""!==u.url.trim()||new Error(s("Waf.Setting.config_55"))},frequency:{trigger:["blur","input"],validator:()=>!!u.frequency||new Error(s("Waf.Setting.config_56"))},cycle:{trigger:["blur","input"],validator:()=>!!u.cycle||new Error(s("Waf.Setting.config_57"))}};return(()=>{const{row:e,isEdit:t}=i;t&&e&&(u.url=e.url,u.frequency=e.frequency,u.cycle=e.cycle)})(),a({onConfirm:async()=>{var e;await(null==(e=o.value)?void 0:e.validate()),i.isEdit?await c(S(u)):await r(S(u)),n("refresh")}}),(t,a)=>{const l=W,i=j,n=k,s=f,c=e;return g(),_("div",U,[v(s,{ref_key:"formRef",ref:o,model:x(u),rules:p},{default:b((()=>[v(i,{label:"URL",path:"url"},{default:b((()=>[w("div",P,[v(l,{value:x(u).url,"onUpdate:value":a[0]||(a[0]=e=>x(u).url=e),placeholder:"/index.php"},null,8,["value"])]),w("span",$,h(t.$t("Waf.Setting.config_51")),1)])),_:1}),v(i,{label:t.$t("Waf.Setting.config_48"),path:"frequency"},{default:b((()=>[w("div",C,[v(n,{value:x(u).frequency,"onUpdate:value":a[1]||(a[1]=e=>x(u).frequency=e),min:1,"show-button":!1},null,8,["value"])]),w("span",R,h(t.$t("Public.Unit.Time",x(u).frequency)),1)])),_:1},8,["label"]),v(i,{label:t.$t("Waf.Setting.config_49"),path:"cycle"},{default:b((()=>[w("div",B,[v(n,{value:x(u).cycle,"onUpdate:value":a[2]||(a[2]=e=>x(u).cycle=e),min:1,"show-button":!1},null,8,["value"])]),w("span",L,h(t.$t("Public.Unit.Second",x(u).cycle)),1)])),_:1},8,["label"])])),_:1},8,["model"]),v(c,{class:"mt-12px"},{default:b((()=>[w("li",null,h(t.$t("Waf.Setting.config_54")),1)])),_:1})])}}}),D={class:"p-20px"},H={class:"flex mb-16px"},N=p({__name:"config",setup(e){const{t:c}=d(),r=e=>{i({title:e.title,width:570,footer:!0,data:{...e.data,onRefresh:()=>{S()}},component:A})},f=async()=>{r({title:c("Waf.Setting.config_46"),data:{isEdit:!1}})},{table:p,columns:m,setLoading:y}=t([{key:"url",title:"URL",ellipsis:{tooltip:!0}},{key:"frequency",title:c("Waf.Setting.config_48"),width:100,ellipsis:{tooltip:!0}},{key:"cycle",title:c("Waf.Setting.config_49"),width:120,ellipsis:{tooltip:!0},render:e=>c("Waf.Setting.config_50",[e.cycle])},a({width:100,options:e=>[{label:c("Public.Btn.Edit"),onClick:async()=>{(async e=>{r({title:c("Waf.Setting.config_47"),data:{row:e,isEdit:!0}})})(e)}},{label:c("Public.Btn.Del"),onClick:async()=>{await o({url:e.url}),S()}}]})]),S=async()=>{try{y(!0);const{message:e}=await u();n(e)&&(p.data=Object.entries(e.cc_uri_frequency).map((([e,t])=>({url:e,frequency:s(t.frequency),cycle:s(t.cycle)}))))}finally{y(!1)}};return S(),(e,t)=>{const a=E,i=l;return g(),_("div",D,[w("div",H,[v(a,{type:"primary",onClick:f},{default:b((()=>[q(h(e.$t("Public.Btn.Add")),1)])),_:1})]),v(i,{"max-height":368,loading:x(p).loading,data:x(p).data,columns:x(m)},null,8,["loading","data","columns"])])}}});export{N as default};
