Files
dvcp_v2_webapp/packages/device/AppBroadcast/components/List.vue

173 lines
5.3 KiB
Vue
Raw Normal View History

2021-12-14 18:36:19 +08:00
<template>
<section class="AppPetitionManage">
<ai-list>
2021-12-23 11:19:23 +08:00
<ai-title slot="title" title="播发记录" isShowBottomBorder/>
2021-12-14 18:36:19 +08:00
<template #content>
<ai-search-bar bottomBorder>
<template slot="left">
2022-06-11 14:36:19 +08:00
<ai-select v-model="search.cyclingType" placeholder="媒资类型" clearable
2021-12-14 18:36:19 +08:00
:selectList="$dict.getDict('dlbResourceType')"
@change=";(page.current = 1), getList()"></ai-select>
2022-06-11 14:36:19 +08:00
<ai-select v-model="search.messageLevel" placeholder="级别" clearable
2021-12-14 18:36:19 +08:00
:selectList="$dict.getDict('dlbMessageUrgency')"
@change=";(page.current = 1), getList()"></ai-select>
</template>
<template slot="right">
2022-06-11 14:36:19 +08:00
<el-input v-model="search.sourceName" size="small" placeholder="媒资名称" clearable
2022-03-22 14:37:09 +08:00
v-throttle="() => {page.current = 1, getList()}"
2021-12-14 18:36:19 +08:00
@clear=";(page.current = 1), (search.messageName = ''), getList()"
suffix-icon="iconfont iconSearch"/>
</template>
</ai-search-bar>
<ai-search-bar class="ai-search-ba mar-t10">
<template slot="left">
2021-12-22 16:31:38 +08:00
<!-- <el-button icon="iconfont iconAdd" type="primary" size="small" @click="onAdd('')">添加</el-button> -->
2021-12-14 18:36:19 +08:00
<!-- <el-button icon="iconfont iconDelete" size="small" @click="removeAll" :disabled="ids.length == 0">删除 </el-button> -->
</template>
</ai-search-bar>
2022-06-10 17:52:23 +08:00
<ai-table :tableData="tableData" :col-configs="colConfigs" :total="total" :dict="dict" v-loading="loading"
2021-12-14 18:36:19 +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="180" fixed="right">
<template slot-scope="{ row }">
2022-06-11 14:36:19 +08:00
<!-- <el-button type="text" @click="onAdd(row.id)">复制</el-button> -->
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="reset(row.id)"
2021-12-14 18:36:19 +08:00
v-if="row.broadcastStatus == 0 || row.broadcastStatus == 1 || row.broadcastStatus == 2">撤回
</el-button>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</section>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: 'List',
props: {
dict: Object,
instance: Function,
params: Object,
},
data() {
return {
isAdd: false,
page: {
current: 1,
size: 10,
},
total: 0,
search: {
2022-06-11 14:36:19 +08:00
sourceName: '',
cyclingType: '',
messageLevel: '',
2021-12-14 18:36:19 +08:00
},
id: '',
ids: [],
colConfigs: [
2022-06-11 14:36:19 +08:00
{prop: 'sourceName', label: '媒资名称', width: 200},
{prop: 'cyclingType', label: '媒资类型', align: 'center', dict: "dlbResourceType"},
{prop: 'messageLevel', label: '级别', align: 'center', dict: "dlbMessageUrgency"},
{prop: 'taskType', label: '播发方式', align: 'center', render: (h, {row}) => {
return h('span', null, (row.taskType == 1? '定时播放':'立即播放'))},
},
{prop: 'startTime', label: '开始时间', align: 'center', width: 180},
// {prop: 'broadcastStatus', label: '状态', align: 'center', dict: "dlbBroadcastStatus"},
2021-12-14 18:36:19 +08:00
{prop: 'areaName', label: '地区', align: 'center'},
{prop: 'createUserName', label: '创建人', align: 'center'},
{slot: 'options'},
],
tableData: [],
areaId: '',
2022-06-10 17:52:23 +08:00
loading: false,
2021-12-14 18:36:19 +08:00
}
},
computed: {
...mapState(['user']),
param() {
return {
...this.search,
areaId: this.user.info?.areaId,
ids: this.ids,
}
},
},
created() {
this.areaId = this.user.info.areaId
2022-06-11 14:36:19 +08:00
this.dict.load('dlbDyclingType', 'dlbMessageUrgency', 'dlbBroadTaskType', 'dlbBroadcastStatus', 'dlbMessageUrgency').then(() => {
2021-12-14 18:36:19 +08:00
this.getList()
2022-06-10 17:52:23 +08:00
this.loading = true
2021-12-14 18:36:19 +08:00
})
},
methods: {
getList() {
2022-06-11 14:36:19 +08:00
this.instance.post(`/app/appzyvideobroadcast/list`, null, {
2021-12-14 18:36:19 +08:00
params: {
...this.page,
...this.search,
},
})
.then((res) => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = parseInt(res.data.total)
2022-06-10 17:52:23 +08:00
this.loading = false
2021-12-14 18:36:19 +08:00
}
2022-06-10 17:52:23 +08:00
}).catch(() => {
this.loading = false
2021-12-14 18:36:19 +08:00
})
},
onAdd(id) {
this.$emit('change', {
type: 'add',
params: {
id: id || ''
}
})
},
2022-06-08 17:57:19 +08:00
toDetail(id) {
this.$emit('change', {
type: 'detail',
params: {
id: id || ''
}
})
},
2022-06-11 14:36:19 +08:00
reset(id) {
this.$confirm('确定要撤回该广播?').then(() => {
2021-12-14 18:36:19 +08:00
this.instance.post(`/app/appzyvideobroadcast/getBroadcastRecall?broadcastId=${id}`).then((res) => {
if (res.code == 0) {
this.$message.success('撤回成功!')
this.getList()
}
})
})
},
removeAll() {
var id = this.ids.join(',')
this.remove(id)
},
},
}
</script>
<style lang="scss" scoped>
.AppPetitionManage {
height: 100%;
.mar-t10 {
margin-top: 10px;
}
}
</style>