对比新文件 |
| | |
| | | import request from '@/config/axios' |
| | | |
| | | export interface PreDataBarLineReqVO { |
| | | queryIds: string[], |
| | | predictTime: string, |
| | | startTime: string, |
| | | endTime: string |
| | | } |
| | | |
| | | export interface PreDataItemChartReqVO { |
| | | itemId: string, |
| | | startTime: string, |
| | | endTime: string |
| | | } |
| | | |
| | | |
| | | export const getPreDataCharts = (data: PreDataBarLineReqVO) => { |
| | | return request.post({ url: '/model/api/mcs/predict-data/charts', data }) |
| | | } |
| | | |
| | | export const getPreDataItemChart = (data: PreDataItemChartReqVO) => { |
| | | return request.post({ url: '/model/api/mcs/predict-data/item-chart', data }) |
| | | } |
| | |
| | | import request from '@/config/axios' |
| | | |
| | | export interface DmModuleVO { |
| | | id: string |
| | | id: string, |
| | | modulename: string, |
| | | moduletype: string, |
| | | cycle: string |
| | |
| | | <template> |
| | | <el-dialog |
| | | title="采集值" |
| | | title="预测数据" |
| | | :close-on-click-modal="false" |
| | | width="50%" |
| | | v-model="visible" |
| | |
| | | plain |
| | | @click="handleExport" |
| | | :loading="exportLoading" |
| | | v-hasPermi="['data:point:export']" |
| | | > |
| | | <Icon icon="ep:download" />导出 |
| | | <Icon icon="ep:download"/> |
| | | 导出 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div ref="chartDom" class="result-chart"></div> |
| | | <div ref="chartDomPre" class="result-chart"></div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import {ref} from 'vue'; |
| | | import * as echarts from 'echarts'; |
| | | import * as DaPoint from '@/api/data/da/point/daPointChart' |
| | | import * as McsApi from '@/api/model/mcs' |
| | | import {getYMDHM0} from "@/utils/dateUtil" |
| | | import download from "@/utils/download"; |
| | | |
| | | const message = useMessage() // 消息弹窗 |
| | | const visible = ref(false); |
| | | const chartDom = ref(null); |
| | | const chartDomPre = ref(null); |
| | | let myChart = null; |
| | | const chartParams = reactive({ |
| | | codes:[], |
| | | startDate : undefined, |
| | | endDate: undefined, |
| | | itemId: undefined, |
| | | startTime: undefined, |
| | | endTime: undefined, |
| | | }) |
| | | const dataForm = ref({ |
| | | id: "", |
| | | pointNo: "", |
| | | pointName: "", |
| | | pointTypeName: "", |
| | | itemName: "", |
| | | startTime: getYMDHM0(new Date() - 60 * 60 * 1000), |
| | | endTime: "", |
| | | endTime: getYMDHM0(new Date() + 60 * 60 * 1000), |
| | | }); |
| | | |
| | | /** 打开弹窗 */ |
| | | const open = async (row: object) => { |
| | | visible.value = true |
| | | resetForm() |
| | | dataForm.value.id = row.id; |
| | | dataForm.value.pointNo = row.pointNo; |
| | | dataForm.value.pointName = row.pointName; |
| | | getDataList(); |
| | | dataForm.value.itemName = row.itemname; |
| | | if (row.id) { |
| | | getDataList(); |
| | | } |
| | | } |
| | | |
| | | defineExpose({open}) // 提供 open 方法,用于打开弹窗 |
| | |
| | | visible.value = true; |
| | | if (dataForm.value.id) { |
| | | try { |
| | | chartParams.codes=[dataForm.value.pointNo]; |
| | | chartParams.startDate = dataForm.value.startTime; |
| | | chartParams.endDate = dataForm.value.endTime; |
| | | const data = await DaPoint.getPointDaChart(chartParams) |
| | | chartParams.itemId = dataForm.value.id; |
| | | chartParams.startTime = dataForm.value.startTime; |
| | | chartParams.endTime = dataForm.value.endTime; |
| | | const data = await McsApi.getPreDataItemChart(chartParams) |
| | | let legendData = [] |
| | | if (data.legend && data.legend.length > 0) { |
| | | data.legend.forEach(item => { |
| | | legendData.push(item + ":" + '真实值') |
| | | legendData.push(item + ":" + '预测值') |
| | | }) |
| | | } |
| | | |
| | | let seriesData = [] |
| | | data.series.forEach(item => { |
| | | if (data.lastTime) { |
| | | seriesData.push({ |
| | | name: item.name, |
| | | type: "line", |
| | | data: item.data, |
| | | showSymbol: true, |
| | | smooth: false, |
| | | lineStyle: { |
| | | normal: { |
| | | color: "#5B8FF9", |
| | | width: 1, |
| | | name: '', |
| | | data: [null], |
| | | type: 'line', |
| | | smooth: true, |
| | | color: 'green', |
| | | markLine: { |
| | | silent: true, |
| | | lineStyle: { |
| | | color: '#32a487', |
| | | width: 2 |
| | | }, |
| | | data: [{ |
| | | xAxis: data.lastTime |
| | | }], |
| | | label: { |
| | | normal: { |
| | | formatter: data.lastTime |
| | | } |
| | | }, |
| | | symbol: ['circle', 'none'], |
| | | }, |
| | | }); |
| | | }) |
| | | } |
| | | |
| | | myChart = echarts.init(chartDom.value); |
| | | if (data.viewMap) { |
| | | Object.keys(data.viewMap).forEach(key => { |
| | | let viewData = data.viewMap[key] |
| | | seriesData.push({ |
| | | name: key + ":" + '真实值', |
| | | type: "line", |
| | | data: viewData.realData, |
| | | showSymbol: false, |
| | | smooth: false, |
| | | lineStyle: { |
| | | normal: { |
| | | width: 1, |
| | | }, |
| | | }, |
| | | }) |
| | | seriesData.push({ |
| | | name: key + ":" + '预测值', |
| | | type: "line", |
| | | data: viewData.preDataN, |
| | | showSymbol: false, |
| | | smooth: false, |
| | | lineStyle: { |
| | | normal: { |
| | | width: 1, |
| | | }, |
| | | }, |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | myChart = echarts.init(chartDomPre.value); |
| | | const option = { |
| | | title: { |
| | | text: dataForm.value.pointName, |
| | | text: dataForm.value.itemName, |
| | | top: 0, |
| | | left: "1%", |
| | | textStyle: { |
| | |
| | | }, |
| | | }, |
| | | legend: { |
| | | show: false, |
| | | top: 10, |
| | | show: true, |
| | | top: 20, |
| | | data: legendData |
| | | }, |
| | | grid: { |
| | | top: 30, |
| | | top: "20%", |
| | | left: "3%", |
| | | right: "5%", |
| | | bottom: 10, |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** 导出按钮操作 */ |
| | | const exportLoading = ref(false) |
| | | const handleExport = async () => { |
| | | chartParams.codes=[dataForm.value.pointNo]; |
| | | chartParams.startDate = dataForm.value.startTime; |
| | | chartParams.endDate = dataForm.value.endTime; |
| | | chartParams.itemId = dataForm.value.id; |
| | | chartParams.startTime = dataForm.value.startTime; |
| | | chartParams.endTime = dataForm.value.endTime; |
| | | try { |
| | | // 导出的二次确认 |
| | | await message.exportConfirm() |
| | | // 发起导出 |
| | | exportLoading.value = true |
| | | const data = await DaPoint.exportDaPointValue(chartParams) |
| | | download.excel(data, dataForm.value.pointName +'.xls') |
| | | /*const data = await DaPoint.exportDaPointValue(chartParams) |
| | | download.excel(data, dataForm.value.pointName + '.xls')*/ |
| | | } catch { |
| | | } finally { |
| | | exportLoading.value = false |
| | | } |
| | | } |
| | | |
| | | /** 重置表单 */ |
| | | const resetForm = () => { |
| | | dataForm.value = { |
| | | id: undefined, |
| | | itemName: undefined, |
| | | startTime: undefined, |
| | | endTime: undefined |
| | | } |
| | | } |
| | | </script> |
| | | <style> |
| | | .el-select { |
| | |
| | | import * as MmPredictItem from '@/api/model/pre/item' |
| | | import * as MmItemType from '@/api/model/pre/type' |
| | | import * as DmModule from '@/api/model/pre/dm' |
| | | import * as MmResultTable from '@/api/model/pre/result' |
| | | import * as ProjectApi from '@/api/model/mpk/project' |
| | | import * as DaPoint from '@/api/data/da/point' |
| | | import {useUpload} from '@/api/model/pre/item' |
| | | import * as ScheduleModelApi from '@/api/model/sche/model' |
| | | import request from "@/config/axios"; |
| | | |
| | | const {uploadUrl, httpRequest} = useUpload() |
| | | |
| | |
| | | const itemTypeList = ref([]) |
| | | const itemTypeMap = ref({}) |
| | | const moduleList = ref([]) |
| | | const resultstridList = ref([]) |
| | | const mpkProjectList = ref([]) |
| | | const pointNoList = ref([]) |
| | | const pointList = ref([]) |
| | |
| | | |
| | | // 获取管网列表 |
| | | moduleList.value = await DmModule.getModuleList() |
| | | |
| | | // 获取结果字符串列表 |
| | | resultstridList.value = await MmResultTable.getResultstridList() |
| | | |
| | | // 获取mpk项目列表 |
| | | mpkProjectList.value = await ProjectApi.list() |