import{l as e,K as s,t as a,x as l,v as t}from"./utils-lib.js?v=20260328163632";import{q as r}from"./database.js?v=20260328163632";import{u as i}from"./store.js?v=20260328163632";import{B as u}from"./index84.js?v=20260328163632";import{s as o,d as p}from"./useMethod3.js?v=20260328163632";import{c as d,r as n,O as v,k as m,J as c,V as x,W as b,Y as y}from"./base-lib.js?v=20260328163632";import"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index98.js?v=20260328163632";import"./index92.js?v=20260328163632";import"./useMethod2.js?v=20260328163632";import"./index85.js?v=20260328163632";import"./service.vue_vue_type_style_index_0_scoped_073b5b46_lang.js?v=20260328163632";const{isRefreshList:j,rowData:_}=i(),h=d((()=>!!_.value)),f=[{content:e("有效期为0表示永久")}],g=d((()=>({label:e("数据库"),children:[{type:"select",key:"dbIndex",attrs:{class:"!w-260px",disabled:h.value,options:p.value,placeholder:e("请选择数据库")}}]}))),k=d((()=>({label:e("键"),ruleKey:"key",rules:[s({message:e("请输入键"),trigger:["blur","input"]})],children:[{type:"input",key:"key",attrs:{class:"!w-260px ",placeholder:e("请输入键(key)"),disabled:h.value}}]}))),w=n({label:e("值"),ruleKey:"value",rules:[s({message:e("请输入值"),trigger:["blur","input"]})],children:[{type:"input",key:"value",attrs:{type:"textarea",rows:4,class:"!w-260px ",placeholder:e("请输入值")}}]}),I=n({label:e("有效期"),children:[{type:"custom",key:"expire",render:()=>v(u,{modelValue:M.value.expire,"onUpdate:modelValue":e=>M.value.expire=e,placeholder:e("为空则永不过期"),width:"225px",textType:e("秒")},null)}]}),K=n({formAttrs:{labelWidth:"100px"},formItems:[]}),V=d((()=>(K.value.formItems=[g.value,k.value,w.value,I.value],K.value))),[q,M,O]=a(V),W=async()=>{const{db_access:s,address:a,expire:t,...i}=M.value;let u={...i,expire:t||0,db_access:"ip"===s?a:s,sid:o.value};const p=await l({loading:e("正在添加数据库，请稍后..."),request:r(u),message:!0,data:{status:Number}});return 0===p.status&&(j.value=!0),0===p.status},A=()=>{},B={class:"p-24px"},C=m({__name:"index",setup:(e,{expose:s})=>((async()=>{var e,s,a;const{ttl:l}=_.value||{};Object.assign(M.value,{dbIndex:(null==(e=_.value)?void 0:e.dbIndex)||p.value[0].value,key:(null==(s=_.value)?void 0:s.key)||"",value:(null==(a=_.value)?void 0:a.value)||"",expire:_.value?-1e-9===l?0:l:""})})(),c(A),s({onConfirm:W}),(e,s)=>(x(),b("div",B,[v(y(q)),v(y(t),{options:y(f)},null,8,["options"])])))});export{C as default};
