diff --git a/src/views/tjt/output/index.vue b/src/views/tjt/output/index.vue index fd486ca..48c9454 100644 --- a/src/views/tjt/output/index.vue +++ b/src/views/tjt/output/index.vue @@ -301,15 +301,22 @@
季度分配
-
+
+ 专业所 + 指导价法按指导价法明细分别维护季度分配。 +
+
总分配、已分配、待分配和提取进度备注属于合约规划的总体分配控制;季度分配表只展示年度、季度和分配比例明细。
编辑季度分配 @@ -328,7 +335,13 @@
已分配
- {{ formatPercentText(currentPlanning.allocatedAmount) }} + {{ + formatPercentText( + guideDetailMode && activeGuideDetail + ? activeGuideDetail.allocatedAmount + : currentPlanning.allocatedAmount + ) + }}
@@ -336,7 +349,13 @@
待分配
- {{ formatPercentText(currentPlanning.pendingAmount) }} + {{ + formatPercentText( + guideDetailMode && activeGuideDetail + ? activeGuideDetail.pendingAmount + : currentPlanning.pendingAmount + ) + }}
@@ -350,7 +369,63 @@ - + + + ([]) const currentProject = ref() const currentPlanning = ref() const quarterRows = ref([]) +const guideDetailMode = ref(false) +const historyParentMode = ref(false) +const guideDetailRows = ref([]) +const activeGuideDetailTab = ref('') const queryFormRef = ref() const projectTableRef = ref() const planningTableRef = ref() +let planningDetailRequestSeq = 0 const queryParams = reactive({ pageNo: 1, @@ -478,6 +564,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) { @@ -535,6 +628,20 @@ const buildQuarterRows = ( })) } +const resetQuarterDetailState = () => { + quarterRows.value = [] + guideDetailMode.value = false + historyParentMode.value = false + guideDetailRows.value = [] + activeGuideDetailTab.value = '' +} + +const cancelQuarterDetailState = () => { + planningDetailRequestSeq += 1 + quarterLoading.value = false + resetQuarterDetailState() +} + const getProjectList = async () => { loading.value = true try { @@ -545,7 +652,7 @@ const getProjectList = async () => { currentProject.value = undefined planningList.value = [] currentPlanning.value = undefined - quarterRows.value = [] + cancelQuarterDetailState() return } const targetProjectId = currentProject.value?.id || projectList.value[0].id @@ -562,7 +669,7 @@ const getPlanningList = async () => { if (!currentProject.value?.id) { planningList.value = [] currentPlanning.value = undefined - quarterRows.value = [] + cancelQuarterDetailState() return } planningLoading.value = true @@ -570,7 +677,7 @@ const getPlanningList = async () => { planningList.value = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id) if (!planningList.value.length) { currentPlanning.value = undefined - quarterRows.value = [] + cancelQuarterDetailState() return } const targetPlanningId = currentPlanning.value?.id || planningList.value[0].id @@ -584,14 +691,35 @@ const getPlanningList = async () => { } const loadPlanningDetail = async (planningId: number) => { - const planning = await PlanningApi.getProjectPlanning(planningId) - currentPlanning.value = planning + const requestSeq = ++planningDetailRequestSeq quarterLoading.value = true try { - const quarterList = await PlanningQuarterApi.getProjectPlanningQuarterListByPlanningId(planningId) - quarterRows.value = buildQuarterRows(planning, quarterList) + const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(planningId) + if (requestSeq !== planningDetailRequestSeq) { + return + } + currentPlanning.value = detail?.planning + 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 + if (requestSeq === planningDetailRequestSeq) { + quarterLoading.value = false + } } } @@ -606,14 +734,20 @@ const resetQuery = () => { } const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => { - currentProject.value = row || undefined + const previousProjectId = currentProject.value?.id + const nextProject = row || undefined + currentProject.value = nextProject + if (previousProjectId !== nextProject?.id) { + currentPlanning.value = undefined + cancelQuarterDetailState() + } await getPlanningList() } const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => { if (!row?.id) { currentPlanning.value = undefined - quarterRows.value = [] + cancelQuarterDetailState() return } await loadPlanningDetail(row.id) @@ -630,12 +764,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 () => { diff --git a/src/views/tjt/profit/index.vue b/src/views/tjt/profit/index.vue index 02cf703..c97c136 100644 --- a/src/views/tjt/profit/index.vue +++ b/src/views/tjt/profit/index.vue @@ -88,7 +88,7 @@ {{ formatAmountText(scope.row.finalSettlementAmount) }} - + @@ -210,7 +210,7 @@ {{ formatAmountText(budgetDisplay.finalSettlementAmount) }} - + {{ formatAmountText(budgetDisplay.effectiveSettlementAmount) }} @@ -301,7 +301,7 @@ {{ formatAmountText(accountingDisplay.finalSettlementAmount) }} - + {{ formatAmountText(accountingDisplay.effectiveSettlementAmount) }}