Commit 5454a14c by 潘建波

feat chrome视频播放

1 parent 226e2835
NODE_ENV = 'development'
VUE_APP_URL = 'http://192.168.9.133:20080'
\ No newline at end of file
VUE_APP_URL = 'http://192.168.9.233:20080'
\ No newline at end of file
.DS_Store
node_modules
/dist
dist
# local env files
.env.local
.env.*.local
......
This file is too large to display.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -43,6 +43,7 @@
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0",
"generate-asset-webpack-plugin": "^0.3.0",
"node-sass": "^4.12.0",
"prettier": "^1.18.2",
"sass-loader": "^8.0.0",
......
......@@ -17,6 +17,8 @@
<script src="<%= BASE_URL %>zTree_v3/js/jquery.ztree.exhide.min.js"></script>
<script src="<%= BASE_URL %>zTree_v3/js/fuzzysearch.js"></script>
<script src="<%= BASE_URL %>js/keymaster.js"></script>
<script src="<%= BASE_URL %>js/config.js"></script>
<script src="<%= BASE_URL %>js/NodePlayer-full.min.js"></script>
</head>
<body id="theme-name">
<noscript>
......
This diff could not be displayed because it is too large.
No preview for this file type
This diff could not be displayed because it is too large.
No preview for this file type
This diff could not be displayed because it is too large.
No preview for this file type
export let config = {
"logstatus":false, //是否开启日志收集
window.config = {
"logstatus":true, //是否开启日志收集
"hadertitle":"AI视频分析平台",//系统标题
"logintitle":"AI视频分析平台",//展示标题
"https": false,
"isvideo":0,
"bigtree":false,//大数据展示树
"host":"http://10.1.200.100:20080",
"ddurl":"http://aaa.zzgx.gov.cn",
"ddloginurl":"http://10.1.200.97:29090",
"huasanDD": 'http://aaa.zzgx.gov.cn/oauth/authorize?response_type=code&scope=read&client_id=KLjmdAH0',
"ddwsurl":"10.1.200.97:29090",
"isdd":false, //是否开启钉钉登录
}
{"commit":"396f8de8bfd915640ef731d378a7bdc81e4bdfbf","commitDate":"2021-1-18 15:21","buildDate":"2021-2-23 18:8","version":"2.0.9","info":"临时提交文件"}
\ No newline at end of file
{"commit":"226e28357cc713ecc9f9cf3535515e003387c606","commitDate":"2021-2-23 18:45","buildDate":"2021-4-23 11:7","version":"2.1.0","info":"feat✨ 设备树搜索改为服务端搜索"}
\ No newline at end of file
{
"logstatus":false, //是否开启日志收集
"hadertitle":"AI视频分析平台",//系统标题
"logintitle":"AI视频分析平台",//展示标题
"https": false,
"isvideo":1,
"bigtree":false,//大数据展示树
}
......@@ -10,16 +10,19 @@ import ops from "./ops";
import {config} from '../../public/js/config.js'
import baseurl from './baseUrl'
let wsIP = "";
let flvIP = "";
switch (process.env.NODE_ENV) {
case "development":
wsIP = config.https?"192.168.9.227:20070":"192.168.9.227:20080"; // 测试环境url
// baseUrl = "http://192.168.9.61:8086";
wsIP = window.config.https?"192.168.9.227:20070":"192.168.9.233:20080"; // 测试环境url
flvIP = window.config.https?"192.168.9.245:8080":"192.168.9.245:8080";
break;
case "pre":
wsIP = ""; // 预上线环境url
break;
case "production":
wsIP = location.host; // 生产环境url
flvIP = "192.168.9.245" + ":8080"
// flvIP = location.hostname + ":8080"
break;
}
export default {
......@@ -33,5 +36,6 @@ export default {
codes,
ops,
wsIP,
flvIP,
baseurl
};
let baseUrl = "/api"; // 本地代理
import {config} from '../../public/js/config.js'
console.log(process.env.NODE_ENV);
switch (process.env.NODE_ENV) {
case "development":
// baseUrl = "http://192.168.9.234:20080"; // 测试环境url
baseUrl = config.https?"https://192.168.9.233:20070":"http://192.168.9.245:20080"; // 测试环境url
baseUrl = window.config.https?"https://192.168.9.233:20070":"http://192.168.9.233:20080"; // 测试环境url
// baseUrl = "http://192.168.9.82:8080"; // 测试环境url
// baseUrl = "http://192.168.9.61:8086";
// baseUrl = 'http://vion-panda.51vip.biz:52510';
......@@ -14,7 +13,7 @@ switch (process.env.NODE_ENV) {
break;
case "production":
baseUrl = config.https?`https://${location.host}`:`http://${location.host}`; // 生产环境url
baseUrl = window.config.https?`https://${location.host}`:`http://${location.host}`; // 生产环境url
break;
}
......
......@@ -41,5 +41,8 @@ export default {
},
deleteTrafficCode(cate_unid,code_unid,params) {
return api.delete(urls.editTrafficCode(cate_unid, code_unid), params);
},
editcustomCode(cate_unid,code_unid,params) {
return api.post(urls.editcustomCode(cate_unid, code_unid), params);
}
};
......@@ -17,5 +17,8 @@ export default {
},
editTrafficCode(cate_unid, code_unid) {
return `${baseUrl}/api/v1/codes/traffic/cates/${cate_unid}/codes/${code_unid}`;
},
editcustomCode(cate_unid,code_unid){
return `${baseUrl}/api/v1/codes/custom/cates/${cate_unid}/codes/${code_unid}`;
}
};
......@@ -26,8 +26,14 @@ export default {
url = "/vchans?vchan_type=vfile";
break;
}
return `${baseUrl}/api/v1/devconf_fx/devs/${devuid}${url}`
if(window.config.bigtree) {
return `${baseUrl}/api/v1/devconf_fx/devs/${devuid}${url}` //ztree版本
} else {
return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${devuid}${url}`, params);
}
},
getDevtreeLike(devuid, devname, params){
let url = "";
switch (devname) {
......
import api from './index';
import baseurl from './baseUrl';
import moment from "moment";
import {config} from '../../public/js/config'
let oplogurl = `${baseurl}/api/v1/log_serv/user_oper_logs`
let userlogurl = `${baseurl}/api/v1/log_serv/system_logs/`
......@@ -15,7 +14,7 @@ let servicename = {
}
const oplogs = function(data,service,action) {
//开启日志模式才进行日志收集
if(config.logstatus) {
if(window.config.logstatus) {
let username = localStorage.getItem('uname');
let baseData = {
"dt": moment().locale('zh-cn'),
......
......@@ -14,5 +14,11 @@ export default {
},
storeconfs(params, id) {
return api.get(urls.storeconfs, params);
},
ddlogout:(params) => {
return api.post(urls.ddout,params)
},
ddlogin:(params) => {
return api.get(urls.ddlogin,params)
}
};
......@@ -6,6 +6,8 @@ export default {
cates: baseUrl + "/api/v1/codes/traffic/cates",
codes: baseUrl + "/api/v1/codes/traffic/cates/",
customCode:baseUrl + "/api/v1/codes/custom/cates",
menus:baseUrl + "/api/v1/auth/apps/0d88c025fafc5ad1189670655597c183/menus"
menus:baseUrl + "/api/v1/auth/apps/0d88c025fafc5ad1189670655597c183/menus",
ddout:`${window.config.ddloginurl}/api/v1/huasan/code/hs/logout`,
ddlogin:`${window.config.ddloginurl}/ddlogin`
// getApps:baseUrl + "/api/v1/auth/apps"
};
......@@ -284,6 +284,13 @@ Vue.prototype.base64Img = function(file) {
};
});
};
/**
* 判断是否是chrome浏览器
*/
Vue.prototype.checkchrome = function() {
var isWebKit = navigator.userAgent.indexOf('WebKit') > -1 //
return isWebKit
};
/**
* code操作
......
......@@ -27,7 +27,7 @@ import {config} from '../../public/js/config'
this.player = document.getElementById('playerVideo');
console.log(this.player)
this.player.loop = true;
if(config.https) {
if(window.config.https) {
let loc = location.host
this.player.src = `https://${loc}/${play_url.split(":20080")[1]}`
} else {
......
......@@ -36,7 +36,3 @@ new Vue({
store,
render: h => h(App)
}).$mount("#app");
//用户退出时清除相关信息
// window.onunload = function() {
// localStorage.clear();
// };
......@@ -23,6 +23,10 @@ export const constantRouterMap = [{
]
},
{
path: "/ddlogin",
name: "ddlogin",
component: resolve => require(["../views/ddlogin.vue"], resolve)
},{
path: "/login",
name: "login",
// route level code-splitting
......
......@@ -135,19 +135,29 @@ export default {
},
handleCommand(command){
window.document.documentElement.setAttribute('data-theme',command);
localStorage.setItem("theme",command)
localStorage.setItem("fxtheme",command)
},
ddlogout(){
let params = {
"access_token":localStorage.getItem("access_token")
}
this.$api.login.ddlogout(params).then(res=> {
console.log("dingding",res)
})
},
logout() {
localStorage.removeItem("menu");
localStorage.removeItem("curmenu");
this.$store.commit(types.ATOKEN, "");
localStorage.removeItem("atoken");
this.$logs.oplogs('','serv_login',`登出了平台`);
if(window.config.isdd) {
this.ddlogout()
}
localStorage.removeItem("atoken");
this.$router.push("/login").catch(err => {
err;
});
location.reload();
// location.reload();
},
resetpass() {
......@@ -157,7 +167,7 @@ export default {
}
},
created() {
this.headertitle = config.hadertitle;
this.headertitle = window.config.hadertitle;
this.$api.device.getDev().then(m => {
if (m.length < 1) {
this.$message({
......@@ -174,7 +184,7 @@ export default {
menus
},
mounted() {
let theme = localStorage.getItem("theme") || 'light';
let theme = localStorage.getItem("fxtheme") || 'light';
window.document.documentElement.setAttribute('data-theme',theme);
console.log(this.permission_routers);
this.conHeight = window.innerHeight - 65;
......@@ -200,7 +210,6 @@ export default {
clearTimeout(window.mousetimer);
}
window.mousetimer = setTimeout(() => {
debugger
clearTimeout(window.mousetimer);
window.mousetimer = null;
this.logout();
......@@ -239,7 +248,7 @@ export default {
let uid = localStorage.getItem("user_unid");
let clientid = localStorage.getItem("client_unid");
this.$api.device.getGlobalWs(uid, clientid).then(data => {
if(config.https) {
if(window.config.https) {
let url = data.ws_url.replace("ws://","wss://")
this.globalWs = new WebSocket(url.replace("20080","20070"));
} else {
......
<template>
<div id="login" :style="{ height: innerHeight + 'px' }" class="js-count-particles" >
<div class="ddclosebtn"><span class="el-icon-close" @click="closedd" v-if="isdd" v-show="showdd"></span></div>
<!-- ie空白解决方法https://blog.csdn.net/heyNewbie/article/details/99623550 -->
<!-- <vue-particles
color="#dedede"
......@@ -48,6 +49,10 @@
>
</el-form-item>
</el-form>
<div class="ddbox" v-show="isdd">
<img class="ddimg" src="../assets/img/login/dd@2x.png" alt="">
<span class="title" @click="switchLogin">钉钉登录</span>
</div>
<div class="syversion">版本:v{{ versioninfo.version }}</div>
</div>
</div>
......@@ -79,12 +84,17 @@ export default {
return {
username: "",
password: "",
showdd:true,
innerHeight: 0,
logintitle:"",
isdd:window.config.isdd,
webSocketL:null,
ddWindow:null,
ruleForm: {
username: "",
password: ""
},
ddurl:`${window.config.ddurl}/oauth/authorize?response_type=code&scope=read&client_id=KLjmdAH0&redirect_uri=${window.config.ddloginurl}/api/v1/huasan/code/call`,
versioninfo: versioninfo,
rules: {
password: [{ validator: validatePass, trigger: "change" }],
......@@ -102,6 +112,9 @@ export default {
}
});
},
closedd(){
this.showdd = false;
},
initHeight() {
this.innerHeight = window.innerHeight;
},
......@@ -115,18 +128,35 @@ export default {
})
.then(res => {
if (!res.ecode) {
this.$store.commit(types.ATOKEN, res.atoken);
this.loginMount(res,"user")
} else {
this.$message({
type: "error",
message: res.enote
});
}
})
.catch(err => {
this.$message({
type: "error",
message: err
});
});
},
loginMount(res,logintype){
this.$store.commit(types.ATOKEN, res.atoken);
// localStorage.setItem('rtoken',m.data.rtoken)
sessionStorage.setItem("user_unid", res.user_unid);
//本系统可以直接用本地缓存做
localStorage.setItem("atoken", res.atoken);
localStorage.setItem("uname", res.user_name);
this.$logs.oplogs(res.user_name,'serv_login',`登录了平台`);
localStorage.setItem("access_token",res.access_token || '')
// 处理登录用户权限菜单显示问题;
if(res.firstLogin) {
this.$router.push('resetpass')
return;
}
// if(res.firstLogin && logintype !== "dingding") {
// this.$router.push('resetpass')
// return;
// }
//算法配置列表
this.algoList();
//存储配置列表
......@@ -138,19 +168,6 @@ export default {
this.getEventList();
this.getDev();
this.getMenu(res.user_unid);
} else {
this.$message({
type: "error",
message: res.enote
});
}
})
.catch(err => {
this.$message({
type: "error",
message: err
});
});
},
getMenu(id) {
//获取菜单
......@@ -253,6 +270,7 @@ export default {
});
});
},
switchLogin(){},
getOneEventList(code, id) {
this.$api.codes.eventType({}, id).then(res => {
// 存储cate列表
......@@ -296,8 +314,9 @@ export default {
document.body.style.overflow = "hidden";
},
created() {
this.logintitle = config.logintitle;
this.logintitle = window.config.logintitle;
this.initHeight();
// this.isdd? this.switchLogin():null;
let _this = this;
document.onkeydown = function(e) {
let _key = window.event.keyCode;
......@@ -429,4 +448,32 @@ p:nth-child(1) {
.syversion {
color: rgb(199, 197, 197);
}
.ddbox {
margin-top: -10px;
.ddimg{
height: 20px;
width: 20px;
vertical-align: middle;
margin: -5px 10px 0 0;
}
.title {
cursor: pointer;
color: #0069ff;
font-size: 14px;
}
}
.ddiframe{
position: relative;
height: 100%;
width: 100%;
z-index: 1000;
}
.ddclosebtn{
position: absolute;
right: 20px;
top: 10px;
color: #ccc;
z-index:10001;
cursor: pointer;
}
</style>
<template>
<div class="login-bg"></div>
</template>
<script>
import types from "../store/types.js";
export default {
data() {
return {
ddLoginUrl: ""
};
},
created() {
let host = `http://${location.host}`;
this.ddLoginUrl = `${
window.config.huasanDD
}&redirect_uri=${`${ window.config.host}/#/ddlogin`}`;
this.switchLogin();
},
mounted() {},
methods: {
switchLogin() {
setTimeout(() => {
let { href } = window.location,
code = "";
console.log(href, href.includes("code"));
if (href.includes("code")) {
code = href.split("?")[1].split("#")[0];
}
console.log("code", code);
if (code) {
this.getLoginInfo(code);
} else {
window.location.href = this.ddLoginUrl;
}
}, 200);
},
getLoginInfo(code) {
this.$api.login.ddlogin({"code":code.split("=")[1]}).then(res => {
if (res.code == 200) {
this.loginMount(res.data);
} else if (res.code == 500) {
window.location.href = this.ddLoginUrl;
}
});
},
dealRedirect (){
let { redirect } ="";
if(redirect) {
redirect = redirect.split('/')[ redirect.split('/').length - 1 ];
}
return redirect
},
loginMount(res, logintype) {
this.$store.commit(types.ATOKEN, res.atoken);
// localStorage.setItem('rtoken',m.data.rtoken)
sessionStorage.setItem("user_unid", res.user_unid);
//本系统可以直接用本地缓存做
localStorage.setItem("atoken", res.atoken);
localStorage.setItem("uname", res.user_name);
this.$logs.oplogs(res.user_name, "serv_login", `登录了平台`);
localStorage.setItem("access_token", res.access_token || "");
// 处理登录用户权限菜单显示问题;
// if(res.firstLogin && logintype !== "dingding") {
// this.$router.push('resetpass')
// return;
// }
//算法配置列表
this.algoList();
//存储配置列表
this.storeConfList();
//code列表
this.getCatesList();
this.getCodeList();
this.getCustomCode();
this.getEventList();
this.getDev();
this.getMenu(res.user_unid);
},
getMenu(id) {
//获取菜单
this.$api.login
.getMenus({
shape: "tree"
})
.then(res => {
localStorage.setItem(
"menu",
JSON.stringify(res.menu_tree[0].children)
);
this.$store
.dispatch("GetMenuRole", res.menu_tree[0].children)
.then(r => {
this.$router
.push(res.menu_tree[0].children[0].children[0].path)
.catch(err => {
err;
});
});
});
},
algoList() {
this.$api.login
.algocombs({
limit: "",
algo_set: "video"
})
.then(res => {
if (!res.ecode) {
this.$store.commit(types.ALGO, res.list_data);
}
})
.catch(err => {});
},
storeConfList() {
this.$api.login
.storeconfs({
offset: 0,
limit: ""
})
.then(res => {
if (!res.ecode) {
this.$store.commit(types.STORECONF, res.list_data);
}
})
.catch(err => {});
},
getCodeList() {
this.$api.codes
.cates()
.then(res => {
res.list_data.forEach(item => {
this.$api.codes
.codes({ active: true }, item.cate_unid)
.then(res => {
// 存储code列表
window.localStorage.setItem(
item.name,
JSON.stringify(res.list_data)
);
// 存储单独code
res.list_data.forEach(chilItem => {
window.localStorage.setItem(
item.name + "-" + chilItem.code,
chilItem.name
);
});
})
.catch(err => {});
});
})
.catch(err => {});
},
getCustomCode() {
this.$api.codes
.customCode()
.then(res => {
if (res.list_data.length > 0) {
res.list_data.forEach(item => {
window.localStorage.setItem(
item.name + "-" + item.cate,
item.unid
);
});
} else {
this.$message({
type: "warning",
message: "获取自定义编码失败!"
});
}
})
.catch(err => {});
},
getCatesList() {
this.$api.codes.eventCates({}).then(res => {
// 存储cate列表
window.localStorage.setItem("cate列表", JSON.stringify(res.list_data));
// 存储单独code
res.list_data.forEach(item => {
this.getOneEventList(item.code, item.event_cate_unid);
});
});
},
getOneEventList(code, id) {
this.$api.codes.eventType({}, id).then(res => {
// 存储cate列表
window.localStorage.setItem(code, JSON.stringify(res.list_data));
});
},
getEventList() {
this.$api.search.eventTypes({ active: true }).then(res => {
// 存储code列表
window.localStorage.setItem("安防事件", JSON.stringify(res.list_data));
// 存储单独code
res.list_data.forEach(item => {
window.localStorage.setItem("安防事件-" + item.code, item.name);
});
});
},
getDev() {
this.$api.resource.devs().then(res => {
localStorage.setItem("dev_unid", res[0].dev_unid);
this.getDevsName(res[0].dev_unid);
});
},
getDevsName(id) {
this.$api.resource
.getDevsName(
{
is_leaf: 0
},
id
)
.then(res => {
if (res.list_data.length > 0) {
sessionStorage.setItem("device_id", res.list_data[0].device_id);
}
});
}
}
};
</script>
<style scoped>
.login-bg {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-image: url("../assets/img/login/background.png");
background-size: 100% 100%;
}
</style>
\ No newline at end of file
......@@ -238,7 +238,6 @@
message: '删除成功!'
});
this.getTableList();
debugger
this.$logs.oplogs(res,'serv_auth',`删除角色${row.name}`);
}else{
this.$message({
......@@ -247,7 +246,6 @@
});
}
})
}).catch(() => {
this.$message({
type: 'info',
......@@ -269,8 +267,7 @@
permarr.push(item.perm_unid)
}
})
this.$refs.editTree.setCheckedKeys(permarr);
this.$refs.editTree.setCheckedKeys(permarr);
this.editUnid=row.role_unid;
})
},
......@@ -302,7 +299,6 @@
message: data.enote
});
}
})
}else{
this.$message({
......@@ -339,7 +335,6 @@
message: data.enote
});
}
})
}else{
this.$message({
......
......@@ -49,7 +49,7 @@
<el-button
size="small"
type="primary"
@click="submitUpload"
@click="submitUpload('config')"
plain
class="plainButton"
>参数导入</el-button
......@@ -151,6 +151,47 @@
</div>
</el-form>
</div>
<!-- 数据备份 -->
<div class="lineBox big"><i class="el-icon-share"></i>设备鉴权</div>
<div class="radioContent">
<div class="lineBox">
<span class="upTit">鉴权文件</span
><span class="upTit2">选择导入文件</span>
<div class="upInput">
<el-input v-model="authfilename"></el-input>
</div>
<span style="display: inline-block;">
<el-upload
class="upload-demo"
ref="authupload"
:on-change="authfileChange"
:multiple="false"
:show-file-list="false"
:auto-upload="false"
:action="authexurl"
:on-success="authsuccessback"
:data="updata"
:on-error="onerrorback"
>
<el-button
slot="trigger"
size="small"
type="primary"
class="primaryButton upButton"
>浏览</el-button
>
<el-button
size="small"
type="primary"
@click="submitUpload('auth')"
plain
class="plainButton"
>鉴权</el-button
>
</el-upload>
</span>
</div>
</div>
</el-form>
</div>
</template>
......@@ -160,8 +201,15 @@ export default {
return {
openRestart: false,
selectFilename: "",
authfilename:"",
authfile:null,
updata:{
name:'',
vchan_type:"authfile"
},
timeArr: [],
exurl: "http://" + location.host + "/api/v1/devconf_fx/restore",
authexurl:`http://${location.host}/api/v1/devconf_fx/devs/${localStorage.getItem("dev_unid")}/vfile_vchans`,
file: null,
dev_unid: localStorage.getItem("dev_unid"),
device_id: sessionStorage.getItem("device_id")
......@@ -196,12 +244,18 @@ export default {
});
}
},
submitUpload() {
let importFileExt = this.file.name.substr(
submitUpload(type) {
if(type === 'config') {
let importFileExt = this.file.name.substr(
this.file.name.lastIndexOf(".")
);
this.$refs.upload.submit(); // 这里是执行文件上传的函数,其实也就是获取我们要上传的文件
);
this.$refs.upload.submit(); // 这里是执行文件上传的函数,其实也就是获取我们要上传的文件
} else if(type === 'auth'){
this.$refs.authupload.submit();
}
},
successback() {
this.$message({
type: "success",
......@@ -211,6 +265,15 @@ export default {
this.file = null;
this.$logs.oplogs(res,'serv_system',`参数导入`);
},
authsuccessback(){
this.$message({
type: "success",
message: "上传成功!"
});
this.selectFilename = "";
this.file = null;
this.$logs.oplogs(res,'serv_system',`鉴权文件导入`);
},
onerrorback() {
this.file = null;
},
......@@ -218,6 +281,11 @@ export default {
this.selectFilename = file.name;
this.file = file;
},
authfileChange(file, fileList) {
this.authfilename = file.name;
this.updata.name = file.name;
this.authfile = file;
},
reset() {
this.$confirm("此操作将恢复出厂设置, 是否继续?", "提示", {
confirmButtonText: "确定",
......
<template>
<div class="ocxbox">
<canvas id="video1" style="width:100%;height:100%;" class="fvideo"></canvas>
<div class="control" hidden>
<span :class="{'videostatus':true,'el-icon-video-play':videostatus,'el-icon-video-pause':!videostatus }" @click="controlvideo"></span>
<!-- <span :class="{'el-icon-full-screen':!furllstatus,'el-icon-circle-close':furllstatus,'videostatus':true, 'full-icon':true}" @click="fullvideo" id="full"></span> -->
</div>
</div>
</template>
<script>
var player;
export default {
data() {
return {
show: true,
videostatus:false,
furllstatus:false
};
},
computed: {},
methods: {
controlvideo() {
this.videostatus = !this.videostatus
if(!this.videostatus) {
this.startFunc()
} else {
this.stopFunc()
}
},
fullvideo(ev){
if(!this.furllstatus){
this.furllstatus = true;
this.fullel();
} else {
this.furllstatus = false;
this.exitFullscreen();
}
},
fullel(){
var ele = document.getElementById("full")
if (ele.requestFullscreen) {
ele.requestFullscreen();
} else if (ele.mozRequestFullScreen) {
ele.mozRequestFullScreen();
} else if (ele.webkitRequestFullScreen) {
ele.webkitRequestFullScreen();
}
},
exitFullscreen(){
var de = document
if (de.exitFullscreen) {
de.exitFullscreen();
} else if (de.mozCancelFullScreen) {
de.mozCancelFullScreen();
} else if (de.webkitCancelFullScreen) {
de.webkitCancelFullScreen();
}
},
startFunc(url) {
this.stopFunc()
/**
* 设置解密密码,必须是16字节
*/
player.setCryptoKey("");
/**
* 开始播放,参数为 http-flv或 websocket-flv 的url
*/
player.start(url);
},
stopFunc() {
/**
* 停止播放
*/
player.stop();
},
fullFunc() {
/**
* 全屏播放
*/
player.fullscreen();
},
volumeChange(event) {
/**
* 设置音量
* 0.0 ~~ 1.0
* 当为0.0时,完全静音, 最大1.0
*/
player.setVolume(event.target.value / 100.0);
},
bufferChange(event) {
player.setBufferTime(event.target.value);
},
scaleModeChange(event) {
/**
* 视频缩放模式, 当视频分辨率比例与Canvas显示区域比例不同时,缩放效果不同:
* 0 视频画面完全填充canvas区域,画面会被拉伸 --- 默认值
* 1 视频画面做等比缩放后,对齐Canvas区域,画面不被拉伸,但有黑边
* 2 视频画面做等比缩放后,完全填充Canvas区域,画面不被拉伸,没有黑边,但画面显示不全
* 软解时有效
*/
player.setScaleMode(event.target.value);
}
},
mounted() {
NodePlayer.load(() => {
/**
* 是否打印debug信息
*/
// NodePlayer.debug(true);
player = new NodePlayer();
/**
* 自动测试浏览器是否支持MSE播放,如不支持,仍然使用软解码。
* 紧随 new 后调用
* 不调用则只使用软解
*/
//player.useMSE();
/**
* 传入 canvas视图的id,当使用mse时,自动转换为video标签
*/
player.setView("video1");
/**
* 是否开启屏幕常亮
* 在手机浏览器上,canvas标签渲染视频并不会像video标签那样保持屏幕常亮
* 如果需要该功能, 可以调用此方法, 会有少量cpu消耗, pc浏览器不会执行
*/
player.setKeepScreenOn();
/**
* 设置为等比缩放模式
*/
player.setScaleMode(1);
/**
* 设置最大缓冲时长,单位毫秒,只在软解时有效
*/
player.setBufferTime(1000);
player.on("start", () => {
console.log("player on start");
});
player.on("stop", () => {
console.log("player on stop");
});
player.on("error", e => {
console.log("player on error", e);
});
player.on("videoInfo", (w, h) => {
console.log("player on video info width=" + w + " height=" + h);
});
player.on("audioInfo", (r, c) => {
console.log("player on audio info samplerate=" + r + " channels=" + c);
});
player.on("stats", stats => {
// console.log("player on stats=", stats);
});
player.on("metadata", metadata => {
var m = NodePlayer.AMF.parseScriptData(
metadata.buffer,
0,
metadata.length
);
console.log(m);
});
});
}
};
</script>
<style lang="stylus">
.ocxbox {
height: 100%;
position: relative;
.fvideo {
height: 100%;
width: 100%;
}
.control {
position: absolute;
bottom: 0;
height: 40px;
width: 100%;
background: rgba(255, 255, 255, 0.2);
display none
.videostatus {
cursor: pointer;
color: #fff;
font-size: 30px;
line-height: 40px;
padding-left: 10px;
}
.full-icon{
float right
margin-right 20px
font-size 25px
}
}
}
.ocxbox:hover {
.control{
// display block
cursor pointer
}
}
</style>
......@@ -26,6 +26,8 @@ export default {
props: ["playurl", "type"],
methods: {
videoPlay: function() {
debugger
this.urlFlag = false;
console.log(this.playurl);
if (!this.playurl.sip_serv_ip) {
......
<template>
<div>
<el-tree
class="filter-tree"
accordion
:data="treeData"
node-key="id"
:props="defaultProps"
@node-click="handleNodeClick"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="catree"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>
<span
class="tree-label"
v-if="data.label || data.label == ''"
>{{ data.label == "" ? "未命名" : data.label }}</span
>
<span class="tree-label" v-else-if="!data.label">{{
data.vchan_name == "" ? "未命名" : data.vchan_name
}}</span>
</span>
<span class="tree-btn" v-if="(data.label || data.label == '') && data.vtype ? false:true" >
<i class="el-icon-plus" @click.stop="nodeAddClick(node, data)"></i>
<i
class="el-icon-edit"
@click.stop="nodeEditClick(node, data)"
v-if="data.org_type != 'root'"
></i>
<i
class="el-icon-delete"
@click.stop="nodeDelClick(node, data)"
v-if="data.org_type != 'root'"
></i>
</span>
</span>
</el-tree>
<el-dialog title="添加" :visible.sync="addVisible" width="450px">
<div>
<el-form
label-position="left"
label-width="120px"
:model="formData"
:rules="rules"
ref="addForm"
hide-required-asterisk
>
<el-form-item label="添加目标类型">
<el-select
v-model="formData.targetType"
placeholder="请选择"
:popper-append-to-body="false"
>
<el-option
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in targetOpt"
>
</el-option>
</el-select>
</el-form-item>
<div v-if="formData.targetType == 'org'">
<el-form-item label="组织编号">
<el-input v-model="formData.code"></el-input>
</el-form-item>
<el-form-item label="组织名称" prop="name">
<el-input v-model="formData.name"></el-input>
</el-form-item>
</div>
<div v-else-if="formData.targetType == 'address'">
<el-form-item label="地点编号">
<el-input v-model="formData.code"></el-input>
</el-form-item>
<el-form-item label="地点名称" prop="name">
<el-input v-model="formData.name"></el-input>
</el-form-item>
</div>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="addVisible = false">取 消</el-button>
<el-button type="primary" @click="save">确 定</el-button>
</span>
</el-dialog>
<!-- 编辑dialog -->
<el-dialog title="修改" :visible.sync="editVisible" width="450px">
<div>
<el-form
label-position="left"
label-width="120px"
:model="editForm"
:rules="rules"
hide-required-asterisk
ref="editForm"
>
<div v-if="editForm.targetType == 'org'">
<el-form-item label="组织编号">
<el-input v-model="editForm.code" disabled></el-input>
</el-form-item>
<el-form-item label="组织名称" prop="name">
<el-input v-model="editForm.name"></el-input>
</el-form-item>
</div>
<div v-else-if="editForm.targetType == 'address'">
<el-form-item label="地点编号">
<el-input v-model="editForm.code" disabled></el-input>
</el-form-item>
<el-form-item label="地点名称" prop="name">
<el-input v-model="editForm.name"></el-input>
</el-form-item>
</div>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="editVisible = false">取 消</el-button>
<el-button type="primary" @click="editFinish">确 定</el-button>
</span>
</el-dialog>
<addCamera ref="addCamera" @getAllData="addCamareAfterGet"></addCamera>
</div>
</template>
<script>
import addCamera from "./cameraDialog";
export default {
data() {
return {
formData: {
targetType: "org"
},
editForm: {
targetType: "",
name: "",
code: ""
},
addVideoParam: {},
treeData: [
{
unid: "0",
org_pid: "0",
label: "手动添加相机资源",
type: "root",
org_type: "root",
children: []
}
],
currentNodeId: "",
defaultProps: {
children: "children",
disabled: "disabled",
label: "label"
},
addVisible: false,
editVisible: false,
targetOpt: [],
rules: {
name: [
{ required: true, message: "请输入名称", trigger: "blur" },
]
},
dev_unid: localStorage.getItem("dev_unid")
};
},
components: {
addCamera
},
props: {
filterText: {
type: String,
default: ""
},
treeDatas: {
type: Array,
defalut: []
}
},
watch: {
filterText(val) {
this.$refs.catree.filter(val);
},
treeDatas(val) {
this.treeData[0].children = val;
}
},
methods: {
addCamareAfterGet(data) {
this.$emit("getData", data);
},
handleNodeClick(data) {
this.$emit("clickHandle", data, "camera");
},
nodeDelClick(node, data) {
if(data.children.length > 0) {
this.$message({
type: "warning",
message: "该组织下存在子节点,不允许直接删除!"
});
return false;
}
this.$confirm("此操作将永久删除该选项, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
let cate_unid = this.getCustomCate("组织", "residence");
this.$api.resource
.getCode(
{
limit: 9999
},
cate_unid
)
.then(res => {
let editObj = [];
editObj = res.list_data.filter(
item => item.code == data.org_code
);
this.$api.resource
.delCode({}, cate_unid, editObj[0].unid)
.then(res => {});
this.$api.resource.delOrg({}, data.unid).then(res => {
if (!res.enote) {
this.$message({
type: "success",
message: "删除成功!"
});
let type = data.org_type;
if(type == 'org') {
this.$logs.oplogs(res,'serv_vchan',`删除组织${data.label}`);
}
if(type == 'address') {
this.$logs.oplogs(res,'serv_vchan',`删除地点${data.label}`);
}
this.$emit("getTree");
}
});
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除"
});
});
},
nodeEditClick(node, data) {
this.editForm.targetType = data.org_type;
this.editForm.code = data.org_code;
this.editForm.name = data.org_name;
this.editVisible = true;
},
editFinish() {
this.$refs["editForm"].validate(valid => {
if (valid) {
let cate_unid = this.getCustomCate("组织", "residence");
this.$api.resource
.getCode(
{
limit: 9999
},
cate_unid
)
.then(res => {
let editObj = [];
editObj = res.list_data.filter(
item => item.code == this.editForm.code
);
debugger
let data = {
code_unid: editObj[0].unid,
code: this.editForm.code,
name: this.editForm.name,
note: this.editForm.name,
active: true,
sort: 0,
};
this.$api.codes
.editcustomCode(
cate_unid,
editObj[0].unid,
data
)
.then(data => {
let type = this.editForm.targetType;
if(type == 'org') {
this.$logs.oplogs(res,'serv_vchan',`修改组织${this.editForm.name}`);
}
if(type == 'address') {
this.$logs.oplogs(res,'serv_vchan',`修改地点${this.editForm.name}`);
}
console.log(type)
if (res.ecode) {
this.$message({
type: "error",
message: res.enote
});
} else {
this.editVisible = false;
this.$emit("getTree");
}
});
});
} else {
return false;
}
});
},
delTreenode(data){
this.$refs.catree.remove(data.vchan_refid)
},
nodeAddClick(node, data) {
if (data.org_type == "address") {
//添加视频
this.$refs.addCamera.initDialog(node, "add", this.dev_unid);
} else {
//添加组织关系
this.currentNodeId = data.unid;
this.formData = {
targetType: "org",
name: "",
code: ""
};
if (data.org_type === "root") {
this.targetOpt = [
{
label: "组织",
value: "org"
}
];
} else if (data.org_type === "org") {
this.targetOpt = [
{
label: "组织",
value: "org"
},
{
label: "地点",
value: "address"
}
];
} else {
this.targetOpt = [
{
label: "地点",
value: "address"
}
];
}
this.addVisible = true;
}
},
getCustomCate(name, cate) {
let localKey = name + "-" + cate;
return window.localStorage.getItem(localKey);
},
save() {
this.$refs["addForm"].validate(valid => {
if (valid) {
let cate_unid = this.getCustomCate("组织", "residence");
// console.log('添加节点分类unid:', cate_unid);
if (cate_unid) {
this.$api.resource
.addCode(
{
code: this.formData.code,
name: this.formData.name
},
cate_unid
)
.then(res => {
if (res.ecode) {
this.$message({
type: "error",
message: res.enote
});
} else {
this.orgServ(); // org service
}
});
}
} else {
return false;
}
});
},
orgServ() {
this.$api.resource
.addNode({
org_pid: this.currentNodeId,
org_type: this.formData.targetType,
org_code: this.formData.code,
is_leaf: false
})
.then(res => {
if (res.ecode) {
this.$message({
type: "error",
message: res.enote
});
} else {
this.$message({
type: "success",
message: "添加成功!"
});
this.addVisible = false;
this.$emit("getTree");
let type =this.formData.targetType;
if(type == 'org') {
this.$logs.oplogs(res,'serv_vchan',`添加组织${this.formData.name}`);
}
if(type == 'address') {
this.$logs.oplogs(res,'serv_vchan',`添加地点${this.formData.name}`);
}
}
});
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
}
}
};
</script>
<style></style>
......@@ -104,7 +104,7 @@ export default {
connectwebsocket(type) {
let that = this;
this.connect_id = new Date().getTime();
if(config.https) {
if(window.config.https) {
this.cws = new WebSocket(
`wss://${this.$api.wsIP}/websocket/v1/recv_data/connects/${this.connect_id}`
);
......
......@@ -63,7 +63,8 @@
<el-col :span="15" class="ht100">
<div class="video-box">
<div class="play-box">
<videoplay ref="videoplay" :playurl="playurl"></videoplay>
<videoplay ref="videoplay" :playurl="playurl" v-if="!ischrome"></videoplay>
<flvvideo ref="flvideo" v-if="ischrome"></flvvideo>
</div>
<div class>
<setting
......@@ -89,6 +90,7 @@
</template>
<script>
import videoplay from "../public/videoPlay";
import flvvideo from "../public/flvvideo"
import InfoDialog from "../public/infodialog";
import setting from "./setting";
import eventtab from "./eventTab";
......@@ -97,6 +99,7 @@ export default {
videoplay,
InfoDialog,
setting,
flvvideo,
eventtab
},
data() {
......@@ -109,6 +112,7 @@ export default {
subindex: -1,
playurl: "",
taskID: "",
streamclock:null,
currentSubtaskId: "",
defaultProps: {
children: "children",
......@@ -160,27 +164,45 @@ export default {
},
//发送推流请求
pushSteam(vdata) {
let data = {
send_stream: true,
task_id: this.currentSubtaskId,
is_analyse: true
};
this.$api.task
.getStream(this.dev_unid, vdata.vchan.vchan_refid, data)
.then(m => {
this.steam(vdata).then(m => {
if (m.ecode) {
this.$message({
message: "发送推流请求失败:" + m.enote,
type: "error"
});
} else {
this.vchandata = vdata.vchan;
this.getPlayUrl();
this.vchandata = vdata.vchan;
clearInterval(this.streamclock)
this.streamclock = null;
this.getPlayUrl();
}
})
},
steam(vdata){
return new Promise((resolve, reject) =>{
let data = {
send_stream: true,
task_id: this.currentSubtaskId,
is_analyse: true
};
this.$api.task
.getStream(this.dev_unid, vdata.vchan.vchan_refid, data)
.then(m => {
resolve(m);
});
})
},
getPlayUrl: function() {
this.$api.task.getPlayUrl(this.currentSubtaskId).then(res => {
if(this.ischrome) {
let ip = this.$api.flvIP;
let url = `http://${ip}/live/${this.currentSubtaskId}.flv`
console.log("FLV播放地址:", url)
this.$refs.flvideo.startFunc(url);
this.streamclock = setInterval(()=> {
this.steam(this.subtaskdata)
},9000)
}
this.$api.task.getPlayUrl(this.currentSubtaskId).then(res => {
this.playurl = res;
if (this.playurl.rtsp_url) {
this.$message({
......@@ -188,7 +210,7 @@ export default {
type: "success"
});
setTimeout(() => {
this.$refs.videoplay.videoPlay();
!this.ischrome?this.$refs.videoplay.videoPlay():null;
}, 2000);
console.info("视频播放地址:", this.playurl.rtsp_url);
} else {
......@@ -216,10 +238,16 @@ export default {
},
created() {
this.getTask();
this.ischrome = this.checkchrome();
},
mounted() {
},
beforeDestroy(){
clearInterval(this.streamclock);
this.streamclock = null;
}
};
</script>
......
......@@ -95,7 +95,7 @@ export default {
this.subtaskid = subid;
this.subtask_name = subdata.subtask_name;
this.dialogVisible = true;
this.uploadurl = `${config.https?'https':'http'}://${location.host}/api/v1/devconf_fx/import/${this.subtaskid}`;
this.uploadurl = `${window.config.https?'https':'http'}://${location.host}/api/v1/devconf_fx/import/${this.subtaskid}`;
this.fileList = [];
this.$store.commit("setocxstate", 0);
},
......
......@@ -471,7 +471,7 @@ export default {
this.conditions.location_code
? this.conditions.location_code.replace(/\s\s*/g, "")
: this.conditions.location_code
}&event_cate=${cate}`;
}&event_cate=${cate}&event_type=${this.conditions.type}`;
this.$logs.oplogs({},'serv_serarch',`事件数据导出`);
window.open(encodeURI(url));
},
......
......@@ -132,6 +132,10 @@
</el-date-picker>
</span>
</el-form-item>
<el-form-item label="导出设置">
<el-checkbox v-model="checked" true-label="1" false-label="0">
<span> 带视频导出</span></el-checkbox>
</el-form-item>
</el-form>
</el-col>
<el-col :span="2">
......@@ -159,6 +163,7 @@
:data="formatterData"
:height="tableHeight"
v-loading="loading"
ref="eventTable"
stripe
border
@selection-change="handleSelectionChange"
......@@ -435,6 +440,7 @@ export default {
return {
loading: false,
playurl: "",
checked:"0",
detailObj: {},
carImg: require("@/assets/img/home/defaultImg.png"),
detailImg: "",
......@@ -465,6 +471,7 @@ export default {
page: 1,
pageSize: 30,
selectcheck: [],
exportevent:[],
currentIndex: 0,
taskList: [],
displaystatus:'table',
......@@ -560,7 +567,11 @@ export default {
"&is_key_vehicle=" +
this.conditions.is_key_vehicle +
"&illegal_code=" +
this.conditions.illegal
this.conditions.illegal +
"&isHasVideo=" +
this.checked +
"&event_unids=" +
this.exportevent.join(",")
)
);
},
......@@ -622,8 +633,10 @@ export default {
},
handleSelectionChange(obj) {
this.selectcheck = [];
this.exportevent = [];
obj.forEach(item => {
this.selectcheck.push(item.id);
this.exportevent.push(item.unid);
});
},
handleSizeChange(val) {
......
<template>
<div>
<el-dialog
title="视频源配置修改"
top="12vh"
:visible.sync="setvisible"
width="906px"
:before-close="handleClose"
>
<moveTask ref="movetask"></moveTask>
<div>
<!-- 外层内容 -->
<div class="leftBox">
<el-input
class="search-input"
prefix-icon="el-icon-search"
placeholder="请输入内容"
v-model="searchText"
>
<el-button slot="append" icon="el-icon-search" @click="serchVchan"></el-button>
</el-input>
<div class=""></div>
<div class="treeBox">
<!-- <el-tree
:props="props"
:load="loadNode"
lazy
:node-key="props.id"
show-checkbox
@node-click="vchanClick"
ref="tree"
@check="handleCheckChange"
:filter-node-method="filterNode"
:render-content="renderContent"
></el-tree> -->
<!-- <tree
:setting="treesetting"
:nodes="nodes"
@onClick="onClick"
@onCheck="onCheck"
@onCreated="handleCreated"
@onExpand="onExpand"
@onAsyncSuccess="onAsyncSuccess"
/> -->
<div id="treeDemo" class="ztree"></div>
</div>
</div>
<div class="rightBox">
<div class="imgBox">
<videoplay ref="video" :playurl="play_url"></videoplay>
</div>
<div class="tableBox">
<el-table height="286" :data="tableData" border width="300">
<el-table-column align="center" prop="name" label="视频源名称">
<template slot-scope="scope">
<div @click="rowclick(scope.row)">
{{ scope.row.name }}
</div>
</template>
</el-table-column>
<el-table-column align="center" label="视频状态">
<template slot-scope="scope">
<div v-html="statusFormatter(scope.row)"></div>
</template>
</el-table-column>
<el-table-column
align="center"
width="136"
prop="operation"
label="视频操作"
>
<template slot-scope="scope">
<el-tooltip
content="迁移"
placement="bottom"
effect="light"
:visible-arrow="false"
>
<span
class="icon-fanxing-qianyi moveIcon"
@click="moveFun(scope.$index, scope.row)"
></span>
</el-tooltip>
<span class="tableSpanBorder"></span>
<el-tooltip
content="删除"
placement="bottom"
effect="light"
:visible-arrow="false"
>
<span
:class="{
'el-icon-delete': true,
delIcon: true,
nodel: scope.row.enableStatus == 5 ? true : false,
}"
@click="delFun(scope.$index, scope.row)"
></span>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div style="clear: both"></div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="editsubTask">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import videoplay from "../public/videoPlay";
import moveTask from "./moveSubTask";
export default {
data() {
return {
setting: {
async: {
enable: true,
type: "get",
dataFilter: this.filterNode,
url: this.getUrl,
otherParam: ["offset", "0", "limit", ""],
},
check: {
enable: true,
},
data: {
key: {
children: "childs",
id: "vchan_refid",
},
simpleData: {
enable: true,
},
},
view: {
expandSpeed: "",
showIcon: false,
},
callback: {
// beforeExpand: beforeExpand,
onClick: this.vchanClick,
beforeClick: this.beforeClick,
onAsyncSuccess: this.onAsyncSuccess,
onCheck: this.checkNode,
onExpand: this.onExpand,
beforeCheck: this.beforeCheck,
// onAsyncError: onAsyncError
},
},
tableData: [],
zNodes: [
{
name: "外部设备",
id: "0",
count: 500,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
{
name: "内部设备",
id: "1",
count: 1000,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
{
name: "短视频",
id: "2",
count: 2000,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
],
nodes: [
{
dev_unid: this.dev_unid,
id: 0,
refid: "",
name: "外部设备",
leaf: false,
disabled: true,
isParent: true,
children: [],
},
{
dev_unid: this.dev_unid,
refid: "",
id: 1,
name: "内部设备",
leaf: false,
isParent: true,
disabled: true,
children: [],
},
{
dev_unid: this.dev_unid,
refid: "",
id: 2,
name: "短视频",
leaf: false,
isParent: true,
disabled: true,
children: [],
},
],
play_url: "",
user_unid: "",
formData: {},
editData: {},
taskData: {},
moveTaskData: [],
searchText: "",
setvisible: false,
props: {
id: "vchan_refid",
label: "name",
children: "zones",
disabled: "disabled",
isLeaf: "leaf",
},
sessionData: {},
data: [],
defaultProps: {
children: "children",
label: "label",
id: "vchan_refid",
},
};
},
props: {
pedittype: {
type: String,
default: "add",
},
},
watch: {
parentData(val) {
// this.sessionData = JSON.parse(JSON.stringify(val));
// this.editData = val;
},
searchText(val) {
},
},
components: {
videoplay,
moveTask,
},
mounted() {},
methods: {
beforeCheck(treeId, treeNode) {
if (treeNode.refid || treeNode.vchan_refid) {
let staus = false;
if (this.tableData.length > 0) {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].vchan_refid == treeNode.vchan_refid || this.tableData[i].vchan_refid == treeNode.refid ) {
staus = true;
break;
}
}
}
if (!staus) {
if(treeNode.oldname) {
treeNode.name = treeNode.oldname
}
// this.editsubTask(data);
this.tableData.push(treeNode);
staus = false;
}
} else {
return false;
}
},
checkNode(event, treeId, treeNode) {
//勾选节点
if (!treeNode.checked) {
if (this.tableData.length > 0) {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].vchan_refid == treeNode.refid || this.tableData[i].refid == treeNode.refid) {
this.delFun(i, this.tableData[i], "tree");
break;
}
}
}
}
},
getUrl(treeId, treeNode) {
if (treeNode.level === 0) {
// http请求
let params = {
offset: 0,
limit: "",
};
return this.$api.device.getDevtree(
this.dev_unid,
treeNode.name,
params
);
}
},
onAsyncSuccess(event, treeId, treeNode, msg) {
// this.checkvckan()
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
let arr = [];
setTimeout(() => {
this.tableData.forEach((ele) => {
var id = zTree.getNodeByTId(ele.vchan_refid);
if (id) {
id.chkDisabled = true;
zTree.checkNode(id, true, false, function () {});
}
});
}, 1000);
// zTree.checkNode();
},
onExpand(ev, treeid, treenode) {
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
this.tableData.forEach((ele) => {
// var id = zTree.getNodeByTId(ele.refid);
var nodes = zTree.getNodesByFilter(function (node) {
return node.refid == ele.vchan_refid;
}, true);
if (nodes) {
nodes.checktype = true;
zTree.checkNode(nodes, true, false, function () {});
}
});
},
filterNode(treeId, parentNode, childNodes) {
var treenode = null;
if (!childNodes) return null;
if (parentNode.name === "短视频") {
var nodes = [];
childNodes.list_data.map((ele) => {
nodes.push(ele);
});
treenode = nodes;
} else if (parentNode.name === "内部设备") {
let vchans = childNodes.vchan_struct || childNodes.list_data;
treenode = vchans
} else {
treenode = childNodes.vchan_struct;
}
return treenode;
},
showModal(val) {
this.taskData = val;
this.tableData = [];
this.setvisible = true;
this.$store.commit("setocxstate", 1);
this.editData = val;
this.$api.task.getSubTask(val.task_id).then((res) => {
let ary = [];
let data = res.list_data;
for (let i in data) {
if (data[i].vchan) {
data[i].vchan.subtask_id = data[i].subtask_id;
data[i].vchan.refid = data[i].vchan.vchan_refid;
data[i].vchan.name = data[i].vchan.vchan_name;
data[i].vchan.running_status = data[i].running_status;
data[i].vchan.play_url = data[i].rtsp_url;
data[i].vchan.play_url = data[i].rtsp_url;
data[i].vchan.enableStatus = data[i].enableStatus;
} else {
data.vchan = {
subtask_id: data[i].subtask_id,
refid: "",
vchan_name: data[i].subtask_name,
name: data[i].subtask_name,
running_status: data[i].running_status,
play_url: data[i].rtsp_url,
enableStatus: data[i].enableStatus,
};
}
ary.push(data[i].vchan);
}
this.tableData = ary;
this.checkvckan();
});
var _this = this;
var ztree = null;
setTimeout(() => {
ztree = $.fn.zTree.init($("#treeDemo"), _this.setting, _this.zNodes);
// fuzzySearch("treeDemo", "#key", null, true); //初始化模糊搜索方法
}, 10);
},
statusFormatter(row) {
let data = row.enableStatus;
if (data == 2) {
return "<span class='runningbox statusbox'>工作中</span>";
} else if (data == 1) {
return "<span class='nomoralbox statusbox'>部署中</span>";
} else if (data == 3) {
return "<span class='pausebox statusbox'>暂停中</span>";
} else if (data == 4) {
return "<span class='pausebox statusbox'>已暂停</span>";
} else if (data == 5) {
return "<span class='deletebox statusbox'>删除中</span>";
} else if (data == 6) {
return "<span class='deletebox statusbox'>已删除</span>";
} else if (data == 7) {
return "<span class='pausebox statusbox'>启动中</span>";
} else if (data == 0) {
return "<span class='nomoralbox statusbox'>未部署</span>";
} else {
// return "<span class='errorbox statusbox'>异常</span>";
return "<span class='nomoralbox statusbox'>部署中</span>";
}
},
editTask(data) {
// let data = this.taskData;
this.$api.task.editTask(data, data.task_id).then((res) => {
this.$emit("refresh");
});
},
editsubTask() {
let status = true;
let subData = [];
this.tableData.map((e) => {
let vchan = e;
let data = {
is_dome: false,
subtask_name: vchan.name,
vchan: {
vchan_refid: vchan.refid || vchan.vchan_refid,
vchan_duid: vchan.duid || vchan.vchan_duid,
vdev_unid: this.dev_unid,
vchan_name: vchan.name,
},
assign_to: {
id: this.taskData.plate_type,
flag: 1,
},
};
subData.push(data);
});
console.log(subData);
this.$api.task
.addSubtaskList(this.editData.task_id, subData)
.then((res) => {
if (res && !res.ecode && res.length > 0) {
this.$message({
message: "添加成功",
type: "success",
});
this.setvisible = false;
let subname = "";
res.map((ele) => {
subname += ele.subtaskName + ";";
});
let taskname = this.taskData.task_name;
this.$logs.oplogs(
res,
"serv_task",
`${taskname}添加视频源${subname}`
);
this.$emit("refresh");
} else {
if (res.length == 0) {
this.setvisible = false; //未添加新任务
} else {
this.$message.error(res.enote);
}
}
});
},
delFun(index, data, action = "tree") {
if (data.enableStatus == 5) {
return;
}
this.$store.commit("setocxstate", 0);
this.$confirm("删除视频源, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
if (!data.subtask_id) {
this.tableData.forEach((ele, i) => {
if (ele.vchan_refid == data.refid || ele.refid == data.refid) {
this.tableData.splice(i, 1);
this.checkvckan();
}
});
return;
}
this.$api.task
.deleteSubTask(this.editData.task_id, data.subtask_id)
.then((res) => {
if (res.ecode == "200") {
this.$message({
type: "success",
message: "删除成功!",
});
this.tableData.splice(index, 1);
this.checkvckan();
this.$store.commit("setocxstate", 1);
} else {
this.$message({
type: "error",
message: res.enote,
});
}
let taskname = this.taskData.task_name;
this.$logs.oplogs(
res,
"serv_task",
`${taskname}删除视频源${data.name}`
);
});
if (action != "tree") {
setTimeout(() => {
this.checkvckan();
}, 0);
}
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
this.checkvckan();
this.$store.commit("setocxstate", 1);
});
},
append(data) {
const newChild = { id: id++, label: "testtest", children: [] };
if (!data.children) {
this.$set(data, "children", []);
}
data.children.push(newChild);
},
checkvckan() {
// this.$refs.tree.setCheckedKeys([]);
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
zTree.checkAllNodes(false);
this.tableData.forEach((ele) => {
// var id = zTree.getNodeByTId(ele.refid);
var nodes = zTree.getNodesByFilter(function (node) {
return node.refid == ele.vchan_refid;
}, true);
if (nodes) {
nodes.checktype = true;
zTree.checkNode(nodes, true, false, function () {});
}
});
},
serchVchan(){
if(this.searchText == '') {
var zNodes = [
{
name: "外部设备",
id: "0",
count: 500,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
{
name: "内部设备",
id: "1",
count: 1000,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
{
name: "短视频",
id: "2",
count: 2000,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
]
var ztree = $.fn.zTree.init($("#treeDemo"), this.setting, zNodes);
return
}
this.$api.device.getDevtreeLike(this.dev_unid,'外部设备',{vchan_name_like:this.searchText }).then(res => {
this.$api.device.getDevtreeLike(this.dev_unid,'内部设备',{vchan_name_like:this.searchText }).then(camerares => {
this.$api.device.getDevtreeLike(this.dev_unid,'短视频',{vchan_name_like:this.searchText }).then(vchanres => {
setTimeout(() => {
this.zNodes[0].childs = res.vchan_struct
this.zNodes[1].childs = camerares.vchan_struct
this.zNodes[2].childs = vchanres.list_data
var ztree = $.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes);
ztree.expandAll(true)
this.checkvckan()
}, 10);
})
})
})
},
rowclick(row) {
//播放视频
// this.vchanClick(row);
// console.log("row", row);
// this.play_url = {
// rtsp_url: row.play_url
// };
// setTimeout(() => {
// this.$refs.video.videoPlay();
// }, 100);
},
getData() {
let tdata = require("../../assets/js/vchan_struct.json");
this.nodes = [];
},
beforeClick(treeId, treeNode, clickFlag) {
let status = true;
if (!treeNode.refid && !treeNode.vchan_refid) {
status = false;
}
return status;
},
vchanClick(event, treeId, node) {
try {
window.clearTimeout(this.timeout1);
window.clearTimeout(this.timeout2);
} catch (err) {
console.log(err);
}
// var e = e || window.event;
this.play_url = "";
// if (this.testIe.isIe) {
try {
let video_ocx = document.getElementById("VionVideo");
let stopRes = video_ocx.StopPlaySip(0);
let stopRtspRes = video_ocx.StopPlay(0);
console.log("视频新建任务,停止sip播放返回值:", stopRes);
console.log("视频新建任务,停止rtsp播放返回值:", stopRtspRes);
} catch (err) {
console.log("视频新建任务,停止异常:", err.message);
}
// 判断播放sip or rtsp
if (node.vchan_type === "camera" || node.vchan_type === "vfile") {
if (node.video_url) {
if (node.vchan_type === "vfile") {
this.play_url = {
rtsp_url: node.video_url,
};
} else {
this.play_url = {
rtsp_url: node.video_url,
};
}
console.log("playURL:", JSON.stringify(this.play_url));
setTimeout(() => {
this.$refs.video.videoPlay();
}, 0);
} else {
alert("播放地址不存在!");
}
} else {
this.getSipSetting(node.refid);
}
// } else {
// this.getSendingCount = 1;
// this.isNeedRewriteIsSending = true;
// this.currentVchan = node.refid || node.vchan_refid;
// }
},
getSipSetting: function (refid) {
if (this.dev_unid) {
this.$api.device.sipSet(this.dev_unid, this.user_unid).then((res) => {
if (!res.ecode) {
console.log("获取sip配置返回:", JSON.stringify(res));
this.play_url = res;
this.play_url.devId = refid;
console.log("playUrl", JSON.stringify(res));
for (let attr of Object.keys(this.play_url)) {
if (this.play_url[attr] === "") {
setTimeout(() => {
this.$message({
message: "获取播放地址失败,请前往配置sip服务!!请重试!",
type: "error",
});
}, 0);
return;
}
}
setTimeout(() => {
this.$refs.video.videoPlay();
}, 100);
} else {
this.$message({
message: "获取播放地址失败,请前往配置sip服务!!请重试!",
type: "error",
});
}
});
} else {
console.log("运维ID获取失败");
this.$message({
type: "warning",
message: "运维ID获取失败",
});
}
},
remove(node, data) {
const parent = node.parent;
const children = parent.data.children || parent.data;
const index = children.findIndex((d) => d.id === data.id);
children.splice(index, 1);
},
handleClose() {
let video_ocx = document.getElementById("VionVideo");
try {
let stopRes = video_ocx.StopPlaySip(0);
let stopRtspRes = video_ocx.StopPlay(0);
this.setvisible = false;
this.$store.commit("setocxstate", 0);
} catch (error) {
this.setvisible = false;
console.log(error);
}
},
save() {
this.setvisible = false;
this.$emit("refresh");
},
moveFun(index, row) {
this.$refs.movetask.initMoveTask(row, this.taskData);
},
},
created() {
this.user_unid = window.sessionStorage.getItem("user_unid");
// this.getData();
},
};
</script>
<style scoped="scoped" lang="scss">
.bofangIcon {
cursor: pointer;
color: #cccccc;
font-size: 16px;
margin-left: 26px;
}
.moveIcon {
cursor: pointer;
color: #34b3a2;
font-size: 16px;
}
.delIcon {
cursor: pointer;
color: #f2365a;
font-size: 16px;
}
.leftBox {
width: 233px;
height: 630px;
border: 1px solid rgba(229, 229, 229, 1);
float: left;
overflow: auto;
}
.titles {
height: 30px;
line-height: 30px;
padding-left: 13px;
background: $title-backgroud;
font-size: 14px;
color: $title-color;
}
.treeBox {
padding: 6px;
width: 1000px;
// overflow: auto;
}
.empty {
height: 30px;
width: 97%;
border-radius: 0;
border: 1px solid #ccc;
margin: 2px;
}
.rightBox {
float: left;
width: 599px;
overflow: hidden;
}
.imgBox {
width: 587px;
height: 330px;
border: 1px solid #444444;
margin-bottom: 14px;
}
.search-input {
width: 90%;
margin: 10px 5%;
}
</style>
......@@ -17,12 +17,11 @@
placeholder="请输入内容"
v-model="searchText"
>
<el-button slot="append" icon="el-icon-search" @click="serchVchan"></el-button>
</el-input>
<div class=""></div>
</el-input>
<div class="">
</div>
<div class="treeBox">
<!-- <el-tree
<el-tree
:props="props"
:load="loadNode"
lazy
......@@ -33,17 +32,7 @@
@check="handleCheckChange"
:filter-node-method="filterNode"
:render-content="renderContent"
></el-tree> -->
<!-- <tree
:setting="treesetting"
:nodes="nodes"
@onClick="onClick"
@onCheck="onCheck"
@onCreated="handleCreated"
@onExpand="onExpand"
@onAsyncSuccess="onAsyncSuccess"
/> -->
<div id="treeDemo" class="ztree"></div>
></el-tree>
</div>
</div>
<div class="rightBox">
......@@ -90,11 +79,7 @@
:visible-arrow="false"
>
<span
:class="{
'el-icon-delete': true,
delIcon: true,
nodel: scope.row.enableStatus == 5 ? true : false,
}"
:class="{'el-icon-delete':true, 'delIcon':true,'nodel': scope.row.enableStatus == 5?true:false}"
@click="delFun(scope.$index, scope.row)"
></span>
</el-tooltip>
......@@ -103,7 +88,7 @@
</el-table>
</div>
</div>
<div style="clear: both"></div>
<div style="clear: both;"></div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
......@@ -115,250 +100,70 @@
<script>
import videoplay from "../public/videoPlay";
import moveTask from "./moveSubTask";
var jsond = require("./treedata.json")
export default {
data() {
return {
setting: {
async: {
enable: true,
type: "get",
dataFilter: this.filterNode,
url: this.getUrl,
otherParam: ["offset", "0", "limit", ""],
},
check: {
enable: true,
},
data: {
key: {
children: "childs",
id: "vchan_refid",
},
simpleData: {
enable: true,
},
},
view: {
expandSpeed: "",
showIcon: false,
},
callback: {
// beforeExpand: beforeExpand,
onClick: this.vchanClick,
beforeClick: this.beforeClick,
onAsyncSuccess: this.onAsyncSuccess,
onCheck: this.checkNode,
onExpand: this.onExpand,
beforeCheck: this.beforeCheck,
// onAsyncError: onAsyncError
},
},
tableData: [],
zNodes: [
{
name: "外部设备",
id: "0",
count: 500,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
{
name: "内部设备",
id: "1",
count: 1000,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
{
name: "短视频",
id: "2",
count: 2000,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
],
nodes: [
{
dev_unid: this.dev_unid,
id: 0,
refid: "",
name: "外部设备",
leaf: false,
disabled: true,
isParent: true,
children: [],
},
{
dev_unid: this.dev_unid,
refid: "",
id: 1,
name: "内部设备",
leaf: false,
isParent: true,
disabled: true,
children: [],
},
{
dev_unid: this.dev_unid,
refid: "",
id: 2,
name: "短视频",
leaf: false,
isParent: true,
disabled: true,
children: [],
},
],
play_url: "",
user_unid: "",
formData: {},
editData: {},
taskData: {},
moveTaskData: [],
searchText: "",
searchText:"",
setvisible: false,
props: {
id: "vchan_refid",
label: "name",
children: "zones",
disabled: "disabled",
isLeaf: "leaf",
isLeaf: "leaf"
},
sessionData: {},
data: [],
defaultProps: {
children: "children",
label: "label",
id: "vchan_refid",
},
id: "vchan_refid"
}
};
},
props: {
pedittype: {
type: String,
default: "add",
},
default: "add"
}
},
watch: {
parentData(val) {
// this.sessionData = JSON.parse(JSON.stringify(val));
// this.editData = val;
},
searchText(val) {
},
searchText(val){
this.$refs.tree.filter(val);
}
},
components: {
videoplay,
moveTask,
moveTask
},
mounted() {
console.log(this.setvisible);
},
mounted() {},
methods: {
beforeCheck(treeId, treeNode) {
if (treeNode.refid || treeNode.vchan_refid) {
let staus = false;
if (this.tableData.length > 0) {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].vchan_refid == treeNode.vchan_refid || this.tableData[i].vchan_refid == treeNode.refid ) {
staus = true;
break;
}
}
}
if (!staus) {
if(treeNode.oldname) {
treeNode.name = treeNode.oldname
}
// this.editsubTask(data);
this.tableData.push(treeNode);
staus = false;
}
} else {
return false;
}
},
checkNode(event, treeId, treeNode) {
//勾选节点
if (!treeNode.checked) {
if (this.tableData.length > 0) {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].vchan_refid == treeNode.refid || this.tableData[i].refid == treeNode.refid) {
this.delFun(i, this.tableData[i], "tree");
break;
}
}
}
}
},
getUrl(treeId, treeNode) {
if (treeNode.level === 0) {
// http请求
let params = {
offset: 0,
limit: "",
};
return this.$api.device.getDevtree(
this.dev_unid,
treeNode.name,
params
);
}
},
onAsyncSuccess(event, treeId, treeNode, msg) {
// this.checkvckan()
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
let arr = [];
setTimeout(() => {
this.tableData.forEach((ele) => {
var id = zTree.getNodeByTId(ele.vchan_refid);
if (id) {
id.chkDisabled = true;
zTree.checkNode(id, true, false, function () {});
}
});
}, 1000);
// zTree.checkNode();
},
onExpand(ev, treeid, treenode) {
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
this.tableData.forEach((ele) => {
// var id = zTree.getNodeByTId(ele.refid);
var nodes = zTree.getNodesByFilter(function (node) {
return node.refid == ele.vchan_refid;
}, true);
if (nodes) {
nodes.checktype = true;
zTree.checkNode(nodes, true, false, function () {});
}
});
},
filterNode(treeId, parentNode, childNodes) {
var treenode = null;
if (!childNodes) return null;
if (parentNode.name === "短视频") {
var nodes = [];
childNodes.list_data.map((ele) => {
nodes.push(ele);
});
treenode = nodes;
} else if (parentNode.name === "内部设备") {
let vchans = childNodes.vchan_struct || childNodes.list_data;
treenode = vchans
} else {
treenode = childNodes.vchan_struct;
}
return treenode;
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
showModal(val) {
this.taskData = val;
this.tableData = [];
this.setvisible = true;
this.$store.commit("setocxstate", 1);
this.editData = val;
this.$api.task.getSubTask(val.task_id).then((res) => {
this.$api.task.getSubTask(val.task_id).then(res => {
let ary = [];
let data = res.list_data;
for (let i in data) {
......@@ -378,7 +183,7 @@ export default {
name: data[i].subtask_name,
running_status: data[i].running_status,
play_url: data[i].rtsp_url,
enableStatus: data[i].enableStatus,
enableStatus: data[i].enableStatus
};
}
ary.push(data[i].vchan);
......@@ -386,12 +191,6 @@ export default {
this.tableData = ary;
this.checkvckan();
});
var _this = this;
var ztree = null;
setTimeout(() => {
ztree = $.fn.zTree.init($("#treeDemo"), _this.setting, _this.zNodes);
// fuzzySearch("treeDemo", "#key", null, true); //初始化模糊搜索方法
}, 10);
},
statusFormatter(row) {
let data = row.enableStatus;
......@@ -416,16 +215,34 @@ export default {
return "<span class='nomoralbox statusbox'>部署中</span>";
}
},
handleCheckChange(data, node) {
console.log(data);
let staus = false;
if (this.tableData.length > 0) {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].vchan_refid == data.vchan_refid) {
this.delFun(i, this.tableData[i], "tree");
staus = true;
break;
}
}
}
if (data.leaf && !staus) {
// this.editsubTask(data);
this.tableData.push(data);
staus = false;
}
},
editTask(data) {
// let data = this.taskData;
this.$api.task.editTask(data, data.task_id).then((res) => {
this.$api.task.editTask(data, data.task_id).then(res => {
this.$emit("refresh");
});
},
editsubTask() {
let status = true;
let subData = [];
this.tableData.map((e) => {
this.tableData.map(e => {
let vchan = e;
let data = {
is_dome: false,
......@@ -434,35 +251,31 @@ export default {
vchan_refid: vchan.refid || vchan.vchan_refid,
vchan_duid: vchan.duid || vchan.vchan_duid,
vdev_unid: this.dev_unid,
vchan_name: vchan.name,
vchan_name: vchan.name
},
assign_to: {
id: this.taskData.plate_type,
flag: 1,
},
flag: 1
}
};
subData.push(data);
});
console.log(subData);
this.$api.task
.addSubtaskList(this.editData.task_id, subData)
.then((res) => {
.then(res => {
if (res && !res.ecode && res.length > 0) {
this.$message({
message: "添加成功",
type: "success",
type: "success"
});
this.setvisible = false;
let subname = "";
res.map((ele) => {
subname += ele.subtaskName + ";";
let subname ="";
res.map(ele => {
subname += ele.subtaskName+";"
});
let taskname = this.taskData.task_name;
this.$logs.oplogs(
res,
"serv_task",
`${taskname}添加视频源${subname}`
);
let taskname = this.taskData.task_name;
this.$logs.oplogs(res,'serv_task',`${taskname}添加视频源${subname}`);
this.$emit("refresh");
} else {
if (res.length == 0) {
......@@ -471,8 +284,12 @@ export default {
this.$message.error(res.enote);
}
}
});
},
playVideo(data) {
console.log("b", data);
},
delFun(index, data, action = "tree") {
if (data.enableStatus == 5) {
return;
......@@ -481,12 +298,12 @@ export default {
this.$confirm("删除视频源, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
type: "warning"
})
.then(() => {
if (!data.subtask_id) {
this.tableData.forEach((ele, i) => {
if (ele.vchan_refid == data.refid || ele.refid == data.refid) {
if (ele.vchan_refid == data.vchan_refid) {
this.tableData.splice(i, 1);
this.checkvckan();
}
......@@ -495,11 +312,11 @@ export default {
}
this.$api.task
.deleteSubTask(this.editData.task_id, data.subtask_id)
.then((res) => {
.then(res => {
if (res.ecode == "200") {
this.$message({
type: "success",
message: "删除成功!",
message: "删除成功!"
});
this.tableData.splice(index, 1);
this.checkvckan();
......@@ -507,15 +324,13 @@ export default {
} else {
this.$message({
type: "error",
message: res.enote,
message: res.enote
});
}
let taskname = this.taskData.task_name;
this.$logs.oplogs(
res,
"serv_task",
`${taskname}删除视频源${data.name}`
);
let taskname = this.taskData.task_name;
debugger
console.log(data)
this.$logs.oplogs(res,'serv_task',`${taskname}删除视频源${data.vchan_name}`);
});
if (action != "tree") {
setTimeout(() => {
......@@ -526,7 +341,7 @@ export default {
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
message: "已取消删除"
});
this.checkvckan();
this.$store.commit("setocxstate", 1);
......@@ -541,67 +356,13 @@ export default {
},
checkvckan() {
// this.$refs.tree.setCheckedKeys([]);
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
zTree.checkAllNodes(false);
this.tableData.forEach((ele) => {
// var id = zTree.getNodeByTId(ele.refid);
var nodes = zTree.getNodesByFilter(function (node) {
return node.refid == ele.vchan_refid;
}, true);
if (nodes) {
nodes.checktype = true;
zTree.checkNode(nodes, true, false, function () {});
}
this.$refs.tree.setCheckedKeys([]);
let arr = [];
this.tableData.forEach(ele => {
arr.push(ele.vchan_refid);
});
},
serchVchan(){
if(this.searchText == '') {
var zNodes = [
{
name: "外部设备",
id: "0",
count: 500,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
{
name: "内部设备",
id: "1",
count: 1000,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
{
name: "短视频",
id: "2",
count: 2000,
times: 1,
isParent: true,
dev_unid: this.dev_unid,
},
]
var ztree = $.fn.zTree.init($("#treeDemo"), this.setting, zNodes);
return
}
this.$api.device.getDevtreeLike(this.dev_unid,'外部设备',{vchan_name_like:this.searchText }).then(res => {
this.$api.device.getDevtreeLike(this.dev_unid,'内部设备',{vchan_name_like:this.searchText }).then(camerares => {
this.$api.device.getDevtreeLike(this.dev_unid,'短视频',{vchan_name_like:this.searchText }).then(vchanres => {
setTimeout(() => {
this.zNodes[0].childs = res.vchan_struct
this.zNodes[1].childs = camerares.vchan_struct
this.zNodes[2].childs = vchanres.list_data
var ztree = $.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes);
ztree.expandAll(true)
this.checkvckan()
}, 10);
})
})
})
console.log(arr);
this.$refs.tree.setCheckedKeys(arr);
},
rowclick(row) {
//播放视频
......@@ -614,18 +375,110 @@ export default {
// this.$refs.video.videoPlay();
// }, 100);
},
getData() {
let tdata = require("../../assets/js/vchan_struct.json");
this.nodes = [];
},
beforeClick(treeId, treeNode, clickFlag) {
let status = true;
if (!treeNode.refid && !treeNode.vchan_refid) {
status = false;
loadNode(node, resolve) {
if (node.level === 0) {
return resolve([
{
dev_unid: this.dev_unid,
refid: "",
name: "外部设备",
leaf: false,
disabled: true
},
{
dev_unid: this.dev_unid,
refid: "",
name: "内部设备",
leaf: false,
disabled: true
},
{
dev_unid: this.dev_unid,
refid: "",
name: "短视频",
leaf: false,
disabled: true
}
]);
}
return status;
if (node.level === 1) {
// http请求
let params = {
offset: 0,
limit: ""
};
this.$api.device
.getDevtree(this.dev_unid, node.data.name, params)
.then(data => {
// let node = require('../../assets/js/vchan_struct')
let vchans = data.vchan_struct || data.list_data;
for (let i in vchans) {
const vchan = vchans[i];
vchan.leaf =
vchan.typea == 1 ||
vchan.vchan_type == "camera" ||
Boolean(vchan.vchan_refid);
vchan.disabled = !vchan.leaf;
vchan.name =
vchan.name || vchan.org_name || vchan.vchan_name || "未命名";
vchan.leafNode = vchan.typea
? "extern"
: vchan.vchan_type === "vfile"
? "vfile"
: "camera";
if (vchan.leaf) {
vchan.childs = "";
}
vchan.vchan_refid = vchan.refid || vchan.vchan_refid;
}
resolve(vchans);
this.checkvckan();
});
return;
}
for (let i in node.data.childs) {
const element = node.data.childs[i];
// console.log(element.childs)
// element.leaf = (element.typea == 1&&element.childs&&element.childs.length < 1)|| element.vchan_type == "camera" ;
element.leaf = element.typea == 1 || element.vchan_type == "camera" ;
element.disabled = !element.leaf;
element.name =
element.name || element.org_name || element.vchan_name || "未命名";
element.leafNode = element.typea
? "extern"
: element.vchan_type === "vfile"
? "vfile"
: "camera";
}
if (!node.data.childs.length) {
this.$message({
type: "info",
message: "该组织下没有像机"
});
}
setTimeout(() => {
this.checkvckan();
}, 10);
return resolve(node.data.childs);
},
renderContent(h, { node, data, store }) {
return (
<span class="custom-tree-node">
<el-tooltip
popper-class="tasktip"
effect="dark"
content={node.label}
placement="top-start"
>
<span>{node.label}</span>
</el-tooltip>
</span>
);
},
vchanClick(event, treeId, node) {
vchanClick(node) {
if (!node.refid && !node.vchan_refid) {
return;
}
try {
window.clearTimeout(this.timeout1);
window.clearTimeout(this.timeout2);
......@@ -645,16 +498,16 @@ export default {
console.log("视频新建任务,停止异常:", err.message);
}
// 判断播放sip or rtsp
if (node.vchan_type === "camera" || node.vchan_type === "vfile") {
if (node.leafNode === "camera" || node.leafNode === "vfile") {
if (node.video_url) {
if (node.vchan_type === "vfile") {
if (node.leafNode === "vfile") {
debugger;
this.play_url = {
rtsp_url: node.URL,
rtsp_url: node.video_url
};
} else {
this.play_url = {
rtsp_url: node.video_url,
rtsp_url: node.video_url
};
}
......@@ -675,9 +528,9 @@ export default {
// }
},
getSipSetting: function (refid) {
getSipSetting: function(refid) {
if (this.dev_unid) {
this.$api.device.sipSet(this.dev_unid, this.user_unid).then((res) => {
this.$api.device.sipSet(this.dev_unid, this.user_unid).then(res => {
if (!res.ecode) {
console.log("获取sip配置返回:", JSON.stringify(res));
this.play_url = res;
......@@ -688,7 +541,7 @@ export default {
setTimeout(() => {
this.$message({
message: "获取播放地址失败,请前往配置sip服务!!请重试!",
type: "error",
type: "error"
});
}, 0);
return;
......@@ -700,7 +553,7 @@ export default {
} else {
this.$message({
message: "获取播放地址失败,请前往配置sip服务!!请重试!",
type: "error",
type: "error"
});
}
});
......@@ -708,16 +561,19 @@ export default {
console.log("运维ID获取失败");
this.$message({
type: "warning",
message: "运维ID获取失败",
message: "运维ID获取失败"
});
}
},
remove(node, data) {
const parent = node.parent;
const children = parent.data.children || parent.data;
const index = children.findIndex((d) => d.id === data.id);
const index = children.findIndex(d => d.id === data.id);
children.splice(index, 1);
},
handleNodeClick(data) {
console.log(data);
},
handleClose() {
let video_ocx = document.getElementById("VionVideo");
try {
......@@ -725,6 +581,7 @@ export default {
let stopRtspRes = video_ocx.StopPlay(0);
this.setvisible = false;
this.$store.commit("setocxstate", 0);
this.$refs.tree.setCheckedKeys([]);
} catch (error) {
this.setvisible = false;
console.log(error);
......@@ -736,12 +593,11 @@ export default {
},
moveFun(index, row) {
this.$refs.movetask.initMoveTask(row, this.taskData);
},
}
},
created() {
this.user_unid = window.sessionStorage.getItem("user_unid");
// this.getData();
},
}
};
</script>
......@@ -779,16 +635,9 @@ export default {
}
.treeBox {
padding: 6px;
width: 1000px;
width:1000px
// overflow: auto;
}
.empty {
height: 30px;
width: 97%;
border-radius: 0;
border: 1px solid #ccc;
margin: 2px;
}
.rightBox {
float: left;
width: 599px;
......@@ -800,7 +649,7 @@ export default {
border: 1px solid #444444;
margin-bottom: 14px;
}
.search-input {
.search-input{
width: 90%;
margin: 10px 5%;
}
......
......@@ -253,23 +253,39 @@
@refresh="getTaskList"
></editset>
<editvideo
v-if="!isbigtree"
ref="editvideo"
:parentData="curtask"
:pedittype="pedittype"
@refresh="getTaskList"
></editvideo>
<editVidebigree
v-if="isbigtree"
ref="editvideo"
:parentData="curtask"
:pedittype="pedittype"
@refresh="getTaskList"
></editVidebigree>
</div>
</div>
</template>
<script>
import editset from "./editSet";
import editvideo from "./editVideo";
import editVidebigree from "./editVidebigree";
import subTaskInfo from "./subtask.vue";
import mixin from "../../assets/js/mixin";
export default {
components: {
editset,
editvideo,
editVidebigree,
subTaskInfo
},
mixins: [mixin],
data() {
return {
isbigtree:window.config.bigtree,
task_name: "",
curtask: "",
task_algo_type: "",
......@@ -288,11 +304,6 @@ export default {
curscrollTop: 0
};
},
components: {
editset,
editvideo,
subTaskInfo
},
methods: {
expandchange(row, prow) {
......
No preview for this file type
......@@ -5,6 +5,7 @@ const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
module.exports = {
productionSourceMap: false,
lintOnSave: false,
publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
// ...
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!