Commit 37633e16 authored by 左玲玲's avatar 左玲玲 😬

问题修复

parent 6e91f9c3
...@@ -33,9 +33,9 @@ class Mtable extends PureComponent { ...@@ -33,9 +33,9 @@ class Mtable extends PureComponent {
this.props.columns != nextprops.columns this.props.columns != nextprops.columns
) { ) {
if (nextprops.actionRef) { if (nextprops.actionRef) {
nextprops.actionRef?.current?.reload(); nextprops.actionRef?.current?.reset();
} else { } else {
this.actionRefs?.current?.reload(); this.actionRefs?.current?.reset();
} }
this.initDrage(nextprops); this.initDrage(nextprops);
} }
......
...@@ -76,14 +76,22 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -76,14 +76,22 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
}, [data]); }, [data]);
const onChange = (e) => { const onChange = (e) => {
const { value } = e.target; const { value } = e.target;
const newExpandedKeys = alldata.map((item) => { const dataLists = getAllList();
const newExpandedKeys = dataLists.map((item) => {
if (item.title.indexOf(value) > -1) { if (item.title.indexOf(value) > -1) {
return getParentKey(item.key, treeData); return getParentKey(item.key, treeData);
} }
return null; return null;
}).filter((item, i, self) => item && self.indexOf(item) === i); }).filter((item, i, self) => item && self.indexOf(item) === i);
onExpand(newExpandedKeys);
setsearch(value); setsearch(value);
if(newExpandedKeys.length>0){
setexpandall(true);
setAutoExpandParent(true)
}else{
setexpandall(false);
setAutoExpandParent(false)
}
onExpand(newExpandedKeys);
}; };
const loop = data => data.map(item => { const loop = data => data.map(item => {
const index = item.title.indexOf(search); const index = item.title.indexOf(search);
...@@ -240,7 +248,22 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -240,7 +248,22 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
useEffect(() => { useEffect(() => {
setexpandall(true); setexpandall(true);
onExpand(allkeys) onExpand(allkeys)
}, [allkeys]) }, [allkeys]);
function getAllList() {
const dataLists = [];
const generateLists = data => {
for (let i = 0; i < data.length; i++) {
const node = data[i];
const key = node.key;
dataLists.push({ key, title: node.title, level: node.level });
if (node.children) {
generateLists(node.children, node.key);
}
}
};
generateLists(treeData);
return dataLists;
}
return ( return (
<div> <div>
<Modal <Modal
...@@ -329,12 +352,12 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -329,12 +352,12 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
autoExpandParent={autoExpandParent} autoExpandParent={autoExpandParent}
defaultExpandAll={true} defaultExpandAll={true}
expandedKeys={expandedKeys} expandedKeys={expandedKeys}
onExpand={(expandedKeys, {expanded: bool, node}) => { onExpand={(expandedKeys, { expanded: bool, node }) => {
onExpand(expandedKeys); onExpand(expandedKeys);
setAutoExpandParent(false); setAutoExpandParent(false);
if(!bool && node.key=="00000000"){ if (!bool && node.key == "00000000") {
setexpandall(false) setexpandall(false)
}else{ } else {
setexpandall(true) setexpandall(true)
} }
}} }}
......
...@@ -50,7 +50,7 @@ const EditUpload = ({ record, fid, storeId }) => { ...@@ -50,7 +50,7 @@ const EditUpload = ({ record, fid, storeId }) => {
search: false, search: false,
valueType: "select", valueType: "select",
request: async (params) => { request: async (params) => {
let res = await doFetch({ url: "/ngic-auth/sysStorePosition/queryByStoreId/selection", params}); let res = await doFetch({ url: "/ngic-auth/sysStorePosition/queryByStoreId/selection", params:{storeId:params.storeId}});
return res?.data?.dataList return res?.data?.dataList
}, },
editable: (text, record, index) => { editable: (text, record, index) => {
......
...@@ -65,7 +65,7 @@ const EditUpload = ({ record, fid, storeId }) => { ...@@ -65,7 +65,7 @@ const EditUpload = ({ record, fid, storeId }) => {
search: false, search: false,
valueType: "select", valueType: "select",
request: async (params) => { request: async (params) => {
let res = await doFetch({ url: "/ngic-auth/sysStorePosition/queryByStoreId/selection", params }); let res = await doFetch({ url: "/ngic-auth/sysStorePosition/queryByStoreId/selection", params:{storeId:params.storeId} });
return res?.data?.dataList return res?.data?.dataList
}, },
editable: (text, record, index) => { editable: (text, record, index) => {
......
...@@ -741,8 +741,8 @@ const materielDetail = [ ...@@ -741,8 +741,8 @@ const materielDetail = [
columns: [ columns: [
{ {
title: "辅助单位", title: "辅助单位",
dataIndex: "productionUnit", dataIndex: "productionUnitName",
key: "productionUnit", key: "productionUnitName",
search: false, search: false,
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment