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

多行显示更新

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