Commit 4aaf34ab by 潘建波

提交修改BUG和任务下发

1 parent b2e5589f
......@@ -12,7 +12,7 @@
font-size: 16px;
}
#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{
padding: 0;
......
......@@ -83,9 +83,9 @@ export default {
},
beforeDestroy: function () {
if (this.videoplayer.techName_ == "Flash" && this.videoplayer.pause) {
this.videoplayer.pause();
}
// if (this.videoplayer.techName_ == "Flash" && this.videoplayer.pause) {
// this.videoplayer.pause();
// }
}
};
......
This diff could not be displayed because it is too large.
<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 @@
:visible-arrow="false"
>
<span
class="el-icon-copy-document moveIcon"
class="icon-fanxing-qianyi moveIcon"
@click="moveFun(scope.$index, scope.row)"
></span>
</el-tooltip>
......@@ -115,6 +115,7 @@ export default {
user_unid: "",
formData: {},
editData: {},
taskData:{},
setvisible: false,
props: {
id: "vchan_refid",
......@@ -152,6 +153,7 @@ export default {
},
methods: {
showModal(val) {
this.taskData = val;
this.tableData = [];
this.setvisible = true;
this.$store.commit("setocxstate", 1);
......@@ -160,7 +162,6 @@ export default {
let ary = [];
let data = res.list_data;
for (let i in data) {
debugger
if (data[i].vchan) {
data[i].vchan.subtask_id = data[i].subtask_id;
data[i].vchan.refid = data[i].vchan.vchan_refid;
......@@ -199,6 +200,12 @@ export default {
staus = false;
}
},
editTask(data) {
// let data = this.taskData;
this.$api.task.editTask(data, data.task_id).then(res => {
this.$emit("refresh");
});
},
editsubTask(vchan) {
let data = {
is_dome: false,
......@@ -210,6 +217,7 @@ export default {
vchan_name: vchan.name
}
};
this.$api.task.editSubTask(this.editData.task_id, data).then(res => {
this.tableData.push(vchan);
});
......@@ -222,9 +230,12 @@ export default {
.deleteSubTask(this.editData.task_id, data.subtask_id)
.then(res => {
this.tableData.splice(index, 1);
this.checkvckan();
});
if (action != "tree") {
this.checkvckan();
setTimeout(() => {
this.checkvckan();
}, 0);
}
},
append(data) {
......
......@@ -71,36 +71,20 @@
:data="tableData"
stripe
border
ref="table"
ref="table"
style="width: 100%"
@expand-change="expandchange"
:expand-row-keys="rowkey"
>
<el-table-column type="expand">
<template slot-scope="props">
<div
<subTaskInfo
v-for="(item, index) in props.row.subTaskData"
:key="index"
class="expande-table-row"
:subTaskData="item"
:taskData="props.row"
:freeList="freeList"
>
<span class="label">视频源文件</span>
<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>
</subTaskInfo>
</template>
</el-table-column>
<el-table-column
......@@ -255,6 +239,7 @@
<script>
import editset from "./editSet";
import editvideo from "./editVideo";
import subTaskInfo from "./subtask.vue";
export default {
data() {
return {
......@@ -263,22 +248,23 @@ export default {
task_algo_type: "",
total: 0,
page: 1,
freeList: [],
pageSize: 30,
setShow: false,
videoShow: false,
editForm: {},
tableData: [],
subTaskData: [],
freeList: [],
pedittype: "add",
currentRow: {},
rowkey: ["1"],
pedittype: "add",
currentRow: {},
assign_ip: ""
};
},
components: {
editset,
editvideo
editvideo,
subTaskInfo
},
mounted() {
this.getTaskList();
......@@ -297,12 +283,14 @@ export default {
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.assign_id = data[i].assign_to ?data[i].assign_to.id : "";
} else {
data.vchan = {
subtask_id: data[i].subtask_id,
refid: "",
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);
......@@ -340,6 +328,12 @@ export default {
return "未知";
}
},
getFreelist() {
this.$api.device.getFreelist(this.dev_unid).then(res => {
this.freeList = res.list_data;
});
// /
},
dateFormatter(row, column, cellValue, index) {
let startDate = cellValue ? cellValue.split(" ")[0] : "";
let endDate = row.end_dt ? row.end_dt.split(" ")[0] : "";
......@@ -395,7 +389,7 @@ export default {
this.tableData = [];
} else {
res.list_data.forEach(item => {
item.subTaskData = []
item.subTaskData = [];
if (item.start_dt) {
//先转utc格式
let date = this.$moment.utc(item.start_dt).format();
......@@ -418,12 +412,6 @@ export default {
})
.catch(error => {});
},
getFreelist() {
this.$api.device.getFreelist(this.dev_unid).then(res => {
this.freeList = res.list_data;
});
// /
},
editVideo(index, row) {
this.$refs.editvideo.showModal(row);
},
......@@ -595,38 +583,20 @@ export default {
color: #f2365a;
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) {
width: 8vw;
}
.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;
}
line-height: 40px;
border-bottom: 1px solid #f0f0f0;
.subtask-info:nth-child(2) {
width: 8vw;
}
.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;
}
</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 @@
<div class="alarm-event-box">
<el-table :data="tableData" height="30vh">
<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 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="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="操作">
<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
src="../../assets/img/home/look.png"
alt
......@@ -16,7 +33,12 @@
/>
</el-tooltip>
<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
src="../../assets/img/home/del.png"
alt
......@@ -34,93 +56,104 @@
export default {
data() {
return {
tableData:[]
}
tableData: []
};
},
methods:{
methods: {
delFun(index, rows) {
rows.splice(index, 1);
},
editVideo(index, rows){
this.$emit('event',rows)
},
editVideo(index, rows) {
this.$emit("event", rows);
}
},
beforeMount(){
let that = this;
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.wsIP}/websocket/api/v1/datahandle/connects/${this.connect_id}`)
beforeMount() {
try {
let that = this;
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.wsIP}/websocket/api/v1/datahandle/connects/${this.connect_id}`
);
this.cws.onopen = () =>{
console.log('ws事件推送服务连接成功')
}
//事件断开
this.cws.onclose = () =>{
window.clearTimeout(that.keepAlive)
console.log('ws事件推送服务断开')
that.connect_id = new Date().getTime()
that.cws = new WebSocket(`ws://${this.$api.wsIP}/websocket/api/v1/datahandle/connects/${this.connect_id}`)
this.cws.onopen = () => {
console.log("ws事件推送服务连接成功");
};
//事件断开
this.cws.onclose = () => {
window.clearTimeout(that.keepAlive);
console.log("ws事件推送服务断开");
that.connect_id = new Date().getTime();
that.cws = new WebSocket(
`ws://${this.$api.wsIP}/websocket/api/v1/datahandle/connects/${this.connect_id}`
);
that.keepAlive = setInterval(() => {
let message = {
type: 'request',
type: "request",
id: new Date().getTime(),
mts: new Date().getTime(),
command:'get /websocket/v1/recv_data/connects/' + this.connect_id +'/keep_alive'
}
this.cws.send(JSON.stringify(message))
command:
"get /websocket/v1/recv_data/connects/" +
this.connect_id +
"/keep_alive"
};
this.cws.send(JSON.stringify(message));
}, 20000);
}
//事件推送信息
let _this = this;
this.cws.onmessage = (evt) =>{
let data = JSON.parse(evt.data)
try {
if(data.event_data.illegal.state == 1){
let illname = _this.getCode('违法类型',data.event_data.illegal.code) || '';
let camername = data.event_data.location.name
let dt = this.showLocalTime(data.event_dt).split(' ')[1];
console.log(data.pics[0].src_url)
let pics = data.pics[0].src_url
let pos = data.event_data.location.pos
let obj = {
illname:illname,
illdt:dt,
camername:camername,
pics:pics,
pos:pos
}
if(that.tableData.length > 40) {
that.tableData.pop(obj)
};
//事件推送信息
let _this = this;
this.cws.onmessage = evt => {
let data = JSON.parse(evt.data);
try {
if (data.event_data.illegal.state == 1) {
let illname =
_this.getCode("违法类型", data.event_data.illegal.code) || "";
let camername = data.event_data.location.name;
let dt = this.showLocalTime(data.event_dt).split(" ")[1];
console.log(data.pics[0].src_url);
let pics = data.pics[0].src_url;
let pos = data.event_data.location.pos;
let obj = {
illname: illname,
illdt: dt,
camername: camername,
pics: pics,
pos: pos
};
if (that.tableData.length > 40) {
that.tableData.pop(obj);
} else {
that.tableData.unshift(obj)
}
that.tableData.unshift(obj)
} else{
that.tableData.unshift(obj);
}
that.tableData.unshift(obj);
}
} catch (error) {
console.log(error);
}
} catch (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(() => {
let message = {
type: 'request',
id: new Date().getTime(),
mts: new Date().getTime(),
command:'get /websocket/v1/recv_data/connects/' + this.connect_id +'/keep_alive'
}
this.cws.send(JSON.stringify(message))
}, 50000);
let message = {
type: "request",
id: new Date().getTime(),
mts: new Date().getTime(),
command:
"get /websocket/v1/recv_data/connects/" +
this.connect_id +
"/keep_alive"
};
this.cws.send(JSON.stringify(message));
}, 50000);
} catch (error) {
console.log(error);
}
}
};
</script>
<style>
</style>>
\ 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!