Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangzhonghua
/
BoneHouse_Business_APP
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ec53b230
authored
Jul 06, 2021
by
peii
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加音频及快速下单选项
parent
79296dfb
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
453 additions
and
82 deletions
src/components/form/audio.styl
src/components/form/audio.tsx
src/inversify/index.ts
src/inversify/types.ts
src/pages/consume/consume.tsx
src/pages/order/quick.tsx
src/pages/signin/signin.tsx
src/services/request.ts
src/services/service.ts
src/stores/consume.ts
src/stores/index.ts
src/stores/order.ts
src/stores/organization.ts
src/stores/system.ts
src/stores/user.ts
src/components/form/audio.styl
View file @
ec53b230
...
...
@@ -30,4 +30,33 @@
&__text
font-size second_text_size
color #333
\ No newline at end of file
color #333
.recorded
@extend .row
align-items center
&-item
background-color home_background_color
padding 10px
border-radius 10px
&__text
font-size second_text_size
font-family font_family_regular
&__delete
padding 0 8px
background-color primary_color
height 22px
@extend .middle
border-radius 5px
margin-left 20px
&-text
font-size third_text_size
color #fff
line-height 22px
.unactive
display none
\ No newline at end of file
src/components/form/audio.tsx
View file @
ec53b230
...
...
@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/components/form/audio.tsx
* @Author: peii
* @Date: 2021-06-19 22:37:22
* @LastEditTime: 2021-06-
27 15:46:04
* @LastEditTime: 2021-06-
30 00:29:20
* @LastEditors: peii
* @Vision: 1.0
* @Description: 录音组件
...
...
@@ -10,7 +10,8 @@
// @ts-nocheck
import
React
,
{
Component
}
from
'react'
import
{
View
,
Text
,
Image
,
TouchableOpacity
,
ScrollView
,
Alert
,
Linking
,
Platform
,
NativeModules
}
from
'react-native'
import
{
View
,
Text
,
Image
,
TouchableOpacity
,
Alert
,
Linking
,
Platform
,
NativeModules
}
from
'react-native'
import
Sound
from
'react-native-sound'
import
{
IFormField
}
from
'bonehouse'
import
*
as
R
from
'ramda'
import
{
AudioRecorder
,
AudioUtils
}
from
'react-native-audio'
...
...
@@ -42,6 +43,7 @@ export default class Audio extends Component<IProps, IState> {
recorded
:
false
,
currentTime
:
0
,
}
sound
=
null
constructor
(
props
:
IProps
)
{
super
(
props
)
...
...
@@ -51,6 +53,7 @@ export default class Audio extends Component<IProps, IState> {
this
.
recordHandler
=
this
.
recordHandler
.
bind
(
this
)
this
.
stopRecordingHandler
=
this
.
stopRecordingHandler
.
bind
(
this
)
this
.
deleteHandler
=
this
.
deleteHandler
.
bind
(
this
)
this
.
playHandler
=
this
.
playHandler
.
bind
(
this
)
}
componentDidMount
()
{
...
...
@@ -93,12 +96,10 @@ export default class Audio extends Component<IProps, IState> {
if
(
!
isAuthor
)
return
this
.
openAppSetting
()
this
.
setState
({
hasPermission
:
isAuthor
})
this
.
prepareRecordingPath
(
this
.
state
.
audioPath
)
//
this.prepareRecordingPath(this.state.audioPath)
// 录音进展
AudioRecorder
.
onProgress
=
data
=>
{
console
.
log
(
data
)
this
.
setState
({
currentTime
:
Math
.
ceil
(
data
.
currentTime
),
})
...
...
@@ -106,7 +107,7 @@ export default class Audio extends Component<IProps, IState> {
// 完成录音
AudioRecorder
.
onFinished
=
data
=>
{
// data 录音数据
console
.
log
(
this
.
state
.
currentTime
)
console
.
log
(
data
)
}
})
}
...
...
@@ -141,12 +142,10 @@ export default class Audio extends Component<IProps, IState> {
try
{
if
(
!
this
.
state
.
hasPermission
)
return
this
.
openAppSetting
()
if
(
this
.
state
.
recorded
)
{
this
.
prepareRecordingPath
(
this
.
state
.
audioPath
)
}
await
this
.
prepareRecordingPath
(
this
.
state
.
audioPath
)
this
.
sound
=
null
AudioRecorder
.
startRecording
()
show
(
'录音开始'
)
await
AudioRecorder
.
startRecording
()
}
catch
(
err
)
{
console
.
error
(
err
)
}
...
...
@@ -168,44 +167,73 @@ export default class Audio extends Component<IProps, IState> {
}
/**
* @description: 录音播放
* @param {*}
* @return {*}
*/
playHandler
()
{
if
(
this
.
state
.
playing
)
return
if
(
isBlank
(
this
.
sound
))
{
this
.
sound
=
new
Sound
(
this
.
state
.
audioPath
,
''
,
err
=>
{
if
(
err
)
{
return
show
(
'音频加载失败'
)
}
this
.
setState
({
playing
:
true
})
this
.
sound
.
play
(
success
=>
{
this
.
setState
({
playing
:
false
})
success
?
show
(
'播放完毕'
)
:
show
(
'播放失败'
)
})
})
}
else
{
this
.
setState
({
playing
:
true
})
this
.
sound
.
play
(
success
=>
{
this
.
setState
({
playing
:
false
})
success
?
show
(
'播放完毕'
)
:
show
(
'播放失败'
)
})
}
}
/**
* @description: 删除操作
* @param {*}
* @return {*}
*/
deleteHandler
()
{}
deleteHandler
()
{
this
.
setState
({
recorded
:
false
})
this
.
sound
=
null
}
render
()
{
const
{
recorded
,
currentTime
}
=
this
.
state
return
(
<
View
style=
{
g
(
styles
,
'audio'
)
}
>
{
!
recorded
?
(
<
View
style=
{
g
(
styles
,
'not-record'
)
}
>
<
Text
style=
{
g
(
styles
,
'not-record-tip'
)
}
>
还有什么要安排的,可录音备注哟!
</
Text
>
<
TouchableOpacity
style=
{
g
(
styles
,
'record-btn'
)
}
touchableOpacity=
{
0.8
}
onLongPress=
{
this
.
recordHandler
}
onPressOut=
{
this
.
stopRecordingHandler
}
>
<
Image
style=
{
g
(
styles
,
'record-btn__icon'
)
}
source=
{
require
(
'../../assets/images/record_icon.png'
)
}
resizeMode=
"contain"
/>
<
Text
style=
{
g
(
styles
,
'record-btn__text'
)
}
>
长按录音
</
Text
>
</
TouchableOpacity
>
</
View
>
)
:
(
<
View
style=
{
g
(
styles
,
'recorded'
)
}
>
<
TouchableOpacity
style=
{
g
(
styles
,
'recorded-item'
)
}
>
<
Text
style=
{
g
(
styles
,
'recorded-item__text'
)
}
>
点击播放
{
currentTime
}
"
</
Text
>
</
TouchableOpacity
>
<
TouchableOpacity
style=
{
g
(
styles
,
'recorded-item__delete'
)
}
>
<
Text
style=
{
g
(
styles
,
'recorded-item__delete-text'
)
}
>
删除
</
Text
>
</
TouchableOpacity
>
</
View
>
)
}
<
View
style=
{
g
(
styles
,
{
'not-record'
:
true
,
unactive
:
recorded
})
}
>
<
Text
style=
{
g
(
styles
,
'not-record-tip'
)
}
>
还有什么要安排的,可录音备注哟!
</
Text
>
<
TouchableOpacity
style=
{
g
(
styles
,
'record-btn'
)
}
touchableOpacity=
{
0.8
}
onLongPress=
{
this
.
recordHandler
.
bind
(
this
)
}
onPressOut=
{
this
.
stopRecordingHandler
}
ref=
{
ref
=>
(
this
.
recordBtnRef
=
ref
)
}
>
<
Image
style=
{
g
(
styles
,
'record-btn__icon'
)
}
source=
{
require
(
'../../assets/images/record_icon.png'
)
}
resizeMode=
"contain"
/>
<
Text
style=
{
g
(
styles
,
'record-btn__text'
)
}
>
长按录音
</
Text
>
</
TouchableOpacity
>
</
View
>
<
View
style=
{
g
(
styles
,
{
recorded
:
true
,
unactive
:
!
recorded
})
}
>
<
TouchableOpacity
style=
{
g
(
styles
,
'recorded-item'
)
}
onPress=
{
this
.
playHandler
}
>
<
Text
style=
{
g
(
styles
,
'recorded-item__text'
)
}
>
点击播放
{
currentTime
}
"
</
Text
>
</
TouchableOpacity
>
<
TouchableOpacity
style=
{
g
(
styles
,
'recorded-item__delete'
)
}
onPress=
{
this
.
deleteHandler
}
>
<
Text
style=
{
g
(
styles
,
'recorded-item__delete-text'
)
}
>
删除
</
Text
>
</
TouchableOpacity
>
</
View
>
</
View
>
)
}
...
...
src/inversify/index.ts
View file @
ec53b230
...
...
@@ -17,6 +17,7 @@ import System from '../stores/system'
import
User
from
'../stores/user'
import
Organization
from
'../stores/organization'
import
Consume
from
'../stores/consume'
import
Order
from
'../stores/order'
const
container
=
new
Container
({
defaultScope
:
'Singleton'
})
...
...
@@ -26,5 +27,6 @@ container.bind<System>(TYPES.SysStore).to(System)
container
.
bind
<
User
>
(
TYPES
.
UserStore
).
to
(
User
)
container
.
bind
<
Organization
>
(
TYPES
.
OrgStore
).
to
(
Organization
)
container
.
bind
<
Consume
>
(
TYPES
.
Consume
).
to
(
Consume
)
container
.
bind
<
Order
>
(
TYPES
.
Order
).
to
(
Order
)
export
default
container
src/inversify/types.ts
View file @
ec53b230
...
...
@@ -15,4 +15,5 @@ export const TYPES = {
UserStore
:
Symbol
.
for
(
'user'
),
OrgStore
:
Symbol
.
for
(
'organization'
),
Consume
:
Symbol
.
for
(
'consume'
),
Order
:
Symbol
.
for
(
'order'
),
}
src/pages/consume/consume.tsx
View file @
ec53b230
...
...
@@ -10,15 +10,14 @@
*/
// @ts-nocheck
import
React
,
{
Component
}
from
'react'
import
{
View
,
Text
,
ScrollView
}
from
'react-native'
import
{
View
}
from
'react-native'
import
{
inject
,
observer
}
from
'mobx-react'
import
{
toJS
}
from
'mobx'
import
{
IOrganization
,
ISurgeryCollectHeader
,
IFee
}
from
'bonehouse'
import
*
as
R
from
'ramda'
import
Form
from
'../../components/form'
import
{
FieldType
}
from
'../../enums'
import
Header
from
'../../components/header/header'
import
{
g
,
getFormItem
,
isBlank
,
isNotBlank
,
show
}
from
'../../utils/utils'
import
{
g
,
getFormItem
,
isBlank
,
isNotBlank
,
show
,
translateSysprofile
}
from
'../../utils/utils'
import
Consumables
from
'./components/selected-consumables'
import
Fees
from
'./components/fees'
import
styles
from
'./consume.styl'
...
...
@@ -222,8 +221,9 @@ class Consume extends Component<IProps> {
setOptionsFormItems
()
{
const
{
sysProfiles
}
=
this
.
props
.
sysStore
let
{
formItems
}
=
this
.
state
let
depSetting
=
translateSysprofile
(
sysProfiles
.
OBS_MOBILE_CONSU_DEPARTMENT_DISPLAY
)
// 部门(00)第一位显示、第二位必需
if
(
R
.
pathEq
([
'OBS_MOBILE_CONSU_DEPARTMENT_DISPLAY'
,
0
],
'1'
,
sysProfiles
)
)
{
if
(
depSetting
.
show
)
{
formItems
=
R
.
insert
(
2
,
{
...
...
@@ -234,7 +234,7 @@ class Consume extends Component<IProps> {
options
:
[],
rules
:
[
{
required
:
R
.
pathEq
([
'OBS_MOBILE_CONSU_DEPARTMENT_DISPLAY'
,
1
],
'1'
,
sysProfiles
)
,
required
:
depSetting
.
required
,
message
:
'请选择客户'
,
},
],
...
...
@@ -244,7 +244,8 @@ class Consume extends Component<IProps> {
)
}
// 跟台(00)第一位显示、第二位必需
if
(
R
.
pathEq
([
'OBS_MOBILE_CONSU_FOLLOW_DISPLAY'
,
0
],
'1'
,
sysProfiles
))
{
const
follerSetting
=
translateSysprofile
(
sysProfiles
.
OBS_MOBILE_CONSU_FOLLOW_DISPLAY
)
if
(
follerSetting
.
show
)
{
const
idx
=
R
.
findIndex
(
R
.
propEq
(
'field'
,
'surgeryCollectNumber'
))(
formItems
)
formItems
=
R
.
insert
(
idx
+
1
,
...
...
@@ -256,7 +257,7 @@ class Consume extends Component<IProps> {
options
:
[],
rules
:
[
{
required
:
R
.
pathEq
([
'OBS_MOBILE_CONSU_FOLLOW_DISPLAY'
,
1
],
'1'
,
sysProfiles
)
,
required
:
follerSetting
.
required
,
message
:
'请选择跟台员'
,
},
],
...
...
@@ -266,7 +267,8 @@ class Consume extends Component<IProps> {
)
}
// 医生(00)第一位显示、第二位必需
if
(
R
.
pathEq
([
'OBS_MOBILE_CONSU_DOCTOR_DISPLAY'
,
0
],
'1'
,
sysProfiles
))
{
const
doctorSetting
=
translateSysprofile
(
sysProfiles
.
OBS_MOBILE_CONSU_DOCTOR_DISPLAY
)
if
(
doctorSetting
.
show
)
{
const
idx
=
R
.
findIndex
(
R
.
propEq
(
'field'
,
'consumeDate'
))(
formItems
)
formItems
=
R
.
insert
(
idx
+
1
,
...
...
@@ -278,7 +280,7 @@ class Consume extends Component<IProps> {
options
:
[],
rules
:
[
{
required
:
R
.
pathEq
([
'OBS_MOBILE_CONSU_DOCTOR_DISPLAY'
,
1
],
'1'
,
sysProfiles
)
,
required
:
doctorSetting
.
required
,
message
:
'请输入医生姓名'
,
},
],
...
...
@@ -395,11 +397,7 @@ class Consume extends Component<IProps> {
async
setSurgeryCollectNumberCallback
()
{
const
{
data
,
formItems
}
=
this
.
state
let
followers
=
this
.
props
.
orgStore
.
followers
(
data
.
sellerCode
,
data
.
orgCode
,
data
.
departmentCode
,
)
let
followers
=
this
.
props
.
orgStore
.
followers
(
data
.
sellerCode
,
data
.
orgCode
,
data
.
departmentCode
)
const
orderFollower
=
this
.
props
.
consumeStore
.
orderFollower
(
data
.
sellerCode
,
data
.
orgCode
,
...
...
src/pages/order/quick.tsx
View file @
ec53b230
...
...
@@ -33,6 +33,9 @@ type IProps = {
// APP下单是否显示送货员权限
OBS_MOBILE_DELIVERYMAN_DISPLAY
:
string
}
sysValueSets
:
{
ORTHOPEDICS_PRODUCT_CLASS
:
[]
}
}
userStore
:
{
userName
:
string
...
...
@@ -43,10 +46,17 @@ type IProps = {
orgs
:
Function
getCustomers
:
Function
customers
:
Function
billToSites
:
Function
shipToSites
:
Function
doctors
:
Function
getDepartmentsBySellerAndOrg
:
Function
departments
:
Function
followers
:
Function
}
orderStore
:
{
surgeryTemplates
:
[]
getTemplates
:
Function
}
}
class
QuickOrder
extends
Component
<
IProps
>
{
...
...
@@ -102,7 +112,7 @@ class QuickOrder extends Component<IProps> {
placeholder
:
'请选择'
,
rules
:
[{
required
:
true
,
message
:
'请选择收单地点'
}],
refrence
:
[
'orgCode'
,
'customerCode'
],
callback
:
this
.
set
Customer
Callback
.
bind
(
this
),
callback
:
this
.
set
BillToSites
Callback
.
bind
(
this
),
},
{
field
:
'shipToSiteCode'
,
...
...
@@ -111,8 +121,8 @@ class QuickOrder extends Component<IProps> {
options
:
[],
placeholder
:
'请选择'
,
rules
:
[{
required
:
true
,
message
:
'请选择收货地点'
}],
refrence
:
[
'orgCode'
,
'customerCode'
],
// callback: this.setCustomer
Callback.bind(this),
refrence
:
[
'orgCode'
,
'customerCode'
,
'billToSiteCode'
],
callback
:
this
.
setShipToSite
Callback
.
bind
(
this
),
},
{
field
:
'doctorName'
,
...
...
@@ -120,19 +130,26 @@ class QuickOrder extends Component<IProps> {
type
:
FieldType
.
SELECT
,
options
:
[],
placeholder
:
'请选择'
,
rules
:
[{
required
:
true
,
message
:
'请选择主治医生'
}],
refrence
:
[
'orgCode'
,
'customerCode'
],
//
rules: [{ required: true, message: '请选择主治医生' }],
refrence
:
[
'orgCode'
,
'customerCode'
,
'billToSiteCode'
,
'shipToSiteCode'
],
// callback: this.setCustomerCallback.bind(this),
},
{
field
:
'surgeryType
Name
'
,
field
:
'surgeryType'
,
label
:
'手术类型'
,
type
:
FieldType
.
SELECT
,
options
:
[],
options
:
R
.
compose
(
R
.
map
(
R
.
applySpec
({
label
:
R
.
prop
(
'valueName'
),
value
:
R
.
prop
(
'valueCode'
),
}),
),
R
.
pathOr
([],
[
'sysStore'
,
'sysValueSets'
,
'ORTHOPEDICS_PRODUCT_CLASS'
]),
)(
this
.
props
),
placeholder
:
'请选择'
,
rules
:
[],
refrence
:
[
'orgCode'
,
'customerCode'
],
// callback: this.setCustomerCallback.bind(this),
callback
:
this
.
getSurgeryTemplates
.
bind
(
this
),
},
{
field
:
'templateCollectNumber'
,
...
...
@@ -141,7 +158,7 @@ class QuickOrder extends Component<IProps> {
options
:
[],
placeholder
:
'请选择'
,
rules
:
[{
required
:
true
,
message
:
'请选择手术模板'
}],
refrence
:
[
'
orgCode'
,
'customerCod
e'
],
refrence
:
[
'
sellerCode'
,
'orgCode'
,
'customerCode'
,
'surgeryTyp
e'
],
},
{
field
:
'surgeryDate'
,
...
...
@@ -179,6 +196,8 @@ class QuickOrder extends Component<IProps> {
componentDidMount
()
{
this
.
setOptionsFormItems
()
console
.
log
(
toJS
(
this
.
props
.
sysStore
.
sysValueSets
.
ORTHOPEDICS_PRODUCT_CLASS
))
}
/**
...
...
@@ -242,9 +261,128 @@ class QuickOrder extends Component<IProps> {
})
}
setOrgCallback
()
{}
/**
* @description: 组织选择完回调
* @param {*}
* @return {*}
*/
async
setOrgCallback
()
{
const
sysProfiles
=
this
.
props
.
sysStore
.
sysProfiles
const
{
show
,
required
}
=
translateSysprofile
(
sysProfiles
.
OBS_MOBILE_DEPARTMENT_DISPLAY
)
if
(
show
)
{
this
.
getDepartments
.
call
(
this
)
}
this
.
getCustomers
.
call
(
this
)
}
/**
* @description: 获取部门列表
* @param {*}
* @return {*}
*/
async
getDepartments
()
{
const
{
data
,
formItems
}
=
this
.
state
const
{
orgCode
,
sellerCode
}
=
data
let
departments
=
this
.
props
.
orgStore
.
departments
(
sellerCode
,
orgCode
)
const
item
=
getFormItem
(
formItems
,
'departmentCode'
)
if
(
isBlank
(
departments
))
{
item
.
loading
=
true
await
this
.
props
.
orgStore
.
getDepartmentsBySellerAndOrg
(
sellerCode
,
orgCode
)
item
.
loading
=
false
departments
=
this
.
props
.
orgStore
.
departments
(
sellerCode
,
orgCode
)
}
item
.
options
=
departments
this
.
setState
({
formItems
})
}
/**
* @description: 获取客户列表
* @param {*}
* @return {*}
*/
async
getCustomers
()
{
const
{
data
,
formItems
}
=
this
.
state
const
{
orgCode
,
sellerCode
}
=
data
let
customers
=
this
.
props
.
orgStore
.
customers
(
sellerCode
,
orgCode
)
const
item
=
getFormItem
(
formItems
,
'customerCode'
)
if
(
isBlank
(
customers
))
{
item
.
loading
=
true
await
this
.
props
.
orgStore
.
getCustomers
(
sellerCode
,
orgCode
)
item
.
loading
=
false
customers
=
this
.
props
.
orgStore
.
customers
(
sellerCode
,
orgCode
)
}
item
.
options
=
customers
setCustomerCallback
()
{}
this
.
setState
({
formItems
})
}
/**
* @description: 客户选择完回调
* @param {*}
* @return {*}
*/
setCustomerCallback
()
{
const
{
formItems
,
data
}
=
this
.
state
const
{
sellerCode
,
orgCode
,
customerCode
}
=
data
const
billToSites
=
this
.
props
.
orgStore
.
billToSites
(
sellerCode
,
orgCode
,
customerCode
)
const
item
=
getFormItem
(
formItems
,
'billToSiteCode'
)
item
.
options
=
billToSites
this
.
setState
({
formItems
})
}
/**
* @description: 收单地点选择完回调
* @param {*}
* @return {*}
*/
setBillToSitesCallback
()
{
const
{
formItems
,
data
}
=
this
.
state
const
{
sellerCode
,
orgCode
,
customerCode
,
billToSiteCode
}
=
data
const
shipToSites
=
this
.
props
.
orgStore
.
shipToSites
(
sellerCode
,
orgCode
,
customerCode
,
billToSiteCode
)
const
item
=
getFormItem
(
formItems
,
'shipToSiteCode'
)
item
.
options
=
shipToSites
this
.
setState
({
formItems
})
}
/**
* @description: 收货地点
* @param {*}
* @return {*}
*/
setShipToSiteCallback
()
{
const
{
formItems
,
data
}
=
this
.
state
const
{
sellerCode
,
orgCode
,
customerCode
,
billToSiteCode
}
=
data
const
doctors
=
this
.
props
.
orgStore
.
doctors
(
sellerCode
,
orgCode
,
customerCode
,
billToSiteCode
)
const
item
=
getFormItem
(
formItems
,
'doctorName'
)
item
.
options
=
doctors
this
.
setState
({
formItems
})
}
/**
* @description: 获取手术模板
* @param {*}
* @return {*}
*/
async
getSurgeryTemplates
()
{
const
{
formItems
,
data
}
=
this
.
state
const
{
sellerCode
,
orgCode
,
customerCode
,
surgeryType
,
doctorName
}
=
data
const
item
=
getFormItem
(
formItems
,
'templateCollectNumber'
)
let
templates
=
this
.
props
.
orderStore
.
surgeryTemplates
// if (isBlank(templates)) {
item
.
loading
=
true
await
this
.
props
.
orderStore
.
getTemplates
(
sellerCode
,
orgCode
,
customerCode
,
surgeryType
,
doctorName
)
item
.
loading
=
false
// }
// templates = this.props.orderStore.surgeryTemplates
// console.log(templates)
}
submitHandler
()
{}
...
...
@@ -275,4 +413,4 @@ class QuickOrder extends Component<IProps> {
}
}
export
default
inject
(
'sysStore'
,
'userStore'
,
'orgStore'
)(
observer
(
QuickOrder
))
export
default
inject
(
'sysStore'
,
'userStore'
,
'orgStore'
,
'orderStore'
)(
observer
(
QuickOrder
))
src/pages/signin/signin.tsx
View file @
ec53b230
...
...
@@ -64,9 +64,11 @@ class Signin extends Component<IProps> {
if
(
isBlank
(
username
))
return
show
(
'请输入您的用户名'
)
if
(
isBlank
(
password
))
return
show
(
'请输入您的密码'
)
this
.
setState
({
loading
:
true
})
await
this
.
props
.
userStore
.
signin
(
username
,
password
)
const
res
=
await
this
.
props
.
userStore
.
signin
(
username
,
password
)
this
.
setState
({
loading
:
false
})
navigation
.
navigate
(
'Main'
)
if
(
res
)
{
navigation
.
navigate
(
'Main'
)
}
}
/**
...
...
@@ -151,10 +153,7 @@ class Signin extends Component<IProps> {
>
{
loading
?
(
<>
<
ActivityIndicator
style=
{
g
(
styles
,
'login-card__loading'
)
}
color=
"#ffffff"
/>
<
ActivityIndicator
style=
{
g
(
styles
,
'login-card__loading'
)
}
color=
"#ffffff"
/>
<
Text
style=
{
g
(
styles
,
'login-card__btn-text'
)
}
>
登录中
</
Text
>
</>
)
:
(
...
...
src/services/request.ts
View file @
ec53b230
...
...
@@ -120,6 +120,7 @@ export const request = (args: Partial<RequestConfig>) => {
return
doRequest
()
}
failHandler
(
e
,
store
,
pid
)
return
reject
(
transformObject
(
e
.
error_code
?
e
:
{
error_code
:
1
,
error_msg
:
'请求失败'
},
'toHump'
))
})
}
...
...
src/services/service.ts
View file @
ec53b230
...
...
@@ -117,4 +117,13 @@ export default class Service {
createConsumeOrder
(
data
:
any
)
{
return
request
({
url
:
`
${
ctx
}
/surgery/consume_order/create`
,
data
,
method
:
'post'
})
}
/**
* @description: 请求手术模板
* @param {any} data
* @return {*}
*/
getSurgeryTemplates
(
data
:
any
)
{
return
request
({
url
:
`
${
ctx
}
/surgery/template_header/search`
,
data
})
}
}
src/stores/consume.ts
View file @
ec53b230
...
...
@@ -129,6 +129,8 @@ export default class Consume {
*/
getOrders
=
flow
(
function
*
(
this
:
Consume
,
params
:
any
)
{
const
res
=
yield
this
.
service
.
getCollectOrders
(
params
)
as
any
if
(
res
.
errorCode
)
return
const
{
sellerCode
,
orgCode
,
customerCode
}
=
params
this
.
_orders
[
`
${
sellerCode
}
_
${
orgCode
}
_
${
customerCode
}
`
]
=
res
.
data
.
surgeryCollectHeaders
})
...
...
@@ -145,6 +147,8 @@ export default class Consume {
filterNoneFlag
:
'Y'
,
})
this
.
loading
=
false
if
(
res
.
errorCode
)
return
this
.
_orderLines
[
surgeryCollectNumber
]
=
R
.
compose
(
R
.
reject
(
R
.
propEq
(
'raisedConsume'
,
'Y'
)),
R
.
pathOr
([],
[
'data'
,
'lines'
]),
...
...
src/stores/index.ts
View file @
ec53b230
...
...
@@ -18,6 +18,7 @@ const sysStore = container.get<any>(TYPES.SysStore)
const
userStore
=
container
.
get
<
any
>
(
TYPES
.
UserStore
)
const
orgStore
=
container
.
get
<
any
>
(
TYPES
.
OrgStore
)
const
consumeStore
=
container
.
get
<
any
>
(
TYPES
.
Consume
)
const
orderStore
=
container
.
get
<
any
>
(
TYPES
.
Order
)
const
hydrate
=
create
({
storage
:
AsyncStorage
,
...
...
@@ -30,4 +31,4 @@ hydrate('sysStore', sysStore)
hydrate
(
'userStore'
,
userStore
)
hydrate
(
'orgStore'
,
orgStore
)
export
default
{
store
,
sysStore
,
userStore
,
orgStore
,
consumeStore
}
export
default
{
store
,
sysStore
,
userStore
,
orgStore
,
consumeStore
,
orderStore
}
src/stores/order.ts
0 → 100644
View file @
ec53b230
/*
* @FilePath: /BoneHouse_Business_APP/src/stores/order.ts
* @Author: peii
* @Date: 2021-07-04 14:52:03
* @LastEditTime: 2021-07-04 18:02:51
* @LastEditors: peii
* @Vision: 1.0
* @Description: 订单store
*/
// @ts-nocheck
import
{
observable
,
action
,
runInAction
,
toJS
,
flow
}
from
'mobx'
import
{
persist
}
from
'mobx-persist'
import
{
injectable
,
inject
}
from
'inversify'
import
Service
from
'../services/service'
import
{
IOrganization
,
ICustomer
,
IDepartment
}
from
'bonehouse'
import
*
as
R
from
'ramda'
import
{
isBlank
,
isNotBlank
}
from
'../utils/utils'
import
{
TYPES
}
from
'../inversify/types'
@
injectable
()
export
default
class
Order
{
@
inject
(
TYPES
.
Service
)
private
service
!
:
Service
@
observable
surgeryTemplates
:
{
[
key
:
string
]:
any
[]
}
/**
* @description: 请求手术模板
* @param {*}
* @return {*}
*/
getTemplates
=
flow
(
function
*
(
this
:
Order
,
sellerCode
:
string
,
orgCode
:
string
,
customerCode
:
string
,
surgeryType
:
string
,
doctorName
?:
string
,
)
{
const
params
=
{
sellerCode
,
orgCode
,
customerCode
,
surgeryType
,
doctorName
,
}
const
res
=
yield
this
.
service
.
getSurgeryTemplates
(
params
)
if
(
res
.
errorCode
)
return
console
.
log
(
res
)
})
}
src/stores/organization.ts
View file @
ec53b230
...
...
@@ -16,7 +16,7 @@ import { injectable, inject } from 'inversify'
import
Service
from
'../services/service'
import
{
IOrganization
,
ICustomer
,
IDepartment
}
from
'bonehouse'
import
*
as
R
from
'ramda'
import
{
isBlank
}
from
'../utils/utils'
import
{
isBlank
,
isNotBlank
}
from
'../utils/utils'
import
{
TYPES
}
from
'../inversify/types'
@
injectable
()
...
...
@@ -61,6 +61,101 @@ export default class Organization {
}
/**
* @description: 收单地点选项
* @param {string} sellerCode
* @param {string} orgCode
* @param {string} customerCode
* @param {string} uniq 唯一性字段
* @return {*}
*/
billToSites
(
sellerCode
:
string
,
orgCode
:
string
,
customerCode
:
string
,
uniq
=
'billToSiteCode'
)
{
const
customers
=
this
.
_customers
[
`
${
sellerCode
}
_
${
orgCode
}
`
]
||
[]
if
(
isBlank
(
customers
))
return
[]
const
customer
=
R
.
find
(
R
.
propEq
(
'customerCode'
,
customerCode
))(
customers
)
if
(
isBlank
(
customer
))
return
[]
let
billToSites
=
R
.
compose
(
R
.
map
(
R
.
applySpec
({
label
:
R
.
prop
(
'billToSiteName'
),
value
:
R
.
prop
(
'billToSiteCode'
),
shipToSites
:
R
.
prop
(
'shipToSites'
),
}),
),
R
.
propOr
([],
'billToSites'
),
)(
customer
)
if
(
isNotBlank
(
uniq
))
{
billToSites
=
R
.
uniqWith
(
R
.
eqBy
(
R
.
prop
(
uniq
)))(
billToSites
)
}
return
billToSites
}
/**
* @description:
* @param {string} sellerCode
* @param {string} orgCode
* @param {string} customerCode
* @param {string} billToSiteCode
* @param {string} uniq
* @return {*}
*/
shipToSites
(
sellerCode
:
string
,
orgCode
:
string
,
customerCode
:
string
,
billToSiteCode
:
string
,
uniq
=
'shipToSiteCode'
,
)
{
const
billToSites
=
this
.
billToSites
(
sellerCode
,
orgCode
,
customerCode
,
null
)
if
(
isBlank
(
billToSites
))
return
[]
const
billToSite
=
R
.
find
(
R
.
propEq
(
'value'
,
billToSiteCode
))(
billToSites
)
if
(
isBlank
(
billToSite
))
return
[]
let
shipToSites
=
R
.
compose
(
R
.
map
(
R
.
applySpec
({
label
:
R
.
prop
(
'shipToSiteName'
),
value
:
R
.
prop
(
'shipToSiteCode'
),
customerDoctor
:
R
.
prop
(
'customerDoctor'
),
}),
),
R
.
propOr
([],
'shipToSites'
),
)(
billToSite
)
if
(
isNotBlank
(
uniq
))
{
shipToSites
=
R
.
uniqWith
(
R
.
eqBy
(
R
.
prop
(
uniq
)))(
shipToSites
)
}
return
shipToSites
}
/**
* @description:
* @param {string} sellerCode
* @param {string} orgCode
* @param {string} customerCode
* @param {string} billToSiteCode
* @param {string} shipToSiteCode
* @return {*}
*/
doctors
(
sellerCode
:
string
,
orgCode
:
string
,
customerCode
:
string
,
billToSiteCode
:
string
)
{
const
shipToSites
=
this
.
shipToSites
(
sellerCode
,
orgCode
,
customerCode
,
billToSiteCode
,
null
)
if
(
isBlank
(
shipToSites
))
return
[]
return
R
.
compose
(
R
.
uniqWith
(
R
.
eqBy
(
R
.
prop
(
'value'
))),
R
.
map
(
R
.
applySpec
({
label
:
R
.
prop
(
'customerDoctor'
),
value
:
R
.
prop
(
'customerDoctor'
),
}),
),
)(
shipToSites
)
}
/**
* @description: 部门选项
* @param {string} sellerCode
* @param {string} orgCode
...
...
@@ -108,10 +203,9 @@ export default class Organization {
*/
getOrganizations
=
flow
(
function
*
(
this
:
Organization
)
{
const
res
=
yield
this
.
service
.
getOrganizations
()
this
.
organizations
=
R
.
compose
(
R
.
uniqBy
(
R
.
prop
(
'orgCode'
)),
R
.
pathOr
([],
[
'data'
,
'organizations'
]),
)(
res
)
if
(
res
.
errorCode
)
return
this
.
organizations
=
R
.
compose
(
R
.
uniqBy
(
R
.
prop
(
'orgCode'
)),
R
.
pathOr
([],
[
'data'
,
'organizations'
]))(
res
)
this
.
inventories
=
res
.
data
.
inventories
})
...
...
@@ -122,6 +216,8 @@ export default class Organization {
*/
getCustomers
=
flow
(
function
*
(
this
:
Organization
,
sellerCode
:
string
,
orgCode
:
string
)
{
const
res
=
yield
this
.
service
.
getCustomers
({
orgCode
,
sellerCode
})
if
(
res
.
errorCode
)
return
this
.
_customers
[
`
${
sellerCode
}
_
${
orgCode
}
`
]
=
res
.
data
.
customers
})
...
...
@@ -137,6 +233,8 @@ export default class Organization {
scopeFlag
=
'Y'
,
)
{
const
res
=
yield
this
.
service
.
getDepartmentsBySellerAndOrg
({
sellerCode
,
orgCode
,
scopeFlag
})
if
(
res
.
errorCode
)
return
this
.
_departments
[
`
${
sellerCode
}
_
${
orgCode
}
`
]
=
res
.
data
.
relationships
})
}
src/stores/system.ts
View file @
ec53b230
...
...
@@ -48,6 +48,9 @@ export default class System {
@
persist
(
'map'
)
@
observable
sysValueSets
=
{
// 消耗明细费用类型
SUR_FEE_TYPE
:
[],
// 手术类型
ORTHOPEDICS_PRODUCT_CLASS
:
[]
}
@
action
...
...
@@ -63,6 +66,8 @@ export default class System {
getSysProfile
=
flow
(
function
*
(
this
:
System
)
{
const
getProfiles
=
async
(
key
:
any
)
=>
{
const
res
=
(
await
this
.
service
.
getSysProfile
({
profileCode
:
key
}))
as
any
if
(
res
.
errorCode
)
return
runInAction
(()
=>
{
// @ts-ignore
this
.
sysProfiles
[
key
]
=
isNaN
(
res
.
data
.
profileValue
)
...
...
@@ -82,12 +87,14 @@ export default class System {
getSysValueSet
=
flow
(
function
*
(
this
:
System
)
{
const
getValueSets
=
async
(
key
:
any
)
=>
{
const
res
=
(
await
this
.
service
.
getSysValueSet
({
valueSetCode
:
key
}))
as
any
if
(
res
.
errorCode
)
return
runInAction
(()
=>
{
// @ts-ignore
this
.
sysValueSets
[
key
]
=
res
.
data
.
sysValues
})
}
R
.
compose
(
R
.
map
(
getValueSets
),
R
.
keys
)(
this
.
sysValueSets
)
R
.
compose
(
R
.
map
(
getValueSets
),
R
.
tap
(
x
=>
console
.
log
(
x
)),
R
.
keys
)(
this
.
sysValueSets
)
})
}
src/stores/user.ts
View file @
ec53b230
...
...
@@ -66,8 +66,9 @@ export default class UserStore {
user_password
:
password
,
},
}
const
res
=
yield
this
.
service
.
signin
(
params
)
if
(
res
.
errorCode
)
return
false
this
.
username
=
username
this
.
password
=
password
...
...
@@ -83,5 +84,6 @@ export default class UserStore {
this
.
store
.
setFunctions
(
res
.
functions
)
this
.
sysStore
.
getSysProfile
()
this
.
sysStore
.
getSysValueSet
()
return
true
})
}
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