whyczyk
2021-10-13 a355aafef5a635bd31a701127cea097338cee0a7
src/components/charts/monomerVoltage.vue
@@ -9,6 +9,7 @@
<script>
import * as echarts from 'echarts';
import { WebSocketClass } from '@/assets/js/socket'
import { checkboxs } from '@/assets/js/powerInfoData'
// 单体电压、内阻和温度 页面
export default {
   name: "monomerVoltage",
@@ -44,21 +45,40 @@
      }
   },
   methods: {
      toParentPage() {
         window.parent.parent.postMessage({
            cmd: "syncPage",
            params: {
               pageInfo: {
                  label: "电池实时告警",
                  name: "batteryrTimequery",
                  src: "#/batteryrTimequery",
                  closable: true
               },
            }
         }, "*");
      toParentPage(value) {
         if (typeof (value) == 'string') {
            window.parent.parent.postMessage({
               cmd: "syncPage",
               params: {
                  pageInfo: {
                     label: "电池实时告警",
                     name: "batteryrTimequery",
                     src: "#/batteryrTimequery/?alarmType=" + value,
                     closable: true
                  },
               }
            }, "*");
         }
      },
      setOption(opt) {
         this.$options.chart.setOption(opt);
         this.$options.chart.on('click', (params) => {
            console.log(params)
            let name;
            if (params.name == '单体电压高告警' || params.name == '单体电压低告警') {
               name = '单体电压';
            } else if (params.name == '单体内阻高告警' || params.name == '单体内阻低告警') {
               name = '单体内阻';
            } else if (params.name == '单体温度高告警' || params.name == '单体温度低告警') {
               name = '单体温度';
            }
            checkboxs.dcgj.map(item => {
               if (item.label == name) {
                  console.log(name)
                  this.toParentPage(item.value)
               }
            })
         })
      },
      postData() {
         let userId = localStorage.getItem('userId');