Commit e98d1f98 authored by XieZhiXiong's avatar XieZhiXiong
parents 7f1c290c 81ae8b4c
...@@ -46,10 +46,15 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -46,10 +46,15 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
const [fileLoading, setFileLoading] = useState<boolean>(false); const [fileLoading, setFileLoading] = useState<boolean>(false);
const beforeDocUpload = (file: any) => { const beforeDocUpload = (file: any) => {
const isLt50M = file.size / 1024 / 1024 < 50; const isLt50M = file.size / 1024 / 1024 < 50;
const PDFList = ['application/pdf']
const isPDF = PDFList.includes(file.type)
if (!isLt50M) { if (!isLt50M) {
message.error('上传文件大小不超过 50M!'); message.error('上传文件大小不超过 50M!');
} }
return isLt50M; if (!isPDF) {
message.error('请上传pdf格式文件');
}
return isLt50M && isPDF;
} }
const handleChange = ({ file }) => { const handleChange = ({ file }) => {
setFileLoading(true); setFileLoading(true);
......
...@@ -35,6 +35,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => { ...@@ -35,6 +35,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => {
/* 执行请款的选中 */ /* 执行请款的选中 */
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据 const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [value, setvalue] = useState('');
/* 搜素 */ /* 搜素 */
const onSearch = (values) => { const onSearch = (values) => {
const data = { const data = {
...@@ -216,6 +217,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => { ...@@ -216,6 +217,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => {
current: page, current: page,
pageSize: size, pageSize: size,
} }
setvalue('')
getContracInfoList(data) getContracInfoList(data)
} }
useEffect(() => { useEffect(() => {
...@@ -241,6 +243,8 @@ const situationList: React.FC<Iprops> = ({ contractId }) => { ...@@ -241,6 +243,8 @@ const situationList: React.FC<Iprops> = ({ contractId }) => {
placeholder="搜素" placeholder="搜素"
allowClear allowClear
onSearch={onSearch} onSearch={onSearch}
value={value}
onChange={(e) => setvalue(e.target.value)}
/> />
<Button style={{ paddingLeft: 10, paddingRight: 10, marginLeft: 10, marginRight: 10 }} onClick={Reset}> 重置 </Button> <Button style={{ paddingLeft: 10, paddingRight: 10, marginLeft: 10, marginRight: 10 }} onClick={Reset}> 重置 </Button>
</div> </div>
......
...@@ -313,6 +313,7 @@ const table = (props: any) => { ...@@ -313,6 +313,7 @@ const table = (props: any) => {
PlanList.map((item) => { PlanList.map((item) => {
item.applyNo = item.orderNO; item.applyNo = item.orderNO;
item.outerStatusName = item.orderStatusName; item.outerStatusName = item.orderStatusName;
item.orderTime = item.orderTime ? moment().format('YYYY-MM-DD') : '';
// item.isHasTax = item.isHasTax == '是' ? 1 : 0; // item.isHasTax = item.isHasTax == '是' ? 1 : 0;
}) })
setPlanList(PlanList) setPlanList(PlanList)
......
...@@ -10,39 +10,22 @@ import { goodcolumns } from '../Table' ...@@ -10,39 +10,22 @@ import { goodcolumns } from '../Table'
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
const { Option } = Select; const { Option } = Select;
const { Text } = Typography; const { Text } = Typography;
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
const FormList = (props: any) => { const FormList = (props: any) => {
const { currentRef, Row, sourceType } = props; const { currentRef, Row, sourceType } = props;
const refs = useRef({}); const refs = useRef({});
/* 显示模态框 */ /* 显示模态框 */
const [isModalVisible, setIsModalVisible] = useState(false);// 显示模态框 const [isModalVisible, setIsModalVisible] = useState(false);// 显示模态框
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) // 选中的 const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id' });
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [dataList, setData] = useState<Array<any>>([]) // 列表数据 const [dataList, setData] = useState<Array<any>>([]) // 列表数据
/* 选中 */
const rowSelectionGood: any = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectedRowKeys(selectedRowKeys)
setSelectRow(selectedRows)
console.log(setSelectedRowKeys)
}
};
const [columnsTab, setcolumnsTab] = useState<any>([]); const [columnsTab, setcolumnsTab] = useState<any>([]);
/* 确定 */ /* 确定 */
const handleOk = () => { const handleOk = () => {
console.log(dataList) let list = RowCtl.selectRow;
let dataArr = dataList.length != 0 ? dataList.concat(selectRow) : selectRow; list.map((item: any, index: number) => {
const hash = {}
let templateList = dataArr.reduceRight((item, next) => {
if (!hash[next.id]) hash[next.id] = true && item.push(next)
return item
}, [])
templateList.map((item: any, index: number) => {
item.rowId = index + 1 item.rowId = index + 1
dataArr.push(item);
}) })
setData(templateList) setData(list)
setIsModalVisible(false); setIsModalVisible(false);
}; };
/* 获取商品 */ /* 获取商品 */
...@@ -59,11 +42,9 @@ const FormList = (props: any) => { ...@@ -59,11 +42,9 @@ const FormList = (props: any) => {
/* 删除 */ /* 删除 */
const handleDelete = (id) => { const handleDelete = (id) => {
const dataSource = [...dataList]; const dataSource = [...dataList];
const RowKeys = [...selectedRowKeys]
let List = dataSource.filter((item) => item.id !== id); let List = dataSource.filter((item) => item.id !== id);
const RowKeysList = RowKeys.filter(item => item !== id);
setData(List) setData(List)
setSelectedRowKeys(RowKeysList) // setSelectedRowKeys(RowKeysList)
}; };
/* 获取物料信息 */ /* 获取物料信息 */
const getList = () => { const getList = () => {
...@@ -439,7 +420,7 @@ const FormList = (props: any) => { ...@@ -439,7 +420,7 @@ const FormList = (props: any) => {
}} }}
columns={goodcolumns} columns={goodcolumns}
currentRef={refs} currentRef={refs}
rowSelection={rowSelectionGood} rowSelection={rowSelection}
fetchTableData={(params: any) => getGoodsList(params)} fetchTableData={(params: any) => getGoodsList(params)}
/> />
</Modal> </Modal>
......
...@@ -3,7 +3,7 @@ import { Button, Card, Tabs, message } from 'antd' ...@@ -3,7 +3,7 @@ import { Button, Card, Tabs, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import Information from './components/Information' import Information from './components/Information'
import FormList from './components/FormList' import FormList from './components/FormList'
import Fromtable from './components/fromtable' import Fromtable from './components/Fromtable'
import ContractText from './components/ContractText' import ContractText from './components/ContractText'
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { history } from 'umi' import { history } from 'umi'
......
...@@ -197,6 +197,7 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => { ...@@ -197,6 +197,7 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
"props": { "props": {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl, categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId, categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList categoryList: categoryDetail.categoryBOList
}, },
}, },
......
...@@ -46,10 +46,15 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -46,10 +46,15 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
const [fileLoading, setFileLoading] = useState<boolean>(false); const [fileLoading, setFileLoading] = useState<boolean>(false);
const beforeDocUpload = (file: any) => { const beforeDocUpload = (file: any) => {
const isLt50M = file.size / 1024 / 1024 < 50; const isLt50M = file.size / 1024 / 1024 < 50;
const PDFList = ['application/pdf']
const isPDF = PDFList.includes(file.type)
if (!isLt50M) { if (!isLt50M) {
message.error('上传文件大小不超过 50M!'); message.error('上传文件大小不超过 50M!');
} }
return isLt50M; if (!isPDF) {
message.error('请上传pdf格式文件');
}
return isLt50M && isPDF;
} }
const handleChange = ({ file }) => { const handleChange = ({ file }) => {
setFileLoading(true); setFileLoading(true);
......
...@@ -87,6 +87,22 @@ export const getSaleOrderAuditPageSelectOption = () => { ...@@ -87,6 +87,22 @@ export const getSaleOrderAuditPageSelectOption = () => {
return state return state
} }
/** (采购订单-待新增订单)获取前端页面下拉框列表 */
export const getPurchaseOrderReadyAddPageSelectOption = () => {
const [state, setstate] = useState<any>()
useEffect(() => {
PublicApi.getOrderBuyerCreatePageItems({}).then(res => {
const { code, data } = res
if(code === 1000) {
setstate(data)
}
})
}, [])
return state
}
// **以下*即将弃用*** // // **以下*即将弃用*** //
......
...@@ -3,88 +3,71 @@ import { history } from 'umi' ...@@ -3,88 +3,71 @@ import { history } from 'umi'
import { formatTimeString } from '@/utils' import { formatTimeString } from '@/utils'
import StatusColors from '../components/StatusColors' import StatusColors from '../components/StatusColors'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import { getPurchaseOrderSelectOption } from '../../effect'
export const baseOrderListColumns: any = () => { export const baseOrderListColumns: any = () => {
// const res = getPurchaseOrderSelectOption() return [
// if(res) { {
// const { title: '订单号',
// orderTypes: OrderType, align: 'center',
// innerStatus: PurchaseOrderInsideWorkStateTexts, dataIndex: 'orderNo',
// outerStatus: PurchaseOrderOutWorkStateTexts key: 'orderNo',
// } = res render: (text, record) => {
return (
return [ <EyePreview url={`${history.location.pathname}/preview?id=${record.orderId}`}>
{ {text}
title: '订单号', </EyePreview>
align: 'center', )
dataIndex: 'orderNo',
key: 'orderNo',
render: (text, record) => {
// 查看订单, 需根据状态显示不同schema
return (
<EyePreview url={`${history.location.pathname}/preview?id=${record.orderId}`}>
{text}
</EyePreview>
)
},
ellipsis: true,
},
{
title: '订单摘要',
align: 'center',
dataIndex: 'digest',
key: 'digest',
ellipsis: true,
},
{
title: '供应会员',
align: 'center',
dataIndex: 'vendorMemberName',
key: 'vendorMemberName',
ellipsis: true,
},
{
title: '下单时间',
align: 'center',
dataIndex: 'createTime',
key: 'createTime',
render: (text) => formatTimeString(text)
},
{
title: '订单总额',
align: 'center',
dataIndex: 'amount',
key: 'amount',
ellipsis: true,
},
{
title: '订单类型',
align: 'center',
dataIndex: 'orderTypeName',
key: 'orderTypeName',
// filters: OrderType.map((e, i) => ({ text: e['text'], value: Number(e['id']) })),
// onFilter: (value, record) => value === record.orderType,
},
{
title: '外部状态',
align: 'center',
dataIndex: 'outerStatusName',
key: 'outerStatusName',
render: (text, record) => <StatusColors status={text} type='out' text={record['outerStatusName']} />,
// filters: PurchaseOrderOutWorkStateTexts.map((e, i) => ({ text: e['text'], value: Number(e['id']) })),
// onFilter: (value, record) => value === record.outerStatus,
}, },
{ ellipsis: true,
title: '内部状态', },
align: 'center', {
dataIndex: 'innerStatusName', title: '订单摘要',
key: 'innerStatusName', align: 'center',
render: (text, record) => <StatusColors status={text} type='inside' text={record['innerStatusName']} />, dataIndex: 'digest',
// filters: PurchaseOrderInsideWorkStateTexts.map((e, i) => ({ text: e['text'], value: Number(e['id']) })), key: 'digest',
// onFilter: (value, record) => value === record.innerStatus, ellipsis: true,
} },
] {
// } title: '供应会员',
align: 'center',
dataIndex: 'vendorMemberName',
key: 'vendorMemberName',
ellipsis: true,
},
{
title: '下单时间',
align: 'center',
dataIndex: 'createTime',
key: 'createTime',
render: (text) => formatTimeString(text)
},
{
title: '订单总额',
align: 'center',
dataIndex: 'amount',
key: 'amount',
ellipsis: true,
},
{
title: '订单类型',
align: 'center',
dataIndex: 'orderTypeName',
key: 'orderTypeName',
},
{
title: '外部状态',
align: 'center',
dataIndex: 'outerStatusName',
key: 'outerStatusName',
render: (text, record) => <StatusColors status={text} type='out' text={record['outerStatusName']} />,
},
{
title: '内部状态',
align: 'center',
dataIndex: 'innerStatusName',
key: 'innerStatusName',
render: (text, record) => <StatusColors status={text} type='inside' text={record['innerStatusName']} />,
}
]
} }
...@@ -58,7 +58,6 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => { ...@@ -58,7 +58,6 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
schemaAction.setFieldValue('sourceType', item.sourceType) schemaAction.setFieldValue('sourceType', item.sourceType)
schemaAction.setFieldValue('purchaseType', 1) schemaAction.setFieldValue('purchaseType', 1)
const { data } = await fetchOrderApi.getContractPurchaseMaterielList({ const { data } = await fetchOrderApi.getContractPurchaseMaterielList({
shopId: schemaAction.getFieldValue('shopId'),
contractId: item.id, contractId: item.id,
current: 1, current: 1,
pageSize: 999, pageSize: 999,
...@@ -83,7 +82,6 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => { ...@@ -83,7 +82,6 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
temp.category = v.category; temp.category = v.category;
temp.brand = v.brand; temp.brand = v.brand;
temp.unit = v.unit; temp.unit = v.unit;
// temp.relevanceGoods = v.associatedGoods;
temp.relevanceProductId = v.associatedDataId; temp.relevanceProductId = v.associatedDataId;
temp.relevanceProductName = v.associatedGoods; temp.relevanceProductName = v.associatedGoods;
temp.relevanceProductNo = v.associatedMaterielNo; temp.relevanceProductNo = v.associatedMaterielNo;
...@@ -91,9 +89,8 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => { ...@@ -91,9 +89,8 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
temp.relevanceProductCategory = v.associatedCategory; temp.relevanceProductCategory = v.associatedCategory;
temp.relevanceProductBrand = v.associatedBrand; temp.relevanceProductBrand = v.associatedBrand;
temp.price = v.price; temp.price = v.price;
temp.inventory = v.bidCount; temp.stock = v.bidCount;
// temp.purchaseCount = v.purchaseCount; temp.tax = v.isHasTax;
temp.taxInclusive = v.isHasTax;
temp.taxRate = v.taxRate; temp.taxRate = v.taxRate;
// @ 配送方式 默认物流 // @ 配送方式 默认物流
temp.logistics = 1 temp.logistics = 1
...@@ -104,12 +101,11 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => { ...@@ -104,12 +101,11 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
return temp return temp
}) })
// 把地址信息冗余给商品字段render // 把地址信息冗余给商品字段render
// schemaAction.setFieldValue('orderProductRequests', await filterProductDataById([], data)) schemaAction.setFieldValue('products', newData)
schemaAction.setFieldValue('orderProductRequests', newData) schemaAction.setFieldValue('vendorMemberName', item.partyBName)
schemaAction.setFieldValue('supplyMembersName', item.partyBName) schemaAction.setFieldValue('vendorMemberId', item.partyBMemberId)
schemaAction.setFieldValue('supplyMembersId', item.partyBMemberId) schemaAction.setFieldValue('vendorRoleId', item.partyBRoleId)
schemaAction.setFieldValue('supplyMembersRoleId', item.partyBRoleId) schemaAction.setFieldValue('digest', item.contractAbstract)
schemaAction.setFieldValue('orderThe', item.contractAbstract)
schemaAction.setFieldValue('contractId', item.id) schemaAction.setFieldValue('contractId', item.id)
} }
confirmModal && confirmModal() confirmModal && confirmModal()
......
...@@ -103,8 +103,8 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => { ...@@ -103,8 +103,8 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
temp.relevanceProductCategory = v.associatedCategory; temp.relevanceProductCategory = v.associatedCategory;
temp.relevanceProductBrand = v.associatedBrand; temp.relevanceProductBrand = v.associatedBrand;
temp.price = v.price; temp.price = v.price;
temp.inventory = v.bidCount; temp.stock = v.bidCount;
temp.taxInclusive = v.isHasTax; temp.tax = v.isHasTax;
temp.taxRate = v.taxRate; temp.taxRate = v.taxRate;
// @ 配送方式 默认物流 // @ 配送方式 默认物流
temp.logistics = 1 temp.logistics = 1
...@@ -116,7 +116,6 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => { ...@@ -116,7 +116,6 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
tempOriginData.push(item) tempOriginData.push(item)
} }
}) })
console.log(tempOriginData, 'tempOriginData')
return tempOriginData return tempOriginData
} }
} }
...@@ -126,15 +125,15 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => { ...@@ -126,15 +125,15 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
console.log(rowSelectionCtl, 'rowSelectionCtl') console.log(rowSelectionCtl, 'rowSelectionCtl')
// @ts-ignore // @ts-ignore
const res = await PublicApi.postOrderIsWorkFlow({ const res = await PublicApi.postOrderIsWorkFlow({
memberId: schemaAction.getFieldValue('supplyMembersId'), memberId: schemaAction.getFieldValue('vendorMemberId'),
memberRoleId: schemaAction.getFieldValue('supplyMembersRoleId'), memberRoleId: schemaAction.getFieldValue('vendorRoleId'),
productIds: rowSelectionCtl.selectRow.map(item => item.associatedDataId), productIds: rowSelectionCtl.selectRow.map(item => item.associatedDataId),
orderModel: schemaAction.getFieldValue('orderModel') orderModel: schemaAction.getFieldValue('orderModel')
}, { ctlType: 'none' }) }, { ctlType: 'none' })
if (res.code === 1000) { if (res.code === 1000) {
const productData = schemaAction.getFieldValue('orderProductRequests') const productData = schemaAction.getFieldValue('products')
schemaAction.setFieldValue('orderProductRequests', addMaterialProcessField(rowSelectionCtl.selectRow, productData)) schemaAction.setFieldValue('products', addMaterialProcessField(rowSelectionCtl.selectRow, productData))
confirmModal && confirmModal() confirmModal && confirmModal()
setVisible(false) setVisible(false)
} }
......
...@@ -34,6 +34,7 @@ export const procurementRenderField = (_orderProductRequests) => { ...@@ -34,6 +34,7 @@ export const procurementRenderField = (_orderProductRequests) => {
relevanceProductName: item.productName, relevanceProductName: item.productName,
relevanceProductBrand: item.brand, relevanceProductBrand: item.brand,
relevanceProductCategory: item.category, relevanceProductCategory: item.category,
relevanceProductSpec: item.spec,
logistics: item.logistics.deliveryType, logistics: item.logistics.deliveryType,
// id: item.materialId, // id: item.materialId,
code: item.materialCode, code: item.materialCode,
...@@ -47,25 +48,21 @@ export const procurementRenderField = (_orderProductRequests) => { ...@@ -47,25 +48,21 @@ export const procurementRenderField = (_orderProductRequests) => {
/** 采购合同下单 字段转换 */ /** 采购合同下单 字段转换 */
export const procurementProcessField = (value) => { export const procurementProcessField = (value) => {
value.orderProductRequests = value.orderProductRequests.map(item => { value.products = value.products.map(item => {
// @todo 查询商品对应的最小起订数
// const { data, code } = await PublicApi.getProductCommodityGetCommodity({id: item.relevanceProductId})
// delete item.id
return { return {
...item, ...item,
productId: item.relevanceProductId, productId: item.quotedSkuId,
productName: item.relevanceProductName, productName: item.quotedName,
brand: item.relevanceProductBrand, brand: item.quotedBrand,
category: item.relevanceProductCategory, category: item.quotedCategory,
unit: item.unit, unit: item.unit,
price: item.unitPrice, price: item.price,
deliveryType: item.logistics.deliveryType, deliveryType: item.logistics.deliveryType,
// @todo 后端暂无返回 写死1
minOrder: 1,
// 物料信息 // 物料信息
// materialId: item.id, materialId: item.productId,
materialCode: item.code, materialCode: item.productNo,
materialName: item.name, materialName: item.name,
materialSpec: item.spec,
materialType: item.type, materialType: item.type,
materialCategory: item.category, materialCategory: item.category,
materialBrand: item.brand, materialBrand: item.brand,
...@@ -268,182 +265,6 @@ export const contractColumns: any[] = [ ...@@ -268,182 +265,6 @@ export const contractColumns: any[] = [
} }
] ]
export const paymentInformationColumns: any[] = [
{
title: '支付次数',
dataIndex: 'payCount',
// align: 'center',
key: 'payCount'
},
{
title: '支付环节',
dataIndex: 'payNode',
// align: 'center',
key: 'payNode'
},
{
title: '外部状态',
dataIndex: 'externalState',
// align: 'center',
key: 'externalState',
render: text => PurchaseOrderOutWorkStateTexts[text]
},
{
title: '支付比例',
dataIndex: 'payRatio',
key: 'payRatio',
editable: true,
forceEdit: true,
formItem: 'input',
formItemProps: {
addonAfter: '%'
},
width: 200,
render: text => text + '%'
},
{
title: '支付金额',
dataIndex: 'payPrice',
// align: 'center',
key: 'payPrice'
},
{
title: '支付方式',
dataIndex: 'payWay',
key: 'payWay',
formItem: 'select',
editable: true,
forceEdit: true,
formItemProps: {
options: []
},
width: 200
},
{
title: '支付渠道',
dataIndex: 'channel',
key: 'channel',
formItem: 'select',
editable: true,
forceEdit: true,
width: 200
},
]
// 商品列表
export const productInfoColumns: any[] = [
// to fix: 这里通过commodityId判断询报价手工类型会出错
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
key: 'productId',
// render: (t, r) => {
// if(r?.commodityId) {
// return r.id
// } else {
// return r.productId
// }
// }
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
key: 'productName',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
// to fix: 这里通过commodityId判断询报价手工类型会出错 之前有commodityId是手工
{
title: '单价(元)',
dataIndex: 'unitPrice',
align: 'left',
key: 'unitPrice',
// render: (t, r) => {
// // todo 还差需求报价的商品数据字段对比
// if(r?.commodityId) {
// return <PriceComp priceSection={r.unitPrice}/>
// } else {
// return <span style={{color: 'red'}}>¥ {r.price}</span>
// }
// }
},
{
title: '会员折扣',
dataIndex: 'memberPrice',
align: 'center',
key: 'memberPrice',
render: (text, record) => record.isMemberPrice && text ? text * 100 + '%' : null
},
{
title: '采购数量',
dataIndex: 'purchaseCount',
align: 'center',
key: 'purchaseCount',
formItem: 'input',
editable: true,
width: 140
},
{
title: '含税',
dataIndex: 'taxInclusive',
align: 'center',
key: 'taxInclusive',
render: (t, r) => r.taxRate ? '是' : '否'
},
{
title: '税率',
dataIndex: 'taxRate',
align: 'center',
key: 'taxRate',
render: (t, r) => t ? `${t}%` : null
},
{
title: '金额',
dataIndex: 'money',
align: 'center',
key: 'money',
},
// 接口调用
{
title: '配送方式',
dataIndex: 'logistics',
align: 'center',
key: 'logistics',
render: (t, r) => {
if(r.logistics?.deliveryType === 1)
return "物流(默认)"
else if(r.logistics?.deliveryType === 2)
return <AddressPop pickInfo={t}>{DELIVERY_TYPE[t.deliveryType]}</AddressPop>
else if(r.logistics?.deliveryType === 3)
return "无需配送"
}
},
{
title: '操作',
dataIndex: 'ctl',
align: 'center',
key: 'ctl',
},
]
// 合同下单 物料列表 // 合同下单 物料列表
export const materialInfoColumns: any[] = [ export const materialInfoColumns: any[] = [
{ {
...@@ -496,7 +317,7 @@ export const materialInfoColumns: any[] = [ ...@@ -496,7 +317,7 @@ export const materialInfoColumns: any[] = [
dataIndex: 'relevanceProductId', dataIndex: 'relevanceProductId',
align: 'center', align: 'center',
key: 'relevanceProductId', key: 'relevanceProductId',
render: (t, r) => `${t}/${r.relevanceProductName || ''}/${r.relevanceProductCategory || ''}/${r.relevanceProductBrand || ''}` render: (t, r) => `${t}/${r.relevanceProductName || ''}/${r.relevanceProductSpec || ''}/${r.relevanceProductCategory || ''}/${r.relevanceProductBrand || ''}`
}, },
{ {
title: '单价(元)', title: '单价(元)',
...@@ -506,24 +327,24 @@ export const materialInfoColumns: any[] = [ ...@@ -506,24 +327,24 @@ export const materialInfoColumns: any[] = [
}, },
{ {
title: '供方库存', title: '供方库存',
dataIndex: 'inventory', dataIndex: 'stock',
align: 'center', align: 'center',
key: 'inventory', key: 'stock',
}, },
{ {
title: '采购数量', title: '采购数量',
dataIndex: 'purchaseCount', dataIndex: 'quantity',
align: 'center', align: 'center',
key: 'purchaseCount', key: 'quantity',
formItem: 'input', formItem: 'input',
editable: true, editable: true,
// width: 80 // width: 80
}, },
{ {
title: '含税', title: '含税',
dataIndex: 'taxInclusive', dataIndex: 'tax',
align: 'center', align: 'center',
key: 'taxInclusive', key: 'tax',
render: (t, r) => t ? '是' : '否' render: (t, r) => t ? '是' : '否'
}, },
{ {
...@@ -547,15 +368,6 @@ export const materialInfoColumns: any[] = [ ...@@ -547,15 +368,6 @@ export const materialInfoColumns: any[] = [
key: 'logistics', key: 'logistics',
formItem: 'select', formItem: 'select',
editable: true, editable: true,
// width: 80
// render: (t, r) => {
// if(r.logistics?.deliveryType === 1)
// return "物流(默认)"
// else if(r.logistics?.deliveryType === 2)
// return "自提"
// else if(r.logistics?.deliveryType === 3)
// return "无需配送"
// }
}, },
{ {
title: '操作', title: '操作',
...@@ -564,99 +376,3 @@ export const materialInfoColumns: any[] = [ ...@@ -564,99 +376,3 @@ export const materialInfoColumns: any[] = [
key: 'ctl', key: 'ctl',
}, },
] ]
// 合并订单父级表格列
export const mergeParentTableColumns: any[] = [
{
title: '订单号',
dataIndex: 'orderNo',
align: 'center',
key: 'orderNo',
// @todo 此时以采购商的角色查看供应商的订单详情,合理性有待商榷
render: (t, r) => <a target="blank" href={`/memberCenter/tranactionAbility/purchaseOrder/orderList/preview?id=${r.id}`}>{t}</a>
},
{
title: '订单摘要',
dataIndex: 'orderThe',
align: 'center',
key: 'orderThe',
},
{
title: '采购商名称',
dataIndex: 'memberName',
align: 'center',
key: 'memberName',
},
{
title: '下单时间',
dataIndex: 'createTime',
align: 'center',
key: 'createTime',
render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '活动时间',
dataIndex: 'none',
align: 'center',
key: 'none',
},
{
title: '活动名称',
dataIndex: 'none',
align: 'center',
key: 'none',
}
]
// 合并订单子级表格列
export const mergeChildrenTableColumns: any[] = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
key: 'productId',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
key: 'productName',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
key: 'price',
},
{
title: '原订单数量',
dataIndex: 'purchaseCount',
align: 'center',
key: 'purchaseCount',
},
{
title: '原订单金额',
dataIndex: 'id',
align: 'center',
key: 'id',
render: (t, r) => `¥${(r.purchaseCount*100) * (r.price*100) / 10000}`
}
]
...@@ -67,6 +67,14 @@ export const useInvoiceList = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -67,6 +67,14 @@ export const useInvoiceList = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
}) })
} }
export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('products').subscribe(state => {
const { value } = state
// 强制渲染一次, 用于触发金额总数
update()
})
}
// 编辑订单 地址和发票变动 触发订单更新 // 编辑订单 地址和发票变动 触发订单更新
export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => { export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
......
...@@ -8,12 +8,11 @@ import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd ...@@ -8,12 +8,11 @@ import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd
import { SaveOutlined, LinkOutlined, PlusOutlined } from '@ant-design/icons' import { SaveOutlined, LinkOutlined, PlusOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm' import NiceForm from '@/components/NiceForm'
import { mergeAllSchemas } from './schema' import { mergeAllSchemas } from './schema'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useOrderUpdateChangeOther } from './effects' import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useOrderUpdateChangeOther, useProductTableChangeForPay } from './effects'
import { orderCombination, orderTypeLabelMap, procurementProcessField, procurementRenderField } from './constant' import { orderCombination, orderTypeLabelMap, procurementProcessField, procurementRenderField } from './constant'
import CirculationRecord from '../components/circulationRecord' import CirculationRecord from '../components/circulationRecord'
import SelectAddress from './components/selectAddress' import SelectAddress from './components/selectAddress'
import TheInvoiceList from './components/theInvoiceList' import TheInvoiceList from './components/theInvoiceList'
import moment from 'moment'
import styled from 'styled-components' import styled from 'styled-components'
import { useUpdate } from '@umijs/hooks' import { useUpdate } from '@umijs/hooks'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
...@@ -44,8 +43,8 @@ const addSchemaAction = createFormActions() ...@@ -44,8 +43,8 @@ const addSchemaAction = createFormActions()
// 总计金额联动框 // 总计金额联动框
export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => { export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
const { form } = useFormSpy({ selector: [['onFieldValueChange', 'orderProductRequests']], reducer: v => v }) const { form } = useFormSpy({ selector: [['onFieldValueChange', 'products']], reducer: v => v })
const data = form.getFieldValue('orderProductRequests') const data = form.getFieldValue('products')
const sum = data.reduce((prev, next) => (prev*100 + (next.money || 0)*100)/100, 0) const sum = data.reduce((prev, next) => (prev*100 + (next.money || 0)*100)/100, 0)
const [freePrice, setFreePrice] = useState<number>(0) const [freePrice, setFreePrice] = useState<number>(0)
...@@ -105,7 +104,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -105,7 +104,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
deliveryTime: formatTimeString(data.deliveryTime) deliveryTime: formatTimeString(data.deliveryTime)
}) })
setTimeout(() => { setTimeout(() => {
addSchemaAction.setFieldValue('orderProductRequests', _orderProductRequests) addSchemaAction.setFieldValue('products', _orderProductRequests)
}, 1000) }, 1000)
setFormLoading(false) setFormLoading(false)
}) })
...@@ -121,89 +120,33 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -121,89 +120,33 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}, []) }, [])
const handleSubmit = async (value) => { const handleSubmit = async (value) => {
const _orderProductRequests = JSON.parse(JSON.stringify(value.orderProductRequests))
try { try {
let fnResult = null let fnResult = null
switch (page_type) { // 新增订单/编辑订单
case '0': { const params = { ...value }
// 新增订单/编辑订单
const params = {
...value,
deliveryTime: moment(value.deliveryTime).valueOf(),
// 没用的字段
orderProductRequests: _orderProductRequests.map(v => {
v.price = v.money / v.purchaseCount / v.memberPrice
v.isMemberPrice = Number(v.isMemberPrice) || 0
v.memberPrice = v.memberPrice
v.imgUrl = v.mainPic ? v.mainPic : v.imgUrl
v.minOrder = v.minOrder
v.channelProductId = v?.channelProductId || v?.commodityUnitPriceAndPicId
return v
}),
needTheInvoice: value.needTheInvoice ? 1 : 0,
// 冗余交付信息
deliveryAddresId: value.deliveryAddresId.id || value.deliveryAddresId,
...omit(value.deliveryAddresId, ['id']),
// 冗余发票信息
theInvoiceId: value.theInvoiceId ? value.theInvoiceId.id : undefined,
}
// 合同下单 取供应商默认的发货地址
const { data: deliveryAddress} = await PublicApi.getLogisticsSelectListMemberShipperAddress({
memberId: params.supplyMembersId,
roleId: params.supplyMembersRoleId
})
params.orderProductRequests = params.orderProductRequests.map(item => {
const address = deliveryAddress[0]
const logistics: any = {
deliveryType: item.logistics,
sendAddress: address.id,
render: address
}
return {
...item,
logistics
}
})
// 校验采购数量
const judgementByCount = params.orderProductRequests?.length && params.orderProductRequests.map(item => {
if(item.purchaseCount){
return true
} else {
return false
}
})
if(!judgementByCount || judgementByCount.includes(false)){
throw new Error('请填写商品采购数量')
}
// 使用发票即校验发票id
if(params.needTheInvoice && !params.theInvoiceId) {
throw new Error('请新增或选择需要使用的发票')
}
// logistics render字段字符串化
params.orderProductRequests = params.orderProductRequests.map(item => {
const logistics: any = {
...item.logistics,
render: JSON.stringify(typeof item.logistics.render === "object" ? item.logistics.render : (item.logistics?.render ? item.logistics.render.replace(/\"/g, '') : {}))
};
return {
...item,
logistics
}
})
setBtnLoading(true)
delete params.type
if(id) { // 校验采购数量
fnResult = await PublicApi.postOrderProcurementOrderUpdate({...params, id}) const judgementByCount = params.products?.length && params.products.map(item => {
} else { if(item.quantity){
const _params = procurementProcessField(params) return true
const _ = _params.quotationNo } else {
_params.quotationNo = _params.contractNo return false
_params.contractNo = _
fnResult = await PublicApi.postOrderPurchaseContractAdd(_params)
}
break;
} }
})
if(!judgementByCount || judgementByCount.includes(false)){
throw new Error('请填写商品采购数量')
}
// 使用发票即校验发票id
if(params.needInvoice && !params.theInvoiceId) {
throw new Error('请新增或选择需要使用的发票')
}
setBtnLoading(true)
if(id) {
fnResult = await PublicApi.postOrderProcurementOrderUpdate({...params, id})
} else {
const _params = procurementProcessField(params)
fnResult = await PublicApi.postOrderPurchaseContractAdd(_params)
} }
if (fnResult.code === 1000) { if (fnResult.code === 1000) {
setTimeout(() => { setTimeout(() => {
...@@ -289,20 +232,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -289,20 +232,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}) })
} }
}) })
// 监听商品总价的变更, 此处逻辑需优化
$('sumPrice').subscribe(payload => {
const payment = addSchemaAction.getFieldValue('paymentInformationResponses')
const oldData = payment ? [...payment] : [];
if (oldData && oldData.length > 0) {
const newData = oldData.map(v => {
v.payPrice = (v.payRatio / 100 * payload).toFixed(2)
return v
})
addSchemaAction.setFieldValue('paymentInformationResponses', newData)
}
// setProductSumPrice(payload)
productSumPriceRef.current = payload
})
useOrderFormInitEffect(ctx) useOrderFormInitEffect(ctx)
useModelTypeChange(state => { useModelTypeChange(state => {
const { value } = state const { value } = state
...@@ -311,6 +240,9 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -311,6 +240,9 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}) })
useEditHideField() useEditHideField()
// 商品信息的改动 驱动支付信息变化
useProductTableChangeForPay(ctx, update)
// 编辑 地址和发票信息变动 触发订单更新 // 编辑 地址和发票信息变动 触发订单更新
useOrderUpdateChangeOther(ctx) useOrderUpdateChangeOther(ctx)
......
...@@ -22,18 +22,8 @@ export const sortByKey = (params) => { ...@@ -22,18 +22,8 @@ export const sortByKey = (params) => {
} }
export const getUnitPriceTotal = (record) => { export const getUnitPriceTotal = (record) => {
const purchaseCount = Number(record['purchaseCount']) || 0 const purchaseCount = Number(record['quantity']) || 0
record.unitPrice = pageStatus === PageStatus.EDIT ? record.price : record.unitPrice || record.price || 0 return Number((record.price * purchaseCount).toFixed(2))
if (typeof record.unitPrice === 'number') {
return Number((record.unitPrice * purchaseCount).toFixed(2))
}
if(record.unitPrice) {
record.unitPrice = sortByKey(record.unitPrice)
}
// fix 当没有传递unitPrice字段时 但有price字段时 补全unitPrice字段
if(record.price && JSON.stringify(record.unitPrice) === "{}") {
record.unitPrice = {'0-0': record.price}
}
} }
/** /**
...@@ -46,7 +36,7 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio ...@@ -46,7 +36,7 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
orderModel = ctx.getFieldValue('orderModel') orderModel = ctx.getFieldValue('orderModel')
const handleDelete = (record) => { const handleDelete = (record) => {
const newData = [...ctx.getFieldValue('orderProductRequests')] const newData = [...ctx.getFieldValue('products')]
// 删除formvalue // 删除formvalue
const colIndex = newData.findIndex(v => v.id === record.id) const colIndex = newData.findIndex(v => v.id === record.id)
newData.splice(colIndex, 1) newData.splice(colIndex, 1)
...@@ -54,7 +44,7 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio ...@@ -54,7 +44,7 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
// 删除选中的项 // 删除选中的项
rowSelectionCtl.setSelectRow(newData) rowSelectionCtl.setSelectRow(newData)
rowSelectionCtl.setSelectedRowKeys(newData.map(v => v.id)) rowSelectionCtl.setSelectedRowKeys(newData.map(v => v.id))
ctx.setFieldValue('orderProductRequests', newData) ctx.setFieldValue('products', newData)
} }
...@@ -65,37 +55,22 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio ...@@ -65,37 +55,22 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
// 渲染操作 // 渲染操作
materialInfoColumns[materialInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>删除</Button> materialInfoColumns[materialInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>删除</Button>
// 渲染单价 // 渲染单价
materialInfoColumns[8].render = (t, r) => { materialInfoColumns[8].render = (t, r) => <span style={{color: 'red'}}>{r.price}</span>
if(orderModel === OrderModalType["HAND_ORDER"]) {
return <PriceComp priceSection={r.unitPrice}/>
} else {
return r.price ? <span style={{color: 'red'}}>{r.price}</span> : <PriceComp priceSection={r.unitPrice}/>
}
}
// 渲染商品ID
materialInfoColumns[0].render = (t, r) => {
if(orderModel === OrderModalType["HAND_ORDER"]) {
return r.id
} else {
return r.id ? r.id : r.productId
}
}
} else { } else {
// 渲染单价 // 渲染单价
materialInfoColumns[8].render = (t, r) => <span style={{color: 'red'}}>{r.price}</span> materialInfoColumns[8].render = (t, r) => <span style={{color: 'red'}}>{r.price}</span>
// 渲染商品ID
materialInfoColumns[0].render = (t, r) => r.productId
materialInfoColumns[materialInfoColumns.length - 1].render = (t, r) => null materialInfoColumns[materialInfoColumns.length - 1].render = (t, r) => null
} }
return materialInfoColumns return materialInfoColumns
}) })
const handleShowMaterial = () => { const handleShowMaterial = () => {
const supplyMembersId = ctx.getFieldValue('supplyMembersId') const supplyMembersId = ctx.getFieldValue('vendorMemberId')
const products = ctx.getFieldValue('products')
if (supplyMembersId) { if (supplyMembersId) {
materialRef.current.setVisible(true) materialRef.current.setVisible(true)
materialRef.current.rowSelectionCtl.setSelectedRowKeys(() => products.map(item => item.id))
} else { } else {
message.error('请先选择采购询价合同') message.error('请先选择采购询价合同')
} }
...@@ -113,22 +88,16 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio ...@@ -113,22 +88,16 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
const { pageStatus } = usePageStatus() const { pageStatus } = usePageStatus()
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('orderProductRequests')]; const newData = [...ctx.getFieldValue('products')];
const index = newData.findIndex(item => row.id === item.id); const index = newData.findIndex(item => row.id === item.id);
const item = newData[index]; const item = newData[index];
// 算单行价格
row['money'] = getUnitPriceTotal(row) row['money'] = getUnitPriceTotal(row)
// 通过下单模式判断 是否是手工或者渠道手工下单
let addModel = ctx.getFieldValue("orderModel")
row['productId'] = (
addModel === OrderModalType["HAND_ORDER"] ||
addModel === OrderModalType["CHANNEL_DIRECT_MINING_ORDER"] ||
addModel === OrderModalType["CHANNEL_SPOT_MANUAL_ORDER"]
) && (pageStatus === PageStatus.ADD) ? row.id : row.productId
newData.splice(index, 1, { newData.splice(index, 1, {
...item, ...item,
...row, ...row,
}); });
ctx.setFieldValue('orderProductRequests', newData) ctx.setFieldValue('products', newData)
resolve({item, newData}) resolve({item, newData})
}) })
}; };
......
...@@ -13,7 +13,6 @@ const getShopTypeMap = (() => { ...@@ -13,7 +13,6 @@ const getShopTypeMap = (() => {
})) }))
})() })()
// 基本信息 // 基本信息
const basicInfo: ISchema = { const basicInfo: ISchema = {
"x-index": 0, "x-index": 0,
...@@ -66,14 +65,7 @@ const basicInfo: ISchema = { ...@@ -66,14 +65,7 @@ const basicInfo: ISchema = {
}, },
], ],
}, },
shopId: { digest: {
type: 'string',
enum: getShopTypeMap,
title: '适应商城',
required: true,
visible: false,
},
orderThe: {
type: 'string', type: 'string',
title: '订单摘要', title: '订单摘要',
"x-rules": [ "x-rules": [
...@@ -97,7 +89,7 @@ const basicInfo: ISchema = { ...@@ -97,7 +89,7 @@ const basicInfo: ISchema = {
"x-linkages": [ "x-linkages": [
{ {
type: 'value:schema', type: 'value:schema',
target: "supplyMembersName", target: "vendorMemberName",
condition: `{{$self.editable && !!$value}}`, condition: `{{$self.editable && !!$value}}`,
schema: { schema: {
"x-component-props": { "x-component-props": {
...@@ -108,7 +100,7 @@ const basicInfo: ISchema = { ...@@ -108,7 +100,7 @@ const basicInfo: ISchema = {
} }
], ],
}, },
supplyMembersName: { vendorMemberName: {
type: 'string', type: 'string',
title: '供应会员', title: '供应会员',
"x-component-props": { "x-component-props": {
...@@ -116,11 +108,11 @@ const basicInfo: ISchema = { ...@@ -116,11 +108,11 @@ const basicInfo: ISchema = {
}, },
required: true, required: true,
}, },
supplyMembersId: { vendorMemberId: {
type: 'string', type: 'string',
display: false display: false
}, },
supplyMembersRoleId: { vendorRoleId: {
type: 'string', type: 'string',
display: false display: false
}, },
...@@ -194,11 +186,11 @@ export const orderMaterial: ISchema = { ...@@ -194,11 +186,11 @@ export const orderMaterial: ISchema = {
tab: '订单物料' tab: '订单物料'
}, },
properties: { properties: {
orderProductRequests: { products: {
type: 'array', type: 'array',
"x-component": 'MultTable', "x-component": 'MultTable',
"x-component-props": { "x-component-props": {
rowKey: 'id', rowKey: 'materialId',
columns: "{{materialColumns}}", columns: "{{materialColumns}}",
components: "{{materialComponents}}", components: "{{materialComponents}}",
prefix: "{{materialAddButton}}", prefix: "{{materialAddButton}}",
......
...@@ -25,7 +25,8 @@ const approvedActions = createFormActions() ...@@ -25,7 +25,8 @@ const approvedActions = createFormActions()
export interface ReadyAddOrderProps {} export interface ReadyAddOrderProps {}
const fetchTableData = async (params) => { const fetchTableData = async (params) => {
const { data } = await PublicApi.getOrderProcurementStayAddList(params) const { data } = await PublicApi.getOrderBuyerCreatePage(params)
// const { data } = await PublicApi.getOrderProcurementStayAddList(params)
return data return data
} }
......
import React, { useRef } from 'react' import React, { useRef } from 'react'
import { Button, Popconfirm } from 'antd' import { Button, Dropdown, Menu } from 'antd'
import { baseOrderListColumns } from '../../constant' import { baseOrderListColumns } from '../../constant'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable' import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { history } from 'umi' import { history } from 'umi'
import { PurchaseOrderInsideWorkState, PurchaseOrderOutWorkState } from '@/constants/order' import { CaretDownOutlined } from '@ant-design/icons'
import TableOperation from '@/components/TableOperation'
// 业务hooks, 待新增订单 // 业务hooks, 待新增订单
export const useSelfTable = () => { export const useSelfTable = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id', extendsSelection: { const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id'})
getCheckboxProps: record => ({
// 不等于可提交审核的 都无法通过批量提交
disabled: record.interiorState !== PurchaseOrderInsideWorkState.ADD_PURCHASE_ORDER,
interiorState: record.interiorState,
})
}})
const handleSubmit = async (id) => { const handleSubmit = async (id) => {
// 从待新增订单直接传到一级审核, 状态写死, 默认传-1 await PublicApi.postOrderBuyerCreateSubmit({orderId: id})
await PublicApi.postOrderProcurementOrderSubmitExamine({id, state: -1})
ref.current.reload() ref.current.reload()
} }
const handleDelete = async (id) => { const handleDelete = async (id) => {
await PublicApi.postOrderProcurementOrderDelete({id}) await PublicApi.postOrderBuyerCreateDelete({orderId: id})
ref.current.reload() ref.current.reload()
} }
const handleEdit = (record: any) => { const handleEdit = (record: any) => {
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/edit?id=${record.id}${record.type === 4 ? '&type=4' : ''}`) history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/srm/edit?id=${record.orderId}${record.type === 4 ? '&type=4' : ''}`)
} // history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/edit?id=${record.id}${record.type === 4 ? '&type=4' : ''}`)
const handleCancel = async (id) => {
await PublicApi.postOrderPurchaseOrderCancel({id})
ref.current.reload()
} }
/** 参照后台数据生成 */ /** 参照后台数据生成 */
const renderOptionButton = (record: any) => { const renderOptionButton = (record: any) => {
const statusAndOperationList = { const buttonGroup = { '提交': true, '修改': true, '删除': true }
'5': ['提交审核', '修改', '删除'],
'6': ['修改'],
}
const operationHandler = { const operationHandler = {
'提交审核': () => handleSubmit(record.id), '提交': () => handleSubmit(record.orderId),
'修改': () => handleEdit(record), '修改': () => handleEdit(record),
'删除': () => handleDelete(record.id), '删除': () => handleDelete(record.orderId),
} }
return (
<TableOperation const keyNames = Object.keys(buttonGroup)
record={record}
customField='button' return (<>
statusOperationMap={statusAndOperationList} {
operationHandler={operationHandler} Object.values(buttonGroup).filter(Boolean).length > 2
priorityOperationName='提交审核' ?
/> <>
) <Button type='link' onClick={operationHandler[keyNames[0]]}>{keyNames[0]}</Button>
<Dropdown overlay={
<Menu>
{
keyNames.slice(1, keyNames.length).map((e, i) => (
<Menu.Item key={`menuItem${i}`}>
<Button type='link' onClick={operationHandler[e]}>{ e }</Button>
</Menu.Item>
))
}
</Menu>
}>
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
更多 <CaretDownOutlined />
</a>
</Dropdown>
</>
:
keyNames.map((e, i) => (buttonGroup[e] ? <Button key={`btnItem${i}`} type='link' onClick={operationHandler[e]}>{ e }</Button> : null))
}
</>)
} }
const secondColumns = () => { const secondColumns = () => {
......
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { getPurchaseOrderSelectOption } from '@/pages/transaction/effect'; import { getPurchaseOrderReadyAddPageSelectOption } from '@/pages/transaction/effect';
export const tableListSchema: any = () => { export const tableListSchema: any = () => {
const res = getPurchaseOrderSelectOption() const res = getPurchaseOrderReadyAddPageSelectOption()
if(res) { if(res) {
const { const {
orderTypes: OrderType, orderTypes: OrderType,
...@@ -31,19 +31,19 @@ export const tableListSchema: any = () => { ...@@ -31,19 +31,19 @@ export const tableListSchema: any = () => {
}, },
}, },
properties: { properties: {
orderThe: { "digest": {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '请输入订单摘要', placeholder: '请输入订单摘要',
} }
}, },
"supplyMembersName": { "memberName": {
type: 'string', type: 'string',
"x-component-props": { "x-component-props": {
placeholder: '请输入供应会员名称' placeholder: '请输入供应会员名称'
} }
}, },
"type": { "orderType": {
type: 'string', type: 'string',
"x-component-props": { "x-component-props": {
placeholder: '请选择订单类型' placeholder: '请选择订单类型'
...@@ -53,7 +53,7 @@ export const tableListSchema: any = () => { ...@@ -53,7 +53,7 @@ export const tableListSchema: any = () => {
value: item['id'], value: item['id'],
})) }))
}, },
"[startCreateTime,endCreateTime]": { "[startDate,endDate]": {
type: 'daterange', type: 'daterange',
// "x-component": 'DateRangePickerUnix', // "x-component": 'DateRangePickerUnix',
'x-component-props': { 'x-component-props': {
......
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