Commit 64a0d720 by Denglingling

调整选择产品-耗材数量显示问题

parent 302506fe
...@@ -114,9 +114,9 @@ class ProductModel extends Component { ...@@ -114,9 +114,9 @@ class ProductModel extends Component {
// 耗材清空图标回调 // 耗材清空图标回调
handleClearBack(item, index, superIndex) { handleClearBack(item, index, superIndex) {
let { orginOptionList, topProcOptionList } = this.state let { orginOptionList, topProcOptionList } = this.state
console.log('耗材😋=====', item, index, superIndex) // console.log('耗材😋=====', item, index, superIndex)
console.log('耗材😋=====', orginOptionList) // console.log('耗材😋=====', orginOptionList)
console.log('耗材😋=====', topProcOptionList) // console.log('耗材😋=====', topProcOptionList)
// 耗材当前清空项 // 耗材当前清空项
let allCountQuantity = 0 // 初始化 let allCountQuantity = 0 // 初始化
...@@ -165,8 +165,8 @@ class ProductModel extends Component { ...@@ -165,8 +165,8 @@ class ProductModel extends Component {
console.log('🆕topProcOptionList=====', topProcOptionList) // console.log('🆕topProcOptionList=====', topProcOptionList)
console.log('🆕topProcOptionList=====', allCountQuantity) // console.log('🆕topProcOptionList=====', allCountQuantity)
this.props.changeCallBack(topProcOptionList) this.props.changeCallBack(topProcOptionList)
...@@ -240,9 +240,9 @@ class ProductModel extends Component { ...@@ -240,9 +240,9 @@ class ProductModel extends Component {
// 列表计算后回调 // 列表计算后回调
handleCalCallBack(item, index, superIndex) { handleCalCallBack(item, index, superIndex) {
console.log('计算后🐒=====', item, index, superIndex) // console.log('计算后🐒=====', item, index, superIndex)
let { topProcOptionList, topActiveIndex } = this.state let { topProcOptionList, topActiveIndex } = this.state
console.log('计算后🐒=====', topProcOptionList) // console.log('计算后🐒=====', topProcOptionList)
let defauIndex = index let defauIndex = index
defauIndex = item.superIndex defauIndex = item.superIndex
if (LocalVariable.SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR]) { if (LocalVariable.SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR]) {
...@@ -292,7 +292,7 @@ class ProductModel extends Component { ...@@ -292,7 +292,7 @@ class ProductModel extends Component {
// 手术套包 // 手术套包
let deleFlag = false let deleFlag = false
let deleInd = null let deleInd = null
console.log('listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME][index]--', listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME][index]) // console.log('listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME][index]--', listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME][index])
// 初始化 三级 // 初始化 三级
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME][index][LocalVariable.QUANTITY_FIELD] = 0 listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME][index][LocalVariable.QUANTITY_FIELD] = 0
// listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.QUANTITY_FIELD] = 0 // listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.QUANTITY_FIELD] = 0
...@@ -304,7 +304,7 @@ class ProductModel extends Component { ...@@ -304,7 +304,7 @@ class ProductModel extends Component {
deleFlag = true deleFlag = true
deleInd = chInd deleInd = chInd
} }
console.log('相同🧵=====',deleInd, deleFlag) // console.log('相同🧵=====',deleInd, deleFlag)
} }
if (!chIt[LocalVariable.QUANTITY_FIELD]) { if (!chIt[LocalVariable.QUANTITY_FIELD]) {
chIt[LocalVariable.QUANTITY_FIELD] = 0 chIt[LocalVariable.QUANTITY_FIELD] = 0
...@@ -397,8 +397,8 @@ class ProductModel extends Component { ...@@ -397,8 +397,8 @@ class ProductModel extends Component {
allCountQuantity += listItem[LocalVariable.SELECTED_QUQNTITY] allCountQuantity += listItem[LocalVariable.SELECTED_QUQNTITY]
}) })
console.log('topProcOptionList=====', topProcOptionList) // console.log('topProcOptionList=====', topProcOptionList)
console.log('topProcOptionList=====', allCountQuantity) // console.log('topProcOptionList=====', allCountQuantity)
this.props.changeCallBack(topProcOptionList) this.props.changeCallBack(topProcOptionList)
...@@ -517,7 +517,7 @@ class ProductModel extends Component { ...@@ -517,7 +517,7 @@ class ProductModel extends Component {
handleClearRubbish() { handleClearRubbish() {
let { orginOptionList, topProcOptionList } = this.state let { orginOptionList, topProcOptionList } = this.state
// this.refs.ClearAllModel.show('清空当前所有数据') // this.refs.ClearAllModel.show('清空当前所有数据')
console.log('清空🎹所有==--', this) // console.log('清空🎹所有==--', this)
// this.modelClearAllCB(true) // this.modelClearAllCB(true)
...@@ -574,8 +574,8 @@ class ProductModel extends Component { ...@@ -574,8 +574,8 @@ class ProductModel extends Component {
// 清空所有回调 // 清空所有回调
modelClearAllCB(clear_flag){ modelClearAllCB(clear_flag){
console.log('clear_flag===', clear_flag) // console.log('clear_flag===', clear_flag)
console.log('clear_flag===', this) // console.log('clear_flag===', this)
let { orginOptionList, topProcOptionList } = this.state let { orginOptionList, topProcOptionList } = this.state
let that = this let that = this
if(clear_flag){ if(clear_flag){
......
...@@ -66,7 +66,8 @@ class ChooseProductPage extends Component { ...@@ -66,7 +66,8 @@ class ChooseProductPage extends Component {
[LocalVariable.SELECTED_DATA_ARR]: [], [LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0 [LocalVariable.SELECTED_QUQNTITY]: 0
}], }],
local_cur_options: [] local_cur_options: [],
cur_hc_opts: []
} }
} }
...@@ -371,7 +372,7 @@ class ChooseProductPage extends Component { ...@@ -371,7 +372,7 @@ class ChooseProductPage extends Component {
}) })
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = top_sel_sum topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = top_sel_sum
console.log('topProcOptionList---', topProcOptionList) // console.log('topProcOptionList---', topProcOptionList)
this.setState({ this.setState({
topProcOptionList topProcOptionList
}) })
...@@ -725,7 +726,7 @@ class ChooseProductPage extends Component { ...@@ -725,7 +726,7 @@ class ChooseProductPage extends Component {
// 返回底部按钮 // 返回底部按钮
renderFooterBtnItem() { renderFooterBtnItem() {
let { selectShowPopup, topProcOptionList, topActiveIndex, local_sel_options, local_cur_options} = this.state let { selectShowPopup, topProcOptionList, topActiveIndex, local_sel_options, local_cur_options, cur_hc_opts} = this.state
let allCountQuantity = this.getAllCountQuantity() let allCountQuantity = this.getAllCountQuantity()
let cur_sel_options = [] let cur_sel_options = []
let sel_tip = this.getAllCountQuantity(true) let sel_tip = this.getAllCountQuantity(true)
...@@ -772,13 +773,11 @@ class ChooseProductPage extends Component { ...@@ -772,13 +773,11 @@ class ChooseProductPage extends Component {
li_obj.left_category_name = left_item.category_name li_obj.left_category_name = left_item.category_name
}) })
} }
cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].push(cur_line_obj) cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].push(cur_line_obj)
// let cur_has_sign = [] // let cur_has_sign = []
// cur_has_sign = cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].filter(filt_obj => filt_obj.supplier_code === cur_line_obj.supplier_code) // cur_has_sign = cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].filter(filt_obj => filt_obj.supplier_code === cur_line_obj.supplier_code)
// console.log('🏠==cur_has_sign===',cur_has_sign) // console.log('🏠==cur_has_sign===',cur_has_sign)
// console.log('🏠==cur_has_sign===',cur_line_obj)
// if (cur_has_sign.length > 0) { // if (cur_has_sign.length > 0) {
// cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].forEach(function (sel_arr) { // cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].forEach(function (sel_arr) {
// if (sel_arr.supplier_code === cur_line_obj.supplier_code) { // if (sel_arr.supplier_code === cur_line_obj.supplier_code) {
...@@ -823,9 +822,9 @@ class ChooseProductPage extends Component { ...@@ -823,9 +822,9 @@ class ChooseProductPage extends Component {
// sel_arr[LocalVariable.CHILDREN_LINE_NAME].push(...cur_line_obj[LocalVariable.CHILDREN_LINE_NAME]) // sel_arr[LocalVariable.CHILDREN_LINE_NAME].push(...cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
// } // }
// else { // else {
// console.log('add➕🏠=====',curHasInd) // // console.log('add➕🏠=====',curHasInd)
// console.log('add➕🏠=====',hasDetails) // // console.log('add➕🏠=====',hasDetails)
// console.log('add➕🏠=====',hasItemCode) // // console.log('add➕🏠=====',hasItemCode)
// // let deIndArr = [] // // let deIndArr = []
// // sel_arr[LocalVariable.CHILDREN_LINE_NAME].forEach((ch_line, ch_ind) => { // // sel_arr[LocalVariable.CHILDREN_LINE_NAME].forEach((ch_line, ch_ind) => {
...@@ -850,9 +849,9 @@ class ChooseProductPage extends Component { ...@@ -850,9 +849,9 @@ class ChooseProductPage extends Component {
// } // }
// console.log('🏠=====',has_line_sign) // // console.log('🏠=====',has_line_sign)
// console.log('🏠=====',cur_line_obj) // // console.log('🏠=====',cur_line_obj)
// console.log('🏠=====',sel_arr) // // console.log('🏠=====',sel_arr)
// } // }
// }) // })
// } else { // } else {
...@@ -864,11 +863,49 @@ class ChooseProductPage extends Component { ...@@ -864,11 +863,49 @@ class ChooseProductPage extends Component {
}) })
} }
}) })
// console.log('传递🚢======', topProcOptionList)
// console.log('传递🚢======', topActiveIndex)
// console.log('传递🚢======', cur_sel_options)
// console.log('传递🚢======', cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR])
let cur_hc_arr = [], cur_obj = {}
cur_hc_arr = cloneObject(cur_hc_opts)
if(cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].length >0) {
cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].forEach((hc_item, hc_ind) => {
// console.log('if===', cur_obj)
// console.log('if===', cur_hc_arr)
let curHasSup = cur_hc_arr.filter(su_obj => su_obj.supplier_code === hc_item.supplier_code)
if(curHasSup.length === 0){
cur_hc_arr.push(hc_item)
}else {
cur_hc_arr.map(function (end_item) {
if(end_item.supplier_code === hc_item.supplier_code){
end_item[LocalVariable.SELECTED_QUQNTITY] += hc_item[LocalVariable.SELECTED_QUQNTITY]
for(let line_obj of hc_item[LocalVariable.CHILDREN_LINE_NAME]){
let cur_fil = end_item[LocalVariable.CHILDREN_LINE_NAME].filter(fi_obj => {
if(fi_obj.details && fi_obj.details.length > 0){
return fi_obj.category_code === line_obj.category_code
}else {
return fi_obj.item_code === line_obj.item_code
}
})
if(cur_fil.length === 0 && line_obj[LocalVariable.QUANTITY_FIELD] > 0){
end_item[LocalVariable.CHILDREN_LINE_NAME].push(line_obj)
}
}
end_item[LocalVariable.CHILDREN_LINE_NAME] = end_item[LocalVariable.CHILDREN_LINE_NAME].filter(fil_ob => fil_ob[LocalVariable.QUANTITY_FIELD] > 0)
}
})
}
})
cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR] = cur_hc_arr
}
// console.log('传递🚢======', cur_hc_arr)
} }
// console.log('传递🚢======', topProcOptionList)
// console.log('传递🚢======', topActiveIndex)
// console.log('传递🚢======', cur_sel_options)
return ( return (
<View style={list_common_item.sub_box}> <View style={list_common_item.sub_box}>
......
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