提交 fa77557e authored 作者: chscls@163.com's avatar chscls@163.com

树型菜单

上级 b44b8a49
......@@ -289,7 +289,14 @@ class TreeList extends React.Component {
objId: this.state.objId
},
callback: () => {
this.getPage();
this.getPage({parentId: this.state.parentId},null,null, (list) => {
const treeData = this.refesh(this.state.parentId, list, this.state.treeData)
this.setState({
modalVisible: false,
treeData
});
})
},
});
};
......@@ -322,7 +329,6 @@ class TreeList extends React.Component {
showMobileDiv,
})
}
console.log(showMobileDiv)
}
//渲染值
componentDidMount() {
......@@ -560,18 +566,18 @@ class TreeList extends React.Component {
}
sqlBs16=Base16Encode(this.props.sql)
getPage = (params, values,callPage) => {
getPage = (params, values,callPage,callback) => {
if(this.columns==null||this.columns.length==0){
return;
}
const { dispatch } = this.props;
const { dispatch ,json:{treeParentIdName}} = this.props;
const pagination = this.state.data.pagination;
if (params == null) {
params = {
pageNo: pagination.current ? pagination.current : 1,
pageSize: pagination.pageSize ? pagination.pageSize : (this.props.pageSize||10),
// pageNo: pagination.current ? pagination.current : 1,
//pageSize: pagination.pageSize ? pagination.pageSize : (this.props.pageSize||10),
query: JSON.stringify(values!=null?values:this.state.formValues),
};
}
......@@ -598,19 +604,28 @@ class TreeList extends React.Component {
}else{
dispatch({
type: 'formList/fetch',
type: 'formList/tree',
payload: {
custom:this.custom,
...params,
parentIdName: treeParentIdName,
sql:this.sqlBs16,
dataObjId: this.state.objId,
},
callback:(data)=>{
callback:(list)=>{
const data={
list:list,
pagination:false
}
if(!this.state.isReady){
this.setState({data,isReady:true})
this.setState({data,parentId:params.parentId,isReady:true},()=>{
if(callback) callback(list)
})
}else{
this.setState({data})
this.setState({data,parentId:params.parentId},()=>{
if(callback) callback(list)
})
}
......@@ -641,9 +656,11 @@ class TreeList extends React.Component {
};
handleAdd = (fields, isAdd) => {
const {json:{treeParentIdName}}=this.props
let params = {
...fields,
};
params[treeParentIdName]=this.state.parentId
this.props.dispatch({
type: 'formList/add',
payload: {
......@@ -655,10 +672,15 @@ class TreeList extends React.Component {
},
callback: () => {
message.success('操作成功');
this.setState({
modalVisible: false,
});
this.getPage();
this.getPage({parentId: this.state.parentId},null,null, (list) => {
const treeData = this.refesh(this.state.parentId, list, this.state.treeData)
this.setState({
modalVisible: false,
treeData
});
})
},
});
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论