|
@@ -32,123 +32,123 @@
|
|
|
</Transition>
|
|
</Transition>
|
|
|
</template>
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-import Header from './header.vue';
|
|
|
|
|
-import Content from '../../components/content.vue';
|
|
|
|
|
-import { computed, ref, watch } from 'vue';
|
|
|
|
|
-import ventBox1 from './ventBoxBelt.vue';
|
|
|
|
|
-import { openWindow } from '/@/utils';
|
|
|
|
|
-import { getFormattedText } from '../../hooks/helper';
|
|
|
|
|
-import { useInitModule } from '../../hooks/useInit';
|
|
|
|
|
|
|
+ import Header from './Header.vue';
|
|
|
|
|
+ import Content from '../../components/content.vue';
|
|
|
|
|
+ import { computed, ref, watch } from 'vue';
|
|
|
|
|
+ import ventBox1 from './ventBoxBelt.vue';
|
|
|
|
|
+ import { openWindow } from '/@/utils';
|
|
|
|
|
+ import { getFormattedText } from '../../hooks/helper';
|
|
|
|
|
+ import { useInitModule } from '../../hooks/useInit';
|
|
|
|
|
|
|
|
-const props = defineProps<{
|
|
|
|
|
- pageType: string;
|
|
|
|
|
- moduleData: any;
|
|
|
|
|
- showStyle: any;
|
|
|
|
|
- deviceType: string;
|
|
|
|
|
- data: any;
|
|
|
|
|
- moduleName: string;
|
|
|
|
|
- visible: boolean;
|
|
|
|
|
- chartData?: any;
|
|
|
|
|
- activeId?: string | number;
|
|
|
|
|
-}>();
|
|
|
|
|
|
|
+ const props = defineProps<{
|
|
|
|
|
+ pageType: string;
|
|
|
|
|
+ moduleData: any;
|
|
|
|
|
+ showStyle: any;
|
|
|
|
|
+ deviceType: string;
|
|
|
|
|
+ data: any;
|
|
|
|
|
+ moduleName: string;
|
|
|
|
|
+ visible: boolean;
|
|
|
|
|
+ chartData?: any;
|
|
|
|
|
+ activeId?: string | number;
|
|
|
|
|
+ }>();
|
|
|
|
|
|
|
|
-const emit = defineEmits<{
|
|
|
|
|
- (e: 'close'): void;
|
|
|
|
|
- (e: 'click'): void;
|
|
|
|
|
- (e: 'clickItem', data: any): void;
|
|
|
|
|
-}>();
|
|
|
|
|
|
|
+ const emit = defineEmits<{
|
|
|
|
|
+ (e: 'close'): void;
|
|
|
|
|
+ (e: 'click'): void;
|
|
|
|
|
+ (e: 'clickItem', data: any): void;
|
|
|
|
|
+ }>();
|
|
|
|
|
|
|
|
-const { header } = props.moduleData;
|
|
|
|
|
-const selectedData = ref();
|
|
|
|
|
-const selectedAlarmItem = ref({});
|
|
|
|
|
-const alarmBgClass = ref('');
|
|
|
|
|
-watch(() => props.data, updateAlarm, { immediate: true });
|
|
|
|
|
-watch(() => props.activeId, updateAlarm);
|
|
|
|
|
-const { selectedDeviceID, selectedDevice, options, init } = useInitModule(props.deviceType, props.moduleData);
|
|
|
|
|
-// 更新报警情况下背景图
|
|
|
|
|
-function updateAlarm() {
|
|
|
|
|
- const currentId = props.activeId;
|
|
|
|
|
- if (!currentId || !props.data) {
|
|
|
|
|
- alarmBgClass.value = '';
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- let level = null;
|
|
|
|
|
- Object.values(props.data || {}).some((moduleList) => {
|
|
|
|
|
- if (!Array.isArray(moduleList)) return false;
|
|
|
|
|
- const target = moduleList.find((item) => {
|
|
|
|
|
- const itemId = item.sysId || item.sys_id;
|
|
|
|
|
- return String(itemId) === String(currentId);
|
|
|
|
|
|
|
+ const { header } = props.moduleData;
|
|
|
|
|
+ const selectedData = ref();
|
|
|
|
|
+ const selectedAlarmItem = ref({});
|
|
|
|
|
+ const alarmBgClass = ref('');
|
|
|
|
|
+ watch(() => props.data, updateAlarm, { immediate: true });
|
|
|
|
|
+ watch(() => props.activeId, updateAlarm);
|
|
|
|
|
+ const { selectedDeviceID, selectedDevice, options, init } = useInitModule(props.deviceType, props.moduleData);
|
|
|
|
|
+ // 更新报警情况下背景图
|
|
|
|
|
+ function updateAlarm() {
|
|
|
|
|
+ const currentId = props.activeId;
|
|
|
|
|
+ if (!currentId || !props.data) {
|
|
|
|
|
+ alarmBgClass.value = '';
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ let level = null;
|
|
|
|
|
+ Object.values(props.data || {}).some((moduleList) => {
|
|
|
|
|
+ if (!Array.isArray(moduleList)) return false;
|
|
|
|
|
+ const target = moduleList.find((item) => {
|
|
|
|
|
+ const itemId = item.sysId || item.sys_id;
|
|
|
|
|
+ return String(itemId) === String(currentId);
|
|
|
|
|
+ });
|
|
|
|
|
+ if (target) {
|
|
|
|
|
+ level = target.alarmLevel ?? target.alarm_level ?? 0;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
- if (target) {
|
|
|
|
|
- level = target.alarmLevel ?? target.alarm_level ?? 0;
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+ switch (String(level ?? 0)) {
|
|
|
|
|
+ case '102':
|
|
|
|
|
+ alarmBgClass.value = 'alarm-yellow';
|
|
|
|
|
+ break;
|
|
|
|
|
+ case '103':
|
|
|
|
|
+ alarmBgClass.value = 'alarm-orange';
|
|
|
|
|
+ break;
|
|
|
|
|
+ case '104':
|
|
|
|
|
+ alarmBgClass.value = 'alarm-warning';
|
|
|
|
|
+ break;
|
|
|
|
|
+ case '0':
|
|
|
|
|
+ case 'null':
|
|
|
|
|
+ default:
|
|
|
|
|
+ alarmBgClass.value = 'alarm-normal';
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
- switch (String(level ?? 0)) {
|
|
|
|
|
- case '102':
|
|
|
|
|
- alarmBgClass.value = 'alarm-yellow';
|
|
|
|
|
- break;
|
|
|
|
|
- case '103':
|
|
|
|
|
- alarmBgClass.value = 'alarm-orange';
|
|
|
|
|
- break;
|
|
|
|
|
- case '104':
|
|
|
|
|
- alarmBgClass.value = 'alarm-warning';
|
|
|
|
|
- break;
|
|
|
|
|
- case '0':
|
|
|
|
|
- case 'null':
|
|
|
|
|
- default:
|
|
|
|
|
- alarmBgClass.value = 'alarm-normal';
|
|
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-const handleAlarmItem = (data) => {
|
|
|
|
|
- selectedAlarmItem.value = data;
|
|
|
|
|
- emit('clickItem', data);
|
|
|
|
|
-};
|
|
|
|
|
-const style = computed(() => {
|
|
|
|
|
- const size = props.showStyle.size;
|
|
|
|
|
- const position = props.showStyle.position;
|
|
|
|
|
- return size + position + 'position: absolute; pointer-events: auto; z-index: 1';
|
|
|
|
|
-});
|
|
|
|
|
|
|
+ const handleAlarmItem = (data) => {
|
|
|
|
|
+ selectedAlarmItem.value = data;
|
|
|
|
|
+ emit('clickItem', data);
|
|
|
|
|
+ };
|
|
|
|
|
+ const style = computed(() => {
|
|
|
|
|
+ const size = props.showStyle.size;
|
|
|
|
|
+ const position = props.showStyle.position;
|
|
|
|
|
+ return size + position + 'position: absolute; pointer-events: auto; z-index: 1';
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
-const pageType = computed(() => props.pageType || '');
|
|
|
|
|
-const capitalizedPosition = computed(() => (props.showStyle.position.includes('left') ? 'Left' : 'Right'));
|
|
|
|
|
|
|
+ const pageType = computed(() => props.pageType || '');
|
|
|
|
|
+ const capitalizedPosition = computed(() => (props.showStyle.position.includes('left') ? 'Left' : 'Right'));
|
|
|
|
|
|
|
|
-function getModuleClass({ size, position }) {
|
|
|
|
|
- const [_, width] = size.match(/width:([0-9]+)px/) || [];
|
|
|
|
|
- if (position.includes('bottom') || parseInt(width) > 800) {
|
|
|
|
|
- return 'module-common module-common-longer';
|
|
|
|
|
|
|
+ function getModuleClass({ size, position }) {
|
|
|
|
|
+ const [_, width] = size.match(/width:([0-9]+)px/) || [];
|
|
|
|
|
+ if (position.includes('bottom') || parseInt(width) > 800) {
|
|
|
|
|
+ return 'module-common module-common-longer';
|
|
|
|
|
+ }
|
|
|
|
|
+ return 'module-common';
|
|
|
}
|
|
}
|
|
|
- return 'module-common';
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-function redirectTo() {
|
|
|
|
|
- const { to } = props.moduleData;
|
|
|
|
|
- if (!to) return;
|
|
|
|
|
- openWindow(getFormattedText(props.data, to));
|
|
|
|
|
-}
|
|
|
|
|
-watch(
|
|
|
|
|
- () => props.data,
|
|
|
|
|
- (d) => {
|
|
|
|
|
- init(d);
|
|
|
|
|
- if (!selectedDeviceID.value) {
|
|
|
|
|
- selectedDeviceID.value = options.value[0]?.value;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- { immediate: true }
|
|
|
|
|
-);
|
|
|
|
|
|
|
+ function redirectTo() {
|
|
|
|
|
+ const { to } = props.moduleData;
|
|
|
|
|
+ if (!to) return;
|
|
|
|
|
+ openWindow(getFormattedText(props.data, to));
|
|
|
|
|
+ }
|
|
|
|
|
+ watch(
|
|
|
|
|
+ () => props.data,
|
|
|
|
|
+ (d) => {
|
|
|
|
|
+ init(d);
|
|
|
|
|
+ if (!selectedDeviceID.value) {
|
|
|
|
|
+ selectedDeviceID.value = options.value[0]?.value;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ { immediate: true }
|
|
|
|
|
+ );
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
|
-@import '/@/design/theme.less';
|
|
|
|
|
-.module-common .box1-center {
|
|
|
|
|
- height: calc(100% - 48px);
|
|
|
|
|
-}
|
|
|
|
|
-:deep(.box1-center) {
|
|
|
|
|
- height: calc(100% - 48px);
|
|
|
|
|
-}
|
|
|
|
|
-:deep(.box1-center > .box-container) {
|
|
|
|
|
- height: 100%;
|
|
|
|
|
- padding: 0 !important;
|
|
|
|
|
- width: 100% !important;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ @import '/@/design/theme.less';
|
|
|
|
|
+ .module-common .box1-center {
|
|
|
|
|
+ height: calc(100% - 48px);
|
|
|
|
|
+ }
|
|
|
|
|
+ :deep(.box1-center) {
|
|
|
|
|
+ height: calc(100% - 48px);
|
|
|
|
|
+ }
|
|
|
|
|
+ :deep(.box1-center > .box-container) {
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ padding: 0 !important;
|
|
|
|
|
+ width: 100% !important;
|
|
|
|
|
+ }
|
|
|
</style>
|
|
</style>
|