diff --git a/src/pages/AppointmentManage/components/MeetingReservation.tsx b/src/pages/AppointmentManage/components/MeetingReservation.tsx index 00cd0bf..5b98474 100644 --- a/src/pages/AppointmentManage/components/MeetingReservation.tsx +++ b/src/pages/AppointmentManage/components/MeetingReservation.tsx @@ -1,16 +1,27 @@ import React, { useState } from 'react'; -import { Button, DatePicker, Form, Input, Modal, Select, Space, Spin } from 'antd'; +import { Button, DatePicker, DatePickerProps, Form, Input, Modal, Select, Space, Spin } from 'antd'; +import moment from 'moment' interface MeetingReservationProps { modalVisible: boolean; onCancel: () => void; } const layout = { - labelCol: { span: 5 }, - wrapperCol: { span: 17 }, + labelCol: { span: 7 }, + wrapperCol: { span: 14 }, }; const tailLayout = { - wrapperCol: { offset: 5, span: 17 }, + wrapperCol: { offset: 7, span: 14 }, +}; +const validateMessages = { + required: '请填写此项', +}; +const range = (start: number, end: number) => { + const result = []; + for (let i = start; i < end; i++) { + result.push(i); + } + return result; }; const MeetingReservation: React.FC = (props) => { @@ -23,6 +34,13 @@ const MeetingReservation: React.FC = (props) => { const onFinish = (values: any) => { console.log(values); }; + function disabledDate(current: any) { + return current && current < moment().startOf('day'); + } + const disabledDateTime = () => ({ + disabledHours: () => [...range(0, 7), ...range(19, 24)], + }); + const dateFormat: DatePickerProps['format'] = value => value.startOf('hour').format('YYYY-MM-DD HH:mm:ss'); return ( = (props) => { visible={modalVisible} onCancel={() => onCancel()} centered - width={'70%'} + width={600} footer={null} > -
+ - + - + - + - + - + - + diff --git a/src/pages/AppointmentManage/index.tsx b/src/pages/AppointmentManage/index.tsx index 1b7eb1c..4031d98 100644 --- a/src/pages/AppointmentManage/index.tsx +++ b/src/pages/AppointmentManage/index.tsx @@ -1,12 +1,15 @@ +import ProList from '@ant-design/pro-list'; import type { ActionType, ProColumns } from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table'; -import { Button, Card, Space } from 'antd'; -import React, { useEffect, useState } from 'react'; +import { Button, Card, Space, Tag } from 'antd'; +import React, { ReactText, useEffect, useState } from 'react'; import { useRef } from 'react'; import MeetingReservation from './components/MeetingReservation'; const orange_bg = { background: '#f59a23', color: '#0000ff' }; const green_bg = { background: '#4b7902' }; +const align_middle = { display: 'flex', alignItems: 'center' }; +const tag_size = { height: '20px', width: '20px' }; const data = { week: [ @@ -290,70 +293,84 @@ const data = { ] } -const columns: ProColumns[] = [ +const dataSource = [ { - title: '评标室名称', - dataIndex: 'name', - align: 'center', - render: (_, record, index) => { - return { - children: _, - props: { - rowSpan: index % 24 == 0 ? 24 : 0, - } - } - } + "id": "1", + "title": '集团第一评标室', + "rs": "10", }, { - title: '可容纳人数(人)', - dataIndex: 'rs', - align: 'center', - render: (_, record, index) => { - return { - children: _, - props: { - rowSpan: index % 24 == 0 ? 24 : 0, - } - } - } + "id": "2", + "title": '集团第二评标室', + "rs": "18", }, { - title: '场次', - align: 'center', - colSpan: 2, - render: (_, record, index) => { - return { - children: "00:00 ~ 24:00", - props: { - rowSpan: index % 24 == 0 ? 24 : 0, - } - } - } - }, - { - dataIndex: "time", - align: 'right', - width: '60px', - colSpan: 0, - }, - { - title: '预约时间', - dataIndex: "info_time", - valueType: 'date', - hideInTable: true, - }, -]; + "id": "3", + "title": '集团第三评标室', + "rs": "29", + } +] -export default () => { +const ScreenTable = (props: { tableData: any[], tabColumns: any[], record: any }) => { + const { tableData, tabColumns, record } = props; const actionRef = useRef(); //表格列 const [tableColumns, setTableColumns] = useState[]>([]); - //表格数据 - const [tableData, setTableData] = useState([]); - //预约弹窗 - const [modalVisible, setModalVisible] = useState(false); + const columns: ProColumns[] = [ + { + title: '评标室名称', + dataIndex: 'name', + align: 'center', + render: (_, record, index) => { + return { + children: _, + props: { + rowSpan: index % 24 == 0 ? 24 : 0, + } + } + } + }, + { + title: '可容纳人数(人)', + dataIndex: 'rs', + align: 'center', + render: (_, record, index) => { + return { + children: _, + props: { + rowSpan: index % 24 == 0 ? 24 : 0, + } + } + } + }, + { + title: '场次', + align: 'center', + colSpan: 2, + render: (_, record, index) => { + return { + children: "07:00 ~ 18:00", + props: { + rowSpan: index % 24 == 0 ? 24 : 0, + } + } + } + }, + { + dataIndex: "time", + align: 'right', + width: '60px', + colSpan: 0, + }, + { + title: '预约时间', + dataIndex: "info_time", + valueType: 'date', + hideInTable: true, + }, + ]; useEffect(() => { - for (const ite of data.week) { + for (const ite of tabColumns) { columns.push({ title: {ite.week}
{ite.date}
, dataIndex: ite.id, @@ -375,10 +392,17 @@ export default () => { }) } setTableColumns(columns); - setTableData(data.data); }, []); return ( - +
+ + + + columns={tableColumns} actionRef={actionRef} @@ -390,31 +414,49 @@ export default () => { pagination={false} options={false} dateFormatter="string" - toolbar={{ - title: ( - - - - - - ), - actions: [ - , - , - , - ], + /> +
+ ) +} + +export default () => { + //预约弹窗 + const [modalVisible, setModalVisible] = useState(false); + const [expandedRowKeys, setExpandedRowKeys] = useState([]); + + return ( + +
+ + + + + +
已预约
+
未预约
+
+
+ + rowKey="id" + expandable={{ + expandedRowKeys, onExpandedRowsChange: setExpandedRowKeys, + }} + dataSource={dataSource} + toolBarRender={false} + metas={{ + title: { + render: (_: any, record: any) => setExpandedRowKeys(keys => keys.includes(record.id) ? [] : [record.id])}>{record.title}, + }, + subTitle: { + render: (_: any, record: any) => `可容纳人数:${record.rs}人`, + }, + description: { + render: (_: any, record: any) => , + }, }} /> {modalVisible && setModalVisible(false)} />}