|
|
|
|
@ -34,6 +34,13 @@
|
|
|
|
|
<!-- 预算成本 -->
|
|
|
|
|
<el-table-column label="预算成本" align="center">
|
|
|
|
|
<el-table-column prop="sortOrder" label="序号" width="60" align="center" />
|
|
|
|
|
<el-table-column prop="type" label="类型" width="120">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-select v-model="scope.row.installType" placeholder="请选择类型" clearable @change="handleTypeChange(scope.row)">
|
|
|
|
|
<el-option v-for="dict in install_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="personnelCategory" label="人员类别" width="150">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input v-model="scope.row.personnelCategory" placeholder="请输入人员类别" />
|
|
|
|
|
@ -41,27 +48,32 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="peopleNumber" label="人数" width="120">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input-number v-model="scope.row.peopleNumber" :min="0" :precision="0" size="small" @change="calculateBudgetAmount(scope.row)" style="width:106px;"/>
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.NON_CONTRACT" v-model="scope.row.peopleNumber" :min="0" :precision="0" size="small" @change="calculateBudgetAmount(scope.row)" style="width:106px;"/>
|
|
|
|
|
<span v-else></span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="cumulativeTime" label="累计时间(月)" width="120">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input-number v-model="scope.row.cumulativeTime" :min="0" :precision="2" size="small" @change="calculateBudgetAmount(scope.row)" style="width:106px;"/>
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.NON_CONTRACT" v-model="scope.row.cumulativeTime" :min="0" :precision="2" size="small" @change="calculateBudgetAmount(scope.row)" style="width:106px;"/>
|
|
|
|
|
<span v-else></span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="monthRate" label="月平均投入比例(%)" width="150">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input-number v-model="scope.row.monthRate" :min="0" :max="100" :precision="2" size="small" @change="calculateBudgetAmount(scope.row)" style="width:136px;"/>
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.NON_CONTRACT" v-model="scope.row.monthRate" :min="0" :max="100" :precision="2" size="small" @change="calculateBudgetAmount(scope.row)" style="width:136px;"/>
|
|
|
|
|
<span v-else></span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="artificialStandard" label="人工标准(元/人月)" width="150">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input-number v-model="scope.row.artificialStandard" :min="0" :precision="2" :step="10" size="small" @change="calculateBudgetAmount(scope.row)" style="width:136px;"/>
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.NON_CONTRACT" v-model="scope.row.artificialStandard" :min="0" :precision="2" :step="10" size="small" @change="calculateBudgetAmount(scope.row)" style="width:136px;"/>
|
|
|
|
|
<span v-else></span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="price" label="金额(万元)" width="100">
|
|
|
|
|
<el-table-column prop="price" label="金额(元)" width="150">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ format2TenThousandNumber(scope.row.price) }}
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.CONTRACT" v-model="scope.row.price" :min="0" :precision="2" size="small" style="width:136px;"/>
|
|
|
|
|
<span v-else>{{ formatNumber(scope.row.price) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
@ -75,27 +87,32 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="reducePeopleNumber" label="人数" width="120">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input-number v-model="scope.row.reducePeopleNumber" :min="0" :precision="0" size="small" @change="calculateReducedAmount(scope.row)" style="width:106px;"/>
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.NON_CONTRACT" v-model="scope.row.reducePeopleNumber" :min="0" :precision="0" size="small" @change="calculateReducedAmount(scope.row)" style="width:106px;"/>
|
|
|
|
|
<span v-else></span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="reduceCumulativeTime" label="累计时间(月)" width="120">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input-number v-model="scope.row.reduceCumulativeTime" :min="0" :precision="2" size="small" @change="calculateReducedAmount(scope.row)" style="width:106px;"/>
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.NON_CONTRACT" v-model="scope.row.reduceCumulativeTime" :min="0" :precision="2" size="small" @change="calculateReducedAmount(scope.row)" style="width:106px;"/>
|
|
|
|
|
<span v-else></span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="reduceMonthRate" label="月平均投入比例(%)" width="150">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input-number v-model="scope.row.reduceMonthRate" :min="0" :max="100" :precision="2" size="small" @change="calculateReducedAmount(scope.row)" style="width:136px;"/>
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.NON_CONTRACT" v-model="scope.row.reduceMonthRate" :min="0" :max="100" :precision="2" size="small" @change="calculateReducedAmount(scope.row)" style="width:136px;"/>
|
|
|
|
|
<span v-else></span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="reduceArtificialStandard" label="人工标准(元/人月)" width="150">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input-number v-model="scope.row.reduceArtificialStandard" :min="0" :precision="2" :step="10" size="small" @change="calculateReducedAmount(scope.row)" style="width:136px;"/>
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.NON_CONTRACT" v-model="scope.row.reduceArtificialStandard" :min="0" :precision="2" :step="10" size="small" @change="calculateReducedAmount(scope.row)" style="width:136px;"/>
|
|
|
|
|
<span v-else></span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="reducePrice" label="金额(万元)" width="100">
|
|
|
|
|
<el-table-column prop="reducePrice" label="金额(元)" width="150">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ format2TenThousandNumber(scope.row.reducePrice) }}
|
|
|
|
|
<el-input-number v-if="scope.row.installType === INSTALL_TYPE.CONTRACT" v-model="scope.row.reducePrice" :min="0" :precision="2" size="small" style="width:136px;"/>
|
|
|
|
|
<span v-else>{{ formatNumber(scope.row.reducePrice) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
@ -135,9 +152,16 @@
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import { budgetInstallCostVO } from '@/api/oa/erp/budgetInfo/market/budgetInstallCost/types';
|
|
|
|
|
import { budgetMaterialCostVO } from '@/api/oa/erp/budgetInfo/market/budgetMaterialCost/types';
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const { install_type } = toRefs<any>(
|
|
|
|
|
proxy?.useDict('install_type')
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const INSTALL_TYPE = {
|
|
|
|
|
NON_CONTRACT: '1', //非承包
|
|
|
|
|
CONTRACT: '2' //承包
|
|
|
|
|
}
|
|
|
|
|
// 安装费数据
|
|
|
|
|
const installCostList = ref<budgetInstallCostVO[]>([]);
|
|
|
|
|
const toDeletedInstallCostIdList = ref([]);
|
|
|
|
|
@ -163,7 +187,7 @@ const personnelCategories = ref([
|
|
|
|
|
{ label: '其他', value: '其他' }
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
// 格式化数字,元转换为万元
|
|
|
|
|
// 格式化数字
|
|
|
|
|
const formatNumber = (value: number) => {
|
|
|
|
|
if (!value) return '0.00';
|
|
|
|
|
return parseFloat(value).toFixed(2);
|
|
|
|
|
@ -175,24 +199,37 @@ const format2TenThousandNumber = (value: number) => {
|
|
|
|
|
return (parseFloat(value) / 10000).toFixed(2);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 处理类型变更
|
|
|
|
|
const handleTypeChange = (row: any) => {
|
|
|
|
|
if (row.installType === INSTALL_TYPE.NON_CONTRACT) {
|
|
|
|
|
// 非承包类型,重新计算金额
|
|
|
|
|
calculateBudgetAmount(row)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 计算预算金额
|
|
|
|
|
const calculateBudgetAmount = (row: any) => {
|
|
|
|
|
const peopleNumber = parseFloat(row.peopleNumber) || 0
|
|
|
|
|
const cumulativeTime = parseFloat(row.cumulativeTime) || 0
|
|
|
|
|
const monthRate = parseFloat(row.monthRate) || 0
|
|
|
|
|
const artificialStandard = parseFloat(row.artificialStandard) || 0
|
|
|
|
|
// 只有非承包类型才需要计算金额
|
|
|
|
|
if (row.installType === INSTALL_TYPE.NON_CONTRACT) {
|
|
|
|
|
const peopleNumber = parseFloat(row.peopleNumber) || 0
|
|
|
|
|
const cumulativeTime = parseFloat(row.cumulativeTime) || 0
|
|
|
|
|
const monthRate = parseFloat(row.monthRate) || 0
|
|
|
|
|
const artificialStandard = parseFloat(row.artificialStandard) || 0
|
|
|
|
|
|
|
|
|
|
row.price = peopleNumber * cumulativeTime * (monthRate / 100) * artificialStandard
|
|
|
|
|
row.price = peopleNumber * cumulativeTime * (monthRate / 100) * artificialStandard
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 计算降成本后金额
|
|
|
|
|
const calculateReducedAmount = (row: any) => {
|
|
|
|
|
const peopleNumber = parseFloat(row.reducePeopleNumber) || 0
|
|
|
|
|
const cumulativeTime = parseFloat(row.reduceCumulativeTime) || 0
|
|
|
|
|
const monthRate = parseFloat(row.reduceMonthRate) || 0
|
|
|
|
|
const artificialStandard = parseFloat(row.reduceArtificialStandard) || 0
|
|
|
|
|
if (row.installType === INSTALL_TYPE.NON_CONTRACT) {
|
|
|
|
|
const peopleNumber = parseFloat(row.reducePeopleNumber) || 0
|
|
|
|
|
const cumulativeTime = parseFloat(row.reduceCumulativeTime) || 0
|
|
|
|
|
const monthRate = parseFloat(row.reduceMonthRate) || 0
|
|
|
|
|
const artificialStandard = parseFloat(row.reduceArtificialStandard) || 0
|
|
|
|
|
|
|
|
|
|
row.reducePrice = peopleNumber * cumulativeTime * (monthRate / 100) * artificialStandard
|
|
|
|
|
row.reducePrice = peopleNumber * cumulativeTime * (monthRate / 100) * artificialStandard
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 选择变化
|
|
|
|
|
@ -209,6 +246,7 @@ const handleAddRows = () => {
|
|
|
|
|
for (let i = 0; i < addRowCount.value; i++) {
|
|
|
|
|
installCostList.value.push({
|
|
|
|
|
sortOrder: currentSortOrder + i + 1,
|
|
|
|
|
installType: INSTALL_TYPE.NON_CONTRACT,
|
|
|
|
|
personnelCategory: '',
|
|
|
|
|
peopleNumber: 0,
|
|
|
|
|
cumulativeTime: 0,
|
|
|
|
|
@ -267,7 +305,7 @@ const getSummaries = (param: any) => {
|
|
|
|
|
const sums: any[] = []
|
|
|
|
|
columns.forEach((column: any, index: number) => {
|
|
|
|
|
if (index === 2) {
|
|
|
|
|
sums[index] = '合计(万元)'
|
|
|
|
|
sums[index] = '合计(元)'
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (column.property === 'price' || column.property === 'reducePrice') {
|
|
|
|
|
@ -281,7 +319,7 @@ const getSummaries = (param: any) => {
|
|
|
|
|
return prev
|
|
|
|
|
}
|
|
|
|
|
}, 0)
|
|
|
|
|
sums[index] = format2TenThousandNumber(sums[index])
|
|
|
|
|
sums[index] = formatNumber(sums[index])
|
|
|
|
|
} else {
|
|
|
|
|
sums[index] = ''
|
|
|
|
|
}
|
|
|
|
|
@ -294,8 +332,8 @@ const getSummaries = (param: any) => {
|
|
|
|
|
|
|
|
|
|
// 获取总金额(供父组件调用)
|
|
|
|
|
const getTotalAmount = () => {
|
|
|
|
|
const totalBudgetAmount = installCostList.value.reduce((sum, item) => sum + Number(item.price), 0)
|
|
|
|
|
const totalReducedAmount = installCostList.value.reduce((sum, item) => sum + Number(item.reducePrice), 0)
|
|
|
|
|
const totalBudgetAmount = installCostList.value.reduce((sum, item) => sum + Number(item.price), 0);
|
|
|
|
|
const totalReducedAmount = installCostList.value.reduce((sum, item) => sum + Number(item.reducePrice), 0);
|
|
|
|
|
return {
|
|
|
|
|
budgetAmount: totalBudgetAmount,
|
|
|
|
|
reducedAmount: totalReducedAmount
|
|
|
|
|
|