Commit 2970a610 by Denglingling

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

parent 30919775
......@@ -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'}
export function requestEquipOrderInfo(params) {
return (dispatch, getState) => {
......@@ -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() {
return {
type: EQUIP_CONSU_LIST_DOING
}
}
function requestListDataSuccess(data) {
export function requestListDataSuccess(data) {
return {
type: EQUIP_CONSU_LIST_SUCCESS,
rawData: data
......
......@@ -45,7 +45,10 @@ import {
uploadEquipImg,
getSubdetailOption,
requestEquipSumbit,
setEquipInitData
setEquipInitData,
reqEquipSurgeryHospital,
reqEquipOrderInfo,
requestListDataSuccess
} from '../../action/EquipAction';
import {
EQUIP_CONSU_LIST_DOING,
......@@ -71,104 +74,75 @@ class EquipConsuPage extends Component {
"id": "0",
title: '销售员',
name: '蔡妍',
value: 'caiyan',
isPicker: false,
select: false,
isEditable: false // 不可编辑
value: 'caiyan'
},
{
"id": "1",
title: '组织',
name: '请选择',
value: '',
isPicker: true,
select: false
value: ''
},
{
"id": "2",
title: '客户名称',
name: '请选择',
value: '',
isPicker: true,
select: false
value: ''
},
{
"id": "3",
title: '订单信息',
name: '请选择',
value: '',
isPicker: true,
select: false
value: ''
},
{
"id": "4",
title: '消耗时间',
name: '请选择',
value: '',
dateValue: new Date(),
isPicker: true,
select: false,
showDatePicker: true
dateValue: new Date()
},
{
"id": "5",
title: '患者姓名',
value: '',
isPicker: false,
select: false
value: ''
},
{
"id": "6",
title: '性别', // 选择
name: '请选择',
value: '',
isPicker: true,
select: false
value: ''
},
{
"id": "7",
title: '年龄', // 输入
value: '',
isPicker: false,
select: false
value: ''
},
{
"id": "8",
title: '床位',
value: '',
isPicker: false,
select: false
value: ''
},
{
"id": "9",
title: '病历号',
value: '',
isPicker: false,
select: false
value: ''
},
{
"id": "10",
title: '是否结单',
value: '',
isPicker: false,
select: false,
isRedio: 'N' // 单选
},
{
"id": "11",
title: '备注',
value: '',
isPicker: false,
select: false,
isRemark: true // 备注
value: ''
},
{
"id": "12",
title: '耗材明细', // 跳转
btnTit: '+添加消耗明细',
value: '',
isPicker: false,
select: false,
isJumpSubPage: true, // 跳转子页
isShowSub: true, // 是否展示子项
subOption: [
......@@ -179,13 +153,6 @@ class EquipConsuPage extends Component {
// serial_number: '2001202001001774',
// sale_price: '360000',
// 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 {
"id": "13",
title: '添加图片',
value: '',
isPicker: false,
select: false,
isAddImage: true, // 添加图片
uploadImgArr: [] // 上传后的路径
}
......@@ -348,11 +313,18 @@ class EquipConsuPage extends Component {
clearInitNameAndValue(curIndex) {
let { listOptionData, localOtherObj } = this.state
let { props } = this
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.customerGetOrderInfo()
}
// 清空耗材明细
listOptionData[12].subOption = []
props.getSubdetailOption([])
......@@ -548,6 +520,44 @@ class EquipConsuPage extends Component {
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() {
let { state, props } = this
......@@ -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() {
......@@ -1525,6 +1575,9 @@ const mapDispatchToProps = (dispatch) => {
},
setEquipInitData: () => {
dispatch(setEquipInitData())
},
requestListDataSuccess: (data) => {
dispatch(requestListDataSuccess(data))
}
}
}
......
......@@ -512,7 +512,6 @@ 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(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