<template>
|
<view class="pages-task-log-item vert-line">
|
<view class="btn-no "> {{taskData.task_button}}
|
</view>
|
<view class="content">
|
<view class="line">
|
<view class="title"> {{taskData.task_group_name}}</view>
|
<view class="status" :style="{'background-color':taskStatusColor+ '10','color':taskStatusColor}">
|
{{taskStatusText}}
|
</view>
|
</view>
|
<view class="line"><text class="text">{{ startTime}} - {{endTime}} </text>
|
<text class="text">{{Math.ceil((taskData.end_time- taskData.start_time) / (60* 1000)) }}{{translate("minute")}}</text>
|
</view>
|
</view>
|
</view>
|
|
|
</template>
|
|
<script>
|
import {
|
showToast,
|
showModal
|
} from "@/comm/utils.js"
|
export default {
|
name: "PagesTaskLogItem",
|
props: {
|
taskData: {
|
type: Object,
|
default () {
|
return {};
|
}
|
},
|
},
|
data() {
|
return {
|
|
}
|
},
|
computed: {
|
startTime() {
|
const date = new Date(Number(this.taskData.start_time))
|
return `${date.getHours()}:${date.getMinutes()}`;
|
},
|
endTime() {
|
const date = new Date(Number(this.taskData.end_time))
|
return `${date.getHours()}:${date.getMinutes()}`;
|
},
|
taskStatusText() {
|
let statusText = ""
|
if (this.taskData.task_status == "finish") {
|
statusText = this.translate("task_completed")
|
} else if (this.taskData.task_status == "cancel") {
|
statusText = this.translate("task_exception")
|
} else {
|
statusText = this.taskData.task_status
|
}
|
return statusText
|
},
|
taskStatusText() {
|
let statusText = ""
|
if (this.taskData.task_status == "finish") {
|
statusText = this.translate("task_completed")
|
} else if (this.taskData.task_status == "cancel") {
|
statusText =this.translate("task_exception")
|
} else {
|
statusText = this.taskData.task_status
|
}
|
return statusText
|
},
|
taskStatusColor() {
|
let statusColor = ""
|
if (this.taskData.task_status == "finish") {
|
statusColor = "#38861a"
|
} else if (this.taskData.task_status == "cancel") {
|
statusColor = "#d64017"
|
} else if (this.taskData.task_status == 5) {
|
statusColor = "#000000"
|
}
|
return statusColor
|
}
|
},
|
|
methods: {
|
setData(obj) {
|
let that = this;
|
let keys = [];
|
let val, data;
|
|
Object.keys(obj).forEach(function(key) {
|
keys = key.split(".");
|
val = obj[key];
|
data = that.$data;
|
keys.forEach(function(key2, index) {
|
if (index + 1 == keys.length) {
|
that.$set(data, key2, val);
|
} else {
|
if (!data[key2]) {
|
that.$set(data, key2, {});
|
}
|
}
|
data = data[key2];
|
});
|
});
|
},
|
clickTask() {
|
this.$emit('click-item', this.taskData)
|
},
|
translate(t) {
|
if (typeof this.$t == "function") return this.$t(`page.${t}`)
|
else return t;
|
},
|
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.pages-task-log-item {
|
width: 100%;
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
|
|
.btn-no {
|
margin: 0 10rpx 0 20rpx;
|
border-radius: 25rpx;
|
background-color: #E6F7FF;
|
color: #1890FF;
|
width: 50rpx;
|
height: 50rpx;
|
line-height: 54rpx;
|
justify-content: center;
|
align-items: center;
|
text-align: center;
|
}
|
|
|
.content {
|
flex: 1;
|
padding: 5px;
|
|
.line {
|
padding: 10rpx 0;
|
width: 100%;
|
display: flex;
|
flex-direction: row;
|
flex-wrap: wrap;
|
|
.title {
|
font-size: 36rpx;
|
font-weight: 600;
|
}
|
|
.status {
|
margin-left: 10rpx;
|
padding: 4rpx;
|
}
|
|
.text {
|
padding: 0 20rpx;
|
font-size: 30rpx;
|
color: #888;
|
}
|
|
.date {
|
padding: 0 20rpx;
|
font-size: 30rpx;
|
}
|
|
.vert-line {
|
border-right: 2rpx solid #ccc;
|
}
|
}
|
}
|
|
|
}
|
</style>
|