fix: 修复没有项目级权限时不断查询任务的bug

This commit is contained in:
Captain.B 2021-07-05 14:35:24 +08:00 committed by 刘瑞斌
parent de0f345825
commit c6c51de583
1 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div v-permission="['PROJECT_API_SCENARIO:READ']">
<el-menu :unique-opened="true" class="header-user-menu align-right header-top-menu" <el-menu :unique-opened="true" class="header-user-menu align-right header-top-menu"
mode="horizontal" mode="horizontal"
:background-color="color" :background-color="color"
@ -11,7 +11,8 @@
<span>{{ $t('commons.task_center') }}</span> <span>{{ $t('commons.task_center') }}</span>
</template> </template>
<el-badge :value="runningTotal" class="item" type="primary" v-if="runningTotal > 0"> <el-badge :value="runningTotal" class="item" type="primary" v-if="runningTotal > 0">
<font-awesome-icon @click="showTaskCenter" class="icon global focusing" :icon="['fas', 'tasks']" style="font-size: 18px"/> <font-awesome-icon @click="showTaskCenter" class="icon global focusing" :icon="['fas', 'tasks']"
style="font-size: 18px"/>
</el-badge> </el-badge>
<font-awesome-icon @click="showTaskCenter" class="icon global focusing" :icon="['fas', 'tasks']" v-else/> <font-awesome-icon @click="showTaskCenter" class="icon global focusing" :icon="['fas', 'tasks']" v-else/>
</el-tooltip> </el-tooltip>
@ -19,7 +20,8 @@
</el-menu> </el-menu>
<el-drawer :visible.sync="taskVisible" :destroy-on-close="true" direction="rtl" <el-drawer :visible.sync="taskVisible" :destroy-on-close="true" direction="rtl"
:withHeader="true" :modal="false" :title="$t('commons.task_center')" size="600px" custom-class="ms-drawer-task"> :withHeader="true" :modal="false" :title="$t('commons.task_center')" size="600px"
custom-class="ms-drawer-task">
<div style="color: #2B415C;margin: 0px 20px 0px"> <div style="color: #2B415C;margin: 0px 20px 0px">
<el-form label-width="68px"> <el-form label-width="68px">
<el-row> <el-row>
@ -45,7 +47,9 @@
<div v-for="item in taskData" :key="item.id" style="margin-bottom: 5px"> <div v-for="item in taskData" :key="item.id" style="margin-bottom: 5px">
<el-card class="ms-card-task" @click.native="showReport(item,$event)"> <el-card class="ms-card-task" @click.native="showReport(item,$event)">
<span>{{ item.name }} </span><br/> <span>{{ item.name }} </span><br/>
<span>执行器{{ item.actuator }} {{ item.executor }} {{ item.executionTime | timestampFormatDate }} {{ getMode(item.triggerMode) }}</span><br/> <span>执行器{{ item.actuator }} {{ item.executor }} {{
item.executionTime | timestampFormatDate
}} {{ getMode(item.triggerMode) }}</span><br/>
<el-row> <el-row>
<el-col :span="20"> <el-col :span="20">
<el-progress :percentage="getPercentage(item.executionStatus)" :format="format"/> <el-progress :percentage="getPercentage(item.executionStatus)" :format="format"/>
@ -69,7 +73,7 @@
<script> <script>
import MsDrawer from "../common/components/MsDrawer"; import MsDrawer from "../common/components/MsDrawer";
import {getCurrentProjectID} from "@/common/js/utils"; import {getCurrentProjectID, hasPermissions} from "@/common/js/utils";
import MsRequestResultTail from "../../components/api/definition/components/response/RequestResultTail"; import MsRequestResultTail from "../../components/api/definition/components/response/RequestResultTail";
export default { export default {
@ -114,7 +118,9 @@ export default {
color: String color: String
}, },
created() { created() {
this.getTaskRunning(); if (hasPermissions('PROJECT_API_SCENARIO:READ')) {
this.getTaskRunning();
}
}, },
methods: { methods: {
format(item) { format(item) {
@ -215,7 +221,7 @@ export default {
}); });
} }
} }
} };
</script> </script>
<style> <style>