Commit 67d63047 by zhaochengxiang

解决卡顿问题

parent 0b2d0608
...@@ -148,7 +148,7 @@ const EditModel = (props) => { ...@@ -148,7 +148,7 @@ const EditModel = (props) => {
showMessage("success", '保存模型成功'); showMessage("success", '保存模型成功');
const _action = getQueryParam(Action, props.location.search); const _action = getQueryParam(Action, props.location.search);
setActionData({ ...actionData, ...{ action: (_action==='flow')?'flow':'detail', modelerId: data.id||'', stateId: data?.state?.id||'', permitCheckOut: data?.permitCheckOut||false, editable: data?.editable||false } }); setActionData({ ...actionData, ...{ action: (_action==='flow')?'flow':'detail', modelerId: data.id||'', stateId: data?.state?.id||'', permitCheckOut: data?.permitCheckOut||false, editable: data?.editable||false } });
LocalStorage.set('modelChange', !(LocalStorage.get('modelChange')||false)); LocalStorage.set('modelChange', !(LocalStorage.get('modelChange')||false));
} }
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Spin } from 'antd'; import { Spin } from 'antd';
import LocalStorage from 'local-storage'; import LocalStorage from 'local-storage';
...@@ -24,15 +24,31 @@ const ImportAction = (props) => { ...@@ -24,15 +24,31 @@ const ImportAction = (props) => {
const [ validateReports, setValidateReports ] = useState([]); const [ validateReports, setValidateReports ] = useState([]);
const [ loading, setLoading ] = useState(false); const [ loading, setLoading ] = useState(false);
const mountRef = useRef(true);
useEffect(() =>{ useEffect(() =>{
if ((action||'')==='') return; if ((action||'')==='') return;
if (!mountRef.current && action === 'edit' && !permitCheckOut) {
return;
}
mountRef.current = false;
//初始化form状态 //初始化form状态
if (action==='add'||action==='edit'||action==='flow') { if (action==='add'||action==='edit'||action==='flow') {
form.resetFields(); form.resetFields();
} }
if (action === 'detail'|| action ==='flow' || action === 'detail-version') {
//把数据表结构中的数据清空,解决性能问题
const newModelerData = { ...modelerData, easyDataModelerDataModelAttributes: [] };
onChange && onChange(newModelerData);
setModelerData(newModelerData);
}
setLoading(true); setLoading(true);
dispatch({ dispatch({
...@@ -124,7 +140,6 @@ const ImportAction = (props) => { ...@@ -124,7 +140,6 @@ const ImportAction = (props) => {
} }
const getCurrentDataModel = () => { const getCurrentDataModel = () => {
let type = 'datamodel.getDataModel'; let type = 'datamodel.getDataModel';
let params = { let params = {
...@@ -147,10 +162,11 @@ const ImportAction = (props) => { ...@@ -147,10 +162,11 @@ const ImportAction = (props) => {
type = 'datamodel.getCheckOutDataModel'; type = 'datamodel.getCheckOutDataModel';
} else if (action==='edit') { } else if (action==='edit') {
const _action = getQueryParam(Action, props.location.search); const _action = getQueryParam(Action, props.location.search);
if (_action === 'flow') { if (_action === 'flow') {
params.ignoreNamespace = true; params.ignoreNamespace = true;
} }
} }
dispatch({ dispatch({
type, type,
......
...@@ -292,6 +292,7 @@ const ImportActionTable = (props) => { ...@@ -292,6 +292,7 @@ const ImportActionTable = (props) => {
moveRowRef.current.pageSize = pageSize; moveRowRef.current.pageSize = pageSize;
if (filterData.length > supportMaxAttributeCountPerPage) { if (filterData.length > supportMaxAttributeCountPerPage) {
let _filterPageData = paginate(filterData, pageNum, pageSize); let _filterPageData = paginate(filterData, pageNum, pageSize);
if ((_filterPageData||[]).length===0 && pageNum > 1) { if ((_filterPageData||[]).length===0 && pageNum > 1) {
...@@ -315,7 +316,7 @@ const ImportActionTable = (props) => { ...@@ -315,7 +316,7 @@ const ImportActionTable = (props) => {
if (newFilterData.length > supportMaxAttributeCountPerPage) { if (newFilterData.length > supportMaxAttributeCountPerPage) {
const totalNum = (newFilterData.length/supportMaxAttributeCountPerPage) + ((newFilterData.length%supportMaxAttributeCountPerPage===0)?0:1); const totalNum = parseInt(newFilterData.length/supportMaxAttributeCountPerPage) + ((newFilterData.length%supportMaxAttributeCountPerPage===0)?0:1);
setFilterPageCondition({...filterPageCondition, ...{ filterData: newFilterData, pageNum: totalNum }}); setFilterPageCondition({...filterPageCondition, ...{ filterData: newFilterData, pageNum: totalNum }});
} else { } else {
......
...@@ -514,7 +514,7 @@ class Model extends React.Component { ...@@ -514,7 +514,7 @@ class Model extends React.Component {
} }
<Space> <Space>
<Input <Input
placeholder="请输入关键字" placeholder="通过模型名称全文搜索"
allowClear allowClear
value={keyword} value={keyword}
onChange={(e) => { this.onSearchInputChange(e); }} onChange={(e) => { this.onSearchInputChange(e); }}
......
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