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("*"); 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 } }, // 发布信息 ____publishInfo() { 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 }) }) let data = { content: content, deviceId: this.selectedDevice.iotDeviceId } if (IS_TESTING) { // this.saveLog(content); this.____getDeviceInfo(); loading.close() } else { publishToBoard(data).then(res => { // this.saveLog(content); 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.selectedDevice; 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("情报板日志保存失败!"); } }) } } }