qushaowei
2024-01-26 5a74ff63f47921f97b6c3c35751b24b085a1a78c
src/views/mdc/base/modules/OvertimeManagement/OvertimeManagementList.vue
@@ -6,7 +6,7 @@
        <a-row :gutter="24">
          <a-col :md="7" :sm="7">
            <a-form-item label="时间">
              <a-range-picker @change="dateParamChange" v-model="dates"  format="YYYY-MM-DD HH:mm:ss"/>
              <a-range-picker @change="dateParamChange" v-model="dates"  format="YYYYMMDD"/>
            </a-form-item>
          </a-col>
          <a-col :md="5" :sm="5">
@@ -79,6 +79,9 @@
        </span>
        <span slot="model" slot-scope="text" style="font-weight: bold">
          <j-ellipsis :value="text" :length="8"/>
        </span>
        <span slot="duration" slot-scope="text">
          {{text|getFormattedTime}}
        </span>
      </a-table>
    </div>
@@ -163,25 +166,25 @@
          {
            title: '日期',
            align: 'center',
            dataIndex: 'effectiveDate',
            dataIndex: 'theDate',
            width:150
            // scopedSlots:{customRender:'startTime'},
            // customRender:(text,row,index) => {
            //   return moment(text).format("YYYY-MM-DD HH:mm:ss")
            // }
          },
          {
            title: '班次开始时间',
            align: 'center',
            dataIndex: 'startDate',
            width:150
          },
          {
            title: '班次结束时间',
            align: 'center',
            dataIndex: 'endDate',
            width:150
          },
          // {
          //   title: '班次开始时间',
          //   align: 'center',
          //   dataIndex: 'startDate',
          //   width:150
          // },
          // {
          //   title: '班次结束时间',
          //   align: 'center',
          //   dataIndex: 'endDate',
          //   width:150
          // },
          {
            title: '加班开始时间',
            align: 'center',
@@ -195,10 +198,17 @@
            width:150
          },
          {
            title: '加班时长',
            align: 'center',
            dataIndex: 'duration',
            scopedSlots: {customRender: 'duration'},
            width:200
          },
          {
            title: '备注',
            align: 'center',
            dataIndex: 'remark',
            width:150
            width:210
          },
          {
            title: '操作',
@@ -257,6 +267,36 @@
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    filters:{
      /**
       * 格式化时间
       * @param seconds 秒数
       * @returns '' 格式化后时间字符串
       */
      getFormattedTime(seconds) {
        var hours = Math.floor(seconds / 3600)
        var minutes = Math.floor((seconds % 3600) / 60)
        var secs = seconds % 60
        if (hours === 0) {
          if (minutes === 0) {
            return secs === 0 ? 0 : `${secs}秒`
          } else {
            if (secs === 0) {
              return `${minutes}分`
            }
            return `${minutes}分 ${secs}秒`
          }
        } else {
          if (minutes === 0 && secs === 0) {
            return `${hours}小时`
          } else if (minutes !== 0 && secs === 0) {
            return `${hours}小时 ${minutes}分`
          }
        }
        return `${hours}小时 ${minutes}分 ${secs}秒`
      }
    },
    methods: {
      importTemplate(fileName){
        var a = document.createElement("a");