86 lines
3.5 KiB
Markdown
86 lines
3.5 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project Overview
|
|
保持中文回复和中文询问
|
|
|
|
Offline, client-side Vue 3 application for calculating transportation infrastructure consulting fees (交通工程造价咨询收费). All data persists to IndexedDB via localforage — there is no backend API.
|
|
|
|
## Tech Stack
|
|
|
|
- **Framework**: Vue 3 with Composition API (`<script setup>` SFCs)
|
|
- **Language**: TypeScript (strict mode)
|
|
- **Build**: Vite 8 (beta) with Rolldown
|
|
- **Package Manager**: Bun
|
|
- **Styling**: Tailwind CSS v4 via `@tailwindcss/vite` plugin
|
|
- **UI Primitives**: Reka UI (headless), Lucide icons
|
|
- **Grids**: AG Grid Enterprise v35 (modules registered globally in `main.ts`)
|
|
- **State**: Pinia with custom IndexedDB persistence plugin (`src/pinia/Plugin/indexdb.ts`)
|
|
- **Math**: decimal.js for precise fee calculations
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
bun run dev # Dev server (bunx --bun vite)
|
|
bun run build # Type-check then build (vue-tsc -b && vite build)
|
|
bun run preview # Preview production build
|
|
bun run type-check # Type-check only (vue-tsc --noEmit)
|
|
```
|
|
|
|
No test framework is configured.
|
|
|
|
## Architecture
|
|
|
|
### Navigation (No Vue Router)
|
|
|
|
Tab-based navigation managed by `useTabStore` (`src/pinia/tab.ts`). Each tab has a `componentName` resolved via `defineAsyncComponent` in `src/layout/tab.vue`. Protected tabs cannot be closed by the user.
|
|
|
|
### Workspace Modes
|
|
|
|
Two modes stored in localStorage under `jgjs-workspace-mode-v1`:
|
|
- `project` — multi-contract project workspace (default)
|
|
- `quick` — single quick-calculation mode
|
|
|
|
Mode logic and tab ID constants live in `src/lib/workspace.ts`.
|
|
|
|
### Pinia Stores
|
|
|
|
| Store | File | Purpose |
|
|
|-------|------|---------|
|
|
| `useTabStore` | `src/pinia/tab.ts` | Tab list, active tab, workspace entry |
|
|
| `useKvStore` | `src/pinia/kv.ts` | Generic key-value persistence layer |
|
|
| `useZxFwPricingStore` | `src/pinia/zxFwPricing.ts` | Core pricing/contract data with versioned snapshot diffing |
|
|
|
|
All stores persist to IndexedDB via the custom plugin in `src/pinia/Plugin/indexdb.ts` (uses localforage).
|
|
|
|
### Domain Data
|
|
|
|
`src/sql.ts` contains the full fee schedule: majors (专业), services (咨询服务), work types, and pricing method lookup tables. Four pricing methods: 投资规模法, 用地规模法, 工作量法, 工时法.
|
|
|
|
### Key Directories
|
|
|
|
- `src/components/views/` — top-level view components (rendered in tabs)
|
|
- `src/components/ht/` — contract (合同) components
|
|
- `src/components/xm/` — project (项目) components
|
|
- `src/components/pricing/` — pricing method panes (one per method)
|
|
- `src/components/shared/` — reusable AG Grid wrappers
|
|
- `src/components/ui/` — primitive UI components (shadcn-vue style)
|
|
- `src/lib/` — utilities: decimal math, number formatting, AG Grid config, workspace logic, `.zw` archive encode/decode
|
|
- `src/layout/` — tab shell and layout components
|
|
|
|
### Import/Export
|
|
|
|
Custom `.zw` binary archive format (`src/lib/zwArchive.ts`) for project data. Excel export via ExcelJS (`src/sql.ts`).
|
|
|
|
## Path Alias
|
|
|
|
`@` maps to `src/` (configured in both `vite.config.ts` and `tsconfig.json`).
|
|
|
|
## Conventions
|
|
|
|
- All UI text is in Chinese (zh-CN)
|
|
- Immutable state updates in Pinia stores (create new arrays/objects, don't mutate)
|
|
- AG Grid modules are registered once globally in `main.ts` — don't re-register in components
|
|
- Decimal.js is used for all fee arithmetic to avoid floating-point errors (`src/lib/decimal.ts`)
|