popupForm-fb23e790.js 6.3 KB

1
  1. import{h as D,y as I,r as N,F as $,p as u,M as f,N as i,a6 as c,l as z,W as V,V as _,k as e,o as w,q as r,m as P,a0 as h,$ as k,a4 as B,a2 as E,an as W,t as n,a7 as b}from"./vue-a39e6937.js";import{f as K,_ as A}from"./index-ba596ae9.js";import{b as s,r as M}from"./validate-4ecec794.js";import{F as m}from"./index-f0d8af94.js";import{b as R}from"./controllerUrls-941681c3.js";import"./index-434d719f.js";import"./index-7e56a0fa.js";const G={class:"title"},L=D({__name:"popupForm",setup(H){const p=I(),a=W("baTable"),{t:l}=K(),v=N({username:[s({name:"required",title:l("auth.admin.username")}),s({name:"account",message:l("Please enter the correct field",{field:l("auth.admin.username")})})],nickname:[s({name:"required",title:l("auth.admin.nickname")})],group_arr:[s({name:"required",message:l("Please select field",{field:l("auth.admin.grouping")})})],email:[s({name:"email",message:l("Please enter the correct field",{field:l("auth.admin.mailbox")})})],mobile:[s({name:"mobile",message:l("Please enter the correct field",{field:l("auth.admin.mobile")})})],password:[{validator:(g,t,d)=>{if(a.form.operate=="add"){if(!t)return d(new Error(l("Please input field",{field:l("auth.admin.Password")})))}else if(!t)return d();return M(t)?d():d(new Error(l("Please enter the correct field",{field:l("auth.admin.Password")})))},trigger:"blur"}]});return $(()=>a.form.operate,g=>{v.password[0].required=g=="add"}),(g,t)=>{const d=n("el-input"),x=n("el-form-item"),C=n("el-form"),S=n("el-scrollbar"),y=n("el-button"),U=n("el-dialog"),F=b("drag"),j=b("zoom"),T=b("loading"),q=b("blur");return u(),f(U,{class:"ba-operate-dialog","close-on-click-modal":!1,"model-value":!!e(a).form.operate,onClose:e(a).toggleForm},{header:i(()=>[c((u(),z("div",G,[V(_(e(a).form.operate?e(l)(e(a).form.operate):""),1)])),[[F,[".ba-operate-dialog",".el-dialog__header"]],[j,".ba-operate-dialog"]])]),footer:i(()=>[w("div",{style:P("width: calc(100% - "+e(a).form.labelWidth/1.8+"px)")},[r(y,{onClick:t[14]||(t[14]=o=>e(a).toggleForm(""))},{default:i(()=>[V(_(e(l)("Cancel")),1)]),_:1}),c((u(),f(y,{loading:e(a).form.submitLoading,onClick:t[15]||(t[15]=o=>e(a).onSubmit(p.value)),type:"primary"},{default:i(()=>[V(_(e(a).form.operateIds&&e(a).form.operateIds.length>1?e(l)("Save and edit next item"):e(l)("Save")),1)]),_:1},8,["loading"])),[[q]])],4)]),default:i(()=>[c((u(),f(S,{class:"ba-table-form-scrollbar"},{default:i(()=>[w("div",{class:E(["ba-operate-form","ba-"+e(a).form.operate+"-form"]),style:P("width: calc(100% - "+e(a).form.labelWidth/2+"px)")},[e(a).form.loading?B("",!0):(u(),f(C,{key:0,ref_key:"formRef",ref:p,onKeyup:t[13]||(t[13]=h(o=>e(a).onSubmit(p.value),["enter"])),model:e(a).form.items,"label-position":"right","label-width":e(a).form.labelWidth+"px",rules:v},{default:i(()=>[r(m,{label:e(l)("auth.admin.username"),modelValue:e(a).form.items.username,"onUpdate:modelValue":t[0]||(t[0]=o=>e(a).form.items.username=o),type:"string",prop:"username",placeholder:e(l)("auth.admin.Administrator login")},null,8,["label","modelValue","placeholder"]),r(m,{label:e(l)("auth.admin.nickname"),modelValue:e(a).form.items.nickname,"onUpdate:modelValue":t[1]||(t[1]=o=>e(a).form.items.nickname=o),type:"string",prop:"nickname",placeholder:e(l)("Please input field",{field:e(l)("auth.admin.nickname")})},null,8,["label","modelValue","placeholder"]),r(m,{label:e(l)("auth.admin.grouping"),modelValue:e(a).form.items.group_arr,"onUpdate:modelValue":t[2]||(t[2]=o=>e(a).form.items.group_arr=o),prop:"group_arr",type:"remoteSelect","input-attr":{multiple:!0,params:{isTree:!0},field:"name","remote-url":e(R)+"index",placeholder:e(l)("Click Select")}},null,8,["label","modelValue","input-attr"]),r(m,{label:e(l)("department.department.department"),modelValue:e(a).form.items.department_id,"onUpdate:modelValue":t[3]||(t[3]=o=>e(a).form.items.department_id=o),type:"remoteSelect","input-attr":{multiple:!1,params:{isTree:!0},field:"name","remote-url":"/admin/department.department/index",placeholder:e(l)("Click Select")}},null,8,["label","modelValue","input-attr"]),r(m,{label:e(l)("department.jobs.jobs"),modelValue:e(a).form.items.jobs_id,"onUpdate:modelValue":t[4]||(t[4]=o=>e(a).form.items.jobs_id=o),type:"remoteSelect","input-attr":{multiple:!1,params:{isTree:!0},field:"name","remote-url":"/admin/department.jobs/index",placeholder:e(l)("Click Select")}},null,8,["label","modelValue","input-attr"]),r(m,{label:e(l)("auth.admin.head portrait"),type:"image",modelValue:e(a).form.items.avatar,"onUpdate:modelValue":t[5]||(t[5]=o=>e(a).form.items.avatar=o)},null,8,["label","modelValue"]),r(m,{label:e(l)("auth.admin.mailbox"),prop:"email",modelValue:e(a).form.items.email,"onUpdate:modelValue":t[6]||(t[6]=o=>e(a).form.items.email=o),type:"string",placeholder:e(l)("Please input field",{field:e(l)("auth.admin.mailbox")})},null,8,["label","modelValue","placeholder"]),r(m,{label:e(l)("auth.admin.mobile"),prop:"mobile",modelValue:e(a).form.items.mobile,"onUpdate:modelValue":t[7]||(t[7]=o=>e(a).form.items.mobile=o),type:"string",placeholder:e(l)("Please input field",{field:e(l)("auth.admin.mobile")})},null,8,["label","modelValue","placeholder"]),r(m,{label:e(l)("auth.admin.Password"),prop:"password",modelValue:e(a).form.items.password,"onUpdate:modelValue":t[8]||(t[8]=o=>e(a).form.items.password=o),type:"password",placeholder:e(a).form.operate=="add"?e(l)("Please input field",{field:e(l)("auth.admin.Password")}):e(l)("auth.admin.Please leave blank if not modified")},null,8,["label","modelValue","placeholder"]),r(x,{prop:"motto",label:e(l)("auth.admin.Personal signature")},{default:i(()=>[r(d,{onKeyup:[t[9]||(t[9]=h(k(()=>{},["stop"]),["enter"])),t[10]||(t[10]=h(k(o=>e(a).onSubmit(p.value),["ctrl"]),["enter"]))],modelValue:e(a).form.items.motto,"onUpdate:modelValue":t[11]||(t[11]=o=>e(a).form.items.motto=o),type:"textarea",placeholder:e(l)("Please input field",{field:e(l)("auth.admin.Personal signature")})},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),r(m,{label:e(l)("state"),modelValue:e(a).form.items.status,"onUpdate:modelValue":t[12]||(t[12]=o=>e(a).form.items.status=o),type:"radio",data:{content:{0:e(l)("Disable"),1:e(l)("Enable")},childrenAttr:{border:!0}}},null,8,["label","modelValue","data"])]),_:1},8,["model","label-width","rules"]))],6)]),_:1})),[[T,e(a).form.loading]])]),_:1},8,["model-value","onClose"])}}});const le=A(L,[["__scopeId","data-v-a63f3831"]]);export{le as default};