Merge remote-tracking branch 'origin/main'

This commit is contained in:
huguanghan 2024-12-18 10:53:56 +08:00
commit 5f02115098
4 changed files with 29 additions and 16 deletions

View File

@ -180,9 +180,10 @@ export function queryfaultCodeDict(params: object = {}) {
}) })
} }
export function getAllSubSystemReq() { export function getAllSubSystemReq(params: { iotModelId: string }) {
return createAxios({ return createAxios({
url: '/api/equipment/model/attribute/getAllSubsystem', url: '/api/equipment/model/attribute/getAllSubsystem',
method: 'post' method: 'post',
data: params
}) })
} }

View File

@ -184,7 +184,7 @@
</el-row> </el-row>
</el-dialog> </el-dialog>
<el-dialog v-model="selectPointVisible" title="选择测点" width="1000"> <el-dialog v-model="selectPointVisible" title="选择测点" width="1000">
<SelectPoint ref="selectPointDialogRef" :defaultAttr="defaultAttr" :visible="selectPointVisible"></SelectPoint> <SelectPoint ref="selectPointDialogRef" :defaultAttr="defaultAttr" :visible="selectPointVisible" :iot-model-id="selectPointModelId"></SelectPoint>
<template #footer> <template #footer>
<div class="selectPointDialogFooter"> <div class="selectPointDialogFooter">
<el-button type="primary" @click="saveSelectPoint">保存</el-button> <el-button type="primary" @click="saveSelectPoint">保存</el-button>
@ -197,6 +197,7 @@
ref="realDataChartRef" ref="realDataChartRef"
:visible="realDataLineChartVisible" :visible="realDataLineChartVisible"
:id="clickRow!.irn" :id="clickRow!.irn"
:iot-model-id="selectPointModelId"
@clearChart="() => (linePause = false)" @clearChart="() => (linePause = false)"
></RealDataChart> ></RealDataChart>
<template #header> <template #header>
@ -695,6 +696,9 @@ const defaultAttr = computed(() => {
} }
}) })
}) })
const selectPointModelId = computed(()=>{
return tableData.value[0]?.iotModelId ?? ''
})
const openMeasure = () => { const openMeasure = () => {
selectPointVisible.value = true selectPointVisible.value = true
} }

View File

@ -33,7 +33,12 @@
</el-row> </el-row>
</div> </div>
<el-dialog v-model="selectPointVisible" title="选择测点" width="1000"> <el-dialog v-model="selectPointVisible" title="选择测点" width="1000">
<SelectPoint ref="selectPointRef" :visible="selectPointVisible" :default-attr="selectPointAttr"></SelectPoint> <SelectPoint
ref="selectPointRef"
:visible="selectPointVisible"
:default-attr="selectPointAttr"
:iot-model-id="props.iotModelId"
></SelectPoint>
<template #footer> <template #footer>
<div class="selectPointDialogFooter"> <div class="selectPointDialogFooter">
<el-button type="primary" @click="saveSelectPoint">保存</el-button> <el-button type="primary" @click="saveSelectPoint">保存</el-button>
@ -51,9 +56,10 @@ import { getRealValueListReq } from '/@/api/backend/deviceModel/request'
import { dayjs, ElMessage } from 'element-plus' import { dayjs, ElMessage } from 'element-plus'
import { getCutDecimalsValue } from './utils' import { getCutDecimalsValue } from './utils'
const emits = defineEmits(['clearChart']) const emits = defineEmits(['clearChart'])
const props = withDefaults(defineProps<{ id: string; visible: boolean }>(), { const props = withDefaults(defineProps<{ id: string; visible: boolean; iotModelId: string }>(), {
id: '', id: '',
visible: false, visible: false,
iotModelId: '',
}) })
const showTimeInterval = ref(300) const showTimeInterval = ref(300)
//#region //#region
@ -204,7 +210,7 @@ const createChartData = (data: { [k: string]: number }, time: string) => {
fillData.push(curVal) fillData.push(curVal)
return { return {
id: item, id: item,
name: info.name +' '+ (info?.unit ?? ''), name: info.name + ' ' + (info?.unit ?? ''),
type: 'line', type: 'line',
barWidth: 20, barWidth: 20,
itemStyle: { itemStyle: {
@ -226,16 +232,16 @@ const createChart = () => {
if (chartInstance && realDataXAxis.length > 1) { if (chartInstance && realDataXAxis.length > 1) {
const nameMap: any = {} const nameMap: any = {}
realDataSeries.forEach((item: any) => { realDataSeries.forEach((item: any) => {
const yAxisName = item.name.split(' ')[1] const yAxisName = item.name.split(' ')[1]
if (nameMap[yAxisName] || nameMap[yAxisName]===0) { if (nameMap[yAxisName] || nameMap[yAxisName] === 0) {
item.yAxisIndex = nameMap[yAxisName] item.yAxisIndex = nameMap[yAxisName]
} else { } else {
const len = Object.keys(nameMap).length const len = Object.keys(nameMap).length
item.yAxisIndex = len item.yAxisIndex = len
nameMap[yAxisName] = len nameMap[yAxisName] = len
} }
}) })
const nameMapKeys = Object.keys(nameMap) const nameMapKeys = Object.keys(nameMap)
if (realDataSeries.length >= 4 && nameMapKeys.length === 4) { if (realDataSeries.length >= 4 && nameMapKeys.length === 4) {
selectPointNum.value = realDataSeries.length selectPointNum.value = realDataSeries.length

View File

@ -88,11 +88,13 @@ import { Top, Bottom, Close } from '@element-plus/icons-vue'
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
defaultAttr: { attributeCode: string; attributeName: string }[] defaultAttr: { attributeCode: string; attributeName: string }[]
visible: boolean visible: boolean,
iotModelId:string
}>(), }>(),
{ {
defaultAttr: () => [], defaultAttr: () => [],
visible: false, visible: false,
iotModelId:''
} }
) )
@ -109,16 +111,16 @@ const subSystemVal = ref('')
const subSystemList = ref() const subSystemList = ref()
const getAllSubSystem = () => { const getAllSubSystem = () => {
getAllSubSystemReq().then((res) => { getAllSubSystemReq({iotModelId:props.iotModelId}).then((res) => {
const data = res.data const data = res.data
.filter((item: any) => item) .filter((item: any) => item)
.map((item:any) => { .map((item: any) => {
return { return {
label: item, label: item,
value: item, value: item,
} }
}) })
subSystemList.value = [...data, { label: '全部', value: ' ' }] subSystemList.value = [{ label: '全部', value: ' ' }, ...data]
}) })
} }
@ -195,11 +197,11 @@ const getTableData = (customData = {}) => {
inputVal[searchType.value] = searchInfo.value inputVal[searchType.value] = searchInfo.value
getModelAttributeListReq({ getModelAttributeListReq({
iotModelId: '', iotModelId: props.iotModelId,
// attributeType: radioActiveName.value, // attributeType: radioActiveName.value,
pageNum: pageSetting.current, pageNum: pageSetting.current,
pageSize: pageSetting.pageSize, pageSize: pageSetting.pageSize,
subSystem: (!subSystemVal.value || subSystemVal.value === ' ') ? null : subSystemVal.value, subSystem: !subSystemVal.value || subSystemVal.value === ' ' ? null : subSystemVal.value,
...inputVal, ...inputVal,
...customData, ...customData,
}) })