var R=Object.defineProperty,V=Object.defineProperties;var A=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var Z=(t,a,e)=>a in t?R(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e,N=(t,a)=>{for(var e in a||(a={}))z.call(a,e)&&Z(t,e,a[e]);if(k)for(var e of k(a))G.call(a,e)&&Z(t,e,a[e]);return t},I=(t,a)=>V(t,A(a));var u=(t,a,e)=>new Promise((g,o)=>{var s=r=>{try{f(e.next(r))}catch(c){o(c)}},y=r=>{try{f(e.throw(r))}catch(c){o(c)}},f=r=>r.done?g(r.value):Promise.resolve(r.value).then(s,y);f((e=e.apply(t,a)).next())});import{u as L}from"./index-dfcd01ad.js";import{u as T}from"./useCurrentInstance-cd4729ef.js";import{d as $,r as w,K as D,L as C,j as v,o as E,h as j,w as m,b as q,e as b,k as O}from"./index-90c78f99.js";const S={class:"dialog-footer"},J=$({__name:"change-user-dialog",props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(t,{emit:a}){const e=t,{proxy:g}=T(),o=w({leaderZwddId:void 0,leaderPhone:void 0,leaderName:void 0}),s=w(!1),y=w(),f=l=>u(this,null,function*(){l&&(yield l.validate(d=>u(this,null,function*(){if(d)try{s.value=!0;const n={applicationCode:e.data&&e.data.applicationCode,applicationStatus:e.data&&e.data.applicationStatus,leaderName:o.value&&o.value.leaderName,leaderPhone:o.value&&o.value.leaderPhone,leaderZwddId:o.value&&o.value.leaderZwddId,buildOrg:e.data&&e.data.buildOrg,buildOrgName:e.data&&e.data.buildOrgName};yield L(n),g.$message.success("修改成功！"),a("close",!0),s.value=!1}catch(n){s.value=!1}})))}),r=w(),c=(l,d)=>u(this,null,function*(){let n;if(l.level){const i=yield C({needMember:!0,organizationCode:l.data.key});n=i&&i.data&&i.data[0]&&i.data[0].children.map(p=>I(N({},p),{disabled:p.type==="ORGANIZATION",isLeaf:p.type==="MEMBER"})),d(n)}}),M=l=>u(this,null,function*(){r.value=[];const d=yield C({needMember:!0,organizationCode:l?void 0:"GO_ff70e47bae684fdba0d64f4acab85661",employeeName:l||""});r.value=d.data.map(n=>I(N({},n),{disabled:n.type==="ORGANIZATION"}))}),P={children:"children",label:"title",value:"key",isLeaf:"isLeaf"},x=l=>{l.type==="MEMBER"&&(o.value={leaderZwddId:l.key,leaderName:l&&l.title,leaderPhone:l&&l.mobile})};return D(()=>e.visible,l=>u(this,null,function*(){if(l){const d=yield C({needMember:!0,onlyUnit:!1,organizationCode:e&&e.data&&e.data.leaderZwddId?void 0:"GO_ff70e47bae684fdba0d64f4acab85661",employeeName:e&&e.data&&e.data.leaderName||""});r.value=d.data,o.value={leaderName:e&&e.data&&e.data.leaderName,leaderPhone:e&&e.data&&e.data.leaderPhone,leaderZwddId:e&&e.data&&e.data.leaderZwddId||void 0}}})),(l,d)=>{const n=v("el-tree-select"),i=v("el-form-item"),p=v("el-form"),h=v("el-button"),B=v("el-dialog");return E(),j(B,{"model-value":t.visible,"destroy-on-close":"",width:"580px",title:"修改应用管理员",onClose:d[3]||(d[3]=_=>a("close"))},{footer:m(()=>[q("span",S,[b(h,{onClick:d[1]||(d[1]=_=>a("close"))},{default:m(()=>[O("取消")]),_:1}),b(h,{type:"primary",loading:s.value,onClick:d[2]||(d[2]=_=>f(y.value))},{default:m(()=>[O(" 确认 ")]),_:1},8,["loading"])])]),default:m(()=>[b(p,{ref_key:"formRef",ref:y,model:o.value,"label-suffix":":"},{default:m(()=>[b(i,{label:"管理员姓名",prop:"leaderZwddId",rules:[{required:!0,message:"请选择应用状态"}]},{default:m(()=>[b(n,{modelValue:o.value.leaderZwddId,"onUpdate:modelValue":d[0]||(d[0]=_=>o.value.leaderZwddId=_),"filter-method":M,filterable:"",data:r.value,props:P,"node-key":"key",lazy:"",load:c,class:"w-full",onNodeClick:x},null,8,["modelValue","data"])]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value"])}}});export{J as default};
