Commit 466c7837 authored by shenshaokai's avatar shenshaokai

Merge branch 'fix-20221102' into 'jinfa-20221102'

fix: bugID=37174 到货区域接口更换 See merge request project/jinfa-platform!500
parents c12040b5 ec19394b
......@@ -12,6 +12,7 @@ import { getProductGoodsGetGoodsList } from '@/services/ProductV2Api';
import { getPurchaseBiddingPrizeMaterielPage, getPurchaseQuotedPriceProductlistListContract, getPurchaseSubmitTenderMaterielGetSubmitTenderMaterielList } from '@/services/PurchaseV2Api';
import { getIntl, history } from 'umi';
import { getContractPurchaseRequisitionPageToBeCreate, getContractSelectArrivalAreaList, getContractSelectBusinessTypeList, postContractPurchaseRequisitionGetPrpIdsByRequisitionProductIds } from '@/services/ContractV2Api';
import { getMemberParameterManageGetArrivalArea } from '@/services/MemberV2Api'
import NiceForm from '@/components/NiceForm';
import { createFormActions, useForm } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
......@@ -513,7 +514,7 @@ const FormList = (props: any) => {
rules={[{
required: true,
pattern: /^\d*(?:\.\d{0,5})?$/,
message: '单价仅限五位小数'
message: '单价仅限五位小数'
},
]}
>
......@@ -791,7 +792,6 @@ const FormList = (props: any) => {
}
item[idx].bidAmount = item[idx].bidCount && item[idx].price ? (new BigNumber(+item[idx].bidCount).multipliedBy(item[idx].price).toNumber()).toFixed(2) : 0;
console.log(item[idx].bidAmount,item[idx]);
setData(item)
......@@ -813,11 +813,11 @@ const FormList = (props: any) => {
};
// 搜索条件下拉选择内容
const fetchOptions = (service) => {
const fetchOptions = (service, [label, value] = ['text', 'id']) => {
return async function () {
const res = await service();
if (res.code === 1000) {
return res.data.map((item) => { return { label: item.text, value: item.id.toString() } })
return res.data.map((item) => ({ label: item[label], value: item[value].toString() }))
}
return [];
}
......@@ -894,7 +894,7 @@ const FormList = (props: any) => {
);
useAsyncSelect(
'arrivalArea',
fetchOptions(getContractSelectArrivalAreaList),
fetchOptions(getMemberParameterManageGetArrivalArea, ['name', 'key']),
);
useAsyncSelect(
'businessType',
......
......@@ -3,6 +3,7 @@ import { useState, useEffect, forwardRef } from 'react';
import { Input, Select, DatePicker, Form, message } from 'antd'
import style from '../../../constants/styles.less'
import { getContractSelectArrivalAreaList, getContractManageGetContractNo, getContractSelectArrivalPortTransitList } from '@/services/ContractV2Api'
import { getMemberParameterManageGetArrivalArea } from '@/services/MemberV2Api'
import { getIntl } from 'umi';
import { validatorByte } from '@/utils/regExp';
......@@ -65,7 +66,7 @@ const FreightInfo = (props: any) => {
useEffect(() => {
/**到货区域 */
getContractSelectArrivalAreaList().then(res => {
getMemberParameterManageGetArrivalArea().then(res => {
if (res.code === 1000) {
setAreaList(res.data)
}
......@@ -249,7 +250,7 @@ const FreightInfo = (props: any) => {
style={{ minWidth: 100 }}
>
{areaList?.length ? areaList.map((item) => (
<Option value={`${item.id}_+_${item.text}`} key={item.id}>{item.text}</Option>
<Option value={`${item.key}_+_${item.name}`} key={item.key}>{item.name}</Option>
)) : null}
</Select>
</Form.Item>
......
......@@ -4,6 +4,7 @@ import { Button, Input, Select, DatePicker, Form, Drawer, message } from 'antd'
import style from '../../../constants/styles.less'
import moment from 'moment';
import { getContractManageGetContractNo, getContractSelectArrivalAreaList, getContractSelectArrivalPortList, getContractSelectBusinessTypeList, getContractSelectCurrencyList } from '@/services/ContractV2Api'
import { getMemberParameterManageGetArrivalArea } from '@/services/MemberV2Api';
import { getIntl } from 'umi';
import { Ht_gl } from '../../add/components/Information';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
......@@ -109,7 +110,7 @@ const Information = (props: any) => {
})
/**到货区域 */
getContractSelectArrivalAreaList().then(res => {
getMemberParameterManageGetArrivalArea().then(res => {
if (res.code === 1000) {
setAreaList(res.data)
}
......
......@@ -13,6 +13,7 @@ import Submit from '@/components/NiceForm/components/Submit'
import { getIntl, history } from 'umi';
import moment from 'moment';
import { getContractPurchaseRequisitionPageToBeCreate, getContractSelectArrivalAreaList, getContractSelectBusinessTypeList } from '@/services/ContractV2Api'
import { getMemberParameterManageGetArrivalArea } from '@/services/MemberV2Api'
import AuthButton from '@/components/AuthButton'
import { InfoCircleFilled, PlusCircleOutlined } from '@ant-design/icons';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
......@@ -20,12 +21,12 @@ const intl = getIntl();
const BiddingList = () => {
const ref = useRef<any>({});
const [visible,setVisible] = useState<boolean>(false)
const [visible, setVisible] = useState<boolean>(false)
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
//表头
const columns: ColumnType<any>[] = [{
width:120,
width: 120,
title: intl.formatMessage({ id: 'contract.purchase.number' }),
dataIndex: 'requisitionNo',
align: 'left',
......@@ -38,24 +39,24 @@ const BiddingList = () => {
{text}
</EyePreview>
</div>
},
},
{
title: intl.formatMessage({ id: 'contract.materialMark' }),
dataIndex: 'materialNo',
width:120,
width: 120,
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.purchase.materialName' }),
dataIndex: 'name',
width:120,
width: 120,
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.purchase.quantity' }),
dataIndex: 'quantity',
align: 'left',
width:120,
width: 120,
sorter: {
compare: (a, b) => a.quantity - b.quantity,
multiple: 1,
......@@ -63,70 +64,70 @@ const BiddingList = () => {
},
{
title: intl.formatMessage({ id: 'contract.purchase.digest' }),
width:120,
width: 120,
dataIndex: 'digest',
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.purchase.member' }),
width:120,
width: 120,
dataIndex: 'vendorMemberName',
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.purchase.materialNumber' }),
dataIndex: 'productNo',
width:120,
width: 120,
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.currency' }),
width:100,
width: 100,
dataIndex: 'currencyName',
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.businessType' }),
dataIndex: 'businessTypeName',
width:100,
width: 100,
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.purchase.department' }),
dataIndex: 'department',
width:80,
width: 80,
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.purchase.people' }),
dataIndex: 'requisitioner',
width:120,
width: 120,
align: 'left',
},
{
title: '创建人',
dataIndex: 'creator',
width:120,
width: 120,
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.purchase.time' }),
dataIndex: 'advanceDeliveryDate',
width:120,
width: 120,
align: 'left',
sorter: (a, b) => moment(a.finishTime).valueOf() - moment(b.finishTime).valueOf(),
},
{
title: intl.formatMessage({ id: 'contract.purchase.type' }),
dataIndex: 'deliveryMethodName',
width:80,
width: 80,
},
{
title: intl.formatMessage({ id: 'contract.purchase.address' }),
dataIndex: 'deliveryAddress',
width:160,
width: 160,
ellipsis: true,
render: (text) => (
<Tooltip title={text}>
......@@ -137,27 +138,27 @@ const BiddingList = () => {
{
title: intl.formatMessage({ id: 'contract.arrivalArea' }),
dataIndex: 'arrivalAreaName',
width:80,
width: 80,
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.fukuanfangshi' }),
dataIndex: 'payWayName',
width:80,
width: 80,
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.paymentClause' }),
dataIndex: 'payConditionName',
width:80,
width: 80,
align: 'left',
},
{
title: intl.formatMessage({ id: 'contract.purchase.internalState' }),
dataIndex: 'buyerInnerStatusName',
align: 'left',
width:120,
width: 120,
render: (text) => {
return (
<div>
......@@ -170,7 +171,7 @@ const BiddingList = () => {
{
title: intl.formatMessage({ id: 'contract.caozuo' }),
dataIndex: 'state',
width:120,
width: 120,
align: 'left',
fixed: 'right',
render: (_, record) => {
......@@ -224,25 +225,25 @@ const BiddingList = () => {
};
//检查数组中某参数是否一致
const isAllEqual = (array,type) =>{
const isAllEqual = (array, type) => {
if (array.length > 0) {
return !array.some(function(value, index) {
return value[type] !== array[0][type];
});
return !array.some(function (value, index) {
return value[type] !== array[0][type];
});
} else {
return true;
return true;
}
}
const handlePurchaseData = ()=>{
const handlePurchaseData = () => {
let data = selectRow
let record = data[0]
record.totalAmount ='';
record.partyBMemberId = isAllEqual(selectRow,'vendorMemberName') ? record.vendorMemberId : null;
record.partyBRoleId = isAllEqual(selectRow,'vendorMemberName') ? record.vendorRoleId : null;
record.partyBName = isAllEqual(selectRow,'vendorMemberName') ? record.vendorMemberName : null;
record.totalAmount = '';
record.partyBMemberId = isAllEqual(selectRow, 'vendorMemberName') ? record.vendorMemberId : null;
record.partyBRoleId = isAllEqual(selectRow, 'vendorMemberName') ? record.vendorRoleId : null;
record.partyBName = isAllEqual(selectRow, 'vendorMemberName') ? record.vendorMemberName : null;
record.sourceType = "4";
sessionStorage.setItem('record', JSON.stringify(data[0]));
......@@ -251,37 +252,37 @@ const BiddingList = () => {
}
const handleBatchAdd = ()=>{
if(!selectedRowKeys || !selectedRowKeys?.length){
message.info(intl.formatMessage({ id: 'qwe', defaultMessage: '请选择请购单'}))
const handleBatchAdd = () => {
if (!selectedRowKeys || !selectedRowKeys?.length) {
message.info(intl.formatMessage({ id: 'qwe', defaultMessage: '请选择请购单' }))
return
}
if(isAllEqual(selectRow,'vendorMemberName') && isAllEqual(selectRow,'currency') && isAllEqual(selectRow,'businessType') && isAllEqual(selectRow,'arrivalArea')&& isAllEqual(selectRow,'deliveryMethod') && isAllEqual(selectRow,'payWayName')&& isAllEqual(selectRow,'payConditionName')){
if (isAllEqual(selectRow, 'vendorMemberName') && isAllEqual(selectRow, 'currency') && isAllEqual(selectRow, 'businessType') && isAllEqual(selectRow, 'arrivalArea') && isAllEqual(selectRow, 'deliveryMethod') && isAllEqual(selectRow, 'payWayName') && isAllEqual(selectRow, 'payConditionName')) {
handlePurchaseData()
}else{
} else {
Modal.info({
width: 600,
title: intl.formatMessage({ id: 'material.pendingAdd.list.submit.tips', defaultMessage: '提交提醒' }),
icon: <InfoCircleFilled rotate={180} />,
content: (
<div>
<div style={{fontSize: 14}}>{intl.formatMessage({ id: 'contract.purchase.add.tip.title' })}</div>
<div style={{ fontSize: 14 }}>{intl.formatMessage({ id: 'contract.purchase.add.tip.title' })}</div>
</div>
),
okText: intl.formatMessage({ id: 'contract.purchase.continue'}),
cancelText: intl.formatMessage({ id: 'contract.quxiao'}),
okText: intl.formatMessage({ id: 'contract.purchase.continue' }),
cancelText: intl.formatMessage({ id: 'contract.quxiao' }),
});
}
}
// 搜索条件下拉选择内容
const fetchOptions = (service) => {
return async function() {
const fetchOptions = (service, [label, value] = ['text', 'id']) => {
return async function () {
const res = await service();
if(res.code === 1000) {
return res.data.map((item) => {return { label: item.text, value: item.id.toString() }})
if (res.code === 1000) {
return res.data.map((item) => ({ label: item[label], value: item[value].toString() }))
}
return [];
}
......@@ -313,7 +314,7 @@ const BiddingList = () => {
);
useAsyncSelect(
'arrivalArea',
fetchOptions(getContractSelectArrivalAreaList),
fetchOptions(getMemberParameterManageGetArrivalArea, ['name', 'key']),
);
useAsyncSelect(
'businessType',
......
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