Commit 226e2835 by 潘建波

feat 设备树搜索改为服务端搜索

1 parent 765d3273
This file is too large to display.
No preview for this file type
No preview for this file type
<<<<<<< HEAD
{"commit":"bacfed303de17d1adb667265fe3aa2967acf6950","commitDate":"2020-12-24 10:40","buildDate":"2020-12-29 15:46","version":"2.0.9","info":"提交合并后版本"}
=======
{"commit":"cc5f1ada409915cb24fb8ea80b9e70df5019074d","commitDate":"2021-2-20 13:59","buildDate":"2021-2-20 14:1","version":"2.0.9","info":"修改任务设置树形结构"}
>>>>>>> 589f9512265f8154bb08c340fd94dbb43af77e09
{"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
......@@ -28,6 +28,21 @@ export default {
}
return `${baseUrl}/api/v1/devconf_fx/devs/${devuid}${url}`
},
getDevtreeLike(devuid, devname, params){
let url = "";
switch (devname) {
case "外部设备":
url = "/vchan_struct?vchan_type=extern";
break;
case "内部设备":
url = "/vchan_struct?vchan_type=camera";
break;
case "短视频":
url = "/vchans?vchan_type=vfile";
break;
}
return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${devuid}${url}`, params)
},
getFxStream(devuid, refid) {
return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${devuid}/vchans/${refid}`); //获取分析流
},
......
......@@ -11,20 +11,15 @@
<div>
<!-- 外层内容 -->
<div class="leftBox">
<!-- <el-input
<el-input
class="search-input"
prefix-icon="el-icon-search"
placeholder="请输入内容"
v-model="searchText"
>
</el-input> -->
<input
type="text"
id="key"
value=""
class="empty"
placeholder="请输入关键字"
/>
<el-button slot="append" icon="el-icon-search" @click="serchVchan"></el-button>
</el-input>
<div class=""></div>
<div class="treeBox">
<!-- <el-tree
......@@ -253,7 +248,7 @@ export default {
// this.editData = val;
},
searchText(val) {
this.$refs.tree.filter(val);
},
},
components: {
......@@ -267,13 +262,16 @@ export default {
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) {
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;
......@@ -287,7 +285,7 @@ export default {
if (!treeNode.checked) {
if (this.tableData.length > 0) {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].vchan_refid == treeNode.vchan_refid) {
if (this.tableData[i].vchan_refid == treeNode.refid || this.tableData[i].refid == treeNode.refid) {
this.delFun(i, this.tableData[i], "tree");
break;
}
......@@ -329,9 +327,8 @@ export default {
this.tableData.forEach((ele) => {
// var id = zTree.getNodeByTId(ele.refid);
var nodes = zTree.getNodesByFilter(function (node) {
return node.vchan_refid == ele.vchan_refid;
return node.refid == ele.vchan_refid;
}, true);
debugger;
if (nodes) {
nodes.checktype = true;
zTree.checkNode(nodes, true, false, function () {});
......@@ -344,28 +341,17 @@ export default {
if (parentNode.name === "短视频") {
var nodes = [];
childNodes.list_data.map((ele) => {
ele.name = ele.vchan_name;
nodes.push(ele);
});
treenode = nodes;
} else if (parentNode.name === "内部设备") {
let vchans = childNodes.vchan_struct || childNodes.list_data;
treenode = this.buildvchantree(vchans);
treenode = vchans
} else {
treenode = childNodes.vchan_struct;
}
return treenode;
},
buildvchantree(datas) {
for (let i in datas) {
datas[i].name =
datas[i].name || datas[i].org_name || datas[i].vchan_name || "未命名";
if (datas[i].childs) {
datas[i].childs = this.buildvchantree(datas[i].childs);
}
}
return datas;
},
showModal(val) {
this.taskData = val;
this.tableData = [];
......@@ -404,7 +390,7 @@ export default {
var ztree = null;
setTimeout(() => {
ztree = $.fn.zTree.init($("#treeDemo"), _this.setting, _this.zNodes);
fuzzySearch("treeDemo", "#key", null, true); //初始化模糊搜索方法
// fuzzySearch("treeDemo", "#key", null, true); //初始化模糊搜索方法
}, 10);
},
statusFormatter(row) {
......@@ -430,23 +416,6 @@ export default {
return "<span class='nomoralbox statusbox'>部署中</span>";
}
},
handleCheckChange(data, node) {
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) => {
......@@ -517,7 +486,7 @@ export default {
.then(() => {
if (!data.subtask_id) {
this.tableData.forEach((ele, i) => {
if (ele.vchan_refid == data.vchan_refid) {
if (ele.vchan_refid == data.refid || ele.refid == data.refid) {
this.tableData.splice(i, 1);
this.checkvckan();
}
......@@ -545,7 +514,7 @@ export default {
this.$logs.oplogs(
res,
"serv_task",
`${taskname}删除视频源${data.vchan_name}`
`${taskname}删除视频源${data.name}`
);
});
if (action != "tree") {
......@@ -578,7 +547,7 @@ export default {
this.tableData.forEach((ele) => {
// var id = zTree.getNodeByTId(ele.refid);
var nodes = zTree.getNodesByFilter(function (node) {
return node.vchan_refid == ele.vchan_refid;
return node.refid == ele.vchan_refid;
}, true);
if (nodes) {
nodes.checktype = true;
......@@ -586,6 +555,54 @@ export default {
}
});
},
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);
......@@ -628,13 +645,12 @@ export default {
console.log("视频新建任务,停止异常:", err.message);
}
// 判断播放sip or rtsp
debugger;
if (node.vchan_type === "camera" || node.vchan_type === "vfile") {
if (node.video_url) {
if (node.vchan_type === "vfile") {
debugger;
this.play_url = {
rtsp_url: node.video_url,
rtsp_url: node.URL,
};
} else {
this.play_url = {
......@@ -709,7 +725,6 @@ 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);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!