Commit 3d478a44 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

🐞 fix: 修改商品询价 询价报价等状态

parent 28f5f6f4
import React, { useRef, useState, useImperativeHandle } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card } from 'antd';
import { StandardTable } from 'god';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ColumnType } from 'antd/lib/table/interface';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { searchSelectGetSelectCategoryOptionEffect } from '@/pages/transaction/effect/index';
import { useLinkageUtils } from '@/utils/formEffectUtils';
const { onFormMount$ } = FormEffectHooks
interface Iprops {
/** 列表接口 */
fetch?: () => Promise<unknown>,
/** 多选返回 */
fetchRowkeys?(e: any),
/** 操作按钮 */
controllerBtns?: React.ReactNode,
/** 搜索的schema */
schema?: any,
/** 列表表头 */
columns: ColumnType<any>[],
/** schema搜索第一个的name */
effects?: string,
/** 是否多选 */
selectedRow?: boolean,
/** 刷新 */
reload?: any,
/** 外部状态接口 */
externalStatusFetch?: Promise<unknown>,
/** 内部状态接口 */
interiorStatusFetch?: Promise<unknown>,
}
const formActions = createFormActions();
const Table: React.FC<Iprops> = (props: any) => {
const {
schema,
columns,
effects,
fetch,
controllerBtns,
selectedRow,
reload,
fetchRowkeys,
externalStatusFetch,
interiorStatusFetch
} = props;
const tableRef = useRef<any>({});
/** 列表数据 */
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
fetch({ ...params }).then(res => {
resolve(res.data)
})
})
}
/**多选 */
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([]);
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
fetchRowkeys(selectedRowKeys)
setSelectedRowKeys(selectedRowKeys);
},
}
useImperativeHandle(reload, () => ({
reload: () => {
tableRef.current.reload();
}
}));
// 搜索
const search = (values: any) => {
tableRef.current.reload(values)
}
const useBusinessEffects = () => {
const linkage = useLinkageUtils();
onFormMount$().subscribe(() => {
externalStatusFetch && externalStatusFetch.then(res => {
const _enum = res.data.map((item) => {return { label: item.name, value: item.state}})
linkage.enum('externalState',_enum)
linkage.enum('externalStatusList',_enum)
})
interiorStatusFetch && interiorStatusFetch.then(res => {
const _enum = res.data.map((item) => {return { label: item.name, value: item.state}})
linkage.enum('interiorState',_enum)
linkage.enum('innerStatusList',_enum)
})
})
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
currentRef={tableRef}
columns={columns}
tableProps={{ rowKew: 'id' }}
rowSelection={selectedRow && rowSelection}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
expressionScope={{ controllerBtns }}
onSubmit={values => search(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, effects, FORM_FILTER_PATH)
FormEffectHooks.onFieldChange$('category').subscribe(state => {
searchSelectGetSelectCategoryOptionEffect(actions, 'category')
})
useBusinessEffects();
}}
schema={schema}
>
</NiceForm>
}
/>
</Card>
</PageHeaderWrapper>
)
}
export default Table;
import React, { useState, useEffect } from 'react';
import { Form, Input, Button } from 'antd';
import { Form, Input, Button, Tag, Badge } from 'antd';
import styles from './index.less';
import { LinkOutlined } from '@ant-design/icons';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { ISchema } from '@formily/antd';
import ModalTable from '@/components/ModalTable'
import { PublicApi } from '@/services/api'
import { history } from 'umi'
import { quoteOrderInternalState, inquiryQuoteOuterState } from '../../../common/tableStatusList';
import moment from 'moment';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from '../../components/stateColor';
const layout: any = {
colon: false,
......@@ -178,10 +177,10 @@ const BasicInfo: React.FC<queryProps> = (props) => {
<span>{(Object.keys(editData).length > 0 && editData.voucherTime) ? format(editData.voucherTime) : '-'}</span>
</Form.Item>
<Form.Item label='外部状态' name='external'>
<span>{(Object.keys(editData).length > 0 && editData.externalState) ? inquiryQuoteOuterState(editData.externalState) : '-'}</span>
<span>{(Object.keys(editData).length > 0 && editData.externalState) ? <Tag color={EXTERNALSTATE_COLOR[editData.externalState]}>{editData.externalStateName}</Tag> : '-'}</span>
</Form.Item>
<Form.Item label='内部状态' name='internal'>
<span>{(Object.keys(editData).length > 0 && editData.interiorState) ? quoteOrderInternalState(editData.interiorState) : '-'}</span>
<span>{(Object.keys(editData).length > 0 && editData.interiorState) ? <Badge status={INTERNALSTATE_COLOR[editData.interiorState]} text={editData.interiorStateName} /> : '-'}</span>
</Form.Item>
</Form>
{/* 选择会员弹框 */}
......
import React, { useEffect, useState } from 'react';
import styles from './index.less';
import { Radio } from 'antd';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
import moment from 'moment';
import GeneralExternalState from '@/pages/transaction/common/externalState';
import GeneralInteriorState from '@/pages/transaction/common/interiorState';
import { PublicApi } from '@/services/api';
export interface parmas {
editData?: any
}
const FlowRecord: React.FC<parmas> = (props) => {
const { editData } = props;
const [radio, setRadio] = useState<string>('outer'); //切换单据
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const outerColumns: EditableColumns[] = [{
title: '序号',
dataIndex: 'id',
}, {
title: '操作角色',
dataIndex: 'roleName',
}, {
title: '状态',
dataIndex: 'state',
render: (text: any, record: any) => <GeneralExternalState colorType={2} state={text} data={externalState} />
}, {
title: '操作',
dataIndex: 'operation',
}, {
title: '操作时间',
dataIndex: 'operationTime',
render: (text: any, record: any) => format(text)
}, {
title: '审核意见',
dataIndex: 'auditOpinion',
}]
const insideColumns: EditableColumns[] = [{
title: '序号',
dataIndex: 'id',
}, {
title: '操作人',
dataIndex: 'roleName',
}, {
title: '部门',
dataIndex: 'department',
}, {
title: '职位',
dataIndex: 'position',
}, {
title: '状态',
dataIndex: 'state',
render: (text: any, record: any) => <GeneralInteriorState colorType={2} state={text} data={interiorState} />
}, {
title: '操作',
dataIndex: 'operation',
}, {
title: '操作时间',
dataIndex: 'operationTime',
render: (text: any, record: any) => format(text)
}, {
title: '审核意见',
dataIndex: 'auditOpinion',
}]
const onChange = (e: any) => {
setRadio(e.target.value)
}
const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]);
useEffect(() => {
const external = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用外部状态
PublicApi.getOrderProductInquiryExternalStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
const interior = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用内部状态
PublicApi.getOrderProductInquiryInteriorStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
Promise.all([external,interior]).then(res => {
setExternalState(res[0])
setInteriorState(res[1])
})
},[])
return (
<div className={styles.revise_style}>
<Radio.Group defaultValue="outer" buttonStyle="solid" onChange={onChange}>
<Radio.Button value="outer">外部单据</Radio.Button>
<Radio.Button value="inside">内部单据</Radio.Button>
</Radio.Group>
{radio === 'outer' ?
<PolymericTable
dataSource={editData.externalInquiryListLogResponses}
columns={outerColumns}
loading={false}
pagination={null}
/>
:
<PolymericTable
dataSource={editData.interiorInquiryListLogResponses}
columns={insideColumns}
loading={false}
pagination={null}
/>
}
</div>
)
}
export default FlowRecord
import React, { useState } from 'react';
import styles from './index.less';
import { Radio, Tag } from 'antd';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
import moment from 'moment';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from '../../components/stateColor';
export interface parmas {
editData?: any
}
const FlowRecord: React.FC<parmas> = (props) => {
const { editData } = props;
const [radio, setRadio] = useState<string>('outer'); //切换单据
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const outerColumns: EditableColumns[] = [{
title: '序号',
dataIndex: 'id',
}, {
title: '操作角色',
dataIndex: 'roleName',
}, {
title: '状态',
dataIndex: 'state',
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.stateName}</Tag>
}, {
title: '操作',
dataIndex: 'operation',
}, {
title: '操作时间',
dataIndex: 'operationTime',
render: (text: any, record: any) => format(text)
}, {
title: '审核意见',
dataIndex: 'auditOpinion',
}]
const insideColumns: EditableColumns[] = [{
title: '序号',
dataIndex: 'id',
}, {
title: '操作人',
dataIndex: 'roleName',
}, {
title: '部门',
dataIndex: 'department',
}, {
title: '职位',
dataIndex: 'position',
}, {
title: '状态',
dataIndex: 'state',
render: (text: any, record: any) => <Tag color={INTERNALSTATE_COLOR[text]}>{record.stateName}</Tag>
}, {
title: '操作',
dataIndex: 'operation',
}, {
title: '操作时间',
dataIndex: 'operationTime',
render: (text: any, record: any) => format(text)
}, {
title: '审核意见',
dataIndex: 'auditOpinion',
}]
const onChange = (e: any) => {
setRadio(e.target.value)
}
return (
<div className={styles.revise_style}>
<Radio.Group defaultValue="outer" buttonStyle="solid" onChange={onChange}>
<Radio.Button value="outer">外部单据</Radio.Button>
<Radio.Button value="inside">内部单据</Radio.Button>
</Radio.Group>
{radio === 'outer' ?
<PolymericTable
dataSource={editData.externalInquiryListLogResponses}
columns={outerColumns}
loading={false}
pagination={null}
/>
:
<PolymericTable
dataSource={editData.interiorInquiryListLogResponses}
columns={insideColumns}
loading={false}
pagination={null}
/>
}
</div>
)
}
export default FlowRecord
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const ADDINQUIRYORDERSCHEMA: ISchema = {
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: "object",
"x-component": "Children",
"x-component-props": {
children: "{{controllerBtns}}"
}
},
inquiryListNo: {//报价单号
type: "string",
"x-component": "Search",
"x-mega-props": {},
"x-component-props": {
placeholder: "询价单号"
}
}
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: "nowrap"
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
details: {
type: "string",
"x-component-props": {
placeholder: "询价单摘要"
}
},
memberName: {
type: "string",
"x-component-props": {
placeholder: "被询价会员"
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
}
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}
/** 内部状态颜色 */
export const EXTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "success",
5: "error",
}
/** 外部状态颜色 */
export const INTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "default",
5: "success",
6: "error",
7: "error",
}
import React, { useState, useEffect } from 'react';
import style from './index.less';
import { history } from 'umi';
import { Button, Tabs, Steps, Table, Popconfirm } from 'antd';
import { Button, Tabs, Steps, Table, Popconfirm, Tag, Badge } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { CheckSquareOutlined, LinkOutlined } from '@ant-design/icons'
import { PageHeaderWrapper } from '@ant-design/pro-layout';
......@@ -11,6 +11,7 @@ import { PublicApi } from '@/services/api';
import GeneralExternalState from '@/pages/transaction/common/externalState';
import GeneralInteriorState from '@/pages/transaction/common/interiorState';
import EyePreview from '@/components/EyePreview';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from './stateColor';
const { TabPane } = Tabs;
const { Step } = Steps;
......@@ -140,7 +141,7 @@ const Details: React.FC<parmas> = (props) => {
title: '状态',
key: 'state',
dataIndex: 'state',
render: (text: any, record: any) => <GeneralExternalState colorType={2} state={text} data={externalState} />
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.stateName}</Tag>
}, {
title: '操作',
key: 'operation',
......@@ -176,7 +177,7 @@ const Details: React.FC<parmas> = (props) => {
title: '状态',
key: 'state',
dataIndex: 'state',
render: (text: any, record: any) => <GeneralInteriorState colorType={2} state={text} data={interiorState} />
render: (text: any, record: any) => <Tag color={INTERNALSTATE_COLOR[text]}>{record.stateName}</Tag>
}, {
title: '操作',
key: 'operation',
......@@ -224,31 +225,6 @@ const Details: React.FC<parmas> = (props) => {
window.location.href = `/api/order/contractTemplate/downloadContract?contractName=${file.name}&contractUrl=${file.url}`
}
const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]);
useEffect(() => {
const external = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用外部状态
PublicApi.getOrderProductInquiryExternalStateEnum().then((res: any) => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
const interior = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用内部状态
PublicApi.getOrderProductInquiryInteriorStateEnum().then((res: any) => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
Promise.all([external, interior]).then(res => {
setExternalState(res[0])
setInteriorState(res[1])
})
}, [])
const handleSubmit = () => {
const value = {
id,
......@@ -307,16 +283,16 @@ const Details: React.FC<parmas> = (props) => {
<div className={style['headerMain-left']}>
<div className={style['headerMain-left-option']}>
<div>询价会员:</div>
<div><a>{data.memberName}</a> </div>
<div><a>{data.inquiryListMemberName}</a> </div>
</div>
{headerWrapperData && headerWrapperData.map(item => (
<div key={item.name} className={style['headerMain-left-option']}>
<div>{item.label}</div>
<div>
{item.name === 'externalState' ?
<GeneralExternalState colorType={2} state={item.value} data={externalState} /> :
<Tag color={INTERNALSTATE_COLOR[item.value]}>{data.externalStateName}</Tag> :
item.name === 'interiorState' ?
<GeneralInteriorState colorType={2} state={item.value} data={interiorState} /> :
<Badge status={INTERNALSTATE_COLOR[item.value]} text={data.interiorStateName} /> :
item.name === 'voucherTime' ? format(item.value) : item.value}
</div>
</div>
......
/** 内部状态颜色 */
export const EXTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "success",
5: "error",
}
/** 外部状态颜色 */
export const INTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "default",
5: "success",
6: "error",
7: "error",
}
import React, { useRef, useEffect, useState } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card } from 'antd';
import { StandardTable } from 'god';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { enquieryOfferSearchSchema } from '../schema';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import {searchSelectGetSelectCategoryOptionEffect} from '../../effect/index'
import React, { useRef } from 'react';
import Table from '@/pages/transaction/components/TableLayout';
import { Tag, Badge } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview';
import { timeRange } from '@/utils/index';
import moment from 'moment'
import moment from 'moment';
import { PublicApi } from '@/services/api';
import GeneralExternalState from '@/pages/transaction/common/externalState';
import GeneralInteriorState from '@/pages/transaction/common/interiorState';
import { INQUIRYSEARCHSCHEMA } from './schema';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from '../components/stateColor';
const EnquiryOrder = () => {
const reload = useRef<any>({});
const formActions = createFormActions();
const EnquiryOrder: React.FC<{}> = (props) => {
const ref = useRef<any>({});
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const columns: ColumnType<any>[] = [{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/goodsOffer/enquiryOrder/preview?id=${record.id}`}>{text}</EyePreview>
}, {
title: '询价单摘要',
key: 'details',
dataIndex: 'details',
}, {
title: '被询价会员',
key: 'memberName',
dataIndex: 'memberName',
}, {
title: '交付日期',
key: 'deliveryTime',
dataIndex: 'deliveryTime',
render: (text: any, record: any) => format(text)
}, {
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any, record: any) => format(text)
}, {
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
render: (text: any, record: any) => format(text)
}, {
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: text => <GeneralExternalState colorType={2} state={text} data={externalState} />
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any) => <GeneralInteriorState colorType={2} state={text} data={interiorState} />
}];
//交易能力 询价报价 询价单查询
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
PublicApi.getTransactionInquiryAddList({...params}).then(res => {
resolve(res.data)
})
})
}
// 搜索
const search = (values: any) => {
if (values.voucherTime) {
values.startDocumentsTime = timeRange(values.voucherTime).st
values.endDocumentsTime = timeRange(values.voucherTime).et
delete values.voucherTime
}
ref.current.reload(values)
}
const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]);
useEffect(() => {
const external = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用外部状态
PublicApi.getOrderProductInquiryExternalStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
const interior = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用内部状态
PublicApi.getOrderProductInquiryInteriorStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
Promise.all([external,interior]).then(res => {
setExternalState(res[0])
setInteriorState(res[1])
})
},[])
const columns: ColumnType<any>[] = [
{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/goodsOffer/enquiryOrder/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '询价单摘要',
key: 'details',
dataIndex: 'details',
},
{
title: '被询价会员',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '交付日期',
key: 'deliveryTime',
dataIndex: 'deliveryTime',
render: (text: any) => format(text)
},
{
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any) => format(text)
},
{
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
render: (text: any) => format(text)
},
{
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.externalStateName}</Tag>
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any, record: any) => <Badge status={INTERNALSTATE_COLOR[text]} text={record.interiorStateName} />
},
];
return (
<PageHeaderWrapper>
<Card>
<StandardTable
currentRef={ref}
columns={columns}
tableProps={{ rowKew: 'id' }}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => search(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($,actions,'inquiryListNo',FORM_FILTER_PATH)
FormEffectHooks.onFieldChange$('category').subscribe(state => {
searchSelectGetSelectCategoryOptionEffect(actions,'category')
})
}}
schema={enquieryOfferSearchSchema}
>
</NiceForm>
}
/>
</Card>
</PageHeaderWrapper>
<Table
schema={INQUIRYSEARCHSCHEMA}
columns={columns}
effects="inquiryListNo"
fetch={PublicApi.getTransactionInquiryAddList}
reload={reload}
externalStatusFetch={PublicApi.getTransactionProductInquiryExternalStateEnum({ type: '1' })}
interiorStatusFetch={PublicApi.getTransactionProductInquiryInteriorStateEnum({ type: '1' })}
/>
)
}
export default EnquiryOrder;
export default EnquiryOrder
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const INQUIRYSEARCHSCHEMA: ISchema = {
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
properties: {
inquiryListNo: {
type: "string",
"x-component": "Search",
"x-mega-props": {},
"x-component-props": {
placeholder: "询价单号",
align: "flex-left",
}
}
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
justifyContent: "flex-start",
flexWrap: "nowrap"
},
colStyle: {//改变间隔
marginRight: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
memberName: {
type: "string",
"x-component-props": {
placeholder: "被询价会员"
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
externalState: {
type: "string",
"x-component-props": {
placeholder: "外部状态",
style: {
width: 160
}
},
enum: []
},
interiorState: {
type: "string",
"x-component-props": {
placeholder: "内部状态",
style: {
width: 160
}
},
enum: []
},
}
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}
/** 内部状态颜色 */
export const EXTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "success",
5: "error",
}
/** 外部状态颜色 */
export const INTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "default",
5: "success",
6: "error",
7: "error",
}
import React, { useRef, useState } from 'react';
import { message } from 'antd';
import ReviewList from '../components/reviewList';
import { timeRange } from '@/utils/index';
import { PublicApi } from '@/services/api';
import Table from '@/pages/transaction/components/TableLayout';
import { history } from 'umi';
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview';
import moment from 'moment'
import { PublicApi } from '@/services/api';
import { Row, Col, Button, Tag, Badge } from 'antd';
import { PENDINGREVIEWONESCHEMA } from './schema';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from '../components/stateColor';
const PendingReviewOne: React.FC<{}> = () => {
const [selectRow, setSelectRow] = useState<Array<number>>([]);
const [loading, setLoading] = useState<boolean>(false);
const PendingReviewOne = () => {
const ref = useRef<any>({});
// 多选
const selectAll = (values: any) => {
setSelectRow(values);
console.log(values, '我是多选的id')
}
// 列表数据
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
return new Promise((resolve, reject) => {
PublicApi.getTransactionInquiryToAuditList({ ...params }).then(res => {
resolve(res.data)
})
})
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
// 批量操作
const batchAction = () => {
if (selectRow.length > 0) {
setLoading(true)
return new Promise((resolve, reject) => {
PublicApi.postTransactionInquiryDocumentsReviewAll({ ids: selectRow }).then(res => {
if (res.code === 1000) {
resolve(res.data)
setLoading(false)
setSelectRow([])
ref.current.reload();
}
})
})
} else {
message.error('请选择要操作的询价单!')
const [rowkeys, setRowKeys] = useState<Array<number>>([]);
/** 批量审核 */
const fetchSubmitBatch = async () => {
const res = await PublicApi.postTransactionInquiryDocumentsReviewAll({ ids: rowkeys });
if (res.code === 1000) {
ref.current.reload();
setRowKeys([])
}
}
const column = {
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/goodsOffer/pendingReviewOne/preview?id=${record.id}`}>{text}</EyePreview>
}
const columns: ColumnType<any>[] = [
{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/goodsOffer/pendingReviewOne/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '询价单摘要',
key: 'details',
dataIndex: 'details',
},
{
title: '被询价会员',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '交付日期',
key: 'deliveryTime',
dataIndex: 'deliveryTime',
render: (text: any, record: any) => format(text)
},
{
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any, record: any) => format(text)
},
{
title: '单据时间',
key: 'createTime',
dataIndex: 'createTime',
render: (text: any, record: any) => format(text)
},
{
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.externalStateName}</Tag>
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any, record: any) => <Badge status={INTERNALSTATE_COLOR[text]} text={record.interiorStateName} />
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any) => <Button type='link' onClick={()=>history.push(`/memberCenter/tranactionAbility/goodsOffer/pendingReviewOne/details?id=${record.id}`)}>审核</Button>
},
];
return (
<ReviewList
reloadRef={ref}
fetchData={fetchData}
selectAll={selectAll}
batchAction={batchAction}
loading={loading}
type={2}
column={column}
<Table
selectedRow
reload={ref}
schema={PENDINGREVIEWONESCHEMA}
columns={columns}
effects="inquiryListNo"
fetch={PublicApi.getTransactionInquiryToAuditList}
fetchRowkeys={(e) => setRowKeys(e)}
controllerBtns={
<Row>
<Col span={6}>
<Button
disabled={rowkeys.length === 0}
onClick={fetchSubmitBatch}
>
批量提交审核
</Button>
</Col>
</Row>
}
/>
)
}
export default PendingReviewOne
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const PENDINGREVIEWONESCHEMA: ISchema = {
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: "object",
"x-component": "Children",
"x-component-props": {
children: "{{controllerBtns}}"
}
},
inquiryListNo: {//报价单号
type: "string",
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: "询价单号搜索"
}
}
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: "nowrap"
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
details: {
type: "string",
"x-component-props": {
placeholder: "询价单摘要"
}
},
memberName: {
type: "string",
"x-component-props": {
placeholder: "被询价会员"
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
}
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}
/** 内部状态颜色 */
export const EXTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "success",
5: "error",
}
/** 外部状态颜色 */
export const INTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "default",
5: "success",
6: "error",
7: "error",
}
import React, { useRef, useState } from 'react';
import { message } from 'antd';
import ReviewList from '../components/reviewList';
import { timeRange } from '@/utils/index';
import { PublicApi } from '@/services/api';
import Table from '@/pages/transaction/components/TableLayout';
import { history } from 'umi';
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview';
import moment from 'moment'
import { PublicApi } from '@/services/api';
import { Row, Col, Button, Tag, Badge } from 'antd';
import { PENDINGREVIEWTWOSCHEMA } from './schema';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from '../components/stateColor';
const PendingReviewTwo: React.FC<{}> = () => {
const [selectRow, setSelectRow] = useState<Array<number>>([]);
const [loading, setLoading] = useState<boolean>(false);
const PendingReviewTwo = () => {
const ref = useRef<any>({});
// 多选
const selectAll = (values: any) => {
setSelectRow(values);
console.log(values, '我是多选的id')
}
//列表数据
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
PublicApi.getTransactionInquiryToAuditListTwo({...params}).then(res => {
resolve(res.data)
})
})
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
// 批量操作
const batchAction = () => {
if (selectRow.length > 0) {
return new Promise((resolve, reject) => {
setLoading(true)
PublicApi.postTransactionInquiryDocumentsReviewAllTwo({ ids: selectRow }).then(res => {
if (res.code === 1000) {
resolve(res.data)
setLoading(false)
setSelectRow([])
ref.current.reload();
}
})
})
} else {
message.error('请选择要操作的询价单!')
const [rowkeys, setRowKeys] = useState<Array<number>>([]);
/** 批量审核 */
const fetchSubmitBatch = async () => {
const res = await PublicApi.postTransactionInquiryDocumentsReviewAllTwo({ ids: rowkeys });
if (res.code === 1000) {
ref.current.reload();
setRowKeys([])
}
}
const column = {
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/goodsOffer/pendingReviewTwo/preview?id=${record.id}`}>{text}</EyePreview>
}
const columns: ColumnType<any>[] = [
{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/goodsOffer/pendingReviewOne/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '询价单摘要',
key: 'details',
dataIndex: 'details',
},
{
title: '被询价会员',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '交付日期',
key: 'deliveryTime',
dataIndex: 'deliveryTime',
render: (text: any, record: any) => format(text)
},
{
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any, record: any) => format(text)
},
{
title: '单据时间',
key: 'createTime',
dataIndex: 'createTime',
render: (text: any, record: any) => format(text)
},
{
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.externalStateName}</Tag>
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any, record: any) => <Badge status={INTERNALSTATE_COLOR[text]} text={record.interiorStateName} />
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any) => <Button type='link' onClick={()=>history.push(`/memberCenter/tranactionAbility/goodsOffer/pendingReviewOne/details?id=${record.id}`)}>审核</Button>
},
];
return (
<ReviewList
reloadRef={ref}
fetchData={fetchData}
selectAll={selectAll}
batchAction={batchAction}
type={3}
loading={loading}
column={column}
<Table
selectedRow
reload={ref}
schema={PENDINGREVIEWTWOSCHEMA}
columns={columns}
effects="inquiryListNo"
fetch={PublicApi.getTransactionInquiryToAuditListTwo}
fetchRowkeys={(e) => setRowKeys(e)}
controllerBtns={
<Row>
<Col span={6}>
<Button
disabled={rowkeys.length === 0}
onClick={fetchSubmitBatch}
>
批量提交审核
</Button>
</Col>
</Row>
}
/>
)
}
export default PendingReviewTwo
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const PENDINGREVIEWTWOSCHEMA: ISchema = {
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: "object",
"x-component": "Children",
"x-component-props": {
children: "{{controllerBtns}}"
}
},
inquiryListNo: {//报价单号
type: "string",
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: "询价单号搜索"
}
}
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: "nowrap"
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
details: {
type: "string",
"x-component-props": {
placeholder: "询价单摘要"
}
},
memberName: {
type: "string",
"x-component-props": {
placeholder: "被询价会员"
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
}
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}
/** 内部状态颜色 */
export const EXTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "success",
5: "error",
}
/** 外部状态颜色 */
export const INTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "default",
5: "success",
6: "error",
7: "error",
}
import React, { useRef, useState, useEffect } from 'react';
import { Card, Button, Row, Col, Popconfirm , message} from 'antd';
import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { StandardTable } from 'god';
import moment from 'moment';
import { timeRange } from '@/utils/index';
import React, { useRef, useState } from 'react';
import Table from '@/pages/transaction/components/TableLayout';
import { ColumnType } from 'antd/lib/table/interface';
import NiceForm from '@/components/NiceForm';
import { createFormActions} from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import EyePreview from '@/components/EyePreview';
import { pendingReviewSchema } from '../schema/pendingReview';
import moment from 'moment'
import { PublicApi } from '@/services/api';
import GeneralExternalState from '@/pages/transaction/common/externalState';
import GeneralInteriorState from '@/pages/transaction/common/interiorState';
import { Row, Col, Button, Popconfirm, Tag, Badge } from 'antd';
import { PENDINGSUBMITSCHEMA } from './schema';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from '../components/stateColor';
const formActions = createFormActions();
const PendingSubmit: React.FC<{}> = () => {
const ref = useRef<any>({});
const [id, setId] = useState<any>(0);
const [visible, setvisible] = useState<boolean>(false);
const [selectRow, setSelectRow] = useState([])
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([]);
const [loading, setLoading] = useState<boolean>(false)
const PendingSubmit = () => {
const reload = useRef<any>({});
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const [rowkeys, setRowKeys] = useState<Array<number>>([]);
/** 批量审核 */
const fetchSubmitBatch = async (id?: number) => {
let res = null;
if (id) {
res = await PublicApi.postTransactionInquirySubmit({ id: Number(id) })
} else {
res = await PublicApi.postTransactionInquirySubmitAll({ ids: rowkeys });
}
if (res.code === 1000) {
reload.current.reload();
setRowKeys([])
}
}
const columns: ColumnType<any>[] = [
{
title: '询价单号',
......@@ -64,154 +67,47 @@ const PendingSubmit: React.FC<{}> = () => {
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: text => <GeneralExternalState colorType={2} state={text} data={externalState} />
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.externalStateName}</Tag>
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any) => <GeneralInteriorState colorType={2} state={text} data={interiorState} />
render: (text: any, record: any) => <Badge status={INTERNALSTATE_COLOR[text]} text={record.interiorStateName} />
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any) =>
<Popconfirm title="确定要提交吗?" okText="是" cancelText="否" onConfirm={() => handleSubmit(record.id)}>
<Popconfirm title="确定要提交吗?" okText="是" cancelText="否" onConfirm={() => fetchSubmitBatch(record.id)}>
<Button type='link'>提交询价单</Button>
</Popconfirm>
},
]
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
/**多选 */
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
},
}
/**批量审核通过按钮 */
const controllerBtns = <Row>
<Col span={6}>
<Button onClick={() => handleSubmitAll(selectedRowKeys)} disabled={selectedRowKeys.length < 1 } loading={loading}>批量提交审核</Button>
</Col>
</Row>
// 单个提交
const handleSubmit = (id:any) => {
const value = {id,state: 1}
PublicApi.postTransactionInquirySubmit(value).then(res => {
if(res.code === 1000) {
ref.current.reload()
}
})
}
/**列表数据 */
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
return new Promise((resolve, reject) => {
PublicApi.getTransactionSubmitInquirySheetList({ ...params }).then(res => {
resolve(res.data)
})
})
}
/**搜索 */
const handleSumbit = (values: any) => {
if (values.voucherTime) {
values.startDocumentsTime = timeRange(values.voucherTime).st
values.endDocumentsTime = timeRange(values.voucherTime).et
delete values.voucherTime
}
console.log('values', values)
ref.current.reload(values)
}
/**批量审核 */
const handleSubmitAll = (ids: number[]) => {
if(ids.length > 0) {
setLoading(true)
PublicApi.postTransactionInquirySubmitAll({ ids: ids }).then(res => {
setLoading(false)
setSelectedRowKeys([]);
ref.current.reload()
})
} else {
message.error('请选择要操作的询价单!')
}
}
const handleModalOK = () => {
setvisible(false)
setTimeout(() => {
ref.current.reload();
}, 500)
}
const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]);
useEffect(() => {
const external = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用外部状态
PublicApi.getOrderProductInquiryExternalStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
const interior = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用内部状态
PublicApi.getOrderProductInquiryInteriorStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
Promise.all([external,interior]).then(res => {
setExternalState(res[0])
setInteriorState(res[1])
})
},[])
];
return (
<PageHeaderWrapper>
<Card>
<StandardTable
currentRef={ref}
columns={columns}
tableProps={{ rowKew: 'id' }}
rowSelection={rowSelection}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => handleSumbit(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'inquiryListNo', FORM_FILTER_PATH)
}}
expressionScope={{
controllerBtns
}}
schema={pendingReviewSchema}
<Table
selectedRow
reload={reload}
schema={PENDINGSUBMITSCHEMA}
columns={columns}
effects="inquiryListNo"
fetch={PublicApi.getTransactionSubmitInquirySheetList}
fetchRowkeys={(e) => setRowKeys(e)}
controllerBtns={
<Row>
<Col span={6}>
<Button
disabled={rowkeys.length === 0}
onClick={() => fetchSubmitBatch()}
>
</NiceForm>
}
>
</StandardTable>
</Card>
{/* <AuditModal
id={id}
type={1}
dialogVisible={visible}
onCancel={() => setvisible(false)}
onOK={handleModalOK}
/> */}
</PageHeaderWrapper>
批量提交审核
</Button>
</Col>
</Row>
}
/>
)
}
export default PendingSubmit
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const PENDINGSUBMITSCHEMA: ISchema = {
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: "object",
"x-component": "Children",
"x-component-props": {
children: "{{controllerBtns}}"
}
},
inquiryListNo: {//报价单号
type: "string",
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: "询价单号搜索"
}
}
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: "nowrap"
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
details: {
type: "string",
"x-component-props": {
placeholder: "询价单摘要"
}
},
memberName: {
type: "string",
"x-component-props": {
placeholder: "被询价会员"
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
}
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}
/** 内部状态颜色 */
export const EXTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "success",
5: "error",
}
/** 外部状态颜色 */
export const INTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "default",
5: "success",
6: "error",
7: "error",
}
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const ADDINQUIRYORDERSHCEMA: ISchema = {
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: "object",
"x-component": "Children",
"x-component-props": {
children: "{{controllerBtns}}"
}
},
quotationNo: {//报价单号
type: "string",
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: "报价单号"
}
}
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: "nowrap"
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
inquiryListNo: {
type: "string",
"x-component-props": {
placeholder: "询价单号"
}
},
details: {
type: "string",
"x-component-props": {
placeholder: "报价单摘要"
}
},
memberName: {
type: "string",
"x-component-props": {
placeholder: "询价会员"
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
externalState: {
type: "string",
"x-component-props": {
placeholder: "外部状态",
style: {
width: 160
}
},
enum: []
},
interiorState: {
type: "string",
"x-component-props": {
placeholder: "内部状态",
style: {
width: 160
}
},
enum: []
},
}
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}
......@@ -36,21 +36,21 @@ const AuditModal: React.FC<Params> = (props) => {
value.id = Number(props.id)
switch (props.type) {
case 1:
PublicApi.postOrderProductQuotationtToSubmit(value).then(res => {
PublicApi.postTransactionProductQuotationtToSubmit(value).then(res => {
if (res.code === 1000) {
props.onOK()
}
})
break;
case 2:
PublicApi.postOrderProductQuotationtAuditSubmit(value).then(res => {
PublicApi.postTransactionProductQuotationtAuditSubmit(value).then(res => {
if (res.code === 1000) {
props.onOK()
}
})
break;
case 3:
PublicApi.postOrderProductQuotationtAuditSubmitTwo(value).then(res => {
PublicApi.postTransactionProductQuotationtAuditSubmitTwo(value).then(res => {
if (res.code === 1000) {
props.onOK()
}
......
/** 内部状态颜色 */
export const EXTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "success",
5: "error",
}
/** 外部状态颜色 */
export const INTERNALSTATE_COLOR = {
1: "default",
2: "default",
3: "default",
4: "default",
5: "success",
6: "error",
7: "error",
}
import React, { useRef, useEffect, useState } from 'react';
import {Link} from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card, Button } from 'antd';
import { StandardTable } from 'god';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { enquieryOfferSearchSchema } from '../schema';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import {searchSelectGetSelectCategoryOptionEffect} from '../../effect/index'
import React, { useRef } from 'react';
import Table from '@/pages/transaction/components/TableLayout';
import { history } from 'umi';
import { Tag, Button } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview';
import { timeRange } from '@/utils/index';
import moment from 'moment';
import { PublicApi } from '@/services/api';
import GeneralExternalState from '@/pages/transaction/common/externalState';
import GeneralInteriorState from '@/pages/transaction/common/interiorState';
import { ENQURIRYORDERSCHEMA } from './schema';
import { EXTERNALSTATE_COLOR } from '../components/stateColor';
const EnquiryOrder = () => {
const reload = useRef<any>({});
const formActions = createFormActions();
const EnquiryOrder: React.FC<{}> = (props) => {
const ref = useRef<any>({});
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const columns: ColumnType<any>[] = [{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
const columns: ColumnType<any>[] = [
{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/enquiryOrder/rfq/preview?id=${record.id}`}>{text}</EyePreview>
}, {
title: '询价单摘要',
key: 'details',
dataIndex: 'details',
}, {
title: '被询价会员',
key: 'memberName',
dataIndex: 'memberName',
}, {
title: '交付日期',
key: 'deliveryTime',
dataIndex: 'deliveryTime',
render: (text: any, record: any) => format(text)
}, {
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any, record: any) => format(text)
}, {
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
render: (text: any, record: any) => format(text)
}, {
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: text => <GeneralExternalState colorType={2} state={text} data={externalState} />
}, {
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any) => <Button disabled={record.isQuoted ===1} type='link'><Link to={`/memberCenter/tranactionAbility/inquiryQuote/addInquiryOrder/quote?id=${record.id}`}>报价</Link></Button>
}];
//交易能力 询价报价 询价单查询
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
PublicApi.getTransactionProductInquiryList({...params}).then(res => {
resolve(res.data)
})
})
}
// 搜索
const search = (values: any) => {
if (values.voucherTime) {
values.startDocumentsTime = timeRange(values.voucherTime).st
values.endDocumentsTime = timeRange(values.voucherTime).et
delete values.voucherTime
},
{
title: '询价单摘要',
key: 'details',
dataIndex: 'details',
},
{
title: '被询价会员',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '交付日期',
key: 'deliveryTime',
dataIndex: 'deliveryTime',
render: (text: any, record: any) => format(text)
},
{
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any, record: any) => format(text)
},
{
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
render: (text: any, record: any) => format(text)
},
{
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.externalStateName}</Tag>
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any) => <Button disabled={record.isQuoted === 1} onClick={() => history.push(`/memberCenter/tranactionAbility/inquiryQuote/addInquiryOrder/quote?id=${record.id}`)} type='link'>报价</Button>
}
ref.current.reload(values)
}
const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]);
useEffect(() => {
const external = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用外部状态
PublicApi.getOrderProductInquiryExternalStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
const interior = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用内部状态
PublicApi.getOrderProductInquiryInteriorStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
Promise.all([external,interior]).then(res => {
setExternalState(res[0])
setInteriorState(res[1])
})
},[])
];
return (
<PageHeaderWrapper>
<Card>
<StandardTable
currentRef={ref}
columns={columns}
tableProps={{ rowKew: 'id' }}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => search(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($,actions,'inquiryListNo',FORM_FILTER_PATH)
FormEffectHooks.onFieldChange$('category').subscribe(state => {
searchSelectGetSelectCategoryOptionEffect(actions,'category')
})
}}
schema={enquieryOfferSearchSchema}
>
</NiceForm>
}
/>
</Card>
</PageHeaderWrapper>
<Table
schema={ENQURIRYORDERSCHEMA}
columns={columns}
effects="inquiryListNo"
fetch={PublicApi.getTransactionProductInquiryList}
reload={reload}
externalStatusFetch={PublicApi.getTransactionProductInquiryExternalStateEnum({ type: '1' })}
/>
)
}
export default EnquiryOrder;
export default EnquiryOrder
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const ENQURIRYORDERSCHEMA: ISchema = {
type: 'object',
properties: {
megalayout: {
type: 'object',
"x-component": 'mega-layout',
properties: {
inquiryListNo: {
type: 'string',
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: '询价单号搜索',
align: 'flex-left',
}
}
}
},
[FORM_FILTER_PATH]: {
type: 'object',
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
justifyContent: 'flex-start',
flexWrap: 'nowrap'
},
colStyle: {//改变间隔
marginRight: 20
}
},
properties: {
PRO_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
memberName: {
type: 'string',
"x-component-props": {
placeholder: '被询价会员'
},
},
details: {
type: 'string',
"x-component-props": {
placeholder: '询价单摘要'
},
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
externalState: {
type: "string",
"x-component-props": {
placeholder: "外部状态",
style: {
width: 160
}
},
enum: []
},
}
},
sumbit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
import React, { useRef, useState } from 'react';
import { message } from 'antd';
import ReviewList from '../components/reviewList';
import { timeRange } from '@/utils/index';
import { PublicApi } from '@/services/api';
import Table from '@/pages/transaction/components/TableLayout';
import { history } from 'umi';
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview';
import moment from 'moment'
import { PublicApi } from '@/services/api';
import { Row, Col, Button, Tag, Badge } from 'antd';
import { PENDINGREVIEWONESCHEMA } from './schema';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from '../components/stateColor';
const PendingReviewOne: React.FC<{}> = () => {
const [selectRow, setSelectRow] = useState<Array<number>>([]);
const PendingReviewOne = () => {
const ref = useRef<any>({});
// 多选
const selectAll = (values: any) => {
setSelectRow(values);
console.log(values, '我是多选的id')
}
// 列表数据
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
return new Promise((resolve, reject) => {
PublicApi.getOrderAuditProductQuotationList({...params}).then(res => {
resolve(res.data)
})
})
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
// 批量操作
const batchAction = () => {
if (selectRow.length > 0) {
return new Promise((resolve, reject) => {
PublicApi.postTransactionProductQuotationtAuditAll({ ids: selectRow }).then(res => {
if (res.code === 1000) {
resolve(res.data)
ref.current.reload();
setSelectRow([])
}
})
})
} else {
message.error('请选择要操作的报价单!')
const [rowkeys, setRowKeys] = useState<Array<number>>([]);
/** 批量审核 */
const fetchSubmitBatch = async () => {
const res = await PublicApi.postTransactionProductQuotationtAuditAll({ ids: rowkeys });
if (res.code === 1000) {
ref.current.reload();
setRowKeys([])
}
}
const column: ColumnType<any>[] = [{
title: '报价单号',
key: 'quotationNo',
dataIndex: 'quotationNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewOne/quote/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewOne/rfq/preview?id=${record.inquiryListId}`}>{text}</EyePreview>
}]
const columns: ColumnType<any>[] = [
{
title: '报价单号',
key: 'quotationNo',
dataIndex: 'quotationNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewOne/quote/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewOne/rfq/preview?id=${record.inquiryListId}`}>{text}</EyePreview>
},
{
title: '报价单摘要',
key: 'details',
dataIndex: 'details',
},
{
title: '询价会员',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any, record: any) => format(text)
},
{
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
render: (text: any, record: any) => format(text)
},
{
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.externalStateName}</Tag>
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any, record: any) => <Badge status={INTERNALSTATE_COLOR[text]} text={record.interiorStateName} />
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any) => <Button type='link' disabled={record.interiorState === 1} onClick={() => history.push(`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewTwo/quote/detail?id=${record.id}&page_type=2`)}>审核</Button>
},
]
return (
<ReviewList
reloadRef={ref}
fetchData={fetchData}
selectAll={selectAll}
batchAction={batchAction}
type={2}
column={column}
<Table
selectedRow
reload={ref}
schema={PENDINGREVIEWONESCHEMA}
columns={columns}
effects="quotationNo"
fetch={PublicApi.getTransactionAuditProductQuotationList}
externalStatusFetch={PublicApi.getTransactionProductInquiryExternalStateEnum({ type: '2' })}
interiorStatusFetch={PublicApi.getTransactionProductInquiryInteriorStateEnum({ type: '2' })}
fetchRowkeys={(e) => setRowKeys(e)}
controllerBtns={
<Row>
<Col span={6}>
<Button
disabled={rowkeys.length === 0}
onClick={fetchSubmitBatch}
>
批量提交审核
</Button>
</Col>
</Row>
}
/>
)
}
export default PendingReviewOne
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const PENDINGREVIEWONESCHEMA: ISchema = {
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: "object",
"x-component": "Children",
"x-component-props": {
children: "{{controllerBtns}}"
}
},
quotationNo: {//报价单号
type: "string",
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: "报价单号"
}
}
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: "nowrap"
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
inquiryListNo: {
type: "string",
"x-component-props": {
placeholder: "询价单号"
}
},
details: {
type: "string",
"x-component-props": {
placeholder: "报价单摘要"
}
},
memberName: {
type: "string",
"x-component-props": {
placeholder: "询价会员"
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
externalState: {
type: "string",
"x-component-props": {
placeholder: "外部状态",
style: {
width: 160
}
},
enum: []
},
interiorState: {
type: "string",
"x-component-props": {
placeholder: "内部状态",
style: {
width: 160
}
},
enum: []
},
}
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}
import React, { useRef, useState } from 'react';
import { message } from 'antd';
import ReviewList from '../components/reviewList';
import { timeRange } from '@/utils/index';
import { PublicApi } from '@/services/api';
import Table from '@/pages/transaction/components/TableLayout';
import { history } from 'umi';
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview';
import moment from 'moment'
import { PublicApi } from '@/services/api';
import { Row, Col, Button, Tag, Badge } from 'antd';
import { PENDINGREVIEWTWOSCHEMA } from './schema';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from '../components/stateColor';
const PendingReviewTwo: React.FC<{}> = () => {
const [selectRow, setSelectRow] = useState<Array<number>>([]);
const PendingReviewOne = () => {
const ref = useRef<any>({});
// 多选
const selectAll = (values: any) => {
setSelectRow(values);
console.log(values, '我是多选的id')
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
// 列表数据
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
return new Promise((resolve, reject) => {
PublicApi.getOrderAuditProductQuotationListTwo({...params}).then(res => {
resolve(res.data)
})
})
}
// 批量操作
const batchAction = () => {
if (selectRow.length > 0) {
return new Promise((resolve, reject) => {
PublicApi.postTransactionProductQuotationtAuditAllTwo({ ids: selectRow }).then(res => {
if (res.code === 1000) {
resolve(res.data)
ref.current.reload();
setSelectRow([])
}
})
})
} else {
message.error('请选择要操作的报价单!')
const [rowkeys, setRowKeys] = useState<Array<number>>([]);
/** 批量审核 */
const fetchSubmitBatch = async () => {
const res = await PublicApi.postTransactionProductQuotationtAuditAllTwo({ ids: rowkeys });
if (res.code === 1000) {
ref.current.reload();
setRowKeys([])
}
}
const column: ColumnType<any>[] = [{
title: '报价单号',
key: 'quotationNo',
dataIndex: 'quotationNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewTwo/quote/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewTwo/rfq/preview?id=${record.inquiryListId}`}>{text}</EyePreview>
}]
const columns: ColumnType<any>[] = [
{
title: '报价单号',
key: 'quotationNo',
dataIndex: 'quotationNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewTwo/quote/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewTwo/rfq/preview?id=${record.inquiryListId}`}>{text}</EyePreview>
},
{
title: '报价单摘要',
key: 'details',
dataIndex: 'details',
},
{
title: '询价会员',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any, record: any) => format(text)
},
{
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
render: (text: any, record: any) => format(text)
},
{
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.externalStateName}</Tag>
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any, record: any) => <Badge status={INTERNALSTATE_COLOR[text]} text={record.interiorStateName} />
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any) => <Button type='link' disabled={record.interiorState === 1} onClick={() => history.push(`/memberCenter/tranactionAbility/inquiryQuote/pendingReviewTwo/quote/detail?id=${record.id}&page_type=3`)}>审核</Button>
},
]
return (
<ReviewList
reloadRef={ref}
fetchData={fetchData}
selectAll={selectAll}
batchAction={batchAction}
type={3}
column={column}
<Table
selectedRow
reload={ref}
schema={PENDINGREVIEWTWOSCHEMA}
columns={columns}
effects="quotationNo"
fetch={PublicApi.getTransactionAuditProductQuotationListTwo}
externalStatusFetch={PublicApi.getTransactionProductInquiryExternalStateEnum({ type: '2' })}
interiorStatusFetch={PublicApi.getTransactionProductInquiryInteriorStateEnum({ type: '2' })}
fetchRowkeys={(e) => setRowKeys(e)}
controllerBtns={
<Row>
<Col span={6}>
<Button
disabled={rowkeys.length === 0}
onClick={fetchSubmitBatch}
>
批量提交审核
</Button>
</Col>
</Row>
}
/>
)
}
export default PendingReviewOne
export default PendingReviewTwo
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const PENDINGREVIEWTWOSCHEMA: ISchema = {
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: "object",
"x-component": "Children",
"x-component-props": {
children: "{{controllerBtns}}"
}
},
quotationNo: {//报价单号
type: "string",
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: "报价单号"
}
}
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: "nowrap"
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
inquiryListNo: {
type: "string",
"x-component-props": {
placeholder: "询价单号"
}
},
details: {
type: "string",
"x-component-props": {
placeholder: "报价单摘要"
}
},
memberName: {
type: "string",
"x-component-props": {
placeholder: "询价会员"
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
externalState: {
type: "string",
"x-component-props": {
placeholder: "外部状态",
style: {
width: 160
}
},
enum: []
},
interiorState: {
type: "string",
"x-component-props": {
placeholder: "内部状态",
style: {
width: 160
}
},
enum: []
},
}
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}
import React, { useRef, useEffect, useState } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card } from 'antd';
import { StandardTable } from 'god';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { quoteFormSearch } from '../schema';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { searchSelectGetSelectCategoryOptionEffect } from '../../effect/index'
import React, { useRef } from 'react';
import Table from '@/pages/transaction/components/TableLayout';
import { history } from 'umi';
import { Tag, Badge } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview';
import { timeRange } from '@/utils/index';
import moment from 'moment';
import { PublicApi } from '@/services/api';
import GeneralExternalState from '@/pages/transaction/common/externalState';
import GeneralInteriorState from '@/pages/transaction/common/interiorState';
import { QUOTEORDERSCHEMA } from './schema';
import { EXTERNALSTATE_COLOR, INTERNALSTATE_COLOR } from '../components/stateColor';
const EnquiryOrder = () => {
const reload = useRef<any>({});
const formActions = createFormActions();
const EnquiryOrder: React.FC<{}> = (props) => {
const ref = useRef<any>({});
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const columns: ColumnType<any>[] = [{
title: '报价单号',
key: 'quotationNo',
dataIndex: 'quotationNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/quoteOrder/quote/preview?id=${record.id}`}>{text}</EyePreview>
},{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/quoteOrder/rfq/preview?id=${record.inquiryListId}`}>{text}</EyePreview>
}, {
title: '报价单摘要',
key: 'details',
dataIndex: 'details',
}, {
title: '询价会员',
key: 'memberName',
dataIndex: 'memberName',
},{
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any, record: any) => format(text)
}, {
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
render: (text: any, record: any) => format(text)
}, {
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: text => <GeneralExternalState colorType={2} state={text} data={externalState} />
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any) => <GeneralInteriorState colorType={2} state={text} data={interiorState} />
}];
//交易能力 询价报价 询价单查询
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
PublicApi.getTransactionProductQuotationList({...params}).then(res => {
resolve(res.data)
})
})
}
// 搜索
const search = (values: any) => {
if (values.voucherTime) {
values.startDocumentsTime = timeRange(values.voucherTime).st
values.endDocumentsTime = timeRange(values.voucherTime).et
delete values.voucherTime
}
ref.current.reload(values)
}
const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]);
useEffect(() => {
const external = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用外部状态
PublicApi.getOrderProductInquiryExternalStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
const interior = new Promise(resolve => {
// 询价查询, 询价报价, 确认询价报价单 通用内部状态
PublicApi.getOrderProductInquiryInteriorStateEnum().then((res:any) => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
Promise.all([external,interior]).then(res => {
setExternalState(res[0])
setInteriorState(res[1])
})
},[])
const columns: ColumnType<any>[] = [
{
title: '报价单号',
key: 'quotationNo',
dataIndex: 'quotationNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/quoteOrder/quote/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '询价单号',
key: 'inquiryListNo',
dataIndex: 'inquiryListNo',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/inquiryQuote/quoteOrder/rfq/preview?id=${record.inquiryListId}`}>{text}</EyePreview>
},
{
title: '报价单摘要',
key: 'details',
dataIndex: 'details',
},
{
title: '询价会员',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any, record: any) => format(text)
},
{
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
render: (text: any, record: any) => format(text)
},
{
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: (text: any, record: any) => <Tag color={EXTERNALSTATE_COLOR[text]}>{record.externalStateName}</Tag>
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any, record: any) => <Badge status={INTERNALSTATE_COLOR[text]} text={record.interiorStateName} />
},
];
return (
<PageHeaderWrapper>
<Card>
<StandardTable
currentRef={ref}
columns={columns}
tableProps={{ rowKew: 'id' }}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => search(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'quotationNo', FORM_FILTER_PATH)
FormEffectHooks.onFieldChange$('category').subscribe(state => {
searchSelectGetSelectCategoryOptionEffect(actions, 'category')
})
}}
schema={quoteFormSearch}
>
</NiceForm>
}
/>
</Card>
</PageHeaderWrapper>
<Table
schema={QUOTEORDERSCHEMA}
columns={columns}
effects="quotationNo"
fetch={PublicApi.getTransactionProductQuotationList}
reload={reload}
externalStatusFetch={PublicApi.getTransactionProductInquiryExternalStateEnum({ type: '2' })}
interiorStatusFetch={PublicApi.getTransactionProductInquiryInteriorStateEnum({ type: '2' })}
/>
)
}
export default EnquiryOrder;
export default EnquiryOrder
import { ISchema } from "@formily/antd";
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const QUOTEORDERSCHEMA: ISchema = {
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
properties: {
quotationNo: {
type: "string",
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: "报价单号",
align: "flex-left",
}
}
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
justifyContent: "flex-start",
flexWrap: "nowrap"
},
colStyle: {//改变间隔
marginRight: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
inquiryListNo: {
type: "string",
"x-component-props": {
placeholder: "询价单号"
}
},
memberName: {
type: "string",
"x-component-props": {
placeholder: "询价会员"
}
},
details: {
type: "string",
"x-component-props": {
placeholder: "报价单摘要"
}
},
"[startDocumentsTime,endDocumentsTime]": {
type: "string",
"x-component": "dateSelect",
"x-component-props": {
placeholder: "单据时间(全部)",
}
},
externalState: {
type: "string",
"x-component-props": {
placeholder: "外部状态",
style: {
width: 160
}
},
enum: []
},
interiorState: {
type: "string",
"x-component-props": {
placeholder: "内部状态",
style: {
width: 160
}
},
enum: []
},
}
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}
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