Commit fc803436 by Denglingling

【器械消耗】提交接口,以及提示信息;【消耗明细】搜索功能等;

parent f02dea34
...@@ -116,7 +116,6 @@ function requestListDataFail() { ...@@ -116,7 +116,6 @@ function requestListDataFail() {
// 获取当前临时存储的明细 // 获取当前临时存储的明细
export function getSubdetailOption(data) { export function getSubdetailOption(data) {
console.log('data====!!!!', data)
return { return {
type: GET_SUB_DETAIL_OPTION, type: GET_SUB_DETAIL_OPTION,
rawData: data rawData: data
...@@ -143,11 +142,10 @@ export function requestEquipSumbit({access_token, ...params}) { ...@@ -143,11 +142,10 @@ export function requestEquipSumbit({access_token, ...params}) {
dispatch(requestSubmiting()); dispatch(requestSubmiting());
PostRequest(getUrlParams('/surgery/consume_order/create', {access_token: access_token}), params) PostRequest(getUrlParams('/surgery/consume_order/create', {access_token: access_token}), params)
.then(res => { .then(res => {
console.warn('res=====', Object.keys(res)); console.warn('res=====', Object.keys(res), res);
if(res.error_code == 0) { if(res.error_code == 0) {
console.warn('res====requestEquipSumbit==========', res.data); console.warn('res====requestEquipSumbit==========', res);
let { data } = res dispatch(requestSubmitSuccess(res));
dispatch(requestSubmitSuccess(data));
} else if(res.error_code === 41006) { } else if(res.error_code === 41006) {
show('登录过期,请重新登录'); show('登录过期,请重新登录');
dispatch(exitLoginStatus()); dispatch(exitLoginStatus());
...@@ -181,4 +179,11 @@ function requestSubmitFail() { ...@@ -181,4 +179,11 @@ function requestSubmitFail() {
return { return {
type: EQUIP_SUBMIT_FAILURE type: EQUIP_SUBMIT_FAILURE
} }
}
// 初始化数据
export function setEquipInitData() {
return {
type: EQUIP_INIT_DATA
}
} }
\ No newline at end of file
...@@ -7,14 +7,14 @@ export function requestLogin(params) { ...@@ -7,14 +7,14 @@ export function requestLogin(params) {
dispatch(logining()); dispatch(logining());
PostRequest('/access_token/password/search?app_code=PDA', params).then((res) => { PostRequest('/access_token/password/search?app_code=PDA', params).then((res) => {
if(res.error_code === 0){ if(res.error_code === 0){
show('登录成功'); show('登录成功', 'success');
dispatch(loginSuccess(res, params.data.user_name, params.data.user_password)); dispatch(loginSuccess(res, params.data.user_name, params.data.user_password));
}else { }else {
show(res.error_msg); show(res.error_msg, 'error');
dispatch(loginFailure()) dispatch(loginFailure())
} }
}).catch((err) => { }).catch((err) => {
show(err.error); show(err.error, 'error');
}) })
} }
} }
...@@ -67,11 +67,11 @@ export function autoLogin(params) { ...@@ -67,11 +67,11 @@ export function autoLogin(params) {
dispatch(autoLoginSuccess(res)) dispatch(autoLoginSuccess(res))
}else { }else {
console.warn(res.error_msg); console.warn(res.error_msg);
show(res.error_msg); show(res.error_msg, 'error');
dispatch(autoLoginFailure()) dispatch(autoLoginFailure())
} }
}).catch((err) => { }).catch((err) => {
show(err.error); show(err.error, 'error');
}) })
} }
} }
\ No newline at end of file
...@@ -33,14 +33,17 @@ import { ...@@ -33,14 +33,17 @@ import {
ContTextStyle ContTextStyle
} from '../common/CellTextStyle'; } from '../common/CellTextStyle';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { isEmpty, dedupQuoteArray, show, formatStrForDate } from '../../utils/Utils'; import { isEmpty, dedupQuoteArray, show, formatStrForDate, cloneObject } from '../../utils/Utils';
import DateModel from '../common/DateModel'; import DateModel from '../common/DateModel';
import DialogModel from '../common/DialogModel'; import DialogModel from '../common/DialogModel';
import { import {
requestEquipOrganizations, requestEquipOrganizations,
requestEquipSurgeryHospital, requestEquipSurgeryHospital,
requestEquipOrderInfo, requestEquipOrderInfo,
uploadEquipImg uploadEquipImg,
getSubdetailOption,
requestEquipSumbit,
setEquipInitData
} from '../../action/EquipAction'; } from '../../action/EquipAction';
import { import {
EQUIP_CONSU_LIST_DOING, EQUIP_CONSU_LIST_DOING,
...@@ -61,7 +64,7 @@ class EquipConsuPage extends Component { ...@@ -61,7 +64,7 @@ class EquipConsuPage extends Component {
super(props); super(props);
this.state = { this.state = {
canSubFlag: false, // 生成订单按钮样式改变 canSubFlag: false, // 生成订单按钮样式改变
listOptionData: [ // 备注以上的元素 listOptionData: [ // 页面元素
{ {
"id": "0", "id": "0",
title: '销售员', title: '销售员',
...@@ -147,7 +150,7 @@ class EquipConsuPage extends Component { ...@@ -147,7 +150,7 @@ class EquipConsuPage extends Component {
value: '', value: '',
isPicker: false, isPicker: false,
select: false, select: false,
isRedio: false // 单选 isRedio: 'N' // 单选
}, },
{ {
"id": "11", "id": "11",
...@@ -215,21 +218,22 @@ class EquipConsuPage extends Component { ...@@ -215,21 +218,22 @@ class EquipConsuPage extends Component {
uploadImgArr: [] // 上传后的路径 uploadImgArr: [] // 上传后的路径
} }
], ],
subInitListOption: [], // 提交成功后,初始化当前数据
submitOption: { // 提交的信息 submitOption: { // 提交的信息
// seller_code: '', // 用户名username ?? 没有用户名 // seller_code: '', // 用户名username ?? 没有用户名
org_code: '', // 组织 org_code: '', // 组织
surgery_collect_number: '', // 订单信息 ?? 没有手术医院 surgery_collect_number: '', // 订单信息 ?? 没有手术医院
consume_date: '', // 消耗时间
patient_name: '', // 患者姓名 patient_name: '', // 患者姓名
patient_gender: '', // 性别 patient_gender: '', // 性别
patient_age: '', // 年龄 patient_age: '', // 年龄
patient_bed: '', // 床位 patient_bed: '', // 床位
patient_id: '', // 病历号 patient_id: '', // 病历号
consume_date: '', // 消耗时间
settled_flag: false, // 是否结单 settled_flag: false, // 是否结单
remark: '', // 备注信息 remark: '', // 备注信息
lines: [], // 消耗明细 lines: [], // 消耗明细
img_url: '', // 图片路径 img_url: '', // 图片路径,逗号分割
}, },
currentItem: { currentItem: {
...@@ -272,7 +276,6 @@ class EquipConsuPage extends Component { ...@@ -272,7 +276,6 @@ class EquipConsuPage extends Component {
componentDidMount() { componentDidMount() {
console.log('houhou hahei!谁在跳???')
this.getSellerName() this.getSellerName()
} }
...@@ -280,7 +283,17 @@ class EquipConsuPage extends Component { ...@@ -280,7 +283,17 @@ class EquipConsuPage extends Component {
getSellerName() { getSellerName() {
let {state, props} = this let {state, props} = this
// console.log('---userInfo',props.userInfo) // console.log('---userInfo',props.userInfo)
let {listOptionData} = this.state
this.setState({
subInitListOption: cloneObject(listOptionData) // 存储初始化数据,提交成功后赋此值
})
if(state.listOptionData[0].name !== props.userInfo.person_name) { if(state.listOptionData[0].name !== props.userInfo.person_name) {
listOptionData[0].name = props.userInfo.person_name
listOptionData[0].value = props.userInfo.user_name
// this.setState({
// listOptionData,
// subInitListOption: cloneObject(listOptionData)
// })
this.setState({ this.setState({
listOptionData: state.listOptionData.map((item) => { listOptionData: state.listOptionData.map((item) => {
if(item.title === '销售员') { if(item.title === '销售员') {
...@@ -288,7 +301,8 @@ class EquipConsuPage extends Component { ...@@ -288,7 +301,8 @@ class EquipConsuPage extends Component {
item.value = props.userInfo.user_name item.value = props.userInfo.user_name
} }
return item return item
}) }),
subInitListOption: cloneObject(listOptionData)
}) })
} }
} }
...@@ -335,8 +349,32 @@ class EquipConsuPage extends Component { ...@@ -335,8 +349,32 @@ class EquipConsuPage extends Component {
listOptionData[12].subOption = nextProps.subDetOption listOptionData[12].subOption = nextProps.subDetOption
this.setState({ this.setState({
listOptionData listOptionData
},() => {
self.changeCanSub()
}) })
} }
if(submit_equip_order_status != nextProps.submit_equip_order_status) {
// console.warn('-submit_equip_order_status------', nextProps.submit_equip_order_status)
// console.warn('--222---submit_equip_order_status--', submit_equip_order_status)
switch (nextProps.submit_equip_order_status) {
case EQUIP_SUBMIT_DOING:
this.changeSubLoding(true, '提交中')
break;
case EQUIP_SUBMIT_SUCCESS:
self.setState({
isSubLoding: false,
lodingTitle: '提交中'
},() => {
self.processReturnData()
})
break;
case EQUIP_SUBMIT_FAILURE:
this.changeSubLoding(false, '提交中')
break;
default:
break;
}
}
} }
// 修改正在加载 // 修改正在加载
...@@ -347,14 +385,24 @@ class EquipConsuPage extends Component { ...@@ -347,14 +385,24 @@ class EquipConsuPage extends Component {
}) })
} }
// 清空当前项以下的 // 清空当前项以下的选择器值,以及耗材明细
clearInitNameAndValue(curIndex) { clearInitNameAndValue(curIndex) {
let { listOptionData, localOtherObj } = this.state let { listOptionData, localOtherObj } = this.state
let { props } = 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 ) {
console.log('进入')
item.name = localOtherObj.name item.name = localOtherObj.name
item.value = localOtherObj.value item.value = localOtherObj.value
// 清空耗材明细
listOptionData[12].subOption = []
props.getSubdetailOption([])
}
if(index == curIndex && curIndex == 3) {
// 清空耗材明细
listOptionData[12].subOption = []
props.getSubdetailOption([])
} }
return item return item
}) })
...@@ -363,28 +411,39 @@ class EquipConsuPage extends Component { ...@@ -363,28 +411,39 @@ class EquipConsuPage extends Component {
// 判断是否都有值,修改提交按钮的颜色 // 判断是否都有值,修改提交按钮的颜色
changeCanSub(isSubCheck) { changeCanSub(isSubCheck) {
// let { listOptionData } = this.state let { listOptionData } = this.state
// let tempStatus = false let tempStatus = false
// let tempTit = '' let tempTit = ''
// for(let chIndex in listOptionData) { for(let chIndex in listOptionData) {
// if(chIndex > 0 && chIndex < 10 if(chIndex > 0 && chIndex < 7
// && chIndex != 6 && chIndex != 8 && chIndex != 5
// && !listOptionData[chIndex].value && !listOptionData[chIndex].value) {
// && listOptionData[chIndex].name !== '其他') { // 选择器为空
// // console.log('chIndex-----',chIndex, chIndex !== 6, typeof chIndex, listOptionData[chIndex].title) tempTit = `“${listOptionData[chIndex].title}”未选择`
// // 不是主治医生 tempStatus = true
// tempTit = listOptionData[chIndex].title break
// tempStatus = true } else if(chIndex >= 5
// break && chIndex != 6
// } && chIndex < 10
// } && !listOptionData[chIndex].value) {
// // console.log('tempStatus====',tempStatus) // 输入框为空
// this.setState({ tempTit = `“${listOptionData[chIndex].title}”未输入`
// canSubFlag: !tempStatus tempStatus = true
// }) break
// if(isSubCheck && tempStatus) { } else if( chIndex == 12
// show(`${tempTit}未选择,不能提交`) && !listOptionData[chIndex].subOption.length ) {
// } tempTit = `“${listOptionData[chIndex].title}”未添加`
tempStatus = true
break
}
}
// console.log('tempStatus====',tempStatus)
this.setState({
canSubFlag: !tempStatus
})
if(isSubCheck && tempStatus) {
show(`${tempTit},不能提交`, 'warn')
}
} }
// 选择器弹窗回调函数 // 选择器弹窗回调函数
...@@ -409,6 +468,9 @@ class EquipConsuPage extends Component { ...@@ -409,6 +468,9 @@ class EquipConsuPage extends Component {
if(itemTitle === '手术医院') { if(itemTitle === '手术医院') {
self.clearInitNameAndValue(2) self.clearInitNameAndValue(2)
} }
if(itemTitle === '订单信息') {
self.clearInitNameAndValue(3)
}
} }
return chItem return chItem
}) })
...@@ -594,6 +656,7 @@ class EquipConsuPage extends Component { ...@@ -594,6 +656,7 @@ class EquipConsuPage extends Component {
dateModalCallback(date) { dateModalCallback(date) {
console.warn('callback',date) console.warn('callback',date)
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '消耗时间') { if(item.title === '消耗时间') {
...@@ -603,6 +666,8 @@ class EquipConsuPage extends Component { ...@@ -603,6 +666,8 @@ class EquipConsuPage extends Component {
} }
return item return item
}) })
},() => {
self.changeCanSub()
}) })
console.warn('--手术类时间---', listOptionData[8]) console.warn('--手术类时间---', listOptionData[8])
} }
...@@ -611,6 +676,7 @@ class EquipConsuPage extends Component { ...@@ -611,6 +676,7 @@ class EquipConsuPage extends Component {
handlePatNameInput(text) { handlePatNameInput(text) {
console.warn('患者姓名------input:', text) console.warn('患者姓名------input:', text)
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '患者姓名') { if(item.title === '患者姓名') {
...@@ -618,6 +684,8 @@ class EquipConsuPage extends Component { ...@@ -618,6 +684,8 @@ class EquipConsuPage extends Component {
} }
return item return item
}) })
},() => {
self.changeCanSub()
}) })
} }
...@@ -644,8 +712,9 @@ class EquipConsuPage extends Component { ...@@ -644,8 +712,9 @@ class EquipConsuPage extends Component {
// 年龄 输入 // 年龄 输入
handleAgeInput(text) { handleAgeInput(text) {
console.warn('年龄------input:', text) // console.warn('年龄------input:', text)
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '年龄') { if(item.title === '年龄') {
...@@ -653,13 +722,16 @@ class EquipConsuPage extends Component { ...@@ -653,13 +722,16 @@ class EquipConsuPage extends Component {
} }
return item return item
}) })
},() => {
self.changeCanSub()
}) })
} }
// 床位 输入 // 床位 输入
handleBedInput(text) { handleBedInput(text) {
console.warn('床位------input:', text) // console.warn('床位------input:', text)
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '床位') { if(item.title === '床位') {
...@@ -667,13 +739,16 @@ class EquipConsuPage extends Component { ...@@ -667,13 +739,16 @@ class EquipConsuPage extends Component {
} }
return item return item
}) })
},() => {
self.changeCanSub()
}) })
} }
// 病历号 输入 // 病历号 输入
handleRecordNumInput(text) { handleRecordNumInput(text) {
console.warn('病历号------input:', text) // console.warn('病历号------input:', text)
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '病历号') { if(item.title === '病历号') {
...@@ -681,13 +756,15 @@ class EquipConsuPage extends Component { ...@@ -681,13 +756,15 @@ class EquipConsuPage extends Component {
} }
return item return item
}) })
},() => {
self.changeCanSub()
}) })
} }
// 结单 是 // 结单 是
handleRadioYesClick() { handleRadioYesClick() {
let {listOptionData} = this.state let {listOptionData} = this.state
listOptionData[10].isRedio = true listOptionData[10].isRedio = 'Y'
this.setState({ this.setState({
listOptionData listOptionData
}) })
...@@ -696,7 +773,7 @@ class EquipConsuPage extends Component { ...@@ -696,7 +773,7 @@ class EquipConsuPage extends Component {
// 结单 否 // 结单 否
handleRadioNoClick() { handleRadioNoClick() {
let {listOptionData} = this.state let {listOptionData} = this.state
listOptionData[10].isRedio = false listOptionData[10].isRedio = 'N'
this.setState({ this.setState({
listOptionData listOptionData
}) })
...@@ -704,7 +781,7 @@ class EquipConsuPage extends Component { ...@@ -704,7 +781,7 @@ class EquipConsuPage extends Component {
// 备注 输入 // 备注 输入
handleRemarkInput(text) { handleRemarkInput(text) {
console.warn('备注---',text) // console.warn('备注---',text)
let { listOptionData } = this.state let { listOptionData } = this.state
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
...@@ -784,7 +861,7 @@ class EquipConsuPage extends Component { ...@@ -784,7 +861,7 @@ class EquipConsuPage extends Component {
noData: false, noData: false,
storageOptions: { storageOptions: {
skipBackup: true, skipBackup: true,
path: 'images' path: 'WisdomEquip' // 存储本地地址
} }
}; };
...@@ -821,9 +898,7 @@ class EquipConsuPage extends Component { ...@@ -821,9 +898,7 @@ class EquipConsuPage extends Component {
else if (res.customButton) { else if (res.customButton) {
console.log('User tapped custom button: ', res.customButton); console.log('User tapped custom button: ', res.customButton);
} else { } else {
// show('上传中...')
that.changeSubLoding(true, '上传中') that.changeSubLoding(true, '上传中')
let source; //保存选中的图片 let source; //保存选中的图片
if (Platform.OS === 'android') { if (Platform.OS === 'android') {
source = res.uri; source = res.uri;
...@@ -833,42 +908,27 @@ class EquipConsuPage extends Component { ...@@ -833,42 +908,27 @@ class EquipConsuPage extends Component {
const formData = new FormData(); const formData = new FormData();
let file = { uri: source, type: 'multipart/form-data', name: res.fileName }; let file = { uri: source, type: 'multipart/form-data', name: res.fileName };
formData.append('file',file); formData.append('file',file);
// console.log('formData112===',formData)
console.log('formData112===',formData)
let params = { let params = {
access_token: props.token, access_token: props.token,
formData formData
} }
//上传图片接口 //上传图片接口
console.log('---handleSubmit--',params) // console.log('---handleSubmit--',params)
let imgResult = await uploadEquipImg(params); let imgResult = await uploadEquipImg(params);
console.log('返回---imgResult======',imgResult) // console.log('返回---imgResult======',imgResult)
if(imgResult.error_code == 0) { if(imgResult.error_code == 0) {
that.changeSubLoding(false) that.changeSubLoding(false)
// 提交订单 // 提交订单
show('上传成功'); show('上传成功');
let {url} = imgResult.data let {url} = imgResult.data
localPhoOption.push(source); localPhoOption.push(source); // 本地图片地址
listOptionData[13].uploadImgArr.push(url) listOptionData[13].uploadImgArr.push(url) // 服务器图片地址
that.setState({ that.setState({
localPhoOption, localPhoOption,
listOptionData listOptionData
}); });
// // that.setState({
// // listOptionData: state.listOptionData.map((item, index) => {
// // if(index == 11) {
// // item.value = imgResult.data.url
// // }
// // return item
// // })
// // }, () => {
// // that.changeSubLoding(false)
// // that.submitQuickOrder()
// // })
} else if(imgResult.error_code == 41006) { } else if(imgResult.error_code == 41006) {
that.changeSubLoding(false) that.changeSubLoding(false)
show('登录过期,请重新登录'); show('登录过期,请重新登录');
...@@ -878,79 +938,83 @@ class EquipConsuPage extends Component { ...@@ -878,79 +938,83 @@ class EquipConsuPage extends Component {
let error_msg = imgResult.error_msg || imgResult.message let error_msg = imgResult.error_msg || imgResult.message
show(error_msg); show(error_msg);
} }
// uploadEquipImg(params)
// .then((response)=>{
// console.log('response==!!!!----------=', response)
// if (response.error_code === 0) {
// show('上传成功');
// localPhoOption.push(source);
// that.setState({localPhoOption});
// }else if(response.error_code === 41006){
// show('登录过期,请重新登录');
// props.exitLoginStatus()
// } else {
// show(response.error_msg)
// }
// })
} }
}) })
} }
// 删除单个照片 点击
handleDelPickCheck(item, index) {
let {listOptionData, localPhoOption} = this.state
localPhoOption.splice(index, 1) // 删除本地地址
listOptionData[13].uploadImgArr.splice(index, 1) // 删除服务器地址
this.setState({
listOptionData,
localPhoOption
}, () => {
show('删除成功')
})
}
// 生成订单 点击 // 生成订单 点击
handleSubmit() { handleSubmit() {
console.warn('生成订单------check') console.warn('生成订单------check')
// 先上传照片,再提交订单 this.changeCanSub(true)
} let { state, props } = this
// 提交订单
submitQuickOrder() {
// // 测试提交--重复数据
// this.clearAllData() // 清空数据
// let { state: { params: { title } } } = this.props.navigation
// this.props.navigation.navigate('SubSuccPage', { // 现在没返回订单号
// title: `${title} - 下单成功`
// })
// 可提交 并且 不处于正在提交中
if(state.canSubFlag && !state.isSubLoding) {
console.warn('进入提交内容----!!------')
let tempSubOption = state.submitOption
tempSubOption.org_code = state.listOptionData[1].value
tempSubOption.surgery_collect_number = state.listOptionData[3].value
tempSubOption.consume_date = state.listOptionData[4].value
tempSubOption.patient_name = state.listOptionData[5].value
tempSubOption.patient_gender = state.listOptionData[6].value
tempSubOption.patient_age = state.listOptionData[7].value
tempSubOption.patient_bed = state.listOptionData[8].value
tempSubOption.patient_id = state.listOptionData[9].value
tempSubOption.settled_flag = state.listOptionData[10].isRedio
tempSubOption.remark = state.listOptionData[11].value
tempSubOption.lines = state.listOptionData[12].subOption
if( tempSubOption.lines.length ) {
tempSubOption.lines = tempSubOption.lines.map(item => {
item['consumed_quantity'] = 1
return item
})
}
tempSubOption.img_url = state.listOptionData[13].uploadImgArr.join(',')
console.log('tempSubOption-----', tempSubOption)
let params = {
access_token: props.token,
data: { ...tempSubOption }
}
props.requestEquipSumbit(params)
}
} }
// 判断组织是否为空 // 判断组织是否为空
judgeOrgIsNull() { judgeOrgIsNull() {
return this.showTipFirstSelect(1) return this.showTipFirstSelect(1)
// let { listOptionData } = this.state
// let orgVal = listOptionData[1].value
// if(!orgVal) {
// show('请先选择组织')
// return false
// } else {
// return true
// }
} }
// 判断手术医院是否为空 // 判断手术医院是否为空
judgeCustomerIsNull() { judgeCustomerIsNull() {
return this.showTipFirstSelect(2) return this.showTipFirstSelect(2)
// let { listOptionData } = this.state
// let orgVal = listOptionData[2].value
// if(!orgVal) {
// show('请先选择手术医院')
// return false
// } else {
// return true
// }
} }
// 判断订单信息是否为空 // 判断订单信息是否为空
judgeOrderInfoIsNull() { judgeOrderInfoIsNull() {
return this.showTipFirstSelect(3) return this.showTipFirstSelect(3)
// let { listOptionData } = this.state
// let orgVal = listOptionData[3].value
// if(!orgVal) {
// show(`请先选择${listOptionData[3].title}`)
// return false
// } else {
// return true
// }
} }
// 提示请先选择 // 提示请先选择
...@@ -967,13 +1031,33 @@ class EquipConsuPage extends Component { ...@@ -967,13 +1031,33 @@ class EquipConsuPage extends Component {
// 处理提交后返回的数据 // 处理提交后返回的数据
processReturnData() { processReturnData() {
// 打开下单成功页面
let { equipOrderOption } = this.props
console.log('submit --- !!!! --- 当前:--返回成功的数据---', equipOrderOption)
if(equipOrderOption.error_code == 0) {
this.clearAllData() // 清空数据
let { state: { params: { title } } } = this.props.navigation
this.props.navigation.navigate('SubSuccPage', { // 现在没返回订单号
title: `${title} - 下单成功`
})
}
} }
// 清空数据
clearAllData() {
let {props} = this
let {listOptionData, subInitListOption} = this.state
props.setEquipInitData() // 清空缓存数据
this.setState({
listOptionData: listOptionData.map((item, index) => {
// 器械消耗 为何和 快速下单一样赋值方式就不行,所以换成这个
Object.keys(item).forEach(key => {
item[key] = subInitListOption[index][key]
})
return item
})
})
}
// 返回备注以上的元素 // 返回备注以上的元素
renderListItem() { renderListItem() {
...@@ -1063,6 +1147,7 @@ class EquipConsuPage extends Component { ...@@ -1063,6 +1147,7 @@ class EquipConsuPage extends Component {
style={styles.cell_input} style={styles.cell_input}
placeholder={`请输入`} placeholder={`请输入`}
onChangeText={(text) => this.handlePatNameInput(text)} onChangeText={(text) => this.handlePatNameInput(text)}
defaultValue={listOptionData[5].value}
/> />
</CellTextStyle> </CellTextStyle>
</TouchableOpacity> </TouchableOpacity>
...@@ -1090,7 +1175,9 @@ class EquipConsuPage extends Component { ...@@ -1090,7 +1175,9 @@ class EquipConsuPage extends Component {
<ContInputTextStyle <ContInputTextStyle
style={styles.cell_input} style={styles.cell_input}
placeholder={`请输入`} placeholder={`请输入`}
keyboardType={'numeric'}
onChangeText={(text) => this.handleAgeInput(text)} onChangeText={(text) => this.handleAgeInput(text)}
defaultValue={listOptionData[7].value}
/> />
</CellTextStyle> </CellTextStyle>
</TouchableOpacity> </TouchableOpacity>
...@@ -1105,7 +1192,9 @@ class EquipConsuPage extends Component { ...@@ -1105,7 +1192,9 @@ class EquipConsuPage extends Component {
<ContInputTextStyle <ContInputTextStyle
style={styles.cell_input} style={styles.cell_input}
placeholder={`请输入`} placeholder={`请输入`}
keyboardType={'numeric'}
onChangeText={(text) => this.handleBedInput(text)} onChangeText={(text) => this.handleBedInput(text)}
defaultValue={listOptionData[8].value}
/> />
</CellTextStyle> </CellTextStyle>
</TouchableOpacity> </TouchableOpacity>
...@@ -1120,7 +1209,9 @@ class EquipConsuPage extends Component { ...@@ -1120,7 +1209,9 @@ class EquipConsuPage extends Component {
<ContInputTextStyle <ContInputTextStyle
style={styles.cell_input} style={styles.cell_input}
placeholder={`请输入`} placeholder={`请输入`}
keyboardType={'numeric'}
onChangeText={(text) => this.handleRecordNumInput(text)} onChangeText={(text) => this.handleRecordNumInput(text)}
defaultValue={listOptionData[9].value}
/> />
</CellTextStyle> </CellTextStyle>
</TouchableOpacity> </TouchableOpacity>
...@@ -1140,7 +1231,7 @@ class EquipConsuPage extends Component { ...@@ -1140,7 +1231,7 @@ class EquipConsuPage extends Component {
> >
<View style={styles.radio_icon}> <View style={styles.radio_icon}>
{ {
listOptionData[10].isRedio ? listOptionData[10].isRedio == 'Y' ?
<Image style={icon_style} source={require('../../images/radio_yes.png')} /> <Image style={icon_style} source={require('../../images/radio_yes.png')} />
: <Image style={icon_style} source={require('../../images/radio_no.png')} /> : <Image style={icon_style} source={require('../../images/radio_no.png')} />
} }
...@@ -1154,7 +1245,7 @@ class EquipConsuPage extends Component { ...@@ -1154,7 +1245,7 @@ class EquipConsuPage extends Component {
> >
<View style={styles.radio_icon}> <View style={styles.radio_icon}>
{ {
listOptionData[10].isRedio ? listOptionData[10].isRedio == 'Y' ?
<Image style={icon_style} source={require('../../images/radio_no.png')} /> <Image style={icon_style} source={require('../../images/radio_no.png')} />
: <Image style={icon_style} source={require('../../images/radio_yes.png')} /> : <Image style={icon_style} source={require('../../images/radio_yes.png')} />
} }
...@@ -1208,6 +1299,7 @@ class EquipConsuPage extends Component { ...@@ -1208,6 +1299,7 @@ class EquipConsuPage extends Component {
// 返回备注元素 // 返回备注元素
renderRemarksItem() { renderRemarksItem() {
let { state } = this let { state } = this
console.log('备注===', state.listOptionData[11], state.subInitListOption[11])
return ( return (
<CellTextStyle style={list_common_item.remark_item}> <CellTextStyle style={list_common_item.remark_item}>
<View style={list_common_item.rema_box}> <View style={list_common_item.rema_box}>
...@@ -1224,7 +1316,7 @@ class EquipConsuPage extends Component { ...@@ -1224,7 +1316,7 @@ class EquipConsuPage extends Component {
style={list_common_item.rema_Input} style={list_common_item.rema_Input}
maxLength={140} maxLength={140}
onChangeText={(text) => this.handleRemarkInput(text)} onChangeText={(text) => this.handleRemarkInput(text)}
defaultValue={state.listOptionData[10].value} defaultValue={state.listOptionData[11].value}
/> />
</TouchableOpacity> </TouchableOpacity>
</View> </View>
...@@ -1367,7 +1459,7 @@ class EquipConsuPage extends Component { ...@@ -1367,7 +1459,7 @@ class EquipConsuPage extends Component {
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={.8}
style={list_common_item.del_img_box} style={list_common_item.del_img_box}
onPress={()=>console.log('删除图片')} onPress={(item, index) => this.handleDelPickCheck(item, index)}
> >
<Image style={icon_style} source={require('../../images/close_err_icon.png')} /> <Image style={icon_style} source={require('../../images/close_err_icon.png')} />
</TouchableOpacity> </TouchableOpacity>
...@@ -1508,6 +1600,15 @@ const mapDispatchToProps = (dispatch) => { ...@@ -1508,6 +1600,15 @@ const mapDispatchToProps = (dispatch) => {
}, },
exitLoginStatus: () => { exitLoginStatus: () => {
dispatch(exitLoginStatus()) dispatch(exitLoginStatus())
},
getSubdetailOption: (data) => {
dispatch(getSubdetailOption(data))
},
requestEquipSumbit: (params) => {
dispatch(requestEquipSumbit(params))
},
setEquipInitData: () => {
dispatch(setEquipInitData())
} }
} }
} }
......
...@@ -99,6 +99,7 @@ class ConsumDetailsPage extends Component { ...@@ -99,6 +99,7 @@ class ConsumDetailsPage extends Component {
// select: false // select: false
// } // }
], ],
allConOption: [], // 所有数据(未筛选过的)
selectShowPopup: false, // 共计已选弹窗 selectShowPopup: false, // 共计已选弹窗
localSelectOption: [], // 已选数据 localSelectOption: [], // 已选数据
isSubLoding: true, // 加载中弹窗 isSubLoding: true, // 加载中弹窗
...@@ -133,7 +134,8 @@ class ConsumDetailsPage extends Component { ...@@ -133,7 +134,8 @@ class ConsumDetailsPage extends Component {
}) })
this.setState({ this.setState({
isSubLoding: false, isSubLoding: false,
conDetaOption: lines conDetaOption: lines,
allConOption: lines
}) })
this.changeIsSelected() this.changeIsSelected()
} else if(detailResult.error_code === 41006) { } else if(detailResult.error_code === 41006) {
...@@ -147,6 +149,30 @@ class ConsumDetailsPage extends Component { ...@@ -147,6 +149,30 @@ class ConsumDetailsPage extends Component {
} }
} }
// 搜索 输入
handleSearchInput(text) {
console.log('搜索 输入---', text)
let {allConOption} = this.state
let self = this
let tempArr = []
if(text) {
allConOption.forEach(item => {
let itemStr = JSON.stringify(item)
if(itemStr.indexOf(text) != -1) {
// 满足搜索条件
tempArr.push(item)
}
})
} else {
tempArr = [...allConOption]
}
this.setState({
conDetaOption: tempArr
}, () => {
self.changeIsSelected()
})
}
// 修改加载中 // 修改加载中
changeLodingFlag(show) { changeLodingFlag(show) {
this.setState({ this.setState({
...@@ -169,14 +195,13 @@ class ConsumDetailsPage extends Component { ...@@ -169,14 +195,13 @@ class ConsumDetailsPage extends Component {
// 修改 当前已选择 // 修改 当前已选择
changeIsSelected(ind, selFlag) { changeIsSelected(ind, selFlag) {
let {conDetaOption} = this.state let {conDetaOption} = this.state
if(ind) { if(ind != undefined) {
conDetaOption[ind].select = selFlag conDetaOption[ind].select = selFlag
} }
let that = this let that = this
this.setState({ this.setState({
conDetaOption conDetaOption
},() => { },() => {
// let {conDetaOption} = this.state
console.log('conDetaOption---修改-', conDetaOption) console.log('conDetaOption---修改-', conDetaOption)
let tempArr = [] let tempArr = []
conDetaOption.forEach(item => { conDetaOption.forEach(item => {
...@@ -186,8 +211,6 @@ class ConsumDetailsPage extends Component { ...@@ -186,8 +211,6 @@ class ConsumDetailsPage extends Component {
}) })
that.setState({ that.setState({
localSelectOption: tempArr localSelectOption: tempArr
}, () => {
console.log('this.localSelectOption--!!2--that====' , that.state.localSelectOption)
}) })
}) })
} }
...@@ -195,7 +218,6 @@ class ConsumDetailsPage extends Component { ...@@ -195,7 +218,6 @@ class ConsumDetailsPage extends Component {
// 已选回调函数 // 已选回调函数
detailsCallbak(subOpt) { detailsCallbak(subOpt) {
console.log('----回调:',subOpt) console.log('----回调:',subOpt)
// let {conDetaOption} = this.state
let tempOption = [...this.state.conDetaOption] let tempOption = [...this.state.conDetaOption]
// 获取当前已选值 // 获取当前已选值
tempOption = tempOption.map(item => { tempOption = tempOption.map(item => {
...@@ -233,10 +255,7 @@ class ConsumDetailsPage extends Component { ...@@ -233,10 +255,7 @@ class ConsumDetailsPage extends Component {
handleSubmit() { handleSubmit() {
console.warn('确定耗材', this.props.navigation.navigate) console.warn('确定耗材', this.props.navigation.navigate)
this.handleCloseSelectModal(false) this.handleCloseSelectModal(false)
console.warn('携带数据,填写单价') // 可存储于store中!!!
let {localSelectOption} = this.state let {localSelectOption} = this.state
if(!localSelectOption.length) { if(!localSelectOption.length) {
show('请选择耗材') show('请选择耗材')
return return
...@@ -256,6 +275,7 @@ class ConsumDetailsPage extends Component { ...@@ -256,6 +275,7 @@ class ConsumDetailsPage extends Component {
placeholder={'请输入搜索关键词'} placeholder={'请输入搜索关键词'}
style={list_common_item.ser_text_input} style={list_common_item.ser_text_input}
defaultValue={this.state.searchValue} defaultValue={this.state.searchValue}
onChangeText={(text) => this.handleSearchInput(text)}
/> />
<View style={list_common_item.ser_img_box}> <View style={list_common_item.ser_img_box}>
<Image source={require('../../../images/search_icon.png')} style={icon_style}/> <Image source={require('../../../images/search_icon.png')} style={icon_style}/>
...@@ -266,7 +286,6 @@ class ConsumDetailsPage extends Component { ...@@ -266,7 +286,6 @@ class ConsumDetailsPage extends Component {
// 返回中间主要内容 // 返回中间主要内容
renderContItem() { renderContItem() {
// let {conDetaOption} = this.state
return ( return (
<ScrollView <ScrollView
style={styles.cons_cont_scroll} style={styles.cons_cont_scroll}
......
...@@ -16,7 +16,7 @@ const defaultState = { ...@@ -16,7 +16,7 @@ const defaultState = {
equip_list_status: EQUIP_CONSU_LIST_NO, // 获取数据状态 equip_list_status: EQUIP_CONSU_LIST_NO, // 获取数据状态
submit_equip_order_status: EQUIP_SUBMIT_NO, // 提交订单状态 submit_equip_order_status: EQUIP_SUBMIT_NO, // 提交订单状态
equipOrderOption: {}, // 当前选择器临时存储数据 equipOrderOption: {}, // 当前选择器临时存储数据
subDetOption: {}, // 选择的消耗明细数据 subDetOption: [], // 选择的消耗明细数据
} }
export default equip = (state = defaultState, action) => { export default equip = (state = defaultState, action) => {
...@@ -54,10 +54,9 @@ export default equip = (state = defaultState, action) => { ...@@ -54,10 +54,9 @@ export default equip = (state = defaultState, action) => {
equip_list_status: EQUIP_CONSU_LIST_NO, equip_list_status: EQUIP_CONSU_LIST_NO,
submit_equip_order_status: EQUIP_SUBMIT_NO, submit_equip_order_status: EQUIP_SUBMIT_NO,
equipOrderOption: {}, equipOrderOption: {},
subDetOption: {} subDetOption: []
}) })
case GET_SUB_DETAIL_OPTION: case GET_SUB_DETAIL_OPTION:
console.log('----??----存储啦吗??', action.rawData)
return Object.assign({}, state, { return Object.assign({}, state, {
subDetOption: action.rawData subDetOption: action.rawData
}) })
......
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