Commit 63f4224b by 潘建波

renwu

1 parent 96136389
......@@ -20,7 +20,7 @@ service.interceptors.request.use(
if (config.method == 'post') {
config.data = {
...config.data,
_t: Date.parse(new Date()) / 1000
// _t: Date.parse(new Date()) / 1000
}
} else if (config.method == 'get') {
config.params = {
......
......@@ -29,6 +29,9 @@ export default {
return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${devuid}/vchans/${refid}`); //获取分析流
},
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 {
}
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) {
let options = {};
......
......@@ -6,9 +6,15 @@ export default {
getTask(params, id) {
return api.get(urls.getTask, params);
},
addTask(params, headers) {
return api.post2(urls.getTask, params, headers)
},
editTask(params, taskid) {
return api.post(urls.editTask(taskid), params);
},
editSubTask(taskid, params) {
return api.post2(urls.setSubTask(taskid), params)
},
editRoi(taskid, subtaskid, params) {
return api.post(urls.editroi(taskid, subtaskid), params);
},
......@@ -35,5 +41,11 @@ export default {
},
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() {
return new Date().getTime();
}
export default {
getTask: `${baseUrl}/api/v1/devconf_fx/tasks?s=${gitTimer()}`,
getTask: `${baseUrl}/api/v1/devconf_fx/tasks`,
editTask: taskid => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}`;
},
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) => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtask/${subtaskid}/suspend_alternate_task?s=${gitTimer()}`;
......@@ -17,7 +17,10 @@ export default {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/subtask/${subtaskid}/suspend_algorithm?s=${gitTimer()}`;
},
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) => {
return `${baseUrl}/api/v1/stream/devs/${devid}/vchans/${vrefid}/live/is_sending?s=${gitTimer()}`;
......@@ -35,7 +38,7 @@ export default {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}?s=${gitTimer()}`; // 删除子任务
},
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 => {
return `${baseUrl}/api/v1/devconf_fx/tasks/${taskid}/start_or_stop?s=${gitTimer()}`; // 切换任务
......
......@@ -11,17 +11,12 @@
<el-input v-model="formData.task_name" placeholder="请输入任务名称"></el-input>
</el-form-item>
<el-form-item label="算法类型">
<el-select v-model="formData.type" placeholder="请选择" :popper-append-to-body=false>
<el-option
key="1"
label="全部"
value="">
</el-option>
<el-option
key="2"
label="222"
value="2">
</el-option>
<el-select v-model="formData.task_algo_type" placeholder="请选择" :popper-append-to-body=false>
<el-option value="" label="--"></el-option>
<el-option value="0" label="交通"></el-option>
<el-option value="1" label="客流"></el-option>
<el-option value="2" label="行为分析"></el-option>
<el-option value="5" label="交通行人"></el-option>
</el-select>
</el-form-item>
<el-form-item label="场景占用">
......@@ -42,34 +37,25 @@
<el-input v-model="formData.type"></el-input>
</el-form-item>
<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 label="存储配置">
<el-select v-model="formData.type" placeholder="请选择" :popper-append-to-body=false>
<el-option
key="1"
label="全部"
value="">
</el-option>
<el-option
key="2"
label="222"
value="2">
</el-option>
<el-select v-model="formData.store_conf.unid" placeholder="请选择" :popper-append-to-body=false>
<el-option :value="store.unid" :label="store.name" v-for="store in store_confs" :key="store.unid"></el-option>
</el-select>
</el-form-item>
<el-form-item label="优先级">
<el-select v-model="formData.type" placeholder="请选择" :popper-append-to-body=false>
<el-option
key="1"
label="全部"
value="">
</el-option>
<el-option
key="2"
label="222"
value="2">
</el-option>
<el-select v-model="formData.priority" placeholder="请选择" :popper-append-to-body=false>
<el-option value="high" label="高"></el-option>
<el-option value="normal" selected="" label="中"></el-option>
<el-option value="low" label="低"></el-option>
</el-select>
</el-form-item>
</el-form>
......@@ -86,48 +72,136 @@
export default{
data(){
return{
formData:{},
sessionData:{}
setvisible:false,
formData:{
task_name:'',
task_algo_type:'',
timer:'',
store_conf:{
unid:''
},
priority:'',
},
vchanAry:[],
sessionData:{},
store_confs:[]
}
},
props:{
setvisible:{
type:Boolean,
default:false
pedittype:{
type:String,
default:'add'
},
parentData:{
type:Object,
default: function () {
return {}
}
}
},
watch:{
parentData(nval, oval){
console.log(nval, oval)
this.sessionData=JSON.parse(JSON.stringify(nval));
this.formData=nval;
console.log(this.formData)
}
},
mounted(){
console.log('mounted',this.formData)
},
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(){
this.$emit('update:setvisible',false)
this.setvisible = false;
},
closeVisible(){
for(var key in this.sessionData){
this.formData[key]=this.sessionData[key]
}
this.$emit('update:setvisible',false)
this.setvisible = false;
},
save(){
this.sessionData=JSON.parse(JSON.stringify(this.formData));
this.$emit('update:parentData',this.formData);
this.$emit('update:setvisible',false)
this.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>
......
......@@ -8,7 +8,7 @@
:before-close="handleClose"
>
<!-- 内层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-column align="center" prop="name" label="任务名称"></el-table-column>
<el-table-column align="center" prop="status" label="状态">
......@@ -20,7 +20,7 @@
<el-table-column align="center" prop="set" label="储存配置"></el-table-column>
<el-table-column align="center" prop="per" label="场景占用"></el-table-column>
</el-table>
</el-dialog>
</el-dialog> -->
<div>
<!-- 外层内容 -->
<div class="leftBox">
......@@ -34,7 +34,7 @@
show-checkbox
@node-click="vchanClick"
ref="tree"
@check-change="handleCheckChange"
@check="handleCheckChange"
></el-tree>
</div>
</div>
......@@ -84,16 +84,9 @@ export default {
tableData: [],
play_url:'',
user_unid:'',
taskData: [
{
name: 111,
status: 22,
type: 33,
set: 44,
per: 55
}
],
formData: {},
editData: {},
setvisible:false,
props: {
id: "vchan_refid",
label: "name",
......@@ -105,26 +98,22 @@ export default {
data: [],
defaultProps: {
children: "children",
label: "label"
label: "label",
id:"vchan_refid"
}
};
},
props: {
setvisible: {
type: Boolean,
default: false
pedittype:{
type:String,
default:'add'
},
parentData: {
type: Object,
default: function() {
return {};
}
}
},
watch: {
parentData(val) {
this.sessionData = JSON.parse(JSON.stringify(val));
this.formData = val;
// this.sessionData = JSON.parse(JSON.stringify(val));
// this.editData = val;
}
},
components:{
......@@ -134,11 +123,37 @@ export default {
console.log(this.setvisible);
},
methods: {
showModal(){
showModal(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
}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
if(this.tableData.length > 0) {
for(let i = 0; i < this.tableData.length; i++){
......@@ -152,14 +167,36 @@ export default {
}
}
if(data.leaf && !staus){
this.tableData.push(data)
this.editsubTask(data)
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) {
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) {
const newChild = { id: id++, label: "testtest", children: [] };
if (!data.children) {
......@@ -167,6 +204,15 @@ export default {
}
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) {
if (node.level === 0) {
return resolve([
......@@ -221,6 +267,9 @@ export default {
}
}
resolve(vchans);
setTimeout(()=>{
this.checkvckan()
},0)
});
return;
}
......@@ -345,13 +394,11 @@ export default {
handleClose() {
this.setvisible = false;
this.$store.commit("setocxstate", 0);
this.$refs.tree.setCheckedKeys([]);
},
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) {
this.innerVisible = true;
}
......@@ -401,7 +448,6 @@ export default {
}
.rightBox {
float: left;
margin-left: 5px;
}
.imgBox {
width: 587px;
......
......@@ -127,11 +127,11 @@
</el-tooltip>
<span class="tableSpanBorder"></span>
<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>
<span class="tableSpanBorder"></span>
<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>
<span class="tableSpanBorder"></span>
<el-tooltip content="删除" placement="bottom" effect="light" :visible-arrow=false>
......@@ -157,8 +157,8 @@
</div>
</div>
<editset :setvisible.sync="setShow" :parentData="editForm" :edittype="pedittype"></editset>
<editvideo ref="editvideo" :parentData="curtask"></editvideo>
<editset ref="editset" :pedittype="pedittype" @refresh="getTaskList"></editset>
<editvideo ref="editvideo" :parentData="curtask" :pedittype="pedittype" @refresh="getTaskList"></editvideo>
</div>
</div>
</template>
......@@ -287,25 +287,44 @@
})
},
editVideo(index,row){
this.$refs.editvideo.showModal()
this.curtask = row
this.$refs.editvideo.showModal(row)
},
editTask(type,index,row){
this.$refs.editset.initData(type,row)
this.pedittype = type
this.setShow=true;
this.$nextTick(() => {
this.editForm=row;
})
},
playFun(index,row){
console.log(row)
},
pauseFun(index,row){
console.log(row)
setTaskStatus(data,type){
this.$api.task.setTaskStatus(data.task_id,{start_stop_status:type}).then(res =>{
this.$message({
type: res.ecode=='200'?'success':'error',
message: res.enote
})
if(res.ecode=='200') {
this.getTaskList();
}
})
},
delFun(index,row){
console.log(row)
delFun(index, data){
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!