if (res.code === 200) {
        // timeLong 单位:秒
        let durationHour = `${parseInt(res.data.timeLong / 3600)}小时 `
        let durationMi = `${parseInt(res.data.timeLong / 60)}分钟 `
        const durationSecond = `${parseInt(res.data.timeLong % 60)}秒 `
        // const durationSecond = parseInt((res.data.timeLong - Math.floor(res.data.timeLong)) * 60)
        durationHour = parseFloat(durationHour) > 0 ? durationHour : ''
        durationMi = parseFloat(durationMi) > 0 ? durationMi : ''
        this.rowDetailInfo = {
          ...res.data,
          startAndEndTime: `${res.data.startTime}-${res.data.endTime}`, // 开始/结束时间
          duration: `${durationHour}${durationMi}${durationSecond}` // 巡更时长
        }
        this.rowDetailList = res.data.danVOS
      }
      this.loadingShowXGDetail = false
    },

以分钟为单位,譬如 1.5分钟

if (res.code === 200) {
        let durationHour = `${parseInt(res.data.timeLong / 60)}小时 `
        let durationMi = `${parseInt(res.data.timeLong % 60)}分钟 `
        const durationSecond = parseInt((res.data.timeLong - Math.floor(res.data.timeLong)) * 60)
        durationHour = parseFloat(durationHour) > 0 ? durationHour : ''
        durationMi = parseFloat(durationMi) > 0 ? durationMi : ''
        this.rowDetailInfo = {
          ...res.data,
          startAndEndTime: `${res.data.startTime}-${res.data.endTime}`, // 开始/结束时间
          duration: `${durationHour}${durationMi}${durationSecond}秒` // 巡更时长
        }
        this.rowDetailList = res.data.danVOS
      }

Logo

前往低代码交流专区

更多推荐