var v=Object.defineProperty;var y=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var D=(e,a,t)=>a in e?v(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,g=(e,a)=>{for(var t in a||(a={}))S.call(a,t)&&D(e,t,a[t]);if(y)for(var t of y(a))k.call(a,t)&&D(e,t,a[t]);return e};var p=(e,a,t)=>new Promise((i,u)=>{var m=n=>{try{r(t.next(n))}catch(l){u(l)}},c=n=>{try{r(t.throw(n))}catch(l){u(l)}},r=n=>n.done?i(n.value):Promise.resolve(n.value).then(m,c);r((t=t.apply(e,a)).next())});import{B as F,u as B}from"./useForm-B-PbqzOc.js";import{b as x,aq as C,v as R,_ as P}from"./entry/index-BOVpYCVt-1731915664217.js";import{a as w,b as q}from"./copyTextToClipboard-7uPthhEV.js";import{g as T}from"./dictionary-7FeiQfIJ.js";import{l as $,d as N,f as A,c as L,u as d,a9 as h,_ as O,a6 as j,a7 as V,k as z,aa as G}from"./vue-B5pbXMv7.js";import{a9 as U}from"./antd-DXvsKA0x.js";import{B as M,a as W}from"./index-CwBw3p8r.js";const{t:o}=x(),se=[{title:o("common.displayName"),dataIndex:"title",width:100},{title:o("sys.dictionary.key"),dataIndex:"key",width:100},{title:o("sys.dictionary.value"),dataIndex:"value",width:100},{title:o("common.status"),dataIndex:"status",width:50,customRender:({record:e})=>(Reflect.has(e,"pendingStatus")||(e.pendingStatus=!1),$(U,{checked:e.status===1,checkedChildren:o("common.on"),unCheckedChildren:o("common.off"),loading:e.pendingStatus,onChange(a,t){e.pendingStatus=!0;const i=a?1:2;w({id:e.id,status:i}).then(()=>{e.status=i}).finally(()=>{e.pendingStatus=!1})}}))},{title:o("common.createTime"),dataIndex:"createdAt",width:70,customRender:({record:e})=>C(e.createdAt)}],ne=[{field:"key",label:o("sys.dictionary.key"),component:"Input",colProps:{span:8}}],E=[{field:"id",label:"ID",component:"Input",show:!1},{field:"title",label:o("common.displayName"),component:"Input",required:!0,rules:[{max:50}]},{field:"key",label:o("sys.dictionary.key"),component:"Input",required:!0,rules:[{max:80}]},{field:"value",label:o("sys.dictionary.value"),component:"Input",required:!0,rules:[{max:100}]},{field:"sort",label:o("common.sort"),component:"InputNumber",required:!0,rules:[{type:"number",max:1e4}]},{field:"status",label:o("common.status"),component:"RadioButtonGroup",defaultValue:1,componentProps:{options:[{label:o("common.on"),value:1},{label:o("common.off"),value:2}]}},{field:"dictionaryId",label:o("sys.dictionary.name"),component:"ApiSelect",required:!0,componentProps:{api:T,params:{page:1,pageSize:1e3},resultField:"data.data",labelField:"title",valueField:"id"}}],H=N({name:"DictionaryDetailDrawer",components:{BasicDrawer:M,BasicForm:F},emits:["success","register"],setup(e,{emit:a}){const t=A(!0),{t:i}=R.useI18n(),[u,{resetFields:m,setFieldsValue:c,validate:r}]=B({labelWidth:160,baseColProps:{span:24},layout:"vertical",schemas:E,showActionButtonGroup:!1}),[n,{setDrawerProps:l,closeDrawer:b}]=W(s=>p(this,null,function*(){m(),l({confirmLoading:!1}),t.value=!!(s!=null&&s.isUpdate);const f=s==null?void 0:s.dictionaryId;d(t)?c(g({},s.record)):c({dictionaryId:f})})),I=L(()=>d(t)?i("sys.dictionary.editDictionaryDetail"):i("sys.dictionary.addDictionaryDetail"));function _(){return p(this,null,function*(){const s=yield r();l({confirmLoading:!0}),s.id=d(t)?Number(s.id):0,(d(t)?yield w(s):yield q(s)).code===0&&(b(),a("success")),l({confirmLoading:!1})})}return{registerDrawer:n,registerForm:u,getTitle:I,handleSubmit:_}}});function J(e,a,t,i,u,m){const c=h("BasicForm"),r=h("BasicDrawer");return O(),j(r,G(e.$attrs,{onRegister:e.registerDrawer,showFooter:"",title:e.getTitle,width:"500px",onOk:e.handleSubmit}),{default:V(()=>[z(c,{onRegister:e.registerForm},null,8,["onRegister"])]),_:1},16,["onRegister","title","onOk"])}const K=P(H,[["render",J]]),ie=Object.freeze(Object.defineProperty({__proto__:null,default:K},Symbol.toStringTag,{value:"Module"}));export{K as D,ie as a,se as c,ne as s};