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