From d835d1b51f832889929cdf69010034a30ef44d02 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 17 十月 2024 13:57:29 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/batch/index.jsx | 245 ++++++++----------------------------------------
1 files changed, 42 insertions(+), 203 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/batch/index.jsx b/zy-asrs-flow/src/pages/map/batch/index.jsx
index 9b154bd..6c18bf1 100644
--- a/zy-asrs-flow/src/pages/map/batch/index.jsx
+++ b/zy-asrs-flow/src/pages/map/batch/index.jsx
@@ -1,57 +1,39 @@
import React, { useState, useRef, useEffect } from 'react';
-import { Drawer, Space, Button, Card, Select, InputNumber, Input, Result, Form } from 'antd';
-import {
- ProCard,
- ProForm,
- ProFormCheckbox,
- ProFormDatePicker,
- ProFormDateRangePicker,
- ProFormSelect,
- ProFormText,
- ProFormTextArea,
- StepsForm,
-} from '@ant-design/pro-components';
+import { Drawer, Space, Button, Card } from 'antd';
import { FormattedMessage, useIntl, useModel } from '@umijs/max';
import { createStyles } from 'antd-style';
import * as Utils from '../utils'
import ShowJson from '../drawer/showJson';
+import BatchShelfView from './view'
+import BatchModify from './modify';
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 [form] = Form.useForm();
- const [currentStep, setCurrentStep] = useState(0);
-
- const resetForm = () => {
- form.resetFields();
- setCurrentStep(0);
- };
+ const {
+ batchSprites,
+ model,
+ ModelEnum,
+ } = props;
useEffect(() => {
- console.log(batchSprites);
- resetForm();
}, [props]);
-
- useEffect(() => {
- console.log(currentStep);
- }, [currentStep]);
const handleCancel = () => {
props.onCancel();
+ };
+
+ const handleDelete = () => {
+ batchSprites.forEach((curSprite) => {
+ Utils.getMapContainer().removeChild(curSprite);
+ Utils.removeSelectedEffect();
+ props.onCancel();
+ })
};
return (
@@ -69,6 +51,9 @@
}}
extra={
<Space>
+ <Button onClick={handleDelete} danger>
+ <FormattedMessage id='page.delete' defaultMessage='鍒犻櫎' />
+ </Button>
<Button onClick={handleCancel}>
<FormattedMessage id='common.cancel' defaultMessage='鍙栨秷' />
</Button>
@@ -84,176 +69,30 @@
height: '100%'
}}
>
- <StepsForm
- form={form}
- current={currentStep}
- onCurrentChange={setCurrentStep}
- onFinish={async () => {
- await waitTime(1000);
- message.success('鎻愪氦鎴愬姛');
- }}
- formProps={{
- variant: 'filled',
- layout: 'horizontal',
- labelCol: {
- span: 4,
- },
- wrapperCol: {
- span: 20,
- },
- labelWrap: true
- }}
- submitter={{
- render: (props, dom) => {
- return props.step === 2 ? [] : dom;
- },
- }}
- >
- {/************************* first ****************************/}
- <StepsForm.StepForm
- name="base"
- title={intl.formatMessage({ id: 'map.settings.batch.select.shelf', defaultMessage: '閫夋嫨璐ф灦' })}
- 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={intl.formatMessage({ id: 'map.settings.batch.set.params', defaultMessage: '璁剧疆鍙傛暟' })}
- onFinish={(values) => {
- console.log(values);
- return true;
- }}
- >
- <ProForm.Item
- name='shelfType'
- label={intl.formatMessage({ id: 'map.settings.shelf.type', defaultMessage: '绫诲瀷' })}
- rules={[
- {
- required: true,
- },
- ]}
- >
- <Select
- style={{ width: 120 }}
- options={[
- {
- label: intl.formatMessage({ id: 'map.settings.shelf.store', defaultMessage: '搴撲綅' }),
- value: 0
- },
- {
- label: intl.formatMessage({ id: 'map.settings.shelf.track', defaultMessage: '杞ㄩ亾' }),
- value: 3
- },
- {
- label: intl.formatMessage({ id: 'map.settings.shelf.diable', defaultMessage: '绂佺敤' }),
- value: 1
- },
- ]}
- defaultValue={0}
- />
- </ProForm.Item>
- <ProForm.Item
- label={intl.formatMessage({ id: 'map.settings.shelf.space', defaultMessage: '闂磋窛' })}
- >
- <Space.Compact>
- <ProForm.Item
- name='top'
- noStyle
- >
- <InputNumber
- addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.top' defaultMessage='涓�' /></Space.Compact>}
- style={{
- width: '50%',
- }}
- />
- </ProForm.Item>
- <ProForm.Item
- name='bottom'
- noStyle
- >
- <InputNumber
- addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.bottom' defaultMessage='涓�' /></Space.Compact>}
- style={{
- width: '50%',
- }}
- />
- </ProForm.Item>
- </Space.Compact>
- </ProForm.Item>
- <ProForm.Item
- label={' '}
- >
- <Space.Compact>
- <ProForm.Item
- name='left'
- noStyle
- >
- <InputNumber
- addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.left' defaultMessage='宸�' /></Space.Compact>}
- style={{
- width: '50%',
- }}
- />
- </ProForm.Item>
- <ProForm.Item
- name='right'
- noStyle
- >
- <InputNumber
- addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.right' defaultMessage='鍙�' /></Space.Compact>}
- style={{
- width: '50%',
- }}
- />
- </ProForm.Item>
- </Space.Compact>
- </ProForm.Item>
- <ProForm.Item
- name='value'
- label={intl.formatMessage({ id: 'map.settings.shelf.value', defaultMessage: '鍦板浘鍊�' })}
- >
- <Input
- style={{
- width: '50%',
- }}
- />
- </ProForm.Item>
- </StepsForm.StepForm>
- {/************************* third ****************************/}
- <StepsForm.StepForm
- name="time"
- title={intl.formatMessage({ id: 'map.settings.batch.result', defaultMessage: '缁撴灉' })}
- submitter={false}
- >
- <Result
- status="success"
- title={intl.formatMessage({ id: 'map.settings.batch.result.title', defaultMessage: '鎵归噺璁剧疆鎴愬姛' })}
- subTitle=""
- extra={[
- <Button type="primary" key="console" onClick={handleCancel}>
- <FormattedMessage id='common.confirm' defaultMessage='纭畾' />
- </Button>,
- ]}
+ {model === ModelEnum.OBSERVER_MODEL && (
+ <>
+ <ShowJson
+ data={
+ batchSprites?.map(item => {
+ return item.data?.no;
+ })
+ }
/>
- </StepsForm.StepForm>
- </StepsForm >
+ {/* <BatchShelfView
+
+ /> */}
+ </>
+ )}
+
+ {model === ModelEnum.SETTINGS_MODEL && (
+ <>
+ <BatchModify
+ batchSprites={batchSprites}
+ handleCancel={handleCancel}
+ />
+ </>
+ )}
+
</Card >
</Drawer >
</>
--
Gitblit v1.9.1