Files
dvcp_v2_webapp/packages/device/AppEquipmentManage/components/taskList.vue

145 lines
4.2 KiB
Vue
Raw Normal View History

2022-06-08 17:19:32 +08:00
<template>
2022-06-09 16:42:46 +08:00
<section class="taskList">
2022-06-08 17:19:32 +08:00
<ai-list>
2023-04-18 09:34:11 +08:00
<ai-title slot="title" title="任务列表" isShowBack isShowBottomBorder @onBackClick="cancel"/>
2022-06-08 17:19:32 +08:00
<template #content>
<ai-search-bar bottomBorder>
<template slot="right">
2022-06-11 14:36:19 +08:00
<el-input v-model="search.sourceName" size="small" placeholder="媒资名称/创建人" clearable
2022-06-08 17:19:32 +08:00
v-throttle="() => {page.current = 1, getList()}"
2022-06-11 14:36:19 +08:00
@clear=";(page.current = 1), (search.sourceName = ''), getList()" suffix-icon="iconfont iconSearch"/>
2022-06-08 17:19:32 +08:00
</template>
</ai-search-bar>
2022-06-11 13:16:21 +08:00
<ai-table :tableData="tableData" :col-configs="colConfigs" :total="page.total" ref="aitableex"
2022-06-08 17:19:32 +08:00
:current.sync="page.current" :size.sync="page.size" @getList="getList"
@selection-change="(v) => (ids = v.map((e) => e.id))">
<el-table-column slot="options" label="操作" align="center" width="280" fixed="right">
2022-06-13 14:50:39 +08:00
<template slot-scope="{ row }" v-if="row.taskType == 1 && (row.broadcastStatus == 0 || row.broadcastStatus == 1 || row.broadcastStatus == 2 )">
2022-06-11 13:16:21 +08:00
<el-button type="text" @click="reset(row.id)">撤回任务</el-button>
2022-06-08 17:19:32 +08:00
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</section>
</template>
<script>
2023-04-18 09:34:11 +08:00
import {mapMutations} from "vuex";
2022-06-08 17:19:32 +08:00
export default {
2022-06-09 16:42:46 +08:00
name: 'taskList',
2022-06-08 17:19:32 +08:00
props: {
dict: Object,
instance: Function,
},
data() {
return {
page: {
current: 1,
size: 10,
2022-06-11 13:16:21 +08:00
total: 0,
2022-06-08 17:19:32 +08:00
},
search: {
2022-06-11 14:36:19 +08:00
sourceName: '',
2022-06-08 17:19:32 +08:00
},
tableData: [],
colConfigs: [
{
2022-06-11 13:16:21 +08:00
prop: 'sourceName',
2022-06-08 17:19:32 +08:00
label: '任务名称',
},
{
2022-06-13 13:59:03 +08:00
prop: 'type',
2022-06-08 17:19:32 +08:00
label: '媒资类型',
2022-06-11 13:16:21 +08:00
width: '200',
2022-06-08 17:19:32 +08:00
align: 'center',
2023-04-18 09:34:11 +08:00
render: (h, {row}) => {
return h('span', null, this.dict.getLabel('dlbResourceType', row.type))
2022-06-11 13:16:21 +08:00
}
2022-06-08 17:19:32 +08:00
},
{
2022-06-11 13:16:21 +08:00
prop: 'messageLevel',
2022-06-08 17:19:32 +08:00
label: '级别',
align: 'center',
2023-04-18 09:34:11 +08:00
render: (h, {row}) => {
return h('span', null, this.dict.getLabel('dlbMessageUrgency', row.messageLevel))
2022-06-11 13:16:21 +08:00
}
2022-06-08 17:19:32 +08:00
},
{
2022-06-11 13:16:21 +08:00
prop: 'taskType',
2022-06-08 17:19:32 +08:00
label: '播发方式',
2022-06-11 13:16:21 +08:00
width: '220',
2022-06-08 17:19:32 +08:00
align: 'center',
render: (h, {row}) => {
2023-04-18 09:34:11 +08:00
return h('span', null, (row.taskType == 1 ? '定时播放' : '立即播放'))
2022-06-08 17:19:32 +08:00
},
},
{
2022-06-11 13:16:21 +08:00
prop: 'startTime',
2022-06-08 17:19:32 +08:00
label: '开始时间',
width: '120',
align: 'center',
},
2022-06-13 13:59:03 +08:00
{
prop: 'broadcastStatus',
label: '状态',
align: 'center',
2023-04-18 09:34:11 +08:00
render: (h, {row}) => {
return h('span', null, (row.broadcastStatus == 0 ? '已下发' : row.broadcastStatus == 3 ? '播发成功' : row.broadcastStatus == 6 ? '已取消' : ''))
2022-06-13 14:14:47 +08:00
}
2022-06-13 13:59:03 +08:00
},
2022-06-08 17:19:32 +08:00
{
2022-06-11 13:16:21 +08:00
prop: 'createUserName',
2022-06-08 17:19:32 +08:00
label: '创建人',
align: 'center',
},
{
slot: 'options',
label: '操作',
align: 'center',
},
],
}
},
2022-06-11 13:16:21 +08:00
created() {
2023-04-18 09:34:11 +08:00
this.setPageTitle("设备任务列表")
this.dict.load('dlbDyclingType', 'dlbMessageUrgency', 'dlbBroadcastStatus', 'dlbResourceType')
this.getList()
2022-06-08 17:19:32 +08:00
},
methods: {
2023-04-18 09:34:11 +08:00
...mapMutations(['setPageTitle']),
2022-06-11 13:16:21 +08:00
getList() {
2023-04-18 09:34:11 +08:00
const {id: deviceId} = this.$route.query
this.instance.post(`/app/appzyvideobroadcast/list`, null, {
params: {...this.page, ...this.search, deviceId}
}).then(res => {
if (res?.data) {
2022-06-11 13:16:21 +08:00
this.tableData = res.data.records
this.page.total = res.data.total
}
})
},
reset(id) {
this.$confirm('确定要撤回该任务吗?').then(() => {
this.instance.post(`/app/appzyvideobroadcast/getBroadcastRecall?broadcastId=${id}`).then((res) => {
2022-06-08 17:19:32 +08:00
if (res.code == 0) {
2022-06-11 13:16:21 +08:00
this.$message.success('撤回成功!')
2022-06-08 17:19:32 +08:00
this.getList()
}
})
})
},
2023-04-18 09:34:11 +08:00
cancel() {
this.$router.push({})
2022-06-08 17:19:32 +08:00
},
},
}
</script>
<style lang="scss" scoped>
2022-06-09 16:42:46 +08:00
.taskList {
2022-06-08 17:19:32 +08:00
height: 100%;
}
2023-04-18 09:34:11 +08:00
</style>