一,需求截图:(问题)
目前里面的重量全是实际重量,
质保书数据:
目前全是理论重量,实际需求,直条里面除了样品号为0的取理论重量,其它的都取实际重量;
二,实现出库单和质保书取值:
出库单前端实现:
<tr
style="line-height: 25px; border-left: 1px solid #000"
v-for="item in outBillList"
:label="item.id"
:key="item.id"
>
<td
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
>
{{ item.goodName }}
</td>
<td
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
>
{{ item.markNo }}
</td>
<td
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
>
{{ item.specs }}
</td>
<td
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
>
{{ item.quantity }}
</td>
<td v-if="item.qualityStatus!=0"
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
>
{{ item.realWeight }}
</td>
<td v-if="item.qualityStatus==0"
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
>
{{ item.weight }}
</td>
<td
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
></td>
<td
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
>
{{ item.amount }}
</td>
<th
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
"
>
{{ item.qualityStatus }}
</th>
</tr>
主要语句:
<td v-if="item.qualityStatus!=0"
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
>
<!-- 实际重量 -->
{{ item.realWeight }}
</td>
<td v-if="item.qualityStatus==0"
style="
border-left: 1px solid #000;
border-bottom: 1px solid #000;
"
>
<!-- 理论重量 -->
{{ item.weight }}
</td>
实现之后效果:
重量合计取值函数:
//出库磅单理论重量量合计
outBillWeightSum() {
let weightSum = 0;
this.outBillList.forEach(function (item, index) {
if(item.qualityStatus==0){
weightSum += item.weight * 1;
}else{
weightSum += item.realWeight * 1;
}
});
return weightSum.toFixed(3);
}
质保书取值实现主要语句:
<el-table-column
label="理重/吨"
align="center"
width="60px"
>
<template scope="scope">
<p v-if="scope.row.qualityStatus =='0'">
<!-- 理重 -->
{{scope.row.scalWeight}}
</p>
<!-- 实重 -->
<p v-if="scope.row.qualityStatus !=0"> {{scope.row.realWeight}}</p>
</template>
</el-table-column>
具体效果: