Merge remote-tracking branch 'origin/main'

This commit is contained in:
fengrong 2024-10-29 16:20:37 +08:00
commit 5c804fada0
8 changed files with 334 additions and 53 deletions

View File

@ -155,3 +155,11 @@ export const getRealValueListReq = (data: { deviceId: string, attributes?: strin
data: data,
})
}
export const getRealValueRangeReq = (data: { startTime: number, endTime: number, devices: { deviceId: string, attributes?: string[] }[],interval?:string }) => {
return createAxios<never, RequestReturnType<any>>({
url: '/api/data/history',
method: 'post',
data: data,
})
}

View File

@ -47,10 +47,11 @@ export const addNodeListReq = (data: addNodeType) => {
})
}
export const submitNodeConfigReq = () => {
return createAxios({
export const submitNodeConfigReq = (data:{id:string}) => {
return createAxios<never, RequestReturnType<nodeType>>({
url: '/api/node/configUpdate',
method: 'post',
data
})
}

View File

@ -31,22 +31,61 @@
<!--实时预览-->
<div class="overview panelBg">
<el-text class="mx-1 homelabel">实时预览</el-text>
<div class="radioItem">
<!-- <div class="radioItem">
<el-radio-group v-model="radioactiveName">
<el-radio value="1">模拟量</el-radio>
<el-radio value="2">状态量</el-radio>
</el-radio-group>
</div>
</div> -->
<el-row :gutter="10">
<!-- <div class="realScroll" ref="listContainer">
<div class="realPart" v-for="item in overviewData140" :key="item.name">
<span class="realLeft">{{ item.name }}</span>
<span class="reafRight">{{ item.value }}</span>
<div class="realScroll" ref="listContainer">
<div class="realPart">
<span class="realLeft">网侧A相电压</span>
<span class="reafRight">{{ overviewData.iul1_690v }}</span>
</div>
</div> -->
<VisualList :list="radioactiveName === '1' ? overviewData138And139 : overviewData140" :item-size="40"></VisualList>
<div class="realPart">
<span class="realLeft">网侧B相电压</span>
<span class="reafRight">{{ overviewData.iul2_690v }}</span>
</div>
<div class="realPart">
<span class="realLeft">网侧C相电压</span>
<span class="reafRight">{{ overviewData.iul3_690v }}</span>
</div>
<div class="realPart">
<span class="realLeft">有功功率</span>
<span class="reafRight">{{ overviewData.igenpower }}</span>
</div>
<div class="realPart">
<span class="realLeft">无功功率</span>
<span class="reafRight">{{ overviewData.ireactivepower }}</span>
</div>
<div class="realPart">
<span class="realLeft">功率因素</span>
<span class="reafRight">{{ overviewData.icosphi }}</span>
</div>
<div class="realPart">
<span class="realLeft">主轴承温度A</span>
<span class="reafRight">{{ overviewData.itemprotorbeara_1sec }}</span>
</div>
<div class="realPart">
<span class="realLeft">主轴承温度B</span>
<span class="reafRight">{{ overviewData.itemprotorbeara_1sec }}</span>
</div>
<div class="realPart">
<span class="realLeft">总扭缆角度</span>
<span class="reafRight">{{ overviewData.icabletwisttotal }}</span>
</div>
<div class="realPart">
<span class="realLeft">发动机驱动侧轴承温度</span>
<span class="reafRight">{{ overviewData.itempgenbearde_1sec }}</span>
</div>
<div class="realPart">
<span class="realLeft">发动机非驱动侧轴承温度</span>
<span class="reafRight">{{ overviewData.itempgenbearnde_1sec }}</span>
</div>
</div>
<div class="ralIcon" @click="handleClick">
<el-icon :size="20" color="#0064AA"><DArrowRight /></el-icon>
<el-icon :size="20" color="#0064AA" @click="() => (overviewSlotData.visible = true)"><DArrowRight /></el-icon>
</div>
</el-row>
</div>
@ -261,39 +300,60 @@
</el-col>
</el-row>
</div>
<el-dialog v-model="overviewSlotData.visible" title="实时预览">
<template #header>
<div class="overviewSlot">
<span style="font-size: 20px">实时预览</span>
<div class="radioForOverviewType">
<el-radio-group v-model="overviewSlotData.type">
<el-radio value="138">模拟量</el-radio>
<el-radio value="140">状态量</el-radio>
</el-radio-group>
</div>
</div>
</template>
<Overview v-bind="overviewSlotData"></Overview>
</el-dialog>
</template>
<script setup lang="ts">
import { nextTick, onActivated, onMounted, reactive, ref, computed, onBeforeMount } from 'vue'
import { nextTick, onActivated, onMounted, reactive, ref, computed, onBeforeMount, onUnmounted } from 'vue'
import * as echarts from 'echarts'
import { useTemplateRefsList, useEventListener } from '@vueuse/core'
import { useI18n } from 'vue-i18n'
import { DArrowRight } from '@element-plus/icons-vue'
import { getRealValueListReq } from '/@/api/backend/deviceModel/request'
import { getRealValueListReq, getRealValueRangeReq } from '/@/api/backend/deviceModel/request'
import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request'
import { useRoute } from 'vue-router'
import VisualList from './visualList.vue'
import Overview from './overview.vue'
import { TableInstance } from 'element-plus'
import { dayjs } from 'element-plus'
const route = useRoute()
const d = new Date()
const { t } = useI18n()
let timer: any = null
let myTable = ref(null)
let myTable = ref<TableInstance>()
const radioactiveName = ref('1')
const overviewData138And139 = ref<{ name: string; value: string }[]>([])
const overviewData140 = ref<{ name: string; value: string }[]>([])
const overviewData = reactive({
iul1_690v: '',
iul2_690v: '',
iul3_690v: '',
igenpower: '',
ireactivepower: '',
icosphi: '',
itemprotorbeara_1sec: '',
itemprotorbearb_1sec: '',
icabletwisttotal: '',
itempgenbearde_1sec: '',
itempgenbearnde_1sec: '',
})
const handleClick = () => {
// debugger
// visible.value = true
}
const listContainer = ref(null)
const scrollDown = () => {
if (listContainer.value) {
listContainer.value.scrollTop += 45 // 100px
}
}
const realTimeDataForSingle = ref<any>({
ikwhthisday: '',
@ -329,9 +389,9 @@ const powerChartData = [
]
const initpowerChart = () => {
const initpowerChart = echarts.init(chartRefs.value[0] as HTMLElement)
const xAxisdata = []
const powerData = []
const windSpeedData = []
const xAxisdata: any[] = []
const powerData: any[] = []
const windSpeedData: any[] = []
powerChartData.forEach((item, index) => {
const dataTime = item.dataTime
const dataTimearr = dataTime.split(' ')
@ -443,14 +503,14 @@ const initpowerChart = () => {
},
],
legend: {
data: ['功率', '风速'],
data: ['有功功率','理论有功功率', '风速',],
textStyle: {
color: '#73767a',
},
},
series: [
{
name: '功率',
name: '有功功率',
type: 'line',
barWidth: 20,
itemStyle: {
@ -461,6 +521,18 @@ const initpowerChart = () => {
symbol: 'none',
data: powerData,
},
{
name: '理论有功功率',
type: 'line',
barWidth: 20,
itemStyle: {
color: '#00a4ff',
barBorderRadius: 2,
},
smooth: 0.6,
symbol: 'none',
data: powerData,
},
{
name: '风速',
type: 'line',
@ -507,10 +579,10 @@ const TrendData = [
]
const timeType = '日'
const inittrendChart = (t, u) => {
const currentPeriod = []
const samePeriod = []
const xAxisdata = []
const inittrendChart = (t: any, u: any) => {
const currentPeriod: any = []
const samePeriod: any = []
const xAxisdata: any = []
TrendData.forEach((item, index) => {
const generationTime = item.generationTime
const generationTimearr = generationTime.split('-')
@ -913,13 +985,13 @@ const clearScroll = () => {
}
const createScroll = () => {
clearScroll()
const table = myTable.value.layout.table.refs
const tableWrapper = table.bodyWrapper.firstElementChild.firstElementChild
const table = myTable.value!.layout.table.refs
const tableWrapper = table.bodyWrapper.firstElementChild!.firstElementChild
timer = setInterval(() => {
tableWrapper.scrollTop += 1
if (tableWrapper.clientHeight + tableWrapper.scrollTop == tableWrapper.scrollHeight) {
tableWrapper.scrollTop = 0
tableWrapper!.scrollTop += 1
if (tableWrapper!.clientHeight + tableWrapper!.scrollTop == tableWrapper!.scrollHeight) {
tableWrapper!.scrollTop = 0
}
}, 30)
}
@ -991,7 +1063,9 @@ const createRealTimeData = async () => {
const modelList: any = await getModelList()
const realTimeData: any = await getRealTimeData()
const sigleDataKeys:any = Object.keys(realTimeDataForSingle.value)
const overviewDatakeys: any = Object.keys(overviewData)
const sigleDataKeys: any = Object.keys(realTimeDataForSingle.value)
const dataFor138And139: { name: string; value: string }[] = []
const dataFor140: { name: string; value: string }[] = []
const realDataForSub: any = [
@ -1008,6 +1082,9 @@ const createRealTimeData = async () => {
if (sigleDataKeys.includes(item.attributeCode.toLowerCase())) {
realTimeDataForSingle.value[item.attributeCode.toLowerCase()] = val
}
if (overviewDatakeys.includes(item.attributeCode.toLowerCase())) {
overviewData[item.attributeCode.toLowerCase() as keyof typeof overviewData] = val === '-' ? val : val + item.unit
}
const showData = {
name: item.attributeName,
value: val === '-' ? val : val + item.unit,
@ -1058,9 +1135,8 @@ const createRealTimeData = async () => {
}
}
})
overviewData138And139.value = dataFor138And139
overviewData140.value = dataFor140
console.log(realDataForSub)
overviewSlotData.type138 = dataFor138And139
overviewSlotData.type140 = dataFor140
realTimeForSubSystem.type1 = realDataForSub[0]
realTimeForSubSystem.type2 = realDataForSub[1]
@ -1133,6 +1209,7 @@ onMounted(() => {
initChart()
initfrequencyChart()
useEventListener(window, 'resize', echartsResize)
autoUpdate()
})
onBeforeMount(() => {
for (const key in state.charts) {
@ -1151,6 +1228,44 @@ const tabhandleClick = (tabName) => {
inittrendChart('月', '6')
}
}
const overviewSlotData = reactive<{ visible: boolean; type: '138' | '140'; type138: any[]; type140: any[] }>({
visible: false,
type: '138',
type138: [],
type140: [],
})
let autoUpdateTimer: any = null
const autoUpdate = () => {
if (!autoUpdateTimer) {
autoUpdateTimer = setInterval(() => {
createRealTimeData()
}, 2000)
}
}
const getChartData = () => {
const data = {
startTime: new Date(new Date().toLocaleDateString()).getTime(),
endTime: Date.now(),
devices: [
{
deviceId: route.query.irn as string,
attributes: ['iGenPower', 'iTheoreticalPower', 'iWindSpeed'],
},
],
interval: '1min',
}
getRealValueRangeReq(data).then(res=>{
console.log(res);
})
}
// getChartData()
onUnmounted(() => {
autoUpdateTimer && clearInterval(autoUpdateTimer)
})
</script>
<style scoped lang="scss">
@ -1197,7 +1312,6 @@ const tabhandleClick = (tabName) => {
.realScroll {
width: 100%;
height: 450px;
overflow: hidden;
.realPart {
font-size: 14px;
color: #333333;
@ -1216,7 +1330,10 @@ const tabhandleClick = (tabName) => {
width: 100%;
text-align: center;
transform: rotate(90deg);
margin-top: 30px;
margin-top: 44px;
:hover {
cursor: pointer;
}
}
}
.status {
@ -1474,8 +1591,14 @@ const tabhandleClick = (tabName) => {
}
}
.dialogContent {
height: 500px;
max-height: 500px;
overflow-y: auto;
overflow-x: hidden;
}
.overviewSlot {
display: flex;
.radioForOverviewType {
margin-left: auto;
}
}
</style>

View File

@ -0,0 +1,112 @@
<template>
<div class="overviewWrap">
<div class="dialogContent">
<div class="PitchPart">
<el-row>
<el-col :span="12" v-for="item in showData" :key="item.name">
<div class="Pitchitem">
<span class="PitchitemLeft">{{ item.name }}</span>
<span class="PitchitemRight">{{ item.value }}</span>
</div>
</el-col>
</el-row>
</div>
</div>
<div class="footer">
<el-pagination
v-model:current-page="pageSetting.current"
v-model:page-size="pageSetting.pageSize"
:total="pageSetting.total"
:page-sizes="pageSetting.pageSizes"
background
:pager-count="7"
layout="prev, pager, next, jumper,sizes,total"
@change="getcurrentPage"
></el-pagination>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, computed, watch, onMounted } from 'vue'
const props = withDefaults(defineProps<{ visible: boolean; type: string; type138: any; type140: any }>(), {
visible: false,
type: '138',
type138: [],
type140: [],
})
const showData = computed(() => {
let data = props.type === '138' ? props.type138 : props.type140
return data.slice((pageSetting.current - 1) * pageSetting.pageSize, pageSetting.current * pageSetting.pageSize)
})
const pageSetting = reactive({
current: 1,
pageSize: 20,
total: 0,
pageSizes: [20, 50, 100],
})
const getcurrentPage = () => {}
watch(
() => props.type,
() => {
pageSetting.current = 1
pageSetting.total = props.type === '138' ? props.type138.length : props.type140.length
}
)
onMounted(() => {
pageSetting.total = props.type === '138' ? props.type138.length : props.type140.length
})
</script>
<style scoped lang="scss">
.dialogContent {
width: 100%;
max-height: 540px;
overflow-x: hidden;
overflow-y: auto;
.PitchPart {
.Pitchitem {
border: 1px solid #e1edf6;
display: flex;
justify-content: space-between;
margin-left: 15px;
width: 100%;
height: 100%;
.PitchitemLeft {
display: flex;
align-items: center;
width: 80%;
min-height: 50px;
background: #f7f9fc;
padding-left: 20px;
font-size: 14px;
color: #4e5969;
letter-spacing: 0;
font-weight: 500;
word-break: break-all;
}
.PitchitemRight {
display: flex;
justify-content: center;
align-items: center;
width: 20%;
height: 100%;
font-size: 14px;
color: #4e5969;
letter-spacing: 0;
font-weight: 500;
}
}
}
}
.footer {
width: 100%;
display: flex;
justify-content: right;
}
</style>

View File

@ -230,7 +230,9 @@
<el-option label="计算量" :value="199"></el-option>
</el-select>
</el-form-item>
<template v-if="attributeForm.attributeType === 138 || attributeForm.attributeType === 139 || attributeForm.attributeType === 199">
<template
v-if="attributeForm.attributeType === 138 || attributeForm.attributeType === 139 || attributeForm.attributeType === 199"
>
<el-form-item :label="ModelAttributeFieldsEnums['dataType']" prop="dataType">
<el-select v-model="attributeForm.dataType" :placeholder="'请选择' + ModelAttributeFieldsEnums['dataType']">
<el-option v-for="v in attributeFormDataTypeOptions" :key="v.value" :label="v.value" :value="v.value"></el-option>
@ -242,7 +244,11 @@
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
</el-form-item>
<el-form-item v-if="attributeForm.attributeType === 138 || attributeForm.attributeType === 139 || attributeForm.attributeType === 199" :label="ModelAttributeFieldsEnums['unit']" prop="unit">
<el-form-item
v-if="attributeForm.attributeType === 138 || attributeForm.attributeType === 139 || attributeForm.attributeType === 199"
:label="ModelAttributeFieldsEnums['unit']"
prop="unit"
>
<el-input v-model="attributeForm.unit" :placeholder="'请输入' + ModelAttributeFieldsEnums['unit']"></el-input>
</el-form-item>
</div>
@ -652,7 +658,9 @@ const getAttributeList = ({
? '累积量'
: item.attributeType === 140
? '离散量'
: item.attributeType!,
: item.attributeType === 199
? '计算量'
: item.attributeType!,
highSpeed: item.highSpeed === 1,
visible: item.visible === 1,
}
@ -756,7 +764,7 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
subSystem: '',
dataType: '',
visible: true,
unit:'',
unit: '',
revision: 1,
createdBy: undefined,
createdTime: undefined,
@ -1119,7 +1127,7 @@ $paginationHeight: 32px;
.el-select {
width: 184px;
}
.el-input{
.el-input {
width: 184px;
}
}

View File

@ -66,7 +66,7 @@ export enum ModelAttributeFieldsEnums {
'subSystem' = '子系统',
'dataType' = '数据类型',
'visible' = '是否可见',
'unit'='单位',
'unit' = '单位',
'revision' = '乐观锁',
'createdBy' = '创建人',
'createdTime' = '创建时间',
@ -109,7 +109,7 @@ export type AddModelAttributeType = {
highSpeed: 0 | 1 | boolean
subSystem: string
dataType: attributeTypeDataType | ''
unit:string
unit: string
visible: 0 | 1 | boolean
revision: number
createdBy?: string
@ -171,7 +171,7 @@ export type modelTabsTypeKeyType = keyof typeof modelTabsType
export type ModelAttributeTableType = AddModelAttributeType &
UpdateModelAttributeType & {
attributeTypeName: '模拟量' | '累积量' | '离散量' | ModelAttributeType
attributeTypeName: '模拟量' | '累积量' | '离散量' | '计算量' | ModelAttributeType
}
export type ModelServiceTableType = AddModelServiceType &
UpdateModelServiceType & {

View File

@ -197,6 +197,13 @@ const selectAirBlower = (type: SelectTypeKeyUnionType) => {
tableData.value = originTableData.value
return
} else if (airBlowerSelect.belongLine !== '全部' && airBlowerSelect.iturbineoperationmode !== 987654321) {
if (type === 'iturbineoperationmode' && airBlowerSelect.iturbineoperationmode === 2) {
const type1 = tableData.value.filter((item) => item.iturbineoperationmode === 1)
const type6 = tableData.value.filter((item) => item.iturbineoperationmode === 6)
const type2 = tableData.value.filter((item) => item.iturbineoperationmode === 2)
tableData.value = [...type1, ...type6, ...type2]
return
}
tableData.value = tableData.value.filter((item) => item[type] === airBlowerSelect[type])
return
} else {
@ -207,6 +214,14 @@ const selectAirBlower = (type: SelectTypeKeyUnionType) => {
tableData.value = originTableData.value.filter((item) => item.belongLine === airBlowerSelect.belongLine)
return
}
if (type === 'iturbineoperationmode' && airBlowerSelect.iturbineoperationmode === 2) {
const type1 = originTableData.value.filter((item) => item.iturbineoperationmode === 1)
const type6 = originTableData.value.filter((item) => item.iturbineoperationmode === 6)
const type2 = originTableData.value.filter((item) => item.iturbineoperationmode === 2)
tableData.value = [...type1, ...type6, ...type2]
return
}
tableData.value = originTableData.value.filter((item) => item[type] === airBlowerSelect[type])
return
}

View File

@ -317,7 +317,21 @@ const delNode = () => {
ElMessage.error(err?.response?.data?.msg ?? '删除失败')
})
}
const submitNodeConfig = () => {}
const submitNodeConfig = () => {
console.log(clickTreeData.value?.id!)
submitNodeConfigReq({ id: clickTreeData.value?.id! })
.then((res) => {
if (res.success) {
ElMessage.success(res.msg ?? '提交成功')
} else {
ElMessage.error(res.msg ?? '提交失败')
}
})
.catch((err) => {
ElMessage.error('提交失败')
})
}
const submitNodeForm = () => {
nodeFormRef.value?.validate((valid: boolean) => {