@appthen/cli 1.2.10 → 1.2.11

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 (122) hide show
  1. package/.gitignore +1 -0
  2. package/bin/main.js +45 -0
  3. package/dist/index.js +1108 -267
  4. package/package.json +1 -1
  5. package/tests/test-app/.appthen/shadow-space-100001-test-app-e99876b1.json +1406 -0
  6. package/tests/test-app/.appthen/shadow-space-unknown-user-test-app-e99876b1.json +1060 -0
  7. package/tests/test-app/.appthen/space-config.json +8 -0
  8. package/tests/test-app/docs/AI-Workflow.flow +112 -0
  9. package/tests/test-app/docs/Logic-1.flow +16 -0
  10. package/tests/test-app/docs/Logic.flow +16 -0
  11. package/tests/test-app/docs/Project-Blueprint-1.flow +119 -0
  12. package/tests/test-app/docs/Project-Blueprint.flow +119 -0
  13. package/tests/test-app/docs/README.md +3 -0
  14. package/tests/test-app/docs/claude.md +194 -0
  15. package/tests/test-app/docs/page_requirement_analysis.md +149 -0
  16. package/tests/test-app/docs//345/267/245/345/215/225/347/256/241/347/220/206/347/263/273/347/273/237/350/257/246/347/273/206/350/256/276/350/256/241.md +377 -0
  17. package/tests/test-app/src/apis/AddTodoPost.api.ts +42 -0
  18. package/tests/test-app/src/apis/DeleteTodoPost.api.ts +32 -0
  19. package/tests/test-app/src/apis/GetListPost.api.ts +38 -0
  20. package/tests/test-app/src/apis/TicketAttachmentUploadPost.api.ts +42 -0
  21. package/tests/test-app/src/apis/UpdateTodoPost.api.ts +46 -0
  22. package/tests/test-app/src/app.css +15 -0
  23. package/tests/test-app/src/cloud_functions/ticket|attachment|upload.node.ts +86 -0
  24. package/tests/test-app/src/cloud_functions/ticket|comment|add.node.ts +65 -0
  25. package/tests/test-app/src/cloud_functions/types|entity|Ticket.node.ts +88 -0
  26. package/tests/test-app/src/cloud_functions/types|entity|TicketAttachment.node.ts +70 -0
  27. package/tests/test-app/src/cloud_functions/types|entity|TicketCategory.node.ts +56 -0
  28. package/tests/test-app/src/cloud_functions/types|entity|TicketComment.node.ts +62 -0
  29. package/tests/test-app/src/cloud_functions/types|entity|TicketHistory.node.ts +74 -0
  30. package/tests/test-app/src/cloud_functions/types|entity|TicketPriority.node.ts +68 -0
  31. package/tests/test-app/src/cloud_functions/types|entity|TicketStatus.node.ts +63 -0
  32. package/tests/test-app/src/cloud_functions/types|models|CreateTicketParams.node.ts +20 -0
  33. package/tests/test-app/src/cloud_functions/types|models|TicketListParams.node.ts +30 -0
  34. package/tests/test-app/src/cloud_functions/types|models|UpdateTicketParams.node.ts +22 -0
  35. package/tests/test-app/src/components/Button.js +11 -0
  36. package/tests/test-app/src/components/MouduleDemoNzp.tsx +40 -0
  37. package/tests/test-app/src/components/Timeline.tsx +145 -0
  38. package/tests/test-app/src/index.ts +2 -0
  39. package/tests/test-app/src/modules/work_order_module/apis/TicketCommentAddPost.api.ts +48 -0
  40. package/tests/test-app/src/modules/work_order_module/apis/TicketCreatePost.api.ts +52 -0
  41. package/tests/test-app/src/modules/work_order_module/apis/TicketDeleteDelete.api.ts +39 -0
  42. package/tests/test-app/src/modules/work_order_module/apis/TicketDetailGet.api.ts +39 -0
  43. package/tests/test-app/src/modules/work_order_module/apis/TicketListGet.api.ts +61 -0
  44. package/tests/test-app/src/modules/work_order_module/apis/TicketUpdatePut.api.ts +57 -0
  45. package/tests/test-app/src/modules/work_order_module/apis/TrainDoorFaultListGet.ts +76 -0
  46. package/tests/test-app/src/modules/work_order_module/apis/TrainDoorListGet.ts +76 -0
  47. package/tests/test-app/src/modules/work_order_module/apis/TrainDoorOperationRecordsGet.ts +284 -0
  48. package/tests/test-app/src/modules/work_order_module/apis/TrainDoorStatisticsGet.ts +96 -0
  49. package/tests/test-app/src/modules/work_order_module/cloud_function/category|list.node.ts +40 -0
  50. package/tests/test-app/src/modules/work_order_module/cloud_function/priority|list.node.ts +26 -0
  51. package/tests/test-app/src/modules/work_order_module/cloud_function/status|list.node.ts +26 -0
  52. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|create.node.ts +54 -0
  53. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|delete.node.ts +55 -0
  54. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|detail.node.ts +65 -0
  55. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|list.node.ts +85 -0
  56. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|update.node.ts +73 -0
  57. package/tests/test-app/src/modules/work_order_module/data_model/Ticket.m.ts +85 -0
  58. package/tests/test-app/src/modules/work_order_module/data_model/TicketCategory.m.ts +53 -0
  59. package/tests/test-app/src/modules/work_order_module/data_model/TicketStatus.m.ts +60 -0
  60. package/tests/test-app/src/modules/work_order_module//345/267/245/345/215/225/347/263/273/347/273/237/344/272/247/345/223/201/350/256/276/350/256/241/346/226/207/346/241/243.md +301 -0
  61. package/tests/test-app/src/modules/work_order_module//345/267/245/345/215/225/347/263/273/347/273/237/345/274/200/345/217/221/344/273/273/345/212/241/345/210/206/345/267/245/346/226/207/346/241/243.md +345 -0
  62. package/tests/test-app/src/pages/SLAManagement.tsx +668 -0
  63. package/tests/test-app/src/pages/TicketCreate.tsx +27 -0
  64. package/tests/test-app/src/pages/TicketDetail.tsx +27 -0
  65. package/tests/test-app/src/pages/TicketList.tsx +27 -0
  66. package/tests/test-app/src/pages/TicketManagementPage.tsx +1238 -0
  67. package/tests/test-app/src/pages/VisualAIIDEUpgrade.tsx +245 -0
  68. package/tests/test-app/src/pages/appthen_guide/ComponentTreeUnderstanding.tsx +26 -0
  69. package/tests/test-app/src/pages/appthen_guide/DataBindingLearning.tsx +26 -0
  70. package/tests/test-app/src/pages/back-end/adminRootLayout.tsx +155 -0
  71. package/tests/test-app/src/pages/back-end/adminRootLayout10.tsx +157 -0
  72. package/tests/test-app/src/pages/back-end/adminRootLayout2.tsx +156 -0
  73. package/tests/test-app/src/pages/back-end/adminRootLayout3.tsx +156 -0
  74. package/tests/test-app/src/pages/back-end/adminRootLayout4.tsx +157 -0
  75. package/tests/test-app/src/pages/back-end/adminRootLayout5.tsx +157 -0
  76. package/tests/test-app/src/pages/back-end/adminRootLayout6.tsx +157 -0
  77. package/tests/test-app/src/pages/back-end/adminRootLayout7.tsx +157 -0
  78. package/tests/test-app/src/pages/back-end/adminRootLayout8.tsx +157 -0
  79. package/tests/test-app/src/pages/back-end/adminRootLayout9.tsx +157 -0
  80. package/tests/test-app/src/pages/back-end/backgroundManagementSystem.css +5 -0
  81. package/tests/test-app/src/pages/back-end/backgroundManagementSystem.tsx +1745 -0
  82. package/tests/test-app/src/pages/component/WorkOrderCard.tsx +140 -0
  83. package/tests/test-app/src/pages/cover.tsx +42 -0
  84. package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.css +181 -0
  85. package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.tsx +225 -0
  86. package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.css +181 -0
  87. package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.tsx +138 -0
  88. package/tests/test-app/src/pages/data_dashboard/component_library/BlueBrightGreenBorder.tsx +47 -0
  89. package/tests/test-app/src/pages/data_dashboard/component_library/FullScreenContainer.tsx +133 -0
  90. package/tests/test-app/src/pages/description_of_mock_interface.md +32 -0
  91. package/tests/test-app/src/pages/digitalLargeScreen.css +181 -0
  92. package/tests/test-app/src/pages/digitalLargeScreen.tsx +1417 -0
  93. package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.css +3 -0
  94. package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.tsx +362 -0
  95. package/tests/test-app/src/pages/mobile_terminal/WorkOrderHomepage.tsx +337 -0
  96. package/tests/test-app/src/pages/mobile_terminal/newWorkOrder.tsx +224 -0
  97. package/tests/test-app/src/pages/mobile_terminal/tabbar.tsx +67 -0
  98. package/tests/test-app/src/pages/mobile_terminal/uiHandsOnPractice.tsx +638 -0
  99. package/tests/test-app/src/pages/mobile_terminal/workOrderDetails.tsx +346 -0
  100. package/tests/test-app/src/pages/mobile_terminal/workOrderPage.tsx +345 -0
  101. package/tests/test-app/src/pages/testPage.css +3 -0
  102. package/tests/test-app/src/pages/testPage.tsx +158 -0
  103. package/tests/test-app/src/pages/web_version/website.css +205 -0
  104. package/tests/test-app/src/pages/web_version/website.tsx +1066 -0
  105. package/tests/test-app/src/pages//345/276/205/345/212/236.apidoc.json +336 -0
  106. package/tests/test-app/src/project.json +1120 -0
  107. package/tests/test-app/src/store/global.store.ts +10 -0
  108. package/tests/test-app/src/types/CreateTicketParams.m.ts +20 -0
  109. package/tests/test-app/src/types/SLAPolicy.ts +50 -0
  110. package/tests/test-app/src/types/Ticket.ts +68 -0
  111. package/tests/test-app/src/types/TicketAttachment.m.ts +67 -0
  112. package/tests/test-app/src/types/TicketComment.m.ts +59 -0
  113. package/tests/test-app/src/types/TicketEvaluation.ts +44 -0
  114. package/tests/test-app/src/types/TicketHistory.m.ts +71 -0
  115. package/tests/test-app/src/types/TicketListParams.m.ts +30 -0
  116. package/tests/test-app/src/types/TicketPriority.m.ts +65 -0
  117. package/tests/test-app/src/types/TicketRecord.ts +47 -0
  118. package/tests/test-app/src/types/TrainDoor.ts +284 -0
  119. package/tests/test-app/src/types/UpdateTicketParams.m.ts +22 -0
  120. package/tests/test-app/src/utils/__afterRequest.util.ts +3 -0
  121. package/tests/test-app/src/utils/__beforeRequest.util.ts +10 -0
  122. package/tests/test-app/src/utils/testGlobalAction.util.ts +7 -0
@@ -0,0 +1,46 @@
1
+ /**
2
+ * 更新待办
3
+ *
4
+ * @api POST /updateTodo
5
+ */
6
+
7
+ /**
8
+ * Body 参数类型
9
+ */
10
+ export class UpdateTodoPostBodyDto {
11
+ /* 根节点 @example {"id":"660ffe0bd894a1618b354cc0","title":"12333333","date":"2024-01-01","startTime":"14:20","endTime":"18:00","description":"待办描述","category":{"name":"生活","color":"red"},"status":1} */
12
+ body: {
13
+ id?: string,
14
+ title?: string,
15
+ date?: string,
16
+ startTime?: string,
17
+ endTime?: string,
18
+ description?: string,
19
+ category?: string,
20
+ status?: number,
21
+ } = {
22
+ id: undefined,
23
+ title: undefined,
24
+ date: undefined,
25
+ startTime: undefined,
26
+ endTime: undefined,
27
+ description: undefined,
28
+ category: undefined,
29
+ status: undefined
30
+ };
31
+ }
32
+ /**
33
+ * Query 参数类型
34
+ */
35
+ export class UpdateTodoPostQueryDto {}
36
+ /**
37
+ * Path 参数类型
38
+ */
39
+ export class UpdateTodoPostPathDto {}
40
+ /**
41
+ * 接口返回值类型
42
+ */
43
+ export class UpdateTodoPostResponseDto {
44
+ /* 成功 */
45
+ 200: any = {};
46
+ }
@@ -0,0 +1,15 @@
1
+ .GnUdojY6u1 {
2
+ color: #766d9e;
3
+ }
4
+ .fuck {
5
+ font-size: 18px;
6
+ color: #000;
7
+ }
8
+ .fuck4 {
9
+ font-size: 18px;
10
+ color: #000;
11
+ }
12
+ .fuck5 {
13
+ font-size: 18px;
14
+ color: #d0021b;
15
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * 上传工单附件
3
+ * 支持文件上传和关联工单
4
+ *
5
+ * @methods POST
6
+ */
7
+ import cloud from '@lafjs/cloud';
8
+ import { DataSource } from 'typeorm';
9
+ import { Response } from '@/utils/func';
10
+ import { TicketAttachment } from '@/types/entity/TicketAttachment';
11
+ import { Ticket } from '@/types/entity/Ticket';
12
+ import { TicketHistory } from '@/types/entity/TicketHistory';
13
+
14
+ export default async function (ctx: FunctionContext) {
15
+ const { ticketId, description } = ctx.body;
16
+ const file = ctx.files?.[0];
17
+
18
+ if (!ticketId || !file) {
19
+ return Response.failed('工单ID和文件为必填项');
20
+ }
21
+
22
+ try {
23
+ const dataSource: DataSource = cloud.datasource.default;
24
+ const attachmentRepository = dataSource.getRepository(TicketAttachment);
25
+ const ticketRepository = dataSource.getRepository(Ticket);
26
+ const historyRepository = dataSource.getRepository(TicketHistory);
27
+
28
+ // 验证工单是否存在
29
+ const ticket = await ticketRepository.findOne({
30
+ where: { id: parseInt(ticketId) }
31
+ });
32
+
33
+ if (!ticket) {
34
+ return Response.failed('工单不存在');
35
+ }
36
+
37
+ // 文件大小限制(10MB)
38
+ const maxSize = 10 * 1024 * 1024;
39
+ if (file.size > maxSize) {
40
+ return Response.failed('文件大小不能超过10MB');
41
+ }
42
+
43
+ // 允许的文件类型
44
+ const allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'text/plain'];
45
+ if (!allowedTypes.includes(file.mimetype)) {
46
+ return Response.failed('不支持的文件类型');
47
+ }
48
+
49
+ // 保存文件
50
+ const fileName = `${Date.now()}_${file.originalname}`;
51
+ const filePath = `uploads/tickets/${ticketId}/${fileName}`;
52
+
53
+ // 这里应该调用文件存储服务,简化处理
54
+ const savedPath = filePath; // 实际项目中需要接入云存储
55
+
56
+ // 创建附件记录
57
+ const attachment = attachmentRepository.create({
58
+ ticketId: parseInt(ticketId),
59
+ uploaderId: ctx.user?._id || 'system',
60
+ fileName: file.originalname,
61
+ filePath: savedPath,
62
+ fileSize: file.size,
63
+ fileType: file.mimetype,
64
+ description: description || '',
65
+ createdAt: new Date(),
66
+ updatedAt: new Date()
67
+ });
68
+
69
+ const savedAttachment = await attachmentRepository.save(attachment);
70
+
71
+ // 记录上传历史
72
+ const history = historyRepository.create({
73
+ ticketId: parseInt(ticketId),
74
+ userId: ctx.user?._id || 'system',
75
+ action: 'UPLOAD_ATTACHMENT',
76
+ description: `上传附件: ${file.originalname}`,
77
+ createdAt: new Date()
78
+ });
79
+ await historyRepository.save(history);
80
+
81
+ return Response.ok(savedAttachment);
82
+ } catch (error) {
83
+ console.error('上传附件失败:', error);
84
+ return Response.failed('上传失败,请稍后重试');
85
+ }
86
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * 添加工单评论
3
+ * 支持评论和回复功能
4
+ *
5
+ * @methods POST
6
+ */
7
+ import cloud from '@lafjs/cloud';
8
+ import { DataSource } from 'typeorm';
9
+ import { Response } from '@/utils/func';
10
+ import { TicketComment } from '@/types/entity/TicketComment';
11
+ import { Ticket } from '@/types/entity/Ticket';
12
+ import { TicketHistory } from '@/types/entity/TicketHistory';
13
+
14
+ export default async function (ctx: FunctionContext) {
15
+ const { ticketId, content, parentId, type = 'comment', isInternal = false } = ctx.body;
16
+
17
+ if (!ticketId || !content) {
18
+ return Response.failed('工单ID和评论内容为必填项');
19
+ }
20
+
21
+ try {
22
+ const dataSource: DataSource = cloud.datasource.default;
23
+ const commentRepository = dataSource.getRepository(TicketComment);
24
+ const ticketRepository = dataSource.getRepository(Ticket);
25
+ const historyRepository = dataSource.getRepository(TicketHistory);
26
+
27
+ // 验证工单是否存在
28
+ const ticket = await ticketRepository.findOne({
29
+ where: { id: ticketId }
30
+ });
31
+
32
+ if (!ticket) {
33
+ return Response.failed('工单不存在');
34
+ }
35
+
36
+ // 创建评论
37
+ const comment = commentRepository.create({
38
+ ticketId,
39
+ userId: ctx.user?._id || 'system',
40
+ content,
41
+ parentId: parentId || null,
42
+ type,
43
+ isInternal,
44
+ createdAt: new Date(),
45
+ updatedAt: new Date()
46
+ });
47
+
48
+ const savedComment = await commentRepository.save(comment);
49
+
50
+ // 记录评论历史
51
+ const history = historyRepository.create({
52
+ ticketId,
53
+ userId: ctx.user?._id || 'system',
54
+ action: 'COMMENT',
55
+ description: `添加${type === 'comment' ? '评论' : '回复'}`,
56
+ createdAt: new Date()
57
+ });
58
+ await historyRepository.save(history);
59
+
60
+ return Response.ok(savedComment);
61
+ } catch (error) {
62
+ console.error('添加评论失败:', error);
63
+ return Response.failed('添加评论失败,请稍后重试');
64
+ }
65
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * 工单实体
3
+ */
4
+ import { Entity, Column } from 'typeorm';
5
+ /**
6
+ * 工单实体
7
+ * 用于存储工单的基本信息和状态
8
+ */
9
+ @Entity({
10
+ name: "tickets"
11
+ })
12
+ export class Ticket {
13
+ id: number;
14
+ /* 工单标题 */
15
+ @Column({
16
+ type: "varchar",
17
+ length: 200,
18
+ nullable: false
19
+ })
20
+ title: string = "";
21
+ /* 工单描述 */
22
+ @Column({
23
+ type: "text",
24
+ nullable: true
25
+ })
26
+ description?: string = "";
27
+ /* 工单编号 */
28
+ @Column({
29
+ type: "varchar",
30
+ length: 50,
31
+ nullable: false
32
+ })
33
+ ticketNumber: string = "";
34
+ /* 创建人ID */
35
+ @Column({
36
+ type: "varchar",
37
+ length: 50,
38
+ nullable: false
39
+ })
40
+ creatorId: string = "";
41
+ /* 处理人ID */
42
+ @Column({
43
+ type: "varchar",
44
+ length: 50,
45
+ nullable: true
46
+ })
47
+ assigneeId?: string = "";
48
+ /* 分类ID */
49
+ @Column({
50
+ type: "int",
51
+ nullable: false
52
+ })
53
+ categoryId: number;
54
+ /* 优先级ID */
55
+ @Column({
56
+ type: "int",
57
+ nullable: false
58
+ })
59
+ priorityId: number;
60
+ /* 状态ID */
61
+ @Column({
62
+ type: "int",
63
+ nullable: false
64
+ })
65
+ statusId: number;
66
+ /* 截止日期 */
67
+ @Column({
68
+ type: "timestamp",
69
+ nullable: true
70
+ })
71
+ dueDate?: Date = new Date();
72
+ /* 标签 */
73
+ @Column({
74
+ type: "simple-array",
75
+ nullable: true
76
+ })
77
+ tags?: string[] = [];
78
+ /* 创建时间 */
79
+ createdAt: Date = new Date();
80
+ /* 更新时间 */
81
+ updatedAt: Date = new Date();
82
+ /* 删除时间 */
83
+ @Column({
84
+ type: "timestamp",
85
+ nullable: true
86
+ })
87
+ deletedAt?: Date = new Date();
88
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * 工单附件实体
3
+ */
4
+ import { Entity, Column } from 'typeorm';
5
+ /**
6
+ * 工单附件实体
7
+ * 用于存储工单的附件信息
8
+ */
9
+ @Entity({
10
+ name: "ticket_attachments"
11
+ })
12
+ export class TicketAttachment {
13
+ id: number;
14
+ /* 工单ID */
15
+ @Column({
16
+ type: "int",
17
+ nullable: false
18
+ })
19
+ ticketId: number;
20
+ /* 上传人ID */
21
+ @Column({
22
+ type: "varchar",
23
+ length: 50,
24
+ nullable: false
25
+ })
26
+ uploaderId: string = "";
27
+ /* 文件名称 */
28
+ @Column({
29
+ type: "varchar",
30
+ length: 255,
31
+ nullable: false
32
+ })
33
+ fileName: string = "";
34
+ /* 文件路径 */
35
+ @Column({
36
+ type: "varchar",
37
+ length: 500,
38
+ nullable: false
39
+ })
40
+ filePath: string = "";
41
+ /* 文件大小(字节) */
42
+ @Column({
43
+ type: "bigint",
44
+ nullable: false
45
+ })
46
+ fileSize: number;
47
+ /* 文件类型 */
48
+ @Column({
49
+ type: "varchar",
50
+ length: 100,
51
+ nullable: false
52
+ })
53
+ fileType: string = "";
54
+ /* 文件描述 */
55
+ @Column({
56
+ type: "text",
57
+ nullable: true
58
+ })
59
+ description?: string = "";
60
+ /* 创建时间 */
61
+ createdAt: Date = new Date();
62
+ /* 更新时间 */
63
+ updatedAt: Date = new Date();
64
+ /* 删除时间 */
65
+ @Column({
66
+ type: "timestamp",
67
+ nullable: true
68
+ })
69
+ deletedAt?: Date = new Date();
70
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * 工单分类实体
3
+ */
4
+ import { Entity, Column } from 'typeorm';
5
+ /**
6
+ * 工单分类实体
7
+ * 用于管理工单的分类信息
8
+ */
9
+ @Entity({
10
+ name: "ticket_categories"
11
+ })
12
+ export class TicketCategory {
13
+ id: number;
14
+ /* 分类名称 */
15
+ @Column({
16
+ type: "varchar",
17
+ length: 100,
18
+ nullable: false
19
+ })
20
+ name: string = "";
21
+ /* 分类描述 */
22
+ @Column({
23
+ type: "text",
24
+ nullable: true
25
+ })
26
+ description?: string = "";
27
+ /* 父分类ID */
28
+ @Column({
29
+ type: "int",
30
+ nullable: true
31
+ })
32
+ parentId?: number = 0;
33
+ /* 排序 */
34
+ @Column({
35
+ type: "int",
36
+ default: 0
37
+ })
38
+ sortOrder: number;
39
+ /* 是否启用 */
40
+ @Column({
41
+ type: "boolean",
42
+ default: true
43
+ })
44
+ isActive: boolean = true;
45
+ /* 图标 */
46
+ @Column({
47
+ type: "varchar",
48
+ length: 100,
49
+ nullable: true
50
+ })
51
+ icon?: string = "";
52
+ /* 创建时间 */
53
+ createdAt: Date = new Date();
54
+ /* 更新时间 */
55
+ updatedAt: Date = new Date();
56
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * 工单评论实体
3
+ */
4
+ import { Entity, Column } from 'typeorm';
5
+ /**
6
+ * 工单评论实体
7
+ * 用于存储工单的评论和回复信息
8
+ */
9
+ @Entity({
10
+ name: "ticket_comments"
11
+ })
12
+ export class TicketComment {
13
+ id: number;
14
+ /* 工单ID */
15
+ @Column({
16
+ type: "int",
17
+ nullable: false
18
+ })
19
+ ticketId: number;
20
+ /* 评论人ID */
21
+ @Column({
22
+ type: "varchar",
23
+ length: 50,
24
+ nullable: false
25
+ })
26
+ userId: string = "";
27
+ /* 评论内容 */
28
+ @Column({
29
+ type: "text",
30
+ nullable: false
31
+ })
32
+ content: string = "";
33
+ /* 父评论ID(用于回复) */
34
+ @Column({
35
+ type: "int",
36
+ nullable: true
37
+ })
38
+ parentId?: number = 0;
39
+ /* 评论类型 */
40
+ @Column({
41
+ type: "varchar",
42
+ length: 20,
43
+ default: "comment"
44
+ })
45
+ type: string = "comment";
46
+ /* 是否内部评论 */
47
+ @Column({
48
+ type: "boolean",
49
+ default: false
50
+ })
51
+ isInternal: boolean = false;
52
+ /* 创建时间 */
53
+ createdAt: Date = new Date();
54
+ /* 更新时间 */
55
+ updatedAt: Date = new Date();
56
+ /* 删除时间 */
57
+ @Column({
58
+ type: "timestamp",
59
+ nullable: true
60
+ })
61
+ deletedAt?: Date = new Date();
62
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * 工单历史记录实体
3
+ */
4
+ import { Entity, Column } from 'typeorm';
5
+ /**
6
+ * 工单历史记录实体
7
+ * 用于存储工单的操作历史记录
8
+ */
9
+ @Entity({
10
+ name: "ticket_histories"
11
+ })
12
+ export class TicketHistory {
13
+ id: number;
14
+ /* 工单ID */
15
+ @Column({
16
+ type: "int",
17
+ nullable: false
18
+ })
19
+ ticketId: number;
20
+ /* 操作人ID */
21
+ @Column({
22
+ type: "varchar",
23
+ length: 50,
24
+ nullable: false
25
+ })
26
+ userId: string = "";
27
+ /* 操作类型 */
28
+ @Column({
29
+ type: "varchar",
30
+ length: 50,
31
+ nullable: false
32
+ })
33
+ action: string = "";
34
+ /* 操作描述 */
35
+ @Column({
36
+ type: "text",
37
+ nullable: false
38
+ })
39
+ description: string = "";
40
+ /* 变更前的值 */
41
+ @Column({
42
+ type: "json",
43
+ nullable: true
44
+ })
45
+ oldValue?: any = {};
46
+ /* 变更后的值 */
47
+ @Column({
48
+ type: "json",
49
+ nullable: true
50
+ })
51
+ newValue?: any = {};
52
+ /* 变更字段 */
53
+ @Column({
54
+ type: "varchar",
55
+ length: 100,
56
+ nullable: true
57
+ })
58
+ fieldName?: string = "";
59
+ /* IP地址 */
60
+ @Column({
61
+ type: "varchar",
62
+ length: 50,
63
+ nullable: true
64
+ })
65
+ ipAddress?: string = "";
66
+ /* 用户代理 */
67
+ @Column({
68
+ type: "text",
69
+ nullable: true
70
+ })
71
+ userAgent?: string = "";
72
+ /* 创建时间 */
73
+ createdAt: Date = new Date();
74
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * 工单优先级实体
3
+ */
4
+ import { Entity, Column } from 'typeorm';
5
+ /**
6
+ * 工单优先级实体
7
+ * 用于管理工单的优先级设置
8
+ */
9
+ @Entity({
10
+ name: "ticket_priorities"
11
+ })
12
+ export class TicketPriority {
13
+ id: number;
14
+ /* 优先级名称 */
15
+ @Column({
16
+ type: "varchar",
17
+ length: 50,
18
+ nullable: false
19
+ })
20
+ name: string = "";
21
+ /* 优先级描述 */
22
+ @Column({
23
+ type: "text",
24
+ nullable: true
25
+ })
26
+ description?: string = "";
27
+ /* 优先级级别 */
28
+ @Column({
29
+ type: "int",
30
+ nullable: false
31
+ })
32
+ level: number;
33
+ /* 优先级颜色 */
34
+ @Column({
35
+ type: "varchar",
36
+ length: 20,
37
+ nullable: false
38
+ })
39
+ color: string = "";
40
+ /* 响应时间(分钟) */
41
+ @Column({
42
+ type: "int",
43
+ nullable: true
44
+ })
45
+ responseTime?: number = 0;
46
+ /* 解决时间(分钟) */
47
+ @Column({
48
+ type: "int",
49
+ nullable: true
50
+ })
51
+ resolutionTime?: number = 0;
52
+ /* 排序 */
53
+ @Column({
54
+ type: "int",
55
+ default: 0
56
+ })
57
+ sortOrder: number;
58
+ /* 是否启用 */
59
+ @Column({
60
+ type: "boolean",
61
+ default: true
62
+ })
63
+ isActive: boolean = true;
64
+ /* 创建时间 */
65
+ createdAt: Date = new Date();
66
+ /* 更新时间 */
67
+ updatedAt: Date = new Date();
68
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * 工单状态实体
3
+ */
4
+ import { Entity, Column } from 'typeorm';
5
+ /**
6
+ * 工单状态实体
7
+ * 用于管理工单的各种状态
8
+ */
9
+ @Entity({
10
+ name: "ticket_statuses"
11
+ })
12
+ export class TicketStatus {
13
+ id: number;
14
+ /* 状态名称 */
15
+ @Column({
16
+ type: "varchar",
17
+ length: 50,
18
+ nullable: false
19
+ })
20
+ name: string = "";
21
+ /* 状态描述 */
22
+ @Column({
23
+ type: "text",
24
+ nullable: true
25
+ })
26
+ description?: string = "";
27
+ /* 状态颜色 */
28
+ @Column({
29
+ type: "varchar",
30
+ length: 20,
31
+ nullable: false
32
+ })
33
+ color: string = "";
34
+ /* 状态类型 */
35
+ @Column({
36
+ type: "varchar",
37
+ length: 20,
38
+ nullable: false
39
+ })
40
+ type: string = "";
41
+ /* 排序 */
42
+ @Column({
43
+ type: "int",
44
+ default: 0
45
+ })
46
+ sortOrder: number;
47
+ /* 是否启用 */
48
+ @Column({
49
+ type: "boolean",
50
+ default: true
51
+ })
52
+ isActive: boolean = true;
53
+ /* 是否为默认状态 */
54
+ @Column({
55
+ type: "boolean",
56
+ default: false
57
+ })
58
+ isDefault: boolean = false;
59
+ /* 创建时间 */
60
+ createdAt: Date = new Date();
61
+ /* 更新时间 */
62
+ updatedAt: Date = new Date();
63
+ }