/* 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-74e0ef9a.js";import{u as a}from"./useShow-02d4fd72.js";import{d as l,f as r,m as t,x as o,aa as m,X 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,a4 as f,a3 as V,ab as j,U as v,Z as y,a0 as g}from"./index-0ffeeea6.js";const U={class:"flex justify-end"},h=l({__name:"create",props:{primary:String|Number,api:String},emits:["close"],setup(l,{emit:h}){const x=l,{formData:w,form:k,loading:S,submitForm:C,close:q,beforeCreate:F,beforeUpdate:D}=e(x.api,x.primary);w.value.sort=1,F.value=()=>{w.value.parent_id=E(w.value.parent_id)},D.value=()=>{w.value.parent_id=E(w.value.parent_id)};const E=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 K=t();return o((()=>{m.get(x.api).then((e=>{K.value=e.data.data})),q((()=>{h("close")}))})),(e,a)=>{const l=b,t=f,o=V,m=j,h=v,x=y,q=g;return p((s(),i(x,{model:r(w),"label-width":"120px",ref_key:"form",ref:k,class:"pr-4"},{default:n((()=>[d(t,{label:"父级部门",prop:"parent_id"},{default:n((()=>[d(l,{options:K.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",U,[d(h,{type:"primary",onClick:a[6]||(a[6]=e=>r(C)(r(k)))},{default:n((()=>[c(_(e.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[q,r(S)]])}}});export{h as _};
