Commit aafcd173 by Denglingling

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

(cherry picked from commit 6df041fe)
parent 99224c50
......@@ -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'}
export function requestTransTargetOrderInfo(params) {
return (dispatch, getState) => {
......@@ -74,7 +78,6 @@ export function requestTransTargetOrderInfo(params) {
GetRequest(global_domain_config, getUrlParams('/surgery/collect_order/search', params))
.then(res => {
if(res.error_code == 0) {
// 待确认!!!!!!!????
let { data: { surgery_collect_headers } } = res
dispatch(requestListDataSuccess(surgery_collect_headers));
} else if(res.error_code === 41006) {
......@@ -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() {
return {
type: TRANS_ORDER_LIST_DOING
}
}
function requestListDataSuccess(data) {
export function requestListDataSuccess(data) {
return {
type: TRANS_ORDER_LIST_SUCCESS,
rawData: data
......
......@@ -442,7 +442,7 @@ class EquipConsuPage extends Component {
let obj = {}
let collect_number = item.collect_number ? item.collect_number : '空'
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}`
obj.name = tempName,
obj.value = item.collect_number
......@@ -605,7 +605,7 @@ class EquipConsuPage extends Component {
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 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}`
listOptionData[3].name = tempName
listOptionData[3].value = surgery_collect_headers[0].collect_number
......
......@@ -46,7 +46,10 @@ import {
uploadTransImg,
requestTransSumbit,
setTransInitData,
setTransDetailOption
setTransDetailOption,
reqTransSurgeryHospital,
reqTransTargetOrderInfo,
requestListDataSuccess
} from '../../action/TransAction';
import { show, isEmpty, dedupQuoteArray, formatStrForDate, cloneObject } from '../../utils/Utils';
import {
......@@ -116,18 +119,6 @@ class TransOrderPage extends Component {
// {
// item_name: '人工髋关节假体-JS-HB ||| 人工髋关节假体-JS-HB',
// 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 {
],
subInitListOption: [], // 提交成功后,初始化当前数据
submitOption: { // 提交的信息
org_code: '',
org_code: '', // 组织
collect_number: '',
remark: '',
voice_url: '',
remark: '', // 备注信息
voice_url: '', // 录音地址
sur_order_transfer_line: '',
img_url: ''
img_url: '' // 图片地址
// seller_code: '', // 用户名username
// org_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: '', // 备注信息
// voice_url: '', // 录音地址
// order_currency: 'CNY',
// Caller: 'dingding',
// force_balance_check_flag: 'Y', // 检查缺失物料
},
currentItem: {
name: '请选择',
......@@ -180,24 +161,12 @@ class TransOrderPage extends Component {
// {
// name: '男',
// value: 'boy'
// },
// {
// name: '女',
// value: 'girl'
// },
// {
// name: '其他',
// value: 'other'
// }
],
hasPermission: undefined, //录音 授权状态
// audioPath: AudioUtils.DocumentDirectoryPath + `/quickAudio${Math.floor(Math.random() * (1000))+1}.aac`, // 文件路径
audioPath: AudioUtils.DocumentDirectoryPath + `/trans_audio_${new Date().getTime()}.aac`, // 文件路径
// recording: false, //是否录音
// pause: false, //录音是否暂停
stop: false, //录音是否停止
currentTime: 0, //录音时长
localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生
localPhoOption: [ // 添加的图片
// 'file:///storage/emulated/0/Pictures/images/image-ea1a24b8-2d12-468f-ac23-e9aed20c6d31.jpg'
],
......@@ -509,11 +478,18 @@ class TransOrderPage extends Component {
// 清空当前项以下的值
clearInitNameAndValue(curIndex) {
let { listOptionData, localOtherObj } = this.state
let that = this
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(index > curIndex && index < 4 ) {
item.name = localOtherObj.name
item.value = localOtherObj.value
if(listOptionData[1].value && item.title == '客户名称') {
that.organizationGetCustomerData()
}
if(listOptionData[2].value && item.title == '目标订单信息') {
that.customerGetTargetOrder()
}
}
return item
})
......@@ -592,9 +568,6 @@ class TransOrderPage extends Component {
if(currentTitle === '组织') {
tempOption = this.changeNameAndValue(transOrderOption, 'org_name', 'org_code')
} else if(currentTitle === '客户名称') {
this.setState({
localCustomersOption: transOrderOption // 用了吗??
})
// 去重医院数据
let filterOpt = dedupQuoteArray(transOrderOption, 'customer_code')
let currentArr = []
......@@ -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() {
......@@ -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) {
......@@ -1140,7 +1191,7 @@ class TransOrderPage extends Component {
// 返回录音元素
renderRecordingItem() {
let { recording, pause, stop, currentTime } = this.state
let { stop, currentTime } = this.state
return (
<CellTextStyle style={[list_common_item.reco_item, !stop ? '' : list_common_item.reco_play_height]}>
<View style={list_common_item.reco_btn_cont}>
......@@ -1462,6 +1513,9 @@ const mapDispatchToProps = (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