Commit 7f6910eb by Denglingling

调整自助下单已选弹窗,支持产品分类下,根据厂家分类展示

parent e14b4dac
......@@ -78,6 +78,7 @@ export function requestEquipOrderInfo(params) {
let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/surgery/collect_order/search', params))
.then(res => {
console.log('res===', res)
if(res.error_code == 0) {
let { data: { surgery_collect_headers } } = res
dispatch(requestListDataSuccess(surgery_collect_headers));
......
......@@ -222,67 +222,67 @@ export function requestSelfSumbit({access_token, ...params}) {
// 选择产品-供应商信息查询接口
export const reqPurSupplierSearch = async (global_domain_config, params) => {
// return local_inter_mock.inter_1
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 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 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 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
// }
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_header/search', params))
}
// 选择产品-螺钉盒明细查询接口
export const reqNailBoxLineSearch = async (global_domain_config, params) => {
// return local_inter_mock.inter_6
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 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 local_inter_mock.inter_8
return await GetRequest(global_domain_config, getUrlParams('/order/tool/search', params))
}
// 选择产品-单点耗材查询接口
export const reqSingleConsumSearch = async (global_domain_config, params) => {
// if(params.leftIndex && params.leftIndex%2 === 0){
// return local_inter_mock.inter_9
// }else {
// return local_inter_mock.inter_99
// }
if(params.leftIndex && params.leftIndex%2 === 0){
return local_inter_mock.inter_9
}else {
return local_inter_mock.inter_99
}
return await GetRequest(global_domain_config, getUrlParams('/order/item_detail/search', params))
}
......
import React, { Component } from 'react';
import { View, Text, StyleSheet, SafeAreaView, Modal, ScrollView, TouchableOpacity, FlatList, Image } from 'react-native';
import { pxHeight, foundation_color, promary_color, second_text_color, first_text_color, Width, pxSize, safe_view, font_family_medium, font_family_light, list_common_item, third_text_size, icon_style, point_color, title_text_color } from '../../base/BaseStyle';
import { pxHeight, foundation_color, promary_color, second_text_color, first_text_color, Width, pxSize, safe_view, font_family_medium, font_family_light, list_common_item, third_text_size, icon_style, point_color, title_text_color, second_text_size } from '../../base/BaseStyle';
import ChooseCardList from '../common/listDataComponent/ChooseCardList';
import PicTitDetaiCalcu from '../common/listDataComponent/PicTitDetaiCalcu';
import _ from "lodash";
import LocalVariable from './LocalVariable';
import { connect } from 'react-redux';
import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect';
import { cloneObject } from '../../utils/Utils';
const PropTypes = require('prop-types');
class ProductModel extends Component {
......@@ -16,6 +19,7 @@ class ProductModel extends Component {
modelOption: PropTypes.array, // 已选左侧数据
modelCallBack: PropTypes.func, // 修改选择的回调函数
clearRubbish: PropTypes.func, // 清空所有
changeCallBack: PropTypes.func, // 改变后的回调
}
constructor(props) {
......@@ -24,27 +28,30 @@ class ProductModel extends Component {
isVisible: this.props.show,
topProcOptionList: [],
topActiveIndex: 0,
// leftOptionList: [],
leftActiveIndex: 0,
orginOptionList: [], // 原始数据
}
}
componentWillReceiveProps(nextProps) {
let that = this
if(this.state.isVisible != nextProps.show) {
this.setState({isVisible: nextProps.show});
if (this.state.isVisible != nextProps.show) {
this.setState({ isVisible: nextProps.show });
}
if(nextProps.modelOption) {
if (nextProps.modelOption) {
that.setState({
orginOptionList: nextProps.modelOption
},() => {
that.getTopOptions()
orginOptionList: nextProps.modelOption,
topProcOptionList: nextProps.modelOption
}, () => {
// that.getTopOptions()
});
}
}
// 修改已选数据
getTopOptions(){
let {orginOptionList} = this.state
getTopOptions() {
let { orginOptionList } = this.state
let otherArr = []
let otherChildObj = {
category_code: 'local_sign_items',
......@@ -54,32 +61,73 @@ class ProductModel extends Component {
[LocalVariable.LOCAL_SECOND_DATA]: []
}
orginOptionList.forEach((orItem, orIndex) => {
if(orIndex < 4) {
// if (orIndex < 4) {
if (orItem.category_code === LocalVariable.SURGICAL_TEMPLATE || orItem.category_code === LocalVariable.NAIL_BOX || orItem.category_code === LocalVariable.EQUIPMENT_BAG || orItem.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
otherArr.push(orItem)
}else {
} else {
otherChildObj[LocalVariable.LOCAL_SECOND_DATA].push(orItem)
if(orItem[LocalVariable.SELECTED_QUQNTITY]){
if (orItem[LocalVariable.SELECTED_QUQNTITY]) {
otherChildObj[LocalVariable.SELECTED_QUQNTITY] += Number(orItem[LocalVariable.SELECTED_QUQNTITY])
}
if(orItem[LocalVariable.SELECTED_DATA_ARR]){
orItem[LocalVariable.SELECTED_DATA_ARR].forEach(function(sign_it) {
if (orItem[LocalVariable.SELECTED_DATA_ARR]) {
orItem[LocalVariable.SELECTED_DATA_ARR].forEach(function (sign_it) {
sign_it[LocalVariable.SUPER_TITLE_NAME] = orItem.category_name
})
otherChildObj[LocalVariable.SELECTED_DATA_ARR].push(...orItem[LocalVariable.SELECTED_DATA_ARR])
}
}
})
// otherArr.push(otherChildObj)
if (otherChildObj[LocalVariable.SELECTED_QUQNTITY] > 0) {
otherArr.push(otherChildObj)
}
this.setState({
topProcOptionList: otherArr
})
// let shppArr = []
// orginOptionList.map((top_item) => {
// if (top_item.leftOptionList && top_item.leftOptionList.length > 0) {
// let otherArr = []
// let otherChildObj = {
// category_code: 'local_sign_items',
// category_name: '单选耗材',
// [LocalVariable.SELECTED_QUQNTITY]: 0,
// [LocalVariable.SELECTED_DATA_ARR]: [],
// [LocalVariable.LOCAL_SECOND_DATA]: []
// }
// top_item.leftOptionList.forEach((orItem, orIndex) => {
// if (orIndex < 4) {
// otherArr.push(orItem)
// } else {
// otherChildObj[LocalVariable.LOCAL_SECOND_DATA].push(orItem)
// if (orItem[LocalVariable.SELECTED_QUQNTITY]) {
// otherChildObj[LocalVariable.SELECTED_QUQNTITY] += Number(orItem[LocalVariable.SELECTED_QUQNTITY])
// }
// if (orItem[LocalVariable.SELECTED_DATA_ARR]) {
// orItem[LocalVariable.SELECTED_DATA_ARR].forEach(function (sign_it) {
// sign_it[LocalVariable.SUPER_TITLE_NAME] = orItem.category_name
// })
// otherChildObj[LocalVariable.SELECTED_DATA_ARR].push(...orItem[LocalVariable.SELECTED_DATA_ARR])
// }
// }
// })
// otherArr.push(otherChildObj)
// top_item.selectLeftOptionList = otherArr
// shppArr.push(top_item)
// }
// })
// this.setState({
// topProcOptionList: shppArr
// })
}
// 恢复耗材以外的数据
setTopOrginTopData(curOptions){
let {orginOptionList} = this.state
orginOptionList.map(function(orgItem, orgIndex) {
if(orgIndex < 4){
setTopOrginTopData(curOptions) {
let { orginOptionList } = this.state
orginOptionList.map(function (orgItem, orgIndex) {
if (orgIndex < 4) {
orgItem = curOptions[orgIndex]
}
})
......@@ -101,146 +149,391 @@ class ProductModel extends Component {
}
// 单选耗材清空图标回调
handleClearBack(item, index){
let {orginOptionList} = this.state
handleClearBack(item, index, superIndex) {
let { orginOptionList, topProcOptionList } = this.state
console.log('耗材😋=====', item, index, superIndex)
console.log('耗材😋=====', orginOptionList)
console.log('耗材😋=====', topProcOptionList)
// 单选耗材当前清空项
let allCountQuantity = 0 // 初始化
orginOptionList.forEach(function(orgOpts, orgInd) {
if(orgInd >= 4){
if(orgOpts[LocalVariable.LOCAL_SECOND_DATA] && orgOpts[LocalVariable.LOCAL_SECOND_DATA].length > 0){
orgOpts[LocalVariable.LOCAL_SECOND_DATA].forEach(function(localDa) {
if(localDa[LocalVariable.ONLY_TWO_LEVELS] && localDa['item_code'] === item['item_code']){
// 二级
localDa[LocalVariable.QUANTITY_FIELD] = 0
}else if(!localDa[LocalVariable.ONLY_TWO_LEVELS] && localDa['category_code'] === item['category_code']){
localDa[LocalVariable.QUANTITY_FIELD] = 0
if(localDa.details && localDa.details.length > 0){
// 三级
localDa.details.forEach(function(da_it){
da_it[LocalVariable.QUANTITY_FIELD] = 0
})
}
}
})
}
topProcOptionList.forEach(function (orgOpts, orgInd) {
if (orgOpts.category_code === LocalVariable.SIGN_SELECT_CONSUMABLES) {
if(orgOpts[LocalVariable.SELECTED_DATA_ARR] && orgOpts[LocalVariable.SELECTED_DATA_ARR].length > 0){
orgOpts[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME].splice(index, 1)
orgOpts[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.SELECTED_QUQNTITY] = 0
let delArr = []
orgOpts[LocalVariable.SELECTED_DATA_ARR].map((deIt, deIndex) => {
if(deIt[LocalVariable.ONLY_TWO_LEVELS] && deIt['item_code'] === item['item_code']){
delArr.push(deIndex)
}else if(!deIt[LocalVariable.ONLY_TWO_LEVELS] && deIt['category_code'] === item['category_code']){
delArr.push(deIndex)
if(orgOpts[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME].length >0){
orgOpts[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME].map((line_it, line_ind) => {
if(line_it[LocalVariable.QUANTITY_FIELD] === 0){
delArr.push(line_ind)
}
orgOpts[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.SELECTED_QUQNTITY] += line_it[LocalVariable.QUANTITY_FIELD]
})
for(let i=delArr.length-1; i>=0; i--){
orgOpts[LocalVariable.SELECTED_DATA_ARR].splice(delArr[i], 1);
}
for (let i = delArr.length - 1; i >= 0; i--) {
orgOpts[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME].splice(delArr[i], 1);
}
}
// 初始化
orgOpts[LocalVariable.SELECTED_QUQNTITY] = 0
if(orgOpts[LocalVariable.SELECTED_DATA_ARR] && orgOpts[LocalVariable.SELECTED_DATA_ARR].length > 0){
orgOpts[LocalVariable.SELECTED_DATA_ARR].map(function(itDa){
if(!itDa[LocalVariable.QUANTITY_FIELD]){
itDa[LocalVariable.QUANTITY_FIELD] = 0
if (orgOpts[LocalVariable.SELECTED_DATA_ARR] && orgOpts[LocalVariable.SELECTED_DATA_ARR].length > 0) {
let delSelArr = []
orgOpts[LocalVariable.SELECTED_DATA_ARR].map(function (itDa, itInd) {
if (!itDa[LocalVariable.SELECTED_QUQNTITY]) {
itDa[LocalVariable.SELECTED_QUQNTITY] = 0
}
orgOpts[LocalVariable.SELECTED_QUQNTITY] += Number(itDa[LocalVariable.QUANTITY_FIELD])
if(itDa[LocalVariable.SELECTED_QUQNTITY] === 0){
delSelArr.push(itInd)
}
orgOpts[LocalVariable.SELECTED_QUQNTITY] += Number(itDa[LocalVariable.SELECTED_QUQNTITY])
})
for (let i = delSelArr.length - 1; i >= 0; i--) {
orgOpts[LocalVariable.SELECTED_DATA_ARR].splice(delSelArr[i], 1);
}
}
}
if(!orgOpts[LocalVariable.SELECTED_QUQNTITY]){
if (!orgOpts[LocalVariable.SELECTED_QUQNTITY]) {
orgOpts[LocalVariable.SELECTED_QUQNTITY] = 0
}
allCountQuantity += orgOpts[LocalVariable.SELECTED_QUQNTITY]
})
this.props.modelCallBack(orginOptionList)
if(allCountQuantity === 0){
console.log('🆕topProcOptionList=====', topProcOptionList)
console.log('🆕topProcOptionList=====', allCountQuantity)
this.props.changeCallBack(topProcOptionList)
this.setState({
topProcOptionList: topProcOptionList
})
if (allCountQuantity === 0) {
this.closeModal()
}
// this.props.modelCallBack(orginOptionList)
// if (allCountQuantity === 0) {
// this.closeModal()
// }
// orginOptionList.forEach(function (orgOpts, orgInd) {
// if (orgInd >= 4) {
// if (orgOpts[LocalVariable.LOCAL_SECOND_DATA] && orgOpts[LocalVariable.LOCAL_SECOND_DATA].length > 0) {
// orgOpts[LocalVariable.LOCAL_SECOND_DATA].forEach(function (localDa) {
// if (localDa[LocalVariable.ONLY_TWO_LEVELS] && localDa['item_code'] === item['item_code']) {
// // 二级
// localDa[LocalVariable.QUANTITY_FIELD] = 0
// } else if (!localDa[LocalVariable.ONLY_TWO_LEVELS] && localDa['category_code'] === item['category_code']) {
// localDa[LocalVariable.QUANTITY_FIELD] = 0
// if (localDa.details && localDa.details.length > 0) {
// // 三级
// localDa.details.forEach(function (da_it) {
// da_it[LocalVariable.QUANTITY_FIELD] = 0
// })
// }
// }
// })
// }
// if (orgOpts[LocalVariable.SELECTED_DATA_ARR] && orgOpts[LocalVariable.SELECTED_DATA_ARR].length > 0) {
// let delArr = []
// orgOpts[LocalVariable.SELECTED_DATA_ARR].map((deIt, deIndex) => {
// if (deIt[LocalVariable.ONLY_TWO_LEVELS] && deIt['item_code'] === item['item_code']) {
// delArr.push(deIndex)
// } else if (!deIt[LocalVariable.ONLY_TWO_LEVELS] && deIt['category_code'] === item['category_code']) {
// delArr.push(deIndex)
// }
// })
// for (let i = delArr.length - 1; i >= 0; i--) {
// orgOpts[LocalVariable.SELECTED_DATA_ARR].splice(delArr[i], 1);
// }
// }
// // 初始化
// orgOpts[LocalVariable.SELECTED_QUQNTITY] = 0
// if (orgOpts[LocalVariable.SELECTED_DATA_ARR] && orgOpts[LocalVariable.SELECTED_DATA_ARR].length > 0) {
// orgOpts[LocalVariable.SELECTED_DATA_ARR].map(function (itDa) {
// if (!itDa[LocalVariable.QUANTITY_FIELD]) {
// itDa[LocalVariable.QUANTITY_FIELD] = 0
// }
// orgOpts[LocalVariable.SELECTED_QUQNTITY] += Number(itDa[LocalVariable.QUANTITY_FIELD])
// })
// }
// }
// if (!orgOpts[LocalVariable.SELECTED_QUQNTITY]) {
// orgOpts[LocalVariable.SELECTED_QUQNTITY] = 0
// }
// allCountQuantity += orgOpts[LocalVariable.SELECTED_QUQNTITY]
// })
// this.props.modelCallBack(orginOptionList)
// if (allCountQuantity === 0) {
// this.closeModal()
// }
}
// 列表计算后回调
handleCalCallBack(item, index){
let {topProcOptionList, topActiveIndex} = this.state
handleCalCallBack(item, index, superIndex) {
console.log('计算后🐒=====', item, index, superIndex)
let { topProcOptionList, topActiveIndex } = this.state
console.log('计算后🐒=====', topProcOptionList)
let defauIndex = index
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]) {
let allCountQuantity = 0 // 初始化
topProcOptionList.map(function(listItem, listIndex) {
if(listIndex === topActiveIndex){
if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
topProcOptionList.map(function (listItem, listIndex) {
if (listIndex === topActiveIndex) {
if (listItem.category_code === LocalVariable.NAIL_BOX || listItem.category_code === LocalVariable.EQUIPMENT_BAG || listItem.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
// if (topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3) {
//钉盒 器械包 零散器械
//初始化 中类
let deleFlag = false
let deleInd = null
listItem[LocalVariable.SELECTED_QUQNTITY] = 0
listItem[LocalVariable.SELECTED_DATA_ARR].forEach(function(seDa, seInd) {
if(!seDa[LocalVariable.QUANTITY_FIELD]){
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.SELECTED_QUQNTITY] = 0
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME].forEach(function (seDa, seInd) {
if (!seDa[LocalVariable.QUANTITY_FIELD]) {
seDa[LocalVariable.QUANTITY_FIELD] = 0
}
if(seDa[LocalVariable.QUANTITY_FIELD] === 0){
if (seDa[LocalVariable.QUANTITY_FIELD] === 0) {
deleFlag = true
deleInd = seInd
}
listItem[LocalVariable.SELECTED_QUQNTITY] += Number(seDa[LocalVariable.QUANTITY_FIELD])
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.SELECTED_QUQNTITY] += Number(seDa[LocalVariable.QUANTITY_FIELD])
// listItem[LocalVariable.SELECTED_QUQNTITY] += Number(seDa[LocalVariable.QUANTITY_FIELD])
})
if(deleFlag) {
listItem[LocalVariable.SELECTED_DATA_ARR].splice(deleInd, 1)
if (deleFlag) {
// listItem[LocalVariable.SELECTED_DATA_ARR].splice(deleInd, 1)
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME].splice(deleInd, 1)
}
}else {
let sel_de_flag =false
let sel_de_index = null
listItem[LocalVariable.SELECTED_DATA_ARR].map((sel_arr, sel_ind) => {
if (sel_arr[LocalVariable.SELECTED_QUQNTITY] === 0) {
sel_de_flag = true
sel_de_index = sel_ind
}
listItem[LocalVariable.SELECTED_QUQNTITY] += Number(sel_arr[LocalVariable.SELECTED_QUQNTITY])
})
if(sel_de_flag){
listItem[LocalVariable.SELECTED_DATA_ARR].splice(sel_de_index, 1)
}
} else {
// 手术模板
let deleFlag = false
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])
// 初始化 三级
listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.QUANTITY_FIELD] = 0
listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.CHILDREN_LINE_NAME].forEach(function(chIt, chInd) {
if(_.isEqual(chIt, item)){
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][superIndex][LocalVariable.CHILDREN_LINE_NAME][index][LocalVariable.CHILDREN_LINE_NAME].forEach(function (chIt, chInd) {
// listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.CHILDREN_LINE_NAME].forEach(function (chIt, chInd) {
if (_.isEqual(chIt, item)) {
chIt = item
if(chIt[LocalVariable.QUANTITY_FIELD] === 0){
if (chIt[LocalVariable.QUANTITY_FIELD] === 0) {
deleFlag = true
deleInd = chInd
}
console.log('相同🧵=====',deleInd, deleFlag)
}
if(!chIt[LocalVariable.QUANTITY_FIELD]){
if (!chIt[LocalVariable.QUANTITY_FIELD]) {
chIt[LocalVariable.QUANTITY_FIELD] = 0
}
listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.QUANTITY_FIELD] += Number(chIt[LocalVariable.QUANTITY_FIELD])
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME][index][LocalVariable.QUANTITY_FIELD] += Number(chIt[LocalVariable.QUANTITY_FIELD])
// listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.QUANTITY_FIELD] += Number(chIt[LocalVariable.QUANTITY_FIELD])
})
if(deleFlag) {
listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.CHILDREN_LINE_NAME].splice(deleInd, 1)
if (deleFlag) {
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME][index][LocalVariable.CHILDREN_LINE_NAME].splice(deleInd, 1)
// listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.CHILDREN_LINE_NAME].splice(deleInd, 1)
}
let line_de_flag =false
let line_de_index = null
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME].map((sel_arr, sel_ind) => {
if (sel_arr[LocalVariable.QUANTITY_FIELD] === 0) {
line_de_flag = true
line_de_index = sel_ind
}
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.SELECTED_QUQNTITY] += Number(sel_arr[LocalVariable.QUANTITY_FIELD])
})
if(line_de_flag){
listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME].splice(line_de_index, 1)
}
let del_out_arr = []
// 初始化 中类
listItem[LocalVariable.SELECTED_QUQNTITY] = 0
listItem[LocalVariable.SELECTED_DATA_ARR].forEach(function(seDa) {
if(!seDa[LocalVariable.QUANTITY_FIELD]){
seDa[LocalVariable.QUANTITY_FIELD] = 0
listItem[LocalVariable.SELECTED_DATA_ARR].forEach(function (seDa, seInd) {
// if (!seDa[LocalVariable.QUANTITY_FIELD]) {
// seDa[LocalVariable.QUANTITY_FIELD] = 0
// }
// listItem[LocalVariable.SELECTED_QUQNTITY] += Number(seDa[LocalVariable.QUANTITY_FIELD])
seDa[LocalVariable.SELECTED_QUQNTITY] = 0
if(seDa[LocalVariable.CHILDREN_LINE_NAME] && seDa[LocalVariable.CHILDREN_LINE_NAME].length > 0){
seDa[LocalVariable.CHILDREN_LINE_NAME].map(function (lineDa) {
if (!lineDa[LocalVariable.QUANTITY_FIELD]) {
lineDa[LocalVariable.QUANTITY_FIELD] = 0
}
listItem[LocalVariable.SELECTED_QUQNTITY] += Number(seDa[LocalVariable.QUANTITY_FIELD])
seDa[LocalVariable.SELECTED_QUQNTITY] += Number(lineDa[LocalVariable.QUANTITY_FIELD])
})
// 已选数量赋值之前默认数据
let curObj = listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex]
if(listIndex < 4){
if(curObj['template_number']){
listItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function(deIt) {
if(deIt.template_number === curObj.template_number){
deIt = curObj
listItem[LocalVariable.SELECTED_QUQNTITY] += Number(seDa[LocalVariable.SELECTED_QUQNTITY])
}else {
del_out_arr.push(seInd)
}
})
for (let i = del_out_arr.length - 1; i >= 0; i--) {
listItem[LocalVariable.SELECTED_DATA_ARR].splice(del_out_arr[i], 1);
}
}
// let sel_de_flag =false
// let sel_de_index = null
// listItem[LocalVariable.SELECTED_DATA_ARR].map((sel_arr, sel_ind) => {
// if (sel_arr[LocalVariable.SELECTED_QUQNTITY] === 0) {
// sel_de_flag = true
// sel_de_index = sel_ind
// }
// listItem[LocalVariable.SELECTED_QUQNTITY] += Number(sel_arr[LocalVariable.SELECTED_QUQNTITY])
// })
// if(sel_de_flag){
// listItem[LocalVariable.SELECTED_DATA_ARR].splice(sel_de_index, 1)
// }
// // 已选数量赋值之前默认数据
// let curObj = listItem[LocalVariable.SELECTED_DATA_ARR][superIndex][LocalVariable.CHILDREN_LINE_NAME][index]
// // let curObj = listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex]
// if (listIndex < 4) {
// if (curObj['template_number']) {
// listItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function (deIt) {
// // listItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function (deIt) {
// if (deIt.template_number === curObj.template_number) {
// deIt = curObj
// }
// })
// }
// }
}
}
if(!listItem[LocalVariable.SELECTED_QUQNTITY]){
if (!listItem[LocalVariable.SELECTED_QUQNTITY]) {
listItem[LocalVariable.SELECTED_QUQNTITY] = 0
}
allCountQuantity += listItem[LocalVariable.SELECTED_QUQNTITY]
})
// 恢复之后再调用
this.setTopOrginTopData(topProcOptionList)
if(allCountQuantity === 0){
console.log('topProcOptionList=====', topProcOptionList)
console.log('topProcOptionList=====', allCountQuantity)
this.props.changeCallBack(topProcOptionList)
this.setState({
topProcOptionList: topProcOptionList
})
if (allCountQuantity === 0) {
this.closeModal()
}
// // 恢复之后再调用
// this.setTopOrginTopData(topProcOptionList)
// if (allCountQuantity === 0) {
// this.closeModal()
// }
}
// if (LocalVariable.SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR]) {
// let allCountQuantity = 0 // 初始化
// topProcOptionList.map(function (listItem, listIndex) {
// if (listIndex === topActiveIndex) {
// if (orItem.category_code === LocalVariable.NAIL_BOX || orItem.category_code === LocalVariable.EQUIPMENT_BAG || orItem.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
// // if (topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3) {
// //钉盒 器械包 零散器械
// //初始化 中类
// let deleFlag = false
// let deleInd = null
// listItem[LocalVariable.SELECTED_QUQNTITY] = 0
// listItem[LocalVariable.SELECTED_DATA_ARR].forEach(function (seDa, seInd) {
// if (!seDa[LocalVariable.QUANTITY_FIELD]) {
// seDa[LocalVariable.QUANTITY_FIELD] = 0
// }
// if (seDa[LocalVariable.QUANTITY_FIELD] === 0) {
// deleFlag = true
// deleInd = seInd
// }
// listItem[LocalVariable.SELECTED_QUQNTITY] += Number(seDa[LocalVariable.QUANTITY_FIELD])
// })
// if (deleFlag) {
// listItem[LocalVariable.SELECTED_DATA_ARR].splice(deleInd, 1)
// }
// } else {
// // 手术模板
// let deleFlag = false
// let deleInd = null
// // 初始化 三级
// listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.QUANTITY_FIELD] = 0
// listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.CHILDREN_LINE_NAME].forEach(function (chIt, chInd) {
// if (_.isEqual(chIt, item)) {
// chIt = item
// if (chIt[LocalVariable.QUANTITY_FIELD] === 0) {
// deleFlag = true
// deleInd = chInd
// }
// }
// if (!chIt[LocalVariable.QUANTITY_FIELD]) {
// chIt[LocalVariable.QUANTITY_FIELD] = 0
// }
// listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.QUANTITY_FIELD] += Number(chIt[LocalVariable.QUANTITY_FIELD])
// })
// if (deleFlag) {
// listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.CHILDREN_LINE_NAME].splice(deleInd, 1)
// }
// // 初始化 中类
// listItem[LocalVariable.SELECTED_QUQNTITY] = 0
// listItem[LocalVariable.SELECTED_DATA_ARR].forEach(function (seDa) {
// if (!seDa[LocalVariable.QUANTITY_FIELD]) {
// seDa[LocalVariable.QUANTITY_FIELD] = 0
// }
// listItem[LocalVariable.SELECTED_QUQNTITY] += Number(seDa[LocalVariable.QUANTITY_FIELD])
// })
// // 已选数量赋值之前默认数据
// let curObj = listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex]
// if (listIndex < 4) {
// if (curObj['template_number']) {
// listItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function (deIt) {
// if (deIt.template_number === curObj.template_number) {
// deIt = curObj
// }
// })
// }
// }
// }
// }
// if (!listItem[LocalVariable.SELECTED_QUQNTITY]) {
// listItem[LocalVariable.SELECTED_QUQNTITY] = 0
// }
// allCountQuantity += listItem[LocalVariable.SELECTED_QUQNTITY]
// })
// // 恢复之后再调用
// this.setTopOrginTopData(topProcOptionList)
// if (allCountQuantity === 0) {
// this.closeModal()
// }
// }
}
// 点击顶部菜单
......@@ -250,24 +543,94 @@ class ProductModel extends Component {
})
}
// 点击顶部产品分类菜单
handleLeftNav(item, index) {
this.setState({
leftActiveIndex: index
})
}
// 清空
handleClearRubbish() {
let {orginOptionList} = this.state
orginOptionList.map(function(listItem) {
listItem[LocalVariable.SELECTED_QUQNTITY] = 0
listItem[LocalVariable.SELECTED_DATA_ARR] = []
listItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function(deIt) {
deIt[LocalVariable.QUANTITY_FIELD] = 0
deIt[LocalVariable.CHILDREN_LINE_NAME] = []
let { orginOptionList, topProcOptionList } = this.state
// orginOptionList.map(function (listItem) {
// listItem[LocalVariable.SELECTED_QUQNTITY] = 0
// listItem[LocalVariable.SELECTED_DATA_ARR] = []
// listItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function (deIt) {
// deIt[LocalVariable.QUANTITY_FIELD] = 0
// deIt[LocalVariable.CHILDREN_LINE_NAME] = []
// })
// })
// this.props.clearRubbish()
// this.closeModal()
this.refs.ClearAllModel.show('清空当前所有数据')
// topProcOptionList.map(function(top_item) {
// top_item[LocalVariable.SELECTED_QUQNTITY] = 0
// top_item[LocalVariable.SELECTED_DATA_ARR] = []
// })
// this.props.changeCallBack(topProcOptionList)
// this.setState({
// topProcOptionList: topProcOptionList
// })
// this.closeModal()
}
// 清空当前
handleClearCurSuppRubbish(cu_item, cu_index) {
console.log('当前🥚=====', cu_item, cu_index)
let {orginOptionList, topProcOptionList, topActiveIndex} = this.state
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR].splice(cu_index, 1)
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0
let allCountQuantity = 0 // 初始化
if(topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR] && topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR].length > 0){
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR].forEach(local_arr => {
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] += local_arr[LocalVariable.SELECTED_QUQNTITY]
})
}
topProcOptionList.map(listItem => {
allCountQuantity += listItem[LocalVariable.SELECTED_QUQNTITY]
})
this.props.clearRubbish()
this.props.changeCallBack(topProcOptionList)
console.log('topProcOptionList=====', allCountQuantity)
this.setState({
topProcOptionList: topProcOptionList
})
if (allCountQuantity === 0) {
this.closeModal()
}
}
// 清空所有回调
modelClearAllCB(clear_flag){
console.log('clear_flag===', clear_flag)
let { orginOptionList, topProcOptionList } = this.state
if(clear_flag){
topProcOptionList.map(function(top_item) {
top_item[LocalVariable.SELECTED_QUQNTITY] = 0
top_item[LocalVariable.SELECTED_DATA_ARR] = []
})
this.props.changeCallBack(topProcOptionList)
this.setState({
topProcOptionList: topProcOptionList
})
this.closeModal()
}
}
// 返回清空
renderRubbish() {
return(
return (
<View style={styles.rb_top_cont}>
<TouchableOpacity
activeOpacity={.8}
......@@ -283,6 +646,37 @@ class ProductModel extends Component {
)
}
// // 返回顶部厂家编辑选项
// renderTopSuppItem() {
// let { topProcOptionList, topActiveIndex } = this.state
// return (
// <ChooseCardList
// cardStyleBox={styles.top_box}
// cardStyleScroll={styles.top_scroll_cont}
// cardScrollEnabled={false}
// cardHorizontal={true}
// cardShowsHorizontalScrollIndicator={false}
// cardStyleListItem={styles.top_inner}
// cardStyleListItemAct={[styles.top_inner_act, styles.top_supp_act]}
// cardStyleItemTit={[styles.top_tit, styles.top_supp_tit]}
// cardStyleItemTitAct={[styles.top_tit_act, styles.top_supp_tit_act]}
// cardListOptions={topProcOptionList}
// cardItemTitle={'supplier_short_name'}
// curActIndex={topActiveIndex}
// cardCallBack={(item, index) => this.handleTopNav(item, index)}
// cardCountName={LocalVariable.SELECTED_QUQNTITY}
// cardStyleType={'DEFAULT'}
// />
// )
// }
// 返回是否清空所有
renderTipClearAll() {
return (
<TipInfoNeedSelect ref="ClearAllModel" closeCallBack={() => this.modelClearAllCB()} submitCallBack={() => this.modelClearAllCB(true)} />
)
}
// 返回顶部编辑选项
renderTopProItem() {
let { topProcOptionList, topActiveIndex } = this.state
......@@ -309,30 +703,72 @@ class ProductModel extends Component {
// 返回底部主要元素
renderContItem() {
let {topProcOptionList, topActiveIndex} = this.state
let { topProcOptionList, topActiveIndex } = this.state
let curData = topProcOptionList[topActiveIndex]
let localBottomContData = []
if(curData && curData[LocalVariable.SELECTED_DATA_ARR]){
curData[LocalVariable.SELECTED_DATA_ARR].forEach(function(sedItem, sedInd) {
if(topActiveIndex === 0){
// 手术模板
localBottomContData.push(...sedItem[LocalVariable.CHILDREN_LINE_NAME])
}else {
if(topActiveIndex > 3){
if(sedItem[LocalVariable.ONLY_TWO_LEVELS]){
// 二级
sedItem[LocalVariable.SUPER_TITLE_TIP]=`${sedItem.general_name} (${sedItem.item_code}) x ${sedItem[LocalVariable.QUANTITY_FIELD]}`
if (curData && curData[LocalVariable.SELECTED_DATA_ARR]) {
curData[LocalVariable.SELECTED_DATA_ARR].forEach(function (sedItem, sedInd) {
// if (sedItem.category_code === LocalVariable.SIGN_SELECT_CONSUMABLES) {
// if (sedItem[LocalVariable.ONLY_TWO_LEVELS]) {
// // 二级
// sedItem[LocalVariable.SUPER_TITLE_TIP] = `${sedItem.general_name} (${sedItem.item_code}) x ${sedItem[LocalVariable.QUANTITY_FIELD]}`
// } else {
// // 三级
// sedItem[LocalVariable.SUPER_TITLE_TIP] = `${sedItem.category_name} (${sedItem.category_code}) x ${sedItem[LocalVariable.QUANTITY_FIELD]}`
// }
// }
if(sedItem.category_code === LocalVariable.SIGN_SELECT_CONSUMABLES){
if(sedItem[LocalVariable.CHILDREN_LINE_NAME] && sedItem[LocalVariable.CHILDREN_LINE_NAME].length > 0){
sedItem[LocalVariable.CHILDREN_LINE_NAME].forEach(function(child_it) {
if(child_it.details) {
child_it[LocalVariable.SUPER_TITLE_NAME] = child_it.left_category_name
child_it[LocalVariable.SUPER_TITLE_TIP] = `${child_it.category_name} x ${child_it[LocalVariable.QUANTITY_FIELD]}`
}else {
// 三级
sedItem[LocalVariable.SUPER_TITLE_TIP]=`${sedItem.category_name} (${sedItem.category_code}) x ${sedItem[LocalVariable.QUANTITY_FIELD]}`
child_it[LocalVariable.SUPER_TITLE_NAME] = child_it.left_category_name
child_it[LocalVariable.SUPER_TITLE_TIP] = `${child_it.general_name} x ${child_it[LocalVariable.QUANTITY_FIELD]}`
}
})
}
localBottomContData.push(sedItem)
}
localBottomContData.push(sedItem)
// if (topActiveIndex === 0) {
// // 手术模板
// // localBottomContData.push(...sedItem[LocalVariable.CHILDREN_LINE_NAME])
// localBottomContData.push(sedItem)
// } else {
// if (sedItem.category_code === LocalVariable.SIGN_SELECT_CONSUMABLES) {
// if (topActiveIndex > 3) {
// // 二级
// sedItem[LocalVariable.SUPER_TITLE_TIP] = `${sedItem.general_name} (${sedItem.item_code}) x ${sedItem[LocalVariable.QUANTITY_FIELD]}`
// } else {
// // 三级
// sedItem[LocalVariable.SUPER_TITLE_TIP] = `${sedItem.category_name} (${sedItem.category_code}) x ${sedItem[LocalVariable.QUANTITY_FIELD]}`
// }
// }
// localBottomContData.push(sedItem)
// }
})
}
return(
console.log('底部🉐️=====', localBottomContData)
// localBottomContData = [{
// supplier_short_name: "嘉思特华剑医疗器材(天津)有限公司", // 测试
// supplier_code: "SU00000369", // 测试
// [LocalVariable.CHILDREN_LINE_NAME]: localBottomContData
// },{
// supplier_short_name: "天津正天医疗器械有限公司", // 测试
// supplier_code: "SU00000360", // 测试
// [LocalVariable.CHILDREN_LINE_NAME]: localBottomContData
// },{
// supplier_short_name: "常州奥斯迈医疗器械有限公司", // 测试
// supplier_code: "SU00000390", // 测试
// [LocalVariable.CHILDREN_LINE_NAME]: localBottomContData
// }]
return (
<View style={styles.edit_cont}>
<ScrollView
style={styles.edit_scroll_cont}
......@@ -343,7 +779,7 @@ class ProductModel extends Component {
keyExtractor={item => item.id}
data={localBottomContData}
extraData={this.state}
renderItem={ ({item, index}) => this.renderContColumnItem(item, index) }
renderItem={({ item, index }) => this.renderContColumnItem(item, index)}
/>
</ScrollView>
</View>
......@@ -352,37 +788,106 @@ class ProductModel extends Component {
// 返回每一列元素
renderContColumnItem(item, index) {
let {topActiveIndex} = this.state
let curTit='', curTipOne='', curTipTwo='', curTipOneTit='', curTipTwoTit='', curIcon=''
let { topActiveIndex, leftActiveIndex } = this.state
let { global_domain_config } = this.props
let curTit = '', curTipOne = '', curTipTwo = '', curTipOneTit = '', curTipTwoTit = '', curIcon = ''
let curListMaxNum = ''
if(topActiveIndex === 0){
if (topActiveIndex === 0) {
curTit = 'superTit'
curTipOne = 'superTip'
}else if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
} else if (topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3) {
curTit = 'item_name'
curTipOne = 'specification'
curTipTwo = 'item_code'
curTipOneTit='规格型号'
curTipTwoTit='物料代码'
curIcon='photos'
if(topActiveIndex === 2){
curTipOneTit = '规格型号'
curTipTwoTit = '物料代码'
curIcon = 'photos'
if (topActiveIndex === 2) {
curListMaxNum = 1
}
}else {
} else {
curTit = LocalVariable.SUPER_TITLE_NAME
curTipOne = LocalVariable.SUPER_TITLE_TIP
}
// let cur_supplier_icon = ["files/20201224/截屏2020-12-24 上午11.11.20_1608779494102.11.20.png"]
// let cur_icon = ''
// cur_icon = { uri: global_domain_config + '/jeecg-boot/sys/common/view/' + cur_supplier_icon[0] }
let bttom_options = []
if (item[LocalVariable.CHILDREN_LINE_NAME]) {
if (item.category_code === LocalVariable.SURGICAL_TEMPLATE) {
item[LocalVariable.CHILDREN_LINE_NAME].map(surg_item => {
if (surg_item[LocalVariable.CHILDREN_LINE_NAME]) {
bttom_options.push(...surg_item[LocalVariable.CHILDREN_LINE_NAME])
}
})
} else {
bttom_options = item[LocalVariable.CHILDREN_LINE_NAME]
}
}
return (
<TouchableOpacity
activeOpacity={1}
style={styles.column_container}>
<View style={styles.col_cont}>
<View style={styles.col_shpp_box}>
<View style={styles.col_shpp_tit_box}>
{/* <View style={styles.rb_icon}>
<Image style={icon_style} source={require('../../images/rubbish.png')} />
</View> */}
<Text style={styles.col_shpp_tit}>{item.supplier_name}</Text>
</View>
<View style={styles.col_shpp_clear}>
<TouchableOpacity
activeOpacity={.8}
style={styles.rb_top_inner}
onPress={() => this.handleClearCurSuppRubbish(item, index)}
>
<View style={styles.rb_icon}>
<Image style={icon_style} source={require('../../images/rubbish.png')} />
</View>
</TouchableOpacity>
</View>
</View>
<View>
{
bttom_options.map((ch_item, ch_index) =>
<PicTitDetaiCalcu
listItem={ch_item}
listIndex={ch_index}
calField={LocalVariable.QUANTITY_FIELD}
subCalCallBack={(ch_item, ch_index) => this.handleCalCallBack(ch_item, ch_index, index)}
titText={curTit}
tipTextOne={curTipOne}
tipTextTwo={curTipTwo}
tipTextOneTit={curTipOneTit}
tipTextTwoTit={curTipTwoTit}
listPicType={'SQUARE'}
listStyleImg={styles.list_icon}
listStyleTit={styles.list_tit}
showClearIcon={true}
showClearIndex={4}
listCardActIndex={topActiveIndex}
clearCallBack={(ch_item, ch_index) => this.handleClearBack(ch_item, ch_index, index)}
listMaxNum={curListMaxNum}
key={'ch_item' + ch_index}
/>
)
}
</View>
</View>
{/* <PicTitDetaiCalcu
listItem={item}
listIndex={index}
calField={LocalVariable.QUANTITY_FIELD}
subCalCallBack={(item,index) => this.handleCalCallBack(item,index)}
subCalCallBack={(item, index) => this.handleCalCallBack(item, index)}
titText={curTit}
tipTextOne={curTipOne}
tipTextTwo={curTipTwo}
......@@ -395,19 +900,19 @@ class ProductModel extends Component {
showClearIndex={4}
listCardActIndex={topActiveIndex}
clearCallBack={(item, index) => this.handleClearBack(item, index)}
listMaxNum ={curListMaxNum}
/>
listMaxNum={curListMaxNum}
/> */}
</TouchableOpacity>
)
}
// 返回底部按钮
renderFooterBtnItem() {
let {topProcOptionList} = this.state
let { topProcOptionList } = this.state
let allCountQuantity = 0
let sel_tip = ''
topProcOptionList.map(proItem => {
if(!proItem[LocalVariable.SELECTED_QUQNTITY]){
if (!proItem[LocalVariable.SELECTED_QUQNTITY]) {
proItem[LocalVariable.SELECTED_QUQNTITY] = 0
}
allCountQuantity += proItem[LocalVariable.SELECTED_QUQNTITY]
......@@ -415,6 +920,7 @@ class ProductModel extends Component {
sel_tip += `${proItem.category_name}x${proItem[LocalVariable.SELECTED_QUQNTITY]} `
}
})
console.log('弹窗⏏️=======', topProcOptionList)
return (
<View style={list_common_item.sub_box}>
<View style={list_common_item.sub_two_btn}>
......@@ -424,7 +930,7 @@ class ProductModel extends Component {
onPress={() => this.closeModal()}
>
<Text style={list_common_item.lef_tip} numberOfLines={1}>
{allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'当前已选: '}</Text>}
{allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'已选: '}</Text>}
{allCountQuantity === 0 ? null : <Text style={styles.lef_tip_txt}>{sel_tip}</Text>}
</Text>
{allCountQuantity === 0 ? null : <View style={styles.lef_btn_num}>
......@@ -449,8 +955,13 @@ class ProductModel extends Component {
<View style={styles.modal_style}>
<View style={styles.scro_box}>
{this.renderRubbish()}
{/* {this.renderTopSuppItem()} */}
{this.renderTopProItem()}
{this.renderContItem()}
{this.renderTipClearAll()}
</View>
{this.renderFooterBtnItem()}
</View>
......@@ -530,16 +1041,25 @@ const styles = StyleSheet.create({
borderBottomWidth: 2,
borderBottomColor: promary_color
},
top_supp_act: {
borderBottomWidth: 4,
},
top_tit: {
paddingTop: 10,
paddingBottom: 10,
color: second_text_color,
fontSize: third_text_size
},
top_supp_tit: {
fontSize: 14
},
top_tit_act: {
color: first_text_color,
fontFamily: font_family_medium,
fontSize: 12
fontSize: 14
},
top_supp_tit_act: {
fontSize: 14
},
edit_cont: {
flex: 1
......@@ -551,6 +1071,28 @@ const styles = StyleSheet.create({
column_container: {
paddingHorizontal: 14
},
col_cont: {
marginVertical: 10,
borderWidth: 1,
borderColor: 'rgba(241, 241, 241, 0.96)',
borderRadius: 10,
paddingHorizontal: 10,
paddingVertical: 20
},
col_shpp_box: {
flexDirection: "row",
justifyContent: 'space-between',
marginBottom: 10
},
col_shpp_tit_box: {
flexDirection: "row"
},
col_shpp_tit: {
// fontSize: second_text_size,
fontSize: 12,
// marginLeft: 10
},
col_shpp_clear: {},
list_icon: {
width: pxSize(42),
height: pxSize(42),
......@@ -564,7 +1106,7 @@ const styles = StyleSheet.create({
minWidth: pxSize(20),
textAlign: 'center'
},
rb_top_cont:{
rb_top_cont: {
paddingHorizontal: 16,
paddingTop: 16,
alignItems: 'flex-end'
......@@ -605,4 +1147,18 @@ const styles = StyleSheet.create({
}
})
export default ProductModel;
\ 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)(ProductModel);
\ No newline at end of file
......@@ -90,7 +90,7 @@ class ChooseCardList extends Component {
resizeMode="cover" /> : <Image source={cur_icon} style={icon_style} resizeMode="cover" />
}
</View> : null}
<Text numberOfLines={2} style={[styles.list_item_tit, cardStyleItemTit, cur_icon ? '' : cardStyleNotIconTit, index == curActIndex ? [styles.list_tit_act, cardStyleItemTitAct] : '']}>
<Text numberOfLines={3} style={[styles.list_item_tit, cardStyleItemTit, cur_icon ? '' : cardStyleNotIconTit, index == curActIndex ? [styles.list_tit_act, cardStyleItemTitAct] : '']}>
{item[cardItemTitle]}
{(item[cardCountName] && countStyleType[0] === cardStyleType) ? <Text style={[styles.sum_def, cardCouStyle]}>({item[cardCountName]})</Text> : null}
</Text>
......
......@@ -580,6 +580,7 @@ class EquipConsuPage extends Component {
customer_code: state.listOptionData[2].value,
collect_header_status: 'RETURNED,COLLECTED'
}
console.log('params----', params)
props.requestEquipOrderInfo(params)
})
}
......
......@@ -11,6 +11,7 @@ import { cloneObject, show } from '../../../utils/Utils';
import { reqPurSupplierSearch, reqProCategorySearch, reqSurTempHeadSearch, reqNailEquipHeadSearch, reqScatEquipmentSearch, reqSingleConsumSearch, setSelectProductOpts } from '../../../action/SelfAction';
import LoadingModel from '../../common/listDataComponent/LoadingModel';
import LocalVariable from '../../common/LocalVariable';
import { exitLoginStatus } from '../../../action/LoginAction';
class ChooseProductPage extends Component {
constructor(props) {
......@@ -74,7 +75,8 @@ class ChooseProductPage extends Component {
let params = {
access_token: token,
org_code: cur_org_code,
supplier_type: 'MANUFACTURER' // 供应商
supplier_type: 'MANUFACTURER', // 供应商
filter_flag: 'Y', // 过滤标识
}
console.log('params=', params)
let pur_sup_search = await reqPurSupplierSearch(global_domain_config, params)
......@@ -111,7 +113,7 @@ class ChooseProductPage extends Component {
let that = this
let { token, global_domain_config } = that.props
let { topProcOptionList, defalutLeftItem } = this.state
if (topItem[LocalVariable.SELECTED_QUQNTITY] !== 0){
if (topItem[LocalVariable.SELECTED_QUQNTITY] !== 0) {
that.setState({
topActiveIndex: topIndex
}, () => {
......@@ -243,7 +245,8 @@ class ChooseProductPage extends Component {
access_token: token,
category_code: leftItem.category_code,
manufacturer_code: topItem.supplier_code,
org_code: cur_org_code
org_code: cur_org_code,
leftIndex: leftIndex // 测试
}
console.log('params=', params)
let single_all_search = await reqSingleConsumSearch(global_domain_config, params)
......@@ -392,7 +395,10 @@ class ChooseProductPage extends Component {
// 点击已选
handleSubSelected() {
let { selectShowPopup } = this.state
if (this.getAllCountQuantity() !== 0 && this.getCurCountSum() !== 0) {
// if (this.getAllCountQuantity() !== 0 && this.getCurCountSum() !== 0) {
// this.handleCloseSelectModal(!selectShowPopup)
// }
if (this.getAllCountQuantity() !== 0) {
this.handleCloseSelectModal(!selectShowPopup)
}
}
......@@ -403,6 +409,150 @@ class ChooseProductPage extends Component {
this.handleGoBack()
}
// 改变弹窗后的回调
handleChangeCallBack(options){
let { topProcOptionList, topActiveIndex } = this.state
console.log('🐯 改变后的回调 🐯=====', options)
console.log('🐯 改变后的回调 🐯=====', topProcOptionList)
let localSurgicalOpts = options[0][LocalVariable.SELECTED_DATA_ARR]
let localNailOpts = options[1][LocalVariable.SELECTED_DATA_ARR]
let localQuipmentOpts = options[2][LocalVariable.SELECTED_DATA_ARR]
let localScatteredOpts = options[3][LocalVariable.SELECTED_DATA_ARR]
let localSignOpts = options[4][LocalVariable.SELECTED_DATA_ARR]
topProcOptionList.forEach(function(top_item, top_index) {
top_item[LocalVariable.SELECTED_QUQNTITY] = 0
if(top_item.leftOptionList && top_item.leftOptionList.length > 0){
top_item.leftOptionList.forEach(function (left_item, left_index) {
left_item[LocalVariable.SELECTED_QUQNTITY] = 0
if(left_item.category_code === LocalVariable.SURGICAL_TEMPLATE || left_item.category_code === LocalVariable.NAIL_BOX || left_item.category_code === LocalVariable.EQUIPMENT_BAG || left_item.category_code === LocalVariable.SCATTERED_EQUIPMENT){
if(left_item[LocalVariable.SELECTED_DATA_ARR].length > 0 ){
// 加减
left_item[LocalVariable.SELECTED_DATA_ARR].map(arr_obj => {
left_item[LocalVariable.SELECTED_QUQNTITY] += arr_obj[LocalVariable.QUANTITY_FIELD]
})
}
// 清空部分
let cur_no_clear = []
let cur_clear_flag = false
let four_clear_flag = false
options.forEach(opt_obj => {
if(opt_obj.category_code === left_item.category_code
// (opt_obj.category_code === LocalVariable.SURGICAL_TEMPLATE || opt_obj.category_code === LocalVariable.NAIL_BOX || opt_obj.category_code === LocalVariable.EQUIPMENT_BAG || opt_obj.category_code === LocalVariable.SCATTERED_EQUIPMENT)
){
cur_no_clear = opt_obj[LocalVariable.SELECTED_DATA_ARR].filter(fi_it => {
if(fi_it.supplier_code === top_item.supplier_code){
cur_clear_flag = true
}
return fi_it.supplier_code === top_item.supplier_code
})
if(opt_obj[LocalVariable.SELECTED_DATA_ARR].length === 0){
four_clear_flag = true
}
}
})
console.log('cur_no_clear---', cur_no_clear, four_clear_flag)
console.log('cur_no_clear--🆚🆚-', cur_clear_flag, top_item.supplier_name, left_item.category_name)
// 清空
if(cur_no_clear.length === 0 ||
(left_item.category_code === LocalVariable.SURGICAL_TEMPLATE && localSurgicalOpts.length === 0) ||
(left_item.category_code === LocalVariable.NAIL_BOX && localNailOpts.length === 0) ||
(left_item.category_code === LocalVariable.EQUIPMENT_BAG && localQuipmentOpts.length === 0) ||
(left_item.category_code === LocalVariable.SCATTERED_EQUIPMENT && localScatteredOpts.length === 0)
){
console.log('cur_no_clear--- 🈳️🈳️',top_item.supplier_name, left_item.category_name)
left_item[LocalVariable.SELECTED_DATA_ARR] =[]
left_item[LocalVariable.SELECTED_QUQNTITY] = 0
left_item[LocalVariable.LOCAL_SECOND_DATA].forEach(function(local_opts) {
local_opts[LocalVariable.QUANTITY_FIELD] = 0
if(left_item.category_code === LocalVariable.SURGICAL_TEMPLATE){
local_opts[LocalVariable.CHILDREN_LINE_NAME] = []
}
})
}
}else {
// 单选耗材
left_item[LocalVariable.SELECTED_DATA_ARR] = []
localSignOpts.forEach((sign_obj, sign_index) => {
if(sign_obj.supplier_code === top_item.supplier_code){
sign_obj[LocalVariable.CHILDREN_LINE_NAME].forEach((si_line, si_ind)=>{
if(si_line.left_category_code === left_item.category_code){
left_item[LocalVariable.SELECTED_DATA_ARR].push(si_line)
left_item[LocalVariable.SELECTED_QUQNTITY] += si_line[LocalVariable.QUANTITY_FIELD]
}
})
}
})
left_item[LocalVariable.LOCAL_SECOND_DATA].forEach(function(loc_da, loc_ind) {
// loc_da[LocalVariable.QUANTITY_FIELD] = 0
if(left_item[LocalVariable.SELECTED_DATA_ARR] && left_item[LocalVariable.SELECTED_DATA_ARR].length === 0){
loc_da[LocalVariable.QUANTITY_FIELD] = 0
if(loc_da.details){
loc_da.details.forEach(function(det_item) {
det_item[LocalVariable.QUANTITY_FIELD] = 0
})
}
}else {
let hasSignFlag = false
left_item[LocalVariable.SELECTED_DATA_ARR].map((se_sign) => {
if((loc_da.details && se_sign.details && loc_da.category_code === se_sign.category_code) || (!se_sign.details && loc_da.item_code === se_sign.item_code)){
loc_da = se_sign
hasSignFlag = true
}
})
if(!hasSignFlag){
// 已清除
loc_da[LocalVariable.QUANTITY_FIELD] = 0
if(loc_da.details){
loc_da.details.forEach(function(det_item) {
det_item[LocalVariable.QUANTITY_FIELD] = 0
})
}
}
// loc_da[LocalVariable.QUANTITY_FIELD] = 0
// if(loc_da.details){
// loc_da.details.forEach(function(det_item) {
// det_item[LocalVariable.QUANTITY_FIELD] = 0
// })
// }
}
})
}
top_item[LocalVariable.SELECTED_QUQNTITY] += left_item[LocalVariable.SELECTED_QUQNTITY]
})
}
})
console.log('👌👌👌 改变后的回调 👌=====', topProcOptionList)
this.setState({
topProcOptionList: topProcOptionList
})
}
// 已选修改回调
handleSelectCallBack(options) {
let { topProcOptionList, topActiveIndex } = this.state
......@@ -575,10 +725,162 @@ class ChooseProductPage extends Component {
let allCountQuantity = this.getAllCountQuantity()
let cur_sel_options = []
let sel_tip = this.getAllCountQuantity(true)
// if (topProcOptionList.length > 0) {
// cur_sel_options = topProcOptionList[topActiveIndex].leftOptionList.filter(fi_item => fi_item[LocalVariable.SELECTED_QUQNTITY] > 0)
// }
cur_sel_options = [{
category_name: '手术模板',
category_code: LocalVariable.SURGICAL_TEMPLATE,
[LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0
}, {
category_name: '钉盒',
category_code: LocalVariable.NAIL_BOX,
[LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0
}, {
category_name: '器械包',
category_code: LocalVariable.EQUIPMENT_BAG,
[LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0
}, {
category_name: '零散器械',
category_code: LocalVariable.SCATTERED_EQUIPMENT,
[LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0
}, {
category_name: '单选耗材',
category_code: LocalVariable.SIGN_SELECT_CONSUMABLES,
[LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0
}]
if (topProcOptionList.length > 0) {
cur_sel_options = topProcOptionList[topActiveIndex].leftOptionList
topProcOptionList.map(top_item => {
// if(top_item.category_code === LocalVariable.SURGICAL_TEMPLATE || top_item.category_code === LocalVariable.NAIL_BOX || top_item.category_code === LocalVariable.EQUIPMENT_BAG || orItem.category_code === LocalVariable.SCATTERED_EQUIPMENT){
if (top_item.leftOptionList && top_item.leftOptionList.length > 0) {
let leftOptionList = top_item.leftOptionList
leftOptionList.map(left_item => {
// let category_name = '单选耗材'
// let category_code = LocalVariable.SIGN_SELECT_CONSUMABLES
// if(left_item.category_code === LocalVariable.SURGICAL_TEMPLATE || left_item.category_code === LocalVariable.NAIL_BOX || left_item.category_code === LocalVariable.EQUIPMENT_BAG || left_item.category_code === LocalVariable.SCATTERED_EQUIPMENT){
// category_name = left_item.category_name
// category_code = left_item.category_code
// }
// let cur_obj = {
// category_name: category_name,
// category_code: category_code,
// [LocalVariable.SELECTED_DATA_ARR]: [{
// supplier_code: top_item.category_code,
// supplier_short_name: top_item.supplier_short_name,
// supplier_name: top_item.supplier_name,
// [LocalVariable.CHILDREN_LINE_NAME]:top_item.leftOptionList.filter(fi_item => fi_item[LocalVariable.SELECTED_QUQNTITY] > 0)
// }]
// }
if (left_item[LocalVariable.SELECTED_QUQNTITY] > 0) {
let cur_line_obj = {
supplier_code: top_item.supplier_code,
supplier_name: top_item.supplier_name,
supplier_short_name: top_item.supplier_short_name,
[LocalVariable.SELECTED_QUQNTITY]: left_item[LocalVariable.SELECTED_QUQNTITY],
[LocalVariable.CHILDREN_LINE_NAME]: left_item[LocalVariable.SELECTED_DATA_ARR]
}
let localNotSign = false
for (let selOpts of cur_sel_options) {
if (selOpts.category_code === left_item.category_code) {
cur_line_obj.category_code = selOpts.category_code
cur_line_obj.category_name = selOpts.category_name
selOpts[LocalVariable.SELECTED_QUQNTITY] += cur_line_obj[LocalVariable.SELECTED_QUQNTITY]
selOpts[LocalVariable.SELECTED_DATA_ARR].push(cur_line_obj)
localNotSign = true
break
}
}
if (!localNotSign) {
// 单选耗材
cur_line_obj.category_code = cur_sel_options[cur_sel_options.length - 1].category_code
cur_line_obj.category_name = cur_sel_options[cur_sel_options.length - 1].category_name
// cur_line_obj.left_category_code = left_item.category_code
// cur_line_obj.left_category_name = left_item.category_name
cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_QUQNTITY] += cur_line_obj[LocalVariable.SELECTED_QUQNTITY]
if(cur_line_obj[LocalVariable.CHILDREN_LINE_NAME] && cur_line_obj[LocalVariable.CHILDREN_LINE_NAME].length >0 ){
cur_line_obj[LocalVariable.CHILDREN_LINE_NAME].map(function(li_obj) {
li_obj.left_category_code = left_item.category_code
li_obj.left_category_name = left_item.category_name
})
}
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)
if(cur_has_sign.length > 0){
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){
sel_arr[LocalVariable.SELECTED_QUQNTITY] += cur_line_obj[LocalVariable.SELECTED_QUQNTITY]
// console.log('add➕🏠=====',sel_arr[LocalVariable.CHILDREN_LINE_NAME])
// console.log('add➕🏠=====',cur_line_obj.supplier_name,cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
// sel_arr[LocalVariable.CHILDREN_LINE_NAME].push(...cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
let has_line_sign = []
has_line_sign = sel_arr[LocalVariable.CHILDREN_LINE_NAME].filter((line_item) => {
if(line_item.details){
return line_item.category_code === cur_line_obj[LocalVariable.CHILDREN_LINE_NAME][0].category_code
}else {
return line_item.item_code === cur_line_obj[LocalVariable.CHILDREN_LINE_NAME][0].item_code
}
})
if(has_line_sign.length === 0){
console.log('add➕🏠=====',has_line_sign, has_line_sign.length)
console.log('add➕🏠=====',sel_arr[LocalVariable.CHILDREN_LINE_NAME])
console.log('add➕🏠=====',cur_line_obj.supplier_name,cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
sel_arr[LocalVariable.CHILDREN_LINE_NAME].push(...cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
}
}
})
}else {
cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].push(cur_line_obj)
}
}
}
})
}
// let cur_obj = {
// supplier_code: top_item.category_code,
// supplier_short_name: top_item.supplier_short_name,
// supplier_name: top_item.supplier_name,
// [LocalVariable.CHILDREN_LINE_NAME]: top_item.leftOptionList.filter(fi_item => fi_item[LocalVariable.SELECTED_QUQNTITY] > 0)
// }
// }
})
// cur_sel_options = topProcOptionList[topActiveIndex].leftOptionList.filter(fi_item => fi_item[LocalVariable.SELECTED_QUQNTITY] > 0)
}
// cur_sel_options.forEach(function (curOpts) {
// curOpts[LocalVariable.SELECTED_QUQNTITY] = curOpts[LocalVariable.SELECTED_DATA_ARR].length
// })
// cur_sel_options = topProcOptionList
console.log('传递🚢======', topProcOptionList)
console.log('传递🚢======', topActiveIndex)
console.log('传递🚢======', cur_sel_options)
return (
<View style={list_common_item.sub_box}>
<View style={list_common_item.sub_two_btn}>
......@@ -588,7 +890,7 @@ class ChooseProductPage extends Component {
onPress={() => this.handleSubSelected()}
>
<Text style={list_common_item.lef_tip} numberOfLines={1}>
{allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'所有已选: '}</Text>}
{allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'已选: '}</Text>}
{allCountQuantity === 0 ? null : <Text style={styles.lef_tip_txt}>{sel_tip}</Text>}
</Text>
{allCountQuantity === 0 ? null : <View style={styles.lef_btn_num}>
......@@ -610,6 +912,7 @@ class ChooseProductPage extends Component {
modelOption={cur_sel_options}
modelCallBack={(options) => this.handleSelectCallBack(options)}
clearRubbish={() => this.handleClearRubbish()}
changeCallBack={(options) => this.handleChangeCallBack(options)}
/>
{ this.renderLodingItem()}
</View>
......@@ -691,7 +994,8 @@ const styles = StyleSheet.create({
},
cont_left_inner: {
flexDirection: 'row',
height: 58,
minHeight: 58,
maxHeight: 80,
justifyContent: 'flex-start',
alignItems: 'center',
borderWidth: 0,
......
......@@ -12,6 +12,7 @@ import { cloneObject, show } from '../../../utils/Utils';
import { reqSurTempLineSearch, reqNailBoxLineSearch, reqEquipPackageLineSearch } from '../../../action/SelfAction';
import LoadingModel from '../../common/listDataComponent/LoadingModel';
import LocalVariable from '../../common/LocalVariable';
import { exitLoginStatus } from '../../../action/LoginAction';
class EditThirdLevelPage extends Component {
......@@ -211,6 +212,7 @@ class EditThirdLevelPage extends Component {
this.refs.LoadingModel.hide()
if (result.error_code == 41006) {
show('登录过期,请重新登录');
console.log('this.props---', this.props)
this.props.exitLoginStatus();
} else {
let error_msg = result.error_msg || result.message
......
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