src/views/mdc/base/modules/deviceLog/LogList.vue
@@ -3,7 +3,7 @@
    <!-- table区域-begin -->
    <div class="table_logList">
      <a-table ref="table" bordered size="middle" :rowKey="(record,index)=>{return index}" :columns="columns"
               :dataSource="dataList" :pagination="ipagination" :loading="loadingequip"  @change="handleTableChange">
               :dataSource="dataList" :pagination="ipagination" :loading="loadingequip"  @change="handleTableChange" :customRow="rowClick">
        <template slot="status" slot-scope="status">
          <div v-if="status == '3' || status ==  '23'" style="color: #00ee00;width: 100%; height: 100%;">运行</div>
          <div v-else-if="status == '1' || status == '2'" style="color: #ffea91;width: 100%; height: 100%;">待机</div>
@@ -28,6 +28,7 @@
  import {
    JeecgListMixin
  } from '@/mixins/JeecgListMixin'
  import moment from 'moment'
  export default {
    name: 'LogList',
    mixins: [JeecgListMixin],
@@ -47,6 +48,9 @@
        type:Boolean,
        default: false
      }
    },
    watch:{
    },
    data() {
      return {
@@ -90,13 +94,52 @@
            title: '持续时间',
            align: 'center',
            dataIndex: 'duration',
            customRender:(t,r,index) =>{
              // console.log(t)
              var ss = parseInt(t)
              if(ss>=3600){
                // 根据秒数转换成对应的时分秒
                const hour = parseInt(ss / 3600) < 10 ? '0' + parseInt(ss / 3600) : parseInt(ss / 3600)
                const min = parseInt(ss % 3600 / 60) < 10 ? '0' + parseInt(ss % 3600 / 60) : parseInt(ss % 3600 / 60)
                const sec = parseInt(ss % 3600 % 60) < 10 ? '0' + parseInt(ss % 3600 % 60) : parseInt(ss % 3600 % 60)
                if(min == '00') {
                  if(sec == '00'){
                    return hour + '小时'
                  }else{
                    return hour + '小时'+ sec + '秒'
                  }
                }else{
                  if(sec == '00') {
                    return hour + '小时' + min + '分'
                  }else{
                    return hour + '小时' + min + '分' + sec + '秒'
                  }
                }
                // if(sec == '00'){
                //   return hour + '小时' + min + '分'
                // }
                // if(min == '00' && sec == '00'){
                //   return hour + '小时'
                // }
                // return hour + '小时' + min + '分' + sec + '秒'
              }else if(60<ss && ss<3600){
                const min1 = parseInt(ss % 3600 / 60) < 10 ? '0' + parseInt(ss % 3600 / 60) : parseInt(ss % 3600 / 60)
                const sec1 = parseInt(ss % 3600 % 60) < 10 ? '0' + parseInt(ss % 3600 % 60) : parseInt(ss % 3600 % 60)
                return  min1 + '分' + sec1 + "秒"
              }else{
                const sec2 = parseInt(ss % 3600 % 60) < 10 ? '0' + parseInt(ss % 3600 % 60) : parseInt(ss % 3600 % 60)
                return sec2 + '秒'
              }
            }
            // defaultSortOrder:'descend',
            // sorter: (a, b) => {return a.duration>b.duration?1:-1}
          },
          {
            title: '程序号',
            align: 'center',
            dataIndex: 'sequencenumber'
            dataIndex: 'sequenceNumber'
          }
        ]
      }
@@ -112,6 +155,24 @@
        this.ipagination = pagination;
        // this.loadData();
      },
      /**
       * 给设备日志表格中的行添加点击事件
       * @param record 点击的当前行数据
       * @returns {{on: {click: on.click}}} 添加事件对象
       */
      rowClick(record){
        return {
          on:{
            click:()=>{
              const timeObj={
                start:moment(record.startTime),
                end:moment(record.endTime)
              }
              this.$bus.$emit('tableRowRecord',timeObj)
            }
          }
        }
      }
    },
    created() {
    }