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