Commit 36c2744e authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

🐞fix: 修改二轮报价列表显示的问题

parent e1fa60b2
......@@ -6,9 +6,15 @@ import { PublicApi } from '@/services/api';
import style from './index.less';
import { CaretDownOutlined, CaretRightOutlined } from '@ant-design/icons';
export type effectType = {
/** 报价轮次 */
turn?: number,
/** 订单Id */
id: number,
}
export interface BidInfoProps {
fetch?: () => Promise<unknown>,
effect?: any,
effect?: effectType,
}
const chNum: { [key: number]: string } = {
......@@ -132,6 +138,11 @@ const BidInfoLayout: React.FC<BidInfoProps> = (props: any) => {
})
}
const splitProductAttributeJson = (name: string,num: number) => {
const arr = name.split('-');
return arr[num]
}
return (
<Card
id='bidInfoLayout'
......@@ -162,8 +173,8 @@ const BidInfoLayout: React.FC<BidInfoProps> = (props: any) => {
</Col>
<Col span={6}>
<div className={style.childrenContent}>
<p><span>规格:</span>-</p>
<p><span>品类:</span>-</p>
<p><span>规格:</span>{splitProductAttributeJson(record.productAttributeJson, 0)}</p>
<p><span>品类:</span>{splitProductAttributeJson(record.productAttributeJson, 1)}</p>
</div>
</Col>
<Col span={6}>
......
......@@ -55,6 +55,7 @@ const AddForm = () => {
const fileInfo: any = { ...file };
basicInfo.id = params.purchaseInquiryId || params.id;
basicInfo.number = params.purchaseInquiryNo;
basicInfo.contacts = params.contacts;
basicInfo.purchaseInquiryNo = params.purchaseInquiryNo;
basicInfo.quotedPriceNo = params.quotedPriceNo;
basicInfo.memberName = params.memberName;
......@@ -62,12 +63,13 @@ const AddForm = () => {
basicInfo.createTime = params.createTime;
basicInfo.externalState = params.externalState;
basicInfo.interiorState = params.interiorState;
offerInfo.count = params.count || 0;
offerInfo.id = params.id;
if (params.count) {
if (path === 'edit') {
offerInfo.materiels = params.quotedPriceProducts;
offerInfo.count = params.count;
} else {
offerInfo.materiels = params.materiels;
offerInfo.turn = params.turn;
}
/** 修改才有回显下面这些的 */
if (path === 'edit') {
......@@ -85,7 +87,6 @@ const AddForm = () => {
setbasic(basicInfo);
setoffer(offerInfo);
setexplain(explainInfo);
console.log(res.data, 10086)
}
})
}, [])
......
......@@ -36,7 +36,6 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
const [record, setRecord] = useState<any>({});
const [index, setIndex] = useState<number>();
const [data, setData] = useState<any>({});
const [dataSource, setDataSource] = useState<any>([]);
const [idx, setIdx] = useState<number>(0);
/** 修改税率&单价 */
......@@ -107,7 +106,6 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
<Form.Item
name={`isTax${index}`}
style={{ margin: 0 }}
initialValue={text}
rules={[{ required: true, message: '请选择' }]}
>
<Select
......@@ -129,7 +127,6 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={`taxProbability${index}`}
initialValue={text}
rules={[{ required: true, message: '请输入' }]}
>
<Input
......@@ -149,7 +146,6 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={`taxUnitPrice${index}`}
initialValue={text}
rules={[{ required: true, message: '请输入' }]}
>
<Input
......@@ -194,13 +190,23 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
query[index].customerCategoryName = params.product.customerCategoryName;
query[index].productName = params.product.name;
query[index].productBrand = params.product.brandName;
query[index].productAttributeJson = productAttributeJson;
query[index].productAttributeJson = `${productAttributeJson}-${params.product.customerCategoryName}`;
query[index].enclosureUrls = params.files;
param[idx] = [...query];
setData(param)
setVisible(false);
}
const setFieldsValueFn = (params: any) => {
params.forEach((it: any, i: number) => {
form.setFieldsValue({
['isTax' + i]: it.isTax,
['taxProbability' + i]: it.taxProbability,
['taxUnitPrice' + i]: it.taxUnitPrice
})
})
}
const fetchTableData = (turn: any, index: number) => {
const params = {
id: fetchdata.id,
......@@ -210,14 +216,31 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
}
const param = { ...data };
if (name === 'quote') {
param[index] = fetchdata.materiels;
setData({ ...param });
PublicApi.getPurchasePurchaseInquiryGetMaterielsByPurchaseInquiryId({ ...params }).then((res: any) => {
if (res.code !== 1000) {
return
}
if (res.data.data.length > 0) {
console.log(1)
param[index] = [...res.data.data];
if (param[index]) {
setFieldsValueFn(param[index])
}
} else {
console.log(2)
param[index] = fetchdata.materiels;
}
setData({ ...param });
})
} else {
PublicApi.getPurchaseQuotedPriceMaterielDetailed({ ...params }).then((res: any) => {
if (res.code !== 1000) {
return
}
param[index] = [...res.data.data];
if (param[index]) {
setFieldsValueFn(param[index])
}
setData({ ...param });
})
}
......@@ -226,25 +249,23 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
useEffect(() => {
if (fetchdata.id) {
const isTurn = fetchdata.count ? fetchdata.count : 1;
const isTurn = fetchdata.turn ? fetchdata.turn : 1;
fetchTableData(isTurn, 0)
}
console.log(fetchdata.count, 10086)
if (fetchdata.count || fetchdata.count === 0) {
let aCount = 0;
if (name === 'edit') {
aCount = fetchdata.count ? (fetchdata.count + 1) : 1;
} else if (name === 'quote') {
aCount = fetchdata.count ? (fetchdata.count + 1) : 1;
}
form.setFieldsValue({
count: aCount
})
setCount(aCount);
handleTabs(aCount);
let aCount = 0;
if (fetchdata.turn) {
aCount = (fetchdata.turn + 1)
} else {
aCount = 1
}
if (name === 'edit') {
aCount = fetchdata.count ? (fetchdata.count + 1) : 1;
}
form.setFieldsValue({
count: aCount
})
setCount(aCount);
handleTabs(aCount);
}, [fetchdata])
useEffect(() => {
......@@ -253,7 +274,6 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
form.validateFields().then(res => {
const detailss: any = [];
data[0].forEach(item => {
console.log(item, 10086)
detailss.push({
purchaseInquiryDetailsId: name === 'quote' ? item.id : item.purchaseInquiryDetailsId,
taxUnitPrice: item.taxUnitPrice,
......@@ -263,7 +283,7 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
productId: item.productId,
goodsId: item.goodsId,
productBrand: item.productBrand,
productAttributeJson: `${item.productAttributeJson}-${item.customerCategoryName}`,
productAttributeJson: item.productAttributeJson,
})
})
resolve({
......@@ -283,21 +303,28 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
const handleRadioGroup = (e) => {
const params = { ...data };
const { value } = e.target;
const index = e.target['data-index']
setCount(value);
const index = e.target['data-index'];
setIdx(index);
setCount(value);
if (!params[index]) {
const isTurn = value === 1 ? 1 : value - 1
fetchTableData(isTurn, index)
} else {
setFieldsValueFn(params[index])
}
}
const splitProductAttributeJson = (name: string, num: number) => {
const arr = name.split('-');
return arr[num]
}
return (
<Form
form={form}
className={style.offerStyle}
>
<Form.Item name='count'>
<Form.Item name='count' initialValue={count}>
<Radio.Group onChange={handleRadioGroup}>
{tabs.length > 0 && tabs.map((item, index: any) => {
return (
......@@ -330,8 +357,8 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
</Col>
<Col span={6}>
<div className={style.childrenContent}>
<p><span>规格:</span>{record.productAttributeJson}</p>
<p><span>品类:</span>{record.customerCategoryName}</p>
<p><span>规格:</span>{splitProductAttributeJson(record.productAttributeJson, 0)}</p>
<p><span>品类:</span>{splitProductAttributeJson(record.productAttributeJson, 1)}</p>
</div>
</Col>
<Col span={6}>
......
......@@ -28,7 +28,7 @@ const AddOffter = () => {
dataIndex: 'quotedPriceNo',
render: (text: any, record: any) => (
<Space direction='vertical'>
<EyePreview url={`/memberCenter/procurementAbility/offter/addOffter/view?id=${record.id}&number=${record.quotedPriceNo}`}>{text}</EyePreview>
<EyePreview url={`/memberCenter/procurementAbility/offter/addOffter/view?id=${record.id}&number=${record.quotedPriceNo}&turn=${record.turn}`}>{text}</EyePreview>
<Text type='secondary'>{record.details}</Text>
</Space>
)
......@@ -39,7 +39,7 @@ const AddOffter = () => {
render: (text: any, record: any) => (
<Space direction='vertical'>
<EyePreview
url={`/memberCenter/procurementAbility/offter/addOffter/preview?id=${record.purchaseInquiryId}&number=${record.purchaseInquiryNo}&turn=${record.turn}`}
url={`/memberCenter/procurementAbility/offter/addOffter/preview?id=${record.purchaseInquiryId}&number=${record.purchaseInquiryNo}`}
>{text}</EyePreview>
<Text type='secondary'>{record.memberName}</Text>
</Space>
......
......@@ -114,8 +114,6 @@ const CrossSellProducts: React.FC<IProps> = (props: any) => {
setFiles(arr);
}
console.log(record, 10086)
return (
<>
<Drawer
......
......@@ -86,6 +86,7 @@ const AddInquiry = () => {
const res = await PublicApi.postPurchasePurchaseInquirySubmitBatch({ ids: rowkeys });
if (res.code === 1000) {
ref.current.reload();
setRowKeys([])
}
}
......@@ -102,6 +103,7 @@ const AddInquiry = () => {
}
if (res.code === 1000) {
ref.current.reload();
setRowKeys([])
}
}
......
......@@ -22,6 +22,7 @@ const AuditInquiryOne = () => {
const res = await PublicApi.postPurchasePurchaseInquiryExamine1Batch({ ids: rowkeys });
if (res.code === 1000) {
ref.current.reload();
setRowKeys([])
}
}
const columns: ColumnType<any>[] = [{
......
......@@ -24,6 +24,7 @@ const AuditInquiryTwo = () => {
const res = await PublicApi.postPurchasePurchaseInquiryExamine2Batch({ ids: rowkeys });
if (res.code === 1000) {
ref.current.reload();
setRowKeys([])
}
}
const columns: ColumnType<any>[] = [{
......
......@@ -22,6 +22,7 @@ const SubmitInquiry = () => {
const res = await PublicApi.postPurchasePurchaseInquiryCommitBatch({ ids: rowkeys });
if (res.code === 1000) {
ref.current.reload();
setRowKeys([])
}
}
const columns: ColumnType<any>[] = [{
......
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