@appthen/cli 1.2.11 → 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/bin/main.js +47 -0
- package/dist/index.js +6165 -14980
- package/package.json +8 -1
- package/tests/test-app/.appthen/shadow-space-100001-test-app-e99876b1.json +1197 -741
- package/tests/test-app/.appthen/space-config.json +2 -2
- package/tests/test-app/src/components/MessageCenter.tsx +506 -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/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/TicketManagement.tsx +402 -0
- package/tests/test-app/src/pages/UserProfile.tsx +404 -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/article-list.tsx +222 -0
- package/tests/test-app/src/pages/babyProductRecommendationPage.tsx +168 -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/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/demo-error-page.tsx +119 -0
- package/tests/test-app/src/pages/department-list.tsx +183 -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/uiHandsOnPractice.tsx +1 -1
- 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/ui/styleSelectorPage.tsx +1554 -0
- package/tests/test-app/src/pages/user-list.tsx +212 -0
- package/tests/test-app/src/pages/wrong-page.tsx +50 -0
- package/tests/test-app/.appthen/shadow-space-unknown-user-test-app-e99876b1.json +0 -1060
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 演示错误页面
|
|
3
|
+
* @type Page
|
|
4
|
+
* @route /demo-error
|
|
5
|
+
* @screen 1920w
|
|
6
|
+
* @frames web
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IProps {
|
|
13
|
+
pageTitle?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* 数据与接口请求定义
|
|
18
|
+
*/
|
|
19
|
+
class IState {
|
|
20
|
+
userList?: string[];
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
selectedUser?: any;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class Document extends React.Component<IProps, IState> {
|
|
26
|
+
state = { userList: [], loading: false, selectedUser: null };
|
|
27
|
+
|
|
28
|
+
loadData() {
|
|
29
|
+
this.setState({
|
|
30
|
+
loading: true,
|
|
31
|
+
});
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
this.setState({
|
|
34
|
+
loading: false,
|
|
35
|
+
userList: [
|
|
36
|
+
{
|
|
37
|
+
id: 1,
|
|
38
|
+
name: '张三',
|
|
39
|
+
email: 'zhangsan@example.com',
|
|
40
|
+
age: 25,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 2,
|
|
44
|
+
name: '李四',
|
|
45
|
+
email: 'lisi@example.com',
|
|
46
|
+
age: 30,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 3,
|
|
50
|
+
name: '王五',
|
|
51
|
+
email: 'wangwu@example.com',
|
|
52
|
+
age: 28,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
}, 1000);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
selectUser(user) {
|
|
60
|
+
this.setState({
|
|
61
|
+
selectedUser: user,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
render() {
|
|
66
|
+
return (
|
|
67
|
+
<Page className="p-[24px]">
|
|
68
|
+
<Card title="用户管理">
|
|
69
|
+
<Space direction="vertical" className="w-full">
|
|
70
|
+
<Button type="primary" onClick={() => this.loadData()}>
|
|
71
|
+
加载数据
|
|
72
|
+
</Button>
|
|
73
|
+
{!!this.state.loading && <View>加载中...</View>}
|
|
74
|
+
<Table
|
|
75
|
+
columns={[
|
|
76
|
+
{
|
|
77
|
+
title: 'ID',
|
|
78
|
+
dataIndex: 'id',
|
|
79
|
+
render: id => <Text>#{id}</Text>,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
title: '姓名',
|
|
83
|
+
dataIndex: 'name',
|
|
84
|
+
render: name => <Text>{name}</Text>,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: '邮箱',
|
|
88
|
+
dataIndex: 'email',
|
|
89
|
+
render: email => <Text>{email}</Text>,
|
|
90
|
+
},
|
|
91
|
+
]}
|
|
92
|
+
dataSource={this.state.userList}
|
|
93
|
+
loading={this.state.loading}
|
|
94
|
+
/>
|
|
95
|
+
{this.state.userList.map((user, index) => (
|
|
96
|
+
<View key={user.id}>
|
|
97
|
+
<Text>{user.name}</Text>
|
|
98
|
+
<Text>{user.email}</Text>
|
|
99
|
+
<Text>{user.age}</Text>
|
|
100
|
+
<Button size="small" onClick={() => this.selectUser(user)}>
|
|
101
|
+
选择
|
|
102
|
+
</Button>
|
|
103
|
+
</View>
|
|
104
|
+
))}
|
|
105
|
+
{!!this.state.selectedUser && (
|
|
106
|
+
<Card title="已选用户">
|
|
107
|
+
<p>姓名:{this.state.selectedUser.name}</p>
|
|
108
|
+
<p>邮箱:{this.state.selectedUser.email}</p>
|
|
109
|
+
<p>年龄:{this.state.selectedUser.age}</p>
|
|
110
|
+
</Card>
|
|
111
|
+
)}
|
|
112
|
+
</Space>
|
|
113
|
+
</Card>
|
|
114
|
+
</Page>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default Document;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 部门列表
|
|
3
|
+
* 查看和管理所有部门信息
|
|
4
|
+
*
|
|
5
|
+
* @type Page
|
|
6
|
+
* @route /departments
|
|
7
|
+
* @screen 1920w
|
|
8
|
+
* @frames web
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class IProps {}
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* 数据与接口请求定义
|
|
18
|
+
*/
|
|
19
|
+
class IState {
|
|
20
|
+
departments?: {
|
|
21
|
+
/* @example 1 */id?: number,
|
|
22
|
+
/* @example 技术部 */name?: string,
|
|
23
|
+
/* @example 张三 */manager?: string,
|
|
24
|
+
/* @example 25 */memberCount?: number,
|
|
25
|
+
/* @example enabled */status?: string,
|
|
26
|
+
/* @example 2024-01-15 */createTime?: string,
|
|
27
|
+
}[];
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
searchKeyword?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
class Document extends React.Component<IProps, IState> {
|
|
33
|
+
state = {
|
|
34
|
+
departments: [
|
|
35
|
+
{
|
|
36
|
+
id: 1,
|
|
37
|
+
name: '技术部',
|
|
38
|
+
manager: '张三',
|
|
39
|
+
memberCount: 25,
|
|
40
|
+
status: 'enabled',
|
|
41
|
+
createTime: '2024-01-15',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 2,
|
|
45
|
+
name: '市场部',
|
|
46
|
+
manager: '李四',
|
|
47
|
+
memberCount: 18,
|
|
48
|
+
status: 'enabled',
|
|
49
|
+
createTime: '2024-02-20',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 3,
|
|
53
|
+
name: '人事部',
|
|
54
|
+
manager: '王五',
|
|
55
|
+
memberCount: 8,
|
|
56
|
+
status: 'enabled',
|
|
57
|
+
createTime: '2024-03-10',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 4,
|
|
61
|
+
name: '财务部',
|
|
62
|
+
manager: '赵六',
|
|
63
|
+
memberCount: 12,
|
|
64
|
+
status: 'enabled',
|
|
65
|
+
createTime: '2024-04-05',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 5,
|
|
69
|
+
name: '运营部',
|
|
70
|
+
manager: '钱七',
|
|
71
|
+
memberCount: 15,
|
|
72
|
+
status: 'enabled',
|
|
73
|
+
createTime: '2024-05-12',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
loading: false,
|
|
77
|
+
searchKeyword: '',
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
handleSearch(value) {
|
|
81
|
+
this.setState({
|
|
82
|
+
searchKeyword: value,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
handleAdd() {
|
|
87
|
+
console.log('添加部门');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
handleEdit(record) {
|
|
91
|
+
console.log('编辑部门', record);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
handleDelete(record) {
|
|
95
|
+
console.log('删除部门', record);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
getStatusTag(status) {
|
|
99
|
+
if (status === 'enabled') {
|
|
100
|
+
return <Tag color="green">启用</Tag>;
|
|
101
|
+
}
|
|
102
|
+
return <Tag color="gray">禁用</Tag>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
render() {
|
|
106
|
+
return (
|
|
107
|
+
<Page className="p-[24px] bg-[var(--gray-50)] min-h-screen">
|
|
108
|
+
<View className="mb-[24px]">
|
|
109
|
+
<h1 className="text-2xl font-bold text-[#1f2937]">部门列表</h1>
|
|
110
|
+
<p className="text-[#6b7280] text-sm mt-[4px]">
|
|
111
|
+
管理系统中的所有部门
|
|
112
|
+
</p>
|
|
113
|
+
</View>
|
|
114
|
+
<Card className="mb-[24px]">
|
|
115
|
+
<View className="flex items-center justify-between">
|
|
116
|
+
<Input
|
|
117
|
+
placeholder="搜索部门名称"
|
|
118
|
+
value={this.state.searchKeyword}
|
|
119
|
+
onChange={e => this.handleSearch(e.target.value)}
|
|
120
|
+
prefix="🔍"
|
|
121
|
+
className=""
|
|
122
|
+
/>
|
|
123
|
+
<Button type="primary" onClick={() => this.handleAdd()}>
|
|
124
|
+
+ 新增部门
|
|
125
|
+
</Button>
|
|
126
|
+
</View>
|
|
127
|
+
</Card>
|
|
128
|
+
<Card>
|
|
129
|
+
<Table
|
|
130
|
+
loading={this.state.loading}
|
|
131
|
+
columns={[
|
|
132
|
+
{ title: 'ID', dataIndex: 'id', key: 'id', width: 80 },
|
|
133
|
+
{ title: '部门名称', dataIndex: 'name', key: 'name' },
|
|
134
|
+
{ title: '部门经理', dataIndex: 'manager', key: 'manager' },
|
|
135
|
+
{
|
|
136
|
+
title: '成员数量',
|
|
137
|
+
dataIndex: 'memberCount',
|
|
138
|
+
key: 'memberCount',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
title: '状态',
|
|
142
|
+
dataIndex: 'status',
|
|
143
|
+
key: 'status',
|
|
144
|
+
render: function (text) {
|
|
145
|
+
return this.getStatusTag(text);
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime' },
|
|
149
|
+
{
|
|
150
|
+
title: '操作',
|
|
151
|
+
key: 'action',
|
|
152
|
+
render: (text, record) => (
|
|
153
|
+
<Space>
|
|
154
|
+
<Button type="link" onClick={() => this.handleEdit(record)}>
|
|
155
|
+
编辑
|
|
156
|
+
</Button>
|
|
157
|
+
<Button
|
|
158
|
+
type="link"
|
|
159
|
+
danger={true}
|
|
160
|
+
onClick={() => this.handleDelete(record)}
|
|
161
|
+
>
|
|
162
|
+
删除
|
|
163
|
+
</Button>
|
|
164
|
+
</Space>
|
|
165
|
+
),
|
|
166
|
+
},
|
|
167
|
+
]}
|
|
168
|
+
dataSource={this.state.departments}
|
|
169
|
+
rowKey="id"
|
|
170
|
+
pagination={{
|
|
171
|
+
pageSize: 10,
|
|
172
|
+
showTotal: function (total) {
|
|
173
|
+
return `共 ${total} 条`;
|
|
174
|
+
},
|
|
175
|
+
}}
|
|
176
|
+
/>
|
|
177
|
+
</Card>
|
|
178
|
+
</Page>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export default Document;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 商品列表
|
|
3
|
+
* 查看和管理所有商品信息
|
|
4
|
+
*
|
|
5
|
+
* @type Page
|
|
6
|
+
* @route /goods
|
|
7
|
+
* @screen 1920w
|
|
8
|
+
* @frames web
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class IProps {}
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* 数据与接口请求定义
|
|
18
|
+
*/
|
|
19
|
+
class IState {
|
|
20
|
+
goods?: {
|
|
21
|
+
/* @example 1 */id?: number,
|
|
22
|
+
/* @example iPhone 15 Pro */name?: string,
|
|
23
|
+
/* @example 手机 */category?: string,
|
|
24
|
+
/* @example 8999 */price?: number,
|
|
25
|
+
/* @example 100 */stock?: number,
|
|
26
|
+
/* @example onsale */status?: string,
|
|
27
|
+
/* @example 2024-01-15 */createTime?: string,
|
|
28
|
+
}[];
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
searchKeyword?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class Document extends React.Component<IProps, IState> {
|
|
34
|
+
state = {
|
|
35
|
+
goods: [
|
|
36
|
+
{
|
|
37
|
+
id: 1,
|
|
38
|
+
name: 'iPhone 15 Pro',
|
|
39
|
+
category: '手机',
|
|
40
|
+
price: 8999,
|
|
41
|
+
stock: 100,
|
|
42
|
+
status: 'onsale',
|
|
43
|
+
createTime: '2024-01-15',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 2,
|
|
47
|
+
name: 'MacBook Air M2',
|
|
48
|
+
category: '电脑',
|
|
49
|
+
price: 7999,
|
|
50
|
+
stock: 50,
|
|
51
|
+
status: 'onsale',
|
|
52
|
+
createTime: '2024-02-20',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 3,
|
|
56
|
+
name: 'AirPods Pro',
|
|
57
|
+
category: '耳机',
|
|
58
|
+
price: 1999,
|
|
59
|
+
stock: 200,
|
|
60
|
+
status: 'onsale',
|
|
61
|
+
createTime: '2024-03-10',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 4,
|
|
65
|
+
name: 'iPad Air',
|
|
66
|
+
category: '平板',
|
|
67
|
+
price: 4799,
|
|
68
|
+
stock: 0,
|
|
69
|
+
status: 'outofstock',
|
|
70
|
+
createTime: '2024-04-05',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 5,
|
|
74
|
+
name: 'Apple Watch',
|
|
75
|
+
category: '手表',
|
|
76
|
+
price: 2999,
|
|
77
|
+
stock: 80,
|
|
78
|
+
status: 'onsale',
|
|
79
|
+
createTime: '2024-05-12',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
loading: false,
|
|
83
|
+
searchKeyword: '',
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
handleSearch(value) {
|
|
87
|
+
this.setState({
|
|
88
|
+
searchKeyword: value,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
handleAdd() {
|
|
93
|
+
console.log('添加商品');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
handleEdit(record) {
|
|
97
|
+
console.log('编辑商品', record);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
handleDelete(record) {
|
|
101
|
+
console.log('删除商品', record);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
getStatusTag(status) {
|
|
105
|
+
if (status === 'onsale') {
|
|
106
|
+
return <Tag color="green">在售</Tag>;
|
|
107
|
+
}
|
|
108
|
+
if (status === 'outofstock') {
|
|
109
|
+
return <Tag color="red">缺货</Tag>;
|
|
110
|
+
}
|
|
111
|
+
return <Tag color="gray">下架</Tag>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
getCategoryTag(category) {
|
|
115
|
+
const config = {
|
|
116
|
+
手机: {
|
|
117
|
+
text: '手机',
|
|
118
|
+
color: 'blue',
|
|
119
|
+
},
|
|
120
|
+
电脑: {
|
|
121
|
+
text: '电脑',
|
|
122
|
+
color: 'purple',
|
|
123
|
+
},
|
|
124
|
+
耳机: {
|
|
125
|
+
text: '耳机',
|
|
126
|
+
color: 'cyan',
|
|
127
|
+
},
|
|
128
|
+
平板: {
|
|
129
|
+
text: '平板',
|
|
130
|
+
color: 'orange',
|
|
131
|
+
},
|
|
132
|
+
手表: {
|
|
133
|
+
text: '手表',
|
|
134
|
+
color: 'green',
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
const configItem = config[category] || {
|
|
138
|
+
text: category,
|
|
139
|
+
color: 'default',
|
|
140
|
+
};
|
|
141
|
+
return <Tag color={configItem.color}>{configItem.text}</Tag>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
render() {
|
|
145
|
+
return (
|
|
146
|
+
<Page className="p-[24px] bg-[var(--gray-50)] min-h-screen">
|
|
147
|
+
<View className="mb-[24px]">
|
|
148
|
+
<h1 className="text-2xl font-bold text-[#1f2937]">商品列表</h1>
|
|
149
|
+
<p className="text-[#6b7280] text-sm mt-[4px]">
|
|
150
|
+
管理系统中的所有商品
|
|
151
|
+
</p>
|
|
152
|
+
</View>
|
|
153
|
+
<Card className="mb-[24px]">
|
|
154
|
+
<View className="flex items-center justify-between">
|
|
155
|
+
<Input
|
|
156
|
+
placeholder="搜索商品名称/分类"
|
|
157
|
+
value={this.state.searchKeyword}
|
|
158
|
+
onChange={e => this.handleSearch(e.target.value)}
|
|
159
|
+
prefix="🔍"
|
|
160
|
+
className=""
|
|
161
|
+
/>
|
|
162
|
+
<Button type="primary" onClick={() => this.handleAdd()}>
|
|
163
|
+
+ 新增商品
|
|
164
|
+
</Button>
|
|
165
|
+
</View>
|
|
166
|
+
</Card>
|
|
167
|
+
<Card>
|
|
168
|
+
<Table
|
|
169
|
+
loading={this.state.loading}
|
|
170
|
+
columns={[
|
|
171
|
+
{ title: 'ID', dataIndex: 'id', key: 'id', width: 80 },
|
|
172
|
+
{ title: '商品名称', dataIndex: 'name', key: 'name' },
|
|
173
|
+
{
|
|
174
|
+
title: '分类',
|
|
175
|
+
dataIndex: 'category',
|
|
176
|
+
key: 'category',
|
|
177
|
+
render: function (text) {
|
|
178
|
+
return this.getCategoryTag(text);
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
title: '价格',
|
|
183
|
+
dataIndex: 'price',
|
|
184
|
+
key: 'price',
|
|
185
|
+
render: function (text) {
|
|
186
|
+
return `¥${text}`;
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{ title: '库存', dataIndex: 'stock', key: 'stock' },
|
|
190
|
+
{
|
|
191
|
+
title: '状态',
|
|
192
|
+
dataIndex: 'status',
|
|
193
|
+
key: 'status',
|
|
194
|
+
render: function (text) {
|
|
195
|
+
return this.getStatusTag(text);
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime' },
|
|
199
|
+
{
|
|
200
|
+
title: '操作',
|
|
201
|
+
key: 'action',
|
|
202
|
+
render: (text, record) => (
|
|
203
|
+
<Space>
|
|
204
|
+
<Button type="link" onClick={() => this.handleEdit(record)}>
|
|
205
|
+
编辑
|
|
206
|
+
</Button>
|
|
207
|
+
<Button
|
|
208
|
+
type="link"
|
|
209
|
+
danger={true}
|
|
210
|
+
onClick={() => this.handleDelete(record)}
|
|
211
|
+
>
|
|
212
|
+
删除
|
|
213
|
+
</Button>
|
|
214
|
+
</Space>
|
|
215
|
+
),
|
|
216
|
+
},
|
|
217
|
+
]}
|
|
218
|
+
dataSource={this.state.goods}
|
|
219
|
+
rowKey="id"
|
|
220
|
+
pagination={{
|
|
221
|
+
pageSize: 10,
|
|
222
|
+
showTotal: function (total) {
|
|
223
|
+
return `共 ${total} 条`;
|
|
224
|
+
},
|
|
225
|
+
}}
|
|
226
|
+
/>
|
|
227
|
+
</Card>
|
|
228
|
+
</Page>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export default Document;
|