0513新功能优化

This commit is contained in:
lzm
2026-05-13 11:41:30 +08:00
parent ddc0c7db1e
commit 5cb913cb0a
20 changed files with 442 additions and 229 deletions

View File

@@ -159,71 +159,73 @@
/>
</ContentWrap>
<ContentWrap v-if="currentProfit">
<div class="mb-16px flex items-center justify-between gap-16px">
<div class="text-16px font-600">{{ currentProfit.projectName }}</div>
<el-button plain type="primary" @click="openProfitEditDialog">
<Icon class="mr-5px" icon="ep:edit" />
编辑盈亏参数
</el-button>
<ContentWrap>
<div v-loading="detailLoading" class="min-h-220px">
<template v-if="currentProfit">
<div class="mb-16px flex items-center justify-between gap-16px">
<div class="text-16px font-600">{{ currentProfit.projectName }}</div>
<el-button plain type="primary" @click="openProfitEditDialog">
<Icon class="mr-5px" icon="ep:edit" />
编辑盈亏参数
</el-button>
</div>
<el-descriptions :column="3" border>
<el-descriptions-item label="合同产值(元)">
{{ formatAmountText(currentProfit.contractAmount) }}
</el-descriptions-item>
<el-descriptions-item label="最终结算金额(元)">
{{ formatAmountText(currentProfit.finalSettlementAmount) }}
</el-descriptions-item>
<el-descriptions-item label="测算采用金额(元)">
<el-tooltip
v-if="isUsingContractAmount(currentProfit)"
content="最终结算金额未填写,当前暂按合同产值测算"
placement="top"
>
<span>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span>
</el-tooltip>
<span v-else>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span>
</el-descriptions-item>
<el-descriptions-item label="项目开始年度">
{{ currentProfit.projectStartYear || '-' }}
</el-descriptions-item>
<el-descriptions-item label="综合所协作金额(元)">
{{ formatAmountText(currentProfit.comprehensivePlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专业分包金额(元)">
{{ formatAmountText(currentProfit.subcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专业所产值(元)">
{{ formatAmountText(currentProfit.majorOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="专业所预计绩效(元)">
{{ formatAmountText(currentProfit.majorExpectedPerformance) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值比例">
{{ formatPercentText(currentProfit.innovationOutputRate) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值(元)">
{{ formatAmountText(currentProfit.innovationOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="其他成本(元)">
{{ formatAmountText(currentProfit.otherCost) }}
</el-descriptions-item>
<el-descriptions-item label="盈亏值(元)">
<span :class="profitLossClass(currentProfit.profitLossValue)">
{{ formatAmountText(currentProfit.profitLossValue) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="盈亏百分比">
<span :class="profitLossClass(currentProfit.profitLossValue)">
{{ formatPercentText(currentProfit.profitLossRate) }}
</span>
</el-descriptions-item>
</el-descriptions>
</template>
<el-empty v-else-if="!detailLoading" description="请选择项目后查看盈亏详情" />
</div>
<el-descriptions :column="3" border>
<el-descriptions-item label="合同产值(元)">
{{ formatAmountText(currentProfit.contractAmount) }}
</el-descriptions-item>
<el-descriptions-item label="最终结算金额(元)">
{{ formatAmountText(currentProfit.finalSettlementAmount) }}
</el-descriptions-item>
<el-descriptions-item label="测算采用金额(元)">
<el-tooltip
v-if="isUsingContractAmount(currentProfit)"
content="最终结算金额未填写,当前暂按合同产值测算"
placement="top"
>
<span>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span>
</el-tooltip>
<span v-else>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span>
</el-descriptions-item>
<el-descriptions-item label="项目开始年度">
{{ currentProfit.projectStartYear || '-' }}
</el-descriptions-item>
<el-descriptions-item label="综合所协作金额(元)">
{{ formatAmountText(currentProfit.comprehensivePlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专业分包金额(元)">
{{ formatAmountText(currentProfit.subcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专业所产值(元)">
{{ formatAmountText(currentProfit.majorOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="专业所预计绩效(元)">
{{ formatAmountText(currentProfit.majorExpectedPerformance) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值比例">
{{ formatPercentText(currentProfit.innovationOutputRate) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值(元)">
{{ formatAmountText(currentProfit.innovationOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="其他成本(元)">
{{ formatAmountText(currentProfit.otherCost) }}
</el-descriptions-item>
<el-descriptions-item label="盈亏值(元)">
<span :class="profitLossClass(currentProfit.profitLossValue)">
{{ formatAmountText(currentProfit.profitLossValue) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="盈亏百分比">
<span :class="profitLossClass(currentProfit.profitLossValue)">
{{ formatPercentText(currentProfit.profitLossRate) }}
</span>
</el-descriptions-item>
</el-descriptions>
</ContentWrap>
<ContentWrap v-else>
<el-empty description="请选择项目后查看盈亏详情" />
</ContentWrap>
<Dialog v-model="dialogVisible" title="编辑盈亏参数" width="520">
@@ -286,6 +288,7 @@ const message = useMessage()
const { t } = useI18n()
const loading = ref(false)
const detailLoading = ref(false)
const total = ref(0)
const list = ref<ProfitApi.ProjectProfitVO[]>([])
const currentProfit = ref<ProfitApi.ProjectProfitVO>()
@@ -337,21 +340,24 @@ const queryProjectStartYearValue = computed({
const getList = async () => {
loading.value = true
let targetProfit: ProfitApi.ProjectProfitVO | undefined
try {
const data = await ProfitApi.getProjectProfitPage(queryParams)
list.value = data.list
total.value = data.total
if (!list.value.length) {
currentProfit.value = undefined
return
} else {
const targetProjectId = currentProfit.value?.projectId || list.value[0].projectId
targetProfit = list.value.find((item) => item.projectId === targetProjectId) || list.value[0]
}
const targetProjectId = currentProfit.value?.projectId || list.value[0].projectId
const targetProfit = list.value.find((item) => item.projectId === targetProjectId) || list.value[0]
await nextTick()
profitTableRef.value?.setCurrentRow(targetProfit)
} finally {
loading.value = false
}
if (targetProfit) {
await nextTick()
profitTableRef.value?.setCurrentRow(targetProfit)
}
}
const handleQuery = () => {
@@ -369,14 +375,24 @@ const handleCurrentProfitChange = async (row?: ProfitApi.ProjectProfitVO) => {
currentProfit.value = undefined
return
}
currentProfit.value = await ProfitApi.getProjectProfit(row.projectId)
detailLoading.value = true
try {
currentProfit.value = await ProfitApi.getProjectProfit(row.projectId)
} finally {
detailLoading.value = false
}
}
const refreshCurrentProfit = async () => {
if (!currentProfit.value?.projectId) {
return
}
currentProfit.value = await ProfitApi.getProjectProfit(currentProfit.value.projectId)
detailLoading.value = true
try {
currentProfit.value = await ProfitApi.getProjectProfit(currentProfit.value.projectId)
} finally {
detailLoading.value = false
}
await getList()
}
@@ -440,11 +456,18 @@ const profitLossClass = (value?: number) => {
const isUsingContractAmount = (row?: ProfitApi.ProjectProfitVO) =>
!!row && Number(row.finalSettlementAmount || 0) <= 0 && Number(row.contractAmount || 0) > 0
let activatedOnce = false
onMounted(() => {
getList()
})
onActivated(() => {
// KeepAlive 首次挂载也会触发 onActivated跳过首轮避免重复请求列表。
if (!activatedOnce) {
activatedOnce = true
return
}
getList()
})
</script>