commit
80d6bcfea9
@ -13,6 +13,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getTaskProgress } from '@/api/setting-api'
|
||||||
import TableList from "@/components/table/TableList"
|
import TableList from "@/components/table/TableList"
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
|
|
||||||
@ -26,6 +27,10 @@ export default {
|
|||||||
type: Array,
|
type: Array,
|
||||||
default: []
|
default: []
|
||||||
},
|
},
|
||||||
|
monitor: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['message'])
|
...mapState(['message'])
|
||||||
@ -43,21 +48,34 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
data(val) {
|
data(val) {
|
||||||
this.dataList = val
|
if (val) {
|
||||||
|
this.dataList = val
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
getTaskProgress().then(res => {
|
||||||
|
this.dataList = res.data
|
||||||
|
})
|
||||||
},
|
},
|
||||||
message(msg) {
|
message(msg) {
|
||||||
if (msg.event === 'msg/taskProgress') {
|
if (this.monitor && msg.event === 'msg/taskCountChange') {
|
||||||
const taskProgress = msg.data.body
|
this.dataList = msg.data
|
||||||
const index = this.dataList.findIndex(item => item.taskId === taskProgress.taskId)
|
} else {
|
||||||
if (index > -1) {
|
if (msg.event === 'msg/taskProgress') {
|
||||||
if (taskProgress.progress) {
|
const taskProgress = msg.data.body
|
||||||
this.dataList[index].progress = taskProgress.progress
|
const index = this.dataList.findIndex(item => item.taskId === taskProgress.taskId)
|
||||||
|
if (index > -1) {
|
||||||
|
if (taskProgress.progress) {
|
||||||
|
this.dataList[index].progress = taskProgress.progress
|
||||||
|
} else {
|
||||||
|
this.dataList.splice(index, 1)
|
||||||
|
this.$store.dispatch('updateMessage', { event: 'msg/taskCountChange', data: this.dataList })
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.dataList.splice(index, 1)
|
if (taskProgress.progress) {
|
||||||
}
|
this.dataList.push(taskProgress)
|
||||||
} else {
|
this.$store.dispatch('updateMessage', { event: 'msg/taskCountChange', data: this.dataList })
|
||||||
if (taskProgress.progress) {
|
}
|
||||||
this.dataList.push(taskProgress)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,19 @@
|
|||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
<hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
||||||
<breadcrumb class="breadcrumb-container" />
|
<breadcrumb class="breadcrumb-container" />
|
||||||
|
|
||||||
<div class="right-content">
|
<div class="right-content">
|
||||||
|
|
||||||
|
<el-popover
|
||||||
|
placement="bottom"
|
||||||
|
width="600"
|
||||||
|
trigger="hover">
|
||||||
|
<TaskProgress/>
|
||||||
|
<div slot="reference" class="right-content-button" v-show="showTaskProgress > 0">
|
||||||
|
<svg-icon icon-class="gengxinjindu" :class="progressExecuting ? 'rotate' : ''"></svg-icon>
|
||||||
|
{{ $t('app.taskProgress') }}
|
||||||
|
</div>
|
||||||
|
</el-popover>
|
||||||
|
|
||||||
<app-link
|
<app-link
|
||||||
v-for="route in routes.topRouters"
|
v-for="route in routes.topRouters"
|
||||||
:key="route.path"
|
:key="route.path"
|
||||||
@ -48,7 +59,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import TaskProgress from '@/components/TaskProgress/index.vue'
|
||||||
|
import { mapGetters, mapState } from 'vuex'
|
||||||
import Breadcrumb from '@/components/Breadcrumb'
|
import Breadcrumb from '@/components/Breadcrumb'
|
||||||
import Hamburger from '@/components/Hamburger'
|
import Hamburger from '@/components/Hamburger'
|
||||||
import Icon from '@/components/Icon/Icon.vue'
|
import Icon from '@/components/Icon/Icon.vue'
|
||||||
@ -62,10 +74,14 @@ export default {
|
|||||||
isShow: true,
|
isShow: true,
|
||||||
activeIndex: '1',
|
activeIndex: '1',
|
||||||
imageUrl: `${process.env.VUE_APP_BASE_API}/view/thumbnail?jmal-token=${this.$store.state.user.token}&name=${this.$store.state.user.name}&id=`,
|
imageUrl: `${process.env.VUE_APP_BASE_API}/view/thumbnail?jmal-token=${this.$store.state.user.token}&name=${this.$store.state.user.name}&id=`,
|
||||||
defaultAvatar: require('../../assets/img/default-avatar.png')
|
defaultAvatar: require('../../assets/img/default-avatar.png'),
|
||||||
|
showTaskProgress: false,
|
||||||
|
progressExecuting: false,
|
||||||
|
delayedHidden: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
TaskProgress,
|
||||||
Icon,
|
Icon,
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
Hamburger,
|
Hamburger,
|
||||||
@ -78,6 +94,7 @@ export default {
|
|||||||
'showName',
|
'showName',
|
||||||
'newVersion'
|
'newVersion'
|
||||||
]),
|
]),
|
||||||
|
...mapState(['message']),
|
||||||
routes() {
|
routes() {
|
||||||
let routes = {}
|
let routes = {}
|
||||||
let topRouters = []
|
let topRouters = []
|
||||||
@ -98,6 +115,13 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.isShow = this.$pc;
|
this.isShow = this.$pc;
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
message(msg) {
|
||||||
|
if (msg.event === 'msg/taskCountChange') {
|
||||||
|
this.taskCountChange(msg.data.length)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleSelect(key, keyPath) {
|
handleSelect(key, keyPath) {
|
||||||
},
|
},
|
||||||
@ -116,6 +140,25 @@ export default {
|
|||||||
return this.basePath
|
return this.basePath
|
||||||
}
|
}
|
||||||
return path.resolve(this.basePath, routePath)
|
return path.resolve(this.basePath, routePath)
|
||||||
|
},
|
||||||
|
taskCountChange(count) {
|
||||||
|
if (count > 0) {
|
||||||
|
clearTimeout(this.delayedHidden)
|
||||||
|
this.showTaskProgress = true
|
||||||
|
this.progressExecuting = true
|
||||||
|
}
|
||||||
|
if (count <= 0 && this.progressExecuting) {
|
||||||
|
this.progressExecuting = false
|
||||||
|
}
|
||||||
|
if (count <= 0 && this.showTaskProgress) {
|
||||||
|
if (this.delayedHidden != null) {
|
||||||
|
clearTimeout(this.delayedHidden)
|
||||||
|
this.delayedHidden = null
|
||||||
|
}
|
||||||
|
this.delayedHidden = setTimeout(() => {
|
||||||
|
this.showTaskProgress = false
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +263,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #00000006;
|
background-color: #d9d9d980;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,10 +283,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.right-content-button {
|
.right-content-button {
|
||||||
|
cursor: pointer;
|
||||||
line-height: 50px;
|
line-height: 50px;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #00000006;
|
background-color: #d9d9d980;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,4 +296,17 @@ export default {
|
|||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.rotate {
|
||||||
|
animation: rotate 2s linear infinite;
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rotate {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -10,6 +10,10 @@ export default {
|
|||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
rotate: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render(h, context) {
|
render(h, context) {
|
||||||
@ -17,7 +21,11 @@ export default {
|
|||||||
const vnodes = []
|
const vnodes = []
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
vnodes.push(<svg-icon icon-class={icon}/>)
|
if (context.props.rotate) {
|
||||||
|
vnodes.push(<svg-icon icon-class={icon} class="rotate"/>)
|
||||||
|
} else {
|
||||||
|
vnodes.push(<svg-icon icon-class={icon}/>)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
@ -27,3 +35,18 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.rotate {
|
||||||
|
animation: rotate 2s linear infinite;
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rotate {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
|
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
|
||||||
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
|
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
|
||||||
<el-badge value="new" v-if="item.path === '/setting/cloudManager' && newVersion" class="new-version"/>
|
<el-badge value="new" v-if="item.path === '/setting/cloudManager' && newVersion" class="new-version"/>
|
||||||
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title"/>
|
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :rotate="item.path === '/setting/taskProgress' && showTaskProgress" :title="onlyOneChild.meta.title"/>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</app-link>
|
</app-link>
|
||||||
</template>
|
</template>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { isExternal } from '@/utils/validate'
|
import { isExternal } from '@/utils/validate'
|
||||||
import Item from './Item'
|
import Item from './Item'
|
||||||
@ -54,12 +54,22 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
this.onlyOneChild = null
|
this.onlyOneChild = null
|
||||||
return {}
|
return {
|
||||||
|
showTaskProgress: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'newVersion'
|
'newVersion'
|
||||||
]),
|
]),
|
||||||
|
...mapState(['message'])
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
message(msg) {
|
||||||
|
if (msg.event === 'msg/taskCountChange') {
|
||||||
|
this.taskCountChange(msg.data.length)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hasOneShowingChild(children = [], parent) {
|
hasOneShowingChild(children = [], parent) {
|
||||||
@ -94,6 +104,14 @@ export default {
|
|||||||
return this.basePath
|
return this.basePath
|
||||||
}
|
}
|
||||||
return path.resolve(this.basePath, routePath)
|
return path.resolve(this.basePath, routePath)
|
||||||
|
},
|
||||||
|
taskCountChange(count) {
|
||||||
|
if (count > 0 && !this.showTaskProgress) {
|
||||||
|
this.showTaskProgress = true
|
||||||
|
}
|
||||||
|
if (count <= 0 && this.showTaskProgress) {
|
||||||
|
this.showTaskProgress = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,5 +69,7 @@ export default {
|
|||||||
startSync: 'Start scanning? ',
|
startSync: 'Start scanning? ',
|
||||||
confirmDeleteMenuAndRole: 'Are you sure you want to delete the current role and menu? ',
|
confirmDeleteMenuAndRole: 'Are you sure you want to delete the current role and menu? ',
|
||||||
resetSuccessfully: 'Reset successfully',
|
resetSuccessfully: 'Reset successfully',
|
||||||
|
|
||||||
|
taskProgress: 'Task Progress',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,5 +69,7 @@ export default {
|
|||||||
startSync: '是否开始扫描? ',
|
startSync: '是否开始扫描? ',
|
||||||
confirmDeleteMenuAndRole: '您确定要删除当前角色、菜单吗? ',
|
confirmDeleteMenuAndRole: '您确定要删除当前角色、菜单吗? ',
|
||||||
resetSuccessfully: '重置成功',
|
resetSuccessfully: '重置成功',
|
||||||
|
|
||||||
|
taskProgress: '任务进度',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
</div>
|
</div>
|
||||||
<task-progress :data="taskProgressDataList"></task-progress>
|
<TaskProgress monitor/>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import TaskProgress from "@/components/TaskProgress/index.vue";
|
import TaskProgress from "@/components/TaskProgress/index.vue";
|
||||||
import { getTaskProgress, getTranscodeStatus } from '@/api/setting-api'
|
import { getTranscodeStatus } from '@/api/setting-api'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -43,9 +43,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
getTaskProgress().then(res => {
|
|
||||||
this.taskProgressDataList = res.data
|
|
||||||
})
|
|
||||||
getTranscodeStatus().then(res => {
|
getTranscodeStatus().then(res => {
|
||||||
this.transcodeStatus = res.data
|
this.transcodeStatus = res.data
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user