项目成本测算新增项目成本预算、核算、结算,季度分配调整可子合约规划分配
This commit is contained in:
@@ -307,9 +307,10 @@
|
||||
</div>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:update', 'tjt:planning-quarter:update', 'tjt:planning-quarter:create']"
|
||||
:disabled="guideDetailMode && !historyParentMode && !activeGuideDetail"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openQuarterDistributionForm"
|
||||
@click="openQuarterDistributionForm(activeGuideDetail?.id)"
|
||||
>
|
||||
编辑季度分配
|
||||
</el-button>
|
||||
@@ -328,7 +329,13 @@
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">已分配</div>
|
||||
<div class="mt-6px text-18px font-600">
|
||||
{{ formatPercentText(currentPlanning.allocatedAmount) }}
|
||||
{{
|
||||
formatPercentText(
|
||||
guideDetailMode && activeGuideDetail
|
||||
? activeGuideDetail.allocatedAmount
|
||||
: currentPlanning.allocatedAmount
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -336,7 +343,13 @@
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">待分配</div>
|
||||
<div class="mt-6px text-18px font-600">
|
||||
{{ formatPercentText(currentPlanning.pendingAmount) }}
|
||||
{{
|
||||
formatPercentText(
|
||||
guideDetailMode && activeGuideDetail
|
||||
? activeGuideDetail.pendingAmount
|
||||
: currentPlanning.pendingAmount
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -350,7 +363,63 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="quarterRows" border>
|
||||
<template v-if="guideDetailMode && !historyParentMode">
|
||||
<el-empty
|
||||
v-if="!guideDetailRows.length"
|
||||
description="暂无指导价法明细,请先维护指导价法明细"
|
||||
/>
|
||||
<template v-else>
|
||||
<el-tabs v-model="activeGuideDetailTab" class="mb-12px" type="card">
|
||||
<el-tab-pane
|
||||
v-for="detail in guideDetailRows"
|
||||
:key="detail.tabKey"
|
||||
:label="`序号 ${detail.sortNo || '-'}`"
|
||||
:name="detail.tabKey"
|
||||
/>
|
||||
</el-tabs>
|
||||
|
||||
<el-descriptions
|
||||
v-if="activeGuideDetail"
|
||||
:column="4"
|
||||
border
|
||||
class="mb-12px"
|
||||
size="small"
|
||||
>
|
||||
<el-descriptions-item label="设计部位">
|
||||
{{ getDesignPartLabel(activeGuideDetail.designPart) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设计内容/设计类型">
|
||||
{{ activeGuideDetail.buildingType || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设计面积">
|
||||
{{ formatAreaText(activeGuideDetail.designArea) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="考核产值小计">
|
||||
{{ formatAmountText(activeGuideDetail.assessmentOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-table :data="activeGuideDetailQuarterRows" border>
|
||||
<el-table-column align="center" label="分配年度" width="150" prop="distributionYear" />
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
:key="quarter.value"
|
||||
:label="quarter.label"
|
||||
min-width="220"
|
||||
>
|
||||
<template #default="scope">
|
||||
<div class="flex flex-col gap-8px">
|
||||
<div class="rounded-6px bg-[var(--el-fill-color-light)] px-10px py-8px text-12px">
|
||||
分配比例:{{ formatQuarterRatio(scope.row, quarter.value) }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<el-table v-else :data="quarterRows" border>
|
||||
<el-table-column align="center" label="分配年度" width="150" prop="distributionYear" />
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
@@ -399,6 +468,7 @@ import {
|
||||
formatPercentText,
|
||||
getCalculationMethodLabel,
|
||||
getCalculationRatioLabel,
|
||||
getDesignPartLabel,
|
||||
getDesignStageLabel,
|
||||
getOwnershipTypeLabel,
|
||||
getVirtualCalculationMethodLabel,
|
||||
@@ -416,6 +486,11 @@ interface QuarterYearRow {
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
interface GuideDetailQuarterRow extends PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO {
|
||||
tabKey: string
|
||||
quarterRows: QuarterYearRow[]
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
@@ -427,6 +502,10 @@ const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
const currentProject = ref<ProjectApi.ProjectVO>()
|
||||
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
const guideDetailMode = ref(false)
|
||||
const historyParentMode = ref(false)
|
||||
const guideDetailRows = ref<GuideDetailQuarterRow[]>([])
|
||||
const activeGuideDetailTab = ref('')
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
const planningTableRef = ref()
|
||||
@@ -479,6 +558,13 @@ const showParentInternalGuidanceUnitPrice = computed(
|
||||
currentPlanning.value?.internalGuidanceUnitPrice !== undefined &&
|
||||
currentPlanning.value?.internalGuidanceUnitPrice !== null
|
||||
)
|
||||
const activeGuideDetail = computed(() => {
|
||||
return (
|
||||
guideDetailRows.value.find((item) => item.tabKey === activeGuideDetailTab.value) ||
|
||||
guideDetailRows.value[0]
|
||||
)
|
||||
})
|
||||
const activeGuideDetailQuarterRows = computed(() => activeGuideDetail.value?.quarterRows || [])
|
||||
|
||||
const formatFactorText = (value?: number, digits = 4) => {
|
||||
if (value === undefined || value === null) {
|
||||
@@ -536,6 +622,14 @@ const buildQuarterRows = (
|
||||
}))
|
||||
}
|
||||
|
||||
const resetQuarterDetailState = () => {
|
||||
quarterRows.value = []
|
||||
guideDetailMode.value = false
|
||||
historyParentMode.value = false
|
||||
guideDetailRows.value = []
|
||||
activeGuideDetailTab.value = ''
|
||||
}
|
||||
|
||||
const getProjectList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -546,7 +640,7 @@ const getProjectList = async () => {
|
||||
currentProject.value = undefined
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProject.value?.id || projectList.value[0].id
|
||||
@@ -563,7 +657,7 @@ const getPlanningList = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
@@ -571,7 +665,7 @@ const getPlanningList = async () => {
|
||||
planningList.value = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
const targetPlanningId = currentPlanning.value?.id || planningList.value[0].id
|
||||
@@ -589,7 +683,23 @@ const loadPlanningDetail = async (planningId: number) => {
|
||||
try {
|
||||
const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(planningId)
|
||||
currentPlanning.value = detail?.planning
|
||||
quarterRows.value = detail?.planning ? buildQuarterRows(detail.planning, detail.quarters || []) : []
|
||||
guideDetailMode.value = !!detail?.guideDetailMode
|
||||
historyParentMode.value = !!detail?.historyParentMode
|
||||
if (!detail?.planning) {
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
quarterRows.value = buildQuarterRows(detail.planning, detail.quarters || [])
|
||||
guideDetailRows.value = (detail.guideDetails || []).map((item, index) => ({
|
||||
...item,
|
||||
tabKey: String(item.id || item.sortNo || index),
|
||||
quarterRows: buildQuarterRows(detail.planning!, item.quarters || [])
|
||||
}))
|
||||
const currentTab = activeGuideDetailTab.value
|
||||
activeGuideDetailTab.value =
|
||||
guideDetailRows.value.find((item) => item.tabKey === currentTab)?.tabKey ||
|
||||
guideDetailRows.value[0]?.tabKey ||
|
||||
''
|
||||
} finally {
|
||||
quarterLoading.value = false
|
||||
}
|
||||
@@ -613,7 +723,7 @@ const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => {
|
||||
if (!row?.id) {
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
await loadPlanningDetail(row.id)
|
||||
@@ -630,12 +740,15 @@ const openPlanningOutputForm = () => {
|
||||
planningOutputFormRef.value.open(currentPlanning.value.id)
|
||||
}
|
||||
|
||||
const openQuarterDistributionForm = () => {
|
||||
const openQuarterDistributionForm = (guideDetailId?: number) => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
quarterDistributionFormRef.value.open(currentPlanning.value.id)
|
||||
quarterDistributionFormRef.value.open(
|
||||
currentPlanning.value.id,
|
||||
guideDetailMode.value && !historyParentMode.value ? guideDetailId : undefined
|
||||
)
|
||||
}
|
||||
|
||||
const handlePlanningOutputFormSuccess = async () => {
|
||||
|
||||
Reference in New Issue
Block a user