adspecs 0.1.40 → 0.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@
10
10
  {
11
11
  "name": "adspecs",
12
12
  "description": "AI Coding研发协同开发插件",
13
- "version": "0.1.40",
13
+ "version": "0.1.42",
14
14
  "source": "./",
15
15
  "author": {
16
16
  "name": "Qingwen Chen",
@@ -2,7 +2,7 @@
2
2
  "name": "adspecs",
3
3
  "displayName": "adspecs AI Plugin",
4
4
  "description": "AI first工程规范驱动开发插件",
5
- "version": "0.1.40",
5
+ "version": "0.1.42",
6
6
  "author": {
7
7
  "name": "Qingwen Chen",
8
8
  "email": "cqinwn@qq.com",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adspecs",
3
3
  "displayName": "adspecs AI 工程规范驱动开发插件",
4
- "version": "0.1.40",
4
+ "version": "0.1.42",
5
5
  "description": "AI-first specification-driven development plugin for ECP platform full-lifecycle development",
6
6
  "descriptionZh": "AI优先的工程规范驱动开发插件,覆盖需求分析、PRD、系统设计、任务拆解、TDD、代码评审、Wiki同步全流程",
7
7
  "author": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adspecs",
3
3
  "displayName": "adspecs AI 工程规范驱动开发插件",
4
- "version": "0.1.40",
4
+ "version": "0.1.42",
5
5
  "description": "AI-first specification-driven development plugin for ECP platform full-lifecycle development",
6
6
  "descriptionZh": "AI优先的工程规范驱动开发插件,覆盖需求分析、PRD、系统设计、任务拆解、TDD、代码评审、Wiki同步全流程",
7
7
  "author": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adspecs",
3
3
  "displayName": "adspecs AI 工程规范驱动开发插件",
4
- "version": "0.1.40",
4
+ "version": "0.1.42",
5
5
  "description": "AI-first specification-driven development plugin for ECP platform full-lifecycle development",
6
6
  "descriptionZh": "AI优先的工程规范驱动开发插件,覆盖需求分析、PRD、系统设计、任务拆解、TDD、代码评审、Wiki同步全流程",
7
7
  "author": {
package/README.md CHANGED
@@ -291,7 +291,7 @@ adspecs init
291
291
  | `front-demo/` | Vue 3 前端演示项目(Vite + TS + Element Plus) |
292
292
  | `antd-front-demo/` | Ant Design React 前端演示项目 |
293
293
  | `ant6-front-standard/` | Ant Design 6 前端编码规范(12 篇) |
294
- | `vue3-front-stantard/` | Vue 3 前端编码规范 |
294
+ | `vue3-front-standard/` | Vue 3 前端编码规范 |
295
295
  | `python-end-standard/` | Python 后端参考 |
296
296
  | `yudaocloud-end-standard/` | 芋道 Cloud 后端集成参考 |
297
297
  | `tools/` | 辅助工具集 |
package/bin/adspecs.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
4
  const { Command } = require('commander');
@@ -25,7 +25,7 @@ program
25
25
  .option('--company <name>', '公司名称', 'XX有限公司')
26
26
  .option('--confidentiality <level>', '文件密级: 公开|内部资料|机密|绝密', '内部资料')
27
27
  .option('--mode <mode>', '初始化模式: simple|classic|full|demo')
28
- .option('--front-demo <stack>', '前端演示技术栈: vue|antd', 'vue')
28
+ .option('--front-demo <stack>', '前端演示技术栈: vue|antd')
29
29
  .option('--modules <list>', '后端模块列表(逗号分隔,格式 {port}-crm-{name}:{package})')
30
30
  .option('--non-interactive', '非交互模式,所有未提供的参数使用默认值')
31
31
  .option('--force', '跳过冲突决策,所有已存在区域直接重新创建')
@@ -20,7 +20,8 @@ const platform = require('./platform');
20
20
 
21
21
  // ── 配置 ──────────────────────────────────────────────
22
22
  // 队列文件放在目标项目根目录的平台状态目录下。
23
- // 使用 process.cwd() 获取目标项目根目录(平台运行 hook CWD 即为目标项目)。
23
+ // 项目根由 platform.getProjectRoot() 解析:优先 CLAUDE_PROJECT_DIR 环境变量,兜底 cwd
24
+ // (会话中途 cd 到子目录时,状态文件仍落在真正的项目根,避免队列分裂)。
24
25
  const PROJECT_ROOT = platform.getProjectRoot();
25
26
  const QUEUE_DIR = platform.getStateDir(PROJECT_ROOT);
26
27
  const QUEUE_FILE = path.join(QUEUE_DIR, '.commit-candidates');
package/hooks/hooks.json CHANGED
@@ -1,24 +1,23 @@
1
1
  {
2
- "_comment": "跨平台 Hook 配置 — 同时支持 Claude Code、Qoder 和 WorkBuddy。所有脚本命令使用项目根目录相对路径(hooks/xxx.js),由 /project-init 将插件 hooks/ 复制到目标项目根。平台运行时 CWD 即为目标项目根目录。",
3
2
  "hooks": {
4
3
  "SessionStart": [
5
4
  {
6
5
  "hooks": [
7
6
  {
8
7
  "type": "command",
9
- "command": "node hooks/session-start.js"
8
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-start.js\""
10
9
  },
11
10
  {
12
11
  "type": "command",
13
- "command": "node hooks/wiki-queue.js init"
12
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/wiki-queue.js\" init"
14
13
  },
15
14
  {
16
15
  "type": "command",
17
- "command": "node hooks/commit-queue.js init"
16
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/commit-queue.js\" init"
18
17
  },
19
18
  {
20
19
  "type": "command",
21
- "command": "node hooks/session-logger.js init"
20
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-logger.js\" init"
22
21
  }
23
22
  ]
24
23
  }
@@ -28,7 +27,7 @@
28
27
  "hooks": [
29
28
  {
30
29
  "type": "command",
31
- "command": "node hooks/session-logger.js mark"
30
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-logger.js\" mark"
32
31
  }
33
32
  ]
34
33
  }
@@ -40,24 +39,18 @@
40
39
  "hooks": [
41
40
  {
42
41
  "type": "command",
43
- "command": "node hooks/wiki-queue.js enqueue"
42
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/wiki-queue.js\" enqueue"
44
43
  }
45
- ],
46
- "conditions": {
47
- "filePattern": "\\.(java|py|ts|js|go|rs|cs|md|vue|tsx|jsx)$"
48
- }
44
+ ]
49
45
  },
50
46
  {
51
47
  "matcher": "Write|Edit|SearchReplace",
52
48
  "hooks": [
53
49
  {
54
50
  "type": "command",
55
- "command": "node hooks/commit-queue.js enqueue"
51
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/commit-queue.js\" enqueue"
56
52
  }
57
- ],
58
- "conditions": {
59
- "filePattern": "pipeline-manifest\\.json$"
60
- }
53
+ ]
61
54
  }
62
55
  ],
63
56
  "Stop": [
@@ -65,15 +58,15 @@
65
58
  "hooks": [
66
59
  {
67
60
  "type": "command",
68
- "command": "node hooks/wiki-queue.js report"
61
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/wiki-queue.js\" report"
69
62
  },
70
63
  {
71
64
  "type": "command",
72
- "command": "node hooks/commit-queue.js report"
65
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/commit-queue.js\" report"
73
66
  },
74
67
  {
75
68
  "type": "command",
76
- "command": "node hooks/session-logger.js report"
69
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-logger.js\" report"
77
70
  }
78
71
  ]
79
72
  }
package/hooks/platform.js CHANGED
@@ -72,12 +72,16 @@ function getPluginRoot(hooksDir) {
72
72
 
73
73
  /**
74
74
  * 获取目标项目根目录
75
- * 两种平台均使用 process.cwd()(运行时 CWD 即为目标项目)
75
+ * 优先 CLAUDE_PROJECT_DIR(Claude Code 执行 hook 时注入,恒指向会话项目根),
76
+ * 兜底 process.cwd()。
77
+ * 背景:旧实现仅用 cwd——会话中途 cd 到子目录(如 front-demo/)后,Stop hook 会把
78
+ * .wiki-update-queue / marker / 日志等状态误写进子目录,产生项目状态分裂。
79
+ * Qoder/WorkBuddy 不注入该环境变量,行为与旧版一致。
76
80
  *
77
81
  * @returns {string}
78
82
  */
79
83
  function getProjectRoot() {
80
- return process.cwd();
84
+ return process.env.CLAUDE_PROJECT_DIR || process.cwd();
81
85
  }
82
86
 
83
87
  /**
@@ -18,7 +18,8 @@ const path = require('path');
18
18
  const platform = require('./platform');
19
19
 
20
20
  // ── 路径解析 ──────────────────────────────────────────────
21
- // 使用 process.cwd() 定位目标项目(不用 __dirname,因为 __dirname 指向插件目录)
21
+ // 项目根由 platform.getProjectRoot() 解析:优先 CLAUDE_PROJECT_DIR,兜底 cwd
22
+ // (不用 __dirname——它指向插件目录而非目标项目)
22
23
  const PROJECT_ROOT = platform.getProjectRoot();
23
24
  const STATE_DIR = platform.getStateDir(PROJECT_ROOT);
24
25
  const MARKER_FILE = path.join(STATE_DIR, '.session-save-marker');
@@ -19,7 +19,8 @@ const platform = require('./platform');
19
19
 
20
20
  // ── 配置 ──────────────────────────────────────────────
21
21
  // 队列文件放在目标项目根目录的平台状态目录下。
22
- // 使用 process.cwd() 获取目标项目根目录(平台运行 hook CWD 即为目标项目)。
22
+ // 项目根由 platform.getProjectRoot() 解析:优先 CLAUDE_PROJECT_DIR 环境变量,兜底 cwd
23
+ // (会话中途 cd 到子目录时,状态文件仍落在真正的项目根,避免队列分裂)。
23
24
  const PROJECT_ROOT = platform.getProjectRoot();
24
25
  const QUEUE_DIR = platform.getStateDir(PROJECT_ROOT);
25
26
  const QUEUE_FILE = path.join(QUEUE_DIR, '.wiki-update-queue');
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
- {
2
- "name": "adspecs",
3
- "version": "0.1.40",
4
- "description": "AI first 工程规范驱动开发插件 — 支持 npm 安装和 CLI 初始化",
5
- "bin": {
6
- "adspecs": "bin/adspecs.js"
7
- },
8
- "main": "./src/utils.js",
9
- "files": [
10
- "bin/",
11
- "src/",
12
- ".claude-plugin/",
13
- ".qoder-plugin/",
14
- ".codebuddy-plugin/",
15
- ".workbuddy-plugin/",
16
- ".adspecs/",
17
- "skills/",
18
- "hooks/",
19
- "references/",
20
- "scripts/postinstall.js",
21
- "scripts/sync-version.js",
22
- "CLAUDE.md",
23
- "README.md",
24
- "INSTALL.md",
25
- "CHANGELOG.md",
26
- "LICENSE"
27
- ],
28
- "engines": {
29
- "node": ">=18.0.0"
30
- },
31
- "scripts": {
32
- "test": "node --test src/**/*.test.js",
33
- "postinstall": "node scripts/postinstall.js",
34
- "prepublishOnly": "node scripts/prepublish-check.js",
35
- "version": "node scripts/sync-version.js && git add .claude-plugin/plugin.json .claude-plugin/marketplace.json .qoder-plugin/plugin.json .codebuddy-plugin/plugin.json .workbuddy-plugin/plugin.json",
36
- "sync-version": "node scripts/sync-version.js"
37
- },
38
- "dependencies": {
39
- "commander": "^12.0.0",
40
- "@inquirer/prompts": "^7.0.0",
41
- "chalk": "^4.1.2"
42
- },
43
- "devDependencies": {},
44
- "keywords": [
45
- "adspecs",
46
- "claude-code",
47
- "qoder",
48
- "workbuddy",
49
- "plugin",
50
- "scaffold",
51
- "cli",
52
- "project-init",
53
- "ai-first"
54
- ],
55
- "author": "Qingwen Chen <cqinwn@qq.com>",
56
- "license": "Apache-2.0",
57
- "repository": {
58
- "type": "git",
59
- "url": "https://gitee.com/yuebon/adp-plugins.git"
60
- },
61
- "homepage": "https://gitee.com/yuebon/adp-plugins#readme",
62
- "bugs": {
63
- "url": "https://gitee.com/yuebon/adp-plugins/issues"
64
- }
65
- }
1
+ {
2
+ "name": "adspecs",
3
+ "version": "0.1.42",
4
+ "description": "AI first 工程规范驱动开发插件 — 支持 npm 安装和 CLI 初始化",
5
+ "bin": {
6
+ "adspecs": "bin/adspecs.js"
7
+ },
8
+ "main": "./src/utils.js",
9
+ "files": [
10
+ "bin/",
11
+ "src/",
12
+ ".claude-plugin/",
13
+ ".qoder-plugin/",
14
+ ".codebuddy-plugin/",
15
+ ".workbuddy-plugin/",
16
+ ".adspecs/",
17
+ "skills/",
18
+ "hooks/",
19
+ "references/",
20
+ "scripts/postinstall.js",
21
+ "scripts/sync-version.js",
22
+ "CLAUDE.md",
23
+ "README.md",
24
+ "INSTALL.md",
25
+ "CHANGELOG.md",
26
+ "LICENSE"
27
+ ],
28
+ "engines": {
29
+ "node": ">=18.0.0"
30
+ },
31
+ "scripts": {
32
+ "test": "node --test src/**/*.test.js",
33
+ "postinstall": "node scripts/postinstall.js",
34
+ "prepublishOnly": "node scripts/prepublish-check.js",
35
+ "version": "node scripts/sync-version.js && git add .claude-plugin/plugin.json .claude-plugin/marketplace.json .qoder-plugin/plugin.json .codebuddy-plugin/plugin.json .workbuddy-plugin/plugin.json",
36
+ "sync-version": "node scripts/sync-version.js"
37
+ },
38
+ "dependencies": {
39
+ "commander": "^12.0.0",
40
+ "@inquirer/prompts": "^7.0.0",
41
+ "chalk": "^4.1.2"
42
+ },
43
+ "devDependencies": {},
44
+ "keywords": [
45
+ "adspecs",
46
+ "claude-code",
47
+ "qoder",
48
+ "workbuddy",
49
+ "plugin",
50
+ "scaffold",
51
+ "cli",
52
+ "project-init",
53
+ "ai-first"
54
+ ],
55
+ "author": "Qingwen Chen <cqinwn@qq.com>",
56
+ "license": "Apache-2.0",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "https://gitee.com/yuebon/adp-plugins.git"
60
+ },
61
+ "homepage": "https://gitee.com/yuebon/adp-plugins#readme",
62
+ "bugs": {
63
+ "url": "https://gitee.com/yuebon/adp-plugins/issues"
64
+ }
65
+ }
@@ -0,0 +1,54 @@
1
+ # 前端规则文件索引
2
+
3
+ 本目录包含 `sie-front-demo` 的 AI 开发规则。生成或修改代码前,先按任务类型读取对应规则。
4
+
5
+ ## 文件组织
6
+
7
+ ```text
8
+ .claude/rules/
9
+ ├── INDEX.md
10
+ ├── project-overview.md
11
+ ├── gushen-components.md
12
+ ├── page-development-rules.md
13
+ ├── api-i18n-rules.md
14
+ └── page-template-index.md
15
+ ```
16
+
17
+ ## 推荐读取顺序
18
+
19
+ ### 新增普通业务页面
20
+
21
+ 1. `project-overview.md`
22
+ 2. `page-development-rules.md`
23
+ 3. `gushen-components.md`
24
+ 4. `api-i18n-rules.md`
25
+ 5. `page-template-index.md`
26
+
27
+ ### 新增列表页
28
+
29
+ 1. `gushen-components.md`
30
+ 2. `page-development-rules.md`
31
+ 3. `api-i18n-rules.md`
32
+ 4. `page-template-index.md`
33
+
34
+ ### 新增表单或流程页面
35
+
36
+ 1. `page-development-rules.md`
37
+ 2. `api-i18n-rules.md`
38
+ 3. `page-template-index.md`
39
+
40
+ ### 选择复杂页面模板
41
+
42
+ 1. `page-template-index.md`
43
+ 2. 根据选中的模式补读 `gushen-components.md` 或 `api-i18n-rules.md`
44
+
45
+ ### 使用 `@gushen` 组件
46
+
47
+ 1. `gushen-components.md`
48
+ 2. 如规则不足,读取 `node_modules/@gushen/*/src` 中对应组件源码。
49
+
50
+ ## 维护要求
51
+
52
+ - 新增规则文件时,同步更新本索引和根目录 `claude.md`。
53
+ - 修改页面模板候选时,同步更新 `page-template-index.md`。
54
+ - 组件依赖升级后,重新读取 `node_modules/@gushen/*/src`,再更新 `gushen-components.md`。
@@ -0,0 +1,65 @@
1
+ # API 与多语言规则
2
+
3
+ ## API 文件
4
+
5
+ 新增 API 放在 `src/api/<module>/<page>/index.ts` 或已有模块目录下。
6
+
7
+ 推荐写法:
8
+
9
+ ```ts
10
+ import request from '@/utils/request'
11
+
12
+ export function findPagination(data: any) {
13
+ return request({
14
+ url: '/api/demoa/example/find-pagination',
15
+ method: 'post',
16
+ data,
17
+ })
18
+ }
19
+ ```
20
+
21
+ ## 请求规则
22
+
23
+ - POST 保存、更新、分页查询按现有接口要求传 `data`。
24
+ - 保存/更新业务对象通常使用 `{ params: formData }` 包装。
25
+ - GET 查询单条使用 `params`,不要拼接复杂 query 字符串。
26
+ - 不确定后端前缀时,先参考同模块 API 文件,不要凭空新增服务前缀。
27
+ - 需要动态域名时,参考旧页面中的 `window.getVersionTypeApiUrl(...)` 用法。
28
+
29
+ ## 成功判断
30
+
31
+ - Composition API 页面优先 import `reqIsSucceed`。
32
+ - Options API 旧页面可使用 `this.reqIsSucceed(res)`。
33
+ - 不要在新页面里散落 `res.code === 800`、`res.status === 'S'`;只有维护旧接口或流程接口时才沿用既有判断。
34
+
35
+ ## 错误处理
36
+
37
+ - 保存、删除、提交等用户操作需要 loading 防重复点击。
38
+ - 失败时显示后端 `msg` 或明确错误提示。
39
+ - 不要吞掉 catch;至少恢复 loading 状态。
40
+
41
+ ## 多语言
42
+
43
+ 本工程语言包位于:
44
+
45
+ - `src/lang/zh-cn.ts`
46
+ - `src/lang/en-us.ts`
47
+ - `src/lang/zh-tw.ts`
48
+ - `src/lang/modules/<module>/<locale>.ts`
49
+
50
+ 规则:
51
+
52
+ - 新增用户可见文案优先放入模块语言包。
53
+ - 至少补齐 `zh-cn`、`en-us`、`zh-tw`;如果现有模块已有 `hu-hu`、`vi-vn`,同步评估是否需要补。
54
+ - 模板中使用 `$t('module.key')` 或 `t('module.key')`。
55
+ - 表格列名、按钮、提示、确认文案、校验信息都属于用户可见文案。
56
+
57
+ ## 路由标题
58
+
59
+ 路由 `meta.title` 使用中文标题;`meta.enTitle` 在当前工程常见为多语言 JSON 字符串:
60
+
61
+ ```ts
62
+ enTitle: '{"zh-tw":"消息中心","en-us":"letters","hu-hu":"Üzenetközpont","vi-vn":"Trung tâm thông điệp"}'
63
+ ```
64
+
65
+ 新增路由时保持和邻近路由一致。
@@ -0,0 +1,174 @@
1
+ # Gushen 前端组件规则
2
+
3
+ 本工程依赖:
4
+
5
+ - `@gushen/gushen-common-components`
6
+ - `@gushen/gushen-form-render`
7
+
8
+ 当前目标工程未安装 `@gushen/gushen-work-flow`。如果需求涉及工作流组件(如 `flow-container`、`flow-ea-buttons`、`flow-commit`),先确认依赖、注册方式和运行时子应用边界,不要直接生成组件用法。
9
+
10
+ 使用组件前,优先读取组件源码:`node_modules/@gushen/gushen-common-components/src/packages/components`。
11
+
12
+ ## 全局注册
13
+
14
+ `src/core/initMain.ts` 已执行:
15
+
16
+ ```ts
17
+ import GsComponents from '@gushen/gushen-common-components'
18
+ instance.use(GsComponents)
19
+ ```
20
+
21
+ 因此 `gs-*` 公共组件可直接在模板中使用。当前本地全局组件仅包含 `GsIconDialog`、`GsIcon`、`SvgIcon`、`UploadImg`,注册位置为 `src/components/global-register.ts`。
22
+
23
+ 常见公共组件分类:
24
+
25
+ - 表格:`GsTable`、`GsCustomizeTable`、`GsVxeTable`、`GsSuperTable`
26
+ - 查询/输入:`GsSearchBar`、`GsInput`、`GsSelect`、`GsRadio`、`GsSwitch`
27
+ - 选择器:`GsSelectTreeTable`、`GsPersonnelSelector`、`GsDepartmentSelector`、`GsPageSelect`、`GsDialogSelector`
28
+ - 上传/导入导出:`GsUpload`、`GsAttachmentList`、`UploadImg`、`GsImportData`、`GsExportData`
29
+ - 弹层/布局:`GsDialog`、`GsDrawer`、`GsCard`、`GsGridLayout`
30
+
31
+ ## `GsCustomizeTable` / `gs-table`
32
+
33
+ 源码路径:`node_modules/@gushen/gushen-common-components/src/packages/components/GsCustomizeTable`。
34
+
35
+ ### 推荐用途
36
+
37
+ - 后端分页列表页。
38
+ - 需要列设置、表头查询、刷新、导入导出、关键字搜索的业务列表。
39
+ - 页面模板统一从 `page-template-index.md` 选择;本规则只说明组件 API 和约束。
40
+
41
+ ### 核心配置
42
+
43
+ 组件级常用 props:
44
+
45
+ - `gridConfig`:核心表格配置,和源码 `defaultConfig()` 合并。
46
+ - `queryParams`:请求参数,常见结构为 `{ params: { pageIndex, pageRows, params: {} }, queryUrl }`。
47
+ - `fixedParams`:固定参数,搜索重置时保留。
48
+ - `tableParams`:表头搜索附加参数。
49
+ - `method`:请求方法,默认 `post`。
50
+ - `tableHeight` / `maxHeight`:高度控制。
51
+ - `reserveSelection`:跨页保留勾选,需配合 `rowKey`。
52
+ - `readonly`:只读禁用交互。
53
+ - `isParamsOutSearch`:为 true 时抛出 `paramsOutSearch`,由父组件接管请求。
54
+ - `reqBeforeHandler` / `resDataHandler`:请求前和响应数据处理钩子。
55
+
56
+ 常用顶层配置来自 `common/defaultConfig.js`:
57
+
58
+ - `columns`:列配置。
59
+ - `queryUrl`:远程查询接口。
60
+ - `selectable`:是否显示勾选列。
61
+ - `showIndex`:是否显示序号列。
62
+ - `slotArr`:需要自定义插槽渲染的列字段。
63
+ - `needPagination` / `paged`:是否分页。
64
+ - `hideSearchBtn`:是否隐藏表头查询切换。
65
+ - `showSetting`:是否显示列设置。
66
+ - `showRefresh`:是否显示刷新按钮。
67
+ - `importable` / `exportable`:是否启用导入导出。
68
+ - `enableCustomizeFilter`:是否启用高级筛选。
69
+ - `isVirtualList`:是否启用虚拟滚动。
70
+ - `localstorageName`:列设置缓存 key。
71
+ - `rowKey`:跨页勾选、虚拟列表建议设置,默认常用 `id`。
72
+ - `showKeyWordSearch`:是否显示关键字搜索。
73
+ - `isScrollRequest`:是否启用滚动加载。
74
+
75
+ 列默认配置来自 `common/columnDefaultConfig.js`:
76
+
77
+ - `prop`、`label`、`width`、`align`、`headerAlign`、`fixed`。
78
+ - `isShow`、`hidden`、`hiddenFlag` 控制显示。
79
+ - `sortable` 默认 `true`。
80
+ - `showOverflowTooltip` 默认 `true`。
81
+ - `dataType` 默认 `string`。
82
+ - `dictCode` 可配合字典数据做显示转换。
83
+ - `list` 可提供下拉选项。
84
+ - `component`、`componentAttr`、`list` 可用于表头搜索控件。
85
+ - `sortableType: 'all'` 表示远程排序。
86
+ - `hideSearh` 用于禁用表头搜索(源码拼写如此)。
87
+
88
+ ### 插槽
89
+
90
+ - `#table-title`:表格标题。
91
+ - `#btn`:表格头部左侧按钮。
92
+ - `#btn-r`:头部浮动按钮区域。
93
+ - `#expand`:展开行。
94
+ - `#pager`:自定义分页区域。
95
+ - 字段插槽:字段名必须加入 `slotArr`,例如 `slotArr: ['readStatus', 'action']` 后可写 `#readStatus`、`#action`。
96
+
97
+ ### 事件
98
+
99
+ 常用事件:
100
+
101
+ - `@inited`:表格初始化完成,返回表格实例。
102
+ - `@updateTableData`:表格数据更新。
103
+ - `@update:tableTotal`:总数更新。
104
+ - `@requestError`:请求异常。
105
+ - `@pageChange`、`@sizeChange`:分页变化。
106
+ - `@row-click`:行点击。
107
+ - `@select-all`:全选变化。
108
+ - `@sort-change`:排序变化。
109
+ - `@header-dragend`:列宽拖拽结束。
110
+ - `@needSearchChange`:表头查询开关变化。
111
+ - `@paramsOutSearch`:外部接管查询参数。
112
+ - `@import-success`、`@exportSuccess`:导入导出成功。
113
+
114
+ ### 实例方法
115
+
116
+ 通过 `ref` 可调用:
117
+
118
+ - `refresh(hasLoading, isClearSelection = true)`:刷新数据。
119
+ - `getData(...)`:按当前配置查询。
120
+ - `outSearch(isKeepPage?, noLike?, hasLoading?, index?)`:外部搜索条件变化后触发查询。
121
+ - `tableSearch(isKeepPage?, index?)`:表头查询。
122
+ - `getSelection()`:获取勾选行。
123
+ - `setRowSelection(row, flag, key?)`:切换指定行选中。
124
+ - `getCurrentParams()`:获取当前请求参数。
125
+ - `resetTable()` / `init()` / `doTableLayout()`:重置、初始化、重排布局。
126
+ - `setFirstRow()`:选中首行并触发 `getfirstdata`。
127
+
128
+ ### 生成代码约束
129
+
130
+ - 普通值展示优先使用列配置和 `dictCode`,不要为了纯文本显示滥用插槽。
131
+ - 需要 `el-tag`、按钮、链接、富文本等复杂渲染时,字段必须加入 `slotArr`。
132
+ - 操作列使用 `prop: 'action'`、`fixed: 'right'`,并加入 `slotArr`。
133
+ - 表头查询字段使用 `component`、`componentAttr`、`list`;字典字段优先配置 `dictCode`。
134
+ - 每个列表页设置唯一 `localstorageName`,避免列设置缓存串页。
135
+ - 外部查询条件变化后更新 `queryParams.params.params`,再调用 `tableRef.value?.outSearch(false)`;普通刷新调用 `tableRef.value?.refresh(true)`。
136
+ - 勾选场景必须设置 `rowKey`。
137
+
138
+ ## `GsTable`
139
+
140
+ 源码路径:`node_modules/@gushen/gushen-common-components/src/packages/components/GsTable/index.vue`。
141
+
142
+ - 适合简单本地或远程表格。
143
+ - `columns` 控制列,`options`/工具配置控制搜索、刷新、列设置、选择列、序号列、加减行。
144
+ - `#header` 放头部按钮,`#cell` 用于可编辑或自定义单元格。
145
+ - 旧代码中 `<gs-table :columns="columns" :options="options" :remote="remoteData">` 是可参考写法。
146
+
147
+ ## `GsSearchBar`
148
+
149
+ 源码路径:`node_modules/@gushen/gushen-common-components/src/packages/components/GsSearchBar/index.vue`。
150
+
151
+ - `searchConfig.items` 描述查询项,字段名使用 `field`。
152
+ - `fixedParams` 会合并进查询参数。
153
+ - `btnPosition` 支持 `top` / `bottom`。
154
+ - 查询项 `type` 直接映射 Element Plus 组件,如 `el-input`、`el-select`、`el-cascader`。
155
+ - `el-select` 的选项使用 `options: [{ label, value }]`。
156
+ - `#prepend`、`#append` 可插入按钮。
157
+ - 事件:`@search="handleSearch"`、`@reset="handleReset"`、`@expand="handleExpand"`。
158
+ - 可通过实例方法 `setFormItemValue(field, value)` 设置查询字段。
159
+
160
+ ## 上传与图片
161
+
162
+ - 本地全局 `UploadImg` 来自 `src/components/UploadImg/index.vue`。
163
+ - 公共组件库也提供 `GsUpload`、`UploadImg`,使用前对照源码确认事件和字段。
164
+ - 文件上传 API 参考 `src/api/attachment.ts` 和 `src/components/GsUpload`。
165
+
166
+ ## 动态表单
167
+
168
+ - 依赖 `@gushen/gushen-form-render` 已安装。
169
+ - 动态表单组件来自 `@gushen/gushen-form-render`,常用注册名是 `FormRender` / `<form-render>`;不存在 `GsForm` 业务组件。
170
+ - 当前 `src/core/initMain.ts` 中插件注册是注释状态;新增 `<FormRender />` 前,先确认是否需要解除注释:
171
+ - `import GushenFormRender from '@gushen/gushen-form-render'`
172
+ - `import '@gushen/gushen-form-render/lib/gushen-form-render.css'`
173
+ - `instance.use(GushenFormRender)`
174
+ - 现有动态表单入口:`src/views/dynamic-form/index.vue`。