1.0.50前端:

feat(budget):完成研发项目预算导出功能
dev
xs 17 hours ago
parent 8deb7a579c
commit c3c7cfadb4

@ -26,6 +26,21 @@
<el-input v-model="searchForm.projectName" placeholder="请选择项目后自动填充" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="版本号">
<el-input v-model="searchForm.budgetVersion" disabled>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="申请说明">
<el-input v-model="searchForm.remark" type="textarea" placeholder="请输入申请说明" />
</el-form-item>
</el-col>
<!-- <el-col :span="12" class="text-right">-->
<!-- <el-button type="primary" @click="exportBudget" size="default">-->
<!-- <el-icon><Download /></el-icon>-->
@ -307,7 +322,9 @@ const searchForm = reactive({
projectName: '',
projectCode: '',
projectCategory: '',
flowStatus: ''
flowStatus: '',
budgetVersion: 1,
remark: ''
});
//
@ -645,6 +662,8 @@ const handleSave = async (status: string, mode: boolean) => {
ElMessage.warning('不支持的预算类型');
return;
}
budgetForm.budgetVersion = searchForm.budgetVersion;
budgetForm.remark = searchForm.remark;
console.log('----');
console.log(budgetForm);
@ -776,7 +795,21 @@ const processRdCostData = (budgetForm: budgetInfoForm) => {
//
if (assignIfChanged([], rdMaterialCostRef.value?.allMaterialData, oriRdBudgetMaterialCostList.value).length) {
budgetForm.erpRdBudgetMaterialCostList = rdMaterialCostRef.value?.allMaterialData || [];
budgetForm.erpRdBudgetMaterialCostList = (rdMaterialCostRef.value?.allMaterialData || []).map(item => {
const newItem = { ...item };
//
if (newItem.materialType === 2 || newItem.materialType === '2') {
if (newItem.price !== null && newItem.price !== undefined) {
const priceValue = parseFloat(newItem.price);
if (!isNaN(priceValue)) {
// 10000
newItem.price = priceValue * 10000;
}
}
}
return newItem;
});
}
//
@ -937,6 +970,8 @@ async function loadBudgetData() {
routeParams.value = route.query;
budgetId.value = routeParams.value.id as string | number;
await getUsers();
if (!budgetId.value || !['update', 'view', 'approval'].includes(routeParams.value.type as string)) {
handleAddMode();
return;
@ -958,8 +993,8 @@ async function handleLoadMode() {
Object.assign(searchForm, res.data);
if (routeParams.value.changeFlag === '1') {
searchForm.flowStatus = 'draft';
searchForm.budgetVersion = (searchForm.budgetVersion || 0) + 1;
}
await getUsers();
if (isRdOrPreProductionCategory()) {
await handleRdOrPreProductionData(res.data);
@ -989,6 +1024,17 @@ async function handleRdOrPreProductionData(data: any) {
//
const groupedMaterialData = groupByField(data.erpRdBudgetMaterialCostList, 'materialType');
groupedMaterialData[MATERIAL_TYPE.OTHER] = groupedMaterialData[MATERIAL_TYPE.OTHER].map(item => {
return {
...item,
unitPrice: undefined,
amount: undefined,
unitId: undefined,
//
price: item.price ? (item.price / 10000).toFixed(2) : ''
};
});
const groupedTechData = groupByField(data.erpRdBudgetTechCostList, 'techType');
const groupedLaborData = groupByField(data.erpRdBudgetLaborCostList, 'laborType');
const groupedLiteratureData = groupByField(data.erpRdBudgetLiteratureCostList, 'literatureType');

@ -18,6 +18,16 @@
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="版本" prop="budgetVersion">
<el-input-number
v-model="queryParams.budgetVersion"
:min="1"
:precision="0"
placeholder="版本"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="项目经理" prop="managerId">
<el-select v-model="queryParams.managerId" filterable placeholder="请选择项目经理">
<el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId"></el-option>
@ -64,7 +74,7 @@
</template>
<el-table v-loading="loading" border :data="budgetInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="版本,新版本+1" align="center" prop="budgetVersion" v-if="columns[4].visible" />-->
<el-table-column label="项目类别" align="center" prop="projectCategory" v-if="columns[5].visible" width="150">
<template #default="scope">
@ -438,12 +448,14 @@ const handleDelete = async (row?: budgetInfoVO) => {
/** 导出按钮操作 */
const handleExport = (row?: budgetInfoVO) => {
const budgetId = row.budgetId;
const projectName = row.projectName;
proxy?.download(
'oa/erp/budgetInfo/export',
'oa/erp/budgetInfo/exportBudgetInfo',
{
...queryParams.value
budgetId: budgetId
},
`erp/budgetInfo_${new Date().getTime()}.xlsx`
projectName + `_${new Date().getTime()}.xlsx`
);
};

@ -51,7 +51,7 @@
</el-table-column>
<el-table-column prop="monthRate" label="月平均投入比例(%)" width="150">
<template #default="scope">
<el-input-number v-model="scope.row.monthRate" :min="0" :precision="2" size="small" @change="calculateBudgetAmount(scope.row)" style="width:136px;"/>
<el-input-number v-model="scope.row.monthRate" :min="0" :max="100" :precision="2" size="small" @change="calculateBudgetAmount(scope.row)" style="width:136px;"/>
</template>
</el-table-column>
<el-table-column prop="artificialStandard" label="人工标准(元/人月)" width="150">
@ -85,7 +85,7 @@
</el-table-column>
<el-table-column prop="reduceMonthRate" label="月平均投入比例(%)" width="150">
<template #default="scope">
<el-input-number v-model="scope.row.reduceMonthRate" :min="0" :precision="2" size="small" @change="calculateReducedAmount(scope.row)" style="width:136px;"/>
<el-input-number v-model="scope.row.reduceMonthRate" :min="0" :max="100" :precision="2" size="small" @change="calculateReducedAmount(scope.row)" style="width:136px;"/>
</template>
</el-table-column>
<el-table-column prop="reduceArtificialStandard" label="人工标准(元/人月)" width="150">

@ -195,7 +195,7 @@
<!-- 专家咨询合计 -->
<div class="mt-2 bg-gray-50 p-3 rounded text-right font-semibold border-t border-gray-200">
专家咨询合计: {{ formatNumber(expertConsultSubtotal) }} 万元
专家咨询合计: {{ formatNumber(expertConsultSubtotal) }} 万元技术服务费合计: {{ formatNumber(techExpertSubtotal) }} 万元
</div>
</div>
</el-card>
@ -472,6 +472,10 @@ const expertConsultSubtotal = computed(() => {
return expertMeetingSubtotal.value + expertCommSubtotal.value;
});
const techExpertSubtotal = computed(() => {
return (techConsultSubtotal.value || 0) + (expertConsultSubtotal.value || 0);
});
const laborTotal = computed(() => {
return laborList.value.reduce((sum, item) => {
const amountInTenThousand = (Number(item.price) || 0) / 10000;
@ -538,6 +542,7 @@ const calculateServiceAmount = () => {
});
};
const getLaborAmount = () => {
return {
techConsultTotal: ((techConsultSubtotal.value || 0) + (expertConsultSubtotal.value || 0)) * 10000,

@ -33,14 +33,31 @@
<el-table-column prop="unitId" label="单位" width="160">
<template #default="scope">
<el-select v-model="scope.row.unitId" placeholder="单位" filterable allow-create default-first-option style="width: 100%" clearable>
<el-select
v-model="scope.row.unitId"
placeholder="单位"
filterable
allow-create
default-first-option
style="width: 100%"
clearable
v-if="scope.row.materialType === MATERIAL_TYPE.MAIN"
>
<el-option v-for="option in unitOptions" :key="option.unitId" :label="option.unitName" :value="option.unitId" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价(元/单位数量)" width="180">
<template #default="scope">
<el-input-number v-model.number="scope.row.unitPrice" placeholder="单价" :min="0" :precision="2" size="small" @change="calculateAmount" />
<el-input-number
v-model.number="scope.row.unitPrice"
placeholder="单价"
:min="0"
:precision="2"
size="small"
@change="calculateAmount"
v-if="scope.row.materialType === MATERIAL_TYPE.MAIN"
/>
</template>
</el-table-column>
<el-table-column prop="amount" label="购置数量" width="180">
@ -52,13 +69,18 @@
:precision="2"
size="small"
@change="calculateAmount"
v-if="scope.row.materialType === MATERIAL_TYPE.MAIN"
/>
</template>
</el-table-column>
<el-table-column prop="price" label="金额(万元)" width="120">
<el-table-column prop="price" label="金额(万元)" width="160">
<template #default="scope">
{{ format2TenThousandNumber(scope.row.price) }}
<el-input-number v-if="scope.row.materialType === MATERIAL_TYPE.OTHER" v-model="scope.row.price" size="small" :min="0" :precision="2" />
<!-- 其他情况直接显示格式化后的值 -->
<span v-else>
{{ format2TenThousandNumber(scope.row.price) }}
</span>
</template>
</el-table-column>
@ -120,8 +142,8 @@
</template>
<script setup lang="ts">
import { ref, reactive, watch, computed, nextTick } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import { ref, watch, computed, nextTick } from 'vue';
import { ElMessage } from 'element-plus';
import { rdBudgetMaterialCostVO } from '@/api/oa/erp/budgetInfo/rd/rdBudgetMaterialCost/types';
import { getBaseUnitInfoList } from '@/api/oa/base/unitInfo';
import { UnitInfoVO } from '@/api/oa/base/unitInfo/types';
@ -302,7 +324,7 @@ const calculateAmount = () => {
});
//
otherMaterial.value.price = (otherMaterial.value.amount || 0) * (otherMaterial.value.unitPrice || 0);
// otherMaterial.value.price = (otherMaterial.value.amount || 0) * (otherMaterial.value.unitPrice || 0);
//
calculateTotal();
@ -311,7 +333,7 @@ const calculateAmount = () => {
//
const calculateTotal = () => {
const mainAmount = parseFloat(((Number(mainMaterialTotalAmount.value) || 0) / 10000).toFixed(2));
const otherAmount = parseFloat(((Number(otherMaterial.value.price) || 0) / 10000).toFixed(2));
const otherAmount = parseFloat((Number(otherMaterial.value.price) || 0).toFixed(2));
totalAmount.value = (mainAmount + otherAmount).toFixed(2);
};

@ -420,8 +420,8 @@ const calculateTravelSubtotal = () => {
travelList.value.forEach((item) => {
// 宿 = * * 宿
item.stayCosts = (item.peopleNumber || 0) * (item.days || 0) * (item.stayStandard || 0);
// = 50 * *
item.subsidyCosts = 50 * (item.peopleNumber || 0) * (item.days || 0);
// = 90 * *
item.subsidyCosts = 90 * (item.peopleNumber || 0) * (item.days || 0);
// = ( + 宿 + ) / 10000
item.subtotalCosts = (item.travelExpenses || 0) + item.stayCosts + item.subsidyCosts;
});

Loading…
Cancel
Save