feat: 新增字典渲染组件释放业务层处理,新增small模式的表单格式
parent
7ec6df5540
commit
bd2c1ede98
@ -0,0 +1,24 @@
|
|||||||
|
import { isEnableEnum } from '@/enums/common';
|
||||||
|
import { Badge } from 'antd';
|
||||||
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
type IsEnableBoxProps = {
|
||||||
|
isEnable: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
const IsEnableBox: React.FC<IsEnableBoxProps> = (props) => {
|
||||||
|
const { isEnable } = props;
|
||||||
|
|
||||||
|
const currentItem = isEnableEnum[isEnable ? '1' : '0']
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||||
|
<Badge status={isEnable ? 'success' : 'default'}></Badge>
|
||||||
|
<span style={{color: currentItem.color, padding: 4 }}>
|
||||||
|
<FormattedMessage id={isEnable ? 'common.enable' : 'common.disable'} defaultMessage="$$$" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default IsEnableBox;
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* @Author: zhoux zhouxia@supervision.ltd
|
||||||
|
* @Date: 2023-11-14 17:03:13
|
||||||
|
* @LastEditors: zhoux zhouxia@supervision.ltd
|
||||||
|
* @LastEditTime: 2023-11-15 13:27:35
|
||||||
|
* @FilePath: \general-ai-platform-web\src\components\TablePaginationCard\index.tsx
|
||||||
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
|
*/
|
||||||
|
import { TableDropdown } from '@ant-design/pro-components';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export type TablePaginationCardProps = {
|
||||||
|
total: number;
|
||||||
|
pageSize: number;
|
||||||
|
current: number;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
|
onChange: Function
|
||||||
|
|
||||||
|
};
|
||||||
|
// 分页器
|
||||||
|
const TablePaginationCard: React.FC<TablePaginationCardProps> = (props) => {
|
||||||
|
const { total, pageSize, current, onChange } = props;
|
||||||
|
const totalPage = Math.ceil(total / pageSize);
|
||||||
|
|
||||||
|
const handleChange = (page: number, pageSize: number) => {
|
||||||
|
onChange(page, pageSize);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<span>
|
||||||
|
Total {total} items, {totalPage} pages
|
||||||
|
</span>
|
||||||
|
<TableDropdown
|
||||||
|
total={totalPage as number}
|
||||||
|
current={current}
|
||||||
|
pageSize={pageSize}
|
||||||
|
onClick={(e) => handleChange(e, pageSize)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TablePaginationCard;
|
@ -0,0 +1,9 @@
|
|||||||
|
// 是否启用
|
||||||
|
export const isEnableEnum = {
|
||||||
|
'0' : {
|
||||||
|
color: '#999999',
|
||||||
|
},
|
||||||
|
'1' : {
|
||||||
|
color: '#52C41A',
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue