Commit 2970a610 by Denglingling

优化【消耗确认】联动信息选择后,查询出联动字段只有一条数据时,给联动字段赋值这条数据;

parent 30919775
...@@ -67,6 +67,10 @@ export function requestEquipSurgeryHospital(params) { ...@@ -67,6 +67,10 @@ export function requestEquipSurgeryHospital(params) {
} }
} }
export const reqEquipSurgeryHospital = 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: 'RETURNED,COLLECTED'} // 获取订单信息 params={access_token:'', org_code:'', seller_code:'', customer_code:'', collect_header_status: 'RETURNED,COLLECTED'}
export function requestEquipOrderInfo(params) { export function requestEquipOrderInfo(params) {
return (dispatch, getState) => { return (dispatch, getState) => {
...@@ -94,13 +98,17 @@ export function requestEquipOrderInfo(params) { ...@@ -94,13 +98,17 @@ export function requestEquipOrderInfo(params) {
} }
} }
export const reqEquipOrderInfo = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/surgery/collect_order/search', params))
}
function requestListDataing() { function requestListDataing() {
return { return {
type: EQUIP_CONSU_LIST_DOING type: EQUIP_CONSU_LIST_DOING
} }
} }
function requestListDataSuccess(data) { export function requestListDataSuccess(data) {
return { return {
type: EQUIP_CONSU_LIST_SUCCESS, type: EQUIP_CONSU_LIST_SUCCESS,
rawData: data rawData: data
......
...@@ -45,7 +45,10 @@ import { ...@@ -45,7 +45,10 @@ import {
uploadEquipImg, uploadEquipImg,
getSubdetailOption, getSubdetailOption,
requestEquipSumbit, requestEquipSumbit,
setEquipInitData setEquipInitData,
reqEquipSurgeryHospital,
reqEquipOrderInfo,
requestListDataSuccess
} from '../../action/EquipAction'; } from '../../action/EquipAction';
import { import {
EQUIP_CONSU_LIST_DOING, EQUIP_CONSU_LIST_DOING,
...@@ -71,104 +74,75 @@ class EquipConsuPage extends Component { ...@@ -71,104 +74,75 @@ class EquipConsuPage extends Component {
"id": "0", "id": "0",
title: '销售员', title: '销售员',
name: '蔡妍', name: '蔡妍',
value: 'caiyan', value: 'caiyan'
isPicker: false,
select: false,
isEditable: false // 不可编辑
}, },
{ {
"id": "1", "id": "1",
title: '组织', title: '组织',
name: '请选择', name: '请选择',
value: '', value: ''
isPicker: true,
select: false
}, },
{ {
"id": "2", "id": "2",
title: '客户名称', title: '客户名称',
name: '请选择', name: '请选择',
value: '', value: ''
isPicker: true,
select: false
}, },
{ {
"id": "3", "id": "3",
title: '订单信息', title: '订单信息',
name: '请选择', name: '请选择',
value: '', value: ''
isPicker: true,
select: false
}, },
{ {
"id": "4", "id": "4",
title: '消耗时间', title: '消耗时间',
name: '请选择', name: '请选择',
value: '', value: '',
dateValue: new Date(), dateValue: new Date()
isPicker: true,
select: false,
showDatePicker: true
}, },
{ {
"id": "5", "id": "5",
title: '患者姓名', title: '患者姓名',
value: '', value: ''
isPicker: false,
select: false
}, },
{ {
"id": "6", "id": "6",
title: '性别', // 选择 title: '性别', // 选择
name: '请选择', name: '请选择',
value: '', value: ''
isPicker: true,
select: false
}, },
{ {
"id": "7", "id": "7",
title: '年龄', // 输入 title: '年龄', // 输入
value: '', value: ''
isPicker: false,
select: false
}, },
{ {
"id": "8", "id": "8",
title: '床位', title: '床位',
value: '', value: ''
isPicker: false,
select: false
}, },
{ {
"id": "9", "id": "9",
title: '病历号', title: '病历号',
value: '', value: ''
isPicker: false,
select: false
}, },
{ {
"id": "10", "id": "10",
title: '是否结单', title: '是否结单',
value: '', value: '',
isPicker: false,
select: false,
isRedio: 'N' // 单选 isRedio: 'N' // 单选
}, },
{ {
"id": "11", "id": "11",
title: '备注', title: '备注',
value: '', value: ''
isPicker: false,
select: false,
isRemark: true // 备注
}, },
{ {
"id": "12", "id": "12",
title: '耗材明细', // 跳转 title: '耗材明细', // 跳转
btnTit: '+添加消耗明细', btnTit: '+添加消耗明细',
value: '', value: '',
isPicker: false,
select: false,
isJumpSubPage: true, // 跳转子页 isJumpSubPage: true, // 跳转子页
isShowSub: true, // 是否展示子项 isShowSub: true, // 是否展示子项
subOption: [ subOption: [
...@@ -179,13 +153,6 @@ class EquipConsuPage extends Component { ...@@ -179,13 +153,6 @@ class EquipConsuPage extends Component {
// serial_number: '2001202001001774', // serial_number: '2001202001001774',
// sale_price: '360000', // sale_price: '360000',
// select: true // select: true
// },{
// "id": "1",
// item_name: '人工髋关节假体-JS-HB ||| T2',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774',
// sale_price: '36668',
// select: true
// } // }
] ]
}, },
...@@ -193,8 +160,6 @@ class EquipConsuPage extends Component { ...@@ -193,8 +160,6 @@ class EquipConsuPage extends Component {
"id": "13", "id": "13",
title: '添加图片', title: '添加图片',
value: '', value: '',
isPicker: false,
select: false,
isAddImage: true, // 添加图片 isAddImage: true, // 添加图片
uploadImgArr: [] // 上传后的路径 uploadImgArr: [] // 上传后的路径
} }
...@@ -348,11 +313,18 @@ class EquipConsuPage extends Component { ...@@ -348,11 +313,18 @@ class EquipConsuPage extends Component {
clearInitNameAndValue(curIndex) { clearInitNameAndValue(curIndex) {
let { listOptionData, localOtherObj } = this.state let { listOptionData, localOtherObj } = this.state
let { props } = this let { props } = this
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.customerGetOrderInfo()
}
// 清空耗材明细 // 清空耗材明细
listOptionData[12].subOption = [] listOptionData[12].subOption = []
props.getSubdetailOption([]) props.getSubdetailOption([])
...@@ -548,6 +520,44 @@ class EquipConsuPage extends Component { ...@@ -548,6 +520,44 @@ class EquipConsuPage extends Component {
props.requestEquipSurgeryHospital(params) props.requestEquipSurgeryHospital(params)
} }
// 组织选择后,判断当前客户名称是否只有一个
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 reqEquipSurgeryHospital(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.customerGetOrderInfo()
})
}
} else if(cusResult.error_code == 41006) {
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
let error_msg = cusResult.error_msg || cusResult.message
show(error_msg);
}
}
// 订单信息 点击 // 订单信息 点击
handleOrderInfoCheck() { handleOrderInfoCheck() {
let { state, props } = this let { state, props } = this
...@@ -571,6 +581,46 @@ class EquipConsuPage extends Component { ...@@ -571,6 +581,46 @@ class EquipConsuPage extends Component {
}) })
} }
} }
// 客户名称选择后,判断订单信息是否只有一条数据
async customerGetOrderInfo() {
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: 'RETURNED,COLLECTED'
}
let that = this
let { global_domain_config } = props
let cusResult = await reqEquipOrderInfo(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 HH:mm:ss") : '空'
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);
}
}
// 消耗时间 点击 // 消耗时间 点击
handleEquipDateCheck() { handleEquipDateCheck() {
...@@ -1525,6 +1575,9 @@ const mapDispatchToProps = (dispatch) => { ...@@ -1525,6 +1575,9 @@ const mapDispatchToProps = (dispatch) => {
}, },
setEquipInitData: () => { setEquipInitData: () => {
dispatch(setEquipInitData()) dispatch(setEquipInitData())
},
requestListDataSuccess: (data) => {
dispatch(requestListDataSuccess(data))
} }
} }
} }
......
...@@ -512,7 +512,6 @@ class EquipConsuPage extends Component { ...@@ -512,7 +512,6 @@ class EquipConsuPage extends Component {
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(index > curIndex && index < 11 ) { if(index > curIndex && index < 11 ) {
// console.log('----优化,客户名称选择之后,收单地点、收货地点只有一个时,赋值第一个--', this.state.localCustomersOption)
item.name = localOtherObj.name item.name = localOtherObj.name
item.value = localOtherObj.value item.value = localOtherObj.value
if(listOptionData[1].value && item.title == '客户名称') { if(listOptionData[1].value && item.title == '客户名称') {
......
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