You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

370 lines
9.7 KiB
Vue

<template>
2 years ago
<el-tabs
v-model="activeName"
@tab-click="handleClick"
type="card"
v-loading="loading"
>
2 years ago
<el-tab-pane label="查询实际参数" name="1">
<div class="captureBoxVideo">
<div class="flexnr">
<div class="wt80">通道:</div>
<el-select v-model="selaccess" placeholder="请选择" class="mr20">
<el-option
v-for="item in accesslist"
:key="item.channelid"
:label="
item.alias !== null && item.alias !== ''
? item.alias
: item.channelname
"
:value="item.channelid"
>
{{
item.alias !== null && item.alias !== ""
? item.alias
: item.channelname
}}
</el-option>
</el-select>
</div>
<div class="flexno bt30">
<div class="wt80">视频分辨率:</div>
<el-select
2 years ago
v-model="capturenr.videoFormat"
class="wt280"
:disabled="true"
>
<el-option
v-for="item in ratiolist"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</div>
<div class="flexno bt30">
<div class="wt80">预置位:</div>
<el-input
2 years ago
v-model="capturenr.preset"
:disabled="true"
class="wt280"
></el-input>
</div>
<div class="flexno bt30">
<div class="wt80">录制时长:</div>
<el-input
2 years ago
v-model="capturenr.videoTime"
:disabled="true"
class="wt280"
>
<template slot="append">s ()</template>
</el-input>
</div>
2 years ago
<el-button
class="searchImage"
:loading="searchloading"
type="primary"
@click="inquirebtn()"
>查询</el-button
>
</div>
</el-tab-pane>
<el-tab-pane label="设置参数" name="2">
<div class="captureBoxVideo">
<el-form
:model="setForm"
:rules="rules"
ref="setForm"
label-width="120px"
2 years ago
class="captureForm"
>
<el-form-item label="通道" prop="channelId">
<el-select
v-model="setForm.channelId"
placeholder="请选择"
class="mr20"
>
<el-option
v-for="item in accesslist"
:key="item.channelid"
:label="
item.alias !== null && item.alias !== ''
? item.alias
: item.channelname
"
:value="item.channelid"
>
{{
item.alias !== null && item.alias !== ""
? item.alias
: item.channelname
}}
</el-option>
</el-select>
</el-form-item>
2 years ago
<el-form-item label="视频分辨率" prop="videoFormat">
<el-select
2 years ago
v-model="setForm.videoFormat"
placeholder="请选择"
class="mr20"
>
<el-option
v-for="item in ratiolist"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
2 years ago
<el-form-item label="预置位" prop="preset">
<el-input-number
2 years ago
v-model="setForm.preset"
:min="1"
:max="255"
2 years ago
:disabled="true"
></el-input-number>
</el-form-item>
2 years ago
<el-form-item label="录制时长 s(秒)" prop="videoTime">
<el-input-number
2 years ago
v-model="setForm.videoTime"
:min="1"
:max="100"
></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitbtn('setForm')"
>确认</el-button
>
</el-form-item>
</el-form>
2 years ago
</div>
</el-tab-pane>
</el-tabs>
</template>
<script>
import {
getChannelListJoggle,
getVideoParamApi,
setVideoParamApi,
getVideoParamnrApi,
getResolutionRatio,
} from "@/utils/api/index";
export default {
data() {
return {
loading: false,
isShow: false,
searchloading: false,
activeName: "1", //选项卡
accesslist: [], //通道选择器
ratiolist: [], //分辨率
selaccess: "", //选中的通道
capturenr: {}, //查询后的内容
2 years ago
setForm: {
preset: 255,
2 years ago
}, //设置参数
rules: {
channelId: [{ required: true, message: "请选择通道", trigger: "blur" }],
2 years ago
videoTime: [
{ required: true, message: "请输入录制时长", trigger: "blur" },
],
2 years ago
preset: [{ required: true, message: "请输入预置位", trigger: "blur" }],
videoFormat: [
{ required: true, message: "请选择视频分辨率", trigger: "blur" },
2 years ago
],
},
timer: null,
i: 0,
seltermid: "", //装置id
selcmdId: "", //cmdId
requestId: "",
};
},
mounted() {},
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
//获取设备通道
getSingleAccess(val) {
2 years ago
this.setForm = {
preset: 255,
2 years ago
};
console.log(val);
this.seltermid = val.id;
2 years ago
this.selcmdId = val.cmdId;
getChannelListJoggle({ termid: this.seltermid })
.then((res) => {
this.accesslist = res.data.list;
this.selaccess = res.data.list[0].channelid;
this.$set(this.setForm, "channelId", res.data.list[0].channelid);
})
.catch((err) => {});
},
//获取分辨率
getRatio() {
getResolutionRatio({ type: 1 })
.then((res) => {
this.ratiolist = res.data.list;
2 years ago
this.$set(this.setForm, "videoFormat", res.data.list[0].id);
})
.catch((err) => {});
},
//查询触发
inquirebtn() {
this.loading = true;
this.searchloading = true;
getVideoParamApi({
channelId: this.selaccess,
cmdId: this.selcmdId,
})
.then((res) => {
if (res.code == 200) {
this.requestId = res.data.requestId;
this.inquirenr();
this.timer = window.setInterval(() => {
this.inquirenr();
this.i++;
}, 1000);
} else {
this.$message.error(res.code.msg);
}
})
.catch((err) => {});
},
//查询接口
inquirenr() {
getVideoParamnrApi({
2 years ago
// channelId: this.selaccess,
// termId: this.seltermid,
2 years ago
requestId: this.requestId,
})
.then((res) => {
this.loading = false;
if (res.code == 200) {
this.capturenr = res.data;
if (res.data.isNew == true) {
this.searchloading = false;
this.i = 0;
2 years ago
this.$message({
duration: 1500,
2 years ago
showClose: true,
message: "查询已更新",
type: "success",
});
clearInterval(this.timer);
this.timer = null;
} else if (this.i > 9) {
this.searchloading = false;
this.i = 0;
2 years ago
this.$message({
duration: 1500,
2 years ago
showClose: true,
message: "暂无响应,请稍后再试!",
type: "warning",
});
clearInterval(this.timer);
this.timer = null;
}
} else {
this.$message.error(res.code.msg);
}
})
.catch((err) => {});
},
//确认
submitbtn(setForm) {
this.$set(this.setForm, "cmdId", this.selcmdId);
2 years ago
// this.$set(this.setForm, "preset", 255);
2 years ago
// this.$set(this.setForm, "termId", this.seltermid);
this.$refs[setForm].validate((valid) => {
if (valid) {
setVideoParamApi(this.setForm)
.then((res) => {
if (res.code == 200) {
this.$message.success("设置成功");
this.isShow = false;
} else {
this.$message.error(res.code.msg);
}
})
.catch((err) => {
this.$message.error("设置失败");
});
} else {
return false;
}
});
},
display() {
this.isShow = true;
},
hide() {
this.isShow = false;
},
handleclose() {
this.searchloading = false;
this.i = 0;
clearInterval(this.timer);
this.timer = null;
},
},
};
</script>
2 years ago
<style lang="less">
2 years ago
.captureBoxVideo {
width: 400px;
margin: 0 auto;
margin-top: 24px;
.flexnr {
display: flex;
height: 32px;
line-height: 32px;
margin-bottom: 18px;
.wt80 {
text-align: right;
float: left;
font-size: 14px;
color: #606266;
margin: 0 12px 0 0;
box-sizing: border-box;
width: 100px;
display: block;
}
.mr20 {
flex: 1;
}
}
2 years ago
.searchImage {
margin-left: 110px;
}
.flexno {
display: flex;
2 years ago
height: 32px;
line-height: 32px;
margin-bottom: 18px;
.wt80 {
text-align: right;
float: left;
font-size: 14px;
color: #606266;
margin: 0 12px 0 0;
box-sizing: border-box;
width: 100px;
display: block;
}
2 years ago
.wt280 {
flex: 1;
}
2 years ago
}
.captureForm {
.el-form-item__content {
}
}
}
</style>