#
luxiaotao1123
2024-03-24 622b6417f882c4c099a52cf56ea95e01524c900c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import React, { useState, useRef, useEffect } from 'react';
import { Drawer, Space, Button, Card } from 'antd';
import {
    ProCard,
    ProForm,
    ProFormCheckbox,
    ProFormDatePicker,
    ProFormDateRangePicker,
    ProFormSelect,
    ProFormText,
    ProFormTextArea,
    StepsForm,
} from '@ant-design/pro-components';
import { FormattedMessage, useIntl, useModel } from '@umijs/max';
import { createStyles } from 'antd-style';
import * as Utils from '../utils'
import ShowJson from '../drawer/showJson';
 
const useStyles = createStyles(({ token, css }) => {
    return {
    }
})
 
const waitTime = (time = 100) => {
    return new Promise((resolve) => {
        setTimeout(() => {
            resolve(true);
        }, time);
    });
};
 
const BatchDrawer = (props) => {
    const intl = useIntl();
    const { styles } = useStyles();
    const { batchSprites } = props;
    const formRef = useRef();
 
    useEffect(() => {
        console.log(batchSprites);
    }, []);
 
    const handleCancel = () => {
        props.onCancel();
    };
 
    return (
        <>
            <Drawer
                open={props.open}
                onClose={handleCancel}
                getContainer={props.refCurr}
                rootStyle={{ position: "absolute" }}
                mask={false}
                width={600}
                style={{
                    opacity: 1
                }}
                extra={
                    <Space>
                        <Button onClick={handleCancel}>
                            <FormattedMessage id='common.cancel' defaultMessage='取消' />
                        </Button>
                    </Space>
                }
            >
                <Card
                    className='drawer-card'
                    hoverable
                    bordered={false}
                    type='inner'
                    style={{
                        height: '100%'
                    }}
                >
                    <StepsForm
                        formRef={formRef}
                        onFinish={async () => {
                            await waitTime(1000);
                            message.success('提交成功');
                        }}
                        formProps={{
                            validateMessages: {
                                required: '此项为必填项',
                            },
                        }}
                    >
                        {/************************* first ****************************/}
                        <StepsForm.StepForm
                            name="base"
                            title="选择货架"
                            onFinish={() => {
                                return true;
                            }}
                        >
                            <ProForm.Item
                            >
                                <ShowJson
                                    data={
                                        batchSprites?.filter(item => {
                                            return item.data?.type === Utils.SENSOR_TYPE.SHELF
                                        }).map(item => {
                                            return item.data?.no;
                                        })
                                    }
                                    height='500px'
                                    jsonType={0}
                                />
                            </ProForm.Item>
                        </StepsForm.StepForm>
                        {/************************* second ****************************/}
                        <StepsForm.StepForm
                            name="checkbox"
                            title="设置参数"
                            onFinish={(values) => {
                                console.log(values);
                                return true;
                            }}
                        >
                            <ProForm.Group>
                                <ProFormText name="dbname" label="业务 DB 用户名" />
                                <ProFormSelect
                                    label="Pod 调度策略"
                                    name="remark2"
                                    initialValue="2"
                                    options={[
                                        {
                                            value: '1',
                                            label: '策略一',
                                        },
                                        { value: '2', label: '策略二' },
                                    ]}
                                />
                            </ProForm.Group>
                        </StepsForm.StepForm>
                        {/************************* third ****************************/}
                        <StepsForm.StepForm
                            name="time"
                            title="结果"
                        >
                        </StepsForm.StepForm>
                    </StepsForm >
                </Card >
            </Drawer >
        </>
    )
}
 
export default BatchDrawer;