Ver Fonte

短期调控列表查询和曲线拖动

xusl há 6 meses atrás
pai
commit
2792b8943c

+ 121 - 7
cpp-admin/src/main/java/com/cpp/web/controller/regulation/DqRegulationController.java

@@ -1,17 +1,32 @@
 package com.cpp.web.controller.regulation;
 
+import cn.hutool.core.date.DatePattern;
+import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.cpp.common.core.domain.R;
+import com.cpp.common.utils.DateUtils;
+import com.cpp.web.domain.accuracy.AccuracyPassRate;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.enums.ForecastTypeEnum;
+import com.cpp.web.domain.regulation.TempShortRegulation;
+import com.cpp.web.domain.station.ElectricField;
 import com.cpp.web.domain.station.ForecastPowerShortTermStation;
 import com.cpp.web.domain.station.WeatherStationStatusData;
+import com.cpp.web.dto.TempShortRegulationDto;
+import com.cpp.web.service.accuracy.AccuracyPassRateService;
+import com.cpp.web.service.regulation.TempShortRegulationService;
+import com.cpp.web.service.station.ElectricFieldService;
 import com.cpp.web.service.station.ForecastPowerShortTermStationService;
 import com.cpp.web.utils.DateTimeUtil;
 import lombok.RequiredArgsConstructor;
