From 077ada8ac2c47b383b84398a3951b653767a6364 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 25 三月 2024 16:14:38 +0800 Subject: [PATCH] # --- zy-asrs-flow/src/pages/map/batch/modify.jsx | 88 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 70 insertions(+), 18 deletions(-) diff --git a/zy-asrs-flow/src/pages/map/batch/modify.jsx b/zy-asrs-flow/src/pages/map/batch/modify.jsx index 5b0347f..d017796 100644 --- a/zy-asrs-flow/src/pages/map/batch/modify.jsx +++ b/zy-asrs-flow/src/pages/map/batch/modify.jsx @@ -3,6 +3,7 @@ import { ProForm, StepsForm, + ProFormSelect } from '@ant-design/pro-components'; import { FormattedMessage, useIntl, useModel } from '@umijs/max'; import { createStyles } from 'antd-style'; @@ -29,19 +30,53 @@ const [form] = Form.useForm(); const [currentStep, setCurrentStep] = useState(0); + const [uuidsOfBatchSprites, setUuidsOfBatchSprites] = useState([]); const resetForm = () => { form.resetFields(); + form.setFieldsValue({ + shelfType: Utils.SHELF_TYPE.STORE + }) setCurrentStep(0); }; useEffect(() => { - console.log(batchSprites); resetForm(); - }, [props]); + if (batchSprites?.length > 0) { + setUuidsOfBatchSprites(batchSprites?.filter(item => { + return item.data?.type === Utils.SENSOR_TYPE.SHELF + }).map(item => { + return item.data?.no; + })); + } else { + setUuidsOfBatchSprites([]); + } + }, [batchSprites]); + + const handleOk = (values) => { + console.log(values); + if (batchSprites?.length > 0) { + // loading + batchSprites.forEach(sprite => { + if (sprite.data?.type === Utils.SENSOR_TYPE.SHELF) { + if (values.shelfType) { + + } + Utils.showSheflType(sprite); + } + }); + return false; + } else { + return false; + } + } useEffect(() => { - console.log(currentStep); + if (currentStep === 1) { + form.setFieldsValue({ + shelfType: Utils.SHELF_TYPE.STORE + }); + } }, [currentStep]); return ( @@ -70,6 +105,9 @@ return props.step === 2 ? [] : dom; }, }} + initialValues={{ + shelfType: Utils.SHELF_TYPE.STORE + }} > {/************************* first ****************************/} <StepsForm.StepForm @@ -79,16 +117,9 @@ return true; }} > - <ProForm.Item - > + <ProForm.Item> <ShowJson - data={ - batchSprites?.filter(item => { - return item.data?.type === Utils.SENSOR_TYPE.SHELF - }).map(item => { - return item.data?.no; - }) - } + data={uuidsOfBatchSprites} height='500px' jsonType={0} /> @@ -98,12 +129,9 @@ <StepsForm.StepForm name="checkbox" title={intl.formatMessage({ id: 'map.settings.batch.set.params', defaultMessage: '璁剧疆鍙傛暟' })} - onFinish={(values) => { - console.log(values); - return true; - }} + onFinish={handleOk} > - <ProForm.Item + {/* <ProForm.Item name='shelfType' label={intl.formatMessage({ id: 'map.settings.shelf.type', defaultMessage: '绫诲瀷' })} rules={[ @@ -130,7 +158,31 @@ ]} defaultValue={0} /> - </ProForm.Item> + </ProForm.Item> */} + <ProFormSelect + name='shelfType' + label={intl.formatMessage({ id: 'map.settings.shelf.type', defaultMessage: '绫诲瀷' })} + rules={[ + { + required: true, + }, + ]} + style={{ width: 120 }} + options={[ + { + label: intl.formatMessage({ id: 'map.settings.shelf.store', defaultMessage: '搴撲綅' }), + value: Utils.SHELF_TYPE.STORE + }, + { + label: intl.formatMessage({ id: 'map.settings.shelf.track', defaultMessage: '杞ㄩ亾' }), + value: Utils.SHELF_TYPE.TRACK + }, + { + label: intl.formatMessage({ id: 'map.settings.shelf.diable', defaultMessage: '绂佺敤' }), + value: Utils.SHELF_TYPE.DISABLE + }, + ]} + /> <ProForm.Item label={intl.formatMessage({ id: 'map.settings.shelf.space', defaultMessage: '闂磋窛' })} > -- Gitblit v1.9.1