Commit c715eb37 by Denglingling

调整【转单历史查询】功能,为重复转单号添加序号(1)、(2)...

parent 25351b6d
......@@ -105,7 +105,8 @@ export function requestGetAllTrans(params) {
.then(res => {
if(res.error_code == 0) {
let { data: { sur_order_transfer_head_chs_v } } = res
dispatch(requestSearchSuccess(sur_order_transfer_head_chs_v));
let transData = getDuplicateIncreCount(sur_order_transfer_head_chs_v, 'order_number')
dispatch(requestSearchSuccess(transData));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
......@@ -145,4 +146,37 @@ function requestSearchFail() {
return {
type: HISTOR_ORDER_SEARCH_FAILURE
}
}
function getCalculatTimes(data, typeName) {
let calObj = {}
if(!data || !data.length || !typeName) {
return calObj
}
for(let item of data) {
if(calObj[item[typeName]]) {
calObj[item[typeName]] += 1
} else {
calObj[item[typeName]] = 1
}
}
return calObj
}
function getDuplicateIncreCount(data, typeName) {
if(!data || !data.length) {
return []
}
let dupData = [...data]
let dupObj = getCalculatTimes(data, typeName)
Object.keys(dupObj).map(key => {
let count = 1
for(let chItem of dupData) {
if(chItem[typeName] == key && dupObj[key] > 1) {
chItem[typeName] = `${chItem[typeName]}${count})`
count++;
}
}
})
return dupData
}
\ No newline at end of file
......@@ -312,14 +312,18 @@ class HistoricalOrderPage extends Component {
}
// 跳转到行页面
openLinePage(item, index) {
openLinePage(item) {
let {topActiveIndex} = this.state
let {navigation} = this.props
let originalItem = item
if(originalItem.order_number && originalItem.order_number.includes('(')) {
originalItem.order_number = originalItem.order_number.split('(')[0]
}
if(navigation.navigate) {
navigation.navigate('LineOrderPage',{
title: item.local_his_number,
supIndex: topActiveIndex,
data: item
data: originalItem
})
}
}
......@@ -454,7 +458,7 @@ class HistoricalOrderPage extends Component {
<TouchableOpacity
activeOpacity={.7}
style={styles.cont_list_box}
onPress={() => this.openLinePage(item, index)}
onPress={() => this.openLinePage(item)}
>
<View style={styles.cont_lef}>
<Text style={styles.cont_lef_tit}>
......
......@@ -55,26 +55,6 @@ class LineOrderPage extends Component {
// item_name: '人工髋关节假体-JS-HB ||| T',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// },{
// "id": "1",
// item_name: '人工髋关节假体-JS-HB ||| T2',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// },{
// "id": "2",
// item_name: '人工髋关节假体-JS-HB ||| T3',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// },{
// "id": "3",
// item_name: '人工髋关节假体-JS-HB ||| T4',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// },{
// "id": "4",
// item_name: '人工髋关节假体-JS-HB ||| T5',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// }
]
},
......
......@@ -178,14 +178,6 @@ class EquipConsuPage extends Component {
// {
// name: '男',
// value: 'boy'
// },
// {
// name: '女',
// value: 'girl'
// },
// {
// name: '其他',
// value: 'other'
// }
],
dateModelPop: false, // 日期选择器
......@@ -517,6 +509,7 @@ class EquipConsuPage extends Component {
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(index > curIndex && index < 11 ) {
// console.log('----优化,客户名称选择之后,收单地点、收货地点只有一个时,赋值第一个--', this.state.localCustomersOption)
item.name = localOtherObj.name
item.value = localOtherObj.value
if(item.title == '主治医生') {
......@@ -727,7 +720,7 @@ class EquipConsuPage extends Component {
}, () => {
let tempOption = []
if( localCustomersOption.length ) {
localCustomersOption.forEach((item, index) => {
localCustomersOption.forEach((item) => {
if(item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的地点
let obj = {}
......@@ -802,7 +795,7 @@ class EquipConsuPage extends Component {
}, () => {
let tempOption = []
if( localCustomersOption.length ) {
localCustomersOption.forEach((item, index) => {
localCustomersOption.forEach((item) => {
if(item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的医生
let obj = {}
......
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