var U=Object.defineProperty,x=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var b=(r,o,s)=>o in r?U(r,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[o]=s,B=(r,o)=>{for(var s in o||(o={}))q.call(o,s)&&b(r,s,o[s]);if(v)for(var s of v(o))L.call(o,s)&&b(r,s,o[s]);return r},V=(r,o)=>x(r,T(o));import{u as N}from"./index.83bc3204.js";import{F as R}from"./index.41aa7d3c.js";import{a as $,c as z,d as M,e as X}from"./organize.e4627e58.js";import{d as j,c as G,y as g,t as H,X as I,A as J,r as m,a as K,i as u,w as n,o as O,_ as l,$ as P,f as Q,k as W,E as Y}from"./vendor.26ab8f26.js";const Z={class:"department-edit"},ee=Q("div",{class:"muted"},"\u9ED8\u8BA4\u4E3A0\uFF0C \u6570\u503C\u8D8A\u5927\u8D8A\u6392\u524D",-1),ue=W("\u4FDD\u5B58"),de=j({setup(r){const{router:o,route:s}=N(),p=G(()=>{var a;return(a=s.query)==null?void 0:a.id}),_=g(null),D=g([]),{formData:e,rules:y}=H(I({formData:{pid:"",name:"",duty:"",mobile:"",sort:0,isStop:0},rules:{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"]}]}})),A=()=>{$({}).then(a=>{console.log(a,"res"),D.value=F(a)})},F=a=>a.map(i=>{const f=i.children||[];return f.length&&F(f),i.id==p.value||i.isStop==1?i.disabled=!0:i.disabled=!1,i}),h=()=>{!p.value||z({id:p.value}).then(a=>{e.value=a})},w=()=>{var a;(a=_.value)==null||a.validate(t=>{if(!t)return;Array.isArray(e.value.pid)&&(e.value.pid=e.value.pid[e.value.pid.length-1]),(p.value?M(V(B({},e.value),{id:p.value})):X(e.value)).then(()=>{setTimeout(()=>o.go(-1),500),Y({type:"success",message:"\u4FDD\u5B58\u6210\u529F"})})})};return J(()=>{h(),A()}),(a,t)=>{const i=m("el-page-header"),f=m("el-card"),k=m("el-cascader"),c=m("el-form-item"),E=m("el-input"),C=m("el-switch"),S=m("el-button");return O(),K("div",Z,[u(f,{shadow:"never"},{default:n(()=>[u(i,{content:l(p)?"\u7F16\u8F91\u90E8\u95E8":"\u65B0\u589E\u90E8\u95E8",onBack:t[0]||(t[0]=d=>a.$router.back())},null,8,["content"])]),_:1}),u(f,{shadow:"never",class:"m-t-15"},{default:n(()=>[u(l(P),{ref_key:"formRefs",ref:_,rules:l(y),class:"ls-form",model:l(e),"label-width":"150px",size:"small"},{default:n(()=>[u(c,{label:"\u4E0A\u7EA7\u90E8\u95E8",prop:"pid"},{default:n(()=>[u(k,{modelValue:l(e).pid,"onUpdate:modelValue":t[1]||(t[1]=d=>l(e).pid=d),options:D.value,props:{value:"id",label:"name",checkStrictly:!0},clearable:"",disabled:l(e).pid===0&&l(p)},null,8,["modelValue","options","disabled"])]),_:1}),u(c,{label:"\u90E8\u95E8\u540D\u79F0",prop:"name"},{default:n(()=>[u(E,{modelValue:l(e).name,"onUpdate:modelValue":t[2]||(t[2]=d=>l(e).name=d),placeholder:"\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(c,{label:"\u8D1F\u8D23\u4EBA",prop:"duty"},{default:n(()=>[u(E,{modelValue:l(e).duty,"onUpdate:modelValue":t[3]||(t[3]=d=>l(e).duty=d),placeholder:"\u8BF7\u8F93\u5165\u8D1F\u8D23\u4EBA\u59D3\u540D"},null,8,["modelValue"])]),_:1}),u(c,{label:"\u8054\u7CFB\u7535\u8BDD",prop:"mobile"},{default:n(()=>[u(E,{modelValue:l(e).mobile,"onUpdate:modelValue":t[4]||(t[4]=d=>l(e).mobile=d),placeholder:"\u8BF7\u8F93\u5165\u8054\u7CFB\u7535\u8BDD",type:"tel"},null,8,["modelValue"])]),_:1}),u(c,{label:"\u6392\u5E8F",prop:"sort"},{default:n(()=>[u(E,{modelValue:l(e).sort,"onUpdate:modelValue":t[5]||(t[5]=d=>l(e).sort=d),placeholder:"\u8BF7\u8F93\u5165\u6392\u5E8F",type:"number"},null,8,["modelValue"]),ee]),_:1}),u(c,{label:"\u90E8\u95E8\u72B6\u6001"},{default:n(()=>[u(C,{modelValue:l(e).isStop,"onUpdate:modelValue":t[6]||(t[6]=d=>l(e).isStop=d),"active-value":0,"inactive-value":1},null,8,["modelValue"])]),_:1})]),_:1},8,["rules","model"])]),_:1}),u(R,null,{default:n(()=>[u(S,{type:"primary",size:"small",onClick:w},{default:n(()=>[ue]),_:1})]),_:1})])}}});export{de as default};
