qingzhengli
7 months ago
5 changed files with 1201 additions and 1189 deletions
@ -1,152 +1,157 @@ |
|||
import { publishToBoard, saveBoardReleaseLog } from '@/api/board/board' |
|||
import moment from 'moment/moment'; |
|||
import store from '@/store' |
|||
export default{ |
|||
data(){ |
|||
return { |
|||
import { publishToBoard, saveBoardReleaseLog } from "@/api/board/board"; |
|||
import moment from "moment/moment"; |
|||
import store from "@/store"; |
|||
import { Message } from "element-ui"; |
|||
export default { |
|||
data() { |
|||
return {}; |
|||
}, |
|||
methods: { |
|||
// 新增待下发
|
|||
____onAddDeviceItem() { |
|||
let arr = this.selectedSize.split("*"); |
|||
|
|||
} |
|||
}, |
|||
methods:{ |
|||
// 新增待下发
|
|||
____onAddDeviceItem() { |
|||
let arr = this.selectedSize.split("*"); |
|||
|
|||
this.editDialog = { |
|||
visible: true, |
|||
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 |
|||
} |
|||
this.editDialog = { |
|||
visible: true, |
|||
mode: "add", |
|||
type: "device", |
|||
tpl: { |
|||
textContent: "", |
|||
origin: { |
|||
displayAreaWidth: +arr[0], |
|||
displayAreaHeight: +arr[1], |
|||
}, |
|||
}, |
|||
// 发布信息
|
|||
____publishInfo() { |
|||
let deviceList = []; |
|||
if (this.selectedDevice){ |
|||
deviceList = [this.selectedDevice]; |
|||
}else{ |
|||
deviceList = this.selectedDevices; |
|||
} |
|||
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)' |
|||
}) |
|||
}; |
|||
}, |
|||
// 从模板新增待下发
|
|||
____onTplToDevice(item, showDialog) { |
|||
// if(this.checkedDeviceIds.length<=0){
|
|||
// this.$message.warning('未选择设备!');
|
|||
// return;
|
|||
// }
|
|||
|
|||
let content = []; |
|||
let arr = this.selectedSize.split("*"); |
|||
item.origin = { |
|||
displayAreaWidth: +arr[0], |
|||
displayAreaHeight: +arr[1], |
|||
}; |
|||
|
|||
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 |
|||
}) |
|||
}) |
|||
this.editDialog = { |
|||
visible: showDialog == false ? false : true, |
|||
mode: "toDevice", |
|||
type: "template", |
|||
tpl: item, |
|||
}; |
|||
}, |
|||
// 发布信息
|
|||
____publishInfo() { |
|||
let deviceList = []; |
|||
if (this.isMultiControl && !this.selectItems.length) { |
|||
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) { |
|||
// this.saveLog(content);
|
|||
this.____getDeviceInfo(); |
|||
loading.close() |
|||
let content = []; |
|||
|
|||
} else { |
|||
publishToBoard(data).then(res => { |
|||
// this.saveLog(content);
|
|||
this.$message({ |
|||
type:"success", |
|||
message:"发布成功!" |
|||
}); |
|||
this.____getDeviceInfo(); |
|||
}).catch(err=>{ |
|||
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, |
|||
}); |
|||
}); |
|||
|
|||
}).finally(()=>{ |
|||
loading.close() |
|||
}); |
|||
} |
|||
let data = { content: content, deviceList }; |
|||
|
|||
}).catch(() => { |
|||
if (IS_TESTING) { |
|||
// this.saveLog(content);
|
|||
this.____getDeviceInfo(); |
|||
loading.close(); |
|||
} else { |
|||
publishToBoard(data) |
|||
.then((res) => { |
|||
// this.saveLog(content);
|
|||
this.$message({ |
|||
type: 'info', |
|||
message: '取消发布' |
|||
}) |
|||
}) |
|||
|
|||
}, |
|||
//
|
|||
saveLog(content){ |
|||
let time = moment().format("YYYY-MM-DD HH:mm:ss"); |
|||
let device = this.selectedDevices; |
|||
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("情报板日志保存失败!"); |
|||
} |
|||
}) |
|||
type: "success", |
|||
message: "发布成功!", |
|||
}); |
|||
!isMultiControl && this.____getDeviceInfo(); |
|||
}) |
|||
.catch((err) => {}) |
|||
.finally(() => { |
|||
loading.close(); |
|||
}); |
|||
} |
|||
}) |
|||
.catch(() => { |
|||
this.$message({ |
|||
type: "info", |
|||
message: "取消发布", |
|||
}); |
|||
}); |
|||
}, |
|||
//
|
|||
saveLog(content) { |
|||
let time = moment().format("YYYY-MM-DD HH:mm:ss"); |
|||
let device = this.selectedDevices; |
|||
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("情报板日志保存失败!"); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
}, |
|||
}; |
|||
|
File diff suppressed because it is too large
File diff suppressed because it is too large
Loading…
Reference in new issue