diff --git a/ui/dasadmin/src/views/backend/WindBlower/index.vue b/ui/dasadmin/src/views/backend/WindBlower/index.vue index 44ed0b38..9f3ae1be 100644 --- a/ui/dasadmin/src/views/backend/WindBlower/index.vue +++ b/ui/dasadmin/src/views/backend/WindBlower/index.vue @@ -38,48 +38,48 @@
实时预览
- 网侧A相电压: - {{ overviewData.iul1_690v }} + 机组运行状态: + {{ realTimeDataState }}
- 网侧B相电压: - {{ overviewData.iul2_690v }} + 风速: + {{ overviewData.iwindspeed }}
- 网侧C相电压: - {{ overviewData.iul3_690v }} + 风向: + {{ overviewData.iwinddirection }} +
+
+ 发电机转速: + {{ overviewData.igenspeed }}
有功功率: {{ overviewData.igenpower }}
+
+ 给定有功功率: + {{ overviewData.iactivepowersetpointvalue }} +
无功功率: {{ overviewData.ireactivepower }}
- 功率因素: - {{ overviewData.icosphi }} + 给定无功功率: + {{ overviewData.ireactivepowersetpointvalue }}
- 主轴承温度A: - {{ overviewData.itemprotorbeara_1sec }} + 限电原因: + {{ overviewData.powerlimitsource }}
- 主轴承温度B: - {{ overviewData.itemprotorbeara_1sec }} + 机舱位置: + {{ overviewData.ivanedirection }}
- 总扭缆角度: - {{ overviewData.icabletwisttotal }} -
-
- 发动机驱动侧轴承温度: - {{ overviewData.itempgenbearde_1sec }} -
-
- 发动机非驱动侧轴承温度: - {{ overviewData.itempgenbearnde_1sec }} + 日发电量: + {{ overviewData.ikwhthisday }}
@@ -326,17 +326,17 @@ let timer: any = null let myTable = ref() const overviewData = reactive({ - iul1_690v: '-', - iul2_690v: '-', - iul3_690v: '-', + // iturbineoperationmode: '-', + iwindspeed: '-', + iwinddirection: '-', + igenspeed: '-', igenpower: '-', + iactivepowersetpointvalue: '-', ireactivepower: '-', - icosphi: '-', - itemprotorbeara_1sec: '-', - itemprotorbearb_1sec: '-', - icabletwisttotal: '-', - itempgenbearde_1sec: '-', - itempgenbearnde_1sec: '-', + ireactivepowersetpointvalue: '-', + powerlimitsource: '-', + ivanedirection: '-', + ikwhthisday: '-', }) const realTimeDataForSingle = ref({ @@ -1008,7 +1008,6 @@ const createRealTimeData = async () => { { type138: [], type140: [], type199: [] }, ] modelList.forEach((item: any) => { - const realVal = realData[item.attributeCode.toLowerCase()] let val = getCutDecimalsValue(realVal) if (enumStore.keys.includes(item.attributeCode)) { @@ -1018,7 +1017,11 @@ const createRealTimeData = async () => { realTimeDataForSingle.value[item.attributeCode.toLowerCase()] = val === '-' ? val : val } if (overviewDatakeys.includes(item.attributeCode.toLowerCase())) { - overviewData[item.attributeCode.toLowerCase() as keyof typeof overviewData] = val === '-' ? val : val + item.unit + if (enumStore.keys.includes(item.attributeCode)) { + overviewData[item.attributeCode.toLowerCase() as keyof typeof overviewData] = val as string + } else { + overviewData[item.attributeCode.toLowerCase() as keyof typeof overviewData] = val === '-' ? val : val + item.unit + } } const showData = { name: item.attributeName, @@ -1374,19 +1377,11 @@ const sendManualCommand = (type: 1 | 0) => { const getAlarmList = () => { const start = dayjs().startOf('day').toDate().getTime() const end = dayjs().endOf('day').toDate().getTime() - console.log({ - startTime: start, - endTime: end, - deviceCode: [route.query.deviceCode], - },'----------------------------------'); - getAlarmListReq({ startTime: start, endTime: end, deviceCode: [route.query.deviceCode], }).then((res) => { - console.log(res,'------------------------'); - if (res.rows) { tableData.value = res.rows.map((item: any) => { return { diff --git a/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue b/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue index 918a2172..132f9932 100644 --- a/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue +++ b/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue @@ -191,7 +191,14 @@ - + + @@ -203,7 +210,7 @@ import { getAirBlowerListReq, getBelongLineListReq } from '/@/api/backend/airBlo import { CircleCheck, CircleClose, Loading, Crop, Download } from '@element-plus/icons-vue' import { ElMessage, TableInstance, ElPopconfirm } from 'element-plus' import { useRouter, useRoute } from 'vue-router' -import { getRealTimeState, getCutDecimalsValue } from './utils' +import { getRealTimeState, getCutDecimalsValue, getEnumToValue } from './utils' import { sendCommandReq } from '/@/api/backend/control/request' import { adminBaseRoutePath } from '/@/router/static/adminBase' import { getRealValueListReq } from '/@/api/backend/deviceModel/request' @@ -380,6 +387,7 @@ const defaultColumn: TableColumnType[] = [ prop: 'name', align: 'center', custom: 'default', + width: 120, }, { label: '实时曲线', @@ -399,6 +407,7 @@ const defaultColumn: TableColumnType[] = [ prop: 'iturbineoperationmode', align: 'center', custom: 'default', + width: 100, }, ] const dynamicColumn: TableColumnType[] = [ @@ -493,7 +502,7 @@ const dynamicColumn: TableColumnType[] = [ width: 100, }, { - label: '总发电量 (万kWh)', + label: '总发电量 (kWh)', prop: 'ikwhoverall', align: 'center', custom: 'header', @@ -547,7 +556,8 @@ const getTableData = () => { const data = airBlowerIdList.map((id) => { const realData: any = {} Object.keys(res.data[id]).forEach((key) => { - realData[key] = getCutDecimalsValue(res.data[id][key]) + const cutVal = getCutDecimalsValue(res.data[id][key]) + realData[key] = getEnumToValue(key, cutVal) }) const state = getRealTimeState(res.data[id]) return { @@ -565,7 +575,6 @@ const getTableData = () => { if (airBlowerSelect.belongLine === '全部' && airBlowerSelect.iturbineoperationmode === 987654321) { tableData.value = data - console.log(tableData.value) } else { const irn = tableData.value.map((item) => item.irn) const result: TableDataObjType[] = [] @@ -616,21 +625,23 @@ const selectTable = (selected: TableDataObjType[]) => { const autoUpdate = ref(true) const autoUpdateInterval = ref(null) -watch(autoUpdate, (newVal: boolean) => { - if (newVal) { - if (autoUpdateInterval.value) return - ElMessage.success('开启自动刷新') - autoUpdateInterval.value = setInterval(() => { - getTableData() - }, 2000) - } else { - if (realDataLineChartVisible.value) { - ElMessage.warning('关闭自动刷新') +watch( + () => autoUpdate.value, + (newVal: boolean) => { + if (newVal) { + if (autoUpdateInterval.value) return + autoUpdateInterval.value = setInterval(() => { + getTableData() + }, 2000) + } else { + clearInterval(autoUpdateInterval.value) + autoUpdateInterval.value = null } - clearInterval(autoUpdateInterval.value) - autoUpdateInterval.value = null + }, + { + immediate: true, } -}) +) const openWindTurbine = (row: TableDataObjType) => { if (!router.hasRoute('windTurbine')) { @@ -758,16 +769,52 @@ const downFun = () => { document.body.removeChild(link) } +const realDataChartRef = ref() const clickRowId = ref('') const realDataLineChartVisible = ref(false) const openLineChart = (row: TableDataObjType) => { clickRowId.value = row.irn realDataLineChartVisible.value = true autoUpdate.value = false + linePause.value = false } const closeLineChart = () => { autoUpdate.value = true } + +const linePause = ref(false) +const saveLineChart = () => { + const data = realDataChartRef.value?.saveChart() + linePause.value = true + const info = 'deviceCode:' + clickRowId.value + '\n' + let title = 'TimeStamp;' + let columns = '' + data.time.forEach((item: any, index: number) => { + columns += item + data.chartData.forEach((item: any) => { + if (index === 0) { + title += `${item.id};` + } + const val = item.data[index] + columns += `;${val}` + }) + columns += '\n' + }) + let str = info + title + '\n' + columns + let uri = 'data:text/plain;charset=utf-8,' + encodeURIComponent(str) + let link = document.createElement('a') + link.href = uri + link.download = clickRowId.value + 'ChartData' + '.txt' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) +} + +const continueLineChart = () => { + realDataChartRef.value?.continueChart() + linePause.value = false +} + onUnmounted(() => { autoUpdateInterval.value && clearInterval(autoUpdateInterval.value) autoUpdateInterval.value = null @@ -890,4 +937,8 @@ getBlongLineList() height: 40px; } } + +.saveBtn { + margin-left: 164px; +} diff --git a/ui/dasadmin/src/views/backend/equipment/airBlower/realDataChart.vue b/ui/dasadmin/src/views/backend/equipment/airBlower/realDataChart.vue index ea3963bc..cf1dd8ec 100644 --- a/ui/dasadmin/src/views/backend/equipment/airBlower/realDataChart.vue +++ b/ui/dasadmin/src/views/backend/equipment/airBlower/realDataChart.vue @@ -4,10 +4,16 @@
添加测点 + 显示区间: + + + + +
- + (), { id: '', visible: false, }) - +const showTimeInterval = ref(300) //#region const defaultList = [ { @@ -109,18 +116,28 @@ const defaultList = [ ] //#endregion const selectList = ref([]) -watch( - () => selectList.value, - () => { - if (!timer && selectList.value[0]) { - createTimer() - } - if (selectList.value.length === 0) { - clearTimer() - chartInstance && chartInstance.clear() - } +const changeCheck = () => { + if (!timer && selectList.value[0]) { + createTimer() } -) + + if (selectList.value.length === 0) { + clearTimer() + chartInstance && chartInstance.clear() + } +} +// watch( +// () => selectList.value, +// () => { +// if (!timer && selectList.value[0]) { +// createTimer() +// } +// if (selectList.value.length === 0) { +// clearTimer() +// chartInstance && chartInstance.clear() +// } +// } +// ) const realDataList = ref(JSON.parse(JSON.stringify(defaultList))) const chartRef = ref() @@ -153,7 +170,7 @@ const getRandomDarkColor = () => { } const createChartData = (data: { [k: string]: number }, time: string) => { - if (realDataXAxis.length > 120) { + if (realDataXAxis.length > showTimeInterval.value) { realDataXAxis.shift() realDataSeries.forEach((item: any) => { item.data.shift() @@ -183,16 +200,17 @@ const createChartData = (data: { [k: string]: number }, time: string) => { } const seriesData = attrCode.map((item) => { + const curVal = getCutDecimalsValue(data[item], 2) if (lastSeriesId.includes(item)) { const cur = realDataSeries.find((val: any) => val.id === item) - cur.data.push(data[item]) + cur.data.push(curVal) return cur } else { const info = realDataList.value.find((val) => val.prop === item) const list = realDataSeries?.[0]?.data ?? [] const len = list.length const fillData = new Array(len).fill('') - fillData.push(data[item]) + fillData.push(curVal) return { id: item, name: info.name + info.unit, @@ -343,6 +361,8 @@ const saveSelectPoint = () => { } }) realDataList.value = selectList + selectPointVisible.value = false + ElMessage.success('添加成功') } } let timer: any = null @@ -357,6 +377,29 @@ const clearTimer = () => { realDataSeries = [] realDataXAxis = [] } + +const pauseState = ref(false) +const saveChart = () => { + timer && clearInterval(timer) + pauseState.value = true + return { + time: realDataXAxis, + chartData: realDataSeries, + } +} +const continueChart = () => { + pauseState.value = false + const fillVal = new Array(5).fill('') + realDataXAxis.push(...fillVal) + realDataSeries.forEach((item: any) => { + item.data.push(...fillVal) + }) + createTimer() +} +defineExpose({ + saveChart, + continueChart, +}) onMounted(() => { if (selectList.value.length > 0) { createTimer() @@ -389,7 +432,19 @@ watch( height: 100%; border-right: 1px solid #edf2fa; .leftHeader { + display: flex; + justify-content: space-between; + align-items: center; padding: 10px; + span { + margin-left: auto; + } + .el-select { + width: 100px; + } + :deep(.el-select__wrapper) { + width: 100px; + } } .leftMain { width: 100%; @@ -418,4 +473,11 @@ watch( } } } +.selectPointDialogFooter { + text-align: center; + .el-button { + width: 120px; + height: 40px; + } +} diff --git a/ui/dasadmin/src/views/backend/equipment/airBlower/utils.ts b/ui/dasadmin/src/views/backend/equipment/airBlower/utils.ts index aa4d5ef9..2300b0f7 100644 --- a/ui/dasadmin/src/views/backend/equipment/airBlower/utils.ts +++ b/ui/dasadmin/src/views/backend/equipment/airBlower/utils.ts @@ -1,3 +1,7 @@ +import { useEnumStore } from '/@/stores/enums' + +const enumStore = useEnumStore() + export const getRealTimeState = (data: any) => { if (data.iturbineoperationmode) { if (data.iturbineoperationmode > 1 && data.iturbineoperationmode < 6) { @@ -20,3 +24,15 @@ export const getCutDecimalsValue = (data: number, num = 3) => { const n = Math.pow(10, num) return data === 0 ? 0 : data ? (data % 1 === 0 ? data : Math.floor(data * n) / n) : '-' } + +export const getEnumToValue = (key: string, value: any) => { + const enumData: any = {} + enumStore.keys.forEach(item => { + enumData[item.toLowerCase()] = enumStore.data[item] + }) + if (enumData[key]) { + return enumData[key]?.[value] ?? value + } else { + return value + } +} \ No newline at end of file