|
|
@@ -0,0 +1,64 @@
|
|
|
+import React, { useEffect } from 'react';
|
|
|
+import { Card, Button, Space, Form, Input, message } from 'antd';
|
|
|
+import { SPACING } from '../../../constants';
|
|
|
+import { getConfig, modifyConfig, configItem } from '@/API/system/options';
|
|
|
+
|
|
|
+const ReportTitle: React.FC = () => {
|
|
|
+ const [form] = Form.useForm();
|
|
|
+ const onFinish = async (values: Record<string, string>) => {
|
|
|
+ const res = await modifyConfig(values);
|
|
|
+ if (res?.code === '0x000000') {
|
|
|
+ message.success('修改成功');
|
|
|
+ // form.resetFields();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const getReportTitle = async () => {
|
|
|
+ const res = await getConfig({
|
|
|
+ uri: ['Report/MainTitle', 'Report/SubTitle'],
|
|
|
+ });
|
|
|
+ if (res?.code === '0x000000') {
|
|
|
+ const formValues = (res?.data?.configs || []).reduce((acc, cur) => {
|
|
|
+ acc[cur.uri] = cur.config_value;
|
|
|
+ return acc;
|
|
|
+ }, {});
|
|
|
+ form.setFieldsValue(formValues);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ getReportTitle();
|
|
|
+ }, [form]);
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div style={{ padding: SPACING.LG }}>
|
|
|
+ <Card title="报告配置" variant="borderless">
|
|
|
+ <Form layout="vertical" form={form} onFinish={onFinish}>
|
|
|
+ <Form.Item
|
|
|
+ name="Report/MainTitle"
|
|
|
+ label="主标题"
|
|
|
+ rules={[{ required: true }]}
|
|
|
+ >
|
|
|
+ <Input allowClear />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ name="Report/SubTitle"
|
|
|
+ label="副标题"
|
|
|
+ rules={[{ required: true }]}
|
|
|
+ >
|
|
|
+ <Input allowClear />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item>
|
|
|
+ <Space>
|
|
|
+ <Button type="primary" htmlType="submit">
|
|
|
+ 保存
|
|
|
+ </Button>
|
|
|
+ </Space>
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </Card>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+export default ReportTitle;
|