<template>
|
<view class="pages-task-item">
|
<view class="btn-no " :class="taskIsRun?'active':'' ">
|
{{taskData.taskButton}}
|
</view>
|
<view class="content" @click="clickTask">
|
<view class="line">
|
<view class="title"> {{taskData.taskGroupName}}</view>
|
</view>
|
<view class="line">
|
{{taskListDesc}}
|
</view>
|
</view>
|
<view class="action-button" v-if="taskIsRun">
|
<!-- <button type="primary" v-show="false" :plain="true" class="button" @click.stop="clickRepeatTask">
|
<text class="ico repeat" />
|
</button> -->
|
<button type="primary" :plain="true" class="button" @click.stop="clickSkipTask">
|
<text class="ico skip-next-rounded" />
|
</button>
|
<button type="primary" :plain="true" class="button" @click.stop="clickStopTask">
|
<text class="ico stop" />
|
</button>
|
<!-- <button type="primary" v-show="false" :plain="true" class="button" @click.stop="clickPauseTask">
|
<text class="ico pause-rounded" />
|
</button>
|
<button type="primary" v-show="false" :plain="true" class="button" @click.stop="clickPlayTask">
|
<text class="ico play-filled" />
|
</button> -->
|
</view>
|
<view class="action-button" v-else>
|
<button :type=" !taskCanRun ? 'default':'primary'" :plain="true" class="button" :disabled=" !taskCanRun"
|
@click.stop="clickPlayTask">
|
<text class="ico play-filled " :class="taskCanRun ? '':'disabled'" />
|
</button>
|
</view>
|
<!-- <view class="btn-del" :style="{ transform: `translateX(${deleteX || 0}px)` }" @click="clickDelete">
|
删除</view> -->
|
|
</view>
|
|
</template>
|
|
<script>
|
import {
|
showToast,
|
showModal
|
} from "@/comm/utils.js"
|
import {
|
Button
|
} from 'antd-mobile-vue-next'
|
export default {
|
name: "PagesTaskItem",
|
components: {
|
'a-button': Button
|
},
|
props: {
|
taskData: {
|
type: Object,
|
default () {
|
return {};
|
}
|
},
|
taskStatus: {
|
type: Object,
|
default () {
|
return {};
|
}
|
},
|
deleteX: {
|
type: Number,
|
default () {
|
return 0;
|
}
|
},
|
},
|
data() {
|
return {}
|
},
|
computed: {
|
taskListDesc() {
|
let list = this.taskData.taskList || []
|
list = list.map((a) => a.dest?.name)
|
return list.join("-")
|
},
|
taskIsRun() {
|
if (this.taskStatus?.taskGroupID == this.taskData.taskGroupID) {
|
return true
|
} else {
|
return false
|
}
|
},
|
taskCanRun() {
|
if (this.taskStatus?.taskGroupID) {
|
return false
|
} else {
|
return true
|
}
|
},
|
|
},
|
|
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)
|
},
|
clickPlayTask() {
|
if (this.taskStatus?.taskGroupID)
|
return
|
this.$emit('click-play', this.taskData)
|
},
|
|
clickStopTask() {
|
this.$emit('click-stop', this.taskData)
|
},
|
|
clickSkipTask() {
|
this.$emit('click-skip', this.taskData)
|
},
|
|
clickRepeatTask() {
|
this.$emit('click-repeat', this.taskData)
|
},
|
|
clickPauseTask() {
|
this.$emit('click-pause', this.taskData)
|
},
|
|
clickDelete() {
|
this.$emit('click-delete', this.taskData)
|
},
|
|
|
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.pages-task-item {
|
width: 100%;
|
display: flex;
|
flex-direction: row;
|
position: relative;
|
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;
|
}
|
|
.active {
|
background-color: #1890FF;
|
color: #fff;
|
}
|
|
.content {
|
flex: 1;
|
padding: 5px;
|
|
.line {
|
padding: 5px 0;
|
width: 100%;
|
display: flex;
|
flex-direction: row;
|
|
.title {
|
font-size: 36rpx;
|
font-weight: 600;
|
}
|
|
.text {
|
padding: 0 10px;
|
font-size: 14px;
|
color: #1ABC9C;
|
flex: 1;
|
}
|
|
|
|
}
|
}
|
|
.action-button {
|
display: flex;
|
flex-direction: row;
|
|
.button {
|
display: flex;
|
margin: 10rpx;
|
border-radius: 50%;
|
//padding: 5rpx !important;
|
width: 60rpx;
|
height: 60rpx;
|
justify-content: center;
|
align-items: center;
|
|
.ico {
|
font-size: 30rpx;
|
color: #1890FF;
|
|
}
|
.disabled{
|
color: gray !important;
|
}
|
|
}
|
.disabled{
|
color: gray;
|
}
|
|
|
}
|
|
.btn-del {
|
position: absolute;
|
right: -80px;
|
top: 0;
|
padding: 0 8px;
|
line-height: 100px;
|
background-color: #CC001A;
|
font-weight: 700;
|
color: #fff;
|
border: none;
|
border-radius: 10px;
|
border-bottom-right-radius: 0px;
|
border-bottom-left-radius: 0px;
|
border-top-left-radius: 0px;
|
transform: translateX(100%);
|
transition: transform 0.3s;
|
}
|
}
|
</style>
|