@agile-team/wl-skills-kit 2.11.1 → 2.11.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +38 -21
  3. package/bin/wl-skills.js +27 -3
  4. package/files/.wl-skills/docs/jh-pagination.md +505 -505
  5. package/files/.wl-skills/docs/request.md +940 -940
  6. package/files/.wl-skills/docs/validate-exempt.md +113 -0
  7. package/files/.wl-skills/guides/architecture.md +1 -1
  8. package/files/.wl-skills/skills/_compat/headers/cursor-mdc.txt +1 -1
  9. package/files/.wl-skills/skills/_compat/headers/kiro.txt +1 -1
  10. package/files/.wl-skills/skills/_compat/headers/trae.txt +1 -1
  11. package/files/.wl-skills/skills/core/convention-audit/SKILL.md +3 -3
  12. package/files/.wl-skills/skills/core/spec-doc-parse/SKILL.md +332 -332
  13. package/files/.wl-skills/skills/core/spec-doc-parse/USAGE.md +97 -97
  14. package/files/.wl-skills/skills/sync/permission-sync/USAGE.md +107 -107
  15. package/files/.wl-skills/src/components/global/C_ParentView/index.vue +3 -3
  16. package/files/.wl-skills/src/components/global/C_RightToolbar/index.vue +157 -157
  17. package/files/.wl-skills/src/components/global/C_SvgIcon/index.vue +31 -31
  18. package/files/.wl-skills/src/components/global/C_SvgIcon/svgicon.js +10 -10
  19. package/files/.wl-skills/src/components/global/C_TagStatus/README.md +264 -264
  20. package/files/.wl-skills/src/components/global/C_TagStatus/config.ts +192 -192
  21. package/files/.wl-skills/src/components/global/C_TagStatus/index.vue +106 -106
  22. package/files/.wl-skills/src/components/global/C_TagStatus/types.ts +64 -64
  23. package/files/.wl-skills/src/components/global/C_Tree/README.md +153 -153
  24. package/files/.wl-skills/src/components/global/C_Tree/index.scss +42 -42
  25. package/files/.wl-skills/src/components/global/C_Tree/index.vue +78 -78
  26. package/files/.wl-skills/src/components/global/C_Tree/types.ts +59 -59
  27. package/files/.wl-skills/src/components/local/c_formModal/README.md +235 -235
  28. package/files/.wl-skills/src/components/local/c_formModal/data.ts +95 -95
  29. package/files/.wl-skills/src/components/local/c_formModal/index.scss +8 -8
  30. package/files/.wl-skills/src/components/local/c_formModal/index.vue +107 -107
  31. package/files/.wl-skills/src/components/local/c_formSections/data.ts +175 -175
  32. package/files/.wl-skills/src/components/local/c_formSections/index.scss +280 -280
  33. package/files/.wl-skills/src/components/local/c_formSections/index.vue +429 -429
  34. package/files/.wl-skills/src/components/local/c_listModal/data.ts +41 -41
  35. package/files/.wl-skills/src/components/local/c_listModal/index.vue +136 -136
  36. package/files/.wl-skills/src/components/local/c_spliterTitle/index.scss +25 -25
  37. package/files/.wl-skills/src/components/local/c_spliterTitle/index.vue +21 -21
  38. package/files/.wl-skills/src/components/remote/AGGrid/README.md +530 -530
  39. package/files/.wl-skills/src/components/remote/BaseForm/README.md +508 -508
  40. package/files/.wl-skills/src/components/remote/BaseQuery/README.md +865 -865
  41. package/files/.wl-skills/src/components/remote/BaseTable/README.md +941 -941
  42. package/files/.wl-skills/src/components/remote/BaseToolbar/README.md +496 -496
  43. package/files/.wl-skills/src/types/page.ts +24 -24
  44. package/files/.wl-skills/standards/04-coding-basics.md +39 -1
  45. package/files/.wl-skills/standards/09-typescript.md +26 -3
  46. package/files/.wl-skills/standards/12-base-table.md +56 -4
  47. package/files/.wl-skills/standards/13-platform-components.md +1 -0
  48. package/files/.wl-skills/standards/index.md +2 -2
  49. package/files/.wl-skills/templates/README.md +44 -44
  50. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/api.md +54 -54
  51. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/data.ts +346 -346
  52. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/index.scss +1 -1
  53. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/index.vue +28 -28
  54. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/data.ts +115 -115
  55. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/index.scss +44 -44
  56. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/index.vue +43 -43
  57. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/data.ts +338 -338
  58. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/index.scss +1 -1
  59. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/index.vue +28 -28
  60. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/data.ts +115 -115
  61. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/index.scss +44 -44
  62. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/index.vue +43 -43
  63. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/api.md +88 -88
  64. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/data.ts +601 -601
  65. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/index.scss +1 -1
  66. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/index.vue +64 -64
  67. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/api.md +67 -67
  68. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/data.ts +286 -286
  69. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/index.scss +139 -139
  70. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/index.vue +318 -318
  71. package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/api.md +98 -98
  72. package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/data.ts +543 -543
  73. package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/index.scss +1 -1
  74. package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/index.vue +52 -52
  75. package/files/.wl-skills/templates/sale/demo/add-demo/data.ts +518 -518
  76. package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/data.ts +524 -524
  77. package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/index.scss +154 -154
  78. package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/index.vue +117 -117
  79. package/files/.wl-skills/templates/sale/demo/domestic-trade-order/data.ts +308 -308
  80. package/files/.wl-skills/templates/sale/demo/domestic-trade-order/index.scss +99 -99
  81. package/files/.wl-skills/templates/sale/demo/domestic-trade-order/index.vue +77 -77
  82. package/files/.wl-skills/templates/sale/demo/heat-batch-return/data.ts +367 -367
  83. package/files/.wl-skills/templates/sale/demo/heat-batch-return/index.scss +100 -100
  84. package/files/.wl-skills/templates/sale/demo/heat-batch-return/index.vue +170 -170
  85. package/files/.wl-skills/templates/sale/demo/heat-batch-return/meltDialog.vue +320 -320
  86. package/files/.wl-skills/templates/sale/demo/metallurgical-spec/data.ts +824 -824
  87. package/lib/ast-rules.js +395 -12
  88. package/mcp/config.js +46 -46
  89. package/mcp/registry.js +6 -1
  90. package/mcp/tools/projectTools.js +9 -1
  91. package/package.json +2 -2
