(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d22cc4a"],{f549:function(t,e,n){"use strict";n.r(e),n.d(e,"JEditableTableMixin",(function(){return a}));var i=n("7550"),o=n("e2e0"),s=n("0fea"),a={components:{JEditableTable:i["default"]},data:function(){return{title:"操作",visible:!1,form:this.$form.createForm(this),confirmLoading:!1,model:{},labelCol:{xs:{span:24},sm:{span:6}},wrapperCol:{xs:{span:24},sm:{span:18}}}},methods:{getAllTable:function(){var t=this;if(!(this.refKeys instanceof Array))throw this.throwNotArray("refKeys");var e=this.refKeys.map((function(e){return Object(o["c"])(t,e)}));return Promise.all(e)},eachAllTable:function(t){this.getAllTable().then((function(e){e.forEach((function(e,n){"function"===typeof t&&t(e,n)}))}))},add:function(){"function"===typeof this.addBefore&&this.addBefore();var t=this.addDefaultRowNum;"number"!==typeof t&&(t=1),this.eachAllTable((function(e){e.add(t)})),"function"===typeof this.addAfter&&this.addAfter(this.model),this.edit({})},edit:function(t){"function"===typeof this.editBefore&&this.editBefore(t),this.visible=!0,this.activeKey=this.refKeys[0],this.form.resetFields(),this.model=Object.assign({},t),"function"===typeof this.editAfter&&this.editAfter(this.model)},close:function(){this.visible=!1,this.eachAllTable((function(t){t.initialize()})),this.$emit("close")},requestSubTableData:function(t,e,n){n.loading=!0,Object(s["f"])(t,e).then((function(t){n.dataSource=t.result||[]})).finally((function(){n.loading=!1}))},request:function(t){var e=this,n=this.url.add,i="post";this.model.id&&(n=this.url.edit,i="put"),this.confirmLoading=!0,Object(s["m"])(n,t,i).then((function(t){t.success?(e.$message.success(t.message),e.$emit("ok"),e.close()):e.$message.warning(t.message)})).finally((function(){e.confirmLoading=!1}))},handleChangeTabs:function(t){Object(o["c"])(this,t).then((function(t){t.resetScrollTop()}))},handleCancel:function(){this.close()},handleOk:function(){var t=this;this.getAllTable().then((function(e){return Object(o["d"])(t.form,e)})).then((function(e){if(e.formValue=e.tablesValue.values,"function"!==typeof t.classifyIntoFormData)throw t.throwNotFunction("classifyIntoFormData");var n=t.classifyIntoFormData(e);return t.request(n)})).catch((function(e){e.error===o["b"]&&(t.activeKey=null==e.index?t.activeKey:t.refKeys[e.index])}))},throwNotFunction:function(t){return"".concat(t," 未定义或不是一个函数")},throwNotArray:function(t){return"".concat(t," 未定义或不是一个数组")}}}}}]);