Commit 56151aa5 by Denglingling

删除多余代码,以及相关常用变量

(cherry picked from commit fbdeabf3)
parent 9f63e122
......@@ -60,26 +60,26 @@ export default class LocalVariable {
/**
* 手术模板名
*/
static SURGICAL_TEMPLATE = 'surg_temp'
static SURGICAL_TEMPLATE = 'surgical_template_name'
/**
* 钉盒名
*/
static NAIL_BOX = 'screw_box'
static NAIL_BOX = 'nail_box_name'
/**
* 器械包名
*/
static EQUIPMENT_BAG = 'equip_bag'
static EQUIPMENT_BAG = 'equipment_bag_name'
/**
* 零散器械名
*/
static SCATTERED_EQUIPMENT = 'auxili_tool'
static SCATTERED_EQUIPMENT = 'scattered_equipment_name'
/**
* 单选耗材名
*/
static SIGN_SELECT_CONSUMABLES = 'sign_consu'
static SIGN_SELECT_CONSUMABLES = 'sign_select_consumables_name'
}
\ No newline at end of file
......@@ -24,7 +24,6 @@ class LodingModel extends Component {
componentWillReceiveProps(nextProps) {
if (this.state.isVisible != nextProps.show) {
console.log('nextProps.show====', nextProps.show)
this.setState({
isVisible: nextProps.show
})
......@@ -33,14 +32,12 @@ class LodingModel extends Component {
render() {
let { title, size, color, style_back } = this.props
console.log('!!this.state.isVisible====', !!this.state.isVisible)
return (
<View style={styles.container}>
<Modal
transparent={true}
visible={!!this.state.isVisible}
animationType={'fade'}
// onRequestClose={() => this.closeModal()}>
>
<SafeAreaView style={safe_view}>
<View style={[styles.loding_cont, style_back]}>
......
import React, { Component } from 'react';
import { View, Text, StyleSheet, SafeAreaView, Modal, ScrollView, TouchableOpacity, FlatList, Image } from 'react-native';
import { pxHeight, foundation_color, promary_color, second_text_color, third_text_color, first_text_color, second_text_size, Width, pxSize, safe_view, font_family_medium, font_family_light, list_common_item, third_text_size, icon_style, point_color, title_text_color } from '../../base/BaseStyle';
import { pxHeight, foundation_color, promary_color, second_text_color, first_text_color, Width, pxSize, safe_view, font_family_medium, font_family_light, list_common_item, third_text_size, icon_style, point_color, title_text_color } from '../../base/BaseStyle';
import ChooseCardList from '../common/listDataComponent/ChooseCardList';
import PicTitDetaiCalcu from '../common/listDataComponent/PicTitDetaiCalcu';
import _ from "lodash";
import localMockData from '../../containers/selfOrder/module/mock/sen_mock';
import { cloneObject } from '../../utils/Utils';
import LocalVariable from './LocalVariable';
const PropTypes = require('prop-types');
// const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
// const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
// const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
// const QUANTITY_FIELD = 'quantity' // 计算的字段
// const CHILDREN_LINE_NAME = 'childrenLineData' // 显示的子类数组名称
// const SUPER_TITLE_NAME = 'super_title_name'
// const SUPER_TITLE_TIP = 'super_title_tip'
// const ONLY_TWO_LEVELS = 'onlyTwoLevels' // 只有两级的耗材
class ProductModel extends Component {
static propTypres = {
......@@ -38,14 +27,6 @@ class ProductModel extends Component {
orginOptionList: [], // 原始数据
}
}
componentDidMount(){
// console.log('本地测试数据====localMockData===', localMockData)
// // 赋值测试数据
// this.setState({
// topProcOptionList: localMockData.localBottomOption
// })
}
componentWillReceiveProps(nextProps) {
let that = this
......@@ -89,39 +70,29 @@ class ProductModel extends Component {
}
})
otherArr.push(otherChildObj)
console.log('修改后的已选数据😁====', otherArr)
this.setState({
topProcOptionList: otherArr
})
}
// 恢复其他所有数据
// 恢复耗材以外的数据
setTopOrginTopData(curOptions){
let {orginOptionList} = this.state
// console.log('回调之前的==原始已选数据==', orginOptionList)
// console.log('回调之前的===当前修改后的已选数据==', curOptions)
orginOptionList.map(function(orgItem, orgIndex) {
if(orgIndex < 4){
orgItem = curOptions[orgIndex]
}
})
// console.log('当前修改后的原始数据==', orginOptionList)
this.props.modelCallBack(orginOptionList) // 调用
}
// 共计已选 点击
handleCloseSelected() {
console.log('已选:handleCloseSelected')
this.closeModal()
this.props.modelCallBack(orginOptionList)
}
// 选好了 点击
handleCloseSubmit() {
console.log('选好了--handleCloseSubmit')
this.closeModal()
this.props.closeSubmit()
}
// 关闭弹窗
closeModal() {
this.setState({
isVisible: false
......@@ -131,18 +102,13 @@ class ProductModel extends Component {
// 单选耗材清空图标回调
handleClearBack(item, index){
let {orginOptionList, topProcOptionList, topActiveIndex} = this.state
// console.log('清空图标回调---', item, index)
// console.log('原始已选数据==--===--', orginOptionList)
// console.log('当前已选数据==----', topProcOptionList, topActiveIndex)
let {orginOptionList} = this.state
// 单选耗材当前清空项
let allCountQuantity = 0 // 初始化
orginOptionList.forEach(function(orgOpts, orgInd) {
if(orgInd >= 4){
if(orgOpts[LocalVariable.LOCAL_SECOND_DATA] && orgOpts[LocalVariable.LOCAL_SECOND_DATA].length > 0){
orgOpts[LocalVariable.LOCAL_SECOND_DATA].forEach(function(localDa, localInd) {
orgOpts[LocalVariable.LOCAL_SECOND_DATA].forEach(function(localDa) {
if(localDa[LocalVariable.ONLY_TWO_LEVELS] && localDa['item_code'] === item['item_code']){
// 二级
localDa[LocalVariable.QUANTITY_FIELD] = 0
......@@ -186,30 +152,23 @@ class ProductModel extends Component {
}
allCountQuantity += orgOpts[LocalVariable.SELECTED_QUQNTITY]
})
// console.log('修改后的已选=======---', topProcOptionList)
// console.log('修改后的数量---', allCountQuantity)
// console.log('修改后端所有数据---', orginOptionList)
this.props.modelCallBack(orginOptionList)
if(allCountQuantity === 0){
this.closeModal()
}
}
// 修改列表计算后数据
// 列表计算后回调
handleCalCallBack(item, index){
console.log('回调=====', item, index)
let {topProcOptionList, topActiveIndex} = this.state
let defauIndex = index
defauIndex = item.superIndex
console.log('--当前已选数据 ===',topProcOptionList, topActiveIndex)
if(LocalVariable.SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR]) {
let allCountQuantity = 0 // 初始化
topProcOptionList.map(function(listItem, listIndex) {
if(listIndex === topActiveIndex){
if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
//钉盒 零散器械
//钉盒 器械包 零散器械
//初始化 中类
let deleFlag = false
let deleInd = null
......@@ -228,6 +187,7 @@ class ProductModel extends Component {
listItem[LocalVariable.SELECTED_DATA_ARR].splice(deleInd, 1)
}
}else {
// 手术模板
let deleFlag = false
let deleInd = null
// 初始化 三级
......@@ -247,8 +207,7 @@ class ProductModel extends Component {
})
if(deleFlag) {
listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.CHILDREN_LINE_NAME].splice(deleInd, 1)
}
}
// 初始化 中类
listItem[LocalVariable.SELECTED_QUQNTITY] = 0
listItem[LocalVariable.SELECTED_DATA_ARR].forEach(function(seDa) {
......@@ -259,11 +218,10 @@ class ProductModel extends Component {
})
// 已选数量赋值之前默认数据
let curObj = listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex]
// console.log('curObj----', curObj)
if(listIndex < 4){
if(curObj.id){
if(curObj['template_number']){
listItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function(deIt) {
if(deIt.id === curObj.id){ // 本地测试'id'为唯一值
if(deIt.template_number === curObj.template_number){
deIt = curObj
}
})
......@@ -295,7 +253,6 @@ class ProductModel extends Component {
// 清空
handleClearRubbish() {
let {orginOptionList} = this.state
// console.log('清空======', orginOptionList)
orginOptionList.map(function(listItem) {
listItem[LocalVariable.SELECTED_QUQNTITY] = 0
listItem[LocalVariable.SELECTED_DATA_ARR] = []
......@@ -304,9 +261,6 @@ class ProductModel extends Component {
deIt[LocalVariable.CHILDREN_LINE_NAME] = []
})
})
// 回调函数
// console.log('---清空之后===== ', orginOptionList)
// this.props.modelCallBack(orginOptionList)
this.props.clearRubbish()
this.closeModal()
}
......@@ -357,10 +311,6 @@ class ProductModel extends Component {
renderContItem() {
let {topProcOptionList, topActiveIndex} = this.state
let curData = topProcOptionList[topActiveIndex]
// console.log('已选展示信息 === curData---', topProcOptionList)
// console.log('已选展示信息 === curData---', topActiveIndex)
// console.log('已选展示信息 === curData---', curData)
let localBottomContData = []
if(curData && curData[LocalVariable.SELECTED_DATA_ARR]){
curData[LocalVariable.SELECTED_DATA_ARR].forEach(function(sedItem, sedInd) {
......@@ -381,8 +331,6 @@ class ProductModel extends Component {
}
})
}
// console.log('已选当前模块数据---',curData,topActiveIndex)
// console.log('已选展示信息---',localBottomContData)
return(
<View style={styles.edit_cont}>
......@@ -405,7 +353,6 @@ class ProductModel extends Component {
// 返回每一列元素
renderContColumnItem(item, index) {
let {topActiveIndex} = this.state
// let curTit='', curTipOne='', curTipTwo=''
let curTit='', curTipOne='', curTipTwo='', curTipOneTit='', curTipTwoTit='', curIcon=''
let curListMaxNum = ''
if(topActiveIndex === 0){
......@@ -425,26 +372,7 @@ class ProductModel extends Component {
curTit = LocalVariable.SUPER_TITLE_NAME
curTipOne = LocalVariable.SUPER_TITLE_TIP
}
// if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
// //钉盒 零散器械
// curTit = 'title'
// curTipOne = 'tip1'
// curTipTwo = 'tip2'
// // if(topActiveIndex === 2){
// // curTipOne = 'lineTip'
// // curTipTwo = ''
// // }
// }
// else if(topActiveIndex === 2){
// // 器械包
// curTit = 'item_name'
// curTipOne = 'category_name'
// curTipTwo = 'category_desc'
// }else {
// curTit = 'superTit'
// curTipOne = 'superTip'
// }
return (
<TouchableOpacity
activeOpacity={1}
......@@ -460,7 +388,6 @@ class ProductModel extends Component {
tipTextTwo={curTipTwo}
tipTextOneTit={curTipOneTit}
tipTextTwoTit={curTipTwoTit}
// listImgIcon={'superImg'}
listPicType={'SQUARE'}
listStyleImg={styles.list_icon}
listStyleTit={styles.list_tit}
......@@ -488,14 +415,13 @@ class ProductModel extends Component {
sel_tip += `${proItem.category_name}x${proItem[LocalVariable.SELECTED_QUQNTITY]} `
}
})
console.log('弹窗===', topProcOptionList, sel_tip)
return (
<View style={list_common_item.sub_box}>
<View style={list_common_item.sub_two_btn}>
<TouchableOpacity
activeOpacity={.8}
style={[list_common_item.lef_btn, styles.fo_btn_lef]}
onPress={() => this.handleCloseSelected()}
onPress={() => this.closeModal()}
>
<Text style={list_common_item.lef_tip} numberOfLines={1}>
{allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'当前已选: '}</Text>}
......
import React, { Component } from 'react';
import { StyleSheet, Image, Text, TouchableOpacity, View, ScrollView } from 'react-native';
import { first_text_color, font_family_light, font_family_regular, font_family_semibold, foundation_color, home_background_color, icon_style, point_color, promary_color, pxSize, second_text_color, second_text_size, third_text_color, third_text_size, title_text_color, Width } from '../../../base/BaseStyle';
import { first_text_color, font_family_regular, font_family_semibold, home_background_color, icon_style, point_color, promary_color, pxSize, second_text_color, third_text_size, title_text_color } from '../../../base/BaseStyle';
const PropTypes = require('prop-types');
import localMockData from '../../selfOrder/module/mock/sen_mock';
import { connect } from 'react-redux';
/**
* 卡片选择器,可用于顶部,右侧
*/
class ChooseCardList extends Component {
static propTypres = {
......@@ -27,19 +29,13 @@ class ChooseCardList extends Component {
cardListOptions: PropTypes.array,
cardItemTitle: PropTypes.string,
cardItemIcon: PropTypes.string,
cardImgName: PropTypes.string,
cardCallBack: PropTypes.func,
curActIndex: PropTypes.number, // 当前已选项index
cardCountName: PropTypes.string, // 显示计数字段
cardStyleType: PropTypes.string, // 计数可选样式
cardCouStyle: PropTypes.object, // 指定计数样式
cardShowDefIcon: PropTypes.bool, // 是否显示默认无图
cardKeyName: PropTypes.string, // 关键key值
}
constructor(props) {
......@@ -51,15 +47,12 @@ class ChooseCardList extends Component {
}
render() {
let { cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox, cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardImgName,
cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardCountName, cardStyleType, cardCouStyle,
global_domain_config, cardShowDefIcon, cardKeyName } = this.props
let { cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox,
cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon,
cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardCountName, cardStyleType,
cardCouStyle, global_domain_config, cardShowDefIcon } = this.props
let { countStyleType } = this.state
// let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
// cardListOptions[cardImgName] = localTestImageUrls // 本地测试
return (
<View style={[styles.card_container, cardStyleBox]}>
<ScrollView
......@@ -72,17 +65,12 @@ class ChooseCardList extends Component {
{cardListOptions.map((item, index) => {
let cur_icon = item[cardItemIcon]
if (typeof cur_icon === 'string') {
// global_domain_config = 'https://obs-dev.gyjtsx.com' // 本地测试
// cur_icon = {uri: global_domain_config+cur_icon} // 测试
cur_icon = { uri: global_domain_config + '/jeecg-boot/sys/common/view/' + cur_icon } // 正式
cur_icon = { uri: global_domain_config + '/jeecg-boot/sys/common/view/' + cur_icon }
} else if (cur_icon instanceof Array) {
// global_domain_config = 'https://obs-dev.gyjtsx.com' // 本地测试
// cur_icon = {uri: global_domain_config+cur_icon[0]} // 测试
if (cur_icon.length === 0) {
cur_icon = require('../../../images/not_img.png')
} else {
cur_icon = { uri: global_domain_config + '/jeecg-boot/sys/common/view/' + cur_icon[0] } // 正式
cur_icon = { uri: global_domain_config + '/jeecg-boot/sys/common/view/' + cur_icon[0] }
}
}
return <View style={styles.card_list_box} key={'choose_card' + index}>
......
......@@ -37,9 +37,6 @@ class LoadingModel extends Component {
render() {
let { title, size, color, style_back } = this.props
// console.log('==aaa=LoadingModel===', this.state.isVisible)
return (
<View style={styles.container}>
<Modal
......
import React, { Component } from 'react';
import { StyleSheet, Image, TouchableOpacity, View, Modal, ActivityIndicator, Text, SafeAreaView } from 'react-native';
import { font_family_medium, font_family_regular, Height, icon_style, pxSize, second_text_color, second_text_size, Width } from '../../../base/BaseStyle';
import { AsteriskTextStyle, CellTextStyle, ContInputTextStyle, ContTextStyle, ImageTextStyle, TitleTextStyle } from '../CellTextStyle';
import { StyleSheet, Image, TouchableOpacity, View } from 'react-native';
import { font_family_regular, icon_style, pxSize, second_text_color, second_text_size } from '../../../base/BaseStyle';
import { AsteriskTextStyle, CellTextStyle, ContInputTextStyle, ContTextStyle, TitleTextStyle } from '../CellTextStyle';
const PropTypes = require('prop-types');
/**
......
import React, { Component } from 'react';
import { StyleSheet, Image, Text, TouchableOpacity, View } from 'react-native';
import { connect } from 'react-redux';
import { first_text_color, font_family_light, font_family_medium, font_family_regular, font_family_semibold, home_background_color, icon_style, promary_text_color, pxSize, second_text_size, third_text_color, third_text_size } from '../../../base/BaseStyle';
import { first_text_color, font_family_medium, font_family_regular, font_family_semibold, home_background_color, icon_style, pxSize, second_text_size, third_text_color, third_text_size } from '../../../base/BaseStyle';
import PictureZoom from '../../common/listDataComponent/PictureZoom';
const PropTypes = require('prop-types');
/**
* 列表组件,图片-标题(提示)-计算/关闭
*/
class PicTitDetaiCalcu extends Component {
static propTypres = {
......@@ -29,7 +32,6 @@ class PicTitDetaiCalcu extends Component {
listStyleImg: PropTypes.objec,
plusCallBack: PropTypes.func, // 加法的回调函数
reduceCallBack: PropTypes.func, // 减法的回调函数
// listShowChildNum: PropTypes.string, // 已选展示的子类数量,标题显示父级标题
showClearIcon: PropTypes.bool, // 展示减少x图标,不展示加减
showClearIndex: PropTypes.number, // 展示index
listCardActIndex: PropTypes.number, // 父级index = 展示index
......@@ -38,7 +40,6 @@ class PicTitDetaiCalcu extends Component {
onlyShowNum: PropTypes.bool, // 只展示数字
onlyShowSelect: PropTypes.bool, // 只能单选
listMaxNum: PropTypes.number, // 数量限制最大值
listShowNoData: PropTypes.bool, // 展示暂无数据
}
constructor(props) {
......@@ -49,11 +50,6 @@ class PicTitDetaiCalcu extends Component {
}
}
// // 清空图标
// handelClearCheck(item, index) {
// reduceCallBack(item, index)
// }
// 单选点击
handelSelectCheck(item, index) {
item.select = !!!item.select
......@@ -69,16 +65,13 @@ class PicTitDetaiCalcu extends Component {
handelCalculation(item, index, isPlus) {
let { calField, plusCallBack, reduceCallBack } = this.props
if (!isPlus && reduceCallBack) {
// console.log('减法回调======')
reduceCallBack(item, index)
return
}
if (isPlus && plusCallBack) {
// console.log('加法回调======', item, index)
plusCallBack(item, index)
return
}
// console.log('加减======', item, index, isPlus)
item[calField] = Number(item[calField])
if (Number.isNaN(item[calField])) {
item[calField] = 0
......@@ -95,7 +88,7 @@ class PicTitDetaiCalcu extends Component {
let { listItem, listIndex, calField, listStyleBox, listStyleTit, listStyleTip, listStyleCalBtn, listPicType, titCallBack,
titText, tipTextStr, tipTextOne, tipTextTwo, listImgIcon, listStyleImg, showClearIcon, showClearIndex, listCardActIndex,
listStyleClearBtn, clearCallBack, onlyShowNum, onlyShowSelect, tipTextStrTit, tipTextOneTit, tipTextTwoTit,
global_domain_config, listMaxNum, listShowNoData } = this.props
global_domain_config, listMaxNum } = this.props
let { listPicTypeArr, picStyleArr } = this.state
let picOthStyle = ''
......@@ -117,94 +110,85 @@ class PicTitDetaiCalcu extends Component {
}
let cur_photos = []
if (listItem[listImgIcon] instanceof Array) {
// global_domain_config = 'https://obs.uat.sfrx.guke.tech' // 本地测试
listItem[listImgIcon].map((iconIt) => {
// cur_photos.push({ url: global_domain_config + iconIt}) // 测试
cur_photos.push({ url: global_domain_config + '/jeecg-boot/sys/common/view/' + iconIt }) // 正式
cur_photos.push({ url: global_domain_config + '/jeecg-boot/sys/common/view/' + iconIt })
})
}
// console.log('每一列----',cur_photos)
return (
<View>
<View style={[styles.ri_inner, listStyleBox]}>
{(listImgIcon && cur_photos.length > 0) ?
<PictureZoom
listImageIndex={0}
listImageUrls={cur_photos}
listStyleImage={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}
listPicType={listPicType}
/>
: null}
<View style={styles.ri_text_box}>
<TouchableOpacity
activeOpacity={titCallBack ? .8 : 1}
onPress={() => { titCallBack ? titCallBack(listItem, listIndex) : {} }}
style={styles.oth_box}
>
<Text numberOfLines={1} style={[styles.thr_ot, listStyleTit]}>
{listItem[titText]}
</Text>
{listItem[tipTextStr] ? <Text numberOfLines={1} style={[styles.ri_te_ot, styles.te_ot_str, listStyleTip]}>
{tipTextStrTit ? `${tipTextStrTit}:` : ''}{listItem[tipTextStr]}
</Text> : null}
{listItem[tipTextOne] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>
{tipTextOneTit ? `${tipTextOneTit}:` : ''}{listItem[tipTextOne]}
</Text> : null}
{listItem[tipTextTwo] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>
{tipTextTwoTit ? `${tipTextTwoTit}:` : ''}{listItem[tipTextTwo]}
</Text> : null}
</TouchableOpacity>
</View>
{
listShowNoData ? <Text>暂无数据</Text> :
<View style={[styles.ri_inner, listStyleBox]}>
{(listImgIcon && cur_photos.length > 0) ?
<PictureZoom
listImageIndex={0}
listImageUrls={cur_photos}
listStyleImage={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}
listPicType={listPicType}
/>
: null}
<View style={styles.ri_text_box}>
(showClearIcon && listCardActIndex === showClearIndex) ?
<View style={styles.btn_cle_box}>
<TouchableOpacity
activeOpacity={.9}
style={[styles.btn_clear_inner, listStyleClearBtn]}
onPress={() => clearCallBack(listItem, listIndex)}
>
<View style={[styles.icon_cle_btn]}>
<Image source={require('../../../images/close_icon.png')} style={icon_style}></Image>
</View>
</TouchableOpacity>
</View> :
<View style={[styles.ri_num_box, onlyShowNum ? styles.show_num_box : null]}>
{(listItem[calField] !== 0 && !onlyShowNum && !onlyShowSelect) ?
<TouchableOpacity
activeOpacity={titCallBack ? .8 : 1}
onPress={() => { titCallBack ? titCallBack(listItem, listIndex) : {} }}
style={styles.oth_box}
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex)}
>
<Text numberOfLines={1} style={[styles.thr_ot, listStyleTit]}>
{listItem[titText]}
</Text>
{listItem[tipTextStr] ? <Text numberOfLines={1} style={[styles.ri_te_ot, styles.te_ot_str, listStyleTip]}>
{tipTextStrTit ? `${tipTextStrTit}:` : ''}{listItem[tipTextStr]}
</Text> : null}
{listItem[tipTextOne] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>
{tipTextOneTit ? `${tipTextOneTit}:` : ''}{listItem[tipTextOne]}
</Text> : null}
{listItem[tipTextTwo] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>
{tipTextTwoTit ? `${tipTextTwoTit}:` : ''}{listItem[tipTextTwo]}
</Text> : null}
</TouchableOpacity>
</View>
{
(showClearIcon && listCardActIndex === showClearIndex) ?
<View style={styles.btn_cle_box}>
<TouchableOpacity
activeOpacity={.9}
style={[styles.btn_clear_inner, listStyleClearBtn]}
onPress={() => clearCallBack(listItem, listIndex)}
>
<View style={[styles.icon_cle_btn]}>
<Image source={require('../../../images/close_icon.png')} style={icon_style}></Image>
</View>
</TouchableOpacity>
</View> :
<View style={[styles.ri_num_box, onlyShowNum ? styles.show_num_box : null]}>
{(listItem[calField] !== 0 && !onlyShowNum && !onlyShowSelect) ?
<TouchableOpacity
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex)}
>
<View style={[styles.thr_num_btn, styles.thr_btn_left]}>
<Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image>
</View>
</TouchableOpacity> : null}
{(listItem[calField] !== 0 && !onlyShowSelect) ? <Text style={[styles.thr_num, onlyShowNum ? styles.show_num : null]}>{listItem[calField]}</Text> : null}
{(!onlyShowNum && !onlyShowSelect && showPlusIcon) ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex, true)}
>
<View style={[styles.thr_num_btn, styles.thr_btn_right]}>
<Image source={calIcon} style={icon_style}></Image>
</View>
</TouchableOpacity> : null}
{onlyShowSelect ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_sel_inner]}
onPress={() => this.handelSelectCheck(listItem, listIndex)}
>
<View style={[styles.thr_sel_btn]}>
<Image source={defSelIcon} style={icon_style}></Image>
</View>
</TouchableOpacity> : null
}
<View style={[styles.thr_num_btn, styles.thr_btn_left]}>
<Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image>
</View>
</TouchableOpacity> : null}
{(listItem[calField] !== 0 && !onlyShowSelect) ? <Text style={[styles.thr_num, onlyShowNum ? styles.show_num : null]}>{listItem[calField]}</Text> : null}
{(!onlyShowNum && !onlyShowSelect && showPlusIcon) ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex, true)}
>
<View style={[styles.thr_num_btn, styles.thr_btn_right]}>
<Image source={calIcon} style={icon_style}></Image>
</View>
</TouchableOpacity> : null}
{onlyShowSelect ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_sel_inner]}
onPress={() => this.handelSelectCheck(listItem, listIndex)}
>
<View style={[styles.thr_sel_btn]}>
<Image source={defSelIcon} style={icon_style}></Image>
</View>
</TouchableOpacity> : null
}
</View>
}
......@@ -273,7 +257,6 @@ const styles = StyleSheet.create({
btn_sel_inner: {},
btn_cle_box: {
marginRight: 6,
// backgroundColor: 'red',
paddingHorizontal: 4,
paddingVertical: 4
},
......
import React, { Component } from 'react';
import { StyleSheet, Image, TouchableOpacity, View, Modal, ActivityIndicator, Text } from 'react-native';
import { font_family_medium, Height, icon_style, pxSize, second_text_size, Width } from '../../../base/BaseStyle';
import { font_family_medium, Height, icon_style, pxSize, second_text_size } from '../../../base/BaseStyle';
import ImageViewer from 'react-native-image-zoom-viewer';
const PropTypes = require('prop-types');
......@@ -131,7 +131,6 @@ const styles = StyleSheet.create({
marginBottom: (Height() / 2) - 40
},
top_indic: {
// backgroundColor: 'hsla(0, 0%, 100%, .2)',
position: 'absolute',
top: 50,
left: '46%'
......
......@@ -94,12 +94,9 @@ class TipInfoNeedSelect extends Component {
transparent={true}
visible={this.state.isVisible}
animationType={'fade'}
// onRequestClose={() => this.closeModal()}
>
<View style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1}
// onPress={() => this.closeModal()}
>
<TouchableOpacity style={styles.container} activeOpacity={1}>
{this.renderDialog()}
</TouchableOpacity>
</View>
......
import React, { Component } from 'react';
import { View, Text, SafeAreaView, StyleSheet, TouchableOpacity, Image, ScrollView, TextInput, Alert, Linking, NativeModules, Platform, DeviceEventEmitter } from 'react-native';
import { View, Text, SafeAreaView, StyleSheet, TouchableOpacity, Image, ScrollView, TextInput, Alert, Linking, NativeModules, Platform } from 'react-native';
import { connect } from 'react-redux';
import { home_background_color, placehold_text_color, promary_color, safe_view, icon_style, list_common_item } from '../../base/BaseStyle';
import { ImageTextStyle, CellTextStyle, FooterBtnStyle } from '../common/CellTextStyle';
......@@ -15,20 +15,14 @@ import { requestSelfOrganizations, requestSelfSurgeryHospital, requestSelfOrderT
import { exitLoginStatus } from '../../action/LoginAction';
import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE, LOGIN_NO, SELF_SUBMIT_DOING, SELF_SUBMIT_SUCCESS, SELF_SUBMIT_FAILURE } from '../../base/ActionTypes';
import PageListArrow from '../common/listDataComponent/PageListArrow';
import EmitterEvents from '../common/EmitterEvents';
import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect';
import LocalVariable from '../common/LocalVariable';
import LoadingModel from '../common/listDataComponent/LoadingModel';
// const SELECTED_QUQNTITY = 'selectedQuantity'
// const SELECTED_DATA_ARR = 'selectedDataArr'
// const QUANTITY_FIELD = 'quantity' // 计算的字段
class SelfOrderPage extends Component {
constructor(props) {
super(props);
this.state = {
canSubFlag: false, // 生成订单按钮样式改变
canSubFlag: false, // 提交按钮样式
listOptionData: [
{
"id": "0",
......@@ -116,7 +110,7 @@ class SelfOrderPage extends Component {
isRecode: true // 录音
}
],
subInitListOption: [], // 提交成功后,初始化当前数据
subInitListOption: [], // 存储最初数据
submitOption: { // 提交的信息
seller_code: '', // 用户名username
org_code: '', // 组织
......@@ -147,29 +141,20 @@ class SelfOrderPage extends Component {
dateModelPop: false, // 日期选择器
hasPermission: undefined, //录音 授权状态
audioPath: AudioUtils.DocumentDirectoryPath + `/self_audio_${new Date().getTime()}.aac`, // 文件路径
recording: false, //是否录音
pause: false, //录音是否暂停
stop: false, //录音是否停止
currentTime: 0, //录音时长
localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生
local_tip: {
replace_item_flag: 'N', // 器械包
take_cert_flag: 'N' // 合格证
}
}
}
componentDidMount() {
this.getSellerName()
this.getAudioAuthorize()
// this.subscription = DeviceEventEmitter.addListener(EmitterEvents.BACK_TO_SELF_PAGE, (params) => this.productCallBack(params))
}
componentWillUnmount() {
this.props.setSelectProductOpts([])
// this.subscription.remove()
}
// 赋值销售员 初始化数据
......@@ -195,7 +180,6 @@ class SelfOrderPage extends Component {
.then(isAuthor => {
console.log('是否授权: ' + isAuthor)
if (!isAuthor) {
// return alert('APP需要使用录音,请打开录音权限允许APP使用')
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
text: '设置',
onPress: () => {
......@@ -252,27 +236,6 @@ class SelfOrderPage extends Component {
// 开始录音
_record = async () => {
console.log('开始录音==')
// show('录音开始')
// if(!this.state.hasPermission) {
// return alert('没有授权')
// }
// if(this.state.recording) {
// return alert('正在录音中...')
// }
// if(this.state.stop) {
// // 初始化录音
// this.prepareRecordingPath(this.state.audioPath)
// }
// this.setState({recording: true,pause: false})
// try {
// await AudioRecorder.startRecording()
// } catch (err) {
// console.log(err)
// }
if (!this.state.hasPermission) {
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
text: '设置',
......@@ -289,7 +252,6 @@ class SelfOrderPage extends Component {
}, {
text: '取消',
}])
// return
}
show('录音开始')
if (this.state.stop) {
......@@ -305,10 +267,8 @@ class SelfOrderPage extends Component {
// 停止录音
_stop = async () => {
console.log('----停止录音---', this.state.hasPermission)
if (!this.state.hasPermission) {
return
// return alert('没有授权')
}
show('录音结束')
try {
......@@ -317,15 +277,6 @@ class SelfOrderPage extends Component {
} catch (error) {
console.log('stop record--error->', error);
}
// console.log('tanqi')
// show('录音结束')
// console.log('停止录音',this.state.currentTime)
// try {
// await AudioRecorder.stopRecording();
// this.setState({stop: true, recording: false, paused: false});
// } catch (error) {
// console.error(error);
// }
}
// 播放录音
......@@ -346,21 +297,6 @@ class SelfOrderPage extends Component {
}
})
})
// let self = this
// self.whoosh = new Sound(this.state.audioPath, '', (err) => {
// if(err) {
// show('加载音频失败')
// return console.log(err)
// }
// self.whoosh.play(success => {
// if(success) {
// console.log('success - 播放成功')
// }else {
// console.log('fail - 播放失败')
// show('播放失败')
// }
// })
// })
}
// 删除录音
......@@ -377,7 +313,7 @@ class SelfOrderPage extends Component {
}
componentWillReceiveProps(nextProps) {
let { self_list_status, loginState, navigation, submit_self_order_status, local_sele_pro_options } = this.props
let { self_list_status, loginState, navigation, submit_self_order_status } = this.props
let that = this
if (self_list_status != nextProps.self_list_status) {
switch (nextProps.self_list_status) {
......@@ -418,10 +354,8 @@ class SelfOrderPage extends Component {
isSubLoding: false,
lodingTitle: '提交中'
}, () => {
console.log('SELF_SUBMIT_SUCCESS===', that.state.isSubLoding)
that.processReturnData()
})
// that.processReturnData()
break;
case SELF_SUBMIT_FAILURE:
that.changeSubLoding(false, '提交中')
......@@ -430,12 +364,6 @@ class SelfOrderPage extends Component {
break;
}
}
// console.log('哈哈哈哈😄=====', nextProps.local_sele_pro_options)
// console.log('哈哈哈哈😄=====', local_sele_pro_options)
// if(nextProps.local_sele_pro_options){
// that.productCallBack(nextProps.local_sele_pro_options)
// }
}
// 修改正在加载
......@@ -484,7 +412,6 @@ class SelfOrderPage extends Component {
&& !listOptionData[chIndex].value
&& listOptionData[chIndex].name !== '其他') {
// 不是主治医生
console.log('tempTit--', tempTit)
tempTit = listOptionData[chIndex].title
tempStatus = true
break
......@@ -500,7 +427,6 @@ class SelfOrderPage extends Component {
// 选择器弹窗回调函数
handleCallBack(item, itemTitle) {
// console.log('选择器弹窗回调函数-----',itemTitle)
let { listOptionData } = this.state
let self = this
listOptionData.map(function (chItem, index) {
......@@ -839,7 +765,6 @@ class SelfOrderPage extends Component {
this.setState({
listOptionData: listOptionData
})
console.log('主治医生---', text, curData, listOptionData[5])
}
// 手术名称 输入
......@@ -853,12 +778,10 @@ class SelfOrderPage extends Component {
this.setState({
listOptionData: listOptionData
})
console.log('手术名称---', text, curData, listOptionData[6])
}
// 手术时间 点击 2020-04-23 17:41
handleSurDateCheck(curData) {
console.log('手术时间 点击 ===', curData)
let { listOptionData } = this.state
let date = curData.value
if (date) {
......@@ -883,7 +806,6 @@ class SelfOrderPage extends Component {
// 修改当前日期数据
dateModalCallback(date, curData) {
console.log('修改当前日期数据:', date, curData)
let { listOptionData } = this.state
listOptionData.map(function (item) {
if (item.title === curData.title) {
......@@ -895,7 +817,6 @@ class SelfOrderPage extends Component {
this.setState({
listOptionData: listOptionData
})
console.log('修改当前日期数据-----', listOptionData[7])
}
// 手术类型 点击
......@@ -921,7 +842,7 @@ class SelfOrderPage extends Component {
// 订单类型 点击
handleOrderCheck(curData) {
let { state, props } = this
let { props } = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({
currentTitle: curData.title,
......@@ -930,7 +851,6 @@ class SelfOrderPage extends Component {
value: curData.value
}
}, () => {
// 在此修改接口
let params = {
access_token: props.token,
value_set_code: 'SUR_ORDER_TYPE'
......@@ -958,14 +878,11 @@ class SelfOrderPage extends Component {
// 选择产品 回调
productCallBack(params) {
let { listOptionData } = this.state
console.log('哈哈哈哈😄=====')
console.log('选择产品返回=!!!!=', params)
listOptionData[10].name = '请选择'
listOptionData[10].value = ''
listOptionData[10].lines = []
// let cur_params = params.local_lines
let cur_params = params
if (params && cur_params) {
if (cur_params && cur_params.length > 0) {
cur_params.forEach(loc_item => {
if (loc_item[LocalVariable.SELECTED_QUQNTITY] > 0) {
listOptionData[10].value += `【${loc_item.supplier_short_name}】`
......@@ -976,8 +893,6 @@ class SelfOrderPage extends Component {
listOptionData[10].lines = cloneObject(cur_params)
}
}
console.log('选择产品返回=!!!=', listOptionData[10])
this.setState({
listOptionData: listOptionData
}, () => {
......@@ -996,12 +911,10 @@ class SelfOrderPage extends Component {
this.setState({
listOptionData: listOptionData
})
console.log('备注---', listOptionData[11])
}
// 生成订单 点击
async handleSubmit() {
console.log('生成订单')
this.changeCanSub(true)
let { state, props } = this
let that = this
......@@ -1074,41 +987,30 @@ class SelfOrderPage extends Component {
access_token: props.token,
data: { ...tempSubOption }
}
console.log('submitSelfOrder!!!!', params)
// this.processReturnData() // 测试
props.requestSelfSumbit(params) // 正式
console.log('params=', params)
props.requestSelfSumbit(params)
}
// 获取选择产品提交接口需要的数据
// 处理选择产品数据为提交接口需要的格式
getSumLinesOps() {
let { listOptionData } = this.state
// 修改提交的行数据
let local_lines = cloneObject(listOptionData[10].lines)
let res_lines = []
console.log('提交==', local_lines)
let showPackageTip = false
local_lines.forEach(sup_item => {
if (sup_item[LocalVariable.SELECTED_QUQNTITY] > 0 && sup_item.leftOptionList && sup_item.leftOptionList.length > 0) {
sup_item.leftOptionList.map(lef_item => {
let select_arr = lef_item[LocalVariable.SELECTED_DATA_ARR]
if (lef_item[LocalVariable.SELECTED_QUQNTITY] > 0 && select_arr && select_arr.length > 0) {
// console.log('lef_item.category_code--', lef_item.category_code)
if (lef_item.category_code === LocalVariable.SURGICAL_TEMPLATE) {
// 手术模板
select_arr.forEach(sel_item => {
let template_number = sel_item.template_number
// sel_item.childrenLineData[0].lineOptions[0][LocalVariable.SELECTED_DATA_ARR]
if (sel_item[LocalVariable.CHILDREN_LINE_NAME] && sel_item[LocalVariable.CHILDREN_LINE_NAME].length > 0) {
sel_item[LocalVariable.CHILDREN_LINE_NAME].forEach(chi_item => {
if (chi_item[LocalVariable.LINE_OPTIONS] && chi_item[LocalVariable.LINE_OPTIONS].length > 0) {
chi_item[LocalVariable.LINE_OPTIONS].forEach(lin_item => {
if (lin_item[LocalVariable.SELECTED_DATA_ARR] && lin_item[LocalVariable.SELECTED_DATA_ARR].length > 0) {
lin_item[LocalVariable.SELECTED_DATA_ARR].forEach(sel_item => {
sel_item['template_number'] = template_number
......@@ -1120,10 +1022,7 @@ class SelfOrderPage extends Component {
}
})
}
})
} else if (lef_item.category_code === LocalVariable.NAIL_BOX || lef_item.category_code === LocalVariable.EQUIPMENT_BAG) {
// 钉盒/器械包
if (lef_item.category_code === LocalVariable.EQUIPMENT_BAG) {
......@@ -1134,7 +1033,6 @@ class SelfOrderPage extends Component {
sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item)
})
}
else if (lef_item.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
// 零散器械
......@@ -1167,18 +1065,7 @@ class SelfOrderPage extends Component {
})
}
})
console.log('提交==', res_lines)
let test_sum_num = 0
res_lines.map(line => {
test_sum_num += line[LocalVariable.PLAN_QUANTITY]
})
console.log('提交==', test_sum_num)
console.log('提交==', showPackageTip)
console.log('提交==', listOptionData[10].lines)
listOptionData[10].sub_lines = res_lines
if (showPackageTip) {
this.refs.PackageModel.show()
} else {
......@@ -1186,8 +1073,6 @@ class SelfOrderPage extends Component {
}
}
// 判断组织是否为空
judgeOrgIsNull() {
let { listOptionData } = this.state
......@@ -1214,7 +1099,6 @@ class SelfOrderPage extends Component {
processReturnData() {
let { selfOrderOption } = this.props
let that = this
console.log('selfOrderOption----!!!!', selfOrderOption)
that.setState({
isSubLoding: false
})
......@@ -1224,7 +1108,6 @@ class SelfOrderPage extends Component {
let { state: { params: { title } } } = that.props.navigation
that.props.navigation.navigate('SubSuccPage', {
title: `${title} - 提交成功`,
// orderNumber: 'TS_11001100100110' // 测试
orderNumber: selfOrderOption.order_number
})
}
......@@ -1233,29 +1116,25 @@ class SelfOrderPage extends Component {
clearAllData() {
let { props } = this
let { listOptionData, subInitListOption } = this.state
props.setSelfInitData() // 清空缓存数据
listOptionData = cloneObject(subInitListOption) // 清空本地数据
props.setSelfInitData()
listOptionData = cloneObject(subInitListOption)
this.setState({
listOptionData,
currentTime: 0, // 清除语音
currentTime: 0,
stop: false
})
}
// 提交的提示回调函数
modelPackageCertCB(typeName, nowVal) {
let { local_tip, listOptionData } = this.state
let { listOptionData } = this.state
listOptionData[10][typeName] = nowVal
// local_tip[typeName] = nowVal
this.setState({
listOptionData: listOptionData
// local_tip: local_tip
})
console.log('modelPackageCertCB---', listOptionData[10])
if (typeName === 'replace_item_flag') {
this.refs.CertModel.show('需要携带注册证?')
} else {
console.log('请求提交====')
this.submitSelfOrder()
}
}
......@@ -1375,11 +1254,9 @@ class SelfOrderPage extends Component {
show={dateModelPop}
callback={(date) => this.dateModalCallback(date, listOptionData[7])}
/>
{ this.renderPickerModel()}
{ this.renderTipModelPackage()}
{ this.renderTipModelCert()}
</View>
)
}
......@@ -1493,13 +1370,6 @@ class SelfOrderPage extends Component {
)
}
// 返回正在加载中 -- 新
renderLodingItemNew() {
return (
<LoadingModel ref="LoadingModel" />
)
}
// 返回提交器械包提示
renderTipModelPackage() {
return (
......@@ -1546,8 +1416,6 @@ class SelfOrderPage extends Component {
{this.renderLodingItem()}
{this.renderLodingItemNew()}
</SafeAreaView>
</View>
);
......
import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput, DeviceEventEmitter, SafeAreaView } from 'react-native';
import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput, SafeAreaView } from 'react-native';
import { connect } from 'react-redux';
import { foundation_color, home_background_color, Width, third_text_size, pxSize, promary_color, safe_view, font_family_regular, icon_style, title_text_color, font_family_medium, list_common_item, point_color } from '../../../base/BaseStyle';
import HeadBackItem from '../../common/HeadBackItem';
......@@ -9,18 +9,9 @@ import StatusBarView from '../../common/StatusBarView';
import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import { cloneObject, show } from '../../../utils/Utils';
import { reqPurSupplierSearch, reqProCategorySearch, reqSurTempHeadSearch, reqNailEquipHeadSearch, reqScatEquipmentSearch, reqSingleConsumSearch, setSelectProductOpts } from '../../../action/SelfAction';
import EmitterEvents from '../../common/EmitterEvents';
import LoadingModel from '../../common/listDataComponent/LoadingModel';
import LocalVariable from '../../common/LocalVariable';
// const QUANTITY_FIELD = 'quantity' // 计算的字段
// const CHILDREN_LINE_NAME = 'childrenLineData' // 显示的子类数组名称
// const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
// const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
// const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
// const ONLY_TWO_LEVELS = 'onlyTwoLevels' // 只有两级的耗材
class ChooseProductPage extends Component {
constructor(props) {
super(props);
......@@ -29,24 +20,22 @@ class ChooseProductPage extends Component {
topActiveIndex: 0,
topProcOptionList: [], // 顶部厂家信息
leftActiveIndex: 0,
rightSecondData: [],
leftOptionList: [], // 左侧分类数据
defaultThridShow: false, // 默认人体髋关节-小类不显示
defaultThridShow: false, // 默认耗材-小类不显示
selectShowPopup: false, // 共计已选弹窗
defalutLeftItem: [{
"category_code": "surg_temp",
"category_code": LocalVariable.SURGICAL_TEMPLATE,
"category_name": "手术模板",
"cate_local_icon": require('../../../images/surg_temp.png')
}, {
"category_code": "screw_box",
"category_code": LocalVariable.NAIL_BOX,
"category_name": "钉盒",
"cate_local_icon": require('../../../images/screw_box.png')
}, {
"category_code": "equip_bag",
"category_code": LocalVariable.EQUIPMENT_BAG,
"category_name": "器械包",
"cate_local_icon": require('../../../images/equip_bag.png')
}, {
"category_code": "auxili_tool",
"category_code": LocalVariable.SCATTERED_EQUIPMENT,
"category_name": "零散器械",
"cate_local_icon": require('../../../images/auxili_tool.png')
}]
......@@ -62,8 +51,6 @@ class ChooseProductPage extends Component {
let { topProcOptionList } = this.state
let { setSelectProductOpts } = this.props
setSelectProductOpts(topProcOptionList)
// 并且=======调用返回
// DeviceEventEmitter.emit(EmitterEvents.BACK_TO_SELF_PAGE, { local_lines: topProcOptionList })
this.props.navigation.state.params.productCallBack(topProcOptionList)
this.props.navigation.goBack()
}
......@@ -72,11 +59,6 @@ class ChooseProductPage extends Component {
async initGetData() {
let that = this
let { token, global_domain_config, navigation, local_sele_pro_options } = that.props
// 判断 local_sele_pro_options 是否有值
// 进行本地转换
console.log('local_sele_pro_options====有值吗====>', local_sele_pro_options)
if (local_sele_pro_options && local_sele_pro_options.length > 0) {
// 之前选择过值
that.setState({
......@@ -84,9 +66,6 @@ class ChooseProductPage extends Component {
})
return
}
console.log('local_sele_pro_options====有值吗====>')
that.refs.LoadingModel.show()
let cur_org_code = ''
if (navigation.state.params.selfData) {
......@@ -97,25 +76,31 @@ class ChooseProductPage extends Component {
org_code: cur_org_code,
supplier_type: 'MANUFACTURER' // 供应商
}
console.log('params=', params)
let pur_sup_search = await reqPurSupplierSearch(global_domain_config, params)
console.log('res_1 : ', pur_sup_search)
if (pur_sup_search.error_code === 0) {
let { data } = pur_sup_search
let { topProcOptionList } = that.state
topProcOptionList = cloneObject(data)
topProcOptionList.forEach(function (topObj) {
topObj[LocalVariable.SELECTED_QUQNTITY] = 0
topObj['leftOptionList'] = []
if (!topObj['supplier_short_name']) {
topObj.supplier_short_name = topObj.supplier_name.substring(0, 3)
}
})
that.setState({
topProcOptionList
}, () => {
that.refs.LoadingModel.hide()
that.handleTopNav(topProcOptionList[0], 0)
})
if (data.length > 0) {
topProcOptionList = cloneObject(data)
topProcOptionList.forEach(function (topObj) {
topObj[LocalVariable.SELECTED_QUQNTITY] = 0
topObj['leftOptionList'] = []
if (!topObj['supplier_short_name']) {
topObj.supplier_short_name = topObj.supplier_name.substring(0, 3)
}
})
that.setState({
topProcOptionList
}, () => {
that.refs.LoadingModel.hide()
that.handleTopNav(topProcOptionList[0], 0)
})
} else {
this.refs.LoadingModel.hide()
show('厂家数据为空,请联系管理员配置!')
}
} else {
that.showRrrorTip(pur_sup_search)
}
......@@ -123,7 +108,6 @@ class ChooseProductPage extends Component {
// 顶部产品点击,获取左侧数据
async handleTopNav(topItem, topIndex) {
console.log('top产品--', topItem, topIndex)
let that = this
let { token, global_domain_config } = that.props
let { topProcOptionList, defalutLeftItem } = this.state
......@@ -132,11 +116,10 @@ class ChooseProductPage extends Component {
access_token: token,
manufacturer_code: topItem.supplier_code,
}
console.log('params====', params)
console.log('params=', params)
let pro_scate_search = await reqProCategorySearch(global_domain_config, params)
console.log('res_2 : ', pro_scate_search)
if (pro_scate_search.error_code === 0) {
if (topItem[LocalVariable.SELECTED_QUQNTITY] === 0) {
let { data } = pro_scate_search
topItem.leftOptionList = defalutLeftItem.concat(data.item)
......@@ -146,7 +129,6 @@ class ChooseProductPage extends Component {
})
topProcOptionList[topIndex] = topItem
}
that.setState({
topActiveIndex: topIndex,
topProcOptionList: topProcOptionList
......@@ -154,23 +136,9 @@ class ChooseProductPage extends Component {
that.refs.LoadingModel.hide()
that.handleLeftNav(topItem['leftOptionList'][0], 0)
})
} else {
topItem.leftOptionList = defalutLeftItem
topProcOptionList[topIndex] = topItem
that.setState({
topActiveIndex: topIndex,
topProcOptionList: topProcOptionList
}, () => {
that.handleLeftNav(topItem['leftOptionList'][0], 0)
})
that.showRrrorTip(pro_scate_search)
}
// this.setState({
// topActiveIndex: topIndex,
// // leftOptionList: cloneObject(localMockData.localLeftOption)
// })
}
// 左侧标题点击
......@@ -178,7 +146,6 @@ class ChooseProductPage extends Component {
let that = this
let { topProcOptionList, topActiveIndex } = that.state
let { token, global_domain_config, navigation } = that.props
console.log('左侧标题--', topActiveIndex, leftItem, leftIndex)
if (leftItem[LocalVariable.SELECTED_QUQNTITY] !== 0) {
that.setState({
leftActiveIndex: leftIndex
......@@ -197,7 +164,7 @@ class ChooseProductPage extends Component {
org_code: cur_org_code,
manufacturer_code: topItem.supplier_code,
}
console.log('params-', params)
console.log('params=', params)
let sur_head_search = await reqSurTempHeadSearch(global_domain_config, params)
console.log('res_3 : ', sur_head_search)
if (sur_head_search.error_code === 0) {
......@@ -247,6 +214,7 @@ class ChooseProductPage extends Component {
let params = {
access_token: token
}
console.log('params=', params)
let scat_head_search = await reqScatEquipmentSearch(global_domain_config, params)
console.log('res_3 : ', scat_head_search)
if (scat_head_search.error_code === 0) {
......@@ -269,14 +237,13 @@ class ChooseProductPage extends Component {
access_token: token,
category_code: leftItem.category_code,
manufacturer_code: topItem.supplier_code,
org_code: cur_org_code,
leftIndex: leftIndex, // 本地测试
org_code: cur_org_code
}
console.log('params=', params)
let single_all_search = await reqSingleConsumSearch(global_domain_config, params)
console.log('res_3 : ', single_all_search, leftIndex, leftIndex % 2)
if (single_all_search.error_code === 0) {
let { data } = single_all_search
console.log('data : ', data, data.items)
if (data && data.items) {
//大-中-小类
data.items = data.items.filter(fi_item => fi_item.details && fi_item.details.length > 0)
......@@ -290,13 +257,6 @@ class ChooseProductPage extends Component {
})
}
})
// topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem)
// that.setState({
// leftActiveIndex: leftIndex,
// topProcOptionList: topProcOptionList
// }, () => {
// that.refs.LoadingModel.hide()
// })
} else if (data && data.details) {
//大-小类
leftItem[LocalVariable.LOCAL_SECOND_DATA] = cloneObject(data.details)
......@@ -304,23 +264,9 @@ class ChooseProductPage extends Component {
righDa[LocalVariable.ONLY_TWO_LEVELS] = true
righDa[LocalVariable.QUANTITY_FIELD] = 0 // 默认
})
// topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem)
// that.setState({
// leftActiveIndex: leftIndex,
// topProcOptionList: topProcOptionList
// }, () => {
// that.refs.LoadingModel.hide()
// })
} else {
// 空数据
leftItem.localSecondData = []
// topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem)
// that.setState({
// leftActiveIndex: leftIndex,
// topProcOptionList: topProcOptionList
// }, () => {
// that.refs.LoadingModel.hide()
// })
}
topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem)
that.setState({
......@@ -347,7 +293,7 @@ class ChooseProductPage extends Component {
return cloneObject(leftItem)
}
// 修改
// 修改小类回调
handleChangeThrShow(show) {
this.setState({
defaultThridShow: show
......@@ -356,14 +302,11 @@ class ChooseProductPage extends Component {
// 计算中级数量回调
handleChangeCount(count, coutFieName) {
let { leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex, defaultThridShow } = this.state
console.log('计算中级数量回调===', count, leftActiveIndex, defaultThridShow, coutFieName)
let { leftActiveIndex, topProcOptionList, topActiveIndex } = this.state
// 初始化
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0
topProcOptionList[topActiveIndex].leftOptionList[leftActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0
topProcOptionList[topActiveIndex].leftOptionList[leftActiveIndex][LocalVariable.SELECTED_DATA_ARR] = []
let top_sel_sum = 0
topProcOptionList[topActiveIndex].leftOptionList.map(function (leItem, leIndex) {
if (!leItem[LocalVariable.SELECTED_QUQNTITY]) {
......@@ -387,17 +330,13 @@ class ChooseProductPage extends Component {
top_sel_sum += leItem[LocalVariable.SELECTED_QUQNTITY]
})
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = top_sel_sum
// console.log('计算中级之后---', leftOptionList)
console.log('计算中级之后---', topProcOptionList)
this.setState({
// leftOptionList,
topProcOptionList
})
}
// 共计已选弹窗
// 关闭已选弹窗
handleCloseSelectModal(show) {
console.log('修改共计已选', show)
this.setState({
selectShowPopup: show
})
......@@ -405,7 +344,7 @@ class ChooseProductPage extends Component {
// 计算所有已选数量
getAllCountQuantity(tipFlag) {
let { topProcOptionList, topActiveIndex } = this.state
let { topProcOptionList } = this.state
let allCountQuantity = 0
let allTip = ''
if (!topProcOptionList.length) {
......@@ -424,14 +363,8 @@ class ChooseProductPage extends Component {
allTip += `${top_item.supplier_short_name}x${top_item[LocalVariable.SELECTED_QUQNTITY]} `
}
})
// topProcOptionList[topActiveIndex].leftOptionList.map(leItem => {
// if (!leItem[LocalVariable.SELECTED_QUQNTITY]) {
// leItem[LocalVariable.SELECTED_QUQNTITY] = 0
// }
// allCountQuantity += leItem[LocalVariable.SELECTED_QUQNTITY]
// })
console.log('allCountQuantity---', allCountQuantity, allTip)
if (tipFlag) {
// 返回提示信息
return allTip
}
return allCountQuantity
......@@ -450,9 +383,8 @@ class ChooseProductPage extends Component {
return curCountQuantity
}
// 点击共计已选
// 点击已选
handleSubSelected() {
// console.log('show-----', show)
let { selectShowPopup } = this.state
if (this.getAllCountQuantity() !== 0 && this.getCurCountSum() !== 0) {
this.handleCloseSelectModal(!selectShowPopup)
......@@ -461,15 +393,12 @@ class ChooseProductPage extends Component {
// 点击选好了
handleSubmit() {
console.log('选好了')
this.handleCloseSelectModal(false)
console.log('携带数据,返回到自助下单')
this.handleGoBack()
}
// 已选修改回调
handleSelectCallBack(options) {
// console.log('--已选修改回调--', options)
let { topProcOptionList, topActiveIndex } = this.state
topProcOptionList[topActiveIndex].leftOptionList = options
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0
......@@ -537,10 +466,9 @@ class ChooseProductPage extends Component {
)
}
// 返回顶部产品元素
// 返回顶部厂家
renderTopProItem() {
let { topProcOptionList, topActiveIndex } = this.state
console.log('返回顶部产品元素---', topProcOptionList)
let cur_title = 'title', cur_icon = 'iconImg'
cur_title = 'supplier_short_name'
cur_icon = 'supplier_icon'
......@@ -569,16 +497,13 @@ class ChooseProductPage extends Component {
)
}
// 返回底部左侧元素
// 返回左侧分类
renderContLeftItem() {
let { leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex } = this.state
let { leftActiveIndex, topProcOptionList, topActiveIndex } = this.state
let curLeftOptions = []
// curLeftOptions = leftOptionList
if (topProcOptionList.length > 0) {
curLeftOptions = topProcOptionList[topActiveIndex].leftOptionList
}
console.log('返回左侧元素---', curLeftOptions)
let cur_title = 'title', cur_icon = 'iconImg'
cur_title = 'category_name'
cur_icon = 'cate_local_icon'
......@@ -607,19 +532,12 @@ class ChooseProductPage extends Component {
)
}
// 返回右侧二级元素
// 返回右侧二级数据
renderContItem() {
let { leftOptionList, leftActiveIndex, defaultThridShow, topProcOptionList, topActiveIndex } = this.state
let { leftActiveIndex, defaultThridShow, topProcOptionList, topActiveIndex } = this.state
let curRigSecoOption = []
let curSuperLeftOption = []
// if(leftOptionList[leftActiveIndex]){
// curRigSecoOption = leftOptionList[leftActiveIndex][LocalVariable.LOCAL_SECOND_DATA] // 本地数据
// curSuperLeftOption = leftOptionList[leftActiveIndex]
// }
let topItem = topProcOptionList[topActiveIndex]
if (topItem && topItem.leftOptionList) {
let leftItem = topItem.leftOptionList[leftActiveIndex]
if (leftItem && leftItem[LocalVariable.LOCAL_SECOND_DATA]) {
......@@ -628,8 +546,6 @@ class ChooseProductPage extends Component {
}
}
// console.log('-返回右侧二级元素--curRigSecoOption', curRigSecoOption)
return (
<View style={styles.cont_bom_box}>
{ this.renderContLeftItem()}
......@@ -641,8 +557,6 @@ class ChooseProductPage extends Component {
superStencilData={curRigSecoOption}
superCallBack={(count, coutFieName) => this.handleChangeCount(count, coutFieName)}
superReduceBack={() => this.handleSubSelected()}
// thirdCallBack={(childData, superIndex) => this.handleChangeThird(childData, superIndex)}
// superLeftData={leftOptionList[leftActiveIndex]}
superLeftData={curSuperLeftOption}
/>
</View>
......@@ -654,24 +568,10 @@ class ChooseProductPage extends Component {
let { selectShowPopup, topProcOptionList, topActiveIndex } = this.state
let allCountQuantity = this.getAllCountQuantity()
let cur_sel_options = []
let sel_tip = ''
let sel_tip = this.getAllCountQuantity(true)
if (topProcOptionList.length > 0) {
// topProcOptionList.forEach(top_item => {
// if(top_item[LocalVariable.SELECTED_QUQNTITY] > 0){
// cur_sel_options.push(...top_item.leftOptionList)
// }
// })
cur_sel_options = topProcOptionList[topActiveIndex].leftOptionList
// cur_sel_options.forEach(cur_item => {
// if (cur_item[LocalVariable.SELECTED_QUQNTITY] > 0) {
// sel_tip += `${cur_item.category_name}x${cur_item[LocalVariable.SELECTED_QUQNTITY]} `
// }
// })
}
console.log('返回底部按钮😂----', cur_sel_options, sel_tip)
sel_tip = this.getAllCountQuantity(true)
return (
<View style={list_common_item.sub_box}>
......@@ -697,7 +597,6 @@ class ChooseProductPage extends Component {
<Text style={list_common_item.rig_tip}>{'选好了'}</Text>
</TouchableOpacity>
</View>
<ProductModel
show={selectShowPopup}
closeModal={(show) => this.handleCloseSelectModal(show)}
......@@ -706,13 +605,12 @@ class ChooseProductPage extends Component {
modelCallBack={(options) => this.handleSelectCallBack(options)}
clearRubbish={() => this.handleClearRubbish()}
/>
{ this.renderLodingItem()}
</View>
)
}
// 返回正在加载中
// 返回加载中
renderLodingItem() {
return (
<LoadingModel ref="LoadingModel" />
......
......@@ -2,10 +2,8 @@ import React, { Component } from 'react';
import { View, StyleSheet, SafeAreaView, ScrollView, FlatList, Text } from 'react-native';
import { connect } from 'react-redux';
import HeadBackItem from '../../common/HeadBackItem';
import { home_background_color, foundation_color, promary_color, third_text_color, first_text_color, second_text_size, Width, pxSize, safe_view, font_family_semibold, font_family_light, second_text_color, placehold_text_color, promary_shadow_color } from '../../../base/BaseStyle';
import {
FooterBtnStyle, PicListNoData
} from '../../common/CellTextStyle';
import { home_background_color, foundation_color, promary_color, third_text_color, first_text_color, second_text_size, Width, pxSize, safe_view, font_family_semibold, font_family_light } from '../../../base/BaseStyle';
import { FooterBtnStyle, PicListNoData } from '../../common/CellTextStyle';
import StatusBarView from '../../common/StatusBarView';
import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
......@@ -13,14 +11,8 @@ import PictureZoom from '../../common/listDataComponent/PictureZoom';
import { cloneObject, show } from '../../../utils/Utils';
import { reqSurTempLineSearch, reqNailBoxLineSearch, reqEquipPackageLineSearch } from '../../../action/SelfAction';
import LoadingModel from '../../common/listDataComponent/LoadingModel';
import localMockData from './mock/sen_mock';
import LocalVariable from '../../common/LocalVariable';
// const SELECTED_QUQNTITY = 'selectedQuantity' // 三级数量
// const SELECTED_DATA_ARR = 'selectedDataArr' // 三级已选元素
// const LOCAL_THRID_CONT_DATA = 'localThridContData' // 三级原本元素
// const QUANTITY_FIELD = 'quantity' // 计算的字段
class EditThirdLevelPage extends Component {
constructor(props) {
......@@ -31,18 +23,18 @@ class EditThirdLevelPage extends Component {
onlyShow: false, // 只展示
onlySignSelect: false, // 单选
defalutTopItem: [{ // 手术模板显示
"category_code": "sign_consu",
"category_code": LocalVariable.SIGN_SELECT_CONSUMABLES,
"category_name": "单选耗材"
}, {
"category_code": "screw_box",
"category_code": LocalVariable.NAIL_BOX,
"category_name": "钉盒",
"cate_local_icon": require('../../../images/screw_box.png')
}, {
"category_code": "equip_bag",
"category_code": LocalVariable.EQUIPMENT_BAG,
"category_name": "器械包",
"cate_local_icon": require('../../../images/equip_bag.png')
}, {
"category_code": "auxili_tool",
"category_code": LocalVariable.SCATTERED_EQUIPMENT,
"category_name": "零散器械",
"cate_local_icon": require('../../../images/auxili_tool.png')
}],
......@@ -51,35 +43,6 @@ class EditThirdLevelPage extends Component {
}
componentDidMount() {
// let {params} = this.props.navigation.state
// let that = this
// console.log('本地测试数据====localMockData===', localMockData)
// console.log('父组件传递的值==', params)
// // 赋值测试数据
// let curOptions = []
// if(params.superData.leftIndex === 1){
// // 钉盒
// curOptions = cloneObject(localMockData.localThridOption_dh)
// this.setState({
// onlyShow: params.superData.thirdShow,
// topProcOptionList: curOptions
// })
// }else if(params.superData.leftIndex === 2) {
// // 器械包
// curOptions = cloneObject(localMockData.localThridOption_qxb)
// this.setState({
// onlyShow: params.superData.thirdShow,
// topProcOptionList: curOptions
// })
// }else {
// curOptions = cloneObject(localMockData.localThridOption)
// this.setState({
// topProcOptionList: curOptions
// }, () => {
// that.setAllSelectData()
// })
// }
this.initGetData()
}
......@@ -89,9 +52,7 @@ class EditThirdLevelPage extends Component {
let { superData } = that.props.navigation.state.params
let { token, global_domain_config } = that.props
let { defalutTopItem, topProcOptionList } = that.state
let { leftIndex, superIndex, superItem, thirdShow } = superData
console.log('父组件传递的值==', leftIndex, superIndex, superItem, thirdShow)
let { leftIndex, superItem } = superData
that.refs.LoadingModel.show()
that.setState({
superData: cloneObject(superData)
......@@ -192,29 +153,10 @@ class EditThirdLevelPage extends Component {
}
// 修改列表计算后数据
// 计算后的回调
handleCalCallBack(item, index, dataName) {
let { topProcOptionList, topActiveIndex } = this.state
let { params } = this.props.navigation.state
let that = this
// console.log('修改列表计算后数据', item, index, dataName)
// console.log('修改列表计算后数据', topActiveIndex, topProcOptionList)
// console.log('父组件传递的值==', params.superData.leftIndex)
// if(params.superData.leftIndex === 2){
// topProcOptionList.map(function(topItem, topInd) {
// if(topInd === index){
// topItem = item
// }else {
// topItem.select = false // 初始化
// }
// })
// that.setState({
// topProcOptionList
// })
// console.log('设置当前所有已选值---', topProcOptionList)
// }else
if (dataName && topProcOptionList[topActiveIndex][dataName]) {
topProcOptionList.map(function (listItem, listIndex) {
if (listIndex === topActiveIndex) {
......@@ -244,16 +186,13 @@ class EditThirdLevelPage extends Component {
})
}
})
// console.log('设置当前所有已选值---', topProcOptionList)
this.setState({
topProcOptionList
})
}
// 点击顶部菜单
handleTopNav(item, index) {
// console.log('item, index----', item, index)
this.setState({
topActiveIndex: index
})
......@@ -263,8 +202,6 @@ class EditThirdLevelPage extends Component {
handleSubmit() {
let { topProcOptionList, superData } = this.state
let { params } = this.props.navigation.state
// console.log('编辑完成====>', topProcOptionList, params.superData)
// console.log(topProcOptionList[0][LocalVariable.LOCAL_THRID_CONT_DATA][0])
params.childrenPageCallBack(topProcOptionList, superData.superIndex)
this.props.navigation.goBack()
}
......@@ -285,13 +222,12 @@ class EditThirdLevelPage extends Component {
renderTopProItem() {
let { topProcOptionList, topActiveIndex, superData } = this.state
let { leftIndex } = superData
console.log('顶部编辑选项===', topProcOptionList)
let curTit = '', curTopList = topProcOptionList
if (leftIndex === 0) {
curTit = 'category_name'
} else if (leftIndex === 1) {
curTit = 'segment_name'
if(curTopList.length > 0 && curTopList[0].segment_code === 'ALL'){
if (curTopList.length > 0 && curTopList[0].segment_code === 'ALL') {
curTopList = []
}
} else if (leftIndex === 2) {
......@@ -322,37 +258,7 @@ class EditThirdLevelPage extends Component {
// 返回底部主要元素
renderContItem() {
let { topProcOptionList, topActiveIndex, superData, onlyShow } = this.state
let { leftIndex } = superData
// let { params } = this.props.navigation.state
// let curData = []
// // 本地测试数据
// let localThridContData = []
// let imgIconArr = ''
// if (params.superData.leftIndex === 1) {
// curData = topProcOptionList
// } else if (params.superData.leftIndex === 2) {
// // localThridContData = topProcOptionList
// } else {
// curData = topProcOptionList[topActiveIndex]
// }
// if (curData && curData[LocalVariable.LOCAL_THRID_CONT_DATA]) {
// localThridContData = curData[LocalVariable.LOCAL_THRID_CONT_DATA]
// }
// if (curData && curData.imgIconArr) {
// imgIconArr = curData.imgIconArr
// }
// if (params.superData.leftIndex === 2) {
// // 器械包
// localThridContData = topProcOptionList['package_components']
// }
let { topProcOptionList, topActiveIndex } = this.state
let localThridContData = []
let imgIconArr = ''
let topItem = topProcOptionList[topActiveIndex]
......@@ -360,8 +266,6 @@ class EditThirdLevelPage extends Component {
localThridContData = topItem[LocalVariable.LOCAL_THRID_CONT_DATA]
}
console.log('底部数据==', topItem, localThridContData)
return (
<View style={styles.edit_cont}>
{ imgIconArr ? <PictureZoom
......@@ -374,7 +278,7 @@ class EditThirdLevelPage extends Component {
style={styles.edit_scroll_cont}
showsVerticalScrollIndicator={false}
>
{ localThridContData.length > 0 ?
{localThridContData.length > 0 ?
<FlatList
style={styles.edit_list}
keyExtractor={item => item.id}
......@@ -385,7 +289,7 @@ class EditThirdLevelPage extends Component {
}
</ScrollView>
{ this.renderLodingItem() }
{ this.renderLodingItem()}
</View>
)
......@@ -393,12 +297,9 @@ class EditThirdLevelPage extends Component {
// 返回每一列元素
renderContColumnItem(item, index) {
let { topProcOptionList, topActiveIndex, superData, onlyShow, onlySignSelect } = this.state
let { leftIndex } = superData
let { onlyShow, onlySignSelect } = this.state
let curTit = '', curTipStr = '', curTipOne = '', curTipTwo = '', curCalField = '', curImgIcon = ''
let curTipStrTit = '', curTipOneTit = '', curTipTwoTit = ''
curTit = 'item_name'
curTipStr = 'item_code'
curTipOne = 'specification'
......@@ -410,7 +311,7 @@ class EditThirdLevelPage extends Component {
curImgIcon = 'photos'
return (
<SafeAreaView style={styles.column_container} key={'item_code'+index}>
<SafeAreaView style={styles.column_container} key={'item_code' + index}>
<PicTitDetaiCalcu
listItem={item}
listIndex={index}
......@@ -435,24 +336,16 @@ class EditThirdLevelPage extends Component {
// 返回正在加载中
renderLodingItem() {
return(
<LoadingModel ref="LoadingModel"/>
return (
<LoadingModel ref="LoadingModel" />
)
}
render() {
let { navigation } = this.props
let { title } = navigation.state.params
let { onlyShow, onlySignSelect } = this.state
console.log('onlyShow==', onlyShow)
let { onlyShow } = this.state
let curShowTop = true
if (onlyShow) {
curShowTop = !onlyShow
}
if (onlySignSelect) {
curShowTop = !onlySignSelect
}
return (
<View style={styles.edit_container}>
<StatusBarView
......@@ -463,7 +356,6 @@ class EditThirdLevelPage extends Component {
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.edit_main}>
{/* {curShowTop ? this.renderTopProItem() : null} */}
{this.renderTopProItem()}
{this.renderContItem()}
</View>
......
......@@ -2,29 +2,18 @@ import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableOpacity, Image, ScrollView, FlatList, SafeAreaView } from 'react-native';
import { third_text_color, foundation_color, second_text_size, Width, pxSize, font_family_regular, icon_style } from '../../../base/BaseStyle';
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
import PictureZoom from '../../common/listDataComponent/PictureZoom';
import { cloneObject } from '../../../utils/Utils';
import { PicListNoData } from '../../common/CellTextStyle';
import _ from "lodash";
import { connect } from 'react-redux';
import localMockData from './mock/sen_mock';
import LocalVariable from '../../common/LocalVariable';
const PropTypes = require('prop-types');
// const QUANTITY_FIELD = 'quantity' // 计算的字段
// const CHILDREN_LINE_NAME = 'childrenLineData' // 显示的子类数组名称
// const ONLY_TWO_LEVELS = 'onlyTwoLevels' // 只有两级的耗材
// const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
// const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
// const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
class ProductRightStyle extends Component {
static propTypres = {
superCallBack: PropTypes.func, // 回调计算函数
superReduceBack: PropTypes.func, // 减法回调
// thirdCallBack: PropTypes.func, // 三级小类的回调函数
superLeftData: PropTypes.object, // 三级大类数据
superStencilData: PropTypes.array, // 当前右侧二级数据
leftIndex: PropTypes.numberm, // 左侧index
......@@ -33,25 +22,18 @@ class ProductRightStyle extends Component {
constructor(props) {
super(props)
this.state = {
rightSecondData: this.props.superStencilData, // 右侧分类数据-模块、螺钉盒、器械包、赋值工具
selectItem: [], // 当前选中模板 -- 之前版本
rowSingleData: [], // 人工髋关节假体等数据 -- 小类
rightSecondData: this.props.superStencilData, // 右侧数据-手术模板、螺钉盒、器械包、零散器械
rowSingleData: [], // 耗材-小类
thridIsVisible: false, // 小类展示
curThridObj: {
title: '测试标题__',
superItem: '',
superIndex: '',
title: '',
image: ''
}
}
}
componentDidMount() {
// console.log('本地测试数据====localMockData===', localMockData)
// // 赋值测试数据
// this.setState({
// // rowSingleData: cloneObject(localMockData.localSingleRowData)
// })
}
componentWillReceiveProps(nextProps) {
if (this.state.thridIsVisible != nextProps.defaultThridShow) {
this.setState({ thridIsVisible: nextProps.defaultThridShow });
......@@ -61,12 +43,11 @@ class ProductRightStyle extends Component {
}
}
// 所有二级数据标题点击事件
// 右侧 二级数据标题 点击
TitleClickEvent(item, index) {
let { leftIndex } = this.props
console.log('右侧标题点击事件 ', leftIndex, index, item)
if (leftIndex >= 0 && leftIndex < 3) {
let curThirdShow = false, curThirdSign = false, curTit = '编辑模板'
let curThirdShow = false, curTit = '编辑模板'
if (leftIndex === 1) {
curThirdShow = true
curTit = '钉盒明细'
......@@ -84,42 +65,14 @@ class ProductRightStyle extends Component {
},
childrenPageCallBack: this.childrenPageCallBack.bind(this) // 传递函数,编辑完成时调用
})
} else if (leftIndex === 3) {
// 零散器械
this.canPlusOrdReduceOne(item, index)
} else {
// 单选耗材 中级标题点击之后
} else if (leftIndex > 3) {
// 单选耗材 中级标题点击
this.changeThrShow(true, item, index)
}
}
// 零散器械标题点击
canPlusOrdReduceOne(item, index) {
let { leftIndex } = this.props
let { rightSecondData } = this.state
// console.log('零散器械标题点击/减1:',rightSecondData)
// console.log('零散器械标题点击/减1:',leftIndex)
// console.log('零散器械标题点击/减1:',item)
// console.log('零散器械标题点击/减1:',index)
}
// 大类加减,小类所有加1/减1
// 大类加减时,小类所有加1/减1
handleAllPlusReduce(curData, curIndex, isPlus) {
let { rightSecondData } = this.state
let { superLeftData } = this.props
console.log('大类加减,整理加一/减一', curData, curIndex, isPlus)
// console.log('右侧数据', rightSecondData, curData[LocalVariable.CHILDREN_LINE_NAME])
// let rowData = [] // 本地测试,需要获取接口数据(无数据时,加法)
// rowData = cloneObject(localMockData.localSingleRowData) // 初始化数据
// let rowData = []
// rowData = curData.details
// console.log('本地测试,获取接口数据--', curData)
// console.log('本地测试,获取接口数据--', rightSecondData)
// console.log('本地测试,获取接口数据--', superLeftData)
if (curData.details && curData.details.length > 0) {
let sumCount = 0
curData[LocalVariable.QUANTITY_FIELD] = 0 // 初始化
......@@ -135,19 +88,14 @@ class ProductRightStyle extends Component {
sumCount += line_val[LocalVariable.QUANTITY_FIELD]
})
curData[LocalVariable.QUANTITY_FIELD] = sumCount
this.handleCalCallBack(curData, curIndex, 'rightSecondData', LocalVariable.QUANTITY_FIELD)
}
console.log('修改后的数据', curData, curIndex)
}
// 手术模板-编辑页面回调
// 手术模板-编辑页面回调
childrenPageCallBack(childData, index) {
let { rightSecondData } = this.state
let { leftIndex } = this.props
console.log('编辑页面的回调----', childData, index, leftIndex)
let that = this
if (rightSecondData.length > 0) {
rightSecondData.forEach(function (rsdItem, rsdIndex) {
......@@ -176,7 +124,6 @@ class ProductRightStyle extends Component {
lineOptions: childData,
[LocalVariable.QUANTITY_FIELD]: 1
}
if (rsdItem[LocalVariable.CHILDREN_LINE_NAME].length !== 0) {
curObj.version = rsdItem[LocalVariable.CHILDREN_LINE_NAME].length
}
......@@ -186,18 +133,14 @@ class ProductRightStyle extends Component {
return lineItem
}
})
// 本地测试
if (filEquArr.length === 0) {
rsdItem[LocalVariable.CHILDREN_LINE_NAME].push(curObj)
}
rsdItem[LocalVariable.QUANTITY_FIELD] = Number(rsdItem[LocalVariable.QUANTITY_FIELD]) + 1
// console.log('回调后的rsdItem====', rsdItem)
that.handleCalCallBack(rsdItem, rsdIndex, 'rightSecondData', LocalVariable.QUANTITY_FIELD)
}
})
}
// console.log('回调后的数组====', rightSecondData)
}
this.setState({
rightSecondData
})
......@@ -206,20 +149,13 @@ class ProductRightStyle extends Component {
// 修改当前小类是否展示
changeThrShow(show, superItem, superIndex) {
let { curThridObj, rowSingleData } = this.state
let { leftIndex } = this.props
let that = this
// console.log('修改当前小类是否展示----', show, superItem, superIndex)
// console.log('修改当前小类是否展示----', rowSingleData)
// console.log('修改当前小类是否展示----', curThridObj)
// console.log('修改当前小类是否展示----', leftIndex)
if (show && superItem) {
// 大类点击标题
// 大类点击标题
let curRowData = cloneObject(superItem['details'])
curThridObj = {
superItem: superItem,
superIndex: superIndex,
// image: localTestImageUrls,
title: superItem.category_name
}
that.setState({
......@@ -227,7 +163,6 @@ class ProductRightStyle extends Component {
curThridObj: curThridObj,
rowSingleData: curRowData
})
} else {
// 小类点击标题
if (curThridObj.superItem) {
......@@ -240,27 +175,17 @@ class ProductRightStyle extends Component {
curDa[LocalVariable.QUANTITY_FIELD] += itVal[LocalVariable.QUANTITY_FIELD]
}
})
that.handleCalCallBack(curDa, curInd, 'rightSecondData', LocalVariable.QUANTITY_FIELD)
that.setState({
thridIsVisible: show
})
}
// this.setState({
// thridIsVisible: show
// })
// 小类点击标题时,回调函数修改左侧数据
// this.props.thirdCallBack(rowSingleData, curThridObj.superIndex)
}
}
// 修改列表计算后数据 - 头/行
// 计算后的回调 - 头/行
handleCalCallBack(item, index, dataName, coutFieName) {
// console.log('修改列表计算后数据==', item, index, dataName, coutFieName)
// 除了单选耗材小类的回调
if (dataName && this.state[dataName]) {
let curDataName = this.state[dataName]
curDataName[index] = item
......@@ -268,8 +193,6 @@ class ProductRightStyle extends Component {
[dataName]: curDataName
})
if (coutFieName) {
// 除了单选耗材小类的回调
// console.log('除了单选耗材的回调==',item, index, dataName, coutFieName)
// 计算==头
let sumCount = 0
curDataName.map(item => {
......@@ -277,7 +200,6 @@ class ProductRightStyle extends Component {
sumCount += Number(item[coutFieName])
}
})
// console.log('计算==数量汇总=字段=', sumCount, coutFieName)
this.props.superCallBack(sumCount, coutFieName)
}
}
......@@ -303,13 +225,6 @@ class ProductRightStyle extends Component {
curTipStrTit = '物料代码'
curTipOneTit = '规格型号'
curIcon = 'photos'
} else {
// curTit = 'title'
// curTipOne = 'tip1'
// curTipTwo = 'tip2'
// curTipOneTit='提示1'
// curTipTwoTit='提示2'
// curIcon='imgIconArr'
}
if (leftIndex === 1) {
// 钉盒
......@@ -322,13 +237,6 @@ class ProductRightStyle extends Component {
curPlusCallBack = ''
curReduceCallBack = ''
curListMaxNum = 1
// if(item['childQuantity'] > 0) {
// 有数量时,需要点击进入选择
// curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
// curPlusCallBack = ((item, index) => this.TitleClickEvent(item,index))
// curReduceCallBack = (() => this.props.superReduceBack())
// }
} else if (leftIndex === 3) {
// 零散器械
curTitCallBack = ''
......@@ -369,16 +277,14 @@ class ProductRightStyle extends Component {
let { rightSecondData } = this.state
return (
<View style={styles.stencil_cont}>
{
rightSecondData.length > 0 ?
<FlatList
style={styles.cont_right_list}
keyExtractor={item => item.id}
data={rightSecondData}
extraData={this.state}
renderItem={({ item, index }) => this.renderSecondtem(item, index)}
/> : <PicListNoData />
}
{ rightSecondData.length > 0 ?
<FlatList
style={styles.cont_right_list}
keyExtractor={item => item.id}
data={rightSecondData}
extraData={this.state}
renderItem={({ item, index }) => this.renderSecondtem(item, index)}
/> : <PicListNoData />}
</View>
)
......@@ -423,26 +329,23 @@ class ProductRightStyle extends Component {
// 单选耗材 -- 大类每一列
renderOtherListItem(item, index) {
let curTit = '', curTipOne = '', curTipTwo = '', curTipOneTit = '', curTipTwoTit = '', curIcon = ''
let curSubCalCallBack = '', curTitCallBack = '', curPlusCallBack = '', curReduceCallBack = ''
let curTitCallBack = '', curPlusCallBack = '', curReduceCallBack = ''
if (item[LocalVariable.ONLY_TWO_LEVELS]) {
// 两级
// 两级数据
curTit = 'item_name'
curTipOne = 'item_code'
curTipOneTit = '物料代码'
curIcon = 'photos'
} else {
// 三级
// 三级数据
curTit = 'category_name'
curTipOne = 'category_code'
curTipOneTit = '分类编码'
// curSubCalCallBack= ''
curTitCallBack = (item, index) => this.TitleClickEvent(item, index)
curPlusCallBack = (item, index) => this.handleAllPlusReduce(item, index, true)
curReduceCallBack = (item, index) => this.handleAllPlusReduce(item, index)
}
// console.log('大类===', item)
return (
<SafeAreaView style={styles.oth_container} key={'item_code' + index}>
<PicTitDetaiCalcu
......@@ -455,7 +358,9 @@ class ProductRightStyle extends Component {
titCallBack={curTitCallBack}
titText={curTit}
tipTextOne={curTipOne}
tipTextTwo={curTipTwo}
tipTextOneTit={curTipOneTit}
tipTextTwoTit={curTipTwoTit}
plusCallBack={curPlusCallBack}
reduceCallBack={curReduceCallBack}
/>
......@@ -482,7 +387,7 @@ class ProductRightStyle extends Component {
)
}
// 返回右侧元素
// 右侧元素
renderRightCurrentStyle() {
let { leftIndex } = this.props
let { thridIsVisible } = this.state
......@@ -497,7 +402,7 @@ class ProductRightStyle extends Component {
}
}
// 返回右侧单选耗材 -- 三级顶部标题和图片
// 单选耗材 -- 三级顶部标题
renderThrHeadStyle() {
let { thridIsVisible, curThridObj } = this.state
if (thridIsVisible) {
......@@ -555,7 +460,6 @@ const styles = StyleSheet.create({
cont_right_list: {},
ri_container: {},
model_cont: {},
// other right
cont_other_cont: {},
cont_other_list: {},
oth_container: {},
......
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image,
ScrollView
} from 'react-native';
import {
first_text_color,
third_text_size,
second_text_color,
pxSize,
foundation_color,
promary_color
} from '../../../../base/BaseStyle';
class TopTabBar extends Component {
constructor(props) {
super(props);
this.state = {
}
}
// 返回自定义 bar 元素
renderTabOption(barItem, index) {
// ScrollableTabView默认传递的属性值,即跳转方法
// console.warn('top_tab_----', this.props)
// console.warn('barItem, index----', barItem, index)
let {activeTab, tabNames, goToPage, imgTabArr, textStyle, activeTextColor} = this.props
console.warn(activeTab, index, 'hh')
return (
<TouchableOpacity
activeOpacity={.8}
key={barItem}
onPress={() => goToPage(index)}
style={[styles.bar_box, activeTab == index ? styles.bar_box_act : '']}
>
<View style={styles.img_box}>
<Image source={imgTabArr[index]} style={styles.img_inner}/>
</View>
<Text style={[textStyle, activeTab == index ? activeTextColor : '']}>{barItem}</Text>
</TouchableOpacity>
)
}
render() {
let {style, tabs} = this.props
console.warn('hhhhh', tabs)
console.warn(this.props)
return (
<View style={[styles.bar_cont, style]}>
<ScrollView
style={styles.top_scroll_cont}
horizontal={true}
showsHorizontalScrollIndicator={false}
>
{
this.props.tabs.map((tab, index) => this.renderTabOption(tab, index))
}
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
bar_cont: {
backgroundColor: foundation_color,
borderBottomColor: '#F4F4F4',
borderBottomWidth: 1,
flexDirection: 'row',
height: 76,
paddingHorizontal: 20
},
top_scroll_cont: {
},
tab: {
},
bar_box: {
flex: 1,
alignItems: 'center',
justifyContent: 'flex-start',
// paddingBottom: 10,
borderBottomWidth: 2,
borderBottomColor: foundation_color,
width: 58,
marginRight: 8
},
bar_box_act: {
borderBottomWidth: 2,
borderBottomColor: promary_color
},
img_box: {
width: pxSize(30),
height: pxSize(30)
},
img_inner: {
width: '100%',
height: '100%'
},
tit_text: {
paddingTop: 10,
paddingBottom: 16,
color: second_text_color,
fontSize: third_text_size
},
tit_text_act: {
color: first_text_color,
fontWeight: 'bold'
}
})
export default TopTabBar;
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image,
ScrollView
} from 'react-native';
import {
first_text_color,
third_text_size,
second_text_color,
pxSize,
foundation_color,
promary_color
} from '../../../../base/BaseStyle';
class TopTabBar extends Component {
constructor(props) {
super(props);
this.state = {
}
}
// 返回自定义 bar 元素
renderTabOption(barItem, index) {
// ScrollableTabView默认传递的属性值,即跳转方法
// console.warn('top_tab_----', this.props)
// console.warn('barItem, index----', barItem, index)
let {activeTab, tabNames, goToPage, imgTabArr, textStyle, activeTextColor} = this.props
// console.warn(activeTab, index, 'hh')
return (
<TouchableOpacity
activeOpacity={.8}
key={barItem}
onPress={() => goToPage(index)}
style={[styles.bar_box, activeTab == index ? styles.bar_box_act : '']}
>
<View style={styles.img_box}>
<Image source={imgTabArr[index]} style={styles.img_inner}/>
</View>
<Text style={[textStyle, activeTab == index ? activeTextColor : '']}>{barItem}</Text>
</TouchableOpacity>
)
}
render() {
let {style, tabs} = this.props
// console.warn('hhhhh', tabs)
// console.warn(this.props)
return (
<View style={[styles.bar_cont, style]}>
<ScrollView
style={styles.top_scroll_cont}
horizontal={true}
showsHorizontalScrollIndicator={false}
>
{
this.props.tabs.map((tab, index) => this.renderTabOption(tab, index))
}
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
bar_cont: {
backgroundColor: foundation_color,
borderBottomColor: '#F4F4F4',
borderBottomWidth: 1,
flexDirection: 'row',
height: 76,
paddingHorizontal: 20
},
top_scroll_cont: {
},
tab: {
},
bar_box: {
flex: 1,
alignItems: 'center',
justifyContent: 'flex-start',
// paddingBottom: 10,
borderBottomWidth: 2,
borderBottomColor: foundation_color,
width: 58,
marginRight: 8
},
bar_box_act: {
borderBottomWidth: 2,
borderBottomColor: promary_color
},
img_box: {
width: pxSize(30),
height: pxSize(30)
},
img_inner: {
width: '100%',
height: '100%'
},
tit_text: {
paddingTop: 10,
paddingBottom: 16,
color: second_text_color,
fontSize: third_text_size
},
tit_text_act: {
color: first_text_color,
fontWeight: 'bold'
}
})
export default TopTabBar;
\ No newline at end of file
/**
* 本地接口测试数据
*/
const local_photos = ['files/20200731/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20200731113857_1596166761793_1596184849964.jpg',
'files/20200921/5_1599645385381_1600672374371.jpg',
'files/20200921/4_1599645381425_1600672375091.jpg',
......
export default [
{
isRequest: true,
title: '销售员',
value: '易凯源',
isPicker: false,
isEditText: true
},
{
isRequest: true,
title: '组织',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '客户名称',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '收单地点',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '收货地点',
value: '请选择',
isPicker: true
},
{
isRequest: false,
title: '主治医生',
value: '请选择',
isPicker: true,
showInput: true
},
{
isRequest: false,
title: '手术名称',
value: '请输入',
isPicker: false
},
{
isRequest: false,
title: '手术时间',
value: '请选择',
isPicker: true,
showDatePicker: true
},
{
isRequest: true,
title: '手术类型',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '订单类型',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '选择产品',
value: '请选择',
isPicker: true,
showItemPage: true
}
]
\ 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