+import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 
@@ -27,24 +42,123 @@ import java.util.*;
 public class DqRegulationController {
     @Autowired
     ForecastPowerShortTermStationService forecastPowerShortTermStationService;
+    @Autowired
+    AccuracyPassRateService accuracyPassRateService;
+    @Autowired
+    TempShortRegulationService tempShortRegulationService;
+    @Autowired
+    ElectricFieldService electricFieldService;
 
 
     @GetMapping("/queryData")
     public R queryData(String stationCode, Long time) {
         int howLongAgo = DateTimeUtil.getDaysBetweenTwoDate(System.currentTimeMillis(),time);
         // 获取要调整的短期那天的最后时间
-        long eneTime = DateTimeUtil.getDayLastTime(time).getTime();
+        long endTime = DateTimeUtil.getDayLastTime(time).getTime();
 
         // 获取短期上报数据(原始数据)
         Map<String, Object> map = new HashMap<>();
-        List<ForecastPowerShortTermStation> forecastPowerShortTermStationList = forecastPowerShortTermStationService.findByForecastTimeBetweenAndForecastHowLongAgoAndStationCode(time, eneTime, howLongAgo, stationCode);
+        List<ForecastPowerShortTermStation> forecastPowerShortTermStationList = forecastPowerShortTermStationService.findByForecastTimeBetweenAndForecastHowLongAgoAndStationCode(time, endTime, howLongAgo, stationCode);
         if (forecastPowerShortTermStationList.size()>0){
-            forecastPowerShortTermStationList.sort(Comparator.comparing(ForecastPowerShortTermStation::getTime));
-            List list  = new ArrayList();
-            for (ForecastPowerShortTermStation forecastPowerShortTermStation:forecastPowerShortTermStationList){
-                list.add(forecastPowerShortTermStation.getFpValue());
+            Map<Long, BigDecimal> ysShortMap = new HashMap<>();
+            for (ForecastPowerShortTermStation forecastPowerShortTermStation:forecastPowerShortTermStationList) {
+                ysShortMap.putIfAbsent(forecastPowerShortTermStation.getTime().getTime(), forecastPowerShortTermStation.getFpValue());
             }
-            map.put("ysData",list);
+            // 获取前30天的准确率生成参考值
+            Date accuracyEndDate = DateUtil.offsetDay(new Date(), -1);
+            Date accuracyStartDate = DateUtil.offsetDay(new Date(), -30);
+
+            List<AccuracyPassRate> accuracyPassRateList = accuracyPassRateService.findByTimeBetweenAndForecastTypeAndDataSourcesAndAgoAndForecastModelAndStationCode(DateTimeUtil.getDayStartTime(accuracyStartDate.getTime()), DateTimeUtil.getDayLastTime(accuracyEndDate.getTime()), ForecastTypeEnum.dq, DataSourcesEnum.E1, howLongAgo, null, stationCode);
+            double accuracySum = 0;
+            if (accuracyPassRateList.size()>0){
+                for (AccuracyPassRate accuracyPassRate:accuracyPassRateList){
+                    accuracySum = accuracySum + Double.parseDouble(accuracyPassRate.getAccuracy().replaceAll("%", ""));
+                }
+                // 计算获取偏差率
+                accuracySum = 100 - accuracySum / accuracyPassRateList.size();
+            }
+            // 获取调控数据
+            QueryWrapper<TempShortRegulation> tempShortRegulationQueryWrapper = new QueryWrapper<>();
+            tempShortRegulationQueryWrapper.eq("station_code", stationCode);
+            tempShortRegulationQueryWrapper.eq("tk_date", new Date(time));
+            tempShortRegulationQueryWrapper.between("time", new Date(time), new Date(endTime));
+            List<TempShortRegulation> tempShortRegulationList = tempShortRegulationService.list(tempShortRegulationQueryWrapper);
+            List<TempShortRegulationDto> tempList = new ArrayList<>();
+            if (tempShortRegulationList.size()==96){
+                for (TempShortRegulation tempShortRegulation:tempShortRegulationList){
+                    TempShortRegulationDto tempShortRegulationDto = new TempShortRegulationDto();
+                    tempShortRegulationDto.setTime(DateUtils.parseDateToStr("HH:mm",tempShortRegulation.getTime()));
+                    tempShortRegulationDto.setTkDate(tempShortRegulation.getTkDate());
+                    tempShortRegulationDto.setYsValue(tempShortRegulation.getYsValue());
+                    tempShortRegulationDto.setTkValue(tempShortRegulation.getTkValue());
+                    tempShortRegulationDto.setSz(tempShortRegulation.getSz());
+                    tempShortRegulationDto.setXs(tempShortRegulation.getXs());
+                    tempList.add(tempShortRegulationDto);
+                }
+            }
+            // 调控数据
+            List<List<Object>> tkDataList = new ArrayList<>();
+            // 原始短期数据
+            List<BigDecimal> ysList = new ArrayList<>();
+            // 参考上限短期
+            List<BigDecimal> refUpList = new ArrayList<>();
+            // 参考下限短期
+            List<BigDecimal> refDownList = new ArrayList<>();
+            ElectricField electricField = electricFieldService.findByStationCode(stationCode);
+            Long momentTime = 15 * 60 * 1000L;
+            for (Long tempTime = time; tempTime <= endTime; tempTime = tempTime + momentTime) {
+                List<Object> listAfter = new ArrayList<>();
+                listAfter.add(DateUtils.parseDateToStr("HH:mm",new Date(tempTime)));
+                listAfter.add(ysShortMap.get(tempTime));
+                tkDataList.add(listAfter);
+
+                if (ysShortMap.get(tempTime)!=null){
+                    ysList.add(ysShortMap.get(tempTime));
+                    if (accuracySum>0){
+                        // 计算出偏差量
+                        BigDecimal baseValue = ysShortMap.get(tempTime).multiply(new BigDecimal(accuracySum).multiply(new BigDecimal("0.01"))).setScale(2, BigDecimal.ROUND_HALF_UP);
+                        // 在原始数据基础上,生成上下限值。
+                        BigDecimal sx = ysShortMap.get(tempTime).add(baseValue).setScale(2, BigDecimal.ROUND_HALF_UP);
+                        if (sx.compareTo(electricField.getCapacity())==1){
+                            sx = electricField.getCapacity();
+                        }
+                        BigDecimal xx = ysShortMap.get(tempTime).subtract(baseValue).setScale(2, BigDecimal.ROUND_HALF_UP);
+                        if (xx.compareTo(new BigDecimal("0"))==-1){
+                            xx = new BigDecimal("0");
+                        }
+                        refUpList.add(sx);
+                        refDownList.add(xx);
+                    }
+
+                    if (tempShortRegulationList.isEmpty()){
+                        // 使用原始值
+                        TempShortRegulationDto tempShortRegulationDto = new TempShortRegulationDto();
+                        tempShortRegulationDto.setTime(DateUtils.parseDateToStr("HH:mm",new Date(tempTime)));
+                        tempShortRegulationDto.setTkDate(new Date(time));
+                        tempShortRegulationDto.setYsValue(ysShortMap.get(tempTime));
+                        tempShortRegulationDto.setTkValue(ysShortMap.get(tempTime));
+                        tempShortRegulationDto.setSz(new BigDecimal("0"));
+                        tempShortRegulationDto.setXs(new BigDecimal("1"));
+                        tempList.add(tempShortRegulationDto);
+                    }
+                }
+                else{
+                    ysList.add(null);
+                    refUpList.add(null);
+                    refDownList.add(null);
+                    listAfter.add(null);
+                }
+            }
+
+            map.put("ysData",ysList);
+            map.put("refUpData",refUpList);
+            map.put("refDownData",refDownList);
+            map.put("tempShortRegulationList",tempList);
+            map.put("tkDataList",tkDataList);
+
+
+            map.put("electricField",electricField);
+
             return R.ok(map);
         }
         else{

+ 69 - 0
cpp-admin/src/main/java/com/cpp/web/domain/regulation/TempShortRegulation.java

@@ -0,0 +1,69 @@
+package com.cpp.web.domain.regulation;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cpp.web.domain.BaseCppEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import javax.validation.constraints.Digits;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 临时短期调控
+ *
+ * @author tl
+ * @date 2024-09-23 15:28:33
+ */
+@Data
+@TableName("cpp_temp_short_regulation")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "cpp_temp_short_regulation")
+public class TempShortRegulation extends BaseCppEntity {
+
+
+    /**
+     * 预测时间
+     */
+    @ApiModelProperty(value = "预测值时间")
+    private Date time;
+
+
+    /**
+     * 原始值
+     */
+    @ApiModelProperty(value = "原始值")
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal ysValue = new BigDecimal(-99);
+
+    /**
+     * 调控值
+     */
+    @ApiModelProperty(value = "调控值")
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal tkValue = new BigDecimal(-99);
+
+
+    /**
+     * 调控日期
+     */
+    @ApiModelProperty(value = "调控日期")
+    private Date tkDate;
+
+    /**
+     * 数值
+     */
+    @ApiModelProperty(value = "数值")
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal sz = new BigDecimal(-99);
+
+    /**
+     * 系数
+     */
+    @ApiModelProperty(value = "系数")
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal xs = new BigDecimal(-99);
+}

+ 54 - 0
cpp-admin/src/main/java/com/cpp/web/dto/TempShortRegulationDto.java

@@ -0,0 +1,54 @@
+package com.cpp.web.dto;
+
+
+import lombok.Data;
+
+import javax.validation.constraints.Digits;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 临时短期调控
+ *
+ * @author tl
+ * @date 2024-09-23 15:28:33
+ */
+@Data
+public class TempShortRegulationDto{
+
+
+    /**
+     * 预测时间
+     */
+    private String time;
+
+    /**
+     * 原始值
+     */
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal ysValue = new BigDecimal(-99);
+
+    /**
+     * 调控值
+     */
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal tkValue = new BigDecimal(-99);
+
+
+    /**
+     * 调控日期
+     */
+    private Date tkDate;
+
+    /**
+     * 数值
+     */
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal sz = new BigDecimal(-99);
+
+    /**
+     * 系数
+     */
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal xs = new BigDecimal(-99);
+}

+ 17 - 0
cpp-admin/src/main/java/com/cpp/web/mapper/regulation/TempShortRegulationMapper.java

@@ -0,0 +1,17 @@
+package com.cpp.web.mapper.regulation;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cpp.web.domain.regulation.TempShortRegulation;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 临时短期调控mapper
+ *
+ * @author xsl
+ * @date 2022-05-11 09:47:21
+ */
+@Mapper
+public interface TempShortRegulationMapper extends BaseMapper<TempShortRegulation> {
+
+}

+ 14 - 0
cpp-admin/src/main/java/com/cpp/web/service/regulation/TempShortRegulationService.java

@@ -0,0 +1,14 @@
+package com.cpp.web.service.regulation;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.cpp.web.domain.regulation.TempShortRegulation;
+
+/**
+ * cpp_electric_field
+ *
+ * @author tl
+ * @date 2024-09-23 15:28:33
+ */
+public interface TempShortRegulationService extends IService<TempShortRegulation> {
+
+}

+ 21 - 0
cpp-admin/src/main/java/com/cpp/web/service/regulation/impl/TempShortRegulationServiceImpl.java

@@ -0,0 +1,21 @@
+package com.cpp.web.service.regulation.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.cpp.web.domain.regulation.TempShortRegulation;
+import com.cpp.web.mapper.regulation.TempShortRegulationMapper;
+import com.cpp.web.service.regulation.TempShortRegulationService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * cpp_electric_field
+ *
+ * @author tl
+ * @date 2024-09-23 15:28:33
+ */
+@Service
+@RequiredArgsConstructor
+public class TempShortRegulationServiceImpl extends ServiceImpl<TempShortRegulationMapper, TempShortRegulation> implements TempShortRegulationService {
+
+}

+ 223 - 29
cpp-ui/src/views/regulation/dqRegulation/index.vue

@@ -21,7 +21,9 @@
           </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-button type="primary" size="small" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">
+            查询
+          </el-button>
         </el-form-item>
       </el-form>
     </div>
@@ -40,50 +42,60 @@
 
         <div class="divTable">
           <el-table
-            :data="form"
+            :data="tableData"
             height="550px"
-            border
-            stripe
+
             size="mini"
             style="width: 100%">
             <el-table-column
-              prop="time1"
+              prop="time"
               header-align="center"
               align="center"
-              label="时间">
+              label="时间"
+            >
             </el-table-column>
             <el-table-column
               prop="xs"
               header-align="center"
               align="center"
               label="系数">
+              <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="数值">
+              <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="ys"
+              prop="ysValue"
               header-align="center"
               align="center"
               label="原始值">
             </el-table-column>
             <el-table-column
-              :show-overflow-tooltip="true"
-              prop="tk"
+              prop="tkValue"
               header-align="center"
               align="center"
-              label="调控值">
-              <template slot-scope="scope">
-                <vxe-input type="number" v-model="scope.row.data1" size="small" style="width:100%" min="0"
-                           :max="capacity" placeholder=""></vxe-input>
-              </template>
+              label="调控值"
+              :max="capacity"
+              :min="0"
+            >
             </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="tkCommit">调控功率</el-button>
+          </div>
+        </div>
 
       </el-col>
       <el-col :span="17">
@@ -103,14 +115,20 @@ export default {
   name: 'inverterinfo',
   data() {
     return {
+      symbolSize: 8,
+      capacity: '',
+      tkData: [],
+      tableData: [],
       hoursArray: [],
       chart: null,
       form: [],
       dateTime: new Date(new Date().toLocaleDateString()).getTime() + (60 * 60 * 24 * 1000),
       stationList: [],
       stationCode: '',
-      ysDataLine: [],
-      chartOption:{
+      ysData: [],
+      refUpData: [],
+      refDownData: [],
+      chartOption: {
         backgroundColor: 'transparent',
         title: {
           top: 20,
@@ -156,6 +174,7 @@ export default {
           end: 100,
           left: "15%",
           right: "15%",
+          throttle: 50
         }, {
           type: 'inside'
         }],
@@ -168,8 +187,9 @@ export default {
         },
         xAxis: [{
           type: 'category',
-          boundaryGap: false,
-          data: this.hoursArray
+          // boundaryGap: false,
+          axisLine: {onZero: false},
+          // data: this.hoursArray
         }],
         yAxis: [{
           type: 'value',
@@ -208,14 +228,15 @@ export default {
               borderWidth: 12
             }
           },
-          data: this.ysDataLine
+          data: this.ysData
         },
           {
+            id: 'a',
             name: '调控值',
             type: 'line',
             smooth: true,
             symbol: 'circle',
-            symbolSize: 5,
+            symbolSize: 10,
             showSymbol: false,
             connectNulls: true,
             lineStyle: {
@@ -241,7 +262,8 @@ export default {
             showSymbol: false,
             lineStyle: {
               normal: {
-                width: 2
+                width: 2,
+                type: 'dashed'   //设置线条类型
               }
             },
             itemStyle: {
@@ -250,7 +272,7 @@ export default {
                 borderWidth: 12
               }
             },
-            data: []
+            data: this.refUpData
           },
           {
             name: '参考值下限',
@@ -262,7 +284,8 @@ export default {
             showSymbol: false,
             lineStyle: {
               normal: {
-                width: 2
+                width: 2,
+                type: 'dashed'   //设置线条类型
               }
             },
             itemStyle: {
@@ -271,7 +294,7 @@ export default {
                 borderWidth: 12
               }
             },
-            data: []
+            data: this.refDownData
           },
         ]
       }
@@ -286,18 +309,180 @@ export default {
   },
   computed: {},
   methods: {
-    dataQuery(){
+    // 调控列表提交
+    tkCommit() {
+      if (this.tableData.length == 0) {
+        this.$message.warning("调控列表为空,不能进行提交!")
+        return
+      }
+      // 判断系数和数值2个字段是否有为空
+      for (let i = 0; i < this.tableData.length; i++) {
+        console.log(this.tableData[i].xs == '')
+        console.log(this.tableData[i].sz == '')
+        if (this.tableData[i].xs == '' || this.tableData[i].sz == '') {
+          this.$message.warning(this.tableData[i].time + "存在空值,不能进行提交!")
+          return
+        }
+      }
+
+    },
+
+    //通过表格内系数或固定值修改  生成曲线以及最终预测结果
+    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()
+      }
+    },
+    dataQuery() {
       let queryParams = {
         "stationCode": this.stationCode,
         "time": Math.round(this.dateTime),
       }
       this.$axios.get('/dqRegulationController/queryData', {params: queryParams}).then(response => {
-        this.ysDataLine = response.data.ysData
+        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.chart.clear()
-        this.chartOption.series[0].data = this.ysDataLine
+        // this.option.yAxis[0].max = this.capacity
+        this.draData()
+      }).catch(() => {
+        this.tableData = []
+        this.ysData = []
+        this.refUpData = []
+        this.refDownData = []
+        this.tkData = []
+        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)
-       })
+      });
+    },
+    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 data = this.tkData
+      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.tableData = form1
+      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)
+      // Update data
+      myChart.setOption({
+        series: [
+          {
+            id: 'a',
+            data: this1.tkData,
+          }
+        ]
+      });
+      this.updatePosition()
     },
+
+
     getStationCode() {
       this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
         this.stationList = response.data
@@ -326,16 +511,25 @@ export default {
   width: 100%;
   text-align: center
 }
+
 .divDescribeBtn {
   position: relative;
   top: 20px; /* 向下移动15px */
   width: 100%;
   text-align: right
 }
+
 .divTable {
   position: relative;
   top: 30px; /* 向下移动15px */
   width: 100%;
   text-align: center
 }
+
+.tkBtn {
+  position: relative;
+  top: 30px; /* 向下移动15px */
+  width: 100%;
+  text-align: center
+}
 </style>