webpackJsonp([33],{"60/I":function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=a("aA9S"),o=a.n(r),i=a("PkDv"),n=a.n(i),l={data:function(){return{visible:!1,tableData:[],dataForm:{delIds:[],groupId:"",items:[]},dataRule:{title:[{required:!0,message:"必填项不能为空",trigger:"blur"}],sType:[{required:!0,message:"必填项不能为空",trigger:"blur"}]},apiData:{}}},methods:{init:function(){var t=this;this.visible=!0,this.$nextTick(function(){t.$refs.dataForm.resetFields(),t.dataForm.delIds=[],t.dataForm.groupId&&t.getGroup()})},handleDelete:function(t,e){var a=this;1!=e.length?(e.filter(function(e,r){t==r&&a.dataForm.delIds.push(e.id)}),e.splice(t,1)):this.$message.error("至少设置一个")},getGroup:function(){var t=this;this.$http.get(window.SITE_CONFIG["baseURL-pay"]+"/datadic/group",{params:{groupId:this.dataForm.groupId}}).then(function(e){if(e&&0===e.ec){if(!e.dt)return void(t.dataListLoading=!1);var a=e.dt.lst;a&&a.length>0&&a.filter(function(e){e.groupId=t.dataForm.groupId}),t.tableData=a||[],t.apiData=n()(t.tableData)}})},addRow:function(){this.tableData.push({no:"",id:-1,name:"",sort:""}),this.apiData=n()(this.tableData)},resetForm:function(){this.tableData={},this.tableData=n()(this.apiData)},dataFormSubmit:function(){var t=this;this.$refs.dataForm.validate(function(e){if(e){var a=!1;t.dataForm.items=t.tableData.filter(function(e){if(e.name)if(e.no)if(e.sort){if(/^\d+$/.test(e.sort))return a=!0,e;t.$message.error(e.name+"排序号码只能为数字"),a=!1}else t.$message.error("请设置"+e.name+"排序号码"),a=!1;else t.$message.error("请设置"+e.name+"数据编号"),a=!1}),console.log("------dataForm",t.dataForm),a&&t.editGroup()}})},editGroup:function(){var t=this,e=o()({},this.dataForm);this.$http.put(window.SITE_CONFIG["baseURL-pay"]+"/datadic/group",e).then(function(e){e&&0===e.ec&&t.$message({message:"操作成功",type:"success",duration:1500,onClose:function(){t.visible=!1,t.$emit("refreshDataList")}})})}}},s={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{attrs:{id:"set-group"}},[a("el-dialog",{attrs:{title:"分组设置","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":"120px"},nativeOn:{keyup:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;t.dataFormSubmit()}}},[a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.tableData}},[a("el-table-column",{attrs:{prop:"no",label:"数据编号",width:"145",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-input",{attrs:{size:"small",placeholder:"请输入数据编号"},model:{value:e.row.no,callback:function(a){t.$set(e.row,"no",t._n(a))},expression:"scope.row.no"}})]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"name",label:"数据名称",width:"260",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-input",{attrs:{size:"small",placeholder:"请输入数据名称"},model:{value:e.row.name,callback:function(a){t.$set(e.row,"name",a)},expression:"scope.row.name"}})]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"sort",label:"排序",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-input",{attrs:{size:"small",placeholder:"请输入排序号码"},model:{value:e.row.sort,callback:function(a){t.$set(e.row,"sort",t._n(a))},expression:"scope.row.sort"}})]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"操作",width:"100",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"danger",icon:"el-icon-delete",circle:"",size:"mini"},nativeOn:{click:function(a){a.preventDefault(),t.handleDelete(e.$index,t.tableData)}}})]}}])})],1)],1),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary",plain:""},on:{click:t.addRow}},[t._v("新增行")]),t._v(" "),a("el-button",{attrs:{type:"primary",plain:""},on:{click:t.resetForm}},[t._v("重置")]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dataFormSubmit()}}},[t._v("保存")]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.visible=!1}}},[t._v("关闭")])],1)],1)],1)},staticRenderFns:[]};var u=a("C7Lr")(l,s,!1,function(t){a("b8HG")},"data-v-08bb5cd3",null);e.default=u.exports},EdFT:function(t,e,a){(t.exports=a("UTlt")(!1)).push([t.i,"",""])},b8HG:function(t,e,a){var r=a("EdFT");"string"==typeof r&&(r=[[t.i,r,""]]),r.locals&&(t.exports=r.locals);a("FIqI")("336d869a",r,!0,{})}});