提交 09f0a8af authored 作者: 吴强's avatar 吴强

多行显示更新

上级 803c89e5
...@@ -20,7 +20,7 @@ class PickerComponent extends PureComponent { ...@@ -20,7 +20,7 @@ class PickerComponent extends PureComponent {
<List style={{ backgroundColor: 'white' }} className="picker-list"> <List style={{ backgroundColor: 'white' }} className="picker-list">
<Picker <Picker
data={data} data={data}
cols={3} cols={this.props.cols}
value={pathVal} value={pathVal}
onPickerChange={this.onPickerChange} onPickerChange={this.onPickerChange}
onOk={this.onOkButton} onOk={this.onOkButton}
......
...@@ -25,32 +25,38 @@ const findTarget = (list, dmpath) => { ...@@ -25,32 +25,38 @@ const findTarget = (list, dmpath) => {
return null; return null;
}; };
const createData = async (list, dmpath, payload) => { const createData = async (list, dmpath, payload) => {
console.log(list);
console.log(dmpath);
// 根据path用fetchDomains 查出children // 根据path用fetchDomains 查出children
let childrens; let childrens = [];
let pathArray; let pathArray;
if (dmpath !== '/') { if (dmpath !== '/' || dmpath.split('/').length === 3) {
childrens = await fetchDomains(dmpath); childrens = await fetchDomains(dmpath);
console.log(childrens); console.info('ChildRen-------------------------');
const childrenPath = childrens[0].path; console.info(childrens);
pathArray = [...payload, childrenPath]; console.info('ChildRen------------------------');
if (childrens.length !== 0) {
const childrenPath = childrens[0].path;
pathArray = [...payload, childrenPath];
console.info(pathArray);
}
} else { } else {
pathArray = [...payload]; pathArray = [...payload];
} }
const cols = pathArray.length;
const childrenData = []; const childrenData = [];
childrens.map(({ name, path }) => { if (childrens.length !== 0) {
childrenData.push({ label: name, value: path, children: [] }); childrens.map(({ name, path }) => {
return childrenData; childrenData.push({ label: name, value: path, children: [] });
}); return childrenData;
});
}
// 根据path在list查出需要添加children的对象target // 根据path在list查出需要添加children的对象target
const findData = findTarget(list, dmpath); const findData = findTarget(list, dmpath);
findData.children = childrenData; findData.children = childrenData;
console.log(findData);
const data = list; const data = list;
console.log(list); console.log(list);
return { data, pathArray }; return { data, pathArray, cols };
}; };
export default { export default {
namespace: 'domain', namespace: 'domain',
...@@ -60,7 +66,7 @@ export default { ...@@ -60,7 +66,7 @@ export default {
list: [], list: [],
listChildren: [], listChildren: [],
arrayPath: [], arrayPath: [],
cols: '', cols: 1,
userInfo: '', userInfo: '',
}, },
...@@ -85,7 +91,6 @@ export default { ...@@ -85,7 +91,6 @@ export default {
}, },
*fetchParam({ payload }, { put, call, select }) { *fetchParam({ payload }, { put, call, select }) {
console.log(payload);
let dmpath = ''; let dmpath = '';
if (payload.length === 1) { if (payload.length === 1) {
dmpath = payload[0]; dmpath = payload[0];
...@@ -95,12 +100,11 @@ export default { ...@@ -95,12 +100,11 @@ export default {
dmpath = payload[2]; dmpath = payload[2];
} }
const { list } = yield select(state => state.domain); const { list } = yield select(state => state.domain);
// const target = yield call(findTarget, list, dmpath);
// console.log(target);
const datas = yield call(createData, list, dmpath, payload); const datas = yield call(createData, list, dmpath, payload);
console.log(datas); console.log(datas);
yield put({ type: 'queryList', payload: datas.data }); yield put({ type: 'queryList', payload: datas.data });
yield put({ type: 'queryArryPath', payload: datas.pathArray }); yield put({ type: 'queryArryPath', payload: datas.pathArray });
yield put({ type: 'setCols', payload: datas.cols });
}, },
*switch({ payload: domainPath }, { put, call }) { *switch({ payload: domainPath }, { put, call }) {
yield call(switchDomain, domainPath); yield call(switchDomain, domainPath);
...@@ -119,7 +123,6 @@ export default { ...@@ -119,7 +123,6 @@ export default {
}, },
*getUserInfo(ignored, { put, call }) { *getUserInfo(ignored, { put, call }) {
const userInfo = yield call(getUser); const userInfo = yield call(getUser);
// console.log(userInfo);
yield put({ type: 'queryUserInfo', payload: userInfo }); yield put({ type: 'queryUserInfo', payload: userInfo });
}, },
}, },
...@@ -155,6 +158,12 @@ export default { ...@@ -155,6 +158,12 @@ export default {
arrayPath, arrayPath,
}; };
}, },
setCols(state, { payload: cols }) {
return {
...state,
cols,
};
},
}, },
}; };
...@@ -78,6 +78,7 @@ class ObligeeInfo extends React.Component { ...@@ -78,6 +78,7 @@ class ObligeeInfo extends React.Component {
<List.Item <List.Item
key={m.key} key={m.key}
extra={detailData[m.key]} extra={detailData[m.key]}
wrap
> >
{m.label} {m.label}
</List.Item> </List.Item>
......
...@@ -78,6 +78,7 @@ class FWQuanShuScreen extends React.Component { ...@@ -78,6 +78,7 @@ class FWQuanShuScreen extends React.Component {
<List.Item <List.Item
key={m.key} key={m.key}
extra={detailData[m.key]} extra={detailData[m.key]}
wrap
> >
{m.label} {m.label}
</List.Item> </List.Item>
......
...@@ -33,6 +33,7 @@ class QuanshuDetailScreen extends React.Component { ...@@ -33,6 +33,7 @@ class QuanshuDetailScreen extends React.Component {
<List.Item <List.Item
key={m.key} key={m.key}
extra={singularData[m.key]} extra={singularData[m.key]}
wrap
> >
{m.label} {m.label}
</List.Item> </List.Item>
......
...@@ -17,13 +17,10 @@ class UserInfoHomeScreen extends PureComponent { ...@@ -17,13 +17,10 @@ class UserInfoHomeScreen extends PureComponent {
this.props.dispatch(createAction('domain/fetch')()); this.props.dispatch(createAction('domain/fetch')());
}; };
onPickerChange =(path) => { onPickerChange =(path) => {
// console.log(path);
this.props.dispatch(createAction('domain/fetchParam')(path)); this.props.dispatch(createAction('domain/fetchParam')(path));
}; };
onOkButton =() => { onOkButton =() => {
console.info(this.props.domain);
const domainPath = last(this.props.domain.arrayPath); const domainPath = last(this.props.domain.arrayPath);
console.info(domainPath);
this.props.dispatch(createAction('domain/switch')(domainPath)); this.props.dispatch(createAction('domain/switch')(domainPath));
}; };
onLogout = () => { onLogout = () => {
...@@ -35,8 +32,6 @@ class UserInfoHomeScreen extends PureComponent { ...@@ -35,8 +32,6 @@ class UserInfoHomeScreen extends PureComponent {
}; };
render() { render() {
const { list, listChildren, arrayPath, cols, userInfo } = this.props.domain; const { list, listChildren, arrayPath, cols, userInfo } = this.props.domain;
// console.log(arrayPath);
console.log(userInfo);
let datas = []; let datas = [];
if (listChildren.length === 0) { if (listChildren.length === 0) {
datas = list; datas = list;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论