| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840 |
- <!-- 感知信息实时展示(重写) -->
- <template>
- <div class="app-container perception-page">
- <div class="grid-main">
- <!-- ============ 左:设备状态总览 ============ -->
- <div class="card">
- <div class="card-head">
- <div class="card-title">
- 设备状态总览
- <span class="title-sub">按片区聚合 · 设备点阵</span>
- </div>
- <div class="row gap8 wrap">
- <el-input
- v-model="locateKeyword"
- placeholder="定位设备:编码 / 名称"
- style="width: 260px"
- clearable
- @keyup.enter="locateDevice"
- />
- <el-button type="primary" :loading="locateLoading" @click="locateDevice">定位</el-button>
- <el-button type="primary" plain size="small" :icon="Refresh" :loading="refreshing" @click="refreshAll">刷新</el-button>
- </div>
- </div>
- <div class="ov-toolbar">
- <span class="legend-inline">
- <span><i style="background:#16a34a"></i>在线</span>
- <span><i style="background:#cbd5e1"></i>离线</span>
- <span><i class="flash" style="background:#ef4444"></i>报警</span>
- </span>
- </div>
- <!-- 全域健康度带 -->
- <div class="health-band">
- <div class="hb-rate">
- <b :class="{ 'text-red': (stats.online ?? 0) < (stats.total ?? 1) * 0.6 }">{{ onlineRate }}%</b>
- <span>设备在线率</span>
- </div>
- <div class="hb-bar">
- <i class="on" :style="{ width: onlineRate + '%' }"></i>
- <i class="off" :style="{ width: offlineRate + '%' }"></i>
- <i class="al" :style="{ width: alarmRate + '%' }"></i>
- </div>
- <div class="hb-items">
- <div><b>{{ stats.total ?? 0 }}</b><span>总数(台)</span></div>
- <div><b class="text-green">{{ stats.online ?? 0 }}</b><span>在线(台)</span></div>
- <div><b class="text-gray">{{ stats.offline ?? 0 }}</b><span>离线(台)</span></div>
- <div><b class="text-red">{{ stats.alarm ?? 0 }}</b><span>报警(台)</span></div>
- </div>
- </div>
- <!-- 片区卡 + 点阵 -->
- <div class="area-grid">
- <div
- v-for="a in areaRank"
- :key="a.district"
- class="acard"
- :class="{ 'has-alarm': a.alarm > 0 }"
- >
- <div class="ac-head">
- <div class="ac-id">
- <div class="ac-name">{{ a.districtName }}</div>
- <div class="ac-sub">片区设备总览</div>
- </div>
- <div class="ac-rate">
- <b>{{ areaOnlineRate(a) }}%</b>
- <span>在线率</span>
- </div>
- </div>
- <div class="ac-bar">
- <i class="on" :style="{ width: areaOnlineRate(a) + '%' }"></i>
- <i class="off" :style="{ width: areaOfflineRate(a) + '%' }"></i>
- <i class="al" :style="{ width: areaAlarmRate(a) + '%' }"></i>
- </div>
- <div class="ac-metrics">
- <div><span>总数</span><b>{{ a.total }}</b></div>
- <div><span>在线</span><b class="text-green">{{ a.online }}</b></div>
- <div><span>离线</span><b class="text-gray">{{ a.offline }}</b></div>
- </div>
- <div class="dot-matrix">
- <div
- v-for="d in devicesByDistrict(a.district)"
- :key="d.equipmentId"
- class="dot"
- :class="dotClass(d)"
- :title="`${d.equipmentName}(${d.equipmentCode})`"
- @click="openProfile(d)"
- ></div>
- <span v-if="!devicesByDistrict(a.district).length" class="ac-tip">暂无设备</span>
- </div>
- </div>
- </div>
- <!-- 类型构成 -->
- <div class="type-dist">
- <div class="sr-head">设备类型构成</div>
- <div class="td-grid">
- <div v-for="t in typeDistribution" :key="t.name" class="td-row">
- <span class="td-name">{{ t.name }}</span>
- <div class="td-track"><i :style="{ width: t.rate + '%' }"></i></div>
- <span class="td-num">{{ t.count }} 台 · 在线 {{ t.online }}</span>
- </div>
- </div>
- </div>
- <!-- 定位结果 -->
- <div v-if="locateResults.length" class="search-result">
- <div class="sr-head">定位结果(回车或点击定位,可精确打开档案)</div>
- <div class="sr-list">
- <div
- v-for="d in locateResults"
- :key="d.equipmentId"
- class="sr-item"
- @click="openProfile(d)"
- >
- <span class="sr-dot" :class="dotClass(d)"></span>
- <span class="sr-name">{{ d.equipmentName }}</span>
- <span class="sr-meta">{{ d.equipmentTypeName || "未分类" }}</span>
- <span class="sr-code">{{ d.equipmentCode }}</span>
- </div>
- </div>
- </div>
- <el-empty v-if="!equipmentList.length" description="暂无可展示的感知设备" />
- </div>
- <!-- ============ 右:实时报警 / 片区健康排行 / 报警类型分布 ============ -->
- <div class="side-col">
- <div class="card alarm-card">
- <div class="card-head">
- <div class="card-title">实时报警 <span class="badge" :class="{ zero: !alarms.length }">{{ alarms.length }}</span></div>
- </div>
- <div class="alarm-list">
- <div v-for="a in alarms" :key="a.id" class="alarm-item">
- <div class="alarm-top">
- <span class="alarm-dev">{{ a.deviceName || a.deviceCode }}<span class="alarm-code">{{ a.deviceCode }}</span></span>
- <span class="alarm-level" :style="{ color: levelColor(a.alarmLevel) }">{{ levelName(a.alarmLevel) }}</span>
- </div>
- <div class="alarm-time">
- <span v-if="a.alarmNo" class="alarm-no">{{ a.alarmNo }}</span>
- <span>{{ a.createTime }}</span>
- </div>
- <div class="alarm-desc">{{ a.alarmContent || "—" }} <span v-if="a.actualValue != null">实测 {{ a.actualValue }}</span></div>
- </div>
- <el-empty v-if="!alarms.length" description="当前无未解除报警" :image-size="60" />
- </div>
- </div>
- <div class="card">
- <div class="card-head"><div class="card-title">报警类型分布</div></div>
- <div class="type-dist side">
- <div v-for="t in alarmTypeDist" :key="t.warningCode" class="td-row">
- <span class="td-name">{{ indicatorName(t, '监测指标') }}</span>
- <div class="td-track"><i :style="{ width: typeDistRate(t) + '%' }"></i></div>
- <span class="td-num">{{ t.count }} 条</span>
- </div>
- <el-empty v-if="!alarmTypeDist.length" description="暂无报警分布" :image-size="50" />
- </div>
- </div>
- <div class="card">
- <div class="card-head"><div class="card-title">片区健康排行</div></div>
- <div class="rank-list">
- <div v-for="(a, i) in areaRank" :key="a.district" class="rank-row" :class="{ top: i === 0 }">
- <span class="rank-no">{{ i + 1 }}</span>
- <span class="rank-name">{{ a.districtName }}</span>
- <div class="rank-track"><i :style="{ width: areaOnlineRate(a) + '%', background: '#16a34a' }"></i></div>
- <span class="rank-val">在线 {{ a.online }} / {{ a.total }}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- ============ 设备档案抽屉 ============ -->
- <el-drawer
- v-model="profileOpen"
- title="设备档案"
- size="720px"
- append-to-body
- direction="rtl"
- @closed="onDrawerClosed"
- >
- <template #header>
- <div class="drawer-title" v-if="profile.base">
- <span class="dt-name">{{ profile.base.equipmentName }}</span>
- <span class="tag" :class="profileTagClass(profile.base)">
- {{ statusText(profile.base) }}
- </span>
- </div>
- </template>
- <div v-loading="profileLoading">
- <template v-if="profile.base">
- <div class="ctl-dev">
- <div class="ctl-dev-grid">
- <div>设备编号:<b>{{ profile.base.equipmentCode }}</b></div>
- <div>设备类型:<b>{{ profile.base.equipmentTypeName || "—" }}</b></div>
- <div>所属片区:<b>{{ districtName(profile.base.district) }}</b></div>
- <div>安装位置:<b>{{ profile.base.equipmentLocation || "—" }}</b></div>
- <div class="full">最后通信:<b>{{ profile.lastCommTime || "—" }}</b></div>
- </div>
- </div>
- <div class="form-item">
- <div class="record-head">
- <span>采集记录(最近 50 条)</span>
- <el-button link type="primary" icon="Refresh" :loading="profileLoading" @click="refreshProfile">刷新</el-button>
- </div>
- <div class="hist-wrap">
- <el-table :data="pagedRecordRows" max-height="480" size="small">
- <el-table-column
- v-for="c in recordViewColumns"
- :key="c.key"
- :label="c.label + (c.unit ? '(' + c.unit + ')' : '')"
- :min-width="c.key === 'create_time' ? 168 : (c.key === 'filepath' ? 170 : 104)"
- >
- <template #default="{ row, $index }">
- <span v-if="c.key === 'create_time'">{{ row.createTime || '—' }}</span>
- <span v-else-if="c.key === 'filepath'" class="rec-audio-cell">
- <audio
- v-if="valueOf(row, c.key) && valueOf(row, c.key) !== '—'"
- class="rec-audio"
- controls
- preload="none"
- :src="buildMinioAttachmentUrl(valueOf(row, c.key))"
- @play="pauseOtherAudios"
- ></audio>
- <span v-else>—</span>
- </span>
- <span v-else :class="{ 'cell-alarm': alarmOf(row, c.key) }">{{ valueOf(row, c.key) }}</span>
- </template>
- </el-table-column>
- <template #empty>
- <div class="rec-empty">暂无采集记录</div>
- </template>
- </el-table>
- <el-pagination
- v-if="recordRows.length"
- class="rec-pager"
- layout="prev, pager, next"
- :total="recordRows.length"
- :page-size="recordPageSize"
- small
- v-model:current-page="recordPage"
- />
- </div>
- </div>
- <div class="drawer-actions">
- <el-button @click="profileOpen = false">关闭</el-button>
- </div>
- </template>
- <el-empty v-else description="未找到设备档案" />
- </div>
- </el-drawer>
- </div>
- </template>
- <script setup>
- import { computed, onMounted, reactive, ref } from "vue";
- import { Refresh } from "@element-plus/icons-vue";
- import { getEquipmentStatusStatistics, listEquipmentTypeAll } from "@/api/pipeNetwork/pdeviceInform";
- import {
- pagePerceptionEquipment,
- getEquipmentProfile,
- pageActiveAlarms,
- getAreaRank,
- getAlarmTypeDist
- } from "@/api/pipeNetwork/perception";
- import { buildMinioAttachmentUrl } from "@/utils/minioAttachment";
- import { indicatorName, loadIndicatorNames } from "@/utils/warningIndicator";
- const loading = ref(false);
- const refreshing = ref(false);
- const stats = ref({});
- const equipmentList = ref([]);
- const total = ref(0);
- const areaRank = ref([]);
- const alarmTypeDist = ref([]);
- const alarms = ref([]);
- const typeOptions = ref([]);
- const locateKeyword = ref("");
- const locateResults = ref([]);
- const locateLoading = ref(false);
- const filters = reactive({
- onlineStatus: undefined,
- district: undefined,
- equipmentTypeId: undefined
- });
- const queryParams = reactive({
- pageNum: 1,
- pageSize: 300
- });
- const profileOpen = ref(false);
- const profileLoading = ref(false);
- const profile = ref({ base: null, records: [], indicators: [], origCollTable: "", recordView: { columns: [], rows: [] } });
- const currentProfileId = ref("");
- const districtOptions = [
- { value: 0, label: "城南" },
- { value: 1, label: "城北" },
- { value: 2, label: "太常" }
- ];
- const onlineRate = computed(() => {
- const t = stats.value.total || 0;
- return t ? Math.round(((stats.value.online || 0) / t) * 100) : 0;
- });
- const offlineRate = computed(() => {
- const t = stats.value.total || 0;
- return t ? Math.round(((stats.value.offline || 0) / t) * 100) : 0;
- });
- const alarmRate = computed(() => {
- const t = stats.value.total || 0;
- return t ? Math.round(((stats.value.alarm || 0) / t) * 100) : 0;
- });
- const typeDistribution = computed(() => {
- const map = {};
- equipmentList.value.forEach((d) => {
- const name = d.equipmentTypeName || "未分类";
- if (!map[name]) map[name] = { count: 0, online: 0 };
- map[name].count += 1;
- if (d.onlineStatus === 1) map[name].online += 1;
- });
- const entries = Object.keys(map).map((name) => ({
- name,
- count: map[name].count,
- online: map[name].online
- }));
- // 按总台数降序排布
- entries.sort((a, b) => b.count - a.count);
- const max = Math.max(1, ...entries.map((e) => e.count));
- return entries.map((e) => ({ ...e, rate: Math.round((e.count / max) * 100) }));
- });
- const recordView = computed(() => profile.value.recordView || { columns: [], rows: [] });
- const recordViewColumns = computed(() => recordView.value.columns || []);
- const recordRows = computed(() => recordView.value.rows || []);
- // 采集记录分页(每页 10 条)
- const recordPage = ref(1);
- const recordPageSize = 10;
- const pagedRecordRows = computed(() => {
- const start = (recordPage.value - 1) * recordPageSize;
- return recordRows.value.slice(start, start + recordPageSize);
- });
- function districtName(district) {
- const found = districtOptions.find((d) => d.value === district);
- return found ? found.label : "—";
- }
- function isOnline(d) {
- return d.onlineStatus === 1;
- }
- function isAlarm(d) {
- return d.alarmStatus === 1;
- }
- function dotClass(d) {
- if (isAlarm(d)) return "al";
- return isOnline(d) ? "on" : "off";
- }
- function profileTagClass(base) {
- if (isAlarm(base)) return "tag-red";
- return isOnline(base) ? "tag-green" : "tag-gray";
- }
- function statusText(d) {
- if (isAlarm(d)) return "报警";
- return isOnline(d) ? "在线" : "离线";
- }
- function areaOnlineRate(a) {
- return a.total ? Math.round((a.online / a.total) * 100) : 0;
- }
- function areaOfflineRate(a) {
- return a.total ? Math.round((a.offline / a.total) * 100) : 0;
- }
- function areaAlarmRate(a) {
- return a.total ? Math.round((a.alarm / a.total) * 100) : 0;
- }
- function typeDistRate(t) {
- const max = Math.max(1, ...alarmTypeDist.value.map((x) => x.count || 0));
- return Math.round(((t.count || 0) / max) * 100);
- }
- function devicesByDistrict(district) {
- return equipmentList.value.filter((d) => d.district === district);
- }
- function valueOf(row, key) {
- const cells = row.cells || [];
- const c = cells.find((x) => x.key === key);
- if (!c) return "—";
- // 竖表(水质指标)展示串已含指标名与单位;宽表使用不含单位的纯值
- if (recordView.value.layout === "long") return c.display;
- return c.value && c.value !== "" ? c.value : c.display;
- }
- function alarmOf(row, key) {
- const cells = row.cells || [];
- const c = cells.find((x) => x.key === key);
- return c ? !!c.alarm : false;
- }
- // 采集记录音频:行内原生播放器,一次只播一条
- function pauseOtherAudios(e) {
- document.querySelectorAll("audio.rec-audio").forEach((el) => {
- if (el !== e.target) el.pause();
- });
- }
- function onDrawerClosed() {
- document.querySelectorAll("audio.rec-audio").forEach((el) => el.pause());
- }
- // 报警等级配色(与系统 alarm 模块保持一致:1红 2橙 3蓝 4绿)
- function levelColor(level) {
- return ({ 1: "#f56c6c", 2: "#e6a23c", 3: "#409eff", 4: "#67c23a" }[level] || "#909399");
- }
- // 报警等级字典名称(与 alarm_level 字典一致:一级/二级/三级/四级报警)
- function levelName(level) {
- return ({ 1: "一级报警", 2: "二级报警", 3: "三级报警", 4: "四级报警" }[level] || (level != null ? level + "级" : "—"));
- }
- function loadStatistics() {
- return getEquipmentStatusStatistics().then((res) => {
- stats.value = res.data || {};
- });
- }
- function loadEquipment() {
- loading.value = true;
- return pagePerceptionEquipment({
- pageNum: queryParams.pageNum,
- pageSize: queryParams.pageSize,
- equipmentCode: undefined,
- equipmentName: undefined,
- equipmentTypeId: filters.equipmentTypeId,
- rootTypeId: undefined,
- onlineStatus: filters.onlineStatus,
- alarmStatus: undefined,
- district: filters.district,
- currentStatus: undefined
- })
- .then((res) => {
- const page = res.data || {};
- equipmentList.value = page.records || [];
- total.value = page.total || 0;
- })
- .finally(() => {
- loading.value = false;
- });
- }
- function loadAreaRank() {
- return getAreaRank().then((res) => {
- areaRank.value = res.data || [];
- });
- }
- function loadAlarmTypeDist() {
- return getAlarmTypeDist().then((res) => {
- alarmTypeDist.value = res.data || [];
- });
- }
- function loadAlarms() {
- return pageActiveAlarms({ pageNum: 1, pageSize: 20 }).then((res) => {
- const page = res.data || {};
- alarms.value = page.records || [];
- });
- }
- function loadProfile(id) {
- profileLoading.value = true;
- return getEquipmentProfile(id)
- .then((res) => {
- profile.value = res.data || { base: null, records: [], indicators: [], origCollTable: "", recordView: { columns: [], rows: [] } };
- })
- .finally(() => {
- profileLoading.value = false;
- });
- }
- async function locateDevice() {
- const kw = locateKeyword.value.trim();
- if (!kw) {
- locateResults.value = [];
- return;
- }
- locateLoading.value = true;
- try {
- // 不再只在当前页 300 条里找,交给后端按编码/名称全局模糊匹配
- const res = await pagePerceptionEquipment({ pageNum: 1, pageSize: 20, keyword: kw });
- const rows = (res.data || {}).records || [];
- locateResults.value = rows;
- if (rows.length === 1) {
- openProfile(rows[0]);
- }
- } catch (e) {
- console.warn("设备定位失败", e);
- locateResults.value = [];
- } finally {
- locateLoading.value = false;
- }
- }
- function locateByCode(code) {
- locateKeyword.value = code || "";
- const matched = equipmentList.value.filter((d) => d.equipmentCode === code);
- locateResults.value = matched;
- if (matched.length) openProfile(matched[0]);
- }
- function openProfile(d) {
- currentProfileId.value = d.equipmentId;
- profileOpen.value = true;
- recordPage.value = 1;
- loadProfile(d.equipmentId);
- }
- function refreshProfile() {
- if (!currentProfileId.value) return;
- loadProfile(currentProfileId.value);
- }
- async function refreshAll() {
- refreshing.value = true;
- try {
- await Promise.allSettled([
- loadStatistics(),
- loadEquipment(),
- loadAreaRank(),
- loadAlarmTypeDist(),
- loadAlarms()
- ]);
- } finally {
- refreshing.value = false;
- }
- }
- function loadTypeOptions() {
- return listEquipmentTypeAll().then((res) => {
- typeOptions.value = res.data || [];
- });
- }
- onMounted(() => {
- loadIndicatorNames();
- loadTypeOptions();
- refreshAll();
- });
- </script>
- <style scoped>
- .perception-page {
- background: #f0f3f8;
- /* 84 = 顶部导航 50 + 标签栏 34,与 AppMain 的 .hasTagsView .app-main 高度一致,
- 使整页恰好占满内容区、不产生页面级滚动条,溢出由各内部区域消化 */
- height: calc(100vh - 84px);
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
- /* 顶部 KPI(与设备统计页一致) */
- .kpi-row {
- display: flex;
- gap: 16px;
- margin-bottom: 20px;
- }
- .kpi {
- flex: 1 1 0;
- min-width: 0;
- border-radius: 12px;
- }
- .kpi :deep(.el-card__body) {
- display: flex;
- align-items: center;
- gap: 16px;
- padding: 20px;
- }
- .kpi-icon {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 44px;
- height: 44px;
- flex: 0 0 44px;
- border-radius: 10px;
- font-size: 22px;
- }
- .kpi-icon.total { background: #edf3fc; color: #014db2; }
- .kpi-icon.online { background: #e7f8f1; color: #10b981; }
- .kpi-icon.offline { background: #fef4e2; color: #f59e0b; }
- .kpi-icon.alarm { background: #fdecec; color: #ef4444; }
- .kpi-label { font-size: 13px; font-weight: 400; color: #6b7280; }
- .kpi-value { margin-top: 6px; font-size: 28px; font-weight: 700; line-height: 1; color: #0a1628; }
- /* 主区 + 侧栏 */
- .grid-main {
- display: grid;
- grid-template-columns: minmax(0, 1fr) 380px;
- gap: 16px;
- align-items: stretch;
- flex: 1;
- min-height: 0;
- overflow: hidden;
- }
- /* 左侧主卡片内部滚动,避免页面级滚动条 */
- .grid-main > .card {
- min-height: 0;
- overflow-y: auto;
- }
- .grid-main > .card > .card-head {
- position: sticky;
- top: 0;
- background: #fff;
- z-index: 1;
- }
- .card {
- background: #fff;
- border: 1px solid #e3e9f2;
- border-radius: 10px;
- box-shadow: 0 2px 8px rgba(15, 34, 67, 0.06);
- margin-bottom: 16px;
- }
- .card-head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 10px;
- padding: 14px 16px;
- border-bottom: 1px solid #eef2f7;
- flex-wrap: wrap;
- }
- .card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
- .card-title:before { content: ""; width: 3px; height: 15px; border-radius: 2px; background: #1677ff; }
- .title-sub { font-size: 12px; color: #97a3b7; font-weight: 400; }
- .row { display: flex; align-items: center; }
- .row.gap8 { gap: 8px; }
- .wrap { flex-wrap: wrap; }
- .ov-toolbar {
- display: flex;
- align-items: center;
- gap: 10px;
- padding: 10px 16px;
- border-bottom: 1px solid #eef2f7;
- background: #fbfdff;
- font-size: 12px;
- color: #97a3b7;
- flex-wrap: wrap;
- }
- .legend-inline { display: flex; align-items: center; gap: 13px; font-size: 12px; color: #5e6d82; }
- .legend-inline i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
- .legend-inline i.flash { animation: dotFlash 0.9s steps(1, end) infinite; }
- .sp { flex: 1; }
- .ov-stat { color: #5e6d82; }
- /* 健康带 */
- .health-band { display: flex; align-items: center; gap: 28px; padding: 22px 24px; border-bottom: 1px solid #eef2f7; background: linear-gradient(180deg, #fbfdff 0%, #fff 100%); flex-wrap: wrap; }
- .hb-rate { display: flex; flex-direction: column; gap: 4px; flex: none; min-width: 150px; }
- .hb-rate b { font-size: 44px; font-weight: 700; color: #16a34a; font-variant-numeric: tabular-nums; line-height: 1; }
- .hb-rate span { font-size: 12px; color: #97a3b7; }
- .hb-bar { flex: 1; min-width: 240px; height: 16px; border-radius: 8px; overflow: hidden; background: #eef2f7; display: flex; }
- .hb-bar i { display: block; height: 100%; transition: width 0.4s; }
- .hb-bar i.on { background: #16a34a; }
- .hb-bar i.off { background: #94a3b8; }
- .hb-bar i.al { background: #ef4444; }
- .hb-items { display: flex; gap: 32px; font-size: 12px; color: #5e6d82; flex: none; }
- .hb-items div { display: flex; flex-direction: column; gap: 3px; }
- .hb-items b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
- .text-green { color: #16a34a; }
- .text-gray { color: #64748b; }
- .text-red { color: #ef4444; }
- /* 片区卡 */
- .area-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 20px; }
- .acard { border: 1px solid #e3e9f2; border-radius: 14px; background: #fff; overflow: hidden; transition: 0.18s; display: flex; flex-direction: column; }
- .acard:hover { border-color: #1677ff; box-shadow: 0 10px 30px rgba(22, 119, 255, 0.14); transform: translateY(-2px); }
- .acard.has-alarm { border-color: #fca5a5; background: linear-gradient(180deg, #fffafa 0%, #fff 42%); }
- .ac-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 14px; }
- .ac-name { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; line-height: 1.2; }
- .ac-sub { font-size: 12px; color: #97a3b7; }
- .ac-rate { text-align: right; flex: none; line-height: 1.1; }
- .ac-rate b { display: block; font-size: 30px; font-weight: 700; color: #16a34a; font-variant-numeric: tabular-nums; }
- .ac-rate span { font-size: 11px; color: #97a3b7; }
- .ac-bar { display: flex; height: 7px; background: #eef2f7; overflow: hidden; margin: 0 20px 16px; border-radius: 4px; }
- .ac-bar i { display: block; height: 100%; transition: width 0.4s; }
- .ac-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: #eef2f7; margin: 0 20px 16px; border: 1px solid #eef2f7; border-radius: 10px; overflow: hidden; }
- .ac-metrics div { background: #fff; padding: 11px 6px; text-align: center; }
- .ac-metrics span { display: block; font-size: 11px; color: #97a3b7; margin-bottom: 3px; }
- .ac-metrics b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
- .dot-matrix { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 20px 18px; align-content: flex-start; flex: 1; }
- .dot { width: 11px; height: 11px; border-radius: 3px; background: #16a34a; cursor: pointer; transition: transform 0.1s; }
- .dot.off { background: #cbd5e1; }
- .dot.al { background: #ef4444; animation: dotFlash 0.9s steps(1, end) infinite; }
- .dot:hover { transform: scale(1.55); box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.16); position: relative; z-index: 2; }
- .ac-tip { font-size: 11px; color: #1677ff; padding: 4px; }
- /* 类型构成 */
- .type-dist { padding: 4px 20px 20px; }
- .td-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 28px; }
- .td-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
- .td-name { width: 150px; color: #5e6d82; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
- .td-track { flex: 1; height: 16px; border-radius: 5px; background: #f1f5f9; display: flex; overflow: hidden; min-width: 120px; }
- .td-track i { display: block; height: 100%; background: #1677ff; }
- .td-num { width: 104px; text-align: right; color: #97a3b7; flex: none; font-variant-numeric: tabular-nums; font-size: 12px; }
- .type-dist.side { padding: 4px 18px 18px; }
- .type-dist.side .td-grid { grid-template-columns: 1fr; }
- .type-dist.side .td-name { width: 160px; }
- /* 定位结果 */
- .search-result { padding: 0 16px 16px; }
- .sr-head { font-size: 13px; font-weight: 600; margin-bottom: 9px; display: flex; align-items: center; gap: 7px; }
- .sr-head:before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: #1677ff; }
- .sr-list { display: flex; flex-wrap: wrap; gap: 8px; }
- .sr-item { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #e3e9f2; border-radius: 8px; padding: 6px 11px; background: #fff; cursor: pointer; font-size: 12px; transition: 0.15s; max-width: 340px; }
- .sr-item:hover { border-color: #1677ff; background: #f4f9ff; }
- .sr-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
- .sr-meta { color: #97a3b7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
- .sr-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: #1677ff; background: #eef5ff; border: 1px solid #d6e6ff; border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
- .sr-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
- .sr-dot.on { background: #16a34a; }
- .sr-dot.off { background: #cbd5e1; }
- .sr-dot.al { background: #ef4444; }
- /* 侧栏 */
- .side-col { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow: hidden; }
- .alarm-card { display: flex; flex-direction: column; flex: 1; min-height: 200px; }
- .alarm-list { overflow-y: auto; flex: 1; }
- .badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #ef4444; color: #fff; font-size: 12px; align-items: center; justify-content: center; font-weight: 600; }
- .badge.zero { background: #cbd5e1; }
- .alarm-item { padding: 11px 16px; border-bottom: 1px solid #eef2f7; border-left: 3px solid #ef4444; }
- .alarm-item:hover { background: #f8fbff; }
- .alarm-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
- .alarm-time { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: #97a3b7; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
- .alarm-no { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #8a96a8; white-space: nowrap; }
- .alarm-dev { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; min-width: 0; }
- .alarm-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; font-weight: 600; color: #5e6d82; background: #f1f5f9; border: 1px solid #e3e9f2; border-radius: 4px; padding: 1px 5px; margin-left: 6px; flex: none; white-space: nowrap; }
- .alarm-level { font-size: 12px; font-weight: 600; flex: none; }
- .alarm-desc { font-size: 12px; color: #5e6d82; line-height: 1.6; margin: 2px 0 6px; }
- .rank-list { padding: 6px 18px 16px; }
- .rank-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
- .rank-row:last-child { border-bottom: none; }
- .rank-no { width: 22px; height: 22px; border-radius: 6px; background: #eef2f7; color: #97a3b7; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
- .rank-row.top .rank-no { background: #1677ff; color: #fff; }
- .rank-name { font-weight: 600; width: 58px; flex: none; }
- .rank-track { flex: 1; height: 9px; border-radius: 5px; background: #eef2f7; overflow: hidden; display: flex; }
- .rank-track i { display: block; height: 100%; }
- .rank-val { width: 110px; text-align: right; color: #97a3b7; font-size: 12px; flex: none; font-variant-numeric: tabular-nums; }
- /* 抽屉 */
- .drawer-title { display: flex; align-items: center; gap: 10px; }
- .dt-name { font-weight: 700; }
- .tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
- .tag-green { background: #dcfce7; color: #16a34a; }
- .tag-gray { background: #f1f5f9; color: #64748b; }
- .tag-red { background: #fee2e2; color: #ef4444; }
- .hist-wrap { overflow: auto; border-radius: 8px; background: #fff; }
- .cell-alarm { color: #ef4444; font-weight: 600; }
- /* 采集记录表格边框与基本信息 .ctl-dev 一致(1px #e3e9f2 / 圆角 8px),仅保留淡行线,不画竖线 */
- .hist-wrap :deep(.el-table) { font-size: 12px; border: 1px solid #e3e9f2; border-radius: 8px; }
- .hist-wrap :deep(.el-table th.el-table__cell) {
- background: #f7f9fc;
- color: #5e6d82;
- font-weight: 600;
- }
- .hist-wrap :deep(.el-table td.el-table__cell) { padding: 6px 0; border-bottom: 1px solid #eef2f7; }
- .hist-wrap :deep(.el-table .cell) { padding: 0 10px; line-height: 1.5; }
- .hist-wrap :deep(.el-table td.el-table__cell .cell) { white-space: nowrap; }
- .hist-wrap :deep(.el-table__header th.el-table__cell) { border-bottom: 1px solid #e3e9f2; }
- /* 去掉 el-table 自带底部/右侧伪元素线(含新版 inner-wrapper 上的),避免与外框叠加变粗;末行行线交给外框封底 */
- .hist-wrap :deep(.el-table::before),
- .hist-wrap :deep(.el-table::after),
- .hist-wrap :deep(.el-table__inner-wrapper::before),
- .hist-wrap :deep(.el-table__inner-wrapper::after) { display: none; }
- .hist-wrap :deep(.el-table .el-table__row:last-child td.el-table__cell) { border-bottom: none; }
- .rec-empty { color: #9aa7b8; font-size: 12px; padding: 28px 0; }
- .rec-audio-cell { display: flex; align-items: center; overflow: hidden; }
- .rec-audio { width: 150px; max-width: 100%; height: 26px; vertical-align: middle; }
- .rec-pager { margin-top: 10px; justify-content: flex-end; }
- @keyframes pulse {
- 0%, 100% { transform: scale(1); }
- 50% { transform: scale(1.08); }
- }
- @keyframes dotFlash {
- 0%, 50% { opacity: 1; }
- 51%, 100% { opacity: 0.25; }
- }
- @media (max-width: 1280px) {
- .grid-main { grid-template-columns: 1fr; }
- .kpi { flex: 1 1 45%; }
- .area-grid { grid-template-columns: 1fr; }
- .td-grid { grid-template-columns: 1fr; }
- }
- @media (max-width: 768px) {
- .kpi { flex: 1 1 100%; }
- }
- /* 设备档案抽屉(严格参考原型 view-monitor) */
- .ctl-dev { background: #f8fafc; border: 1px solid #e3e9f2; border-radius: 8px; padding: 14px; margin-bottom: 16px; }
- .ctl-dev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 12px; color: #5e6d82; }
- .ctl-dev-grid .full { grid-column: 1 / -1; }
- .ctl-dev-grid b { color: #0a1628; font-weight: 500; }
- .form-item { display: block; margin-bottom: 14px; }
- .form-item > span { display: block; font-size: 13px; color: #5e6d82; margin-bottom: 6px; font-weight: 500; }
- .record-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
- .record-head > span { font-size: 13px; color: #5e6d82; font-weight: 500; }
- .drawer-actions { display: flex; gap: 10px; margin-top: 20px; }
- .drawer-actions :deep(.el-button) {
- flex: 1;
- height: 36px;
- padding: 0 14px;
- border-radius: 6px;
- border: 1px solid #e3e9f2;
- background: #fff;
- color: #0a1628;
- font-size: 13px;
- }
- .drawer-actions :deep(.el-button:hover) {
- border-color: #1677ff;
- color: #1677ff;
- background: #fff;
- }
- :deep(.el-drawer__header) {
- margin-bottom: 0;
- padding: 10px 20px;
- border-bottom: 1px solid #e3e9f2;
- color: #0a1628;
- }
- :deep(.el-drawer__body) { padding: 10px 20px 20px; }
- </style>
|