Files
dvcp_v2_wxcp_app/src/apps/AppBroadcast1/AppEquipment/detail.vue
2022-06-13 16:25:17 +08:00

332 lines
9.0 KiB
Vue

<template>
<div class="detail">
<AiTopFixed>
<div class="tab">
<u-tabs :list="tab" :is-scroll="false" :current="currIndex" @change="change" height="96" :bar-style="barStyle"></u-tabs>
</div>
</AiTopFixed>
<div class="content">
<div class="info-content" v-if="currIndex != 1">
<p>{{info.name}}</p>
<div class="info">
<span>设备编号</span>
<span class="color-333">{{info.serialNo}}</span>
</div>
<div class="info">
<span>设备状态</span>
<span style="color: #4E8EEE">{{ $dict.getLabel('dlbDevStatus', info.devStatus) }}</span>
</div>
<div class="info">
<span>信号强度</span>
<span class="color-333">{{ $dict.getLabel('dlbDevSignal', info.devSignal) }}</span>
</div>
<div class="info">
<span>音量</span>
<span class="color-333">{{info.volume}}</span>
</div>
<div class="info">
<span>所属区划</span>
<span class="color-333">{{info.areaName}}</span>
</div>
</div>
<div class="list-content" v-else>
<div class="list">
<div class="item" v-for="(item, index) in list" :key="index" @click="toPlayDetail(item)">
<div class="left">
<p>{{ item.sourceName }}</p>
<div>{{item.createUserName}} {{ item.createTime }}</div>
<div>{{ $dict.getLabel('dlbMessageUrgency', item.messageLevel) }} {{item.taskType == 1 ? '定时播放' : '立即播放'}}</div>
</div>
<div class="right">
<div class="status" v-if="item.broadcastStatus == 6" style="color: #999;">已取消</div>
<div class="status" v-if="item.broadcastStatus == 3" style="color: #5aad6a;">播发成功</div>
<div class="status" v-if="item.broadcastStatus == 0">已下发</div>
<div v-if="item.broadcastStatus == 0 || item.broadcastStatus == 1 || item.broadcastStatus == 2">
<div class="cancel-btn" @click.stop="cancel(item.id)" v-if="item.taskType == 1">撤销</div>
<div class="cancel-btn bg-AFD0FC" v-else>撤销</div>
</div>
<div class="cancel-btn bg-AFD0FC" v-else>撤销</div>
</div>
</div>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div>
</div>
<div class="btn" @click="setVolume" v-if="currIndex != 1">设置音量</div>
<u-popup v-model="isShow" mode="bottom" class="popup">
<div class="title">
<span @click="isShow=false">取消</span>
<p>设置音量</p>
<span @click="confirmAdd">保存</span>
</div>
<div class="slider-content">
<span>1</span>
<div class="slider">
<u-slider v-model="volume" min="1" max="100" :use-slot="true" block-color="#007BFF" step="10">
<view class="">
<view class="badge-button">
{{volume}}
</view>
</view>
</u-slider>
</div>
<span>100</span>
</div>
</u-popup>
</div>
</template>
<script>
export default {
name: "detail",
data() {
return {
barStyle: {width: '98px', bottom: '-3px', left: '-38px'},
tab: [{name: '基本信息'}, {name: '播发任务'}],
list: [],
currIndex: 0,
current: 1,
isShow: false,
volume: 10,
info: {},
id: ''
}
},
onLoad(query) {
this.id = query.id
this.$dict.load(['dlbDevStatus', 'dlbDevSignal']).then(() => {
this.getDetail()
})
},
onShow() {
document.title = '设备详情'
},
methods: {
change(index) {
this.currIndex = index
},
toPlayDetail(item) {
uni.navigateTo({url: `../AppPlayList/detail?id=${item.id}`})
},
setVolume() {
this.isShow = true
this.volume = this.info.volume
},
confirmAdd() {
this.$http.post(`/app/appdlbquipment/volumeControl?deviceId=${this.info.deviceId}&volume=${this.volume}`).then((res) => {
if (res.code == 0) {
this.getDetail()
this.isShow = false
this.$u.toast('音量设置成功')
}
})
},
getDetail() {
this.$http.post(`/app/appdlbquipment/queryDetailById?id=${this.id}`).then((res) => {
if (res.code == 0) {
this.info = res.data
this.getPlayList()
}
})
},
getPlayList() {
this.$http.post(`/app/appzyvideobroadcast/list?current=${this.current}&size=10&serialNo=${this.info.serialNo}`).then(res => {
if (res.code == 0) {
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
this.list = res.data.records
}
}
})
},
cancel(id) {
this.$confirm('确定撤回该广播?').then(() => {
this.$http.post(`/app/appzyvideobroadcast/getBroadcastRecall?broadcastId=${id}`).then((res) => {
if (res.code == 0) {
this.$u.toast('撤回成功!')
this.getList()
}
})
})
},
},
onReachBottom() {
if(this.currIndex == 1) {
this.current ++
this.getPlayList()
}
}
}
</script>
<style lang="scss" scoped>
.detail {
padding-bottom: 128px;
::v-deep .AiTopFixed{
.content{
padding: 0;
}
}
.tab {
border-bottom: 1px solid #ddd;
margin-bottom: 4px;
}
.content{
margin-top: 8px;
.info-content{
padding-left: 32px;
background-color: #fff;
p{
padding: 32px 32px 32px 0;
font-size: 38px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333;
line-height: 56px;
word-break: break-all;
}
.info{
display: flex;
justify-content: space-between;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
color: #999;
line-height: 44px;
padding: 34px 32px 32px 0;
border-bottom: 1px solid #ddd;
.color-333{
color: #333;
}
}
}
.list-content{
.list{
padding-left: 32px;
background-color: #fff;
.item{
display: flex;
padding: 16px 40px 16px 0;
box-sizing: border-box;
border-bottom: 1px solid #ddd;
.left{
width: calc(100% - 176px);
p{
font-size: 34px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #333;
line-height: 48px;
word-break: break-all;
margin-bottom: 8px;
}
div{
font-size: 26px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #999;
line-height: 36px;
margin-bottom: 8px;
}
}
.right{
width: 160px;
text-align: center;
.status{
font-size: 34px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #4E8EEE;
line-height: 48px;
margin-bottom: 28px;
}
.cancel-btn{
width: 154px;
height: 60px;
line-height: 60px;
text-align: center;
background: #3975C6;
border-radius: 8px;
font-size: 30px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #FFF;
}
.bg-AFD0FC{
background: #AFD0FC;
}
}
}
}
}
}
.btn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 112px;
line-height: 112px;
text-align: center;
background: #3975C6;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #FFFFFF;
}
.popup{
background-color: #fff;
.title{
padding: 24px 0;
line-height: 48px;
text-align: center;
span{
display: inline-block;
width: 120px;
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #5297FF;
}
p{
display: inline-block;
width: calc(100% - 240px);
font-size: 36px;
font-family: PingFangSC-Regular, PingFang SC;
color: #0F1826;
}
}
.slider-content{
padding: 56px 44px 120px;
display: flex;
span{
display: inline-block;
font-size: 40px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #666;
line-height: 56px;
}
.slider{
display: inline-block;
flex: 1;
margin: 26px 30px 0;
}
}
}
::v-deep .u-slider__button-wrap{
margin-top: -40px;
font-size: 44px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #666;
}
}
</style>