Commit 4aaf34ab by 潘建波

提交修改BUG和任务下发

1 parent b2e5589f
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
font-size: 16px; font-size: 16px;
} }
#login .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item{ #login .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item{
margin-bottom: 28px!important; /* margin-bottom: 28px!important; */
} }
.el-main{ .el-main{
padding: 0; padding: 0;
......
...@@ -83,9 +83,9 @@ export default { ...@@ -83,9 +83,9 @@ export default {
}, },
beforeDestroy: function () { beforeDestroy: function () {
if (this.videoplayer.techName_ == "Flash" && this.videoplayer.pause) { // if (this.videoplayer.techName_ == "Flash" && this.videoplayer.pause) {
this.videoplayer.pause(); // this.videoplayer.pause();
} // }
} }
}; };
......
<template>
<div class="expande-table-row">
<span class="label">视频源文件</span>
<span class="subtask-info">{{ subTaskData.vchan_name }}</span>
<span class="label">设备地址</span>
<span class="subtask-info">192.178.99.99</span>
<span class="label">已用资源</span>
<span class="subtask-info">22</span>
<span class="label">设备容量</span>
<span class="subtask-info">33</span>
<span class="label">指定设备下发</span>
<span class="subtask-info">
<el-select v-model="assign_id">
<el-option
v-for="(item, index) in freeList"
:key="index"
:value="item.device_id"
>
{{ item.in_ip }}
</el-option>
</el-select>
</span>
<span class="label sub-btn" @click="subMove">确定</span>
</div>
</template>
<script>
export default {
data() {
return {
assign_id: ""
};
},
props: ["subTaskData", "freeList", "taskData"],
methods: {
subMove() {
let taskID = this.taskData.task_id;
let subTaksID = this.subTaskData.subtask_id;
this.$api.task.getTaskParams(taskID, subTaksID).then(res => {
let obj = {};
obj.mtasks = res.mtasks;
obj.assign_to = {
id: this.assign_id,
flag: 0
};
this.subRoi(taskID, subTaksID, obj);
});
},
subRoi(taskid, subtaskid, postObj) {
this.$api.task
.editRoi(taskid, subtaskid, postObj, {
headers: {
authorization: localStorage.getItem("atoken")
}
})
.then(m => {
if (m.ecode == "200") {
this.$message({
message: "设置成功!",
type: "success"
});
}
});
}
},
created() {},
watch: {
subTaskData(val) {
console.log(val);
}
},
mounted() {
this.assign_id = this.subTaskData.assign_id
? this.subTaskData.assign_id
: "";
}
};
</script>
<style lang="scss" scoped>
.expande-table-row {
span {
float: left;
border-bottom: 1px solid #ccc;
overflow: hidden;
}
.label {
width: 6vw;
text-align: center;
border-left: 1px solid $border-color;
background: #f0f0f0;
height: 40px;
line-height: 40px;
}
.subtask-info {
border-left: 1px solid #f0f0f0;
text-align: center;
overflow: hidden;
height: 40px;
line-height: 40px;
}
.subtask-info:nth-child(2) {
width: 9vw;
overflow: hidden;
}
.subtask-info:nth-child(4) {
width: 6vw;
}
.subtask-info:nth-child(6) {
width: 4.5vw;
}
.subtask-info:nth-child(8) {
width: 4vw;
}
.subtask-info:nth-child(10) {
width: 12vw;
}
.sub-btn {
cursor: pointer;
}
}
</style>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
:visible-arrow="false" :visible-arrow="false"
> >
<span <span
class="el-icon-copy-document moveIcon" class="icon-fanxing-qianyi moveIcon"
@click="moveFun(scope.$index, scope.row)" @click="moveFun(scope.$index, scope.row)"
></span> ></span>
</el-tooltip> </el-tooltip>
...@@ -115,6 +115,7 @@ export default { ...@@ -115,6 +115,7 @@ export default {
user_unid: "", user_unid: "",
formData: {}, formData: {},
editData: {}, editData: {},
taskData:{},
setvisible: false, setvisible: false,
props: { props: {
id: "vchan_refid", id: "vchan_refid",
...@@ -152,6 +153,7 @@ export default { ...@@ -152,6 +153,7 @@ export default {
}, },
methods: { methods: {
showModal(val) { showModal(val) {
this.taskData = val;
this.tableData = []; this.tableData = [];
this.setvisible = true; this.setvisible = true;
this.$store.commit("setocxstate", 1); this.$store.commit("setocxstate", 1);
...@@ -160,7 +162,6 @@ export default { ...@@ -160,7 +162,6 @@ export default {
let ary = []; let ary = [];
let data = res.list_data; let data = res.list_data;
for (let i in data) { for (let i in data) {
debugger
if (data[i].vchan) { if (data[i].vchan) {
data[i].vchan.subtask_id = data[i].subtask_id; data[i].vchan.subtask_id = data[i].subtask_id;
data[i].vchan.refid = data[i].vchan.vchan_refid; data[i].vchan.refid = data[i].vchan.vchan_refid;
...@@ -199,6 +200,12 @@ export default { ...@@ -199,6 +200,12 @@ export default {
staus = false; staus = false;
} }
}, },
editTask(data) {
// let data = this.taskData;
this.$api.task.editTask(data, data.task_id).then(res => {
this.$emit("refresh");
});
},
editsubTask(vchan) { editsubTask(vchan) {
let data = { let data = {
is_dome: false, is_dome: false,
...@@ -210,6 +217,7 @@ export default { ...@@ -210,6 +217,7 @@ export default {
vchan_name: vchan.name vchan_name: vchan.name
} }
}; };
this.$api.task.editSubTask(this.editData.task_id, data).then(res => { this.$api.task.editSubTask(this.editData.task_id, data).then(res => {
this.tableData.push(vchan); this.tableData.push(vchan);
}); });
...@@ -222,9 +230,12 @@ export default { ...@@ -222,9 +230,12 @@ export default {
.deleteSubTask(this.editData.task_id, data.subtask_id) .deleteSubTask(this.editData.task_id, data.subtask_id)
.then(res => { .then(res => {
this.tableData.splice(index, 1); this.tableData.splice(index, 1);
this.checkvckan();
}); });
if (action != "tree") { if (action != "tree") {
setTimeout(() => {
this.checkvckan(); this.checkvckan();
}, 0);
} }
}, },
append(data) { append(data) {
......
...@@ -74,33 +74,17 @@ ...@@ -74,33 +74,17 @@
ref="table" ref="table"
style="width: 100%" style="width: 100%"
@expand-change="expandchange" @expand-change="expandchange"
:expand-row-keys="rowkey"
> >
<el-table-column type="expand"> <el-table-column type="expand">
<template slot-scope="props"> <template slot-scope="props">
<div <subTaskInfo
v-for="(item, index) in props.row.subTaskData" v-for="(item, index) in props.row.subTaskData"
:key="index" :key="index"
class="expande-table-row" :subTaskData="item"
:taskData="props.row"
:freeList="freeList"
> >
<span class="label">视频源文件</span> </subTaskInfo>
<span class="subtask-info">{{item.vchan_name}}</span>
<span class="label">设备地址</span>
<span class="subtask-info">192.178.99.99</span>
<span class="label">已用资源</span>
<span class="subtask-info">22</span>
<span class="label">设备容量</span>
<span class="subtask-info">33</span>
<span class="label">指定设备下发</span>
<span class="subtask-info">
<el-select v-model="assign_ip">
<el-option v-for="(item,index) in freeList" :key="index" :value="item.in_ip">
{{item.in_ip}}
</el-option>
</el-select>
</span>
<span class="label">确定</span>
</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -255,6 +239,7 @@ ...@@ -255,6 +239,7 @@
<script> <script>
import editset from "./editSet"; import editset from "./editSet";
import editvideo from "./editVideo"; import editvideo from "./editVideo";
import subTaskInfo from "./subtask.vue";
export default { export default {
data() { data() {
return { return {
...@@ -263,22 +248,23 @@ export default { ...@@ -263,22 +248,23 @@ export default {
task_algo_type: "", task_algo_type: "",
total: 0, total: 0,
page: 1, page: 1,
freeList: [],
pageSize: 30, pageSize: 30,
setShow: false, setShow: false,
videoShow: false, videoShow: false,
editForm: {}, editForm: {},
tableData: [], tableData: [],
subTaskData: [], subTaskData: [],
freeList: [],
pedittype: "add", pedittype: "add",
currentRow: {}, currentRow: {},
rowkey: ["1"],
assign_ip: "" assign_ip: ""
}; };
}, },
components: { components: {
editset, editset,
editvideo editvideo,
subTaskInfo
}, },
mounted() { mounted() {
this.getTaskList(); this.getTaskList();
...@@ -297,12 +283,14 @@ export default { ...@@ -297,12 +283,14 @@ export default {
data[i].vchan.subtask_id = data[i].subtask_id; data[i].vchan.subtask_id = data[i].subtask_id;
data[i].vchan.refid = data[i].vchan.vchan_refid; data[i].vchan.refid = data[i].vchan.vchan_refid;
data[i].vchan.name = data[i].vchan.vchan_name; data[i].vchan.name = data[i].vchan.vchan_name;
data[i].vchan.assign_id = data[i].assign_to ?data[i].assign_to.id : "";
} else { } else {
data.vchan = { data.vchan = {
subtask_id: data[i].subtask_id, subtask_id: data[i].subtask_id,
refid: "", refid: "",
vchan_name: data[i].subtask_name, vchan_name: data[i].subtask_name,
name: data[i].subtask_name name: data[i].subtask_name,
assign_id: data[i].assign_id ? data[i].assign_to.id : ""
}; };
} }
ary.push(data[i].vchan); ary.push(data[i].vchan);
...@@ -340,6 +328,12 @@ export default { ...@@ -340,6 +328,12 @@ export default {
return "未知"; return "未知";
} }
}, },
getFreelist() {
this.$api.device.getFreelist(this.dev_unid).then(res => {
this.freeList = res.list_data;
});
// /
},
dateFormatter(row, column, cellValue, index) { dateFormatter(row, column, cellValue, index) {
let startDate = cellValue ? cellValue.split(" ")[0] : ""; let startDate = cellValue ? cellValue.split(" ")[0] : "";
let endDate = row.end_dt ? row.end_dt.split(" ")[0] : ""; let endDate = row.end_dt ? row.end_dt.split(" ")[0] : "";
...@@ -395,7 +389,7 @@ export default { ...@@ -395,7 +389,7 @@ export default {
this.tableData = []; this.tableData = [];
} else { } else {
res.list_data.forEach(item => { res.list_data.forEach(item => {
item.subTaskData = [] item.subTaskData = [];
if (item.start_dt) { if (item.start_dt) {
//先转utc格式 //先转utc格式
let date = this.$moment.utc(item.start_dt).format(); let date = this.$moment.utc(item.start_dt).format();
...@@ -418,12 +412,6 @@ export default { ...@@ -418,12 +412,6 @@ export default {
}) })
.catch(error => {}); .catch(error => {});
}, },
getFreelist() {
this.$api.device.getFreelist(this.dev_unid).then(res => {
this.freeList = res.list_data;
});
// /
},
editVideo(index, row) { editVideo(index, row) {
this.$refs.editvideo.showModal(row); this.$refs.editvideo.showModal(row);
}, },
...@@ -595,38 +583,20 @@ export default { ...@@ -595,38 +583,20 @@ export default {
color: #f2365a; color: #f2365a;
font-size: 16px; font-size: 16px;
} }
.expande-table-row {
span {
display: inline-block;
}
.label {
width: 6vw;
text-align: center;
border-left: 1px solid $border-color;
background: #f0f0f0;
}
.subtask-info {
border-left: 1px solid #f0f0f0;
text-align: center;
}
.subtask-info:nth-child(2) { .subtask-info:nth-child(2) {
width: 8vw; width: 8vw;
} }
.subtask-info:nth-child(4) { .subtask-info:nth-child(4) {
width: 6vw; width: 6vw;
} }
.subtask-info:nth-child(6) { .subtask-info:nth-child(6) {
width: 4.5vw; width: 4.5vw;
} }
.subtask-info:nth-child(8) { .subtask-info:nth-child(8) {
width: 4vw; width: 4vw;
} }
.subtask-info:nth-child(10) { .subtask-info:nth-child(10) {
width: 12vw; width: 12vw;
}
line-height: 40px;
border-bottom: 1px solid #f0f0f0;
} }
</style> </style>
<template>
<div class="expande-table-row">
<span class="label">视频源文件</span>
<span class="subtask-info">{{ subTaskData.vchan_name }}</span>
<span class="label">设备地址</span>
<span class="subtask-info">192.178.99.99</span>
<span class="label">已用资源</span>
<span class="subtask-info">22</span>
<span class="label">设备容量</span>
<span class="subtask-info">33</span>
<span class="label">指定设备下发</span>
<span class="subtask-info">
<el-select v-model="assign_id">
<el-option
v-for="(item, index) in freeList"
:key="index"
:value="item.device_id"
>
{{ item.in_ip }}
</el-option>
</el-select>
</span>
<span class="label sub-btn" @click="subMove">确定</span>
</div>
</template>
<script>
export default {
data() {
return {
assign_id: ""
};
},
props: ["subTaskData", "freeList", "taskData"],
methods: {
subMove() {
let taskID = this.taskData.task_id;
let subTaksID = this.subTaskData.subtask_id;
this.$api.task.getTaskParams(taskID, subTaksID).then(res => {
let obj = {};
obj.mtasks = res.mtasks;
obj.assign_to = {
id: this.assign_id,
flag: 0
};
this.subRoi(taskID, subTaksID, obj);
});
},
subRoi(taskid, subtaskid, postObj) {
this.$api.task
.editRoi(taskid, subtaskid, postObj, {
headers: {
authorization: localStorage.getItem("atoken")
}
})
.then(m => {
if (m.ecode == "200") {
this.$message({
message: "设置成功!",
type: "success"
});
}
});
}
},
created() {},
watch: {
},
mounted() {
this.assign_id = this.subTaskData.assign_id
? this.subTaskData.assign_id
: "";
}
};
</script>
<style lang="scss" scoped>
.expande-table-row {
span {
float: left;
border-bottom: 1px solid #ccc;
overflow: hidden;
}
.label {
width: 6vw;
text-align: center;
border-left: 1px solid $border-color;
background: #f0f0f0;
height: 40px;
line-height: 40px;
}
.subtask-info {
border-left: 1px solid #f0f0f0;
text-align: center;
overflow: hidden;
height: 40px;
line-height: 40px;
}
.subtask-info:nth-child(2) {
width: 9vw;
overflow: hidden;
}
.subtask-info:nth-child(4) {
width: 6vw;
}
.subtask-info:nth-child(6) {
width: 4.5vw;
}
.subtask-info:nth-child(8) {
width: 4vw;
}
.subtask-info:nth-child(10) {
width: 12vw;
}
.sub-btn {
cursor: pointer;
}
}
</style>
...@@ -2,12 +2,29 @@ ...@@ -2,12 +2,29 @@
<div class="alarm-event-box"> <div class="alarm-event-box">
<el-table :data="tableData" height="30vh"> <el-table :data="tableData" height="30vh">
<el-table-column type="index" align="center" label="#"></el-table-column> <el-table-column type="index" align="center" label="#"></el-table-column>
<el-table-column align="center" prop="camername" label="事件地点"></el-table-column> <el-table-column
<el-table-column align="center" prop="illname" label="抓拍类型"></el-table-column> align="center"
<el-table-column align="center" prop="illdt" label="发生时间"></el-table-column> prop="camername"
label="事件地点"
></el-table-column>
<el-table-column
align="center"
prop="illname"
label="抓拍类型"
></el-table-column>
<el-table-column
align="center"
prop="illdt"
label="发生时间"
></el-table-column>
<el-table-column align="center" prop="operation" label="操作"> <el-table-column align="center" prop="operation" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip content="查看" placement="bottom" effect="light" :visible-arrow="false"> <el-tooltip
content="查看"
placement="bottom"
effect="light"
:visible-arrow="false"
>
<img <img
src="../../assets/img/home/look.png" src="../../assets/img/home/look.png"
alt alt
...@@ -16,7 +33,12 @@ ...@@ -16,7 +33,12 @@
/> />
</el-tooltip> </el-tooltip>
<span class="tableSpanBorder"></span> <span class="tableSpanBorder"></span>
<el-tooltip content="删除" placement="bottom" effect="light" :visible-arrow="false"> <el-tooltip
content="删除"
placement="bottom"
effect="light"
:visible-arrow="false"
>
<img <img
src="../../assets/img/home/del.png" src="../../assets/img/home/del.png"
alt alt
...@@ -34,93 +56,104 @@ ...@@ -34,93 +56,104 @@
export default { export default {
data() { data() {
return { return {
tableData:[] tableData: []
} };
}, },
methods:{ methods: {
delFun(index, rows) { delFun(index, rows) {
rows.splice(index, 1); rows.splice(index, 1);
}, },
editVideo(index, rows){ editVideo(index, rows) {
this.$emit('event',rows) this.$emit("event", rows);
}, }
}, },
beforeMount(){ beforeMount() {
try {
let that = this; let that = this;
this.connect_id = new Date().getTime() this.connect_id = new Date().getTime();
// this.cws = new WebSocket('ws://'+ this.API.IP +'/websocket/v1/integrated/connects/' + this.connect_id) // this.cws = new WebSocket('ws://'+ this.API.IP +'/websocket/v1/integrated/connects/' + this.connect_id)
this.cws = new WebSocket(`ws://${this.$api.wsIP}/websocket/api/v1/datahandle/connects/${this.connect_id}`) this.cws = new WebSocket(
`ws://${this.$api.wsIP}/websocket/api/v1/datahandle/connects/${this.connect_id}`
);
this.cws.onopen = () =>{ this.cws.onopen = () => {
console.log('ws事件推送服务连接成功') console.log("ws事件推送服务连接成功");
} };
//事件断开 //事件断开
this.cws.onclose = () =>{ this.cws.onclose = () => {
window.clearTimeout(that.keepAlive) window.clearTimeout(that.keepAlive);
console.log('ws事件推送服务断开') console.log("ws事件推送服务断开");
that.connect_id = new Date().getTime() that.connect_id = new Date().getTime();
that.cws = new WebSocket(`ws://${this.$api.wsIP}/websocket/api/v1/datahandle/connects/${this.connect_id}`) that.cws = new WebSocket(
`ws://${this.$api.wsIP}/websocket/api/v1/datahandle/connects/${this.connect_id}`
);
that.keepAlive = setInterval(() => { that.keepAlive = setInterval(() => {
let message = { let message = {
type: 'request', type: "request",
id: new Date().getTime(), id: new Date().getTime(),
mts: new Date().getTime(), mts: new Date().getTime(),
command:'get /websocket/v1/recv_data/connects/' + this.connect_id +'/keep_alive' command:
} "get /websocket/v1/recv_data/connects/" +
this.cws.send(JSON.stringify(message)) this.connect_id +
"/keep_alive"
};
this.cws.send(JSON.stringify(message));
}, 20000); }, 20000);
} };
//事件推送信息 //事件推送信息
let _this = this; let _this = this;
this.cws.onmessage = (evt) =>{ this.cws.onmessage = evt => {
let data = JSON.parse(evt.data) let data = JSON.parse(evt.data);
try { try {
if(data.event_data.illegal.state == 1){ if (data.event_data.illegal.state == 1) {
let illname = _this.getCode('违法类型',data.event_data.illegal.code) || ''; let illname =
let camername = data.event_data.location.name _this.getCode("违法类型", data.event_data.illegal.code) || "";
let dt = this.showLocalTime(data.event_dt).split(' ')[1]; let camername = data.event_data.location.name;
console.log(data.pics[0].src_url) let dt = this.showLocalTime(data.event_dt).split(" ")[1];
let pics = data.pics[0].src_url console.log(data.pics[0].src_url);
let pos = data.event_data.location.pos let pics = data.pics[0].src_url;
let pos = data.event_data.location.pos;
let obj = { let obj = {
illname:illname, illname: illname,
illdt:dt, illdt: dt,
camername:camername, camername: camername,
pics:pics, pics: pics,
pos:pos pos: pos
} };
if(that.tableData.length > 40) { if (that.tableData.length > 40) {
that.tableData.pop(obj) that.tableData.pop(obj);
} else { } else {
that.tableData.unshift(obj) that.tableData.unshift(obj);
} }
that.tableData.unshift(obj) that.tableData.unshift(obj);
} else{
} }
} catch (error) { } catch (error) {
console.log(error);
}
if(data.command){
console.log('推送服务连接正常')
} else if(data.type =='response'){
console.log('请求任务推送成功')
} }
if (data.command) {
console.log("推送服务连接正常");
} else if (data.type == "response") {
console.log("请求任务推送成功");
} }
};
this.keepAlive = setInterval(() => { this.keepAlive = setInterval(() => {
let message = { let message = {
type: 'request', type: "request",
id: new Date().getTime(), id: new Date().getTime(),
mts: new Date().getTime(), mts: new Date().getTime(),
command:'get /websocket/v1/recv_data/connects/' + this.connect_id +'/keep_alive' command:
} "get /websocket/v1/recv_data/connects/" +
this.cws.send(JSON.stringify(message)) this.connect_id +
"/keep_alive"
};
this.cws.send(JSON.stringify(message));
}, 50000); }, 50000);
} catch (error) {
console.log(error);
}
} }
}; };
</script> </script>
<style>
</style>>
\ No newline at end of file \ No newline at end of file
<style></style>>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!