优化目录

This commit is contained in:
zwgczx committed 2026-03-17 12:05:22 +08:00
1 parent 4e343cccf1
commit 2b18fe9991
46 files changed
+1061 -1308

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
<script setup lang="ts">
import { computed, onActivated, onMounted, ref } from 'vue'
import { getMajorDictEntries, isMajorIdInIndustryScope } from '@/sql'
import XmFactorGrid from '@/components/shared/XmFactorGrid.vue'
import { useKvStore } from '@/pinia/kv'
interface XmBaseInfoState {
projectIndustry?: string
}
type MajorItem = {
code: string
name: string
defCoe: number | null
desc?: string | null
notshowByzxflxs?: boolean
}
const props = defineProps<{
contractId: string
projectInfoKey?: string
parentStorageKey?: string
}>()
const PROJECT_INFO_KEY = computed(() => props.projectInfoKey || 'xm-base-info-v1')
const projectIndustry = ref('')
const kvStore = useKvStore()
const loadProjectIndustry = async () => {
try {
const data = await kvStore.getItem<XmBaseInfoState>(PROJECT_INFO_KEY.value)
projectIndustry.value =
typeof data?.projectIndustry === 'string' ? data.projectIndustry.trim() : ''
} catch (error) {
console.error('loadProjectIndustry failed:', error)
projectIndustry.value = ''
}
}
const filteredMajorDict = computed<Record<string, MajorItem>>(() => {
const industry = projectIndustry.value
if (!industry) return {}
const entries = getMajorDictEntries()
.filter(({ id }) => isMajorIdInIndustryScope(id, industry))
.map(({ id, item }) => [id, item as MajorItem] as const)
return Object.fromEntries(entries)
})
onMounted(() => {
void loadProjectIndustry()
})
onActivated(() => {
void loadProjectIndustry()
})
</script>
<template>
<XmFactorGrid
title="工程专业系数明细"
:storage-key="`ht-major-factor-v1-${props.contractId}`"
:parent-storage-key="props.parentStorageKey || 'xm-major-factor-v1'"
:dict="filteredMajorDict"
:disable-budget-edit-when-standard-null="true"
:exclude-notshow-by-zxflxs="true"
:init-budget-value-from-standard="true"
/>
</template>