Commit bf6d88b2 by Denglingling

新增模拟接口获取APP数据

(cherry picked from commit e62546a8)
parent 74bcbe53
......@@ -10,6 +10,7 @@ import {
SELF_SUBMIT_FAILURE,
SELF_INIT_DATA
} from '../base/ActionTypes';
import local_inter_mock from '../containers/selfOrder/module/mock/inter_mock'
// 获取组织 params={access_token:''}
export function requestSelfOrganizations(params) {
......@@ -221,50 +222,63 @@ export function requestSelfSumbit({access_token, ...params}) {
// 选择产品-供应商信息查询接口
export const reqPurSupplierSearch = async (global_domain_config, params) => {
return local_inter_mock.inter_1
return await GetRequest(global_domain_config, getUrlParams('/order/pur_supplier/search', params))
}
// 选择产品-产品信息分类查询接口
export const reqProCategorySearch = async (global_domain_config, params) => {
return local_inter_mock.inter_2
return await GetRequest(global_domain_config, getUrlParams('/order/item/search', params))
}
// 选择产品-手术模板头查询接口
export const reqSurTempHeadSearch = async (global_domain_config, params) => {
return local_inter_mock.inter_3
return await GetRequest(global_domain_config, getUrlParams('/surgery/template_header/search', params))
}
// 选择产品-手术模板行查询接口
export const reqSurTempLineSearch = async (global_domain_config, params) => {
return local_inter_mock.inter_4
return await GetRequest(global_domain_config, getUrlParams('/surgery/template_line/search', params))
}
// 选择产品-螺钉盒(器械包)头查询接口
export const reqNailEquipHeadSearch = async (global_domain_config, params) => {
if(params.category_code === '1301'){
return local_inter_mock.inter_5
}else {
return local_inter_mock.inter_55
}
return await GetRequest(global_domain_config, getUrlParams('/inventory/item_package/search', params))
}
// 选择产品-螺钉盒明细查询接口
export const reqNailBoxLineSearch = async (global_domain_config, params) => {
return local_inter_mock.inter_6
return await GetRequest(global_domain_config, getUrlParams('/inventory/nail_box_template_detail/search', params))
}
// 选择产品-器械包明细查询接口
export const reqEquipPackageLineSearch = async (global_domain_config, params) => {
return local_inter_mock.inter_7
return await GetRequest(global_domain_config, getUrlParams('/inventory/item_package/search', params))
}
// 选择产品-零散器械查询接口
export const reqScatEquipmentSearch = async (global_domain_config, params) => {
return local_inter_mock.inter_8
return await GetRequest(global_domain_config, getUrlParams('/order/tool/search', params))
}
// 选择产品-单点耗材查询接口
export const reqSingleConsumSearch = async (global_domain_config, params) => {
return local_inter_mock.inter_9
return await GetRequest(global_domain_config, getUrlParams('/order/item_detail/search', params))
}
......
......@@ -21,7 +21,7 @@ class ProductModel extends Component {
closeModal: PropTypes.func, // 关闭回调
closeSubmit: PropTypes.func, // 选好了回调
show: PropTypes.bool,
modelOption: PropTypes.array, // 已选数据
modelOption: PropTypes.array, // 已选左侧数据
modelCallBack: PropTypes.func, // 修改选择的回调函数
}
......@@ -474,7 +474,7 @@ class ProductModel extends Component {
cardStyleItemTit={styles.top_tit}
cardStyleItemTitAct={styles.top_tit_act}
cardListOptions={topProcOptionList}
cardItemTitle={'title'}
cardItemTitle={'category_name'}
curActIndex={topActiveIndex}
cardCallBack={(item, index) => this.handleTopNav(item, index)}
cardCountName={SELECTED_QUQNTITY}
......@@ -487,9 +487,9 @@ 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)
console.log('已选展示信息 === curData---', topProcOptionList)
console.log('已选展示信息 === curData---', topActiveIndex)
console.log('已选展示信息 === curData---', curData)
let localBottomContData = []
if(curData && curData[SELECTED_DATA_ARR]){
// localBottomContData = curData[SELECTED_DATA_ARR]
......
......@@ -5,6 +5,7 @@ const PropTypes = require('prop-types');
import PictureZoom from '../../common/listDataComponent/PictureZoom';
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
import localMockData from '../../selfOrder/module/mock/sen_mock';
import { connect } from 'react-redux';
class ChooseCardList extends Component {
......@@ -32,7 +33,7 @@ class ChooseCardList extends Component {
cardItemName: PropTypes.string,
cardCallBack: PropTypes.func,
curActIndex: PropTypes.number,
curActIndex: PropTypes.number, // 当前已选项index
cardIsCount: PropTypes.bool, // 显示计数
......@@ -64,22 +65,13 @@ class ChooseCardList extends Component {
this.state = {
countStyleType: ['DEFAULT', 'GRAPHICS'],
countStyleName: ['card_default', 'card_graphice']
// curActIndex: 0
}
}
// 点击当前选项
// handleCheckTit(item, index) {
// console.log('item, index----', item, index)
// // this.state = {
// // // curActIndex: index
// // }
// this.props.cardCallBack(item, index)
// }
render() {
let {cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox, cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardImgName, cardItemName,
cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardIsCount, cardCountName, cardStyleCount, cardStyleType, cardCouStyle, ...props} = this.props
cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardIsCount, cardCountName, cardStyleCount, cardStyleType, cardCouStyle,
global_domain_config } = this.props
let {countStyleType} = this.state
......@@ -97,7 +89,8 @@ class ChooseCardList extends Component {
>
{ cardListOptions.map((item, index) => {
if(typeof item[cardItemIcon] === 'string'){
item[cardItemIcon] = {uri: item[cardItemIcon]}
global_domain_config = 'https://obs-dev.gyjtsx.com' // 本地测试 ======= 正式需要隐藏
item[cardItemIcon] = {uri: global_domain_config+item[cardItemIcon]}
}
return <View style={styles.card_list_box}>
<TouchableOpacity
......@@ -181,5 +174,19 @@ const styles = StyleSheet.create({
fontSize: 10
}
})
export default ChooseCardList;
\ No newline at end of file
const mapStateToProps = (state) => {
return {
global_domain_config: state.login.global_domain_config
}
}
const mapDispatchToProps = (dispatch) => {
return {
// exitLoginStatus: () => {
// dispatch(exitLoginStatus())
// },
}
}
export default connect(mapStateToProps, mapDispatchToProps)(ChooseCardList);
\ No newline at end of file
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 PictureZoom from '../../common/listDataComponent/PictureZoom';
const PropTypes = require('prop-types');
......@@ -40,7 +41,7 @@ class PicTitDetaiCalcu extends Component {
constructor(props) {
super(props);
this.state = {
this.state = {
listPicTypeArr: ['ROUND', 'SQUARE', 'RECTANGLE'],
picStyleArr: ['round_pic', 'square_pic', 'rectan_pic']
}
......@@ -52,11 +53,11 @@ class PicTitDetaiCalcu extends Component {
// }
// 单选点击
handelSelectCheck(item, index){
handelSelectCheck(item, index) {
item.select = !!!item.select
this.props.subCalCallBack(item, index)
}
}
/**
* 点击加减
* @param {object} item 当前小类数据
......@@ -64,53 +65,145 @@ class PicTitDetaiCalcu extends Component {
* @param {boolean} isPlus 默认减法 false,加法 true,
*/
handelCalculation(item, index, isPlus) {
let {calField, plusCallBack, reduceCallBack} = this.props
if(!isPlus && reduceCallBack){
let { calField, plusCallBack, reduceCallBack } = this.props
if (!isPlus && reduceCallBack) {
// console.log('减法回调======')
reduceCallBack(item, index)
return
}
if(isPlus && plusCallBack){
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])){
if (Number.isNaN(item[calField])) {
item[calField] = 0
}
if(isPlus) {
if (isPlus) {
item[calField] += 1
} else if(!isPlus && item[calField] > 0) {
} else if (!isPlus && item[calField] > 0) {
item[calField] -= 1
}
this.props.subCalCallBack(item, index)
}
render() {
let {listItem, listIndex, calField, listStyleBox, listStyleTit, listStyleTip, listStyleCalBtn, listPicType, titCallBack,
render() {
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} = this.props
let {listPicTypeArr, picStyleArr} = this.state
listStyleClearBtn, clearCallBack, onlyShowNum, onlyShowSelect, tipTextStrTit, tipTextOneTit, tipTextTwoTit, global_domain_config } = this.props
let { listPicTypeArr, picStyleArr } = this.state
let picOthStyle = ''
if(listPicTypeArr.indexOf(listPicType) > -1){
if (listPicTypeArr.indexOf(listPicType) > -1) {
picOthStyle = picStyleArr[listPicTypeArr.indexOf(listPicType)]
}
let valIsZero = Boolean(listItem[calField] === 0)
let calIcon = require('../../../images/plur_icon_big.png')
if(!valIsZero) {
if (!valIsZero) {
calIcon = require('../../../images/plur_big_act.png')
}
let defSelIcon = require('../../../images/radio_no.png')
if(onlyShowSelect && listItem.select){
if (onlyShowSelect && listItem.select) {
defSelIcon = require('../../../images/radio_yes.png')
}
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})
})
}
// console.log('每一列----',listItem[listImgIcon], listItem[listImgIcon] instanceof Array)
return (
return (
<View style={[styles.ri_inner, listStyleBox]}>
{/* { listImgIcon ?
<View style={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}>
<Image style={icon_style} source={listItem[listImgIcon]}/>
</View> : null } */}
{ (listImgIcon && cur_photos.length > 0) ?
<PictureZoom
listImageIndex={0}
listImageUrls={cur_photos}
listStyleImage={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}
listPicType={listPicType}
/>
// : listImgIcon ? <View style={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}>
// <Image style={icon_style} source={listItem[listImgIcon]} />
// </View>
: 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>
{
(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) ? <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>
}
</View>
// <View>
// { curListArr.map((curListItem, curListIndex) => {
......@@ -159,90 +252,12 @@ class PicTitDetaiCalcu extends Component {
// })
// }
// </View>
<View style={[styles.ri_inner, listStyleBox]}>
{/* { listImgIcon ?
<View style={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}>
<Image style={icon_style} source={listItem[listImgIcon]}/>
</View> : null } */}
{ (listImgIcon && listItem[listImgIcon] instanceof Array) ?
<PictureZoom
listImageIndex={0}
listImageUrls={listItem[listImgIcon]}
listStyleImage={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}
listPicType={listPicType}
/>: listImgIcon ? <View style={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}>
<Image style={icon_style} source={listItem[listImgIcon]}/>
</View> : 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]}>{listItem[tipTextStr]}</Text> : null }
{ listItem[tipTextOne] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>{listItem[tipTextOne]}</Text> : null }
{ listItem[tipTextTwo] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>{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) ? <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>
}
</View>
);
}
}
const styles = StyleSheet.create({
ri_inner: {
......@@ -300,17 +315,17 @@ const styles = StyleSheet.create({
height: pxSize(22)
},
btn_inner: {},
btn_sel_inner:{},
btn_cle_box:{
btn_sel_inner: {},
btn_cle_box: {
marginRight: 6,
// backgroundColor: 'red',
paddingHorizontal: 4,
paddingVertical: 4
},
btn_clear_inner:{
btn_clear_inner: {
},
icon_cle_btn:{
icon_cle_btn: {
width: pxSize(22),
height: pxSize(22)
},
......@@ -337,4 +352,18 @@ const styles = StyleSheet.create({
}
})
export default PicTitDetaiCalcu;
\ No newline at end of file
const mapStateToProps = (state) => {
return {
global_domain_config: state.login.global_domain_config
}
}
const mapDispatchToProps = (dispatch) => {
return {
// exitLoginStatus: () => {
// dispatch(exitLoginStatus())
// },
}
}
export default connect(mapStateToProps, mapDispatchToProps)(PicTitDetaiCalcu);
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
SafeAreaView,
StyleSheet,
TouchableOpacity,
Image,
ScrollView,
TextInput,
FlatList,
Alert,
Linking,
NativeModules,
Platform
} 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 {
second_text_size,
home_background_color,
dis_sub_color,
placehold_text_color,
Width,
first_text_color,
pxSize,
promary_color,
safe_view,
icon_style,
font_family_regular,
list_common_item
} from '../../base/BaseStyle';
import { home_background_color, placehold_text_color, promary_color, safe_view, icon_style, list_common_item } from '../../base/BaseStyle';
import {
AsteriskTextStyle,
TitleTextStyle,
......@@ -46,28 +19,9 @@ import LodingModel from '../common/LodingModel';
import DateModel from '../common/DateModel';
import { AudioRecorder, AudioUtils } from 'react-native-audio';
import Sound from 'react-native-sound';
import {
requestSelfOrganizations,
requestSelfSurgeryHospital,
requestSelfOrderType,
requestSelfTemplateCollect,
requestSelfAudio,
requestSelfSumbit,
setSelfInitData,
reqSelfSurgeryHospital,
requestListDataSuccess,
requestSelfSurgeryType
} from '../../action/SelfAction';
import { requestSelfOrganizations, requestSelfSurgeryHospital, requestSelfOrderType, requestSelfTemplateCollect, requestSelfAudio, requestSelfSumbit, setSelfInitData, reqSelfSurgeryHospital, requestListDataSuccess, requestSelfSurgeryType } from '../../action/SelfAction';
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 { 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';
class SelfOrderPage extends Component {
......@@ -1227,7 +1181,13 @@ class SelfOrderPage extends Component {
// 选择产品 点击跳转
handleProductCheck() {
this.props.navigation.navigate('ChooseProductPage', {title: `自助下单 - 选择产品`})
let {listOptionData} = this.state
this.props.navigation.navigate('ChooseProductPage', {
title: `选择产品`,
selfData: {
org_code: listOptionData[1].value
}
})
}
// 备注 输入
......
import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput } 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_semibold, font_family_regular, icon_style, title_text_color, font_family_medium, list_common_item} from '../../../base/BaseStyle';
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 } from '../../../base/BaseStyle';
import HeadBackItem from '../../common/HeadBackItem';
import ProductRightStyle from './ProductRightStyle';
import ProductModel from '../../common/ProductModel';
import StatusBarView from '../../common/StatusBarView';
import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import {cloneObject} from '../../../utils/Utils';
import { cloneObject, dedupQuoteArray, show } from '../../../utils/Utils';
import { reqPurSupplierSearch, reqProCategorySearch, reqSurTempHeadSearch, reqNailEquipHeadSearch, reqScatEquipmentSearch, reqSingleConsumSearch } from '../../../action/SelfAction';
import localMockData from './mock/sen_mock';
const DEFAULT_FIELD = 'quantity' // 计算的字段
......@@ -15,12 +16,12 @@ const CHILD_DATA_NAME = 'childrenLineData' // 显示的子类数组名称
const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
const DEFAULT_SECOND_DATA = 'localSecondData' // 中类原本元素
const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
class ChooseProductPage extends Component {
constructor(props) {
super(props);
this.state = {
this.state = {
searchValue: '',
topActiveIndex: 0,
topProcOptionList: [], // 顶部厂家信息
......@@ -29,57 +30,259 @@ class ChooseProductPage extends Component {
leftOptionList: [], // 左侧分类数据
defaultThridShow: false, // 默认人体髋关节-小类不显示
selectShowPopup: false, // 共计已选弹窗
}
defalutLeftItem: [{
"category_code": "surg_temp",
"category_name": "手术模板",
"cate_local_icon": require('../../../images/surg_temp.png')
}, {
"category_code": "screw_box",
"category_name": "钉盒",
"cate_local_icon": require('../../../images/screw_box.png')
}, {
"category_code": "equip_bag",
"category_name": "器械包",
"cate_local_icon": require('../../../images/equip_bag.png')
}, {
"category_code": "auxili_tool",
"category_name": "零散器械",
"cate_local_icon": require('../../../images/auxili_tool.png')
}]
}
}
componentDidMount() {
// console.log('本地测试数据====localMockData===', localMockData)
// // console.log('本地测试数据====localMockData===', localMockData)
let {topProcOptionList} = this.state
topProcOptionList = cloneObject(localMockData.localTopProcOption)
topProcOptionList.forEach(function (topObj) {
topObj[SELECTED_QUQNTITY] = 0
topObj['leftOptionList'] = cloneObject(localMockData.localLeftOption)
})
// let {topProcOptionList} = this.state
// topProcOptionList = cloneObject(localMockData.localTopProcOption)
// topProcOptionList.forEach(function (topObj) {
// topObj[SELECTED_QUQNTITY] = 0
// topObj['leftOptionList'] = cloneObject(localMockData.localLeftOption)
// })
// 赋值本地测试数据
this.setState({
topProcOptionList: topProcOptionList,
leftOptionList: cloneObject(localMockData.localLeftOption)
})
// // 赋值本地测试数据
// this.setState({
// topProcOptionList: topProcOptionList,
// leftOptionList: cloneObject(localMockData.localLeftOption)
// })
this.initGetData()
}
// 顶部产品点击
handleTopNav(item, index) {
// console.log('top产品--',item, index)
this.setState({
topActiveIndex: index,
// leftOptionList: cloneObject(localMockData.localLeftOption)
})
// 初始化获取数据
async initGetData() {
let that = this
let { token, global_domain_config, navigation } = that.props
let cur_org_code = ''
if (navigation.state.params.selfData) {
cur_org_code = navigation.state.params.selfData.org_code
}
let params = {
access_token: token,
org_code: cur_org_code,
supplier_type: 'MANUFACTURER' // 供应商
}
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['selectedQuantity'] = 0
topObj['leftOptionList'] = []
})
that.setState({
topProcOptionList
}, () => {
that.handleTopNav(topProcOptionList[0], 0)
})
} else {
that.showRrrorTip(pur_sup_search)
}
}
// 顶部产品点击,获取左侧数据
async handleTopNav(topItem, topIndex) {
// console.log('top产品--',topItem, topIndex)
let that = this
let { token, global_domain_config } = that.props
let params = {
access_token: token,
manufacturer_code: topItem.supplier_code,
}
let pro_scate_search = await reqProCategorySearch(global_domain_config, params)
console.log('res_2 : ', pro_scate_search)
if (pro_scate_search.error_code === 0) {
let { topProcOptionList, defalutLeftItem } = this.state
let { data } = pro_scate_search
topItem.leftOptionList = defalutLeftItem.concat(data.item)
topItem.leftOptionList.forEach(function (leftObj) {
leftObj['selectedQuantity'] = 0
leftObj['localSecondData'] = []
})
topProcOptionList[topIndex] = topItem
that.setState({
topActiveIndex: topIndex,
topProcOptionList: topProcOptionList
}, () => {
that.handleLeftNav(topItem['leftOptionList'][0], 0)
})
} else {
that.showRrrorTip(pro_scate_search)
}
// this.setState({
// topActiveIndex: topIndex,
// // leftOptionList: cloneObject(localMockData.localLeftOption)
// })
}
// 左侧标题点击
handleLeftNav(item, index) {
async handleLeftNav(leftItem, leftIndex) {
// console.log('左侧标题--', index, item)
let {leftOptionList} = this.state
this.setState({
leftActiveIndex: index,
// rightSecondData: leftOptionList[index][DEFAULT_SECOND_DATA] // 本地数据
// rightSecondData: leftOptionList[index].localSecondData // 本地数据
})
let { topProcOptionList, topActiveIndex, leftOptionList } = this.state
let that = this
let { token, global_domain_config, navigation, userInfo } = that.props
let cur_org_code = ''
if (navigation.state.params.selfData) {
cur_org_code = navigation.state.params.selfData.org_code
}
let topItem = topProcOptionList[topActiveIndex]
if (leftIndex === 0) {
let params = {
access_token: token,
org_code: cur_org_code,
seller_code: userInfo.user_name,
manufacturer_code: topItem.supplier_code,
}
let sur_head_search = await reqSurTempHeadSearch(global_domain_config, params)
console.log('res_3 : ', sur_head_search)
if (sur_head_search.error_code === 0) {
let { data } = sur_head_search
leftItem.localSecondData = cloneObject(data.surgery_template)
leftItem['localSecondData'].forEach(function (righDa) {
if (!righDa['quantity']) {
righDa['quantity'] = 0
} else {
righDa['quantity'] = Number(righDa['quantity'])
}
})
leftOptionList[leftIndex] = leftItem
that.setState({
leftActiveIndex: leftIndex,
leftOptionList: leftOptionList
})
} else {
that.showRrrorTip(sur_head_search)
}
} else if (leftIndex === 1 || leftIndex === 2) {
let cur_category_code = '1301'
if (leftIndex === 2) {
cur_category_code = '1302'
}
let params = {
access_token: token,
category_set: 'INVENTORY',
category_code: cur_category_code,
}
let nail_equip_head_search = await reqNailEquipHeadSearch(global_domain_config, params)
console.log('res_3 : ', nail_equip_head_search)
if (nail_equip_head_search.error_code === 0) {
let { data } = nail_equip_head_search
leftItem.localSecondData = cloneObject(data.items)
leftItem['localSecondData'].forEach(function (righDa) {
if (!righDa['quantity']) {
righDa['quantity'] = 0
} else {
righDa['quantity'] = Number(righDa['quantity'])
}
})
leftOptionList[leftIndex] = leftItem
that.setState({
leftActiveIndex: leftIndex,
leftOptionList: leftOptionList
})
} else {
that.showRrrorTip(nail_equip_head_search)
}
} else if (leftIndex === 3) {
let params = {
access_token: token
}
let scat_head_search = await reqScatEquipmentSearch(global_domain_config, params)
console.log('res_3 : ', scat_head_search)
if (scat_head_search.error_code === 0) {
let { data } = scat_head_search
leftItem.localSecondData = cloneObject(data.tools)
leftItem['localSecondData'].forEach(function (righDa) {
if (!righDa['quantity']) {
righDa['quantity'] = 0
} else {
righDa['quantity'] = Number(righDa['quantity'])
}
})
leftOptionList[leftIndex] = leftItem
that.setState({
leftActiveIndex: leftIndex,
leftOptionList: leftOptionList
})
} else {
that.showRrrorTip(scat_head_search)
}
} else {
let params = {
access_token: token
}
let single_all_search = await reqSingleConsumSearch(global_domain_config, params)
console.log('res_3 : ', single_all_search)
if (single_all_search.error_code === 0) {
let { data } = single_all_search
console.log('data : ', data, data instanceof Array)
if (data instanceof Array) {
//大-中-小类
leftItem.localSecondData = cloneObject(data)
leftItem['localSecondData'].forEach(function (righDa) {
if (!righDa['quantity']) {
righDa['quantity'] = 0
} else {
righDa['quantity'] = Number(righDa['quantity'])
}
righDa[CHILD_DATA_NAME] = cloneObject(righDa['details'])
})
leftOptionList[leftIndex] = leftItem
that.setState({
leftActiveIndex: leftIndex,
leftOptionList: leftOptionList
})
}
} else {
that.showRrrorTip(single_all_search)
}
}
// this.setState({
// leftActiveIndex: leftIndex,
// // rightSecondData: leftOptionList[index][LOCAL_SECOND_DATA] // 本地数据
// // rightSecondData: leftOptionList[index].localSecondData // 本地数据
// })
}
// 修改
handleChangeThrShow (show) {
handleChangeThrShow(show) {
this.setState({
defaultThridShow: show
})
}
// 计算三级回调函数
handleChangeThird(childData, superIndex){
let {leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex} = this.state
handleChangeThird(childData, superIndex) {
let { leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex } = this.state
// console.log("计算三级的回调函数",childData, superIndex, leftActiveIndex)
// console.log(leftOptionList)
......@@ -93,48 +296,48 @@ class ChooseProductPage extends Component {
let top_sel_sum = 0
leftOptionList.map(function(leItem, leIndex) {
if(!leItem[SELECTED_QUQNTITY]){
leftOptionList.map(function (leItem, leIndex) {
if (!leItem[SELECTED_QUQNTITY]) {
leItem[SELECTED_QUQNTITY] = 0
}
if(!leItem[SELECTED_DATA_ARR]){
if (!leItem[SELECTED_DATA_ARR]) {
leItem[SELECTED_DATA_ARR] = []
}
if(leIndex === leftActiveIndex) {
if(leItem[DEFAULT_SECOND_DATA].length && leItem[DEFAULT_SECOND_DATA][superIndex] && childData.length){
if (leIndex === leftActiveIndex) {
if (leItem[LOCAL_SECOND_DATA].length && leItem[LOCAL_SECOND_DATA][superIndex] && childData.length) {
let sumCount = 0
childData.map((chDa, chInd) => {
if(!chDa[DEFAULT_FIELD]){
if (!chDa[DEFAULT_FIELD]) {
chDa[DEFAULT_FIELD] = 0
}
sumCount += chDa[DEFAULT_FIELD]
})
let chDa = leItem[DEFAULT_SECOND_DATA][superIndex]
let chDa = leItem[LOCAL_SECOND_DATA][superIndex]
let curObj = {
superId: chDa['id'], // 本地测试
superIndex: superIndex, // 本地测试
superTit: leItem['title'], // 本地测试
superImg: chDa['imgIcon'], // 本地测试
superTip: `${chDa['title'] }x${sumCount}`, // 本地测试
superTip: `${chDa['title']}x${sumCount}`, // 本地测试
curTitle: chDa['title'], // 本地测试
version: 0,
lineOptions: childData,
[DEFAULT_FIELD]: sumCount
}
// 初始化
leItem[DEFAULT_SECOND_DATA][superIndex][CHILD_DATA_NAME] = []
leItem[DEFAULT_SECOND_DATA][superIndex][CHILD_DATA_NAME].push(curObj)
leItem[DEFAULT_SECOND_DATA][superIndex][DEFAULT_FIELD] = sumCount
leItem[LOCAL_SECOND_DATA][superIndex][CHILD_DATA_NAME] = []
leItem[LOCAL_SECOND_DATA][superIndex][CHILD_DATA_NAME].push(curObj)
leItem[LOCAL_SECOND_DATA][superIndex][DEFAULT_FIELD] = sumCount
}
// 初始化
leItem[SELECTED_QUQNTITY] = 0
leItem[SELECTED_DATA_ARR] = []
if(leItem[DEFAULT_SECOND_DATA].length){ // 本地测试 localSecondData DEFAULT_SECOND_DATA
leItem[DEFAULT_SECOND_DATA].forEach(function(chItem) {
if(chItem[DEFAULT_FIELD] > 0){
if (leItem[LOCAL_SECOND_DATA].length) { // 本地测试 localSecondData LOCAL_SECOND_DATA
leItem[LOCAL_SECOND_DATA].forEach(function (chItem) {
if (chItem[DEFAULT_FIELD] > 0) {
leItem[SELECTED_QUQNTITY] += Number(chItem[DEFAULT_FIELD])
leItem[SELECTED_DATA_ARR].push(chItem)
}
......@@ -148,48 +351,48 @@ class ChooseProductPage extends Component {
// topProcOptionList[topActiveIndex] = top_sel_sum
topProcOptionList[topActiveIndex].leftOptionList.map(function(leItem, leIndex) {
if(!leItem[SELECTED_QUQNTITY]){
topProcOptionList[topActiveIndex].leftOptionList.map(function (leItem, leIndex) {
if (!leItem[SELECTED_QUQNTITY]) {
leItem[SELECTED_QUQNTITY] = 0
}
if(!leItem[SELECTED_DATA_ARR]){
if (!leItem[SELECTED_DATA_ARR]) {
leItem[SELECTED_DATA_ARR] = []
}
if(leIndex === leftActiveIndex) {
if(leItem[DEFAULT_SECOND_DATA].length && leItem[DEFAULT_SECOND_DATA][superIndex] && childData.length){
if (leIndex === leftActiveIndex) {
if (leItem[LOCAL_SECOND_DATA].length && leItem[LOCAL_SECOND_DATA][superIndex] && childData.length) {
let sumCount = 0
childData.map((chDa, chInd) => {
if(!chDa[DEFAULT_FIELD]){
if (!chDa[DEFAULT_FIELD]) {
chDa[DEFAULT_FIELD] = 0
}
sumCount += chDa[DEFAULT_FIELD]
})
let chDa = leItem[DEFAULT_SECOND_DATA][superIndex]
let chDa = leItem[LOCAL_SECOND_DATA][superIndex]
let curObj = {
superId: chDa['id'], // 本地测试
superIndex: superIndex, // 本地测试
superTit: leItem['title'], // 本地测试
superImg: chDa['imgIcon'], // 本地测试
superTip: `${chDa['title'] }x${sumCount}`, // 本地测试
superTip: `${chDa['title']}x${sumCount}`, // 本地测试
curTitle: chDa['title'], // 本地测试
version: 0,
lineOptions: childData,
[DEFAULT_FIELD]: sumCount
}
// 初始化
leItem[DEFAULT_SECOND_DATA][superIndex][CHILD_DATA_NAME] = []
leItem[DEFAULT_SECOND_DATA][superIndex][CHILD_DATA_NAME].push(curObj)
leItem[DEFAULT_SECOND_DATA][superIndex][DEFAULT_FIELD] = sumCount
leItem[LOCAL_SECOND_DATA][superIndex][CHILD_DATA_NAME] = []
leItem[LOCAL_SECOND_DATA][superIndex][CHILD_DATA_NAME].push(curObj)
leItem[LOCAL_SECOND_DATA][superIndex][DEFAULT_FIELD] = sumCount
}
// 初始化
leItem[SELECTED_QUQNTITY] = 0
leItem[SELECTED_DATA_ARR] = []
if(leItem[DEFAULT_SECOND_DATA].length){ // 本地测试 localSecondData DEFAULT_SECOND_DATA
leItem[DEFAULT_SECOND_DATA].forEach(function(chItem) {
if(chItem[DEFAULT_FIELD] > 0){
if (leItem[LOCAL_SECOND_DATA].length) { // 本地测试 localSecondData LOCAL_SECOND_DATA
leItem[LOCAL_SECOND_DATA].forEach(function (chItem) {
if (chItem[DEFAULT_FIELD] > 0) {
leItem[SELECTED_QUQNTITY] += Number(chItem[DEFAULT_FIELD])
leItem[SELECTED_DATA_ARR].push(chItem)
}
......@@ -200,7 +403,7 @@ class ChooseProductPage extends Component {
// top_sel_sum += leItem[SELECTED_QUQNTITY]
})
// console.log('计算三级之后数据---', topProcOptionList, top_sel_sum)
this.setState({
leftOptionList,
......@@ -210,7 +413,7 @@ class ChooseProductPage extends Component {
// 计算中级数量回调
handleChangeCount(count, coutFieName) {
let {leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex,defaultThridShow} = this.state
let { leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex, defaultThridShow } = this.state
// console.log('计算中级数量回调===', count, leftActiveIndex, defaultThridShow, coutFieName)
topProcOptionList[topActiveIndex].leftOptionList[leftActiveIndex][SELECTED_QUQNTITY] = 0
......@@ -219,19 +422,19 @@ class ChooseProductPage extends Component {
leftOptionList[leftActiveIndex][SELECTED_QUQNTITY] = 0
leftOptionList[leftActiveIndex][SELECTED_DATA_ARR] = []
leftOptionList.map(function(leItem, leIndex) {
if(!leItem[SELECTED_QUQNTITY]){
leftOptionList.map(function (leItem, leIndex) {
if (!leItem[SELECTED_QUQNTITY]) {
leItem[SELECTED_QUQNTITY] = 0
}
if(!leItem[SELECTED_DATA_ARR]){
if (!leItem[SELECTED_DATA_ARR]) {
leItem[SELECTED_DATA_ARR] = []
}
if(leIndex === leftActiveIndex) {
if (leIndex === leftActiveIndex) {
// 当前选择项
leItem[SELECTED_QUQNTITY] = count
if(leItem[DEFAULT_SECOND_DATA].length){ // 本地测试 localSecondData DEFAULT_SECOND_DATA
leItem[DEFAULT_SECOND_DATA].forEach(function(chItem) {
if(chItem[coutFieName]){
if (leItem[LOCAL_SECOND_DATA].length) { // 本地测试 localSecondData LOCAL_SECOND_DATA
leItem[LOCAL_SECOND_DATA].forEach(function (chItem) {
if (chItem[coutFieName]) {
leItem[SELECTED_DATA_ARR].push(chItem)
}
})
......@@ -239,26 +442,27 @@ class ChooseProductPage extends Component {
}
})
topProcOptionList[topActiveIndex].leftOptionList.map(function(leItem, leIndex) {
if(!leItem[SELECTED_QUQNTITY]){
topProcOptionList[topActiveIndex].leftOptionList.map(function (leItem, leIndex) {
if (!leItem[SELECTED_QUQNTITY]) {
leItem[SELECTED_QUQNTITY] = 0
}
if(!leItem[SELECTED_DATA_ARR]){
if (!leItem[SELECTED_DATA_ARR]) {
leItem[SELECTED_DATA_ARR] = []
}
if(leIndex === leftActiveIndex) {
if (leIndex === leftActiveIndex) {
// 当前选择项
leItem[SELECTED_QUQNTITY] = count
if(leItem[DEFAULT_SECOND_DATA].length){ // 本地测试 localSecondData DEFAULT_SECOND_DATA
leItem[DEFAULT_SECOND_DATA].forEach(function(chItem) {
if(chItem[coutFieName]){
if (leItem[LOCAL_SECOND_DATA].length > 0) {
leItem[SELECTED_DATA_ARR] = []
leItem[LOCAL_SECOND_DATA].forEach(function (chItem) {
if (chItem[coutFieName]) {
leItem[SELECTED_DATA_ARR].push(chItem)
}
})
}
}
})
console.log('计算中级之后---', leftOptionList)
// console.log('计算中级之后---', leftOptionList)
this.setState({
leftOptionList,
topProcOptionList
......@@ -275,14 +479,14 @@ class ChooseProductPage extends Component {
// 计算所有已选数量
getAllCountQuantity() {
let {leftOptionList, topProcOptionList, topActiveIndex} = this.state
let { leftOptionList, topProcOptionList, topActiveIndex } = this.state
let allCountQuantity = 0
if(!topProcOptionList.length){
if (!topProcOptionList.length) {
return allCountQuantity
}
topProcOptionList[topActiveIndex].leftOptionList.map(leItem => {
// leftOptionList.map(leItem => {
if(!leItem[SELECTED_QUQNTITY]){
// leftOptionList.map(leItem => {
if (!leItem[SELECTED_QUQNTITY]) {
leItem[SELECTED_QUQNTITY] = 0
}
allCountQuantity += leItem[SELECTED_QUQNTITY]
......@@ -294,12 +498,12 @@ class ChooseProductPage extends Component {
// 点击共计已选
handleSubSelected() {
// console.log('show-----', show)
let {selectShowPopup} = this.state
if(this.getAllCountQuantity() !== 0) {
let { selectShowPopup } = this.state
if (this.getAllCountQuantity() !== 0) {
this.handleCloseSelectModal(!selectShowPopup)
}
}
}
// 点击选好了
handleSubmit() {
console.log('选好了', this.props.navigation.navigate)
......@@ -310,7 +514,7 @@ class ChooseProductPage extends Component {
// 已选修改回调
handleSelectCallBack(options) {
// console.log('--已选修改回调--', options)
let {topProcOptionList, topActiveIndex} = this.state
let { topProcOptionList, topActiveIndex } = this.state
topProcOptionList[topActiveIndex].leftOptionList = options
this.setState({
// leftOptionList: options,
......@@ -319,8 +523,8 @@ class ChooseProductPage extends Component {
}
// 接口错误提示
showRrrorTip(result){
if(result.error_code == 41006) {
showRrrorTip(result) {
if (result.error_code == 41006) {
show('登录过期,请重新登录');
this.props.exitLoginStatus();
} else {
......@@ -337,9 +541,9 @@ class ChooseProductPage extends Component {
placeholder={'请输入搜索关键词'}
style={list_common_item.ser_text_input}
defaultValue={this.state.searchValue}
/>
/>
<View style={list_common_item.ser_img_box}>
<Image source={require('../../../images/search_icon.png')} style={icon_style}/>
<Image source={require('../../../images/search_icon.png')} style={icon_style} />
</View>
</View>
)
......@@ -347,11 +551,14 @@ class ChooseProductPage extends Component {
// 返回顶部产品元素
renderTopProItem() {
let {topProcOptionList, topActiveIndex} = this.state
let { topProcOptionList, topActiveIndex } = this.state
// if(topProcOptionList.length > 0){
// topProcOptionList[topActiveIndex][SELECTED_QUQNTITY]= this.getAllCountQuantity()
// }
console.log('返回顶部产品元素---', topProcOptionList)
if(topProcOptionList.length > 0){
topProcOptionList[topActiveIndex][SELECTED_QUQNTITY]= this.getAllCountQuantity()
}
let cur_title = 'title', cur_icon = 'iconImg'
cur_title = 'supplier_short_name'
cur_icon = 'supplier_icon'
return (
<ChooseCardList
......@@ -365,28 +572,31 @@ class ChooseProductPage extends Component {
cardStyleItemTit={styles.top_tit}
cardStyleItemTitAct={styles.top_tit_act}
cardListOptions={topProcOptionList}
cardItemTitle={'title'}
cardItemIcon={'iconImg'}
cardItemTitle={cur_title}
cardItemIcon={cur_icon}
curActIndex={topActiveIndex}
cardCallBack={(item, index) => this.handleTopNav(item, index)}
cardCountName={SELECTED_QUQNTITY}
cardStyleType={'GRAPHICS'}
cardCouStyle={styles.top_cot_num}
/>
/>
)
}
// 返回底部左侧元素
renderContLeftItem() {
let {leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex} = this.state
let { leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex } = this.state
let curLeftOptions = []
let curLeftActIndex = 0
// curLeftOptions = leftOptionList
// curLeftActIndex = leftActiveIndex
if(topProcOptionList.length > 0){
if (topProcOptionList.length > 0) {
curLeftOptions = topProcOptionList[topActiveIndex].leftOptionList
}
curLeftActIndex = leftActiveIndex
console.log('返回左侧元素---', curLeftOptions)
let cur_title = 'title', cur_icon = 'iconImg'
cur_title = 'category_name'
cur_icon = 'cate_local_icon'
return (
<ChooseCardList
cardStyleBox={styles.cont_left_box}
......@@ -401,13 +611,13 @@ class ChooseProductPage extends Component {
cardStyleItemIcon={styles.cont_left_img_box}
// cardListOptions={leftOptionList}
cardListOptions={curLeftOptions}
cardItemTitle={'title'}
cardItemIcon={'iconImg'}
cardItemTitle={cur_title}
cardItemIcon={cur_icon}
curActIndex={leftActiveIndex}
cardCallBack={(item, index) => this.handleLeftNav(item, index)}
cardCountName={SELECTED_QUQNTITY}
cardStyleType={'GRAPHICS'}
/>
/>
)
}
......@@ -418,23 +628,28 @@ class ChooseProductPage extends Component {
let curRigSecoOption = []
let curSuperLeftOption = []
// if(leftOptionList[leftActiveIndex]){
// curRigSecoOption = leftOptionList[leftActiveIndex][DEFAULT_SECOND_DATA] // 本地数据
// curRigSecoOption = leftOptionList[leftActiveIndex][LOCAL_SECOND_DATA] // 本地数据
// curSuperLeftOption = leftOptionList[leftActiveIndex]
// }
if(topProcOptionList[topActiveIndex] && topProcOptionList[topActiveIndex].leftOptionList){
curRigSecoOption = topProcOptionList[topActiveIndex].leftOptionList[leftActiveIndex][DEFAULT_SECOND_DATA] // 本地数据
curSuperLeftOption = topProcOptionList[topActiveIndex].leftOptionList[leftActiveIndex]
let topItem = topProcOptionList[topActiveIndex]
if (topItem && topItem.leftOptionList) {
let leftItem = topItem.leftOptionList[leftActiveIndex]
if (leftItem && leftItem[LOCAL_SECOND_DATA]) {
curRigSecoOption = leftItem[LOCAL_SECOND_DATA]
curSuperLeftOption = leftItem
}
}
// console.log('-返回右侧二级元素--curRigSecoOption', curRigSecoOption)
return (
<View style={styles.cont_bom_box}>
{ this.renderContLeftItem() }
{ this.renderContLeftItem()}
<ProductRightStyle
navigation={this.props.navigation}
superIndex={leftActiveIndex}
leftIndex={leftActiveIndex}
defaultThridShow={defaultThridShow}
changeThrShow={(defaultThridShow) => this.handleChangeThrShow(defaultThridShow)}
superStencilData={curRigSecoOption}
......@@ -450,12 +665,12 @@ class ChooseProductPage extends Component {
// 返回底部按钮
renderFooterBtnItem() {
let {selectShowPopup, leftOptionList, topProcOptionList, topActiveIndex} = this.state
let { selectShowPopup, leftOptionList, topProcOptionList, topActiveIndex } = this.state
let allCountQuantity = this.getAllCountQuantity()
console.log('左侧数据----', leftOptionList)
let cur_sel_options = []
// cur_sel_options = leftOptionList
if(topProcOptionList.length > 0){
if (topProcOptionList.length > 0) {
cur_sel_options = topProcOptionList[topActiveIndex].leftOptionList
}
return (
......@@ -465,20 +680,20 @@ class ChooseProductPage extends Component {
activeOpacity={.8}
style={list_common_item.lef_btn}
onPress={() => this.handleSubSelected()}
>
>
<Text style={list_common_item.lef_tip}>{'已选:'}{allCountQuantity}</Text>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.rig_btn}
onPress={() => this.handleSubmit()}
>
>
<Text style={list_common_item.rig_tip}>{'选好了'}</Text>
</TouchableOpacity>
</View>
<ProductModel
show={ selectShowPopup }
show={selectShowPopup}
closeModal={(show) => this.handleCloseSelectModal(show)}
closeSubmit={() => this.handleSubmit()}
modelOption={cur_sel_options}
......@@ -488,17 +703,17 @@ class ChooseProductPage extends Component {
</View>
)
}
render() {
let {navigation} = this.props
let {title} = navigation.state.params
return (
render() {
let { navigation } = this.props
let { title } = navigation.state.params
return (
<View style={styles.choo_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
barStyle='light-content'
/>
<View style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.choo_main}>
......@@ -509,10 +724,10 @@ class ChooseProductPage extends Component {
{this.renderFooterBtnItem()}
</View>
</View>
);
);
}
}
const styles = StyleSheet.create({
choo_container: {
flex: 1,
......@@ -531,16 +746,14 @@ const styles = StyleSheet.create({
borderBottomWidth: 1
},
top_scroll_cont: {},
// top_touch_cont: {},
top_inner: {
borderBottomColor: foundation_color,
minWidth: 60
},
top_inner_act: {},
// top_img_box: {},
top_tit: {},
top_tit_act: {},
top_cot_num:{
top_cot_num: {
right: 8
},
cont_bom_box: {
......@@ -646,9 +859,9 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
// requestSelfOrganizations: (params) => {
// dispatch(requestSelfOrganizations(params))
// }
exitLoginStatus: () => {
dispatch(exitLoginStatus())
},
}
}
......
import React, { Component } from 'react';
import { View, StyleSheet, SafeAreaView, ScrollView, FlatList } from 'react-native';
import {connect} from 'react-redux';
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 } from '../../../base/BaseStyle';
import {
......@@ -10,72 +10,185 @@ import StatusBarView from '../../common/StatusBarView';
import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
import PictureZoom from '../../common/listDataComponent/PictureZoom';
import {cloneObject} from '../../../utils/Utils';
import { cloneObject, show } from '../../../utils/Utils';
import { reqSurTempLineSearch, reqNailBoxLineSearch, reqEquipPackageLineSearch } from '../../../action/SelfAction';
import localMockData from './mock/sen_mock';
const SELECTED_QUQNTITY = 'selectedQuantity' // 三级数量
const SELECTED_DATA_ARR = 'selectedDataArr' // 三级已选元素
const DEFAULT_SECOND_DATA = 'localThridContData' // 三级原本元素
const DEFAULT_FIELD = 'quantity' // 计算的字段
const LOCAL_THRID_CONT_DATA = 'localThridContData' // 三级原本元素
const QUANTITY_FIELD = 'quantity' // 计算的字段
class EditThirdLevelPage extends Component {
constructor(props) {
super(props);
this.state = {
this.state = {
topProcOptionList: [],
topActiveIndex: 0,
onlyShow: false, // 只展示
onlySignSelect: false, // 单选
defalutTopItem: [{ // 手术模板显示
"category_code": "sign_consu",
"category_name": "单选耗材"
}, {
"category_code": "screw_box",
"category_name": "钉盒",
"cate_local_icon": require('../../../images/screw_box.png')
}, {
"category_code": "equip_bag",
"category_name": "器械包",
"cate_local_icon": require('../../../images/equip_bag.png')
}, {
"category_code": "auxili_tool",
"category_name": "零散器械",
"cate_local_icon": require('../../../images/auxili_tool.png')
}],
superData: {}
}
}
componentDidMount() {
let {params} = this.props.navigation.state
let that = this
// 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)
// if(curOptions.length > 0){
// curOptions.forEach(function(curIt) {
// curIt.select = false // 初始化
// })
// }
this.setState({
// onlySignSelect: params.superData.thirdSign,
onlyShow: params.superData.thirdShow,
topProcOptionList: curOptions
})
}else {
curOptions = cloneObject(localMockData.localThridOption)
this.setState({
topProcOptionList: curOptions
}, () => {
that.setAllSelectData()
})
// 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()
}
// 初始化获取数据
async initGetData() {
let that = this
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)
that.setState({
superData: cloneObject(superData)
})
if (leftIndex === 0) {
let params = {
access_token: token,
template_number: superItem.template_number
}
let sur_line_search = await reqSurTempLineSearch(global_domain_config, params)
console.log('res_line_1 : ', sur_line_search)
if (sur_line_search.error_code === 0) {
let { data } = sur_line_search
topProcOptionList = cloneObject(defalutTopItem)
topProcOptionList.forEach(function (topIt) {
topIt['localThridContData'] = []
topIt['selectedDataArr'] = []
topIt['selectedQuantity'] = 0
})
if (data.items) {
topProcOptionList[0].localThridContData = data.items
}
if (data.nail_box) {
topProcOptionList[1].localThridContData = data.nail_box
}
if (data.item_package) {
topProcOptionList[2].localThridContData = data.item_package
}
if (data.tool) {
topProcOptionList[3].localThridContData = data.tool
}
that.setState({
topProcOptionList: topProcOptionList
}, () => {
that.setAllSelectData()
})
} else {
that.showRrrorTip(sur_line_search)
}
} else if (leftIndex === 1) {
let params = {
access_token: token,
nail_box_code: superItem.item_code,
nail_box_serial_number: superItem.serial_number,
}
let nail_line_search = await reqNailBoxLineSearch(global_domain_config, params)
console.log('res_line_1 : ', nail_line_search)
if (nail_line_search.error_code === 0) {
let { data } = nail_line_search
topProcOptionList = cloneObject(data.segemt)
topProcOptionList.forEach(function (topIt) {
topIt['localThridContData'] = topIt['details']
topIt['selectedDataArr'] = []
topIt['selectedQuantity'] = 0
})
that.setState({
topProcOptionList: topProcOptionList,
onlyShow: true
}, () => {
// that.setAllSelectData()
})
} else {
that.showRrrorTip(nail_line_search)
}
} else if (leftIndex === 2) {
let params = {
access_token: token,
nail_box_code: superItem.item_code,
nail_box_serial_number: superItem.serial_number,
}
let equip_line_search = await reqEquipPackageLineSearch(global_domain_config, params)
console.log('res_line_1 : ', equip_line_search)
if (equip_line_search.error_code === 0) {
let { data } = equip_line_search
data['localThridContData'] = data['package_components']
data['selectedDataArr'] = []
data['selectedQuantity'] = 0
topProcOptionList[0] = cloneObject(data)
that.setState({
topProcOptionList: topProcOptionList,
onlyShow: true
}, () => {
// that.setAllSelectData()
})
} else {
that.showRrrorTip(equip_line_search)
}
}
}
// 修改列表计算后数据
handleCalCallBack(item, index, dataName){
let {topProcOptionList, topActiveIndex} = this.state
let {params} = this.props.navigation.state
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)
// 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){
......@@ -91,15 +204,15 @@ class EditThirdLevelPage extends Component {
// console.log('设置当前所有已选值---', topProcOptionList)
// }else
if(dataName && topProcOptionList[topActiveIndex][dataName]){
topProcOptionList.map(function(listItem, listIndex) {
if(listIndex === topActiveIndex){
if (dataName && topProcOptionList[topActiveIndex][dataName]) {
topProcOptionList.map(function (listItem, listIndex) {
if (listIndex === topActiveIndex) {
listItem[dataName][index] = item
}
})
that.setState({
topProcOptionList
},() => {
}, () => {
that.setAllSelectData()
})
}
......@@ -107,20 +220,20 @@ class EditThirdLevelPage extends Component {
// 设置当前所有已选值
setAllSelectData() {
let {topProcOptionList} = this.state
topProcOptionList.map(function(listItem) {
let { topProcOptionList } = this.state
topProcOptionList.map(function (listItem) {
listItem[SELECTED_QUQNTITY] = 0
listItem[SELECTED_DATA_ARR] = []
if(listItem[DEFAULT_SECOND_DATA].length){
listItem[DEFAULT_SECOND_DATA].forEach(function(chItem) {
if(chItem[DEFAULT_FIELD]){
listItem[SELECTED_QUQNTITY] += Number(chItem[DEFAULT_FIELD])
if (listItem[LOCAL_THRID_CONT_DATA].length) {
listItem[LOCAL_THRID_CONT_DATA].forEach(function (chItem) {
if (chItem[QUANTITY_FIELD]) {
listItem[SELECTED_QUQNTITY] += Number(chItem[QUANTITY_FIELD])
listItem[SELECTED_DATA_ARR].push(chItem)
}
})
}
})
console.log('设置当前所有已选值---', topProcOptionList)
// console.log('设置当前所有已选值---', topProcOptionList)
this.setState({
topProcOptionList
})
......@@ -137,17 +250,40 @@ class EditThirdLevelPage extends Component {
// 点击编辑完成
handleSubmit() {
let {topProcOptionList} = this.state
let {params} = this.props.navigation.state
let { topProcOptionList, superData } = this.state
let { params } = this.props.navigation.state
// console.log('编辑完成====>', topProcOptionList, params.superData)
// console.log(topProcOptionList[0][DEFAULT_SECOND_DATA][0])
params.childrenPageCallBack(topProcOptionList, params.superData.superIndex)
// console.log(topProcOptionList[0][LOCAL_THRID_CONT_DATA][0])
params.childrenPageCallBack(topProcOptionList, superData.superIndex)
this.props.navigation.goBack()
}
// 接口错误提示
showRrrorTip(result) {
if (result.error_code == 41006) {
show('登录过期,请重新登录');
this.props.exitLoginStatus();
} else {
let error_msg = result.error_msg || result.message
show(error_msg);
}
}
// 返回顶部编辑选项
renderTopProItem() {
let { topProcOptionList, topActiveIndex } = this.state
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'
} else if (leftIndex === 2) {
curTopList = []
} else {
curTit = 'title'
}
return (
<ChooseCardList
cardStyleBox={styles.top_box}
......@@ -159,68 +295,77 @@ class EditThirdLevelPage extends Component {
cardStyleListItemAct={styles.top_inner_act}
cardStyleItemTit={styles.top_tit}
cardStyleItemTitAct={styles.top_tit_act}
cardListOptions={topProcOptionList}
cardItemTitle={'title'}
cardListOptions={curTopList}
cardItemTitle={curTit}
curActIndex={topActiveIndex}
cardCallBack={(item, index) => this.handleTopNav(item, index)}
cardCountName={SELECTED_QUQNTITY}
cardStyleType={'DEFAULT'}
/>
/>
)
}
// 返回底部主要元素
renderContItem() {
let {topProcOptionList, topActiveIndex, onlyShow} = this.state
let {params} = this.props.navigation.state
let curData = []
// 本地测试数据
let localThridContData = []
let imgIconArr = ''
let { topProcOptionList, topActiveIndex, superData, onlyShow } = this.state
let { leftIndex } = superData
if(params.superData.leftIndex === 1){
curData = topProcOptionList
}else if(params.superData.leftIndex === 2){
// let { params } = this.props.navigation.state
// let curData = []
// // 本地测试数据
// let localThridContData = []
// let imgIconArr = ''
// localThridContData = topProcOptionList
// if (params.superData.leftIndex === 1) {
// curData = topProcOptionList
// } else if (params.superData.leftIndex === 2) {
}else{
curData = topProcOptionList[topActiveIndex]
}
if(curData && curData[DEFAULT_SECOND_DATA]) {
localThridContData = curData[DEFAULT_SECOND_DATA]
}
if(curData && curData.imgIconArr){
imgIconArr = curData.imgIconArr
}
// // localThridContData = topProcOptionList
if(params.superData.leftIndex === 2){
// 器械包
localThridContData = topProcOptionList['package_components']
// } else {
// curData = topProcOptionList[topActiveIndex]
// }
// if (curData && curData[LOCAL_THRID_CONT_DATA]) {
// localThridContData = curData[LOCAL_THRID_CONT_DATA]
// }
// if (curData && curData.imgIconArr) {
// imgIconArr = curData.imgIconArr
// }
// if (params.superData.leftIndex === 2) {
// // 器械包
// localThridContData = topProcOptionList['package_components']
// }
let localThridContData = []
let imgIconArr = ''
let topItem = topProcOptionList[topActiveIndex]
if (topItem) {
localThridContData = topItem[LOCAL_THRID_CONT_DATA]
}
console.log('底部数据==' ,curData, localThridContData, topProcOptionList)
return(
console.log('底部数据==', topItem, localThridContData)
return (
<View style={styles.edit_cont}>
{ imgIconArr ? <PictureZoom
listImageIndex={0}
listImageUrls={imgIconArr}
listStyleImage={styles.thr_head_tit_img}
listPicType={'RECTANGLE'}
/> : null }
/> : null}
<ScrollView
style={styles.edit_scroll_cont}
showsVerticalScrollIndicator={false}
>
>
<FlatList
style={styles.edit_list}
keyExtractor={item => item.id}
data={localThridContData}
extraData={this.state}
renderItem={ ({item, index}) => this.renderContColumnItem(item, index) }
/>
renderItem={({ item, index }) => this.renderContColumnItem(item, index)}
/>
</ScrollView>
</View>
)
......@@ -228,89 +373,104 @@ class EditThirdLevelPage extends Component {
// 返回每一列元素
renderContColumnItem(item, index) {
let {onlyShow, onlySignSelect} = this.state
let {params} = this.props.navigation.state
console.log('onlySignSelect', onlySignSelect)
let curTitText='', curTipTextStr='', curTipTextOne='',curCalField='',curImgIcon=''
if(!onlyShow){
curImgIcon = 'imgIconArr'
}
let { topProcOptionList, topActiveIndex, superData, onlyShow, onlySignSelect } = this.state
let { leftIndex } = superData
let curTit = '', curTipStr = '', curTipOne = '', curTipTwo = '', curCalField = '', curImgIcon = ''
let curTipStrTit = '', curTipOneTit = '', curTipTwoTit = ''
// if (!onlyShow) {
// curImgIcon = 'imgIconArr'
// }
// if (params.superData.leftIndex === 2) {
// // 器械包
// curTit = 'item_name'
// curTipStr = 'category_name'
// curTipOne = 'category_desc'
// curCalField = 'quantity'
// curImgIcon = ''
// // 物料名称、分类名称、分类说明
// } else {
// curTit = 'title'
// curTipStr = 'tip1'
// curTipOne = 'tip2'
// curCalField = 'quantity'
// // curImgIcon = ''
// }
curTit = 'general_name'
curTipStr = 'specification'
curTipOne = 'item_name'
curTipTwo = 'category_desc'
curTipStrTit = '规格型号'
curTipOneTit = '物料名称'
curTipTwoTit = '描述'
curCalField = 'quantity'
curImgIcon = 'photos'
if(params.superData.leftIndex === 2){
// 器械包
curTitText='item_name'
curTipTextStr='category_name'
curTipTextOne='category_desc'
curCalField='quantity'
curImgIcon=''
// 物料名称、分类名称、分类说明
}else{
curTitText='title'
curTipTextStr='tip1'
curTipTextOne='tip2'
curCalField='quantity'
// curImgIcon = ''
}
return (
<SafeAreaView style={styles.column_container}>
<PicTitDetaiCalcu
listItem={item}
listIndex={index}
calField={curCalField}
subCalCallBack={(item,index) => this.handleCalCallBack(item,index,DEFAULT_SECOND_DATA)}
titText={curTitText}
tipTextStr={curTipTextStr}
tipTextOne={curTipTextOne}
subCalCallBack={(item, index) => this.handleCalCallBack(item, index, LOCAL_THRID_CONT_DATA)}
titText={curTit}
tipTextStr={curTipStr}
tipTextOne={curTipOne}
tipTextTwo={curTipTwo}
tipTextStrTit={curTipStrTit}
tipTextOneTit={curTipOneTit}
tipTextTwoTit={curTipTwoTit}
listImgIcon={curImgIcon}
listPicType={'ROUND'}
onlyShowNum={onlyShow}
onlyShowSelect={onlySignSelect}
listStyleBox={styles.list_style_box}
/>
/>
</SafeAreaView>
)
}
render() {
let {navigation} = this.props
let {title} = navigation.state.params
let {onlyShow, onlySignSelect} = this.state
let { navigation } = this.props
let { title } = navigation.state.params
let { onlyShow, onlySignSelect } = this.state
console.log('onlyShow==', onlyShow)
let curShowTop = true
if(onlyShow){
if (onlyShow) {
curShowTop = !onlyShow
}
if(onlySignSelect) {
if (onlySignSelect) {
curShowTop = !onlySignSelect
}
return (
return (
<View style={styles.edit_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
barStyle='light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.edit_main}>
{ curShowTop ? this.renderTopProItem() : null}
{/* {curShowTop ? this.renderTopProItem() : null} */}
{this.renderTopProItem()}
{this.renderContItem()}
</View>
{ !onlyShow ? <View style={styles.btom_btn_box}>
<FooterBtnStyle
{!onlyShow ? <View style={styles.btom_btn_box}>
<FooterBtnStyle
style={styles.sub_btn_pro}
activeOpacity={.8}
title={'编辑完成'}
textStyle= {styles.sub_btn_txt}
textStyle={styles.sub_btn_txt}
onPress={() => this.handleSubmit()}
/>
/>
</View> : null}
</SafeAreaView>
</View>
);
);
}
}
......@@ -442,12 +602,12 @@ const mapStateToProps = (state) => {
global_domain_config: state.login.global_domain_config
}
}
const mapDispatchToProps = (dispatch) => {
return {
// requestSelfOrganizations: (params) => {
// dispatch(requestSelfOrganizations(params))
// }
exitLoginStatus: () => {
dispatch(exitLoginStatus())
},
}
}
......
import React , { Component } from 'react';
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 { cloneObject } from '../../../utils/Utils';
import _ from "lodash";
import localMockData from './mock/sen_mock';
import { connect } from 'react-redux';
......@@ -23,13 +23,15 @@ class ProductRightStyle extends Component {
superReduceBack: PropTypes.func, // 减法回调
thirdCallBack: PropTypes.func, // 三级小类的回调函数
superLeftData: PropTypes.object, // 三级大类数据
superStencilData: PropTypes.array, // 当前右侧二级数据
leftIndex: PropTypes.numberm, // 左侧index
}
constructor (props) {
constructor(props) {
super(props)
this.state = {
rightSecondData: this.props.superStencilData, // 右侧分类数据-模块、螺钉盒、器械包、赋值工具
selectItem : [], // 当前选中模板 -- 之前版本
selectItem: [], // 当前选中模板 -- 之前版本
rowSingleData: [], // 人工髋关节假体等数据 -- 小类
thridIsVisible: false, // 小类展示
curThridObj: {
......@@ -39,75 +41,75 @@ class ProductRightStyle extends Component {
}
}
componentDidMount(){
componentDidMount() {
// console.log('本地测试数据====localMockData===', localMockData)
// // 赋值测试数据
// this.setState({
// // rowSingleData: cloneObject(localMockData.localSingleRowData)
// })
}
componentWillReceiveProps(nextProps) {
if (this.state.thridIsVisible != nextProps.defaultThridShow) {
this.setState({thridIsVisible: nextProps.defaultThridShow});
this.setState({ thridIsVisible: nextProps.defaultThridShow });
}
if (nextProps.superStencilData) {
this.setState({rightSecondData: nextProps.superStencilData});
this.setState({ rightSecondData: nextProps.superStencilData });
}
}
// 所有二级数据标题点击事件
TitleClickEvent(item, index) {
let {superIndex} = this.props
console.log('右侧标题点击事件 ', superIndex, index, item)
if(superIndex >= 0 && superIndex < 3) {
let curThirdShow=false, curThirdSign=false, curTit='编辑模板'
if(superIndex === 1){
TitleClickEvent(item, index) {
let { leftIndex } = this.props
console.log('右侧标题点击事件 ', leftIndex, index, item)
if (leftIndex >= 0 && leftIndex < 3) {
let curThirdShow = false, curThirdSign = false, curTit = '编辑模板'
if (leftIndex === 1) {
curThirdShow = true
curTit='钉盒明细'
}else if(superIndex === 2){
curTit = '钉盒明细'
} else if (leftIndex === 2) {
curThirdShow = true
// curThirdSign = true
curTit='器械包明细'
curTit = '器械包明细'
}
this.props.navigation.navigate('EditThirdLevelPage', {
title: curTit,
superData:{
superData: {
superItem: item,
superIndex: index,
leftIndex: superIndex,
leftIndex: leftIndex,
thirdShow: curThirdShow,
thirdSign: curThirdSign,
// thirdSign: curThirdSign,
},
childrenPageCallBack: this.childrenPageCallBack.bind(this) // 传递函数,编辑完成时调用
})
}else if(superIndex === 3){
} else if (leftIndex === 3) {
// 零散器械
this.canPlusOrdReduceOne(item, index)
// this.handleCalCallBack(curData, curIndex, 'rightSecondData', DEFAULT_FIELD)
// this.setState({
// rightSecondData
// })
}else {
} else {
// 单选耗材 中级标题点击之后
this.changeThrShow(true, item, index)
}
}
}
// 零散器械标题点击
canPlusOrdReduceOne(item, index){
let {superIndex} = this.props
let {rightSecondData} = this.state
canPlusOrdReduceOne(item, index) {
let { leftIndex } = this.props
let { rightSecondData } = this.state
// console.log('零散器械标题点击/减1:',rightSecondData)
// console.log('零散器械标题点击/减1:',superIndex)
// console.log('零散器械标题点击/减1:',leftIndex)
// console.log('零散器械标题点击/减1:',item)
// console.log('零散器械标题点击/减1:',index)
}
// 大类加减,小类所有加1/减1
handleAllPlusReduce(curData, curIndex, isPlus){
let {rightSecondData} = this.state
let {superLeftData} = this.props
handleAllPlusReduce(curData, curIndex, isPlus) {
let { rightSecondData } = this.state
let { superLeftData } = this.props
// console.log('大类加减,整理加一/减一', curData, curIndex)
// console.log('右侧数据', rightSecondData, curData[CHILD_DATA_NAME])
......@@ -116,13 +118,13 @@ class ProductRightStyle extends Component {
// console.log('本地测试,获取接口数据--', curData)
if((!curData[CHILD_DATA_NAME] || !curData[CHILD_DATA_NAME].length) && isPlus){
if ((!curData[CHILD_DATA_NAME] || !curData[CHILD_DATA_NAME].length) && isPlus) {
let curObj = {
superId: curData['id'], // 本地测试
superIndex: curIndex, // 本地测试
superTit: superLeftData['title'], // 本地测试
superImg: curData['imgIcon'], // 本地测试
superTip: curData['title'] , // 本地测试
superTip: curData['title'], // 本地测试
curTitle: curData['title'], // 本地测试
version: 0,
lineOptions: rowData,
......@@ -135,30 +137,30 @@ class ProductRightStyle extends Component {
}
// 加法/减法
if(curData[CHILD_DATA_NAME] && curData[CHILD_DATA_NAME].length > 0){
if (curData[CHILD_DATA_NAME] && curData[CHILD_DATA_NAME].length > 0) {
let sumCount = 0
curData[CHILD_DATA_NAME][0].lineOptions.forEach(function(lineIt) {
if(!lineIt[DEFAULT_FIELD]){
curData[CHILD_DATA_NAME][0].lineOptions.forEach(function (lineIt) {
if (!lineIt[DEFAULT_FIELD]) {
lineIt[DEFAULT_FIELD] = 0
}
if(!isPlus){
if (!isPlus) {
// 减法
if(lineIt[DEFAULT_FIELD]){
if (lineIt[DEFAULT_FIELD]) {
lineIt[DEFAULT_FIELD] -= 1
}else {
} else {
lineIt[DEFAULT_FIELD] = 0
}
}else {
} else {
// 加法
lineIt[DEFAULT_FIELD] += 1
}
}
sumCount += lineIt[DEFAULT_FIELD]
})
if(sumCount){
if (sumCount) {
curData[CHILD_DATA_NAME][0][DEFAULT_FIELD] = sumCount
curData[DEFAULT_FIELD] = sumCount
curData[CHILD_DATA_NAME][0].superTip = `${curData['title']}x${sumCount}`
}else {
} else {
curData[DEFAULT_FIELD] = 0
delete curData[CHILD_DATA_NAME]
}
......@@ -174,11 +176,11 @@ class ProductRightStyle extends Component {
// 编辑页面的回调
childrenPageCallBack(childData, index) {
let {rightSecondData} = this.state
let {superIndex} = this.props
console.log('编辑页面的回调----', childData, index, superIndex)
let { rightSecondData } = this.state
let { leftIndex } = this.props
console.log('编辑页面的回调----', childData, index, leftIndex)
let that = this
if(superIndex === 8){ // superIndex === 2 器械包有问题
if (leftIndex === 8) { // leftIndex === 2 器械包有问题
// rightSecondData.forEach(function(rsdItem, rsdIndex) {
// if(!rsdItem[CHILD_DATA_NAME]) {
// rsdItem[CHILD_DATA_NAME] = []
......@@ -217,44 +219,56 @@ class ProductRightStyle extends Component {
// that.handleCalCallBack(rsdItem, rsdIndex, 'rightSecondData', DEFAULT_FIELD)
// }
// })
}else {
rightSecondData.forEach(function(rsdItem, rsdIndex) {
if(!rsdItem[CHILD_DATA_NAME]) {
} else {
rightSecondData.forEach(function (rsdItem, rsdIndex) {
if (!rsdItem[CHILD_DATA_NAME]) {
rsdItem[CHILD_DATA_NAME] = []
}
if(!rsdItem[DEFAULT_FIELD]) {
if (!rsdItem[DEFAULT_FIELD]) {
rsdItem[DEFAULT_FIELD] = 0
}
if(rsdIndex === index) {
if (rsdIndex === index && leftIndex === 0) {
let superTip = ''
childData.map((chDa, chInd) => {
let splitStr = ' / '
if(chInd === childData.length - 1){
splitStr = ''
if (chInd === childData.length - 1) {
splitStr = ''
}
superTip += `${chDa.title}x${chDa.selectedQuantity}${splitStr}`
superTip += `${chDa.category_name}x${chDa.selectedQuantity}${splitStr}`
// superTip += `${chDa.title}x${chDa.selectedQuantity}${splitStr}`
})
let curObj = {
superId: rsdItem['id'], // 本地测试
superIndex: rsdIndex, // 本地测试
superTit: rsdItem['title'], // 本地测试
superImg: rsdItem['imgIcon'], // 本地测试
superTip: superTip , // 本地测试
superId: rsdItem['template_number'],
superIndex: rsdIndex,
superTit: rsdItem['template_name'],
superImg: rsdItem['photos'],
superTip: superTip,
version: 0,
lineOptions: childData,
[DEFAULT_FIELD]: 1
}
if(rsdItem[CHILD_DATA_NAME].length !== 0){
curObj.version = rsdItem[CHILD_DATA_NAME].length
// let curObj = {
// superId: rsdItem['id'], // 本地测试
// superIndex: rsdIndex, // 本地测试
// superTit: rsdItem['title'], // 本地测试
// superImg: rsdItem['imgIcon'], // 本地测试
// superTip: superTip, // 本地测试
// version: 0,
// lineOptions: childData,
// [DEFAULT_FIELD]: 1
// }
if (rsdItem[CHILD_DATA_NAME].length !== 0) {
curObj.version = rsdItem[CHILD_DATA_NAME].length
}
let filEquArr = rsdItem[CHILD_DATA_NAME].filter(function(lineItem) {
if(_.isEqual(lineItem.lineOptions, childData)){
let filEquArr = rsdItem[CHILD_DATA_NAME].filter(function (lineItem) {
if (_.isEqual(lineItem.lineOptions, childData)) {
lineItem[DEFAULT_FIELD] += 1
return lineItem
}
})
// 本地测试
if(filEquArr.length === 0) {
if (filEquArr.length === 0) {
rsdItem[CHILD_DATA_NAME].push(curObj)
}
rsdItem[DEFAULT_FIELD] = Number(rsdItem[DEFAULT_FIELD]) + 1
......@@ -263,7 +277,7 @@ class ProductRightStyle extends Component {
}
})
}
console.log('回调后的数组====', rightSecondData)
this.setState({
rightSecondData
......@@ -272,50 +286,52 @@ class ProductRightStyle extends Component {
// 修改当前小类是否展示
changeThrShow(show, superItem, superIndex) {
let {curThridObj, rowSingleData} = this.state
let { curThridObj, rowSingleData } = this.state
// console.log('修改当前小类是否展示----', show, superItem, superIndex)
let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
let curRowData = cloneObject(localMockData.localSingleRowData) // 本地测试数据 此处应该要请求接口,获取小类数据
// let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
// let curRowData = cloneObject(localMockData.localSingleRowData) // 本地测试数据 此处应该要请求接口,获取小类数据
if(superItem) {
if (superItem) {
// 中类点击时
curThridObj = {
superItem: superItem,
superIndex: superIndex,
image:localTestImageUrls,
title: superItem.title
}
if(superItem[CHILD_DATA_NAME] && superItem[CHILD_DATA_NAME].length > 0 && superItem[CHILD_DATA_NAME][0].lineOptions) {
curRowData = cloneObject(superItem[CHILD_DATA_NAME][0].lineOptions)
// image: localTestImageUrls,
title: superItem.category_name
}
// if (superItem[CHILD_DATA_NAME] && superItem[CHILD_DATA_NAME].length > 0 && superItem[CHILD_DATA_NAME][0].lineOptions) {
// curRowData = cloneObject(superItem[CHILD_DATA_NAME][0].lineOptions)
// }
}
this.setState({
thridIsVisible: show,
curThridObj,
rowSingleData: curRowData
curThridObj: curThridObj,
rowSingleData: superItem['details']
// rowSingleData: curRowData
})
if(!show){
// 点击标题时回调函数修改左侧数据
if (!show) {
// 小类点击标题时,回调函数修改左侧数据
this.props.thirdCallBack(rowSingleData, curThridObj.superIndex)
}
}
// 修改列表计算后数据 - 头/行
handleCalCallBack(item, index, dataName, coutFieName){
console.log('修改列表计算后数据==',item, index, dataName, coutFieName)
if(dataName && this.state[dataName]) {
handleCalCallBack(item, index, dataName, coutFieName) {
// console.log('修改列表计算后数据==', item, index, dataName, coutFieName)
if (dataName && this.state[dataName]) {
let curDataName = this.state[dataName]
curDataName[index] = item
this.setState({
[dataName]: curDataName
})
if(coutFieName) {
if (coutFieName) {
// 除了单选耗材小类的回调
// console.log('除了单选耗材的回调==',item, index, dataName, coutFieName)
// 计算==头
let sumCount = 0
let sumCount = 0
curDataName.map(item => {
if(item[coutFieName]){
if (item[coutFieName]) {
sumCount += Number(item[coutFieName])
}
})
......@@ -327,32 +343,55 @@ class ProductRightStyle extends Component {
// 返回右侧二级每一列(单选耗材以上)
renderSecondtem(item, index) {
let {superIndex} = this.props
let curTitCallBack='', curPlusCallBack='', curReduceCallBack=''
if(superIndex === 1){
let { leftIndex } = this.props
let curTitCallBack = '', curPlusCallBack = '', curReduceCallBack = ''
let curTit='', curTipOne='', curTipTwo='', curTipOneTit='', curTipTwoTit='', curIcon=''
if(leftIndex === 0){
curTit = 'template_name'
curTipOne = 'surgery_type_name'
curTipTwo = 'template_number'
curTipOneTit='手术类型'
curTipTwoTit='模板号'
curIcon='photos'
}else if(leftIndex === 1 || leftIndex === 2 || leftIndex === 3){
curTit = 'general_name'
curTipOne = 'specification'
curTipTwo = 'item_code'
curTipOneTit='规格型号'
curTipTwoTit='物料代码'
curIcon='photos'
}else{
// curTit = 'title'
// curTipOne = 'tip1'
// curTipTwo = 'tip2'
// curTipOneTit='提示1'
// curTipTwoTit='提示2'
// curIcon='imgIconArr'
}
if (leftIndex === 1) {
// 钉盒
curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
curTitCallBack = ((item, index) => this.TitleClickEvent(item, index))
curPlusCallBack = ''
curReduceCallBack = ''
}else if(superIndex === 2){
} else if (leftIndex === 2) {
// 器械包
curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
curTitCallBack = ((item, index) => this.TitleClickEvent(item, index))
curPlusCallBack = ''
curReduceCallBack = ''
// if(item['childQuantity'] > 0) {
// 有数量时,需要点击进入选择
// curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
// curPlusCallBack = ((item, index) => this.TitleClickEvent(item,index))
// curReduceCallBack = (() => this.props.superReduceBack())
// 有数量时,需要点击进入选择
// curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
// curPlusCallBack = ((item, index) => this.TitleClickEvent(item,index))
// curReduceCallBack = (() => this.props.superReduceBack())
// }
}else if(superIndex === 3){
} else if (leftIndex === 3) {
// 零散器械
curTitCallBack=''
curTitCallBack = ''
curPlusCallBack = ''
curReduceCallBack = ''
}else {
curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
curPlusCallBack = ((item, index) => this.TitleClickEvent(item,index))
} else {
curTitCallBack = ((item, index) => this.TitleClickEvent(item, index))
curPlusCallBack = ((item, index) => this.TitleClickEvent(item, index))
curReduceCallBack = (() => this.props.superReduceBack())
}
return (
......@@ -361,68 +400,69 @@ class ProductRightStyle extends Component {
listItem={item}
listIndex={index}
calField={DEFAULT_FIELD}
subCalCallBack={(item,index) => this.handleCalCallBack(item,index,'rightSecondData', DEFAULT_FIELD)}
subCalCallBack={(item, index) => this.handleCalCallBack(item, index, 'rightSecondData', DEFAULT_FIELD)}
titCallBack={curTitCallBack}
titText={'title'}
tipTextOne={'tip1'}
tipTextTwo={'tip2'}
// listImgIcon={'imgIcon'}
listImgIcon={'imgIconArr'}
titText={curTit}
tipTextOne={curTipOne}
tipTextTwo={curTipTwo}
tipTextOneTit={curTipOneTit}
tipTextTwoTit={curTipTwoTit}
listImgIcon={curIcon}
listPicType={'SQUARE'}
plusCallBack={curPlusCallBack}
reduceCallBack={curReduceCallBack}
/>
/>
</SafeAreaView>
)
}
// 返回右侧元素(单选耗材以上)
renderStencilStyle() {
return(
return (
<View style={styles.stencil_cont}>
<FlatList
style={styles.cont_right_list}
keyExtractor={item => item.id}
data={this.state.rightSecondData}
extraData={this.state}
renderItem={({item, index}) => this.renderSecondtem(item, index)}
/>
</View>
renderItem={({ item, index }) => this.renderSecondtem(item, index)}
/>
</View>
)
}
// 单选耗材 -- 小类每一列
renderThridItem(item, index) {
return (
<SafeAreaView style={styles.thr_container}>
<SafeAreaView style={styles.thr_container}>
<PicTitDetaiCalcu
listItem={item}
listIndex={index}
calField={DEFAULT_FIELD}
subCalCallBack={(item,index) => this.handleCalCallBack(item,index,'rowSingleData')}
subCalCallBack={(item, index) => this.handleCalCallBack(item, index, 'rowSingleData')}
titText={'title'}
tipTextOne={'tip1'}
tipTextTwo={'tip2'}
listImgIcon={'imgIconArr'}
/>
/>
</SafeAreaView>
)
}
// 单选耗材 -- 小类
renderThridStyle() {
let {rowSingleData} = this.state
return(
let { rowSingleData } = this.state
return (
<View style={styles.stencil_cont}>
<FlatList
style={styles.cont_thr_list}
keyExtractor={item => item.id}
data={rowSingleData}
extraData={this.state}
renderItem={({item, index}) => this.renderThridItem(item, index)}
/>
renderItem={({ item, index }) => this.renderThridItem(item, index)}
/>
</View>
)
)
}
// 单选耗材 -- 大类每一列
......@@ -434,47 +474,45 @@ class ProductRightStyle extends Component {
listIndex={index}
calField={DEFAULT_FIELD}
listPicType={'ROUND'}
subCalCallBack={(item,index) => this.handleCalCallBack(item, index, 'rightSecondData', DEFAULT_FIELD)}
titCallBack={(item,index) => this.TitleClickEvent(item, index)}
titText={'title'}
// listImgIcon={'imgIcon'}
// listImgIcon={'imgIconArr'}
tipTextOne={'tip1'}
tipTextTwo={'tip2'}
plusCallBack={(item, index) => this.handleAllPlusReduce(item,index, true)}
reduceCallBack={(item, index) => this.handleAllPlusReduce(item,index)}
/>
subCalCallBack={(item, index) => this.handleCalCallBack(item, index, 'rightSecondData', DEFAULT_FIELD)}
titCallBack={(item, index) => this.TitleClickEvent(item, index)}
titText={'category_name'}
tipTextOne={'category_code'}
tipTextOneTit={'分类编码'}
plusCallBack={(item, index) => this.handleAllPlusReduce(item, index, true)}
reduceCallBack={(item, index) => this.handleAllPlusReduce(item, index)}
/>
</SafeAreaView>
)
}
// 单选耗材 -- 大类
renderOtherStyle() {
return(
return (
<View style={styles.cont_other_cont}>
<FlatList
style={styles.cont_other_list}
keyExtractor={item => item.id}
data={this.state.rightSecondData}
extraData={this.state}
renderItem={({item, index}) => this.renderOtherListItem(item, index)}
/>
renderItem={({ item, index }) => this.renderOtherListItem(item, index)}
/>
</View>
)
)
}
// 返回右侧元素
renderRightCurrentStyle() {
let { superIndex } = this.props
let { leftIndex } = this.props
let { thridIsVisible } = this.state
if(superIndex >= 0 && superIndex < 4) {
if (leftIndex >= 0 && leftIndex < 4) {
return this.renderStencilStyle()
} else {
if (!thridIsVisible) {
return this.renderOtherStyle()
} else {
return this.renderThridStyle()
}
}
}
}
......@@ -488,12 +526,12 @@ class ProductRightStyle extends Component {
activeOpacity={.8}
style={styles.thr_head_inner}
onPress={() => this.changeThrShow(false)}
>
>
<View style={styles.thr_head_back}>
<View style={styles.thr_icon_box}>
<Image source={require('../../../images/arr_left.png')} style={icon_style}></Image>
<Image source={require('../../../images/arr_left.png')} style={icon_style}></Image>
</View>
<Text style={styles.thr_head_tit}>{ curThridObj.title }</Text>
<Text style={styles.thr_head_tit}>{curThridObj.title}</Text>
</View>
</TouchableOpacity>
{/* <PictureZoom
......@@ -506,16 +544,16 @@ class ProductRightStyle extends Component {
)
}
}
render() {
return (
<View style={styles.cont_right_box}>
{ this.renderThrHeadStyle() }
{ this.renderThrHeadStyle()}
<ScrollView
style={styles.cont_right_scroll_cont}
showsVerticalScrollIndicator={false}
>
{ this.renderRightCurrentStyle() }
>
{this.renderRightCurrentStyle()}
</ScrollView>
</View>
)
......@@ -538,7 +576,7 @@ const styles = StyleSheet.create({
model_cont: {},
// other right
cont_other_cont: {},
cont_other_list: {},
cont_other_list: {},
oth_container: {},
stencil_cont: {},
thr_head_inner: {},
......@@ -574,12 +612,12 @@ const mapStateToProps = (state) => {
global_domain_config: state.login.global_domain_config
}
}
const mapDispatchToProps = (dispatch) => {
return {
// requestSelfOrganizations: (params) => {
// dispatch(requestSelfOrganizations(params))
// }
exitLoginStatus: () => {
dispatch(exitLoginStatus())
},
}
}
......
const local_photos = ['/jeecg-boot/sys/common/view/files/20200731/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20200731113857_1596166761793_1596184849964.jpg',
'/jeecg-boot/sys/common/view/files/20200921/5_1599645385381_1600672374371.jpg',
'/jeecg-boot/sys/common/view/files/20200921/4_1599645381425_1600672375091.jpg',
'/jeecg-boot/sys/common/view/files/20200921/3_1599645381259_1600672375488.jpg']
// 选择产品-供应商信息查询接口
const inter_1 = {
"error_code": 0,
"error_msg": "成功",
"data": [
{
"org_code": "",
"supplier_type": "MANUFACTURER",
"supplier_code": "SU00000235",
"supplier_name": "大博医疗科技股份有限公司",
"supplier_icon": "/img/logo.5b8eddb3.png",
"supplier_short_name": "大博医疗"
}, {
"org_code": "",
"supplier_type": "MANUFACTURER",
"supplier_code": "SU00000237",
"supplier_name": "山东威高集团医用高分子制品股份有限公司",
"supplier_icon": "/img/logo.5b8eddb3.png",
"supplier_short_name": "山东威高"
}, {
"org_code": "",
"supplier_type": "MANUFACTURER",
"supplier_code": "SU00000237",
"supplier_name": "嘉思特华剑医疗器材(天津)有限公司",
"supplier_icon": "/img/logo.5b8eddb3.png",
"supplier_short_name": "嘉思特"
}, {
"org_code": "",
"supplier_type": "MANUFACTURER",
"supplier_code": "SU00000237",
"supplier_name": "国药集团山西有限公司",
"supplier_icon": "/img/logo.5b8eddb3.png",
"supplier_short_name": "国药集团"
}, {
"org_code": "",
"supplier_type": "MANUFACTURER",
"supplier_code": "SU00000237",
"supplier_name": "国药集团山西有限公司器械分公司",
"supplier_icon": "/img/logo.5b8eddb3.png",
"supplier_short_name": "山西器械"
}, {
"org_code": "",
"supplier_type": "MANUFACTURER",
"supplier_code": "SU00000237",
"supplier_name": "国药集团山西物流有限公司",
"supplier_icon": "/img/logo.5b8eddb3.png",
"supplier_short_name": "山西物流"
}
]
}
// 选择产品-产品信息分类查询接口
const inter_2 = {
"error_code": 0,
"error_msg": "成功",
"data": {
// 上面四个为固定🧷
//单点耗材(此处只返回一级分类)
"item": [{
"category_code": "JSTH-01",
"category_name": "人工髋关节假体"
}, {
"category_code": "JSTH-02",
"category_name": "膝关节假体"
}, {
"category_code": "JSTH-03",
"category_name": "金属带锁髓内钉"
}, {
"category_code": "JSTH-04",
"category_name": "髋关节假体金属髋臼"
}
]
}
}
// 选择产品-手术模板头查询接口
const inter_3 = {
"error_code": 0,
"error_msg": "成功",
"data": {
//手术模板
"surgery_template": [
{
"org_id": "",
"template_number": "ST20200924001",
"template_name": "华森标准PFNA",
"template_desc": "主钉 刀片 锁钉,加长尾帽 PFNA器械",
"surgery_type": "JOINT",
"surgery_type_name": "关节",
"photos": local_photos
}, {
"org_id": "",
"template_number": "ST20200924002",
"template_name": "华森-尺桡骨骨折",
"template_desc": "",
"surgery_type": "TRAUMA",
"surgery_type_name": "创伤",
"photos": local_photos
}, {
"org_id": "",
"template_number": "ST20200924003",
"template_name": "大博右侧联合加压加长",
"template_desc": "上海丙文医疗器械销售中心",
"surgery_type": "TRAUMA",
"surgery_type_name": "创伤",
"photos": local_photos
}, {
"org_id": "",
"template_number": "ST20200924004",
"template_name": "爱康右侧GT",
"template_desc": "右侧股骨髁8个(1.5-6) 胫骨托 10个(A-G) 垫片 16个(8 10 12 14)膝关节工具股骨侧+胫骨侧共两箱",
"surgery_type": "JOINT",
"surgery_type_name": "关节",
"photos": local_photos
}, {
"org_id": "",
"template_number": "ST20200924005",
"template_name": "大博肱骨多维左侧",
"template_desc": "大博肱骨多维左侧*-器械",
"surgery_type": "TRAUMA",
"surgery_type_name": "创伤",
"photos": local_photos
},
]
}
}
// 选择产品-手术模板行查询接口
const inter_4 = {
"error_code": 0,
"error_msg": "成功",
"data": {
//普通耗材
"items": [{
"item_code": "3001202007000098",
"item_name": "042150038",
"general_name": "金属接骨螺钉",
"specification": "全螺牙松质骨螺钉 DTQ06-FT φ4.0×50mm",
"manufacturer_product_code": "",
quantity: 2,
"photos": local_photos
}, {
"item_code": "3001202010006127",
"item_name": "042150050",
"general_name": "金属接骨螺钉",
"specification": "全螺牙松质骨螺钉 DTQ06-FT φ4.0×38mm",
"manufacturer_product_code": "",
quantity: 3,
"photos": local_photos
}, {
"item_code": "3001202010006128",
"item_name": "042150050",
"general_name": "金属接骨螺钉",
"specification": "全螺牙松质骨螺钉 DTQ06-FT φ4.0×26mm",
"manufacturer_product_code": "",
quantity: 1,
"photos": local_photos
}, {
"item_code": "3001202010006113",
"item_name": "栓子16(PE)",
"general_name": "人工髋关节假体",
"specification": "栓子JS-CSO PE 16",
"manufacturer_product_code": "",
quantity: 0,
"photos": local_photos
}, {
"item_code": "3001202010006114",
"item_name": "栓子13(PE)",
"general_name": "人工髋关节假体",
"specification": "栓子JS-CSO PE 13",
"manufacturer_product_code": "",
quantity: 0,
"photos": local_photos
}],
//螺钉盒
"nail_box": [
{
"item_code": "GYSX00000003",
"item_name": "大骨块成套手术器械包-内附属钉盒",
"general_name": "大骨块成套手术器械包-内附属钉盒",
"manufacturer_product_code": "",
quantity: 0,
"photos": local_photos
}, {
"item_code": "GYSX00000004",
"item_name": "小骨块成套手术器械包-内附属钉盒",
"general_name": "小骨块成套手术器械包-内附属钉盒",
"manufacturer_product_code": "",
quantity: 1,
"photos": local_photos
}, {
"item_code": "GYSX00000005",
"item_name": "上肢锁定钉盒II型",
"general_name": "上肢锁定钉盒II型",
"manufacturer_product_code": "",
quantity: 1,
"photos": local_photos
},
],
//器械包
"item_package": [
{
"item_code": "GYSX110000001",
"item_name": "上肢器械包",
"general_name": "上肢器械包",
"specification": "12",
quantity: 1,
"photos": local_photos
}, {
"item_code": "GYSX220000002",
"item_name": "下肢器械包",
"general_name": "下肢器械包",
"specification": "12L",
quantity: 1,
"photos": local_photos
}, {
"item_code": "GYSX330000003",
"item_name": "足踝手术器械包",
"general_name": "足踝手术器械包",
"specification": "JC",
quantity: 0,
"photos": local_photos
}
],
//零散器械
"tool": [
{
"item_code": "GYSXQX00000007",
"item_name": "下肢锁定器械_导针测深器",
"general_name": "下肢锁定器械_导针测深器",
"specification": "L:250.230",
"manufacturer_product_code": "",
quantity: 2,
"photos": local_photos,
},
{
"item_code": "GYSXQX00000006",
"item_name": "III型伽玛型髓内钉通用工具_防旋杆",
"general_name": "III型伽玛型髓内钉通用工具_防旋杆",
quantity: 0,
"specification": "",
"photos": local_photos,
},
{
"item_code": "GYSXQX00000005",
"item_name": "空心钉工具包(4.0型)",
"general_name": "空心钉工具包(4.0型)",
quantity: 0,
"specification": "4.0型",
"photos": local_photos,
}
]
}
}
// 选择产品-螺钉盒头查询接口
const inter_5 = {
"error_code": 0,
"error_msg": "成功",
"data": {
"items": [
{
"item_code": "GYSX000000011",
"item_name": "大骨块成套手术器械包-内附属钉盒",
"general_name": "大骨块成套手术器械包-内附属钉盒",
"specification": "12",
"serial_number": "30012020120400001",
"inv_code": "",
"photos": local_photos
}, {
"item_code": "GYSX000000021",
"item_name": "小骨块成套手术器械包-内附属钉盒",
"general_name": "小骨块成套手术器械包-内附属钉盒",
"specification": "12",
"serial_number": "30012020120400002",
"inv_code": "",
"photos": local_photos
}, {
"item_code": "GYSX000000032",
"item_name": "上肢锁定钉盒II型",
"general_name": "上肢锁定钉盒II型",
"specification": "12",
"serial_number": "30012020120400003",
"inv_code": "",
"photos": local_photos
}
]
}
}
// 选择产品-器械包头查询接口
const inter_55 = {
"error_code": 0,
"error_msg": "成功",
"data": {
"items": [
{
"item_code": "GYSX000000001",
"item_name": "上肢器械包",
"general_name": "上肢器械包",
"specification": "12",
"serial_number": "30012020120400001",
"inv_code": "",
"photos": local_photos
}, {
"item_code": "GYSX000000001",
"item_name": "下肢器械包",
"general_name": "下肢器械包",
"specification": "12L",
"serial_number": "30012020120400002",
"inv_code": "",
"photos": local_photos
}, {
"item_code": "GYSX000000002",
"item_name": "足踝手术器械包",
"general_name": "足踝手术器械包",
"specification": "JC",
"serial_number": "30012020120400003",
"inv_code": "",
"photos": local_photos
}
]
}
}
// 选择产品-螺钉盒明细查询接口
const inter_6 = //当钉盒可视化时,分区域展示
{
"error_code": 0,
"error_msg": "成功",
"data": {
"photos": local_photos,
"segemt": [
{
"segment_code": "HB4.0-QY",
"segment_name": "HB4.0松质螺钉(全牙)",
"details": [{
"item_code": "GYSXQX01100007",
"item_name": "HB4.0-12松质螺钉(全牙)",
"general_name": "HB4.0-12松质螺钉(全牙)",
"specification": "L12",
"quantity": "4",
}, {
"item_code": "GYSXQX02200008",
"item_name": "HB4.0-14松质螺钉(全牙)",
"general_name": "HB4.0-14松质螺钉(全牙)",
"specification": "L14",
"quantity": "2",
}]
},
{
"segment_code": "HA3.5-PD",
"segment_name": "HA3.5-皮质螺钉",
"details": [{
"item_code": "GYSXQX00011008",
"item_name": "锁定螺钉Φ3.5(梅花自攻)",
"general_name": "锁定螺钉Φ3.5(梅花自攻)",
"specification": "Φ3.5×22",
"quantity": "2",
}, {
"item_code": "GYSXQX00022008",
"item_name": "锁定螺钉Φ3.5(梅花自攻)",
"general_name": "锁定螺钉Φ3.5(梅花自攻)",
"specification": "Φ3.5×30",
"quantity": "2",
}, {
"item_code": "GYSXQX00033008",
"item_name": "锁定螺钉Φ3.5(梅花自攻)",
"general_name": "锁定螺钉Φ3.5(梅花自攻)",
"specification": "Φ3.5×45",
"quantity": "1",
}]
},
]
}
}
//当钉盒未可视化,仅在inv_item_package配套
const inter_66 = {
"error_code": 0,
"error_msg": "成功",
"data": {
"photos": local_photos,
"segemt": [
{
"segment_code": "",
"segment_name": "全部",
"details": [{
"item_code": "GYSXQX00000117",
"item_name": "金属锁定接骨板系统",
"general_name": "金属锁定接骨板系统",
"specification": "自攻型规则螺纹锥型锁定钉I型 RTCLS01 φ2.4×14mm",
"quantity": "1",
}, {
"item_code": "GYSXQX00000338",
"item_name": "金属锁定接骨板系统",
"general_name": "金属锁定接骨板系统",
"specification": "自攻型规则螺纹锥型锁定钉I型 RTCLS01 φ2.4×16mm",
"quantity": "1",
}, {
"item_code": "GYSXQX00000668",
"item_name": "金属锁定接骨板系统",
"general_name": "金属锁定接骨板系统",
"specification": "自攻型规则螺纹锥型锁定钉I型 RTCLS01 φ2.4×16mm",
"quantity": "2",
}]
}
]
}
}
// 选择产品-器械包明细查询接口
const inter_7 = {
"error_code": 0,
"error_msg": "成功",
"data": {
"item_code": "SPH2000091209",
"package_components": [
{
"item_code": "GYSXQX01100002",
"quantity": 2,
"category_name": "一类医疗器械",
"category_code": "12",
"specification": "",
"item_name": "SKI膝关节器械",
"unit": "个",
"category_desc": "单件可重复使用的器械",
"general_name": "膝关节手术工具",
"start_date": "2020-10-27T18:46:21"
},
{
"item_code": "GYSXQX02200003",
"quantity": 3,
"category_name": "一类医疗器械",
"category_code": "12",
"specification": "",
"item_name": "HARMONY全髋器械",
"unit": "个",
"category_desc": "单件可重复使用的器械",
"general_name": "人工髋关节手术工具(箱)",
"start_date": "2020-10-27T18:46:21"
},
{
"item_code": "GYSXQX00330004",
"quantity": 2,
"category_name": "一类医疗器械",
"category_code": "12",
"specification": "",
"item_name": "SKII膝关节器械",
"unit": "个",
"category_desc": "单件可重复使用的器械",
"general_name": "膝关节手术工具",
"start_date": "2020-10-27T18:46:21"
}
],
"serial_number": "3001202009000006",
"parent_item_code": "SPH2000091209",
"component_quantity": 2
}
}
// 选择产品-零散器械查询接口
const inter_8 = {
"error_code": 0,
"error_msg": "成功",
"data": {
"tools": [
{
"item_code": "GYSXQX02201103",
"item_name": "下肢锁定器械_导针测深器",
"general_name": "下肢锁定器械_导针测深器",
"specification": "L:250.230",
"quantity": 0,
"photos": local_photos
}, {
"item_code": "GYSXQX02202203",
"item_name": "III型伽玛型髓内钉通用工具_防旋杆",
"general_name": "III型伽玛型髓内钉通用工具_防旋杆",
"specification": "L:250.230",
"quantity": 0,
"photos": local_photos
}, {
"item_code": "GYSXQX02203303",
"item_name": "RSL专用工具",
"general_name": "人工髋关节翻修手术工具(箱)",
"specification": "QX-KS-01 560X275X127",
"quantity": 0,
"photos": local_photos
}
]
}
}
// 选择产品-单点耗材查询接口
const inter_9 = //大-中-小类
{
"error_code": 0,
"error_msg": "成功",
"data":
[{
"category_code": "JSTH-01-01",
"category_name": "股骨头",
"details": [
{
"item_code": "GYSX2010006120",
"item_name": "金属接骨螺钉HBQ6.0X30",
"general_name": "金属接骨螺钉HBQ6.0X30",
"specification": "",
"manufacturer_product_code": "",
"quantity": 0,
"photos": local_photos
}, {
"item_code": "GYSX2010006121",
"item_name": "金属接骨螺钉6.0X26(T)",
"general_name": "金属接骨螺钉6.0X26(T)",
"specification": "",
"quantity": 0,
"photos": local_photos
}
]
}, {
"category_code": "JSTH-01-02",
"category_name": "中置器",
"details": [
{
"item_code": "GYSX2010006122",
"item_name": "栓子16(PE)",
"general_name": "人工髋关节假体",
"specification": "栓子JS-CSO PE 16",
"quantity": 0,
"photos": local_photos
}, {
"item_code": "GYSX2010006125",
"item_name": "栓子13(PE)",
"general_name": "人工髋关节假体",
"specification": "栓子JS-CSO PE 13",
"quantity": 0,
"photos": local_photos
}
]
}
]
}
//大-小类
const inter_99 = {
"error_code": 0,
"error_msg": "成功",
"data": {
"details": [
{
"item_code": "GYSX2010006120",
"item_name": "金属接骨螺钉HBQ6.0X30",
"general_name": "金属接骨螺钉HBQ6.0X30",
"specification": "",
"manufacturer_product_code": "",
"quantity": 0,
"photos": local_photos
}, {
"item_code": "GYSX2010006121",
"item_name": "金属接骨螺钉6.0X26(T)",
"general_name": "金属接骨螺钉6.0X26(T)",
"specification": "",
"quantity": 0,
"photos": local_photos
}, {
"item_code": "GYSX2010006128",
"item_name": "金属接骨螺钉6.0X36(T)",
"general_name": "金属接骨螺钉6.0X36(T)",
"specification": "",
"quantity": 0,
"photos": local_photos
}, {
"item_code": "GYSX2010006129",
"item_name": "金属接骨螺钉6.0X38(T)",
"general_name": "金属接骨螺钉6.0X38(T)",
"specification": "",
"quantity": 0,
"photos": local_photos
}
]
}
}
export default{
inter_1,
inter_2,
inter_3,
inter_4,
inter_5,
inter_55,
inter_6,
inter_66,
inter_7,
inter_8,
inter_9,
inter_99
}
\ 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