给商品库存报表增加合计
This commit is contained in:
@@ -376,6 +376,34 @@ export const JeecgListMixin = {
|
|||||||
}
|
}
|
||||||
this.scroll.y = document.documentElement.clientHeight-searchWrapperDomLen-operatorDomLen-basicLength
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,14 +61,31 @@
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:dataSource="dataSource"
|
:dataSource="dataSource"
|
||||||
:pagination="ipagination"
|
:pagination="false"
|
||||||
:scroll="scroll"
|
:scroll="scroll"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
@change="handleTableChange">
|
@change="handleTableChange">
|
||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<a @click="showMaterialInOutList(record)">流水</a>
|
<a @click="showMaterialInOutList(record)">{{record.id?'流水':''}}</a>
|
||||||
</span>
|
</span>
|
||||||
</a-table>
|
</a-table>
|
||||||
|
<a-row :gutter="24" style="margin-top: 8px;text-align:right;">
|
||||||
|
<a-col :md="12" :sm="24"></a-col>
|
||||||
|
<a-col :md="12" :sm="24">
|
||||||
|
<a-pagination @change="onChange" @showSizeChange="onShowSizeChange"
|
||||||
|
size="small"
|
||||||
|
show-size-changer
|
||||||
|
:showQuickJumper="true"
|
||||||
|
:page-size="ipagination.pageSize"
|
||||||
|
:page-size-options="ipagination.pageSizeOptions"
|
||||||
|
:total="ipagination.total"
|
||||||
|
:show-total="(total, range) => `共 ${total} 条`">
|
||||||
|
<template slot="buildOptionText" slot-scope="props">
|
||||||
|
<span>{{ props.value-1 }}条/页</span>
|
||||||
|
</template>
|
||||||
|
</a-pagination>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
</section>
|
</section>
|
||||||
<!-- table区域-end -->
|
<!-- table区域-end -->
|
||||||
<material-in-out-list ref="materialInOutList" @ok="modalFormOk"></material-in-out-list>
|
<material-in-out-list ref="materialInOutList" @ok="modalFormOk"></material-in-out-list>
|
||||||
@@ -109,7 +126,8 @@
|
|||||||
mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性
|
mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性
|
||||||
},
|
},
|
||||||
ipagination:{
|
ipagination:{
|
||||||
pageSizeOptions: ['10', '20', '30', '100', '200']
|
pageSize: 11,
|
||||||
|
pageSizeOptions: ['11', '21', '31', '101', '201']
|
||||||
},
|
},
|
||||||
depotList: [],
|
depotList: [],
|
||||||
categoryTree:[],
|
categoryTree:[],
|
||||||
@@ -118,9 +136,9 @@
|
|||||||
// 表头
|
// 表头
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: '#', dataIndex: '', key:'rowIndex', width:40, align:"center",
|
title: '#', dataIndex: 'rowIndex', width:40, align:"center",
|
||||||
customRender:function (t,r,index) {
|
customRender:function (t,r,index) {
|
||||||
return parseInt(index)+1;
|
return (t !== '合计') ? (parseInt(index) + 1) : t
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{title: '条码', dataIndex: 'mBarCode', width: 80},
|
{title: '条码', dataIndex: 'mBarCode', width: 80},
|
||||||
@@ -153,7 +171,7 @@
|
|||||||
let param = Object.assign({}, this.queryParam, this.isorter);
|
let param = Object.assign({}, this.queryParam, this.isorter);
|
||||||
param.field = this.getQueryField();
|
param.field = this.getQueryField();
|
||||||
param.currentPage = this.ipagination.current;
|
param.currentPage = this.ipagination.current;
|
||||||
param.pageSize = this.ipagination.pageSize;
|
param.pageSize = this.ipagination.pageSize-1;
|
||||||
return param;
|
return param;
|
||||||
},
|
},
|
||||||
getDepotData() {
|
getDepotData() {
|
||||||
@@ -199,6 +217,7 @@
|
|||||||
this.ipagination.total = res.data.total;
|
this.ipagination.total = res.data.total;
|
||||||
this.currentStock = res.data.currentStock;
|
this.currentStock = res.data.currentStock;
|
||||||
this.currentStockPrice = res.data.currentStockPrice;
|
this.currentStockPrice = res.data.currentStockPrice;
|
||||||
|
this.tableAddTotalRow(this.columns, this.dataSource)
|
||||||
}
|
}
|
||||||
if(res.code===510){
|
if(res.code===510){
|
||||||
this.$message.warning(res.data)
|
this.$message.warning(res.data)
|
||||||
@@ -220,6 +239,16 @@
|
|||||||
aoa.push(item)
|
aoa.push(item)
|
||||||
}
|
}
|
||||||
openDownloadDialog(sheet2blob(aoa), '商品库存')
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user