Commit bc51e5a0 authored by 前端-许佳敏's avatar 前端-许佳敏

修改table组件

parent 638832e9
......@@ -40,7 +40,7 @@
"braft-editor": "^2.3.9",
"classnames": "^2.2.6",
"core-js": "^3.6.5",
"god": "^0.1.26",
"god": "^0.1.28",
"lingxi-design": "^1.0.7",
"lingxi-design-ui": "^1.1.0",
"lingxi-editor-core": "^1.0.6",
......
......@@ -2,17 +2,26 @@ import React, { ReactText, useRef, useEffect } from 'react'
import {StandardTable} from 'god'
import { IStandardTableProps } from 'god/dist/src/standard-table'
import { Row, Col, Modal } from 'antd'
import { productModalSchema, productModalByMemberSchema, memberModalSchema, inquirySchema, demandSchema,enquirySchema, mergeOrderSchema } from './schema'
import Search from '../NiceForm/components/Search'
import SearchSelect from '../NiceForm/components/SearchSelect'
import Submit from '../NiceForm/components/Submit'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import DateSelect from '../NiceForm/components/DateSelect'
export interface ModalTableProps extends IStandardTableProps<any> {
width?: number,
modalTitle?: ReactText,
confirm?(),
cancel?(),
visible?: boolean
visible?: boolean,
resetModal?: object,
modalType?: 'productByDefault' | 'productByMember' | 'memberByDefault' | 'inquiryByDefault' | 'demandByDefault' | 'enquiryModel' | 'MergeOrderByDefault' | 'none'
}
const ModalTable:React.FC<ModalTableProps> = (props) => {
const { width = 704,modalTitle, confirm, cancel, visible, currentRef, ...resetTable } = props
const { width = 704,modalTitle, confirm, cancel, visible, currentRef, resetModal, modalType = 'none', ...resetTable } = props
const selfRef = currentRef || useRef<any>({})
useEffect(() => {
if (visible) {
......@@ -24,6 +33,39 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
})
}
}, [visible, selfRef.current])
const modelSchemaRender = () => {
switch (modalType) {
case 'productByDefault': {
return productModalSchema
}
case 'productByMember': {
return productModalByMemberSchema
}
case 'memberByDefault': {
return memberModalSchema
}
case 'inquiryByDefault': {
return inquirySchema
}
case 'enquiryModel':{
return enquirySchema
}
case 'demandByDefault': {
return demandSchema
}
case 'MergeOrderByDefault': {
return mergeOrderSchema
}
case 'none': {
return {}
}
}
}
return (
<Modal
width={width}
......@@ -31,14 +73,31 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
onOk={confirm}
onCancel={cancel}
visible={visible}
{...resetModal}
>
<StandardTable
tableType='small'
currentRef={selfRef}
formRender={(child, ps) => <Row justify='space-between'>
<Col>{child}</Col>
<Col span={18}>{child}</Col>
<Col style={{marginTop: 4}}>{ps}</Col>
</Row>}
formilyProps={
modalType === 'none' ? null : {
ctx: {
schema: modelSchemaRender(),
components: { ModalSearch: Search, SearchSelect, Submit, DateSelect } ,
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
);
}
}
}
}
{...resetTable}
>
</StandardTable>
......
import { ISchema } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const productModalByMemberSchema: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '请输入商品名称/ID',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
categoryId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCustomerCategory,
style: {
width: 160
}
}
},
brandId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品牌',
fetchSearch: PublicApi.getProductSelectGetSelectBrand,
style: {
width: 160
}
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
export const productModalSchema: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '请输入商品名称/ID',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
categoryId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
style: {
width: 160
}
}
},
brandId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品牌',
fetchSearch: PublicApi.getProductSelectGetSelectBrand,
style: {
width: 160
}
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
export const memberModalSchema: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
"x-component": 'Search',
"x-component-props": {
placeholder: '请输入会员名称'
}
}
}
}
export const inquirySchema: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '报价单号/需求单号/报价单摘要',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
// @todo 需调整字段名
categoryId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '报价会员(全部)',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
style: {
width: 160
}
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: 'string',
"x-component": "dateSelect",
"x-component-props": {
placeholder: '单据时间(全部)',
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
/**
* @description: 新增报价单 需求单查询
* @param {type}
* @return {type}
*/
export const enquirySchema: ISchema = {
type: 'object',
properties: {
keywords: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '需求单号/需求单摘要',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
// @todo 需调整字段名
demandMembers: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '需求会员(全部)',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
style: {
width: 160
}
}
},
"[startVoucherTime,endVoucherTime]": {
type: 'string',
"x-component": "dateSelect",
"x-component-props": {
placeholder: '单据时间(全部)',
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
export const demandSchema: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '报价单号/需求单号/报价单摘要',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
// @todo 需调整字段名
categoryId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '报价会员(全部)',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
style: {
width: 160
}
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: 'string',
"x-component": "dateSelect",
"x-component-props": {
placeholder: '单据时间(全部)',
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
export const mergeOrderSchema: ISchema = {
type: 'object',
properties: {
keywords: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '订单号/订单摘要',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
// @todo 需调整字段名
name: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '供应会员(全部)',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
style: {
width: 160
}
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: 'string',
"x-component": "dateSelect",
"x-component-props": {
placeholder: '单据时间(全部)',
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
\ No newline at end of file
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