PerformanceDataQuery.vue 29 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859
<template>
  <div id="main" class="h-all">
    <el-container class="h-all">
      <el-header height="auto">
        <!-- 条件查询工具栏 -->
        <div class="header-search">
          <div class="search-input-box">
            <label>{{$t("Performance.startTime") + ':'}}</label>
            <el-date-picker
              v-model="beginTimestamp"
              type="datetime"
              size="mini"
              format="yyyy-MM-dd HH:mm"
              :clearable="false"
              align="center"
              :picker-options="startDatePicker"
              @change="beginDateChange"
              :placeholder="$t('Performance.startTimePlaceholder')">
            </el-date-picker>
          </div>
          <div class="search-input-box">
            <label>{{$t("Performance.endTime") + ':'}}</label>
            <el-date-picker
              v-model="endTimestamp"
              type="datetime"
              size="mini"
              format="yyyy-MM-dd HH:mm"
              :clearable="false"
              align="center"
              :picker-options="endDatePicker"
              @change="endDateChange"
              :placeholder="$t('Performance.endTimePlaceholder')">
            </el-date-picker>
          </div>
          <div class="search-input-box">
            <label>{{$t("Performance.networkElementType") + ':'}}</label>
            <el-select v-model="deviceType"
                       size="mini"
                       :placeholder="$t('common.selectOption')"
                       @change="deviceTypeChange"
                       :clearable="true">
              <el-option
                v-for="item in deviceTypeList"
                :key="item.deviceTypeKey"
                :label="item.deviceTypeName"
                :value="item.deviceTypeKey">
              </el-option>
            </el-select>
          </div>
          <div class="search-input-box">
            <label>{{$t("Performance.deviceModel") + ':'}}</label>
            <el-select v-model="deviceModel"
                       size="mini"
                       @change="deviceModelChange"
                       :placeholder="$t('common.selectOption')"
                       :clearable="true">
              <el-option v-for="item in deviceModelList"
                         :key="item.deviceModelKey"
                         :label="item.deviceModel"
                         :value="item.deviceModel">
              </el-option>
            </el-select>
          </div>
          <div class="search-input-box">
            <label>{{$t("Performance.networkElementName") + ':'}}</label>
            <el-select v-model="queryDeviceList" size="mini" :placeholder="$t('common.selectOption')"
                       :disabled="queryDeviceShow" :clearable="true">
              <el-option
                v-for="item in deviceList"
                :key="item.deviceKey"
                :label="item.displayName"
                :value="item.deviceKey">
              </el-option>
            </el-select>
          </div>
          <div class="search-input-box">
            <label>{{$t("Performance.performanceEvent") + ':'}}</label>
            <el-select v-model="queryPerformType" size="mini" :placeholder="$t('common.selectOption')" :clearable="true">
              <el-option
                v-for="item in performTypeList"
                :key="item.deviceParam"
                :label="item.peformTypeName"
                :value="item.deviceParam">
              </el-option>
            </el-select>
          </div>
          <div class="search-input-box">
            <label>{{$t("Performance.subnet") + ':'}}</label>
            <el-select v-model="querySubnet" size="mini" :placeholder="$t('common.selectOption')" :clearable="true">
              <el-option
                v-for="item in subnetList"
                :key="item.subnetKey"
                :label="item.subnetName"
                :value="item.subnetKey">
              </el-option>
            </el-select>
          </div>
          <div class="search-input-box">
            <el-button size='mini' icon="el-icon-search" type="primary" @click="queryPerformDataByCondition">{{$t("common.queryBtn")}}</el-button>
