From c41b176dae2d7afe975232f47e6dcf9bd2662658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Fri, 15 Oct 2021 02:10:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E5=95=86=E5=93=81=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=90=88=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jshERP-web/src/mixins/JeecgListMixin.js | 28 +++++++++++++ jshERP-web/src/views/report/MaterialStock.vue | 41 ++++++++++++++++--- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/jshERP-web/src/mixins/JeecgListMixin.js b/jshERP-web/src/mixins/JeecgListMixin.js index 256305d0..4f853849 100644 --- a/jshERP-web/src/mixins/JeecgListMixin.js +++ b/jshERP-web/src/mixins/JeecgListMixin.js @@ -376,6 +376,34 @@ export const JeecgListMixin = { } this.scroll.y = document.documentElement.clientHeight-searchWrapperDomLen-operatorDomLen-basicLength } + }, + /** 表格增加合计行 */ + tableAddTotalRow(columns, dataSource) { + if(this.ipagination.pageSize!==10) { + let numKey = 'rowIndex' + let totalRow = { [numKey]: '合计' } + //移除不需要合计的列 + let removeCols = 'action,mBarCode,purchaseDecimal' + columns.forEach(column => { + let { key, dataIndex } = column + if (![key, dataIndex].includes(numKey)) { + let total = 0 + dataSource.forEach(data => { + total += Number.parseFloat(data[dataIndex]) + }) + if (Number.isNaN(total)) { + total = '-' + } else { + total = total.toFixed(2) + } + if(removeCols.indexOf(dataIndex)>-1) { + total = '-' + } + totalRow[dataIndex] = total + } + }) + dataSource.push(totalRow) + } } } diff --git a/jshERP-web/src/views/report/MaterialStock.vue b/jshERP-web/src/views/report/MaterialStock.vue index af261418..f780e70c 100644 --- a/jshERP-web/src/views/report/MaterialStock.vue +++ b/jshERP-web/src/views/report/MaterialStock.vue @@ -61,14 +61,31 @@ rowKey="id" :columns="columns" :dataSource="dataSource" - :pagination="ipagination" + :pagination="false" :scroll="scroll" :loading="loading" @change="handleTableChange"> - 流水 + {{record.id?'流水':''}} + + + + + + + + @@ -109,7 +126,8 @@ mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性 }, ipagination:{ - pageSizeOptions: ['10', '20', '30', '100', '200'] + pageSize: 11, + pageSizeOptions: ['11', '21', '31', '101', '201'] }, depotList: [], categoryTree:[], @@ -118,9 +136,9 @@ // 表头 columns: [ { - title: '#', dataIndex: '', key:'rowIndex', width:40, align:"center", + title: '#', dataIndex: 'rowIndex', width:40, align:"center", customRender:function (t,r,index) { - return parseInt(index)+1; + return (t !== '合计') ? (parseInt(index) + 1) : t } }, {title: '条码', dataIndex: 'mBarCode', width: 80}, @@ -153,7 +171,7 @@ let param = Object.assign({}, this.queryParam, this.isorter); param.field = this.getQueryField(); param.currentPage = this.ipagination.current; - param.pageSize = this.ipagination.pageSize; + param.pageSize = this.ipagination.pageSize-1; return param; }, getDepotData() { @@ -199,6 +217,7 @@ this.ipagination.total = res.data.total; this.currentStock = res.data.currentStock; this.currentStockPrice = res.data.currentStockPrice; + this.tableAddTotalRow(this.columns, this.dataSource) } if(res.code===510){ this.$message.warning(res.data) @@ -220,6 +239,16 @@ aoa.push(item) } openDownloadDialog(sheet2blob(aoa), '商品库存') + }, + onChange(page, pageSize) { + this.ipagination.current = page + this.ipagination.pageSize = pageSize + this.loadData(this.ipagination.current); + }, + onShowSizeChange(current, size) { + this.ipagination.current = current + this.ipagination.pageSize = size + this.loadData(this.ipagination.current); } } }