|
|
@@ -17,7 +17,7 @@
|
|
|
clearable
|
|
|
@keyup.enter="locateDevice"
|
|
|
/>
|
|
|
- <el-button type="primary" @click="locateDevice">定位</el-button>
|
|
|
+ <el-button type="primary" :loading="locateLoading" @click="locateDevice">定位</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -178,7 +178,6 @@
|
|
|
size="720px"
|
|
|
append-to-body
|
|
|
direction="rtl"
|
|
|
- @opened="startProfileTimer"
|
|
|
@closed="onDrawerClosed"
|
|
|
>
|
|
|
<template #header>
|
|
|
@@ -203,7 +202,10 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="form-item">
|
|
|
- <span>采集记录(最近 50 条)</span>
|
|
|
+ <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
|
|
|
@@ -277,6 +279,7 @@ const alarms = ref([]);
|
|
|
const typeOptions = ref([]);
|
|
|
const locateKeyword = ref("");
|
|
|
const locateResults = ref([]);
|
|
|
+const locateLoading = ref(false);
|
|
|
|
|
|
const filters = reactive({
|
|
|
onlineStatus: undefined,
|
|
|
@@ -292,7 +295,6 @@ const profileOpen = ref(false);
|
|
|
const profileLoading = ref(false);
|
|
|
const profile = ref({ base: null, records: [], indicators: [], origCollTable: "", recordView: { columns: [], rows: [] } });
|
|
|
const currentProfileId = ref("");
|
|
|
-let profileTimer = null;
|
|
|
let refreshTimer = null;
|
|
|
|
|
|
const districtOptions = [
|
|
|
@@ -409,7 +411,6 @@ function pauseOtherAudios(e) {
|
|
|
});
|
|
|
}
|
|
|
function onDrawerClosed() {
|
|
|
- stopProfileTimer();
|
|
|
document.querySelectorAll("audio.rec-audio").forEach((el) => el.pause());
|
|
|
}
|
|
|
|
|
|
@@ -482,18 +483,26 @@ function loadProfile(id) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function locateDevice() {
|
|
|
+async function locateDevice() {
|
|
|
const kw = locateKeyword.value.trim();
|
|
|
if (!kw) {
|
|
|
locateResults.value = [];
|
|
|
return;
|
|
|
}
|
|
|
- const matched = equipmentList.value.filter(
|
|
|
- (d) => d.equipmentCode === kw || d.equipmentName?.includes(kw) || d.equipmentCode?.includes(kw)
|
|
|
- );
|
|
|
- locateResults.value = matched;
|
|
|
- if (matched.length === 1) {
|
|
|
- openProfile(matched[0]);
|
|
|
+ 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;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -511,15 +520,9 @@ function openProfile(d) {
|
|
|
loadProfile(d.equipmentId);
|
|
|
}
|
|
|
|
|
|
-function startProfileTimer() {
|
|
|
- stopProfileTimer();
|
|
|
- profileTimer = setInterval(() => {
|
|
|
- if (currentProfileId.value) loadProfile(currentProfileId.value);
|
|
|
- }, 3000);
|
|
|
-}
|
|
|
-function stopProfileTimer() {
|
|
|
- if (profileTimer) clearInterval(profileTimer);
|
|
|
- profileTimer = null;
|
|
|
+function refreshProfile() {
|
|
|
+ if (!currentProfileId.value) return;
|
|
|
+ loadProfile(currentProfileId.value);
|
|
|
}
|
|
|
|
|
|
function refreshAll() {
|
|
|
@@ -545,7 +548,6 @@ onMounted(() => {
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
if (refreshTimer) clearInterval(refreshTimer);
|
|
|
- stopProfileTimer();
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
@@ -806,6 +808,8 @@ onBeforeUnmount(() => {
|
|
|
.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;
|