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

151 lines
4.1 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>
2022-06-08 17:57:19 +08:00
<ai-title slot="title" title="任务列表" isShowBack isShowBottomBorder @onBackClick="cancel(true)"/>
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 10:34:12 +08:00
<template slot-scope="{ row }" v-if="row.taskType == 1">
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>
export default {
2022-06-09 16:42:46 +08:00
name: 'taskList',
2022-06-08 17:19:32 +08:00
components: {},
props: {
dict: Object,
instance: Function,
params: Object,
},
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',
2022-06-11 13:16:21 +08:00
render: (h, { row })=>{
2022-06-13 13:59:03 +08:00
return h('span',null,this.dict.getLabel('dlbResourceType',row.cyclingType))
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',
2022-06-11 13:16:21 +08:00
render: (h, { row })=>{
return h('span',null,this.dict.getLabel('dlbMessageUrgency',row.messageLevel))
}
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}) => {
2022-06-11 13:16:21 +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',
2022-06-13 14:14:47 +08:00
render: (h, { row })=>{
return h('span',null, (row.broadcastStatus == 0? '已下发': row.broadcastStatus == 3? '播发成功': row.broadcastStatus == 6? '已取消': ''))
}
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() {
2022-06-13 13:59:03 +08:00
this.$dict.load('dlbDyclingType','dlbMessageUrgency','dlbBroadcastStatus','dlbResourceType').then(()=>{
2022-06-11 13:16:21 +08:00
this.getList()
})
2022-06-08 17:19:32 +08:00
},
methods: {
2022-06-11 13:16:21 +08:00
getList() {
this.instance.post(`/app/appzyvideobroadcast/list?deviceId`,null,{
params: {
...this.page,
...this.search,
deviceId: this.params.deviceId
}
}).then(res=>{
if(res?.data) {
this.tableData = res.data.records
this.page.total = res.data.total
}
})
},
2022-06-08 17:19:32 +08:00
2022-06-11 13:16:21 +08:00
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()
}
})
})
},
cancel(isRefresh) {
this.$emit('change', {
2022-06-08 17:57:19 +08:00
type: 'list',
2022-06-08 17:19:32 +08:00
isRefresh: !!isRefresh,
})
},
},
}
</script>
<style lang="scss" scoped>
2022-06-09 16:42:46 +08:00
.taskList {
2022-06-08 17:19:32 +08:00
height: 100%;
}
</style>