Browse Source

语音广播完成

wangqin
Joe 10 months ago
parent
commit
f949169ffa
  1. 14
      ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/components/ElCheckboxGroup.vue
  2. 99
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Broadcast/components/BroadcastReleases.vue
  3. 7
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Broadcast/index.vue
  4. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js
  5. 35
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/httpList.js

14
ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/components/ElCheckboxGroup.vue

@ -1,7 +1,7 @@
<template>
<ElCheckboxGroup v-bind="$attrs" v-on="$listeners" class='ElCheckboxGroup'>
<ElCheckbox v-for="item in options" :label="item.key || item.label" :key="item.key || item.label">
<slot :name="item.key || item.label" :data="item">{{ item.label }}</slot>
<ElCheckbox v-for="item in options" :label="item[id] || item[label]" :key="item[id] || item[label]">
<slot :name="item[id] || item[label]" :data="item">{{ item[label] }}</slot>
</ElCheckbox>
</ElCheckboxGroup>
</template>
@ -19,7 +19,15 @@ export default {
options: {
type: Array,
default: () => []
}
},
id: {
type: String,
default: 'key'
},
label: {
type: String,
default: 'label'
},
}
}
</script>

99
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Broadcast/components/BroadcastReleases.vue

@ -4,14 +4,22 @@
<div class="body">
<div class="left">
<div class="title">路测广播列表</div>
<CheckboxGroup class="checkbox-group" :value="[]" :options="options" />
<CheckboxGroup class="checkbox-group" v-model="checkList" :options="musicList" id="otherConfig"
label="deviceName">
<template #[otherConfig]="{ data }">
<span style="color: #6EE5FE;">
{{ data.deviceName }}(当前设备)
</span>
</template>
</CheckboxGroup>
</div>
<div class="right">
<div class="top-content">
<Video class="item-video" />
<Video class="item-video" :pileNum="pileNum" />
<label>发布内容: </label>
<ElInput type="textarea" :autosize="{ minRows: 3, maxRows: 3 }" :maxlength="150" showWordLimit />
<ElInput type="textarea" v-model="releaseMessage" :autosize="{ minRows: 3, maxRows: 3 }" :maxlength="150"
showWordLimit placeholder="请输入发布内容" />
</div>
<div class="footer">
@ -25,8 +33,6 @@
</div>
</div>
</div>
<!-- <Form class="form" ref="FormConfigRef" :formList="formList" column="1" style="flex: 1;" labelWidth="120px" /> -->
</div>
</Dialog>
</template>
@ -38,11 +44,9 @@ import Form from '@screen/components/FormConfig';
import Video from "@screen/components/Video"
import CheckboxGroup from "@screen/components/FormConfig/components/ElCheckboxGroup.vue"
import { delay } from "@screen/utils/common.js"
import request from "@/utils/request";
import { getDeviceList } from "@screen/pages/Home/components/RoadAndEvents/utils/httpList.js";
import { Message } from "element-ui";
// import { axiosIns } from "@screen/utils/axios/auth.js";
export default {
name: 'BroadcastReleases',
@ -59,15 +63,17 @@ export default {
},
props: {
visible: Boolean,
deviceId: String
deviceId: String,
pileNum: String,
currentId: [String, Number],
otherConfig: Object
},
data() {
return {
submitting: false,
options: Array.from({ length: 24 }).map((_, index) => ({
key: index,
label: "阿发"
}))
checkList: [],
releaseMessage: null,
musicList: []
}
},
computed: {
@ -80,44 +86,44 @@ export default {
}
}
},
watch: {
modelVisible: {
immediate: true,
handler(bool) {
if (!bool) return;
this.reDisplay();
}
}
created() {
getDeviceList(5)
.then(data => {
if (Array.isArray(data)) this.musicList = data;
})
},
methods: {
reDisplay() {
},
handleSubmit() {
const result = {}, formData = this.$refs.FormConfigRef?.formData;
let functionId = 51;
result.mode = formData.controlType === 'manual' ? "00" : "01";
delete result.controlType;
if (result.mode === '01') {
if (!formData.displayTime?.length) return Message.error(`时间不能为空!`);
result.startDisplayTime = formData.displayTime[0];
result.endDisplayTime = formData.displayTime[1];
delete result.displayTime;
} else {
if (!formData.onWorkStatus || !formData.inWorkStatus) return Message.error(`工作状态不能为空!`);
result.onWorkStatus = formData.onWorkStatus
result.inWorkStatus = formData.inWorkStatus
}
if (!this.releaseMessage?.trim()) return Message.error("发布内容不能为空!");
if (!this.checkList.length) return Message.error("请至少选择一个广播设备!");
this.submitting = true;
// this.submitting = false;
// return;
request({
url: `/broadcast/broadcastFunctionCall`,
method: "post",
data: {
"name": "task-3",
"outVol": "6",
"priority": "1",
"text": this.releaseMessage.trim(),
"repeatTimes": "3",
"termList": this.checkList.map(str => JSON.parse(str)),
"functionType": "startPaTts"
}
})
.then(data => {
console.log(data);
if (data.code == '200') {
Message.success("广播发布成功!");
this.modelVisible = false;
} else {
Message.error("广播发布失败!");
}
})
.finally(() => {
this.submitting = false;
})
}
},
}
@ -126,7 +132,7 @@ export default {
<style lang='scss' scoped>
.BroadcastReleases {
// width: 450px;
height: 397px;
height: 420px;
display: flex;
flex-direction: column;
gap: 15px;
@ -168,7 +174,6 @@ export default {
.item-video {
width: 545px;
height: 216px;
}
label {

7
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Broadcast/index.vue

@ -1,6 +1,6 @@
<template>
<Dialog v-model="obverseVisible" title="行车诱导">
<Video class="item-video" />
<Dialog v-model="obverseVisible" title="语音广播">
<Video class="video-stream" :pileNum="dialogData.stakeMarkId" />
<div class="Broadcast">
<ElTabs v-model="activeName" @tab-click="handleClickTabs" class="tabs">
@ -15,7 +15,8 @@
</div>
</div>
<BroadcastReleases v-model="releaseVisible" :deviceId="dialogData.iotDeviceId || '8697-1'" />
<BroadcastReleases v-model="releaseVisible" :deviceId="dialogData.iotDeviceId" :pileNum="dialogData.stakeMarkId"
:otherConfig="dialogData.otherConfig" :currentId="dialogData.id" />
</Dialog>
</template>

2
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js

@ -49,7 +49,7 @@ export const eventMap = {
async "地图设备/map"(item) {
const config = DeviceForMap[item.title];
const data = await getDeviceList(config.deviceType);
const data = await getDeviceList(config.deviceType).catch(() => {});
if (!data) return;

35
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/httpList.js

@ -174,22 +174,29 @@ const DeviceTypeMap = {
14: "光线在线监测",
*/
export function getDeviceList(deviceType) {
return request({
url: "/business/device/query",
method: "get",
params: {
deviceType,
},
})
.then(({ code, data }) => {
if (code != 200)
return Message.error(`${DeviceTypeMap[deviceType]}设备加载失败!`);
return new Promise((resolve, reject) => {
if (!deviceType) return reject();
return data;
request({
url: "/business/device/query",
method: "get",
params: {
deviceType,
},
})
.catch(() => {
Message.error(`${DeviceTypeMap[deviceType]}设备加载失败!`);
});
.then(({ code, data }) => {
if (code != 200) {
reject();
return Message.error(`${DeviceTypeMap[deviceType]}设备加载失败!`);
}
resolve(data);
})
.catch(() => {
Message.error(`${DeviceTypeMap[deviceType]}设备加载失败!`);
reject();
});
});
}
/**

Loading…
Cancel
Save