mirror of
https://github.com/whyour/qinglong.git
synced 2025-12-14 16:05:39 +08:00
fix scenario style
This commit is contained in:
parent
a691951f6d
commit
81f6f84891
|
|
@ -1,12 +1,10 @@
|
||||||
.scenario-page {
|
.scenario-page {
|
||||||
background: white;
|
background: white;
|
||||||
padding: 16px;
|
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scenario-toolbar {
|
.scenario-toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,14 @@ import { Scenario, WorkflowGraph } from './type';
|
||||||
import ScenarioModal from './modal';
|
import ScenarioModal from './modal';
|
||||||
import WorkflowEditorModal from './workflowEditorModal';
|
import WorkflowEditorModal from './workflowEditorModal';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
import { useOutletContext } from '@umijs/max';
|
||||||
|
import { SharedContext } from '@/layouts';
|
||||||
|
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
const ScenarioPage: React.FC = () => {
|
const ScenarioPage: React.FC = () => {
|
||||||
|
const { headerStyle } = useOutletContext<SharedContext>();
|
||||||
const [scenarios, setScenarios] = useState<Scenario[]>([]);
|
const [scenarios, setScenarios] = useState<Scenario[]>([]);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
|
|
@ -218,9 +221,9 @@ const ScenarioPage: React.FC = () => {
|
||||||
title: intl.get('状态'),
|
title: intl.get('状态'),
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
key: 'status',
|
key: 'status',
|
||||||
width: 100,
|
width: 120,
|
||||||
render: (status: number) => (
|
render: (status: number) => (
|
||||||
<Tag color={status === 1 ? 'success' : 'default'}>
|
<Tag color={status === 1 ? 'success' : 'error'}>
|
||||||
{status === 1 ? intl.get('已启用') : intl.get('已禁用')}
|
{status === 1 ? intl.get('已启用') : intl.get('已禁用')}
|
||||||
</Tag>
|
</Tag>
|
||||||
),
|
),
|
||||||
|
|
@ -229,7 +232,7 @@ const ScenarioPage: React.FC = () => {
|
||||||
title: intl.get('工作流'),
|
title: intl.get('工作流'),
|
||||||
dataIndex: 'workflowGraph',
|
dataIndex: 'workflowGraph',
|
||||||
key: 'workflowGraph',
|
key: 'workflowGraph',
|
||||||
width: 120,
|
width: 150,
|
||||||
render: (graph: WorkflowGraph) => (
|
render: (graph: WorkflowGraph) => (
|
||||||
<Text type="secondary">
|
<Text type="secondary">
|
||||||
{graph?.nodes?.length || 0} {intl.get('节点')}
|
{graph?.nodes?.length || 0} {intl.get('节点')}
|
||||||
|
|
@ -240,14 +243,14 @@ const ScenarioPage: React.FC = () => {
|
||||||
title: intl.get('创建时间'),
|
title: intl.get('创建时间'),
|
||||||
dataIndex: 'createdAt',
|
dataIndex: 'createdAt',
|
||||||
key: 'createdAt',
|
key: 'createdAt',
|
||||||
width: 180,
|
width: 200,
|
||||||
render: (date: string) =>
|
render: (date: string) =>
|
||||||
date ? new Date(date).toLocaleString() : '-',
|
date ? new Date(date).toLocaleString() : '-',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: intl.get('操作'),
|
title: intl.get('操作'),
|
||||||
key: 'action',
|
key: 'action',
|
||||||
width: 180,
|
width: 200,
|
||||||
render: (_: any, record: Scenario) => (
|
render: (_: any, record: Scenario) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Button
|
<Button
|
||||||
|
|
@ -273,48 +276,12 @@ const ScenarioPage: React.FC = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer
|
<PageContainer
|
||||||
|
className="ql-container-wrapper scenario-wrapper"
|
||||||
|
title={intl.get('场景管理')}
|
||||||
header={{
|
header={{
|
||||||
title: intl.get('场景管理'),
|
style: headerStyle,
|
||||||
}}
|
}}
|
||||||
>
|
extra={[
|
||||||
<div className="scenario-page">
|
|
||||||
<div className="scenario-toolbar">
|
|
||||||
<Space>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
icon={<PlusOutlined />}
|
|
||||||
onClick={handleCreate}
|
|
||||||
>
|
|
||||||
{intl.get('新建场景')}
|
|
||||||
</Button>
|
|
||||||
{selectedRowKeys.length > 0 && (
|
|
||||||
<>
|
|
||||||
<Button
|
|
||||||
icon={<CheckCircleOutlined />}
|
|
||||||
onClick={() =>
|
|
||||||
handleStatusChange(selectedRowKeys as number[], 1)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{intl.get('启用场景')}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
icon={<CloseCircleOutlined />}
|
|
||||||
onClick={() =>
|
|
||||||
handleStatusChange(selectedRowKeys as number[], 0)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{intl.get('禁用场景')}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
danger
|
|
||||||
icon={<DeleteOutlined />}
|
|
||||||
onClick={() => handleDelete(selectedRowKeys as number[])}
|
|
||||||
>
|
|
||||||
{intl.get('删除')}
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Space>
|
|
||||||
<Search
|
<Search
|
||||||
placeholder={intl.get('搜索场景')}
|
placeholder={intl.get('搜索场景')}
|
||||||
style={{ width: 300 }}
|
style={{ width: 300 }}
|
||||||
|
|
@ -323,8 +290,44 @@ const ScenarioPage: React.FC = () => {
|
||||||
fetchScenarios(value);
|
fetchScenarios(value);
|
||||||
}}
|
}}
|
||||||
allowClear
|
allowClear
|
||||||
/>
|
/>,
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
icon={<PlusOutlined />}
|
||||||
|
onClick={handleCreate}
|
||||||
|
>
|
||||||
|
{intl.get('新建场景')}
|
||||||
|
</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<div className="scenario-page">
|
||||||
|
{selectedRowKeys.length > 0 && (
|
||||||
|
<div className="scenario-toolbar">
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() =>
|
||||||
|
handleStatusChange(selectedRowKeys as number[], 1)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{intl.get('批量启用')}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() =>
|
||||||
|
handleStatusChange(selectedRowKeys as number[], 0)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{intl.get('批量禁用')}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
onClick={() => handleDelete(selectedRowKeys as number[])}
|
||||||
|
>
|
||||||
|
{intl.get('批量删除')}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<Table
|
<Table
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user