import { useEffect } from 'react'; import { Form, Input, Row, Col, Select, DatePicker, Space, Button, Checkbox } from 'antd'; import { objectMapper, at } from '@/utils/commons'; import { DATE_FORMAT, SMALL_DATETIME_FORMAT } from '@/config'; import useFormStore from '@/stores/Form'; import { useDatePresets } from '@/hooks/useDatePresets'; import { useProductsTypes } from '@/hooks/useProductsSets'; import { useTranslation } from 'react-i18next'; import { fetchJSON } from '@/utils/request'; import { HT_HOST } from '@/config'; import SearchInput from './SearchInput'; import AuditStateSelector from './AuditStateSelector'; import DeptSelector from './DeptSelector'; //供应商列表 export const fetchVendorList = async (q) => { const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/VendorList`, { q }) return errcode !== 0 ? [] : result } const { RangePicker } = DatePicker; export const SelectProductsTypes = ({...props}) => { const productsTypes = useProductsTypes(); const { t } = useTranslation(); return ( <> , fieldProps?.keyword?.col || 6 ), item( 'referenceNo', 99, , fieldProps?.referenceNo?.col || 6 ), item( 'PNR', 99, , fieldProps?.PNR?.col || 4 ), item( 'invoiceStatus', 99, , fieldProps?.username?.col || 4 ), item( 'realname', 99, , fieldProps?.realname?.col || 4 ), /** * */ item( 'year', 99, , fieldProps?.year?.col || 3 ), item( 'agency', 99, , fieldProps?.agency?.col || 6 ), item( 'audit_state', 99, , fieldProps?.audit_state?.col || 3 ), item( 'products_types', 99, , fieldProps?.products_types?.col || 6 ), item( 'dept', 99, , fieldProps?.dept?.col || 6 ), item( 'unconfirmed', 99, {t('group:unconfirmed')} , fieldProps?.unconfirmed?.col || 2 ), ]; baseChildren = baseChildren .map((x) => { x.hide = false; if (props.sort === undefined) { return x; } const tmpSort = props.sort; for (const key in tmpSort) { if (Object.prototype.hasOwnProperty.call(tmpSort, key)) { if (x.name === key) { x.sort = tmpSort[key]; } } } return x; }) .map((x) => { if (props.hides.length === 0 && props.shows.length === 0) { return x; } if (props.hides.length === 0) { x.hide = !props.shows.includes(x.name); } else if (props.shows.length === 0) { x.hide = props.hides.includes(x.name); } return x; }) .filter((x) => !x.hide) .sort((a, b) => { return a.sort < b.sort ? -1 : 1; }); const children = []; const leftStyle = {}; // { borderRight: '1px solid #dedede' }; for (let i = 0; i < baseChildren.length; i++) { let style = {}; // { padding: '0px 2px' }; style = i % 2 === 0 && baseChildren[i].col === 12 ? { ...style, ...leftStyle } : style; style = !baseChildren[i].hide ? { ...style, display: 'block' } : { ...style, display: 'none' }; const Item = ( {baseChildren[i].render} ); children.push(Item); } return children; } export default SearchForm;