<template>
  <div :style="{height:height,width:width}">
    <el-table :data="approveData"
              :height="height"
              border>
      <el-table-column
        prop="devName"
        header-align="center"
        align="center"
        :show-overflow-tooltip="true"
        width="80"
        :label="$t('设备类型')">
      </el-table-column>
      <el-table-column
        prop="qyNum"
        header-align="center"
        align="center"
        width="80"
        :label="$t('启用')">
      </el-table-column>
      <el-table-column
        prop="tyNum"
        header-align="center"
        align="center"
        width="80"
        :label="$t('停用')">
      </el-table-column>
      <el-table-column
        prop="bfNum"
        header-align="center"
        align="center"
        width="80"
        :label="$t('报废')">
      </el-table-column>
      <el-table-column
        prop="zxNum"
        header-align="center"
        align="center"
        width="70"
        :label="$t('注销')">
      </el-table-column>
      <el-table-column
          prop="gzNum"
          header-align="center"
          align="center"
          width="70"
          :label="$t('改造')">
      </el-table-column>
<!--      <el-table-column-->
<!--        prop="yqNum"-->
<!--        header-align="center"-->
<!--        align="center"-->
<!--        width="50"-->
<!--        :label="$t('延期')">-->
<!--      </el-table-column>-->
<!--      <el-table-column-->
<!--          prop="csmNum"-->
<!--          header-align="center"-->
<!--          align="center"-->
<!--          width="80"-->
<!--          :label="$t('超设计寿命变更')">-->
<!--      </el-table-column>-->
    </el-table>
  </div>
</template>

<script>
import { listEhskpinew } from "@/api/ehs/ehskpinew";
import Cookies from 'js-cookie'
import {finishApproveData} from "@/api/sems/home";

export default {
  computed: {
    lang: {
      get() {
        return this.$store.state.app.language
      },
      set(lang) {
        this.$i18n.locale = lang
        this.$store.dispatch('app/setLanguage', lang)
      }
    }
  },
  watch: {
    '$store.state.app.language'(newLang) {
      console.log(newLang)
    }
  },
  props: {
    width: {
      type: String,
      default: '450px'
    },
    height: {
      type: String,
      default: '250px'
    }
  },
  data() {
    return {
      // 查询参数
      queryParams: {
      },
      // 表格数据
      approveData: [],
    }
  },
  created() {
    // this.getList();
    // this.lang = Cookies.get('language')
  },
  methods: {
    finishApproveData(plantIds ,unitIds ){
      let params = {
        'plants': plantIds,
        'unitIds': unitIds
      }
      finishApproveData(params).then(response => {
        this.approveData = []
        let arr = response.data
        for (let i = 0; i < arr.length; i++) {
          arr[i].devName = this.$t(arr[i].devName)
           let num = arr[i].qyNum + arr[i].tyNum + arr[i].bfNum +arr[i].zxNum + arr[i].gzNum + arr[i].csmNum + arr[i].yqNum
           if (num != 0) {
             this.approveData.push(arr[i])
           }
        }
      });
    },

  }
}
</script>

<style scoped>
  /deep/.el-table .warning-row {
    background: #ecf0fa;
  }

  /deep/.el-table .success-row {
    background: #f4fcff;
  }

  .el-table {
    background-color: #f6f6f6;
    text-align: center;
    color: #000000;
    border: 0px;
  }

  /deep/.el-table__row>td{
    border: none;
  }

  .el-table::before {
    height: 0px;
  }

  /deep/ .el-table__body-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  /deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb {
    background-color: #bcc6f5;
    border-radius: 3px;
  }
  /deep/.el-table__body-wrapper::-webkit-scrollbar-track {
    background-color: #91d8e3;
  }
</style>
