(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3b59103a"],{"21f1":function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-container",[n("el-main",[n("el-form",{ref:"addDept",attrs:{model:e.dept,rules:e.rules,"label-width":"80px"}},[n("el-form-item",{attrs:{prop:"parentId",label:"父级"}},[n("el-cascader",{attrs:{"expand-trigger":"hover",options:e.options,"show-all-levels":!1,"change-on-select":""},on:{change:e.handleChange},model:{value:e.selectDeptParents,callback:function(t){e.selectDeptParents=t},expression:"selectDeptParents"}})],1),e._v(" "),n("el-form-item",{attrs:{prop:"name",label:"客户名称"}},[n("el-input",{model:{value:e.dept.name,callback:function(t){e.$set(e.dept,"name",t)},expression:"dept.name"}})],1),e._v(" "),n("el-form-item",{attrs:{prop:"delFlag",label:"可用"}},[n("el-select",{attrs:{placeholder:"选择"},model:{value:e.dept.delFlag,callback:function(t){e.$set(e.dept,"delFlag",t)},expression:"dept.delFlag"}},[n("el-option",{attrs:{label:"可用",value:"0"}}),e._v(" "),n("el-option",{attrs:{label:"不可用",value:"1"}})],1)],1),e._v(" "),n("el-form-item",{attrs:{prop:"distributorNum",label:"渠道商"}},[n("el-input",{model:{value:e.dept.distributorNum,callback:function(t){e.$set(e.dept,"distributorNum",t)},expression:"dept.distributorNum"}})],1),e._v(" "),n("el-form-item",{attrs:{prop:"remark",label:"描述"}},[n("el-input",{model:{value:e.dept.remark,callback:function(t){e.$set(e.dept,"remark",t)},expression:"dept.remark"}})],1),e._v(" "),n("el-form-item",[n("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[e._v("添加")]),e._v(" "),n("el-button",{on:{click:e.toDeptList}},[e._v("取消")])],1)],1)],1)],1)},r=[],l=(n("ac6a"),n("456d"),n("fe05")),s={parentId:"选择父级",name:"客户名称",delFlag:"可用",distributorNum:"渠道商号",remark:"描述"},o={data:function(){var e=function(e,t,n){0===t.length?n(new Error(s[e.field]+"必须填写")):n()};return{loading:!1,dept:{deptId:"",parentId:"",name:"",delFlag:"",distributorNum:"",remark:""},rules:{name:[{validator:e}],delFlag:[{validator:e}]},options:[],selectDeptParents:[]}},mounted:function(){this.selectDeptParent()},methods:{setDefault:function(){this.$refs.addDept.resetFields()},onSubmit:function(){var e=this;this.loading||(this.loading=!0,this.$refs.addDept.validate((function(t,n){if(t)Object(l["a"])(e.dept).then((function(t){var n=t.msg;e.$notify({title:"操作成功",message:n,type:"success",duration:2e3}),e.loading=!1,e.setDefault(),e.toDeptList()})).catch((function(){e.loading=!1}));else{var a=n[Object.keys(n)[0]][0].message;e.$message({message:a,type:"error"}),e.loading=!1}})))},toDeptList:function(){this.$router.push({path:"/system/dept"})},selectDeptParent:function(){var e=this;Object(l["e"])().then((function(t){var n=t.data;e.options=n}))},handleChange:function(e){var t=e.length;t-=1,this.dept.parentId=e[t]}}},i=o,d=n("2877"),u=Object(d["a"])(i,a,r,!1,null,"624cd64e",null);t["default"]=u.exports},fe05:function(e,t,n){"use strict";n.d(t,"c",(function(){return r})),n.d(t,"e",(function(){return l})),n.d(t,"f",(function(){return s})),n.d(t,"a",(function(){return o})),n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return d}));n("7f7f"),n("55dd");var a=n("b775");function r(e){return Object(a["a"])({url:"/sys/dept/list",method:"post",params:{page:e.page,pageSize:e.pageSize,sort:e.sort,name:e.name}})}function l(){return Object(a["a"])({url:"/sys/dept/listAll",method:"post"})}function s(){return Object(a["a"])({url:"/sys/dept/listAllTree",method:"post"})}function o(e){return Object(a["a"])({url:"/sys/dept/add",method:"post",data:e})}function i(e){return Object(a["a"])({url:"/sys/dept/edit",method:"post",data:e})}function d(e){return Object(a["a"])({url:"/sys/dept/delete",method:"post",data:{ids:e}})}}}]);