|
@@ -4,7 +4,7 @@
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
* @Date: 2022-12-16 09:42:52
|
|
* @Date: 2022-12-16 09:42:52
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
- * @LastEditTime: 2023-04-26 19:33:00
|
|
|
|
|
|
+ * @LastEditTime: 2023-04-27 11:35:32
|
|
* @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
|
|
* @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
*/
|
|
@@ -113,8 +113,8 @@ const CheckUnitDepMap: React.FC = () => {
|
|
const delTableDataHandle = async (record: any) => {
|
|
const delTableDataHandle = async (record: any) => {
|
|
const resp: any = await delTableData(record.id);
|
|
const resp: any = await delTableData(record.id);
|
|
if (resp) {
|
|
if (resp) {
|
|
- tableRef.current?.reload();
|
|
|
|
getTreeReqFunc();
|
|
getTreeReqFunc();
|
|
|
|
+ tableRef.current?.reload();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -168,13 +168,6 @@ const CheckUnitDepMap: React.FC = () => {
|
|
tag: string;
|
|
tag: string;
|
|
}
|
|
}
|
|
|
|
|
|
- interface TableTransferProps extends TransferProps<TransferItem> {
|
|
|
|
- dataSource: DataType[];
|
|
|
|
- leftColumns: ColumnsType<DataType>;
|
|
|
|
- rightColumns: ColumnsType<DataType>;
|
|
|
|
- record: any
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
const transferTableColumn: any[] = [
|
|
const transferTableColumn: any[] = [
|
|
{
|
|
{
|
|
@@ -259,8 +252,8 @@ const CheckUnitDepMap: React.FC = () => {
|
|
|
|
|
|
if (resp) {
|
|
if (resp) {
|
|
message.success('添加成功!');
|
|
message.success('添加成功!');
|
|
- tableRef.current?.reload();
|
|
|
|
getTreeReqFunc();
|
|
getTreeReqFunc();
|
|
|
|
+ tableRef.current?.reload();
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -396,57 +389,56 @@ const CheckUnitDepMap: React.FC = () => {
|
|
const getTreeReqFunc = async () => {
|
|
const getTreeReqFunc = async () => {
|
|
const resp = await getTreeData();
|
|
const resp = await getTreeData();
|
|
|
|
|
|
- function checkMap(node:any) {
|
|
|
|
- if (!node.child || node.child.length === 0) {
|
|
|
|
- // 如果当前节点没有子节点,说明是最里层的节点
|
|
|
|
- return node.map === false;
|
|
|
|
- } else {
|
|
|
|
- // 如果当前节点有子节点,递归遍历所有子节点
|
|
|
|
- let flag = false; //子节点是否存在false
|
|
|
|
- for (let i = 0; i < node.child.length; i++) {
|
|
|
|
- if (checkMap(node.child[i])) {
|
|
|
|
- // 如果子节点存在 map 为 false,设置当前节点的 map 为 false
|
|
|
|
- flag = true;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return flag;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- function setParentMapVal(node:any,val:boolean) {
|
|
|
|
- if (!node.child) {
|
|
|
|
- // 如果当前节点没有子节点,则直接返回
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ // function checkMap(node:any) {
|
|
|
|
+ // if (!node.child || node.child.length === 0) {
|
|
|
|
+ // // 如果当前节点没有子节点,说明是最里层的节点
|
|
|
|
+ // return node.map === false;
|
|
|
|
+ // } else {
|
|
|
|
+ // // 如果当前节点有子节点,递归遍历所有子节点
|
|
|
|
+ // let flag = false; //子节点是否存在false
|
|
|
|
+ // for (let i = 0; i < node.child.length; i++) {
|
|
|
|
+ // if (checkMap(node.child[i])) {
|
|
|
|
+ // // 如果子节点存在 map 为 false,设置当前节点的 map 为 false
|
|
|
|
+ // flag = true;
|
|
|
|
+ // break;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // return flag;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // function setParentMapVal(node:any,val:boolean) {
|
|
|
|
+ // if (!node.child) {
|
|
|
|
+ // // 如果当前节点没有子节点,则直接返回
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
|
|
- for (let item of node.child) {
|
|
|
|
- // 递归处理子节点,将子节点的 map 属性改为 false
|
|
|
|
- node.map = val,
|
|
|
|
- setParentMapVal(item,val);
|
|
|
|
|
|
+ // for (let item of node.child) {
|
|
|
|
+ // // 递归处理子节点,将子节点的 map 属性改为 false
|
|
|
|
+ // node.map = val,
|
|
|
|
+ // setParentMapVal(item,val);
|
|
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- const newData = resp.map((item: any) => {
|
|
|
|
- const flag = checkMap(item);
|
|
|
|
- console.log({flag});
|
|
|
|
- if(flag){
|
|
|
|
- //将所有父级map改为false
|
|
|
|
- setParentMapVal(item,false);
|
|
|
|
- }else{
|
|
|
|
- setParentMapVal(item,true);
|
|
|
|
- }
|
|
|
|
- return item;
|
|
|
|
- });
|
|
|
|
|
|
+ // const newData = resp.map((item: any) => {
|
|
|
|
+ // const flag = checkMap(item);
|
|
|
|
+ // console.log({flag});
|
|
|
|
+ // if(flag){
|
|
|
|
+ // //将所有父级map改为false
|
|
|
|
+ // setParentMapVal(item,false);
|
|
|
|
+ // }else{
|
|
|
|
+ // setParentMapVal(item,true);
|
|
|
|
+ // }
|
|
|
|
+ // return item;
|
|
|
|
+ // });
|
|
|
|
|
|
- console.log({ newData });
|
|
|
|
|
|
|
|
- set_treeData(newData);
|
|
|
|
|
|
+ set_treeData(resp);
|
|
}
|
|
}
|
|
|
|
|
|
const tableDataSearchHandle = (paramName: string) => {
|
|
const tableDataSearchHandle = (paramName: string) => {
|
|
@@ -478,6 +470,8 @@ const CheckUnitDepMap: React.FC = () => {
|
|
if (treeData[0].child && treeData[0].child.length > 0) {
|
|
if (treeData[0].child && treeData[0].child.length > 0) {
|
|
const [node, nodeParent] = getDeepestTreeData(treeData[0], 'child');
|
|
const [node, nodeParent] = getDeepestTreeData(treeData[0], 'child');
|
|
|
|
|
|
|
|
+ console.log({currentSelectedTreeNode});
|
|
|
|
+
|
|
set_currentSelectedTreeNode(node);
|
|
set_currentSelectedTreeNode(node);
|
|
setExpandedKeys([nodeParent.code]);
|
|
setExpandedKeys([nodeParent.code]);
|
|
}
|
|
}
|
|
@@ -553,7 +547,7 @@ const CheckUnitDepMap: React.FC = () => {
|
|
|
|
|
|
}}>
|
|
}}>
|
|
{title}
|
|
{title}
|
|
- {!nodeData.map && <span className='point'></span>}
|
|
|
|
|
|
+ {!nodeData.map&&<span className={nodeData.unitType?'point lastChild':'point'}></span>}
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
}
|
|
}
|