<template>
  <div class="video">
    <div class="videoTop">
      <div class="videoTopLeft">
        <el-input
          placeholder="搜索设备或编号"
          v-model="filterText"
          class="videoTopLeftInput"
        >
          <template #suffix>
            <i class="el-icon-search el-input__icon"></i>
          </template>
        </el-input>
        <!-- <el-button
          class="search-button"
          icon="el-icon-plus"
          type="success"
          @click="Insert()"
          >新增</el-button
        > -->
      </div>

      <!-- <div class="videoRight">
        <el-button type="primary">导入</el-button>
        <el-button type="primary">导出</el-button>
      </div> -->
    </div>

    <div class="videoContent">
      <el-table
        :data="
          tableData.filter(
            (data) =>
              !filterText ||
              data.manufactor
                .toLowerCase()
                .includes(filterText.toLowerCase()) ||
              data.deviceModel.toLowerCase().includes(filterText.toLowerCase())
          )
        "
        border
        stripe
        :header-cell-style="headClass"
        :height="Height"
      >
        <el-table-column
          prop="stationStatus"
          label="状态"
          align="center"
          width="50"
        >
          <template #default="scope">
            <el-avatar
              class="status"
              :style="
                scope.row.stationStatus == 0
                  ? 'background-color:red'
                  : 'background-color:#04F21C'
              "
            ></el-avatar>
          </template>
        </el-table-column>

        <el-table-column
          prop="manufactor"
          label="视频监测设备名称"
          align="center"
          width=""
        ></el-table-column>
        <el-table-column
          prop="deviceModel"
          label="设备编号"
          align="center"
          width=""
        ></el-table-column>
        <el-table-column
          prop="deviceNum"
          label="所属站点"
          align="center"
          width=""
        ></el-table-column>
        <el-table-column
          prop="deviceNum"
          label="额定电压"
          align="center"
          width=""
        ></el-table-column>
        <el-table-column
          prop="deviceNum"
          label="额定电流"
          align="center"
          width=""
        ></el-table-column>
        <el-table-column
          prop="deviceNum"
          label="设备数量"
          align="center"
          width=""
        ></el-table-column>
        <!-- <el-table-column label="操作" width="150">
          <template #default="scope">
            <el-button
              type="text"
              size="small"
              style="color: #409eff"
              @click.prevent="Update(scope.row)"
            >
              编辑
            </el-button>
            <el-button
              @click="Delete(scope.$index, scope.row)"
              type="text"
              size="small"
              style="color: red"
            >
              删除
            </el-button>
          </template>
        </el-table-column> -->
        <el-table-column label="视频画面" align="center" width="150">
          <template #default="scope" style="text-align: center">
            <el-button
              type="text"
              size="small"
              style="color: #409eff"
              @click.prevent="LookUp(scope.$index, scope.row)"
            >
              查看
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="listPagination">
        <el-pagination
          v-model:currentPage="currentPage"
          :page-sizes="[15, 20, 25, 30]"
          :page-size="15"
          layout="total, sizes, prev, pager, next, jumper"
          :total="tableData.length"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          background
        ></el-pagination>
      </div>
    </div>

    <div></div>
  </div>
</template>
<script>
import { defineComponent, ref } from 'vue'

export default defineComponent({
  name: 'powerEquip',
  components: {},
  props: {
    Height: String,
  },
  setup() {
    const filterText = ref('')
    const currentPage = ref(15)
    const activeName = 'powerEquip'
    const tableData = ref([
      {
        stationStatus: 0,
        manufactor: '上海永天科技股份有限公司',
        deviceModel: '测试设备',
        deviceNum: '8',
      },
      {
        stationStatus: 1,
        manufactor: '上海永天科技股份有限公司',
        deviceModel: '测试设备',
        deviceNum: '8',
      },
    ])

    //查看视频画面
    const LookUp = (ind, row) => {
      console.log(ind, row)
    }
    const handleSizeChange = (val) => {
      console.log(`${val} items per page`)
    }
    const handleCurrentChange = (val) => {
      console.log(`current page: ${val}`)
    }
    // 表头样式设置
    const headClass = () => {
      return 'background:#FAFAFA !important;color: black;'
    }
    return {
      headClass,
      LookUp,
      handleSizeChange,
      handleCurrentChange,

      filterText,
      tableData,
      activeName,
      currentPage,
    }
  },
})
</script>

<style lang="scss" scoped>
//first样式
.video {
  margin: 15px;
  //顶部左侧样式
  .videoTop {
    display: flex;
    height: 32px;
    line-height: 32px;
    .videoTopLeft {
      width: 70%;
      .goBack {
        margin-right: 15px;
      }
      .videoTopLeftTitle {
        font-size: 14px;
        margin-right: 10px;
      }
      .videoTopLeftInput {
        width: 15rem;
      }
      .el-input__icon {
        color: #409eff;
      }
      .el-input__inner:hover {
        border-color: #409eff;
      }
      .el-input__inner:focus {
        border-color: #409eff;
      }
      .search-button {
        margin-left: 1rem;
      }
    }

    //顶部右侧样式
    .videoRight {
      width: 30%;
      button {
        margin-left: 1rem;
        float: right;
      }
    }
  }
  .videoContent {
    margin-top: 15px;
  }
}

.listPagination {
  margin-top: 15px;
  float: right;
}
</style>