Commit d55b139b authored by 陈万宝's avatar 陈万宝

add lint

parent a123c667
...@@ -217,8 +217,8 @@ ...@@ -217,8 +217,8 @@
} }
.ant-form-text { .ant-form-text {
display: flex; display: flex;
justify-content: center;
align-items: center; align-items: center;
justify-content: center;
} }
} }
} }
...@@ -260,9 +260,9 @@ ...@@ -260,9 +260,9 @@
} }
.specsSingularBetween { .specsSingularBetween {
display: flex; display: flex;
align-items: center;
justify-content: flex-start; justify-content: flex-start;
width: max-content; width: max-content;
align-items: center;
:global { :global {
.ant-form-item-label { .ant-form-item-label {
overflow: inherit; overflow: inherit;
...@@ -336,8 +336,8 @@ ...@@ -336,8 +336,8 @@
} }
.rowWarp { .rowWarp {
display: flex; display: flex;
background: #f8f8f8;
flex-direction: column; flex-direction: column;
background: #f8f8f8;
} }
:global { :global {
......
import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react'; // import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react';
import { Button, Modal, Radio, Space, Form, InputNumber, Switch, Input } from 'antd'; // import { Button, Modal, Radio, Space, Form, InputNumber, Switch, Input } from 'antd';
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; // import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
import styles from '../common.less'; // import styles from '../common.less';
import { ENUM_SET_REPERTORY } from '../config'; // import { ENUM_SET_REPERTORY } from '../config';
// const AddMultiSpecModal = (props, ref) => {
// const [confirmLoading, setConfirmLoading] = useState(false);
// const [modalText, setModalText] = useState('Content of the modal');
// const [multiRepertory, setMultiRepertory] = useState(false);
const AddMultiSpecModal = (props, ref) => { // // const {
const [confirmLoading, setConfirmLoading] = useState(false); // // open,
const [modalText, setModalText] = useState('Content of the modal'); // // setOpen,
const [multiRepertory, setMultiRepertory] = useState(false); // // } = props;
// useImperativeHandle(ref, () => ({
// // changeVal 就是暴露给父组件的方法
// setMultiRepertory: newVal => {
// setMultiRepertory(newVal);
// },
// }));
// const onChange3 = () => {};
// const { // const handleOk = () => {
// open, // setModalText('The modal will be closed after two seconds');
// setOpen, // setConfirmLoading(true);
// } = props; // setTimeout(() => {
useImperativeHandle(ref, () => ({ // setMultiRepertory(false);
// changeVal 就是暴露给父组件的方法 // setConfirmLoading(false);
setMultiRepertory: newVal => { // }, 2000);
setMultiRepertory(newVal); // };
},
}));
const onChange3 = () => {};
const handleOk = () => { // const handleCancel = () => {
setModalText('The modal will be closed after two seconds'); // console.log('Clicked cancel button');
setConfirmLoading(true); // setMultiRepertory(false);
setTimeout(() => { // };
setMultiRepertory(false); // useEffect(() => {
setConfirmLoading(false); // console.log('open', multiRepertory);
}, 2000); // }, [multiRepertory]);
}; // return (
// <>
// {multiRepertory && (
// <Modal
// title="修改库存"
// visible={multiRepertory}
// onOk={handleOk}
// width={1050}
// confirmLoading={confirmLoading}
// onCancel={handleCancel}
// >
// <Form>
// <Form.Item>
// <div>份量(如大小/小份、微辣/特辣等)</div>
// <Form.List name="users">
// {(fields, { add, remove }) => (
// <>
// {fields.map(({ key, name, ...restField }) => (
// <Space
// key={key}
// style={{
// display: 'flex',
// flexDirection: 'column',
// marginBottom: 8,
// }}
// align="baseline"
// >
// <Form.Item className={styles.deal}>
// <Form.Item
// {...restField}
// name={[name, 'first']}
// rules={[
// {
// required: true,
// message: 'Missing first name',
// },
// ]}
// >
// <Input placeholder="名称" />
// </Form.Item>
// <Form.Item
// {...restField}
// name={[name, 'last']}
// rules={[
// {
// required: true,
// message: 'Missing last name',
// },
// ]}
// >
// <Input placeholder="约 份量(数字)" />
// </Form.Item>
// <Form.Item
// {...restField}
// name={[name, 'last']}
// rules={[
// {
// required: true,
// message: 'Missing last name',
// },
// ]}
// >
// <Input placeholder="约 份量(数字)" />
// </Form.Item>
// <Form.Item
// {...restField}
// name={[name, 'last']}
// rules={[
// {
// required: true,
// message: 'Missing last name',
// },
// ]}
// >
// <Input placeholder="销售价(元)" />
// </Form.Item>
// <Form.Item
// {...restField}
// name={[name, 'last']}
// rules={[
// {
// required: true,
// message: 'Missing last name',
// },
// ]}
// >
// <Input placeholder="活动价(元)" />
// </Form.Item>
// <MinusCircleOutlined onClick={() => remove(name)} />
// </Form.Item>
// <Form.Item>
// <Form.Item>
// <div>添加规格(如加料、甜度、辣度等)</div>
// <Form.Item>
// <Form.List name="names">
// {(fields, { add, remove }, { errors }) => (
// <>
// {fields.map((field, index) => (
// <Form.Item
// // {...(index === 0 ? formItemLayout : formItemLayoutWithOutLabel)}
// // label={index === 0 ? 'Passengers' : ''}
// required={false}
// key={field.key}
// >
// <Form.Item
// {...field}
// validateTrigger={['onChange', 'onBlur']}
// className={styles.deal}
const handleCancel = () => { // rules={[
console.log('Clicked cancel button'); // {
setMultiRepertory(false); // required: true,
}; // whitespace: true,
useEffect(() => { // message:
console.log('open', multiRepertory); // "Please input passenger's name or delete this field.",
}, [multiRepertory]); // },
return ( // ]}
<> // >
{multiRepertory && ( // <Input
<Modal // placeholder="规格名称"
title="修改库存" // className={styles.nameWidth}
visible={multiRepertory} // />
onOk={handleOk} // {fields.length > 1 ? (
width={1050} // <MinusCircleOutlined
confirmLoading={confirmLoading} // className="dynamic-delete-button"
onCancel={handleCancel} // onClick={() => remove(field.name)}
> // />
<Form> // ) : null}
<Form.Item> // </Form.Item>
<div>份量(如大小/小份、微辣/特辣等)</div> // <Form.Item>
<Form.List name="users"> // <Form.List name="sights">
{(fields, { add, remove }) => ( // {(fields, { add, remove }) => (
<> // <>
{fields.map(({ key, name, ...restField }) => ( // {fields.map(field => (
<Space // <Space key={field.key} align="baseline">
key={key} // <Form.Item
style={{ // noStyle
display: 'flex', // shouldUpdate={(prevValues, curValues) =>
flexDirection: 'column', // prevValues.area !== curValues.area ||
marginBottom: 8, // prevValues.sights !== curValues.sights
}} // }
align="baseline" // >
> // {() => (
<Form.Item className={styles.deal}> // <Form.Item
<Form.Item // {...field}
{...restField} // // label="Sight"
name={[name, 'first']} // name={[field.name, 'sight']}
rules={[ // rules={[
{ // {
required: true, // required: true,
message: 'Missing first name', // message: 'Missing sight',
}, // },
]} // ]}
> // >
<Input placeholder="名称" /> // <Input style={{ width: '200px' }} placeholder="加价名称" />
</Form.Item> // </Form.Item>
<Form.Item // )}
{...restField} // </Form.Item>
name={[name, 'last']} // <Form.Item
rules={[ // {...field}
{ // // label="Price"
required: true, // // name={[field.name, 'price']}
message: 'Missing last name', // rules={[
}, // {
]} // required: true,
> // message: 'Missing price',
<Input placeholder="约 份量(数字)" /> // },
</Form.Item> // ]}
<Form.Item // >
{...restField} // <InputNumber style={{ width: '200px' }} placeholder="加价名称金额(元)" />
name={[name, 'last']} // </Form.Item>
rules={[
{
required: true,
message: 'Missing last name',
},
]}
>
<Input placeholder="约 份量(数字)" />
</Form.Item>
<Form.Item
{...restField}
name={[name, 'last']}
rules={[
{
required: true,
message: 'Missing last name',
},
]}
>
<Input placeholder="销售价(元)" />
</Form.Item>
<Form.Item
{...restField}
name={[name, 'last']}
rules={[
{
required: true,
message: 'Missing last name',
},
]}
>
<Input placeholder="活动价(元)" />
</Form.Item>
<MinusCircleOutlined onClick={() => remove(name)} />
</Form.Item>
<Form.Item>
<Form.Item>
<div>添加规格(如加料、甜度、辣度等)</div>
<Form.Item>
<Form.List name="names">
{(fields, { add, remove }, { errors }) => (
<>
{fields.map((field, index) => (
<Form.Item
// {...(index === 0 ? formItemLayout : formItemLayoutWithOutLabel)}
// label={index === 0 ? 'Passengers' : ''}
required={false}
key={field.key}
>
<Form.Item
{...field}
validateTrigger={['onChange', 'onBlur']}
className={styles.deal}
rules={[ // <MinusCircleOutlined
{ // onClick={() => remove(field.name)}
required: true, // />
whitespace: true, // </Space>
message: // ))}
"Please input passenger's name or delete this field.",
},
]}
>
<Input
placeholder="规格名称"
className={styles.nameWidth}
/>
{fields.length > 1 ? (
<MinusCircleOutlined
className="dynamic-delete-button"
onClick={() => remove(field.name)}
/>
) : null}
</Form.Item>
<Form.Item>
<Form.List name="sights">
{(fields, { add, remove }) => (
<>
{fields.map(field => (
<Space key={field.key} align="baseline">
<Form.Item
noStyle
shouldUpdate={(prevValues, curValues) =>
prevValues.area !== curValues.area ||
prevValues.sights !== curValues.sights
}
>
{() => (
<Form.Item
{...field}
// label="Sight"
name={[field.name, 'sight']}
rules={[
{
required: true,
message: 'Missing sight',
},
]}
>
<Input style={{ width: '200px' }} placeholder="加价名称" />
</Form.Item>
)}
</Form.Item>
<Form.Item
{...field}
// label="Price"
// name={[field.name, 'price']}
rules={[
{
required: true,
message: 'Missing price',
},
]}
>
<InputNumber style={{ width: '200px' }} placeholder="加价名称金额(元)" />
</Form.Item>
<MinusCircleOutlined // <Form.Item>
onClick={() => remove(field.name)} // <Button
/> // type="dashed"
</Space> // onClick={() => add()}
))} // block
// icon={<PlusOutlined />}
// >
// 新增加价
// </Button>
// </Form.Item>
// </>
// )}
// </Form.List>
// </Form.Item>
// </Form.Item>
// ))}
// <Form.Item>
// <Button
// type="dashed"
// onClick={() => add()}
// style={{ width: '60%' }}
// icon={<PlusOutlined />}
// >
// 新增规格
// </Button>
// </Form.Item>
// </>
// )}
// </Form.List>
// </Form.Item>
// </Form.Item>
// </Form.Item>
// </Space>
// ))}
// <Form.Item>
// <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
// 新增份量
// </Button>
// </Form.Item>
// </>
// )}
// </Form.List>
// </Form.Item>
// </Form>
// </Modal>
// )}
// </>
// );
// };
<Form.Item> // export default forwardRef(AddMultiSpecModal);
<Button
type="dashed"
onClick={() => add()}
block
icon={<PlusOutlined />}
>
新增加价
</Button>
</Form.Item>
</>
)}
</Form.List>
</Form.Item>
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => add()}
style={{ width: '60%' }}
icon={<PlusOutlined />}
>
新增规格
</Button>
</Form.Item>
</>
)}
</Form.List>
</Form.Item>
</Form.Item>
</Form.Item>
</Space>
))}
<Form.Item>
<Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
新增份量
</Button>
</Form.Item>
</>
)}
</Form.List>
</Form.Item>
</Form>
</Modal>
)}
</>
);
};
export default forwardRef(AddMultiSpecModal);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment