ccjgmwz 3 éve
szülő
commit
33dea2660a

+ 30 - 2
src/views/warehouse/warehouseManagementRecord.vue

@@ -43,7 +43,7 @@
 					<img v-if="status == 3" width="18" height="18" src="../../../public/img/radio-check.png"
 						alt="" />入库记录
 				</div>
-				<el-table :data="warehouseList.records" height="560" v-show="this.warehouseType== '1'">
+				<el-table show-summary :summary-method="getSummaries"   :data="warehouseList.records" height="560" v-show="this.warehouseType== '1'">
 					<el-table-column type="expand">
 						<template #default="props">
 							<ws-form ref="deptBudgetList" :model="deptBudgetList">
@@ -144,7 +144,7 @@
 					</el-table-column>
 
 				</el-table>
-				<el-table :data="warehouseList.records" height="560" v-show="this.warehouseType== '2'">
+				<el-table show-summary :summary-method="getSummaries" :data="warehouseList.records" height="560" v-show="this.warehouseType== '2'">
 					<el-table-column type="expand">
 						<template #default="props">
 							<ws-form ref="deptBudgetList" :model="deptBudgetList">
@@ -354,6 +354,34 @@
 			this.showType = this.isShow
 		},
 		methods: {
+			//合计
+			getSummaries(param) {
+				const { columns, data } = param
+				const sums = []
+				columns.forEach((column, index) => {
+					if (index === 0) {
+						sums[index] = '合计'
+					} else if (
+						index === 7 
+					) {
+						const values = data.map((item) => Number(item[column.property]))
+						if (!values.every((value) => isNaN(value))) {
+							sums[index] = values.reduce((prev, curr) => {
+								const value = Number(curr)
+								if (!isNaN(value)) {
+									return prev + curr
+								} else {
+									return prev
+								}
+								}, 0)
+							sums[index] = sums[index].toFixed(3)
+						}
+					} else {
+						sums[index] = '--'
+					}
+				})
+				return sums
+			},
 			print(row){
 				getPrintInfo({
                         id: row.id

+ 1 - 1
src/views/warehouse/warehouseManagementTare.vue

@@ -1223,7 +1223,7 @@ export default {
       }
       if (
         this.deptBudgetList.contractNo.length < 6 ||
-        this.deptBudgetList.contractNo.length > 20
+        this.deptBudgetList.contractNo.length > 50
       ) {
         this.$message({
           message: '合同编号输入有误!',