import{a as S}from"./apiAdmin-DKbjyhIh.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-Bei_nIK3.js";import{I as M}from"./index-Cx28gitG.js";import{_ as T,F as I}from"./index-CvmHj1Ev.js";import{B as A}from"./useFlexGapSupport-I9-A4OAO.js";import{M as B}from"./index-BV9s-9gS.js";import{S as P}from"./SaveOutlined-BL7Iw8CQ.js";import{P as U}from"./index-DFCCKFU7.js";import{_ as q,a as F}from"./index-DxFi17QQ.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};
