提交 4f76889e authored 作者: 吴强's avatar 吴强

Merge branch 'master' of ssh://192.168.1.116:29418/bolan-root/frontend/manager-app-sz into wq

# Conflicts: # package.json
......@@ -49,6 +49,7 @@
"react-native-splash-screen": "^3.0.6",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.19",
"react-native-fetch-polyfill": "^1.1.2",
"react-redux": "^5.0.6",
"redux-persist": "^4.10.1"
}
......
import { unionBy } from 'lodash';
import { NavigationActions } from 'react-navigation';
import { getData, getMeta } from '../../utils/DataTemplate';
export default {
namespace: 'QSInfo',
state: {
sourceData: [],
metas: [],
QSID: '',
searchValue: '',
},
reducers: {
setQSID(state, { payload }) {
return {
...state,
QSID: payload,
};
},
setList(state, { payload: { arrayData } }) {
const newSourceData = unionBy(state.sourceData, arrayData, 'id');
return { ...state, sourceData: newSourceData };
},
// 下拉刷新用到的,清空列表的数据
clearList(state) {
return { ...state, sourceData: [] };
},
setMetas(state, { payload }) {
return { ...state, metas: payload };
},
setSearchValue(state, { payload }) {
console.info(payload);
return {
...state,
searchValue: payload,
};
},
},
effects: {
*jumpPage({ payload: id }, { put }) {
yield put({ type: 'setQSID', payload: id });
yield put(NavigationActions.navigate({
routeName: 'QuanshuDetailScreen',
params: { id },
}));
},
*getQSList({ payload }, { take, put, call, select }) {
const { clear, pZhengShuMingCheng } = payload;
console.info(payload);
// console.info(payload);
if (clear === 'clear') {
yield put({ type: 'clearList', payload: {} });
}
const { sourceData } = yield select(state => state.QSInfo);
const size = sourceData.length;
const coordinate = {
containerType: 'module',
containerName: 'query-DSRFWQuanShu',
datasourceName: 'QueryfwqsTable',
};
const result = yield call(getData, coordinate, { pst: size, psz: 10, params: { pZhengShuMingCheng } });
console.info(result);
const meta = yield call(getMeta, coordinate);
yield put({ type: 'setMetas', payload: meta });
for (const row of result) {
yield put({ type: 'addDSR', payload: row });
yield take('addDSR/@@end');
}
},
*addDSR({ payload }, { put }) {
yield put({ type: 'setList', payload: { arrayData: [payload] } });
},
},
};
/**
* Created by zhouhuan on 2017/11/13.
*/
import { getData, getMeta } from '../../utils/DataTemplate';
export default {
namespace: 'QSInfoDetail',
state: {
singularData: {},
metas: [],
enableEdit: false,
QSID: '',
},
reducers: {
setList(state, { payload }) {
return { ...state, singularData: payload.singularData };
},
setSingularData(state, { payload }) {
return { ...state, singularData: payload };
},
setEnable(state, { payload: enableEdit }) {
return { ...state, enableEdit };
},
setMetas(state, { payload }) {
return { ...state, metas: payload };
},
setQSID(state, { payload }) {
return {
...state,
QSID: payload,
};
},
},
effects: {
*getDSRInfoDetail({ payload }, { call, put }) {
const coordinate = {
containerType: 'module',
containerName: 'query-DSRFWQuanShu',
datasourceName: 'QueryfwqsDetails',
};
const result = yield call(getData, coordinate, { pst: 0, psz: 10, params: { pID: payload } });
const singularData = result[0];
yield put({ type: 'setQSID', payload });
yield put({ type: 'setList', payload: { singularData: { ...singularData } } });
const metas = yield call(getMeta, coordinate);
yield put({ type: 'setMetas', payload: metas });
},
},
};
......@@ -6,6 +6,7 @@ import { getToken } from './auth';
import { checkStatus, normParams, parseObject } from './http-helper';
const defaultOptions = {
timeout: 30 * 1000,
headers: { Accept: 'application/json' },
};
......
/* eslint-disable prefer-destructuring */
// noinspection JSUnresolvedVariable
export const fetch = global.fetch;
// eslint-disable-next-line global-require
export const fetch = require('react-native-fetch-polyfill');
......@@ -7,6 +7,7 @@ import { getToken } from './auth';
import { errors } from './error';
const defaultOptions = {
timeout: 30 * 1000,
headers: {
Accept: 'application/json',
},
......
......@@ -6,6 +6,7 @@ import { errors } from './error';
import { checkStatus, normParams, parseObject } from './http-helper';
const defaultOptions = {
timeout: 30 * 1000,
headers: { Accept: 'application/json' },
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论