Files
dvcp_v2_webapp/packages/device/AppBroadcast/components/List.vue
2022-06-13 14:50:39 +08:00

179 lines
5.6 KiB
Vue

<template>
<section class="AppPetitionManage">
<ai-list>
<ai-title slot="title" title="播发记录" isShowBottomBorder/>
<template #content>
<ai-search-bar bottomBorder>
<template slot="left">
<ai-select v-model="search.cyclingType" placeholder="媒资类型" clearable
:selectList="$dict.getDict('dlbResourceType')"
@change=";(page.current = 1), getList()"></ai-select>
<ai-select v-model="search.messageLevel" placeholder="级别" clearable
:selectList="$dict.getDict('dlbMessageUrgency')"
@change=";(page.current = 1), getList()"></ai-select>
</template>
<template slot="right">
<el-input v-model="search.sourceName" size="small" placeholder="媒资名称" clearable
v-throttle="() => {page.current = 1, getList()}"
@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">
<!-- <el-button icon="iconfont iconAdd" type="primary" size="small" @click="onAdd('')">添加</el-button> -->
<!-- <el-button icon="iconfont iconDelete" size="small" @click="removeAll" :disabled="ids.length == 0">删除 </el-button> -->
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :col-configs="colConfigs" :total="total" :dict="dict" v-loading="loading"
: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 }">
<!-- <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)"
v-if="row.taskType == 1 && (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: {
sourceName: '',
cyclingType: '',
messageLevel: '',
},
id: '',
ids: [],
colConfigs: [
{prop: 'sourceName', label: '媒资名称', width: 200},
{prop: 'type', label: '媒资类型', align: 'center', render: (h, {row}) => {
return h('span', null, this.dict.getLabel('dlbResourceType',row.type))},
},
{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',
render: (h, { row })=>{
return h('span',null, (row.broadcastStatus == 0? '已下发': row.broadcastStatus == 3? '播发成功': row.broadcastStatus == 6? '已取消': ''))
}
},
// {prop: 'areaName', label: '地区', align: 'center'},
{prop: 'createUserName', label: '创建人', align: 'center'},
{slot: 'options'},
],
tableData: [],
areaId: '',
loading: false,
}
},
computed: {
...mapState(['user']),
param() {
return {
...this.search,
areaId: this.user.info?.areaId,
ids: this.ids,
}
},
},
created() {
this.areaId = this.user.info.areaId
this.dict.load('dlbDyclingType', 'dlbMessageUrgency', 'dlbBroadTaskType', 'dlbBroadcastStatus', 'dlbMessageUrgency').then(() => {
this.getList()
this.loading = true
})
},
methods: {
getList() {
this.instance.post(`/app/appzyvideobroadcast/list`, null, {
params: {
...this.page,
...this.search,
},
})
.then((res) => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = parseInt(res.data.total)
this.loading = false
}
}).catch(() => {
this.loading = false
})
},
onAdd(id) {
this.$emit('change', {
type: 'add',
params: {
id: id || ''
}
})
},
toDetail(id) {
this.$emit('change', {
type: 'detail',
params: {
id: id || ''
}
})
},
reset(id) {
this.$confirm('确定要撤回该广播?').then(() => {
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>