/* 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-4cdcc37e.js";import{u as a}from"./useShow-897a1bd7.js";import{d as l,f as r,q as t,z as o,ac as m,Z as p,o as s,l as i,w as n,a as d,e as u,b as c,t as _,x as b,a6 as f,a5 as V,ad as j,X as v,a0 as g,a2 as y}from"./index-545c1a76.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:w,form:S,loading:k,submitForm:C,close:q,beforeCreate:z,beforeUpdate:F}=e(x.api,x.primary);w.value.sort=1,z.value=()=>{w.value.parent_id=A(w.value.parent_id)},F.value=()=>{w.value.parent_id=A(w.value.parent_id)};const A=e=>void 0===e?0:e[e.length-1];if(x.primary){const{afterShow:e}=a(x.api,x.primary,w);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 D=t();return o((()=>{m.get(x.api).then((e=>{D.value=e.data.data})),q((()=>{U("close")}))})),(e,a)=>{const l=b,t=f,o=V,m=j,U=v,x=g,q=y;return p((s(),i(x,{model:r(w),"label-width":"120px",ref_key:"form",ref:S,class:"pr-4"},{default:n((()=>[d(t,{label:"父级部门",prop:"parent_id"},{default:n((()=>[d(l,{options:D.value,name:"parent_id",modelValue:r(w).parent_id,"onUpdate:modelValue":a[0]||(a[0]=e=>r(w).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(w).department_name,"onUpdate:modelValue":a[1]||(a[1]=e=>r(w).department_name=e),name:"department_name",clearable:""},null,8,["modelValue"])])),_:1}),d(t,{label:"部门联系人",prop:"principal"},{default:n((()=>[d(o,{modelValue:r(w).principal,"onUpdate:modelValue":a[2]||(a[2]=e=>r(w).principal=e),name:"principal",clearable:""},null,8,["modelValue"])])),_:1}),d(t,{label:"手机号",prop:"mobile"},{default:n((()=>[d(o,{modelValue:r(w).mobile,"onUpdate:modelValue":a[3]||(a[3]=e=>r(w).mobile=e),name:"mobile",clearable:""},null,8,["modelValue"])])),_:1}),d(t,{label:"邮箱",prop:"email"},{default:n((()=>[d(o,{modelValue:r(w).email,"onUpdate:modelValue":a[4]||(a[4]=e=>r(w).email=e),name:"email",clearable:""},null,8,["modelValue"])])),_:1}),d(t,{label:"排序",prop:"sort"},{default:n((()=>[d(m,{modelValue:r(w).sort,"onUpdate:modelValue":a[5]||(a[5]=e=>r(w).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(S)))},{default:n((()=>[c(_(e.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[q,r(k)]])}}});export{U as _};
