(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-75bd1595","chunk-2d0b8b5f"],{"309e":function(e,t,a){"use strict";a.r(t);a("4de4"),a("d81d"),a("b64b"),a("d3b7");var r=a("fcb7"),o=a("2dd7"),l=a("6b01");t["default"]={name:"CreateForm",props:{deptTypeOptions:{type:Array,required:!0},statusOptions:{type:Array,required:!0},deptOptions:{type:Array,required:!0},expandedKeys:{type:Array,required:!0}},components:{AntModal:o["a"],SelectDept:l["a"]},data:function(){return{loading:!1,parentIdShow:!1,hasChild:!1,selectScope:"all",deptTypeEnableValue:[],formTitle:"",currentRow:void 0,oldParentId:"",spinning:!1,delayTime:200,customStyle:"background: #fff;ssborder-radius: 4px;margin-bottom: 24px;border: 0;overflow: hidden",form:{id:void 0,parentId:void 0,deptCode:void 0,deptName:void 0,deptFullName:void 0,treeSort:0,deptType:"dept",leader:void 0,phone:void 0,address:void 0,zipCode:void 0,email:void 0,status:"0"},open:!1,rules:{parentId:[{required:!0,message:"上级部门不能为空",trigger:"blur"}],deptCode:[{required:!0,message:"部门编码不能为空",trigger:"blur"}],deptType:[{required:!0,message:"部门类型不能为空",trigger:"blur"}],deptName:[{required:!0,message:"部门名称不能为空",trigger:"blur"}],treeSort:[{required:!0,message:"排序不能为空",trigger:"blur"}],email:[{type:"email",message:"请输入正确的邮箱地址",trigger:["blur","change"]}],phone:[{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:"请输入正确的手机号码",trigger:"blur"}]}}},filters:{},created:function(){},computed:{},watch:{},methods:{onDeptTypeChange:function(e){"company"===e.target.value?this.selectScope="nonDept":this.selectScope="all"},onSelectDept:function(e){this.getDeptTypeEnableValue(e.types)},cancel:function(){this.open=!1,this.$emit("close")},reset:function(){void 0!==this.$refs.form&&this.$refs.form.resetFields()},getDeptTypeEnableValue:function(e){var t=this.form.id;if(this.deptTypeEnableValue="org"===e||"company"===e?this.deptTypeOptions.filter((function(e){return"org"!==e.dictValue})).map((function(e){return e.dictValue})):this.deptTypeOptions.filter((function(e){return"dept"===e.dictValue})).map((function(e){return e.dictValue})),null!==t&&""!==t&&"undefined"!==t&&void 0!==t){null===e&&(this.deptTypeEnableValue=this.deptTypeOptions.filter((function(e){return"org"===e.dictValue})).map((function(e){return e.dictValue})));var a=this.form.deptType,r=this.deptTypeEnableValue.filter((function(e){return e===a}));this.form.deptType=0===r.length?this.deptTypeEnableValue[0]:a}else this.form.deptType=this.deptTypeEnableValue[0]},handleAdd:function(e){var t=this;this.parentIdShow=!0,this.oldParentId="",this.deptTypeEnableValue=this.deptTypeOptions.map((function(e){return e.dictValue})),void 0!==e&&(this.currentRow=e,this.oldParentId=e.id,this.form.parentId={ids:e.id,names:e.deptName},this.getDeptTypeEnableValue(e.deptType)),Object(r["d"])(void 0!==e?e.id:"0").then((function(e){t.form.treeSort=e.data})),this.$emit("getTreeselect"),this.formTitle="添加部门",this.open=!0},setNodeData:function(e){this.currentRow.deptName=e.deptName,this.currentRow.deptCode=e.deptCode,this.currentRow.leader=e.leader,this.currentRow.phone=e.phone,this.currentRow.email=e.email,this.currentRow.status=e.status,this.currentRow.treeSort=e.treeSort,this.currentRow.createTime=e.createTime,this.currentRow.deptType=e.deptType},handleUpdate:function(e){var t=this;this.currentRow=e,this.open=!0,this.formTitle="修改部门",this.hasChild=e.children.length>0,this.spinning=!this.spinning;var a=e.id;Object(r["e"])(a).then((function(e){t.oldParentId=e.data.parentId,t.form=e.data,"0"!==e.data.parentId?(t.parentIdShow=!0,t.getDeptTypeEnableValue(e.data.parentDeptType)):(t.parentIdShow=!1,t.getDeptTypeEnableValue(null)),"company"===e.data.deptType&&(t.selectScope="nonDept"),t.form.parentId={ids:e.data.parentId,names:e.data.parentName},t.spinning=!t.spinning})),this.$emit("getTreeselect",e)},submitForm:function(){var e=this;this.$refs.form.validate((function(t){if(!t)return!1;var a=JSON.parse(JSON.stringify(e.form));void 0!==e.form.parentId&&(a.parentId=e.form.parentId.ids),void 0!==e.form.id?Object(r["o"])(a).then((function(t){e.$message.success("修改成功",3),e.oldParentId!==e.form.parentId.ids?e.$emit("ok"):e.setNodeData(t.data),e.cancel()})):Object(r["a"])(a).then((function(t){e.$message.success("新增成功",3),e.oldParentId!==e.form.parentId.ids?e.$emit("ok"):e.appendTreeNode(e.currentRow,t.data),e.cancel()}))}))},onLoadData:function(e){return new Promise((function(t){e.dataRef.children?t():Object(r["i"])(e.dataRef.id,1).then((function(a){e.dataRef.children=a.data,t()}))}))}}}},a839:function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e._self._c;return t("a-drawer",{attrs:{width:"480",title:e.formTitle,"label-col":4,"wrapper-col":14,visible:e.open,"body-style":{height:"calc(100vh - 100px)",overflow:"auto"}},on:{close:e.cancel}},[t("a-form-model",{ref:"form",attrs:{model:e.form,rules:e.rules,layout:"vertical"}},[t("a-spin",{attrs:{spinning:e.spinning,delay:e.delayTime,tip:"Loading..."}},[t("a-row",{staticClass:"form-row",attrs:{gutter:32}},[t("a-col",{attrs:{lg:12,md:12,sm:24}},[e.parentIdShow?t("a-form-model-item",{attrs:{label:"上级部门",prop:"parentId"}},[t("select-dept",{attrs:{"select-model":"single","select-scope":e.selectScope},on:{callBack:e.onSelectDept},model:{value:e.form.parentId,callback:function(t){e.$set(e.form,"parentId",t)},expression:"form.parentId"}})],1):e._e()],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"部门编码",prop:"deptCode"}},[t("a-input",{attrs:{placeholder:"请输入"},model:{value:e.form.deptCode,callback:function(t){e.$set(e.form,"deptCode",t)},expression:"form.deptCode"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"部门名称",prop:"deptName"}},[t("a-input",{attrs:{placeholder:"请输入"},model:{value:e.form.deptName,callback:function(t){e.$set(e.form,"deptName",t)},expression:"form.deptName"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"部门全称",prop:"deptFullName"}},[t("a-input",{attrs:{placeholder:"请输入"},model:{value:e.form.deptFullName,callback:function(t){e.$set(e.form,"deptFullName",t)},expression:"form.deptFullName"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"排序",prop:"treeSort"}},[t("a-input-number",{staticStyle:{width:"100%"},attrs:{min:0},model:{value:e.form.treeSort,callback:function(t){e.$set(e.form,"treeSort",t)},expression:"form.treeSort"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"类型",prop:"deptType"}},[t("a-radio-group",{attrs:{"button-style":"solid"},on:{change:e.onDeptTypeChange},model:{value:e.form.deptType,callback:function(t){e.$set(e.form,"deptType",t)},expression:"form.deptType"}},e._l(e.deptTypeOptions,(function(a,r){return t("a-radio-button",{key:r,attrs:{disabled:-1===e.deptTypeEnableValue.indexOf(a.dictValue),value:a.dictValue}},[e._v(e._s(a.dictLabel))])})),1)],1)],1)],1),t("a-collapse",{attrs:{bordered:!1,expandIconPosition:"left"},scopedSlots:e._u([{key:"expandIcon",fn:function(e){return[t("a-icon",{attrs:{type:"caret-right",rotate:e.isActive?90:0}})]}}])},[t("a-collapse-panel",{key:"1",style:e.customStyle,attrs:{header:"详细信息"}},[t("a-row",{attrs:{gutter:32}},[t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"负责人",prop:"leader"}},[t("a-input",{attrs:{placeholder:"请输入"},model:{value:e.form.leader,callback:function(t){e.$set(e.form,"leader",t)},expression:"form.leader"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"办公电话",prop:"phone"}},[t("a-input",{attrs:{placeholder:"请输入"},model:{value:e.form.phone,callback:function(t){e.$set(e.form,"phone",t)},expression:"form.phone"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"联系地址",prop:"address"}},[t("a-input",{attrs:{placeholder:"请输入"},model:{value:e.form.address,callback:function(t){e.$set(e.form,"address",t)},expression:"form.address"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"邮政编码",prop:"zipCode"}},[t("a-input",{attrs:{placeholder:"请输入"},model:{value:e.form.zipCode,callback:function(t){e.$set(e.form,"zipCode",t)},expression:"form.zipCode"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"电子邮箱",prop:"email"}},[t("a-input",{attrs:{placeholder:"请输入"},model:{value:e.form.email,callback:function(t){e.$set(e.form,"email",t)},expression:"form.email"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:"状态",prop:"status"}},[t("a-radio-group",{attrs:{"button-style":"solid"},model:{value:e.form.status,callback:function(t){e.$set(e.form,"status",t)},expression:"form.status"}},e._l(e.statusOptions,(function(a,r){return t("a-radio-button",{key:r,attrs:{value:a.dictValue}},[e._v(e._s(a.dictLabel))])})),1)],1)],1),t("a-col",{attrs:{lg:24,md:24,sm:24,span:24}},[t("a-form-model-item",{attrs:{label:"备注",prop:"remark"}},[t("a-input",{attrs:{placeholder:"请输入",type:"textarea","allow-clear":""},model:{value:e.form.remark,callback:function(t){e.$set(e.form,"remark",t)},expression:"form.remark"}})],1)],1)],1)],1)],1)],1),t("div",{staticClass:"bottom-control"},[t("a-space",[t("a-button",{attrs:{type:"primary"},on:{click:e.submitForm}},[e._v(" 保存 ")]),t("a-button",{on:{click:e.cancel}},[e._v(" 取消 ")])],1)],1)],1)],1)},o=[],l=a("5530"),n=a("309e"),s=Object(l["a"])({},n["default"]),d=s,i=a("2877"),p=Object(i["a"])(d,r,o,!1,null,null,null);t["default"]=p.exports}}]);