|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { useState } from 'react'
|
|
|
|
|
import { Table, Form, Modal, Button, Radio, Input, Flex, Card, InputNumber, Checkbox, DatePicker, Space, App, Tooltip } from 'antd'
|
|
|
|
|
import { Table, Form, Modal, Typography, Button, Radio, Input, Flex, Card, InputNumber, Checkbox, DatePicker, Space, App, Tooltip } from 'antd'
|
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
import { CloseOutlined, StarTwoTone, PlusOutlined, ExclamationCircleFilled, QuestionCircleOutlined, QuestionOutlined } from '@ant-design/icons'
|
|
|
|
|
import { useDatePresets } from '@/hooks/useDatePresets'
|
|
|
|
@ -12,9 +12,13 @@ const { RangePicker } = DatePicker
|
|
|
|
|
const batchSetupInitialValues = {
|
|
|
|
|
'defList': [
|
|
|
|
|
// 旺季
|
|
|
|
|
{
|
|
|
|
|
'useDateList': [
|
|
|
|
|
{
|
|
|
|
|
'useDate': [
|
|
|
|
|
dayjs().add(1, 'year').startOf('y'), dayjs().add(1, 'year').endOf('y')
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
'unitId': '0',
|
|
|
|
|
'currency': 'RMB',
|
|
|
|
@ -56,9 +60,13 @@ const batchSetupInitialValues = {
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
// 淡季
|
|
|
|
|
{
|
|
|
|
|
'useDateList': [
|
|
|
|
|
{
|
|
|
|
|
'useDate': [
|
|
|
|
|
dayjs().add(1, 'year').subtract(2, 'M').startOf('M'), dayjs().add(1, 'year').endOf('M')
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
'unitId': '0',
|
|
|
|
|
'currency': 'RMB',
|
|
|
|
@ -111,17 +119,16 @@ const defaultPriceValue = {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const defaultUseDate = {
|
|
|
|
|
'useDate': [dayjs().add(1, 'year').startOf('y'), dayjs().add(1, 'year').endOf('y')]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const defaultDefinitionValue = {
|
|
|
|
|
'useDate': [
|
|
|
|
|
dayjs().add(1, 'year').subtract(2, 'M').startOf('M'), dayjs().add(1, 'year').endOf('M')
|
|
|
|
|
],
|
|
|
|
|
'useDateList': [defaultUseDate],
|
|
|
|
|
'unitId': '0',
|
|
|
|
|
'currency': 'RMB',
|
|
|
|
|
'weekend': [
|
|
|
|
|
],
|
|
|
|
|
'priceList': [
|
|
|
|
|
defaultPriceValue
|
|
|
|
|
]
|
|
|
|
|
'weekend': [],
|
|
|
|
|
'priceList': [defaultPriceValue]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ProductInfoQuotation = ({ editable, ...props }) => {
|
|
|
|
@ -306,9 +313,25 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
|
|
|
|
|
options={['5', '6', '7']}
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label='有效期' name={[field.name, 'useDate']}>
|
|
|
|
|
<Form.Item label='有效期'>
|
|
|
|
|
<Form.List name={[field.name, 'useDateList']}>
|
|
|
|
|
{(useDateFieldList, useDateOptList) => (
|
|
|
|
|
<Flex gap='middle' vertical>
|
|
|
|
|
{useDateFieldList.map((useDateField, index) => (
|
|
|
|
|
<Space key={useDateField.key}>
|
|
|
|
|
<Form.Item noStyle name={[useDateField.name, 'useDate']}>
|
|
|
|
|
<RangePicker style={{ width: '100%' }} allowClear={true} inputReadOnly={true} presets={datePresets} placeholder={['From', 'Thru']} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
{index == 0 ? <StarTwoTone twoToneColor='#eb2f96' /> : <CloseOutlined onClick={() => useDateOptList.remove(useDateField.name)} />}
|
|
|
|
|
</Space>
|
|
|
|
|
))}
|
|
|
|
|
<Button type='dashed' icon={<PlusOutlined />} onClick={() => useDateOptList.add(defaultUseDate)} block>
|
|
|
|
|
新增有效期
|
|
|
|
|
</Button>
|
|
|
|
|
</Flex>
|
|
|
|
|
)}
|
|
|
|
|
</Form.List>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label='人等'>
|
|
|
|
|
<Form.List name={[field.name, 'priceList']}>
|
|
|
|
|
{(priceFieldList, priceOptList) => (
|
|
|
|
@ -336,6 +359,13 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
|
|
|
|
|
</Flex>
|
|
|
|
|
)}
|
|
|
|
|
</Form.List>
|
|
|
|
|
<Form.Item noStyle shouldUpdate>
|
|
|
|
|
{() => (
|
|
|
|
|
<Typography>
|
|
|
|
|
<pre>{JSON.stringify(batchSetupForm.getFieldsValue(), null, 2)}</pre>
|
|
|
|
|
</Typography>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|