@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.
Files changed (173) hide show
  1. package/.gitignore +1 -0
  2. package/bin/main.js +92 -0
  3. package/dist/index.js +7014 -14988
  4. package/package.json +8 -1
  5. package/tests/test-app/.appthen/shadow-space-100001-test-app-e99876b1.json +1862 -0
  6. package/tests/test-app/.appthen/space-config.json +8 -0
  7. package/tests/test-app/docs/AI-Workflow.flow +112 -0
  8. package/tests/test-app/docs/Logic-1.flow +16 -0
  9. package/tests/test-app/docs/Logic.flow +16 -0
  10. package/tests/test-app/docs/Project-Blueprint-1.flow +119 -0
  11. package/tests/test-app/docs/Project-Blueprint.flow +119 -0
  12. package/tests/test-app/docs/README.md +3 -0
  13. package/tests/test-app/docs/claude.md +194 -0
  14. package/tests/test-app/docs/page_requirement_analysis.md +149 -0
  15. 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
  16. package/tests/test-app/src/apis/AddTodoPost.api.ts +42 -0
  17. package/tests/test-app/src/apis/DeleteTodoPost.api.ts +32 -0
  18. package/tests/test-app/src/apis/GetListPost.api.ts +38 -0
  19. package/tests/test-app/src/apis/TicketAttachmentUploadPost.api.ts +42 -0
  20. package/tests/test-app/src/apis/UpdateTodoPost.api.ts +46 -0
  21. package/tests/test-app/src/app.css +15 -0
  22. package/tests/test-app/src/cloud_functions/ticket|attachment|upload.node.ts +86 -0
  23. package/tests/test-app/src/cloud_functions/ticket|comment|add.node.ts +65 -0
  24. package/tests/test-app/src/cloud_functions/types|entity|Ticket.node.ts +88 -0
  25. package/tests/test-app/src/cloud_functions/types|entity|TicketAttachment.node.ts +70 -0
  26. package/tests/test-app/src/cloud_functions/types|entity|TicketCategory.node.ts +56 -0
  27. package/tests/test-app/src/cloud_functions/types|entity|TicketComment.node.ts +62 -0
  28. package/tests/test-app/src/cloud_functions/types|entity|TicketHistory.node.ts +74 -0
  29. package/tests/test-app/src/cloud_functions/types|entity|TicketPriority.node.ts +68 -0
  30. package/tests/test-app/src/cloud_functions/types|entity|TicketStatus.node.ts +63 -0
  31. package/tests/test-app/src/cloud_functions/types|models|CreateTicketParams.node.ts +20 -0
  32. package/tests/test-app/src/cloud_functions/types|models|TicketListParams.node.ts +30 -0
  33. package/tests/test-app/src/cloud_functions/types|models|UpdateTicketParams.node.ts +22 -0
  34. package/tests/test-app/src/components/Button.js +11 -0
  35. package/tests/test-app/src/components/MessageCenter.tsx +506 -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/CustomerManagement.tsx +535 -0
  63. package/tests/test-app/src/pages/CyberpunkDashboard.tsx +348 -0
  64. package/tests/test-app/src/pages/CyberpunkProductManagement.tsx +637 -0
  65. package/tests/test-app/src/pages/CyberpunkUserList.tsx +316 -0
  66. package/tests/test-app/src/pages/DashboardV2.tsx +334 -0
  67. package/tests/test-app/src/pages/DataReport.tsx +298 -0
  68. package/tests/test-app/src/pages/DataStatistics.tsx +317 -0
  69. package/tests/test-app/src/pages/DepartmentManagement.tsx +503 -0
  70. package/tests/test-app/src/pages/FileExplorer.tsx +441 -0
  71. package/tests/test-app/src/pages/OrderDetail.tsx +393 -0
  72. package/tests/test-app/src/pages/ProductManagement.tsx +521 -0
  73. package/tests/test-app/src/pages/ProjectTimeline.tsx +395 -0
  74. package/tests/test-app/src/pages/RoleManagement.tsx +523 -0
  75. package/tests/test-app/src/pages/SLAManagement.tsx +668 -0
  76. package/tests/test-app/src/pages/StaticCyberpunkDashboard.tsx +462 -0
  77. package/tests/test-app/src/pages/StaticCyberpunkUserList.tsx +567 -0
  78. package/tests/test-app/src/pages/StudentWeaknessList.tsx +547 -0
  79. package/tests/test-app/src/pages/SystemSettings.tsx +422 -0
  80. package/tests/test-app/src/pages/TaskManagement.tsx +467 -0
  81. package/tests/test-app/src/pages/TicketCreate.tsx +27 -0
  82. package/tests/test-app/src/pages/TicketDetail.tsx +27 -0
  83. package/tests/test-app/src/pages/TicketList.tsx +27 -0
  84. package/tests/test-app/src/pages/TicketManagement.tsx +402 -0
  85. package/tests/test-app/src/pages/TicketManagementPage.tsx +1238 -0
  86. package/tests/test-app/src/pages/UserProfile.tsx +404 -0
  87. package/tests/test-app/src/pages/VisualAIIDEUpgrade.tsx +245 -0
  88. package/tests/test-app/src/pages/WorkflowDesigner.tsx +434 -0
  89. package/tests/test-app/src/pages/admin/dashboard.tsx +591 -0
  90. package/tests/test-app/src/pages/appthen_guide/ComponentTreeUnderstanding.tsx +26 -0
  91. package/tests/test-app/src/pages/appthen_guide/DataBindingLearning.tsx +26 -0
  92. package/tests/test-app/src/pages/article-list.tsx +222 -0
  93. package/tests/test-app/src/pages/babyProductRecommendationPage.tsx +168 -0
  94. package/tests/test-app/src/pages/back-end/adminRootLayout.tsx +155 -0
  95. package/tests/test-app/src/pages/back-end/adminRootLayout10.tsx +157 -0
  96. package/tests/test-app/src/pages/back-end/adminRootLayout2.tsx +156 -0
  97. package/tests/test-app/src/pages/back-end/adminRootLayout3.tsx +156 -0
  98. package/tests/test-app/src/pages/back-end/adminRootLayout4.tsx +157 -0
  99. package/tests/test-app/src/pages/back-end/adminRootLayout5.tsx +157 -0
  100. package/tests/test-app/src/pages/back-end/adminRootLayout6.tsx +157 -0
  101. package/tests/test-app/src/pages/back-end/adminRootLayout7.tsx +157 -0
  102. package/tests/test-app/src/pages/back-end/adminRootLayout8.tsx +157 -0
  103. package/tests/test-app/src/pages/back-end/adminRootLayout9.tsx +157 -0
  104. package/tests/test-app/src/pages/back-end/backgroundManagementSystem.css +5 -0
  105. package/tests/test-app/src/pages/back-end/backgroundManagementSystem.tsx +1745 -0
  106. package/tests/test-app/src/pages/category-list.tsx +179 -0
  107. package/tests/test-app/src/pages/comment-list.tsx +194 -0
  108. package/tests/test-app/src/pages/component/WorkOrderCard.tsx +140 -0
  109. package/tests/test-app/src/pages/cover.tsx +42 -0
  110. package/tests/test-app/src/pages/cyberpunk/cyberpunkCRMPage.tsx +1299 -0
  111. package/tests/test-app/src/pages/data-analytics.tsx +1872 -0
  112. package/tests/test-app/src/pages/data-overview.tsx +600 -0
  113. package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.css +181 -0
  114. package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.tsx +225 -0
  115. package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.css +181 -0
  116. package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.tsx +138 -0
  117. package/tests/test-app/src/pages/data_dashboard/component_library/BlueBrightGreenBorder.tsx +47 -0
  118. package/tests/test-app/src/pages/data_dashboard/component_library/FullScreenContainer.tsx +133 -0
  119. package/tests/test-app/src/pages/demo-error-page.tsx +119 -0
  120. package/tests/test-app/src/pages/department-list.tsx +183 -0
  121. package/tests/test-app/src/pages/description_of_mock_interface.md +32 -0
  122. package/tests/test-app/src/pages/digitalLargeScreen.css +181 -0
  123. package/tests/test-app/src/pages/digitalLargeScreen.tsx +1417 -0
  124. package/tests/test-app/src/pages/goods-list.tsx +233 -0
  125. package/tests/test-app/src/pages/housekeeping/adminDashboardPage.tsx +880 -0
  126. package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.css +3 -0
  127. package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.tsx +362 -0
  128. package/tests/test-app/src/pages/mobile_terminal/WorkOrderHomepage.tsx +337 -0
  129. package/tests/test-app/src/pages/mobile_terminal/newWorkOrder.tsx +224 -0
  130. package/tests/test-app/src/pages/mobile_terminal/tabbar.tsx +67 -0
  131. package/tests/test-app/src/pages/mobile_terminal/uiHandsOnPractice.tsx +638 -0
  132. package/tests/test-app/src/pages/mobile_terminal/workOrderDetails.tsx +346 -0
  133. package/tests/test-app/src/pages/mobile_terminal/workOrderPage.tsx +345 -0
  134. package/tests/test-app/src/pages/notice-list.tsx +217 -0
  135. package/tests/test-app/src/pages/order-detail.tsx +330 -0
  136. package/tests/test-app/src/pages/order-list.tsx +195 -0
  137. package/tests/test-app/src/pages/order-management.tsx +563 -0
  138. package/tests/test-app/src/pages/page/OrderList.tsx +230 -0
  139. package/tests/test-app/src/pages/role-list.tsx +184 -0
  140. package/tests/test-app/src/pages/simple/simplePage.tsx +92 -0
  141. package/tests/test-app/src/pages/simple-page.tsx +43 -0
  142. package/tests/test-app/src/pages/test-destructure.tsx +44 -0
  143. package/tests/test-app/src/pages/test-error-page.tsx +75 -0
  144. package/tests/test-app/src/pages/test-page-with-errors.tsx +51 -0
  145. package/tests/test-app/src/pages/test-page.tsx +101 -0
  146. package/tests/test-app/src/pages/test-render.tsx +52 -0
  147. package/tests/test-app/src/pages/test-return-type.tsx +41 -0
  148. package/tests/test-app/src/pages/test-type-assertion.tsx +37 -0
  149. package/tests/test-app/src/pages/testPage.css +3 -0
  150. package/tests/test-app/src/pages/testPage.tsx +158 -0
  151. package/tests/test-app/src/pages/ui/styleSelectorPage.tsx +1554 -0
  152. package/tests/test-app/src/pages/user-list.tsx +212 -0
  153. package/tests/test-app/src/pages/web_version/website.css +205 -0
  154. package/tests/test-app/src/pages/web_version/website.tsx +1066 -0
  155. package/tests/test-app/src/pages/wrong-page.tsx +50 -0
  156. package/tests/test-app/src/pages//345/276/205/345/212/236.apidoc.json +336 -0
  157. package/tests/test-app/src/project.json +1120 -0
  158. package/tests/test-app/src/store/global.store.ts +10 -0
  159. package/tests/test-app/src/types/CreateTicketParams.m.ts +20 -0
  160. package/tests/test-app/src/types/SLAPolicy.ts +50 -0
  161. package/tests/test-app/src/types/Ticket.ts +68 -0
  162. package/tests/test-app/src/types/TicketAttachment.m.ts +67 -0
  163. package/tests/test-app/src/types/TicketComment.m.ts +59 -0
  164. package/tests/test-app/src/types/TicketEvaluation.ts +44 -0
  165. package/tests/test-app/src/types/TicketHistory.m.ts +71 -0
  166. package/tests/test-app/src/types/TicketListParams.m.ts +30 -0
  167. package/tests/test-app/src/types/TicketPriority.m.ts +65 -0
  168. package/tests/test-app/src/types/TicketRecord.ts +47 -0
  169. package/tests/test-app/src/types/TrainDoor.ts +284 -0
  170. package/tests/test-app/src/types/UpdateTicketParams.m.ts +22 -0
  171. package/tests/test-app/src/utils/__afterRequest.util.ts +3 -0
  172. package/tests/test-app/src/utils/__beforeRequest.util.ts +10 -0
  173. package/tests/test-app/src/utils/testGlobalAction.util.ts +7 -0
@@ -0,0 +1,523 @@
1
+ /**
2
+ * 角色权限管理
3
+ * 管理系统角色和权限配置
4
+ *
5
+ * @type Page
6
+ * @route /rolesabc
7
+ * @screen 1920w
8
+ * @frames web
9
+ */
10
+ import React from 'react';
11
+
12
+
13
+
14
+ class IProps {
15
+ systemId?: number;
16
+ }
17
+
18
+ /*
19
+ * 数据与接口请求定义
20
+ */
21
+ class IState {
22
+ roles?: {
23
+ /* @example 1 */id?: number,
24
+ /* @example 超级管理员 */name?: string,
25
+ /* @example SUPER_ADMIN */code?: string,
26
+ /* @example 拥有所有权限 */description?: string,
27
+ /* @example 3 */userCount?: number,
28
+ /* @example active */status?: string,
29
+ /* @example 2024-01-15 */createTime?: string,
30
+ }[];
31
+ permissions?: {
32
+ /* @example 1 */id?: number,
33
+ /* @example 用户管理 */name?: string,
34
+ /* @example user:manage */key?: string,
35
+ /* @example 系统管理 */category?: string,
36
+ }[];
37
+ loading?: boolean;
38
+ searchKeyword?: string;
39
+ selectedRole?: any;
40
+ showAddModal?: boolean;
41
+ showEditModal?: boolean;
42
+ showPermissionDrawer?: boolean;
43
+ @Form({
44
+ setter: "JsonSetter"
45
+ })
46
+ currentPermissions?: string[];
47
+ formData?: {
48
+ name?: string,
49
+ description?: string,
50
+ code?: string,
51
+ };
52
+ }
53
+
54
+ class Document extends React.Component<IProps, IState> {
55
+ state = {
56
+ roles: [
57
+ {
58
+ id: 1,
59
+ name: '超级管理员',
60
+ code: 'SUPER_ADMIN',
61
+ description: '拥有所有权限',
62
+ userCount: 3,
63
+ status: 'active',
64
+ createTime: '2024-01-15',
65
+ },
66
+ {
67
+ id: 2,
68
+ name: '管理员',
69
+ code: 'ADMIN',
70
+ description: '管理系统大部分功能',
71
+ userCount: 8,
72
+ status: 'active',
73
+ createTime: '2024-02-20',
74
+ },
75
+ {
76
+ id: 3,
77
+ name: '编辑',
78
+ code: 'EDITOR',
79
+ description: '内容编辑权限',
80
+ userCount: 15,
81
+ status: 'active',
82
+ createTime: '2024-03-10',
83
+ },
84
+ {
85
+ id: 4,
86
+ name: '审核员',
87
+ code: 'VIEWER',
88
+ description: '内容审核权限',
89
+ userCount: 5,
90
+ status: 'active',
91
+ createTime: '2024-04-05',
92
+ },
93
+ {
94
+ id: 5,
95
+ name: '访客',
96
+ code: 'GUEST',
97
+ description: '只读权限',
98
+ userCount: 45,
99
+ status: 'active',
100
+ createTime: '2024-05-12',
101
+ },
102
+ ],
103
+ permissions: [
104
+ { id: 1, name: '用户管理', key: 'user:manage', category: '系统管理' },
105
+ { id: 2, name: '角色管理', key: 'role:manage', category: '系统管理' },
106
+ {
107
+ id: 3,
108
+ name: '权限管理',
109
+ key: 'permission:manage',
110
+ category: '系统管理',
111
+ },
112
+ { id: 4, name: '内容编辑', key: 'content:edit', category: '内容管理' },
113
+ { id: 5, name: '内容发布', key: 'content:publish', category: '内容管理' },
114
+ { id: 6, name: '内容审核', key: 'content:review', category: '内容管理' },
115
+ { id: 7, name: '数据导出', key: 'data:export', category: '数据管理' },
116
+ { id: 8, name: '报表查看', key: 'report:view', category: '数据管理' },
117
+ ],
118
+ loading: false,
119
+ searchKeyword: '',
120
+ selectedRole: null,
121
+ showAddModal: false,
122
+ showEditModal: false,
123
+ showPermissionDrawer: false,
124
+ currentPermissions: [],
125
+ formData: { name: '', description: '', code: '' },
126
+ };
127
+
128
+ handleSearch(keyword) {
129
+ this.setState({
130
+ searchKeyword: keyword,
131
+ });
132
+ }
133
+
134
+ getRoleById(id) {
135
+ return this.state.roles.find(role => role.id === id);
136
+ }
137
+
138
+ getPermissionKeys(roleId) {
139
+ const role = this.state.roles.find(r => r.id === roleId);
140
+ return role?.permissions || [];
141
+ }
142
+
143
+ getStatusTag(status) {
144
+ if (status === 'active') {
145
+ return <Tag color="green">启用</Tag>;
146
+ }
147
+ return <Tag color="red">禁用</Tag>;
148
+ }
149
+
150
+ handleAddRole() {
151
+ this.setState({
152
+ showAddModal: true,
153
+ formData: {
154
+ name: '',
155
+ description: '',
156
+ code: '',
157
+ },
158
+ });
159
+ }
160
+
161
+ buildPermissionTree(permissions) {
162
+ const categories = {};
163
+ permissions.forEach(p => {
164
+ if (!categories[p.category]) {
165
+ categories[p.category] = [];
166
+ }
167
+ categories[p.category].push({
168
+ title: p.name,
169
+ key: p.key,
170
+ isLeaf: true,
171
+ });
172
+ });
173
+ return Object.keys(categories).map(category => ({
174
+ title: category,
175
+ key: category,
176
+ children: categories[category],
177
+ }));
178
+ }
179
+
180
+ async handleSubmit(type) {
181
+ await new Promise(resolve => setTimeout(resolve, 500));
182
+ if (type === 'add') {
183
+ console.log('添加角色:', this.state.formData);
184
+ } else {
185
+ console.log('编辑角色:', this.state.formData);
186
+ }
187
+ this.setState({
188
+ showAddModal: false,
189
+ showEditModal: false,
190
+ });
191
+ }
192
+
193
+ handleEditRole(role) {
194
+ this.setState({
195
+ selectedRole: role,
196
+ formData: {
197
+ ...role,
198
+ },
199
+ showEditModal: true,
200
+ });
201
+ }
202
+
203
+ handleDeleteRole(id) {
204
+ const confirm = window.confirm('确定要删除这个角色吗?');
205
+ if (confirm) {
206
+ console.log('删除角色:', id);
207
+ }
208
+ }
209
+
210
+ handleOpenPermissionDrawer(role) {
211
+ this.setState({
212
+ selectedRole: role,
213
+ showPermissionDrawer: true,
214
+ currentPermissions: role?.permissions || [],
215
+ });
216
+ }
217
+
218
+ render() {
219
+ return (
220
+ <Page className="p-[24px] bg-[var(--gray-50)] min-h-screen">
221
+ <View className="mb-[24px]">
222
+ <Text className="text-2xl font-bold text-[#1f2937]">
223
+ 角色权限管理
224
+ </Text>
225
+ <Text className="text-[#6b7280] text-sm mt-[4px]">
226
+ 管理系统角色和权限配置
227
+ </Text>
228
+ </View>
229
+ <View className="mb-[24px] flex items-center justify-between">
230
+ <View className="gap-4 flex items-center">
231
+ <Input
232
+ placeholder="搜索角色名称/编码"
233
+ value={this.state.searchKeyword}
234
+ onChange={e => this.handleSearch(e.target.value)}
235
+ prefix="🔍"
236
+ className=""
237
+ />
238
+ </View>
239
+ <Button type="primary" onClick={() => this.handleAddRole()}>
240
+ + 新增角色
241
+ </Button>
242
+ </View>
243
+ <Table
244
+ loading={this.state.loading}
245
+ columns={[
246
+ { title: 'ID', dataIndex: 'id', key: 'id', width: 60 },
247
+ { title: '角色名称', dataIndex: 'name', key: 'name' },
248
+ {
249
+ title: '角色编码',
250
+ dataIndex: 'code',
251
+ key: 'code',
252
+ render: code => (
253
+ <Tag color="blue">
254
+ <Text>{code}</Text>
255
+ </Tag>
256
+ ),
257
+ },
258
+ { title: '描述', dataIndex: 'description', key: 'description' },
259
+ {
260
+ title: '用户数',
261
+ dataIndex: 'userCount',
262
+ key: 'userCount',
263
+ render: count => <Text>{count}人</Text>,
264
+ },
265
+ {
266
+ title: '状态',
267
+ dataIndex: 'status',
268
+ key: 'status',
269
+ render: function (status) {
270
+ return this.getStatusTag(status);
271
+ },
272
+ },
273
+ { title: '创建时间', dataIndex: 'createTime', key: 'createTime' },
274
+ {
275
+ title: '操作',
276
+ key: 'action',
277
+ render: (text, record) => (
278
+ <Space>
279
+ <Button
280
+ type="link"
281
+ onClick={() => this.handleEditRole(record)}
282
+ >
283
+ 编辑
284
+ </Button>
285
+ <Button
286
+ type="link"
287
+ onClick={() => this.handleOpenPermissionDrawer(record)}
288
+ >
289
+ 权限配置
290
+ </Button>
291
+ <Button
292
+ type="link"
293
+ danger={true}
294
+ onClick={() => this.handleDeleteRole(record.id)}
295
+ >
296
+ 删除
297
+ </Button>
298
+ </Space>
299
+ ),
300
+ },
301
+ ]}
302
+ dataSource={this.state.roles?.filter(function (role) {
303
+ return (
304
+ role?.name?.includes(this.state.searchKeyword) ||
305
+ role?.code?.includes(this.state.searchKeyword)
306
+ );
307
+ })}
308
+ rowKey="id"
309
+ pagination={{
310
+ pageSize: 10,
311
+ showTotal: function (total) {
312
+ return `共 ${total} 条`;
313
+ },
314
+ }}
315
+ />
316
+ <Modal
317
+ animate="pop"
318
+ visible={this.state.showAddModal}
319
+ renderView={() => (
320
+ <View className="bg-[#ffffff] w-[600px] h-[500px] p-[24px]">
321
+ <Text className="text-xl font-bold mb-[16px]">新增角色</Text>
322
+ <View className="space-y-4">
323
+ <View>
324
+ <Text className="block mb-[8px]">角色名称</Text>
325
+ <Input
326
+ value={this.state.formData.name}
327
+ onChange={e =>
328
+ this.setState({
329
+ formData: {
330
+ ...this.state.formData,
331
+ name: e.target.value,
332
+ },
333
+ })
334
+ }
335
+ placeholder="请输入角色名称"
336
+ />
337
+ </View>
338
+ <View>
339
+ <Text className="block mb-[8px]">角色编码</Text>
340
+ <Input
341
+ value={this.state.formData.code}
342
+ onChange={e =>
343
+ this.setState({
344
+ formData: {
345
+ ...this.state.formData,
346
+ code: e.target.value,
347
+ },
348
+ })
349
+ }
350
+ placeholder="请输入角色编码"
351
+ />
352
+ </View>
353
+ <View>
354
+ <Text className="block mb-[8px]">描述</Text>
355
+ <Input.TextArea
356
+ value={this.state.formData.description}
357
+ onChange={e =>
358
+ this.setState({
359
+ formData: {
360
+ ...this.state.formData,
361
+ description: e.target.value,
362
+ },
363
+ })
364
+ }
365
+ placeholder="请输入描述"
366
+ rows={4}
367
+ />
368
+ </View>
369
+ <View className="gap-2 flex justify-end mt-[24px]">
370
+ <Button
371
+ onClick={() =>
372
+ this.setState({
373
+ showAddModal: false,
374
+ })
375
+ }
376
+ >
377
+ 取消
378
+ </Button>
379
+ <Button
380
+ type="primary"
381
+ onClick={() => this.handleSubmit('add')}
382
+ >
383
+ 确认
384
+ </Button>
385
+ </View>
386
+ </View>
387
+ </View>
388
+ )}
389
+ maskClosable={true}
390
+ />
391
+ <Modal
392
+ animate="pop"
393
+ visible={this.state.showEditModal}
394
+ renderView={() => (
395
+ <View className="bg-[#ffffff] w-[600px] h-[500px] p-[24px]">
396
+ <Text className="text-xl font-bold mb-[16px]">
397
+ 编辑角色:{this.state.selectedRole?.name}
398
+ </Text>
399
+ <View className="space-y-4">
400
+ <View>
401
+ <Text className="block mb-[8px]">角色名称</Text>
402
+ <Input
403
+ value={this.state.formData.name}
404
+ onChange={e =>
405
+ this.setState({
406
+ formData: {
407
+ ...this.state.formData,
408
+ name: e.target.value,
409
+ },
410
+ })
411
+ }
412
+ placeholder="请输入角色名称"
413
+ />
414
+ </View>
415
+ <View>
416
+ <Text className="block mb-[8px]">角色编码</Text>
417
+ <Input
418
+ value={this.state.formData.code}
419
+ onChange={e =>
420
+ this.setState({
421
+ formData: {
422
+ ...this.state.formData,
423
+ code: e.target.value,
424
+ },
425
+ })
426
+ }
427
+ placeholder="请输入角色编码"
428
+ />
429
+ </View>
430
+ <View>
431
+ <Text className="block mb-[8px]">描述</Text>
432
+ <Input.TextArea
433
+ value={this.state.formData.description}
434
+ onChange={e =>
435
+ this.setState({
436
+ formData: {
437
+ ...this.state.formData,
438
+ description: e.target.value,
439
+ },
440
+ })
441
+ }
442
+ placeholder="请输入描述"
443
+ rows={4}
444
+ />
445
+ </View>
446
+ <View className="gap-2 flex justify-end mt-[24px]">
447
+ <Button
448
+ onClick={() =>
449
+ this.setState({
450
+ showEditModal: false,
451
+ })
452
+ }
453
+ >
454
+ 取消
455
+ </Button>
456
+ <Button
457
+ type="primary"
458
+ onClick={() => this.handleSubmit('edit')}
459
+ >
460
+ 确认
461
+ </Button>
462
+ </View>
463
+ </View>
464
+ </View>
465
+ )}
466
+ maskClosable={true}
467
+ />
468
+ <Drawer
469
+ title="权限配置"
470
+ placement="right"
471
+ width={600}
472
+ visible={this.state.showPermissionDrawer}
473
+ renderView={() => (
474
+ <View className="p-[24px]">
475
+ <Text className="font-bold mb-[16px]">
476
+ 角色:{this.state.selectedRole?.name}
477
+ </Text>
478
+ <Text className="text-[#6b7280] mb-[16px]">
479
+ 请选择该角色拥有的权限
480
+ </Text>
481
+ <Tree
482
+ checkable={true}
483
+ treeData={this.buildPermissionTree(this.state.permissions)}
484
+ checkedKeys={this.state.currentPermissions}
485
+ onCheck={keys =>
486
+ this.setState({
487
+ currentPermissions: keys,
488
+ })
489
+ }
490
+ />
491
+ <View className="gap-2 flex justify-end mt-[24px]">
492
+ <Button
493
+ onClick={() =>
494
+ this.setState({
495
+ showPermissionDrawer: false,
496
+ })
497
+ }
498
+ >
499
+ 取消
500
+ </Button>
501
+ <Button
502
+ type="primary"
503
+ onClick={() =>
504
+ console.log('保存权限:', this.state.currentPermissions)
505
+ }
506
+ >
507
+ 保存
508
+ </Button>
509
+ </View>
510
+ </View>
511
+ )}
512
+ onClose={() =>
513
+ this.setState({
514
+ showPermissionDrawer: false,
515
+ })
516
+ }
517
+ />
518
+ </Page>
519
+ );
520
+ }
521
+ }
522
+
523
+ export default Document;