/* empty css             *//* empty css                   *//* empty css                     *//* empty css                  *//* empty css                        *//* empty css                 *//* empty css                          *//* empty css                  *//* empty css               *//* empty css                    *//* empty css                 *//* empty css                     */import{u as e}from"./useCreate-d1a919fb.js";import{u as a}from"./useShow-5d0f85e9.js";import{d as l,f as r,m as t,x as o,a9 as m,W as p,o as s,l as i,w as n,a as d,e as u,b as c,t as _,s as b,a3 as f,a2 as V,aa as j,S as v,Y as g,$ as y}from"./index-2b50ecca.js";const h={class:"flex justify-end"},U=l({__name:"create",props:{primary:String|Number,api:String},emits:["close"],setup(l,{emit:U}){const x=l,{formData:S,form:w,loading:k,submitForm:C,close:Y,beforeCreate:$,beforeUpdate:q}=e(x.api,x.primary);S.value.sort=1,$.value=()=>{S.value.parent_id=D(S.value.parent_id)},q.value=()=>{S.value.parent_id=D(S.value.parent_id)};const D=e=>void 0===e?0:e[e.length-1];if(x.primary){const{afterShow:e}=a(x.api,x.primary,S);e.value=e=>{const a=r(e);a.parent_id=a.parent_id?[a.parent_id]:0,a.data_range||(a.data_range=null),e.value=a}}const F=t();return o((()=>{m.get(x.api).then((e=>{F.value=e.data.data})),Y((()=>{U("close")}))})),(e,a)=>{const l=b,t=f,o=V,m=j,U=v,x=g,Y=y;return p((s(),i(x,{model:r(S),"label-width":"120px",ref_key:"form",ref:w,class:"pr-4"},{default:n((()=>[d(t,{label:"父级部门",prop:"parent_id"},{default:n((()=>[d(l,{options:F.value,name:"parent_id",modelValue:r(S).parent_id,"onUpdate:modelValue":a[0]||(a[0]=e=>r(S).parent_id=e),clearable:"",props:{value:"id",label:"department_name",checkStrictly:!0},class:"w-full"},null,8,["options","modelValue"])])),_:1}),d(t,{label:"部门名称",prop:"department_name",rules:[{required:!0,message:"部门名称必须填写"}]},{default:n((()=>[d(o,{modelValue:r(S).department_name,"onUpdate:modelValue":a[1]||(a[1]=e=>r(S).department_name=e),name:"department_name",clearable:""},null,8,["modelValue"])])),_:1}),d(t,{label:"部门联系人",prop:"principal"},{default:n((()=>[d(o,{modelValue:r(S).principal,"onUpdate:modelValue":a[2]||(a[2]=e=>r(S).principal=e),name:"principal",clearable:""},null,8,["modelValue"])])),_:1}),d(t,{label:"手机号",prop:"mobile"},{default:n((()=>[d(o,{modelValue:r(S).mobile,"onUpdate:modelValue":a[3]||(a[3]=e=>r(S).mobile=e),name:"mobile",clearable:""},null,8,["modelValue"])])),_:1}),d(t,{label:"邮箱",prop:"email"},{default:n((()=>[d(o,{modelValue:r(S).email,"onUpdate:modelValue":a[4]||(a[4]=e=>r(S).email=e),name:"email",clearable:""},null,8,["modelValue"])])),_:1}),d(t,{label:"排序",prop:"sort"},{default:n((()=>[d(m,{modelValue:r(S).sort,"onUpdate:modelValue":a[5]||(a[5]=e=>r(S).sort=e),name:"sort",min:1},null,8,["modelValue"])])),_:1}),u("div",h,[d(U,{type:"primary",onClick:a[6]||(a[6]=e=>r(C)(r(w)))},{default:n((()=>[c(_(e.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[Y,r(k)]])}}});export{U as _};