@@ -1,286 +1,286 @@
1
- import { getAction, postAction } from "@jhlc/common-core/src/api/action";
2
- import { ElMessage, ElMessageBox } from "element-plus";
3
- import { useRouter } from "vue-router";
4
-
5
- export const API_CONFIG = {
6
- getById: "/sale/tempCustomerArchive/getById",
7
- save: "/sale/tempCustomerArchive/save",
8
- convert: "/sale/tempCustomerArchive/convert",
9
- assign: "/sale/tempCustomerArchive/assign",
10
- claim: "/sale/tempCustomerArchive/claim",
11
- recycle: "/sale/tempCustomerArchive/recycle",
12
- returnBack: "/sale/tempCustomerArchive/return"
13
- } as const;
14
-
15
- export const OPTS = {
16
- useOrg: [
17
- { label: "不锈钢接单中心", value: "不锈钢接单中心" },
18
- {
19
- label: "江阴华新特殊合金材料有限公司",
20
- value: "江阴华新特殊合金材料有限公司"
21
- },
22
- { label: "採瞒管理中心", value: "採瞒管理中心" },
23
- { label: "烟台华鑫再生资源有限公司", value: "烟台华鑫再生资源有限公司" }
24
- ],
25
- product: [
26
- { label: "热轧", value: "热轧" },
27
- { label: "盘元", value: "盘元" },
28
- { label: "冷精", value: "冷精" },
29
- { label: "汽车", value: "汽车" }
30
- ],
31
- customerType: [
32
- { label: "SYCSR001-交易客户", value: "SYCSR001-交易客户" },
33
- { label: "SYCSR002-直采客户", value: "SYCSR002-直采客户" }
34
- ],
35
- customerLevel: [
36
- { label: "一般客户(A1)", value: "一般客户(A1)" },
37
- { label: "重要客户(A2)", value: "重要客户(A2)" },
38
- { label: "战略客户(A3)", value: "战略客户(A3)" }
39
- ],
40
- currency: [
41
- { label: "CNY", value: "CNY" },
42
- { label: "USD", value: "USD" }
43
- ],
44
- followType: [
45
- { label: "客户拜访", value: "客户拜访" },
46
- { label: "电话跟进", value: "电话跟进" },
47
- { label: "邮件跟进", value: "邮件跟进" }
48
- ]
49
- };
50
-
51
- export interface FollowRecord {
52
- id: string;
53
- useOrg: string;
54
- product: string;
55
- type: string;
56
- activityDate: string;
57
- activityCode: string;
58
- activityTitle: string;
59
- activityContent: string;
60
- attachment: string;
61
- createTime: string;
62
- }
63
-
64
- export interface TempCustomerForm {
65
- id: string;
66
- customerName: string;
67
- convertStatus: string;
68
- tempCode: string;
69
- formalCode: string;
70
- useOrg: string;
71
- product: string;
72
- lastFollowPerson: string;
73
- lastFollowDate: string;
74
- creator: string;
75
- createTime: string;
76
- customerType: string;
77
- customerLevel: string;
78
- businessLicense: string;
79
- contactPerson: string;
80
- contactPhone: string;
81
- companyPhone1: string;
82
- companyPhone2: string;
83
- companyFax: string;
84
- position: string;
85
- email: string;
86
- address: string;
87
- consignee: string;
88
- deliveryContact: string;
89
- deliveryAddress: string;
90
- currency: string;
91
- taxRate: string;
92
- bankType: string;
93
- bankAccountName: string;
94
- bankAccount: string;
95
- bankBranch: string;
96
- invoiceHeader: string;
97
- taxNumber: string;
98
- invoiceEmail: string;
99
- invoicePhone: string;
100
- invoiceAddress: string;
101
- followRecords: FollowRecord[];
102
- }
103
-
104
- export function createMockData(): TempCustomerForm {
105
- return {
106
- id: "mock-001",
107
- customerName: "烟台华新不锈钢智能化深加工基地",
108
- convertStatus: "未转换",
109
- tempCode: "10001170",
110
- formalCode: "10001170",
111
- useOrg: "不锈钢接单中心",
112
- product: "热轧",
113
- lastFollowPerson: "郭松",
114
- lastFollowDate: "",
115
- creator: "郭松",
116
- createTime: "",
117
- customerType: "SYCSR001-交易客户",
118
- customerLevel: "一般客户(A1)",
119
- businessLicense: "",
120
- contactPerson: "潘灵连",
121
- contactPhone: "18174058864",
122
- companyPhone1: "18174058864",
123
- companyPhone2: "18174058864",
124
- companyFax: "18174058864",
125
- position: "采购",
126
- email: "2140309447@qq.com",
127
- address: "上海市宝山区富锦路885号",
128
- consignee: "潘灵连",
129
- deliveryContact: "18174058864",
130
- deliveryAddress: "上海市宝山区富锦路885号",
131
- currency: "CNY",
132
- taxRate: "--",
133
- bankType: "中国工商银行股份有限公司",
134
- bankAccountName: "江苏金恒信息科技股份有限公司",
135
- bankAccount: "1001 1538 1900 3292 075",
136
- bankBranch: "中国工商银行股份有限公司七台河兴煤支行",
137
- invoiceHeader: "江苏金恒信息科技股份有限公司",
138
- taxNumber: "91310000631696382C",
139
- invoiceEmail: "2140309447@qq.com",
140
- invoicePhone: "18174058864",
141
- invoiceAddress: "上海市宝山区富锦路885号",
142
- followRecords: [
143
- {
144
- id: "1",
145
- useOrg: "",
146
- product: "",
147
- type: "客户拜访",
148
- activityDate: "2024-01-01",
149
- activityCode: "CV20241119003-07",
150
- activityTitle: "客户拜访商业洽谈",
151
- activityContent: "******",
152
- attachment: "查看附件",
153
- createTime: "2024-01-01 20:00"
154
- },
155
- {
156
- id: "2",
157
- useOrg: "",
158
- product: "",
159
- type: "客户拜访",
160
- activityDate: "2024-01-01",
161
- activityCode: "CV20241119003-07",
162
- activityTitle: "客户拜访商业洽谈",
163
- activityContent: "******",
164
- attachment: "查看附件",
165
- createTime: "2024-01-01 20:00"
166
- },
167
- {
168
- id: "3",
169
- useOrg: "",
170
- product: "",
171
- type: "客户拜访",
172
- activityDate: "2024-01-01",
173
- activityCode: "CV20241119003-07",
174
- activityTitle: "客户拜访商业洽谈",
175
- activityContent: "******",
176
- attachment: "查看附件",
177
- createTime: "2024-01-01 20:00"
178
- }
179
- ]
180
- };
181
- }
182
-
183
- export function useTempCustomerDetail() {
184
- const router = useRouter();
185
- const loading = ref(false);
186
- const form = reactive<TempCustomerForm>(createMockData());
187
-
188
- async function loadDetail(id: string) {
189
- loading.value = true;
190
- try {
191
- const res = await getAction(API_CONFIG.getById, { id });
192
- if (res?.data) Object.assign(form, res.data);
193
- } finally {
194
- loading.value = false;
195
- }
196
- }
197
-
198
- async function handleSave() {
199
- loading.value = true;
200
- try {
201
- const res = await postAction(API_CONFIG.save, { ...form });
202
- if (res?.code === 200) ElMessage.success("保存成功");
203
- } finally {
204
- loading.value = false;
205
- }
206
- }
207
-
208
- function handleTempSave() {
209
- ElMessage.info("暂存功能开发中");
210
- }
211
-
212
- async function handleConvert() {
213
- ElMessageBox.confirm("确定将该临时客户转化为正式客户?", "提示", {
214
- type: "info"
215
- })
216
- .then(async () => {
217
- loading.value = true;
218
- try {
219
- const res = await postAction(API_CONFIG.convert, { ids: [form.id] });
220
- if (res?.code === 200) {
221
- ElMessage.success("转化成功");
222
- router.back();
223
- }
224
- } finally {
225
- loading.value = false;
226
- }
227
- })
228
- .catch(() => {});
229
- }
230
-
231
- function handleAssign() {
232
- ElMessage.info("分配功能开发中");
233
- }
234
- function handleClaim() {
235
- ElMessage.info("认领功能开发中");
236
- }
237
- function handleRecycle() {
238
- ElMessage.info("回收功能开发中");
239
- }
240
- function handleReturn() {
241
- ElMessage.info("退回功能开发中");
242
- }
243
-
244
- function addFollowRecord() {
245
- form.followRecords.push({
246
- id: Date.now().toString(),
247
- useOrg: "",
248
- product: "",
249
- type: "客户拜访",
250
- activityDate: "",
251
- activityCode: "",
252
- activityTitle: "",
253
- activityContent: "",
254
- attachment: "",
255
- createTime: ""
256
- });
257
- }
258
-
259
- function removeFollowRecord(index: number) {
260
- ElMessageBox.confirm("确定删除该跟进记录?", "提示", { type: "warning" })
261
- .then(() => {
262
- form.followRecords.splice(index, 1);
263
- })
264
- .catch(() => {});
265
- }
266
-
267
- function handleCancel() {
268
- router.back();
269
- }
270
-
271
- return {
272
- loading,
273
- form,
274
- loadDetail,
275
- handleSave,
276
- handleTempSave,
277
- handleConvert,
278
- handleAssign,
279
- handleClaim,
280
- handleRecycle,
281
- handleReturn,
282
- addFollowRecord,
283
- removeFollowRecord,
284
- handleCancel
285
- };
286
- }
1
+ import { getAction, postAction } from "@jhlc/common-core/src/api/action";
2
+ import { ElMessage, ElMessageBox } from "element-plus";
3
+ import { useRouter } from "vue-router";
4
+
5
+ export const API_CONFIG = {
6
+ getById: "/sale/tempCustomerArchive/getById",
7
+ save: "/sale/tempCustomerArchive/save",
8
+ convert: "/sale/tempCustomerArchive/convert",
9
+ assign: "/sale/tempCustomerArchive/assign",
10
+ claim: "/sale/tempCustomerArchive/claim",
11
+ recycle: "/sale/tempCustomerArchive/recycle",
12
+ returnBack: "/sale/tempCustomerArchive/return"
13
+ } as const;
14
+
15
+ export const OPTS = {
16
+ useOrg: [
17
+ { label: "不锈钢接单中心", value: "不锈钢接单中心" },
18
+ {
19
+ label: "江阴华新特殊合金材料有限公司",
20
+ value: "江阴华新特殊合金材料有限公司"
21
+ },
22
+ { label: "採瞒管理中心", value: "採瞒管理中心" },
23
+ { label: "烟台华鑫再生资源有限公司", value: "烟台华鑫再生资源有限公司" }
24
+ ],
25
+ product: [
26
+ { label: "热轧", value: "热轧" },
27
+ { label: "盘元", value: "盘元" },
28
+ { label: "冷精", value: "冷精" },
29
+ { label: "汽车", value: "汽车" }
30
+ ],
31
+ customerType: [
32
+ { label: "SYCSR001-交易客户", value: "SYCSR001-交易客户" },
33
+ { label: "SYCSR002-直采客户", value: "SYCSR002-直采客户" }
34
+ ],
35
+ customerLevel: [
36
+ { label: "一般客户(A1)", value: "一般客户(A1)" },
37
+ { label: "重要客户(A2)", value: "重要客户(A2)" },
38
+ { label: "战略客户(A3)", value: "战略客户(A3)" }
39
+ ],
40
+ currency: [
41
+ { label: "CNY", value: "CNY" },
42
+ { label: "USD", value: "USD" }
43
+ ],
44
+ followType: [
45
+ { label: "客户拜访", value: "客户拜访" },
46
+ { label: "电话跟进", value: "电话跟进" },
47
+ { label: "邮件跟进", value: "邮件跟进" }
48
+ ]
49
+ };
50
+
51
+ export interface FollowRecord {
52
+ id: string;
53
+ useOrg: string;
54
+ product: string;
55
+ type: string;
56
+ activityDate: string;
57
+ activityCode: string;
58
+ activityTitle: string;
59
+ activityContent: string;
60
+ attachment: string;
61
+ createTime: string;
62
+ }
63
+
64
+ export interface TempCustomerForm {
65
+ id: string;
66
+ customerName: string;
67
+ convertStatus: string;
68
+ tempCode: string;
69
+ formalCode: string;
70
+ useOrg: string;
71
+ product: string;
72
+ lastFollowPerson: string;
73
+ lastFollowDate: string;
74
+ creator: string;
75
+ createTime: string;
76
+ customerType: string;
77
+ customerLevel: string;
78
+ businessLicense: string;
79
+ contactPerson: string;
80
+ contactPhone: string;
81
+ companyPhone1: string;
82
+ companyPhone2: string;
83
+ companyFax: string;
84
+ position: string;
85
+ email: string;
86
+ address: string;
87
+ consignee: string;
88
+ deliveryContact: string;
89
+ deliveryAddress: string;
90
+ currency: string;
91
+ taxRate: string;
92
+ bankType: string;
93
+ bankAccountName: string;
94
+ bankAccount: string;
95
+ bankBranch: string;
96
+ invoiceHeader: string;
97
+ taxNumber: string;
98
+ invoiceEmail: string;
99
+ invoicePhone: string;
100
+ invoiceAddress: string;
101
+ followRecords: FollowRecord[];
102
+ }
103
+
104
+ export function createMockData(): TempCustomerForm {
105
+ return {
106
+ id: "mock-001",
107
+ customerName: "烟台华新不锈钢智能化深加工基地",
108
+ convertStatus: "未转换",
109
+ tempCode: "10001170",
110
+ formalCode: "10001170",
111
+ useOrg: "不锈钢接单中心",
112
+ product: "热轧",
113
+ lastFollowPerson: "郭松",
114
+ lastFollowDate: "",
115
+ creator: "郭松",
116
+ createTime: "",
117
+ customerType: "SYCSR001-交易客户",
118
+ customerLevel: "一般客户(A1)",
119
+ businessLicense: "",
120
+ contactPerson: "潘灵连",
121
+ contactPhone: "18174058864",
122
+ companyPhone1: "18174058864",
123
+ companyPhone2: "18174058864",
124
+ companyFax: "18174058864",
125
+ position: "采购",
126
+ email: "2140309447@qq.com",
127
+ address: "上海市宝山区富锦路885号",
128
+ consignee: "潘灵连",
129
+ deliveryContact: "18174058864",
130
+ deliveryAddress: "上海市宝山区富锦路885号",
131
+ currency: "CNY",
132
+ taxRate: "--",
133
+ bankType: "中国工商银行股份有限公司",
134
+ bankAccountName: "江苏金恒信息科技股份有限公司",
135
+ bankAccount: "1001 1538 1900 3292 075",
136
+ bankBranch: "中国工商银行股份有限公司七台河兴煤支行",
137
+ invoiceHeader: "江苏金恒信息科技股份有限公司",
138
+ taxNumber: "91310000631696382C",
139
+ invoiceEmail: "2140309447@qq.com",
140
+ invoicePhone: "18174058864",
141
+ invoiceAddress: "上海市宝山区富锦路885号",
142
+ followRecords: [
143
+ {
144
+ id: "1",
145
+ useOrg: "",
146
+ product: "",
147
+ type: "客户拜访",
148
+ activityDate: "2024-01-01",
149
+ activityCode: "CV20241119003-07",
150
+ activityTitle: "客户拜访商业洽谈",
151
+ activityContent: "******",
152
+ attachment: "查看附件",
153
+ createTime: "2024-01-01 20:00"
154
+ },
155
+ {
156
+ id: "2",
157
+ useOrg: "",
158
+ product: "",
159
+ type: "客户拜访",
160
+ activityDate: "2024-01-01",
161
+ activityCode: "CV20241119003-07",
162
+ activityTitle: "客户拜访商业洽谈",
163
+ activityContent: "******",
164
+ attachment: "查看附件",
165
+ createTime: "2024-01-01 20:00"
166
+ },
167
+ {
168
+ id: "3",
169
+ useOrg: "",
170
+ product: "",
171
+ type: "客户拜访",
172
+ activityDate: "2024-01-01",
173
+ activityCode: "CV20241119003-07",
174
+ activityTitle: "客户拜访商业洽谈",
175
+ activityContent: "******",
176
+ attachment: "查看附件",
177
+ createTime: "2024-01-01 20:00"
178
+ }
179
+ ]
180
+ };
181
+ }
182
+
183
+ export function useTempCustomerDetail() {
184
+ const router = useRouter();
185
+ const loading = ref(false);
186
+ const form = reactive<TempCustomerForm>(createMockData());
187
+
188
+ async function loadDetail(id: string) {
189
+ loading.value = true;
190
+ try {
191
+ const res = await getAction(API_CONFIG.getById, { id });
192
+ if (res?.data) Object.assign(form, res.data);
193
+ } finally {
194
+ loading.value = false;
195
+ }
196
+ }
197
+
198
+ async function handleSave() {
199
+ loading.value = true;
200
+ try {
201
+ const res = await postAction(API_CONFIG.save, { ...form });
202
+ if (res?.code === 200) ElMessage.success("保存成功");
203
+ } finally {
204
+ loading.value = false;
205
+ }
206
+ }
207
+
208
+ function handleTempSave() {
209
+ ElMessage.info("暂存功能开发中");
210
+ }
211
+
212
+ async function handleConvert() {
213
+ ElMessageBox.confirm("确定将该临时客户转化为正式客户?", "提示", {
214
+ type: "info"
215
+ })
216
+ .then(async () => {
217
+ loading.value = true;
218
+ try {
219
+ const res = await postAction(API_CONFIG.convert, { ids: [form.id] });
220
+ if (res?.code === 200) {
221
+ ElMessage.success("转化成功");
222
+ router.back();
223
+ }
224
+ } finally {
225
+ loading.value = false;
226
+ }
227
+ })
228
+ .catch(() => {});
229
+ }
230
+
231
+ function handleAssign() {
232
+ ElMessage.info("分配功能开发中");
233
+ }
234
+ function handleClaim() {
235
+ ElMessage.info("认领功能开发中");
236
+ }
237
+ function handleRecycle() {
238
+ ElMessage.info("回收功能开发中");
239
+ }
240
+ function handleReturn() {
241
+ ElMessage.info("退回功能开发中");
242
+ }
243
+
244
+ function addFollowRecord() {
245
+ form.followRecords.push({
246
+ id: Date.now().toString(),
247
+ useOrg: "",
248
+ product: "",
249
+ type: "客户拜访",
250
+ activityDate: "",
251
+ activityCode: "",
252
+ activityTitle: "",
253
+ activityContent: "",
254
+ attachment: "",
255
+ createTime: ""
256
+ });
257
+ }
258
+
259
+ function removeFollowRecord(index: number) {
260
+ ElMessageBox.confirm("确定删除该跟进记录?", "提示", { type: "warning" })
261
+ .then(() => {
262
+ form.followRecords.splice(index, 1);
263
+ })
264
+ .catch(() => {});
265
+ }
266
+
267
+ function handleCancel() {
268
+ router.back();
269
+ }
270
+
271
+ return {
272
+ loading,
273
+ form,
274
+ loadDetail,
275
+ handleSave,
276
+ handleTempSave,
277
+ handleConvert,
278
+ handleAssign,
279
+ handleClaim,
280
+ handleRecycle,
281
+ handleReturn,
282
+ addFollowRecord,
283
+ removeFollowRecord,
284
+ handleCancel
285
+ };
286
+ }