(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0ef1c0ca"],{"20ca":function(t,e,a){"use strict";a.d(e,"a",(function(){return r}));const r=(t,e)=>{let a,r=e||300;return function(){let e=arguments;a&&clearTimeout(a);let s=!a;a=setTimeout(()=>{a=null},r),s&&t.apply(this,e)}}},"935e":function(t,e,a){"use strict";a.r(e);var r=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{attrs:{title:t.dataForm.currentId?"修改":"新增","close-on-click-modal":!1,visible:t.visible},on:{"update:visible":function(e){t.visible=e}}},[a("el-form",{ref:"dataForm",attrs:{model:t.dataForm,rules:t.dataRule,"label-width":"80px"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.dataFormSubmit()}}},[2!==t.dataForm.type?a("el-form-item",{attrs:{label:"分类图片",prop:"pic"}},[a("pic-upload",{model:{value:t.dataForm.pic,callback:function(e){t.$set(t.dataForm,"pic",e)},expression:"dataForm.pic"}})],1):t._e(),2!==t.dataForm.type?a("el-form-item",{attrs:{label:"分类名称",prop:"categoryName"}},[a("el-input",{attrs:{"controls-position":"right",min:0,label:"分类名称"},model:{value:t.dataForm.categoryName,callback:function(e){t.$set(t.dataForm,"categoryName",e)},expression:"dataForm.categoryName"}})],1):t._e(),a("el-form-item",{attrs:{label:"上级分类"}},[a("el-cascader",{attrs:{"expand-trigger":"hover",options:t.categoryList,props:t.categoryTreeProps,"change-on-select":"",clearable:!0},on:{change:t.handleChange},model:{value:t.selectedCategory,callback:function(e){t.selectedCategory=e},expression:"selectedCategory"}})],1),2!==t.dataForm.type?a("el-form-item",{attrs:{label:"排序号",prop:"seq"}},[a("el-input-number",{attrs:{"controls-position":"right",min:0,label:"排序号"},model:{value:t.dataForm.seq,callback:function(e){t.$set(t.dataForm,"seq",e)},expression:"dataForm.seq"}})],1):t._e(),a("el-form-item",{attrs:{label:"状态",size:"mini",prop:"status"}},[a("el-radio-group",{model:{value:t.dataForm.status,callback:function(e){t.$set(t.dataForm,"status",e)},expression:"dataForm.status"}},[a("el-radio",{attrs:{label:0}},[t._v("下线")]),a("el-radio",{attrs:{label:1}},[t._v("正常")])],1)],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"small"},on:{click:function(e){t.visible=!1}}},[t._v("取消")]),a("el-button",{attrs:{size:"small",type:"primary"},on:{click:function(e){return t.dataFormSubmit()}}},[t._v("确定")])],1)],1)},s=[],o=a("ed08"),i=a("cf95"),l=a("20ca"),d={data(){return{visible:!1,dataForm:{categoryId:0,currentId:0,grade:0,categoryName:"",seq:1,status:1,parentId:0,pic:""},dataRule:{categoryName:[{required:!0,message:"分类名称不能为空",trigger:"blur"},{pattern:/\s\S+|S+\s|\S/,message:"请输入正确的分类名称",trigger:"blur"}],pic:[{required:!0,message:"分类图片不能为空",trigger:"blur"}]},categoryList:[],selectedCategory:[],categoryTreeProps:{value:"categoryId",label:"categoryName"},isSubmit:!1}},components:{PicUpload:i["a"]},methods:{init(t){this.dataForm.currentId=t||0,this.dataForm.categoryId=t||0,this.$http({url:this.$http.adornUrl("/prod/category/listCategory"),method:"get",params:this.$http.adornParams()}).then(({data:t})=>{this.categoryList=Object(o["e"])(t,"categoryId","parentId")}).then(()=>{this.visible=!0,this.$nextTick(()=>{this.$refs["dataForm"].resetFields(),this.selectedCategory=[]})}).then(()=>{this.dataForm.categoryId&&this.$http({url:this.$http.adornUrl("/prod/category/info/"+this.dataForm.categoryId),method:"get",params:this.$http.adornParams()}).then(({data:t})=>{this.dataForm.categoryId=t.categoryId,this.dataForm.categoryName=t.categoryName,this.dataForm.seq=t.seq,this.dataForm.pic=t.pic,this.dataForm.parentId=t.parentId,this.dataForm.status=t.status,this.selectedCategory=Object(o["c"])(this.categoryList,t.parentId,"categoryId","children").reverse()})})},handleChange(t){this.dataForm.parentId=t[t.length-1]},dataFormSubmit:Object(l["a"])((function(){1===this.selectedCategory.length&&(this.dataForm.grade=0),2===this.selectedCategory.length&&(this.dataForm.grade=1),3===this.selectedCategory.length&&(this.dataForm.grade=2),this.$refs["dataForm"].validate(t=>{if(t){if(this.isSubmit)return;this.isSubmit=!0,this.$http({url:this.$http.adornUrl("/prod/category"),method:this.dataForm.categoryId?"put":"post",data:this.$http.adornData({categoryId:this.dataForm.categoryId||void 0,categoryName:this.dataForm.categoryName,status:this.dataForm.status,seq:this.dataForm.seq,grade:this.dataForm.grade,parentId:this.dataForm.parentId,pic:this.dataForm.pic})}).then(({data:t})=>{this.$message({message:"操作成功",type:"success",duration:1e3,onClose:()=>{this.isSubmit=!1,this.visible=!1,this.$emit("refreshDataList")}})})}})}))}},c=d,n=a("2877"),m=Object(n["a"])(c,r,s,!1,null,null,null);e["default"]=m.exports}}]);