webpackJsonp([54],{H2kl:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=a("aA9S"),s=a.n(i),r=a("osGO"),o=a.n(r),n={data:function(){return{visible:!1,isEdit:!1,isDisable:!1,cancelText:"关闭",dataForm:{name:"",no:"",desc:""},dataRule:{name:[{required:!0,message:"请输入分组名称",trigger:"blur"}],no:[{required:!0,message:"请输入分组编码",trigger:"blur"}]},apiData:{}}},methods:{init:function(){var t=this;this.visible=!0,this.$nextTick(function(){t.resetForm(),t.dataForm.id?(t.isEdit=!0,t.isDisable=!0,t.getGroup()):(t.isEdit=!1,t.isDisable=!1)})},getGroup:function(){var t=this;this.$http.get(window.SITE_CONFIG["baseURL-pay"]+"/datadic/"+this.dataForm.id).then(function(e){if(e&&0===e.ec){if(!e.dt)return void(t.dataListLoading=!1);var a=e.dt.lst;a&&a.length,s()(t.dataForm,a),t.apiData=s()({},t.dataForm)}})},resetForm:function(){this.$refs.dataForm.resetFields()},cancelHandle:function(){this.isDisable?this.visible=!1:(this.isEdit=!0,this.isDisable=!0,this.$refs.dataForm.clearValidate()),this.cancelText=this.isDisable?"关闭":"取消"},editHandle:function(){this.isEdit=!this.isEdit,this.isDisable=!this.isDisable,this.cancelText=this.isDisable?"关闭":"取消"},dataFormSubmit:function(){var t=this;this.$refs.dataForm.validate(function(e){e&&(console.log("------dataForm",t.dataForm),0!=t.dataForm.id?t.filterData():t.addGroup())})},filterData:function(){if(o()(this.dataForm,this.apiData))this.editHandle();else{var t=[];for(var e in this.dataForm)if(this.dataForm.hasOwnProperty(e)){var a=this.dataForm[e];a!=this.apiData[e]&&t.push({key:e,part:"",value:a})}this.updateGroup(t)}},addGroup:function(){var t=this,e=s()({},this.dataForm);delete e.id,this.$http.post(window.SITE_CONFIG["baseURL-pay"]+"/datadic",e).then(function(e){e&&0===e.ec&&t.$message({message:"操作成功",type:"success",duration:1500,onClose:function(){t.visible=!1,t.$emit("refreshDataList")}})})},updateGroup:function(t){var e=this,a={id:this.dataForm.id,lst:t};this.$http.put(window.SITE_CONFIG["baseURL-pay"]+"/datadic",a).then(function(t){t&&0===t.ec&&e.$message({message:"操作成功",type:"success",duration:1500,onClose:function(){e.visible=!1,e.$emit("refreshDataList")}})})}}},l={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{attrs:{title:t.dataForm.id?"分组详情":"新增分组","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":"100px"},nativeOn:{keyup:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;t.dataFormSubmit()}}},[a("el-form-item",{attrs:{label:"分组名称：",prop:"name"}},[a("el-input",{attrs:{placeholder:"请输入分组名称",disabled:t.isDisable},model:{value:t.dataForm.name,callback:function(e){t.$set(t.dataForm,"name","string"==typeof e?e.trim():e)},expression:"dataForm.name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"分组编码：",prop:"no"}},[a("el-input",{attrs:{placeholder:"请输入分组编码",disabled:t.isDisable},model:{value:t.dataForm.no,callback:function(e){t.$set(t.dataForm,"no","string"==typeof e?e.trim():e)},expression:"dataForm.no"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"分组说明：",prop:"desc"}},[a("el-input",{attrs:{type:"textarea",rows:5,placeholder:"请输入分组说明",disabled:t.isDisable},model:{value:t.dataForm.desc,callback:function(e){t.$set(t.dataForm,"desc",e)},expression:"dataForm.desc"}})],1)],1),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t.dataForm.id?a("el-button",{on:{click:t.cancelHandle}},[t._v(t._s(t.cancelText))]):a("el-button",{on:{click:t.resetForm}},[t._v("重置")]),t._v(" "),t.isEdit?t._e():a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dataFormSubmit()}}},[t._v("提交")]),t._v(" "),t.isEdit?a("el-button",{attrs:{type:"primary"},on:{click:t.editHandle}},[t._v("编辑")]):t._e()],1)],1)},staticRenderFns:[]},d=a("C7Lr")(n,l,!1,null,null,null);e.default=d.exports}});