HistorySearchTable.vue 3.12 KB
<template>
    <el-table
      ref="singleTable"
      :data="tableData"
      highlight-current-row
      @current-change="handleCurrentChange"
      height="250"
      style="width: 100%">
      <el-table-column
        type="index"
        fixed
        width="100">
      </el-table-column>
      <el-table-column
        property="name"
        label="名称">
      </el-table-column>
      <el-table-column
        property="date"
        label="日期">
      </el-table-column>
      <el-table-column
        property="status"
        label="状态">
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作">
        <template slot-scope="scope">
          <el-button icon="el-icon-video-play" size="small" style="border: none" @click="playHistoryVideo(scope.row)"></el-button>
          <el-button v-if="scope.row.status === '1'" icon="el-icon-upload" size="small" style="border: none" @click="uploadHistoryVideo(scope.row)"></el-button>
          <el-button v-if="scope.row.status === '2'" icon="el-icon-download" size="small" style="border: none" @click="downloadHistoryVideo(scope.row)"></el-button>
        </template>
      </el-table-column>
    </el-table>
</template>

<script>
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
//例如:import 《组件名称》 from '《组件路径》,
  export default {
    //import引入的组件需要注入到对象中才能使用"
    components: {},
    props: {
      tableData: {
        type: Array,
        default: []
      }
    },
    data() {
      //这里存放数据"
      return {
        currentRow: null
      };
    },
    //计算属性 类似于data概念",
    computed: {},
    //监控data中的数据变化",
    watch: {},
    //方法集合",
    methods: {
      /**
       * 选中行
       * @param val
       */
      handleCurrentChange(val) {
        this.currentRow = val;
      },
      setCurrent(row) {
        this.$refs.singleTable.setCurrentRow(row);
      },
      /**
       * 播放历史视频
       * @param row
       */
      playHistoryVideo(row){
        this.$emit("playHistoryVideo", row);
      },
      /**
       * 上传历史视频
       * @param row
       */
      uploadHistoryVideo(row){
        this.$emit('uploadHistoryVideo', row);
      },
      /**
       * 下载历史视频
       * @param row
       */
      downloadHistoryVideo(row){
        this.$emit('downloadHistoryVideo', row);
      }
    },
    //生命周期 - 创建完成(可以访问当前this实例)",
    created() {
    },
    //生命周期 - 挂载完成(可以访问DOM元素)",
    mounted() {
    },
    beforeCreate() {
    }, //生命周期 - 创建之前",
    beforeMount() {
    }, //生命周期 - 挂载之前",
    beforeUpdate() {
    }, //生命周期 - 更新之前",
    updated() {
    }, //生命周期 - 更新之后",
    beforeDestroy() {
    }, //生命周期 - 销毁之前",
    destroyed() {
    }, //生命周期 - 销毁完成",
    activated() {
    } //如果页面有keep-alive缓存功能,这个函数会触发",
  };
</script>
<style scoped>

</style>