Commit aafcd173 by Denglingling

优化【转单申请】联动信息选择后,查询出联动字段只有一条数据时,给联动字段赋值这条数据;

(cherry picked from commit 6df041fe)
parent 99224c50
...@@ -66,6 +66,10 @@ export function requestTransSurgeryHospital(params) { ...@@ -66,6 +66,10 @@ export function requestTransSurgeryHospital(params) {
} }
} }
export const reqTransSurgeryHospital = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/sale/seller_customer/search', params))
}
// 获取目标订单信息 params={access_token: '', org_code: '', seller_code: '', customer_code: '', collect_header_status: 'COLLECTING_WAITING_CONFIRM,CONFIRM_COLLECT,COLLECTED_WAITING_CONFIRMED,APPROVED,COLLECTED'} // 获取目标订单信息 params={access_token: '', org_code: '', seller_code: '', customer_code: '', collect_header_status: 'COLLECTING_WAITING_CONFIRM,CONFIRM_COLLECT,COLLECTED_WAITING_CONFIRMED,APPROVED,COLLECTED'}
export function requestTransTargetOrderInfo(params) { export function requestTransTargetOrderInfo(params) {
return (dispatch, getState) => { return (dispatch, getState) => {
...@@ -74,7 +78,6 @@ export function requestTransTargetOrderInfo(params) { ...@@ -74,7 +78,6 @@ export function requestTransTargetOrderInfo(params) {
GetRequest(global_domain_config, getUrlParams('/surgery/collect_order/search', params)) GetRequest(global_domain_config, getUrlParams('/surgery/collect_order/search', params))
.then(res => { .then(res => {
if(res.error_code == 0) { if(res.error_code == 0) {
// 待确认!!!!!!!????
let { data: { surgery_collect_headers } } = res let { data: { surgery_collect_headers } } = res
dispatch(requestListDataSuccess(surgery_collect_headers)); dispatch(requestListDataSuccess(surgery_collect_headers));
} else if(res.error_code === 41006) { } else if(res.error_code === 41006) {
...@@ -94,13 +97,17 @@ export function requestTransTargetOrderInfo(params) { ...@@ -94,13 +97,17 @@ export function requestTransTargetOrderInfo(params) {
} }
} }
export const reqTransTargetOrderInfo = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/surgery/collect_order/search', params))
}
function requestListDataing() { function requestListDataing() {
return { return {
type: TRANS_ORDER_LIST_DOING type: TRANS_ORDER_LIST_DOING
} }
} }
function requestListDataSuccess(data) { export function requestListDataSuccess(data) {
return { return {
type: TRANS_ORDER_LIST_SUCCESS, type: TRANS_ORDER_LIST_SUCCESS,
rawData: data rawData: data
......
...@@ -442,7 +442,7 @@ class EquipConsuPage extends Component { ...@@ -442,7 +442,7 @@ class EquipConsuPage extends Component {
let obj = {} let obj = {}
let collect_number = item.collect_number ? item.collect_number : '空' let collect_number = item.collect_number ? item.collect_number : '空'
let surgery_name = item.surgery_name ? item.surgery_name : '空' let surgery_name = item.surgery_name ? item.surgery_name : '空'
let create_time = item.create_time ? moment(item.create_time).format("YYYY-MM-DD HH:mm:ss") : '空' let create_time = item.create_time ? moment(item.create_time).format("YYYY-MM-DD") : '空'
let tempName = `${collect_number}-${surgery_name}-${create_time}` let tempName = `${collect_number}-${surgery_name}-${create_time}`
obj.name = tempName, obj.name = tempName,
obj.value = item.collect_number obj.value = item.collect_number
...@@ -605,7 +605,7 @@ class EquipConsuPage extends Component { ...@@ -605,7 +605,7 @@ class EquipConsuPage extends Component {
let { listOptionData } = state let { listOptionData } = state
let collect_number = surgery_collect_headers[0].collect_number ? surgery_collect_headers[0].collect_number : '空' let collect_number = surgery_collect_headers[0].collect_number ? surgery_collect_headers[0].collect_number : '空'
let surgery_name = surgery_collect_headers[0].surgery_name ? surgery_collect_headers[0].surgery_name : '空' let surgery_name = surgery_collect_headers[0].surgery_name ? surgery_collect_headers[0].surgery_name : '空'
let create_time = surgery_collect_headers[0].create_time ? moment(surgery_collect_headers[0].create_time).format("YYYY-MM-DD HH:mm:ss") : '空' let create_time = surgery_collect_headers[0].create_time ? moment(surgery_collect_headers[0].create_time).format("YYYY-MM-DD") : '空'
let tempName = `${collect_number}-${surgery_name}-${create_time}` let tempName = `${collect_number}-${surgery_name}-${create_time}`
listOptionData[3].name = tempName listOptionData[3].name = tempName
listOptionData[3].value = surgery_collect_headers[0].collect_number listOptionData[3].value = surgery_collect_headers[0].collect_number
......
...@@ -46,7 +46,10 @@ import { ...@@ -46,7 +46,10 @@ import {
uploadTransImg, uploadTransImg,
requestTransSumbit, requestTransSumbit,
setTransInitData, setTransInitData,
setTransDetailOption setTransDetailOption,
reqTransSurgeryHospital,
reqTransTargetOrderInfo,
requestListDataSuccess
} from '../../action/TransAction'; } from '../../action/TransAction';
import { show, isEmpty, dedupQuoteArray, formatStrForDate, cloneObject } from '../../utils/Utils'; import { show, isEmpty, dedupQuoteArray, formatStrForDate, cloneObject } from '../../utils/Utils';
import { import {
...@@ -116,18 +119,6 @@ class TransOrderPage extends Component { ...@@ -116,18 +119,6 @@ class TransOrderPage extends Component {
// { // {
// item_name: '人工髋关节假体-JS-HB ||| 人工髋关节假体-JS-HB', // item_name: '人工髋关节假体-JS-HB ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006' // serial_number: 'SC20200506000006, SC20200506000006'
// },{
// item_name: '人工髋关节假体-JS-22 ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006'
// },{
// item_name: '人工髋关节假体-JS-33 ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006'
// },{
// item_name: '人工髋关节假体-JS-44 ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006'
// },{
// item_name: '人工髋关节假体-JS-5 ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006'
// } // }
] ]
}, },
...@@ -141,28 +132,18 @@ class TransOrderPage extends Component { ...@@ -141,28 +132,18 @@ class TransOrderPage extends Component {
], ],
subInitListOption: [], // 提交成功后,初始化当前数据 subInitListOption: [], // 提交成功后,初始化当前数据
submitOption: { // 提交的信息 submitOption: { // 提交的信息
org_code: '', org_code: '', // 组织
collect_number: '', collect_number: '',
remark: '', remark: '', // 备注信息
voice_url: '', voice_url: '', // 录音地址
sur_order_transfer_line: '', sur_order_transfer_line: '',
img_url: '' img_url: '' // 图片地址
// seller_code: '', // 用户名username // seller_code: '', // 用户名username
// org_code: '', // 组织 // org_code: '', // 组织
// customer_code: '', // 客户名称 // customer_code: '', // 客户名称
// bill_to_site_code: '', // 收单地点
// ship_to_site_code: '', // 收货地点
// doctor_name: '', // 主治医生
// // surgery_name: '', // 手术名称
// surgery_date: '', // 手术时间
// // surgery_type_code: '', // 手术类型
// template_collect_number: '', // 配台模版
// order_type_code: '', // 订单类型
// surgery_desc: '', // 备注信息 // surgery_desc: '', // 备注信息
// voice_url: '', // 录音地址 // voice_url: '', // 录音地址
// order_currency: 'CNY',
// Caller: 'dingding',
// force_balance_check_flag: 'Y', // 检查缺失物料
}, },
currentItem: { currentItem: {
name: '请选择', name: '请选择',
...@@ -180,24 +161,12 @@ class TransOrderPage extends Component { ...@@ -180,24 +161,12 @@ class TransOrderPage extends Component {
// { // {
// name: '男', // name: '男',
// value: 'boy' // value: 'boy'
// },
// {
// name: '女',
// value: 'girl'
// },
// {
// name: '其他',
// value: 'other'
// } // }
], ],
hasPermission: undefined, //录音 授权状态 hasPermission: undefined, //录音 授权状态
// audioPath: AudioUtils.DocumentDirectoryPath + `/quickAudio${Math.floor(Math.random() * (1000))+1}.aac`, // 文件路径
audioPath: AudioUtils.DocumentDirectoryPath + `/trans_audio_${new Date().getTime()}.aac`, // 文件路径 audioPath: AudioUtils.DocumentDirectoryPath + `/trans_audio_${new Date().getTime()}.aac`, // 文件路径
// recording: false, //是否录音
// pause: false, //录音是否暂停
stop: false, //录音是否停止 stop: false, //录音是否停止
currentTime: 0, //录音时长 currentTime: 0, //录音时长
localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生
localPhoOption: [ // 添加的图片 localPhoOption: [ // 添加的图片
// 'file:///storage/emulated/0/Pictures/images/image-ea1a24b8-2d12-468f-ac23-e9aed20c6d31.jpg' // 'file:///storage/emulated/0/Pictures/images/image-ea1a24b8-2d12-468f-ac23-e9aed20c6d31.jpg'
], ],
...@@ -509,11 +478,18 @@ class TransOrderPage extends Component { ...@@ -509,11 +478,18 @@ class TransOrderPage extends Component {
// 清空当前项以下的值 // 清空当前项以下的值
clearInitNameAndValue(curIndex) { clearInitNameAndValue(curIndex) {
let { listOptionData, localOtherObj } = this.state let { listOptionData, localOtherObj } = this.state
let that = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(index > curIndex && index < 4 ) { if(index > curIndex && index < 4 ) {
item.name = localOtherObj.name item.name = localOtherObj.name
item.value = localOtherObj.value item.value = localOtherObj.value
if(listOptionData[1].value && item.title == '客户名称') {
that.organizationGetCustomerData()
}
if(listOptionData[2].value && item.title == '目标订单信息') {
that.customerGetTargetOrder()
}
} }
return item return item
}) })
...@@ -592,9 +568,6 @@ class TransOrderPage extends Component { ...@@ -592,9 +568,6 @@ class TransOrderPage extends Component {
if(currentTitle === '组织') { if(currentTitle === '组织') {
tempOption = this.changeNameAndValue(transOrderOption, 'org_name', 'org_code') tempOption = this.changeNameAndValue(transOrderOption, 'org_name', 'org_code')
} else if(currentTitle === '客户名称') { } else if(currentTitle === '客户名称') {
this.setState({
localCustomersOption: transOrderOption // 用了吗??
})
// 去重医院数据 // 去重医院数据
let filterOpt = dedupQuoteArray(transOrderOption, 'customer_code') let filterOpt = dedupQuoteArray(transOrderOption, 'customer_code')
let currentArr = [] let currentArr = []
...@@ -686,6 +659,45 @@ class TransOrderPage extends Component { ...@@ -686,6 +659,45 @@ class TransOrderPage extends Component {
}) })
} }
} }
// 组织选择后,判断当前客户名称是否只有一个
async organizationGetCustomerData() {
let { state, props } = this
let params = {
access_token: props.token,
org_code: state.listOptionData[1].value,
seller_code: props.userInfo.user_name
}
let that = this
let { global_domain_config } = props
let cusResult = await reqTransSurgeryHospital(global_domain_config, params);
if(cusResult.error_code == 0) {
let { data: { customers } } = cusResult
props.requestListDataSuccess(customers)
let filterOpt = dedupQuoteArray(customers, 'customer_code')
if(filterOpt.length === 0) {
show(`当前客户名称为空`)
return
}
if(filterOpt.length === 1) {
let { listOptionData } = state
listOptionData[2].name = filterOpt[0].customer_name
listOptionData[2].value = filterOpt[0].customer_code
that.setState({
listOptionData
}, () => {
// that.customerGetTargetOrder()
})
}
} else if(cusResult.error_code == 41006) {
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
let error_msg = cusResult.error_msg || cusResult.message
show(error_msg);
}
}
// 目标订单信息 点击 // 目标订单信息 点击
handleTargetOrderCheck() { handleTargetOrderCheck() {
...@@ -711,7 +723,46 @@ class TransOrderPage extends Component { ...@@ -711,7 +723,46 @@ class TransOrderPage extends Component {
}) })
} }
} }
// 客户名称选择后,判断目标订单信息是否只有一条数据
async customerGetTargetOrder() {
let { state, props } = this
let params = {
access_token: props.token,
org_code: state.listOptionData[1].value,
seller_code: props.userInfo.user_name,
customer_code: state.listOptionData[2].value,
collect_header_status: 'COLLECTING_WAITING_CONFIRM,CONFIRM_COLLECT,COLLECTED_WAITING_CONFIRMED,APPROVED,COLLECTED'
}
let that = this
let { global_domain_config } = props
let cusResult = await reqTransTargetOrderInfo(global_domain_config, params);
if(cusResult.error_code == 0) {
let { data: { surgery_collect_headers } } = cusResult
props.requestListDataSuccess(surgery_collect_headers)
if(surgery_collect_headers.length === 0) {
show(`当前目标订单信息为空`)
return
}
if(surgery_collect_headers.length === 1) {
let { listOptionData } = state
let collect_number = surgery_collect_headers[0].collect_number ? surgery_collect_headers[0].collect_number : '空'
let surgery_name = surgery_collect_headers[0].surgery_name ? surgery_collect_headers[0].surgery_name : '空'
let create_time = surgery_collect_headers[0].create_time ? moment(surgery_collect_headers[0].create_time).format("YYYY-MM-DD") : '空'
let tempName = `${collect_number}-${surgery_name}-${create_time}`
listOptionData[3].name = tempName
listOptionData[3].value = surgery_collect_headers[0].collect_number
that.setState({
listOptionData
})
}
} else if(cusResult.error_code == 41006) {
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
let error_msg = cusResult.error_msg || cusResult.message
show(error_msg);
}
}
// 备注 输入 // 备注 输入
handleRemarkInput(text) { handleRemarkInput(text) {
...@@ -1140,7 +1191,7 @@ class TransOrderPage extends Component { ...@@ -1140,7 +1191,7 @@ class TransOrderPage extends Component {
// 返回录音元素 // 返回录音元素
renderRecordingItem() { renderRecordingItem() {
let { recording, pause, stop, currentTime } = this.state let { stop, currentTime } = this.state
return ( return (
<CellTextStyle style={[list_common_item.reco_item, !stop ? '' : list_common_item.reco_play_height]}> <CellTextStyle style={[list_common_item.reco_item, !stop ? '' : list_common_item.reco_play_height]}>
<View style={list_common_item.reco_btn_cont}> <View style={list_common_item.reco_btn_cont}>
...@@ -1462,6 +1513,9 @@ const mapDispatchToProps = (dispatch) => { ...@@ -1462,6 +1513,9 @@ const mapDispatchToProps = (dispatch) => {
}, },
setTransDetailOption: (data, searchData) => { setTransDetailOption: (data, searchData) => {
dispatch(setTransDetailOption(data, searchData)) dispatch(setTransDetailOption(data, searchData))
},
requestListDataSuccess: (data) => {
dispatch(requestListDataSuccess(data))
} }
} }
} }
......
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