From a64658c5d91adba50240676eb8ffa6a24aa6caa4 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期二, 31 三月 2026 13:49:33 +0800
Subject: [PATCH] 跑库代码更新
---
zy-acs-flow/src/map/insight/code/CodeMain.jsx | 245 +++++++++++++++++++++++++++---------------------
1 files changed, 139 insertions(+), 106 deletions(-)
diff --git a/zy-acs-flow/src/map/insight/code/CodeMain.jsx b/zy-acs-flow/src/map/insight/code/CodeMain.jsx
index 6719584..b25ad7d 100644
--- a/zy-acs-flow/src/map/insight/code/CodeMain.jsx
+++ b/zy-acs-flow/src/map/insight/code/CodeMain.jsx
@@ -8,6 +8,7 @@
Grid,
Chip,
Button,
+ Divider,
Skeleton,
useTheme,
} from '@mui/material';
@@ -55,16 +56,14 @@
() => extractRelationItems(info, ['routeList', 'routes', 'routeRefs']),
[info]
);
- const funcStaBool = detectBoolean(
- info?.funcStaBool ?? info?.isFuncSta ?? info?.funcStation ?? info?.funcStaFlag
+ const funcStaRelations = useMemo(
+ () => extractRelationItems(info, ['funcStaList', 'funcStas']),
+ [info]
);
- const funcStaText = info?.funcSta$ || info?.funcStaName || info?.funcStaType || info?.funcStaCode || info?.funcStaUuid || info?.funcSta;
const ruleList = useMemo(() => normalizeDirRule(info?.dirRule), [info?.dirRule]);
const spatialItems = [
- { label: translate('table.field.code.x'), value: formatNumber(info?.x, 0), hideWhenEmpty: true },
- { label: translate('table.field.code.y'), value: formatNumber(info?.y, 0), hideWhenEmpty: true },
{
label: translate('page.map.insight.code.fields.mapPosition', { _: '鍦板浘鍧愭爣' }),
render: () => (
@@ -103,10 +102,6 @@
}
};
- const funcStaLabel = funcStaBool == null
- ? translate('common.enums.na')
- : translate(funcStaBool ? 'common.enums.true' : 'common.enums.false');
-
return (
<Box sx={{ pr: 1, pb: 3 }}>
<Grid container spacing={3} alignItems="flex-start">
@@ -139,18 +134,18 @@
/>
)}
<FieldGrid items={spatialItems} loading={loading} />
- <Button
- variant="contained"
- color="primary"
- startIcon={<OpenInNewIcon />}
- onClick={handleOpenDetail}
- disabled={!info?.id}
- sx={{ alignSelf: 'flex-start', textTransform: 'none', px: 3 }}
- >
- {translate('page.map.insight.code.actions.openDetail', { _: '杩涘叆 Code 椤甸潰' })}
- </Button>
</Stack>
</Paper>
+ <Button
+ variant="contained"
+ color="primary"
+ startIcon={<OpenInNewIcon />}
+ onClick={handleOpenDetail}
+ disabled={!info?.id}
+ sx={{ alignSelf: 'flex-start', textTransform: 'none', px: 3 }}
+ >
+ {translate('page.map.insight.code.actions.openDetail', { _: '缂栬緫' })}
+ </Button>
</Stack>
</Grid>
<Grid item xs={12} md={7}>
@@ -174,23 +169,16 @@
/>
</InfoPanel>
<InfoPanel title={translate('page.map.insight.code.relations.routes', { _: '鍏宠仈璺嚎' })}>
- <RelationsChips
+ <RelationsList
items={routeRelations}
emptyLabel={translate('page.map.insight.code.relations.empty', { _: '鏆傛棤鍏宠仈淇℃伅' })}
/>
</InfoPanel>
<InfoPanel title={translate('menu.funcSta', { _: '鍔熻兘绔�' })}>
- <Stack spacing={1}>
- <BooleanDisplay
- value={funcStaBool}
- label={funcStaLabel}
- />
- {funcStaText && funcStaText !== funcStaLabel && (
- <Typography variant="body2" color="text.secondary">
- {funcStaText}
- </Typography>
- )}
- </Stack>
+ <RelationsChips
+ items={funcStaRelations}
+ emptyLabel={translate('page.map.insight.code.relations.empty', { _: '鏆傛棤鍏宠仈淇℃伅' })}
+ />
</InfoPanel>
</Stack>
</Paper>
@@ -240,6 +228,43 @@
label={`+${items.length - MAX_RELATION_ITEMS}`}
size="small"
/>
+ )}
+ </Stack>
+ );
+};
+
+const RelationsList = ({ items, emptyLabel }) => {
+ if (!items?.length) {
+ return (
+ <Typography variant="body2" color="text.disabled">
+ {emptyLabel}
+ </Typography>
+ );
+ }
+
+ return (
+ <Stack spacing={1}>
+ {items.slice(0, MAX_RELATION_ITEMS).map((item, index) => (
+ <Box
+ key={`${getRelationKey(item)}-${index}`}
+ sx={{
+ px: 1.25,
+ py: 0.75,
+ borderRadius: 999,
+ border: '1px solid',
+ borderColor: 'divider',
+ backgroundColor: 'background.default',
+ }}
+ >
+ <Typography variant="body2" sx={{ lineHeight: 1.2 }}>
+ {getRelationLabel(item)}
+ </Typography>
+ </Box>
+ ))}
+ {items.length > MAX_RELATION_ITEMS && (
+ <Typography variant="caption" color="text.secondary">
+ +{items.length - MAX_RELATION_ITEMS}
+ </Typography>
)}
</Stack>
);
@@ -441,8 +466,9 @@
}
/>
</Box>
+ <Divider />
{loading ? (
- <Skeleton variant="rounded" height={220} />
+ <Skeleton variant="rounded" height={188} />
) : (
<DirectionRuleCompass rules={rules} translate={translate} />
)}
@@ -452,87 +478,88 @@
const DirectionRuleCompass = ({ rules, translate }) => {
const theme = useTheme();
const enabledCount = rules.filter(rule => rule.enabled).length;
- const placement = {
- 0: { gridColumn: 2, gridRow: 1 },
- 90: { gridColumn: 3, gridRow: 2 },
- 180: { gridColumn: 2, gridRow: 3 },
- 270: { gridColumn: 1, gridRow: 2 },
- };
+ const topRule = rules.find(rule => rule.angle === 0);
+ const rightRule = rules.find(rule => rule.angle === 90);
+ const bottomRule = rules.find(rule => rule.angle === 180);
+ const leftRule = rules.find(rule => rule.angle === 270);
+
+ return (
+ <Stack spacing={0.85} alignItems="center">
+ <DirectionRuleCard rule={topRule} translate={translate} />
+ <Stack direction="row" spacing={0.6} alignItems="center" justifyContent="center">
+ <DirectionRuleCard rule={leftRule} translate={translate} />
+ <Box
+ sx={{
+ width: 52,
+ height: 42,
+ borderRadius: 2.5,
+ border: '1px dashed',
+ borderColor: 'divider',
+ backgroundColor: alpha(theme.palette.primary.main, 0.04),
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ textAlign: 'center',
+ flexShrink: 0,
+ }}
+ >
+ <Typography variant="h5" sx={{ lineHeight: 1, fontWeight: 700, fontSize: '0.98rem' }}>
+ {enabledCount}/{rules.length}
+ </Typography>
+ </Box>
+ <DirectionRuleCard rule={rightRule} translate={translate} />
+ </Stack>
+ <DirectionRuleCard rule={bottomRule} translate={translate} />
+ </Stack>
+ );
+};
+
+const DirectionRuleCard = ({ rule, translate }) => {
+ const theme = useTheme();
+
+ if (!rule) {
+ return null;
+ }
+
+ const statusText = translate(
+ rule.enabled ? 'page.code.dirRule.status.enabled' : 'page.code.dirRule.status.disabled'
+ );
return (
<Box
sx={{
- display: 'grid',
- gridTemplateColumns: 'repeat(3, minmax(0, 1fr))',
- gridTemplateRows: 'repeat(3, minmax(58px, auto))',
- gap: 1,
- alignItems: 'stretch',
+ width: 68,
+ height: 42,
+ borderRadius: 2.5,
+ border: '1px solid',
+ borderColor: rule.enabled ? 'success.light' : 'error.light',
+ backgroundColor: rule.enabled
+ ? alpha(theme.palette.success.main, 0.08)
+ : alpha(theme.palette.error.main, 0.08),
+ px: 0.5,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ textAlign: 'center',
+ flexShrink: 0,
}}
>
- <Box
- sx={{
- gridColumn: 2,
- gridRow: 2,
- borderRadius: 3,
- border: '1px dashed',
- borderColor: 'divider',
- backgroundColor: alpha(theme.palette.primary.main, 0.04),
- px: 1,
- py: 0.75,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- textAlign: 'center',
- }}
- >
- <Typography variant="h6" sx={{ lineHeight: 1.1, fontWeight: 700 }}>
- {enabledCount}/{rules.length}
+ <Stack spacing={0.1}>
+ <Typography variant="subtitle2" sx={{ fontWeight: 700, lineHeight: 1, fontSize: '0.88rem' }}>
+ {rule.angle}掳
</Typography>
- </Box>
- {rules.map(rule => {
- const position = placement[rule.angle] || { gridColumn: 'auto', gridRow: 'auto' };
- const statusText = translate(
- rule.enabled ? 'page.code.dirRule.status.enabled' : 'page.code.dirRule.status.disabled'
- );
-
- return (
- <Box
- key={rule.angle}
- sx={{
- ...position,
- borderRadius: 3,
- border: '1px solid',
- borderColor: rule.enabled ? 'success.light' : 'error.light',
- backgroundColor: rule.enabled
- ? alpha(theme.palette.success.main, 0.08)
- : alpha(theme.palette.error.main, 0.08),
- px: 1,
- py: 0.75,
- minHeight: 60,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- textAlign: 'center',
- }}
- >
- <Stack spacing={0.35}>
- <Typography variant="subtitle2" sx={{ fontWeight: 700, lineHeight: 1 }}>
- {rule.angle}掳
- </Typography>
- <Typography
- variant="caption"
- sx={{
- lineHeight: 1.1,
- color: rule.enabled ? 'success.dark' : 'error.dark',
- fontWeight: 600,
- }}
- >
- {statusText}
- </Typography>
- </Stack>
- </Box>
- );
- })}
+ <Typography
+ variant="caption"
+ sx={{
+ lineHeight: 1.05,
+ fontSize: '0.64rem',
+ color: rule.enabled ? 'success.dark' : 'error.dark',
+ fontWeight: 600,
+ }}
+ >
+ {statusText}
+ </Typography>
+ </Stack>
</Box>
);
};
@@ -592,6 +619,12 @@
return item;
}
if (typeof item === 'object') {
+ if (item.startCode$ && item.endCode$) {
+ return `${item.startCode$} -> ${item.endCode$}`;
+ }
+ if (item.name || item.type || item.state) {
+ return [item.name, item.type, item.state].filter(Boolean).join(' / ');
+ }
return item.name || item.code || item.data || item.no || item.uuid || item.locNo || item.staNo || JSON.stringify(item);
}
return String(item);
--
Gitblit v1.9.1