1
This commit is contained in:
1 parent
d5cae61861
commit
eb415cd0d0
33 files changed
+2642
-382
No files matched your search
@@ -3,17 +3,14 @@
|
||||
scene="xm-tab"
|
||||
title=""
|
||||
storage-key="project-active-cat"
|
||||
default-category="info"
|
||||
default-category="scale-info"
|
||||
:categories="xmCategories"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, defineAsyncComponent, markRaw, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { defineAsyncComponent, markRaw } from 'vue'
|
||||
import TypeLine from '@/layout/typeLine.vue'
|
||||
import { useKvStore } from '@/pinia/kv'
|
||||
|
||||
const infoView = markRaw(defineAsyncComponent(() => import('@/components/views/info.vue')))
|
||||
const scaleInfoView = markRaw(defineAsyncComponent(() => import('@/components/views/xmInfo.vue')))
|
||||
const htView = markRaw(defineAsyncComponent(() => import('@/components/views/Ht.vue')))
|
||||
const consultCategoryFactorView = markRaw(
|
||||
@@ -23,49 +20,10 @@ const majorFactorView = markRaw(
|
||||
defineAsyncComponent(() => import('@/components/views/XmMajorFactor.vue'))
|
||||
)
|
||||
|
||||
const PROJECT_INFO_KEY = 'xm-base-info-v1'
|
||||
const PROJECT_INIT_CHANGED_EVENT = 'xm-project-init-changed'
|
||||
|
||||
const hasProjectBaseInfo = ref(false)
|
||||
const kvStore = useKvStore()
|
||||
|
||||
const fullXmCategories = [
|
||||
{ key: 'info', label: '基础信息', component: infoView },
|
||||
{ key: 'contract', label: '合同段管理', component: htView },
|
||||
const xmCategories = [
|
||||
{ key: 'scale-info', label: '规模信息', component: scaleInfoView },
|
||||
{ key: 'consult-category-factor', label: '咨询分类系数', component: consultCategoryFactorView },
|
||||
{ key: 'major-factor', label: '工程专业系数', component: majorFactorView }
|
||||
{ key: 'major-factor', label: '工程专业系数', component: majorFactorView },
|
||||
{ key: 'contract', label: '合同段管理', component: htView }
|
||||
]
|
||||
|
||||
const xmCategories = computed(() =>
|
||||
hasProjectBaseInfo.value ? fullXmCategories : [fullXmCategories[0]]
|
||||
)
|
||||
|
||||
const refreshProjectBaseInfoState = async () => {
|
||||
try {
|
||||
const data = await kvStore.getItem(PROJECT_INFO_KEY)
|
||||
hasProjectBaseInfo.value = Boolean(data)
|
||||
} catch (error) {
|
||||
console.error('read project base info failed:', error)
|
||||
hasProjectBaseInfo.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleProjectInitChanged = (event: Event) => {
|
||||
const detail = (event as CustomEvent<boolean>).detail
|
||||
if (typeof detail === 'boolean') {
|
||||
hasProjectBaseInfo.value = detail
|
||||
return
|
||||
}
|
||||
void refreshProjectBaseInfoState()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void refreshProjectBaseInfoState()
|
||||
window.addEventListener(PROJECT_INIT_CHANGED_EVENT, handleProjectInitChanged as EventListener)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener(PROJECT_INIT_CHANGED_EVENT, handleProjectInitChanged as EventListener)
|
||||
})
|
||||
</script>
|
||||
Reference in new issue
Block a user