1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045 |
- <template>
- <div class="app-container">
- <div class="dark-el-input dark-el-button">
- <el-form ref="queryForm" size="small" :inline="true" popper-class="cpp-popper">
- <el-form-item label="预测日期">
- <el-date-picker
- :clearable="false"
- v-model="dateTime"
- type="date"
- :picker-options="expireDateOption"
- placeholder="选择生成日期"
- popper-class="cpp-popper"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="场站名称">
- <el-select v-model="stationCode" placeholder="请选择" popper-class="cpp-popper">
- <el-option
- v-for="item in stationList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" size="small" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">
- 查询
- </el-button>
- </el-form-item>
- </el-form>
- </div>
- <el-row>
- <el-col :span="9">
- <div class="divDescribe">调控策略</div>
- <div class="divDescribe">调控截止时间:{{ this.dqEndTime }}</div>
- <div class="divDescribe">调控方式:调控值=原始值*系数+数值</div>
- <div class="divDescribeBtn">
- <div class="dark-el-input dark-el-button">
- <el-button type="primary" size="small" style="margin-left: 5px" @click="quickUse">一键应用</el-button>
- <el-button type="primary" size="small" style="margin-left: 5px" @click="usualSet">设为常用</el-button>
- </div>
- </div>
- <div class="divTable">
- <el-table
- :data="tableData"
- :loading="loading"
- size="mini" height="60vh"
- style="width: 100%;">
- <el-table-column
- prop="time"
- header-align="center"
- align="center"
- label="时间" fixed min-width="50px"
- >
- </el-table-column>
- <el-table-column
- prop="xs"
- header-align="center"
- align="center"
- label="系数" min-width="50px">
- <template slot-scope="scope">
- <vxe-input type="number" v-model="scope.row.xs" size="small" style="width:100%" min="0"
- placeholder="" @change="setValueByManual(scope.row,scope.$index)"></vxe-input>
- </template>
- </el-table-column>
- <el-table-column
- prop="sz"
- header-align="center"
- align="center"
- label="数值" min-width="50px">
- <template slot-scope="scope">
- <vxe-input type="number" v-model="scope.row.sz" size="small" style="width:100%"
- placeholder="" @change="setValueByManual(scope.row,scope.$index)"></vxe-input>
- </template>
- </el-table-column>
- <el-table-column
- prop="ysValue"
- header-align="center"
- align="center"
- label="原始值" min-width="60px">
- </el-table-column>
- <el-table-column
- prop="tkValue"
- header-align="center"
- align="center"
- label="调控值"
- :max="capacity"
- :min="0" min-width="60px"
- >
- </el-table-column>
- </el-table>
- </div>
- <div class="tkBtn">
- <div class="dark-el-input dark-el-button">
- <el-button type="primary" size="small" style="margin-left: 5px" @click="tkDialog">调控功率</el-button>
- </div>
- </div>
- </el-col>
- <el-col :span="15">
- <div style="width: 100%;height: 82vh" id="tkcharts"></div>
- </el-col>
- </el-row>
- <div class="dark-el-dialog">
- <el-dialog :visible.sync="usualOpen" :before-close="cancelUsual" :close-on-click-modal="false" width="450px"
- height="600px">
- <el-form ref="usualForm" :model="usualForm" width="430px" label-width="70px">
- <el-row class="mb4">
- <el-col :span="24">
- <el-form-item label="常用名称" prop="name">
- <el-input style="width: 100%" v-model="usualForm.usualName" maxlength="15" popper-class="cpp-popper"/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row class="mb4">
- <el-col>
- <div style="color: #fff">保存常用名可以在一键应用中找到历史调控策略。</div>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="commitUsual">确 定</el-button>
- <el-button @click="cancelUsual">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- <div class="dark-el-dialog">
- <el-dialog :visible.sync="tkOpen" :close-on-click-modal="false" width="700px" height="600px">
- <div class="flex" style="color:#ffffff;">
- 确认对
- <span style="background: #d3a4ff">{{ this.tkrq }}</span>
- 日,
- <span style="background: #d3a4ff">{{ this.stationName }}</span>
- 的短期功率调控,调控后数据将下发到对应场站上报调度。
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="tkCommit">确 定</el-button>
- <el-button @click="tkCancel">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- <!-- 策略选择弹窗 -->
- <div class="dark-el-dialog">
- <el-dialog :visible.sync="quickUseOpen" :before-close="cancelQuickUse" :close-on-click-modal="false"
- style="height: calc(100% - 50px)">
- <div class="reg-config-container flex justify-between">
- <div class="reg-config-con">
- <span class="flex justify-center dialog-text-title">策略选择</span>
- <!-- 策略列表 -->
- <div class="reg-config flex">
- <div class="reg-config-radio" style="margin-top: 15px">
- <el-radio v-model="vradio" label="1" @click.native.prevent="radioChange('1')">快捷选择历史策略:
- </el-radio>
- </div>
- <div class="flex-column reg-config-btu">
- <!-- 循环生成按钮 -->
- <el-button
- v-for="(button, index) in buttons"
- :key="index"
- @click="handleButtonClick(button.usualName)"
- >
- {{ button.usualName }}
- </el-button>
- </div>
- </div>
- <div class="reg-config flex items-center">
- <div class="reg-config-radio">
- <el-radio v-model="vradio" label="2" @click.native.prevent="radioChange('2')">选择历史策略:</el-radio>
- </div>
- <div>
- <el-select ref="selectUsualName" v-model="usualId" placeholder="请选择" popper-class="cpp-popper"
- :disabled="usualDisabled" @change="changeUsualName">
- <el-option
- v-for="item in usualList"
- :key="item.id"
- :label="item.usualName"
- :value="item.id">
- </el-option>
- </el-select>
- </div>
- </div>
- <div class="reg-config flex items-center" style="margin-top: 18px">
- <div class="reg-config-radio">
- <el-radio v-model="vradio" label="3" @click.native.prevent="radioChange('3')">选择中心侧模型:</el-radio>
- </div>
- <div>
- <el-select v-model="modelId" placeholder="请选择" popper-class="cpp-popper"
- :disabled="modelDisabled" @change="changeForecastModel">
- <el-option
- v-for="item in forecastModelList"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue">
- </el-option>
- </el-select>
- </div>
- </div>
- <div id="currentSelectFunction" style="display: none;margin-top: 30px;margin-left: 24px;"
- class="reg-config flex items-center">
- <div>当前选择策略:</div>
- <div style="width: 215px">
- {{ this.currentStrategy }}
- </div>
- <div>
- <el-button @click="trialPreview">预览</el-button>
- <el-button id="trialDeleteBtnId" @click="trialDelete" v-if="showDeleteButton">删除</el-button>
- </div>
- </div>
- <div slot="footer" class="reg-dialog-footer">
- <el-button type="primary" @click="quickUseCommit">一键应用</el-button>
- <el-button @click="cancelQuickUse">取 消</el-button>
- </div>
- </div>
- <!-- <el-divider direction="vertical" style="height: calc(100% - 30px)"></el-divider>-->
- <div>
- <!-- 预览表格 -->
- <span class="flex justify-center dialog-text-title">预览策略展示</span>
- <el-table
- :data="trialData"
- height="550px"
- :loading="loading"
- size="mini"
- style="width: 100%;margin-top: 13px;">
- <el-table-column
- prop="time"
- header-align="center"
- align="center"
- label="时间"
- >
- </el-table-column>
- <el-table-column
- prop="xs"
- header-align="center"
- align="center"
- label="系数">
- </el-table-column>
- <el-table-column
- prop="sz"
- header-align="center"
- align="center"
- label="数值">
- </el-table-column>
- <el-table-column
- prop="ysValue"
- header-align="center"
- align="center"
- label="原始值">
- </el-table-column>
- <el-table-column
- prop="tkValue"
- header-align="center"
- align="center"
- label="调控值"
- :max="capacity"
- :min="0"
- >
- </el-table-column>
- </el-table>
- </div>
- </div>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import * as echarts from "echarts";
- import {fontSize} from "../../../utils";
- export default {
- name: 'inverterinfo',
- data() {
- return {
- showDeleteButton:true,
- dqEndTime: '',
- markLineData: new Array(),
- visualMapPieces: new Array(),
- trialData: [],
- usualDisabled: true,
- modelDisabled: true,
- vradio: '1',
- buttons: new Array(),
- usualId: '',
- modelId: '',
- usualList: [],
- forecastModelList: [],
- currentStrategy: '',
- stationName: '',
- tkrq: '',
- quickUseOpen: false,
- tkOpen: false,
- usualOpen: false,
- usualForm: {
- usualName: undefined
- },
- expireDateOption: {
- disabledDate(time) {
- return (time.getTime() > Date.now() + 8.64e7 *10) || (time.getTime() < Date.now())
- }
- },
- loading: false,
- symbolSize: 8,
- capacity: '',
- tkData: [],
- tableData: [],
- hoursArray: [],
- chart: null,
- form: [],
- dateTime: new Date(new Date().toLocaleDateString()).getTime() + (60 * 60 * 24 * 1000),
- stationList: [],
- stationCode: '',
- ysData: [],
- refUpData: [],
- refDownData: [],
- chartOption: {
- backgroundColor: 'transparent',
- title: {
- top: 20,
- text: '短期调控曲线',
- textStyle: {
- fontWeight: 'normal',
- fontSize: fontSize(.16),
- },
- left: 'center'
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- lineStyle: {
- color: '#57617B'
- }
- }
- },
- legend: {
- top: 20,
- icon: 'rect',
- itemWidth: 14,
- itemHeight: 5,
- itemGap: 13,
- data: ['原始值', '调控值', '参考值上限', '参考值下限'],
- // right: '4%',
- right: 0,
- textStyle: {
- fontSize: fontSize(.14),
- // color: this.lineColor
- },
- selected: {
- '原始值': true,
- '调控值': true,
- '参考值上限': true,
- '参考值下限': true,
- }
- },
- dataZoom: [{
- type: 'inside'
- }],
- grid: {
- top: 100,
- left: '2%',
- right: '2%',
- bottom: '10%',
- containLabel: true
- },
- xAxis: [{
- type: 'category',
- boundaryGap: false,
- axisLine: {onZero: false},
- }],
- yAxis: [{
- type: 'value',
- name: 'MW',
- axisTick: {
- show: false
- },
- axisLabel: {
- margin: 10,
- textStyle: {
- fontSize: 14
- }
- },
- splitLine: {
- lineStyle: {
- color: '#57617B'
- }
- }
- }],
- series: [{
- name: '原始值',
- type: 'line',
- smooth: true,
- symbol: 'circle',
- symbolSize: 5,
- showSymbol: false,
- connectNulls: true,
- lineStyle: {
- normal: {
- width: 2
- }
- },
- itemStyle: {
- normal: {
- color: 'rgb(219,50,51)',
- borderWidth: 12
- }
- },
- data: this.ysData
- },
- {
- id: 'a',
- name: '调控值',
- type: 'line',
- showSymbol: false,
- smooth: true,
- symbol: 'circle',
- symbolSize: 10,
- connectNulls: true,
- lineStyle: {
- normal: {
- color: 'rgb(0,136,212)',
- width: 2
- }
- },
- itemStyle: {
- normal: {
- color: 'rgb(0,136,212)',
- borderWidth: 50
- }
- },
- data: []
- },
- {
- name: '参考值上限',
- type: 'line',
- smooth: true,
- symbol: 'circle',
- connectNulls: true,
- symbolSize: 5,
- showSymbol: false,
- lineStyle: {
- normal: {
- width: 2,
- type: 'dashed' //设置线条类型
- }
- },
- itemStyle: {
- normal: {
- color: '#00FF00',
- borderWidth: 12
- }
- },
- data: this.refUpData
- },
- {
- name: '参考值下限',
- type: 'line',
- smooth: true,
- symbol: 'circle',
- connectNulls: true,
- symbolSize: 5,
- showSymbol: false,
- lineStyle: {
- normal: {
- width: 2,
- type: 'dashed' //设置线条类型
- }
- },
- itemStyle: {
- normal: {
- color: 'rgb(167,27,189)',
- borderWidth: 12
- }
- },
- data: this.refDownData
- },
- ]
- }
- }
- },
- created() {
- this.getStationCode()
- },
- mounted() {
- this.initChart()
- },
- beforeDestroy() {
- if (!this.chart) {
- return
- }
- this.chart.dispose()
- this.chart = null
- },
- computed: {},
- methods: {
- // 中心侧预测模型选择
- changeForecastModel(dictValue){
- const item = this.forecastModelList.find(item => item.dictValue == dictValue)
- let dictLabel = item ? item.dictLabel : ''
- this.currentStrategy = dictLabel
- document.getElementById("currentSelectFunction").style.display = ''
- },
- // 策略名称下拉框选择
- changeUsualName(id) {
- const item = this.usualList.find(item => item.id == id)
- let usualName = item ? item.usualName : ''
- this.currentStrategy = usualName
- document.getElementById("currentSelectFunction").style.display = ''
- },
- radioChange(radioValue) {
- document.getElementById("currentSelectFunction").style.display = 'none'
- this.currentStrategy = ''
- this.trialData = []
- if (radioValue == '1') {
- // 显示删除按钮
- this.showDeleteButton = true
- this.vradio = '1'
- // 常用策略下拉框名称清空
- this.usualId = ''
- // 常用策略下拉框不可用
- this.usualDisabled = true
- // 中心模型下拉框名称清空
- this.modelId = ''
- // 中心模型下拉框不可用
- this.modelDisabled = true
- }
- else if (radioValue == '2') {
- // 显示删除按钮
- this.showDeleteButton = true
- this.vradio = '2'
- // 常用策略下拉框可用
- this.usualDisabled = false
- this.modelId = ''
- // 中心模型下拉框不可用
- this.modelDisabled = true
- }
- else if (radioValue == '3') {
- // 隐藏删除按钮
- this.showDeleteButton = false
- this.vradio = '3'
- this.usualId = ''
- // 常用策略下拉框不可用
- this.usualDisabled = true
- // 中心模型下拉框可用
- this.modelDisabled = false
- }
- },
- // 默认常用按钮事件
- handleButtonClick(usualName) {
- if (this.vradio == '1') {
- // 执行常用按钮点击
- this.currentStrategy = usualName
- document.getElementById("currentSelectFunction").style.display = ''
- }
- },
- async executeTrial() {
- const param = {
- "selectRadio": this.vradio,
- "usualName": this.currentStrategy,
- "stationCode": this.tableData[0].stationCode,
- "time": new Date(this.tableData[0].forecastDate).getTime()
- }
- // 获取策略名称的系数和数值
- await this.$axios.get('/dqRegulationController/trialData', {params: param}).then(response => {
- this.trialData = response.data
- })
- },
- // 删除按钮点击
- trialDelete() {
- if (this.currentStrategy == '') {
- this.$message.warning("请选择策略名称进行删除!")
- return
- }
- this.$confirm('是否确认删除【' + this.currentStrategy + '】?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- // 提交名称及系数配置
- const formData = new FormData()
- formData.append('usualName', this.currentStrategy)
- this.$axios.post('/dqUsualController/deleteUsual', formData, {
- headers: {
- 'Content-Type': 'multipart/form-data' // 设置请求头,确保服务器正确解析 FormData
- }
- }).then((res) => {
- this.$message.success('删除策略成功!')
- document.getElementById("currentSelectFunction").style.display = "none"
- this.trialData = []
- // 重新渲染下拉框
- this.renderUsual()
- }).catch((error) => {
- })
- })
- },
- // 预览按钮点击
- trialPreview() {
- if (this.currentStrategy == '') {
- this.$message.warning("请选择策略名称进行预览!")
- return
- }
- this.executeTrial()
- },
- // 一键应用中确定
- async quickUseCommit() {
- if (this.currentStrategy == '') {
- this.$message.warning("请选择策略进行应用!")
- return
- }
- await this.executeTrial()
- if (this.trialData.length==0){
- this.$message.warning("此策略无数据,不能一键应用!")
- return
- }
- else{
- // 将列表数据赋值给底层列表
- this.tableData = this.trialData
- // 将预算的调控曲线赋值给底层曲线上
- let tkArray = new Array()
- for (var i = 0; i < this.tableData.length; i++) {
- let array = new Array()
- array.push(this.tableData[i].time)
- array.push(this.tableData[i].tkValue)
- tkArray.push(array)
- }
- this.tkData = tkArray
- this.chartOption.series[1].data = this.tkData
- this.chart.setOption(this.chartOption)
- //再调用updatePosition
- this.updatePosition()
- this.cancelQuickUse()
- }
- },
- // 一键应用中取消按钮
- cancelQuickUse() {
- this.quickUseOpen = false;
- this.trialData = []
- this.currentStrategy = ''
- this.buttons = []
- this.vradio = '1'
- this.usualDisabled = true
- this.modelDisabled = true
- this.usualId=''
- this.modelId=''
- document.getElementById("currentSelectFunction").style.display = 'none'
- },
- renderUsual() {
- this.buttons = []
- this.usualId = ''
- this.currentStrategy = ''
- // 先获取常用下拉框
- this.$axios.get('/dqUsualController/getUsualList').then(response => {
- this.usualList = response.data.tempShortUsualList
- if (this.usualList.length > 0) {
- // 循环list,将前5个给默认常用,将第1个默认选中下拉框
- for (let i = 0; i < this.usualList.length; i++) {
- if (i < 5) {
- this.buttons.push(this.usualList[i])
- }
- }
- }
- this.forecastModelList = response.data.forecastModelList
- })
- },
- quickUse() {
- if (this.tableData.length == 0) {
- this.$message.warning("调控列表为空,不能操作!")
- return
- }
- this.renderUsual()
- this.quickUseOpen = true
- },
- // 点击设为常用按钮触发
- usualSet() {
- if (this.tableData.length == 0) {
- this.$message.warning("调控列表为空,不能操作!")
- return
- }
- this.usualOpen = true
- },
- // 设为常用弹出框保存按钮
- commitUsual() {
- if (this.tableData == undefined || this.tableData.length == 0) {
- this.$message.warning("请查询列表才可以设为常用!")
- return
- }
- if (this.usualForm.usualName == null || this.usualForm.usualName == '' || this.usualForm.usualName == undefined) {
- this.$message.warning("请输入常用名称!")
- return
- } else {
- let tempUsualName = this.usualForm.usualName.trim()
- if (tempUsualName == '') {
- this.$message.warning("请输入常用名称!")
- return
- }
- // 提交名称及系数配置
- const param = {
- "tempShortRegulationDtoList": this.tableData,
- "usualName": tempUsualName
- }
- this.$axios.post('/dqUsualController/saveUsual', param).then((res) => {
- this.$message.success('常用策略保存成功!')
- this.usualOpen = false
- this.resetUsual()
- }).catch((error) => {
- })
- }
- },
- // 表单重置
- resetUsual() {
- this.usualForm = {
- usualName: undefined,
- },
- this.resetForm("usualForm");
- },
- // 取消按钮
- cancelUsual() {
- this.usualOpen = false;
- this.resetUsual();
- },
- tkDialog() {
- // 判断截止时间,超出时间不允许调控
- const now = new Date();
- if (now.getTime() > new Date(this.dqEndTime)) {
- this.$message.warning("截止时间已过,不能进行调控!")
- return
- }
- if (this.tableData.length == 0) {
- this.$message.warning("调控列表为空,不能调控!")
- return
- }
- for (let i=0; i<this.tableData.length;i++){
- if (this.tableData[i].tkValue>this.capacity){
- this.$message.warning("列表中调控值存在超装机容量现象,不能调控!")
- return
- }
- }
- const date = new Date(this.dateTime); // 如果long是毫秒
- const year = date.getFullYear();
- const month = (date.getMonth() + 1).toString().padStart(2, '0');
- const day = date.getDate().toString().padStart(2, '0');
- this.tkrq = `${year}-${month}-${day}`; // 根据需要可以添加时间部分
- const item = this.stationList.find(item => item.value === this.stationCode)
- this.stationName = item ? item.label : ''
- this.tkOpen = true
- },
- tkCancel() {
- this.tkOpen = false
- },
- // 调控列表提交
- tkCommit() {
- if (this.tableData.length == 0) {
- this.$message.warning("调控列表为空,不能进行提交!")
- return
- }
- // 判断系数和数值2个字段是否有为空
- for (let i = 0; i < this.tableData.length; i++) {
- if (isNaN(this.tableData[i].tkValue)) {
- this.$message.warning(this.tableData[i].time + "存在空值,不能进行提交!")
- return
- }
- }
- // 保存调控值列表
- this.$axios.post('/dqRegulationController/updateDqRegulation', this.tableData).then((res) => {
- this.$message.success('调控功率保存成功!')
- // this.dataQuery()
- }).catch((error) => {
- })
- this.tkOpen = false
- },
- //通过表格内系数或固定值修改 生成曲线以及最终预测结果
- setValueByManual(row, index) {
- if (row.xs !== undefined && row.sz !== undefined) {
- // 计算调控值
- row.tkValue = parseFloat((parseFloat(row.ysValue) * parseFloat(row.xs) + parseFloat(row.sz)).toFixed(2))
- if (row.tkValue < 0) {
- row.tkValue = 0
- }
- if (row.tkValue > this.capacity) {
- row.tkValue = this.capacity
- }
- // 赋值给表格
- this.tableData[index] = row
- // 遍历tableData封装调控曲线数组
- let tkArray = new Array()
- for (var i = 0; i < this.tableData.length; i++) {
- let array = new Array()
- array.push(this.tableData[i].time)
- array.push(this.tableData[i].tkValue)
- tkArray.push(array)
- }
- this.tkData = tkArray
- this.chartOption.series[1].data = this.tkData
- this.chart.setOption(this.chartOption)
- //再调用updatePosition
- this.updatePosition()
- }
- },
- async dataQuery() {
- this.loading = true
- let queryParams = {
- "stationCode": this.stationCode,
- "time": Math.round(this.dateTime),
- }
- await this.$axios.get('/dqRegulationController/queryData', {params: queryParams}).then(response => {
- this.chart.clear()
- this.capacity = response.data.electricField.capacity
- this.tableData = response.data.tempShortRegulationList
- this.ysData = response.data.ysData
- this.refUpData = response.data.refUpData
- this.refDownData = response.data.refDownData
- this.tkData = response.data.tkDataList
- this.draData()
- this.loading = false
- }).catch(() => {
- this.tableData = []
- this.ysData = []
- this.refUpData = []
- this.refDownData = []
- this.tkData = []
- this.chart.clear()
- this.chartOption.series[0].data = this.ysData
- this.chartOption.series[1].data = this.tkData
- this.chartOption.series[2].data = this.refUpData
- this.chartOption.series[3].data = this.refDownData
- this.chart.setOption(this.chartOption)
- this.loading = false
- });
- this.getDqEndTime()
- },
- draData() {
- let this1 = this;
- this.chartOption.series[0].data = this.ysData
- this.chartOption.series[1].data = this.tkData
- this.chartOption.series[2].data = this.refUpData
- this.chartOption.series[3].data = this.refDownData
- let myChart = this.chart
- let cap = this.capacity
- setTimeout(function () {
- myChart.setOption({
- graphic: this1.tkData.map(function (item, dataIndex) {
- return {
- type: 'circle',
- position: myChart.convertToPixel('grid', item),
- shape: {
- cx: 0,
- cy: 0,
- r: 10
- },
- invisible: true,
- draggable: true,
- ondrag: function (dx, dy,) {
- this1.onPointDragging(dataIndex, [item[0], dx.offsetY], cap);
- },
- onmousemove: function () {
- this1.showTooltip(dataIndex);
- },
- onmouseout: function () {
- this1.hideTooltip(dataIndex);
- },
- z: 100
- };
- })
- });
- }, 0);
- // window.addEventListener('resize', this1.updatePosition);
- myChart.on('dataZoom', this1.updatePosition);
- // 拖动曲线后,将数值重新赋值给表格
- this.chartOption.yAxis[0].max = this.capacity
- myChart.setOption(this.chartOption)
- },
- updatePosition() {
- let this1 = this;
- let myChart = this.chart
- myChart.setOption({
- graphic: this1.tkData.map(function (item, dataIndex) {
- return {
- position: myChart.convertToPixel('grid', item)
- };
- })
- });
- },
- showTooltip(dataIndex) {
- let myChart = this.chart
- myChart.dispatchAction({
- type: 'showTip',
- seriesIndex: 0,
- dataIndex: dataIndex
- });
- },
- hideTooltip(dataIndex) {
- let myChart = this.chart
- myChart.dispatchAction({
- type: 'hideTip'
- });
- },
- onPointDragging(dataIndex, pos, capacity) {
- let this1 = this;
- let myChart = this.chart
- this1.tkData[dataIndex][1] = myChart.convertFromPixel('grid', pos)[1].toFixed(2);
- if (myChart.convertFromPixel('grid', pos)[1].toFixed(2) > capacity) {
- this1.tkData[dataIndex][1] = capacity
- }
- if (myChart.convertFromPixel('grid', pos)[1].toFixed(2) < 0) {
- this1.tkData[dataIndex][1] = 0
- }
- // 赋值调控值字段
- this1.tableData[dataIndex].tkValue = this1.tkData[dataIndex][1]
- // 根据调控值更新表格中数值字段,数值=调控值-(原始值*系数)
- this1.tableData[dataIndex].sz = (this1.tkData[dataIndex][1] - (this1.tableData[dataIndex].ysValue * this1.tableData[dataIndex].xs)).toFixed(2)
- myChart.setOption(this.chartOption)
- // Update data
- myChart.setOption({
- series: [
- {
- id: 'a',
- data: this1.tkData,
- }
- ]
- });
- this.updatePosition()
- },
- // 获取短期截止时间
- async getDqEndTime() {
- await this.$axios({url: '/dqRegulationController/getDqEndTime', method: 'get'}).then(response => {
- this.dqEndTime = response.data
- })
- },
- getStationCode() {
- this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
- this.stationList = response.data
- if (this.stationList.length > 0) {
- this.stationCode = this.stationList[0].value
- this.dataQuery()
- }
- })
- },
- initChart() {
- for (let i = 0; i < 24 * 60; i += 15) {
- let hours = Math.floor(i / 60);
- let minutes = i % 60;
- this.hoursArray.push(`${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`);
- }
- this.chartOption.xAxis[0].data = this.hoursArray
- this.chart = echarts.init(document.getElementById('tkcharts'), 'dark')
- this.chart.setOption(this.chartOption)
- },
- }
- }
- </script>
- <style scoped>
- .divDescribe {
- position: relative;
- top: 20px; /* 向下移动15px */
- width: 100%;
- text-align: center
- }
- .divDescribeBtn {
- position: relative;
- top: 25px; /* 向下移动15px */
- width: 100%;
- text-align: right
- }
- .divTable {
- position: relative;
- top: 30px; /* 向下移动15px */
- width: 100%;
- text-align: center
- }
- .tkBtn {
- position: relative;
- top: 50px; /* 向下移动15px */
- width: 100%;
- text-align: center
- }
- .dialog-text-title {
- font-size: 16px;
- font-weight: bold;
- }
- .reg-config-container {
- height: 100%;
- }
- .reg-config-con {
- width: 50%;
- position: relative;
- }
- .reg-config {
- margin-top: 5px;
- }
- .reg-config-radio {
- width: 150px;
- }
- .reg-config-btu {
- width: 215px;
- //height: 190px; margin-top: 5px;
- }
- .reg-dialog-footer {
- position: absolute;
- bottom: 0;
- left: 35%;
- //text-align: center;
- }
- /deep/ .reg-config-btu .el-button:first-child {
- margin-top: 5px;
- }
- /deep/ .reg-config-btu .el-button {
- margin-top: 10px;
- }
- /deep/ .reg-config-btu .el-button:last-child {
- margin-bottom: 10px;
- }
- /deep/ .reg-config-btu .el-button + .el-button {
- margin-left: 0px;
- }
- </style>
|