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
黄庭坚
jinfa-platform
Commits
9208a704
Commit
9208a704
authored
Dec 27, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 移除规格属性必填,待支付订单对接建行b2b支付
parent
6b09739c
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
61 additions
and
224 deletions
+61
-224
addAttribute.tsx
src/pages/classAndProperty/attribute/addAttribute.tsx
+1
-13
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+14
-24
index.tsx
src/pages/transaction/components/orderPayModal/index.tsx
+6
-7
index.tsx
...ansaction/purchaseOrder/addPurchaseReceiveOrder/index.tsx
+4
-4
index.ts
...ion/purchaseOrder/addPurchaseReceiveOrder/schema/index.ts
+4
-4
index.ts
...s/transaction/saleOrder/addLogisticsOrder/schema/index.ts
+1
-1
index.tsx
...addSaleDelevedOrder/components/memberModalTable/index.tsx
+0
-69
index.tsx
...addSaleDelevedOrder/components/productTableCell/index.tsx
+5
-5
index.tsx
...nsaction/saleOrder/addSaleDelevedOrder/constant/index.tsx
+2
-56
index.tsx
...pages/transaction/saleOrder/addSaleDelevedOrder/index.tsx
+8
-24
useProductTable.tsx
...n/saleOrder/addSaleDelevedOrder/model/useProductTable.tsx
+13
-14
index.ts
...transaction/saleOrder/addSaleDelevedOrder/schema/index.ts
+3
-3
No files found.
src/pages/classAndProperty/attribute/addAttribute.tsx
View file @
9208a704
...
...
@@ -41,7 +41,6 @@ const AddAtttribute: React.FC<{}> = () => {
const
[
isSee
,
setIsSee
]
=
useState
(
false
)
// 判断查看依据
const
[
isSpecial
,
setIsSpecial
]
=
useState
(
false
)
//特殊属性禁用展示方式
const
[
submitLoading
,
setSubmitLoading
]
=
useState
<
boolean
>
(
false
)
const
[
isDisabledEmpty
,
setIsDisabledEmpty
]
=
useState
<
boolean
>
(
false
)
// 禁用必填
useEffect
(()
=>
{
const
{
location
}
=
history
...
...
@@ -161,16 +160,6 @@ const AddAtttribute: React.FC<{}> = () => {
menuForm
.
setFieldsValue
({
isDate
:
false
})
}
const
priceAttributeChange
=
(
e
)
=>
{
if
(
e
.
target
.
checked
)
{
setIsDisabledEmpty
(
true
)
menuForm
.
setFieldsValue
({
"isEmpty"
:
true
})
}
else
{
setIsDisabledEmpty
(
false
)
menuForm
.
setFieldsValue
({
"isEmpty"
:
false
})
}
}
return
<
PageHeaderWrapper
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
{
intl
.
formatMessage
({
id
:
'classAndProperty.attribute.addAttribute.back'
})
}
/>
}
...
...
@@ -257,7 +246,7 @@ const AddAtttribute: React.FC<{}> = () => {
<
Row
>
<
Col
span=
{
24
}
>
<
Form
.
Item
name=
"isEmpty"
valuePropName=
"checked"
initialValue=
{
false
}
noStyle
>
<
Checkbox
disabled=
{
isSee
||
isDisabledEmpty
}
>
{
intl
.
formatMessage
({
id
:
'classAndProperty.attribute.addAttribute.form.isEmpty'
})
}
</
Checkbox
>
<
Checkbox
disabled=
{
isSee
}
>
{
intl
.
formatMessage
({
id
:
'classAndProperty.attribute.addAttribute.form.isEmpty'
})
}
</
Checkbox
>
</
Form
.
Item
>
</
Col
>
{
/* <Col span={24}>
...
...
@@ -276,7 +265,6 @@ const AddAtttribute: React.FC<{}> = () => {
{
/* 规格属性 -> 原价格属性 */
}
<
Form
.
Item
name=
"isPrice"
valuePropName=
"checked"
initialValue=
{
false
}
noStyle
>
<
Checkbox
onChange=
{
priceAttributeChange
}
disabled=
{
isSee
}
>
{
intl
.
formatMessage
({
id
:
'classAndProperty.attribute.addAttribute.form.isPrice'
})
}
</
Checkbox
>
</
Form
.
Item
>
...
...
src/pages/commodity/products/addProducts.tsx
View file @
9208a704
...
...
@@ -261,23 +261,11 @@ const AddProducts: React.FC<{}> = (props) => {
}
_params
.
unitPriceAndPicList
=
_productAttributeAndImageParams
}
else
{
// 编辑时没有点击商品图片(新增没有点击也就没有数据)
if
(
productInfoByEdit
)
{
_params
.
unitPriceAndPicList
=
productInfoByEdit
.
unitPriceAndPicList
_params
.
isAllAttributePic
=
productInfoByEdit
.
isAllAttributePic
// 没有点击图片单单修改了商品价格 取原有的图片和新的价格合成(编辑属性组合变更,不点击图片,直接报存)
// if (clickTabIndex.indexOf("4") !== -1) {
// _params.unitPriceAndPicList = priceAttributeParams.map((item, index) => {
// return {
// id: item.id,
// goods: { id: item.goodsId },
// attributeAndValueList: item.attributeAndValueList,
// unitPrice: item.unitPrice,
// priceRate: item.priceRate,
// commodityPic: productInfoByEdit.unitPriceAndPicList[index].commodityPic
// }
// })
// }
try
{
try
{
if
(
productInfoByEdit
)
{
_params
.
unitPriceAndPicList
=
productInfoByEdit
.
unitPriceAndPicList
_params
.
isAllAttributePic
=
productInfoByEdit
.
isAllAttributePic
// 没有点击图片单单修改了商品价格 取原有的图片和新的价格合成(编辑属性组合变更,不点击图片,直接报存)
if
(
clickTabIndex
.
indexOf
(
"4"
)
!==
-
1
)
{
_params
.
unitPriceAndPicList
=
priceAttributeParams
.
map
((
item
,
index
)
=>
{
const
pic
=
productInfoByEdit
.
unitPriceAndPicList
[
index
]?.
commodityPic
...
...
@@ -286,17 +274,19 @@ const AddProducts: React.FC<{}> = (props) => {
}
return
{
id
:
item
.
id
,
goods
:
{
id
:
item
.
goodsId
},
attributeAndValueList
:
item
.
attributeAndValueList
,
unitPrice
:
item
.
unitPrice
,
priceRate
:
item
.
priceRate
,
commodityPic
:
pic
goods
:
{
id
:
item
.
goodsId
},
attributeAndValueList
:
item
.
attributeAndValueList
,
unitPrice
:
item
.
unitPrice
,
priceRate
:
item
.
priceRate
,
commodityPic
:
pic
}
})
}
}
catch
(
e
)
{
return
e
}
else
{
throw
new
Error
(
'请上传商品图片!'
)
}
}
catch
(
e
)
{
return
e
}
}
...
...
src/pages/transaction/components/orderPayModal/index.tsx
View file @
9208a704
...
...
@@ -71,7 +71,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
}
},
[])
//timer start
//
timer start
const
[
openTimer
,
setOpenTimer
]
=
useState
(
0
);
// timer
useEffect
(()
=>
{
if
(
openTimer
===
1
)
runTimerJump
()
...
...
@@ -80,7 +80,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
const
runTimerJump
=
()
=>
{
timeChange
=
setInterval
(()
=>
pollPayResult
(),
3000
)
}
//timer ending
//
timer ending
useEffect
(()
=>
{
if
(
!
visible
)
{
...
...
@@ -408,11 +408,10 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
window
.
open
(
res
.
data
.
codeUrl
,
'_blank'
)
}
else
if
(
checked
.
id
===
16
)
{
console
.
log
(
current
,
checked
,
'建行b2b跳转'
)
console
.
log
(
res
.
data
)
// setCurrent(1000)
// setVisible(false)
// setPayResultVisible(true)
// window.open(res.data.codeUrl, '_blank')
setCurrent
(
1000
)
setVisible
(
false
)
setPayResultVisible
(
true
)
window
.
open
(
res
.
data
.
codeUrl
,
'_blank'
)
}
else
{
history
.
goBack
()
}
...
...
src/pages/transaction/purchaseOrder/addPurchaseReceiveOrder/index.tsx
View file @
9208a704
...
...
@@ -52,8 +52,8 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
</
RowStyle
>
})
/**
销售发货单 新增
*/
const
Add
SaleDelevedOrder
:
React
.
FC
<
{}
>
=
()
=>
{
/**
新增采购收货单
*/
const
Add
PurchaseReceiveOrder
:
React
.
FC
<
{}
>
=
()
=>
{
const
memberRef
=
useRef
<
any
>
({})
const
[
formLoading
,
setFormLoading
]
=
useState
(
false
)
const
[
btnLoading
,
setBtnLoading
]
=
useState
(
false
)
...
...
@@ -182,6 +182,6 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
</
div
>)
}
Add
SaleDeleved
Order
.
defaultProps
=
{}
Add
PurchaseReceive
Order
.
defaultProps
=
{}
export
default
Add
SaleDeleved
Order
export
default
Add
PurchaseReceive
Order
src/pages/transaction/purchaseOrder/addPurchaseReceiveOrder/schema/index.ts
View file @
9208a704
...
...
@@ -8,7 +8,7 @@ const basicInfo: ISchema = {
type
:
'object'
,
"x-component"
:
'MellowCard'
,
"x-component-props"
:
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseRequisition.jibenxinxi'
,
defaultMessage
:
'基本信息'
})
,
title
:
'基本信息'
,
id
:
'basicInfo'
,
},
properties
:
{
...
...
@@ -29,7 +29,7 @@ const basicInfo: ISchema = {
type
:
'string'
,
title
:
'单据类型'
,
"x-component"
:
'text'
,
default
:
'
销售发
货单'
,
default
:
'
采购收
货单'
,
},
digest
:
{
type
:
'string'
,
...
...
@@ -111,7 +111,7 @@ const relatedInfo: ISchema = {
type
:
'object'
,
"x-component"
:
'MellowCard'
,
"x-component-props"
:
{
title
:
getIntl
().
formatMessage
({
id
:
'saleOrder.xiangguanxinxi'
,
defaultMessage
:
'相关信息'
})
,
title
:
'相关信息'
,
id
:
'relatedInfo'
,
},
properties
:
{
...
...
@@ -145,7 +145,7 @@ const relatedInfo: ISchema = {
},
address
:
{
type
:
'string'
,
title
:
'
收
货地址'
,
title
:
'
发
货地址'
,
"x-component"
:
'text'
,
},
memberName
:
{
...
...
src/pages/transaction/saleOrder/addLogisticsOrder/schema/index.ts
View file @
9208a704
...
...
@@ -7,7 +7,7 @@ const basicInfo: ISchema = {
type
:
'object'
,
"x-component"
:
'MellowCard'
,
"x-component-props"
:
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseRequisition.jibenxinxi'
,
defaultMessage
:
'基本信息'
})
,
title
:
'基本信息'
,
id
:
'basicInfo'
,
},
properties
:
{
...
...
src/pages/transaction/saleOrder/addSaleDelevedOrder/components/memberModalTable/index.tsx
deleted
100644 → 0
View file @
6b09739c
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
src/pages/transaction/saleOrder/addSaleDelevedOrder/components/
material
TableCell/index.tsx
→
src/pages/transaction/saleOrder/addSaleDelevedOrder/components/
product
TableCell/index.tsx
View file @
9208a704
...
...
@@ -5,7 +5,7 @@ import { FormDetailContext } from '@/formSchema/context';
import
{
getLogisticsSelectListMemberShipperAddress
}
from
'@/services/LogisticsV2Api'
;
import
{
useIntl
}
from
'umi'
;
export
interface
Material
TableCellProps
{
export
interface
Product
TableCellProps
{
title
:
React
.
ReactNode
;
editable
:
boolean
;
children
:
React
.
ReactNode
;
...
...
@@ -19,7 +19,7 @@ export interface MaterialTableCellProps {
const
EditableContext
=
React
.
createContext
<
any
>
({});
export
const
Material
EditableRow
:
React
.
FC
<
any
>
=
({...
props
})
=>
{
export
const
Product
EditableRow
:
React
.
FC
<
any
>
=
({...
props
})
=>
{
const
[
form
]
=
Form
.
useForm
();
const
ctx
=
{
...
...
@@ -35,7 +35,7 @@ export const MaterialEditableRow: React.FC<any> = ({...props }) => {
};
export
const
MaterialTableCell
:
React
.
FC
<
Material
TableCellProps
>
=
({
export
const
ProductTableCell
:
React
.
FC
<
Product
TableCellProps
>
=
({
title
,
editable
,
children
,
...
...
@@ -196,6 +196,6 @@ export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({
return
<
td
{
...
restProps
}
>
{
childNode
}
</
td
>;
}
Material
TableCell
.
defaultProps
=
{}
Product
TableCell
.
defaultProps
=
{}
export
default
Material
TableCell
export
default
Product
TableCell
src/pages/transaction/saleOrder/addSaleDelevedOrder/constant/index.tsx
View file @
9208a704
...
...
@@ -49,63 +49,9 @@ export const procurementProcessField = (value) => {
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
material
InfoColumns
:
any
[]
=
[
//
单据明细 商品
列表
export
const
product
InfoColumns
:
any
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
...
...
src/pages/transaction/saleOrder/addSaleDelevedOrder/index.tsx
View file @
9208a704
import
React
,
{
use
Ref
,
use
State
,
useEffect
}
from
'react'
import
React
,
{
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
{
SaveOutlined
}
from
'@ant-design/icons'
import
NiceForm
from
'@/components/NiceForm'
import
{
increaseSchema
}
from
'./schema'
import
{
useMaterialTableChangeForAmount
}
from
'./effects'
import
{
procurementProcessField
,
procurementRenderField
,
procurmentRenderInit
}
from
'./constant'
import
{
useUpdate
}
from
'@umijs/hooks'
import
{
help
}
from
'../../common'
import
{
useMaterialTable
}
from
'./model/useMaterialTable'
import
MemberModalTable
from
'./components/memberModalTable'
import
{
useProductTable
}
from
'./model/useProductTable'
import
styled
from
'styled-components'
import
FormDetailHeader
from
'@/components/FormDetailHeader'
import
FormDetailWrapper
from
'@/components/FormDetailWrapper'
...
...
@@ -52,9 +51,8 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
</
RowStyle
>
})
/**
销售发货单 新增
*/
/**
新增销售发货单
*/
const
AddSaleDelevedOrder
:
React
.
FC
<
{}
>
=
()
=>
{
const
memberRef
=
useRef
<
any
>
({})
const
[
formLoading
,
setFormLoading
]
=
useState
(
false
)
const
[
btnLoading
,
setBtnLoading
]
=
useState
(
false
)
const
update
=
useUpdate
()
...
...
@@ -63,8 +61,8 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
const
{
formContext
}
=
useFormDetail
()
const
intl
=
useIntl
()
//
请购单物料
const
{
materialColumns
,
materialComponents
}
=
useMaterial
Table
(
addSchemaAction
)
//
单据商品明细
const
{
productColumns
,
productComponents
}
=
useProduct
Table
(
addSchemaAction
)
useEffect
(()
=>
{
if
(
id
)
{
...
...
@@ -87,7 +85,6 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
let
fnResult
=
null
// 新增订单/编辑订单
const
params
=
{
...
value
}
console
.
log
(
value
)
if
(
formContext
.
innerFormErrors
)
{
throw
new
Error
(
intl
.
formatMessage
({
id
:
'purchaseRequisition.qingwanshandingdan'
,
defaultMessage
:
'请完善订单物料数据'
}))
}
...
...
@@ -105,7 +102,6 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
setBtnLoading
(
true
)
const
_params
=
procurementProcessField
(
params
)
console
.
log
(
_params
)
if
(
id
)
{
fnResult
=
await
postPurchaseRequisitionUpdate
({...
_params
,
id
})
}
else
{
...
...
@@ -121,17 +117,9 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
}
catch
(
error
)
{
setBtnLoading
(
false
)
error
?.
message
&&
message
.
error
(
error
.
message
)
console
.
log
(
error
)
}
}
// 选择会员弹窗
const
handleOrderMember
=
()
=>
{
memberRef
.
current
.
setVisible
(
true
)
}
const
memberBtn
=
<
div
className=
'connectBtn'
onClick=
{
handleOrderMember
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
{
intl
.
formatMessage
({
id
:
'saleOrder.xuanze'
,
defaultMessage
:
'选择'
})
}
</
div
>
const
providerValue
=
{
schemaActions
:
addSchemaAction
,
formContext
,
...
...
@@ -167,18 +155,14 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
}
}
expressionScope=
{
{
memberBtn
,
materialColumns
,
materialComponents
,
productColumns
,
productComponents
,
help
,
}
}
/>
</
FormDetailWrapper
>
</
FormDetailContext
.
Provider
>
{
/* 选择供应会员 */
}
<
MemberModalTable
currentRef=
{
memberRef
}
schemaAction=
{
addSchemaAction
}
/>
</
div
>)
}
...
...
src/pages/transaction/saleOrder/addSaleDelevedOrder/model/use
Material
Table.tsx
→
src/pages/transaction/saleOrder/addSaleDelevedOrder/model/use
Product
Table.tsx
View file @
9208a704
import
{
useState
}
from
'react'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
;
import
{
Button
}
from
'antd'
;
import
{
materialInfoColumns
}
from
'../constant'
;
import
MaterialTableCell
,
{
MaterialEditableRow
}
from
'../components/materialTableCell'
;
import
{
productInfoColumns
}
from
'../constant'
;
import
{
useIntl
}
from
'umi'
;
import
ProductTableCell
,
{
ProductEditableRow
}
from
'../components/productTableCell'
;
export
const
getUnitPriceTotal
=
(
record
)
=>
{
const
purchaseCount
=
Number
(
record
[
'quantity'
])
||
0
...
...
@@ -14,7 +13,7 @@ export const getUnitPriceTotal = (record) => {
/**
* @param ctx schemaAction
*/
export
const
use
Material
Table
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
export
const
use
Product
Table
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
const
intl
=
useIntl
()
const
handleDelete
=
(
record
)
=>
{
...
...
@@ -25,17 +24,17 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
ctx
.
setFieldValue
(
'products'
,
newData
)
}
const
[
materialColumns
,
setMaterial
Columns
]
=
useState
(()
=>
{
const
[
productColumns
,
setProduct
Columns
]
=
useState
(()
=>
{
// 渲染操作
materialInfoColumns
[
material
InfoColumns
.
length
-
1
].
render
=
(
text
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDelete
(
record
)
}
>
{
intl
.
formatMessage
({
id
:
'purchaseRequisition.shanchu'
,
defaultMessage
:
'删除'
})
}
</
Button
>
materialInfoColumns
[
material
InfoColumns
.
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
material
InfoColumns
productInfoColumns
[
product
InfoColumns
.
length
-
1
].
render
=
(
text
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDelete
(
record
)
}
>
{
intl
.
formatMessage
({
id
:
'purchaseRequisition.shanchu'
,
defaultMessage
:
'删除'
})
}
</
Button
>
productInfoColumns
[
product
InfoColumns
.
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
product
InfoColumns
})
const
material
Components
=
{
const
product
Components
=
{
body
:
{
row
:
Material
EditableRow
,
cell
:
Material
TableCell
row
:
Product
EditableRow
,
cell
:
Product
TableCell
}
}
...
...
@@ -55,7 +54,7 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
})
};
const
materialMergeColumns
=
material
Columns
.
map
(
col
=>
{
const
productMergeColumns
=
product
Columns
.
map
(
col
=>
{
if
(
!
col
.
editable
)
{
return
col
;
}
...
...
@@ -74,7 +73,7 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
})
return
{
materialColumns
:
material
MergeColumns
,
material
Components
,
productColumns
:
product
MergeColumns
,
product
Components
,
}
}
src/pages/transaction/saleOrder/addSaleDelevedOrder/schema/index.ts
View file @
9208a704
...
...
@@ -8,7 +8,7 @@ const basicInfo: ISchema = {
type
:
'object'
,
"x-component"
:
'MellowCard'
,
"x-component-props"
:
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseRequisition.jibenxinxi'
,
defaultMessage
:
'基本信息'
})
,
title
:
'基本信息'
,
id
:
'basicInfo'
,
},
properties
:
{
...
...
@@ -175,8 +175,8 @@ const material: ISchema = {
required
:
true
,
"x-component-props"
:
{
rowKey
:
'id'
,
columns
:
"{{
material
Columns}}"
,
components
:
"{{
material
Components}}"
,
columns
:
"{{
product
Columns}}"
,
components
:
"{{
product
Components}}"
,
},
},
NO_SUBMIT_SPY
:
{
...
...
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