From 9d0acfb65c80c4948c305ca01338f894b87346a0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 08 四月 2024 09:44:37 +0800
Subject: [PATCH] Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack

---
 zy-asrs-flow/src/pages/map/components/settings.jsx |  118 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 74 insertions(+), 44 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/components/settings.jsx b/zy-asrs-flow/src/pages/map/components/settings.jsx
index 0b53c49..0362981 100644
--- a/zy-asrs-flow/src/pages/map/components/settings.jsx
+++ b/zy-asrs-flow/src/pages/map/components/settings.jsx
@@ -1,51 +1,67 @@
 import React, { useState, useRef, useEffect } from 'react';
-import {
-    ProForm,
-    ProFormDigit,
-    ProFormText,
-    ProFormSelect,
-    ProFormDateTimePicker
-} from '@ant-design/pro-components';
-import moment from 'moment';
-import { Col, Form, Modal, Row, Checkbox, Image, Tree, Drawer, Space, Button, Card, Divider } from 'antd';
+import { Col, Form, Input, Row, Checkbox, Slider, Select, Drawer, Space, Button, InputNumber, Card } from 'antd';
 import { FormattedMessage, useIntl, useModel } from '@umijs/max';
-import * as PIXI from 'pixi.js';
+import {
+    BranchesOutlined,
+    BorderOuterOutlined,
+} from '@ant-design/icons';
 import { createStyles } from 'antd-style';
-import './index.css';
+import * as Utils from '../utils'
 import Http from '@/utils/http';
+import MapSettings from './mapSettings';
+import ConfigSettings from './configSettings';
 
 const useStyles = createStyles(({ token, css }) => {
 
 })
 
-const SpriteSettings = (props) => {
+const Settings = (props) => {
     const intl = useIntl();
     const { styles } = useStyles();
-    const { curSprite } = props;
-    const [form] = Form.useForm();
+    const [activeTabKey, setActiveTabKey] = useState('map');
+    const [mapForm] = Form.useForm();
+    const [configForm] = Form.useForm();
 
     useEffect(() => {
-
     }, []);
-
-    useEffect(() => {
-        form.resetFields();
-        form.setFieldsValue({
-            ...props.values
-        })
-    }, [form, props])
 
     const handleCancel = () => {
         props.onCancel();
     };
 
     const handleOk = () => {
-        form.submit();
+        if (activeTabKey === 'map') {
+            mapForm.submit();
+        }
+        if (activeTabKey === 'config') {
+            configForm.submit();
+        }
     }
 
-    const handleFinish = async (values) => {
-        props.onSubmit({ ...values });
+    const finishSettings = (values, fn) => {
+        fn();
     }
+
+    const contentList = {
+        map: (
+            <MapSettings
+                refCurr={props.refCurr}
+                curSprite={props.curSprite}
+                setSpriteBySettings={props.setSpriteBySettings}
+                onSubmit={finishSettings}
+                mapForm={mapForm}
+            />
+        ),
+        config: (
+            <ConfigSettings
+                refCurr={props.refCurr}
+                curSprite={props.curSprite}
+                setSpriteBySettings={props.setSpriteBySettings}
+                onSubmit={finishSettings}
+                configForm={configForm}
+            />
+        ),
+    };
 
     return (
         <>
@@ -61,33 +77,47 @@
                         <Button onClick={handleCancel}>
                             <FormattedMessage id='common.cancel' defaultMessage='鍙栨秷' />
                         </Button>
-                        <Button onClick={handleOk} type="primary">
+                        <Button hidden={activeTabKey === 'map' || activeTabKey === 'config'} onClick={handleOk} type="primary">
                             <FormattedMessage id='common.submit' defaultMessage='淇濆瓨' />
                         </Button>
                     </Space>
                 }
             >
-                <Card>
+                <Card
+                    hoverable
+                    bordered={false}
+                    type='inner'
+                    tabList={[
+                        {
+                            key: 'map',
+                            tab: intl.formatMessage({ id: 'map.settings.map.param', defaultMessage: '鍦板浘鍙傛暟' }),
+                            icon: <BorderOuterOutlined />
 
-                    <ProForm
-                        form={form}
-                        submitter={false}
-                        onFinish={handleFinish}
-                        layout="horizontal"
-                        grid={true}
-                    >
-
-                    </ProForm>
-                    {/* 
-                        // position
-                        // scale
-                        // rotation
-                        // copy
-                    */}
+                        },
+                        {
+                            key: 'config',
+                            tab: intl.formatMessage({ id: 'map.settings.config.param', defaultMessage: '绯荤粺鍙傛暟' }),
+                            icon: <BranchesOutlined />
+                        },
+                    ]}
+                    activeTabKey={activeTabKey}
+                    onTabChange={(key) => {
+                        setActiveTabKey(key)
+                    }}
+                    tabProps={{
+                        centered: true,
+                        size: 'large',
+                        type: "card",
+                        style: {
+                        }
+                    }}
+                >
+                    {contentList[activeTabKey]}
                 </Card>
-            </Drawer>
+
+            </Drawer >
         </>
     )
 }
 
-export default SpriteSettings;
\ No newline at end of file
+export default Settings;
\ No newline at end of file

--
Gitblit v1.9.1