initial commit
This commit is contained in:
commit
2ce6c88312
8
.editorconfig
Normal file
8
.editorconfig
Normal file
@ -0,0 +1,8 @@
|
||||
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
|
||||
charset = utf-8
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
end_of_line = lf
|
||||
max_line_length = 100
|
||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
* text=auto eol=lf
|
||||
30
.gitignore
vendored
Normal file
30
.gitignore
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
dist-ssr
|
||||
coverage
|
||||
*.local
|
||||
|
||||
/cypress/videos/
|
||||
/cypress/screenshots/
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
*.tsbuildinfo
|
||||
6
.prettierrc.json
Normal file
6
.prettierrc.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/prettierrc",
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"printWidth": 100
|
||||
}
|
||||
8
.vscode/extensions.json
vendored
Normal file
8
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"Vue.volar",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"EditorConfig.EditorConfig",
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
||||
187
CLAUDE.md
Normal file
187
CLAUDE.md
Normal file
@ -0,0 +1,187 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## 项目概述
|
||||
|
||||
这是工业模型软件管理统一平台的Vue.js重构版本,集成多个CAD软件系统(CATIA、Creo Parametric、Revit、PDMS、AutoCAD、SolidWorks)。提供模型分析、格式转换和实时监控功能。
|
||||
|
||||
**原系统位置**: `D:\App\vue\Miany`
|
||||
**API文档**: `D:\App\vue\Miany\api.md`
|
||||
**搜索功能指南**: `D:\App\vue\Miany\SEARCH_FEATURE_GUIDE.md`
|
||||
**前端API文档**: `D:\App\vue\Miany\frontend-api-docs.md`
|
||||
|
||||
### 原项目结构参考
|
||||
```
|
||||
D:\App\vue\Miany/
|
||||
├── index.html # 主页面入口 - UI布局参考
|
||||
├── css/ # 样式文件 - 完整样式参考
|
||||
│ ├── variables.css # CSS变量定义
|
||||
│ ├── main.css # 主要样式
|
||||
│ ├── model-viewer.css # 模型查看器样式
|
||||
│ ├── management-panel.css # 管理面板样式
|
||||
│ └── [其他专用样式文件]
|
||||
├── js/ # JavaScript文件 - 仅作功能参考,不复制代码
|
||||
│ ├── main.js # 应用状态管理参考
|
||||
│ ├── config/api-config.js # API配置参考
|
||||
│ └── [其他功能模块]
|
||||
└── pages/ # 页面文件
|
||||
└── model-viewer.html # 模型查看器界面参考
|
||||
```
|
||||
|
||||
## 开发命令
|
||||
|
||||
```bash
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 启动开发服务器
|
||||
npm run dev
|
||||
|
||||
# 生产构建
|
||||
npm run build
|
||||
|
||||
# 预览生产构建
|
||||
npm run preview
|
||||
|
||||
# 代码检查
|
||||
npm run lint
|
||||
|
||||
# 代码格式化
|
||||
npm run format
|
||||
|
||||
# 运行单元测试
|
||||
npm run test:unit
|
||||
|
||||
# 运行端到端测试
|
||||
npm run test:e2e
|
||||
```
|
||||
|
||||
## 架构设计
|
||||
|
||||
### 核心系统架构
|
||||
Vue应用将与分布式后端服务集成,支持多个CAD软件系统:
|
||||
- **Creo Parametric**: `http://localhost:12345`
|
||||
- **Revit**: `http://localhost:9000`
|
||||
- **PDMS**: `http://localhost:9001`
|
||||
- 每个CAD软件运行在独立端口,具有独立的API端点
|
||||
|
||||
### 主要架构模式
|
||||
|
||||
**状态管理**: 使用Pinia进行集中状态管理,替换原有的全局AppState模式。主要状态模块:
|
||||
- `cad-connections`: 跟踪所有CAD软件的连接状态
|
||||
- `model-analysis`: 存储层级分析结果和几何数据
|
||||
- `export-operations`: 管理文件导出任务和格式
|
||||
- `real-time-logs`: 处理操作日志和监控
|
||||
|
||||
**组件架构**:
|
||||
- **CAD集成组件**: 软件选择器、连接监控、状态仪表板
|
||||
- **分析组件**: 层级树查看器、几何复杂度分析器、安全评估
|
||||
- **导出组件**: 格式转换器、批量导出管理器、路径选择器
|
||||
- **监控组件**: 实时日志查看器、资源监控器、任务队列
|
||||
|
||||
**API层**: 为每个CAD系统创建抽象服务:
|
||||
```
|
||||
services/
|
||||
├── cad-api/
|
||||
│ ├── creo-service.js # Creo专用API调用
|
||||
│ ├── revit-service.js # Revit专用API调用
|
||||
│ ├── pdms-service.js # PDMS专用API调用
|
||||
│ └── base-cad-service.js # 通用CAD操作
|
||||
```
|
||||
|
||||
### 关键集成点
|
||||
|
||||
**实时更新**: 实现WebSocket或轮询机制用于:
|
||||
- CAD软件连接状态
|
||||
- 模型分析进度
|
||||
- 导出操作状态
|
||||
- 系统资源监控
|
||||
|
||||
**文件路径管理**: 正确处理Windows文件路径,用于模型文件操作和导出目标。
|
||||
|
||||
### 数据流模式
|
||||
|
||||
**分析工作流**:
|
||||
1. 用户选择CAD软件并连接
|
||||
2. 触发模型分析 → 调用相应CAD服务API
|
||||
3. 处理结果并存储到Pinia状态
|
||||
4. UI组件响应式显示分析数据
|
||||
5. 用户可基于分析结果执行操作(删除、优化、导出)
|
||||
|
||||
**导出工作流**:
|
||||
1. 用户配置导出参数(格式、路径、选项)
|
||||
2. 验证CAD软件连接和当前模型
|
||||
3. 使用软件特定参数调用导出端点API
|
||||
4. 进度监控和结果反馈
|
||||
|
||||
### 核心业务逻辑
|
||||
|
||||
**安全分析**: 系统在允许模型修改前执行安全评估:
|
||||
- 标记为"禁止删除"的组件必须受到保护
|
||||
- 层级分析包含每个组件的安全级别
|
||||
- UI必须清楚指示安全与不安全的操作
|
||||
|
||||
**多CAD支持**: 每个CAD系统具有不同能力:
|
||||
- **Creo**: 支持参数化特征、装配层级、高级几何分析
|
||||
- **Revit**: 专注BIM,支持IFC导出、建筑信息建模
|
||||
- **PDMS**: 工业厂房设计、管道系统
|
||||
- 导出格式和可用操作因CAD软件而异
|
||||
|
||||
### 组件集成指南
|
||||
|
||||
**CAD模块结构**: 每个CAD系统应有专用Vue组件:
|
||||
```
|
||||
components/
|
||||
├── cad-modules/
|
||||
│ ├── CreoModule.vue # Creo专用功能
|
||||
│ ├── RevitModule.vue # Revit专用功能
|
||||
│ ├── PDMSModule.vue # PDMS专用功能
|
||||
│ └── CommonCAD.vue # 共享CAD功能
|
||||
```
|
||||
|
||||
**状态同步**: 维持实时同步:
|
||||
- 前端连接状态与实际CAD软件状态
|
||||
- 分析结果与CAD软件中的当前模型状态
|
||||
- 导出操作与文件系统状态
|
||||
|
||||
### 开发注意事项
|
||||
|
||||
**API错误处理**: 原系统对CAD连接失败有完善的错误处理。实现类似模式并提供适当的用户反馈:
|
||||
- 连接超时
|
||||
- CAD软件未运行
|
||||
- 模型文件访问问题
|
||||
- 导出路径权限问题
|
||||
|
||||
**调试支持**: 包含广泛的调试功能,原系统有详细的控制台日志用于CAD集成问题排查。
|
||||
|
||||
**资源监控**: 实现系统资源监控(CPU、内存使用),因为CAD操作可能占用大量资源。
|
||||
|
||||
## 重构策略
|
||||
|
||||
**重要说明**: 这是从原系统(位于 `D:\App\vue\Miany`)的完全重构,原有代码质量不佳,无法直接使用。
|
||||
|
||||
**重构原则**:
|
||||
- **仅复制UI设计**: 参考原系统的界面布局、样式和交互设计
|
||||
- **重新编写所有代码**: 不迁移任何原有JavaScript代码或业务逻辑
|
||||
- **重新设计架构**: 使用Vue 3 + Pinia构建全新的现代化架构
|
||||
- **重新实现API集成**: 基于API文档重新设计和实现所有后端调用
|
||||
- **重新构建状态管理**: 完全重新设计应用状态和数据流
|
||||
|
||||
**UI参考指南**:
|
||||
从原系统复制以下UI元素的视觉设计:
|
||||
- 顶部导航栏布局和样式
|
||||
- 左侧CAD软件选择面板
|
||||
- 中央工作区域的模块切换界面
|
||||
- 右侧管理面板的标签页设计
|
||||
- 底部状态栏的布局
|
||||
- 模型查看器界面
|
||||
- 层级分析结果的树形展示
|
||||
- 导出配置表单界面
|
||||
|
||||
**不要复制的内容**:
|
||||
- 任何JavaScript代码逻辑
|
||||
- 状态管理实现
|
||||
- API调用代码
|
||||
- 事件处理逻辑
|
||||
- DOM操作代码
|
||||
35
README.md
Normal file
35
README.md
Normal file
@ -0,0 +1,35 @@
|
||||
# .
|
||||
|
||||
This template should help get you started developing with Vue 3 in Vite.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
||||
|
||||
## Customize configuration
|
||||
|
||||
See [Vite Configuration Reference](https://vite.dev/config/).
|
||||
|
||||
## Project Setup
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compile and Hot-Reload for Development
|
||||
|
||||
```sh
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Compile and Minify for Production
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lint with [ESLint](https://eslint.org/)
|
||||
|
||||
```sh
|
||||
npm run lint
|
||||
```
|
||||
26
eslint.config.js
Normal file
26
eslint.config.js
Normal file
@ -0,0 +1,26 @@
|
||||
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||
import globals from 'globals'
|
||||
import js from '@eslint/js'
|
||||
import pluginVue from 'eslint-plugin-vue'
|
||||
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: 'app/files-to-lint',
|
||||
files: ['**/*.{js,mjs,jsx,vue}'],
|
||||
},
|
||||
|
||||
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
|
||||
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
js.configs.recommended,
|
||||
...pluginVue.configs['flat/essential'],
|
||||
skipFormatting,
|
||||
])
|
||||
13
index.html
Normal file
13
index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
8
jsconfig.json
Normal file
8
jsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
4197
package-lock.json
generated
Normal file
4197
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
32
package.json
Normal file
32
package.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "miany-vue",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint . --fix",
|
||||
"format": "prettier --write src/"
|
||||
},
|
||||
"dependencies": {
|
||||
"pinia": "^3.0.3",
|
||||
"vue": "^3.5.18",
|
||||
"vue-router": "^4.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.31.0",
|
||||
"@vitejs/plugin-vue": "^6.0.1",
|
||||
"@vue/eslint-config-prettier": "^10.2.0",
|
||||
"eslint": "^9.31.0",
|
||||
"eslint-plugin-vue": "~10.3.0",
|
||||
"globals": "^16.3.0",
|
||||
"prettier": "3.6.2",
|
||||
"vite": "^7.0.6",
|
||||
"vite-plugin-vue-devtools": "^8.0.0"
|
||||
}
|
||||
}
|
||||
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
11
src/App.vue
Normal file
11
src/App.vue
Normal file
@ -0,0 +1,11 @@
|
||||
<script setup></script>
|
||||
|
||||
<template>
|
||||
<h1>You did it!</h1>
|
||||
<p>
|
||||
Visit <a href="https://vuejs.org/" target="_blank" rel="noopener">vuejs.org</a> to read the
|
||||
documentation
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
12
src/main.js
Normal file
12
src/main.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
|
||||
app.mount('#app')
|
||||
8
src/router/index.js
Normal file
8
src/router/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [],
|
||||
})
|
||||
|
||||
export default router
|
||||
12
src/stores/counter.js
Normal file
12
src/stores/counter.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useCounterStore = defineStore('counter', () => {
|
||||
const count = ref(0)
|
||||
const doubleCount = computed(() => count.value * 2)
|
||||
function increment() {
|
||||
count.value++
|
||||
}
|
||||
|
||||
return { count, doubleCount, increment }
|
||||
})
|
||||
18
vite.config.js
Normal file
18
vite.config.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
vueDevTools(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
},
|
||||
},
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user