提交 f16fcaf1 authored 作者: 徐立's avatar 徐立

兼容自定义表头

上级 72e5c2bd
...@@ -423,9 +423,24 @@ class FormList extends React.Component { ...@@ -423,9 +423,24 @@ class FormList extends React.Component {
const { rights, columnRights } = this.state; const { rights, columnRights } = this.state;
if (this.props.value && this.props.value.columns) { if (this.props.value && this.props.value.columns) {
this.columns = this.props.value.columns; this.columns = this.props.value.columns;
let cacheList = [];
let cacheChecked = [];
// 表头筛选逻辑
Array.isArray(this.props.value.columns) &&
this.props.value.columns.map(item => {
cacheList.push({
label: item.title,
value: item.name,
});
cacheChecked.push(item.name);
});
this.checkList = cacheList;
this.setState({
checkedList: cacheChecked,
cacheColumns: cloneDeep(this.props.value.columns),
});
if (this.props.objCode == 1 || this.props.objCode == '1') { if (this.props.objCode == 1 || this.props.objCode == '1') {
this.getPage(); this.getPage();
} else { } else {
dispatch({ dispatch({
type: 'formList/getHead', type: 'formList/getHead',
...@@ -433,9 +448,8 @@ class FormList extends React.Component { ...@@ -433,9 +448,8 @@ class FormList extends React.Component {
callback: datas => { callback: datas => {
const querys = []; const querys = [];
const groups = {}; const groups = {};
const refIds=[]; const refIds = [];
for (let t in datas) { for (let t in datas) {
if (datas[t].isShowQuery) { if (datas[t].isShowQuery) {
querys.push(datas[t]); querys.push(datas[t]);
if (datas[t].referenceObjId != null) { if (datas[t].referenceObjId != null) {
...@@ -452,7 +466,6 @@ class FormList extends React.Component { ...@@ -452,7 +466,6 @@ class FormList extends React.Component {
}); });
} }
} }
} }
if (querys.length > 0) { if (querys.length > 0) {
this.setState({ querys }); this.setState({ querys });
...@@ -467,8 +480,8 @@ class FormList extends React.Component { ...@@ -467,8 +480,8 @@ class FormList extends React.Component {
} }
} }
this.getPage(); this.getPage();
} },
}) });
} }
return; return;
} }
...@@ -572,7 +585,7 @@ class FormList extends React.Component { ...@@ -572,7 +585,7 @@ class FormList extends React.Component {
this.setState({ tableWidth: (datas.length - 1) * 200 }); this.setState({ tableWidth: (datas.length - 1) * 200 });
this.columns.push(column); this.columns.push(column);
this.setState({ this.setState({
cacheColumns: this.columns, cacheColumns: cloneDeep(this.columns),
}); });
if (datas[t].isShowQuery) { if (datas[t].isShowQuery) {
querys.push(datas[t]); querys.push(datas[t]);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论