| | |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | |
| | | |
| | | export const queryScadaTimeValues = async (params, req: any = request) => { |
| | | return req({ |
| | | url: 'data/query_scada_time_values', |
| | | method: 'POST', |
| | | data: params, |
| | | headers: { |
| | | 'Content-Type': 'application/x-www-form-urlencoded', |
| | | }, |
| | | }); |
| | | }; |
| | |
| | | :title="firstRow.title" |
| | | :type="firstRow.id" |
| | | :values="rowChunk" |
| | | @itemClick="valueClick" |
| | | /> |
| | | </div> |
| | | <!-- å©ä½è¡ --> |
| | |
| | | :title="row.title" |
| | | :type="row.id" |
| | | :values="rowChunk" |
| | | @itemClick="valueClick" |
| | | /> |
| | | </div> |
| | | </div> |
| | |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | <RecordSetDialog v-model="chartDlgIsShow" :otype="chartDlgMapRow?.OTYPE" :oname="chartDlgMapRow?.ONAME"/> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | THIN_BORDER_WIDTH, |
| | | } from './constants'; |
| | | import type { Monitor, MonitorValue } from './types'; |
| | | import RecordSetDialog from '../recordSet/RecordSetDialog.vue'; |
| | | |
| | | const props = defineProps(chatComProps) as { |
| | | data: Monitor; |
| | |
| | | return chunkResult; |
| | | }); |
| | | |
| | | //#region ====================== ç¹å»çæ²çº¿ ====================== |
| | | |
| | | const chartDlgIsShow = ref(false); |
| | | const chartDlgMapRow = ref(null); |
| | | const valueClick = (item) => { |
| | | chartDlgMapRow.value = item; |
| | | chartDlgIsShow.value = true; |
| | | }; |
| | | //#endregion |
| | | |
| | | // è®¡ç®æå¤§åæ° |
| | | // (x-1)* cellWidth + rowHeaderCellContentWidth.value+thickBorderWidth*(x-1)+thickBorderWidth*2 <= width; |
| | | |
| | |
| | | height: `${CELL_HEIGHT}px`, |
| | | }" |
| | | > |
| | | <span class="cursor-pointer" @mouseover="valueMouseOver($event, item)" @mouseleave="valueMouseLeave"> |
| | | <span class="cursor-pointer" @mouseover="valueMouseOver($event, item)" @mouseleave="valueMouseLeave" @click="emit('itemClick',item,item[type])"> |
| | | {{ item[type] }} |
| | | </span> |
| | | </div> |
| | |
| | | import { reactive, type PropType } from 'vue'; |
| | | import { BORDER_COLOR, CELL_HEIGHT, CONTENT_CELL_CLASS, ROW_HEADER_CELL_CLASS, THICK_BORDER_WIDTH } from './constants'; |
| | | import type { MonitorValue } from './types'; |
| | | |
| | | const emit = defineEmits(['itemClick']) |
| | | const props = defineProps({ |
| | | /** @description æ é¢ */ |
| | | title: { |
| | |
| | | <template> |
| | | <div class="w-full"> |
| | | <div class="flex mb-4 flex-wrap" v-if="visibleParams && visibleParams.length > 0"> |
| | | <div class="flex mb-4 flex-wrap"> |
| | | <!-- TimeRange v-model è· @change ä¸çå¼ä¼ä¸ä¸æ ·ï¼ä»¥@change ä¸ä¸ºå --> |
| | | <component |
| | | class="flex-0 m-1" |
| | | v-model="paramsValueList[index].value" |
| | | v-for="(item, index) in visibleParams as any" |
| | | :key="item.id" |
| | | :id="item.id" |
| | | :is="recordSetMapCom[item.type]" |
| | | :data="item" |
| | | :originData="originData" |
| | | @change="(val) => handleQueryChange(val, item)" |
| | | :disabled="chartLoading" |
| | | ></component> |
| | | <template v-if="visibleParams && visibleParams.length > 0"> |
| | | <component |
| | | class="flex-0 m-1" |
| | | v-model="paramsValueList[index].value" |
| | | v-for="(item, index) in visibleParams as any" |
| | | :key="item.id" |
| | | :id="item.id" |
| | | :is="recordSetMapCom[item.type]" |
| | | :data="item" |
| | | :originData="originData" |
| | | @change="(val) => handleQueryChange(val, item)" |
| | | :disabled="chartLoading" |
| | | ></component> |
| | | </template> |
| | | <slot> |
| | | |
| | | </slot> |
| | | |
| | | <YRange v-model="yRange" @input="yRangeInput" /> |
| | | <el-checkbox class="m-1" v-model="isMultiCompare" label="夿¥å¯¹æ¯" @change="multiCompareChange"></el-checkbox> |
| | | </div> |
| | | <div class="h-[20rem]" v-resize="chartContainerResize" v-loading="chartLoading"> |
| | | <div :style="{ height: chartHeight }" v-resize="chartContainerResize" v-loading="chartLoading"> |
| | | <div ref="chartRef"></div> |
| | | </div> |
| | | </div> |
| | |
| | | summaryIndex: { |
| | | type: Number, |
| | | }, |
| | | chartHeight: { |
| | | type: String, |
| | | default: '20rem', |
| | | }, |
| | | }) as { |
| | | data: RecordSet; |
| | | }; |
| | |
| | | } else { |
| | | newList.push(current); |
| | | } |
| | | }else{ |
| | | } else { |
| | | newList.push(current); |
| | | } |
| | | } |
| | |
| | | |
| | | const drawChart = () => { |
| | | const data = props.data; |
| | | if (!data || !data.cols || !data.values) { |
| | | return; |
| | | } |
| | | preData = data; |
| | | const xType = 'time'; |
| | | timeIndex = data.cols.findIndex((item) => item.type === 'time'); |
| | |
| | | let res = null; |
| | | |
| | | try { |
| | | if(item.type===RecordSetParamsType.TimeRange){ |
| | | changeMap.set(item.range[0].id,val[0]), |
| | | changeMap.set(item.range[1].id,val[1]) |
| | | }else{ |
| | | if (item.type === RecordSetParamsType.TimeRange) { |
| | | changeMap.set(item.range[0].id, val[0]), changeMap.set(item.range[1].id, val[1]); |
| | | } else { |
| | | changeMap.set(item.id, val); |
| | | } |
| | | const paramsObj = {}; |
| | |
| | | } |
| | | }; |
| | | //#endregion |
| | | |
| | | defineExpose({ |
| | | drawChart, |
| | | }); |
| | | </script> |
| | | <style scoped lang="scss"></style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog :destroy-on-close="true" v-model="isShow" draggable :close-on-click-modal="false" :title="chartValues?.title"> |
| | | <RecordSet chartHeight="30rem" ref="recordSetRef" :data="chartValues"> |
| | | <TimeRange class="flex-0 m-1" @change="timeRangeChange" /> |
| | | <List class="flex-0 m-1" v-model="stepTime" :data="listData" @change="selectStepChange" /> |
| | | </RecordSet> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { ref, watch } from 'vue'; |
| | | import RecordSet from './RecordSet.vue'; |
| | | import { queryScadaTimeValues } from '/@/api/ai/chat'; |
| | | import { useCompRef } from '/@/utils/types'; |
| | | import { getRecentDateRange } from '/@/utils/util'; |
| | | import { formatDate } from '/@/utils/formatTime'; |
| | | import TimeRange from './components/TimeRange.vue'; |
| | | import List from './components/List.vue'; |
| | | |
| | | const props = defineProps(['otype', 'oname']); |
| | | |
| | | const isShow = defineModel({ |
| | | type: Boolean, |
| | | }); |
| | | |
| | | const recordSetRef = useCompRef(RecordSet); |
| | | |
| | | const listData = { |
| | | list: [ |
| | | { title: '5åé', value: '5 minutes' }, |
| | | { title: '10åé', value: '10 minutes' }, |
| | | { title: 'åå°æ¶', value: '30 minutes' }, |
| | | { title: '1å°æ¶', value: '1 hours' }, |
| | | { title: '1天', value: '1 days' }, |
| | | ], |
| | | type: 'list', |
| | | title: 'æ¶é¿', |
| | | value: '5 minutes', |
| | | } as any; |
| | | |
| | | const queryRange = ref<string[]>(null); |
| | | const timeRangeChange = (val) => { |
| | | queryRange.value = val; |
| | | setChartData(queryRange.value); |
| | | }; |
| | | |
| | | const selectStepChange = (val) => { |
| | | setChartData(queryRange.value); |
| | | }; |
| | | const stepTime = ref('5 minutes'); |
| | | const chartValues = ref(null); |
| | | const setChartData = async (timeRange: string[]) => { |
| | | const res = await queryScadaTimeValues({ |
| | | otype: props.otype, |
| | | oname: props.oname, |
| | | start_time: timeRange[0], |
| | | end_time: timeRange[1], |
| | | step_time: stepTime.value, |
| | | }); |
| | | chartValues.value = res.values; |
| | | recordSetRef.value.drawChart(); |
| | | }; |
| | | |
| | | watch( |
| | | () => isShow.value, |
| | | (val) => { |
| | | if (!val) { |
| | | return; |
| | | } |
| | | queryRange.value = getRecentDateRange(1).map((item) => formatDate(item)); |
| | | setChartData(queryRange.value); |
| | | } |
| | | ); |
| | | </script> |
| | | <style scoped lang="scss"></style> |
| | |
| | | import { isNil } from 'lodash-unified'; |
| | | import { ref } from 'vue'; |
| | | |
| | | export const isUndefined = (val: any): val is undefined => val === undefined; |
| | | export const isBoolean = (val: any): val is boolean => typeof val === 'boolean'; |
| | |
| | | }; |
| | | |
| | | export const isFilledArray = (val: any) => Array.isArray(val) && val.length > 0; |
| | | /** |
| | | * |
| | | * @param _comp ç»ä»¶æé 彿° |
| | | * @returns ç»ä»¶ ref |
| | | * @example const formRef = useCompRef(ElForm); |
| | | */ |
| | | export const useCompRef = <T extends abstract new (...args: any) => any>(_comp: T) => ref<InstanceType<T>>(); |