master
zhengpengju 4 years ago
parent caaef6755d
commit 328ca6b401

@ -10,10 +10,18 @@
font-size: 16px;
}
.examinationrules{
:global {
.ant-pro-steps-form-step{
min-width: 960px;
}
.ant-space-align-center{
padding:24px;
display: block;
text-align: center;
.ant-space-item{
display: inline-block;
}
}
}
}

@ -11,10 +11,11 @@ import ProForm, {
ProFormDateRangePicker,
} from '@ant-design/pro-form';
import ProCard from '@ant-design/pro-card';
import { Button, Checkbox, Col, Divider, List, message, Radio, Row, Space, Typography } from 'antd';
import { Button, Checkbox, Col, Divider, List, Menu, message, Radio, Row, Space, Typography } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import ProDescriptions from '@ant-design/pro-descriptions';
import styles from './index.less'
import { MailOutlined, AppstoreOutlined } from '@ant-design/icons';
const waitTime = (time: number = 100) => {
return new Promise((resolve) => {
@ -74,7 +75,7 @@ export default () => {
placeholder="请输入名称"
// rules={[{ required: true }]}
// value="锦书"
disabled
// disabled
/>
<ProFormSelect
@ -112,53 +113,16 @@ export default () => {
return true;
}}
>
<Row>
<Col span={6} style={{paddingRight:24}}>
<ProCard
title="题号列表"
bordered
headStyle={{padding:24, border: '#d9d9d9 solid 1px'}}
>
<List
header={<div>. </div>}
footer={false}
bordered
dataSource={numbers}
renderItem={item => (
<List.Item>
<Typography.Text mark={item.id === '3' ? false : true}><span className="number">{item.id}</span></Typography.Text>
</List.Item>
)}
style={{background:'#ffffff', margin:'-25px -24px 0 -24px'}}
/>
<List
header={<div>. </div>}
footer={false}
bordered
dataSource={numbers}
renderItem={item => (
<List.Item>
<Typography.Text mark={item.id === '3' ? false : true}><span className="number">{item.id}</span></Typography.Text>
</List.Item>
)}
style={{background:'#ffffff', margin:'-1px -24px'}}
/>
<List
header={<div>. </div>}
footer={false}
bordered
dataSource={numbers}
renderItem={item => (
<List.Item>
<Typography.Text mark={item.id === '3' ? false : true}><span className="number">{item.id}</span></Typography.Text>
</List.Item>
)}
style={{background:'#ffffff', margin:'-1px -24px -24px -24px'}}
/>
</ProCard>
</Col>
<Col span={13} style={{background:'#ffffff', padding:0}}>
<div style={{margin:'0'}}>
<Typography style={{padding:24, fontSize: 24, textAlign: 'center'}}></Typography>
{/** 一旦录入另一项将禁用,清空组卷后可选另一项 */}
<Radio.Group value={1} onChange={()=>{}} style={{ marginBottom: 16 }}>
<Radio.Button value={1}></Radio.Button>
<Radio.Button value={2}></Radio.Button>
</Radio.Group>
<Divider style={{margin:'6px 0', opacity: 0.5}}/>
<Row>
<Col span={18} style={{background:'#ffffff', padding:0}}>
<ProCard
title="一. 单选题 共50分每题1分"
extra={false}
@ -203,24 +167,26 @@ export default () => {
</Radio.Group>
</Space>
</ProCard>
</Col>
<Col span={5} style={{paddingLeft:24}}>
</Col>
<Col span={6} style={{paddingLeft:24}}>
<div style={{background:'#ffffff', padding:24}}>
<Space direction="vertical" style={{width:'100%'}}>
<strong></strong>
<Typography>614</Typography>
<strong></strong>
<Typography> {} {} </Typography>
<Divider style={{margin:'6px 0', opacity: 0.5}}/>
<strong></strong>
<Typography>14/80</Typography>
<Space direction="vertical">
<Typography> {} {} </Typography>
<Typography> {} {} </Typography>
<Typography> {} {} </Typography>
</Space>
<Divider style={{margin:'6px 0', opacity: 0.5}}/>
<Button size="large" block></Button>
<Button size="large" block></Button>
<Button size="large" type="primary" block></Button>
<Button size="large" block></Button>
<Button size="large" type="primary" block></Button>
</Space>
</div>
</Col>
</Row>
</Col>
</Row>
</div>
</StepsForm.StepForm>
<StepsForm.StepForm
@ -232,18 +198,18 @@ export default () => {
onFinish={async () => {
console.log(formRef.current?.getFieldsValue());
// 跳转到指定路由
history.push('/registration/success');
history.push('/examinationrules/normal');
return true;
}}
>
<Row gutter={24}>
<Col lg={12} md={12} sm={24}>
<Col lg={12} md={12} sm={12} offset={8}>
<ProDescriptions
layout='horizontal'
column={1}
//actionRef={actionRef}
title="高级定义列表 request"
title="模拟考试"
request={async () => {
return Promise.resolve({
success: true,
@ -253,40 +219,16 @@ export default () => {
extra={false}
>
<ProDescriptions.Item dataIndex="id" hideInDescriptions />
<ProDescriptions.Item dataIndex="object" label="考试项目" valueType="text" />
<ProDescriptions.Item dataIndex="date" label="考试时间" valueType="text" />
<ProDescriptions.Item dataIndex="object" label="考试名称" valueType="text" />
<ProDescriptions.Item dataIndex="date" label="关联培训主题" valueType="text" />
<ProDescriptions.Item dataIndex="duration" label="考试时长" valueType="text" />
<ProDescriptions.Item dataIndex="grade" label="满分" valueType="text" />
<ProDescriptions.Item dataIndex="grade" label="考试信息" valueType="text" />
<ProDescriptions.Item dataIndex="through" label="通过标准" valueType="text" />
<ProDescriptions.Item dataIndex="learn" label="报名要求" valueType="text" />
<ProDescriptions.Item dataIndex="times" label="考试次数" valueType="text" />
</ProDescriptions>
</Col>
<Col lg={12} md={12} sm={24}>
<ProDescriptions
layout='horizontal'
column={1}
//actionRef={actionRef}
title="高级定义列表 request"
request={async () => {
return Promise.resolve({
success: true,
data: { id: '这是一段文本', object:'', date: '2020-07-30 08:00', duration:'', grade:100, through:'>60', learn: '>20 min', times: 2 },
});
}}
extra={false}
>
<ProDescriptions.Item dataIndex="id" hideInDescriptions />
<ProDescriptions.Item dataIndex="object" label="考试项目" valueType="text" />
<ProDescriptions.Item dataIndex="date" label="考试时间" valueType="text" />
<ProDescriptions.Item dataIndex="duration" label="考试时长" valueType="text" />
<ProDescriptions.Item dataIndex="grade" label="满分" valueType="text" />
<ProDescriptions.Item dataIndex="through" label="通过标准" valueType="text" />
<ProDescriptions.Item dataIndex="learn" label="报名要求" valueType="text" />
<ProDescriptions.Item dataIndex="times" label="考试次数" valueType="text" />
</ProDescriptions>
</Col>
</Col>
</Row>
</StepsForm.StepForm>
</StepsForm>

@ -4,7 +4,7 @@ export type Member = {
id: string;
};
export type BasicListItemDataType = {
export type CardListItemDataType = {
id: string;
owner: string;
title: string;

@ -1,246 +1,207 @@
import type { FC } from 'react';
import React, { useState } from 'react';
import { DownOutlined, PlusOutlined } from '@ant-design/icons';
import {
Avatar,
Button,
Card,
Col,
Dropdown,
Input,
List,
Menu,
Modal,
Progress,
Radio,
Row,
} from 'antd';
/** 资质考试 */
//import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons';
import { Switch, Button, Card, Col, List, Menu, Progress, Row, Typography, Space, Divider, Radio, Checkbox, Tag, Dropdown } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { useRequest } from 'umi';
import moment from 'moment';
import OperationModal from './components/OperationModal';
import { addFakeList, queryFakeList, removeFakeList, updateFakeList } from './service';
import type { BasicListItemDataType } from './data.d';
//import { useRequest } from 'umi';
//import { queryFakeList } from './service';
//import type { CardListItemDataType } from './data';
import styles from './style.less';
const RadioButton = Radio.Button;
const RadioGroup = Radio.Group;
const { Search } = Input;
const Info: FC<{
title: React.ReactNode;
value: React.ReactNode;
bordered?: boolean;
}> = ({ title, value, bordered }) => (
<div className={styles.headerInfo}>
<span>{title}</span>
<p>{value}</p>
{bordered && <em />}
</div>
);
const ListContent = ({
data: { owner, createdAt, percent, status },
}: {
data: BasicListItemDataType;
}) => (
<div className={styles.listContent}>
<div className={styles.listContentItem}>
<span>Owner</span>
<p>{owner}</p>
</div>
<div className={styles.listContentItem}>
<span></span>
<p>{moment(createdAt).format('YYYY-MM-DD HH:mm')}</p>
</div>
<div className={styles.listContentItem}>
<Progress percent={percent} status={status} strokeWidth={6} style={{ width: 180 }} />
</div>
</div>
);
export const BasicList: FC = () => {
const [done, setDone] = useState<boolean>(false);
const [visible, setVisible] = useState<boolean>(false);
const [current, setCurrent] = useState<Partial<BasicListItemDataType> | undefined>(undefined);
const {
data: listData,
loading,
mutate,
} = useRequest(() => {
return queryFakeList({
count: 50,
});
});
const { run: postRun } = useRequest(
(method, params) => {
if (method === 'remove') {
return removeFakeList(params);
}
if (method === 'update') {
return updateFakeList(params);
}
return addFakeList(params);
//import SubMenu from 'antd/lib/menu/SubMenu';
//import ProCard from '@ant-design/pro-card';
import ProList from '@ant-design/pro-list';
import { ReactText, useState } from 'react';
import { PlusOutlined, DeleteOutlined, DownloadOutlined, UploadOutlined, EditOutlined, EyeOutlined, EyeInvisibleOutlined, DownOutlined } from '@ant-design/icons';
//const { Paragraph } = Typography;
const QuestionBank = () => {
const [selectedRowsState, setSelectedRows] = useState<API.RuleListItem[]>([]);
const [expandedDescRowKeys, setExpandedDescRowKeys] = useState<readonly ReactText[]>([]); // 展开解析设置
const [addType, setAddType] = useState(0);
const numbers = [];
for(let i=0;i<50;i++){
numbers.push({id: `${i}`})
}
const dataSource = [
{
id: 1,
name: '下面哪个词语能体现未来思维?',
type: '单选',
options: [
{label: '井底之蛙', value: 'A'},
{label: '鼠目寸光', value: 'B'},
{label: '未雨绸缪', value: 'C'},
{label: '即时行乐', value: 'D'},
],
time: '2022/12/12',
tag: '生涯理论',
course: '特质因素理论',
answer:'C',
desc: '该成语意思是天还没有下雨,先把门窗绑牢。比喻事先做好准备工作。该成语意思是天还没有下雨,先把门窗绑牢。比喻事先做好准备工作。该成语意思是天还没有下雨,先把门窗绑牢。比喻事先做好准备工作。该成语意思是天还没有下雨,先把门窗绑牢。比喻事先做好准备工作。',
},
{
manual: true,
onSuccess: (result) => {
mutate(result);
},
id: 2,
name: 'Ant Design',
type: '多选',
image:
'https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg',
desc: '我是一条测试的描述',
},
);
const list = listData?.list || [];
const paginationProps = {
showSizeChanger: true,
showQuickJumper: true,
pageSize: 5,
total: list.length,
};
const showEditModal = (item: BasicListItemDataType) => {
setVisible(true);
setCurrent(item);
};
const deleteItem = (id: string) => {
postRun('remove', { id });
};
const editAndDelete = (key: string | number, currentItem: BasicListItemDataType) => {
if (key === 'edit') showEditModal(currentItem);
else if (key === 'delete') {
Modal.confirm({
title: '删除任务',
content: '确定删除该任务吗?',
okText: '确认',
cancelText: '取消',
onOk: () => deleteItem(currentItem.id),
});
}
};
const extraContent = (
<div className={styles.extraContent}>
<RadioGroup defaultValue="all">
<RadioButton value="all"></RadioButton>
<RadioButton value="progress"></RadioButton>
<RadioButton value="waiting"></RadioButton>
</RadioGroup>
<Search className={styles.extraContentSearch} placeholder="请输入" onSearch={() => ({})} />
</div>
);
const MoreBtn: React.FC<{
item: BasicListItemDataType;
}> = ({ item }) => (
<Dropdown
overlay={
<Menu onClick={({ key }) => editAndDelete(key, item)}>
<Menu.Item key="edit"> 1</Menu.Item>
<Menu.Item key="delete"></Menu.Item>
</Menu>
}
>
<a>
<DownOutlined />
</a>
</Dropdown>
);
const handleDone = () => {
setDone(false);
setVisible(false);
setCurrent({});
};
const handleSubmit = (values: BasicListItemDataType) => {
setDone(true);
const method = values?.id ? 'update' : 'add';
postRun(method, values);
};
{
id: 3,
name: '蚂蚁金服体验科技',
type: '判断',
image:
'https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg',
desc: '我是一条测试的描述',
},
{
id: 4,
name: 'TechUI',
type: '单选',
image:
'https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg',
desc: '我是一条测试的描述',
},
];
return (
<div>
<PageContainer>
<div className={styles.standardList}>
<Card bordered={false}>
<Row>
<Col sm={8} xs={24}>
<Info title="我的待办" value="8个任务" bordered />
</Col>
<Col sm={8} xs={24}>
<Info title="本周任务平均处理时间" value="32分钟" bordered />
</Col>
<Col sm={8} xs={24}>
<Info title="本周完成任务数" value="24个任务" />
</Col>
</Row>
</Card>
<Card
className={styles.listCard}
bordered={false}
title="基本列表"
style={{ marginTop: 24 }}
bodyStyle={{ padding: '0 32px 40px 32px' }}
extra={extraContent}
>
<List
size="large"
rowKey="id"
loading={loading}
pagination={paginationProps}
dataSource={list}
renderItem={(item) => (
<List.Item
actions={[
<a
key="edit"
onClick={(e) => {
e.preventDefault();
showEditModal(item);
}}
>
3
</a>,
<MoreBtn key="more" item={item} />,
]}
>
<List.Item.Meta
avatar={<Avatar src={item.logo} shape="square" size="large" />}
title={<a href={item.href}>{item.title}</a>}
description={item.subDescription}
/>
<ListContent data={item} />
</List.Item>
)}
/>
</Card>
</div>
</PageContainer>
<Button
type="dashed"
onClick={() => {
setVisible(true);
<PageContainer content={false} extraContent={false} className={styles.questionbank}>
<ProList<any>
itemLayout="vertical"
rowClassName='questionbank-list-item'
pagination={{
defaultPageSize: 10,
showSizeChanger: false,
}}
toolBarRender={() => {
const menu = (
<Menu onClick={(value)=>setAddType(value)}>
<Menu.Item key="1"></Menu.Item>
<Menu.Item key="2"></Menu.Item>
<Menu.Item key="3"></Menu.Item>
</Menu>
);
return [
<Dropdown overlay={menu}>
<Button>
<PlusOutlined /> <DownOutlined />
</Button>
</Dropdown>,
<Button key="remove" type="default" danger>
<DeleteOutlined />
</Button>,
<Button key="download" >
<DownloadOutlined />
</Button>,
<Button key="upload" >
<UploadOutlined />
</Button>,
];
}}
onRow={(record: any) => {
return {
onMouseEnter: () => {
console.log(record);
},
onClick: () => {
console.log(record);
},
};
}}
rowKey="id"
headerTitle={false}
tooltip={false}
dataSource={dataSource}
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
// grid={{ gutter: 16, column: 1 }}
showActions="always"
showExtra="always"
metas={{
title: {
dataIndex: 'name',
render: (text: React.ReactNode, record: T, index: number) => `1. ${text}`,
},
avatar: {
dataIndex: 'type',
valueType: 'text',
render: (text: React.ReactNode, record: T, index: number) => `[${record.type}]`,
},
description: {
dataIndex: 'options',
valueType: 'checkbox',
render: (text: React.ReactNode, record: T, index: number) => {
return (
<List
header={false}
footer={false}
bordered={false}
dataSource={record.options || []}
renderItem={item => (
<List.Item>
<Typography.Text mark={false}>{`${item?.value}. ${item?.label}`}</Typography.Text>
</List.Item>
)}
/>
);
},
},
subTitle: { },
content: {
render: (text: React.ReactNode, record: T, index: number) => {
return (
<Space direction="vertical" style={{border:'solid 1px #f0f0f0;',padding:10}}>
<Typography>{record.answer}</Typography>
<Typography>{record.desc}</Typography>
</Space>
);
},
},
actions: {
cardActionProps: 'extra',
render: (text: React.ReactNode, record: T, _index: number) => {
return(
<Row style={{padding:'10px 24px'}}>
<Col flex={1} style={{textAlign:'left'}}>
<Space direction="horizontal" size="large">
<Typography>{record.time}</Typography>
<Typography>{record.tag}</Typography>
<Typography>{record.course}</Typography>
</Space>
</Col>
<Col flex={1} style={{textAlign:'right'}}>
<Space direction="horizontal" size="middle">
<a href={record.html_url} target="_blank" rel="noopener noreferrer" key="link">
<EditOutlined />
</a>
<a href={record.html_url} target="_blank" rel="noopener noreferrer" key="warning">
<DeleteOutlined />
</a>
<a
key="view"
onClick={()=>{
setExpandedDescRowKeys([...expandedDescRowKeys, record.id]);
console.log('record id:', record.id);
console.log('expandedDescRowKeys', expandedDescRowKeys)
}}
>
<EyeOutlined /> <EyeInvisibleOutlined />
</a>
</Space>
</Col>
</Row>
)
}
},
}}
style={{ width: '100%', marginBottom: 8 }}
>
<PlusOutlined />
</Button>
<OperationModal
done={done}
visible={visible}
current={current}
onDone={handleDone}
onSubmit={handleSubmit}
/>
</div>
</PageContainer>
);
};
export default BasicList;
export default QuestionBank;

@ -1,50 +1,10 @@
import { request } from 'umi';
import type { BasicListItemDataType } from './data.d';
import type { CardListItemDataType } from './data.d';
type ParamsType = {
count?: number;
} & Partial<BasicListItemDataType>;
export async function queryFakeList(
params: ParamsType,
): Promise<{ data: { list: BasicListItemDataType[] } }> {
return request('/api/get_list', {
export async function queryFakeList(params: {
count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/api/card_fake_list', {
params,
});
}
export async function removeFakeList(
params: ParamsType,
): Promise<{ data: { list: BasicListItemDataType[] } }> {
return request('/api/post_fake_list', {
method: 'POST',
data: {
...params,
method: 'delete',
},
});
}
export async function addFakeList(
params: ParamsType,
): Promise<{ data: { list: BasicListItemDataType[] } }> {
return request('/api/post_fake_list', {
method: 'POST',
data: {
...params,
method: 'post',
},
});
}
export async function updateFakeList(
params: ParamsType,
): Promise<{ data: { list: BasicListItemDataType[] } }> {
return request('/api/post_fake_list', {
method: 'POST',
data: {
...params,
method: 'update',
},
});
}

@ -1,195 +1,23 @@
@import '~antd/es/style/themes/default.less';
@import './utils/utils.less';
.standardList {
.questionbank{
:global {
.ant-card-head {
border-bottom: none;
.ant-list-split.ant-list-something-after-last-item .ant-spin-container > .ant-list-items > .ant-list-item:last-child{
border: none;
}
.ant-card-head-title {
padding: 24px 0;
line-height: 32px;
.questionbank-list-item{
//background: #f0f0f0;
border: solid 1px #f0f0f0 !important;
margin: 15px 0;
}
.ant-card-extra {
padding: 24px 0;
.ant-list-vertical .ant-list-item-action{
padding: 0 !important;
margin: 0 -18px -12px -24px !important;
}
.ant-list-pagination {
margin-top: 24px;
text-align: right;
}
.ant-avatar-lg {
width: 48px;
height: 48px;
line-height: 48px;
}
}
.headerInfo {
position: relative;
text-align: center;
& > span {
display: inline-block;
margin-bottom: 4px;
color: @text-color-secondary;
font-size: @font-size-base;
line-height: 22px;
}
& > p {
margin: 0;
color: @heading-color;
font-size: 24px;
line-height: 32px;
}
& > em {
position: absolute;
top: 0;
right: 0;
width: 1px;
height: 56px;
background-color: @border-color-split;
}
}
.listContent {
font-size: 0;
.listContentItem {
.ant-list-item-action li{
padding: 10px 18px;
background: #f0f0f0;
display: inline-block;
margin-left: 40px;
color: @text-color-secondary;
font-size: @font-size-base;
vertical-align: middle;
> span {
line-height: 20px;
}
> p {
margin-top: 4px;
margin-bottom: 0;
line-height: 22px;
}
}
}
.extraContentSearch {
width: 272px;
margin-left: 16px;
}
}
@media screen and (max-width: @screen-xs) {
.standardList {
:global {
.ant-list-item-content {
display: block;
flex: none;
width: 100%;
}
.ant-list-item-action {
margin-left: 0;
}
}
.listContent {
margin-left: 0;
& > div {
margin-left: 0;
}
}
.listCard {
:global {
.ant-card-head-title {
overflow: visible;
}
}
}
}
}
@media screen and (max-width: @screen-sm) {
.standardList {
.extraContentSearch {
width: 100%;
margin-left: 0;
}
.headerInfo {
margin-bottom: 16px;
& > em {
display: none;
}
}
}
}
@media screen and (max-width: @screen-md) {
.standardList {
.listContent {
& > div {
display: block;
}
& > div:last-child {
top: 0;
width: 100%;
}
}
}
.listCard {
:global {
.ant-radio-group {
display: block;
margin-bottom: 8px;
}
}
}
}
@media screen and (max-width: @screen-lg) and (min-width: @screen-md) {
.standardList {
.listContent {
& > div {
display: block;
}
& > div:last-child {
top: 0;
width: 100%;
}
}
}
}
@media screen and (max-width: @screen-xl) {
.standardList {
.listContent {
& > div {
margin-left: 24px;
}
& > div:last-child {
top: 0;
}
}
}
}
@media screen and (max-width: 1400px) {
.standardList {
.listContent {
text-align: right;
& > div:last-child {
top: 0;
}
}
}
}
.standardListForm {
:global {
.ant-form-item {
margin-bottom: 12px;
&:last-child {
margin-bottom: 32px;
padding-top: 4px;
}
}
}
}
.formResult {
width: 100%;
[class^='title'] {
margin-bottom: 8px;
}
}

@ -1,10 +1,10 @@
import { PlusOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer } from 'antd';
import { Button, message, Input, Drawer, Row, Col, Space, Modal } from 'antd';
import React, { useState, useRef } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import type { ProColumns, ActionType } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import { ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
import { BetaSchemaForm, ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import ProDescriptions from '@ant-design/pro-descriptions';
import type { FormValueType } from './components/UpdateForm';
@ -31,12 +31,12 @@ const handleAdd = async (fields: TableListItem) => {
return false;
}
};
/**
*
*
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
try {
@ -53,12 +53,12 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
return false;
}
};
/**
*
*
* @param selectedRows
*/
const handleRemove = async (selectedRows: TableListItem[]) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;
@ -80,14 +80,12 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
const TableList: React.FC = () => {
/** 新建窗口的弹窗 */
const [createModalVisible, handleModalVisible] = useState<boolean>(false);
/** 分布更新窗口的弹窗 */
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
const [showDetail, setShowDetail] = useState<boolean>(false);
const actionRef = useRef<ActionType>();
const [currentRow, setCurrentRow] = useState<TableListItem>();
const [selectedRowsState, setSelectedRows] = useState<TableListItem[]>([]);
/** 国际化配置 */
const columns: ProColumns<TableListItem>[] = [
{
@ -112,7 +110,7 @@ const TableList: React.FC = () => {
title: '培训对象',
dataIndex: 'org_names',
sorter: false,
hideInForm: true,
hideInForm: false,
renderText: (val: string) => `${val}`,
},
{
@ -134,6 +132,7 @@ const TableList: React.FC = () => {
sorter: false,
dataIndex: 'total_course_hours',
valueType: 'text',
hideInForm: true,
renderText: (val: string) => `${val}小时`,
},
{
@ -229,33 +228,42 @@ const TableList: React.FC = () => {
<Button type="primary"></Button>
</FooterToolbar>
)}
<ModalForm
title="新建规则"
width="400px"
<Modal
title="新建培训"
//
width="60%"
visible={createModalVisible}
onVisibleChange={handleModalVisible}
onFinish={async (value) => {
const success = await handleAdd(value as TableListItem);
if (success) {
handleModalVisible(false);
if (actionRef.current) {
actionRef.current.reload();
}
}
destroyOnClose
onCancel={() => {
handleModalVisible(false);
}}
footer={null}
>
<ProFormText
rules={[
{
required: true,
message: '规则名称为必填项',
},
]}
width="md"
name="name"
<BetaSchemaForm<DataItem>
layout="horizontal"
layoutType="Form"
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values: any) => {
// 表单处理
console.log('columns:', columns);
console.log('values:', values);
}}
submitter={{
render: (props, doms) => (
<Row>
<Col span={12} offset={8}>
<Space>{doms}</Space>
</Col>
</Row>
),
}}
// action = ''
title="新建"
columns={columns}
/>
<ProFormTextArea width="md" name="desc" />
</ModalForm>
</Modal>
<UpdateForm
onSubmit={async (value) => {
const success = await handleUpdate(value, currentRow);

Loading…
Cancel
Save