Commit b208f278 by peii

【DEMAND】报台单

parent 0bdc6baa
......@@ -51,6 +51,10 @@ import MixConsumeForm from '../src/pages/mix_consume/form'
import MixConsumeItems from '../src/pages/mix_consume/consumeItems'
import ConsumeFee from '../src/pages/consume/fee'
// 报台单
import OperationReport from '../src/pages/operation_report/index'
import AddOperationReport from '../src/pages/operation_report/form'
const Router = createAppContainer(
createStackNavigator(
{
......@@ -97,6 +101,9 @@ const Router = createAppContainer(
MixConsume: { screen: MixConsume },
MixConsumeForm: { screen: MixConsumeForm },
MixConsumeItems: { screen: MixConsumeItems },
OperationReport: {screen: OperationReport},
AddOperationReport: {screen: AddOperationReport}
},
{
navigationOptions: {
......
......@@ -73,6 +73,11 @@ class HomePage extends Component {
isLendOrder: true,
},
},
MOBILE_OPERATION_REPORT: {
icon: require('../../images/ope_report.png'),
title: '报台单',
page: 'OperationReport',
},
},
// 结算模块
MOBILE_SETTLEMENT_MODULE: {
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/app/reducers/index.js
* @Author: peii
* @Date: 2021-02-03 20:59:10
* @LastEditTime: 2022-11-02 16:29:41
* @LastEditTime: 2022-11-25 18:07:38
* @LastEditors: PEII
* @Vision: 1.0
* @Description:
......@@ -20,6 +20,7 @@ import settlement from './module/settlement';
import mixConsume from './module/mixConsume';
import { user } from '../../src/reducers/user';
import { report } from '../../src/reducers/report';
const loginConfig = {
key: 'login',
......@@ -94,7 +95,8 @@ const rootReducer = {
deviceInfo: persistReducer(deviceConfig, deviceInfo),
settlement: persistReducer(settlementConfig, settlement),
mixConsume: persistReducer(mixConsumeConfig, mixConsume),
user
user,
report
}
export default rootReducer;
\ No newline at end of file
......@@ -36,11 +36,12 @@ const defaultState = {
OBS_MOBILE_BM_DISPLAY: '00',
OBS_MOBILE_SUR_FOLLOWER_DISPLAY: '00',
OBS_MOBILE_DELIVERYMAN_DISPLAY: '00',
OBS_MOBILE_BOR_WARE_REQUIRED: '00'
OBS_MOBILE_BOR_WARE_REQUIRED: '00',
},
sysValueSets: {
SUR_FEE_TYPE: [],
SUR_ORDER_TYPE: [],
ORTHOPEDICS_PRODUCT_CLASS: [],
},
organizations: [],
}
......@@ -60,12 +61,13 @@ export const originSysProfiles = {
OBS_MOBILE_SUR_FOLLOWER_DISPLAY: '00',
// APP下单是否显示送货员权限
OBS_MOBILE_DELIVERYMAN_DISPLAY: '00',
OBS_MOBILE_BOR_WARE_REQUIRED: '00'
OBS_MOBILE_BOR_WARE_REQUIRED: '00',
}
export const originSysValueSets = {
SUR_FEE_TYPE: [],
SUR_ORDER_TYPE: [],
ORTHOPEDICS_PRODUCT_CLASS: [],
}
export default login = (state = defaultState, action) => {
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/actions/action-types.ts
* @Author: PEII
* @Date: 2022-11-02 16:41:21
* @LastEditTime: 2022-11-24 16:33:56
* @LastEditTime: 2022-11-28 22:21:06
* @LastEditors: PEII
* @Vision: 1.0
* @Description:
......@@ -14,3 +14,8 @@ export const GET_CUSTOMERS = 'GET_CUSTOMERS'
export const GET_COLLECT_SETTING = 'GET_COLLECT_SETTING'
export const GET_DEPARTMENTS = 'GET_DEPARTMENTS'
// 报台单
export const GET_REPORT_ORDER = 'GET_REPORT_ORDER'
export const SET_REPORT_ORDER = 'SET_REPORT_ORDER'
/*
* @FilePath: /BoneHouse_Business_APP/src/actions/reportAction.ts
* @Author: PEII
* @Date: 2022-11-25 16:58:39
* @LastEditTime: 2022-11-28 23:13:19
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 报台Action
*/
import { createApiAction, createSimpleAction } from './utils'
import { GET_REPORT_ORDER, SET_REPORT_ORDER } from './action-types'
import api from '../services/api'
export const getReportOrder = createApiAction(GET_REPORT_ORDER, api.getReportOrder)
export const setReportOrder = createSimpleAction(SET_REPORT_ORDER)
import { IApiAction } from 'action'
import { curry, compose, reject, isNil, applySpec, always, __, Dictionary, identity, type } from 'ramda'
import { request } from '../services/baseApi'
/**
* 创建action
......@@ -25,7 +24,7 @@ export const createAction = curry((type: string, getPayload: Function, getMeta:
* @param payload {any}
* @return
*/
export const createSimpleAction: (string, any?) => Dictionary<any> = createAction(__, identity, always(null))
export const createSimpleAction: (key: string, fun?: any) => Dictionary<any> = createAction(__, identity, always(null))
/**
* 创建常量action
......@@ -46,7 +45,7 @@ export const createApiAction: IApiAction = (actionType: string, fn: Function) =>
}
let data = await fn(params)
if (data && data.error_code === 0) {
dispatch({ type: `${customActionType}`, payload: data.data })
dispatch({ type: `${customActionType}`, payload: data.data, params })
callback.success && callback.success({ payload: data.data })
return data.data
} else {
......
// @ts-nocheck
import React, { Component, PropTypes } from 'react'
import { Dimensions, Platform, PixelRatio, StatusBar, View, ScrollView } from 'react-native'
......
......@@ -56,6 +56,7 @@ export default class Input extends Component<IProps> {
'form-text-input': true,
'form-text-input__multi': item.multiline,
})}
editable={item.disabled !== false}
defaultValue={value}
autoCapitalize="none"
placeholder={item.placeholder || '请输入'}
......
......@@ -4,6 +4,9 @@
.container
@extend .bg-gray
.body
flex 1
.add-btn
color title_text_color
font-size first_text_size
......@@ -11,7 +14,8 @@
text-align right
.list
padding 15px
padding 0 15px
margin 15px 0
.item
background-color foundation_color
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/mix_consume/index.tsx
* @Author: PEII
* @Date: 2022-08-02 16:40:21
* @LastEditTime: 2022-10-28 17:58:04
* @LastEditTime: 2022-11-28 19:33:38
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 混单报消耗
......@@ -109,7 +109,7 @@ class MixConsume extends React.Component<IProps, IState> {
{/* 临时单列表 */}
<FlatList
data={orders}
keyExtractor={order => order.order_number}
keyExtractor={R.prop('order_number')}
extraData={this.state.refresh}
renderItem={props => (
<OrderItem
......
@import '../../../assets/styles/base.styl'
@import '../../../assets/styles/variable.styl'
.search
@extend .row
background-color primary_color
padding 15px
padding-top 5px
align-items center
margin-top -1px
&-box
background-color #fff
border-radius 24px
flex-direction row
align-items center
flex 1
&-input
padding 10px 20px
height 42px
font-size 18px
flex 1
&-icon
width 28px
height @width
margin-right 15px
\ No newline at end of file
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/mix_consume/components/search.tsx
* @Author: PEII
* @Date: 2022-08-02 18:14:35
* @LastEditTime: 2022-10-21 14:59:47
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 搜索
*/
// @ts-nocheck
import React from 'react'
import { View, Text, FlatList, TouchableOpacity, ActivityIndicator, Image, TextInput } from 'react-native'
import { g } from '../../../utils/utils'
import styles from './search.styl'
export default ({ children, search, placeholder, onChange }) => {
return (
<View style={g(styles, 'search')}>
<View style={g(styles, 'search-box')}>
<TextInput
style={g(styles, 'search-input')}
onChangeText={text => onChange && onChange(text)}
placeholder={placeholder}
clearButtonMode="always"
clearTextOnFocus={true}
/>
<TouchableOpacity activeOpacity={0.8} onPress={() => search && search()}>
<Image source={require('../../../assets/images/search_icon.png')} style={g(styles, 'search-icon')}></Image>
</TouchableOpacity>
</View>
{children}
</View>
)
}
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/operation_report/form.items.ts
* @Author: PEII
* @Date: 2022-11-28 13:01:02
* @LastEditTime: 2022-11-28 17:27:53
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 报台单formitems
*/
// @ts-nocheck
import * as R from 'ramda'
import { IFormField } from 'bonehouse'
import { FieldType } from '../../enums'
export function getFormItems(): IFormField[] {
const formItems: IFormField[] = [
{
field: 'orderNumber',
label: '报台单号',
disabled: false,
type: FieldType.TEXT,
},
{
field: 'orgCode',
label: '组织',
options: (() => {
return R.compose(
R.map(
R.applySpec({
label: R.prop('org_name'),
value: R.prop('org_code'),
}),
),
R.uniqBy(R.prop('org_code')),
)(this.props.organizations || [])
})(),
rules: [{ required: true, message: '请选择组织' }],
callback: this.setOrgCodeCallback.bind(this),
},
{
field: 'customerCode',
label: '客户',
options: [],
rules: [{ required: true, message: '请选择客户' }],
refrence: ['orgCode'],
},
{
field: 'surgeryType',
label: '手术类型',
rules: [{ required: true, message: '请选择手术类型' }],
options: (() => {
return R.map(
R.applySpec({
value: R.prop('value_code'),
label: R.prop('value_name'),
}),
)(this.props.surgeryTypes || [])
})(),
},
{
field: 'doctorName',
label: '医生',
type: FieldType.TEXT,
placeholder: '请输入',
rules: [{ required: true, message: '请输入医生' }],
},
{
field: 'surgeryDate',
label: '手术时间',
type: FieldType.DATE,
dateMode: 'datetime',
rules: [{ required: true, message: '请选择手术时间' }],
},
{
field: 'surgeryDesc',
label: '手术说明',
type: FieldType.TEXT,
rules: [{ required: true, message: '请选择手术类型' }],
},
{
field: 'patientName',
label: '患者姓名',
type: FieldType.TEXT,
},
{
field: 'patientGender',
label: '性别',
type: FieldType.RADIO,
options: [
{
value: '未知',
label: '未知',
},
{
value: '男',
label: '男',
},
{
value: '女',
label: '女',
},
],
},
{
field: 'patientAge',
label: '年龄',
type: FieldType.TEXT,
},
{
field: 'patientDepartment',
label: '手术科室',
type: FieldType.TEXT,
},
{
field: 'patientBed',
label: '床位',
type: FieldType.TEXT,
},
{
field: 'patientId',
label: '病历号',
type: FieldType.TEXT,
},
{
field: 'overtime',
label: '是否超时',
type: FieldType.RADIO,
options: [
{
value: 'Y',
label: '是',
},
{
value: 'N',
label: '否',
},
],
},
{
field: 'remark',
label: '备注',
type: FieldType.TEXT,
multiline: true,
},
]
return formItems
}
@import '../../assets/styles/base.styl'
@import '../../assets/styles/variable.styl'
.container
@extend .bg-gray
flex 1
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/operation_report/form.tsx
* @Author: PEII
* @Date: 2022-11-25 14:28:21
* @LastEditTime: 2022-11-28 23:59:44
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 新增报台单
*/
// @ts-nocheck
import React from 'react'
import { View } from 'react-native'
import { ICustomer, IOrganization } from 'bonehouse'
import { INavigation } from 'navigation'
import * as R from 'ramda'
import dayjs from 'dayjs'
import { connect } from 'react-redux'
import Resolution from '../../components/common/Resolution'
import Form from '../../components/form'
import Header from '../../components/header/header'
import { g, getFormItem, isBlank, isNotBlank, show } from '../../utils/utils'
import { getCustomers } from '../../actions/userAction'
import api from '../../services/api'
import { getFormItems } from './form.items'
import { transformObject } from '../../utils/transform'
import styles from './form.styl'
import { FieldType } from '../../enums'
type IProps = {
navigation: INavigation
organizations: IOrganization[]
allCustomers: { [string]: ICustomer[] }
surgeryTypes: any[]
}
type IState = {
searchText: string
allCustomers: { [string]: ICustomer[] }
}
class AddOptionsReport extends React.Component<IProps, IState> {
constructor(props) {
super(props)
this.setData = this.setData.bind(this)
this.submitHandler = this.submitHandler.bind(this)
}
state = {
formItems: [],
data: {
overtime: 'N',
patientGender: '未知',
},
allCustomers: {},
}
componentDidMount(): void {
const formItems = getFormItems.call(this)
this.setState({ formItems }, () => {
this.setEditData()
})
const order = this.props.navigation.getParam('order', null)
if (isBlank(order)) {
this.getOrderNumber()
}
}
setEditData() {
const order = this.props.navigation.getParam('order', null)
if (isBlank(order)) {
return this.setState({ data: this.state.data })
}
const data = transformObject(order, 'toHump')
const { formItems } = this.state
R.map(item => {
if (isBlank(data[item.field])) {
return
}
if (item.type === FieldType.DATE) {
data[item.field] = dayjs(data[item.field]).format('YYYY-MM-DD HH:mm:ss')
}
this.setData(item.field, data[item.field])
})(formItems)
const tmp = this.state.data
tmp.id = data.id
this.setState({ data: tmp })
}
/**
* @description: 设置修改值
* @param {*} key
* @param {*} vlaue
* @return {*}
*/
setData(key: string, value: any) {
return new Promise<any>((resolve, reject) => {
const { data, formItems } = this.state
data[key] = value
this.setState({ data }, () => {
const item = getFormItem(formItems, key)
item && item.callback && item.callback()
resolve()
})
})
}
/**
* @description: 获取报台单号
* @return {*}
*/
async getOrderNumber() {
const res = await api.getReportNumber()
if (res.error_code !== 0) {
return show('报台单号获取失败,请重试或联系管理员!')
}
const { data } = this.state
data.orderNumber = res.orderNumber
this.setState({ data })
}
/**
* @description: 组织选择回调
* @return {*}
*/
setOrgCodeCallback() {
this.getCustomers()
}
/**
* @description: 获取客户列表
* @param {*}
* @return {*}
*/
async getCustomers() {
const { data, formItems, allCustomers } = this.state
const { orgCode } = data
let customers = R.propOr([], orgCode)(allCustomers)
const item = getFormItem(formItems, 'customerCode')
if (isBlank(customers)) {
item.loading = true
await this.props.getCustomers(this.props.user_name, orgCode)
item.loading = false
customers = R.propOr([], orgCode)(this.props.allCustomers)
allCustomers[orgCode] = customers
}
item.options = R.map(
R.applySpec({
label: R.prop('customer_name'),
value: R.prop('customer_code'),
}),
)(customers)
this.setState({ formItems, allCustomers })
}
/**
* @description: 创建报台单
* @return {*}
*/
async submitHandler() {
const { data } = this.state
let postFun = R.ifElse(isBlank, R.always(api.createReportOrder), R.always(api.updateReportOrder))(data.id)
const res = await postFun({ data })
if (res.error_code !== 0) {
return show(res.error_msg || '请求失败')
}
this.props.navigation.replace('SubSuccPage', {
title: `报台单 - ${isBlank(data.id) ? '下单' : '修改'}成功`,
orderNumber: data.orderNumber,
})
}
render(): React.ReactNode {
const title = '新增报台单'
const { data, formItems } = this.state
return (
<View style={g(styles, 'container')}>
<Resolution.FixWidthView>
<Header
title={title}
backCallback={() => {
this.props.navigation.goBack()
}}
></Header>
<Form
data={data}
fields={formItems}
onChange={this.setData}
ref={ref => (this.formRef = ref)}
submitHandler={this.submitHandler}
/>
</Resolution.FixWidthView>
</View>
)
}
}
const mapStateToProps = R.applySpec({
organizations: R.path(['user', 'organizations']),
allCustomers: R.path(['user', 'customers']),
user_name: R.path(['login', 'userInfo', 'user_name']),
surgeryTypes: R.path(['login', 'sysValueSets', 'ORTHOPEDICS_PRODUCT_CLASS']),
})
const mapDispatchToProps = dispatch => ({
getCustomers(seller_code, org_code) {
return new Promise(resolve => {
dispatch(getCustomers({ seller_code, org_code }, { success: () => resolve(), fail: () => resolve() }))
})
},
})
export default connect(mapStateToProps, mapDispatchToProps)(AddOptionsReport)
@import '../../assets/styles/base.styl'
@import '../../assets/styles/variable.styl'
.container
@extend .bg-gray
flex 1
.add-btn
color title_text_color
font-size first_text_size
font-family font_family_regular
text-align right
.body
flex 1
width 100%
align-items center
padding 15px
.list
width 100%
.item
background-color foundation_color
padding 15px
flex-direction row
border-bottom-width 0px
align-items stretch
&-info
flex 1
overflow hidden
&-field
flex-direction row
&-key
width 80px
font-size 16px
color first_text_color
font-family font_family_semibold
&-val
flex 1
font-size 16px
color third_text_color
font-family font_family_semibold
&-action
width 60px
padding-left 10px
justify-content space-between
align-items center
&-btn
&__text
color #333
font-family font_family_semibold
font-weight bold
font-size 16px
.pill
background-color primary_color
padding 5px 10px
border-radius 20px
&-danger
background-color danger_color
&-text
color #fff
font-weight bold
.saperate-line
left 15px
width 354px
height 1px
background-color rgb(228, 228, 228)
\ No newline at end of file
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/operation_report/index.tsx
* @Author: PEII
* @Date: 2022-11-25 14:28:21
* @LastEditTime: 2022-11-29 12:02:36
* @LastEditors: PEII
* @Vision: 1.0
* @Description:
*/
// @ts-nocheck
import React, { Component } from 'react'
import { View, Text, ScrollView, TouchableOpacity, FlatList, Button, RefreshControl } from 'react-native'
import { IOrganization, IReportOrder } from 'bonehouse'
import { INavigation } from 'navigation'
import * as R from 'ramda'
import { connect } from 'react-redux'
import debounce from 'lodash.debounce'
import Resolution from '../../components/common/Resolution'
import { FieldType, SelectMode } from '../../enums'
import Header from '../../components/header/header'
import { g, getFormItem, isBlank, isNotBlank, show, getOrderSysProfile } from '../../utils/utils'
import { getSelfFormItems } from './self.formItem'
import { getReportOrder, setReportOrder } from '../../actions/reportAction'
import Empty from '../../components/empty'
import api from '../../services/api'
import Search from './components/search'
import styles from './index.styl'
type IProps = {
navigation: INavigation
orders: IReportOrder[]
getOrders: (data: any) => void
setOrders: (orders: IReportOrder[]) => void
}
type IState = {
searchText: string
refreshing: boolean
}
class OperationReport extends React.Component<IProps, IState> {
constructor(props) {
super(props)
this.loadMore = debounce(this.loadMore.bind(this), 300)
}
state: Readonly<IState> = {
searchText: '',
refreshing: false,
isEnd: false,
loading: false,
pageNum: 1,
pageSize: 10,
}
componentDidMount(): void {
this.loadData(1)
}
async loadData() {
const { searchText, pageNum, pageSize, loading } = this.state
if (loading) return
this.setState({ loading: true })
const res = await this.props.getOrders({ pageNum, pageSize, orderNumber: searchText })
const isEnd = R.compose(R.gt(pageSize), R.length, R.propOr([], 'payload'))(res)
this.setState({ refreshing: false, loading: false, isEnd })
}
onRefresh() {
this.setState({ refreshing: true, pageNum: 1, loading: false }, () => {
this.loadData()
})
}
loadMore() {
const { isEnd, loading } = this.state
if (loading || isEnd) return
this.setState({ pageNum: this.state.pageNum + 1 }, () => {
this.loadData()
})
}
/**
* @description: 添加
* @return {*}
*/
addHandler() {
this.props.navigation.navigate('AddOperationReport')
}
/**
* @description: 状态更新
* @param {*} item
* @param {*} status
* @return {*}
*/
async updateStatusHandler(item, status) {
const res = await api.updateReportOrderStatus({ id: item.id, status })
if (res.error_code !== 0) {
show(res.error_msg || '更新失败')
}
show('更新成功')
let orders = this.props.orders
const order = R.find(R.propEq('id', item.id))(orders)
order.status = status
this.props.setOrders(orders)
this.forceUpdate()
}
render(): React.ReactNode {
const title = '报台单'
let { navigation, orders } = this.props
const { refreshing } = this.state
return (
<View style={g(styles, 'container')}>
<Resolution.FixWidthView>
<Header
title={title}
backCallback={() => {
navigation.goBack()
}}
>
<TouchableOpacity activeOpacity={0.5} onPress={this.addHandler.bind(this)}>
<Text style={g(styles, 'add-btn')}>新增</Text>
</TouchableOpacity>
</Header>
<Search
onChange={text => this.setState({ searchText: text })}
placeholder="订单号"
search={() => {
this.loadData()
}}
/>
<View style={g(styles, 'body')}>
<FlatList
style={g(styles, 'list')}
data={orders}
keyExtractor={R.prop('order_number')}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={this.onRefresh.bind(this)}
style={g(styles, 'list-inner')}
/>
}
onEndReached={() => {
this.loadMore()
}}
renderItem={props => (
<Item
{...props}
list={orders}
updateStatus={this.updateStatusHandler.bind(this)}
onPressHandler={() => {
this.props.navigation.navigate('AddOperationReport', {
isEdit: true,
order: props.item,
forceUpdate: () => this.forceUpdate(),
})
}}
/>
)}
ItemSeparatorComponent={() => <View style={g(styles, 'saperate-line')}></View>}
ListEmptyComponent={() => <Empty />}
/>
</View>
</Resolution.FixWidthView>
</View>
)
}
}
const statusText = R.cond([
[R.equals('N'), R.always('关闭')],
[R.T, R.always('开启')],
])
const Item = ({ item, index, updateStatus, onPressHandler, list }: { item: IReportOrder; index: number }) => {
return (
<View style={g(styles, { item: true, 'item-last': R.length(list) - 1 === index })}>
<TouchableOpacity style={g(styles, 'item-info')} activeOpacity={0.8} onPress={() => onPressHandler(item)}>
<View style={g(styles, 'item-info-field')}>
<Text style={g(styles, 'item-info-key')}>客户名称:</Text>
<Text style={g(styles, 'item-info-val')} numberOfLines={2}>
{item.customer_name}
</Text>
</View>
<View style={g(styles, 'item-info-field')}>
<Text style={g(styles, 'item-info-key')}>报台单号:</Text>
<Text style={g(styles, 'item-info-val')}>{item.order_number}</Text>
</View>
{/* <View style={g(styles, 'item-info-field')}>
<Text style={g(styles, 'item-info-key')}>手术名称:</Text>
<Text style={g(styles, 'item-info-val')}>{item.surgery_name}</Text>
</View> */}
<View style={g(styles, 'item-info-field')}>
<Text style={g(styles, 'item-info-key')}>医生姓名:</Text>
<Text style={g(styles, 'item-info-val')}>{item.doctor_name}</Text>
</View>
<View style={g(styles, 'item-info-field')}>
<Text style={g(styles, 'item-info-key')}>手术说明:</Text>
<Text style={g(styles, 'item-info-val')}>{item.surgery_desc}</Text>
</View>
</TouchableOpacity>
<View style={g(styles, 'item-action')}>
<View style={g(styles, { pill: true, 'pill-danger': item.status === 'N' })}>
<Text style={g(styles, 'pill-text')}>{statusText(item.status)}</Text>
</View>
<TouchableOpacity
style={g(styles, 'item-btn')}
onPress={() => updateStatus(item, item.status === 'N' ? 'Y' : 'N')}
>
<Text style={g(styles, 'item-btn__text')}>{item.status === 'N' ? '开启' : '关闭'}</Text>
</TouchableOpacity>
</View>
</View>
)
}
const mapStateToProps = R.applySpec({
orders: R.path(['report', 'orders']),
})
const mapDispatchToProps = dispatch => ({
getOrders(data) {
return new Promise(resolve => {
dispatch(getReportOrder(data, { success: res => resolve(res) }))
})
},
setOrders(orders) {
dispatch(setReportOrder(orders))
},
})
export default connect(mapStateToProps, mapDispatchToProps)(OperationReport)
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/order/hoc/order.tsx
* @Author: PEII
* @Date: 2022-11-22 16:47:26
* @LastEditTime: 2022-11-24 22:36:13
* @LastEditTime: 2022-11-28 16:32:45
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 订单类型form
......@@ -18,7 +18,6 @@ type IProps = {
navigation: INavigation
userInfo: any
organizations: IOrganization[]
allCustomers: {}
getCustomers: (sellerCode: string, orgCode: string) => Promise<any>
getCollectSetting: (orgCode, customerCode, billToSiteCode, shipToSiteCode) => Promise<any>
getOrderTypes: (token, orgCode) => Promise<any>
......@@ -27,6 +26,7 @@ type IProps = {
type IState = {
data: { [key: string]: any[] }
formItems: IFormField[]
allCustomers: {}
doctorNames: string[]
invs: { string: any[] }
departments: { string: any[] }
......@@ -188,6 +188,7 @@ export default function Order(WrapComponent: Component<IProps, IState>) {
await this.props.getCustomers(sellerCode, orgCode)
item.loading = false
customers = R.propOr([], orgCode)(this.props.allCustomers)
allCustomers[orgCode] = customers
}
item.options = R.map(
......@@ -197,7 +198,7 @@ export default function Order(WrapComponent: Component<IProps, IState>) {
}),
)(customers)
this.setState({ formItems })
this.setState({ formItems, allCustomers })
}
/**
......
/*
* @FilePath: /BoneHouse_Business_APP/src/reducers/report.ts
* @Author: PEII
* @Date: 2022-11-25 18:04:24
* @LastEditTime: 2022-11-29 11:46:55
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 报台
*/
import * as R from 'ramda'
import { createReducer } from './utils'
import { GET_REPORT_ORDER, SET_REPORT_ORDER } from '../actions/action-types'
const initState = {
orders: [],
}
type IAction = {
type: string
payload: any
params?: any
}
export const report = createReducer(initState, {
[GET_REPORT_ORDER](state: any, action: IAction) {
let orders = state.orders
if (R.pathEq(['params', 'pageNum'], 1, action)) {
orders = action.payload
} else {
orders = R.concat(orders, action.payload)
}
return { ...state, orders }
},
[SET_REPORT_ORDER](state: any, action: IAction) {
return { ...state, orders: action.payload }
},
})
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/services/api.ts
* @Author: peii
* @Date: 2021-12-19 16:06:26
* @LastEditTime: 2022-11-04 18:11:25
* @LastEditTime: 2022-11-28 22:18:02
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 未重构完全暂用的所有请求
......@@ -203,4 +203,48 @@ export default {
}) {
return request({ url: `${v}/surgery/collect_setting/search`, data })
},
/**
* @description: 获取报台单
* @param {object} data
* @return {*}
*/
getReportOrder(data: { orderNumber: string; pageNum: number; pageSize: number; status: 'Y' | 'N' }) {
return request({ url: `${v}/NewspaperOrder/search`, params: data, method: 'POST' })
},
/**
* @description: 获取报新建台单号
* @return {*}
*/
getReportNumber() {
return request({ url: `${v}/NewspaperOrder/getOrderNumber` })
},
/**
* @description: 创建报台单
* @param {any} data
* @return {*}
*/
createReportOrder(data: any) {
return request({ url: `${v}/NewspaperOrder/create`, data, method: 'POST' })
},
/**
* @description: 报台单状态更新
* @param {object} params
* @return {*}
*/
updateReportOrderStatus(params: { status: 'Y' | 'N'; id: string }) {
return request({ url: `${v}/NewspaperOrder/updateStatus`, params, method: 'POST' })
},
/**
* @description: 报台单编辑更新
* @param {object} data
* @return {*}
*/
updateReportOrder(data: { data: any }) {
return request({ url: `${v}/NewspaperOrder/updateById`, data, method: 'POST' })
},
}
......@@ -10,7 +10,7 @@
*/
// @ts-nocheck
import * as R from 'ramda'
import { isBlank, show, genPid } from '../utils/utils'
import { isBlank, show, genPid, isNotBlank } from '../utils/utils'
import { stringify } from 'querystring'
import store from '../../app/store/configureStore'
import { transformObject } from '../utils/transform'
......@@ -19,6 +19,7 @@ interface RequestConfig {
url: string
method: string
data: any
params: any
headers: any
timeout: number
urlToken: boolean
......@@ -58,20 +59,23 @@ export const request = (args: Partial<RequestConfig>) => {
...args,
}
if (options.needToken && token) {
options.data.access_token = token
if (options.method.toUpperCase() === 'POST') {
const accessToken = 'access_token=' + token
options.url += R.ifElse(R.includes('?'), R.always('&' + accessToken), R.always('?' + accessToken))(options.url)
}
}
args.data = transformObject(options.data, 'toLine')
args.params = transformObject(options.params, 'toLine')
options = R.cond([
[R.propSatisfies(isNotBlank, 'params'), () => R.assoc('url', args.url + '?' + stringify(args.params), options)],
[R.propEq('method', 'get'), () => R.assoc('url', args.url + '?' + stringify(args.data), options)],
[R.T, () => R.assoc('body', JSON.stringify(args.data), options)],
])(options)
if (options.needToken && token) {
options.data.access_token = token
if (!R.includes('access_token', options.url)) {
const accessToken = 'access_token=' + token
options.url += R.ifElse(R.includes('?'), R.always('&' + accessToken), R.always('?' + accessToken))(options.url)
}
}
// 上传方式
if (options.headers['Content-Type'] === 'multipart/form-data') {
options.url += `?access_token=${token}`
......@@ -83,7 +87,9 @@ export const request = (args: Partial<RequestConfig>) => {
requestTimes += 1
console.log('请求URL:', host + options.url)
fetch(host + options.url, options)
.then(res => res.json())
.then(res => {
return res.json()
})
.then(res => {
if (isCancel) return
console.log('返回结果: ', res)
......
......@@ -13,7 +13,9 @@
declare module 'action' {
export interface IApiAction {
<T extends (...args: any) => any>(actionType: string, fn: T): (...args: Parameters<T>) => (dispatch: Function) => Promise<any>
<T extends (...args: any) => any>(actionType: string, fn: T): (
...args: Parameters<T>
) => (dispatch: Function) => Promise<any>
}
}
......@@ -74,6 +76,7 @@ declare module 'bonehouse' {
minuteInterval?: number
symmetric?: string
show?: boolean
callback?: () => void
[key: string]: any
}
......@@ -237,6 +240,28 @@ declare module 'bonehouse' {
ssTime: string
[key: string]: any
}
export type IReportOrder = Partial<{
attribute1: string
attribute2: string
create_by: string
create_time: string
customer_id: string
department_id: string
doctor_name: string
id: string
order_number: string
org_id: string
overtime: string
patient_department: string
remark: string
status: 'Y' | 'N'
surgery_desc: string
surgery_name: string
sys_org_code: string
update_by: string
update_time: string
}>
}
declare module 'navigation' {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment