import{_ as C}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{i as R,p as U}from"./index-BTglIPU2.js?v=1773287522785";import{g as w}from"./data-BVsViUMm.js?v=1773287522785";import{u as N}from"./useTableColumns-DDeyYvje.js?v=1773287522785";import{u as P}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import{k as F,l as L,n as j,g as A}from"./setting-DouXuJGW.js?v=1773287522785";import{_ as D}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as T}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{k as x,R as S,r as V,e as O,$,Z as W,a0 as i,a9 as c,_ as l,S as o,aa as _,N as q,j as G}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as I,b as M,_ as Z,B as z}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./index-S15tYq5l.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-DeTfbeeM.js?v=1773287522785";import"./index-Cg6fMjw6.js?v=1773287522785";const H={class:"p-20px"},J={class:"w-220px"},K={class:"ml-8px text-desc"},Q={class:"w-220px mr-8px"},X={class:"text-desc"},Y={class:"w-220px mr-8px"},tt={class:"text-desc"},et=x({__name:"form",props:{isEdit:{type:Boolean,default:!1},row:{}},emits:["refresh"],setup(h,{expose:s,emit:p}){const m=h,y=p,{t:r}=S(),d=V(null),t=O({url:"",frequency:30,cycle:60}),u={url:{trigger:["blur","input"],validator:()=>t.url.trim()===""?new Error(r("Waf.Setting.config_55")):!0},frequency:{trigger:["blur","input"],validator:()=>t.frequency?!0:new Error(r("Waf.Setting.config_56"))},cycle:{trigger:["blur","input"],validator:()=>t.cycle?!0:new Error(r("Waf.Setting.config_57"))}},n=()=>{const{row:e,isEdit:a}=m;a&&e&&(t.url=e.url,t.frequency=e.frequency,t.cycle=e.cycle)},g=async()=>{var e;await((e=d.value)==null?void 0:e.validate()),m.isEdit?await F(q(t)):await L(q(t)),y("refresh")};return n(),s({onConfirm:g}),(e,a)=>{const k=M,b=I,v=Z,E=T,B=D;return $(),W("div",H,[i(E,{ref_key:"formRef",ref:d,model:o(t),rules:u},{default:c(()=>[i(b,{label:"URL",path:"url"},{default:c(()=>[l("div",J,[i(k,{value:o(t).url,"onUpdate:value":a[0]||(a[0]=f=>o(t).url=f),placeholder:"/index.php"},null,8,["value"])]),l("span",K,_(e.$t("Waf.Setting.config_51")),1)]),_:1}),i(b,{label:e.$t("Waf.Setting.config_48"),path:"frequency"},{default:c(()=>[l("div",Q,[i(v,{value:o(t).frequency,"onUpdate:value":a[1]||(a[1]=f=>o(t).frequency=f),min:1,"show-button":!1},null,8,["value"])]),l("span",X,_(e.$t("Public.Unit.Time",o(t).frequency)),1)]),_:1},8,["label"]),i(b,{label:e.$t("Waf.Setting.config_49"),path:"cycle"},{default:c(()=>[l("div",Y,[i(v,{value:o(t).cycle,"onUpdate:value":a[2]||(a[2]=f=>o(t).cycle=f),min:1,"show-button":!1},null,8,["value"])]),l("span",tt,_(e.$t("Public.Unit.Second",o(t).cycle)),1)]),_:1},8,["label"])]),_:1},8,["model"]),i(B,{class:"mt-12px"},{default:c(()=>[l("li",null,_(e.$t("Waf.Setting.config_54")),1)]),_:1})])}}}),nt={class:"p-20px"},ot={class:"flex mb-16px"},ht=x({__name:"config",setup(h){const{t:s}=S(),p=n=>{U({title:n.title,width:570,footer:!0,data:{...n.data,onRefresh:()=>{u()}},component:et})},m=async()=>{p({title:s("Waf.Setting.config_46"),data:{isEdit:!1}})},y=async n=>{p({title:s("Waf.Setting.config_47"),data:{row:n,isEdit:!0}})},{table:r,columns:d,setLoading:t}=P([{key:"url",title:"URL",ellipsis:{tooltip:!0}},{key:"frequency",title:s("Waf.Setting.config_48"),width:100,ellipsis:{tooltip:!0}},{key:"cycle",title:s("Waf.Setting.config_49"),width:120,ellipsis:{tooltip:!0},render:n=>s("Waf.Setting.config_50",[n.cycle])},N({width:100,options:n=>[{label:s("Public.Btn.Edit"),onClick:async()=>{y(n)}},{label:s("Public.Btn.Del"),onClick:async()=>{await j({url:n.url}),u()}}]})]),u=async()=>{try{t(!0);const{message:n}=await A();R(n)&&(r.data=Object.entries(n.cc_uri_frequency).map(([g,e])=>({url:g,frequency:w(e.frequency),cycle:w(e.cycle)})))}finally{t(!1)}};return u(),(n,g)=>{const e=z,a=C;return $(),W("div",nt,[l("div",ot,[i(e,{type:"primary",onClick:m},{default:c(()=>[G(_(n.$t("Public.Btn.Add")),1)]),_:1})]),i(a,{"max-height":368,loading:o(r).loading,data:o(r).data,columns:o(d)},null,8,["loading","data","columns"])])}}});export{ht as default};
