Browse Source

feat 批量控制 情报板完成

wangqin
qingzhengli 7 months ago
parent
commit
d69800720a
  1. 287
      ruoyi-ui/src/views/JiHeExpressway/mixins/InfoBoard.js
  2. 12
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/HomeFrameControl/index.vue
  3. 1019
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/InfoBoard/InfoBoard.vue
  4. 1040
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/InfoBoard/index.vue
  5. 32
      ruoyi-ui/src/views/JiHeExpressway/pages/service/board/index.vue

287
ruoyi-ui/src/views/JiHeExpressway/mixins/InfoBoard.js

@ -1,152 +1,157 @@
import { publishToBoard, saveBoardReleaseLog } from '@/api/board/board' import { publishToBoard, saveBoardReleaseLog } from "@/api/board/board";
import moment from 'moment/moment'; import moment from "moment/moment";
import store from '@/store' import store from "@/store";
export default{ import { Message } from "element-ui";
data(){ export default {
return { data() {
return {};
},
methods: {
// 新增待下发
____onAddDeviceItem() {
let arr = this.selectedSize.split("*");
} this.editDialog = {
}, visible: true,
methods:{ mode: "add",
// 新增待下发 type: "device",
____onAddDeviceItem() { tpl: {
let arr = this.selectedSize.split("*"); textContent: "",
origin: {
this.editDialog = { displayAreaWidth: +arr[0],
visible: true, displayAreaHeight: +arr[1],
mode: "add", },
type: "device",
tpl: {
"textContent": "",
"origin": {
displayAreaWidth: +arr[0],
displayAreaHeight: +arr[1]
}
}
}
},
// 从模板新增待下发
____onTplToDevice(item, showDialog) {
// if(this.checkedDeviceIds.length<=0){
// this.$message.warning('未选择设备!');
// return;
// }
let arr = this.selectedSize.split("*");
item.origin = {
displayAreaWidth: +arr[0],
displayAreaHeight: +arr[1]
}
this.editDialog = {
visible: showDialog == false ? false : true,
mode: "toDevice",
type: "template",
tpl: item
}
}, },
// 发布信息 };
____publishInfo() { },
let deviceList = []; // 从模板新增待下发
if (this.selectedDevice){ ____onTplToDevice(item, showDialog) {
deviceList = [this.selectedDevice]; // if(this.checkedDeviceIds.length<=0){
}else{ // this.$message.warning('未选择设备!');
deviceList = this.selectedDevices; // return;
} // }
this.$confirm('是否确定发布情报板?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
let content = []; let arr = this.selectedSize.split("*");
item.origin = {
displayAreaWidth: +arr[0],
displayAreaHeight: +arr[1],
};
this.selectedBdMsg.forEach(item => { this.editDialog = {
content.push({ visible: showDialog == false ? false : true,
STAY: item.playbackDuration, mode: "toDevice",
ACTION: item.screenEntryMethod, type: "template",
SPEED: item.fontSpacing || 0, tpl: item,
COLOR: item.foregroundColor, };
FONT: item.font, },
FONT_SIZE: item.fontSize, // 发布信息
CONTENT: item.textContent.replaceAll(',', '\\,').replaceAll('=', '\\=').replaceAll('\n', '\\\\n'), ____publishInfo() {
width: item.displayAreaWidth, let deviceList = [];
height: item.displayAreaHeight, if (this.isMultiControl && !this.selectItems.length) {
formatStyle: item.verticalAlignment return Message.error("请至少选择一个设备!");
}) }
}) const selectItems = this.selectItems.map((item) => JSON.parse(item));
if (this.isMultiControl) deviceList = selectItems;
else {
if (this.selectedDevice) deviceList = [this.selectedDevice];
else deviceList = this.selectedDevices;
}
let data = { content: content, deviceList } this.$confirm("是否确定发布情报板?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let loading = this.$loading({
lock: true,
text: "Loading",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
if (IS_TESTING) { let content = [];
// this.saveLog(content);
this.____getDeviceInfo();
loading.close()
} else { this.selectedBdMsg.forEach((item) => {
publishToBoard(data).then(res => { content.push({
// this.saveLog(content); STAY: item.playbackDuration,
this.$message({ ACTION: item.screenEntryMethod,
type:"success", SPEED: item.fontSpacing || 0,
message:"发布成功!" COLOR: item.foregroundColor,
}); FONT: item.font,
this.____getDeviceInfo(); FONT_SIZE: item.fontSize,
}).catch(err=>{ CONTENT: item.textContent
.replaceAll(",", "\\,")
.replaceAll("=", "\\=")
.replaceAll("\n", "\\\\n"),
width: item.displayAreaWidth,
height: item.displayAreaHeight,
formatStyle: item.verticalAlignment,
});
});
}).finally(()=>{ let data = { content: content, deviceList };
loading.close()
});
}
}).catch(() => { if (IS_TESTING) {
// this.saveLog(content);
this.____getDeviceInfo();
loading.close();
} else {
publishToBoard(data)
.then((res) => {
// this.saveLog(content);
this.$message({ this.$message({
type: 'info', type: "success",
message: '取消发布' message: "发布成功!",
}) });
}) !isMultiControl && this.____getDeviceInfo();
})
}, .catch((err) => {})
// .finally(() => {
saveLog(content){ loading.close();
let time = moment().format("YYYY-MM-DD HH:mm:ss"); });
let device = this.selectedDevices; }
let data = { })
"createBy": store.getters.name, .catch(() => {
"createTime": time, this.$message({
"deviceId": device.id, type: "info",
"deviceName": device.deviceName, message: "取消发布",
"direction": device.direction, });
"params": {}, });
"platform": "", },
"releaseContent": JSON.stringify(content), //
"releaseDeptId": "", saveLog(content) {
"releaseDeptName": "", let time = moment().format("YYYY-MM-DD HH:mm:ss");
"releaseIp": "", let device = this.selectedDevices;
"releaseStatus": "", let data = {
"releaseTime": time, createBy: store.getters.name,
"releaseUserId": "", createTime: time,
"releaseUserName": "", deviceId: device.id,
"remark": "", deviceName: device.deviceName,
"searchValue": "", direction: device.direction,
"stakeMark": device.stakeMark, params: {},
"updateBy": "", platform: "",
"updateTime": time releaseContent: JSON.stringify(content),
} releaseDeptId: "",
saveBoardReleaseLog(data).then(res => { releaseDeptName: "",
if(res.code==200){ releaseIp: "",
console.log("情报板日志已保存:::" , data); releaseStatus: "",
}else{ releaseTime: time,
console.log("情报板日志保存失败!"); releaseUserId: "",
} releaseUserName: "",
}) remark: "",
searchValue: "",
stakeMark: device.stakeMark,
updateBy: "",
updateTime: time,
};
saveBoardReleaseLog(data).then((res) => {
if (res.code == 200) {
console.log("情报板日志已保存:::", data);
} else {
console.log("情报板日志保存失败!");
} }
} });
} },
},
};

