From baa73d35c4fe932515e7332ae4ff18481d8963e9 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Sat, 17 Jan 2026 16:36:58 +0800
Subject: [PATCH] feat:数据驾驶仓,右侧面板,历史数据弹窗中搜索栏调整
---
applications/drone-command/src/views/dataCockpit/components/DeviceHistoryDialog.vue | 67 ++++++++++++++++++++-------------
1 files changed, 41 insertions(+), 26 deletions(-)
diff --git a/applications/drone-command/src/views/dataCockpit/components/DeviceHistoryDialog.vue b/applications/drone-command/src/views/dataCockpit/components/DeviceHistoryDialog.vue
index a266041..9df9a8b 100644
--- a/applications/drone-command/src/views/dataCockpit/components/DeviceHistoryDialog.vue
+++ b/applications/drone-command/src/views/dataCockpit/components/DeviceHistoryDialog.vue
@@ -16,15 +16,14 @@
<el-form-item label="区域" prop="area">
<el-tree-select class="command-data-cockpit-select" popper-class="command-data-cockpit-tree-select-popper"
- v-model="searchParams.area" :data="areaTree" :props="areaTreeProps" node-key="value" check-strictly
- clearable placeholder="请选择" @change="handleSearch" />
+ v-model="searchParams.area" :data="areaTree" :props="areaTreeProps" node-key="value" check-strictly filterable :filter-node-method="filterAreaNode" clearable placeholder="请选择" @change="handleSearch" />
</el-form-item>
<el-form-item label="无人机类型" prop="droneType">
<el-select class="command-data-cockpit-select" popper-class="command-data-cockpit-select-popper"
v-model="searchParams.droneType" placeholder="请选择" clearable @change="handleSearch">
- <el-option v-for="item in droneTypeOptions" :key="item.value" :label="item.label"
- :value="item.value" />
+ <el-option v-for="item in dictObj.droneType" :key="item.dictKey" :label="item.dictValue"
+ :value="item.dictKey" />
</el-select>
</el-form-item>
@@ -74,7 +73,9 @@
<script setup>
import { Search, RefreshRight } from '@element-plus/icons-vue'
import { computed, ref, watch } from 'vue'
-import { alarmLogApi } from '@/api/dataCockpit'
+import { getDictionaryByCode } from '@/api/system/dictbiz'
+import { alarmLogApi, areaDivideListApi } from '@/api/dataCockpit'
+import { getDictLabel } from '@ztzf/utils'
const props = defineProps({
modelValue: {
@@ -111,29 +112,41 @@
const loading = ref(true)
const list = ref([])
const total = ref(0)
-const areaTree = ref([
- {
- label: '古村区',
- value: '古村区'
- },
- {
- label: '新区',
- value: '新区'
- },
- {
- label: '产业园',
- value: '产业园'
- }
-])
+const dictObj = ref({
+ droneType: []
+})
+const areaTree = ref([])
const areaTreeProps = {
label: 'label',
children: 'children'
}
-const droneTypeOptions = [
- { label: '微型机', value: '1' },
- { label: '植保机', value: '2' }
-]
+
+const fetchDictList = async () => {
+ const res = await getDictionaryByCode('droneType')
+ dictObj.value = res?.data?.data ?? { droneType: [] }
+}
+
+
+const filterAreaNode = (value, data) => {
+ if (!value) return true
+ return (data?.label || '').includes(value)
+}
+
+const fetchAreaTree = async () => {
+ try {
+ const res = await areaDivideListApi()
+ const list = res?.data?.data ?? []
+ areaTree.value = list
+ .filter((item) => item?.areaName)
+ .map((item) => ({
+ label: item.areaName,
+ value: item.areaName
+ }))
+ } catch (error) {
+ areaTree.value = []
+ }
+}
const getList = async () => {
if (!props.device?.id) {
@@ -188,9 +201,7 @@
}
const getDroneTypeText = (value) => {
- if (value === 1 || value === '1') return '微型机'
- if (value === 2 || value === '2') return '植保机'
- return value || '-'
+ return getDictLabel(value, dictObj.value.droneType) || value || '-'
}
watch(
@@ -198,7 +209,11 @@
(visible) => {
if (visible) {
searchParams.value.current = 1
+ fetchDictList()
+ fetchAreaTree()
getList()
+ } else {
+ searchParams.value = initSearchParams()
}
}
)
--
Gitblit v1.9.3