|
@@ -9,7 +9,7 @@
|
|
|
<Select
|
|
|
@change="handleSensorChange"
|
|
|
:options="deviceTypeOption"
|
|
|
- :fieldNames="{ label: 'itemText', value: 'itemValue' }"
|
|
|
+ :fieldNames="{ label: 'label', value: 'value' }"
|
|
|
v-model:value="deviceKind"
|
|
|
style="width: 200px; margin-bottom: 5px; color: black"
|
|
|
placeholder="请选择设备类型"
|
|
@@ -101,7 +101,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import BarAndLine from '/@/components/chart/BarAndLine.vue';
|
|
|
import { Select } from 'ant-design-vue';
|
|
|
- import { onBeforeMount, ref, onMounted, onUnmounted, toRaw, reactive, nextTick } from 'vue';
|
|
|
+ import { onBeforeMount, ref, onMounted, onUnmounted, toRaw, reactive, nextTick, unref } from 'vue';
|
|
|
import MonitorTable from '../comment/MonitorTable.vue';
|
|
|
import HistoryTable from '../comment/HistoryTable.vue';
|
|
|
import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
|
|
@@ -111,6 +111,10 @@
|
|
|
import { cloneDeep } from 'lodash-es';
|
|
|
import { useMethods } from '/@/hooks/system/useMethods';
|
|
|
import { useGlobSetting } from '/@/hooks/setting';
|
|
|
+ import { useRouter } from 'vue-router';
|
|
|
+ import { getDictItemsByCode } from '/@/utils/dict';
|
|
|
+
|
|
|
+ const router = useRouter();
|
|
|
const { sysOrgCode } = useGlobSetting();
|
|
|
const { exportXlsPostBlob } = useMethods();
|
|
|
const SensorMonitorRef = ref();
|
|
@@ -289,10 +293,17 @@
|
|
|
});
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- const res = await deviceList({ devicetype: 'modelsensor' });
|
|
|
- const obj = res.find((item) => item.itemValue === 'modelsensor');
|
|
|
- deviceTypeOption.value = obj ? obj.children : [];
|
|
|
- deviceKind.value = deviceTypeOption.value[0]['itemValue'] || 'modelsensor_monitor';
|
|
|
+ let dictName = 'modelsensorkind';
|
|
|
+ const route = unref(router.currentRoute);
|
|
|
+ if (route.name) {
|
|
|
+ const nameStrList = route.name.split('-');
|
|
|
+ if (nameStrList.length > 0 && nameStrList[nameStrList.length - 1] !== 'sensorMonitor') {
|
|
|
+ dictName = nameStrList[nameStrList.length - 1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const res = getDictItemsByCode(dictName);
|
|
|
+ deviceTypeOption.value = res;
|
|
|
+ deviceKind.value = deviceTypeOption.value[0]['value'];
|
|
|
handleChange(deviceKind.value);
|
|
|
await getMonitor(true);
|
|
|
});
|