webpackJsonp([52],{QowZ:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r("0xDb"),o={data:function(){return{visible:!1,deptList:[],deptListTreeProps:{label:"name",children:"children"},roleList:[],dataForm:{id:0,name:"",parentId:0,parentName:"",orderNum:0},dataRule:{name:[{required:!0,message:"必填项不能为空",trigger:"blur"}],parentName:[{required:!0,message:"必填项不能为空",trigger:"change"}],orderNum:[{required:!0,message:"必填项不能为空",trigger:"blur"}]}}},methods:{init:function(){var e=this;this.getDeptList().then(function(){e.visible=!0,e.$nextTick(function(){e.$refs.dataForm.resetFields(),e.dataForm.id&&e.getDeptInfo()})})},getDeptList:function(){var e=this;return this.$http.get(window.SITE_CONFIG.baseURL+"/sys/dept/select").then(function(t){t&&0===t.code&&(e.deptList=Object(a.d)(t.deptList||[],"deptId"))})},getDeptInfo:function(){var e=this;this.$http.get(window.SITE_CONFIG.baseURL+"/sys/dept/info/"+this.dataForm.id).then(function(t){t&&0===t.code&&(e.dataForm.name=t.dept.name,e.dataForm.parentId=t.dept.parentId,e.dataForm.orderNum=t.dept.orderNum,e.$refs.deptListTree.setCurrentKey(e.dataForm.parentId),e.dataForm.parentName=e.dataForm.parentId===e.$refs.deptListTree.getCurrentKey()?e.$refs.deptListTree.getCurrentNode().name:"")})},deptListTreeCurrentChangeHandle:function(e,t){this.dataForm.parentId=e.deptId,this.dataForm.parentName=e.name},dataFormSubmit:function(){var e=this;this.$refs.dataForm.validate(function(t){t&&e.$http.post(window.SITE_CONFIG.baseURL+"/sys/dept/"+(e.dataForm.id?"update":"save"),{deptId:e.dataForm.id||void 0,name:e.dataForm.name,parentId:e.dataForm.parentId,parentName:e.dataForm.parentName,orderNum:e.dataForm.orderNum}).then(function(t){t&&0===t.code&&e.$message({message:"操作成功",type:"success",duration:1500,onClose:function(){e.visible=!1,e.$emit("refreshDataList")}})})})}}},n={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-dialog",{attrs:{title:e.dataForm.id?"修改":"新增","close-on-click-modal":!1,visible:e.visible},on:{"update:visible":function(t){e.visible=t}}},[r("el-form",{ref:"dataForm",attrs:{model:e.dataForm,rules:e.dataRule,"label-width":"80px"},nativeOn:{keyup:function(t){if(!("button"in t)&&e._k(t.keyCode,"enter",13,t.key,"Enter"))return null;e.dataFormSubmit()}}},[r("el-form-item",{attrs:{label:"部门名称",prop:"name"}},[r("el-input",{attrs:{placeholder:"部门名称"},model:{value:e.dataForm.name,callback:function(t){e.$set(e.dataForm,"name",t)},expression:"dataForm.name"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"上级部门",prop:"parentName"}},[r("el-popover",{ref:"deptListPopover",attrs:{placement:"bottom-start",trigger:"click"}},[r("el-tree",{ref:"deptListTree",attrs:{data:e.deptList,props:e.deptListTreeProps,"node-key":"deptId","highlight-current":!0,"expand-on-click-node":!1},on:{"current-change":e.deptListTreeCurrentChangeHandle}})],1),e._v(" "),r("el-input",{directives:[{name:"popover",rawName:"v-popover:deptListPopover",arg:"deptListPopover"}],attrs:{readonly:!0,placeholder:"上级部门"},model:{value:e.dataForm.parentName,callback:function(t){e.$set(e.dataForm,"parentName",t)},expression:"dataForm.parentName"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"排序号",prop:"orderNum"}},[r("el-input-number",{attrs:{"controls-position":"right",min:0,label:"排序号"},model:{value:e.dataForm.orderNum,callback:function(t){e.$set(e.dataForm,"orderNum",t)},expression:"dataForm.orderNum"}})],1)],1),e._v(" "),r("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{on:{click:function(t){e.visible=!1}}},[e._v("取消")]),e._v(" "),r("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dataFormSubmit()}}},[e._v("确定")])],1)],1)},staticRenderFns:[]},d=r("C7Lr")(o,n,!1,null,null,null);t.default=d.exports}});