12
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/HomeFrameControl/index.vue

@ -14,7 +14,7 @@
</span> </span>
<Form v-model="data" labelWidth="90px" column="2" class="form" ref="FormConfigRef" :formList="formList" /> <Form v-model="data" labelWidth="90px" column="2" class="form" ref="FormConfigRef" :formList="formList" />
<component ref="ControlComponent" :is="componentMap[DeviceTopics[data.deviceType]]" :isMultiControl="true" <component ref="ControlComponent" :is="componentMap[DeviceTopics[data.deviceType]]" :isMultiControl="true"
:selectItems="data.childType" @update:activeIcon="(val) => { this.activeIcon = val }" :visible="true" :selectItems="data.childType" @update:activeIcon="(val) => { this.activeIcon = val }"
@update:submitting="(val) => { submitting = val }"></component> @update:submitting="(val) => { submitting = val }"></component>
<div v-if="hiddenDevices.indexOf(componentMap[DeviceTopics[data.deviceType]]) == -1" class="footer"> <div v-if="hiddenDevices.indexOf(componentMap[DeviceTopics[data.deviceType]]) == -1" class="footer">
<Button @click.native="submitClick" :loading="submitting"> <Button @click.native="submitClick" :loading="submitting">
@ -42,23 +42,24 @@ import SmartDeviceParams from "@screen/pages/Home/components/Dialogs/SmartDevice
import BroadcastParam from "@screen/pages/Home/components/Dialogs/Broadcast/components/BroadcastParamMulti.vue"; import BroadcastParam from "@screen/pages/Home/components/Dialogs/Broadcast/components/BroadcastParamMulti.vue";
import FatigueWakesUpParam from "@screen/pages/Home/components/Dialogs/FatigueWakesUp/components/DeviceParam.vue"; import FatigueWakesUpParam from "@screen/pages/Home/components/Dialogs/FatigueWakesUp/components/DeviceParam.vue";
import DrivingGuidanceParam from "@screen/pages/Home/components/Dialogs/DrivingGuidance/components/DeviceParam.vue"; import DrivingGuidanceParam from "@screen/pages/Home/components/Dialogs/DrivingGuidance/components/DeviceParam.vue";
import InfoBoardParam from "@screen/pages/Home/components/InfoBoard/InfoBoard.vue";
import { DeviceForMap } from "@screen/pages/Home/components/RoadAndEvents/utils/buttonEvent"; import { DeviceForMap } from "@screen/pages/Home/components/RoadAndEvents/utils/buttonEvent";
const componentMap = { const componentMap = {
"设备箱": "SmartDeviceParams", "语音广播": "BroadcastParam", "疲劳唤醒": "FatigueWakesUpParam", "设备箱": "SmartDeviceParams", "语音广播": "BroadcastParam", "疲劳唤醒": "FatigueWakesUpParam",
"行车诱导": "DrivingGuidanceParam" "行车诱导": "DrivingGuidanceParam", "情报板": "InfoBoardParam",
} //DeviceTopics[deviceType] } //DeviceTopics[deviceType]
//"": undefined, , , "": undefined, // , , "": undefined,
const hiddenDevices = ["SmartDeviceParams"]; const hiddenDevices = ["SmartDeviceParams", "InfoBoardParam"];
const controlMulti = Object.keys(componentMap);//6 const controlMulti = Object.keys(componentMap);//6
const DeviceTopics = {};//6 {key:label} const DeviceTopics = {};//6 {key:label}
Object.keys(DeviceForMap).forEach(DeviceLabel => { Object.keys(DeviceForMap).forEach(DeviceLabel => {
controlMulti.indexOf(DeviceLabel) !== -1 && (DeviceTopics[DeviceForMap[DeviceLabel].deviceType] = DeviceLabel); controlMulti.indexOf(DeviceLabel) !== -1 && (DeviceTopics[DeviceForMap[DeviceLabel].deviceType] = DeviceLabel);
}); });
const deviceTypeDefault = Object.keys(DeviceTopics)[0]; const deviceTypeDefault = Object.keys(DeviceTopics)[1];
async function setDeviceOptions(config, filterData, formList) { async function setDeviceOptions(config, filterData, formList) {
const data = await getDeviceList(config.deviceType, filterData).then(async (data) => { const data = await getDeviceList(config.deviceType, filterData).then(async (data) => {
await delay(600); await delay(600);
@ -85,6 +86,7 @@ export default {
BroadcastParam, BroadcastParam,
FatigueWakesUpParam, FatigueWakesUpParam,
DrivingGuidanceParam, DrivingGuidanceParam,
InfoBoardParam
}, },
data() { data() {
return { return {

1019
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/InfoBoard/InfoBoard.vue

File diff suppressed because it is too large

1040
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/InfoBoard/index.vue

File diff suppressed because it is too large

32
ruoyi-ui/src/views/JiHeExpressway/pages/service/board/index.vue

@ -125,7 +125,8 @@
<div class="partCon"> <div class="partCon">
<vuescroll :ops="scrollOptions" class="templateBox" v-if="selectedBdMsg.length > 0" <vuescroll :ops="scrollOptions" class="templateBox" v-if="selectedBdMsg.length > 0"
:class="{ hide: isHideCtt }"> :class="{ hide: isHideCtt }">
<draggable tag="div" :list="selectedBdMsg" @end="____onDragend" ghostClass="ghost_class" dragClass="drag_class" chosenClass="chosen_class"> <draggable tag="div" :list="selectedBdMsg" @end="____onDragend" ghostClass="ghost_class"
dragClass="drag_class" chosenClass="chosen_class">
<div v-for="(itm, indx) in selectedBdMsg" :key="indx" class="tplItem"> <div v-for="(itm, indx) in selectedBdMsg" :key="indx" class="tplItem">
<!-- 模板内容 --> <!-- 模板内容 -->
<BoardPreview class="boardPreview" :boardWH="selectedSize" :tpl="itm"></BoardPreview> <BoardPreview class="boardPreview" :boardWH="selectedSize" :tpl="itm"></BoardPreview>
@ -492,6 +493,7 @@ export default {
if (!this.selectedSize) { if (!this.selectedSize) {
this.selectedSize = item.otherConfig.screenSize; this.selectedSize = item.otherConfig.screenSize;
} }
console.log(item, item.otherConfig.screenSize)
// if (!this.selectedDevices.deviceName) { // if (!this.selectedDevices.deviceName) {
// this.selectedDevices = item; // this.selectedDevices = item;
// } // }
@ -548,7 +550,7 @@ export default {
tpl, tpl,
}; };
}, },
____onDragend(evt){ ____onDragend(evt) {
// console.log(evt, this.selectedBdMsg , "+++=======") // console.log(evt, this.selectedBdMsg , "+++=======")
}, },
____onEditBoardItem(tpl, index) { ____onEditBoardItem(tpl, index) {
@ -1049,7 +1051,8 @@ export default {
padding-bottom: 10px; padding-bottom: 10px;
.boardPreview { .boardPreview {
border: 2px solid #004c64; background-color: #133242; border: 2px solid #004c64;
background-color: #133242;
// width: 560px; // width: 560px;
// height:80px; // height:80px;
flex: 1; flex: 1;
@ -1061,7 +1064,8 @@ export default {
display: flex; display: flex;
margin-left: 10px; margin-left: 10px;
/* // border: solid 1px #05afe3; */ /* // border: solid 1px #05afe3; */
border: 2px solid #004c64; background-color: #133242; border: 2px solid #004c64;
background-color: #133242;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
@ -1107,18 +1111,26 @@ export default {
} }
.tplItem.ghost_class { .tplItem.ghost_class {
.boardPreview, .infoBtnBox{
border-color:#F00; .boardPreview,
.infoBtnBox {
border-color: #F00;
} }
} }
.tplItem.chosen_class { .tplItem.chosen_class {
.boardPreview, .infoBtnBox{
border-color:#0A0; .boardPreview,
.infoBtnBox {
border-color: #0A0;
} }
} }
.tplItem.drag_class { .tplItem.drag_class {
.boardPreview, .infoBtnBox{
border-color:#FF0; .boardPreview,
.infoBtnBox {
border-color: #FF0;
} }
} }

Loading…
Cancel
Save