Commit 63f4224b by 潘建波

renwu

1 parent 96136389
...@@ -20,7 +20,7 @@ service.interceptors.request.use( ...@@ -20,7 +20,7 @@ service.interceptors.request.use(
if (config.method == 'post') { if (config.method == 'post') {
config.data = { config.data = {
...config.data, ...config.data,
_t: Date.parse(new Date()) / 1000 // _t: Date.parse(new Date()) / 1000
} }
} else if (config.method == 'get') { } else if (config.method == 'get') {
config.params = { config.params = {
......
...@@ -29,6 +29,9 @@ export default { ...@@ -29,6 +29,9 @@ export default {
return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${devuid}/vchans/${refid}`); //获取分析流 return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${devuid}/vchans/${refid}`); //获取分析流
}, },
sipSet(devid, userid) { sipSet(devid, userid) {
return api.get(`${baseUrl}/devconf_fx/devs/${devid}/${userid}/sip_server?s=${gitTimer()}`) return api.get(`${baseUrl}/devconf_fx/devs/${devid}/${userid}/sip_server`)
},
getStore(params) {
return api.get(`${baseUrl}/api/v1/devconf_fx/store_confs`, params)
} }
}; };
...@@ -33,6 +33,14 @@ export default { ...@@ -33,6 +33,14 @@ export default {
} }
return instance.put(url, params, options); return instance.put(url, params, options);
}, },
post2(url, params, headers) {
let options = {};
if (headers) {
options.headers = headers;
}
return instance.post(url, params, options);
},
delete(url, params, headers) { delete(url, params, headers) {
let options = {}; let options = {};
......
...@@ -6,9 +6,15 @@ export default { ...@@ -6,9 +6,15 @@ export default {
getTask(params, id) { getTask(params, id) {
return api.get(urls.getTask, params); return api.get(urls.getTask, params);
}, },
addTask(params, headers) {
return api.post2(urls.getTask, params, headers)
},
editTask(params, taskid) { editTask(params, taskid) {
return api.post(urls.editTask(taskid), params); return api.post(urls.editTask(taskid), params);
}, },
editSubTask(taskid, params) {
return api.post2(urls.setSubTask(taskid), params)
},
editRoi(taskid, subtaskid, params) { editRoi(taskid, subtaskid, params) {
return api.post(urls.editroi(taskid, subtaskid), params); return api.post(urls.editroi(taskid, subtaskid), params);
}, },
...@@ -35,5 +41,11 @@ export default { ...@@ -35,5 +41,11 @@ export default {
}, },
deleteTask(taskid) { deleteTask(taskid) {
return api.delete(urls.deleteTask(taskid)); return api.delete(urls.deleteTask(taskid));
},
deleteSubTask(taskid, subtaskid) {
return api.delete(urls.deleteSubTask(taskid, subtaskid));
},
setTaskStatus(taskid, params) {
return api.post(urls.changeTask(taskid), params);
} }
}; };
...@@ -3,12 +3,12 @@ function gitTimer() { ...@@ -3,12 +3,12 @@ function gitTimer() {
return new Date().getTime(); return new Date().getTime();
} }
export default { export default {
getTask: `${baseUrl}/api/v1/devconf_fx/tasks?s=${gitTimer()}`, getTask: `${baseUrl}/api/v1/devconf_fx/tasks`,
editTask: taskid => { editTask: taskid => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}`; return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}`;
}, },
editroi: (taskid, subtaskid) => { editroi: (taskid, subtaskid) => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtasks/${subtaskid}?s=${gitTimer()}`; // ROI设置 return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtasks/${subtaskid}}`; // ROI设置
}, },
alternatestate: (taskid, subtaskid) => { alternatestate: (taskid, subtaskid) => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtask/${subtaskid}/suspend_alternate_task?s=${gitTimer()}`; return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtask/${subtaskid}/suspend_alternate_task?s=${gitTimer()}`;
...@@ -17,7 +17,10 @@ export default { ...@@ -17,7 +17,10 @@ export default {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtask/${subtaskid}/suspend_algorithm?s=${gitTimer()}`; return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtask/${subtaskid}/suspend_algorithm?s=${gitTimer()}`;
}, },
getSubTask: id => { getSubTask: id => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${id}/subtasks?s=${gitTimer()}`; return `${baseUrl}/api/v1/devconf_fx/tasks/${id}/subtasks`;
},
setSubTask: id => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${id}/subtask`;
}, },
getstream: (devid, vrefid) => { getstream: (devid, vrefid) => {
return `${baseUrl}/api/v1/stream/devs/${devid}/vchans/${vrefid}/live/is_sending?s=${gitTimer()}`; return `${baseUrl}/api/v1/stream/devs/${devid}/vchans/${vrefid}/live/is_sending?s=${gitTimer()}`;
...@@ -35,7 +38,7 @@ export default { ...@@ -35,7 +38,7 @@ export default {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}?s=${gitTimer()}`; // 删除子任务 return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}?s=${gitTimer()}`; // 删除子任务
}, },
deleteSubTask: (taskid, subtaskid) => { deleteSubTask: (taskid, subtaskid) => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtask/${subtaskid}?s=${gitTimer()}`; // 删除子任务 return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtask/${subtaskid}`; // 删除子任务
}, },
changeTask: taskid => { changeTask: taskid => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/start_or_stop?s=${gitTimer()}`; // 切换任务 return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/start_or_stop?s=${gitTimer()}`; // 切换任务
......
...@@ -11,17 +11,12 @@ ...@@ -11,17 +11,12 @@
<el-input v-model="formData.task_name" placeholder="请输入任务名称"></el-input> <el-input v-model="formData.task_name" placeholder="请输入任务名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="算法类型"> <el-form-item label="算法类型">
<el-select v-model="formData.type" placeholder="请选择" :popper-append-to-body=false> <el-select v-model="formData.task_algo_type" placeholder="请选择" :popper-append-to-body=false>
<el-option <el-option value="" label="--"></el-option>
key="1" <el-option value="0" label="交通"></el-option>
label="全部" <el-option value="1" label="客流"></el-option>
value=""> <el-option value="2" label="行为分析"></el-option>
</el-option> <el-option value="5" label="交通行人"></el-option>
<el-option
key="2"
label="222"
value="2">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="场景占用"> <el-form-item label="场景占用">
...@@ -42,34 +37,25 @@ ...@@ -42,34 +37,25 @@
<el-input v-model="formData.type"></el-input> <el-input v-model="formData.type"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="时间"> <el-form-item label="时间">
<el-input v-model="formData.type"></el-input> <el-date-picker
v-model="formData.timer"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="存储配置"> <el-form-item label="存储配置">
<el-select v-model="formData.type" placeholder="请选择" :popper-append-to-body=false> <el-select v-model="formData.store_conf.unid" placeholder="请选择" :popper-append-to-body=false>
<el-option <el-option :value="store.unid" :label="store.name" v-for="store in store_confs" :key="store.unid"></el-option>
key="1"
label="全部"
value="">
</el-option>
<el-option
key="2"
label="222"
value="2">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="优先级"> <el-form-item label="优先级">
<el-select v-model="formData.type" placeholder="请选择" :popper-append-to-body=false> <el-select v-model="formData.priority" placeholder="请选择" :popper-append-to-body=false>
<el-option <el-option value="high" label="高"></el-option>
key="1" <el-option value="normal" selected="" label="中"></el-option>
label="全部" <el-option value="low" label="低"></el-option>
value="">
</el-option>
<el-option
key="2"
label="222"
value="2">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -86,48 +72,136 @@ ...@@ -86,48 +72,136 @@
export default{ export default{
data(){ data(){
return{ return{
formData:{}, setvisible:false,
sessionData:{} formData:{
task_name:'',
task_algo_type:'',
timer:'',
store_conf:{
unid:''
},
priority:'',
},
vchanAry:[],
sessionData:{},
store_confs:[]
} }
}, },
props:{ props:{
setvisible:{ pedittype:{
type:Boolean, type:String,
default:false default:'add'
}, },
parentData:{
type:Object,
default: function () {
return {}
}
}
}, },
watch:{ watch:{
parentData(nval, oval){
console.log(nval, oval)
this.sessionData=JSON.parse(JSON.stringify(nval));
this.formData=nval;
console.log(this.formData)
}
}, },
mounted(){ mounted(){
console.log('mounted',this.formData) console.log('mounted',this.formData)
}, },
methods:{ methods:{
initData(type, pdata){
debugger
this.setvisible = true;
if (type == 'add') {
this.formData = {
task_name:'',
task_algo_type:'',
timer:'',
store_conf:{
unid:''
},
priority:'',
};
}
if (type == 'edit') {
pdata.timer = [pdata.start_dt,pdata.end_dt]
this.formData = pdata;
this.$api.task.getSubTask(pdata.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
}else {
data.vchan = {
subtask_id: data[i].subtask_id,
refid:'',
vchan_name:data[i].subtask_name
}
}
ary.push(data[i].vchan)
}
// this.$refs.edit.editData = confile;
// this.$refs.edit.vchanAry = ary;
this.vchanAry = ary;
})
}
},
handleClose(){ handleClose(){
this.$emit('update:setvisible',false) this.setvisible = false;
}, },
closeVisible(){ closeVisible(){
for(var key in this.sessionData){ for(var key in this.sessionData){
this.formData[key]=this.sessionData[key] this.formData[key]=this.sessionData[key]
} }
this.$emit('update:setvisible',false) this.setvisible = false;
}, },
save(){ save(){
this.sessionData=JSON.parse(JSON.stringify(this.formData)); this.sessionData=JSON.parse(JSON.stringify(this.formData));
this.$emit('update:parentData',this.formData); this.setvisible = false;
this.$emit('update:setvisible',false) //
let postData = {
task_name: this.formData.task_name,
task_algo_type: this.formData.task_algo_type,
source_type: "pull_video_stream",
dev_unid: this.dev_unid,
node_count: 0,
start_dt: this.setUtcTime(this.formData.timer[0]),
end_dt: this.setUtcTime(this.formData.timer[1]),
priority: this.formData.priority,
store_conf_unid: this.formData.store_conf.unid,
task_type: "normal",
// algo_comb_unid: this.formData.store_conf,
};
let formData = new FormData();
for (let i in postData) {
formData.append(i, postData[i]);
}
if(this.pedittype == "add") {
this.addTask(formData)
}
if(this.pedittype == "edit") {
this.editTask(formData)
}
},
addTask(data) {
this.$api.task.addTask(data,{
"content-type": "multipart/form-data"
}).then(res => {
console.log(res)
this.$emit('refresh')
})
},
editTask(data) {
this.$api.task.editTask(data,this.formData.task_id).then(res => {
this.$emit('refresh')
})
}, },
getStore() {
let params = {
offset: 0,
limit: ''
}
this.$api.device.getStore(params).then(res =>{
this.store_confs = res.list_data;
})
}
},
created(){
this.getStore()
} }
} }
</script> </script>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
:before-close="handleClose" :before-close="handleClose"
> >
<!-- 内层dialog --> <!-- 内层dialog -->
<el-dialog width="630px" title="视频迁移" :visible.sync="innerVisible" append-to-body > <!-- <el-dialog width="630px" title="视频迁移" :visible.sync="innerVisible" append-to-body >
<el-table height="286" :data="taskData" stripe border style="width: 100%"> <el-table height="286" :data="taskData" stripe border style="width: 100%">
<el-table-column align="center" prop="name" label="任务名称"></el-table-column> <el-table-column align="center" prop="name" label="任务名称"></el-table-column>
<el-table-column align="center" prop="status" label="状态"> <el-table-column align="center" prop="status" label="状态">
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-table-column align="center" prop="set" label="储存配置"></el-table-column> <el-table-column align="center" prop="set" label="储存配置"></el-table-column>
<el-table-column align="center" prop="per" label="场景占用"></el-table-column> <el-table-column align="center" prop="per" label="场景占用"></el-table-column>
</el-table> </el-table>
</el-dialog> </el-dialog> -->
<div> <div>
<!-- 外层内容 --> <!-- 外层内容 -->
<div class="leftBox"> <div class="leftBox">
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
show-checkbox show-checkbox
@node-click="vchanClick" @node-click="vchanClick"
ref="tree" ref="tree"
@check-change="handleCheckChange" @check="handleCheckChange"
></el-tree> ></el-tree>
</div> </div>
</div> </div>
...@@ -84,16 +84,9 @@ export default { ...@@ -84,16 +84,9 @@ export default {
tableData: [], tableData: [],
play_url:'', play_url:'',
user_unid:'', user_unid:'',
taskData: [ formData: {},
{ editData: {},
name: 111, setvisible:false,
status: 22,
type: 33,
set: 44,
per: 55
}
],
formData: {},
props: { props: {
id: "vchan_refid", id: "vchan_refid",
label: "name", label: "name",
...@@ -105,26 +98,22 @@ export default { ...@@ -105,26 +98,22 @@ export default {
data: [], data: [],
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "label" label: "label",
id:"vchan_refid"
} }
}; };
}, },
props: { props: {
setvisible: { pedittype:{
type: Boolean, type:String,
default: false default:'add'
}, },
parentData: {
type: Object,
default: function() {
return {};
}
}
}, },
watch: { watch: {
parentData(val) { parentData(val) {
this.sessionData = JSON.parse(JSON.stringify(val)); // this.sessionData = JSON.parse(JSON.stringify(val));
this.formData = val; // this.editData = val;
} }
}, },
components:{ components:{
...@@ -134,11 +123,37 @@ export default { ...@@ -134,11 +123,37 @@ export default {
console.log(this.setvisible); console.log(this.setvisible);
}, },
methods: { methods: {
showModal(){ showModal(val){
this.tableData = []
this.setvisible = true this.setvisible = true
this.$store.commit("setocxstate", 1); 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
}else {
data.vchan = {
subtask_id: data[i].subtask_id,
refid:'',
vchan_name:data[i].subtask_name,
name:data[i].subtask_name,
}
}
ary.push(data[i].vchan)
}
this.tableData = ary;
this.checkvckan()
})
}, },
handleCheckChange(data) { handleCheckChange(data,node) {
debugger
console.log(node)
let staus = false let staus = false
if(this.tableData.length > 0) { if(this.tableData.length > 0) {
for(let i = 0; i < this.tableData.length; i++){ for(let i = 0; i < this.tableData.length; i++){
...@@ -152,14 +167,36 @@ export default { ...@@ -152,14 +167,36 @@ export default {
} }
} }
if(data.leaf && !staus){ if(data.leaf && !staus){
this.tableData.push(data) this.editsubTask(data)
staus = false staus = false
} }
}, },
editsubTask(vchan){
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
}
}
this.$api.task.editSubTask(this.editData.task_id,data).then(res => {
this.tableData.push(vchan)
})
},
playVideo(data) { playVideo(data) {
console.log("b", data); console.log("b", data);
}, },
delFun(index, data) {
debugger
this.$api.task.deleteSubTask(this.editData.task_id,data.subtask_id).then(res => {
this.tableData.splice(index,1)
})
this.checkvckan()
},
append(data) { append(data) {
const newChild = { id: id++, label: "testtest", children: [] }; const newChild = { id: id++, label: "testtest", children: [] };
if (!data.children) { if (!data.children) {
...@@ -167,6 +204,15 @@ export default { ...@@ -167,6 +204,15 @@ export default {
} }
data.children.push(newChild); data.children.push(newChild);
}, },
checkvckan(){
this.$refs.tree.setCheckedKeys([])
let arr = []
this.tableData.forEach(ele => {
arr.push(ele.vchan_refid)
})
this.$refs.tree.setCheckedKeys(arr)
},
loadNode(node, resolve) { loadNode(node, resolve) {
if (node.level === 0) { if (node.level === 0) {
return resolve([ return resolve([
...@@ -221,6 +267,9 @@ export default { ...@@ -221,6 +267,9 @@ export default {
} }
} }
resolve(vchans); resolve(vchans);
setTimeout(()=>{
this.checkvckan()
},0)
}); });
return; return;
} }
...@@ -245,7 +294,7 @@ export default { ...@@ -245,7 +294,7 @@ export default {
} }
return resolve(node.data.childs); return resolve(node.data.childs);
}, },
vchanClick(node) { vchanClick(node) {
if (!node.refid && !node.vchan_refid) { if (!node.refid && !node.vchan_refid) {
return; return;
} }
...@@ -345,13 +394,11 @@ export default { ...@@ -345,13 +394,11 @@ export default {
handleClose() { handleClose() {
this.setvisible = false; this.setvisible = false;
this.$store.commit("setocxstate", 0); this.$store.commit("setocxstate", 0);
this.$refs.tree.setCheckedKeys([]);
}, },
save() { save() {
this.sessionData = JSON.parse(JSON.stringify(this.formData));
this.$emit("update:parentData", this.formData);
this.$emit("update:setvisible", false);
}, },
delFun(index, row) {},
moveFun(index, row) { moveFun(index, row) {
this.innerVisible = true; this.innerVisible = true;
} }
...@@ -401,7 +448,6 @@ export default { ...@@ -401,7 +448,6 @@ export default {
} }
.rightBox { .rightBox {
float: left; float: left;
margin-left: 5px;
} }
.imgBox { .imgBox {
width: 587px; width: 587px;
......
...@@ -127,11 +127,11 @@ ...@@ -127,11 +127,11 @@
</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>
<span class="iconfont icon-bofang playIcon" @click="playFun(scope.$index, scope.row)"></span> <span class="iconfont icon-bofang playIcon" @click="setTaskStatus(scope.row,'start')"></span>
</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>
<span class="iconfont icon-zanting pauseIcon" @click="pauseFun(scope.$index, scope.row)"></span> <span class="iconfont icon-zanting pauseIcon" @click="setTaskStatus(scope.row,'stop')"></span>
</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>
...@@ -157,8 +157,8 @@ ...@@ -157,8 +157,8 @@
</div> </div>
</div> </div>
<editset :setvisible.sync="setShow" :parentData="editForm" :edittype="pedittype"></editset> <editset ref="editset" :pedittype="pedittype" @refresh="getTaskList"></editset>
<editvideo ref="editvideo" :parentData="curtask"></editvideo> <editvideo ref="editvideo" :parentData="curtask" :pedittype="pedittype" @refresh="getTaskList"></editvideo>
</div> </div>
</div> </div>
</template> </template>
...@@ -287,25 +287,44 @@ ...@@ -287,25 +287,44 @@
}) })
}, },
editVideo(index,row){ editVideo(index,row){
this.$refs.editvideo.showModal() this.$refs.editvideo.showModal(row)
this.curtask = row
}, },
editTask(type,index,row){ editTask(type,index,row){
this.$refs.editset.initData(type,row)
this.pedittype = type this.pedittype = type
this.setShow=true;
this.$nextTick(() => { this.$nextTick(() => {
this.editForm=row; this.editForm=row;
}) })
}, },
playFun(index,row){ setTaskStatus(data,type){
console.log(row) this.$api.task.setTaskStatus(data.task_id,{start_stop_status:type}).then(res =>{
}, this.$message({
pauseFun(index,row){ type: res.ecode=='200'?'success':'error',
console.log(row) message: res.enote
})
if(res.ecode=='200') {
this.getTaskList();
}
})
}, },
delFun(index,row){ delFun(index, data){
console.log(row) this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.task.deleteTask(data.task_id).then(res => {
this.$message({
type: res.ecode=='200'?'success':'error',
message: res.enote
})
if (res.ecode == '200'){
this.getTaskList();
}
})
})
} }
}, },
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!