logo更换
This commit is contained in:
parent
029d57ad8e
commit
ddea834325
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 22 KiB |
@ -316,7 +316,7 @@
|
||||
:options="machineryTypeOptions"
|
||||
:normalizer="normalizer"
|
||||
placeholder="请选择设备类型"
|
||||
@select="handleNodeClick"
|
||||
@select="handleNode"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -721,7 +721,7 @@ export default {
|
||||
this.handleQuery();
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
handleNode(data) {
|
||||
console.log(data);
|
||||
this.form.machineryTypeName = data.machineryTypeName;
|
||||
this.form.machineryTypeCode = data.code;
|
||||
|
91
src/views/mes/pro/production/components/lib/initPlugin.js
Normal file
91
src/views/mes/pro/production/components/lib/initPlugin.js
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
import { getPubKey, setEncrypt } from './pubKey'
|
||||
var initCount = 0;
|
||||
var oWebControl;
|
||||
/**
|
||||
*
|
||||
* @param {*} id :组件容器id
|
||||
* @param {*} iWidth :组件容器宽
|
||||
* @param {*} iHeight :组件容器高
|
||||
* @param {*}cbIntegrationCallBack:消息推送回调函数
|
||||
* @param {*} argument:初始化api参数
|
||||
* @param {*} completeCallBack:初始化成功回调函数
|
||||
* @param {*} plugErrorCallBack:插件启动失败回调函数
|
||||
*/
|
||||
const initPlugin = (id, iWidth, iHeight, argument, cbIntegrationCallBack = () => { }, completeCallBack = () => { }, plugErrorCallBack = () => { }) => {
|
||||
// eslint-disable-next-line no-undef
|
||||
oWebControl = new WebControl({
|
||||
szPluginContainer: id, // 指定容器id
|
||||
iServicePortStart: 15900, // 指定起止端口号,建议使用该值
|
||||
iServicePortEnd: 15909,
|
||||
szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // 用于IE10使用ActiveX的clsid
|
||||
cbConnectSuccess: function () { // 创建WebControl实例成功
|
||||
oWebControl.JS_StartService("window", { // WebControl实例创建成功后需要启动服务
|
||||
dllPath: "./VideoPluginConnect.dll" // 值"./VideoPluginConnect.dll"写死
|
||||
}).then(function () { // 启动插件服务成功
|
||||
oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
|
||||
cbIntegrationCallBack: cbIntegrationCallBack
|
||||
});
|
||||
|
||||
oWebControl.JS_CreateWnd(id, iWidth, iHeight).then(function () { //JS_CreateWnd创建视频播放窗口,宽高可设定
|
||||
init(argument, iWidth, iHeight,completeCallBack()); // 创建播放实例成功后初始化
|
||||
|
||||
});
|
||||
|
||||
}, function () { // 启动插件服务失败
|
||||
|
||||
});
|
||||
},
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
cbConnectError: function (e) { // 创建WebControl实例失败
|
||||
oWebControl = null;
|
||||
// eslint-disable-next-line no-undef
|
||||
// $(id).html("插件未启动,正在尝试启动,请稍候...");
|
||||
// eslint-disable-next-line no-undef
|
||||
WebControl.JS_WakeUp("VideoWebPlugin://"); // 程序未启动时执行error函数,采用wakeup来启动程序
|
||||
|
||||
initCount++;
|
||||
if (initCount < 2) {
|
||||
setTimeout(function () {
|
||||
initPlugin(id, iWidth, iHeight, argument, cbIntegrationCallBack,completeCallBack,plugErrorCallBack);
|
||||
}, 1000)
|
||||
} else {
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
// $(id).html("插件启动失败,请检查插件是否安装!");
|
||||
plugErrorCallBack()
|
||||
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
cbConnectClose: function (bNormalClose) {
|
||||
// 异常断开:bNormalClose = false
|
||||
// JS_Disconnect正常断开:bNormalClose = true
|
||||
console.log("cbConnectClose");
|
||||
oWebControl = null;
|
||||
}
|
||||
});
|
||||
return oWebControl
|
||||
}
|
||||
|
||||
|
||||
//初始化
|
||||
function init(argument, iWidth, iHeight,callback=()=>{}) {
|
||||
getPubKey(oWebControl, function () {
|
||||
|
||||
oWebControl.JS_RequestInterface({
|
||||
funcName: "init",
|
||||
argument: JSON.stringify({
|
||||
...argument,
|
||||
secret: setEncrypt(argument.secret)
|
||||
})
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
}).then(function (oData) {
|
||||
callback()
|
||||
//oWebControl.JS_Resize(iWidth, iHeight); // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
|
||||
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
export default initPlugin
|
24
src/views/mes/pro/production/components/lib/pubKey.js
Normal file
24
src/views/mes/pro/production/components/lib/pubKey.js
Normal file
@ -0,0 +1,24 @@
|
||||
var pubKey;
|
||||
//获取公钥
|
||||
export function getPubKey(oWebControl,callback) {
|
||||
// eslint-disable-next-line no-undef
|
||||
oWebControl.JS_RequestInterface({
|
||||
funcName: "getRSAPubKey",
|
||||
argument: JSON.stringify({
|
||||
keyLength: 1024
|
||||
})
|
||||
}).then(function (oData) {
|
||||
if (oData.responseMsg.data) {
|
||||
pubKey = oData.responseMsg.data;
|
||||
callback()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//RSA加密
|
||||
export function setEncrypt(value) {
|
||||
// eslint-disable-next-line no-undef
|
||||
var encrypt = new JSEncrypt();
|
||||
encrypt.setPublicKey(pubKey);
|
||||
return encrypt.encrypt(value);
|
||||
}
|
@ -1,351 +1,495 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<div id="playWnd" class="playWnd"></div>
|
||||
<div v-show="lodingshow" style="margin: -17px 0">
|
||||
<a-spin tip="Loading...">
|
||||
<div class="spin-content">插件未启动,正在尝试启动,请稍候...</div>
|
||||
</a-spin>
|
||||
</div>
|
||||
|
||||
<div v-show="lodingres" class="example">
|
||||
<p style="margin: 0; display: inline-block">
|
||||
没有检测到插件,请安装插件后重启浏览器!
|
||||
</p>
|
||||
<a-button class="buttonDetails-class" @click="downloadFile()"
|
||||
>下载</a-button
|
||||
<div class="hk-video-container" id="playWnd">
|
||||
<!-- 下载插件提示框 -->
|
||||
<el-dialog
|
||||
v-if="downloadDialog"
|
||||
title="提示"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
>{{downloadText}}</span
|
||||
>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleDownloadExe">下载</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import initPlugin from "./lib/initPlugin";
|
||||
export default {
|
||||
name: "monitor",
|
||||
name: "hkVideo",
|
||||
props: {
|
||||
width: {
|
||||
type: Number,
|
||||
default: 500,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 300,
|
||||
},
|
||||
//初始化参数,
|
||||
// appkey: appkey, //API网关提供的appkey
|
||||
// secret: secret, //API网关提供的secret
|
||||
// ip: ip, //API网关IP地址
|
||||
// playMode: playMode, //播放模式(决定显示预览还是回放界面)
|
||||
// port: port, //端口
|
||||
// snapDir: snapDir, //抓图存储路径
|
||||
// videoDir: videoDir, //紧急录像或录像剪辑存储路径
|
||||
// layout: layout, //布局
|
||||
// enableHTTPS: enableHTTPS, //是否启用HTTPS协议
|
||||
// encryptedFields: encryptedFields, //加密字段
|
||||
// showToolbar: showToolbar, //是否显示工具栏
|
||||
// showSmart: showSmart, //是否显示智能信息
|
||||
// buttonIDs: buttonIDs //自定义工具条按钮
|
||||
argument: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
//模式:0:预览,1回放
|
||||
playMode: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
//浏览器窗口改变时候是否动态变化组件宽度,将按照初始化组件占浏览器可视区域比例缩放组件宽度
|
||||
autoResize: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
//未安装插件时候是否显示插件下载对话框提示用户下载功能
|
||||
downloadDialog: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
//海康插件下载url
|
||||
downloadUrl: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
downloadText:{
|
||||
type:String,
|
||||
default:'插件启动失败,请检查插件是否安装,如果未安装请点击下载安装,安装后刷新页面'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 控制窗口个数
|
||||
camlength: "1x1",
|
||||
|
||||
// 插件没有启动的显示样式
|
||||
lodingshow: false,
|
||||
lodingres: false,
|
||||
|
||||
curWindIndex: 1, //当前选中窗口号,从1开始
|
||||
oWebControl: null, //插件实例
|
||||
iWidth: "", //组件宽
|
||||
iHeight: "", //组件高
|
||||
options: {
|
||||
appkey: "admin", //API网关提供的appkey
|
||||
secret: "mygymygy.", //API网关提供的secret
|
||||
ip: "192.168.2.107", //API网关IP地址
|
||||
playMode: 0, //播放模式(决定显示预览还是回放界面)
|
||||
port: 443, //端口
|
||||
snapDir: "D:\\SnapDir", //抓图存储路径
|
||||
videoDir: "D:\\VideoDir", //紧急录像或录像剪辑存储路径
|
||||
layout: "3x3", //布局
|
||||
enableHTTPS: 1, //是否启用HTTPS协议
|
||||
encryptedFields: "secret", //加密字段
|
||||
showToolbar: 1,
|
||||
showSmart: 1,
|
||||
buttonIDs:
|
||||
"0,1,16,256,257,258,259,260,512,513,514,515,516,517,768,769,770", //自定义工具条按钮
|
||||
},
|
||||
rate: 0, //组件宽度与窗口宽度比例
|
||||
isInitComolete: false, //第一次初始化是否完成
|
||||
dialogVisible: false,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// 加载播放实例
|
||||
this.initPlugin();
|
||||
// 监听resize事件,使插件窗口尺寸跟随DIV窗口变化
|
||||
// vue 的onresize
|
||||
$(window).resize(() => {
|
||||
if (oWebControl != null) {
|
||||
oWebControl.JS_Resize( $('.map').width(), $('.map').height() - 60);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
// 页面结束的时候关闭显示窗口
|
||||
destroyed() {
|
||||
if (oWebControl != null) {
|
||||
oWebControl.JS_HideWnd(); // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
|
||||
oWebControl.JS_Disconnect().then(() => { // 断开与插件服务连接成功
|
||||
},
|
||||
() => { // 断开与插件服务连接失败
|
||||
});
|
||||
watch: {
|
||||
width: {
|
||||
handler(val) {
|
||||
this.iWidth = val;
|
||||
if (this.isInitComolete) {
|
||||
this.setRate();
|
||||
this.setResize(this.iWidth, this.iHeight);
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
height: {
|
||||
handler(val) {
|
||||
this.iHeight = val;
|
||||
if (this.isInitComolete) {
|
||||
this.setRate();
|
||||
this.setResize(this.iWidth, this.iHeight);
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
playMode() {
|
||||
this.reInit();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
this.handleWindEvent();
|
||||
this.$nextTick(() => {
|
||||
this.setRate();
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.oWebControl != null) {
|
||||
this.oWebControl.JS_HideWnd(); // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
|
||||
this.oWebControl.JS_Disconnect().then(
|
||||
function () {
|
||||
// 断开与插件服务连接成功
|
||||
},
|
||||
function () {
|
||||
// 断开与插件服务连接失败
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 修改布局 展示画面
|
||||
refusePlay() {
|
||||
// 获取区域列表下的摄像机列表 进行布局展示
|
||||
SubordinateCam({
|
||||
pageNo: 1,
|
||||
pageSize: 1000,
|
||||
regionIndexCode: this.$route.params.id
|
||||
}).then(res => {
|
||||
if (res.data.code == 0) {
|
||||
let shuliang = res.data.data.list.length;
|
||||
if (shuliang == 1 || shuliang == 0) {
|
||||
this.camlength = "1x1"
|
||||
} else if (shuliang > 1 && shuliang <= 4) {
|
||||
this.camlength = "2x2"
|
||||
} else if (shuliang > 4 && shuliang <= 9) {
|
||||
this.camlength = "3x3"
|
||||
} else if (shuliang > 9 && shuliang <= 16) {
|
||||
this.camlength = "4x4"
|
||||
} else if (shuliang > 16 && shuliang <= 25) {
|
||||
this.camlength = "5x5"
|
||||
}
|
||||
// 设置摄像头的布局
|
||||
oWebControl.JS_RequestInterface({
|
||||
funcName: "setLayout",
|
||||
argument: {layout: this.camlength}
|
||||
}).then(() => {
|
||||
// 有监控点就进行播放
|
||||
if (res.data.data.list.length > 0) {
|
||||
this.$message.success('获取成功 监控点数量为' + res.data.data.list.length)
|
||||
res.data.data.list.forEach((item, index) => {
|
||||
oWebControl.JS_RequestInterface({
|
||||
funcName: "startPreview",
|
||||
argument: JSON.stringify({
|
||||
cameraIndexCode: item.cameraIndexCode, //监控点编号
|
||||
streamMode: 0, //主子码流标识
|
||||
transMode: 1, //传输协议
|
||||
gpuMode: 0, //是否开启GPU硬解
|
||||
wndId: index + 1 //可指定播放窗口
|
||||
})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.$message.warning('当前区域无直属监控点区域')
|
||||
// 停止全部的播放
|
||||
let result = JSON.stringify({
|
||||
"funcName": "stopAllPreview"
|
||||
}, null, 2)
|
||||
this.requestInterface(result);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error('获取失败')
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
// $('.map').width(), $('.map').height() - 60)
|
||||
// 创建播放实例
|
||||
initPlugin() {
|
||||
// eslint-disable-next-line no-undef
|
||||
oWebControl = new WebControl({
|
||||
szPluginContainer: "playWnd", // 指定容器id
|
||||
iServicePortStart: 15900, // 指定起止端口号,建议使用该值
|
||||
iServicePortEnd: 15909,
|
||||
szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // 用于IE10使用ActiveX的clsid
|
||||
cbConnectSuccess: () => { // 创建WebControl实例成功
|
||||
oWebControl.JS_StartService("window", { // WebControl实例创建成功后需要启动服务
|
||||
dllPath: "./VideoPluginConnect.dll" // 值"./VideoPluginConnect.dll"写死
|
||||
}).then(() => { // 启动插件服务成功
|
||||
oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
|
||||
cbIntegrationCallBack: this.cbIntegrationCallBack
|
||||
});
|
||||
oWebControl.JS_CreateWnd("playWnd", $('.map').width(), $('.map').height() - 60).then(() => { //JS_CreateWnd创建视频播放窗口,宽高可设定
|
||||
this.init(); // 创建播放实例成功后初始化
|
||||
});
|
||||
}, () => { // 启动插件服务失败
|
||||
});
|
||||
},
|
||||
cbConnectError: () => { // 创建WebControl实例失败
|
||||
oWebControl = null;
|
||||
// $("#playWnd").html("插件未启动,正在尝试启动,请稍候...");
|
||||
this.lodingshow = true;
|
||||
// eslint-disable-next-line no-undef
|
||||
WebControl.JS_WakeUp("VideoWebPlugin://"); // 程序未启动时执行error函数,采用wakeup来启动程序
|
||||
initCount++;
|
||||
if (initCount < 3) {
|
||||
setTimeout(() => {
|
||||
this.initPlugin();
|
||||
}, 3000)
|
||||
} else {
|
||||
this.lodingshow = false;
|
||||
this.lodingres = true;
|
||||
// $("#playWnd").html("插件启动失败,请检查插件是否安装!");
|
||||
}
|
||||
},
|
||||
cbConnectClose: () => {
|
||||
// 异常断开:bNormalClose = false
|
||||
// JS_Disconnect正常断开:bNormalClose = true
|
||||
oWebControl = null;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//初始化
|
||||
//初始化插件
|
||||
init() {
|
||||
// 获取公钥的方法
|
||||
this.getPubKey(() => {
|
||||
////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
|
||||
let appkey = admin; //综合安防管理平台提供的appkey,必填
|
||||
// 进行相应的加密
|
||||
let secret = "mygymygy."; //综合安防管理平台提供的secret,必填
|
||||
let ip = "192.168.2.107"; //综合安防管理平台IP地址,必填
|
||||
let port = "443"; //综合安防管理平台端口,若启用HTTPS协议,默认443
|
||||
let playMode = 0; //初始播放模式:0-预览,1-回放
|
||||
let snapDir = "D:\\SnapDir"; //抓图存储路径
|
||||
let videoDir = "D:\\VideoDir"; //紧急录像或录像剪辑存储路径
|
||||
let layout = "1x1"; //playMode指定模式的布局
|
||||
let enableHTTPS = 1; //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
|
||||
let encryptedFields = 'secret'; //加密字段,默认加密领域为secret
|
||||
let showToolbar = 1; //是否显示工具栏,0-不显示,非0-显示
|
||||
let showSmart = 1; //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
|
||||
let buttonIDs = "0,16,256,257,258,259,260,512,513,514,515,516,768,769"; //自定义工具条按钮
|
||||
let toolBarButtonIDs = "2048,2304,2305,2306,2307,2308,2309,4096,4097,4098,4099,4608,4609"
|
||||
////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
|
||||
oWebControl.JS_RequestInterface({
|
||||
funcName: "init",
|
||||
argument: JSON.stringify({
|
||||
appkey: appkey, //API网关提供的appkey
|
||||
secret: secret, //API网关提供的secret
|
||||
ip: ip, //API网关IP地址
|
||||
playMode: playMode, //播放模式(决定显示预览还是回放界面)
|
||||
port: port, //端口
|
||||
snapDir: snapDir, //抓图存储路径
|
||||
videoDir: videoDir, //紧急录像或录像剪辑存储路径
|
||||
layout: layout, //布局
|
||||
enableHTTPS: enableHTTPS, //是否启用HTTPS协议
|
||||
encryptedFields: encryptedFields, //加密字段
|
||||
showToolbar: showToolbar, //是否显示工具栏
|
||||
showSmart: showSmart, //是否显示智能信息
|
||||
buttonIDs: buttonIDs, //自定义工具条按钮
|
||||
toolBarButtonIDs:toolBarButtonIDs //自定义最外层的工具条
|
||||
})
|
||||
}).then(() => {
|
||||
oWebControl.JS_Resize( $('.map').width(), $('.map').height() - 60); // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
|
||||
// 加载完成后进行布局的修改 和 摄像头的展示
|
||||
this.refusePlay();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
//获取公钥
|
||||
getPubKey(callback) {
|
||||
oWebControl.JS_RequestInterface({
|
||||
funcName: "getRSAPubKey",
|
||||
argument: JSON.stringify({
|
||||
keyLength: 1024
|
||||
})
|
||||
}).then((oData) => {
|
||||
console.log(oData);
|
||||
if (oData.responseMsg.data) {
|
||||
pubKey = oData.responseMsg.data;
|
||||
callback()
|
||||
let argument = {
|
||||
...this.options,
|
||||
...this.argument,
|
||||
};
|
||||
if (this.playMode > -1 && this.playMode < 2) {
|
||||
argument.playMode = this.playMode;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//RSA加密
|
||||
setEncrypt(value) {
|
||||
// eslint-disable-next-line no-undef
|
||||
let encrypt = new JSEncrypt();
|
||||
encrypt.setPublicKey(pubKey);
|
||||
return encrypt.encrypt(value);
|
||||
this.iWidth = Math.min(this.iWidth, $(window).width());
|
||||
this.oWebControl = initPlugin(
|
||||
"playWnd",
|
||||
this.iWidth,
|
||||
this.iHeight,
|
||||
argument,
|
||||
this.cbIntegrationCallBack,
|
||||
() => {
|
||||
this.setRate();
|
||||
this.setResize(this.iWidth, this.iHeight);
|
||||
this.isInitComolete = true;
|
||||
this.$emit("initFinish");
|
||||
},
|
||||
|
||||
// 推送消息
|
||||
() => {
|
||||
if (this.downloadDialog) {
|
||||
this.dialogVisible = true;
|
||||
}
|
||||
this.$emit("pluginError");
|
||||
}
|
||||
);
|
||||
},
|
||||
//重新初始化
|
||||
reInit() {
|
||||
if (this.oWebControl) {
|
||||
this.oWebControl
|
||||
.JS_RequestInterface({
|
||||
funcName: "uninit",
|
||||
})
|
||||
.then(() => {
|
||||
this.init();
|
||||
});
|
||||
}
|
||||
},
|
||||
setRate() {
|
||||
// eslint-disable-next-line no-undef
|
||||
var iWidth = $(window).width();
|
||||
this.rate = this.iWidth / iWidth;
|
||||
},
|
||||
//窗口事件
|
||||
handleWindEvent() {
|
||||
// 监听resize事件,使插件窗口尺寸跟随DIV窗口变化
|
||||
// eslint-disable-next-line no-undef
|
||||
if (this.autoResize) {
|
||||
// eslint-disable-next-line no-undef
|
||||
$(window).resize(() => {
|
||||
if (this.oWebControl) {
|
||||
// eslint-disable-next-line no-undef
|
||||
var iWidth = $(window).width();
|
||||
// eslint-disable-next-line no-undef
|
||||
this.iWidth = iWidth * this.rate;
|
||||
this.oWebControl.JS_Resize(this.iWidth, this.iHeight);
|
||||
this.setWndCover();
|
||||
}
|
||||
});
|
||||
}
|
||||
// 监听滚动条scroll事件,使插件窗口跟随浏览器滚动而移动
|
||||
// eslint-disable-next-line no-undef
|
||||
$(window).scroll(() => {
|
||||
if (this.oWebControl) {
|
||||
this.oWebControl.JS_Resize(this.iWidth, this.iHeight);
|
||||
this.setWndCover();
|
||||
}
|
||||
});
|
||||
},
|
||||
//推送消息回调
|
||||
cbIntegrationCallBack(oData) {
|
||||
// if (oData.responseMsg.msg.cameraIndexCode != '') {
|
||||
// this.$router.push({name: 'playbackDetails', params: {id: oData.responseMsg.msg.cameraIndexCode}})
|
||||
// }
|
||||
this.showCBInfo(JSON.stringify(oData.responseMsg));
|
||||
if (oData?.responseMsg?.type) {
|
||||
let data = oData.responseMsg;
|
||||
switch (data.type) {
|
||||
//窗口号改变
|
||||
case 1:
|
||||
if (this.curWindIndex !== data.msg.wndId) {
|
||||
this.curWindIndex = data.msg.wndId;
|
||||
this.$emit("windowChange", this.curWindIndex);
|
||||
}
|
||||
break;
|
||||
//布局改变
|
||||
case 6:
|
||||
this.$emit("layoutChange", data.msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 设置窗口裁剪,当因滚动条滚动导致窗口需要被遮住的情况下需要JS_CuttingPartWindow部分窗口
|
||||
setWndCover() {
|
||||
let iWidth = $('.map').width();
|
||||
let iHeight = $('.map').height() - 60;
|
||||
let oDivRect = $("#playWnd").get(0).getBoundingClientRect();
|
||||
// eslint-disable-next-line no-undef
|
||||
var iWidth = $(window).width();
|
||||
// eslint-disable-next-line no-undef
|
||||
var iHeight = $(window).height();
|
||||
// eslint-disable-next-line no-undef
|
||||
var oDivRect = $("#playWnd").get(0).getBoundingClientRect();
|
||||
|
||||
let iCoverLeft = (oDivRect.left < 0) ? Math.abs(oDivRect.left) : 0;
|
||||
let iCoverTop = (oDivRect.top < 0) ? Math.abs(oDivRect.top) : 0;
|
||||
let iCoverRight = (oDivRect.right - iWidth > 0) ? Math.round(oDivRect.right - iWidth) : 0;
|
||||
let iCoverBottom = (oDivRect.bottom - iHeight > 0) ? Math.round(oDivRect.bottom - iHeight) : 0;
|
||||
var iCoverLeft = oDivRect.left < 0 ? Math.abs(oDivRect.left) : 0;
|
||||
var iCoverTop = oDivRect.top < 0 ? Math.abs(oDivRect.top) : 0;
|
||||
var iCoverRight =
|
||||
oDivRect.right - iWidth > 0 ? Math.round(oDivRect.right - iWidth) : 0;
|
||||
var iCoverBottom =
|
||||
oDivRect.bottom - iHeight > 0
|
||||
? Math.round(oDivRect.bottom - iHeight)
|
||||
: 0;
|
||||
|
||||
iCoverLeft = (iCoverLeft > 1200) ? 1200 : iCoverLeft;
|
||||
iCoverTop = (iCoverTop > 600) ? 600 : iCoverTop;
|
||||
iCoverRight = (iCoverRight > 1200) ? 1200 : iCoverRight;
|
||||
iCoverBottom = (iCoverBottom > 600) ? 600 : iCoverBottom;
|
||||
iCoverLeft = iCoverLeft > this.iWidth ? this.iWidth : iCoverLeft;
|
||||
iCoverTop = iCoverTop > this.iHeight ? this.iHeight : iCoverTop;
|
||||
iCoverRight = iCoverRight > this.iWidth ? this.iWidth : iCoverRight;
|
||||
iCoverBottom = iCoverBottom > this.iHeight ? this.iHeight : iCoverBottom;
|
||||
|
||||
oWebControl.JS_RepairPartWindow(0, 0, $('.map').width(), $('.map').height() - 60); // 多1个像素点防止还原后边界缺失一个像素条
|
||||
this.oWebControl.JS_RepairPartWindow(
|
||||
0,
|
||||
0,
|
||||
this.iWidth + 1,
|
||||
this.iHeight + 1
|
||||
); // 多1个像素点防止还原后边界缺失一个像素条
|
||||
if (iCoverLeft != 0) {
|
||||
oWebControl.JS_CuttingPartWindow(0, 0, iCoverLeft, 600);
|
||||
this.oWebControl.JS_CuttingPartWindow(0, 0, iCoverLeft, this.iHeight);
|
||||
}
|
||||
if (iCoverTop != 0) {
|
||||
oWebControl.JS_CuttingPartWindow(0, 0, $('.map').width(), iCoverTop); // 多剪掉一个像素条,防止出现剪掉一部分窗口后出现一个像素条
|
||||
this.oWebControl.JS_CuttingPartWindow(
|
||||
0,
|
||||
0,
|
||||
this.iWidth + 1,
|
||||
iCoverTop + 1
|
||||
); // 多剪掉一个像素条,防止出现剪掉一部分窗口后出现一个像素条
|
||||
}
|
||||
if (iCoverRight != 0) {
|
||||
oWebControl.JS_CuttingPartWindow($('.map').width() - iCoverRight, 0, iCoverRight, 600);
|
||||
this.oWebControl.JS_CuttingPartWindow(
|
||||
this.iWidth - iCoverRight,
|
||||
0,
|
||||
iCoverRight,
|
||||
this.iHeight
|
||||
);
|
||||
}
|
||||
if (iCoverBottom != 0) {
|
||||
oWebControl.JS_CuttingPartWindow(0, 600 - iCoverBottom, $('.map').width(), iCoverBottom);
|
||||
this.oWebControl.JS_CuttingPartWindow(
|
||||
0,
|
||||
this.iHeight - iCoverBottom,
|
||||
this.iWidth,
|
||||
iCoverBottom
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
// 执行字符串方法
|
||||
// value为字符串,JS_RequestInterface仅接收json格式的变量,且需要先解析出argument,并且将argument字段的内容转为字符串
|
||||
requestInterface(value) {
|
||||
this.isJSON(value);
|
||||
let JsonParam = JSON.parse(value);
|
||||
let JsonArgument = JsonParam.argument;
|
||||
JsonParam.argument = JSON.stringify(JsonArgument);
|
||||
|
||||
oWebControl.JS_RequestInterface(JsonParam).then((oData) => {
|
||||
this.showCBInfo(JSON.stringify(oData ? oData.responseMsg : ''));
|
||||
/** 预览
|
||||
* @param {*} cameraIndexCode :获取输入的监控点编号值,必填
|
||||
* @param {*} argument:api参数,
|
||||
* argument属性cameraIndexCode优先级高于函数参数cameraIndexCode
|
||||
*/
|
||||
startPreview(cameraIndexCode, argument = {}) {
|
||||
if (this.oWebControl) {
|
||||
let params = {
|
||||
cameraIndexCode: cameraIndexCode, //监控点编号
|
||||
streamMode: 0, //主子码流标识
|
||||
transMode: 1, //传输协议
|
||||
gpuMode: 1, //是否开启GPU硬解
|
||||
wndId: -1,
|
||||
};
|
||||
this.oWebControl
|
||||
.JS_RequestInterface({
|
||||
funcName: "startPreview",
|
||||
argument: JSON.stringify({
|
||||
...params,
|
||||
...argument,
|
||||
}),
|
||||
})
|
||||
.then(() => {});
|
||||
}
|
||||
},
|
||||
//停止所有预览
|
||||
stopAllPreview() {
|
||||
this.oWebControl.JS_RequestInterface({
|
||||
funcName: "stopAllPreview",
|
||||
});
|
||||
},
|
||||
|
||||
// 显示接口返回的消息及插件回调信息
|
||||
showCBInfo(szInfo, type) {
|
||||
if (type === 'error') {
|
||||
szInfo = "<div style='color: red;'>" + this.dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss") + " " + szInfo + "</div>";
|
||||
} else {
|
||||
szInfo = "<div>" + this.dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss") + " " + szInfo + "</div>";
|
||||
}
|
||||
$("#cbInfo").html(szInfo + $("#cbInfo").html());
|
||||
},
|
||||
|
||||
// 判断字符串是否为json
|
||||
isJSON(str) {
|
||||
if (typeof str == 'string') {
|
||||
try {
|
||||
let obj = JSON.parse(str);
|
||||
if (typeof obj == 'object' && obj) {
|
||||
return true;
|
||||
} else {
|
||||
this.showCBInfo("param is not the correct JSON message");
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
this.showCBInfo("param is not the correct JSON message");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 格式化时间
|
||||
dateFormat(oDate, fmt) {
|
||||
let o = {
|
||||
"M+": oDate.getMonth() + 1, //月份
|
||||
"d+": oDate.getDate(), //日
|
||||
"h+": oDate.getHours(), //小时
|
||||
"m+": oDate.getMinutes(), //分
|
||||
"s+": oDate.getSeconds(), //秒
|
||||
"q+": Math.floor((oDate.getMonth() + 3) / 3), //季度
|
||||
"S": oDate.getMilliseconds()//毫秒
|
||||
//批量(指定窗口)停止播放
|
||||
/**
|
||||
* idArr:播放窗口序号数组
|
||||
*/
|
||||
stopListPreview(idArr) {
|
||||
let list = idArr.map((item) => {
|
||||
return {
|
||||
wndId: item,
|
||||
};
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (oDate.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
}
|
||||
for (let k in o) {
|
||||
if (new RegExp("(" + k + ")").test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
});
|
||||
this.oWebControl.JS_RequestInterface({
|
||||
funcName: "stopMultiPlay",
|
||||
argument: {
|
||||
list,
|
||||
},
|
||||
// 下载文件到本地
|
||||
downloadFile() {
|
||||
var a = document.createElement('a')
|
||||
// var blob = new Blob([content])
|
||||
// var url = window.URL.createObjectURL(blob)
|
||||
a.href = '控件下载地址'
|
||||
a.download = '视频插件'
|
||||
a.click()
|
||||
// window.URL.revokeObjectURL(url)
|
||||
});
|
||||
},
|
||||
|
||||
/** 根据监控点编号录像回放
|
||||
* @param {*} cameraIndexCode :获取输入的监控点编号值,必填
|
||||
* @param {*} startTime:开始时间
|
||||
* @param {*} endTime:结束时间
|
||||
* @param {*} recordLocation://录像存储位置:0-中心存储,1-设备存储
|
||||
* @param {*} argument:api参数
|
||||
* argument属性cameraIndexCode优先级高于函数参数cameraIndexCode
|
||||
*/
|
||||
startPlayBack(
|
||||
cameraIndexCode,
|
||||
startTime,
|
||||
endTime,
|
||||
recordLocation = 0,
|
||||
argument = {}
|
||||
) {
|
||||
var startTimeStamp = new Date(
|
||||
startTime.replace("-", "/").replace("-", "/")
|
||||
).getTime(); //回放开始时间戳,必填
|
||||
var endTimeStamp = new Date(
|
||||
endTime.replace("-", "/").replace("-", "/")
|
||||
).getTime(); //回放结束时间戳,必填
|
||||
// var recordLocation = 0; //录像存储位置:0-中心存储,1-设备存储
|
||||
var transMode = 1; //传输协议:0-UDP,1-TCP
|
||||
var gpuMode = 0; //是否启用GPU硬解,0-不启用,1-启用
|
||||
var wndId = -1; //播放窗口序号(在2x2以上布局下可指定播放窗口)
|
||||
|
||||
this.oWebControl.JS_RequestInterface({
|
||||
funcName: "startPlayback",
|
||||
argument: JSON.stringify({
|
||||
cameraIndexCode: cameraIndexCode, //监控点编号
|
||||
startTimeStamp: Math.floor(startTimeStamp / 1000).toString(), //录像查询开始时间戳,单位:秒
|
||||
endTimeStamp: Math.floor(endTimeStamp / 1000).toString(), //录像结束开始时间戳,单位:秒
|
||||
recordLocation: recordLocation, //录像存储类型:0-中心存储,1-设备存储
|
||||
transMode: transMode, //传输协议:0-UDP,1-TCP
|
||||
gpuMode: gpuMode, //是否启用GPU硬解,0-不启用,1-启用
|
||||
wndId: wndId, //可指定播放窗口
|
||||
...argument,
|
||||
}),
|
||||
});
|
||||
},
|
||||
//停止所有回放
|
||||
stopAllPlayBack() {
|
||||
this.oWebControl.JS_RequestInterface({
|
||||
funcName: "stopAllPlayback",
|
||||
});
|
||||
},
|
||||
|
||||
//设置布局
|
||||
//latyou布局:2x2
|
||||
setLayout(layout) {
|
||||
this.oWebControl.JS_RequestInterface({
|
||||
funcName: " setLayout",
|
||||
argument: {
|
||||
layout,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/** 画面字符叠加
|
||||
* @param {*} text :文字
|
||||
* @param {*} x:相对播放窗口左上角的横坐标起点
|
||||
* @param {*} y:相对播放窗口左上角的纵坐标起点
|
||||
* @param {*} fontSize:字体大小
|
||||
* @param {*} color:字体颜色,默认白色
|
||||
* @param {*} argument:api参数
|
||||
* argument属性cameraIndexCode优先级高于函数参数cameraIndexCode
|
||||
*/
|
||||
drawText(
|
||||
text,
|
||||
x = 5,
|
||||
y = 5,
|
||||
fontSize = 20,
|
||||
color = 16777215,
|
||||
argument = {}
|
||||
) {
|
||||
this.oWebControl.JS_RequestInterface({
|
||||
funcName: "drawOSD",
|
||||
argument: {
|
||||
text,
|
||||
x,
|
||||
y,
|
||||
fontSize,
|
||||
color,
|
||||
...argument,
|
||||
},
|
||||
});
|
||||
},
|
||||
//进入全屏
|
||||
setFullScreen() {
|
||||
this.oWebControl.JS_RequestInterface({
|
||||
funcName: "setFullScreen",
|
||||
});
|
||||
},
|
||||
//退出全屏
|
||||
exitFullScreen() {
|
||||
this.oWebControl.JS_RequestInterface({
|
||||
funcName: "exitFullScreen",
|
||||
});
|
||||
},
|
||||
//播放抓图
|
||||
snapShot(argument = {}) {
|
||||
this.oWebControl.JS_RequestInterface({
|
||||
funcName: "snapShot",
|
||||
argument,
|
||||
});
|
||||
},
|
||||
//隐藏窗口
|
||||
hideWindow() {
|
||||
this.oWebControl.JS_HideWnd();
|
||||
},
|
||||
//显示窗口
|
||||
showWindow() {
|
||||
this.oWebControl.JS_ShowWnd();
|
||||
},
|
||||
//设置窗口尺寸
|
||||
setResize(width, height) {
|
||||
this.oWebControl.JS_Resize(width, height);
|
||||
this.setWndCover();
|
||||
},
|
||||
//下载安装包
|
||||
handleDownloadExe() {
|
||||
this.dialogVisible = false;
|
||||
if (this.downloadUrl) {
|
||||
this.downloadFile(this.downloadUrl);
|
||||
} else {
|
||||
console.log("下载地址为空");
|
||||
}
|
||||
this.$emit("clickDownload");
|
||||
},
|
||||
//下载文件
|
||||
downloadFile(url, fileName = "") {
|
||||
const a = document.createElement("a");
|
||||
a.style.display = "none";
|
||||
if (fileName) {
|
||||
a.setAttribute("download", fileName);
|
||||
}
|
||||
a.setAttribute("href", url);
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(a.href);
|
||||
document.body.removeChild(a);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
@ -363,28 +363,6 @@ export default {
|
||||
},
|
||||
|
||||
getList() {
|
||||
var params = {
|
||||
pageNo: 1,
|
||||
pageSize: 9999,
|
||||
};
|
||||
axios({
|
||||
url: "https://190.168.2.104:8077/artemis/api/resource/v1/cameras",
|
||||
method: "post",
|
||||
data: params, //将请求参数写入data;
|
||||
headers: {
|
||||
//单个请求设置请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
// listWorkorder(this.queryParams).then((response) => {
|
||||
// this.workorderList = response.data;
|
||||
// });
|
||||
|
@ -381,7 +381,7 @@
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="12"
|
||||
v-if="this.form.code == 'CNC' || this.form.code == 'ROBOT'"
|
||||
v-if="this.form.code == 'CNC'"
|
||||
>
|
||||
<el-form-item label="安全门状态" prop="securityDoor">
|
||||
<el-radio-group v-model="form.securityDoor">
|
||||
@ -548,9 +548,6 @@ export default {
|
||||
nextProcessId: [
|
||||
{ required: true, message: "工序ID不能为空", trigger: "blur" },
|
||||
],
|
||||
machineryTypeId: [
|
||||
{ required: true, message: "设备类型不能为空", trigger: "blur" },
|
||||
],
|
||||
keyFlag: [
|
||||
{
|
||||
required: true,
|
||||
|
Loading…
Reference in New Issue
Block a user