import axios from '@utils/ajax'; import store from '@store'; import { searchList } from '../actions/assistCheck'; export const getSearchList = (val) => { if(val.trim() == ''){ const data = []; return (dispatch) => dispatch(searchList(data,'')); } let baseList = store.getState(); let sex = baseList.patInfo.message.patientSex; return (dispatch) => { axios.json('/demo/retrieval/index',{ "age": 10, "inputStr": val, "sex": 1, "type": '3' }) .then((res)=>{ const data = res.data.data;let curDate=[]; let arr = data.pacsNames; for (var key in arr) { let obj = {} obj['uniqueName'] = arr[key]; obj['detailName'] = arr[key]; obj['name'] = arr[key]; curDate.push(obj) } dispatch(searchList(curDate,val.trim())); }) } };