|
|
@ -588,8 +588,31 @@ export default { |
|
|
json += "}" |
|
|
json += "}" |
|
|
return eval("(" + json + ")") |
|
|
return eval("(" + json + ")") |
|
|
}, |
|
|
}, |
|
|
|
|
|
formatCostValue(value) { |
|
|
|
|
|
return Number.isFinite(value) ? value.toFixed(6) : '' |
|
|
|
|
|
}, |
|
|
|
|
|
getCalcUnitCost(row) { |
|
|
|
|
|
let qtyPerAssembly = Number(row.qtyPerAssembly) |
|
|
|
|
|
let unitPrice = Number(row.unitPrice) |
|
|
|
|
|
return this.formatCostValue(qtyPerAssembly * unitPrice) |
|
|
|
|
|
}, |
|
|
|
|
|
getCalcSetupCost(row) { |
|
|
|
|
|
let quoteQty = Number(this.quoteDetail.qty) |
|
|
|
|
|
if (!quoteQty) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
let componentScrap = Number(row.componentScrap) |
|
|
|
|
|
let unitPrice = Number(row.unitPrice) |
|
|
|
|
|
return this.formatCostValue(componentScrap * unitPrice / quoteQty) |
|
|
|
|
|
}, |
|
|
createExportData() { |
|
|
createExportData() { |
|
|
return this.dataList; |
|
|
|
|
|
|
|
|
return this.dataList.map(item => { |
|
|
|
|
|
return { |
|
|
|
|
|
...item, |
|
|
|
|
|
calcUnitCost: this.getCalcUnitCost(item), |
|
|
|
|
|
calcSetupCost: this.getCalcSetupCost(item), |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
startDownload() { |
|
|
startDownload() { |
|
|
this.exportLoading = true |
|
|
this.exportLoading = true |
|
|
@ -667,10 +690,10 @@ export default { |
|
|
<el-link @click="handleJumpToBom(scope.row)">{{ scope.row[item.columnProp] }}</el-link> |
|
|
<el-link @click="handleJumpToBom(scope.row)">{{ scope.row[item.columnProp] }}</el-link> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="item.columnProp === 'calcUnitCost'"> |
|
|
<template v-else-if="item.columnProp === 'calcUnitCost'"> |
|
|
<span>{{ (Number(scope.row.qtyPerAssembly) * Number(scope.row.unitPrice)).toFixed(6) }}</span> |
|
|
|
|
|
|
|
|
<span>{{ getCalcUnitCost(scope.row) }}</span> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="item.columnProp === 'calcSetupCost'"> |
|
|
<template v-else-if="item.columnProp === 'calcSetupCost'"> |
|
|
<span>{{ quoteDetail.qty ? (Number(scope.row.componentScrap) * Number(scope.row.unitPrice) / Number(quoteDetail.qty)).toFixed(6) : '' }}</span> |
|
|
|
|
|
|
|
|
<span>{{ getCalcSetupCost(scope.row) }}</span> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else> |
|
|
<template v-else> |
|
|
<span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> |
|
|
<span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> |
|
|
|