Commit e097918d by zhaochengxiang

模型基线变更提醒

parent dcdbd6f2
...@@ -632,6 +632,10 @@ export function* joinBranch(payload) { ...@@ -632,6 +632,10 @@ export function* joinBranch(payload) {
return yield call(datamodelerService.joinBranch, payload) return yield call(datamodelerService.joinBranch, payload)
} }
export function* behindAlarmInBranch(payload) {
return yield call(datamodelerService.behindAlarmInBranch, payload)
}
export function* getCooperationUsers() { export function* getCooperationUsers() {
return yield call(datamodelerService.getCooperationUsers) return yield call(datamodelerService.getCooperationUsers)
} }
......
...@@ -579,6 +579,10 @@ export function joinBranch(payload) { ...@@ -579,6 +579,10 @@ export function joinBranch(payload) {
return GetJSON("/datamodeler/easyDataModelerBranching/joinEasyDataModelerDataModel", payload) return GetJSON("/datamodeler/easyDataModelerBranching/joinEasyDataModelerDataModel", payload)
} }
export function behindAlarmInBranch(payload) {
return GetJSON("/datamodeler/easyDataModelerBranching/easyDataModelerDataModelBehindAlarmInBranch", payload)
}
/*approval*/ /*approval*/
export function getApprovalUsers(payload) { export function getApprovalUsers(payload) {
return GetJSON("/baseservice/sync/getUserByUserName", payload) return GetJSON("/baseservice/sync/getUserByUserName", payload)
......
import React, { useState, useEffect, useRef, useMemo } from "react"; import React, { useState, useEffect, useRef, useMemo } from "react";
import { Tooltip, Modal, Table, Typography } from 'antd'; import { Tooltip, Modal, Table, Typography, Button, Space} from 'antd';
import LocalStorage from 'local-storage'; import LocalStorage from 'local-storage';
import { ExclamationCircleFilled } from '@ant-design/icons';
import DataGrid, { defaultPageSize } from '../../VirtualTable'; import DataGrid, { defaultPageSize } from '../../VirtualTable';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
...@@ -142,6 +143,7 @@ const ModelTable = (props) => { ...@@ -142,6 +143,7 @@ const ModelTable = (props) => {
const [ currentItem, setCurrentItem ] = useState(null); const [ currentItem, setCurrentItem ] = useState(null);
const [ scrollRowIndex, setScrollRowIndex ] = useState(); const [ scrollRowIndex, setScrollRowIndex ] = useState();
const [resoureTagMap, setResourceTagMap] = useState(); const [resoureTagMap, setResourceTagMap] = useState();
const [behindAlramData, setBehindAlarmData] = useState();
const expandedDataMapRef = useRef(new Map()); const expandedDataMapRef = useRef(new Map());
const shouldScrollRef = useRef(false); const shouldScrollRef = useRef(false);
...@@ -173,7 +175,16 @@ const ModelTable = (props) => { ...@@ -173,7 +175,16 @@ const ModelTable = (props) => {
sortable: true, sortable: true,
resizable: true, resizable: true,
formatter(props) { formatter(props) {
return (<ModelNameColumn text={props.row.name} record={props.row} detailItem={detailItem} />); return (
<div className='flex' style={{ alignItems: 'center' }}>
{
view === 'branch' && (behindAlramData??[]).indexOf(props.row.id)!== -1 && <Tooltip title='基线模型有变更'>
<Button size='small' type='text' icon={<ExclamationCircleFilled className='pointer' style={{ fontSize: 18, color: '#E94848' }} />} />
</Tooltip>
}
<ModelNameColumn text={props.row.name} record={props.row} detailItem={detailItem} />
</div>
);
} }
}, },
{ {
...@@ -297,7 +308,7 @@ const ModelTable = (props) => { ...@@ -297,7 +308,7 @@ const ModelTable = (props) => {
return newCols; return newCols;
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, [visibleColNames, resoureTagMap, view]) }, [visibleColNames, resoureTagMap, view, behindAlramData])
const summarySelectedCount = useMemo(() => { const summarySelectedCount = useMemo(() => {
let newSelectedRowKeys = Array.from(new Set([...selectedRowKeys, ...expandedSelectedRowKeys])); let newSelectedRowKeys = Array.from(new Set([...selectedRowKeys, ...expandedSelectedRowKeys]));
...@@ -367,6 +378,22 @@ const ModelTable = (props) => { ...@@ -367,6 +378,22 @@ const ModelTable = (props) => {
}, [anchorTimestamp]) }, [anchorTimestamp])
useEffect(() => { useEffect(() => {
if (view === 'branch' && catalogId) {
getBehindAlarmInBranch();
const interval = setInterval(() => {
getBehindAlarmInBranch();
}, 60*1000);
return () => {
clearInterval(interval);
}
} else {
setBehindAlarmData()
}
}, [view, catalogId])
useEffect(() => {
if (shouldScrollRef.current && gridRef.current && offset!==null && (data||[]).length>0) { if (shouldScrollRef.current && gridRef.current && offset!==null && (data||[]).length>0) {
setScrollRowIndex(offset); setScrollRowIndex(offset);
setTimeout(() => { setTimeout(() => {
...@@ -399,6 +426,18 @@ const ModelTable = (props) => { ...@@ -399,6 +426,18 @@ const ModelTable = (props) => {
} }
}, [data, tagSelectOptions, resoureTagMap]) }, [data, tagSelectOptions, resoureTagMap])
const getBehindAlarmInBranch = () => {
dispatch({
type: 'datamodel.behindAlarmInBranch',
payload: {
id: catalogId,
},
callback: (data) => {
setBehindAlarmData(data)
}
})
}
const getResourceTag = () => { const getResourceTag = () => {
const ids = (data??[]).map(item => item.id); const ids = (data??[]).map(item => item.id);
if (ids.length > 0) { if (ids.length > 0) {
......
...@@ -215,7 +215,7 @@ class Model extends React.Component { ...@@ -215,7 +215,7 @@ class Model extends React.Component {
} }
onViewChange = (value) => { onViewChange = (value) => {
this.setState({ currentView: value }); this.setState({ currentView: value, catalogId: '' });
} }
onModelStateChange = (value) => { onModelStateChange = (value) => {
......
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