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());
...@@ -182,3 +180,10 @@ function requestSubmitFail() { ...@@ -182,3 +180,10 @@ function requestSubmitFail() {
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
...@@ -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