DictionaryDrawer-BgCvQ6A0.js 3.7 KB

1
  1. var F=Object.defineProperty;var g=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var D=(e,a,t)=>a in e?F(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,w=(e,a)=>{for(var t in a||(a={}))x.call(a,t)&&D(e,t,a[t]);if(g)for(var t of g(a))R.call(a,t)&&D(e,t,a[t]);return e};var f=(e,a,t)=>new Promise((i,c)=>{var u=o=>{try{r(t.next(o))}catch(m){c(m)}},l=o=>{try{r(t.throw(o))}catch(m){c(m)}},r=o=>o.done?i(o.value):Promise.resolve(o.value).then(u,l);r((t=t.apply(e,a)).next())});import{B as T,u as O}from"./useForm-DYTnyn58.js";import{b as P,aq as $,v as N,u as G,_ as V}from"./entry/index-CP6zkLsN-1726190694502.js";import{u as I,c as j}from"./dictionary-DHwNNDhY.js";import{l as q,d as A,f as b,c as L,u as d,a6 as y,_ as U,a7 as z,ab as M,a8 as h,k as _,G as W,a2 as E,aa as H}from"./vue-CmlY4eyV.js";import{a9 as J}from"./antd-Bp5u6ujY.js";import{B as K,a as Q}from"./index-Bh1SitHa.js";const{t:n}=P(),le=[{title:n("common.displayName"),dataIndex:"trans",width:100},{title:n("sys.dictionary.name"),dataIndex:"name",width:100},{title:n("common.status"),dataIndex:"status",width:50,customRender:({record:e})=>(Reflect.has(e,"pendingStatus")||(e.pendingStatus=!1),q(J,{checked:e.status===1,checkedChildren:n("common.on"),unCheckedChildren:n("common.off"),loading:e.pendingStatus,onChange(a,t){e.pendingStatus=!0;const i=a?1:2;I({id:e.id,status:i}).then(()=>{e.status=i}).finally(()=>{e.pendingStatus=!1})}}))},{title:n("common.createTime"),dataIndex:"createdAt",width:70,customRender:({record:e})=>$(e.createdAt)}],me=[{field:"name",label:n("sys.dictionary.name"),component:"Input",colProps:{span:8},rules:[{min:1,max:50}]}],X=[{field:"id",label:"ID",component:"Input",show:!1},{field:"title",label:n("common.displayName"),component:"Input",required:!0,rules:[{min:1,max:50}]},{field:"name",label:n("sys.dictionary.name"),component:"Input",required:!0,rules:[{min:1,max:50}]},{field:"desc",label:n("common.description"),component:"Input",rules:[{max:200}]},{field:"status",label:n("common.status"),component:"RadioButtonGroup",defaultValue:1,componentProps:{options:[{label:n("common.on"),value:1},{label:n("common.off"),value:2}]}}],Y=A({name:"DictionaryDrawer",components:{BasicDrawer:K,BasicForm:T},emits:["success","register"],setup(e,{emit:a}){const t=b(!0),{t:i}=N.useI18n(),c=b(0),u=G(),[l,{resetFields:r,setFieldsValue:o,validate:m}]=O({labelWidth:160,baseColProps:{span:24},layout:"vertical",schemas:X,showActionButtonGroup:!1}),[S,{setDrawerProps:p,closeDrawer:v}]=Q(s=>f(this,null,function*(){r(),p({confirmLoading:!1}),t.value=!!(s!=null&&s.isUpdate),d(t)&&(o(w({},s.record)),c.value=s.record.id)})),B=L(()=>d(t)?i("sys.dictionary.editDictionary"):i("sys.dictionary.addDictionary"));function k(){return f(this,null,function*(){const s=yield m();p({confirmLoading:!0}),s.id=d(t)?Number(s.id):0,(d(t)?yield I(s):yield j(s)).code===0&&(v(),a("success")),p({confirmLoading:!1})})}function C(){u("/dictionary/detail/"+c.value)}return{registerDrawer:S,registerForm:l,getTitle:B,handleSubmit:k,isUpdate:t,t:i,handleOpenDetail:C}}});function Z(e,a,t,i,c,u){const l=y("BasicForm"),r=y("a-button"),o=y("BasicDrawer");return U(),z(o,H(e.$attrs,{onRegister:e.registerDrawer,showFooter:"",title:e.getTitle,width:"500px",onOk:e.handleSubmit}),M({default:h(()=>[_(l,{onRegister:e.registerForm},null,8,["onRegister"])]),_:2},[e.isUpdate?{name:"extra",fn:h(()=>[_(r,{type:"primary",style:{"margin-right":"8px"},onClick:e.handleOpenDetail},{default:h(()=>[W(E(e.t("sys.dictionary.addDictionaryDetail")),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1040,["onRegister","title","onOk"])}const ee=V(Y,[["render",Z]]),ue=Object.freeze(Object.defineProperty({__proto__:null,default:ee},Symbol.toStringTag,{value:"Module"}));export{ee as D,ue as a,le as c,me as s};