todo: form tooltip

perf/export-docx
Lei OT 11 months ago
parent 0601729c92
commit 7c85e61f78

@ -116,5 +116,26 @@
"Weekdays": "Weekdays" "Weekdays": "Weekdays"
}, },
"FormTooltip": {
"Type": "Product Type",
"Title": "Title",
"Code": "Code",
"City": "City",
"Dept": "Department",
"Duration": "Duration",
"RecommendsRate": "RecommendsRate",
"OpenHours": "Open Hours",
"OpenWeekdays": "Open Weekdays",
"DisplayToC": "Display Type",
"KM": "KM",
"Description": "Description",
"Remarks": "Remarks"
},
"LgcModal": {
"title": "Add language",
"placeholder": "Pick a language"
},
"#": "Product" "#": "Product"
} }

@ -104,5 +104,25 @@
"Weekdays": "周末", "Weekdays": "周末",
"Operation": "Operation" "Operation": "Operation"
}, },
"FormTooltop": {
"Type": "Product Type",
"Title": "Title",
"Code": "Code",
"City": "City",
"dept": "Department",
"Duration": "Duration",
"RecommendsRate": "RecommendsRate",
"OpenHours": "Open Hours",
"OpenWeekdays": "Open Weekdays",
"DisplayToC": "Display Type",
"KM": "KM",
"Description": "Description",
"Remarks": "Remarks"
},
"LgcModal": {
"title": "添加语种",
"placeholder": "选择语种"
},
"#": "产品" "#": "产品"
} }

@ -10,7 +10,7 @@ import { useDefaultLgc } from '@/i18n/LanguageSwitcher';
import dayjs from 'dayjs' import dayjs from 'dayjs'
export const NewProductsForm = ({ initialValues, onFormInstanceReady, ...props }) => { export const NewProductsForm = ({ initialValues, onFormInstanceReady, ...props }) => {
const { t } = useTranslation(); const { t } = useTranslation('products');
const [form] = Form.useForm(); const [form] = Form.useForm();
useEffect(() => { useEffect(() => {
@ -21,10 +21,10 @@ export const NewProductsForm = ({ initialValues, onFormInstanceReady, ...props }
return ( return (
<Form layout='horizontal' form={form} name='new_product_in_modal' initialValues={initialValues} onValuesChange={onValuesChange}> <Form layout='horizontal' form={form} name='new_product_in_modal' initialValues={initialValues} onValuesChange={onValuesChange}>
<Form.Item name={`products_type`} label={t('products:ProductType')} rules={[{ required: true }]}> <Form.Item name={`products_type`} label={t('products:ProductType')} rules={[{ required: true }]} tooltip={t('FormTooltip.Type')}>
<ProductsTypesSelector maxTagCount={1} mode={null} placeholder={t('All')} /> <ProductsTypesSelector maxTagCount={1} mode={null} placeholder={t('All')} />
</Form.Item> </Form.Item>
<Form.Item name={`title`} label={t('products:Title')} rules={[{ required: true }]} > <Form.Item name={`title`} label={t('products:Title')} rules={[{ required: true }]} tooltip={t('FormTooltip.Title')}>
<Input /> <Input />
</Form.Item> </Form.Item>
</Form> </Form>

@ -176,7 +176,7 @@ function getFields(props) {
item( item(
'title', 'title',
99, 99,
<Form.Item name='title' label={t('Title')} {...fieldProps.title} rules={[{ required: true }]}> <Form.Item name='title' label={t('Title')} {...fieldProps.title} rules={[{ required: true }]} tooltip={t('FormTooltip.Title')}>
<Input allowClear {...fieldComProps.title} {...styleProps} {...editableProps('title')} /> <Input allowClear {...fieldComProps.title} {...styleProps} {...editableProps('title')} />
</Form.Item>, </Form.Item>,
fieldProps?.title?.col || midCol fieldProps?.title?.col || midCol
@ -184,7 +184,7 @@ function getFields(props) {
item( item(
'code', 'code',
99, 99,
<Form.Item name='code' label={t('Code')} {...fieldProps.code} rules={[{ required: true }]}> <Form.Item name='code' label={t('Code')} {...fieldProps.code} rules={[{ required: true }]} tooltip={t('FormTooltip.Code')}>
<Input allowClear {...fieldComProps.code} {...styleProps} {...editableProps('code')} /> <Input allowClear {...fieldComProps.code} {...styleProps} {...editableProps('code')} />
</Form.Item>, </Form.Item>,
fieldProps?.code?.col || midCol fieldProps?.code?.col || midCol
@ -192,7 +192,7 @@ function getFields(props) {
item( item(
'city', 'city',
99, 99,
<Form.Item name='city' label={t('City')} {...fieldProps.city}> <Form.Item name='city' label={t('City')} {...fieldProps.city} tooltip={t('FormTooltip.City')}>
<CitySelector {...styleProps} {...editableProps('city_id')} /> <CitySelector {...styleProps} {...editableProps('city_id')} />
</Form.Item>, </Form.Item>,
fieldProps?.city?.col || midCol fieldProps?.city?.col || midCol
@ -208,7 +208,7 @@ function getFields(props) {
item( item(
'duration', 'duration',
99, 99,
<Form.Item name='duration' label={t('Duration')} {...fieldProps.duration}> <Form.Item name='duration' label={t('Duration')} {...fieldProps.duration} tooltip={t('FormTooltip.Duration')}>
<InputNumber suffix={'H'} max={24} {...styleProps} {...editableProps('duration')} /> <InputNumber suffix={'H'} max={24} {...styleProps} {...editableProps('duration')} />
{/* <Input allowClear {...fieldComProps.duration} suffix={'H'} /> */} {/* <Input allowClear {...fieldComProps.duration} suffix={'H'} /> */}
</Form.Item>, </Form.Item>,
@ -217,7 +217,7 @@ function getFields(props) {
item( item(
'km', 'km',
99, 99,
<Form.Item name='km' label={t('KM')} {...fieldProps.km}> <Form.Item name='km' label={t('KM')} {...fieldProps.km} tooltip={t('FormTooltip.KM')}>
<InputNumber suffix={'KM'} min={0.1} {...styleProps} {...editableProps('km')} /> <InputNumber suffix={'KM'} min={0.1} {...styleProps} {...editableProps('km')} />
</Form.Item>, </Form.Item>,
fieldProps?.km?.col || midCol fieldProps?.km?.col || midCol
@ -225,7 +225,7 @@ function getFields(props) {
item( item(
'recommends_rate', 'recommends_rate',
99, 99,
<Form.Item name='recommends_rate' label={t('RecommendsRate')} {...fieldProps.recommends_rate}> <Form.Item name='recommends_rate' label={t('RecommendsRate')} {...fieldProps.recommends_rate} tooltip={t('FormTooltip.RecommendsRate')}>
{/* <Input placeholder={t('RecommendsRate')} allowClear /> */} {/* <Input placeholder={t('RecommendsRate')} allowClear /> */}
<Select <Select
{...styleProps} {...styleProps}
@ -250,6 +250,7 @@ function getFields(props) {
name='display_to_c' name='display_to_c'
label={t('DisplayToC')} label={t('DisplayToC')}
{...fieldProps.display_to_c} {...fieldProps.display_to_c}
tooltip={t('FormTooltip.DisplayToC')}
// rules={[ // rules={[
// () => ({ // () => ({
// validator(_, value) { // validator(_, value) {
@ -283,7 +284,7 @@ function getFields(props) {
item( item(
'open_weekdays', 'open_weekdays',
99, 99,
<Form.Item name='open_weekdays' label={t('OpenWeekdays')} {...fieldProps.open_weekdays}> <Form.Item name='open_weekdays' label={t('OpenWeekdays')} {...fieldProps.open_weekdays} tooltip={t('FormTooltip.OpenWeekdays')}>
<Checkbox.Group options={dataSets.weekdays} {...styleProps} {...editableProps('open_weekdays')} /> <Checkbox.Group options={dataSets.weekdays} {...styleProps} {...editableProps('open_weekdays')} />
</Form.Item>, </Form.Item>,
fieldProps?.open_weekdays?.col || 24 fieldProps?.open_weekdays?.col || 24
@ -291,7 +292,7 @@ function getFields(props) {
item( item(
'remarks', 'remarks',
99, 99,
<Form.Item name='remarks' label={t('Remarks')} {...fieldProps.remarks}> <Form.Item name='remarks' label={t('Remarks')} {...fieldProps.remarks} tooltip={t('FormTooltip.Remarks')}>
<Input.TextArea allowClear rows={2} maxLength={2000} {...fieldComProps.remarks} {...styleProps} {...editableProps('remarks')} /> <Input.TextArea allowClear rows={2} maxLength={2000} {...fieldComProps.remarks} {...styleProps} {...editableProps('remarks')} />
</Form.Item>, </Form.Item>,
fieldProps?.remarks?.col || 24 fieldProps?.remarks?.col || 24

@ -7,7 +7,7 @@ import { useDefaultLgc } from '@/i18n/LanguageSwitcher';
import { cloneDeep, isEmpty, isNotEmpty } from '@/utils/commons'; import { cloneDeep, isEmpty, isNotEmpty } from '@/utils/commons';
const ProductInfoLgc = ({ editable, formInstance, ...props }) => { const ProductInfoLgc = ({ editable, formInstance, ...props }) => {
const { t } = useTranslation(); const { t } = useTranslation('products');
const { language: languageHT } = useDefaultLgc(); const { language: languageHT } = useDefaultLgc();
const HTLanguageSetsMapVal = useHTLanguageSetsMapVal(); const HTLanguageSetsMapVal = useHTLanguageSetsMapVal();
const allLgcOptions = useHTLanguageSets(); const allLgcOptions = useHTLanguageSets();
@ -25,7 +25,7 @@ const ProductInfoLgc = ({ editable, formInstance, ...props }) => {
forceRender: true, forceRender: true,
children: ( children: (
<Form.Item noStyle> <Form.Item noStyle>
<Form.Item name={['lgc_details_mapped', `${ele.lgc}`, 'title']} label={t('products:Title')} initialValue={ele.title} rules={[{ required: true }]}> <Form.Item name={['lgc_details_mapped', `${ele.lgc}`, 'title']} label={t('products:Title')} initialValue={ele.title} rules={[{ required: true }]} tooltip={t('FormTooltip.Title')}>
<Input <Input
className={' !text-slate-600'} className={' !text-slate-600'}
allowClear allowClear
@ -35,7 +35,7 @@ const ProductInfoLgc = ({ editable, formInstance, ...props }) => {
disabled={!editable} disabled={!editable}
/> />
</Form.Item> </Form.Item>
<Form.Item name={['lgc_details_mapped', `${ele.lgc}`, 'description']} label={t('products:Description')} initialValue={ele.descriptions}> <Form.Item name={['lgc_details_mapped', `${ele.lgc}`, 'description']} label={t('products:Description')} initialValue={ele.descriptions} tooltip={t('FormTooltip.Description')}>
<Input.TextArea <Input.TextArea
className={'!text-slate-600'} className={'!text-slate-600'}
rows={3} rows={3}
@ -86,10 +86,10 @@ const ProductInfoLgc = ({ editable, formInstance, ...props }) => {
key: lgcItem.value, key: lgcItem.value,
children: ( children: (
<Form.Item noStyle> <Form.Item noStyle>
<Form.Item name={['lgc_details_mapped', `${lgcItem.value}`, 'title']} preserve={false} label={t('products:Title')} rules={[{ required: true }]}> <Form.Item name={['lgc_details_mapped', `${lgcItem.value}`, 'title']} preserve={false} label={t('products:Title')} rules={[{ required: true }]} tooltip={t('FormTooltip.Title')}>
<Input allowClear /> <Input allowClear />
</Form.Item> </Form.Item>
<Form.Item name={['lgc_details_mapped', `${lgcItem.value}`, 'description']} preserve={false} label={t('products:Description')}> <Form.Item name={['lgc_details_mapped', `${lgcItem.value}`, 'description']} preserve={false} label={t('products:Description')} tooltip={t('FormTooltip.Description')}>
<Input.TextArea rows={3} allowClear /> <Input.TextArea rows={3} allowClear />
</Form.Item> </Form.Item>
<Form.Item hidden name={['lgc_details_mapped', `${lgcItem.value}`, 'lgc']} preserve={false} initialValue={lgcItem.value}> <Form.Item hidden name={['lgc_details_mapped', `${lgcItem.value}`, 'lgc']} preserve={false} initialValue={lgcItem.value}>
@ -159,12 +159,12 @@ const ProductInfoLgc = ({ editable, formInstance, ...props }) => {
hideAdd={isEmpty(lgcOptions) || !editable} hideAdd={isEmpty(lgcOptions) || !editable}
tabPosition='top' tabPosition='top'
/> />
<Modal title={'选择语言'} open={newLgcModalVisible} onOk={handleOk} onCancel={() => setNewLgcModalVisible(false)}> <Modal title={t('LgcModal.title')} open={newLgcModalVisible} onOk={handleOk} onCancel={() => setNewLgcModalVisible(false)} destroyOnClose>
<Select <Select
showSearch showSearch
labelInValue labelInValue
style={{ width: '80%' }} style={{ width: '80%' }}
placeholder='选择语言' placeholder={t('LgcModal.placeholder')}
optionFilterProp='children' optionFilterProp='children'
options={lgcOptions} options={lgcOptions}
onChange={onSelectNewLgc} onChange={onSelectNewLgc}

Loading…
Cancel
Save