qingzhengli
8 months ago
4 changed files with 207 additions and 14 deletions
@ -0,0 +1,182 @@ |
|||||
|
<template> |
||||
|
<div class="body"> |
||||
|
<div class="right" :style="{ width: isMultiControl ? '100%' : undefined }"> |
||||
|
<div class="top-content"> |
||||
|
<Video v-if="!isMultiControl" class="item-video" :pileNum="pileNum" /> |
||||
|
|
||||
|
<label style="width: 99px;">发布内容: </label> |
||||
|
<ElInput type="textarea" v-model="releaseMessage" :autosize="{ minRows: 3, maxRows: 3 }" :maxlength="150" |
||||
|
showWordLimit placeholder="请输入发布内容" /> |
||||
|
</div> |
||||
|
|
||||
|
<div class="footer"> |
||||
|
<Button @click.native="handleSubmit" :loading="submitting"> |
||||
|
确定 |
||||
|
</Button> |
||||
|
|
||||
|
<Button style="background-color: rgba(0, 179, 204, 0.3)" @click.native="cancelClick"> |
||||
|
取消 |
||||
|
</Button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Dialog from "@screen/components/Dialog/index.vue"; |
||||
|
import Button from "@screen/components/Buttons/Button.vue"; |
||||
|
import Video from "@screen/components/Video"; |
||||
|
import CheckboxGroup from "@screen/components/FormConfig/components/ElCheckboxGroup.vue"; |
||||
|
|
||||
|
import request from "@/utils/request"; |
||||
|
import { batchFunctions } from "@screen/pages/Home/components/RoadAndEvents/utils/httpList.js"; |
||||
|
|
||||
|
import { Message } from "element-ui"; |
||||
|
|
||||
|
export default { |
||||
|
name: "BroadcastReleases", |
||||
|
components: { |
||||
|
Dialog, |
||||
|
Button, |
||||
|
Video, |
||||
|
CheckboxGroup, |
||||
|
}, |
||||
|
model: { |
||||
|
prop: "visible", |
||||
|
event: "update:value", |
||||
|
}, |
||||
|
props: { |
||||
|
visible: Boolean, |
||||
|
pileNum: String, |
||||
|
otherConfig: String, |
||||
|
isMultiControl: Boolean, |
||||
|
selectItems: { |
||||
|
type: Array, |
||||
|
default: () => [] |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
submitting: false, |
||||
|
checkList: [], |
||||
|
releaseMessage: null, |
||||
|
// musicList: [], |
||||
|
}; |
||||
|
}, |
||||
|
computed: { |
||||
|
modelVisible: { |
||||
|
get() { |
||||
|
return this.visible; |
||||
|
}, |
||||
|
set(val) { |
||||
|
this.$emit("update:value", val); |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
created() { |
||||
|
// getDeviceList(5).then((data) => { |
||||
|
// if (Array.isArray(data)) |
||||
|
// this.musicList = data.map((item) => ({ |
||||
|
// ...item, |
||||
|
// disabled: item.deviceState != 1, |
||||
|
// })); |
||||
|
// }); |
||||
|
}, |
||||
|
methods: { |
||||
|
cancelClick() { |
||||
|
this.$emit("update:activeIcon", null); |
||||
|
this.submitting = false; |
||||
|
}, |
||||
|
handleSubmit() { |
||||
|
const selectItems = this.selectItems.map(item => JSON.parse(item)); |
||||
|
console.log(this.selectItems, selectItems, "selectItems"); |
||||
|
const checkList = selectItems.map(item => JSON.parse(item.otherConfig)); |
||||
|
if (!this.releaseMessage?.trim()) |
||||
|
return Message.error("发布内容不能为空!"); |
||||
|
if (!selectItems.length) |
||||
|
return Message.error("请至少选择一个广播设备!"); |
||||
|
|
||||
|
this.submitting = true; |
||||
|
|
||||
|
batchFunctions( |
||||
|
{ |
||||
|
"devices": selectItems, |
||||
|
"functions": [ |
||||
|
{ |
||||
|
"functionId": "1",//随便 不为空即可 |
||||
|
"params": { |
||||
|
name: "task-3", |
||||
|
outVol: "6", |
||||
|
priority: "1", |
||||
|
text: this.releaseMessage.trim(), |
||||
|
repeatTimes: "3", |
||||
|
termList: checkList, |
||||
|
functionType: "startPaTts", |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
] |
||||
|
}) |
||||
|
.then((data) => { |
||||
|
const allItems = data.data; |
||||
|
const successItems = allItems.filter(item => item.result.retCode == 0); |
||||
|
console.log("xxxxxxx111") |
||||
|
if (successItems.length == allItems.length) { |
||||
|
Message.success("广播设置成功!"); |
||||
|
} else { |
||||
|
Message.error(`广播设置失败, 失败${allItems.length - successItems.length}个!`); |
||||
|
} |
||||
|
}) |
||||
|
.finally(() => { |
||||
|
this.submitting = false; |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.body { |
||||
|
display: flex; |
||||
|
gap: 9px; |
||||
|
height: 100%; |
||||
|
padding-right: 9px; |
||||
|
margin-top: 15px; |
||||
|
|
||||
|
.right { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
justify-content: space-between; |
||||
|
|
||||
|
.top-content { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
// gap: 9px; |
||||
|
align-items: center; |
||||
|
|
||||
|
.item-video { |
||||
|
width: 545px; |
||||
|
} |
||||
|
|
||||
|
label { |
||||
|
font-size: 15px; |
||||
|
font-family: PingFang SC, PingFang SC; |
||||
|
font-weight: 400; |
||||
|
color: #3de8ff; |
||||
|
line-height: 19px; |
||||
|
vertical-align: middle; |
||||
|
text-align: right; |
||||
|
padding-right: 12px; |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.footer { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: flex-end; |
||||
|
gap: 9px; |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue