sanguu516 2 months ago
parent
commit
fc218756dd
  1. 10
      src/containers/flight/OperationApprovalsContainer.js
  2. 25
      src/containers/rightMenuContainer.js

10
src/containers/flight/OperationApprovalsContainer.js

@ -122,6 +122,16 @@ export default function OperationApprovalsContainer({ mode }) {
.find(feature => feature.source === 'operationLayer');
if (features) {
if (popupRef.current) {
popupRef.current.postMessage({
type: 'matchingRow',
payload: {
selected: features.properties.key,
targetValue: features.properties.key
}
});
return;
}
setSelected([features.properties.key]);
const targetValue = features.properties.key;

25
src/containers/rightMenuContainer.js

@ -45,16 +45,33 @@ function RightMenuContainer() {
setEndDate(payload.endDate);
return;
// case 'handlerSearchRs':
// console.log(payload.filter);
// setFilter(payload.filter);
case 'matchingRow':
handlerMatchingRow(payload.selected, payload.targetValue);
// return;
return;
default:
break;
}
};
const handlerMatchingRow = (selected, targetValue) => {
setSelected([selected]);
const rows = document.getElementsByClassName('ant-table-row');
const matchingRow = Array.from(rows).find(row => {
const rowKey = row.getAttribute('data-row-key');
return rowKey.startsWith(targetValue);
});
if (matchingRow) {
matchingRow.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'nearest'
});
}
};
const handlerOpnerPostMessage = (type, payload) => {
switch (type) {
case 'initalState':

Loading…
Cancel
Save