Commit 11b8868a authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

fix: 修复采购询价新增的bug

parent 3a525ab7
import React, { useRef, useState, useImperativeHandle } from 'react'; import React, { useRef, useState, useImperativeHandle, useEffect } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card } from 'antd'; import { Card } from 'antd';
import { StandardTable } from 'god'; import { StandardTable } from 'god';
...@@ -43,10 +43,11 @@ import { ...@@ -43,10 +43,11 @@ import {
ONLINEBIDREADYBID_SCHEMA, ONLINEBIDREADYBID_SCHEMA,
ONLINEBIDREADYSIGN_SCHEMA, ONLINEBIDREADYSIGN_SCHEMA,
} from '../../schema/onlineBid'; } from '../../schema/onlineBid';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
interface Iprops { interface Iprops {
fetch?: () => Promise<unknown>, fetch?: () => Promise<unknown>,
fetchRowkeys?(e: any), fetchRowkeys?(e: number[]),
controllerBtns?: React.ReactNode, controllerBtns?: React.ReactNode,
schemaType?: schemaType?:
'PurchaseDemand' | 'PurchaseDemand' |
...@@ -76,6 +77,10 @@ interface Iprops { ...@@ -76,6 +77,10 @@ interface Iprops {
reload?: any, reload?: any,
externalStatusFetch?: () => Promise<unknown>, externalStatusFetch?: () => Promise<unknown>,
interiorStatusFetch?: () => Promise<unknown>, interiorStatusFetch?: () => Promise<unknown>,
/** rowKey */
rowKey?: string,
/** 禁用 */
getCheckboxProps?: (record: any) => void,
} }
const formActions = createFormActions(); const formActions = createFormActions();
const Table: React.FC<Iprops> = (props: any) => { const Table: React.FC<Iprops> = (props: any) => {
...@@ -88,6 +93,8 @@ const Table: React.FC<Iprops> = (props: any) => { ...@@ -88,6 +93,8 @@ const Table: React.FC<Iprops> = (props: any) => {
selectedRow, selectedRow,
reload, reload,
fetchRowkeys, fetchRowkeys,
rowKey,
getCheckboxProps,
externalStatusFetch, externalStatusFetch,
interiorStatusFetch interiorStatusFetch
} = props; } = props;
...@@ -151,14 +158,16 @@ const Table: React.FC<Iprops> = (props: any) => { ...@@ -151,14 +158,16 @@ const Table: React.FC<Iprops> = (props: any) => {
} }
/**多选 */ /**多选 */
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([]); const [selectRow, selectRowFns] = useRowSelectionTable({
const rowSelection = { customKey: rowKey || 'id',
selectedRowKeys: selectedRowKeys, extendsSelection: {
onChange: (selectedRowKeys: any, selectedRows: any) => { getCheckboxProps: (record) => getCheckboxProps && getCheckboxProps(record),
fetchRowkeys(selectedRowKeys)
setSelectedRowKeys(selectedRowKeys);
},
} }
});
useEffect(() => {
fetchRowkeys && fetchRowkeys(selectRowFns.selectedRowKeys)
}, [selectRowFns])
useImperativeHandle(reload, () => ({ useImperativeHandle(reload, () => ({
reload: () => { reload: () => {
...@@ -176,17 +185,17 @@ const Table: React.FC<Iprops> = (props: any) => { ...@@ -176,17 +185,17 @@ const Table: React.FC<Iprops> = (props: any) => {
onFormMount$().subscribe(() => { onFormMount$().subscribe(() => {
externalStatusFetch && externalStatusFetch().then(res => { externalStatusFetch && externalStatusFetch().then(res => {
if (res.code !== 1000) return if (res.code !== 1000) return
const _enum = res.data.map((item) => {return { label: item.name || item.message, value: item.satatus || item.code }}) const _enum = res.data.map((item) => { return { label: item.name || item.message, value: item.satatus || item.code } })
linkage.enum('externalState',_enum) linkage.enum('externalState', _enum)
linkage.enum('externalStatusList',_enum) linkage.enum('externalStatusList', _enum)
}).catch(error => { }).catch(error => {
console.warn(error) console.warn(error)
}) })
interiorStatusFetch && interiorStatusFetch().then(res => { interiorStatusFetch && interiorStatusFetch().then(res => {
if (res.code !== 1000) return if (res.code !== 1000) return
const _enum = res.data.map((item) => {return { label: item.name || item.message, value: item.satatus || item.code }}) const _enum = res.data.map((item) => { return { label: item.name || item.message, value: item.satatus || item.code } })
linkage.enum('interiorState',_enum) linkage.enum('interiorState', _enum)
linkage.enum('innerStatusList',_enum) linkage.enum('innerStatusList', _enum)
}).catch(error => { }).catch(error => {
console.warn(error) console.warn(error)
}) })
...@@ -200,13 +209,15 @@ const Table: React.FC<Iprops> = (props: any) => { ...@@ -200,13 +209,15 @@ const Table: React.FC<Iprops> = (props: any) => {
<StandardTable <StandardTable
currentRef={tableRef} currentRef={tableRef}
columns={columns} columns={columns}
tableProps={{ rowKew: 'id' }} tableProps={{ rowKey: rowKey ? rowKey : 'id' }}
rowSelection={selectedRow && rowSelection} rowSelection={selectedRow && selectRow}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
controlRender={ controlRender={
<NiceForm <NiceForm
actions={formActions} actions={formActions}
expressionScope={{ controllerBtns }} components={{
controllerBtns: () => controllerBtns,
}}
onSubmit={values => search(values)} onSubmit={values => search(values)}
effects={($, actions) => { effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, effects, FORM_FILTER_PATH) useStateFilterSearchLinkageEffect($, actions, effects, FORM_FILTER_PATH)
......
...@@ -57,9 +57,25 @@ const BasicInfo: React.FC<BasicInfoprops> = (props: any) => { ...@@ -57,9 +57,25 @@ const BasicInfo: React.FC<BasicInfoprops> = (props: any) => {
return ( return (
<Form {...layout} form={form}> <Form {...layout} form={form}>
<Form.Item label="需求计划摘要" rules={[{ required: true, message: '请输入需求计划摘要' }]} name="summary"> <Form.Item noStyle shouldUpdate={(prevValues, curValues) => (prevValues.startTime && prevValues.endTime) !== (curValues.startTime && curValues.endTime)}>
{({ getFieldValue }) => {
if (getFieldValue('startTime') && getFieldValue('endTime')) {
form.setFieldsValue({'summary': `${getFieldValue('startTime').format('YYYY-MM-DD')}-${getFieldValue('endTime').format('YYYY-MM-DD')}需求计划`})
}
return (getFieldValue('startTime') && getFieldValue('endTime')) && (
<Form.Item
label="需求计划摘要"
name="summary"
rules={[{
required: true,
message: '请输入需求计划摘要'
}]}
>
<Input /> <Input />
</Form.Item> </Form.Item>
)
}}
</Form.Item>
<Form.Item required label="需求计划周期" style={{ marginBottom: 0 }}> <Form.Item required label="需求计划周期" style={{ marginBottom: 0 }}>
<DatePicker <DatePicker
startTimeName='startTime' startTimeName='startTime'
......
...@@ -251,7 +251,7 @@ const BasicInfo: React.FC<Iprops> = (props: any) => { ...@@ -251,7 +251,7 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
name='details' name='details'
rules={[{ required: true, message: '请输入需求单摘要' }]} rules={[{ required: true, message: '请输入需求单摘要' }]}
> >
<Input /> <Input maxLength={30} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={ label={
......
...@@ -159,37 +159,37 @@ const Condition: React.FC<Iprops> = (props: any) => { ...@@ -159,37 +159,37 @@ const Condition: React.FC<Iprops> = (props: any) => {
label="报价要求" label="报价要求"
name="offer" name="offer"
> >
<TextArea rows={3} /> <TextArea rows={3} maxLength={50} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="付款要求" label="付款要求"
name="paymentType" name="paymentType"
> >
<TextArea rows={3} /> <TextArea rows={3} maxLength={50} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="税费要求" label="税费要求"
name="taxes" name="taxes"
> >
<TextArea rows={3} /> <TextArea rows={3} maxLength={50} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="物流要求" label="物流要求"
name="logistics" name="logistics"
> >
<TextArea rows={3} /> <TextArea rows={3} maxLength={50} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="包装要求" label="包装要求"
name="packRequire" name="packRequire"
> >
<TextArea rows={3} /> <TextArea rows={3} maxLength={50} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="其他要求" label="其他要求"
name="otherRequire" name="otherRequire"
> >
<TextArea rows={3} /> <TextArea rows={3} maxLength={50} />
</Form.Item> </Form.Item>
</Col> </Col>
</Row> </Row>
......
...@@ -146,7 +146,6 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => { ...@@ -146,7 +146,6 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => {
if (data.customerCategory) { if (data.customerCategory) {
const fullId = data.customerCategory.fullId; const fullId = data.customerCategory.fullId;
const ids = fullId.replace(/\b(0+)/gi, '').split('.'); const ids = fullId.replace(/\b(0+)/gi, '').split('.');
console.log(ids, fullId)
form.setFieldsValue({ form.setFieldsValue({
ids: ids.join(',').split(','), ids: ids.join(',').split(','),
}) })
...@@ -189,6 +188,7 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => { ...@@ -189,6 +188,7 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => {
urls: files urls: files
} }
onConfirm(data) onConfirm(data)
setProduct([])
form.resetFields(); form.resetFields();
setFiles([]) setFiles([])
}).catch(error => { }).catch(error => {
...@@ -197,6 +197,7 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => { ...@@ -197,6 +197,7 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => {
} }
/** 取消提交 */ /** 取消提交 */
const handleClose = () => { const handleClose = () => {
setProduct([])
form.resetFields(); form.resetFields();
setFiles([]) setFiles([])
onClose() onClose()
......
...@@ -96,11 +96,8 @@ export const DEMANDPLANADDED_SECHEMA: ISchema = { ...@@ -96,11 +96,8 @@ export const DEMANDPLANADDED_SECHEMA: ISchema = {
}, },
properties: { properties: {
ctl: { ctl: {
type: 'object', type: "object",
"x-component": "Children", "x-component": "controllerBtns",
"x-component-props": {
children: "{{controllerBtns}}"
}
}, },
needPlanNo: { needPlanNo: {
type: 'string', type: 'string',
......
...@@ -108,11 +108,8 @@ export const INQUIRYWAITORDER_SCHEMA: ISchema = { ...@@ -108,11 +108,8 @@ export const INQUIRYWAITORDER_SCHEMA: ISchema = {
}, },
properties: { properties: {
ctl: { ctl: {
type: 'object', type: "object",
"x-component": "Children", "x-component": "controllerBtns",
"x-component-props": {
children: "{{controllerBtns}}"
}
}, },
purchaseInquiryNo: { purchaseInquiryNo: {
type: 'string', type: 'string',
...@@ -277,11 +274,8 @@ export const PurchaseDemandPublicSchema: ISchema = { ...@@ -277,11 +274,8 @@ export const PurchaseDemandPublicSchema: ISchema = {
}, },
properties: { properties: {
ctl: { ctl: {
type: 'object', type: "object",
"x-component": "Children", "x-component": "controllerBtns",
"x-component-props": {
children: "{{controllerBtns}}"
}
}, },
requisitionFormNo: { requisitionFormNo: {
type: 'string', type: 'string',
...@@ -729,11 +723,8 @@ export const CONFIRMOFFERAUDIT_SCHEMA: ISchema = { ...@@ -729,11 +723,8 @@ export const CONFIRMOFFERAUDIT_SCHEMA: ISchema = {
}, },
properties: { properties: {
ctl: { ctl: {
type: 'object', type: "object",
"x-component": "Children", "x-component": "controllerBtns",
"x-component-props": {
children: "{{controllerBtns}}"
}
}, },
purchaseInquiryNo: { purchaseInquiryNo: {
type: 'string', type: 'string',
...@@ -996,11 +987,8 @@ export const OFFERSERAHAUDIT_SCHEMA: ISchema = { ...@@ -996,11 +987,8 @@ export const OFFERSERAHAUDIT_SCHEMA: ISchema = {
}, },
properties: { properties: {
ctl: { ctl: {
type: 'object', type: "object",
"x-component": "Children", "x-component": "controllerBtns",
"x-component-props": {
children: "{{controllerBtns}}"
}
}, },
quotedPriceNo: { quotedPriceNo: {
type: 'string', type: 'string',
......
...@@ -108,11 +108,8 @@ export const PURCHASEBIDREADYADD_SCHEMA: ISchema = { ...@@ -108,11 +108,8 @@ export const PURCHASEBIDREADYADD_SCHEMA: ISchema = {
}, },
properties: { properties: {
ctl: { ctl: {
type: 'object', type: "object",
"x-component": "Children", "x-component": "controllerBtns",
"x-component-props": {
children: "{{controllerBtns}}"
}
}, },
biddingNo: { biddingNo: {
type: 'string', type: 'string',
......
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