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
16c3b6ec
Commit
16c3b6ec
authored
Jan 28, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:处理价格策略商品筛选品类树选择问题,处理采购下单采购数和支付比例数据校验问题
parent
7e3f09f0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
104 deletions
+131
-104
index.ts
src/constants/index.ts
+1
-1
ProductModal.tsx
...ages/priceManage/priceStrategy/component/ProductModal.tsx
+8
-1
index.tsx
src/pages/priceManage/schema/index.tsx
+9
-9
index.tsx
src/pages/transaction/purchaseOrder/index.tsx
+1
-1
index.tsx
...eOrder/orderCollect/components/payInfoTableCell/index.tsx
+18
-1
index.tsx
...eOrder/orderCollect/components/productTableCell/index.tsx
+94
-91
No files found.
src/constants/index.ts
View file @
16c3b6ec
...
...
@@ -1070,7 +1070,7 @@ export const SaleOrderInsideWorkStateTexts = {
19
:
'待新增物流单'
,
20
:
'订单发货待确认'
,
23
:
'待确认回单'
,
24
:
'
订单
待归档'
,
24
:
'待归档'
,
25
:
'待审核发货单'
,
26
:
'待确认物流单'
,
27
:
'待手工发货'
,
...
...
src/pages/priceManage/priceStrategy/component/ProductModal.tsx
View file @
16c3b6ec
...
...
@@ -10,8 +10,11 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
ModalSearch
from
'@/components/NiceForm/components/Search'
import
Submit
from
'@/components/NiceForm/components/Submit'
import
CustomCategorySearch
from
'@/components/NiceForm/components/CustomCategorySearch'
import
SearchSelect
from
'@/components/NiceForm/components/SearchSelect'
import
{
clearModalParams
}
from
'@/utils'
import
{
FormEffectHooks
}
from
'@formily/antd'
import
{
searchCustomerCategoryOptionEffect
}
from
'../../effect'
export
interface
ProductModalProps
{
type
?:
'radio'
|
'checkbox'
,
...
...
@@ -87,7 +90,8 @@ const ProductModal:React.FC<ProductModalProps> = (props) => {
schema
:
formProduct
,
components
:
{
ModalSearch
,
SearchSelect
,
Submit
SearchSelect
,
Submit
,
CustomCategorySearch
},
effects
:
(
$
,
actions
)
=>
{
actions
.
reset
()
...
...
@@ -97,6 +101,9 @@ const ProductModal:React.FC<ProductModalProps> = (props) => {
'name'
,
FORM_FILTER_PATH
,
);
FormEffectHooks
.
onFieldChange$
(
'customerCategoryId'
).
subscribe
(
state
=>
{
searchCustomerCategoryOptionEffect
(
actions
,
'customerCategoryId'
)
})
}
}
}
...
...
src/pages/priceManage/schema/index.tsx
View file @
16c3b6ec
...
...
@@ -396,15 +396,15 @@ export const formProduct: ISchema = {
properties
:
{
customerCategoryId
:
{
type
:
'string'
,
"x-component"
:
'SearchSelect
'
,
"x-component-props"
:
{
placeholder
:
'
请选择
品类'
,
className
:
'fixed-ant-selected-down'
,
// 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch
:
PublicApi
.
getProductSelectGetSelectCustomerCategory
,
style
:
{
width
:
160
}
}
'x-component'
:
'CustomCategorySearch
'
,
'x-component-props'
:
{
placeholder
:
'
商品
品类'
,
showSearch
:
true
,
notFoundContent
:
null
,
style
:
{
width
:
'174px'
},
dataoption
:
[],
fieldNames
:
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
},
}
,
},
brandId
:
{
type
:
'string'
,
...
...
src/pages/transaction/purchaseOrder/index.tsx
View file @
16c3b6ec
...
...
@@ -109,7 +109,7 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
render
:
(
text
,
record
)
=>
<>
{
record
.
externalState
===
PurchaseOrderOutWorkState
.
FINISH_ORDER
&&
!
record
.
procurementEevaluateState
&&
<
Button
type=
'link'
onClick=
{
()
=>
handleEvaluate
(
record
.
id
)
}
>
评价
</
Button
>
}
{
record
.
receivingTimes
>=
1
||
record
.
externalState
===
PurchaseOrderOutWorkState
.
FINISH_ORDER
&&
<
Button
type=
'link'
onClick=
{
()
=>
handleSaleAfter
(
record
.
id
)
}
>
售后
</
Button
>
(
record
.
receivingTimes
>=
1
||
record
.
externalState
===
PurchaseOrderOutWorkState
.
FINISH_ORDER
)
&&
<
Button
type=
'link'
onClick=
{
()
=>
handleSaleAfter
(
record
.
id
)
}
>
售后
</
Button
>
}
</>
}
...
...
src/pages/transaction/purchaseOrder/orderCollect/components/payInfoTableCell/index.tsx
View file @
16c3b6ec
...
...
@@ -49,7 +49,20 @@ export const EditableRow: React.FC<any> = (props) => {
);
};
const
validatorNumber
=
(
rule
,
value
,
callback
)
=>
{
try
{
let
n
=
Number
(
value
);
if
(
isNaN
(
n
))
{
throw
new
Error
(
'请正确输入支付比例'
);
}
else
if
(
n
<
0
||
!
Number
.
isInteger
(
n
))
{
throw
new
Error
(
'支付比例为大于0的整数'
);
}
else
{
callback
()
}
}
catch
(
err
)
{
callback
(
err
)
}
}
export
const
PayInfoCell
:
React
.
FC
<
PayInfoCellProps
>
=
({
title
,
...
...
@@ -145,6 +158,10 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({
required
:
true
,
message
:
`${title}必须填写`
,
},
// 支付比例大于0
formItem
===
'input'
&&
{
validator
:
validatorNumber
}
]
}
>
{
chooseFormItem
(
formItem
)
}
...
...
src/pages/transaction/purchaseOrder/orderCollect/components/productTableCell/index.tsx
View file @
16c3b6ec
import
React
,
{
useState
,
useRef
,
useContext
,
useEffect
}
from
'react'
import
{
Form
,
Input
,
Select
}
from
'antd'
;
export
interface
ProductTableCellProps
{
title
:
React
.
ReactNode
;
editable
:
boolean
;
children
:
React
.
ReactNode
;
dataIndex
:
string
;
record
:
any
;
handleSave
:
(
record
:
any
)
=>
Promise
<
any
>
;
forceEdit
:
boolean
,
formItem
:
string
,
formItemProps
:
any
}
const
EditableContext
=
React
.
createContext
<
any
>
({});
export
const
ProductEditableRow
:
React
.
FC
<
any
>
=
({...
props
})
=>
{
const
[
form
]
=
Form
.
useForm
();
const
ctx
=
{
form
}
return
(
<
Form
form=
{
form
}
component=
{
false
}
>
<
EditableContext
.
Provider
value=
{
ctx
}
>
<
tr
{
...
props
}
/>
</
EditableContext
.
Provider
>
</
Form
>
);
};
export
const
ProductTableCell
:
React
.
FC
<
ProductTableCellProps
>
=
({
title
,
editable
,
children
,
dataIndex
,
record
,
handleSave
,
forceEdit
,
formItem
,
formItemProps
=
{},
...
restProps
})
=>
{
const
formItemRef
=
useRef
<
any
>
();
const
{
form
}
=
useContext
(
EditableContext
);
const
save
=
async
e
=>
{
try
{
const
values
=
await
form
.
validateFields
();
values
.
purchaseCount
=
Number
(
values
.
purchaseCount
)
||
0
handleSave
({
...
record
,
...
values
});
}
catch
(
errInfo
)
{
console
.
log
(
'Save failed:'
,
errInfo
);
}
};
const
chooseFormItem
=
(
type
)
=>
{
switch
(
type
)
{
case
'input'
:
{
return
<
Input
style=
{
{
width
:
140
}
}
type=
'number'
ref=
{
formItemRef
}
onChange=
{
save
}
{
...
formItemProps
}
id=
{
dataIndex
+
record
.
id
}
/>
}
}
}
let
childNode
=
children
;
if
(
editable
)
{
childNode
=
<
Form
.
Item
style=
{
{
margin
:
0
}
}
name=
{
dataIndex
}
initialValue=
{
record
[
dataIndex
]
||
''
}
rules=
{
[
{
required
:
true
,
message
:
`${title}必须填写`
,
},
]
}
>
{
chooseFormItem
(
formItem
)
}
</
Form
.
Item
>
}
return
<
td
{
...
restProps
}
>
{
childNode
}
</
td
>;
}
ProductTableCell
.
defaultProps
=
{}
export
default
ProductTableCell
\ No newline at end of file
import
React
,
{
useState
,
useRef
,
useContext
,
useEffect
}
from
'react'
import
{
Form
,
Input
,
Select
}
from
'antd'
;
export
interface
ProductTableCellProps
{
title
:
React
.
ReactNode
;
editable
:
boolean
;
children
:
React
.
ReactNode
;
dataIndex
:
string
;
record
:
any
;
handleSave
:
(
record
:
any
)
=>
Promise
<
any
>
;
forceEdit
:
boolean
,
formItem
:
string
,
formItemProps
:
any
}
const
EditableContext
=
React
.
createContext
<
any
>
({});
export
const
ProductEditableRow
:
React
.
FC
<
any
>
=
({...
props
})
=>
{
const
[
form
]
=
Form
.
useForm
();
const
ctx
=
{
form
}
return
(
<
Form
form=
{
form
}
component=
{
false
}
>
<
EditableContext
.
Provider
value=
{
ctx
}
>
<
tr
{
...
props
}
/>
</
EditableContext
.
Provider
>
</
Form
>
);
};
export
const
ProductTableCell
:
React
.
FC
<
ProductTableCellProps
>
=
({
title
,
editable
,
children
,
dataIndex
,
record
,
handleSave
,
forceEdit
,
formItem
,
formItemProps
=
{},
...
restProps
})
=>
{
const
formItemRef
=
useRef
<
any
>
();
const
{
form
}
=
useContext
(
EditableContext
);
const
save
=
async
e
=>
{
try
{
const
values
=
await
form
.
validateFields
();
values
.
purchaseCount
=
Number
(
values
.
purchaseCount
)
||
0
handleSave
({
...
record
,
...
values
});
}
catch
(
errInfo
)
{
console
.
log
(
'Save failed:'
,
errInfo
);
}
};
const
chooseFormItem
=
(
type
)
=>
{
switch
(
type
)
{
case
'input'
:
{
return
<
Input
style=
{
{
width
:
140
}
}
type=
'number'
ref=
{
formItemRef
}
onChange=
{
save
}
{
...
formItemProps
}
id=
{
dataIndex
+
record
.
id
}
/>
}
}
}
let
childNode
=
children
;
if
(
editable
)
{
childNode
=
<
Form
.
Item
style=
{
{
margin
:
0
}
}
name=
{
dataIndex
}
initialValue=
{
record
[
dataIndex
]
||
''
}
rules=
{
[
{
required
:
true
,
message
:
`${title}必须填写`
,
},
{
pattern
:
/^
\d
+
(\.\d
{1,3}
)?
$/
,
message
:
'采购数量仅限三位小数'
,
},
]
}
>
{
chooseFormItem
(
formItem
)
}
</
Form
.
Item
>
}
return
<
td
{
...
restProps
}
>
{
childNode
}
</
td
>;
}
ProductTableCell
.
defaultProps
=
{}
export
default
ProductTableCell
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