/*!
 *  build: vue-admin-beautiful 
 *  vue-admin-beautiful author: chuzhixin 1204505056@qq.com 
 *  vue-admin-beautiful QQ Group(QQ群): 972435319、1139183756 
 *  time: 2024-10-10 11:14:28
 */
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-70c50d06"],{"074c":function(e,t,o){},"2f10":function(e,t,o){"use strict";o.r(t);var d=o("f2bf");const l={class:"dialog-footer"};function a(e,t,o,a,r,i){const s=Object(d["resolveComponent"])("el-input"),c=Object(d["resolveComponent"])("el-form-item"),n=Object(d["resolveComponent"])("el-option"),p=Object(d["resolveComponent"])("el-select"),u=Object(d["resolveComponent"])("el-form"),m=Object(d["resolveComponent"])("el-button"),f=Object(d["resolveComponent"])("el-dialog");return Object(d["openBlock"])(),Object(d["createBlock"])(f,{modelValue:r.dialogFormVisible,"onUpdate:modelValue":t[2]||(t[2]=e=>r.dialogFormVisible=e),title:r.title,width:"500px",onClose:i.close},{default:Object(d["withCtx"])(()=>[Object(d["createVNode"])(u,{ref:"form",model:r.form,rules:r.rules,"label-width":"80px"},{default:Object(d["withCtx"])(()=>[Object(d["createVNode"])(c,{label:"部门名称",prop:"deptName"},{default:Object(d["withCtx"])(()=>[Object(d["createVNode"])(s,{modelValue:r.form.deptName,"onUpdate:modelValue":t[0]||(t[0]=e=>r.form.deptName=e),modelModifiers:{trim:!0},autocomplete:"off"},null,8,["modelValue"])]),_:1}),Object(d["createVNode"])(c,{label:"上级部门",prop:"parentId"},{default:Object(d["withCtx"])(()=>[Object(d["createVNode"])(p,{modelValue:r.form.parentId,"onUpdate:modelValue":t[1]||(t[1]=e=>r.form.parentId=e),placeholder:"请选择上级部门"},{default:Object(d["withCtx"])(()=>[(Object(d["openBlock"])(!0),Object(d["createElementBlock"])(d["Fragment"],null,Object(d["renderList"])(r.deptData,e=>(Object(d["openBlock"])(),Object(d["createBlock"])(n,{key:e.deptId,label:e.deptName,value:e.deptId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"]),Object(d["createElementVNode"])("div",l,[Object(d["createVNode"])(m,{type:"primary",size:"small",onClick:i.save},{default:Object(d["withCtx"])(()=>t[3]||(t[3]=[Object(d["createTextVNode"])("确 定")])),_:1},8,["onClick"]),Object(d["createVNode"])(m,{size:"small",onClick:i.close},{default:Object(d["withCtx"])(()=>t[4]||(t[4]=[Object(d["createTextVNode"])("取 消")])),_:1},8,["onClick"])])]),_:1},8,["modelValue","title","onClose"])}o("14d9");var r=o("fe05"),i={data(){return{form:{deptId:"",parentId:"",deptName:""},rules:{deptName:[{required:!0,trigger:"blur",message:"请输入部门名称"}]},clearable:!0,deptData:[],title:"",dialogFormVisible:!1}},created(){},methods:{async getDeptData(){const{data:e}=await Object(r["getDeptList"])();e.push({deptId:0,deptName:"顶级部门"}),this.deptData=e},deptEdit(e){this.getDeptData(),e?(this.title="编辑部门",this.form.deptId=e.id,this.form.parentId=e.parentId,this.form.deptName=e.label):this.title="添加部门",this.dialogFormVisible=!0},close(){this.$refs["form"].resetFields(),this.form=this.$options.data().form,this.dialogFormVisible=!1,this.$emit("fetch-data")},save(){this.$refs["form"].validate(async e=>{if(!e)return!1;if(this.form.name=this.form.title,this.form.deptId){const{msg:e}=await Object(r["doDeptEdit"])(this.form);this.$notify({title:e,type:"success"})}else{delete this.form.deptId;const{msg:e}=await Object(r["doDeptAdd"])(this.form);this.$notify({title:e,type:"success"})}this.$refs["form"].resetFields(),this.dialogFormVisible=!1,this.$parent.fetchData()})}}},s=(o("e463"),o("d959")),c=o.n(s);const n=c()(i,[["render",a]]);t["default"]=n},e463:function(e,t,o){"use strict";o("074c")},fe05:function(e,t,o){"use strict";o.r(t),o.d(t,"getDeptList",(function(){return l})),o.d(t,"getDeptTreeList",(function(){return a})),o.d(t,"doDeptDelete",(function(){return r})),o.d(t,"doDeptEdit",(function(){return i})),o.d(t,"doDeptAdd",(function(){return s}));var d=o("b775");function l(e){return Object(d["default"])({url:"/sysDept/list",method:"get",data:e})}function a(e){return Object(d["default"])({url:"/sysDept/deptTree",method:"get",data:e})}function r(e){return Object(d["default"])({url:"/sysDept/delete?deptId="+e.deptId,method:"post",data:e})}function i(e){return Object(d["default"])({url:"/sysDept/update",method:"post",data:e})}function s(e){return Object(d["default"])({url:"/sysDept/add",method:"post",data:e})}}}]);