RoleForm-4a2d9daf.js 4.5 KB

1
  1. import{d as N,h as O,r as n,e as B,o as i,v as g,w as a,f as e,a as l,n as x,x as I,c as L,F as M,q as j,O as G,V as H,A as J,E as P,i as K,y as Q,z as W,D as X,C as Y,I as Z,_ as $,__tla as ee}from"./index-e3afde76.js";import{_ as ae,__tla as le}from"./Dialog-c20523c4.js";import{a as te,D as re,__tla as se}from"./dict-a141296d.js";import{C as U}from"./constants-40f13f5e.js";import{a as ue,c as oe,u as de,__tla as me}from"./index-b4090625.js";import{u as ne,__tla as ce}from"./useMessage-0b1b25bd.js";let T,_e=Promise.all([(()=>{try{return ee}catch{}})(),(()=>{try{return le}catch{}})(),(()=>{try{return se}catch{}})(),(()=>{try{return me}catch{}})(),(()=>{try{return ce}catch{}})()]).then(async()=>{T=$(N({name:"SystemRoleForm",__name:"RoleForm",emits:["success"],setup(pe,{expose:q,emit:C}){const{t:f}=O(),V=ne(),o=n(!1),h=n(""),d=n(!1),b=n(""),s=n({id:void 0,name:"",code:"",sort:void 0,status:U.ENABLE,remark:"",roleType:1}),E=B({name:[{required:!0,message:"\u5C97\u4F4D\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],code:[{required:!0,message:"\u5C97\u4F4D\u7F16\u7801\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}],sort:[{required:!0,message:"\u5C97\u4F4D\u987A\u5E8F\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}],status:[{required:!0,message:"\u5C97\u4F4D\u72B6\u6001\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}],remark:[{required:!1,message:"\u5C97\u4F4D\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),_=n(),F=()=>{var u;s.value={id:void 0,name:"",code:"",sort:void 0,status:U.ENABLE,remark:"",roleType:1},(u=_.value)==null||u.resetFields()};q({open:async(u,t)=>{if(o.value=!0,h.value=f("action."+u),b.value=u,F(),t){d.value=!0;try{s.value=await ue(t)}finally{d.value=!1}}}});const S=C,A=async()=>{if(_&&await _.value.validate()){d.value=!0;try{const u=s.value;b.value==="create"?(await oe(u),V.success(f("common.createSuccess"))):(await de(u),V.success(f("common.updateSuccess"))),o.value=!1,S("success")}finally{d.value=!1}}};return(u,t)=>{const p=H,m=J,c=P,v=K,y=Q,k=W,z=X,w=Y,R=ae,D=Z;return i(),g(R,{modelValue:l(o),"onUpdate:modelValue":t[7]||(t[7]=r=>G(o)?o.value=r:null),title:l(h)},{footer:a(()=>[e(w,{disabled:l(d),type:"primary",onClick:A},{default:a(()=>[x("\u786E \u5B9A")]),_:1},8,["disabled"]),e(w,{onClick:t[6]||(t[6]=r=>o.value=!1)},{default:a(()=>[x("\u53D6 \u6D88")]),_:1})]),default:a(()=>[I((i(),g(z,{ref_key:"formRef",ref:_,model:l(s),rules:l(E),"label-width":"120x",style:{padding:"10px"}},{default:a(()=>[e(v,{gutter:30},{default:a(()=>[e(c,{span:"12"},{default:a(()=>[e(m,{label:"\u89D2\u8272\u540D\u79F0",prop:"name"},{default:a(()=>[e(p,{modelValue:l(s).name,"onUpdate:modelValue":t[0]||(t[0]=r=>l(s).name=r),placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(c,{span:"12"},{default:a(()=>[e(m,{label:"\u89D2\u8272\u6807\u8BC6",prop:"code"},{default:a(()=>[e(p,{modelValue:l(s).code,"onUpdate:modelValue":t[1]||(t[1]=r=>l(s).code=r),placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u6807\u8BC6"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(v,{gutter:30},{default:a(()=>[e(c,{span:"12"},{default:a(()=>[e(m,{label:"\u663E\u793A\u987A\u5E8F",prop:"sort"},{default:a(()=>[e(p,{modelValue:l(s).sort,"onUpdate:modelValue":t[2]||(t[2]=r=>l(s).sort=r),placeholder:"\u8BF7\u8F93\u5165\u663E\u793A\u987A\u5E8F"},null,8,["modelValue"])]),_:1})]),_:1}),e(c,{span:"12"},{default:a(()=>[e(m,{label:"\u72B6\u6001",prop:"status"},{default:a(()=>[e(k,{modelValue:l(s).status,"onUpdate:modelValue":t[3]||(t[3]=r=>l(s).status=r),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001"},{default:a(()=>[(i(!0),L(M,null,j(l(te)(l(re).COMMON_STATUS),r=>(i(),g(y,{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(v,{gutter:30},{default:a(()=>[e(c,{span:"24"},{default:a(()=>[e(m,{label:"\u7528\u6237\u7C7B\u522B",prop:"roleType"},{default:a(()=>[e(k,{modelValue:l(s).roleType,"onUpdate:modelValue":t[4]||(t[4]=r=>l(s).roleType=r),placeholder:"\u8BF7\u9009\u62E9"},{default:a(()=>[e(y,{label:"\u5E73\u53F0\u89D2\u8272",value:1}),e(y,{label:"\u5E97\u94FA\u89D2\u8272",value:2})]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(m,{label:"\u5907\u6CE8",prop:"remark"},{default:a(()=>[e(p,{style:{width:"430px"},modelValue:l(s).remark,"onUpdate:modelValue":t[5]||(t[5]=r=>l(s).remark=r),placeholder:"\u8BF7\u8F93\u5907\u6CE8",type:"textarea"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[D,l(d)]])]),_:1},8,["modelValue","title"])}}}),[["__scopeId","data-v-94ce70f8"],["__file","D:/zx/mall-newfeifan-zx-admin/src/views/system/role/RoleForm.vue"]])});export{_e as __tla,T as default};