|
|
@@ -1,11 +1,13 @@
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
-import { Table, Button, Modal, Form, Input, DatePicker, Space, Typography, message } from 'antd';
|
|
|
+import { Table, Button, Modal, Form, Input, DatePicker, Space, Typography, message, Select } from 'antd';
|
|
|
import { PlusOutlined, EditOutlined, DeleteOutlined, SearchOutlined } from '@ant-design/icons';
|
|
|
import { classroomDataClient } from '@/client/api';
|
|
|
import type { InferResponseType, InferRequestType } from 'hono/client';
|
|
|
import { App } from 'antd';
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
+const { Option } = Select;
|
|
|
+
|
|
|
const { Title } = Typography;
|
|
|
|
|
|
// 定义类型
|
|
|
@@ -89,9 +91,8 @@ export const ClassroomDataPage: React.FC = () => {
|
|
|
holdingCash: record.holdingCash || undefined,
|
|
|
price: record.price || undefined,
|
|
|
code: record.code || undefined,
|
|
|
- status: record.status || undefined,
|
|
|
+ status: record.status !== null ? record.status : undefined,
|
|
|
spare: record.spare || undefined,
|
|
|
- submitUser: record.submitUser || undefined,
|
|
|
});
|
|
|
setIsModalVisible(true);
|
|
|
};
|
|
|
@@ -194,11 +195,13 @@ export const ClassroomDataPage: React.FC = () => {
|
|
|
title: '状态',
|
|
|
dataIndex: 'status',
|
|
|
key: 'status',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '提交用户',
|
|
|
- dataIndex: 'submitUser',
|
|
|
- key: 'submitUser',
|
|
|
+ render: (status: number) => {
|
|
|
+ const statusMap = {
|
|
|
+ 0: '关闭',
|
|
|
+ 1: '开放'
|
|
|
+ };
|
|
|
+ return statusMap[status as keyof typeof statusMap] || '-';
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
@@ -259,7 +262,7 @@ export const ClassroomDataPage: React.FC = () => {
|
|
|
onChange={(p) => setPagination({ ...pagination, current: p.current || 1, pageSize: p.pageSize || 10 })}
|
|
|
bordered
|
|
|
scroll={{ x: 'max-content' }}
|
|
|
- headerCellStyle={{ backgroundColor: '#f9fafb' }}
|
|
|
+ className="ant-table-striped"
|
|
|
rowClassName={(record, index) => index % 2 === 0 ? 'bg-white' : 'bg-gray-50'}
|
|
|
rowKey="id"
|
|
|
/>
|
|
|
@@ -327,9 +330,12 @@ export const ClassroomDataPage: React.FC = () => {
|
|
|
<Form.Item
|
|
|
name="status"
|
|
|
label="状态"
|
|
|
- rules={[{ max: 255, message: '状态不能超过255个字符' }]}
|
|
|
+ rules={[{ required: true, message: '请选择状态' }]}
|
|
|
>
|
|
|
- <Input placeholder="请输入状态" />
|
|
|
+ <Select placeholder="请选择状态">
|
|
|
+ <Option value={0}>关闭</Option>
|
|
|
+ <Option value={1}>开放</Option>
|
|
|
+ </Select>
|
|
|
</Form.Item>
|
|
|
|
|
|
<Form.Item
|
|
|
@@ -339,14 +345,6 @@ export const ClassroomDataPage: React.FC = () => {
|
|
|
>
|
|
|
<Input placeholder="请输入备用信息" />
|
|
|
</Form.Item>
|
|
|
-
|
|
|
- <Form.Item
|
|
|
- name="submitUser"
|
|
|
- label="提交用户"
|
|
|
- rules={[{ max: 255, message: '提交用户不能超过255个字符' }]}
|
|
|
- >
|
|
|
- <Input placeholder="请输入提交用户" />
|
|
|
- </Form.Item>
|
|
|
</Form>
|
|
|
</Modal>
|
|
|
</div>
|