JNDemo/target/classes/templates/jnquotation/index.html

774 lines
40 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>报价</title>
<meta name="author" content="JIAL">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="HandheldFriendly" content="true">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<link rel="icon" href="/static/image/JNlogo.png" type="image/x-icon">
<link rel="stylesheet" href="/plugins/element-ui/index.css">
<!-- import CSS -->
<link rel="stylesheet" href="/static/jnquotation/css/index.css">
</head>
<body>
<div class="container" id="index-app">
<div class="center-container">
<el-form label-width="45%" :model="formLabelAlign" class="form-box">
<el-collapse v-model="activeNames">
<el-collapse-item title="财务费用明细" name="1" >
<div class="collapse-box">
<el-row>
<el-col :span="6">
<el-form-item label="办公费" title="办公费" >
<el-input v-model="formLabelAlign.officeExpense" placeholder="办公费"
@blur="validateAndSetDefault(formLabelAlign, 'officeExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col >
<el-col :span="6">
<el-form-item label="差旅费" title="差旅费">
<el-input v-model="formLabelAlign.travelExpense" placeholder="差旅费"
@blur="validateAndSetDefault(formLabelAlign, 'travelExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="工资及福利保险" title="工资及福利保险">
<el-input v-model="formLabelAlign.salaryInsur" placeholder="工资及福利保险"
@blur="validateAndSetDefault(formLabelAlign, 'salaryInsur')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="其他管理费" title="其他管理费">
<el-input v-model="formLabelAlign.otherMgmtExpense" placeholder="其他管理费"
@blur="validateAndSetDefault(formLabelAlign, 'otherMgmtExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="汽车费用" title="汽车费用">
<el-input v-model="formLabelAlign.carExpense" placeholder="汽车费用"
@blur="validateAndSetDefault(formLabelAlign, 'carExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col >
<el-col :span="6">
<el-form-item label="管理-业务招待费" title="管理-业务招待费">
<el-input v-model="formLabelAlign.mgmtBizEntFee" placeholder="管理-业务招待费"
@blur="validateAndSetDefault(formLabelAlign, 'mgmtBizEntFee')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="管理-折旧费" title="管理-折旧费">
<el-input v-model="formLabelAlign.mgmtDeprecExpense" placeholder="管理-折旧费"
@blur="validateAndSetDefault(formLabelAlign, 'mgmtDeprecExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="咨询与审计费" title="咨询与审计费">
<el-input v-model="formLabelAlign.consultAuditFee" placeholder="咨询与审计费"
@blur="validateAndSetDefault(formLabelAlign, 'consultAuditFee')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="标书费用" title="标书费用">
<el-input v-model="formLabelAlign.tenderCost" placeholder="标书费用"
@blur="validateAndSetDefault(formLabelAlign, 'tenderCost')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="房租费" title="房租费">
<el-input v-model="formLabelAlign.rentExpense" placeholder="房租费"
@blur="validateAndSetDefault(formLabelAlign, 'rentExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="工资" title="工资">
<el-input v-model="formLabelAlign.salary" placeholder="工资"
@blur="validateAndSetDefault(formLabelAlign, 'salary')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item label="检验检查费">
<el-input v-model="formLabelAlign.inspectFee" placeholder="检验检查费"
@blur="validateAndSetDefault(formLabelAlign, 'inspectFee')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="销售-交通与差旅费" title="交通与差旅费">
<el-input v-model="formLabelAlign.transTravelExpense" placeholder="交通与差旅费"
@blur="validateAndSetDefault(formLabelAlign, 'transTravelExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item label="其他销售费" title="其他销售费">
<el-input v-model="formLabelAlign.otherSalesExpense" placeholder="其他销售费"
@blur="validateAndSetDefault(formLabelAlign, 'otherSalesExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="投标费用" title="投标费用">
<el-input v-model="formLabelAlign.biddingCost" placeholder="投标费用"
@blur="validateAndSetDefault(formLabelAlign, 'biddingCost')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item label="销售-业务费" title="销售-业务费">
<el-input v-model="formLabelAlign.bizFee" placeholder="销售-业务费"
@blur="validateAndSetDefault(formLabelAlign, 'bizFee')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6" >
<el-form-item label="销售-业务招待费" title="销售-业务招待费">
<el-input v-model="formLabelAlign.salesBizEntFee" placeholder="销售-业务招待费"
@blur="validateAndSetDefault(formLabelAlign, 'salesBizEntFee')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="运输装卸费" title="运输装卸费">
<el-input v-model="formLabelAlign.transpHandlingFee" placeholder="运输装卸费"
@blur="validateAndSetDefault(formLabelAlign, 'transpHandlingFee')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item label="制造-折旧费" title="制造-折旧费">
<el-input v-model="formLabelAlign.manufDeprecExpense" placeholder="制造-折旧费"
@blur="validateAndSetDefault(formLabelAlign, 'manufDeprecExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="利息支出" title="利息支出">
<el-input v-model="formLabelAlign.interestExpense" placeholder="利息支出"
@blur="validateAndSetDefault(formLabelAlign, 'interestExpense')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6" >
<el-form-item label="手续费" title="手续费">
<el-input v-model="formLabelAlign.handlingFee" placeholder="手续费"
@blur="validateAndSetDefault(formLabelAlign, 'handlingFee')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="贴现利息" title="贴现利息">
<el-input v-model="formLabelAlign.discInterest" placeholder="贴现利息"
@blur="validateAndSetDefault(formLabelAlign, 'discInterest')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item label="财务-其他费用" title="财务-其他费用">
<el-input v-model="formLabelAlign.otherFinExpenses" placeholder="财务-其他费用"
@blur="validateAndSetDefault(formLabelAlign, 'otherFinExpenses')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="存货机会成本" title="存货机会成本">
<el-input v-model="formLabelAlign.invOpCost" placeholder="存货机会成本"
@blur="validateAndSetDefault(formLabelAlign, 'invOpCost')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="税金" title="税金">
<el-input v-model="formLabelAlign.tax" placeholder="税金"
@blur="validateAndSetDefault(formLabelAlign, 'tax')">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</div>
</el-collapse-item>
<el-collapse-item title="财务费用合计" name="2">
<el-row class="collapse-box">
<el-col :span="6">
<el-form-item label="财务费用合计" title="财务费用合计">
<el-input v-model="formLabelAlign.totalFinExpenses" placeholder="财务费用合计">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item label="厂价金额合计" title="厂价金额合计">
<el-input v-model="formLabelAlign.totalFactoryAmount" placeholder="厂价金额合计">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item label="实际金额合计" title="实际金额合计">
<el-input v-model="formLabelAlign.totalActualAmount" placeholder="实际金额合计">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-collapse-item>
</el-collapse>
</el-form>
<div class="button-box">
<el-button type="text" @click="addMaterial">添加物料</el-button>
<el-button type="text" @click="calculatedData">计算数据</el-button>
</div>
<div class="table-box">
<el-table
:data="materialData"
border
:cell-style="cellStyle"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center' }">
<el-table-column
fixed
label="编号"
type="index"
width="50">
</el-table-column>
<el-table-column
width="180"
prop="prodCategory"
label="产品大类">
</el-table-column>
<el-table-column
width="120"
prop="model"
label="型号">
</el-table-column>
<el-table-column
width="180"
prop="specification"
label="规格">
</el-table-column>
<el-table-column
width="180"
prop="voltLevel"
label="电压等级">
</el-table-column>
<el-table-column
width="180"
prop="measureUnit"
label="单位">
</el-table-column>
<el-table-column
width="180"
prop="matCostPrice"
label="材料成本价格">
</el-table-column>
<el-table-column
width="180"
prop="redBookPrice"
label="红本价格">
</el-table-column>
<el-table-column
width="180"
prop="redBookCost"
label="红本成本">
</el-table-column>
<el-table-column
width="180"
prop="rbFacPrice"
label="红本厂价">
</el-table-column>
<el-table-column
width="180"
prop="number"
label="数量">
<template slot-scope="scope">
<el-input v-model="scope.row.number" @blur="validateNumber(scope.row)">
</el-input>
</template>
</el-table-column>
<el-table-column
width="180"
prop="varRatio"
label="差异比率">
</el-table-column>
<el-table-column
width="180"
prop="wdFSurcharge"
label="盘具运费上浮金额">
<template slot-scope="scope">
<el-input v-model="scope.row.wdFSurcharge" >
<template slot="append"></template>
</el-input>
</template>
</el-table-column>
<el-table-column
width="180"
prop="laborCostFloat"
label="人工成本上浮点数">
<template slot-scope="scope">
<el-input v-model="scope.row.laborCostFloat" >
<template slot="append">%</template>
</el-input>
</template>
</el-table-column>
<el-table-column
width="180"
prop="hydroCostFloat"
label="水电成本上浮点数">
<template slot-scope="scope">
<el-input v-model="scope.row.hydroCostFloat" >
<template slot="append">%</template>
</el-input>
</template>
</el-table-column>
<el-table-column
fixed="right"
width="120"
prop="totalCost"
label="总成本">
</el-table-column>
<el-table-column
fixed="right"
width="120"
prop="totalFacPrice"
label="总厂价">
</el-table-column>
<el-table-column
fixed="right"
width="80"
label="操作">
<template slot-scope="scope">
<el-button @click="handleDeleteClick(scope.$index)" style="color: red;" type="text">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1100px">
<div slot="title" style="margin: 0px">
<el-form>
<el-form-item >
<el-input style="width: 200px; " v-model="precMaterialName" placeholder="开头物料名称精确查询">
</el-input>
<el-input style="width: 200px; " v-model="vagueMaterialName" placeholder="物料名称模糊查询">
</el-input>
<el-input style="width: 200px; " v-model="vagueModel" placeholder="规格模糊查询">
</el-input>
<el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button>
</el-form-item>
</el-form>
</div>
<div style="display: flex; flex-direction: row;">
<div style="width: 688px">
<el-table
:data="getCurrentMaterialData"
ref="materialTable"
@selection-change="handleSelectionChange"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
:cell-style="{'text-align': 'center', 'padding': '5px 0px'}"
highlight-selection-row
:row-key="row => row.uid"
:reserve-selection="true"
border>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="序号"
type="index"
width="50">
</el-table-column>
<el-table-column
width="120"
prop="prodCategory"
label="产品大类">
</el-table-column>
<el-table-column
width="120"
prop="model"
label="型号">
</el-table-column>
<el-table-column
width="120"
prop="specification"
label="规格">
</el-table-column>
<el-table-column
width="120"
prop="voltLevel"
label="电压">
</el-table-column>
<el-table-column
width="100"
prop="measureUnit"
label="单位">
</el-table-column>
</el-table>
<div style="text-align: center; margin-top: 10px;">
<el-pagination
@current-change="handleMaterialCurrentChange"
:current-page.sync="materialCurrentPage"
:page-size="pageSize"
:total="materialTableData.length"
></el-pagination>
</div>
</div>
<div style="flex-grow: 1; padding-left: 20px;">
<div
v-for="(selectedItem, index) in selectedMaterialItems"
:key="index"
class="selected-item"
>
{{ selectedItem.model }} , {{ selectedItem.specification }} , {{ selectedItem.voltLevel }}
<el-button @click="removeSelectedItem(selectedItem)" type="text" class="remove-btn">&#10006;</el-button>
</div>
</div>
</div>
<div style="text-align: center; padding-top: 20px">
<el-button-group>
<el-button type="primary" size="small" style="margin-right: 80px" @click="addMaterialToTable">确认</el-button>
<el-button type="warning" size="small" @click="closeMaterialDialog">取消</el-button>
</el-button-group>
</div>
</el-dialog>
</div>
<script src="/plugins/vue/vue.js"></script>
<script src="/plugins/element-ui/index.js"></script>
<script src="/plugins/calendar/calendar.js"></script>
<script src="/plugins/axios/axios.min.js"></script>
<script src="/plugins/axios/request.js"></script>
<!-- import Script -->
<script src="/static/jnquotation/js/index.js"></script>
<script>
new Vue({
el: '#index-app',
data() {
return {
activeNames: ['2'],
formLabelAlign: {
officeExpense: 0.022,
travelExpense: 0.011,
salaryInsur: 0.394,
otherMgmtExpense: 0.373,
carExpense: 0.010,
mgmtBizEntFee:0.156, //管理-业务招待费
mgmtDeprecExpense: 0.016, //管理-折旧费
consultAuditFee: 0.026, //咨询审计费
tenderCost: 0.023, //标书费用
rentExpense: 0.052, //房租费
salary: 0.239, //工资
inspectFee: 0.016, //检验检测费
transTravelExpense: 0.020, //交通与差旅费
otherSalesExpense: 0.073, //其他销售费
biddingCost: 0.134, //投标费用
bizFee: 1.183, //销售-业务费
salesBizEntFee: 0.098, //销售-业务招待费
transpHandlingFee: 0.621, //运输装卸费
manufDeprecExpense: 0.217, //制造-折旧费
interestExpense: 0.436, //利息支出
handlingFee: 0.108, //手续费
discInterest: 0.363, //贴现利息
otherFinExpenses: 0.197, //财务-其他费用
invOpCost: 0.031, //存货机会成本
tax: 1.5, //税金
totalFinExpenses : 0,
totalFactoryAmount: 0,
totalActualAmount: 0,
},
materialData: [
],
materialCurrentPage: 1,
pageSize: 10,
dialogMaterialVisible: false,
materialTableData: [],
selectedMaterialItems: [], // 选中的数据
savedSelectedMaterials: [], // 保存选中的数据
precMaterialName: '',
vagueMaterialName: '',
vagueModel: '',
validationErrors: [], // 用于存储验证错误信息的数组
}
},
computed: {
getCurrentMaterialData() {
const start = (this.materialCurrentPage - 1) * this.pageSize;
const end = start + this.pageSize;
return this.materialTableData.slice(start, end);
},
},
created() {
this.calculateTotal();
},
mounted() {
},
methods: {
async init () {
},
cellStyle({row, column, rowIndex, columnIndex}) {
if(columnIndex === 0) {
return 'color : black; text-align : center; background : #E0E0E0; padding: 0px';
} else if (columnIndex === 8) {
return 'text-align : center; background : #F5F5F5; padding: 0px';
} else {
return ' text-align : center; padding: 0px';
}
},
calculateTotal() {
this.formLabelAlign.totalFinExpenses =parseFloat(
(
parseFloat(this.formLabelAlign.officeExpense) +
parseFloat(this.formLabelAlign.travelExpense) +
parseFloat(this.formLabelAlign.salaryInsur) +
parseFloat(this.formLabelAlign.otherMgmtExpense) +
parseFloat(this.formLabelAlign.carExpense) +
parseFloat(this.formLabelAlign.mgmtBizEntFee) +
parseFloat(this.formLabelAlign.mgmtDeprecExpense) +
parseFloat(this.formLabelAlign.consultAuditFee) +
parseFloat(this.formLabelAlign.tenderCost) +
parseFloat(this.formLabelAlign.rentExpense) +
parseFloat(this.formLabelAlign.salary) +
parseFloat(this.formLabelAlign.inspectFee) +
parseFloat(this.formLabelAlign.transTravelExpense) +
parseFloat(this.formLabelAlign.otherSalesExpense) +
parseFloat(this.formLabelAlign.biddingCost) +
parseFloat(this.formLabelAlign.bizFee) +
parseFloat(this.formLabelAlign.salesBizEntFee) +
parseFloat(this.formLabelAlign.transpHandlingFee) +
parseFloat(this.formLabelAlign.manufDeprecExpense) +
parseFloat(this.formLabelAlign.interestExpense) +
parseFloat(this.formLabelAlign.handlingFee) +
parseFloat(this.formLabelAlign.discInterest) +
parseFloat(this.formLabelAlign.otherFinExpenses) +
parseFloat(this.formLabelAlign.invOpCost) +
parseFloat(this.formLabelAlign.tax)
).toFixed(2))
},
handleDeleteClick(index){
this.materialData.splice(index, 1)
},
handleMaterialCurrentChange(val) {
this.currentPage = val;
},
addMaterial(){
this.dialogMaterialVisible = true;
},
handleSelectionChange(selection) {
selection.forEach(item => {
// 判断是否已经存在于已选列表中,避免重复添加
if (!this.selectedMaterialItems.some(selectedItem => selectedItem.uid === item.uid)) {
this.selectedMaterialItems.push(item);
}
});
},
removeSelectedItem(selectedItem) {
// 判断当前数据是否被选择
const isSelected = this.$refs.materialTable.selection.includes(selectedItem);
// 从已选列表中移除该项
const index = this.selectedMaterialItems.findIndex(item => item.uid === selectedItem.uid);
if (index !== -1) {
this.selectedMaterialItems.splice(index, 1);
}
// 如果当前数据被选择,则取消 el-table 中该项的选择状态
if (isSelected) {
this.$refs.materialTable.toggleRowSelection(selectedItem, false);
}
},
addMaterialToTable() {
// 将选中的物料信息添加到表格中
this.materialData = this.materialData.concat(this.selectedMaterialItems);
// 清空选中的物料信息
this.selectedMaterialItems = [];
this.$refs.materialTable.clearSelection();
this.dialogMaterialVisible = false;
},
closeMaterialDialog() {
this.dialogMaterialVisible = false;
},
searchMaterial() {
if(this.precMaterialName === '' && this.vagueMaterialName === '' && this.vagueModel === '') {
this.$message({
message: '请输入你要查询的物料条件',
type: 'warning'
});
}else {
const params = {
precMaterialName : this.precMaterialName,
vagueMaterialName : this.vagueMaterialName,
vagueModel : this.vagueModel,
}
queryMaterialListByParam(params).then(res => {
this.materialTableData = res.data || [];
}).catch(err => {
this.$message.error('请求出错了:' + err)
})
}
},
calculatedData() {
/**-------------计算财务总成本---------------**/
this.calculateTotal();
/**----------------------进行盘具、数量、人工、水电三个数值的验证---------------**/
this.validationErrors = []; // 清空之前的错误信息
this.materialData.forEach((row, index) => {
const wdFSurcharge = parseFloat(row.wdFSurcharge) || 0; // 如果为空默认为0
const laborCostFloat = parseFloat(row.laborCostFloat) || 0; // 如果为空默认为0
const hydroCostFloat = parseFloat(row.hydroCostFloat) || 0; // 如果为空默认为0
const quantity = parseFloat(row.number) || 0; // 如果为空默认为0
// 进行数量验证
if (isNaN(quantity) || quantity < 0) {
this.validationErrors.push(`${index + 1} 行数量不符合要求\n`);
}
// 进行盘具运费的验证
if (isNaN(wdFSurcharge) || wdFSurcharge < 0) {
this.validationErrors.push(`${index + 1} 行盘具运费上浮金额不符合要求`);
}
// 进行点数的验证
if (isNaN(laborCostFloat) || laborCostFloat < 0 || laborCostFloat > 100) {
this.validationErrors.push(`${index + 1} 行人工成本上浮点数不符合要求(应在 0 到 100 之间)`);
}
if (isNaN(hydroCostFloat) || hydroCostFloat < 0 || hydroCostFloat > 100) {
this.validationErrors.push(`${index + 1} 行水电成本上浮点数不符合要求(应在 0 到 100 之间)`);
}
});
/**-----------------------验证完成进行运算,验证结果通过才进行计算--------------------------**/
if (this.validationErrors.length === 0) {
// 遍历表格数据进行计算
this.materialData.forEach((row, index) => {
this.validationErrors = []; // 清空之前的错误信息
const redBookFacPrice = parseFloat(row.rbFacPrice);
const materialCost = parseFloat(row.matCostPrice);
const wdFSurcharge = parseFloat(row.wdFSurcharge) || 0; // 如果为空默认为0
const laborCostFloat = parseFloat(row.laborCostFloat) || 0; // 如果为空默认为0
const hydroCostFloat = parseFloat(row.hydroCostFloat) || 0; // 如果为空默认为0
const quantity = parseFloat(row.number) || 0; // 如果为空默认为0
// 进行其他计算
this.$set(this.materialData, index, {
...row,
varRatio: ((redBookFacPrice - materialCost) / redBookFacPrice * 100).toFixed(2),
totalFacPrice: (quantity * redBookFacPrice).toFixed(2),
totalCost: (
(materialCost + wdFSurcharge +
materialCost * (laborCostFloat / 100) + materialCost * (hydroCostFloat / 100)) *
quantity
).toFixed(2),
});
});
} else {
this.$message({
type: 'error',
dangerouslyUseHTMLString: true,
message: this.validationErrors.join('<br>')
});
}
// 计算厂价金额合计
const totalFactoryAmount = this.materialData.reduce((sum, row) => sum + parseFloat(row.totalFacPrice), 0);
this.formLabelAlign.totalFactoryAmount = totalFactoryAmount.toFixed(2);
// 计算实际金额合计
const totalCost = this.materialData.reduce((sum, row) => sum + parseFloat(row.totalCost), 0);
this.formLabelAlign.totalActualAmount = (totalCost + totalCost * (parseFloat(this.formLabelAlign.totalFinExpenses) / 100)).toFixed(2);
},
/**----------------表头表单验证-----------------**/
validateInputRange(value) {
const number = parseFloat(value);
return isNaN(number) || (number >= 0 && number <= 100);
},
validateAndSetDefault(model, field) {
if (!this.validateInputRange(model[field])) {
// 如果验证不通过,设置错误提示
this.$message({
type: 'error',
message: '填写错误范围为0~100'
});
this.$set(model, field, 0);
}
},
},
})
</script>
</body>
</html>