济菏高速业务端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
4.8 KiB

1 year ago
import { publishToBoard, saveBoardReleaseLog } from '@/api/board/board'
import moment from 'moment/moment';
import store from '@/store'
export default{
data(){
return {
}
},
methods:{
// 新增待下发
____onAddDeviceItem() {
let arr = this.selectedSize.split("*");
1 year ago
1 year ago
this.editDialog = {
visible: true,
mode: "add",
type: "device",
tpl: {
"textContent": "",
1 year ago
"origin": {
1 year ago
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]
}
1 year ago
this.editDialog = {
visible: showDialog == false ? false : true,
mode: "toDevice",
type: "template",
tpl: item
}
},
// 发布信息
____publishInfo() {
1 year ago
let deviceIdList = [];
if (this.selectedDevice){
deviceIdList = [this.selectedDevice.iotDeviceId];
}else{
deviceIdList = this.checkedDeviceIds;
}
1 year ago
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 = [];
this.selectedBdMsg.forEach(item => {
content.push({
STAY: item.playbackDuration,
ACTION: item.screenEntryMethod,
SPEED: item.fontSpacing || 0,
COLOR: item.foregroundColor,
FONT: item.font,
FONT_SIZE: item.fontSize,
CONTENT: item.textContent.replaceAll(',', '\\,').replaceAll('=', '\\=').replaceAll('\n', '\\\\n'),
width: item.displayAreaWidth,
height: item.displayAreaHeight,
formatStyle: item.verticalAlignment
})
})
1 year ago
let data = { content: content, deviceIdList }
1 year ago
if (IS_TESTING) {
// this.saveLog(content);
1 year ago
this.____getDeviceInfo();
loading.close()
} else {
publishToBoard(data).then(res => {
// this.saveLog(content);
1 year ago
this.____getDeviceInfo();
1 year ago
}).catch(err=>{
1 year ago
}).finally(()=>{
loading.close()
1 year ago
});
}
}).catch(() => {
this.$message({
type: 'info',
message: '取消发布'
})
})
},
//
saveLog(content){
let time = moment().format("YYYY-MM-DD HH:mm:ss");
let device = this.selectedDevices;
1 year ago
let data = {
"createBy": store.getters.name,
"createTime": time,
"deviceId": device.id,
"deviceName": device.deviceName,
"direction": device.direction,
"params": {},
"platform": "",
"releaseContent": JSON.stringify(content),
"releaseDeptId": "",
"releaseDeptName": "",
"releaseIp": "",
"releaseStatus": "",
"releaseTime": time,
"releaseUserId": "",
"releaseUserName": "",
"remark": "",
"searchValue": "",
"stakeMark": device.stakeMark,
"updateBy": "",
"updateTime": time
}
saveBoardReleaseLog(data).then(res => {
if(res.code==200){
console.log("情报板日志已保存:::" , data);
}else{
console.log("情报板日志保存失败!");
}
})
}
}
}