import{c as e,r as a,q as l,v as d,x as t,e as s,B as o,y as r,F as m,b0 as i,z as u,al as n,ab as p,a9 as b,N as c,ak as f}from"./base-lib.js?v=1761009159";import{P as v,k as _}from"./utils-lib.js?v=1761009159";import{setRedisValue as g}from"./database.js?v=1761009159";import{g as x}from"./useStore2.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const w={class:"p-[20px]"},V=e({__name:"index",props:{compData:{default:()=>({options:[],sid:0})}},setup(e,{expose:V}){const{refreshTableList:h}=x(),y=e,D=a(),j=a(),k=a({db_idx:Number(y.compData.keyId),name:"",val:"",endtime:""}),q={db_idx:[{required:!0,message:"请选择数据库",trigger:"change"}],name:[{required:!0,message:"请输入键",trigger:["blur","input"]}],val:[{required:!0,message:"请输入值",trigger:["blur","input"]}]};return l(async()=>{var e;j.value=await(null==(e=y.compData)?void 0:e.refresh()),y.compData.row&&(k.value=y.compData.row)}),V({onConfirm:async e=>{await D.value.validate();let a={...k.value,sid:y.compData.sid};k.value.endtime&&"0"!==k.value.endtime||delete a.endtime,await v({loading:"正在".concat(y.compData.row?"编辑":"添加","数据库，请稍后..."),request:g({data:JSON.stringify(a)}),message:!0}),h(),e()}}),(e,a)=>{const l=f,v=n,g=p,x=_,V=b;return d(),t("div",w,[s(V,{"label-position":"right","label-width":"80px",model:r(k),ref_key:"redisFormRef",ref:D,rules:q},{default:o(()=>[s(g,{label:"数据库",prop:"db_idx"},{default:o(()=>[s(v,{class:"!w-[24rem]",modelValue:r(k).db_idx,"onUpdate:modelValue":a[0]||(a[0]=e=>r(k).db_idx=e),disabled:e.compData.row},{default:o(()=>[(d(!0),t(m,null,i(r(j),(e,a)=>(d(),c(l,{key:a,label:e.name,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),s(g,{label:"键",prop:"name"},{default:o(()=>[s(x,{width:"24rem",placeholder:"请输入键名",modelValue:r(k).name,"onUpdate:modelValue":a[1]||(a[1]=e=>r(k).name=e),disabled:e.compData.row},null,8,["modelValue","disabled"])]),_:1}),s(g,{label:"值",prop:"val"},{default:o(()=>[s(x,{width:"24rem",placeholder:"请输入值",modelValue:r(k).val,"onUpdate:modelValue":a[2]||(a[2]=e=>r(k).val=e),rows:6,type:"textarea"},null,8,["modelValue"])]),_:1}),s(g,{label:"有效期"},{default:o(()=>[s(x,{width:"24rem",placeholder:"为空则永不过期",modelValue:r(k).endtime,"onUpdate:modelValue":a[3]||(a[3]=e=>r(k).endtime=e),"text-type":"秒",min:0,type:"number"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"]),a[4]||(a[4]=u("ul",{class:"mt-[20px] leading-8 text-small list-disc ml-[36px]"},[u("li",null,"有效期为0表示永久")],-1))])}}});export{V as default};
