Commit fd8da620 by peii

【FIX】修复部分bug及滑动优化体验

parent a36be8c0
/*
* @FilePath: /BoneHouse_Business_APP/src/components/form/image.tsx
* @Author: PEII
* @Date: 2022-08-02 16:15:54
* @LastEditTime: 2022-10-27 11:02:31
* @LastEditors: PEII
* @Vision: 1.0
* @Description:
*/
// @ts-nocheck
import React, { Component } from 'react' import React, { Component } from 'react'
import { import { View, Text, Image, TouchableOpacity, ScrollView, Alert, Linking, Platform } from 'react-native'
View,
Text,
Image,
TouchableOpacity,
ScrollView,
Alert,
Linking,
Platform,
} from 'react-native'
import { IFormField, IOption } from 'bonehouse' import { IFormField, IOption } from 'bonehouse'
import * as R from 'ramda' import * as R from 'ramda'
import ImagePicker from 'react-native-image-picker' import ImagePicker from 'react-native-image-picker'
import Toast, { Positions } from 'react-native-root-toast' import Toast, { Positions } from 'react-native-root-toast'
import { isBlank, show, isRequired, isNotBlank, g } from '../../utils/utils' import { isBlank, show, isRequired, isNotBlank, g } from '../../utils/utils'
import styles from './image.styl' import styles from './image.styl'
// import Container from '../../inversify' import service from '../../services/service'
// import { TYPES } from '../../inversify/types'
// import Service from '../../services/service'
// const service: Service = Container.get(TYPES.Service)
type IProps = { type IProps = {
item: IFormField item: IFormField
...@@ -72,10 +69,7 @@ export default class ImageForm extends React.Component<IProps> { ...@@ -72,10 +69,7 @@ export default class ImageForm extends React.Component<IProps> {
if (res.error) { if (res.error) {
const errMsgs = ['Camera permissions not granted', 'Photo library permissions not granted'] const errMsgs = ['Camera permissions not granted', 'Photo library permissions not granted']
const errTips = [ const errTips = ['APP需要使用相机,请打开相机权限允许APP使用', 'APP需要使用相册,请打开相册权限允许APP使用']
'APP需要使用相机,请打开相机权限允许APP使用',
'APP需要使用相册,请打开相册权限允许APP使用',
]
for (const [idx, msg] of Object.entries(errMsgs)) { for (const [idx, msg] of Object.entries(errMsgs)) {
if (R.indexOf(res.error, msg) > -1) { if (R.indexOf(res.error, msg) > -1) {
...@@ -106,7 +100,7 @@ export default class ImageForm extends React.Component<IProps> { ...@@ -106,7 +100,7 @@ export default class ImageForm extends React.Component<IProps> {
formData.append('file', file) formData.append('file', file)
try { try {
const loading = Toast.show('上传中', { duration: 60000, position: Toast.positions.CENTER }) const loading = Toast.show('上传中', { duration: 60000, position: Toast.positions.CENTER })
// const result = await service.uploadImg(formData) const result = await service.uploadImg(formData)
Toast.hide(loading) Toast.hide(loading)
let value = this.props.value || [] let value = this.props.value || []
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
flex-direction row flex-direction row
align-items center align-items center
justify-content flex-end justify-content flex-end
flex 1
&__placeholder &__placeholder
@extend .text @extend .text
......
...@@ -10,14 +10,7 @@ ...@@ -10,14 +10,7 @@
*/ */
// @ts-nocheck // @ts-nocheck
import React, { Component } from 'react' import React, { Component } from 'react'
import { import { View, Text, ScrollView, TouchableOpacity, ActivityIndicator, KeyboardAvoidingView } from 'react-native'
View,
Text,
ScrollView,
TouchableOpacity,
ActivityIndicator,
KeyboardAvoidingView,
} from 'react-native'
import { IFormField } from 'bonehouse' import { IFormField } from 'bonehouse'
import * as R from 'ramda' import * as R from 'ramda'
import { FieldType } from '../../enums' import { FieldType } from '../../enums'
...@@ -57,7 +50,7 @@ export default class Form extends Component<IProps> { ...@@ -57,7 +50,7 @@ export default class Form extends Component<IProps> {
} }
componentDidMount() { componentDidMount() {
this.checkCanSubmit = debounce(this.checkCanSubmit.bind(this)) this.checkCanSubmit = debounce(this.checkSubmit.bind(this))
this.submitHandler = debounce(this.submitHandler.bind(this), 200) this.submitHandler = debounce(this.submitHandler.bind(this), 200)
} }
...@@ -81,7 +74,7 @@ export default class Form extends Component<IProps> { ...@@ -81,7 +74,7 @@ export default class Form extends Component<IProps> {
/** /**
* @description: 是否可以提交 * @description: 是否可以提交
*/ */
checkCanSubmit() { checkSubmit() {
const { fields, data } = this.props const { fields, data } = this.props
for (const item of fields) { for (const item of fields) {
if (isBlank(item.rules)) continue if (isBlank(item.rules)) continue
......
...@@ -60,7 +60,7 @@ export default class Input extends Component<IProps> { ...@@ -60,7 +60,7 @@ export default class Input extends Component<IProps> {
autoCapitalize="none" autoCapitalize="none"
placeholder={item.placeholder || '请输入'} placeholder={item.placeholder || '请输入'}
onChangeText={this.onChangeText} onChangeText={this.onChangeText}
multiline={item.multiline} multiline={true}
numberOfLines={item.numberOfLines || 4} numberOfLines={item.numberOfLines || 4}
maxLength={140} maxLength={140}
placeholderTextColor={placehold_text_color} placeholderTextColor={placehold_text_color}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/mix_consume/consumeItems.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/mix_consume/consumeItems.tsx
* @Author: PEII * @Author: PEII
* @Date: 2022-10-10 14:09:04 * @Date: 2022-10-10 14:09:04
* @LastEditTime: 2022-10-21 14:57:58 * @LastEditTime: 2022-10-27 11:55:34
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 扫码消耗项 * @Description: 扫码消耗项
...@@ -82,12 +82,16 @@ class ConsumeItems extends React.Component<IProps> { ...@@ -82,12 +82,16 @@ class ConsumeItems extends React.Component<IProps> {
if (isBlank(list)) { if (isBlank(list)) {
return show('该条码无法找到物料') return show('该条码无法找到物料')
} }
list = R.filter(R.propEq('customer_code', order.customer_code))(list) const items = R.filter(R.propEq('customer_code', order.customer_code))(list)
if (isBlank(list)) { if (isBlank(items)) {
return show(`该物料借货客户【${list[0].customer_name}】与您选择的客户不一致,请检查`) return show(
`该物料借货客户【${list[0].customer_name}】与您选择的客户【${
order.customer_name || order.customer_code
}】不一致,请检查`,
)
} }
lines = R.compose(R.uniqBy(R.prop('serial_number')), R.concat(lines), R.map(R.assoc('consumed_quantity', 1)))(list) lines = R.compose(R.uniqBy(R.prop('serial_number')), R.concat(lines), R.map(R.assoc('consumed_quantity', 1)))(items)
this.setState({ lines }) this.setState({ lines })
} }
......
...@@ -422,12 +422,12 @@ class ConsumeForm extends Component<IProps, IState> { ...@@ -422,12 +422,12 @@ class ConsumeForm extends Component<IProps, IState> {
data.lines = lines data.lines = lines
this.setState({ data }, () => { this.setState({ data }, () => {
this.saveHandler() this.saveHandler()
const canSubmit = this.formRef.checkCanSubmit() const canSubmit = this.formRef.checkSubmit()
if (!submit) return
if (!submit) return
if (!canSubmit) return show('请完善必填信息再提交') if (!canSubmit) return show('请完善必填信息再提交')
this.submitHandler() this.formRef.submitHandler()
}) })
}, },
}) })
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/services/api.ts * @FilePath: /BoneHouse_Business_APP/src/services/api.ts
* @Author: peii * @Author: peii
* @Date: 2021-12-19 16:06:26 * @Date: 2021-12-19 16:06:26
* @LastEditTime: 2022-10-13 17:30:11 * @LastEditTime: 2022-10-27 11:20:09
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 未重构完全暂用的所有请求 * @Description: 未重构完全暂用的所有请求
...@@ -173,7 +173,11 @@ export default { ...@@ -173,7 +173,11 @@ export default {
* @param {object} data * @param {object} data
* @return {*} * @return {*}
*/ */
getCollectOrderLines(data: { serial_number?: string; raised_consume?: 'Y' | 'N', surgery_collected_number?: string }) { getCollectOrderLines(data: {
serial_number?: string
raised_consume?: 'Y' | 'N'
surgery_collected_number?: string
}) {
return request({ url: `${v}/surgery/collected_order_line/search`, data }) return request({ url: `${v}/surgery/collected_order_line/search`, data })
}, },
...@@ -183,6 +187,6 @@ export default { ...@@ -183,6 +187,6 @@ export default {
* @return {*} * @return {*}
*/ */
createGroupComsumeOrder(data: any) { createGroupComsumeOrder(data: any) {
return request({url: `${v}/surgery/consume_group_order/create`, data, method: 'POST'}) return request({ url: `${v}/surgery/consume_group_order/create`, data, method: 'POST' })
} },
} }
...@@ -13,6 +13,7 @@ import * as R from 'ramda' ...@@ -13,6 +13,7 @@ import * as R from 'ramda'
import { isBlank, show, genPid } from '../utils/utils' import { isBlank, show, genPid } from '../utils/utils'
import { stringify } from 'querystring' import { stringify } from 'querystring'
import store from '../../app/store/configureStore' import store from '../../app/store/configureStore'
import { transformObject } from '../utils/transform'
interface RequestConfig { interface RequestConfig {
url: string url: string
...@@ -64,7 +65,7 @@ export const request = (args: Partial<RequestConfig>) => { ...@@ -64,7 +65,7 @@ export const request = (args: Partial<RequestConfig>) => {
options.url += R.ifElse(R.includes('?'), R.always('&' + accessToken), R.always('?' + accessToken))(options.url) options.url += R.ifElse(R.includes('?'), R.always('&' + accessToken), R.always('?' + accessToken))(options.url)
} }
} }
// args.data = transformObject(options.data, 'toLine') args.data = transformObject(options.data, 'toLine')
args.data = options.data args.data = options.data
options = R.cond([ options = R.cond([
......
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
* *
*/ */
// @ts-nocheck // @ts-nocheck
import { request } from './request' import { request } from './baseApi'
import { injectable } from 'inversify' // import { injectable } from 'inversify'
const ctx = '/api/latest' const ctx = '/api/latest'
@injectable() // @injectable()
export default class Service { class Service {
/** /**
* 获取系统配置 * 获取系统配置
*/ */
...@@ -119,3 +119,5 @@ export default class Service { ...@@ -119,3 +119,5 @@ export default class Service {
return request({ url: `${ctx}/surgery/consume_order/create`, data, method: 'post' }) return request({ url: `${ctx}/surgery/consume_order/create`, data, method: 'post' })
} }
} }
export default new Service()
\ No newline at end of file
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