Commit c81a183f by zhaochengxiang

警告

parent e8639c6e
...@@ -31,6 +31,7 @@ const DefineTable = (props) => { ...@@ -31,6 +31,7 @@ const DefineTable = (props) => {
useEffect(() => { useEffect(() => {
setCheckedKeys([]); setCheckedKeys([]);
setPagination({...pagination, pageNum: 1}); setPagination({...pagination, pageNum: 1});
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [nodeId]) }, [nodeId])
useEffect(() => { useEffect(() => {
...@@ -40,6 +41,7 @@ const DefineTable = (props) => { ...@@ -40,6 +41,7 @@ const DefineTable = (props) => {
} else { } else {
getTemplates(); getTemplates();
} }
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [keyword, pagination]) }, [keyword, pagination])
const columns = useMemo(() => { const columns = useMemo(() => {
......
...@@ -7,11 +7,10 @@ import { DndProvider } from 'react-dnd'; ...@@ -7,11 +7,10 @@ import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend'; import { HTML5Backend } from 'react-dnd-html5-backend';
import DebounceInput from "../../../Model/Component/DebounceInput"; import DebounceInput from "../../../Model/Component/DebounceInput";
import { inputWidth, generateUUID } from "../../../../../util"; import { inputWidth } from "../../../../../util";
import { DragableBodyRow, DatatypeInput } from "../../../Model/Component/ImportActionTable"; import { DragableBodyRow, DatatypeInput } from "../../../Model/Component/ImportActionTable";
import { dispatch } from "../../../../../model"; import { dispatch } from "../../../../../model";
import { EditTemplateContext } from "./UpdateTemplateModal"; import { EditTemplateContext } from "./UpdateTemplateModal";
import { getAllFileds } from "../../../../../model/datamodel";
const InputDebounce = DebounceInput(300)(Input); const InputDebounce = DebounceInput(300)(Input);
...@@ -245,6 +244,7 @@ const UpdateField = (props) => { ...@@ -245,6 +244,7 @@ const UpdateField = (props) => {
getFileds(); getFileds();
} }
} }
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible, template]) }, [visible, template])
const columns = useMemo(() => { const columns = useMemo(() => {
...@@ -255,6 +255,7 @@ const UpdateField = (props) => { ...@@ -255,6 +255,7 @@ const UpdateField = (props) => {
} }
return newColumns; return newColumns;
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [editable, data, editingKey]); }, [editable, data, editingKey]);
useClickAway(() => { useClickAway(() => {
...@@ -495,6 +496,7 @@ const UpdateField = (props) => { ...@@ -495,6 +496,7 @@ const UpdateField = (props) => {
dataRef.current = newData; dataRef.current = newData;
onChange && onChange(newData); onChange && onChange(newData);
}, },
//eslint-disable-next-line react-hooks/exhaustive-deps
[data], [data],
); );
......
...@@ -23,6 +23,7 @@ export const UpdateTemplateModal = (props) => { ...@@ -23,6 +23,7 @@ export const UpdateTemplateModal = (props) => {
form?.setFieldsValue({name: template?.name||'', cnName: template?.cnName||'', comment: template?.comment||''}); form?.setFieldsValue({name: template?.name||'', cnName: template?.cnName||'', comment: template?.comment||''});
setFields([]); setFields([]);
} }
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible]) }, [visible])
const title = useMemo(() => { const title = useMemo(() => {
......
...@@ -61,6 +61,7 @@ const ManageTable = (props) => { ...@@ -61,6 +61,7 @@ const ManageTable = (props) => {
useEffect(() => { useEffect(() => {
setCheckedKeys([]); setCheckedKeys([]);
setPagination({...pagination, pageNum: 1}); setPagination({...pagination, pageNum: 1});
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [nodeId]) }, [nodeId])
useEffect(() => { useEffect(() => {
...@@ -71,6 +72,7 @@ const ManageTable = (props) => { ...@@ -71,6 +72,7 @@ const ManageTable = (props) => {
} else { } else {
getFiledsAndDatas(); getFiledsAndDatas();
} }
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [keyword, pagination]) }, [keyword, pagination])
const getFiledsAndDatas = () => { const getFiledsAndDatas = () => {
...@@ -123,12 +125,6 @@ const ManageTable = (props) => { ...@@ -123,12 +125,6 @@ const ManageTable = (props) => {
setIsDataMasterModalVisible(true); setIsDataMasterModalVisible(true);
} }
const onItemClick = (record) => {
setAction('detail');
setCurrentData(record);
setIsDataMasterModalVisible(true);
}
const onDataMasterModalCancel = (refresh = false) => { const onDataMasterModalCancel = (refresh = false) => {
setIsDataMasterModalVisible(false); setIsDataMasterModalVisible(false);
...@@ -193,7 +189,7 @@ const ManageTable = (props) => { ...@@ -193,7 +189,7 @@ const ManageTable = (props) => {
<Button onClick={onAddClick}>新建</Button> <Button onClick={onAddClick}>新建</Button>
</Space> </Space>
<Space> <Space>
<Tooltip title={(checkedKeys||[]).length===0?'请先选择模版':''}> <Tooltip title={(checkedKeys||[]).length===0?'请先选择主数据':''}>
<Button onClick={onBatchDeleteClick} disabled={(checkedKeys||[]).length===0} loading={deleteLoading}>删除</Button> <Button onClick={onBatchDeleteClick} disabled={(checkedKeys||[]).length===0} loading={deleteLoading}>删除</Button>
</Tooltip> </Tooltip>
</Space> </Space>
......
import {useEffect, useMemo, useState, useRef} from 'react'; import {useEffect, useMemo, useState, useRef} from 'react';
import {Tooltip, Spin, AutoComplete, Tree, Modal} from 'antd'; import {Tooltip, Spin, AutoComplete, Tree} from 'antd';
import {PlusOutlined, ReloadOutlined} from '@ant-design/icons'; import {ReloadOutlined} from '@ant-design/icons';
import { dispatch } from '../../../../../model'; import { dispatch } from '../../../../../model';
import {highlightSearchContentByTerms, showMessage} from '../../../../../util'; import {highlightSearchContentByTerms} from '../../../../../util';
import '../../Define/Component/DefineTree.less'; import '../../Define/Component/DefineTree.less';
...@@ -67,25 +67,6 @@ const ManageTree = (props) => { ...@@ -67,25 +67,6 @@ const ManageTree = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, [data]) }, [data])
const selectNode = useMemo(() => {
const generateList = (data, list) => {
(data||[]).forEach(node => {
list.push({...node});
if (node.children) {
generateList(node.children, list);
}
});
};
const newTreeList = [];
generateList(data, newTreeList);
const filterNodes = newTreeList.filter(item => selectedKeys.indexOf(item._id)!==-1);
return (filterNodes||[]).length>0 ? filterNodes[0]:{};
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [data, selectedKeys])
const getTreeNodes = () => { const getTreeNodes = () => {
setLoading(true); setLoading(true);
dispatch({ dispatch({
...@@ -130,7 +111,7 @@ const ManageTree = (props) => { ...@@ -130,7 +111,7 @@ const ManageTree = (props) => {
if (isModelNode(option.key)) { if (isModelNode(option.key)) {
onTreeSelect([option.key]); onTreeSelect([option.key]);
} }
setExpandedKeys(Array.from(new Set([...expandedKeys, option.key]))); setExpandedKeys(Array.from(new Set([...expandedKeys, option.key])));
setAutoExpandParent(true); setAutoExpandParent(true);
}; };
...@@ -159,14 +140,12 @@ const ManageTree = (props) => { ...@@ -159,14 +140,12 @@ const ManageTree = (props) => {
} }
const isModelNode = (value) => { const isModelNode = (value) => {
return ((value||[]).indexOf('Model=') !== -1); return ((value||'').indexOf('Model=') !== -1);
} }
const findFirstModelNode = (values) => { const findFirstModelNode = (values) => {
const generateList = (data, list) => { const generateList = (data, list) => {
(data||[]).forEach(node => { (data||[]).forEach(node => {
const {_id, name} = node;
list.push(node); list.push(node);
if (node.children) { if (node.children) {
generateList(node.children, list); generateList(node.children, list);
......
...@@ -30,6 +30,7 @@ const UpdateDataMasterModal = (props) => { ...@@ -30,6 +30,7 @@ const UpdateDataMasterModal = (props) => {
form?.setFieldsValue(newFieldsValue); form?.setFieldsValue(newFieldsValue);
} }
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible, data, fields]) }, [visible, data, fields])
const title = useMemo(() => { const title = useMemo(() => {
......
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