Commit 74ee86e9 by Denglingling

调整自助下单-选择产品模块(本地模拟数据,以及部分交互)

parent ce9edb33
...@@ -354,59 +354,81 @@ class ProductModel extends Component { ...@@ -354,59 +354,81 @@ class ProductModel extends Component {
// 修改列表计算后数据 // 修改列表计算后数据
handleCalCallBack(item, index){ handleCalCallBack(item, index){
// console.log('回调=====', item, index) console.log('回调=====', item, index)
let {topProcOptionList, topActiveIndex} = this.state let {topProcOptionList, topActiveIndex} = this.state
let defauIndex = index let defauIndex = index
// SUB_LINE_NAME = 'childrenLineData' // 测试 item.superIndex // SUB_LINE_NAME = 'childrenLineData' // 测试 item.superIndex
defauIndex = item.superIndex defauIndex = item.superIndex
// console.log('--当前已选数据 ===',topProcOptionList, topActiveIndex) console.log('--当前已选数据 ===',topProcOptionList, topActiveIndex)
if(SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][SELECTED_DATA_ARR]) { if(SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][SELECTED_DATA_ARR]) {
let allCountQuantity = 0 // 初始化 let allCountQuantity = 0 // 初始化
topProcOptionList.map(function(listItem, listIndex) { topProcOptionList.map(function(listItem, listIndex) {
if(listIndex === topActiveIndex){ if(listIndex === topActiveIndex){
let deleFlag = false
let deleInd = null if(topActiveIndex === 1 || topActiveIndex === 3 || topActiveIndex === 2){
// 初始化 三级 //钉盒 零散器械
listItem[SELECTED_DATA_ARR][defauIndex][DEFAULT_QUANTITY] = 0 //初始化 中类
listItem[SELECTED_DATA_ARR][defauIndex]['childrenLineData'].forEach(function(chIt, chInd) { let deleFlag = false
if(_.isEqual(chIt, item)){ let deleInd = null
chIt = item listItem[SELECTED_QUQNTITY] = 0
if(chIt[DEFAULT_QUANTITY] === 0){ listItem[SELECTED_DATA_ARR].forEach(function(seDa, seInd) {
if(!seDa[DEFAULT_QUANTITY]){
seDa[DEFAULT_QUANTITY] = 0
}
if(seDa[DEFAULT_QUANTITY] === 0){
deleFlag = true deleFlag = true
deleInd = chInd deleInd = seInd
} }
listItem[SELECTED_QUQNTITY] += Number(seDa[DEFAULT_QUANTITY])
})
if(deleFlag) {
listItem[SELECTED_DATA_ARR].splice(deleInd, 1)
} }
if(!chIt[DEFAULT_QUANTITY]){ }else {
chIt[DEFAULT_QUANTITY] = 0 let deleFlag = false
} let deleInd = null
listItem[SELECTED_DATA_ARR][defauIndex][DEFAULT_QUANTITY] += Number(chIt[DEFAULT_QUANTITY]) // 初始化 三级
}) listItem[SELECTED_DATA_ARR][defauIndex][DEFAULT_QUANTITY] = 0
if(deleFlag) { listItem[SELECTED_DATA_ARR][defauIndex]['childrenLineData'].forEach(function(chIt, chInd) {
listItem[SELECTED_DATA_ARR][defauIndex]['childrenLineData'].splice(deleInd, 1) if(_.isEqual(chIt, item)){
} chIt = item
// 初始化 中类 if(chIt[DEFAULT_QUANTITY] === 0){
listItem[SELECTED_QUQNTITY] = 0 deleFlag = true
listItem[SELECTED_DATA_ARR].forEach(function(seDa) { deleInd = chInd
if(!seDa[DEFAULT_QUANTITY]){
seDa[DEFAULT_QUANTITY] = 0
}
listItem[SELECTED_QUQNTITY] += Number(seDa[DEFAULT_QUANTITY])
})
// 已选数量赋值之前默认数据
let curObj = listItem[SELECTED_DATA_ARR][defauIndex]
// console.log('curObj----', curObj)
if(listIndex < 4){
if(curObj.id){
listItem[DEFAULT_SECOND_DATA].forEach(function(deIt) {
if(deIt.id === curObj.id){ // 本地测试'id'为唯一值
deIt = curObj
} }
}) }
if(!chIt[DEFAULT_QUANTITY]){
chIt[DEFAULT_QUANTITY] = 0
}
listItem[SELECTED_DATA_ARR][defauIndex][DEFAULT_QUANTITY] += Number(chIt[DEFAULT_QUANTITY])
})
if(deleFlag) {
listItem[SELECTED_DATA_ARR][defauIndex]['childrenLineData'].splice(deleInd, 1)
}
// 初始化 中类
listItem[SELECTED_QUQNTITY] = 0
listItem[SELECTED_DATA_ARR].forEach(function(seDa) {
if(!seDa[DEFAULT_QUANTITY]){
seDa[DEFAULT_QUANTITY] = 0
}
listItem[SELECTED_QUQNTITY] += Number(seDa[DEFAULT_QUANTITY])
})
// 已选数量赋值之前默认数据
let curObj = listItem[SELECTED_DATA_ARR][defauIndex]
// console.log('curObj----', curObj)
if(listIndex < 4){
if(curObj.id){
listItem[DEFAULT_SECOND_DATA].forEach(function(deIt) {
if(deIt.id === curObj.id){ // 本地测试'id'为唯一值
deIt = curObj
}
})
}
} }
} }
} }
if(!listItem[SELECTED_QUQNTITY]){ if(!listItem[SELECTED_QUQNTITY]){
listItem[SELECTED_QUQNTITY] = 0 listItem[SELECTED_QUQNTITY] = 0
...@@ -492,12 +514,17 @@ class ProductModel extends Component { ...@@ -492,12 +514,17 @@ class ProductModel extends Component {
renderContItem() { renderContItem() {
let {topProcOptionList, topActiveIndex} = this.state let {topProcOptionList, topActiveIndex} = this.state
let curData = topProcOptionList[topActiveIndex] let curData = topProcOptionList[topActiveIndex]
// console.log('已选展示信息 === curData---', topProcOptionList, topActiveIndex, curData) // console.log('已选展示信息 === curData---', topProcOptionList)
// console.log('已选展示信息 === curData---', topActiveIndex)
// console.log('已选展示信息 === curData---', curData)
let localBottomContData = [] let localBottomContData = []
if(curData && curData[SELECTED_DATA_ARR]){ if(curData && curData[SELECTED_DATA_ARR]){
// localBottomContData = curData[SELECTED_DATA_ARR] // localBottomContData = curData[SELECTED_DATA_ARR]
curData[SELECTED_DATA_ARR].forEach(function(sedItem) { curData[SELECTED_DATA_ARR].forEach(function(sedItem) {
if(sedItem[CHILD_DATA_NAME]){ if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
//钉盒 零散器械
localBottomContData.push(sedItem)
}else if(sedItem[CHILD_DATA_NAME]){
localBottomContData.push(...sedItem[CHILD_DATA_NAME]) localBottomContData.push(...sedItem[CHILD_DATA_NAME])
} }
}) })
...@@ -525,6 +552,20 @@ class ProductModel extends Component { ...@@ -525,6 +552,20 @@ class ProductModel extends Component {
// 返回每一列元素 // 返回每一列元素
renderContColumnItem(item, index) { renderContColumnItem(item, index) {
let {topActiveIndex} = this.state let {topActiveIndex} = this.state
let curTitText='', curTipTextOne='', curTipTextTwo=''
if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
//钉盒 零散器械
curTitText = 'title'
curTipTextOne = 'tip1'
curTipTextTwo = 'tip2'
if(topActiveIndex === 2){
curTipTextOne = 'lineTip'
curTipTextTwo = ''
}
}else {
curTitText = 'superTit'
curTipTextOne = 'superTip'
}
return ( return (
<TouchableOpacity <TouchableOpacity
activeOpacity={1} activeOpacity={1}
...@@ -535,8 +576,9 @@ class ProductModel extends Component { ...@@ -535,8 +576,9 @@ class ProductModel extends Component {
listIndex={index} listIndex={index}
calField={DEFAULT_QUANTITY} calField={DEFAULT_QUANTITY}
subCalCallBack={(item,index) => this.handleCalCallBack(item,index)} subCalCallBack={(item,index) => this.handleCalCallBack(item,index)}
titText={'superTit'} titText={curTitText}
tipTextOne={'superTip'} tipTextOne={curTipTextOne}
tipTextTwo={curTipTextTwo}
// listImgIcon={'superImg'} // listImgIcon={'superImg'}
listPicType={'SQUARE'} listPicType={'SQUARE'}
listStyleImg={styles.list_icon} listStyleImg={styles.list_icon}
...@@ -607,7 +649,7 @@ class ProductModel extends Component { ...@@ -607,7 +649,7 @@ class ProductModel extends Component {
onRequestClose={() => this.closeModal()}> onRequestClose={() => this.closeModal()}>
<SafeAreaView style={safe_view}> <SafeAreaView style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1} <TouchableOpacity style={styles.container} activeOpacity={1}
// onPress={() => this.closeModal()} onPress={() => this.closeModal()}
> >
{this.renderDialog()} {this.renderDialog()}
</TouchableOpacity> </TouchableOpacity>
...@@ -642,7 +684,7 @@ const styles = StyleSheet.create({ ...@@ -642,7 +684,7 @@ const styles = StyleSheet.create({
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
borderTopLeftRadius: 12, borderTopLeftRadius: 12,
borderTopRightRadius: 12, borderTopRightRadius: 12,
height: pxHeight(580), height: pxHeight(680),
// maxHeight: pxHeight(580), // maxHeight: pxHeight(580),
// minHeight: pxHeight(360) // minHeight: pxHeight(360)
}, },
......
...@@ -38,7 +38,8 @@ class ChooseCardList extends Component { ...@@ -38,7 +38,8 @@ class ChooseCardList extends Component {
cardCountName: PropTypes.string, // 显示计数字段 cardCountName: PropTypes.string, // 显示计数字段
cardStyleType: PropTypes.object, // 计数样式 cardStyleType: PropTypes.string, // 计数可选样式
cardCouStyle: PropTypes.object, // 指定计数样式
// cardCountArray: PropTypes.array, // 已选数组 // cardCountArray: PropTypes.array, // 已选数组
...@@ -78,15 +79,13 @@ class ChooseCardList extends Component { ...@@ -78,15 +79,13 @@ class ChooseCardList extends Component {
render() { render() {
let {cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox, cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardImgName, cardItemName, let {cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox, cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardImgName, cardItemName,
cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardIsCount, cardCountName, cardStyleCount, cardStyleType, ...props} = this.props cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardIsCount, cardCountName, cardStyleCount, cardStyleType, cardCouStyle, ...props} = this.props
let {countStyleType} = this.state let {countStyleType} = this.state
let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据 let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
cardListOptions[cardImgName] = localTestImageUrls // 本地测试 cardListOptions[cardImgName] = localTestImageUrls // 本地测试
return ( return (
<View style={[styles.card_container, cardStyleBox]}> <View style={[styles.card_container, cardStyleBox]}>
<ScrollView <ScrollView
...@@ -96,8 +95,11 @@ class ChooseCardList extends Component { ...@@ -96,8 +95,11 @@ class ChooseCardList extends Component {
showsVerticalScrollIndicator={!!cardShowsVerticalScrollIndicator} showsVerticalScrollIndicator={!!cardShowsVerticalScrollIndicator}
style={[styles.card_scroll_box,cardStyleScroll]} style={[styles.card_scroll_box,cardStyleScroll]}
> >
{ cardListOptions.map((item, index) => { cardListOptions.map((item, index) => {
<View style={styles.card_list_box}> if(typeof item[cardItemIcon] === 'string'){
item[cardItemIcon] = {uri: item[cardItemIcon]}
}
return <View style={styles.card_list_box}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={.8}
style={styles.list_touch_cont} style={styles.list_touch_cont}
...@@ -109,15 +111,16 @@ class ChooseCardList extends Component { ...@@ -109,15 +111,16 @@ class ChooseCardList extends Component {
</View> : null } </View> : null }
<Text numberOfLines={2} style={[styles.list_item_tit, cardStyleItemTit, item[cardItemIcon] ? '' : cardStyleNotIconTit, index == curActIndex ? [styles.list_tit_act, cardStyleItemTitAct] : '']}> <Text numberOfLines={2} style={[styles.list_item_tit, cardStyleItemTit, item[cardItemIcon] ? '' : cardStyleNotIconTit, index == curActIndex ? [styles.list_tit_act, cardStyleItemTitAct] : '']}>
{item[cardItemTitle]} {item[cardItemTitle]}
{ (item[cardCountName] && countStyleType[0] === cardStyleType) ? <Text style={styles.sum_def}>({item[cardCountName]})</Text> : null } { (item[cardCountName] && countStyleType[0] === cardStyleType) ? <Text style={[styles.sum_def, cardCouStyle]}>({item[cardCountName]})</Text> : null }
</Text> </Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
{ (item[cardCountName] && countStyleType[1] === cardStyleType) ? <View style={styles.card_def_count}> { (item[cardCountName] && countStyleType[1] === cardStyleType) ? <View style={[styles.card_def_count, cardCouStyle]}>
<Text style={styles.def_count_txt}>{item[cardCountName]}</Text> <Text style={styles.def_count_txt}>{item[cardCountName]}</Text>
</View> : null} </View> : null}
</View> </View>
)
})
} }
</ScrollView> </ScrollView>
...@@ -142,7 +145,8 @@ const styles = StyleSheet.create({ ...@@ -142,7 +145,8 @@ const styles = StyleSheet.create({
marginRight: 14, marginRight: 14,
borderBottomWidth: 4, borderBottomWidth: 4,
borderBottomColor: home_background_color, borderBottomColor: home_background_color,
minWidth: 60 minWidth: 60,
maxWidth: 80
}, },
list_inner_act: { list_inner_act: {
borderBottomWidth: 2, borderBottomWidth: 2,
......
...@@ -34,6 +34,8 @@ class PicTitDetaiCalcu extends Component { ...@@ -34,6 +34,8 @@ class PicTitDetaiCalcu extends Component {
listCardActIndex: PropTypes.number, // 父级index = 展示index listCardActIndex: PropTypes.number, // 父级index = 展示index
listStyleClearBtn: PropTypes.object, listStyleClearBtn: PropTypes.object,
clearCallBack: PropTypes.func, // 清空图标回调函数 clearCallBack: PropTypes.func, // 清空图标回调函数
onlyShowNum: PropTypes.bool, // 只展示数字
onlyShowSelect: PropTypes.bool, // 只能单选
} }
constructor(props) { constructor(props) {
...@@ -48,6 +50,12 @@ class PicTitDetaiCalcu extends Component { ...@@ -48,6 +50,12 @@ class PicTitDetaiCalcu extends Component {
// handelClearCheck(item, index) { // handelClearCheck(item, index) {
// reduceCallBack(item, index) // reduceCallBack(item, index)
// } // }
// 单选点击
handelSelectCheck(item, index){
item.select = !!!item.select
this.props.subCalCallBack(item, index)
}
/** /**
* 点击加减 * 点击加减
...@@ -82,7 +90,8 @@ class PicTitDetaiCalcu extends Component { ...@@ -82,7 +90,8 @@ class PicTitDetaiCalcu extends Component {
render() { render() {
let {listItem, listIndex, calField, listStyleBox, listStyleTit, listStyleTip, listStyleCalBtn, listPicType, titCallBack, let {listItem, listIndex, calField, listStyleBox, listStyleTit, listStyleTip, listStyleCalBtn, listPicType, titCallBack,
titText, tipTextStr, tipTextOne, tipTextTwo, listImgIcon, listStyleImg, showClearIcon, showClearIndex, listCardActIndex, listStyleClearBtn, clearCallBack} = this.props titText, tipTextStr, tipTextOne, tipTextTwo, listImgIcon, listStyleImg, showClearIcon, showClearIndex, listCardActIndex,
listStyleClearBtn, clearCallBack, onlyShowNum, onlyShowSelect, tipTextStrTit, tipTextOneTit, tipTextTwoTit} = this.props
let {listPicTypeArr, picStyleArr} = this.state let {listPicTypeArr, picStyleArr} = this.state
let picOthStyle = '' let picOthStyle = ''
if(listPicTypeArr.indexOf(listPicType) > -1){ if(listPicTypeArr.indexOf(listPicType) > -1){
...@@ -93,8 +102,13 @@ class PicTitDetaiCalcu extends Component { ...@@ -93,8 +102,13 @@ class PicTitDetaiCalcu extends Component {
if(!valIsZero) { if(!valIsZero) {
calIcon = require('../../../images/plur_big_act.png') calIcon = require('../../../images/plur_big_act.png')
} }
let defSelIcon = require('../../../images/radio_no.png')
if(onlyShowSelect && listItem.select){
defSelIcon = require('../../../images/radio_yes.png')
}
console.log('每一列----',listItem[listImgIcon], listItem[listImgIcon] instanceof Array) // console.log('每一列----',listItem[listImgIcon], listItem[listImgIcon] instanceof Array)
return ( return (
...@@ -164,7 +178,7 @@ class PicTitDetaiCalcu extends Component { ...@@ -164,7 +178,7 @@ class PicTitDetaiCalcu extends Component {
</View> : null } </View> : null }
<View style={styles.ri_text_box}> <View style={styles.ri_text_box}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={titCallBack ? .8 : 1}
onPress={() => {titCallBack ? titCallBack(listItem, listIndex) : {}}} onPress={() => {titCallBack ? titCallBack(listItem, listIndex) : {}}}
style={styles.oth_box} style={styles.oth_box}
> >
...@@ -188,8 +202,9 @@ class PicTitDetaiCalcu extends Component { ...@@ -188,8 +202,9 @@ class PicTitDetaiCalcu extends Component {
<Image source={require('../../../images/close_icon.png')} style={icon_style}></Image> <Image source={require('../../../images/close_icon.png')} style={icon_style}></Image>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> : <View style={styles.ri_num_box}> </View> :
{ listItem[calField] !== 0 ? <View style={[styles.ri_num_box, onlyShowNum ? styles.show_num_box : null]}>
{ (listItem[calField] !== 0 && !onlyShowNum && !onlyShowSelect) ?
<TouchableOpacity <TouchableOpacity
activeOpacity={.9} activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]} style={[styles.btn_inner, listStyleCalBtn]}
...@@ -199,8 +214,8 @@ class PicTitDetaiCalcu extends Component { ...@@ -199,8 +214,8 @@ class PicTitDetaiCalcu extends Component {
<Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image> <Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image>
</View> </View>
</TouchableOpacity> : null } </TouchableOpacity> : null }
{ listItem[calField] !== 0 ? <Text style={styles.thr_num}>{ listItem[calField] }</Text> : null} { (listItem[calField] !== 0 && !onlyShowSelect) ? <Text style={[styles.thr_num, onlyShowNum ? styles.show_num : null]}>{ listItem[calField] }</Text> : null}
<TouchableOpacity { (!onlyShowNum && !onlyShowSelect) ? <TouchableOpacity
activeOpacity={.9} activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]} style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex, true)} onPress={() => this.handelCalculation(listItem, listIndex, true)}
...@@ -208,9 +223,19 @@ class PicTitDetaiCalcu extends Component { ...@@ -208,9 +223,19 @@ class PicTitDetaiCalcu extends Component {
<View style={[styles.thr_num_btn, styles.thr_btn_right]}> <View style={[styles.thr_num_btn, styles.thr_btn_right]}>
<Image source={calIcon} style={icon_style}></Image> <Image source={calIcon} style={icon_style}></Image>
</View> </View>
</TouchableOpacity> </TouchableOpacity> : null}
</View>
{ 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>
...@@ -270,7 +295,12 @@ const styles = StyleSheet.create({ ...@@ -270,7 +295,12 @@ const styles = StyleSheet.create({
width: pxSize(24), width: pxSize(24),
height: pxSize(30) height: pxSize(30)
}, },
thr_sel_btn: {
width: pxSize(22),
height: pxSize(22)
},
btn_inner: {}, btn_inner: {},
btn_sel_inner:{},
btn_cle_box:{ btn_cle_box:{
marginRight: 6, marginRight: 6,
// backgroundColor: 'red', // backgroundColor: 'red',
...@@ -290,6 +320,9 @@ const styles = StyleSheet.create({ ...@@ -290,6 +320,9 @@ const styles = StyleSheet.create({
marginLeft: 6, marginLeft: 6,
backgroundColor: home_background_color backgroundColor: home_background_color
}, },
show_num_box: {
backgroundColor: null
},
thr_btn_left: {}, thr_btn_left: {},
thr_btn_right: {}, thr_btn_right: {},
thr_num: { thr_num: {
...@@ -299,6 +332,9 @@ const styles = StyleSheet.create({ ...@@ -299,6 +332,9 @@ const styles = StyleSheet.create({
fontSize: 14, fontSize: 14,
color: first_text_color color: first_text_color
}, },
show_num: {
fontSize: 18
}
}) })
export default PicTitDetaiCalcu; export default PicTitDetaiCalcu;
\ No newline at end of file
...@@ -560,41 +560,72 @@ class EquipConsuPage extends Component { ...@@ -560,41 +560,72 @@ class EquipConsuPage extends Component {
handleCallBack(item, itemTitle) { handleCallBack(item, itemTitle) {
let { listOptionData} = this.state let { listOptionData} = this.state
let self = this let self = this
this.setState({ listOptionData.map(function(chItem, index){
currentItem: item, if(chItem.title === itemTitle) {
}) chItem.name = item.name
this.setState({ chItem.value = item.value
listOptionData: listOptionData.map((chItem, index) => { if(itemTitle === '组织') {
if(chItem.title === itemTitle) { self.clearInitNameAndValue(1)
chItem.name = item.name }
chItem.value = item.value if(itemTitle === '客户名称') {
if(itemTitle === '组织') { self.clearInitNameAndValue(2)
self.clearInitNameAndValue(1) }
} if (itemTitle === '主治医生') {
if(itemTitle === '客户名称') { if(item.name === '其他') {
self.clearInitNameAndValue(2) chItem.showInput = true
} } else {
if (itemTitle === '主治医生') { chItem.showInput = false
if(item.name === '其他') { chItem.inputValue = ''
chItem.showInput = true
} else {
chItem.showInput = false
chItem.inputValue = ''
}
self.clearInitNameAndValue(5)
}
if(itemTitle === '手术类型') {
self.clearInitNameAndValue(6)
} }
if (itemTitle === '手术模板') { self.clearInitNameAndValue(5)
listOptionData[10].value = item.desc
}
} }
return chItem if(itemTitle === '手术类型') {
}) self.clearInitNameAndValue(6)
}, () => { }
if (itemTitle === '手术模板') {
listOptionData[10].value = item.desc
}
}
})
this.setState({
currentItem: item,
listOptionData: listOptionData
},() => {
self.changeCanSub() self.changeCanSub()
}) })
// this.setState({
// listOptionData: listOptionData.map((chItem, index) => {
// if(chItem.title === itemTitle) {
// chItem.name = item.name
// chItem.value = item.value
// if(itemTitle === '组织') {
// self.clearInitNameAndValue(1)
// }
// if(itemTitle === '客户名称') {
// self.clearInitNameAndValue(2)
// }
// if (itemTitle === '主治医生') {
// if(item.name === '其他') {
// chItem.showInput = true
// } else {
// chItem.showInput = false
// chItem.inputValue = ''
// }
// self.clearInitNameAndValue(5)
// }
// if(itemTitle === '手术类型') {
// self.clearInitNameAndValue(6)
// }
// if (itemTitle === '手术模板') {
// listOptionData[10].value = item.desc
// }
// }
// return chItem
// })
// }, () => {
// self.changeCanSub()
// })
} }
// 关闭弹窗 // 关闭弹窗
...@@ -700,7 +731,7 @@ class EquipConsuPage extends Component { ...@@ -700,7 +731,7 @@ class EquipConsuPage extends Component {
} }
// 客户名称 点击 // 客户名称 点击
handleCustomerCheck() { handleCustomerCheck() {
let { state, props } = this let { state } = this
let self = this let self = this
if(this.judgeOrgIsNull()) { if(this.judgeOrgIsNull()) {
self.setState({ self.setState({
......
...@@ -47,7 +47,9 @@ class EditThirdLevelPage extends Component { ...@@ -47,7 +47,9 @@ class EditThirdLevelPage extends Component {
super(props); super(props);
this.state = { this.state = {
topProcOptionList: [], topProcOptionList: [],
topActiveIndex: 0 topActiveIndex: 0,
onlyShow: false, // 只展示
onlySignSelect: false, // 单选
} }
} }
...@@ -55,21 +57,62 @@ class EditThirdLevelPage extends Component { ...@@ -55,21 +57,62 @@ class EditThirdLevelPage extends Component {
let {params} = this.props.navigation.state let {params} = this.props.navigation.state
let that = this let that = this
// console.log('本地测试数据====localMockData===', localMockData) // console.log('本地测试数据====localMockData===', localMockData)
// console.log('父组件传递的值==', params) console.log('父组件传递的值==', params)
// 赋值测试数据 // 赋值测试数据
this.setState({ let curOptions = []
topProcOptionList: cloneObject(localMockData.localThridOption) if(params.superData.leftIndex === 1){
}, () => { // 钉盒
that.setAllSelectData() 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,
topProcOptionList: curOptions
})
}else {
curOptions = cloneObject(localMockData.localThridOption)
this.setState({
topProcOptionList: curOptions
}, () => {
that.setAllSelectData()
})
}
} }
// 修改列表计算后数据 // 修改列表计算后数据
handleCalCallBack(item, index, dataName){ handleCalCallBack(item, index, dataName){
let {topProcOptionList, topActiveIndex} = this.state let {topProcOptionList, topActiveIndex} = this.state
let {params} = this.props.navigation.state
let that = this let that = this
// console.log('修改列表计算后数据',item, index, dataName) console.log('修改列表计算后数据',item, index, dataName)
if(dataName && topProcOptionList[topActiveIndex][dataName]) { console.log('修改列表计算后数据',topActiveIndex, topProcOptionList)
console.log('父组件传递的值==', params.superData.leftIndex)
if(params.superData.leftIndex === 2){
topProcOptionList.map(function(topItem, topInd) {
if(topInd === index){
topItem = item
}else {
topItem.select = false // 初始化
}
})
that.setState({
topProcOptionList
})
console.log('设置当前所有已选值---', topProcOptionList)
}else if(dataName && topProcOptionList[topActiveIndex][dataName]){
topProcOptionList.map(function(listItem, listIndex) { topProcOptionList.map(function(listItem, listIndex) {
if(listIndex === topActiveIndex){ if(listIndex === topActiveIndex){
listItem[dataName][index] = item listItem[dataName][index] = item
...@@ -98,7 +141,7 @@ class EditThirdLevelPage extends Component { ...@@ -98,7 +141,7 @@ class EditThirdLevelPage extends Component {
}) })
} }
}) })
// console.log('设置当前所有已选值---', topProcOptionList) console.log('设置当前所有已选值---', topProcOptionList)
this.setState({ this.setState({
topProcOptionList topProcOptionList
}) })
...@@ -149,26 +192,36 @@ class EditThirdLevelPage extends Component { ...@@ -149,26 +192,36 @@ class EditThirdLevelPage extends Component {
// 返回底部主要元素 // 返回底部主要元素
renderContItem() { renderContItem() {
let {topProcOptionList, topActiveIndex} = this.state let {topProcOptionList, topActiveIndex, onlyShow} = this.state
let curData = topProcOptionList[topActiveIndex] let {params} = this.props.navigation.state
let curData = []
// 本地测试数据 // 本地测试数据
let localThridContData = [] let localThridContData = []
let iconImg = '' let imgIconArr = ''
if(params.superData.leftIndex === 1){
curData = topProcOptionList
}else if(params.superData.leftIndex === 2){
localThridContData = topProcOptionList
}else{
curData = topProcOptionList[topActiveIndex]
}
if(curData && curData[DEFAULT_SECOND_DATA]) { if(curData && curData[DEFAULT_SECOND_DATA]) {
localThridContData = curData[DEFAULT_SECOND_DATA] localThridContData = curData[DEFAULT_SECOND_DATA]
} }
if(curData && curData.iconImg){ if(curData && curData.imgIconArr){
iconImg = curData.iconImg imgIconArr = curData.imgIconArr
} }
// console.log('底部数据==' , localThridContData) console.log('底部数据==' ,curData, localThridContData, topProcOptionList)
return( return(
<View style={styles.edit_cont}> <View style={styles.edit_cont}>
{ iconImg ? <PictureZoom { imgIconArr ? <PictureZoom
listImageIndex={0} listImageIndex={0}
listImageUrls={iconImg} listImageUrls={imgIconArr}
listStyleImage={styles.thr_head_tit_img} listStyleImage={styles.thr_head_tit_img}
listPicType={'RECTANGLE'} listPicType={'RECTANGLE'}
/> : null } /> : null }
...@@ -190,6 +243,15 @@ class EditThirdLevelPage extends Component { ...@@ -190,6 +243,15 @@ class EditThirdLevelPage extends Component {
// 返回每一列元素 // 返回每一列元素
renderContColumnItem(item, index) { renderContColumnItem(item, index) {
let {onlyShow, onlySignSelect} = this.state
let {params} = this.props.navigation.state
console.log('onlySignSelect', onlySignSelect)
let curImgIcon=''
if(!onlyShow){
curImgIcon = 'imgIconArr'
}
return ( return (
<SafeAreaView style={styles.column_container}> <SafeAreaView style={styles.column_container}>
<PicTitDetaiCalcu <PicTitDetaiCalcu
...@@ -200,9 +262,10 @@ class EditThirdLevelPage extends Component { ...@@ -200,9 +262,10 @@ class EditThirdLevelPage extends Component {
titText={'title'} titText={'title'}
tipTextStr={'tip1'} tipTextStr={'tip1'}
tipTextOne={'tip2'} tipTextOne={'tip2'}
// listImgIcon={'imgIcon'} listImgIcon={curImgIcon}
listImgIcon={'imgIconArr'}
listPicType={'ROUND'} listPicType={'ROUND'}
onlyShowNum={onlyShow}
onlyShowSelect={onlySignSelect}
listStyleBox={styles.list_style_box} listStyleBox={styles.list_style_box}
/> />
</SafeAreaView> </SafeAreaView>
...@@ -212,6 +275,16 @@ class EditThirdLevelPage extends Component { ...@@ -212,6 +275,16 @@ class EditThirdLevelPage extends Component {
render() { render() {
let {navigation} = this.props let {navigation} = this.props
let {title} = navigation.state.params let {title} = navigation.state.params
let {onlyShow, onlySignSelect} = this.state
console.log('onlyShow==', onlyShow)
let curShowTop = true
if(onlyShow){
curShowTop = !onlyShow
}
if(onlySignSelect) {
curShowTop = !onlySignSelect
}
return ( return (
<View style={styles.edit_container}> <View style={styles.edit_container}>
<StatusBarView <StatusBarView
...@@ -222,10 +295,10 @@ class EditThirdLevelPage extends Component { ...@@ -222,10 +295,10 @@ class EditThirdLevelPage extends Component {
<SafeAreaView style={safe_view}> <SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} /> <HeadBackItem title={title} navigation={navigation} />
<View style={styles.edit_main}> <View style={styles.edit_main}>
{this.renderTopProItem()} { curShowTop ? this.renderTopProItem() : null}
{this.renderContItem()} {this.renderContItem()}
</View> </View>
<View style={styles.btom_btn_box}> { !onlyShow ? <View style={styles.btom_btn_box}>
<FooterBtnStyle <FooterBtnStyle
style={styles.sub_btn_pro} style={styles.sub_btn_pro}
activeOpacity={.8} activeOpacity={.8}
...@@ -233,7 +306,7 @@ class EditThirdLevelPage extends Component { ...@@ -233,7 +306,7 @@ class EditThirdLevelPage extends Component {
textStyle= {styles.sub_btn_txt} textStyle= {styles.sub_btn_txt}
onPress={() => this.handleSubmit()} onPress={() => this.handleSubmit()}
/> />
</View> </View> : null}
</SafeAreaView> </SafeAreaView>
</View> </View>
); );
......
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