Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linweijiong
jinfa-platform
Commits
0664eec9
Commit
0664eec9
authored
Apr 12, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:处理关联商品展开显示商品信息
parent
e8eae9c6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
4 deletions
+69
-4
index.tsx
...orBids/addNewBid/components/relevanceGoodDrawer/index.tsx
+5
-1
index.tsx
...tender/addTender/components/relateProductDrawer/index.tsx
+2
-2
useProductTable.tsx
...es/procurement/tender/addTender/model/useProductTable.tsx
+62
-1
No files found.
src/pages/procurement/callForBids/addNewBid/components/relevanceGoodDrawer/index.tsx
View file @
0664eec9
...
...
@@ -153,10 +153,14 @@ export const RelevanceGoodDrawer:React.FC<RelevanceGoodDrawerProps> = ({
await
schemaAction
.
setFieldValue
(
'code'
,
selectRow
[
0
][
'code'
])
await
schemaAction
.
setFieldValue
(
'name'
,
selectRow
[
0
][
'name'
])
await
schemaAction
.
setFieldValue
(
'type'
,
selectRow
[
0
][
'type'
])
await
schemaAction
.
setFieldValue
(
'categoryId'
,
selectRow
[
0
][
'customerCategory'
][
'fullId'
].
split
(
'.'
).
map
(
item
=>
Number
(
item
).
toString
()))
//
await schemaAction.setFieldValue('categoryId', selectRow[0]['customerCategory']['fullId'].split('.').map(item => Number(item).toString()))
await
schemaAction
.
setFieldValue
(
'categoryName'
,
selectRow
[
0
][
'customerCategory'
][
'name'
])
await
schemaAction
.
setFieldValue
(
'brandName'
,
selectRow
[
0
][
'brand'
]
?
selectRow
[
0
][
'brand'
][
'name'
]
:
null
)
// await schemaAction.setFieldValue('unitId', selectRow[0]['unitId'])
setTimeout
(
async
()
=>
{
await
schemaAction
.
setFieldValue
(
'categoryId'
,
selectRow
[
0
][
'customerCategory'
][
'fullId'
].
split
(
'.'
).
map
(
item
=>
Number
(
item
).
toString
()))
await
schemaAction
.
setFieldValue
(
'unitId'
,
selectRow
[
0
][
'unitId'
])
},
200
);
await
schemaAction
.
setFieldValue
(
'unitName'
,
selectRow
[
0
][
'unitName'
])
await
schemaAction
.
setFieldValue
(
'has'
,
true
)
setSelectRow
([])
...
...
src/pages/procurement/tender/addTender/components/relateProductDrawer/index.tsx
View file @
0664eec9
...
...
@@ -197,16 +197,16 @@ export const RelevanceTenderProduct: React.FC<RelateProductDrawerProps> = ({
formActions
.
submit
(
v
=>
{
// 点击确定 设置商品id和商品文件到对应物料行中
let
submitMateriel
=
schemaAction
.
getFieldValue
(
'submitTenderMateriel'
)
submitMateriel
.
map
(
item
=>
{
if
(
item
=>
item
.
id
===
currentMaterial
[
0
][
'id'
])
{
item
.
file
=
v
[
'file'
]
item
.
commodityId
=
selectRow
[
0
][
'id'
]
item
.
productId
=
selectRow
[
0
][
'commodityId'
]
}
return
item
})
console
.
log
(
v
,
submitMateriel
)
console
.
log
(
v
,
submitMateriel
,
selectRow
)
schemaAction
.
setFieldValue
(
'submitTenderMateriel'
,
submitMateriel
)
})
}
...
...
src/pages/procurement/tender/addTender/model/useProductTable.tsx
View file @
0664eec9
import
React
,
{
useState
}
from
'react'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
;
import
{
Button
}
from
'antd'
;
import
{
Button
,
message
}
from
'antd'
;
import
{
productInfoColumns
}
from
'../constant'
;
import
ProductTableCell
,
{
ProductEditableRow
}
from
'../components/productTableCell'
;
import
{
CaretDownOutlined
,
CaretRightOutlined
}
from
'@ant-design/icons'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
Row
,
Col
}
from
'antd'
import
style
from
'../index.less'
// 对象按key排序(运用于商城传过来的阶梯价格排序)
export
const
sortByKey
=
(
params
)
=>
{
...
...
@@ -92,6 +96,57 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
};
})
const
renderDescription
=
async
(
record
)
=>
{
// 商品信息
let
res
=
await
PublicApi
.
getProductCommodityGetCommodity
({
id
:
record
.
productId
})
// 商品规格信息
let
spec
=
await
PublicApi
.
getProductCommodityGetCommodityAttributeByUnitPriceAndPicId
({
unitPriceAndPicId
:
record
.
commodityId
})
const
{
code
,
data
}
=
res
if
(
code
===
1000
)
{
const
newData
=
[...
ctx
.
getFieldValue
(
'submitTenderMateriel'
)];
const
index
=
newData
.
findIndex
(
item
=>
record
.
id
===
item
.
id
);
const
item
=
newData
[
index
];
item
.
description
=
(<
div
className=
{
style
.
childrenWrap
}
>
<
Row
>
<
Col
span=
{
3
}
>
<
div
className=
{
style
.
childrenTitle
}
>
<
p
>
对应
</
p
>
<
p
>
招标商品
</
p
>
</
div
>
</
Col
>
<
Col
span=
{
6
}
>
<
div
className=
{
style
.
childrenContent
}
>
<
p
><
span
>
商品编号:
</
span
>
{
data
.
code
}
</
p
>
<
p
><
span
>
商品名称:
</
span
>
{
data
.
name
}
</
p
>
</
div
>
</
Col
>
<
Col
span=
{
6
}
>
<
div
className=
{
style
.
childrenContent
}
>
<
p
><
span
>
规格型号:
</
span
>
{
spec
.
data
.
length
&&
spec
.
data
.
map
(
item
=>
item
.
customerAttributeValueList
[
0
].
value
).
join
(
'/'
)
}
</
p
>
<
p
><
span
>
品类:
</
span
>
{
data
.
customerCategory
.
fullName
}
</
p
>
</
div
>
</
Col
>
<
Col
span=
{
6
}
>
<
div
className=
{
style
.
childrenContent
}
>
<
p
><
span
>
品牌:
</
span
>
{
data
.
brand
.
name
}
</
p
>
</
div
>
</
Col
>
{
/* <Col span={3}>
<div className={style.childrenContent}>
<p><a>查看</a></p>
</div>
</Col> */
}
</
Row
>
</
div
>)
ctx
.
setFieldValue
(
'submitTenderMateriel'
,
newData
)
console
.
log
(
item
,
data
)
}
}
// 嵌套子表格
const
productChildren
=
{
expandedRowRender
:
record
=>
<
p
style=
{
{
margin
:
0
}
}
>
{
record
.
description
}
</
p
>,
...
...
@@ -104,6 +159,12 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
),
onExpand
:
(
expanded
,
record
)
=>
{
console
.
log
(
'通过商品Id 查询商品信息显示在嵌套中'
,
record
)
if
(
!
record
?.
commodityId
)
{
return
message
.
error
(
'请先选择关联商品'
)
}
if
(
expanded
)
{
renderDescription
(
record
)
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment