Commit 6ab8f6ad authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 调整待新增销售发货单页面

parent 835fe2f6
......@@ -10,17 +10,16 @@ import Submit from '@/components/NiceForm/components/Submit'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import '../index.less'
// 待新增采购入库
// 待新增采购收货
export interface FirstApprovedOrderProps {}
export interface AddPurchaseReceiveOrderProps {}
const fetchTableData = async (params) => {
// const { data } = await getOrderPurchaseReceiptAddList(params)
return []
}
// TODO
const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
const AddPurchaseReceiveOrder:React.FC<AddPurchaseReceiveOrderProps> = (props) => {
const {
columns,
ref
......@@ -59,6 +58,6 @@ const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
</PageHeaderWrapper>
}
FirstApprovedOrder.defaultProps = {}
AddPurchaseReceiveOrder.defaultProps = {}
export default FirstApprovedOrder
export default AddPurchaseReceiveOrder
import { postMemberManageLowerProviderPage } from "@/services/MemberV2Api"
import { getProductCommodityCommonGetCommodityListByBuyer, getProductGoodsGetGoodsList } from "@/services/ProductV2Api"
export const fetchOrderApi = {
/** 弹窗获取商品列表 */
async getProductList(params) {
const { data } = await getProductCommodityCommonGetCommodityListByBuyer(params, { useCache: true, ttl: 10 * 1000 })
return data
},
/** 获取下架服务提供者会员列表 */
async getMemberListByMemberName(params) {
const { data } = await postMemberManageLowerProviderPage({...params}, { ctlType: 'none' })
return data
},
/** 请购单物料 获取商品货品列表 */
async getPurchaseRequesitionMaterielList(params) {
const { data } = await getProductGoodsGetGoodsList(params)
return data
},
}
import React, { useEffect } from 'react'
import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import { useModalTable } from '../../model/useModalTable'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { departmentColumns } from '../../constant'
import { getMemberBusinessOrganizationPage } from '@/services/MemberV2Api'
import { useIntl } from 'umi'
export interface DepartmentModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
confirmModal?()
}
// 选择部门弹窗
const DepartmentModalTable:React.FC<DepartmentModalTableProps> = (props) => {
const { type = 'radio', schemaAction, confirmModal, currentRef, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type})
const intl = useIntl()
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
rowSelectionCtl
}
}
}, [])
useEffect(() => {
if(visible) {
const departmentId = schemaAction.getFieldValue('departmentId')
rowSelectionCtl.setSelectedRowKeys([departmentId])
}
}, [visible])
const handleConfirm = async () => {
const item = rowSelectionCtl.selectRow[0]
if (item) {
schemaAction.setFieldValue('departmentId', item['id'])
schemaAction.setFieldValue('department', item['title'])
}
confirmModal && confirmModal()
setVisible(false)
}
return (
<ModalTable
modalTitle={intl.formatMessage({ id: 'purchaseRequisition.xuanzezuzhiji', defaultMessage: '选择组织机构' })}
columns={departmentColumns}
visible={visible}
confirm={handleConfirm}
cancel={() => setVisible(false)}
fetchTableData={async (params) => (await getMemberBusinessOrganizationPage({...params}, {useCache: true, ttl: 10 * 1000})).data}
rowSelection={rowSelection}
modalType='departmentSchema'
searchName="code"
tableProps={{
rowKey: 'id'
}}
resetModal={{
destroyOnClose: true,
}}
{...restProps}
/>
)
}
DepartmentModalTable.defaultProps = {}
export default DepartmentModalTable
import React, { useEffect } from 'react'
import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import { fetchOrderApi } from '../../apis'
import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const';
import Search from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit';
import Children from '@/components/NiceForm/components/Children';
import { addRequesitionMaterialSchema } from '../../schema/modal'
import { Tooltip } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import { clearModalParams } from '@/utils'
import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch'
import CustomInputSearch from '@/components/NiceForm/components/CustomInputSearch'
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from '../../effects'
import { useIntl, getIntl } from 'umi'
export interface MaterialModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
sectionProps: any,
confirmModal?()
}
export const materialColumns: any[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
className: 'commonHide'
},
// 货号 货品名称 规格型号 品类 品牌 单位
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.huohao', defaultMessage: '货号' }),
dataIndex: 'code',
align: 'center',
key: 'code',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.huopinmingcheng', defaultMessage: '货品名称' }),
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.guigexinghao', defaultMessage: '规格型号' }),
dataIndex: 'type',
align: 'center',
key: 'type',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.pinlei', defaultMessage: '品类' }),
dataIndex: ['customerCategory', 'name'],
align: 'center',
key: ['customerCategory', 'name'],
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.pinpai', defaultMessage: '品牌' }),
dataIndex: ['brand', 'name'],
align: 'center',
key: ['brand', 'name'],
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.danwei', defaultMessage: '单位' }),
dataIndex: 'unitName',
align: 'center',
key: 'unitName'
},
]
const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
const intl = useIntl()
const { type = 'checkbox', schemaAction, confirmModal, currentRef, sectionProps, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = sectionProps
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
rowSelectionCtl
}
}
}, [])
const addMaterialProcessField = (value, origin) => {
let tempOriginData = [...origin]
// 对选中值去重
const _value = Object.values(value.reduce((item, next)=>{
item[next.id] = next
return item
},{}))
if(Array.isArray(_value)) {
let processData = _value.map(v => {
let temp: any = {};
temp.id = v.id;
temp.code = v.code;
temp.name = v.name;
temp.type = v.type;
// 处理两套不同字段
temp.category = v?.customerCategory?.name || v?.category || null;
temp.brand = v?.brand?.name || v?.brand || null;
temp.unit = v?.unitName || v?.unit || null;
return temp
})
let originIds = tempOriginData.map(item => item.id)
processData.map(item => {
if(!originIds.includes(item.id)) {
tempOriginData.push(item)
}
})
return tempOriginData
}
}
const handleConfirm = async () => {
const materialData = schemaAction.getFieldValue('products')
schemaAction.setFieldValue('products', addMaterialProcessField(rowSelectionCtl.selectRow, materialData))
confirmModal && confirmModal()
setVisible(false)
clearModalParams()
}
const handleCancel = () => {
setVisible(false)
clearModalParams()
}
const otherHandle = <>
<a className="ant-btn" href="/memberCenter/commodityAbility/commodity/goods/add" target="_blank" style={{marginRight: 16}}>{intl.formatMessage({ id: 'purchaseRequisition.xinzenghuopin', defaultMessage: '新增货品' })}</a>
<Tooltip title={intl.formatMessage({ id: 'purchaseRequisition.dianjichaxun', defaultMessage: '点击查询,列表可显示新增的货品' })}>
<QuestionCircleOutlined />
</Tooltip>
</>
return (
<ModalTable
modalTitle={intl.formatMessage({ id: 'purchaseRequisition.xuanzehuopin', defaultMessage: '选择货品' })}
width={900}
columns={materialColumns}
visible={visible}
confirm={handleConfirm}
cancel={handleCancel}
fetchTableData={fetchOrderApi.getPurchaseRequesitionMaterielList}
rowSelection={rowSelection}
resetModal={{destroyOnClose: true}}
modalType='none'
tableProps={{
rowKey: 'id',
onRow: (record) => ({
onClick: () => {
rowSelectionCtl.appendSelectRow(record);
rowSelectionCtl.appendSelectRowKeys(record.id);
},
})
}}
formilyProps={{
ctx: {
schema: addRequesitionMaterialSchema,
components: {
ModalSearch: Search,
Submit,
Children,
CustomInputSearch,
CustomCategorySearch
},
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'code',
FORM_FILTER_PATH,
);
FormEffectHooks.onFieldChange$('brandId').subscribe(() => {
searchBrandOptionEffect(actions, 'brandId')
})
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(() => {
searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
})
},
expressionScope: {
otherHandle
}
}
}}
{...restProps}
/>
)
}
MaterialModalTable.defaultProps = {}
export default MaterialModalTable
import React, { useState, useRef, useContext } from 'react'
import { Form, Input, Select, Popover, Row } from 'antd';
import { EnvironmentOutlined } from '@ant-design/icons';
import { FormDetailContext } from '@/formSchema/context';
import { getLogisticsSelectListMemberShipperAddress } from '@/services/LogisticsV2Api';
import { useIntl } from 'umi';
export interface MaterialTableCellProps {
title: React.ReactNode;
editable: boolean;
children: React.ReactNode;
dataIndex: string;
record: any;
handleSave: (record: any) => Promise<any>;
forceEdit: boolean,
formItem: string,
formItemProps: any,
}
const EditableContext = React.createContext<any>({});
export const MaterialEditableRow: React.FC<any> = ({...props }) => {
const [form] = Form.useForm();
const ctx = {
form
}
return (
<Form form={form} component={false}>
<EditableContext.Provider value={ctx}>
<tr {...props} />
</EditableContext.Provider>
</Form>
);
};
export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({
title,
editable,
children,
dataIndex,
record,
handleSave,
forceEdit,
formItem,
formItemProps={},
...restProps
}) => {
const formItemRef = useRef<any>();
const { form } = useContext(EditableContext);
const { formContext } = useContext(FormDetailContext);
const intl = useIntl()
// 是否显示地址
const [showAddress, setShowAddress] = useState<boolean>(false)
// 地址信息
const [receiveInfo, setReceiveInfo] = useState<any>()
const getReceiveInfo = async () => {
const { data: deliveryAddress} = await getLogisticsSelectListMemberShipperAddress({
memberId: record.memberId,
roleId: record.memberRoleId
})
// setReceiveInfo(() => deliveryAddress.filter(item => item.isDefault)[0])
setReceiveInfo(() => deliveryAddress[0])
}
const save = async () => {
try {
const values = await form.validateFields();
handleSave({ ...record, ...values });
formContext.ctl.setInnerFormErrors(0)
} catch (errInfo) {
formContext.ctl.setInnerFormErrors(errInfo.errorFields.length)
console.log('Save failed:', errInfo);
}
};
// select的change
const change = async (va, op, idx) => {
console.log(va, op, idx)
// 自提情况下 显示地址
if(va === 2) {
setShowAddress(true)
getReceiveInfo()
} else {
setShowAddress(false)
}
try {
const values = await form.validateFields();
values[idx] = op['label']
values['logistics'] = op['value']
handleSave({ ...record, ...values });
} catch (errInfo) {
console.log('Save failed:', errInfo);
}
}
const chooseFormItem = (type, v) => {
switch(type) {
// input类型
case 'input': {
return <Input
style={{width: 80}}
type='number'
ref={formItemRef}
onChange={save}
{...formItemProps}
id={dataIndex + record.id}
className="purchase_amount_input"
/>
}
// select选择类型
case 'select': {
return <Select
style={{width: 80}}
ref={formItemRef}
onChange={(value, option) => change(value, option, dataIndex)}
id={dataIndex + record.id}
className="purchase_logistic_select"
options={[{ label: intl.formatMessage({ id: 'purchaseRequisition.wuliu', defaultMessage: '物流' }), value: 1 }, { label: intl.formatMessage({ id: 'purchaseRequisition.ziti', defaultMessage: '自提' }), value: 2 }, { label: intl.formatMessage({ id: 'purchaseRequisition.wuxupeisong', defaultMessage: '无需配送' }), value: 3 }]}
{...formItemProps}
/>
}
}
}
// 校验最大精度
const validatorNumber = (rule, value, callback) => {
try {
let _value = Number(value)
if(_value > Number.MAX_SAFE_INTEGER) {
throw new Error(intl.formatMessage({ id: 'purchaseRequisition.shuzhijingduyi', defaultMessage: '数值精度溢出' }))
}
callback()
} catch (err) {
callback(err)
}
}
let childNode = children;
if (editable) {
childNode =
<>
<Form.Item
style={{ margin: 0 }}
name={dataIndex}
initialValue={record[dataIndex] || ''}
rules={dataIndex === 'quantity' ? [
{
required: true,
message: `${title}${intl.formatMessage({ id: 'purchaseRequisition.bixutianxie', defaultMessage: '必须填写' })}`,
},
{
pattern: /^\d+(\.\d{1,3})?$/,
message: intl.formatMessage({ id: 'purchaseRequisition.caigoushuliangjin', defaultMessage: '采购数量仅限三位小数' }),
},
{
validator: validatorNumber
},
] : [
{
pattern: /^\d+(\.\d{1,4})?$/,
message: intl.formatMessage({ id: 'purchaseRequisition.danjiajinxiansi', defaultMessage: '单价仅限四位小数' }),
},
{
validator: validatorNumber
}
]}
>
{chooseFormItem(formItem, record[dataIndex] || '')}
</Form.Item>
{
showAddress
?
<Popover content={
<Row>
<div>
<h3><EnvironmentOutlined/> {intl.formatMessage({ id: 'purchaseRequisition.zitidizhi', defaultMessage: '自提地址' })}</h3>
{
receiveInfo && <>
<p>{receiveInfo.shipperName} / {receiveInfo.phone}</p>
<p>{receiveInfo.provinceName + receiveInfo.cityName + receiveInfo.districtName + receiveInfo.address || receiveInfo.fullAddress}</p>
</>
}
</div>
</Row>
}>
<span style={{position: 'absolute', right: 0, top: '42%', }}><EnvironmentOutlined/></span>
</Popover>
:
null
}
</>
}
return <td {...restProps}>{childNode}</td>;
}
MaterialTableCell.defaultProps = {}
export default MaterialTableCell
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 { memberColumns } from '../../constant'
import { useIntl } from 'umi'
export interface MemberModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
confirmModal?(),
productRef?: any,
}
const MemberModalTable:React.FC<MemberModalTableProps> = (props) => {
const { type = 'radio', schemaAction, confirmModal, currentRef, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type, customKey: 'memberId'})
const intl = useIntl()
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
rowSelectionCtl
}
}
}, [])
useEffect(() => {
if(visible) {
const memberId = schemaAction.getFieldValue('vendorMemberId')
rowSelectionCtl.setSelectedRowKeys([memberId])
}
}, [visible])
const handleConfirm = () => {
const rowItem = rowSelectionCtl.selectRow[0]
console.log(rowItem, 'row')
if (rowItem) {
schemaAction.setFieldValue('vendorRoleId', rowItem.roleId)
schemaAction.setFieldValue('vendorMemberId', rowItem.memberId)
schemaAction.setFieldValue('vendorMemberName', rowItem.name)
}
confirmModal && confirmModal()
setVisible(false)
}
return (
<ModalTable
modalTitle={intl.formatMessage({ id: 'purchaseRequisition.xuanzegongyinghui', defaultMessage: '选择供应会员' })}
columns={memberColumns}
visible={visible}
confirm={handleConfirm}
cancel={() => setVisible(false)}
fetchTableData={(params) => fetchOrderApi.getMemberListByMemberName({...params})}
rowSelection={rowSelection}
modalType='memberByDefault'
tableProps={{
rowKey: 'memberId'
}}
{...restProps}
/>
)
}
MemberModalTable.defaultProps = {}
export default MemberModalTable
import { getIntl } from "umi"
/** 修改请购单 初始值转换 */
export const procurmentRenderInit = (initValue: any) => {
return {
vendorMemberId: initValue.vendorMemberId,
vendorMemberName: initValue.vendorMemberName,
vendorRoleId: initValue.vendorRoleId,
product: initValue.product,
requisitionNo: initValue.requisitionNo,
innerStatusName: initValue.innerStatusName,
createTime: initValue.createTime,
department: initValue.department,
departmentId: initValue.departmentId,
requisitionId: initValue.requisitionId,
deliverTime: initValue.deliverTime,
creator: initValue.creator,
purpose: initValue.purpose,
digest: initValue.digest,
}
}
/** 修改请购单 回显物料字段转换 */
export const procurementRenderField = (data) => {
const _orderProductRequests = data.product.products
return _orderProductRequests.map(item => {
return {
...item,
id: item.productId,
code: item.productNo,
type: item.spec,
memberId: data.vendorMemberId,
memberRoleId: data.vendorRoleId,
}
})
}
/** 采购合同下单 字段转换 */
export const procurementProcessField = (value) => {
value.products = value.products.map(item => {
return {
...item,
productId: item.id,
productNo: item.code,
spec: item.type,
}
})
return value
}
// 会员列
export const memberColumns: any[] = [
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.huiyuanID', defaultMessage: '会员ID' }),
dataIndex: 'memberId',
align: 'center',
key: 'memberId',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.huiyuanmingcheng', defaultMessage: '会员名称' }),
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.gongsileixing', defaultMessage: '公司类型' }),
dataIndex: 'memberTypeName',
align: 'center',
key: 'memberTypeName',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.gongsijuese', defaultMessage: '公司角色' }),
dataIndex: 'roleName',
align: 'center',
key: 'roleName',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.gongsidengji', defaultMessage: '公司等级' }),
dataIndex: 'levelTag',
align: 'center',
key: 'levelTag',
},
]
//组织机构部门列
export const departmentColumns: any[] = [
{
title: 'Id',
dataIndex: 'id',
key: 'id',
className: 'commonHide'
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.jigoudaima', defaultMessage: '机构代码' }),
dataIndex: 'code',
key: 'code',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.jigoumingcheng', defaultMessage: '机构名称' }),
dataIndex: 'title',
key: 'title',
},
]
// 合同下单 物料列表
export const materialInfoColumns: any[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
className: 'commonHide'
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.wuliaobianhao', defaultMessage: '物料编号' }),
dataIndex: 'code',
align: 'center',
key: 'code',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.wuliaomingcheng', defaultMessage: '物料名称' }),
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.guigexinghao', defaultMessage: '规格型号' }),
dataIndex: 'type',
align: 'center',
key: 'type',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.pinlei', defaultMessage: '品类' }),
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.pinpai', defaultMessage: '品牌' }),
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.danwei', defaultMessage: '单位' }),
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.yugudanjia', defaultMessage: '预估单价(元)' }),
dataIndex: 'price',
align: 'left',
key: 'price',
formItem: 'input',
editable: true,
// render: (t) => `¥${t.toFixed(2)}`
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.shuliang', defaultMessage: '数量' }),
dataIndex: 'quantity',
align: 'center',
key: 'quantity',
formItem: 'input',
editable: true,
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.yugujine', defaultMessage: '预估金额(元)' }),
dataIndex: 'amount',
align: 'center',
key: 'amount',
// render: (t, r) => t ? `${Number(t).toFixed(2)}` : null
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.caozuo', defaultMessage: '操作' }),
dataIndex: 'ctl',
align: 'center',
key: 'ctl',
},
]
import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { getProductCustomerGetCustomerCategoryTree, getProductSelectGetSelectBrand } from '@/services/ProductV2Api';
export const useEditHideField = () => {
const { pageStatus } = usePageStatus()
const utils = useLinkageUtils()
FormEffectHooks.onFormInit$().subscribe(() => {
if (pageStatus === PageStatus.ADD) {
utils.hide('orderNo')
utils.hide('createTime')
}
})
}
export const useMaterialTableChangeForAmount = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('products').subscribe(state => {
// 强制渲染一次, 用于触发金额总数
update()
})
}
// 高级筛选schema中用于输入搜索品牌的Effect
export const searchBrandOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
getProductSelectGetSelectBrand({ name: state.props['x-component-props'].searchValue }).then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
// 高级筛选schema中用于输入搜索商品品类的Effect
export const searchCustomerCategoryOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
getProductCustomerGetCustomerCategoryTree().then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
import React from 'react'
import { Card } from 'antd'
import StandardTable from '@/components/StandardTable';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { useSelfTable } from './model/useSelfTable'
import { tableListSchema } from './schema'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import Submit from '@/components/NiceForm/components/Submit'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import '../index.less'
// 待确认支付结果订单
export interface FirstApprovedOrderProps {}
const fetchTableData = async (params) => {
// const { data } = await getOrderSalesInvoiceOrderList(params)
return []
}
import React, { useRef, useState, useEffect } from 'react'
import { history, useIntl } from 'umi'
import { usePageStatus } from '@/hooks/usePageStatus'
import { Button, Col, message, Row } from 'antd'
import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd'
import { SaveOutlined, LinkOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
import { increaseSchema } from './schema'
import { useEditHideField, useMaterialTableChangeForAmount } from './effects'
import { procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import { useUpdate } from '@umijs/hooks'
import { help } from '../../common'
import { useMaterialTable } from './model/useMaterialTable'
import MaterialModalTable from './components/materialModalTable'
import DepartmentModalTable from './components/departmentModalTable'
import MemberModalTable from './components/memberModalTable'
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'
const addSchemaAction = createFormActions()
const RowStyle = styled(props => <Row style={{marginTop: 12, justifyContent: "flex-end"}} justify='end' {...props}>
{props.children}
</Row>)`
.ant-col {
text-align: center
}
.ant-col div {
margin-bottom: 12px;
}
`
// 总计金额联动框
export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
const intl = useIntl()
const { form } = useFormSpy({ selector: [['onFieldValueChange', 'products']], reducer: v => v })
const data = form.getFieldValue('products')
const sum = data.reduce((prev, next) => (prev*1000 + (next.amount || 0)*1000)/1000, 0)
const total = data.reduce((prev, next) => (prev*1000 + (next.quantity || 0)*1000)/1000, 0)
return <RowStyle>
<Col span={2}>
<div>{intl.formatMessage({ id: 'purchaseRequisition.shuliangheji', defaultMessage: '数量合计' })}</div>
<div>{total.toFixed(2)}</div>
</Col>
<Col span={2}>
<div>{intl.formatMessage({ id: 'purchaseRequisition.jinezongji', defaultMessage: '金额总计' })}</div>
<div>{`${intl.formatMessage({id: 'commodity.products.directChannel.columns.currency'})}${(sum).toFixed(2)}`}</div>
</Col>
</RowStyle>
})
/** 采购请购单 新增 */
const IncreaseRequisition:React.FC<{}> = () => {
const departmentRef = useRef<any>({}) // 选部门
const memberRef = useRef<any>({})
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate()
const { id } = usePageStatus()
const [initFormValue, setInitFormValue] = useState<any>({})
const { formContext } = useFormDetail()
const intl = useIntl()
// 请购单物料
const { materialAddButton, materialRef, materialColumns, materialComponents, ...surplusProps } = useMaterialTable(addSchemaAction)
useEffect(() => {
if (id) {
setFormLoading(true)
getPurchaseRequisitionDetail({ id }).then(res => {
const { data } = res
const _orderProductRequests = procurementRenderField(data)
setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => {
addSchemaAction.setFieldValue('products', _orderProductRequests)
}, 1000)
setFormLoading(false)
})
}
}, [])
const handleSubmit = async (value) => {
try {
let fnResult = null
// 新增订单/编辑订单
const params = { ...value }
console.log(value)
if(formContext.innerFormErrors) {
throw new Error(intl.formatMessage({ id: 'purchaseRequisition.qingwanshandingdan', defaultMessage: '请完善订单物料数据' }))
}
// 校验采购数量
const judgementByCount = params.products?.length && params.products.map(item => {
if(item.quantity){
return true
} else {
return false
}
})
if(!judgementByCount || judgementByCount.includes(false)){
throw new Error(intl.formatMessage({ id: 'purchaseRequisition.qingtianxieshangpin', defaultMessage: '请填写商品采购数量' }))
}
setBtnLoading(true)
const _params = procurementProcessField(params)
console.log(_params)
if(id) {
fnResult = await postPurchaseRequisitionUpdate({..._params, id})
} else {
fnResult = await postPurchaseRequisitionCreate(_params)
}
if (fnResult.code === 1000) {
setTimeout(() => {
history.push("/memberCenter/procurementAbility/purchaseRequisition/readyAddBill")
}, 1000)
} else {
setBtnLoading(false)
}
} catch (error) {
setBtnLoading(false)
error?.message && message.error(error.message)
console.log(error)
}
}
// 选择会员弹窗
const handleOrderMember = () => {
memberRef.current.setVisible(true)
}
// TODO
const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
const {
columns,
ref
} = useSelfTable()
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
columns={columns}
currentRef={ref}
rowKey={'orderNo'}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
schema: tableListSchema(),
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'orderNo',
FORM_FILTER_PATH,
);
},
components: {
DateRangePickerUnix,
Submit
}
}
}}
const memberBtn = <div className='connectBtn' onClick={handleOrderMember}><LinkOutlined style={{marginRight: 4}}/>{intl.formatMessage({ id: 'purchaseRequisition.xuanze', defaultMessage: '选择' })}</div>
// 选择合同
const handleDepartment = () => {
departmentRef.current.setVisible(true)
}
const departmentBtn = <div className='connectBtn' onClick={handleDepartment}><LinkOutlined style={{marginRight: 4}}/>{intl.formatMessage({ id: 'purchaseRequisition.xuanze', defaultMessage: '选择' })}</div>
const providerValue = {
schemaActions: addSchemaAction,
formContext,
}
return (<div>
<FormDetailContext.Provider value={providerValue}>
<FormDetailHeader
title={id ? intl.formatMessage({ id: 'purchaseRequisition.bianjiqinggoudan', defaultMessage: '编辑请购单' }) : intl.formatMessage({ id: 'purchaseRequisition.xinzengqinggoudan', defaultMessage: '新增请购单' })}
schema={increaseSchema}
extraRight={[
<Button key="1" onClick={() => addSchemaAction.submit()} loading={btnLoading} type="primary" icon={<SaveOutlined />}>
{intl.formatMessage({ id: 'purchaseRequisition.baocun', defaultMessage: '保存' })}
</Button>,
]}
/>
</Card>
</PageHeaderWrapper>
<FormDetailWrapper>
<NiceForm
loading={formLoading}
previewPlaceholder=' '
value={initFormValue}
actions={addSchemaAction}
schema={increaseSchema}
onSubmit={handleSubmit}
effects={($, ctx) => {
$('onFormMount').subscribe(() => { })
useEditHideField()
// 物料信息的改动 渲染总额
useMaterialTableChangeForAmount(ctx, update)
// 注入表单完成进度
formContext.useAttachmentChangeForContext(ctx)
}}
expressionScope={{
memberBtn,
departmentBtn,
materialColumns,
materialAddButton,
materialComponents,
help,
}}
/>
</FormDetailWrapper>
</FormDetailContext.Provider>
{/* 选择部门 */}
<DepartmentModalTable currentRef={departmentRef} schemaAction={addSchemaAction}/>
{/* 选择采购物料 */}
<MaterialModalTable currentRef={materialRef} schemaAction={addSchemaAction} sectionProps={surplusProps} />
{/* 选择供应会员 */}
<MemberModalTable currentRef={memberRef} schemaAction={addSchemaAction}/>
{/* </PageHeaderWrapper> */}
</div>)
}
FirstApprovedOrder.defaultProps = {}
IncreaseRequisition.defaultProps = {}
export default FirstApprovedOrder
export default IncreaseRequisition
import React, { useState, useEffect } from 'react'
import { OrderModalType } from '@/constants/order'
import { useLocation, history } from 'umi'
import { ISchemaFormActions } from '@formily/antd'
interface DetailOrderLocationState {
// 进货单商品列表
productList?: any[],
// 下单模式
modelType?: OrderModalType
}
interface DetailOptionsProps {
addSchemaAction: ISchemaFormActions
}
export const useDetailOrder = (options: DetailOptionsProps) => {
const { addSchemaAction } = options
const locationState = useLocation<DetailOrderLocationState>().state || {}
const { productList } = locationState
const { modelType } = history.location.query
// 是否显示选择商品按钮
const [showProBtn, setShowProBtn] = useState(false)
// 是否显示供应会员字段
const [showMemberType, setShowMemberType] = useState(false)
const [visibleMember, setVisibleMember] = useState(false)
// 商品列表, 如果路由state中 带有productList, 说明是进货单下单, 需要回显进货单商品数据
const [proList, setProList] = useState<any[]>(() => productList || [])
// 回显数据写在这
useEffect(() => {
// 页面中有传入下单模式, 需要手动回显数据
if (modelType) {
addSchemaAction.setFieldValue('orderMode', parseInt(modelType))
}
// 在有传入商品列表时 需手动回显
if (proList.length > 0) {
addSchemaAction.setFieldValue('orderProductRequests', proList)
addSchemaAction.setFieldValue('orderThe', proList[0].name)
}
}, [modelType, productList])
return {
showProBtn,
setShowProBtn,
showMemberType,
setShowMemberType,
proList,
modelType,
visibleMember,
setVisibleMember
}
}
import { useRef, useState } from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { Button } from 'antd';
import { materialInfoColumns } from '../constant';
import MaterialTableCell, { MaterialEditableRow } from '../components/materialTableCell';
import { useModalTable } from './useModalTable';
import { useIntl } from 'umi';
export const getUnitPriceTotal = (record) => {
const purchaseCount = Number(record['quantity']) || 0
return Number(((record.price || 0) * purchaseCount).toFixed(2))
}
/**
* @param ctx schemaAction
*/
export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const materialRef = useRef<any>({})
const intl = useIntl()
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox'})
const handleDelete = (record) => {
const newData = [...ctx.getFieldValue('products')]
// 删除formvalue
const colIndex = newData.findIndex(v => v.id === record.id)
newData.splice(colIndex, 1)
// 删除选中的项
rowSelectionCtl.setSelectRow(newData)
rowSelectionCtl.setSelectedRowKeys(newData.map(v => v.id))
ctx.setFieldValue('products', newData)
}
const [materialColumns, setMaterialColumns] = useState(() => {
// 渲染操作
materialInfoColumns[materialInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({ id: 'purchaseRequisition.shanchu', defaultMessage: '删除' })}</Button>
materialInfoColumns[materialInfoColumns.length - 2].render = (t, r) => r.amount && <span style={{color: 'red'}}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})} {Number(r.amount).toFixed(2)}</span>
return materialInfoColumns
})
const handleShowMaterial = () => {
const products = ctx.getFieldValue('products')
materialRef.current.setVisible(true)
if(products && products.length) {
materialRef.current.rowSelectionCtl.setSelectedRowKeys(() => products.map(item => item.id))
}
}
const materialAddButton = <Button onClick={handleShowMaterial} block type='default' style={{margin: '24px auto'}}>{intl.formatMessage({ id: 'purchaseRequisition.xuanzecaigouwu', defaultMessage: '选择采购物料' })}</Button>
const materialComponents = {
body: {
row: MaterialEditableRow,
cell: MaterialTableCell
}
}
const handleSave = row => {
return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('products')];
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
// 算单行价格
row['amount'] = getUnitPriceTotal(row)
newData.splice(index, 1, {
...item,
...row,
});
ctx.setFieldValue('products', newData)
resolve({item, newData})
})
};
const materialMergeColumns = materialColumns.map(col => {
if (!col.editable) {
return col;
}
return {
...col,
onCell: record => ({
record,
editable: ctx.getFormState().editable === false ? false : col.editable,
dataIndex: col.dataIndex,
title: col.title,
formItem: col.formItem,
formItemProps: col.formItemProps,
handleSave
}),
};
})
return {
materialRef,
materialAddButton,
materialColumns: materialMergeColumns,
materialComponents,
visible,
setVisible,
rowSelection,
rowSelectionCtl
}
}
import { useState } from 'react'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
export const useModalTable = (options?) => {
const [visible, setVisible] = useState(false)
const [rowSelection, rowSelectionCtl] = useRowSelectionTable(options)
return {
visible,
setVisible,
rowSelection,
rowSelectionCtl
}
}
\ No newline at end of file
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useIntl } from 'umi';
import { ISchema } from '@formily/antd';
import moment from 'moment'
import { getIntl } from 'umi';
export const tableListSchema: any = () => {
const intl = useIntl()
// const OrderType = getOrderType()
return {
type: 'object',
properties: {
orderNo: {
type: 'string',
"x-component": 'SearchFilter',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurudingdan', defaultMessage: '请输入订单编号' }),
align: 'flex-start',
},
// 基本信息
const basicInfo: ISchema = {
"x-index": 0,
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: getIntl().formatMessage({ id: 'purchaseRequisition.jibenxinxi', defaultMessage: '基本信息' }),
id: 'basicInfo',
},
properties: {
NO_SUBMIT_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelCol: 6,
wrapperCol: 16,
labelAlign: "left",
grid: true,
full: true,
autoRow: true,
columns: 2,
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
inline: true,
colStyle: {
marginRight: 20
}
properties: {
requisitionNo: {
type: 'string',
title: getIntl().formatMessage({ id: 'purchaseRequisition.qinggoudanhao', defaultMessage: '请购单号' }),
"x-component": 'text',
visible: false,
},
properties: {
orderThe: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurudingdan', defaultMessage: '请输入订单摘要' }),
}
},
"memberName": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurucaigou', defaultMessage: '请输入采购会员名称' })
digest: {
type: 'string',
title: getIntl().formatMessage({ id: 'purchaseRequisition.dingdanzhaiyao', defaultMessage: '订单摘要' }),
"x-rules": [
{
required: true,
message: getIntl().formatMessage({ id: 'purchaseRequisition.qingshurudingdan', defaultMessage: '请输入订单摘要' })
},
{
limitByte: true,
maxByte: 60
}
},
"type": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'saleOrder.qingxuanzedingdan', defaultMessage: '请选择订单类型' })
],
"x-mega-props": {
span: 1
}
},
deliverTime: {
type: 'string',
"x-component": 'date',
title: getIntl().formatMessage({ id: 'purchaseRequisition.yujiaoriqi', defaultMessage: '预交日期' }),
required: true,
"x-component-props": {
disabledDate: current => {
return current && current < moment().startOf('day')
},
// enum: OrderType.map(item => ({
// label: item['name'],
// value: item['status'],
// }))
enum: []
style: { width: '100%' }
},
"[startCreateTime,endCreateTime]": {
type: 'array',
"x-component": 'DateRangePickerUnix',
'x-component-props': {
placeholder: [intl.formatMessage({ id: 'saleOrder.kaishishijian', defaultMessage: '开始时间' }),intl.formatMessage({ id: 'saleOrder.jieshushijian', defaultMessage: '结束时间' })],
},
"x-mega-props": {
span: 1
}
},
department: {
type: 'string',
title: getIntl().formatMessage({ id: 'purchaseRequisition.qinggoubumen', defaultMessage: '请购部门' }),
required: true,
"x-component-props": {
disabled: true,
addonAfter: "{{departmentBtn}}"
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'saleOrder.chaxun', defaultMessage: '查询' }),
"x-mega-props": {
span: 1
}
},
departmentId: {
type: 'string',
title: getIntl().formatMessage({ id: 'purchaseRequisition.qinggoubumenID', defaultMessage: '请购部门ID' }),
visible: false,
},
purpose: {
type: 'string',
title: getIntl().formatMessage({ id: 'purchaseRequisition.qinggouyongtu', defaultMessage: '请购用途' }),
"x-rules": [
{
required: true,
message: getIntl().formatMessage({ id: 'purchaseRequisition.qingshuruqinggou', defaultMessage: '请输入请购用途' })
},
{
limitByte: true,
maxByte: 100
}
],
"x-mega-props": {
span: 1
}
},
vendorMemberName: {
type: 'string',
title: getIntl().formatMessage({ id: 'purchaseRequisition.gongyinghuiyuan', defaultMessage: '供应会员' }),
"x-component-props": {
disabled: true,
addonAfter: "{{memberBtn}}"
},
required: true,
},
vendorMemberId: {
type: 'string',
visible: false
},
vendorRoleId: {
type: 'string',
visible: false
},
createTime: {
type: 'string',
title: getIntl().formatMessage({ id: 'purchaseRequisition.danjushijian', defaultMessage: '单据时间' }),
visible: false
},
interiorStateName: {
type: 'string',
title: getIntl().formatMessage({ id: 'purchaseRequisition.neibuzhuangtai', defaultMessage: '内部状态' }),
visible: false
},
}
},
}
}
// 请购单物料
const material: ISchema = {
"x-index": 2,
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: getIntl().formatMessage({ id: 'purchaseRequisition.dingdanwuliao', defaultMessage: '订单物料' }),
id: 'orderMaterial',
},
properties: {
products: {
type: 'array',
"x-component": 'MultTable',
required: true,
"x-component-props": {
rowKey: 'id',
columns: "{{materialColumns}}",
components: "{{materialComponents}}",
prefix: "{{materialAddButton}}",
},
},
NO_SUBMIT_SPY: {
type: 'object',
"x-component": "moneyTotalBox"
}
}
}
export const increaseSchema: ISchema = {
type: 'object',
properties: {
basicInfo,
material,
}
}
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ISchema } from '@formily/antd';
import { getIntl } from 'umi';
/**
* 新增采购请购单 选择物料的筛选
*/
export const addRequesitionMaterialSchema: ISchema = {
type: 'object',
properties: {
code: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: getIntl().formatMessage({ id: 'purchaseRequisition.qingshuruhuohao', defaultMessage: '请输入货号' }),
align: 'flex-start',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
// flexWrap: 'nowrap',
justifyContent: 'flex-start',
style: {
marginRight: 0,
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
name: {
type: 'string',
'x-component-props': {
placeholder: getIntl().formatMessage({ id: 'purchaseRequisition.huopinmingcheng', defaultMessage: '货品名称' }),
style: { width: '174px' },
},
},
brandId: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: getIntl().formatMessage({ id: 'purchaseRequisition.shangpinpinpai', defaultMessage: '商品品牌' }),
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px' },
searchValue: null,
dataoption: [],
},
},
customerCategoryId: {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: getIntl().formatMessage({ id: 'purchaseRequisition.shangpinpinlei', defaultMessage: '商品品类' }),
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
dataoption: [],
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
},
type: {
type: 'string',
"x-component-props": {
placeholder: getIntl().formatMessage({ id: 'purchaseRequisition.guigexinghao', defaultMessage: '规格型号' }),
style: { width: '174px' },
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: getIntl().formatMessage({ id: 'purchaseRequisition.chaxun', defaultMessage: '查询' })
}
},
submit1: {
"x-component": 'Children',
"x-component-props": {
children: '{{otherHandle}}'
}
}
}
}
}
}
......@@ -17,7 +17,6 @@ import { useProductTable } from './model/useProductTable'
import styled from 'styled-components'
import { useUpdate } from '@umijs/hooks'
import { help } from '../../common'
import styles from './index.less'
import { getAuth } from '@/utils/auth';
import { fectchShopListsSource } from '@/utils/type'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
......
......@@ -140,7 +140,6 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
}
return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('products')];
console.log(newData, row)
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
row['money'] = getUnitPriceTotal(row)
......
import React from 'react'
import { Card } from 'antd'
import StandardTable from '@/components/StandardTable';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { useSelfTable } from './model/useSelfTable'
import { tableListSchema } from './schema'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import Submit from '@/components/NiceForm/components/Submit'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import '../index.less'
export interface AddSaleDelevedOrderProps {}
const fetchTableData = async (params) => {
// const { data } = await getOrderSalesInvoiceOrderList(params)
return []
}
/** 待新增销售发货单 */
const AddSaleDelevedOrder:React.FC<AddSaleDelevedOrderProps> = (props) => {
const {
columns,
ref
} = useSelfTable()
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
columns={columns}
currentRef={ref}
rowKey={'orderNo'}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
schema: tableListSchema(),
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'orderNo',
FORM_FILTER_PATH,
);
},
components: {
DateRangePickerUnix,
Submit
}
}
}}
/>
</Card>
</PageHeaderWrapper>
}
AddSaleDelevedOrder.defaultProps = {}
export default AddSaleDelevedOrder
......@@ -17,12 +17,16 @@ export const useSelfTable = () => {
/** 参照后台数据生成 */
const renderOptionButton = (record: any) => {
const buttonGroup = { [intl.formatMessage({ id: 'saleOrder.xinzengfahuodan', defaultMessage: '新增发货单' })]: true, [intl.formatMessage({ id: 'saleOrder.shenhe', defaultMessage: '审核' })]: true }
const buttonGroup = {
[intl.formatMessage({ id: 'saleOrder.xinzengfahuodan', defaultMessage: '新增发货单' })]: true,
[intl.formatMessage({ id: 'saleOrder.shenhe', defaultMessage: '审核' })]: true
}
const operationHandler = {
[intl.formatMessage({ id: 'saleOrder.shenhe', defaultMessage: '审核' })]: () => handleConfirm(record),
[intl.formatMessage({ id: 'saleOrder.xinzengfahuodan', defaultMessage: '新增发货单' })]: () => handleAdd(record),
}
return (
<TableOperation
buttonTextFieldMap={buttonGroup}
......@@ -105,7 +109,7 @@ export const useSelfTable = () => {
align: 'center',
dataIndex: 'ctl',
key: 'ctl',
render: (text: any, record: any) => renderOptionButton(record)
render: (text, record) => renderOptionButton(record)
// render: (text, record) => <>
// {/* 支付结果确认到账= 待审核状态 */}
// { record.purchaseOrderInteriorState === SaleOrderInsideWorkState.READY_DELEVED_APPROVED &&
......
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useIntl } from 'umi';
export const tableListSchema: any = () => {
const intl = useIntl()
// const OrderType = getOrderType()
return {
type: 'object',
properties: {
orderNo: {
type: 'string',
"x-component": 'SearchFilter',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurudingdan', defaultMessage: '请输入订单编号' }),
align: 'flex-start',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
inline: true,
colStyle: {
marginRight: 20
}
},
properties: {
orderThe: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurudingdan', defaultMessage: '请输入订单摘要' }),
}
},
"memberName": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurucaigou', defaultMessage: '请输入采购会员名称' })
}
},
"type": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'saleOrder.qingxuanzedingdan', defaultMessage: '请选择订单类型' })
},
// enum: OrderType.map(item => ({
// label: item['name'],
// value: item['status'],
// }))
enum: []
},
"[startCreateTime,endCreateTime]": {
type: 'array',
"x-component": 'DateRangePickerUnix',
'x-component-props': {
placeholder: [intl.formatMessage({ id: 'saleOrder.kaishishijian', defaultMessage: '开始时间' }),intl.formatMessage({ id: 'saleOrder.jieshushijian', defaultMessage: '结束时间' })],
},
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'saleOrder.chaxun', defaultMessage: '查询' }),
},
},
},
},
}
}
}
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