(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d22c324"],{f1cf:function(e,t,i){"use strict";i.r(t);var n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("a-modal",{attrs:{title:e.title,width:e.width,visible:e.visible,confirmLoading:e.confirmLoading,destroyOnClose:!0,cancelText:"关闭"},on:{ok:e.handleOk,cancel:e.handleCancel}},[i("a-spin",{attrs:{spinning:e.confirmLoading}},[i("a-form-model",{ref:"form",attrs:{model:e.model,rules:e.validatorRules}},[i("a-form-model-item",{attrs:{label:"父级节点",labelCol:e.labelCol,wrapperCol:e.wrapperCol,prop:"pid"}},[i("j-tree-select",{ref:"treeSelect",attrs:{placeholder:"请选择父级节点",dict:"sys_category,name,id",pidField:"pid",pidValue:"0",disabled:e.disabled},model:{value:e.model.pid,callback:function(t){e.$set(e.model,"pid",t)},expression:"model.pid"}})],1),i("a-form-model-item",{attrs:{label:"分类名称",labelCol:e.labelCol,wrapperCol:e.wrapperCol,prop:"name"}},[i("a-input",{attrs:{placeholder:"请输入分类名称"},model:{value:e.model.name,callback:function(t){e.$set(e.model,"name",t)},expression:"model.name"}})],1)],1)],1)],1)},s=[],r=i("0fea"),o=i("b098");function a(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function l(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a(Object(i),!0).forEach((function(t){d(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function d(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var c={name:"SysCategoryModal",components:{JTreeSelect:o["default"]},data:function(){return{title:"操作",width:800,visible:!1,model:{},labelCol:{xs:{span:24},sm:{span:5}},wrapperCol:{xs:{span:24},sm:{span:16}},confirmLoading:!1,validatorRules:{pid:{},name:[{required:!0,message:"请输入类型名称!"}]},url:{add:"/sys/category/add",edit:"/sys/category/edit",checkCode:"/sys/category/checkCode"},expandedRowKeys:[],pidField:"pid",subExpandedKeys:[]}},created:function(){},computed:{disabled:function(){return!!this.model.id}},methods:{add:function(){this.edit({})},edit:function(e){this.model=Object.assign({},e),this.visible=!0},close:function(){this.$emit("close"),this.visible=!1,this.$refs.form.resetFields()},handleOk:function(){var e=this,t=this;this.$refs.form.validate((function(i){if(!i)return!1;t.confirmLoading=!0;var n="",s="";e.model.id?(n+=e.url.edit,s="put"):(n+=e.url.add,s="post"),Object(r["h"])(n,e.model,s).then((function(i){i.success?(t.$message.success(i.message),t.submitSuccess(l({},e.model))):t.$message.warning(i.message)})).finally((function(){t.confirmLoading=!1,t.close()}))}))},handleCancel:function(){this.close()},submitSuccess:function(e){if(e.id)this.$emit("ok",e);else{var t=this.$refs.treeSelect.getCurrTreeData();this.expandedRowKeys=[],this.getExpandKeysByPid(e[this.pidField],t,t),e.pid&&0==this.expandedRowKeys.length&&(this.expandedRowKeys=this.subExpandedKeys),this.$emit("ok",e,this.expandedRowKeys.reverse())}},getExpandKeysByPid:function(e,t,i){if(e&&t&&t.length>0)for(var n=0;n<t.length;n++)t[n].key==e?(this.expandedRowKeys.push(t[n].key),this.getExpandKeysByPid(t[n]["parentId"],i,i)):this.getExpandKeysByPid(e,t[n].children,i)}}},p=c,u=i("2877"),m=Object(u["a"])(p,n,s,!1,null,null,null);t["default"]=m.exports}}]);