(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d225006"],{e313:function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("a-card",{attrs:{title:"即时保存示例",bordered:!1}},[a("j-vxe-table",{attrs:{toolbar:"",toolbarConfig:e.toolbarConfig,"row-number":"","row-selection":"","keep-source":"","async-remove":"",height:340,loading:e.loading,columns:e.columns,dataSource:e.dataSource,pagination:e.pagination},on:{save:e.handleTableSave,remove:e.handleTableRemove,"edit-closed":e.handleEditClosed,pageChange:e.handlePageChange,selectRowChange:e.handleSelectRowChange}})],1)},i=[],o=a("0fea"),l=a("2475"),s={name:"JSBCDemo",data:function(){return{toolbarConfig:{btn:["add","save","remove","clearSelection"]},loading:!1,pagination:{current:1,pageSize:200,pageSizeOptions:["10","20","30","100","200"],total:0},selectedRows:[],dataSource:[],columns:[{key:"num",title:"序号",width:"80px"},{key:"ship_name",title:"船名",width:"180px",type:l["b"].input},{key:"call",title:"呼叫",width:"80px",type:l["b"].input},{key:"len",title:"长",width:"80px",type:l["b"].input},{key:"ton",title:"吨",width:"120px",defaultValue:233,type:l["b"].input},{key:"payer",title:"付款方",width:"120px",defaultValue:"张三",type:l["b"].input},{key:"count",title:"数",width:"40px"},{key:"company",title:"公司",minWidth:"180px",type:l["b"].input},{key:"trend",title:"动向",width:"120px",type:l["b"].input}],url:{getData:"/mock/vxe/getData",saveRow:"/mock/vxe/immediateSaveRow",saveAll:"/mock/vxe/immediateSaveAll"}}},created:function(){this.loadData()},methods:{loadData:function(){var e=this,t={pageNo:this.pagination.current,pageSize:this.pagination.pageSize};this.loading=!0,Object(o["c"])(this.url.getData,t).then((function(t){t.success?(e.pagination.total=t.result.total,e.dataSource=t.result.records,e.selectedRows=[]):e.$error({title:"主表查询失败",content:t.message})})).finally((function(){e.loading=!1}))},handleTableSave:function(e){var t=this,a=e.$table,n=e.target;a.validate().then((function(e){if(!e){var a=n.getTableData();n.getNewData(),n.getDeleteData();t.loading=!0,Object(o["i"])(t.url.saveAll,a).then((function(e){e.success?t.$message.success("保存成功！"):t.$message.warn("保存失败："+e.message)})).finally((function(){t.loading=!1}))}}))},handleTableRemove:function(e){var t=this;e.deleteRows.map((function(e){return e.id}));this.loading=!0,window.setTimeout((function(){t.loading=!1,t.$message.success("删除成功"),e.confirmRemove()}),1e3)},handleEditClosed:function(e){var t=this,a=e.$table,n=e.row,i=e.column,l=i.property;n[l];a.isUpdateByRow(n,l)&&a.validate(n).then((function(e){if(!e){var s=t.$message.loading('正在保存"'.concat(i.title,'"'),0);Object(o["k"])(t.url.saveRow,n).then((function(e){e.success?(t.$message.success('"'.concat(i.title,'"保存成功！')),a.reloadRow(n,null,l)):t.$message.warn('"'.concat(i.title,'"保存失败：')+e.message)})).finally((function(){s()}))}}))},handlePageChange:function(e){this.pagination.current=e.current,this.pagination.pageSize=e.pageSize,this.loadData()},handleSelectRowChange:function(e){this.selectedRows=e.selectedRows}}},c=s,d=a("2877"),u=Object(d["a"])(c,n,i,!1,null,"1ee4436f",null);t["default"]=u.exports}}]);