<!--            <el-button size='mini' icon="el-icon-download" type="success" @click="exportToExcelInit">{{$t("common.exportBtn")}}</el-button>-->
            <el-button size='mini' icon="el-icon-download" type="success" @click="downloadInit = true">{{$t('common.exportBtn')}}
            </el-button>
          </div>
        </div>
      </el-header>
      <!-- table数据表格 -->
      <el-main class="adapt-height-box">
        <el-table
          :empty-text="$t('common.noData')"
          ref="multipleTable"
          :data="performList"
          header-row-class-name="table-header"
          cell-class-name="table-cell"
          class="adapt-height"
          stripe
          tooltip-effect="dark"
          :highlight-current-row="true"
          height="auto"
          border
          @selection-change="handleSelectionChange">
          <el-table-column
            type="index"
            :label="$t('Performance.index')"
            width="50">
          </el-table-column>
          <el-table-column
            prop="timestamp"
            :label="$t('Performance.acquisitionTime')"
            :formatter="formatDate"
            :show-overflow-tooltip="true">
          </el-table-column>
          <!--<el-table-column-->
            <!--prop="deviceParam"-->
            <!--:label="$t('Performance.performanceEvent')"-->
            <!--:show-overflow-tooltip="true">-->
          <!--</el-table-column>-->
          <el-table-column
            prop="performName"
            :label="$t('Performance.performanceEvent')"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="resourceName"
            :label="$t('Performance.resourceName')"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="displayName"
            :label="$t('Performance.networkElementName')"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="deviceTypeKey"
            :label="$t('Performance.networkElementType')"
            width="180"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="deviceModel"
            :label="$t('Performance.deviceModel')"
            width="180"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="period"
            :label="$t('Performance.monitoringPeriod') + '(min)'"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="performValue"
            :label="$t('Performance.monitoringValue')"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="unit"
            :label="$t('Performance.unit')"
            :show-overflow-tooltip="true">
          </el-table-column>
        </el-table>
        <el-pagination
          background
          @current-change="handleCurrentChange"
          :current-page.sync="currentPage"
          :page-size="pageSize"
          layout="total, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </el-main>
    </el-container>
    <el-dialog
      v-dialogDrag
      title="导出文件格式选择"
      :visible.sync="downloadInit"
      width="400px"
      height="360px"
      style="font-size: 20px; "
    >
      <div>
        <el-radio-group v-model="radio1"  size="mini">
          <el-radio label="excel表格" border>excel</el-radio>
          <el-radio label="csv" border>csv</el-radio>
        </el-radio-group>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" icon='el-icon-circle-check' @click="exportToInit" size="mini">{{$t("common.ok")}}</el-button>
        <el-button icon='el-icon-circle-close' @click="downloadCancle" size="mini">{{$t("common.cancel")}}</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import DeviceService from '../../domain/services/DeviceService'
import PerformanceMonitorService from '../../domain/services/PerformanceMonitorService'
import PerformanceDataQuaryService from '../../domain/services/PerformanceDataQuaryService'
import DeviceManager from '../../domain/models/DeviceManager'
import HelperUtil from '../../utils/HelperUtil'
import loading from "../../utils/Loading";
import SubnetService from "../../domain/services/SubnetService";
import IndexTeplateService from "../../domain/services/IndexTeplateService";

export default {
  name: 'PerformanceDataQuery',
  // 创建期间
  beforeCreate () {

  },
  // vue加载初始化函数,加载数据
  created: function () {
    this.setDefaultDateTime()
    this.getAllSubnetInit()
    this.getAllDevice()
    this.getAllPerformType()
    this.getAllDeviceModel()
    this.getAllDeviceType()

    if (this.$route.params.performList != null) {
      // this.TurnFromCollectTask(this.$route.query.collectTask)
      this.performList = this.$route.params.performList
      this.total = this.performList.length
    }
    if (this.$route.query.performTemplateName == null) {
      // this.getAllIndexTemplate()
    }
  },

  // 存放数据
  data: function () {
    return {
      deviceKeyShow: true,
      downloadInit: false,
      radio1: 'excel表格',

      // 日期控件
      beginTimestamp: '', // 开始时间
      endTimestamp: '', // 结束时间
      addBeginTimestamp: '00.000', // 查询开始时间默认添加
      addEndTimestamp: '59.999', // 查询结束时间默认添加
      startDatePicker: this.beginDate(),
      endDatePicker: this.endDate(),

      // 查询条件控件
      queryDeviceOptions: [], // 设备名称
      queryDeviceShow: false, // 设备名称选择器是否禁用
      deviceKey: '', // 设备ID(对应设备名称)(下拉列表)
      deviceTypeKey: '',
      deviceParam: '',
      deviceCollection: {}, // 设备collection

      performTypeList: [],
      performTypeList1: [], // 全部性能事件
      performTypeCollection: {},
      queryPerformTypeOptions: [], // 性能事件选项
      deviceType: '',
      deviceModel: '',
      queryDeviceList: '',
      queryPerformType: '',
      querySubnet: '',
      // 双向绑定展示数据
      performList: [],
      subnetList: [],
      // 查询条件List
      selectList: [],
      deviceList: [],
      deviceList0: [], // 设备列表
      deviceTypeList: [],
      deviceModelList: [],
      deviceModelList0: [],
      deviceModelList1: [],

      // 多选分页控制
      multipleSelection: [],
      beginItem: 1,
      endItem: 100,
      total: 0,
      currentPage: 1,
      pageSize: 100
    }
  },
  methods: {
    /**
     * @Description  : TurnFromCOlectTask
     * @author       : ls
     * @date         : 2021/3/29 16:26
     * @param        :
     * @return       :
     */
    TurnFromCollectTask: function (val) {
      let _this = this
      PerformanceDataQuaryService.queryPerformTaskData(val).then(result => {
        _this.performList = Object.values(result)
        if (_this.performList.length === 0) {
          this.InfoTip.warningTip(_this, HelperUtil.getCheckStatusCodeObjectByCode(_this.successCode.QUERY_NULL_CODE))
        } else {
          this.InfoTip.successTip(_this, HelperUtil.getStatusCodeObjectByCode(_this.successCode.QUERY_CODE))
        }
      }).catch(err => {
        this.InfoTip.errorTip(_this, err)
      })
    },
    /**
     * @Description  : exportToInit
     * @author       : ls
     * @date         : 2021/3/29 16:25
     * @param        :
     * @return       :
     */
    exportToInit: function () {
      switch (this.radio1) {
        case 'excel表格':
          this.exportToExcel()
          break
        case 'csv':
          this.exportToCsv()
          break
        default:
          this.exportToExcel()
      }
    },

    // 导出格式为excel
    exportToExcel: function () {
      this.downloadInit = false
      let _this = this
      this.setQuerySelectList()
      let loadingInstance = _this.Loading.openLoading()
      PerformanceDataQuaryService.exportToExcel(this.selectList).then(result => {
        // 成功
        this.radio1 = 'excel表格'
        _this.Loading.closeLoading(loadingInstance)
      }).catch(err => {
        // 失败
        _this.Loading.closeLoading(loadingInstance)
        _this.InfoTip.errorTip(_this, err)
      })
    },

    // 导出格式为csv
    exportToCsv: function () {
      this.downloadInit = false
      let _this = this
      this.setQuerySelectList()
      let loadingInstance = _this.Loading.openLoading()
      PerformanceDataQuaryService.downloadPerformCsv(this.selectList).then(result => {
        // 成功
        this.radio1 = 'excel表格'
        _this.Loading.closeLoading(loadingInstance)
      }).catch(err => {
        // 失败
        _this.Loading.closeLoading(loadingInstance)
        _this.InfoTip.errorTip(_this, err)
      })
    },

    downloadCancle: function () {
      this.downloadInit = false
      this.radio1 = 'excel表格'
    },

    /***
       * @Description  : 检测时间合法
       * @author       : zf
       * @date         : 2019/1/21 13:37
       */
    // 设置禁止选择当前日期之后的时间,且开始时间小于结束时间
    beginDate: function () {
      let self = this
      return {
        disabledDate (time) {
          return time.getTime() > self.endTimestamp.getTime() || time.getTime() > Date.now()
        }
      }
    },
    // 结束时间必须大于开始时间
    endDate: function () {
      let self = this
      return {
        disabledDate (time) {
          return time.getTime() < (self.beginTimestamp.getTime() - 1000 * 3600 * 24) || time.getTime() > Date.now()
        }
      }
    },
    // 开始时间被清空后重新赋值
    beginDateChange: function () {
      const setTimes = new Date()
      if (this.beginTimestamp === null) {
        setTimes.setTime(this.endTimestamp.getTime() - (60 * 60 * 1000))
        this.beginTimestamp = setTimes
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.START_TIME_EMPTY_CODE))
      }
      if (this.beginTimestamp > this.endTimestamp) {
        setTimes.setTime(this.endTimestamp.getTime() - (60 * 60 * 1000))
        this.beginTimestamp = setTimes
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.START_END_TIME_CODE))
      }
      // if ((this.endTimestamp.getTime() - this.beginTimestamp.getTime()) > 24 * 60 * 60 * 1000) {
      //   setTimes.setTime(this.beginTimestamp.getTime() + (24 * 60 * 60 * 1000));
      //   this.endTimestamp = setTimes;
      //   this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PERIOD_TIME_CODE))
      // }
    },
    // 结束时间被清空后重新赋值
    endDateChange: function () {
      const setTimes = new Date()
      const curTimes = new Date()
      if (this.endTimestamp === null) {
        if ((this.beginTimestamp.getTime() + (60 * 60 * 1000)) > curTimes.getTime()) {
          this.endTimestamp = curTimes
        } else {
          setTimes.setTime(this.beginTimestamp.getTime() + (60 * 60 * 1000))
          this.endTimestamp = setTimes
        }
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.END_TIME_EMPTY_CODE))
      }
      if (this.endTimestamp < this.beginTimestamp) {
        if ((this.beginTimestamp.getTime() + (60 * 60 * 1000)) > curTimes.getTime()) {
          this.endTimestamp = curTimes
        } else {
          setTimes.setTime(this.beginTimestamp.getTime() + (60 * 60 * 1000))
          this.endTimestamp = setTimes
        }
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.START_END_TIME_CODE))
      }
      if (this.endTimestamp > curTimes) {
        if ((this.beginTimestamp.getTime() + (60 * 60 * 1000)) > curTimes.getTime()) {
          this.endTimestamp = curTimes
        } else {
          setTimes.setTime(this.beginTimestamp.getTime() + (60 * 60 * 1000))
          this.endTimestamp = setTimes
        }
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.END_TIME_CURRENT_CODE))
      }
      // if ((this.endTimestamp.getTime() - this.beginTimestamp.getTime()) >  24 * 3600 * 1000) {
      //   setTimes.setTime(this.endTimestamp.getTime() - (24 * 60 * 60 * 1000));
      //   this.beginTimestamp = setTimes;
      //   this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PERIOD_TIME_CODE))
      // }
    },
    /**
     * @Description  : 格式化日期
     * @author       : ls
     * @date         : 2020/6/24 16:28
     * @param        :
     * @return       :
     */
    formatDate: function (row) {
      return HelperUtil.timeTran(row.timestamp)
    },

    /* ---------------------------初始化页面数据--------------------------- */

    /***
       * @Description  : 获取默认时间
       * @author       : zf
       * @date         : 2019/1/4 11:32
       */
    setDefaultDateTime: function () {
      const start = new Date()
      const end = new Date()
      start.setTime(start.getTime() - 3600 * 1000)
      this.beginTimestamp = start
      this.endTimestamp = end
    },
    /**
     * @Description  : deviceTypeChange
     * @author       : ls
     * @date         : 2020/11/17 23:48
     * @param        :
     * @return       :
     */
    deviceTypeChange: function () {
      var a = HelperUtil.deviceTypeChangeDevice(this.deviceModelList1, this.deviceType, this.deviceModel, this.deviceList0)
      this.deviceModelList = a[0]
      this.deviceModel = a[1]
      this.queryDeviceList = ''
      this.deviceList = []
      this.deviceList = a[2]


      // this.deviceModel = ''
      // this.queryDeviceName = ''
      // this.deviceModelList = []
      // this.deviceList = []
      // for (let j in this.deviceModelList0) {
      //   if (this.deviceType === null) {
      //     this.deviceModelList.push(this.deviceModelList0[j])
      //   } else {
      //     if (this.deviceModelList0[j]['deviceTypeKey'] === this.deviceType) {
      //       this.deviceModelList.push(this.deviceModelList0[j])
      //     }
      //   }
      // }
      // for (let i in this.deviceList0) {
      //   if (this.deviceType === null) {
      //     this.deviceList.push(this.deviceList0[i])
      //   } else {
      //     if (this.deviceType === this.deviceList0[i].deviceTypeKey) {
      //       this.deviceList.push(this.deviceList0[i])
      //     }
      //   }
      // }
    },
    /**
     * @Description  : deviceModelChange
     * @author       : ls
     * @date         : 2020/11/17 23:48
     * @param        :
     * @return       :
     */
    deviceModelChange: function () {
      this.queryDeviceList = ''
      this.deviceList = []
      this.deviceList = HelperUtil.deviceModelChange(this.deviceType, this.deviceModel, this.deviceList0)

      //
      // this.queryDeviceName = ''
      // this.deviceList = []
      // for (let k in this.deviceList0) {
      //   if (this.deviceModel === null) {
      //     if (this.deviceType === null) {
      //       this.deviceList.push(this.deviceList0[k])
      //     }
      //   } else {
      //     if (this.deviceModel === this.deviceList0[k]['deviceModel']) {
      //       if (this.deviceType === null) {
      //         this.deviceList.push(this.deviceList0[k])
      //       } else {
      //         if (this.deviceType === this.deviceList0[k]['deviceTypeKey']) {
      //           this.deviceList.push(this.deviceList0[k])
      //         }
      //       }
      //     }
      //   }
      // }
    },
    /**
     * @Description  : getAllDeviceType
     * @author       : ls
     * @date         : 2020/11/18 0:46
     * @param        :
     * @return       :
     */
    getAllDeviceType: function () {
      let _this = this
      DeviceService.getAllDeviceTypeCollection().then(result => {
        _this.deviceTypeList = Object.values(result)
      }).catch(err => {
        _this.InfoTip.errorTip(_this, err)
      })
    },
    /**
     * @description   : 获取子网
     * @author        : ls
     * @date          : 2020/6/22 20:52
     * @param         :
     * @return        :
     **/
    getAllSubnetInit: function () {
      let _this = this
      let loadingInstance = loading.openLoading()
      SubnetService.getAllSubnetCollection().then(result => {
        _this.subnetList = Object.values(result)
        loadingInstance.close()
      }).catch(err => {
        this.InfoTip.errorTip(this, err)
        loadingInstance.close()
      })
    },
    /***
       * @Description  : 设备/服务器下拉列表
       * @author       : zf
       * @date         : 2018/12/24 11:29
       */
    getAllDevice: function () {
      let _this = this
      this.deviceList0 = []
      DeviceService.getAllDeviceCollection().then(result => {
        // 成功
        _this.deviceCollection = result
        _this.deviceList = Object.values(result) // 新加字段,用于formatter查询数据表格
        let DevMgr = DeviceManager(_this.deviceCollection)
        _this.queryDeviceOptions = Object.values(DevMgr.getInUsingDeviceList())
        _this.deviceList0 = Object.values(DevMgr.getInUsingDeviceList())
        // _this.getAllDeviceModelListSelf()
      }).catch(err => {
        // 失败
        _this.InfoTip.errorTip(_this, err)
      })
    },
    /**
     * @Description  : getAllDeviceModelListSelf
     * @author       : ls
     * @date         : 2020/11/18 0:42
     * @param        :
     * @return       :
     */
    getAllDeviceModelListSelf: function () {
      for (let key in this.deviceList0) {
        let containIs = false
        for (let i in this.deviceModelList) {
          if (this.deviceList0[key].deviceModel === this.deviceModelList[i].value) {
            containIs = true
            break
          }
        }
        if (containIs === false && this.deviceList0[key].deviceModel !== '') {
          let device = {}
          device.key = key
          device.deviceTypeKey = this.deviceList0[key].deviceTypeKey
          device.label = this.deviceList0[key].deviceModel
          device.value = this.deviceList0[key].deviceModel
          this.deviceModelList.push(device)
          this.deviceModelList0.push(device)
        }
      }
    },
    /**
     * @Description  : 获取性能
     * @author       : ls
     * @date         : 2020/6/24 14:35
     * @param        :
     * @return       :
     */
    getAllPerformType: function () {
      let _this = this
      PerformanceMonitorService.getAllPerformanceTypeCollection().then(result => {
        // 成功
        _this.performTypeList = Object.values(result)
      }).catch(err => {
        // 失败
        _this.InfoTip.errorTip(_this, err)
      })
    },
    /**
     * @Description  : 获取型号
     * @author       : ls
     * @date         : 2020/6/24 14:34
     * @param        :
     * @return       :
     */
    getAllDeviceModel: function () {
      let _this = this
      DeviceService.getAllDeviceModelCollection().then(result => {
        _this.deviceModelList = Object.values(result)
        _this.deviceModelList1 = Object.values(result)
      }).catch(err => {
        _this.InfoTip.errorTip(_this, err)
      })
    },

    /* ---------------------------查询功能实现--------------------------- */

    /***
       * @Description  : 获取查询条件列表
       * @author       : zf
       * @date         : 2019/1/4 11:29
       */
    setQuerySelectList: function () {
      this.selectList = []
      if (this.beginTimestamp !== '' && this.beginTimestamp !== null) {
        this.selectList.push({
          quaryAttribute: 'timestamp',
          compareSymbol: '>=',
          compareValue: HelperUtil.getTimeInit(this.beginTimestamp) + this.addBeginTimestamp
        })
      }
      if (this.endTimestamp !== '' && this.endTimestamp !== null) {
        this.selectList.push({
          quaryAttribute: 'timestamp',
          compareSymbol: '<=',
          compareValue: HelperUtil.getTimeInit(this.endTimestamp) + this.addEndTimestamp
        })
      }
      if (this.queryDeviceList !== '' && this.queryDeviceList !== null) {
        this.selectList.push({
          quaryAttribute: 'deviceKey',
          compareSymbol: '=',
          compareValue: this.queryDeviceList
        })
      }
      if (this.queryPerformType !== '' && this.queryPerformType !== null) {
        this.selectList.push({
          quaryAttribute: 'deviceParam',
          compareSymbol: '=',
          compareValue: this.queryPerformType
        })
      }
      if (this.deviceType !== '' && this.deviceType !== null) {
        this.selectList.push({
          quaryAttribute: 'deviceTypeKey',
          compareSymbol: '=',
          compareValue: this.deviceType
        })
      }
      if (this.deviceModel !== '' && this.deviceModel !== null) {
        this.selectList.push({
          quaryAttribute: 'deviceModel',
          compareSymbol: '=',
          compareValue: this.deviceModel
        })
      }
      if (this.querySubnet !== '' && this.querySubnet !== null) {
        this.selectList.push({
          quaryAttribute: 'subnetKey',
          compareSymbol: '=',
          compareValue: this.querySubnet
        })
      }
    },
    /**
     * @Description  : 变化
     * @author       : ls
     * @date         : 2020/6/24 10:57
     * @param        :
     * @return       :
     */
    handleCurrentChange (val) {
      this.currentPage = val
      this.beginItem = ((val - 1) * 100) + 1
      this.endItem = this.beginItem + 99
      if (this.endItem > this.total) {
        this.endItem = this.total
      }
      this.queryPerformDataByConditionCurrentPage()
    },

    /***
       * @Description  : 点击查询按钮事件
       * @author       : zf
       * @date         : 2018/12/13 16:37
       */
    queryPerformDataByCondition: function () {
      this.beginItem = 1
      this.performList = []
      // this.nodeTypeDefineTable();
      this.setQuerySelectList()
      this.queryPerformDataTotalNumber()
    },

    /***
       * @Description  : 按条件查询性能数据总条数
       * @author       : zf
       * @date         : 2018/12/13 16:37
       */
    queryPerformDataTotalNumber: function () {
      let _this = this
      let loadingInstance = _this.Loading.openLoading()
      PerformanceDataQuaryService.queryPerformDataTotalNumber(this.selectList).then(result => {
        // 成功
        _this.Loading.closeLoading(loadingInstance)
        _this.total = result
        if (_this.total === 0 || _this.total < 0) {
          _this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.QUERY_NULL_CODE))
        } else {
          if (_this.total < 100 && _this.total > 0) {
            _this.endItem = _this.total
          } else {
            _this.endItem = 100
          }
        }
        _this.queryPerformDataByConditionCurrentPage()
      }).catch(err => {
        // 失败
        _this.endItem = 100
        _this.Loading.closeLoading(loadingInstance)
        _this.InfoTip.errorTip(_this, err)
      })
    },

    /***
       * @Description  : 获取当前分页性能列表
       * @author       : zf
       * @date         : 2018/12/20 20:17
       */
    queryPerformDataByConditionCurrentPage: function () {
      let _this = this
      let loadingInstance = _this.Loading.openLoading()
      PerformanceDataQuaryService.queryPerformDataSplitNumber(this.beginItem, this.endItem, this.selectList).then(result => {
        // 成功
        _this.performList = Object.values(result)
        _this.Loading.closeLoading(loadingInstance)
      }).catch(err => {
        // 失败
        _this.Loading.closeLoading(loadingInstance)
        _this.InfoTip.errorTip(_this, err)
      })
    },

    /* ---------------------------导出功能实现--------------------------- */

    /**
       * @Description  :导出文件
       */
    exportToExcelInit: function () {
      this.setQuerySelectList()
      let _this = this
      let loadingInstance = _this.Loading.openLoading()
      PerformanceDataQuaryService.exportToExcel(this.selectList).then(result => {
        // 成功
        _this.Loading.closeLoading(loadingInstance)
      }).catch(err => {
        // 失败
        _this.Loading.closeLoading(loadingInstance)
        _this.InfoTip.errorTip(_this, err)
      })
    },

    /* ---------------------------留用--------------------------- */

    /***
       * @Description  : 多选框变化:未用
       * @author       : zf
       * @date         : 2019/1/4 11:33
       */
    handleSelectionChange (val) {
      this.multipleSelection = val
    }
  },

  computed: {},

  watch: {
    '$route' (to) {
      if (to.name === '性能查询' && to.params.performList !== undefined) {
        this.queryIndexTemplateName = to.query.collectTask
        // this.performList = this.$route.query.collectTask
        this.performList = this.$route.params.performList
        this.total = this.performList.length
      }
    },
    '$i18n.locale' () {

    }
  }
}
</script>

<style scoped>
</style>