大改,使用pinia传值,indexdb做持久化
This commit is contained in:
1 parent
3ad7bae1a9
commit
9a045cfe86
20 files changed
+1527
-545
No files matched your search
+15
-5
@@ -3,10 +3,13 @@ import { computed, defineAsyncComponent, markRaw, nextTick, onBeforeUnmount, onM
|
||||
import type { ComponentPublicInstance } from 'vue'
|
||||
import draggable from 'vuedraggable'
|
||||
import { useTabStore } from '@/pinia/tab'
|
||||
import { useZxFwPricingStore } from '@/pinia/zxFwPricing'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger } from '@/components/ui/tooltip'
|
||||
import { ChevronDown, CircleHelp, RotateCcw, X } from 'lucide-vue-next'
|
||||
import { createPinia } from 'pinia';
|
||||
|
||||
import localforage from 'localforage'
|
||||
import {
|
||||
AlertDialogAction,
|
||||
@@ -348,6 +351,7 @@ const componentMap: Record<string, any> = {
|
||||
}
|
||||
|
||||
const tabStore = useTabStore()
|
||||
const zxFwPricingStore = useZxFwPricingStore()
|
||||
|
||||
|
||||
|
||||
@@ -1098,12 +1102,16 @@ const buildExportReportPayload = async (): Promise<ExportReportPayload> => {
|
||||
const serviceId = toSafeInteger(serviceIdText)
|
||||
if (serviceId == null) return null
|
||||
|
||||
const [method1Raw, method2Raw, method3Raw, method4Raw] = await Promise.all([
|
||||
localforage.getItem<DetailRowsStorageLike<ScaleMethodRowLike>>(`tzGMF-${contractId}-${serviceIdText}`),
|
||||
localforage.getItem<DetailRowsStorageLike<ScaleMethodRowLike>>(`ydGMF-${contractId}-${serviceIdText}`),
|
||||
localforage.getItem<DetailRowsStorageLike<WorkloadMethodRowLike>>(`gzlF-${contractId}-${serviceIdText}`),
|
||||
localforage.getItem<DetailRowsStorageLike<HourlyMethodRowLike>>(`hourlyPricing-${contractId}-${serviceIdText}`)
|
||||
const [method1State, method2State, method3State, method4State] = await Promise.all([
|
||||
zxFwPricingStore.loadServicePricingMethodState<ScaleMethodRowLike>(contractId, serviceIdText, 'investScale'),
|
||||
zxFwPricingStore.loadServicePricingMethodState<ScaleMethodRowLike>(contractId, serviceIdText, 'landScale'),
|
||||
zxFwPricingStore.loadServicePricingMethodState<WorkloadMethodRowLike>(contractId, serviceIdText, 'workload'),
|
||||
zxFwPricingStore.loadServicePricingMethodState<HourlyMethodRowLike>(contractId, serviceIdText, 'hourly')
|
||||
])
|
||||
const method1Raw = method1State ? { detailRows: method1State.detailRows } : null
|
||||
const method2Raw = method2State ? { detailRows: method2State.detailRows } : null
|
||||
const method3Raw = method3State ? { detailRows: method3State.detailRows } : null
|
||||
const method4Raw = method4State ? { detailRows: method4State.detailRows } : null
|
||||
|
||||
const method1 = buildMethod1(method1Raw?.detailRows)
|
||||
const method2 = buildMethod2(method2Raw?.detailRows)
|
||||
@@ -1255,6 +1263,7 @@ const confirmImportOverride = async () => {
|
||||
await writeForage(localforage, normalizeEntries(payload.localforageDefault))
|
||||
|
||||
tabStore.resetTabs()
|
||||
await tabStore.$persistNow?.()
|
||||
dataMenuOpen.value = false
|
||||
window.location.reload()
|
||||
} catch (error) {
|
||||
@@ -1275,6 +1284,7 @@ const handleReset = async () => {
|
||||
console.error('reset failed:', error)
|
||||
} finally {
|
||||
tabStore.resetTabs()
|
||||
await tabStore.$persistNow?.()
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user