Commit 95af0221 authored by lijin's avatar lijin

modified

parent 4f532f34
......@@ -66,14 +66,14 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="start_time" label="开始时间" width="180">
<el-table-column prop="startTime" label="开始时间" width="180">
<template slot-scope="scope">
{{ scope.row.start_time }}
{{ scope.row.startTime ? moment(scope.row.startTime).format('YYYY-MM-DD HH:mm:ss') : '' }}
</template>
</el-table-column>
<el-table-column prop="finish_time" label="结束时间" width="180">
<el-table-column prop="finishTime" label="结束时间" width="180">
<template slot-scope="scope">
{{ scope.row.finish_time }}
{{ scope.row.finishTime ? moment(scope.row.finishTime).format('YYYY-MM-DD HH:mm:ss') : '' }}
</template>
</el-table-column>
<el-table-column label="执行时间" width="150">
......@@ -138,10 +138,11 @@
import CampaignTemplateSelector from '@/components/GroupSelectors/CampaignTemplateSelector'
import { getCampaignTaskList, createCampaignTask, updateCampaignTask } from '@/api/campaignTask'
import axios from 'axios'
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import moment from 'moment'
dayjs.extend(duration)
// 设置moment语言为中文
moment.locale('zh-cn')
export default {
name: 'CampaignTaskManage',
......@@ -149,8 +150,8 @@ export default {
CampaignTemplateSelector
},
data() {
const end = dayjs()
const start = end.subtract(7, 'day')
const end = moment()
const start = end.clone().subtract(7, 'day')
return {
loading: false,
condition: {
......@@ -180,6 +181,7 @@ export default {
this.fetchData()
},
methods: {
moment,
async fetchData() {
this.loading = true
try {
......@@ -225,10 +227,10 @@ export default {
},
calculateDuration(row) {
const startTime = dayjs(row.start_time)
const endTime = row.finish_time ? dayjs(row.finish_time) : dayjs()
const startTime = moment(row.startTime)
const endTime = row.finishTime ? moment(row.finishTime) : moment()
const diff = endTime.diff(startTime)
const duration = dayjs.duration(diff)
const duration = moment.duration(diff)
if (duration.asHours() >= 1) {
return Math.floor(duration.asHours()) + '小时'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment