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.

1003 lines
22 KiB
Vue

<template>
2 years ago
<el-tabs
v-model="activeName"
type="card"
@tab-click="handleClick"
v-loading="loading"
2 years ago
>
2 years ago
<el-tab-pane label="查询实际参数" name="1">
<div class="captureBox">
2 years ago
<div class="flexnr">
2 years ago
<div class="wt80">通道</div>
2 years ago
<el-select
v-model="selaccess"
placeholder="请选择"
class="mr20"
@change="clearform"
>
2 years ago
<el-option
v-for="item in accesslist"
:key="item.channelid"
:label="
item.alias !== null && item.alias !== ''
? item.alias
: item.channelname
"
2 years ago
:value="item.channelid"
>
{{
item.alias !== null && item.alias !== ""
? item.alias
: item.channelname
}}
</el-option>
2 years ago
</el-select>
</div>
<div class="flexno bt30">
2 years ago
<div class="wt80">色彩选择</div>
2 years ago
<el-select v-model="capturenr.color" class="wt280" :disabled="true">
<el-option
v-for="item in colorlist"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
2 years ago
</div>
<div class="flexno bt30">
2 years ago
<div class="wt80">图像分辨率</div>
2 years ago
<el-select
v-model="capturenr.resolution"
class="wt280"
:disabled="true"
>
<el-option
v-for="item in ratiolist"
:key="item.id"
2 years ago
:label="item.id + ' (' + item.name + ')'"
2 years ago
:value="item.id"
></el-option>
</el-select>
2 years ago
</div>
<div class="flexno bt30">
2 years ago
<div class="wt80">亮度</div>
2 years ago
<el-input
v-model="capturenr.luminance"
:disabled="true"
class="wt280"
></el-input>
</div>
<div class="flexno bt30">
2 years ago
<div class="wt80">对比度</div>
2 years ago
<el-input
v-model="capturenr.contrast"
:disabled="true"
class="wt280"
></el-input>
</div>
<div class="flexno bt30">
2 years ago
<div class="wt80">饱和度</div>
2 years ago
<el-input
v-model="capturenr.saturation"
:disabled="true"
class="wt280"
></el-input>
</div>
2 years ago
<el-button
class="searchImage"
:loading="searchloading"
type="primary"
2 years ago
@click="imageSearch()"
2 years ago
>查询</el-button
>
2 years ago
<!-- <el-button
class="searchImage"
:loading="searchloading"
type="primary"
@click="inquirebtn()"
>查询</el-button
> -->
2 years ago
</div>
</el-tab-pane>
<el-tab-pane label="设置参数" name="2">
<div class="captureBox">
2 years ago
<el-form
:model="setForm"
:rules="rules"
ref="setForm"
label-width="120px"
2 years ago
class="captureForm"
2 years ago
>
<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>
2 years ago
</el-form-item>
<el-form-item label="色彩选择" prop="color">
<el-select
v-model="setForm.color"
placeholder="请选择"
class="mr20"
>
<el-option
v-for="item in colorlist"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="图像分辨率" prop="resolution">
<el-select
v-model="setForm.resolution"
placeholder="请选择"
class="mr20"
>
<el-option
v-for="item in ratiolist"
:key="item.id"
2 years ago
:label="item.id + ' (' + item.name + ')'"
2 years ago
:value="item.id"
></el-option>
</el-select>
</el-form-item>
2 years ago
<el-form-item label="亮度" prop="luminance">
<el-input-number
v-model="setForm.luminance"
:min="1"
:max="100"
></el-input-number>
</el-form-item>
<el-form-item label="对比度" prop="contrast">
<el-input-number
v-model="setForm.contrast"
:min="1"
:max="100"
></el-input-number>
</el-form-item>
2 years ago
<el-form-item label="饱和度" prop="saturation">
<el-input-number
v-model="setForm.saturation"
:min="1"
:max="100"
></el-input-number>
</el-form-item>
<el-form-item>
2 years ago
<!-- <el-button type="primary" @click="submitbtn('setForm')"
>确认</el-button
> -->
<el-button
type="primary"
@click="imageSet('setForm')"
:loading="setloading"
2 years ago
>确认</el-button
>
</el-form-item>
</el-form>
2 years ago
</div>
</el-tab-pane>
</el-tabs>
2 years ago
</template>
<script>
import {
getChannelListJoggle,
getPhotoParamApi,
setPhotoParamApi,
getPhotoParamnrApi,
getResolutionRatio,
2 years ago
setTermCamera,
getTermCameraRequest,
2 years ago
} from "@/utils/api/index";
export default {
data() {
return {
loading: false,
2 years ago
searchloading: false,
setloading: false,
2 years ago
activeName: "1", //选项卡
accesslist: [], //通道选择器
colorlist: [
{
name: "彩色",
id: 1,
},
{
name: "黑白",
id: 0,
},
2 years ago
], //色彩选择器
2 years ago
ratiolist: [],
hnratiolist: [
{
id: 1,
name: "320X240",
},
{
id: 2,
name: "640X480",
},
{
id: 3,
name: "704X576",
},
{
id: 5,
name: "1024X768",
},
{
id: 6,
name: "1280X1024",
},
{
id: 7,
name: "1280X720",
},
{
id: 8,
name: "1920X1080",
},
{
id: 9,
name: "2560X1440",
},
{
id: 10,
name: "3840X2160",
},
{
id: 11,
name: "2560X1920",
},
{
id: 12,
name: "3200X2400",
},
{
id: 13,
name: "4000X3000",
},
{
id: 14,
name: "4160X3120",
},
{
id: 15,
name: "4608X3456",
},
2 years ago
{
id: 16,
name: "",
},
{
id: 17,
name: "",
},
{
id: 18,
name: "",
},
{
id: 19,
name: "",
},
{
id: 20,
name: "",
},
2 years ago
], //湖南图像分辨率
zzratiolist: [
{
id: 1,
2 years ago
name: "320X240",
2 years ago
},
{
id: 2,
2 years ago
name: "640X480",
2 years ago
},
{
id: 3,
2 years ago
name: "704X576",
2 years ago
},
{
id: 4,
2 years ago
name: "800X600",
2 years ago
},
{
id: 5,
2 years ago
name: "1024X768",
2 years ago
},
{
id: 6,
2 years ago
name: "1280X1024",
2 years ago
},
{
id: 7,
2 years ago
name: "1280X720",
2 years ago
},
{
id: 8,
2 years ago
name: "1920X1080",
2 years ago
},
{
id: 9,
2 years ago
name: "2560X1440",
2 years ago
},
{
id: 10,
2 years ago
name: "3840X2160",
},
{
id: 11,
name: "",
},
{
id: 12,
name: "",
},
{
id: 13,
name: "",
},
{
id: 14,
name: "",
},
{
id: 15,
name: "",
},
{
id: 16,
name: "",
},
{
id: 17,
name: "",
},
{
id: 18,
name: "",
},
{
id: 19,
name: "",
},
{
id: 20,
name: "",
2 years ago
},
], //郑州图像分辨率
jsratiolist: [
{
id: 1,
2 years ago
name: "320X240",
2 years ago
},
{
id: 2,
2 years ago
name: "640X480",
2 years ago
},
{
id: 3,
2 years ago
name: "704X576",
2 years ago
},
{
id: 4,
2 years ago
name: "720X480 ",
2 years ago
},
{
id: 5,
2 years ago
name: "1280X720",
2 years ago
},
{
id: 6,
2 years ago
name: "1920X1080 ",
2 years ago
},
{
id: 7,
2 years ago
name: "2048X1536",
2 years ago
},
{
id: 8,
2 years ago
name: "2592X1520",
2 years ago
},
{
id: 9,
2 years ago
name: "2592X1944",
2 years ago
},
{
id: 10,
2 years ago
name: "3072X2048",
2 years ago
},
{
id: 11,
2 years ago
name: "3840X2160 ",
2 years ago
},
{
id: 12,
2 years ago
name: "4000X3000",
2 years ago
},
{
id: 13,
2 years ago
name: "4608X3456",
},
{
id: 14,
name: "",
},
{
id: 15,
name: "",
},
{
id: 16,
name: "",
},
{
id: 17,
name: "",
},
{
id: 18,
name: "",
},
{
id: 19,
name: "",
},
{
id: 20,
name: "",
2 years ago
},
], //江苏图像分辨率
ahratiolist: [
{
id: 1,
2 years ago
name: "320X240",
2 years ago
},
{
id: 2,
2 years ago
name: "640X480",
2 years ago
},
{
id: 3,
2 years ago
name: "704X576",
2 years ago
},
{
id: 4,
2 years ago
name: "720 X 480",
2 years ago
},
{
id: 5,
2 years ago
name: "1280X720",
2 years ago
},
{
id: 6,
2 years ago
name: "1920X1080",
},
{
id: 7,
name: "",
},
{
id: 8,
name: "",
},
{
id: 9,
name: "",
},
{
id: 10,
name: "",
},
{
id: 11,
name: "",
},
{
id: 12,
name: "",
},
{
id: 13,
name: "",
},
{
id: 14,
name: "",
},
{
id: 15,
name: "",
},
{
id: 16,
name: "",
},
{
id: 17,
name: "",
},
{
id: 18,
name: "",
},
{
id: 19,
name: "",
},
{
id: 20,
name: "",
2 years ago
},
], //安徽图像分辨率
zhejiangratiolist: [
{
id: 1,
2 years ago
name: "320X240",
2 years ago
},
{
id: 2,
2 years ago
name: "640X480",
2 years ago
},
{
id: 3,
2 years ago
name: "704X576",
2 years ago
},
{
id: 4,
2 years ago
name: "800X600 ",
2 years ago
},
{
id: 5,
2 years ago
name: "1024X768",
2 years ago
},
{
id: 6,
2 years ago
name: "1280X960 ",
2 years ago
},
{
id: 7,
2 years ago
name: "1600X1200",
2 years ago
},
{
id: 8,
2 years ago
name: "1920X1080",
2 years ago
},
{
id: 9,
2 years ago
name: "2048X1536",
2 years ago
},
{
id: 10,
2 years ago
name: "2592X1944",
2 years ago
},
{
id: 11,
2 years ago
name: "2816X2112 ",
2 years ago
},
{
id: 12,
2 years ago
name: "3072X2304",
2 years ago
},
{
id: 13,
2 years ago
name: "3264X2448",
2 years ago
},
{
id: 14,
2 years ago
name: "3456X2592",
2 years ago
},
{
id: 15,
2 years ago
name: "3672X2754",
},
{
id: 16,
name: "",
},
{
id: 17,
name: "",
},
{
id: 18,
name: "",
},
{
id: 19,
name: "",
},
{
id: 20,
name: "",
2 years ago
},
], //浙江
2 years ago
selaccess: "", //选中的通道
capturenr: {}, //查询后的内容
setForm: {}, //设置参数
rules: {
channelId: [{ required: true, message: "请选择通道", trigger: "blur" }],
color: [{ required: true, message: "请选择色彩", trigger: "blur" }],
contrast: [
{ required: true, message: "请输入对比度", trigger: "blur" },
],
luminance: [{ required: true, message: "请输入亮度", trigger: "blur" }],
resolution: [
{ required: true, message: "请选择图像分辨率", trigger: "blur" },
2 years ago
],
saturation: [
{ required: true, message: "请输入饱和度", trigger: "blur" },
],
},
timer: null,
2 years ago
i: 0,
2 years ago
seltermid: "", //装置id
selcmdId: "", //cmdId
requestId: "",
2 years ago
requestid: "",
timer: null,
i: 0,
2 years ago
};
},
mounted() {},
methods: {
handleClick(tab, event) {
console.log(tab, event);
2 years ago
this.capturenr = {};
},
2 years ago
//获取设备通道
getSingleAccess(val) {
this.setForm = {};
console.log(val);
this.seltermid = val.id;
2 years ago
this.selcmdId = val.cmdId;
2 years ago
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) => {});
},
2 years ago
//获取图像分辨率
2 years ago
getRatio(val) {
2 years ago
this.$set(this.setForm, "color", this.colorlist[0].id);
2 years ago
console.log(val);
switch (val.protocol) {
//湖南
case 65283:
this.ratiolist = this.hnratiolist;
break;
//河南
// case 65285:
// days = "星期二";
// break;
//郑州
case 65286:
this.ratiolist = this.zzratiolist;
break;
//江苏
case 65282:
this.ratiolist = this.jsratiolist;
break;
//安徽
case 65281:
this.ratiolist = this.ahratiolist;
break;
//浙江
case 65284:
this.ratiolist = this.zhejiangratiolist;
break;
}
this.$set(this.setForm, "resolution", this.ratiolist[0].id);
// getResolutionRatio({ type: 0 })
// .then((res) => {
// this.ratiolist = this.hnratiolist;
// this.$set(this.setForm, "resolution", res.data.list[0].id);
// })
// .catch((err) => {});
2 years ago
},
2 years ago
2 years ago
//查询触发
inquirebtn() {
this.loading = true;
2 years ago
this.searchloading = true;
2 years ago
getPhotoParamApi({
channelId: this.selaccess,
termId: this.seltermid,
2 years ago
})
.then((res) => {
if (res.code == 200) {
this.requestId = res.data.requestId;
this.inquirenr();
this.timer = window.setInterval(() => {
this.inquirenr();
2 years ago
this.i++;
2 years ago
}, 1000);
2 years ago
} else {
this.$message.error(res.code.msg);
}
})
2 years ago
.catch((err) => {});
},
//查询接口
inquirenr() {
getPhotoParamnrApi({
channelId: this.selaccess,
termId: this.seltermid,
requestId: this.requestId,
})
.then((res) => {
this.loading = false;
if (res.code == 200) {
2 years ago
this.capturenr = res.data;
2 years ago
if (res.data.isNew == true) {
2 years ago
this.searchloading = false;
this.i = 0;
2 years ago
this.$message.success("查询已更新");
clearInterval(this.timer);
2 years ago
this.timer = null;
2 years ago
} else if (this.i > 9) {
2 years ago
this.searchloading = false;
this.i = 0;
2 years ago
this.$message.warning("暂无响应,请稍后再试!");
2 years ago
2 years ago
clearInterval(this.timer);
this.timer = null;
}
} else {
2 years ago
this.$message.error(res.code.msg);
}
2 years ago
})
.catch((err) => {});
},
2 years ago
//确认
submitbtn(setForm) {
this.$set(this.setForm, "cmdId", this.selcmdId);
this.$set(this.setForm, "termId", this.seltermid);
this.$refs[setForm].validate((valid) => {
if (valid) {
setPhotoParamApi(this.setForm)
.then((res) => {
if (res.code == 200) {
this.$message.success("设置成功");
} else {
this.$message.error(res.code.msg);
}
})
.catch((err) => {
this.$message.error("设置失败");
});
} else {
return false;
}
});
},
2 years ago
//命令调用imageSearch
//--act=imgparams [0xC9] --flag=[Request Set Flag, default is set=1, 0: request] --rf=[Request Flag] --channel=[Channel No] --color=[Color Select: 0, 1] --resolution=[Resolution: 1-15 255] --luminance=[Luminance: 1-100] --contrast=[Contrast: 1-100] --saturation=[Saturation: 1-100]
imageSearch() {
this.searchloading = true;
2 years ago
let params = [
{
name: "act",
value: "imgparams",
},
{
name: "flag",
value: 0,
},
{
name: "channel",
value: this.selaccess,
},
{
name: "color",
value: "",
},
{
name: "resolution",
value: "",
},
{
name: "luminance",
value: "",
},
{
name: "contrast",
value: "",
},
{
name: "saturation",
value: "",
},
];
this.setTermFn(params);
},
imageSet(setForm) {
console.log(this.setForm);
this.setloading = true;
2 years ago
let params = [
{
name: "act",
value: "imgparams",
},
{
name: "flag",
value: 1,
},
{
name: "channel",
value: this.setForm.channelId,
},
{
name: "color",
value: this.setForm.color,
},
{
name: "resolution",
value: this.setForm.resolution,
},
{
name: "luminance",
value: this.setForm.luminance,
},
{
name: "contrast",
value: this.setForm.contrast,
},
{
name: "saturation",
value: this.setForm.saturation,
},
];
this.setTermFn(params);
2 years ago
},
2 years ago
setTermFn(dataParams) {
setTermCamera({
termId: this.seltermid,
list: dataParams,
})
.then((res) => {
console.log(res);
this.requestid = res.data.requestId;
//this.getinfo1();
clearInterval(this.timer);
this.timer = window.setInterval(() => {
this.getinfo();
this.i++;
}, 1000);
// this.timer = setInterval(() => {
// this.getinfo();
// this.i++;
// }, 1000);
})
.catch((err) => {});
2 years ago
},
2 years ago
getinfo() {
getTermCameraRequest({ requestid: this.requestid })
.then((res) => {
if (res.data.success == 1) {
window.clearInterval(this.timer);
this.timer = null;
this.i = 0;
console.log("终止轮询");
this.searchloading = false;
this.setloading = false;
2 years ago
// && res.data.result == 255
console.log(JSON.parse(res.data.data));
this.capturenr = JSON.parse(res.data.data);
this.$message({
duration: 1500,
showClose: true,
message: "信息已更新",
type: "success",
});
} else if (this.i > 9) {
window.clearInterval(this.timer);
this.timer = null;
this.i = 0;
this.searchloading = false;
this.setloading = false;
2 years ago
this.$message({
duration: 1500,
showClose: true,
message: "暂未获取到信息,请稍后再试!!",
type: "warning",
});
}
})
.catch();
},
2 years ago
clearform() {
console.log("清除其他数据");
this.capturenr = {};
this.searchloading = false;
this.setloading = false;
2 years ago
},
2 years ago
clearData() {
this.capturenr = {};
this.setForm = {};
this.searchloading = false;
this.setloading = false;
2 years ago
},
2 years ago
},
};
</script>
2 years ago
<style lang="less">
2 years ago
.captureBox {
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
}
2 years ago
.searchImage {
2 years ago
margin-left: 110px;
2 years ago
}
.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
}
2 years ago
.wt280 {
flex: 1;
}
}
2 years ago
.captureForm {
.el-form-item__content {
}
}
2 years ago
}
</style>