var v=Object.defineProperty;var m=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var u=(t,o,e)=>o in t?v(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(t,o)=>{for(var e in o||(o={}))F.call(o,e)&&u(t,e,o[e]);if(m)for(var e of m(o))I.call(o,e)&&u(t,e,o[e]);return t};var p=(t,o,e)=>new Promise((l,s)=>{var d=a=>{try{n(e.next(a))}catch(r){s(r)}},i=a=>{try{n(e.throw(a))}catch(r){s(r)}},n=a=>a.done?l(a.value):Promise.resolve(a.value).then(d,i);n((e=e.apply(t,o)).next())});import{l as P,d as S,f as k,u as g,e as w,U as b,a2 as y,ad as D,af as N,k as T,ag as x}from"./vue-vendor-CxLCUzY4.js";import{B as R}from"./index-D2AmS0aU.js";import"./index-ARbUvvsq.js";import{Y as $}from"./antd-vue-vendor-CDWW6V_M.js";import{a as q}from"./system-CPwSAvs9.js";import{u as C,B as L}from"./useForm-CcjrODHR.js";import{a8 as O,_ as U}from"./index-B_2CoVdl.js";const X=[{title:"部门名称",dataIndex:"deptName",width:160,align:"left"},{title:"排序",dataIndex:"orderNo",width:50},{title:"状态",dataIndex:"status",width:80,customRender:({record:t})=>{const e=~~t.status===0,l=e?"green":"red",s=e?"启用":"停用";return P($,{color:l},()=>s)}},{title:"创建时间",dataIndex:"createTime",width:180},{title:"备注",dataIndex:"remark"}],Z=[{field:"deptName",label:"部门名称",component:"Input",colProps:{span:8}},{field:"status",label:"状态",component:"Select",componentProps:{options:[{label:"启用",value:"0"},{label:"停用",value:"1"}]},colProps:{span:8}}],V=[{field:"deptName",label:"部门名称",component:"Input",required:!0},{field:"parentDept",label:"上级部门",component:"TreeSelect",componentProps:{replaceFields:{title:"deptName",key:"id",value:"id"},getPopupContainer:()=>document.body},required:!0},{field:"orderNo",label:"排序",component:"InputNumber",required:!0},{field:"status",label:"状态",component:"RadioButtonGroup",defaultValue:"0",componentProps:{options:[{label:"启用",value:"0"},{label:"停用",value:"1"}]},required:!0},{label:"备注",field:"remark",component:"InputTextArea"}],j=S({name:"DeptModal",components:{BasicModal:R,BasicForm:L},emits:["success","register"],setup(t,{emit:o}){const e=k(!0),[l,{resetFields:s,setFieldsValue:d,updateSchema:i,validate:n}]=C({labelWidth:100,schemas:V,showActionButtonGroup:!1}),[a,{setModalProps:r,closeModal:h}]=O(c=>p(this,null,function*(){s(),r({confirmLoading:!1}),e.value=!!(c!=null&&c.isUpdate),g(e)&&d(f({},c.record));const M=yield q();i({field:"parentDept",componentProps:{treeData:M}})})),_=w(()=>g(e)?"编辑部门":"新增部门");function B(){return p(this,null,function*(){try{const c=yield n();r({confirmLoading:!0}),h(),o("success")}finally{r({confirmLoading:!1})}})}return{registerModal:a,registerForm:l,getTitle:_,handleSubmit:B}}});function A(t,o,e,l,s,d){const i=b("BasicForm"),n=b("BasicModal");return y(),D(n,x(t.$attrs,{onRegister:t.registerModal,title:t.getTitle,onOk:t.handleSubmit}),{default:N(()=>[T(i,{onRegister:t.registerForm},null,8,["onRegister"])]),_:1},16,["onRegister","title","onOk"])}const G=U(j,[["render",A]]),ee=Object.freeze(Object.defineProperty({__proto__:null,default:G},Symbol.toStringTag,{value:"Module"}));export{G as D,ee as a,X as c,Z as s};
