import { publishToBoard, saveBoardReleaseLog } from "@/api/broadcast/broadcast"; import moment from "moment/moment"; import store from "@/store"; export default { data() { return {}; }, methods: { // 新增待下发 ____onAddDeviceItem() { this.editDialog = { visible: true, mode: "add", type: "device", tpl: { content:"" }, }; }, // 从模板新增待下发 ____onTplToDevice(item, showDialog) { // if(this.checkedDeviceIds.length<=0){ // this.$message.warning('未选择设备!'); // return; // } if (this.selectedBdMsg.length >= 1){ this.$message({ type: "warning", message: "只能发布一条语音广播!", }); return; } this.editDialog = { visible: showDialog == false ? false : true, mode: "toDevice", type: "template", tpl: item, }; }, // 发布信息 ____publishInfo() { let deviceList = []; if (this.selectedDevice){ deviceList = [item.otherConfig]; } else{ this.selectedDevices.forEach(item=>{ deviceList.push(item.otherConfig); }) } 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 data = { functionType : "startPaTts", name : "task-3", // outVol : "6", outVol: this.selectedBdMsg[0].outVol, // priority : "1", priority: this.selectedBdMsg[0].priority, repeatTimes: this.selectedBdMsg[0].repeatTimes, // termList : [{ zoneld: "6001", termDN: "601" }, { zoneld: "6001", termDN: "608" }, { zoneld: "6001", termDN: "610" }], termList: deviceList, text: this.selectedBdMsg[0].content } if (IS_TESTING) { // this.saveLog(content); this.____getDeviceInfo(); loading.close(); } else { publishToBoard(data) .then((res) => { // this.saveLog(content); this.$message({ 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("情报板日志保存失败!"); } }); }, }, };