feat(react-web-next): 新增.editorconfig和.prettierrc配置文件,添加public/.gitkeep占位文件
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import React, { useState } from 'react';
|
||||
import { PageContainer, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components';
|
||||
import { Space, Switch, message } from 'antd';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { ordersApi } from '@/services/orders';
|
||||
import { ActionBar, GradientButton, SearchBarPlus } from '@/components/ui';
|
||||
|
||||
const VideoTemplatePage: React.FC = () => {
|
||||
const [params, setParams] = useState<Record<string, any>>({});
|
||||
|
||||
const columns: any[] = [
|
||||
{ dataIndex: 'index', valueType: 'indexBorder', width: 48 },
|
||||
{ title: '模板名称', dataIndex: 'name' },
|
||||
{ title: '描述', dataIndex: 'description' },
|
||||
{ title: '状态', dataIndex: 'status', render: (v: number, r: any) => <Switch checked={v === 1} onChange={(c) => ordersApi.updateVideoTemplateStatus(r.id, c ? 1 : 0)} /> },
|
||||
{
|
||||
title: '操作', key: 'action',
|
||||
render: (_: any, record: any) => (
|
||||
<Space>
|
||||
<a onClick={async () => { message.info('演示环境暂不提供修改参数'); }}>编辑</a>
|
||||
<a style={{ color: '#1677ff' }} onClick={async () => { try { await ordersApi.deleteVideoTemplate(record.id); message.success('删除成功'); } catch { message.error('删除失败'); } }}>删除</a>
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ title: '视频模板' }}>
|
||||
<SearchBarPlus defaultCollapsed split span={8} onTenantChanged={() => { /* 租户切换 */ }} onFinish={async (values) => setParams(values)}>
|
||||
<ProFormText name="name" label="模板名称" />
|
||||
<ProFormSelect name="status" label="状态" valueEnum={{ 1: '启用', 0: '禁用' }} allowClear />
|
||||
</SearchBarPlus>
|
||||
|
||||
<ActionBar left={<GradientButton size="middle" type="primary" onClick={async () => {
|
||||
const hide = message.loading('保存中...');
|
||||
try { await ordersApi.saveVideoTemplate({ name: '新模板', status: 1 }); message.success('新增成功'); }
|
||||
catch { message.error('新增失败'); } finally { hide(); }
|
||||
}}><PlusOutlined /> 新增</GradientButton>} />
|
||||
|
||||
<ProTable<any>
|
||||
rowKey="id"
|
||||
request={(p) => ordersApi.getVideoTemplateList({ ...p, ...params } as any)}
|
||||
columns={columns}
|
||||
search={false}
|
||||
pagination={{ showSizeChanger: true, showQuickJumper: true }}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default VideoTemplatePage;
|
||||
|
||||
Reference in New Issue
Block a user