Commit 4676b9cc authored by xiexiuxing's avatar xiexiuxing

请购单改,曾加请购人字段

parent 6ed948d7
......@@ -3,7 +3,7 @@ import StandardTable from '@/components/StandardTable';
import NestTable from '@/components/NestTable';
import { IStandardTableProps } from 'god/dist/src/standard-table';
import { Row, Col, Modal } from 'antd';
import { productModalSchema, productModalByMemberSchema, memberModalSchema, inquirySchema, demandSchema, enquirySchema, mergeOrderSchema, goodsModalSchema, demandNumberSchema, logisticsDeliverySearchSchema, addOrderModalSchema , logisticsSelectGoodsSearchSchema, SelectRfqOrderSearchSchema, SelectLogisticsService, contractSchema, departmentSchema, requisitionSchema} from './schema';
import { requisitSchema, productModalSchema, productModalByMemberSchema, memberModalSchema, inquirySchema, demandSchema, enquirySchema, mergeOrderSchema, goodsModalSchema, demandNumberSchema, logisticsDeliverySearchSchema, addOrderModalSchema, logisticsSelectGoodsSearchSchema, SelectRfqOrderSearchSchema, SelectLogisticsService, contractSchema, departmentSchema, requisitionSchema } from './schema';
import Search from '../NiceForm/components/Search';
import SearchSelect from '../NiceForm/components/SearchSelect';
import Submit from '../NiceForm/components/Submit';
......@@ -18,7 +18,7 @@ export interface ModalTableProps extends IStandardTableProps<any> {
cancel?(),
visible?: boolean,
resetModal?: object,
modalType?: 'productByDefault' | 'productByMember' | 'memberByDefault' | 'inquiryByDefault' | 'demandByDefault' | 'enquiryModel' | 'MergeOrderByDefault' | 'goodsModalSchema' | 'demandNumberSchema' | 'logisticsDelivery' | 'addOrderModalSchema' | 'selectGoodsSchema' | 'selectRfqOrder' | 'SelectLogisticsService' | 'contractByDefault' | 'departmentSchema' | 'requisitionSchema' | 'none' ,
modalType?: 'productByDefault' | 'productByMember' | 'memberByDefault' | 'inquiryByDefault' | 'demandByDefault' | 'enquiryModel' | 'MergeOrderByDefault' | 'goodsModalSchema' | 'demandNumberSchema' | 'logisticsDelivery' | 'addOrderModalSchema' | 'selectGoodsSchema' | 'selectRfqOrder' | 'SelectLogisticsService' | 'contractByDefault' | 'departmentSchema' | 'requisitionSchema' | 'requisitSchema' | 'none',
useNestTable?: boolean, // 是否使用嵌套表格
nestColumns?: any[],
nestTableProps?: any,
......@@ -27,8 +27,8 @@ export interface ModalTableProps extends IStandardTableProps<any> {
searchName?: string
}
const ModalTable:React.FC<ModalTableProps> = (props) => {
const { width = 704, modalTitle, confirm, cancel, visible, currentRef, resetModal, modalType = 'none', forceRender, useNestTable = false, nestColumns, nestTableProps,searchName , ...resetTable } = props
const ModalTable: React.FC<ModalTableProps> = (props) => {
const { width = 704, modalTitle, confirm, cancel, visible, currentRef, resetModal, modalType = 'none', forceRender, useNestTable = false, nestColumns, nestTableProps, searchName, ...resetTable } = props
const selfRef = currentRef || useRef<any>({})
useEffect(() => {
if (visible && forceRender) {
......@@ -59,7 +59,7 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
return inquirySchema
}
case 'enquiryModel':{
case 'enquiryModel': {
return enquirySchema
}
......@@ -100,6 +100,9 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
case 'requisitionSchema': {
return requisitionSchema
}
case 'requisitSchema': {
return requisitSchema
}
case 'none': {
return {}
}
......@@ -122,33 +125,33 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
rowClassName={(_, index) => (index % 2) === 0 && "tb_bg"}
{...nestTableProps}
/>
) : (
<StandardTable
tableType='small'
currentRef={selfRef}
formRender={(child, ps) => <Row justify='space-between' style={{marginBottom: 16}}>
<Col style={{ zIndex: 99, width: 'calc(100% - 130px)' }}>{child}</Col>
<Col style={{ marginTop: 4, minWidth: 128 }}>{ps}</Col>
</Row >}
formilyProps={
modalType === 'none' ? null : {
ctx: {
schema: modelSchemaRender(),
components: { ModalSearch: Search, SearchSelect, Submit, DateSelect },
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
searchName ? searchName : 'name',
FORM_FILTER_PATH,
);
) : (
<StandardTable
tableType='small'
currentRef={selfRef}
formRender={(child, ps) => <Row justify='space-between' style={{ marginBottom: 16 }}>
<Col style={{ zIndex: 99, width: 'calc(100% - 130px)' }}>{child}</Col>
<Col style={{ marginTop: 4, minWidth: 128 }}>{ps}</Col>
</Row >}
formilyProps={
modalType === 'none' ? null : {
ctx: {
schema: modelSchemaRender(),
components: { ModalSearch: Search, SearchSelect, Submit, DateSelect },
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
searchName ? searchName : 'name',
FORM_FILTER_PATH,
);
}
}
}
}
{...resetTable}
/>
}
{...resetTable}
/>
)
}
......
......@@ -1173,3 +1173,31 @@ export const departmentSchema: ISchema = {
}
}
}
export const requisitSchema: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
"x-component": 'Search',
"x-component-props": {
placeholder: '请输入姓名'
}
},
// org: {
// type: 'string',
// "x-component": 'Search',
// "x-component-props": {
// placeholder: '请输入所属机构'
// }
// },
// jobTitle: {
// type: 'string',
// "x-component": 'Search',
// "x-component-props": {
// placeholder: '请输入职位'
// }
// }
}
}
\ No newline at end of file
......@@ -249,11 +249,11 @@ const Products: React.FC<{}> = () => {
dataIndex: ['draft', 'type'],
key: 'type',
render: t => {
if(t === 1) {
if (t === 1) {
return intl.formatMessage({ id: 'commodity.products.columns.type.1' })
} else if(t === 2) {
} else if (t === 2) {
return intl.formatMessage({ id: 'commodity.products.columns.type.2' })
} else if(t === 3) {
} else if (t === 3) {
return intl.formatMessage({ id: 'commodity.products.columns.type.3' })
}
}
......@@ -296,8 +296,8 @@ const Products: React.FC<{}> = () => {
dataIndex: 'option',
width: 160,
render: (text, record) => (<>
<Button type='link' onClick={()=>clickDraftModify(record)}>{intl.formatMessage({ id: 'commodity.products.products.button.draft.option1' })}</Button>
<Button type='link' onClick={()=>clickDraftDelete(record)}>{intl.formatMessage({ id: 'commodity.products.products.button.draft.option2' })}</Button>
<Button type='link' onClick={() => clickDraftModify(record)}>{intl.formatMessage({ id: 'commodity.products.products.button.draft.option1' })}</Button>
<Button type='link' onClick={() => clickDraftDelete(record)}>{intl.formatMessage({ id: 'commodity.products.products.button.draft.option2' })}</Button>
</>)
}
];
......@@ -314,8 +314,8 @@ const Products: React.FC<{}> = () => {
okType: 'danger',
cancelText: intl.formatMessage({ id: 'commodity.products.confirmDelete.cancelText' }),
onOk() {
postProductCommodityDeleteCommodityDraftBatch({idList: [record['id']]}).then(({code}) => {
if(code === 1000) {
postProductCommodityDeleteCommodityDraftBatch({ idList: [record['id']] }).then(({ code }) => {
if (code === 1000) {
refDraft.current.reload()
}
})
......@@ -419,7 +419,7 @@ const Products: React.FC<{}> = () => {
let a: any = document.createElement("a")
document.body.appendChild(a)
a.style = "display: none"
getProductCommodityExportCommodityTemplate({ }, { responseType: 'blob', getResponse: true }).then((res: any) => {
getProductCommodityExportCommodityTemplate({}, { responseType: 'blob', getResponse: true }).then((res: any) => {
const { data, response } = res
const filename = response.headers.get('content-disposition').split('=')[1]
let blob = new Blob([data], { type: "application/vnd.ms-excel" })
......@@ -551,13 +551,13 @@ const Products: React.FC<{}> = () => {
setCurrentOptionRow(record)
const fn = record?.id ? getProductCommodityGetShop : postProductCommodityGetShopBatch
// @ts-ignore
fn(record?.id ? { id: record.id } : { idList: currentCtrlRef.current.selectedRowKeys }, { ctlType: 'none' }).then(({data}) => {
fn(record?.id ? { id: record.id } : { idList: currentCtrlRef.current.selectedRowKeys }, { ctlType: 'none' }).then(({ data }) => {
setShopsOption(data.sort((a, b) => a.shopId - b.shopId))
let initValue = {}
data.forEach(item => {
initValue[item.shopId] = item.isCheck
})
upForm.setFieldsValue({...initValue})
upForm.setFieldsValue({ ...initValue })
})
setIsUp(param)
setUpDownModal(true)
......@@ -573,8 +573,8 @@ const Products: React.FC<{}> = () => {
const checkShops = [...params.upShops]
// 1. 判断是否有店铺
const hasShop = await judgeStop(checkShops)
if(hasShop) {
const params = isBatch ? currentCtrlRef.current.selectedRowKeys: [currentOptionRow.id]
if (hasShop) {
const params = isBatch ? currentCtrlRef.current.selectedRowKeys : [currentOptionRow.id]
// 2. 判断是否库存
const hasStore = await judgeStore(params)
if (hasStore) {
......@@ -663,7 +663,7 @@ const Products: React.FC<{}> = () => {
const shopId = shopIdRef.current
// @ts-ignore
fn(isBatch ? { storeId: shopId['id'], storeName: shopId['name'], storeLogo: shopId['logo'], shopList: params.shopList, idList: RowCtl.selectedRowKeys } : { storeId: shopId?.id || null, storeName: shopId?.name || null, storeLogo: shopId?.logo || null, ...params }).then((res) => {
if(res.code === 1000) {
if (res.code === 1000) {
setGiudeVisible(false)
ref.current.reload()
setIsDisabledOKbtn(false)
......@@ -680,7 +680,7 @@ const Products: React.FC<{}> = () => {
}
if (isUp) {
if (upShops.length > 0) {
handlePutwayGuide({upShops}).then(res => {
handlePutwayGuide({ upShops }).then(res => {
// 返回true时 全部验证通过
if (res) {
// 执行上架逻辑
......@@ -819,7 +819,7 @@ const Products: React.FC<{}> = () => {
if (selectedRowKeys.length > 1000) {
return message.error(intl.formatMessage({ id: 'commodity.products.schema.fastSchema.zuiduodaochuyiqiange' }))
}
postProductCommodityExportCommoditySkuByCommodityIdList({idList: selectedRowKeys}, { responseType: 'blob', getResponse: true }).then((res:any) => {
postProductCommodityExportCommoditySkuByCommodityIdList({ idList: selectedRowKeys }, { responseType: 'blob', getResponse: true }).then((res: any) => {
const { data, response } = res
const filename = response.headers.get('content-disposition').split('=')[1]
let blob = new Blob([data], { type: "application/vnd.ms-excel" })
......@@ -935,7 +935,7 @@ const Products: React.FC<{}> = () => {
{intl.formatMessage({ id: 'commodity.products.menuMore.5' })}
</Menu.Item>
<Menu.Item key="6" icon={<ExportOutlined />}>
{intl.formatMessage({ id: 'commodity.products.huoqushangyougongyingshangpin'})}
{intl.formatMessage({ id: 'commodity.products.huoqushangyougongyingshangpin' })}
</Menu.Item>
{/* <Menu.Item key="7" icon={<ExportOutlined />}>
{intl.formatMessage({ id: 'commodity.products.huoquxiayouxiaoshoushangpin'})}
......@@ -953,7 +953,7 @@ const Products: React.FC<{}> = () => {
<PlusOutlined />{intl.formatMessage({ id: 'commodity.products.controllerBtns.button.1' })}
</Button>
</AuthButton>
<Button style={{margin:'0 16px'}} onClick={()=>setImportModal(true)}>{intl.formatMessage({ id: 'commodity.products.controllerBtns.button.3' })}</Button>
<Button style={{ margin: '0 16px' }} onClick={() => setImportModal(true)}>{intl.formatMessage({ id: 'commodity.products.controllerBtns.button.3' })}</Button>
<AuthButton btnCode='products.batch' >
<Dropdown overlay={menuMore} trigger={['click']}>
<Button>
......@@ -1096,31 +1096,31 @@ const Products: React.FC<{}> = () => {
<Modal
title={isUp ? intl.formatMessage({ id: 'commodity.products.modal.title.2' }) : intl.formatMessage({ id: 'commodity.products.modal.title.3' })}
visible={upDownModal}
onOk={()=>upForm.submit()}
onOk={() => upForm.submit()}
onCancel={handleCancelUp}
forceRender={true}
okButtonProps={{ disabled: isDisabledOKbtn }}
width={600}
>
<Form
labelCol={{span: 12}}
wrapperCol={{span: 12}}
labelCol={{ span: 12 }}
wrapperCol={{ span: 12 }}
form={upForm}
onFinish={handleUp}
>
{/* 优化上下架操作用户体验 */}
<h4>{isUp ? intl.formatMessage({ id: 'commodity.products.modal.form.label.1.isUpTrue1' }) : intl.formatMessage({ id: 'commodity.products.modal.form.label.1.isUpFalse1' })}</h4>
<Row>
{
Array.isArray(shopsOption) && shopsOption.map((item, index) =><Col span={12} key={item.shopId}>
<Form.Item name={item.shopId} label={item.name}>
<Radio.Group>
<Radio value={true}>{intl.formatMessage({id: 'commodity.products.operationHandler.5'})}</Radio>
<Radio value={false}>{intl.formatMessage({id: 'commodity.products.operationHandler.6'})}</Radio>
</Radio.Group>
</Form.Item>
</Col>)
}
{
Array.isArray(shopsOption) && shopsOption.map((item, index) => <Col span={12} key={item.shopId}>
<Form.Item name={item.shopId} label={item.name}>
<Radio.Group>
<Radio value={true}>{intl.formatMessage({ id: 'commodity.products.operationHandler.5' })}</Radio>
<Radio value={false}>{intl.formatMessage({ id: 'commodity.products.operationHandler.6' })}</Radio>
</Radio.Group>
</Form.Item>
</Col>)
}
</Row>
</Form>
</Modal>
......@@ -1156,7 +1156,7 @@ const Products: React.FC<{}> = () => {
title={intl.formatMessage({ id: 'common.tip.modal.tip' })}
visible={exportVisible}
onOk={handleExport}
onCancel={()=>setExportVisible(false)}
onCancel={() => setExportVisible(false)}
confirmLoading={exportLoading}
>
<h2>{intl.formatMessage({ id: 'commodity.products.handleExport.querendaochu' })}</h2>
......
......@@ -11,19 +11,38 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import '../index.less'
import { tableListSchema } from '../constant'
import { getPurchaseRequisitionFirstAuditPage } from '@/services/PurchaseV2Api'
import NiceForm from '@/components/NiceForm';
import { createFormActions } from '@formily/antd';
import { getMemberUserPage } from '@/services/MemberV2Api';
// 待审核请购单 一级
export interface FirstApprovedBillProps {}
export interface FirstApprovedBillProps { }
const fetchTableData = async (params) => {
const { data } = await getPurchaseRequisitionFirstAuditPage(params)
return data
}
const FirstApprovedBill:React.FC<FirstApprovedBillProps> = () => {
const FirstApprovedBill: React.FC<FirstApprovedBillProps> = () => {
const { columns, ref } = useSelfTable()
const intl = useIntl()
const formActions = createFormActions();
const handleSearch = async value => {
if (!value) {
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = [];
});
return;
}
const data: any = { name: value, status: '1', pageSize: 10, current: 1 }
const res = await getMemberUserPage(data)
const list = res.data.data.map((item) => { return { label: item.name, value: item.userId } })
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = list;
});
};
const controllerBtns = null;
return <PageHeaderWrapper>
<Card>
<StandardTable
......@@ -31,31 +50,29 @@ const FirstApprovedBill:React.FC<FirstApprovedBillProps> = () => {
columns={columns}
currentRef={ref}
rowKey="id"
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
schema: tableListSchema(),
effects: ($, actions) => {
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
expressionScope={{
controllerBtns,
handleSearch,
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'requisitionNo',
FORM_FILTER_PATH,
);
},
components: {
}}
schema={tableListSchema()}
components={{
DateRangePickerUnix,
Submit
}
},
layouts: {
order: 2,
span: 24
}
}}
Submit,
}}
/>
}
/>
</Card>
</PageHeaderWrapper>
......
import { postMemberManageLowerProviderPage } from "@/services/MemberV2Api"
import { getMemberUserPage, postMemberManageLowerProviderPage } from "@/services/MemberV2Api"
import { getProductCommodityCommonGetCommodityListByBuyer, getProductGoodsGetGoodsList } from "@/services/ProductV2Api"
export const fetchOrderApi = {
......@@ -20,5 +20,11 @@ export const fetchOrderApi = {
return data
},
/** 查询请购人 */
async getMemberUserPageList (params) {
const {data} = await getMemberUserPage(params)
return data;
}
}
import React, { useEffect } from 'react'
import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import { fetchOrderApi } from '../../apis'
import { useModalTable } from '../../model/useModalTable'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { RequisitiColumns } from '../../constant'
import { useIntl } from 'umi'
export interface MemberModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
confirmModal?(),
productRef?: any,
}
const RequisitionerTable: React.FC<MemberModalTableProps> = (props) => {
const { type = 'radio', schemaAction, confirmModal, currentRef, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({ type, customKey: 'userId' })
const intl = useIntl()
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
rowSelectionCtl
}
}
}, [])
useEffect(() => {
if (visible) {
const memberId = schemaAction.getFieldValue('requisitionerId')
rowSelectionCtl.setSelectedRowKeys([memberId])
}
}, [visible])
const handleConfirm = () => {
const rowItem = rowSelectionCtl.selectRow[0]
console.log(rowItem, 'row')
if (rowItem) {
schemaAction.setFieldValue('requisitioner', rowItem.name)
schemaAction.setFieldValue('requisitionerId', rowItem.userId)
// schemaAction.setFieldValue('vendorMemberName', rowItem.name)
}
confirmModal && confirmModal()
setVisible(false)
}
return (
<ModalTable
modalTitle="选择请购人"
columns={RequisitiColumns}
visible={visible}
confirm={handleConfirm}
cancel={() => setVisible(false)}
fetchTableData={(params) => fetchOrderApi.getMemberUserPageList({ ...params })}
rowSelection={rowSelection}
modalType='requisitSchema'
tableProps={{
rowKey: 'userId'
}}
{...restProps}
/>
)
}
RequisitionerTable.defaultProps = {}
export default RequisitionerTable
......@@ -180,3 +180,33 @@ export const materialInfoColumns: any[] = [
key: 'ctl',
},
]
export const RequisitiColumns: any[] = [
{
title: "姓名",
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: "手机号",
dataIndex: 'phone',
align: 'center',
key: 'phone',
},
{
title: "所属机构",
dataIndex: 'orgName',
align: 'center',
key: 'orgName',
},
{
title: "职位",
dataIndex: 'jobTitle',
align: 'center',
key: 'jobTitle',
},
]
......@@ -14,14 +14,19 @@ import { useMaterialTable } from './model/useMaterialTable'
import MaterialModalTable from './components/materialModalTable'
import DepartmentModalTable from './components/departmentModalTable'
import MemberModalTable from './components/memberModalTable'
import RequisitionerTable from './components/requisitionerTable'
import AddressSelect from '@/components/AddressSelect'
import styled from 'styled-components'
import FormDetailHeader from '@/components/FormDetailHeader'
import FormDetailWrapper from '@/components/FormDetailWrapper'
import { FormDetailContext } from '@/formSchema/context'
import { useFormDetail } from '@/formSchema/effects/useFormDetail'
import { getPurchaseRequisitionDetail, postPurchaseRequisitionCreate, postPurchaseRequisitionUpdate } from '@/services/PurchaseV2Api'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { getPurchaseRequisitionDeliveryMethodItems, getPurchaseRequisitionDetail, postPurchaseRequisitionCreate, postPurchaseRequisitionUpdate } from '@/services/PurchaseV2Api'
import { UPLOAD_TYPE } from '@/constants'
import styles from './index.less'
import { ADDRESS_TYPE } from '../../purchaseAbility/purchaseBid/readyAdd/components/condition'
const addSchemaAction = createFormActions()
const { Option } = Select;
......@@ -60,8 +65,11 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
const IncreaseRequisition: React.FC<{}> = () => {
const departmentRef = useRef<any>({}) // 选部门
const memberRef = useRef<any>({})
const RequisRef = useRef<any>({}) // 请购人
const AddressRef = useRef<any>({});
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
const [selAddress, setSelAddress] = useState<ADDRESS_TYPE>();
const update = useUpdate()
const { id } = usePageStatus()
const [initFormValue, setInitFormValue] = useState<any>({})
......@@ -130,6 +138,23 @@ const IncreaseRequisition: React.FC<{}> = () => {
}
}
// 选中请购人
const handleOrder = () => {
RequisRef.current.setVisible(true)
}
const RequisitionerBtn = <div className='connectBtn' onClick={handleOrder}><LinkOutlined style={{ marginRight: 4 }} />{intl.formatMessage({ id: 'purchaseRequisition.xuanze', defaultMessage: '选择' })}</div>
const getFullAddress = (info) => {
const params: ADDRESS_TYPE = {
fullAddress: `${info.name} ${info.fullAddress} ${info.phone}`,
id: info.id,
phone: info.phone,
name: info.name,
}
setSelAddress(params)
}
// 选择会员弹窗
const handleOrderMember = () => {
memberRef.current.setVisible(true)
......@@ -173,18 +198,7 @@ const IncreaseRequisition: React.FC<{}> = () => {
}
}
]
// const dataSource = [
// {
// deliveryTime1: 'xxxx',
// deliveryTime: 'xxxx',
// id: 1,
// },
// {
// deliveryTime1: 'xxxx',
// deliveryTime: 'xxxx',
// id: 2,
// }
// ]
// 上传
const handleFrontUrl = async ({ fileList }) => {
if (fileList[0].response) {
......@@ -199,6 +213,16 @@ const IncreaseRequisition: React.FC<{}> = () => {
}
}
const fetchOptions = (service) => {
console.log(service, 'service')
return async function () {
const res = await service();
if (res.code === 1000) {
return res.data.deliveryMethods.map((item) => { return { label: item.deliveryMethodName, value: item.deliveryMethod } })
}
return [];
}
}
/**
* 上传大小限制
* */
......@@ -250,7 +274,12 @@ const IncreaseRequisition: React.FC<{}> = () => {
effects={($, ctx) => {
$('onFormMount').subscribe(() => { })
useEditHideField()
useAsyncSelect(
"deliveryMethod",
fetchOptions(
getPurchaseRequisitionDeliveryMethodItems,
)
)
// ctx.setFieldValue('productsList', dataSource)
// 物料信息的改动 渲染总额
useMaterialTableChangeForAmount(ctx, update)
......@@ -258,12 +287,31 @@ const IncreaseRequisition: React.FC<{}> = () => {
// 注入表单完成进度
formContext.useAttachmentChangeForContext(ctx)
$('onFieldChange', 'deliveryMethod').subscribe(res => {
if (res.value === 2) {
addSchemaAction.setFieldState('deliveryAddress', state => {
state.visible = false;
});
addSchemaAction.setFieldState('address', state => {
state.visible = true;
});
} else {
addSchemaAction.setFieldState('deliveryAddress', state => {
state.visible = true;
});
addSchemaAction.setFieldState('address', state => {
state.visible = false;
});
}
})
}}
expressionScope={{
memberBtn,
departmentBtn,
materialColumns,
materialAddButton,
RequisitionerBtn,
materialComponents,
help,
enclosureColumns,
......@@ -280,6 +328,8 @@ const IncreaseRequisition: React.FC<{}> = () => {
<MaterialModalTable currentRef={materialRef} schemaAction={addSchemaAction} sectionProps={surplusProps} />
{/* 选择供应会员 */}
<MemberModalTable currentRef={memberRef} schemaAction={addSchemaAction} />
{/* 请购人选择会员 */}
<RequisitionerTable currentRef={RequisRef} schemaAction={addSchemaAction} />
{/* </PageHeaderWrapper> */}
</div>)
......
......@@ -110,24 +110,21 @@ const basicInfo: ISchema = {
title: getIntl().formatMessage({ id: 'purchaseRequisition.neibuzhuangtai', defaultMessage: '内部状态' }),
visible: false
},
deliverTime: {
// 请购人
requisitioner: {
type: 'string',
title: "请购人",
"x-rules": [
{
required: true,
message:"请输入请购人"
},
{
limitByte: true,
maxByte: 100
}
],
"x-mega-props": {
span: 1
}
title: '请购人',
"x-component-props": {
disabled: true,
addonAfter: "{{RequisitionerBtn}}"
},
required: true,
},
requisitionerId:{
type: 'string',
visible: false
}
}
},
......@@ -171,9 +168,10 @@ const delivery: ISchema = {
span: 1
}
},
purpose: {
deliveryMethod: {
type: 'string',
title: "配送方式",
enum: [],
"x-rules": [
{
required: true,
......@@ -188,7 +186,19 @@ const delivery: ISchema = {
span: 1
}
},
vendorMemberName: {
//
address: {
visible:false,
type: 'string',
title: '送货地址',
required: true,
'x-component': 'CustomAddressSelect',
"x-mega-props": {
span: 1
}
},
deliveryAddress: {
// visible:false,
type: 'string',
title: "送货地址",
"x-rules": [
......
......@@ -18,6 +18,7 @@ import {
postPurchaseRequisitionPause,
} from '@/services/PurchaseV2Api';
import { useIntl } from 'umi';
import { getMemberUserPage } from '@/services/MemberV2Api';
// 请购单查询
......@@ -144,13 +145,21 @@ const RequestBill: React.FC<RequestBillProps> = () => {
]);
}
};
const handleSearch = value => {
const handleSearch = async value => {
console.log(value)
if (!value) {
formActions.setFieldState('qinggouPenson', fieldState => {
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = [];
});
return;
}
const data: any = { name: value, status: '1', pageSize: 10, current: 1 }
const res = await getMemberUserPage(data)
const list = res.data.data.map((item) => { return { label: item.name, value: item.userId } })
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = list;
});
console.log(list)
};
return (
<PageHeaderWrapper>
......
......@@ -12,8 +12,10 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import '../index.less'
import { tableListSchema } from '../constant'
import { getPurchaseRequisitionCreatePage } from '@/services/PurchaseV2Api'
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { createAsyncFormActions, createFormActions, FormEffectHooks } from '@formily/antd';
import { searchOptionEffect } from './effect';
import { getMemberUserPage } from '@/services/MemberV2Api';
import NiceForm from '@/components/NiceForm';
// 待新增请购单
......@@ -33,7 +35,32 @@ const ReadyAddBill: React.FC<ReadyAddBillProps> = () => {
const formActions = createFormActions();
const handleSearch = async value => {
if (!value) {
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = [];
});
return;
}
const data: any = { name: value, status: '1', pageSize: 10, current: 1 }
const res = await getMemberUserPage(data)
const list = res.data.data.map((item) => { return { label: item.name, value: item.userId } })
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = list;
});
};
const controllerBtns = (
<Space>
<Button
icon={<PlusCircleOutlined />}
type='primary'
onClick={clickAdd}
>
{intl.formatMessage({ id: 'purchaseRequisition.xinjian', defaultMessage: '新建' })}
</Button>
</Space>
)
return <PageHeaderWrapper>
<Card>
<StandardTable
......@@ -41,53 +68,32 @@ const ReadyAddBill: React.FC<ReadyAddBillProps> = () => {
columns={columns}
currentRef={ref}
rowKey="id"
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
schema: tableListSchema(),
effects: ($, actions) => {
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
expressionScope={{
controllerBtns,
handleSearch,
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'requisitionNo',
FORM_FILTER_PATH,
);
FormEffectHooks.onFieldChange$('brandId').subscribe(state => {
searchOptionEffect(actions, 'brandId')
})
},
components: {
}}
schema={tableListSchema()}
components={{
DateRangePickerUnix,
Submit
}
},
layouts: {
order: 2,
span: 24
}
}}
formilyChilds={{
children: <Space>
<Button
icon={<PlusCircleOutlined />}
type='primary'
onClick={clickAdd}
>
{intl.formatMessage({ id: 'purchaseRequisition.xinjian', defaultMessage: '新建' })}
</Button>
</Space>,
layouts: {
span: 8
}
}}
Submit,
}}
/>
}
/>
</Card>
</PageHeaderWrapper>
......
......@@ -10,19 +10,37 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import '../index.less'
import { tableListSchema } from '../constant'
import { getPurchaseRequisitionSubmitPage } from '@/services/PurchaseV2Api'
import { getMemberUserPage } from '@/services/MemberV2Api';
import NiceForm from '@/components/NiceForm';
import { createFormActions } from '@formily/antd';
// 待提交请购单
export interface ReadySubmitBillProps {}
export interface ReadySubmitBillProps { }
const fetchTableData = async (params) => {
const { data } = await getPurchaseRequisitionSubmitPage(params)
return data
}
const ReadySubmitBill:React.FC<ReadySubmitBillProps> = () => {
const ReadySubmitBill: React.FC<ReadySubmitBillProps> = () => {
const { columns, ref } = useSelfTable()
const formActions = createFormActions();
const handleSearch = async value => {
if (!value) {
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = [];
});
return;
}
const data: any = { name: value, status: '1', pageSize: 10, current: 1 }
const res = await getMemberUserPage(data)
const list = res.data.data.map((item) => { return { label: item.name, value: item.userId } })
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = list;
});
};
const controllerBtns = null;
return <PageHeaderWrapper>
<Card>
<StandardTable
......@@ -30,32 +48,31 @@ const ReadySubmitBill:React.FC<ReadySubmitBillProps> = () => {
columns={columns}
currentRef={ref}
rowKey="id"
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
schema: tableListSchema(),
effects: ($, actions) => {
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
expressionScope={{
controllerBtns,
handleSearch,
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'requisitionNo',
FORM_FILTER_PATH,
);
},
components: {
}}
schema={tableListSchema()}
components={{
DateRangePickerUnix,
Submit
}
},
layouts: {
order: 2,
span: 24
}
}}
Submit,
}}
/>
}
/>
</Card>
</PageHeaderWrapper>
}
......
......@@ -10,19 +10,37 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import '../index.less'
import { tableListSchema } from '../constant'
import { getPurchaseRequisitionTwoAuditPage } from '@/services/PurchaseV2Api'
import { createFormActions } from '@formily/antd';
import { getMemberUserPage } from '@/services/MemberV2Api';
import NiceForm from '@/components/NiceForm';
// 待审核请购单 二级
export interface SecondApprovedBillProps {}
export interface SecondApprovedBillProps { }
const fetchTableData = async (params) => {
const { data } = await getPurchaseRequisitionTwoAuditPage(params)
return data
}
const SecondApprovedBill:React.FC<SecondApprovedBillProps> = () => {
const SecondApprovedBill: React.FC<SecondApprovedBillProps> = () => {
const { columns, ref } = useSelfTable()
const formActions = createFormActions();
const handleSearch = async value => {
if (!value) {
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = [];
});
return;
}
const data: any = { name: value, status: '1', pageSize: 10, current: 1 }
const res = await getMemberUserPage(data)
const list = res.data.data.map((item) => { return { label: item.name, value: item.userId } })
formActions.setFieldState('requisitionerId', fieldState => {
fieldState.props.enum = list;
});
};
const controllerBtns = null;
return <PageHeaderWrapper>
<Card>
<StandardTable
......@@ -30,31 +48,29 @@ const SecondApprovedBill:React.FC<SecondApprovedBillProps> = () => {
columns={columns}
currentRef={ref}
rowKey="id"
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
schema: tableListSchema(),
effects: ($, actions) => {
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
expressionScope={{
controllerBtns,
handleSearch,
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'requisitionNo',
FORM_FILTER_PATH,
);
},
components: {
}}
schema={tableListSchema()}
components={{
DateRangePickerUnix,
Submit
}
},
layouts: {
order: 2,
span: 24
}
}}
Submit,
}}
/>
}
/>
</Card>
</PageHeaderWrapper>
......
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