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
385e33fb
Commit
385e33fb
authored
Oct 20, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:销售订单-提交审核
parent
ebd0821e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
187 additions
and
4 deletions
+187
-4
useAsyncSelect.ts
src/formSchema/effects/useAsyncSelect.ts
+2
-2
index.less
...ges/transaction/components/createElectronModal/index.less
+0
-0
index.tsx
...ages/transaction/components/createElectronModal/index.tsx
+183
-0
index.tsx
...transaction/saleOrder/readyApprovedOrder/detail/index.tsx
+2
-2
No files found.
src/formSchema/effects/useAsyncSelect.ts
View file @
385e33fb
import
{
createFormActions
,
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
const
{
onForm
Ini
t$
}
=
FormEffectHooks
const
{
onForm
Moun
t$
}
=
FormEffectHooks
/**
* @description 处理异步请求的下拉选择
...
...
@@ -11,7 +11,7 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
const
{
dispatch
,
setFieldState
}
=
createFormActions
()
const
linkage
=
useLinkageUtils
()
onForm
Ini
t$
().
subscribe
(()
=>
{
onForm
Moun
t$
().
subscribe
(()
=>
{
setFieldState
(
name
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.x-props.hasFeedback'
,
true
)
})
...
...
src/pages/transaction/components/createElectronModal/index.less
0 → 100644
View file @
385e33fb
src/pages/transaction/components/createElectronModal/index.tsx
0 → 100644
View file @
385e33fb
import
React
,
{
useContext
,
useRef
}
from
'react'
import
{
Modal
,
Button
}
from
'antd'
import
{
createFormActions
,
ISchema
}
from
'@formily/antd'
import
ModalForm
from
'@/components/ModalForm'
import
{
history
}
from
'umi'
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
import
{
PublicApi
}
from
'@/services/api'
import
{
useHttpRequest
}
from
'@/hooks/useHttpRequest'
import
{
OrderDetailContext
}
from
'../../_public/order/context'
export
interface
OrderElectronModalProps
{
currentRef
:
any
}
const
schemaActions
=
createFormActions
()
const
schema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT
:
{
type
:
'object'
,
"x-component"
:
"mega-layout"
,
"x-component-props"
:
{
labelAlign
:
'left'
,
labelCol
:
6
},
properties
:
{
usingElectronicContracts
:
{
type
:
'radio'
,
title
:
'是否使用电子合同'
,
enum
:
[
{
label
:
'是'
,
value
:
1
},
{
label
:
'否'
,
value
:
2
},
],
default
:
1
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'contractTemplateId'
,
condition
:
"{{$value === 1}}"
},
{
type
:
'value:visible'
,
target
:
'electronicContractName'
,
condition
:
"{{$value === 1}}"
}
]
},
contractTemplateId
:
{
type
:
'string'
,
enum
:
[],
title
:
'电子合同模板'
,
required
:
true
,
"x-component-props"
:
{
placeholder
:
'请选择电子合同模板'
,
style
:
{
minWidth
:
140
}
},
"x-props"
:
{
addonAfter
:
"{{electronBtn}}"
}
},
electronicContractName
:
{
type
:
'string'
,
"x-component"
:
'children'
,
"x-component-props"
:
{
children
:
""
},
title
:
'电子合同'
,
},
electronicContractUrl
:
{
type
:
'string'
,
display
:
false
,
},
state
:
{
type
:
'radio'
,
title
:
'是否审核通过'
,
enum
:
[
{
label
:
'审核通过'
,
value
:
1
},
{
label
:
'审核不通过'
,
value
:
0
},
],
default
:
1
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'cause'
,
condition
:
"{{$value === 0}}"
}
]
},
cause
:
{
type
:
'textarea'
,
"x-component-props"
:
{
rows
:
4
,
placeholder
:
'在此输入你的原因, 最多60个汉字'
},
title
:
'审核不通过原因'
,
"x-rules"
:
[
{
required
:
true
,
message
:
'请输入审核不通过原因'
},
{
limitByte
:
true
,
maxByte
:
30
}
]
}
}
}
}
}
//@todo 尚未完成
const
CreateOrderElectronModal
:
React
.
FC
<
OrderElectronModalProps
>
=
(
props
)
=>
{
const
formRef
=
useRef
<
any
>
({})
const
{
data
}
=
useContext
(
OrderDetailContext
)
const
{
run
,
loading
}
=
useHttpRequest
(
PublicApi
.
postOrderSignatureSignContractCreate
,
{
ctlType
:
'none'
})
const
{
run
:
submitRun
,
loading
:
submitLoading
}
=
useHttpRequest
(
PublicApi
.
postOrderSubmittedReviewOrder
)
const
createElectron
=
async
()
=>
{
const
contractTemplateId
=
schemaActions
.
getFieldValue
(
'contractTemplateId'
)
const
orderNo
=
data
.
orderNo
const
signMemberId
=
data
.
createMemberId
const
params
=
{
contractTemplateId
,
orderNo
,
signMemberId
}
const
{
code
,
data
:
resData
}
=
await
run
(
params
)
if
(
code
===
1000
)
{
schemaActions
.
setFieldValue
(
'electronicContractName'
,
resData
.
contractName
)
schemaActions
.
setFieldValue
(
'electronicContractUrl'
,
resData
.
contractUrl
)
schemaActions
.
setFieldState
(
'electronicContractName'
,
state
=>
{
state
.
props
[
"x-component-props"
].
children
=
<
a
href=
{
resData
.
contractUrl
}
download=
{
resData
.
contractName
}
target=
'_blank'
>
{
resData
.
contractName
}
</
a
>
})
}
}
const
electronBtn
=
<
Button
style=
{
{
marginLeft
:
24
}
}
onClick=
{
createElectron
}
loading=
{
loading
}
>
生成电子合同
</
Button
>
const
handleSubmit
=
async
(
value
)
=>
{
const
params
=
{
...
value
,
id
:
data
.
id
,
}
const
{
code
}
=
await
submitRun
(
params
)
if
(
code
===
1000
)
{
history
.
goBack
()
}
}
const
handleConfirm
=
()
=>
{
schemaActions
.
submit
()
}
return
(
<
ModalForm
modalTitle=
'确认提交审核'
previewPlaceholder=
' '
currentRef=
{
props
.
currentRef
}
schema=
{
schema
}
actions=
{
schemaActions
}
onSubmit=
{
handleSubmit
}
confirm=
{
handleConfirm
}
modalProps=
{
{
confirmLoading
:
submitLoading
}
}
expressionScope=
{
{
electronBtn
}
}
effects=
{
(
$
,
actions
)
=>
{
useAsyncSelect
(
'contractTemplateId'
,
async
()
=>
(
await
PublicApi
.
getOrderSelectListContractTemplate
()).
data
,
[
'name'
,
'id'
])
}
}
/>
)
}
CreateOrderElectronModal
.
defaultProps
=
{}
export
default
CreateOrderElectronModal
\ No newline at end of file
src/pages/transaction/saleOrder/readyApprovedOrder/detail/index.tsx
View file @
385e33fb
...
...
@@ -9,7 +9,7 @@ import { useOrderDetail } from '../../../_public/order/effects/useOrderDetail';
import
{
history
}
from
'umi'
import
{
useHttpRequest
}
from
'@/hooks/useHttpRequest'
;
import
OrderDetailSection
from
'../../../components/orderDetailSection'
;
import
OrderElectronModal
from
'@/pages/transaction/components/order
ElectronModal'
;
import
CreateOrderElectronModal
from
'@/pages/transaction/components/create
ElectronModal'
;
const
ReadyApprovedOrderDetail
:
React
.
FC
=
()
=>
{
const
{
formContext
,
id
,
detailList
}
=
useOrderDetail
({
type
:
'saleOrder'
})
...
...
@@ -35,7 +35,7 @@ const ReadyApprovedOrderDetail: React.FC = () => {
</
OrderDetailWrapper
>
{
/* 提交时触发的弹窗集合 */
}
<
OrderElectronModal
<
Create
OrderElectronModal
currentRef=
{
electronRef
}
/>
</
OrderDetailContext
.
Provider
>
...
...
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