import{W as g,A as S,y as x,t as R,s as U,B as h}from"./element-plus.33d6376e.js";import{d as N,a as I,b as q}from"./department.600e5c35.js";import{P as L}from"./index.4107e0ad.js";import{u as P}from"./useDictOptions.be8eeaaf.js";import{f as T}from"./index.80c2a703.js";import{d as K,s as i,r as M,e as O,$ as W,o as c,c as $,U as l,L as a,K as j,u as f,R as z,a as E}from"./@vue.230e89ba.js";const G={class:"edit-popup"},H=E("div",{class:"form-tips"},"\u9ED8\u8BA4\u4E3A0\uFF0C \u6570\u503C\u8D8A\u5927\u8D8A\u6392\u524D",-1),le=K({__name:"edit",emits:["success","close"],setup(J,{expose:_,emit:r}){const m=i(),d=i(),n=M("add"),F=O(()=>n.value=="edit"?"\u7F16\u8F91\u90E8\u95E8":"\u65B0\u589E\u90E8\u95E8"),u=W({id:"",pid:"",name:"",duty:"",mobile:"",sort:0,isStop:0}),D={pid:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u90E8\u95E8",trigger:["change"]}],name:[{required:!0,message:"\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0",trigger:["blur"]}]},{optionsData:V}=P({dept:{api:N}}),B=async()=>{var t,e;await((t=m.value)==null?void 0:t.validate()),n.value=="edit"?await I(u):await q(u),(e=d.value)==null||e.close(),T.msgSuccess("\u64CD\u4F5C\u6210\u529F"),r("success")},b=(t="add")=>{var e;n.value=t,(e=d.value)==null||e.open()},v=t=>{for(const e in u)t[e]!=null&&t[e]!=null&&(u[e]=t[e])},A=()=>{r("close")};return _({open:b,setFormData:v}),(t,e)=>{const y=g,s=S,p=x,C=R,k=U,w=h;return c(),$("div",G,[l(L,{ref_key:"popupRef",ref:d,title:f(F),async:!0,width:"550px",clickModalClose:!0,onConfirm:B,onClose:A},{default:a(()=>[l(w,{ref_key:"formRef",ref:m,model:u,"label-width":"84px",rules:D},{default:a(()=>[u.pid!==0?(c(),j(s,{key:0,label:"\u4E0A\u7EA7\u90E8\u95E8",prop:"pid"},{default:a(()=>[l(y,{class:"flex-1",modelValue:u.pid,"onUpdate:modelValue":e[0]||(e[0]=o=>u.pid=o),data:f(V).dept,clearable:"","node-key":"id",props:{value:"id",label:"name"},"check-strictly":"","default-expand-all":!0,placeholder:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u90E8\u95E8"},null,8,["modelValue","data"])]),_:1})):z("",!0),l(s,{label:"\u90E8\u95E8\u540D\u79F0",prop:"name"},{default:a(()=>[l(p,{modelValue:u.name,"onUpdate:modelValue":e[1]||(e[1]=o=>u.name=o),placeholder:"\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u8D1F\u8D23\u4EBA",prop:"duty"},{default:a(()=>[l(p,{modelValue:u.duty,"onUpdate:modelValue":e[2]||(e[2]=o=>u.duty=o),placeholder:"\u8BF7\u8F93\u5165\u8D1F\u8D23\u4EBA\u59D3\u540D"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u8054\u7CFB\u7535\u8BDD",prop:"mobile"},{default:a(()=>[l(p,{modelValue:u.mobile,"onUpdate:modelValue":e[3]||(e[3]=o=>u.mobile=o),placeholder:"\u8BF7\u8F93\u5165\u8054\u7CFB\u7535\u8BDD"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u6392\u5E8F",prop:"sort"},{default:a(()=>[E("div",null,[l(C,{modelValue:u.sort,"onUpdate:modelValue":e[4]||(e[4]=o=>u.sort=o)},null,8,["modelValue"]),H])]),_:1}),l(s,{label:"\u90E8\u95E8\u72B6\u6001",prop:"isStop"},{default:a(()=>[l(k,{modelValue:u.isStop,"onUpdate:modelValue":e[5]||(e[5]=o=>u.isStop=o),"active-value":0,"inactive-value":1},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])])}}});export{le as _};
