feat: 网盘设置界面新增视频转码或OCR识别的任务进度
This commit is contained in:
parent
0ffd6e4409
commit
546697eee8
@ -103,3 +103,11 @@ export function getHeartwings(params) {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getTaskProgress(params) {
|
||||||
|
return request({
|
||||||
|
url: '/cloud/task/progress',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
73
src/components/TaskProgress/index.vue
Normal file
73
src/components/TaskProgress/index.vue
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container">
|
||||||
|
<table-list
|
||||||
|
ref="tableList"
|
||||||
|
:less-client-height="245"
|
||||||
|
:tableData="dataList"
|
||||||
|
:loading="loading"
|
||||||
|
:hasSelection="false"
|
||||||
|
:border="false"
|
||||||
|
:tableHeader="tableHeader"
|
||||||
|
></table-list>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import TableList from "@/components/table/TableList"
|
||||||
|
import {mapState} from "vuex";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TaskProgress',
|
||||||
|
components: {
|
||||||
|
TableList
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Array,
|
||||||
|
default: []
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(['message'])
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dataList: [],
|
||||||
|
loading: false,
|
||||||
|
tableHeader: [
|
||||||
|
{prop: 'type', width: 100, label: '任务类型'},
|
||||||
|
{prop: 'name', minWidth: 100, label: '名称'},
|
||||||
|
{prop: 'progress', width: 100, label: '进度'},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
data(val) {
|
||||||
|
console.log('data', val)
|
||||||
|
this.dataList = val
|
||||||
|
},
|
||||||
|
message(msg) {
|
||||||
|
if (msg.event === 'msg/taskProgress') {
|
||||||
|
const taskProgress = msg.data.body
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (taskProgress.progress) {
|
||||||
|
this.dataList.push(taskProgress)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
@ -55,6 +55,8 @@ function onMessage(msg) {
|
|||||||
const url = msg.url
|
const url = msg.url
|
||||||
if (url === 'synced') {
|
if (url === 'synced') {
|
||||||
store.dispatch('updateMessage', {event: 'msg/synced', data: msg})
|
store.dispatch('updateMessage', {event: 'msg/synced', data: msg})
|
||||||
|
} else if (url === 'taskProgress') {
|
||||||
|
store.dispatch('updateMessage', {event: 'msg/taskProgress', data: msg})
|
||||||
} else if (url === 'uploaderChunkSize') {
|
} else if (url === 'uploaderChunkSize') {
|
||||||
store.dispatch('updateMessage', {event: 'uploaderChunkSize', data: msg.body})
|
store.dispatch('updateMessage', {event: 'uploaderChunkSize', data: msg.body})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -124,13 +124,25 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
<el-card class="box-card">
|
||||||
|
<div slot="header">
|
||||||
|
<div class="box-card-header">
|
||||||
|
<div class="clearfix card-header-back">
|
||||||
|
<span>任务进度</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<task-progress :data="taskProgressDataList"></task-progress>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import config from '@/../package.json'
|
import config from '@/../package.json'
|
||||||
import settingApi, {getSetting} from "@/api/setting-api";
|
import settingApi, { getSetting, getTaskProgress } from "@/api/setting-api";
|
||||||
import Logo from "@/components/Logo";
|
import Logo from "@/components/Logo";
|
||||||
import getPageTitle from "@/utils/get-page-title";
|
import getPageTitle from "@/utils/get-page-title";
|
||||||
import UploadImageInput from "@/components/input/UploadImageInput.vue";
|
import UploadImageInput from "@/components/input/UploadImageInput.vue";
|
||||||
@ -138,9 +150,10 @@ import roleApi from "@/api/role";
|
|||||||
import { loadLdapConfig, testLdapConfig, updateLdapConfig} from '@/api/user'
|
import { loadLdapConfig, testLdapConfig, updateLdapConfig} from '@/api/user'
|
||||||
import {mapGetters, mapState} from "vuex";
|
import {mapGetters, mapState} from "vuex";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import TaskProgress from "@/components/TaskProgress/index.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {UploadImageInput, Logo},
|
components: {TaskProgress, UploadImageInput, Logo},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeName: '1',
|
activeName: '1',
|
||||||
@ -150,6 +163,7 @@ export default {
|
|||||||
clickSync: false,
|
clickSync: false,
|
||||||
indexingPercent: 100,
|
indexingPercent: 100,
|
||||||
syncPercent: 100,
|
syncPercent: 100,
|
||||||
|
taskProgressDataList: [],
|
||||||
resetLoading: false,
|
resetLoading: false,
|
||||||
webpEnabled: false,
|
webpEnabled: false,
|
||||||
logoFileName: '',
|
logoFileName: '',
|
||||||
@ -208,6 +222,10 @@ export default {
|
|||||||
this.getLdapConfig()
|
this.getLdapConfig()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getTaskProgress().then(res => {
|
||||||
|
this.taskProgressDataList = res.data
|
||||||
|
this.taskProgressChange(this.taskProgressDataList.length)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['message']),
|
...mapState(['message']),
|
||||||
@ -405,7 +423,7 @@ export default {
|
|||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.webpEnabled = !this.webpEnabled
|
this.webpEnabled = !this.webpEnabled
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user