<template>
|
<div class="inspectionTask" :style="{ paddingTop: route.query.topMargin + 'px' }">
|
<van-search v-model="app_key_word" enterkeyhint="go" placeholder="请输入任务编号/名称/机巢名称/创建人" shape="round"
|
@search="handleSearch" @clear="onCancel" />
|
|
<van-tabs v-model:active="currentTab" @click-tab="onClickTab" line-width="26">
|
<van-tab title="我的任务">
|
<template #title>
|
<div class="custom-tab-title">
|
<div class="tab-text">我的任务</div>
|
<div class="tab-badge">{{ tabList[0].number }}</div>
|
</div>
|
</template>
|
<MyTask :indexTab="indexTab" :searchTxt="search_txt" @taskDetails="taskDetails"></MyTask>
|
</van-tab>
|
<van-tab title="计划执行">
|
<template #title>
|
<div class="custom-tab-title">
|
<div class="tab-text">计划执行</div>
|
<div class="tab-badge">{{ tabList[1].number }}</div>
|
</div>
|
</template>
|
<planExecute :indexTab="indexTab" :searchTxt="search_txt" @taskDetails="taskDetails"></planExecute>
|
</van-tab>
|
<van-tab title="执行中">
|
<template #title>
|
<div class="custom-tab-title">
|
<div class="tab-text">执行中</div>
|
<div class="tab-badge">{{ tabList[2].number }}</div>
|
</div>
|
</template>
|
<executeing :indexTab="indexTab" :searchTxt="search_txt" @taskDetails="taskDetails"></executeing>
|
</van-tab>
|
<van-tab title="待执行">
|
<template #title>
|
<div class="custom-tab-title">
|
<div class="tab-text">待执行</div>
|
<div class="tab-badge">{{ tabList[3].number }}</div>
|
</div>
|
</template>
|
<pendingExecution :indexTab="indexTab" :searchTxt="search_txt" @taskDetails="taskDetails">
|
</pendingExecution>
|
</van-tab>
|
<van-tab title="已执行">
|
<template #title>
|
<div class="custom-tab-title">
|
<div class="tab-text">已执行</div>
|
<div class="tab-badge">{{ tabList[4].number }}</div>
|
</div>
|
</template>
|
<executioned :indexTab="indexTab" :searchTxt="search_txt" @taskDetails="taskDetails"></executioned>
|
</van-tab>
|
<van-tab title="执行失败">
|
<template #title>
|
<div class="custom-tab-title">
|
<div class="tab-text">执行失败</div>
|
<div class="tab-badge">{{ tabList[5].number }}</div>
|
</div>
|
</template>
|
<executionError :indexTab="indexTab" :searchTxt="search_txt" @taskDetails="taskDetails">
|
</executionError>
|
</van-tab>
|
<van-tab title="取消执行">
|
<template #title>
|
<div class="custom-tab-title">
|
<div class="tab-text">取消执行</div>
|
<div class="tab-badge">{{ tabList[6].number }}</div>
|
</div>
|
</template>
|
<cancelExecution :indexTab="indexTab" :searchTxt="search_txt" @taskDetails="taskDetails">
|
</cancelExecution>
|
</van-tab>
|
</van-tabs>
|
|
<div class="add-task-btn" v-if="showAddBtn">
|
<img :src="addBtnSvg" alt="" @click="addTask">
|
</div>
|
</div>
|
</template>
|
|
<script setup>
|
import addBtnSvg from '@/appDataSource/add.png'
|
import { getDeviceJobList, jobStatistics } from '@/api/home/task'
|
// import { useStore } from 'vuex'
|
import { showToast, showLoadingToast, closeToast } from 'vant'
|
import _ from 'lodash'
|
import MyTask from './compoment/myTask.vue'
|
import planExecute from './compoment/planExecute.vue'
|
import executeing from './compoment/executeing.vue'
|
import executioned from './compoment/executioned.vue'
|
import executionError from './compoment/executionError.vue'
|
import cancelExecution from './compoment/cancelExecution.vue'
|
import pendingExecution from './compoment/pendingExecution.vue'
|
import { useRoute } from 'vue-router'
|
const route = useRoute()
|
// const store = useStore()
|
|
const app_key_word = ref('')
|
const currentTab = ref(1)
|
const showAddBtn = ref(false)
|
const tabList = ref([
|
{ name: '我的任务', number: 0, id: 'my_planned_executions' },
|
{ name: '计划执行', number: 0, id: 'planned_executions' },
|
{ name: '执行中', number: 0, id: 'running_num' },
|
{ name: '待执行', number: 0, id: 'pending_executions' },
|
{ name: '已执行', number: 0, id: 'executed' },
|
{ name: '执行失败', number: 0, id: 'failed_executions' },
|
{ name: '取消执行', number: 0, id: 'go_home_executions' },
|
])
|
|
function getNumbers () {
|
jobStatistics({ date_enum: '', app_key_word: app_key_word.value }).then(res => {
|
// {executed:56,my_planned_executions:34,planned_executions:45 }
|
tabList.value.forEach(tab => {
|
if (res.data.data.hasOwnProperty(tab.id)) {
|
tab.number = res.data.data[tab.id]
|
}
|
})
|
})
|
}
|
function taskDetails (item) {
|
const transmitData = { data: { type: 'taskDetails', rowItem: { ..._.cloneDeep(item) } } }
|
if ([1, 2].includes(item.status)) {
|
wx.miniProgram.navigateTo({ url: `/subPackages/taskDetail/inProgress/index?wayLineJobInfoId=${item.id}` })
|
} else {
|
wx.miniProgram.navigateTo({ url: `/subPackages/taskDetail/execution/index?wayLineJobInfoId=${item.id}&waylineJobId=${item.wayline_job_id}&batch_no=${item.batch_no}` })
|
}
|
wx.miniProgram.postMessage(transmitData)
|
uni.postMessage(transmitData)
|
}
|
const search_txt = ref('')
|
function handleSearch () {
|
search_txt.value = app_key_word.value
|
getNumbers()
|
}
|
function onCancel () {
|
search_txt.value = app_key_word.value
|
getNumbers()
|
}
|
let indexTab = ref(0)
|
function onClickTab (index) {
|
// app_key_word.value = ''
|
indexTab.value = index
|
search_txt.value = app_key_word.value
|
getNumbers()
|
}
|
|
function addTask () {
|
const transmitData = { data: { type: 'addTask' } }
|
wx.miniProgram.navigateTo({ url: `/subPackages/taskDetail/addTask/index` })
|
wx.miniProgram.postMessage(transmitData)
|
uni.postMessage(transmitData)
|
}
|
|
watch(
|
() => route.query,
|
(newValue, oldValue) => {
|
if (newValue.updateKey) {
|
nextTick()
|
app_key_word.value = ''
|
currentTab.value = 1
|
getNumbers()
|
}
|
},
|
{ deep: true })
|
|
onMounted(() => {
|
if ('showAddBtn' in route.query) {
|
showAddBtn.value = Number(route.query.showAddBtn)
|
}
|
|
getNumbers()
|
})
|
</script>
|
|
<style scoped lang="scss">
|
.inspectionTask {
|
position: relative;
|
height: 100%;
|
|
//overflow: auto;
|
//background: #f6f6f6;
|
:deep(.van-search) {
|
background: transparent;
|
}
|
|
:deep(.van-tabs) {
|
display: flex;
|
flex-direction: column;
|
height: calc(100vh - 54px);
|
}
|
|
:deep(.van-tabs__wrap) {
|
height: 59px;
|
margin-bottom: 10px;
|
}
|
|
:deep(.van-tabs__content) {
|
flex: 1;
|
overflow-y: auto;
|
height: 0;
|
}
|
|
:deep(.van-tabs__nav--line) {
|
background: transparent;
|
}
|
|
:deep(.van-badge) {
|
background-color: #1d6fe9;
|
}
|
|
:deep(.van-empty) {
|
//height: calc(100vh - 100px);
|
margin-top: 100px;
|
}
|
|
:deep(.van-tab) {
|
.custom-tab-title {
|
padding-bottom: 8px;
|
min-width: 60px;
|
text-align: center;
|
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-weight: 500;
|
|
.tab-text {
|
height: 21px;
|
line-height: 21px;
|
color: #676666 !important;
|
font-size: 15px;
|
}
|
|
.tab-badge {
|
margin-top: 2px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
height: 18px;
|
background: rgba(29, 111, 233, 0.14);
|
border-radius: 4px 4px 4px 4px;
|
color: #222324 !important;
|
font-size: 12px;
|
}
|
}
|
}
|
|
:deep(.van-tab--active) {
|
.custom-tab-title {
|
.tab-text {
|
color: #1d6fe9 !important;
|
}
|
|
.tab-badge {
|
color: #0051ff !important;
|
}
|
}
|
}
|
|
:deep(.van-tabs__line) {
|
background: #227bff !important;
|
}
|
|
.add-task-btn {
|
position: absolute;
|
right: 6px;
|
bottom: 24px;
|
|
img {
|
width: 60px;
|
height: 60px;
|
vertical-align: middle;
|
// border-radius: 50%;
|
}
|
}
|
}
|
</style>
|