@appthen/cli 1.2.10 → 1.2.12
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/.gitignore +1 -0
- package/bin/main.js +92 -0
- package/dist/index.js +7014 -14988
- package/package.json +8 -1
- package/tests/test-app/.appthen/shadow-space-100001-test-app-e99876b1.json +1862 -0
- package/tests/test-app/.appthen/space-config.json +8 -0
- package/tests/test-app/docs/AI-Workflow.flow +112 -0
- package/tests/test-app/docs/Logic-1.flow +16 -0
- package/tests/test-app/docs/Logic.flow +16 -0
- package/tests/test-app/docs/Project-Blueprint-1.flow +119 -0
- package/tests/test-app/docs/Project-Blueprint.flow +119 -0
- package/tests/test-app/docs/README.md +3 -0
- package/tests/test-app/docs/claude.md +194 -0
- package/tests/test-app/docs/page_requirement_analysis.md +149 -0
- 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
- package/tests/test-app/src/apis/AddTodoPost.api.ts +42 -0
- package/tests/test-app/src/apis/DeleteTodoPost.api.ts +32 -0
- package/tests/test-app/src/apis/GetListPost.api.ts +38 -0
- package/tests/test-app/src/apis/TicketAttachmentUploadPost.api.ts +42 -0
- package/tests/test-app/src/apis/UpdateTodoPost.api.ts +46 -0
- package/tests/test-app/src/app.css +15 -0
- package/tests/test-app/src/cloud_functions/ticket|attachment|upload.node.ts +86 -0
- package/tests/test-app/src/cloud_functions/ticket|comment|add.node.ts +65 -0
- package/tests/test-app/src/cloud_functions/types|entity|Ticket.node.ts +88 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketAttachment.node.ts +70 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketCategory.node.ts +56 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketComment.node.ts +62 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketHistory.node.ts +74 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketPriority.node.ts +68 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketStatus.node.ts +63 -0
- package/tests/test-app/src/cloud_functions/types|models|CreateTicketParams.node.ts +20 -0
- package/tests/test-app/src/cloud_functions/types|models|TicketListParams.node.ts +30 -0
- package/tests/test-app/src/cloud_functions/types|models|UpdateTicketParams.node.ts +22 -0
- package/tests/test-app/src/components/Button.js +11 -0
- package/tests/test-app/src/components/MessageCenter.tsx +506 -0
- package/tests/test-app/src/components/MouduleDemoNzp.tsx +40 -0
- package/tests/test-app/src/components/Timeline.tsx +145 -0
- package/tests/test-app/src/index.ts +2 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketCommentAddPost.api.ts +48 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketCreatePost.api.ts +52 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketDeleteDelete.api.ts +39 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketDetailGet.api.ts +39 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketListGet.api.ts +61 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketUpdatePut.api.ts +57 -0
- package/tests/test-app/src/modules/work_order_module/apis/TrainDoorFaultListGet.ts +76 -0
- package/tests/test-app/src/modules/work_order_module/apis/TrainDoorListGet.ts +76 -0
- package/tests/test-app/src/modules/work_order_module/apis/TrainDoorOperationRecordsGet.ts +284 -0
- package/tests/test-app/src/modules/work_order_module/apis/TrainDoorStatisticsGet.ts +96 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/category|list.node.ts +40 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/priority|list.node.ts +26 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/status|list.node.ts +26 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|create.node.ts +54 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|delete.node.ts +55 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|detail.node.ts +65 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|list.node.ts +85 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|update.node.ts +73 -0
- package/tests/test-app/src/modules/work_order_module/data_model/Ticket.m.ts +85 -0
- package/tests/test-app/src/modules/work_order_module/data_model/TicketCategory.m.ts +53 -0
- package/tests/test-app/src/modules/work_order_module/data_model/TicketStatus.m.ts +60 -0
- 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
- 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
- package/tests/test-app/src/pages/CustomerManagement.tsx +535 -0
- package/tests/test-app/src/pages/CyberpunkDashboard.tsx +348 -0
- package/tests/test-app/src/pages/CyberpunkProductManagement.tsx +637 -0
- package/tests/test-app/src/pages/CyberpunkUserList.tsx +316 -0
- package/tests/test-app/src/pages/DashboardV2.tsx +334 -0
- package/tests/test-app/src/pages/DataReport.tsx +298 -0
- package/tests/test-app/src/pages/DataStatistics.tsx +317 -0
- package/tests/test-app/src/pages/DepartmentManagement.tsx +503 -0
- package/tests/test-app/src/pages/FileExplorer.tsx +441 -0
- package/tests/test-app/src/pages/OrderDetail.tsx +393 -0
- package/tests/test-app/src/pages/ProductManagement.tsx +521 -0
- package/tests/test-app/src/pages/ProjectTimeline.tsx +395 -0
- package/tests/test-app/src/pages/RoleManagement.tsx +523 -0
- package/tests/test-app/src/pages/SLAManagement.tsx +668 -0
- package/tests/test-app/src/pages/StaticCyberpunkDashboard.tsx +462 -0
- package/tests/test-app/src/pages/StaticCyberpunkUserList.tsx +567 -0
- package/tests/test-app/src/pages/StudentWeaknessList.tsx +547 -0
- package/tests/test-app/src/pages/SystemSettings.tsx +422 -0
- package/tests/test-app/src/pages/TaskManagement.tsx +467 -0
- package/tests/test-app/src/pages/TicketCreate.tsx +27 -0
- package/tests/test-app/src/pages/TicketDetail.tsx +27 -0
- package/tests/test-app/src/pages/TicketList.tsx +27 -0
- package/tests/test-app/src/pages/TicketManagement.tsx +402 -0
- package/tests/test-app/src/pages/TicketManagementPage.tsx +1238 -0
- package/tests/test-app/src/pages/UserProfile.tsx +404 -0
- package/tests/test-app/src/pages/VisualAIIDEUpgrade.tsx +245 -0
- package/tests/test-app/src/pages/WorkflowDesigner.tsx +434 -0
- package/tests/test-app/src/pages/admin/dashboard.tsx +591 -0
- package/tests/test-app/src/pages/appthen_guide/ComponentTreeUnderstanding.tsx +26 -0
- package/tests/test-app/src/pages/appthen_guide/DataBindingLearning.tsx +26 -0
- package/tests/test-app/src/pages/article-list.tsx +222 -0
- package/tests/test-app/src/pages/babyProductRecommendationPage.tsx +168 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout.tsx +155 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout10.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout2.tsx +156 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout3.tsx +156 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout4.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout5.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout6.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout7.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout8.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout9.tsx +157 -0
- package/tests/test-app/src/pages/back-end/backgroundManagementSystem.css +5 -0
- package/tests/test-app/src/pages/back-end/backgroundManagementSystem.tsx +1745 -0
- package/tests/test-app/src/pages/category-list.tsx +179 -0
- package/tests/test-app/src/pages/comment-list.tsx +194 -0
- package/tests/test-app/src/pages/component/WorkOrderCard.tsx +140 -0
- package/tests/test-app/src/pages/cover.tsx +42 -0
- package/tests/test-app/src/pages/cyberpunk/cyberpunkCRMPage.tsx +1299 -0
- package/tests/test-app/src/pages/data-analytics.tsx +1872 -0
- package/tests/test-app/src/pages/data-overview.tsx +600 -0
- package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.css +181 -0
- package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.tsx +225 -0
- package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.css +181 -0
- package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.tsx +138 -0
- package/tests/test-app/src/pages/data_dashboard/component_library/BlueBrightGreenBorder.tsx +47 -0
- package/tests/test-app/src/pages/data_dashboard/component_library/FullScreenContainer.tsx +133 -0
- package/tests/test-app/src/pages/demo-error-page.tsx +119 -0
- package/tests/test-app/src/pages/department-list.tsx +183 -0
- package/tests/test-app/src/pages/description_of_mock_interface.md +32 -0
- package/tests/test-app/src/pages/digitalLargeScreen.css +181 -0
- package/tests/test-app/src/pages/digitalLargeScreen.tsx +1417 -0
- package/tests/test-app/src/pages/goods-list.tsx +233 -0
- package/tests/test-app/src/pages/housekeeping/adminDashboardPage.tsx +880 -0
- package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.css +3 -0
- package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.tsx +362 -0
- package/tests/test-app/src/pages/mobile_terminal/WorkOrderHomepage.tsx +337 -0
- package/tests/test-app/src/pages/mobile_terminal/newWorkOrder.tsx +224 -0
- package/tests/test-app/src/pages/mobile_terminal/tabbar.tsx +67 -0
- package/tests/test-app/src/pages/mobile_terminal/uiHandsOnPractice.tsx +638 -0
- package/tests/test-app/src/pages/mobile_terminal/workOrderDetails.tsx +346 -0
- package/tests/test-app/src/pages/mobile_terminal/workOrderPage.tsx +345 -0
- package/tests/test-app/src/pages/notice-list.tsx +217 -0
- package/tests/test-app/src/pages/order-detail.tsx +330 -0
- package/tests/test-app/src/pages/order-list.tsx +195 -0
- package/tests/test-app/src/pages/order-management.tsx +563 -0
- package/tests/test-app/src/pages/page/OrderList.tsx +230 -0
- package/tests/test-app/src/pages/role-list.tsx +184 -0
- package/tests/test-app/src/pages/simple/simplePage.tsx +92 -0
- package/tests/test-app/src/pages/simple-page.tsx +43 -0
- package/tests/test-app/src/pages/test-destructure.tsx +44 -0
- package/tests/test-app/src/pages/test-error-page.tsx +75 -0
- package/tests/test-app/src/pages/test-page-with-errors.tsx +51 -0
- package/tests/test-app/src/pages/test-page.tsx +101 -0
- package/tests/test-app/src/pages/test-render.tsx +52 -0
- package/tests/test-app/src/pages/test-return-type.tsx +41 -0
- package/tests/test-app/src/pages/test-type-assertion.tsx +37 -0
- package/tests/test-app/src/pages/testPage.css +3 -0
- package/tests/test-app/src/pages/testPage.tsx +158 -0
- package/tests/test-app/src/pages/ui/styleSelectorPage.tsx +1554 -0
- package/tests/test-app/src/pages/user-list.tsx +212 -0
- package/tests/test-app/src/pages/web_version/website.css +205 -0
- package/tests/test-app/src/pages/web_version/website.tsx +1066 -0
- package/tests/test-app/src/pages/wrong-page.tsx +50 -0
- package/tests/test-app/src/pages//345/276/205/345/212/236.apidoc.json +336 -0
- package/tests/test-app/src/project.json +1120 -0
- package/tests/test-app/src/store/global.store.ts +10 -0
- package/tests/test-app/src/types/CreateTicketParams.m.ts +20 -0
- package/tests/test-app/src/types/SLAPolicy.ts +50 -0
- package/tests/test-app/src/types/Ticket.ts +68 -0
- package/tests/test-app/src/types/TicketAttachment.m.ts +67 -0
- package/tests/test-app/src/types/TicketComment.m.ts +59 -0
- package/tests/test-app/src/types/TicketEvaluation.ts +44 -0
- package/tests/test-app/src/types/TicketHistory.m.ts +71 -0
- package/tests/test-app/src/types/TicketListParams.m.ts +30 -0
- package/tests/test-app/src/types/TicketPriority.m.ts +65 -0
- package/tests/test-app/src/types/TicketRecord.ts +47 -0
- package/tests/test-app/src/types/TrainDoor.ts +284 -0
- package/tests/test-app/src/types/UpdateTicketParams.m.ts +22 -0
- package/tests/test-app/src/utils/__afterRequest.util.ts +3 -0
- package/tests/test-app/src/utils/__beforeRequest.util.ts +10 -0
- package/tests/test-app/src/utils/testGlobalAction.util.ts +7 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 列车车门系统状态枚举
|
|
3
|
+
*/
|
|
4
|
+
export enum DoorSystemStatus {
|
|
5
|
+
NORMAL = 'normal',
|
|
6
|
+
WARNING = 'warning',
|
|
7
|
+
FAULT = 'fault',
|
|
8
|
+
OFFLINE = 'offline'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 车门故障类型枚举
|
|
13
|
+
*/
|
|
14
|
+
export enum DoorFaultType {
|
|
15
|
+
MECHANICAL = 'mechanical',
|
|
16
|
+
ELECTRICAL = 'electrical',
|
|
17
|
+
SENSOR = 'sensor',
|
|
18
|
+
CONTROL = 'control',
|
|
19
|
+
COMMUNICATION = 'communication'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 车门运行状态枚举
|
|
24
|
+
*/
|
|
25
|
+
export enum DoorOperatingStatus {
|
|
26
|
+
OPEN = 'open',
|
|
27
|
+
CLOSED = 'closed',
|
|
28
|
+
OPENING = 'opening',
|
|
29
|
+
CLOSING = 'closing',
|
|
30
|
+
STUCK = 'stuck',
|
|
31
|
+
MAINTENANCE = 'maintenance'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 车门数据实体
|
|
36
|
+
* 用于存储车门的基本信息和状态
|
|
37
|
+
*/
|
|
38
|
+
@Entity({
|
|
39
|
+
name: "train_doors"
|
|
40
|
+
})
|
|
41
|
+
export class TrainDoor {
|
|
42
|
+
id: number;
|
|
43
|
+
|
|
44
|
+
/* 列车ID */
|
|
45
|
+
@Column({
|
|
46
|
+
type: "varchar",
|
|
47
|
+
length: 50,
|
|
48
|
+
nullable: false
|
|
49
|
+
})
|
|
50
|
+
trainId: string = "";
|
|
51
|
+
|
|
52
|
+
/* 车厢号 */
|
|
53
|
+
@Column({
|
|
54
|
+
type: "varchar",
|
|
55
|
+
length: 20,
|
|
56
|
+
nullable: false
|
|
57
|
+
})
|
|
58
|
+
carriageNumber: string = "";
|
|
59
|
+
|
|
60
|
+
/* 车门编号 */
|
|
61
|
+
@Column({
|
|
62
|
+
type: "varchar",
|
|
63
|
+
length: 30,
|
|
64
|
+
nullable: false
|
|
65
|
+
})
|
|
66
|
+
doorNumber: string = "";
|
|
67
|
+
|
|
68
|
+
/* 车门位置(左侧/右侧) */
|
|
69
|
+
@Column({
|
|
70
|
+
type: "varchar",
|
|
71
|
+
length: 10,
|
|
72
|
+
nullable: false
|
|
73
|
+
})
|
|
74
|
+
doorPosition: string = "";
|
|
75
|
+
|
|
76
|
+
/* 车门状态 */
|
|
77
|
+
@Column({
|
|
78
|
+
type: "varchar",
|
|
79
|
+
length: 20,
|
|
80
|
+
nullable: false
|
|
81
|
+
})
|
|
82
|
+
status: DoorSystemStatus = DoorSystemStatus.NORMAL;
|
|
83
|
+
|
|
84
|
+
/* 运行状态 */
|
|
85
|
+
@Column({
|
|
86
|
+
type: "varchar",
|
|
87
|
+
length: 20,
|
|
88
|
+
nullable: false
|
|
89
|
+
})
|
|
90
|
+
operatingStatus: DoorOperatingStatus = DoorOperatingStatus.CLOSED;
|
|
91
|
+
|
|
92
|
+
/* 开关次数 */
|
|
93
|
+
@Column({
|
|
94
|
+
type: "int",
|
|
95
|
+
nullable: false
|
|
96
|
+
})
|
|
97
|
+
operationCount: number = 0;
|
|
98
|
+
|
|
99
|
+
/* 故障次数 */
|
|
100
|
+
@Column({
|
|
101
|
+
type: "int",
|
|
102
|
+
nullable: false
|
|
103
|
+
})
|
|
104
|
+
faultCount: number = 0;
|
|
105
|
+
|
|
106
|
+
/* 上次维护时间 */
|
|
107
|
+
@Column({
|
|
108
|
+
type: "timestamp",
|
|
109
|
+
nullable: true
|
|
110
|
+
})
|
|
111
|
+
lastMaintenanceTime?: Date;
|
|
112
|
+
|
|
113
|
+
/* 下次维护时间 */
|
|
114
|
+
@Column({
|
|
115
|
+
type: "timestamp",
|
|
116
|
+
nullable: true
|
|
117
|
+
})
|
|
118
|
+
nextMaintenanceTime?: Date;
|
|
119
|
+
|
|
120
|
+
/* 使用寿命(百分比) */
|
|
121
|
+
@Column({
|
|
122
|
+
type: "decimal",
|
|
123
|
+
precision: 5,
|
|
124
|
+
scale: 2,
|
|
125
|
+
nullable: false
|
|
126
|
+
})
|
|
127
|
+
lifespanPercentage: number = 100;
|
|
128
|
+
|
|
129
|
+
/* 创建时间 */
|
|
130
|
+
createdAt: Date = new Date();
|
|
131
|
+
|
|
132
|
+
/* 更新时间 */
|
|
133
|
+
updatedAt: Date = new Date();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 车门故障记录实体
|
|
138
|
+
*/
|
|
139
|
+
@Entity({
|
|
140
|
+
name: "door_fault_records"
|
|
141
|
+
})
|
|
142
|
+
export class DoorFaultRecord {
|
|
143
|
+
id: number;
|
|
144
|
+
|
|
145
|
+
/* 车门ID */
|
|
146
|
+
@Column({
|
|
147
|
+
type: "int",
|
|
148
|
+
nullable: false
|
|
149
|
+
})
|
|
150
|
+
doorId: number;
|
|
151
|
+
|
|
152
|
+
/* 故障类型 */
|
|
153
|
+
@Column({
|
|
154
|
+
type: "varchar",
|
|
155
|
+
length: 30,
|
|
156
|
+
nullable: false
|
|
157
|
+
})
|
|
158
|
+
faultType: DoorFaultType = DoorFaultType.MECHANICAL;
|
|
159
|
+
|
|
160
|
+
/* 故障描述 */
|
|
161
|
+
@Column({
|
|
162
|
+
type: "text",
|
|
163
|
+
nullable: false
|
|
164
|
+
})
|
|
165
|
+
description: string = "";
|
|
166
|
+
|
|
167
|
+
/* 故障严重程度(1-5) */
|
|
168
|
+
@Column({
|
|
169
|
+
type: "int",
|
|
170
|
+
nullable: false
|
|
171
|
+
})
|
|
172
|
+
severity: number = 1;
|
|
173
|
+
|
|
174
|
+
/* 故障开始时间 */
|
|
175
|
+
@Column({
|
|
176
|
+
type: "timestamp",
|
|
177
|
+
nullable: false
|
|
178
|
+
})
|
|
179
|
+
faultStartTime: Date = new Date();
|
|
180
|
+
|
|
181
|
+
/* 故障结束时间 */
|
|
182
|
+
@Column({
|
|
183
|
+
type: "timestamp",
|
|
184
|
+
nullable: true
|
|
185
|
+
})
|
|
186
|
+
faultEndTime?: Date;
|
|
187
|
+
|
|
188
|
+
/* 修复时间(分钟) */
|
|
189
|
+
@Column({
|
|
190
|
+
type: "int",
|
|
191
|
+
nullable: true
|
|
192
|
+
})
|
|
193
|
+
repairDuration?: number;
|
|
194
|
+
|
|
195
|
+
/* 维修人员 */
|
|
196
|
+
@Column({
|
|
197
|
+
type: "varchar",
|
|
198
|
+
length: 50,
|
|
199
|
+
nullable: true
|
|
200
|
+
})
|
|
201
|
+
repairPerson?: string;
|
|
202
|
+
|
|
203
|
+
/* 故障状态 */
|
|
204
|
+
@Column({
|
|
205
|
+
type: "varchar",
|
|
206
|
+
length: 20,
|
|
207
|
+
nullable: false
|
|
208
|
+
})
|
|
209
|
+
status: string = "active"; // active, resolved, maintenance
|
|
210
|
+
|
|
211
|
+
/* 创建时间 */
|
|
212
|
+
createdAt: Date = new Date();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* 车门运行记录实体
|
|
217
|
+
*/
|
|
218
|
+
@Entity({
|
|
219
|
+
name: "door_operation_records"
|
|
220
|
+
})
|
|
221
|
+
export class DoorOperationRecord {
|
|
222
|
+
id: number;
|
|
223
|
+
|
|
224
|
+
/* 车门ID */
|
|
225
|
+
@Column({
|
|
226
|
+
type: "int",
|
|
227
|
+
nullable: false
|
|
228
|
+
})
|
|
229
|
+
doorId: number;
|
|
230
|
+
|
|
231
|
+
/* 操作类型 */
|
|
232
|
+
@Column({
|
|
233
|
+
type: "varchar",
|
|
234
|
+
length: 20,
|
|
235
|
+
nullable: false
|
|
236
|
+
})
|
|
237
|
+
operationType: DoorOperatingStatus = DoorOperatingStatus.OPEN;
|
|
238
|
+
|
|
239
|
+
/* 操作开始时间 */
|
|
240
|
+
@Column({
|
|
241
|
+
type: "timestamp",
|
|
242
|
+
nullable: false
|
|
243
|
+
})
|
|
244
|
+
operationStartTime: Date = new Date();
|
|
245
|
+
|
|
246
|
+
/* 操作结束时间 */
|
|
247
|
+
@Column({
|
|
248
|
+
type: "timestamp",
|
|
249
|
+
nullable: true
|
|
250
|
+
})
|
|
251
|
+
operationEndTime?: Date;
|
|
252
|
+
|
|
253
|
+
/* 操作持续时间(毫秒) */
|
|
254
|
+
@Column({
|
|
255
|
+
type: "int",
|
|
256
|
+
nullable: true
|
|
257
|
+
})
|
|
258
|
+
duration?: number;
|
|
259
|
+
|
|
260
|
+
/* 操作是否成功 */
|
|
261
|
+
@Column({
|
|
262
|
+
type: "boolean",
|
|
263
|
+
nullable: false
|
|
264
|
+
})
|
|
265
|
+
success: boolean = true;
|
|
266
|
+
|
|
267
|
+
/* 错误信息 */
|
|
268
|
+
@Column({
|
|
269
|
+
type: "text",
|
|
270
|
+
nullable: true
|
|
271
|
+
})
|
|
272
|
+
errorMessage?: string;
|
|
273
|
+
|
|
274
|
+
/* 站点信息 */
|
|
275
|
+
@Column({
|
|
276
|
+
type: "varchar",
|
|
277
|
+
length: 100,
|
|
278
|
+
nullable: true
|
|
279
|
+
})
|
|
280
|
+
station?: string;
|
|
281
|
+
|
|
282
|
+
/* 创建时间 */
|
|
283
|
+
createdAt: Date = new Date();
|
|
284
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取车门统计数据
|
|
3
|
+
*
|
|
4
|
+
* @api GET /train/door/statistics
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Body 参数类型
|
|
9
|
+
*/
|
|
10
|
+
export class TrainDoorStatisticsGetBodyDto {
|
|
11
|
+
/* 根节点 */
|
|
12
|
+
_root_?: any = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Query 参数类型
|
|
17
|
+
*/
|
|
18
|
+
export class TrainDoorStatisticsGetQueryDto {
|
|
19
|
+
/* 线路 */
|
|
20
|
+
line?: string = "6号线";
|
|
21
|
+
|
|
22
|
+
/* 统计类型 */
|
|
23
|
+
type?: string = "overview"; // overview, fault, operation, maintenance
|
|
24
|
+
|
|
25
|
+
/* 时间范围 */
|
|
26
|
+
timeRange?: string = "today"; // today, week, month, year
|
|
27
|
+
|
|
28
|
+
/* 开始时间 */
|
|
29
|
+
startTime?: Date = new Date();
|
|
30
|
+
|
|
31
|
+
/* 结束时间 */
|
|
32
|
+
endTime?: Date = new Date();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Path 参数类型
|
|
37
|
+
*/
|
|
38
|
+
export class TrainDoorStatisticsGetPathDto {}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 接口返回值类型
|
|
42
|
+
*/
|
|
43
|
+
export class TrainDoorStatisticsGetResponseDto {
|
|
44
|
+
/* 根节点 */
|
|
45
|
+
_root_?: {
|
|
46
|
+
/* 响应码 */code?: number,
|
|
47
|
+
/* 响应消息 */message?: string,
|
|
48
|
+
/* 返回数据 */data?: {
|
|
49
|
+
/* 车门总数 */totalDoors?: number,
|
|
50
|
+
/* 正常车门数 */normalDoors?: number,
|
|
51
|
+
/* 预警车门数 */warningDoors?: number,
|
|
52
|
+
/* 故障车门数 */faultDoors?: number,
|
|
53
|
+
/* 离线车门数 */offlineDoors?: number,
|
|
54
|
+
/* 今日故障次数 */todayFaultCount?: number,
|
|
55
|
+
/* 本周故障次数 */weekFaultCount?: number,
|
|
56
|
+
/* 本月故障次数 */monthFaultCount?: number,
|
|
57
|
+
/* 平均故障率 */averageFaultRate?: number,
|
|
58
|
+
/* 最高故障车门 */highestFaultDoor?: any,
|
|
59
|
+
/* 维护统计 */maintenanceStats?: {
|
|
60
|
+
/* 已维护数 */maintainedCount?: number,
|
|
61
|
+
/* 待维护数 */pendingMaintenanceCount?: number,
|
|
62
|
+
/* 逾期维护数 */overdueMaintenanceCount?: number
|
|
63
|
+
},
|
|
64
|
+
/* 运行统计 */operationStats?: {
|
|
65
|
+
/* 总运行次数 */totalOperations?: number,
|
|
66
|
+
/* 成功率 */successRate?: number,
|
|
67
|
+
/* 平均开关时间 */averageOperationTime?: number
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
} = {
|
|
71
|
+
code: 0,
|
|
72
|
+
message: "",
|
|
73
|
+
data: {
|
|
74
|
+
totalDoors: 0,
|
|
75
|
+
normalDoors: 0,
|
|
76
|
+
warningDoors: 0,
|
|
77
|
+
faultDoors: 0,
|
|
78
|
+
offlineDoors: 0,
|
|
79
|
+
todayFaultCount: 0,
|
|
80
|
+
weekFaultCount: 0,
|
|
81
|
+
monthFaultCount: 0,
|
|
82
|
+
averageFaultRate: 0,
|
|
83
|
+
highestFaultDoor: null,
|
|
84
|
+
maintenanceStats: {
|
|
85
|
+
maintainedCount: 0,
|
|
86
|
+
pendingMaintenanceCount: 0,
|
|
87
|
+
overdueMaintenanceCount: 0
|
|
88
|
+
},
|
|
89
|
+
operationStats: {
|
|
90
|
+
totalOperations: 0,
|
|
91
|
+
successRate: 0,
|
|
92
|
+
averageOperationTime: 0
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取分类列表
|
|
3
|
+
* 支持树形结构返回
|
|
4
|
+
*
|
|
5
|
+
* @methods GET
|
|
6
|
+
*/
|
|
7
|
+
import cloud from '@lafjs/cloud';
|
|
8
|
+
import { DataSource } from 'typeorm';
|
|
9
|
+
import { Response } from '@/utils/func';
|
|
10
|
+
import { TicketCategory } from '@/types/entity/TicketCategory';
|
|
11
|
+
|
|
12
|
+
export default async function (ctx: FunctionContext) {
|
|
13
|
+
try {
|
|
14
|
+
const dataSource: DataSource = cloud.datasource.default;
|
|
15
|
+
const categoryRepository = dataSource.getRepository(TicketCategory);
|
|
16
|
+
|
|
17
|
+
// 查询所有启用的分类
|
|
18
|
+
const categories = await categoryRepository.find({
|
|
19
|
+
where: { isActive: true },
|
|
20
|
+
order: { sortOrder: 'ASC', createdAt: 'ASC' }
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// 构建树形结构
|
|
24
|
+
const buildTree = (categories: TicketCategory[], parentId?: number): any[] => {
|
|
25
|
+
return categories
|
|
26
|
+
.filter(cat => cat.parentId === parentId)
|
|
27
|
+
.map(cat => ({
|
|
28
|
+
...cat,
|
|
29
|
+
children: buildTree(categories, cat.id)
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const treeData = buildTree(categories);
|
|
34
|
+
|
|
35
|
+
return Response.ok(treeData);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('获取分类列表失败:', error);
|
|
38
|
+
return Response.failed('获取分类列表失败,请稍后重试');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取优先级列表
|
|
3
|
+
*
|
|
4
|
+
* @methods GET
|
|
5
|
+
*/
|
|
6
|
+
import cloud from '@lafjs/cloud';
|
|
7
|
+
import { DataSource } from 'typeorm';
|
|
8
|
+
import { Response } from '@/utils/func';
|
|
9
|
+
import { TicketPriority } from '@/types/entity/TicketPriority';
|
|
10
|
+
|
|
11
|
+
export default async function (ctx: FunctionContext) {
|
|
12
|
+
try {
|
|
13
|
+
const dataSource: DataSource = cloud.datasource.default;
|
|
14
|
+
const priorityRepository = dataSource.getRepository(TicketPriority);
|
|
15
|
+
|
|
16
|
+
const priorities = await priorityRepository.find({
|
|
17
|
+
where: { isActive: true },
|
|
18
|
+
order: { level: 'ASC', sortOrder: 'ASC' }
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return Response.ok(priorities);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('获取优先级列表失败:', error);
|
|
24
|
+
return Response.failed('获取优先级列表失败,请稍后重试');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取状态列表
|
|
3
|
+
*
|
|
4
|
+
* @methods GET
|
|
5
|
+
*/
|
|
6
|
+
import cloud from '@lafjs/cloud';
|
|
7
|
+
import { DataSource } from 'typeorm';
|
|
8
|
+
import { Response } from '@/utils/func';
|
|
9
|
+
import { TicketStatus } from '@/types/entity/TicketStatus';
|
|
10
|
+
|
|
11
|
+
export default async function (ctx: FunctionContext) {
|
|
12
|
+
try {
|
|
13
|
+
const dataSource: DataSource = cloud.datasource.default;
|
|
14
|
+
const statusRepository = dataSource.getRepository(TicketStatus);
|
|
15
|
+
|
|
16
|
+
const statuses = await statusRepository.find({
|
|
17
|
+
where: { isActive: true },
|
|
18
|
+
order: { sortOrder: 'ASC', createdAt: 'ASC' }
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return Response.ok(statuses);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('获取状态列表失败:', error);
|
|
24
|
+
return Response.failed('获取状态列表失败,请稍后重试');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 { Ticket } from '@/types/entity/Ticket';
|
|
11
|
+
import { CreateTicketParams } from '@/types/models/CreateTicketParams';
|
|
12
|
+
|
|
13
|
+
export default async function (ctx: FunctionContext) {
|
|
14
|
+
const { body } = ctx;
|
|
15
|
+
const params: CreateTicketParams = body;
|
|
16
|
+
|
|
17
|
+
// 参数验证
|
|
18
|
+
if (!params.title || !params.categoryId || !params.priorityId) {
|
|
19
|
+
return Response.failed('标题、分类和优先级为必填项');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const dataSource: DataSource = cloud.datasource.default;
|
|
24
|
+
const ticketRepository = dataSource.getRepository(Ticket);
|
|
25
|
+
|
|
26
|
+
// 生成工单编号
|
|
27
|
+
const date = new Date();
|
|
28
|
+
const dateStr = date.toISOString().slice(0, 10).replace(/-/g, '');
|
|
29
|
+
const count = await ticketRepository.count();
|
|
30
|
+
const ticketNumber = `TK-${dateStr}-${String(count + 1).padStart(6, '0')}`;
|
|
31
|
+
|
|
32
|
+
// 创建工单
|
|
33
|
+
const ticket = ticketRepository.create({
|
|
34
|
+
title: params.title,
|
|
35
|
+
description: params.description || '',
|
|
36
|
+
ticketNumber,
|
|
37
|
+
creatorId: ctx.user?._id || 'system',
|
|
38
|
+
categoryId: params.categoryId,
|
|
39
|
+
priorityId: params.priorityId,
|
|
40
|
+
statusId: 1, // 默认状态:新建
|
|
41
|
+
tags: params.tags || [],
|
|
42
|
+
dueDate: params.dueDate || null,
|
|
43
|
+
createdAt: new Date(),
|
|
44
|
+
updatedAt: new Date()
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const savedTicket = await ticketRepository.save(ticket);
|
|
48
|
+
|
|
49
|
+
return Response.ok(savedTicket);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error('创建工单失败:', error);
|
|
52
|
+
return Response.failed('创建工单失败,请稍后重试');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 删除工单(软删除)
|
|
3
|
+
* 将工单标记为已删除状态
|
|
4
|
+
*
|
|
5
|
+
* @methods DELETE
|
|
6
|
+
*/
|
|
7
|
+
import cloud from '@lafjs/cloud';
|
|
8
|
+
import { DataSource } from 'typeorm';
|
|
9
|
+
import { Response } from '@/utils/func';
|
|
10
|
+
import { Ticket } from '@/types/entity/Ticket';
|
|
11
|
+
import { TicketHistory } from '@/types/entity/TicketHistory';
|
|
12
|
+
|
|
13
|
+
export default async function (ctx: FunctionContext) {
|
|
14
|
+
const { id } = ctx.query;
|
|
15
|
+
|
|
16
|
+
if (!id) {
|
|
17
|
+
return Response.failed('工单ID不能为空');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const dataSource: DataSource = cloud.datasource.default;
|
|
22
|
+
const ticketRepository = dataSource.getRepository(Ticket);
|
|
23
|
+
const historyRepository = dataSource.getRepository(TicketHistory);
|
|
24
|
+
|
|
25
|
+
const ticket = await ticketRepository.findOne({
|
|
26
|
+
where: { id: parseInt(id) }
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (!ticket) {
|
|
30
|
+
return Response.failed('工单不存在');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 软删除
|
|
34
|
+
await ticketRepository.save({
|
|
35
|
+
...ticket,
|
|
36
|
+
deletedAt: new Date(),
|
|
37
|
+
updatedAt: new Date()
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// 记录删除历史
|
|
41
|
+
const history = historyRepository.create({
|
|
42
|
+
ticketId: parseInt(id),
|
|
43
|
+
userId: ctx.user?._id || 'system',
|
|
44
|
+
action: 'DELETE',
|
|
45
|
+
description: '删除工单',
|
|
46
|
+
createdAt: new Date()
|
|
47
|
+
});
|
|
48
|
+
await historyRepository.save(history);
|
|
49
|
+
|
|
50
|
+
return Response.ok({ message: '工单已删除' });
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error('删除工单失败:', error);
|
|
53
|
+
return Response.failed('删除失败,请稍后重试');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取工单详情
|
|
3
|
+
* 包含完整信息和关联数据
|
|
4
|
+
*
|
|
5
|
+
* @methods GET
|
|
6
|
+
*/
|
|
7
|
+
import cloud from '@lafjs/cloud';
|
|
8
|
+
import { DataSource } from 'typeorm';
|
|
9
|
+
import { Response } from '@/utils/func';
|
|
10
|
+
import { Ticket } from '@/types/entity/Ticket';
|
|
11
|
+
import { TicketComment } from '@/types/entity/TicketComment';
|
|
12
|
+
import { TicketAttachment } from '@/types/entity/TicketAttachment';
|
|
13
|
+
import { TicketHistory } from '@/types/entity/TicketHistory';
|
|
14
|
+
|
|
15
|
+
export default async function (ctx: FunctionContext) {
|
|
16
|
+
const { id } = ctx.query;
|
|
17
|
+
|
|
18
|
+
if (!id) {
|
|
19
|
+
return Response.failed('工单ID不能为空');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const dataSource: DataSource = cloud.datasource.default;
|
|
24
|
+
const ticketRepository = dataSource.getRepository(Ticket);
|
|
25
|
+
const commentRepository = dataSource.getRepository(TicketComment);
|
|
26
|
+
const attachmentRepository = dataSource.getRepository(TicketAttachment);
|
|
27
|
+
const historyRepository = dataSource.getRepository(TicketHistory);
|
|
28
|
+
|
|
29
|
+
// 查询工单基本信息
|
|
30
|
+
const ticket = await ticketRepository.findOne({
|
|
31
|
+
where: { id: parseInt(id) },
|
|
32
|
+
relations: ['category', 'status', 'priority']
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (!ticket) {
|
|
36
|
+
return Response.failed('工单不存在');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 查询关联数据
|
|
40
|
+
const comments = await commentRepository.find({
|
|
41
|
+
where: { ticketId: parseInt(id) },
|
|
42
|
+
order: { createdAt: 'ASC' }
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const attachments = await attachmentRepository.find({
|
|
46
|
+
where: { ticketId: parseInt(id) },
|
|
47
|
+
order: { createdAt: 'DESC' }
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const histories = await historyRepository.find({
|
|
51
|
+
where: { ticketId: parseInt(id) },
|
|
52
|
+
order: { createdAt: 'DESC' }
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return Response.ok({
|
|
56
|
+
...ticket,
|
|
57
|
+
comments,
|
|
58
|
+
attachments,
|
|
59
|
+
histories
|
|
60
|
+
});
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error('查询工单详情失败:', error);
|
|
63
|
+
return Response.failed('查询失败,请稍后重试');
|
|
64
|
+
}
|
|
65
|
+
}
|