import{a as S}from"./apiAdmin-B6-2qm0d.js";import{_ as y,d as C,e as $,w as t,g as a,i as _,t as f,b as h,a0 as O,k as g,T as w,o as D,u as E}from"./app-D7zH3Nl5.js";import{I as M}from"./index-Cu62pBdq.js";import{_ as T,F as I}from"./index-DZxk72Vu.js";import{B as A}from"./useFlexGapSupport-CpBR-RD-.js";import{M as B}from"./index-fjGxdX_x.js";import{S as P}from"./SaveOutlined-jkHaLNj1.js";import{P as U}from"./index-BUzTR6QN.js";import{_ as q,a as F}from"./index-Cv7zOydE.js";const N=C({props:["formData","data","visible","url","addEditType","pageTitle","successMessage"],components:{PlusOutlined:U,LoadingOutlined:O,SaveOutlined:P},setup(e,{emit:o}){const{addEditRequestAdmin:l,loading:m,rules:n}=S(),r=g([]),d="users?limit=10000";return w(()=>{const s=axiosAdmin.get(d);Promise.all([s]).then(([i])=>{r.value=i.data})}),{loading:m,rules:n,onClose:()=>{n.value={},o("closed")},onSubmit:()=>{l({url:e.url,data:e.formData,successMessage:e.successMessage,success:s=>{o("addEditSuccess",s.xid)}})},users:r,drawerWidth:window.innerWidth<=991?"90%":"45%"}}});function V(e,o,l,m,n,r){const d=M,u=T,c=F,s=q,i=I,v=h("SaveOutlined"),p=A,b=B;return D(),$(b,{open:e.visible,closable:!1,centered:!0,title:e.pageTitle,onOk:e.onSubmit},{footer:t(()=>[a(p,{key:"submit",type:"primary",loading:e.loading,onClick:e.onSubmit},{icon:t(()=>[a(v)]),default:t(()=>[_(" "+f(e.addEditType=="add"?e.$t("common.create"):e.$t("common.update")),1)]),_:1},8,["loading","onClick"]),a(p,{key:"back",onClick:e.onClose},{default:t(()=>[_(f(e.$t("common.cancel")),1)]),_:1},8,["onClick"])]),default:t(()=>[a(i,{layout:"vertical"},{default:t(()=>[a(s,{gutter:16},{default:t(()=>[a(c,{xs:24,sm:24,md:24,lg:24},{default:t(()=>[a(u,{label:e.$t("department.name"),name:"name",help:e.rules.name?e.rules.name.message:null,validateStatus:e.rules.name?"error":null,class:"required"},{default:t(()=>[a(d,{value:e.formData.name,"onUpdate:value":o[0]||(o[0]=k=>e.formData.name=k),placeholder:e.$t("common.placeholder_default_text",[e.$t("department.name")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1})]),_:1})]),_:1},8,["open","title","onOk"])}const Q=y(N,[["render",V]]),X=()=>{const e="departments",{t:o}=E(),l={name:""},m=g([{title:o("department.name"),dataIndex:"name"},{title:o("department.total_employee"),dataIndex:"employee_count"}]),n=[{key:"name",value:o("common.name")}];return{addEditUrl:e,initData:l,columns:m,filterableColumns:n}};export{Q as A,X as f};
