@agile-team/wl-skills-kit 2.1.2 → 2.1.3
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.
- package/CHANGELOG.md +14 -0
- package/README.md +6 -5
- package/bin/wl-skills.js +35 -1
- package/files/.github/guides/README.md +13 -13
- package/files/.github/guides/architecture.md +555 -555
- package/files/.github/guides/usage.md +166 -166
- package/files/.github/reports/README.md +65 -65
- package/files/.github/reports/SYS_DICT_INFO.md +19 -19
- package/files/.github/reports/SYS_MENU_INFO.md +247 -247
- package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -20
- package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -33
- package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -44
- package/files/.github/skills/_compat/README.md +108 -108
- package/files/.github/skills/_compat/headers/agents.txt +8 -8
- package/files/.github/skills/_compat/headers/claude-code.txt +7 -7
- package/files/.github/skills/_compat/headers/cline.txt +7 -7
- package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -16
- package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -7
- package/files/.github/skills/_compat/headers/github-copilot.txt +1 -1
- package/files/.github/skills/_compat/headers/kiro.txt +10 -10
- package/files/.github/skills/_compat/headers/trae.txt +11 -11
- package/files/.github/skills/_compat/headers/windsurf.txt +7 -7
- package/files/.github/skills/_registry.md +81 -81
- package/files/.github/skills/core/api-contract/SKILL.md +344 -344
- package/files/.github/skills/core/api-contract/USAGE.md +110 -110
- package/files/.github/skills/core/convention-audit/SKILL.md +189 -189
- package/files/.github/skills/core/convention-audit/USAGE.md +99 -99
- package/files/.github/skills/core/page-codegen/SKILL.md +973 -973
- package/files/.github/skills/core/page-codegen/USAGE.md +102 -102
- package/files/.github/skills/core/page-codegen/templates/_index.md +46 -46
- package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -107
- package/files/.github/skills/core/page-codegen/templates/domains/produce/TPL-OPERATION-STATION.md +442 -442
- package/files/.github/skills/core/page-codegen/templates/domains/sale/README.md +26 -26
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-CHANGE-HISTORY.md +276 -276
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-DETAIL-TABS.md +1145 -1145
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-DRIVEN.md +124 -124
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-FORM-ROUTE.md +436 -436
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-LIST.md +191 -191
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-MASTER-DETAIL.md +148 -148
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-RECORD-FORM.md +371 -371
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-TREE-LIST.md +186 -186
- package/files/.github/skills/core/prototype-scan/SKILL.md +498 -498
- package/files/.github/skills/core/prototype-scan/USAGE.md +95 -95
- package/files/.github/skills/core/template-extract/SKILL.md +139 -139
- package/files/.github/skills/core/template-extract/USAGE.md +93 -93
- package/files/.github/skills/domain/README.md +51 -51
- package/files/.github/skills/ops/code-fix/SKILL.draft.md +108 -108
- package/files/.github/skills/sync/dict-sync/SKILL.draft.md +100 -100
- package/files/.github/skills/sync/menu-sync/SKILL.md +258 -258
- package/files/.github/skills/sync/menu-sync/USAGE.md +104 -104
- package/files/.github/skills/sync/menu-sync/env/env.local.json +6 -6
- package/files/.github/skills/sync/menu-sync/env/guide.md +83 -83
- package/files/.github/skills/sync/permission-sync/SKILL.draft.md +91 -91
- package/files/.github/standards/01-toolchain.md +57 -57
- package/files/.github/standards/02-code-structure.md +111 -111
- package/files/.github/standards/03-comments.md +53 -53
- package/files/.github/standards/04-coding-basics.md +33 -33
- package/files/.github/standards/05-logging.md +38 -38
- package/files/.github/standards/06-security.md +44 -44
- package/files/.github/standards/07-config.md +52 -52
- package/files/.github/standards/08-git.md +60 -60
- package/files/.github/standards/09-typescript.md +71 -71
- package/files/.github/standards/10-pinia.md +57 -57
- package/files/.github/standards/11-form-validation.md +81 -81
- package/files/.github/standards/12-base-table.md +116 -116
- package/files/.github/standards/13-platform-components.md +123 -123
- package/files/.github/standards/index.md +89 -89
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -196
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -150
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -79
- package/files/docs/jh-date-range.md +257 -257
- package/files/docs/jh-date.md +222 -222
- package/files/docs/jh-dept-picker.md +190 -190
- package/files/docs/jh-drag-row.md +590 -590
- package/files/docs/jh-file-upload.md +216 -216
- package/files/docs/jh-picker.md +218 -218
- package/files/docs/jh-select.md +148 -148
- package/files/docs/jh-text.md +248 -248
- package/files/docs/jh-user-picker.md +197 -197
- package/package.json +2 -4
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
# Standards 规范门控(懒加载入口)
|
|
2
|
-
|
|
3
|
-
> **版本**:v1.0.0 **维护者**:CHENY (工号 409322)
|
|
4
|
-
> **加载策略**:AI 按当前任务类型,**只读取相关条目**,不全量加载。
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## 13 条规范清单
|
|
9
|
-
|
|
10
|
-
| 编号 | 文件 | 主题 | 强制度 |
|
|
11
|
-
| ---- | --------------------------- | ---------------------- | -------------- |
|
|
12
|
-
| 01 | `01-toolchain.md` | 工具链前置检测 | 🔴 阻断 |
|
|
13
|
-
| 02 | `02-code-structure.md` | 代码结构与顺序 | 🔴 必遵 |
|
|
14
|
-
| 03 | `03-comments.md` | 注释规范 | 🟡 建议 |
|
|
15
|
-
| 04 | `04-coding-basics.md` | 基础编码(13 条) | 🔴 必遵 |
|
|
16
|
-
| 05 | `05-logging.md` | 日志输出 | 🔴 必遵 |
|
|
17
|
-
| 06 | `06-security.md` | 安全规范 | 🔴 必遵 |
|
|
18
|
-
| 07 | `07-config.md` | 配置管理 | 🔴 必遵 |
|
|
19
|
-
| 08 | `08-git.md` | Git 分支 & 提交 | 🔴 必遵 |
|
|
20
|
-
| 09 | `09-typescript.md` | TypeScript 类型 | 🟡 建议 |
|
|
21
|
-
| 10 | `10-pinia.md` | Pinia 状态管理 | 🔴 必遵 |
|
|
22
|
-
| 11 | `11-form-validation.md` | 表单与校验 | 🔴 必遵 |
|
|
23
|
-
| 12 | `12-base-table.md` | BaseTable + AGGrid cid | 🔴 必遵 |
|
|
24
|
-
| 13 | `13-platform-components.md` | 平台组件合规(核心) | 🔴 必遵 + 阻断 |
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 任务类型 → 必读规范映射
|
|
29
|
-
|
|
30
|
-
> AI 按用户意图选取下方匹配的「任务类型」,**仅加载该类型对应的规范文件**。
|
|
31
|
-
|
|
32
|
-
### 任务类型 A:生成新页面(page-codegen)
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
必读:01 / 02 / 04 / 12 / 13
|
|
36
|
-
按需:09(TS 类型复杂时) / 10(涉及 Store) / 11(FORM_ROUTE 模板)
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### 任务类型 B:修改/重构既有页面
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
必读:02 / 04 / 13
|
|
43
|
-
按需:09 / 10 / 11
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### 任务类型 C:规范审计(convention-audit)
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
必读:全部 13 条(审计需要完整对照)
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 任务类型 D:模板提取(template-extract)
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
必读:02 / 13(模板必须遵循结构与组件合规规则)
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 任务类型 E:菜单/字典/权限同步类
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
必读:07(环境变量与 API 地址不硬编码)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### 任务类型 F:仅 Git 操作 / Commit
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
必读:08
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## 加载方式(Pre-flight 声明示例)
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
✅ 已读取 standards/index.md → 规范门控,匹配任务类型 A(生成新页面)
|
|
76
|
-
✅ 已读取 standards/02-code-structure.md → 4 文件原则 + 三段式 + script 9 段顺序
|
|
77
|
-
✅ 已读取 standards/12-base-table.md → AGGrid 必用 + cid 命名规范
|
|
78
|
-
✅ 已读取 standards/13-platform-components.md → 平台组件对照表
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
> **不要** 一次性读取全部 13 条。错误示范:`✅ 已读取 standards/01 ~ standards/13`(浪费 token,违反懒加载原则)。
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## 规范变更管理
|
|
86
|
-
|
|
87
|
-
- 新增规范条目:编号顺序追加,不复用废弃编号
|
|
88
|
-
- 修改既有规范:在文件末尾追加 `## 变更记录` 章节,登记日期 + 变更摘要
|
|
89
|
-
- 整体破坏性变更:升级本文件顶部 `version`,并在根 `CHANGELOG.md` 标注
|
|
1
|
+
# Standards 规范门控(懒加载入口)
|
|
2
|
+
|
|
3
|
+
> **版本**:v1.0.0 **维护者**:CHENY (工号 409322)
|
|
4
|
+
> **加载策略**:AI 按当前任务类型,**只读取相关条目**,不全量加载。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 13 条规范清单
|
|
9
|
+
|
|
10
|
+
| 编号 | 文件 | 主题 | 强制度 |
|
|
11
|
+
| ---- | --------------------------- | ---------------------- | -------------- |
|
|
12
|
+
| 01 | `01-toolchain.md` | 工具链前置检测 | 🔴 阻断 |
|
|
13
|
+
| 02 | `02-code-structure.md` | 代码结构与顺序 | 🔴 必遵 |
|
|
14
|
+
| 03 | `03-comments.md` | 注释规范 | 🟡 建议 |
|
|
15
|
+
| 04 | `04-coding-basics.md` | 基础编码(13 条) | 🔴 必遵 |
|
|
16
|
+
| 05 | `05-logging.md` | 日志输出 | 🔴 必遵 |
|
|
17
|
+
| 06 | `06-security.md` | 安全规范 | 🔴 必遵 |
|
|
18
|
+
| 07 | `07-config.md` | 配置管理 | 🔴 必遵 |
|
|
19
|
+
| 08 | `08-git.md` | Git 分支 & 提交 | 🔴 必遵 |
|
|
20
|
+
| 09 | `09-typescript.md` | TypeScript 类型 | 🟡 建议 |
|
|
21
|
+
| 10 | `10-pinia.md` | Pinia 状态管理 | 🔴 必遵 |
|
|
22
|
+
| 11 | `11-form-validation.md` | 表单与校验 | 🔴 必遵 |
|
|
23
|
+
| 12 | `12-base-table.md` | BaseTable + AGGrid cid | 🔴 必遵 |
|
|
24
|
+
| 13 | `13-platform-components.md` | 平台组件合规(核心) | 🔴 必遵 + 阻断 |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 任务类型 → 必读规范映射
|
|
29
|
+
|
|
30
|
+
> AI 按用户意图选取下方匹配的「任务类型」,**仅加载该类型对应的规范文件**。
|
|
31
|
+
|
|
32
|
+
### 任务类型 A:生成新页面(page-codegen)
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
必读:01 / 02 / 04 / 12 / 13
|
|
36
|
+
按需:09(TS 类型复杂时) / 10(涉及 Store) / 11(FORM_ROUTE 模板)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 任务类型 B:修改/重构既有页面
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
必读:02 / 04 / 13
|
|
43
|
+
按需:09 / 10 / 11
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 任务类型 C:规范审计(convention-audit)
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
必读:全部 13 条(审计需要完整对照)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 任务类型 D:模板提取(template-extract)
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
必读:02 / 13(模板必须遵循结构与组件合规规则)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 任务类型 E:菜单/字典/权限同步类
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
必读:07(环境变量与 API 地址不硬编码)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 任务类型 F:仅 Git 操作 / Commit
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
必读:08
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 加载方式(Pre-flight 声明示例)
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
✅ 已读取 standards/index.md → 规范门控,匹配任务类型 A(生成新页面)
|
|
76
|
+
✅ 已读取 standards/02-code-structure.md → 4 文件原则 + 三段式 + script 9 段顺序
|
|
77
|
+
✅ 已读取 standards/12-base-table.md → AGGrid 必用 + cid 命名规范
|
|
78
|
+
✅ 已读取 standards/13-platform-components.md → 平台组件对照表
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
> **不要** 一次性读取全部 13 条。错误示范:`✅ 已读取 standards/01 ~ standards/13`(浪费 token,违反懒加载原则)。
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 规范变更管理
|
|
86
|
+
|
|
87
|
+
- 新增规范条目:编号顺序追加,不复用废弃编号
|
|
88
|
+
- 修改既有规范:在文件末尾追加 `## 变更记录` 章节,登记日期 + 变更摘要
|
|
89
|
+
- 整体破坏性变更:升级本文件顶部 `version`,并在根 `CHANGELOG.md` 标注
|
|
@@ -1,196 +1,196 @@
|
|
|
1
|
-
import { getAction } from "@jhlc/common-core/src/api/action";
|
|
2
|
-
import { useRouter } from "vue-router";
|
|
3
|
-
import { createChangeMockData } from "@/components/local/c_customerTabs/data";
|
|
4
|
-
import type {
|
|
5
|
-
BasicInfoForm,
|
|
6
|
-
BusinessInfoRow
|
|
7
|
-
} from "@/components/local/c_customerTabs/data";
|
|
8
|
-
|
|
9
|
-
export const API_CONFIG = {
|
|
10
|
-
changeHistoryList: "/sale/customerApply/changeHistory/list",
|
|
11
|
-
getById: "/sale/customerApply/changeHistory/getById",
|
|
12
|
-
getDiffById: "/sale/customerApply/changeHistory/getDiffById"
|
|
13
|
-
} as const;
|
|
14
|
-
|
|
15
|
-
export interface HistoryRecord {
|
|
16
|
-
id: string;
|
|
17
|
-
changeType: string;
|
|
18
|
-
changeTime: string;
|
|
19
|
-
changePerson: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** 变更历史记录 mock 数据(对齐原型截图,首条为"数据变更"以便立即展示比对效果) */
|
|
23
|
-
function createHistoryListMock(): HistoryRecord[] {
|
|
24
|
-
return [
|
|
25
|
-
{
|
|
26
|
-
id: "h001",
|
|
27
|
-
changeType: "数据变更",
|
|
28
|
-
changeTime: "2025/12/15 13:48:07",
|
|
29
|
-
changePerson: "变更人姓名"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: "h002",
|
|
33
|
-
changeType: "数据新增",
|
|
34
|
-
changeTime: "2025/12/15 13:48:07",
|
|
35
|
-
changePerson: "新增人姓名"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
id: "h003",
|
|
39
|
-
changeType: "数据新增",
|
|
40
|
-
changeTime: "2025/12/15 13:48:07",
|
|
41
|
-
changePerson: "新增人姓名"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: "h004",
|
|
45
|
-
changeType: "数据变更",
|
|
46
|
-
changeTime: "2025/12/15 13:48:07",
|
|
47
|
-
changePerson: "变更人姓名"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: "h005",
|
|
51
|
-
changeType: "数据变更",
|
|
52
|
-
changeTime: "2025/12/15 13:48:07",
|
|
53
|
-
changePerson: "变更人姓名"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
id: "h006",
|
|
57
|
-
changeType: "数据新增",
|
|
58
|
-
changeTime: "2025/12/15 13:48:07",
|
|
59
|
-
changePerson: "新增人姓名"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: "h007",
|
|
63
|
-
changeType: "数据新增",
|
|
64
|
-
changeTime: "2025/12/15 13:48:07",
|
|
65
|
-
changePerson: "新增人姓名"
|
|
66
|
-
}
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** 变更比对 mock:旧版数据(对齐原型截图中的上下比对效果)
|
|
71
|
-
* 使用显示标签(非值码),以便 diff-old-value 直接展示中文。
|
|
72
|
-
* - basicInfo.taxCategory: "小规模纳税人"(旧)vs "一级纳税人"(新)
|
|
73
|
-
* - basicInfo.relationType: "02-合并关系人"(旧)vs "03-非关系人"(新)
|
|
74
|
-
* - businessInfoList[0]: salesType "外销"(旧)vs "内销"(新),customerLevel "B3" vs "B1"
|
|
75
|
-
*/
|
|
76
|
-
function createDiffMockData(): {
|
|
77
|
-
basicInfo: BasicInfoForm;
|
|
78
|
-
businessInfoList: BusinessInfoRow[];
|
|
79
|
-
} {
|
|
80
|
-
const current = createChangeMockData();
|
|
81
|
-
return {
|
|
82
|
-
basicInfo: {
|
|
83
|
-
...current.basicInfo,
|
|
84
|
-
taxCategory: "小规模纳税人",
|
|
85
|
-
relationType: "02-合并关系人"
|
|
86
|
-
},
|
|
87
|
-
businessInfoList: current.businessInfoList.map((row, idx) => {
|
|
88
|
-
if (idx === 0) {
|
|
89
|
-
return { ...row, salesType: "外销", customerLevel: "B3" };
|
|
90
|
-
}
|
|
91
|
-
return { ...row };
|
|
92
|
-
})
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export function useChangeHistory(tabsRef: any) {
|
|
97
|
-
const router = useRouter();
|
|
98
|
-
const loading = ref(false);
|
|
99
|
-
const historyLoading = ref(false);
|
|
100
|
-
const historyList = ref<HistoryRecord[]>([]);
|
|
101
|
-
const selectedId = ref<string>("");
|
|
102
|
-
const isMockMode = ref(false);
|
|
103
|
-
|
|
104
|
-
// ─── 真实接口模式(有 id 时调用) ───
|
|
105
|
-
|
|
106
|
-
async function loadHistoryList(applyId: string) {
|
|
107
|
-
isMockMode.value = false;
|
|
108
|
-
historyLoading.value = true;
|
|
109
|
-
try {
|
|
110
|
-
const res = await getAction(API_CONFIG.changeHistoryList, { applyId });
|
|
111
|
-
if (res?.data?.length) {
|
|
112
|
-
historyList.value = res.data;
|
|
113
|
-
}
|
|
114
|
-
} finally {
|
|
115
|
-
historyLoading.value = false;
|
|
116
|
-
if (historyList.value.length > 0) {
|
|
117
|
-
await loadHistoryDetail(historyList.value[0].id);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
async function loadHistoryDetail(id: string) {
|
|
123
|
-
selectedId.value = id;
|
|
124
|
-
loading.value = true;
|
|
125
|
-
const currentRecord = historyList.value.find((r) => r.id === id);
|
|
126
|
-
const isChangeType = currentRecord?.changeType.includes("变更");
|
|
127
|
-
try {
|
|
128
|
-
const res = await getAction(API_CONFIG.getById, { id });
|
|
129
|
-
if (res?.data) {
|
|
130
|
-
tabsRef.value?.loadData(res.data);
|
|
131
|
-
if (isChangeType) {
|
|
132
|
-
const diffRes = await getAction(API_CONFIG.getDiffById, { id }).catch(
|
|
133
|
-
() => null
|
|
134
|
-
);
|
|
135
|
-
if (diffRes?.data) {
|
|
136
|
-
tabsRef.value?.loadDiffData(diffRes.data);
|
|
137
|
-
} else {
|
|
138
|
-
tabsRef.value?.clearDiffData?.();
|
|
139
|
-
}
|
|
140
|
-
} else {
|
|
141
|
-
tabsRef.value?.clearDiffData?.();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
} finally {
|
|
145
|
-
loading.value = false;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// ─── Mock 模式(无 id 时调用,纯本地数据,零接口请求) ───
|
|
150
|
-
|
|
151
|
-
function loadMockData() {
|
|
152
|
-
isMockMode.value = true;
|
|
153
|
-
historyList.value = createHistoryListMock();
|
|
154
|
-
if (historyList.value.length > 0) {
|
|
155
|
-
nextTick(() => selectMockDetail(historyList.value[0].id));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function selectMockDetail(id: string) {
|
|
160
|
-
selectedId.value = id;
|
|
161
|
-
const currentRecord = historyList.value.find((r) => r.id === id);
|
|
162
|
-
const isChangeType = currentRecord?.changeType.includes("变更");
|
|
163
|
-
tabsRef.value?.loadData(createChangeMockData());
|
|
164
|
-
if (isChangeType) {
|
|
165
|
-
tabsRef.value?.loadDiffData(createDiffMockData());
|
|
166
|
-
} else {
|
|
167
|
-
tabsRef.value?.clearDiffData?.();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// ─── 公共 ───
|
|
172
|
-
|
|
173
|
-
function handleSelectHistory(item: HistoryRecord) {
|
|
174
|
-
if (item.id === selectedId.value) return;
|
|
175
|
-
if (isMockMode.value) {
|
|
176
|
-
selectMockDetail(item.id);
|
|
177
|
-
} else {
|
|
178
|
-
loadHistoryDetail(item.id);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function handleCancel() {
|
|
183
|
-
router.back();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return {
|
|
187
|
-
loading,
|
|
188
|
-
historyLoading,
|
|
189
|
-
historyList,
|
|
190
|
-
selectedId,
|
|
191
|
-
loadHistoryList,
|
|
192
|
-
loadMockData,
|
|
193
|
-
handleSelectHistory,
|
|
194
|
-
handleCancel
|
|
195
|
-
};
|
|
196
|
-
}
|
|
1
|
+
import { getAction } from "@jhlc/common-core/src/api/action";
|
|
2
|
+
import { useRouter } from "vue-router";
|
|
3
|
+
import { createChangeMockData } from "@/components/local/c_customerTabs/data";
|
|
4
|
+
import type {
|
|
5
|
+
BasicInfoForm,
|
|
6
|
+
BusinessInfoRow
|
|
7
|
+
} from "@/components/local/c_customerTabs/data";
|
|
8
|
+
|
|
9
|
+
export const API_CONFIG = {
|
|
10
|
+
changeHistoryList: "/sale/customerApply/changeHistory/list",
|
|
11
|
+
getById: "/sale/customerApply/changeHistory/getById",
|
|
12
|
+
getDiffById: "/sale/customerApply/changeHistory/getDiffById"
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export interface HistoryRecord {
|
|
16
|
+
id: string;
|
|
17
|
+
changeType: string;
|
|
18
|
+
changeTime: string;
|
|
19
|
+
changePerson: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** 变更历史记录 mock 数据(对齐原型截图,首条为"数据变更"以便立即展示比对效果) */
|
|
23
|
+
function createHistoryListMock(): HistoryRecord[] {
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
id: "h001",
|
|
27
|
+
changeType: "数据变更",
|
|
28
|
+
changeTime: "2025/12/15 13:48:07",
|
|
29
|
+
changePerson: "变更人姓名"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "h002",
|
|
33
|
+
changeType: "数据新增",
|
|
34
|
+
changeTime: "2025/12/15 13:48:07",
|
|
35
|
+
changePerson: "新增人姓名"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "h003",
|
|
39
|
+
changeType: "数据新增",
|
|
40
|
+
changeTime: "2025/12/15 13:48:07",
|
|
41
|
+
changePerson: "新增人姓名"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "h004",
|
|
45
|
+
changeType: "数据变更",
|
|
46
|
+
changeTime: "2025/12/15 13:48:07",
|
|
47
|
+
changePerson: "变更人姓名"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "h005",
|
|
51
|
+
changeType: "数据变更",
|
|
52
|
+
changeTime: "2025/12/15 13:48:07",
|
|
53
|
+
changePerson: "变更人姓名"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "h006",
|
|
57
|
+
changeType: "数据新增",
|
|
58
|
+
changeTime: "2025/12/15 13:48:07",
|
|
59
|
+
changePerson: "新增人姓名"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "h007",
|
|
63
|
+
changeType: "数据新增",
|
|
64
|
+
changeTime: "2025/12/15 13:48:07",
|
|
65
|
+
changePerson: "新增人姓名"
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** 变更比对 mock:旧版数据(对齐原型截图中的上下比对效果)
|
|
71
|
+
* 使用显示标签(非值码),以便 diff-old-value 直接展示中文。
|
|
72
|
+
* - basicInfo.taxCategory: "小规模纳税人"(旧)vs "一级纳税人"(新)
|
|
73
|
+
* - basicInfo.relationType: "02-合并关系人"(旧)vs "03-非关系人"(新)
|
|
74
|
+
* - businessInfoList[0]: salesType "外销"(旧)vs "内销"(新),customerLevel "B3" vs "B1"
|
|
75
|
+
*/
|
|
76
|
+
function createDiffMockData(): {
|
|
77
|
+
basicInfo: BasicInfoForm;
|
|
78
|
+
businessInfoList: BusinessInfoRow[];
|
|
79
|
+
} {
|
|
80
|
+
const current = createChangeMockData();
|
|
81
|
+
return {
|
|
82
|
+
basicInfo: {
|
|
83
|
+
...current.basicInfo,
|
|
84
|
+
taxCategory: "小规模纳税人",
|
|
85
|
+
relationType: "02-合并关系人"
|
|
86
|
+
},
|
|
87
|
+
businessInfoList: current.businessInfoList.map((row, idx) => {
|
|
88
|
+
if (idx === 0) {
|
|
89
|
+
return { ...row, salesType: "外销", customerLevel: "B3" };
|
|
90
|
+
}
|
|
91
|
+
return { ...row };
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function useChangeHistory(tabsRef: any) {
|
|
97
|
+
const router = useRouter();
|
|
98
|
+
const loading = ref(false);
|
|
99
|
+
const historyLoading = ref(false);
|
|
100
|
+
const historyList = ref<HistoryRecord[]>([]);
|
|
101
|
+
const selectedId = ref<string>("");
|
|
102
|
+
const isMockMode = ref(false);
|
|
103
|
+
|
|
104
|
+
// ─── 真实接口模式(有 id 时调用) ───
|
|
105
|
+
|
|
106
|
+
async function loadHistoryList(applyId: string) {
|
|
107
|
+
isMockMode.value = false;
|
|
108
|
+
historyLoading.value = true;
|
|
109
|
+
try {
|
|
110
|
+
const res = await getAction(API_CONFIG.changeHistoryList, { applyId });
|
|
111
|
+
if (res?.data?.length) {
|
|
112
|
+
historyList.value = res.data;
|
|
113
|
+
}
|
|
114
|
+
} finally {
|
|
115
|
+
historyLoading.value = false;
|
|
116
|
+
if (historyList.value.length > 0) {
|
|
117
|
+
await loadHistoryDetail(historyList.value[0].id);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async function loadHistoryDetail(id: string) {
|
|
123
|
+
selectedId.value = id;
|
|
124
|
+
loading.value = true;
|
|
125
|
+
const currentRecord = historyList.value.find((r) => r.id === id);
|
|
126
|
+
const isChangeType = currentRecord?.changeType.includes("变更");
|
|
127
|
+
try {
|
|
128
|
+
const res = await getAction(API_CONFIG.getById, { id });
|
|
129
|
+
if (res?.data) {
|
|
130
|
+
tabsRef.value?.loadData(res.data);
|
|
131
|
+
if (isChangeType) {
|
|
132
|
+
const diffRes = await getAction(API_CONFIG.getDiffById, { id }).catch(
|
|
133
|
+
() => null
|
|
134
|
+
);
|
|
135
|
+
if (diffRes?.data) {
|
|
136
|
+
tabsRef.value?.loadDiffData(diffRes.data);
|
|
137
|
+
} else {
|
|
138
|
+
tabsRef.value?.clearDiffData?.();
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
tabsRef.value?.clearDiffData?.();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
} finally {
|
|
145
|
+
loading.value = false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ─── Mock 模式(无 id 时调用,纯本地数据,零接口请求) ───
|
|
150
|
+
|
|
151
|
+
function loadMockData() {
|
|
152
|
+
isMockMode.value = true;
|
|
153
|
+
historyList.value = createHistoryListMock();
|
|
154
|
+
if (historyList.value.length > 0) {
|
|
155
|
+
nextTick(() => selectMockDetail(historyList.value[0].id));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function selectMockDetail(id: string) {
|
|
160
|
+
selectedId.value = id;
|
|
161
|
+
const currentRecord = historyList.value.find((r) => r.id === id);
|
|
162
|
+
const isChangeType = currentRecord?.changeType.includes("变更");
|
|
163
|
+
tabsRef.value?.loadData(createChangeMockData());
|
|
164
|
+
if (isChangeType) {
|
|
165
|
+
tabsRef.value?.loadDiffData(createDiffMockData());
|
|
166
|
+
} else {
|
|
167
|
+
tabsRef.value?.clearDiffData?.();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// ─── 公共 ───
|
|
172
|
+
|
|
173
|
+
function handleSelectHistory(item: HistoryRecord) {
|
|
174
|
+
if (item.id === selectedId.value) return;
|
|
175
|
+
if (isMockMode.value) {
|
|
176
|
+
selectMockDetail(item.id);
|
|
177
|
+
} else {
|
|
178
|
+
loadHistoryDetail(item.id);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function handleCancel() {
|
|
183
|
+
router.back();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
loading,
|
|
188
|
+
historyLoading,
|
|
189
|
+
historyList,
|
|
190
|
+
selectedId,
|
|
191
|
+
loadHistoryList,
|
|
192
|
+
loadMockData,
|
|
193
|
+
handleSelectHistory,
|
|
194
|
+
handleCancel
|
|
195
|
+
};
|
|
196
|
+
}
|