/** * 由 Fantastic-admin 提供技术支持 * Powered by Fantastic-admin * Gitee https://gitee.com/hooray/fantastic-admin * Github https://github.com/hooray/fantastic-admin */ import{g as z}from"./groupCatApi-1f505a2f.js";import{j as y,J as k,o as x,a3 as u,ad as U,z as B,u as a,k as i,x as b,y as n,l as C,X as F,F as R,r as v,E as r,C as w,B as q}from"./runtime-core.esm-bundler-5fc1c360.js";import{g as P,c as S,u as h}from"./groupApi-dea7fce6.js";import{aU as j}from"./index-5cddd228.js";import{b as N}from"./route-block-83d24a4e.js";import"./menu-2c9c5182.js";import"./settings-be8974ad.js";import"./pinia-7162f4ce.js";import"./_MapCache-1b613190.js";import"./vue-router-8a13d09b.js";import"./index-c228ae8f.js";import"./iframe-10768394.js";import"./runtime-dom.esm-bundler-e65f1c43.js";const A=y({name:"GroupCatSelector"}),J=y({...A,emits:["update:modelValue"],setup(G,{emit:g}){const l=k({loading:!1,groupCatId:0,dataList:[]}),d=async()=>{l.loading=!0;const{data:e}=await z();l.loading=!1,l.dataList=e},c=()=>{g("update:modelValue",l.groupCatId)};return x(()=>{d()}),(e,p)=>{const _=u("el-option"),V=u("el-select"),m=U("loading");return B((i(),b(V,{modelValue:a(l).groupCatId,"onUpdate:modelValue":p[0]||(p[0]=o=>a(l).groupCatId=o),style:{width:"100%"},filterable:"",placeholder:"请选择部门类别","value-key":"groupCatId",onChange:c},{default:n(()=>[(i(!0),C(R,null,F(a(l).dataList,o=>(i(),b(_,{key:o.groupCatId,label:o.groupCatTitle,value:o.groupCatId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])),[[m,a(l).loading]])}}}),X=y({__name:"Group",emits:["success"],setup(G,{expose:g,emit:l}){const d=v(),c=v({groupName:[{required:!0,message:"请输入标题",trigger:"blur"}],roleDesc:[{required:!1,message:"请输入描述",trigger:"blur"}]}),e=k({title:"",dialogVisible:!1,loading:!1,groupParent:void 0,formData:{groupId:0,groupName:"",parentId:0,parentName:"",groupDesc:"",groupCatId:0},actionType:1});x(()=>{});const p=async o=>{e.loading=!0;const{data:t}=await P(o);e.loading=!1,e.formData=t};function _(){d.value&&d.value.validate(async o=>{o&&(e.actionType===1?(await S(e.formData),e.dialogVisible=!1,l("success")):(await h(e.formData),e.dialogVisible=!1,l("success")),j.success({message:"保存成功",center:!0}))})}function V(){e.dialogVisible=!1}function m(){e.formData={groupId:0,groupName:"",groupDesc:"",parentId:0,parentName:"",groupCatId:0}}return g({showAddModel(o,t){m(),e.title="新增部门",e.actionType=1,e.dialogVisible=!0,e.formData.parentId=o,e.formData.parentName=t},showEditModel(o){m(),e.title="编辑部门",e.actionType=2,e.dialogVisible=!0,p(o)}}),(o,t)=>{const D=u("el-input"),f=u("el-form-item"),T=J,L=u("el-form"),I=u("el-button"),E=u("el-dialog"),M=U("loading");return i(),C("div",null,[r(E,{modelValue:a(e).dialogVisible,"onUpdate:modelValue":t[4]||(t[4]=s=>a(e).dialogVisible=s),title:a(e).title,width:"600px","close-on-click-modal":!1,"append-to-body":"","destroy-on-close":""},{footer:n(()=>[r(I,{size:"large",onClick:V},{default:n(()=>[w(" 取消 ")]),_:1}),r(I,{type:"primary",size:"large",onClick:_},{default:n(()=>[w(" 保存 ")]),_:1})]),default:n(()=>[B((i(),C("div",null,[r(L,{ref_key:"formRef",ref:d,model:a(e).formData,rules:a(c),"label-width":"120px","label-suffix":":"},{default:n(()=>[a(e).groupParent?(i(),b(f,{key:0,label:"上级部门"},{default:n(()=>[r(D,{modelValue:a(e).formData.parentName,"onUpdate:modelValue":t[0]||(t[0]=s=>a(e).formData.parentName=s),readonly:""},null,8,["modelValue"])]),_:1})):q("",!0),r(f,{label:"部门名称",prop:"groupName"},{default:n(()=>[r(D,{modelValue:a(e).formData.groupName,"onUpdate:modelValue":t[1]||(t[1]=s=>a(e).formData.groupName=s)},null,8,["modelValue"])]),_:1}),r(f,{label:"类别",prop:"groupCatId"},{default:n(()=>[r(T,{modelValue:a(e).formData.groupCatId,"onUpdate:modelValue":t[2]||(t[2]=s=>a(e).formData.groupCatId=s)},null,8,["modelValue"])]),_:1}),r(f,{label:"说明"},{default:n(()=>[r(D,{modelValue:a(e).formData.groupDesc,"onUpdate:modelValue":t[3]||(t[3]=s=>a(e).formData.groupDesc=s),rows:5,type:"textarea","show-word-limit":"",maxlength:"50"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])])),[[M,a(e).loading]])]),_:1},8,["modelValue","title"])])}}});typeof N=="function"&&N(X);export{X as default};