Merge branch 'master' of http://47.115.223.229:8888/yangjun/hldy_yunwei_vue
This commit is contained in:
commit
cffec8699a
|
|
@ -508,9 +508,9 @@
|
||||||
margin-top:5px;
|
margin-top:5px;
|
||||||
}
|
}
|
||||||
.selectDiv:hover{
|
.selectDiv:hover{
|
||||||
border: 1px solid #a2a3a3;
|
border: 1px solid #f4f5fa;
|
||||||
background: #a2a3a3;
|
background: #f4f5fa;
|
||||||
color:white;
|
color:#037FEA;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,438 +1,467 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- <j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"> -->
|
<!-- <j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"> -->
|
||||||
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
|
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
|
||||||
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
|
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
|
||||||
<div v-if="showCamera">
|
<div v-if="showCamera">
|
||||||
<CameraPreviewForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></CameraPreviewForm>
|
<CameraPreviewForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false">
|
||||||
|
</CameraPreviewForm>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<view style="display: flex;align-items: center; width: 100%;justify-content: space-between;">
|
<view style="display: flex;align-items: center; width: 100%;justify-content: space-between;">
|
||||||
|
|
||||||
<a-col :span="20" style="text-align: center;margin-top: 15px;margin-bottom: 15px;">
|
<a-col :span="20" style="text-align: center;margin-top: 15px;margin-bottom: 15px;">
|
||||||
<!-- 对讲、停止对讲 切换 -->
|
<!-- 对讲、停止对讲 切换 -->
|
||||||
<!-- <img src="../../../../../assets/iot/monitor_1.png" class="buttonImg"/> -->
|
<!-- <img src="../../../../../assets/iot/monitor_1.png" class="buttonImg"/> -->
|
||||||
<span class="buttonSpan djImg" @click="startPhone" v-show="!izPhone"><span style="margin-left:30px;">对讲</span></span>
|
<span class="buttonSpan djImg" @click="startPhone" v-show="!izPhone"><span
|
||||||
<span class="buttonSpan djImg" @click="stopPhone" v-show="izPhone"><span style="margin-left:30px;">结束</span></span>
|
style="margin-left:30px;">对讲</span></span>
|
||||||
<!-- 流畅、超清 切换 -->
|
<span class="buttonSpan djImg" @click="stopPhone" v-show="izPhone"><span
|
||||||
<span class="buttonSpan qxdImg" @click="switchResolution"><span style="margin-left:30px;">{{ resolution }}</span></span>
|
style="margin-left:30px;">结束</span></span>
|
||||||
<!-- 录制、结束录制 切换 -->
|
<!-- 流畅、超清 切换 -->
|
||||||
<span class="buttonSpan lzImg" @click="recordingStart" v-show="!izRecording"><span style="margin-left:30px;">录制</span></span>
|
<span class="buttonSpan qxdImg" @click="switchResolution"><span style="margin-left:30px;">{{ resolution
|
||||||
<span class="buttonSpan lzImg" @click="recordingEnd" v-show="izRecording"><span style="margin-left:30px;">结束</span></span>
|
}}</span></span>
|
||||||
|
<!-- 录制、结束录制 切换 -->
|
||||||
<span class="buttonSpan jtImg" @click="screenshot"><span style="margin-left:30px;">截图</span></span>
|
<span class="buttonSpan lzImg" @click="recordingStart" v-show="!izRecording"><span
|
||||||
<span class="buttonSpan bjImg" @click="manualAlarm"><span style="margin-left:30px;">报警</span></span>
|
style="margin-left:30px;">录制</span></span>
|
||||||
<a-popover >
|
<span class="buttonSpan lzImg" @click="recordingEnd" v-show="izRecording"><span
|
||||||
<template #content>
|
style="margin-left:30px;">结束</span></span>
|
||||||
<div style="text-align: center;">
|
|
||||||
<div class="selectDiv" @click="setFishEyeDisplayMode('ORIGIN')">原图</div>
|
<span class="buttonSpan jtImg" @click="screenshot"><span style="margin-left:30px;">截图</span></span>
|
||||||
<div class="selectDiv" @click="setFishEyeDisplayMode('FISHEYE_360D')">360全景</div>
|
<span class="buttonSpan bjImg" @click="manualAlarm"><span style="margin-left:30px;">报警</span></span>
|
||||||
<div class="selectDiv" @click="setFishEyeDisplayMode('FISHEYE_180D')">180全景</div>
|
<a-popover>
|
||||||
<div class="selectDiv" @click="setFishEyeDisplayMode('FISHEYE_WIN_PLANE_TOP_QUAD')">四分屏</div>
|
<template #content>
|
||||||
<div class="selectDiv" @click="setFishEyeDisplayMode('FISHEYE_LONGITUDE')">全景拉伸</div>
|
<div style="text-align: center;">
|
||||||
</div>
|
<div class="selectDiv" @click="setFishEyeDisplayMode('ORIGIN')">原图</div>
|
||||||
</template>
|
<div class="selectDiv" @click="setFishEyeDisplayMode('FISHEYE_360D')">360全景</div>
|
||||||
<span class="buttonSpan fpImg"><span style="margin-left:30px;">分屏</span></span>
|
<div class="selectDiv" @click="setFishEyeDisplayMode('FISHEYE_180D')">180全景</div>
|
||||||
</a-popover>
|
<div class="selectDiv" @click="setFishEyeDisplayMode('FISHEYE_WIN_PLANE_TOP_QUAD')">四分屏</div>
|
||||||
<a-popover>
|
<div class="selectDiv" @click="setFishEyeDisplayMode('FISHEYE_LONGITUDE')">全景拉伸</div>
|
||||||
<template #content>
|
</div>
|
||||||
<div style="text-align: center;">
|
</template>
|
||||||
<div class="selectDiv" @click="changeSwitch('flip_type','off')">关闭</div>
|
<span class="buttonSpan fpImg"><span style="margin-left:30px;">分屏</span></span>
|
||||||
<div class="selectDiv" @click="changeSwitch('flip_type','left_and_right')">左右</div>
|
</a-popover>
|
||||||
<div class="selectDiv" @click="changeSwitch('flip_type','up_and_down')">上下</div>
|
<a-popover>
|
||||||
<div class="selectDiv" @click="changeSwitch('flip_type','center')">中心</div>
|
<template #content>
|
||||||
</div>
|
<div style="text-align: center;">
|
||||||
</template>
|
<div class="selectDiv" @click="changeSwitch('flip_type', 'off')">关闭</div>
|
||||||
<span class="buttonSpan hmxzImg"><span style="margin-left:30px;">画面旋转</span></span>
|
<div class="selectDiv" @click="changeSwitch('flip_type', 'left_and_right')">左右</div>
|
||||||
</a-popover>
|
<div class="selectDiv" @click="changeSwitch('flip_type', 'up_and_down')">上下</div>
|
||||||
</a-col>
|
<div class="selectDiv" @click="changeSwitch('flip_type', 'center')">中心</div>
|
||||||
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
|
</div>
|
||||||
</view>
|
</template>
|
||||||
|
<span class="buttonSpan hmxzImg"><span style="margin-left:30px;">画面旋转</span></span>
|
||||||
|
</a-popover>
|
||||||
|
</a-col>
|
||||||
|
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
|
||||||
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
<!-- </j-modal> -->
|
<!-- </j-modal> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import CameraPreviewForm from './CameraPreviewForm.vue'
|
import CameraPreviewForm from './CameraPreviewForm.vue'
|
||||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||||
|
|
||||||
const title = ref<string>('');
|
const title = ref<string>('');
|
||||||
const width = ref<string>('70%');
|
const width = ref<string>('70%');
|
||||||
const visible = ref<boolean>(false);
|
const visible = ref<boolean>(false);
|
||||||
const showCamera = ref<boolean>(false);
|
const showCamera = ref<boolean>(false);
|
||||||
const disableSubmit = ref<boolean>(false);
|
const disableSubmit = ref<boolean>(false);
|
||||||
const registerForm = ref();
|
const registerForm = ref();
|
||||||
const emit = defineEmits(['register', 'success', 'ok']);
|
const emit = defineEmits(['register', 'success', 'ok']);
|
||||||
|
|
||||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||||
import { defHttp } from '@/utils/http/axios';
|
import { defHttp } from '@/utils/http/axios';
|
||||||
import { useMessage } from '@/hooks/web/useMessage';
|
import { useMessage } from '@/hooks/web/useMessage';
|
||||||
import { getValueType } from '@/utils';
|
import { getValueType } from '@/utils';
|
||||||
import { Form } from 'ant-design-vue';
|
import { Form } from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
getImageCommon,
|
getImageCommon,
|
||||||
getMultitransUrl,
|
getMultitransUrl,
|
||||||
getPreviewUrl,
|
getPreviewUrl,
|
||||||
setImageCommon,
|
setImageCommon,
|
||||||
testAudio,
|
testAudio,
|
||||||
motionCtrl
|
motionCtrl
|
||||||
} from "../camera.api";
|
} from "../camera.api";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
formDisabled: { type: Boolean, default: false },
|
formDisabled: { type: Boolean, default: false },
|
||||||
formData: { type: Object, default: () => ({})},
|
formData: { type: Object, default: () => ({}) },
|
||||||
formBpm: { type: Boolean, default: true }
|
formBpm: { type: Boolean, default: true }
|
||||||
});
|
});
|
||||||
|
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const player = ref();
|
const player = ref();
|
||||||
const resolution = ref<string>('流畅');
|
const resolution = ref<string>('流畅');
|
||||||
const izPlaying = ref<boolean>(true);
|
const izPlaying = ref<boolean>(true);
|
||||||
const izRecording = ref<boolean>(false);
|
const izRecording = ref<boolean>(false);
|
||||||
const izPhone = ref<boolean>(false);
|
const izPhone = ref<boolean>(false);
|
||||||
const fishEyeDisplayMode = ref<string>('ORIGIN');
|
const fishEyeDisplayMode = ref<string>('ORIGIN');
|
||||||
const flipType = ref<string>('off');
|
const flipType = ref<string>('off');
|
||||||
const useForm = Form.useForm;
|
const useForm = Form.useForm;
|
||||||
const formData = reactive<Record<string, any>>({
|
const formData = reactive<Record<string, any>>({
|
||||||
|
|
||||||
//预览通道参数
|
//预览通道参数
|
||||||
deviceIndex: '',//设备索引
|
deviceIndex: '',//设备索引
|
||||||
streamType: 1,//码流类型 0 代表主码流,1 代码子码流
|
streamType: 1,//码流类型 0 代表主码流,1 代码子码流
|
||||||
|
|
||||||
//视频预览参数
|
//视频预览参数
|
||||||
url: '',//预览通道对应的URL
|
url: '',//预览通道对应的URL
|
||||||
backupUrl: '',//备选URL,当流媒体服务器存在内外网IP配置时,该字段不为null
|
backupUrl: '',//备选URL,当流媒体服务器存在内外网IP配置时,该字段不为null
|
||||||
wsUrl: '',//用于建立ws连接传输视频帧信息
|
wsUrl: '',//用于建立ws连接传输视频帧信息
|
||||||
wssUrl: '',//用于建立wss接传输视频帧信息
|
wssUrl: '',//用于建立wss接传输视频帧信息
|
||||||
|
|
||||||
flip_type: '',//画面镜像旋转: "off"//关闭 "left_and_right"//左右 "up_and_down"//上下 "center"//中心
|
flip_type: '',//画面镜像旋转: "off"//关闭 "left_and_right"//左右 "up_and_down"//上下 "center"//中心
|
||||||
zoom: 1, //变焦
|
zoom: 1, //变焦
|
||||||
sliderValue : 1,//滑动条的值
|
sliderValue: 1,//滑动条的值
|
||||||
ptz : 0,//是否有云台
|
ptz: 0,//是否有云台
|
||||||
smartCode : 0,//是否可变焦
|
smartCode: 0,//是否可变焦
|
||||||
});
|
});
|
||||||
const { createMessage } = useMessage();
|
const { createMessage } = useMessage();
|
||||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
const confirmLoading = ref<boolean>(false);
|
const confirmLoading = ref<boolean>(false);
|
||||||
|
|
||||||
//表单验证
|
//表单验证
|
||||||
const validatorRules = reactive({
|
const validatorRules = reactive({
|
||||||
});
|
});
|
||||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑
|
|
||||||
* @param record
|
|
||||||
*/
|
|
||||||
|
|
||||||
async function edit(record) {
|
|
||||||
title.value = record.deviceName;
|
|
||||||
showCamera.value = true;
|
|
||||||
visible.value = true;
|
|
||||||
nextTick(() => {
|
|
||||||
registerForm.value.edit(record);
|
|
||||||
});
|
|
||||||
await nextTick(() => {
|
|
||||||
confirmLoading.value=true;
|
|
||||||
resetFields();
|
|
||||||
const tmpData = {};
|
|
||||||
Object.keys(formData).forEach((key) => {
|
|
||||||
if(record.hasOwnProperty(key)){
|
|
||||||
tmpData[key] = record[key]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
//赋值
|
|
||||||
Object.assign(formData, tmpData);
|
|
||||||
});
|
|
||||||
createPreview();
|
|
||||||
getSwitch();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确定按钮点击事件
|
|
||||||
*/
|
|
||||||
function handleOk() {
|
|
||||||
registerForm.value.submitForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* form保存回调事件
|
* 编辑
|
||||||
*/
|
* @param record
|
||||||
function submitCallback() {
|
*/
|
||||||
handleCancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
async function edit(record) {
|
||||||
* 取消按钮回调事件
|
title.value = record.deviceName;
|
||||||
*/
|
showCamera.value = true;
|
||||||
function handleCancel() {
|
visible.value = true;
|
||||||
visible.value = false;
|
nextTick(() => {
|
||||||
nextTick(() => {
|
registerForm.value.edit(record);
|
||||||
registerForm.value.destroy();
|
|
||||||
showCamera.value = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始电话
|
|
||||||
*/
|
|
||||||
function startPhone(){
|
|
||||||
getMultitransUrl({
|
|
||||||
"videoDevId":formData.deviceIndex
|
|
||||||
}).then(res=>{
|
|
||||||
player.value.startVoiceIntercom({
|
|
||||||
"url": res.url, // 该url为一次性 需要通过接口实时获取
|
|
||||||
"wssUrl": res.wssUrl,
|
|
||||||
"mode": "half_duplex"
|
|
||||||
});
|
|
||||||
izPhone.value = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 结束电话
|
|
||||||
*/
|
|
||||||
function stopPhone(){
|
|
||||||
player.value.stopVoiceIntercom();
|
|
||||||
izPhone.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建预览
|
|
||||||
*/
|
|
||||||
async function createPreview(){
|
|
||||||
await getPreviewUrl({"deviceIndex":formData.deviceIndex,"streamType":formData.streamType}).then(res=>{
|
|
||||||
formData.url = res.url;
|
|
||||||
formData.backupUrl = res.backupUrl;
|
|
||||||
formData.wsUrl = res.wsUrl;
|
|
||||||
formData.wssUrl = res.wssUrl;
|
|
||||||
confirmLoading.value=false;
|
|
||||||
});
|
|
||||||
if (player.value){
|
|
||||||
player.value.destroy().then(() => {
|
|
||||||
}); // 销毁
|
|
||||||
player.value = null;
|
|
||||||
}
|
|
||||||
const TumsPlayer = window['tums-player'].default;
|
|
||||||
player.value = new TumsPlayer('video-container-preview', {
|
|
||||||
type: "rtsp", // 协议类型,rtsp
|
|
||||||
url: formData.url, // 取流地址, getPreviewUrl接口获取
|
|
||||||
// url: formData.backupUrl, // 取流地址, getPreviewUrl接口获取
|
|
||||||
socket: formData.wssUrl, // websocket地址, getPreviewUrl接口获取
|
|
||||||
pluginPath: '/static', // 当sdk资源不在根路径下时,需配置pluginPath
|
|
||||||
talkEnable: true,
|
|
||||||
useMultitrans: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
let isPlaying = player.value.isPlaying();
|
|
||||||
if (!isPlaying) {
|
|
||||||
if (player.value.isInit) {
|
|
||||||
player.value.start();
|
|
||||||
} else {
|
|
||||||
player.value.play();
|
|
||||||
}
|
|
||||||
izPlaying.value = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 切换超清/流程
|
|
||||||
*/
|
|
||||||
function switchResolution(){
|
|
||||||
if(formData.streamType == 0){
|
|
||||||
resolution.value = '流畅';
|
|
||||||
formData.streamType = 1;
|
|
||||||
}else{
|
|
||||||
resolution.value = '超清';
|
|
||||||
formData.streamType = 0;
|
|
||||||
}
|
|
||||||
createMessage.info('正在切换至'+resolution.value);
|
|
||||||
createPreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 播放
|
|
||||||
*/
|
|
||||||
function play(){
|
|
||||||
izPlaying.value = true;
|
|
||||||
player.value.play();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 暂停
|
|
||||||
*/
|
|
||||||
function pause(){
|
|
||||||
izPlaying.value = false;
|
|
||||||
player.value.pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 截屏
|
|
||||||
*/
|
|
||||||
function screenshot(){
|
|
||||||
player.value.screenshot();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 鱼眼画面显示模式
|
|
||||||
*/
|
|
||||||
function setFishEyeDisplayMode(value){
|
|
||||||
player.value.setFishEyeDisplayMode(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取画面翻转
|
|
||||||
*/
|
|
||||||
function getSwitch(){
|
|
||||||
if(formData.deviceIndex==null){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
getImageCommon({
|
|
||||||
"deviceIndex": formData.deviceIndex,
|
|
||||||
"type": "switch"
|
|
||||||
}).then(res=>{
|
|
||||||
formData.flip_type = res.flip_type; //画面镜像翻转
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 画面翻转
|
|
||||||
*/
|
|
||||||
function changeSwitch(attr,value){
|
|
||||||
let param = {};
|
|
||||||
param[attr] = value;
|
|
||||||
setImageCommon({
|
|
||||||
"deviceIndex": formData.deviceIndex,
|
|
||||||
"type": "switch",
|
|
||||||
"param": param
|
|
||||||
}).then(res=>{ });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手动报警
|
|
||||||
*/
|
|
||||||
function manualAlarm(){
|
|
||||||
let params = {
|
|
||||||
"deviceIndex": formData.deviceIndex,
|
|
||||||
"force": 1,
|
|
||||||
"id": '0'
|
|
||||||
};
|
|
||||||
testAudio(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始录制
|
|
||||||
*/
|
|
||||||
function recordingStart(){
|
|
||||||
izRecording.value = true;
|
|
||||||
player.value.startRecording({micStream:true}).then((res) => {
|
|
||||||
// 设置成功,返回resolve
|
|
||||||
}).catch((errData) => {
|
|
||||||
// 设置失败,包括网络错误以及接口调用报错
|
|
||||||
// 具体错误见errData.error_code
|
|
||||||
createMessage.error('录制错误,'+errData.msg);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 结束录制
|
|
||||||
*/
|
|
||||||
function recordingEnd(){
|
|
||||||
izRecording.value = false;
|
|
||||||
let fileName = formData.deviceIndex+'-'+(new Date().getTime());
|
|
||||||
player.value.stopRecording(fileName, true).then((res) => {
|
|
||||||
// 设置成功,返回resolve
|
|
||||||
}).catch((errData) => {
|
|
||||||
// 设置失败,包括网络错误以及接口调用报错
|
|
||||||
// 具体错误见errData.error_code
|
|
||||||
createMessage.error('录制错误,'+errData.msg);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
edit,
|
|
||||||
disableSubmit,
|
|
||||||
});
|
});
|
||||||
|
await nextTick(() => {
|
||||||
|
confirmLoading.value = true;
|
||||||
|
resetFields();
|
||||||
|
const tmpData = {};
|
||||||
|
Object.keys(formData).forEach((key) => {
|
||||||
|
if (record.hasOwnProperty(key)) {
|
||||||
|
tmpData[key] = record[key]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//赋值
|
||||||
|
Object.assign(formData, tmpData);
|
||||||
|
});
|
||||||
|
createPreview();
|
||||||
|
getSwitch();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 确定按钮点击事件
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
registerForm.value.submitForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* form保存回调事件
|
||||||
|
*/
|
||||||
|
function submitCallback() {
|
||||||
|
handleCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消按钮回调事件
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
visible.value = false;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.destroy();
|
||||||
|
showCamera.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始电话
|
||||||
|
*/
|
||||||
|
function startPhone() {
|
||||||
|
getMultitransUrl({
|
||||||
|
"videoDevId": formData.deviceIndex
|
||||||
|
}).then(res => {
|
||||||
|
player.value.startVoiceIntercom({
|
||||||
|
"url": res.url, // 该url为一次性 需要通过接口实时获取
|
||||||
|
"wssUrl": res.wssUrl,
|
||||||
|
"mode": "half_duplex"
|
||||||
|
});
|
||||||
|
izPhone.value = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束电话
|
||||||
|
*/
|
||||||
|
function stopPhone() {
|
||||||
|
player.value.stopVoiceIntercom();
|
||||||
|
izPhone.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建预览
|
||||||
|
*/
|
||||||
|
async function createPreview() {
|
||||||
|
await getPreviewUrl({ "deviceIndex": formData.deviceIndex, "streamType": formData.streamType }).then(res => {
|
||||||
|
formData.url = res.url;
|
||||||
|
formData.backupUrl = res.backupUrl;
|
||||||
|
formData.wsUrl = res.wsUrl;
|
||||||
|
formData.wssUrl = res.wssUrl;
|
||||||
|
confirmLoading.value = false;
|
||||||
|
});
|
||||||
|
if (player.value) {
|
||||||
|
player.value.destroy().then(() => {
|
||||||
|
}); // 销毁
|
||||||
|
player.value = null;
|
||||||
|
}
|
||||||
|
const TumsPlayer = window['tums-player'].default;
|
||||||
|
player.value = new TumsPlayer('video-container-preview', {
|
||||||
|
type: "rtsp", // 协议类型,rtsp
|
||||||
|
url: formData.url, // 取流地址, getPreviewUrl接口获取
|
||||||
|
// url: formData.backupUrl, // 取流地址, getPreviewUrl接口获取
|
||||||
|
socket: formData.wssUrl, // websocket地址, getPreviewUrl接口获取
|
||||||
|
pluginPath: '/static', // 当sdk资源不在根路径下时,需配置pluginPath
|
||||||
|
talkEnable: true,
|
||||||
|
useMultitrans: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
let isPlaying = player.value.isPlaying();
|
||||||
|
if (!isPlaying) {
|
||||||
|
if (player.value.isInit) {
|
||||||
|
player.value.start();
|
||||||
|
} else {
|
||||||
|
player.value.play();
|
||||||
|
}
|
||||||
|
izPlaying.value = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换超清/流程
|
||||||
|
*/
|
||||||
|
function switchResolution() {
|
||||||
|
if (formData.streamType == 0) {
|
||||||
|
resolution.value = '流畅';
|
||||||
|
formData.streamType = 1;
|
||||||
|
} else {
|
||||||
|
resolution.value = '超清';
|
||||||
|
formData.streamType = 0;
|
||||||
|
}
|
||||||
|
createMessage.info('正在切换至' + resolution.value);
|
||||||
|
createPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 播放
|
||||||
|
*/
|
||||||
|
function play() {
|
||||||
|
izPlaying.value = true;
|
||||||
|
player.value.play();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂停
|
||||||
|
*/
|
||||||
|
function pause() {
|
||||||
|
izPlaying.value = false;
|
||||||
|
player.value.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 截屏
|
||||||
|
*/
|
||||||
|
function screenshot() {
|
||||||
|
player.value.screenshot();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 鱼眼画面显示模式
|
||||||
|
*/
|
||||||
|
function setFishEyeDisplayMode(value) {
|
||||||
|
player.value.setFishEyeDisplayMode(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取画面翻转
|
||||||
|
*/
|
||||||
|
function getSwitch() {
|
||||||
|
if (formData.deviceIndex == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
getImageCommon({
|
||||||
|
"deviceIndex": formData.deviceIndex,
|
||||||
|
"type": "switch"
|
||||||
|
}).then(res => {
|
||||||
|
formData.flip_type = res.flip_type; //画面镜像翻转
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面翻转
|
||||||
|
*/
|
||||||
|
function changeSwitch(attr, value) {
|
||||||
|
let param = {};
|
||||||
|
param[attr] = value;
|
||||||
|
setImageCommon({
|
||||||
|
"deviceIndex": formData.deviceIndex,
|
||||||
|
"type": "switch",
|
||||||
|
"param": param
|
||||||
|
}).then(res => { });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动报警
|
||||||
|
*/
|
||||||
|
function manualAlarm() {
|
||||||
|
let params = {
|
||||||
|
"deviceIndex": formData.deviceIndex,
|
||||||
|
"force": 1,
|
||||||
|
"id": '0'
|
||||||
|
};
|
||||||
|
testAudio(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始录制
|
||||||
|
*/
|
||||||
|
function recordingStart() {
|
||||||
|
izRecording.value = true;
|
||||||
|
player.value.startRecording({ micStream: true }).then((res) => {
|
||||||
|
// 设置成功,返回resolve
|
||||||
|
}).catch((errData) => {
|
||||||
|
// 设置失败,包括网络错误以及接口调用报错
|
||||||
|
// 具体错误见errData.error_code
|
||||||
|
createMessage.error('录制错误,' + errData.msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束录制
|
||||||
|
*/
|
||||||
|
function recordingEnd() {
|
||||||
|
izRecording.value = false;
|
||||||
|
let fileName = formData.deviceIndex + '-' + (new Date().getTime());
|
||||||
|
player.value.stopRecording(fileName, true).then((res) => {
|
||||||
|
// 设置成功,返回resolve
|
||||||
|
}).catch((errData) => {
|
||||||
|
// 设置失败,包括网络错误以及接口调用报错
|
||||||
|
// 具体错误见errData.error_code
|
||||||
|
createMessage.error('录制错误,' + errData.msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
edit,
|
||||||
|
disableSubmit,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/**隐藏样式-modal确定按钮 */
|
/**隐藏样式-modal确定按钮 */
|
||||||
.jee-hidden {
|
.jee-hidden {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-modal-body {
|
.ant-modal-body {
|
||||||
height: auto !important;
|
height: auto !important;
|
||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.selectDiv{
|
.selectDiv {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid #f6faff;
|
border: 1px solid white;
|
||||||
padding: 3px 10px;
|
padding: 3px 10px;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
margin-top:5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
.selectDiv:hover{
|
|
||||||
border: 1px solid #a2a3a3;
|
.selectDiv:hover {
|
||||||
background: #a2a3a3;
|
border: 1px solid #f4f5fa;
|
||||||
color:white;
|
background: #f4f5fa;
|
||||||
border-radius: 10px;
|
color: #037FEA;
|
||||||
cursor: pointer;
|
border-radius: 10px;
|
||||||
}
|
cursor: pointer;
|
||||||
.buttonSpan{
|
}
|
||||||
display: inline-flex;
|
|
||||||
align-items: flex-end;
|
.buttonSpan {
|
||||||
margin-left: 20px;
|
display: inline-flex;
|
||||||
padding: 6px 6px;
|
align-items: flex-end;
|
||||||
}
|
margin-left: 20px;
|
||||||
.djImg{
|
padding: 6px 6px;
|
||||||
background: url('../../../../../assets/iot/monitor_1.png') left/contain no-repeat;
|
}
|
||||||
}
|
|
||||||
.djImg:hover{
|
.buttonSpan:hover {
|
||||||
background: url('../../../../../assets/iot/monitor_1_1.png') left/contain no-repeat;
|
//border: 1px solid #1ea0fa;
|
||||||
}
|
color: #1ea0fa;
|
||||||
.qxdImg{
|
border-radius: 10px;
|
||||||
background: url('../../../../../assets/iot/monitor_5.png') left/contain no-repeat;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.qxdImg:hover{
|
|
||||||
background: url('../../../../../assets/iot/monitor_5_1.png') left/contain no-repeat;
|
.djImg {
|
||||||
}
|
background: url('../../../../../assets/iot/monitor_1.png') left/contain no-repeat;
|
||||||
.lzImg{
|
}
|
||||||
background: url('../../../../../assets/iot/monitor_4.png') left/contain no-repeat;
|
|
||||||
}
|
.djImg:hover {
|
||||||
.lzImg:hover{
|
background: url('../../../../../assets/iot/monitor_1_1.png') left/contain no-repeat;
|
||||||
background: url('../../../../../assets/iot/monitor_4_1.png') left/contain no-repeat;
|
}
|
||||||
}
|
|
||||||
.jtImg{
|
.qxdImg {
|
||||||
background: url('../../../../../assets/iot/monitor_3.png') left/contain no-repeat;
|
background: url('../../../../../assets/iot/monitor_5.png') left/contain no-repeat;
|
||||||
}
|
}
|
||||||
.jtImg:hover{
|
|
||||||
background: url('../../../../../assets/iot/monitor_3_1.png') left/contain no-repeat;
|
.qxdImg:hover {
|
||||||
}
|
background: url('../../../../../assets/iot/monitor_5_1.png') left/contain no-repeat;
|
||||||
.bjImg{
|
}
|
||||||
background: url('../../../../../assets/iot/monitor_8.png') left/contain no-repeat;
|
|
||||||
}
|
.lzImg {
|
||||||
.bjImg:hover{
|
background: url('../../../../../assets/iot/monitor_4.png') left/contain no-repeat;
|
||||||
background: url('../../../../../assets/iot/monitor_8_1.png') left/contain no-repeat;
|
}
|
||||||
}
|
|
||||||
.fpImg{
|
.lzImg:hover {
|
||||||
background: url('../../../../../assets/iot/monitor_6.png') left/contain no-repeat;
|
background: url('../../../../../assets/iot/monitor_4_1.png') left/contain no-repeat;
|
||||||
}
|
}
|
||||||
.fpImg:hover{
|
|
||||||
background: url('../../../../../assets/iot/monitor_6_1.png') left/contain no-repeat;
|
.jtImg {
|
||||||
}
|
background: url('../../../../../assets/iot/monitor_3.png') left/contain no-repeat;
|
||||||
.hmxzImg{
|
}
|
||||||
background: url('../../../../../assets/iot/monitor_7.png') left/contain no-repeat;
|
|
||||||
}
|
.jtImg:hover {
|
||||||
.hmxzImg:hover{
|
background: url('../../../../../assets/iot/monitor_3_1.png') left/contain no-repeat;
|
||||||
background: url('../../../../../assets/iot/monitor_7_1.png') left/contain no-repeat;
|
}
|
||||||
}
|
|
||||||
|
.bjImg {
|
||||||
|
background: url('../../../../../assets/iot/monitor_8.png') left/contain no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bjImg:hover {
|
||||||
|
background: url('../../../../../assets/iot/monitor_8_1.png') left/contain no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fpImg {
|
||||||
|
background: url('../../../../../assets/iot/monitor_6.png') left/contain no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fpImg:hover {
|
||||||
|
background: url('../../../../../assets/iot/monitor_6_1.png') left/contain no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hmxzImg {
|
||||||
|
background: url('../../../../../assets/iot/monitor_7.png') left/contain no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hmxzImg:hover {
|
||||||
|
background: url('../../../../../assets/iot/monitor_7_1.png') left/contain no-repeat;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<BasicDrawer
|
<BasicDrawer v-bind="$attrs" @register="registerDrawer" :title="getTitle" :width="adaptiveWidth" @ok="handleSubmit"
|
||||||
v-bind="$attrs"
|
:showFooter="showFooter" destroyOnClose>
|
||||||
@register="registerDrawer"
|
<div class="card-class">
|
||||||
:title="getTitle"
|
<BasicForm @register="registerForm"></BasicForm>
|
||||||
:width="adaptiveWidth"
|
</div>
|
||||||
@ok="handleSubmit"
|
|
||||||
:showFooter="showFooter"
|
|
||||||
destroyOnClose
|
|
||||||
>
|
|
||||||
<BasicForm @register="registerForm" ></BasicForm>
|
|
||||||
</BasicDrawer>
|
</BasicDrawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -41,7 +36,7 @@ const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (
|
||||||
setDrawerProps({ confirmLoading: false, showFooter: showFooter.value });
|
setDrawerProps({ confirmLoading: false, showFooter: showFooter.value });
|
||||||
isUpdate.value = !!data?.isUpdate;
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
|
||||||
if(data.records){
|
if (data.records) {
|
||||||
records.value = data.records;
|
records.value = data.records;
|
||||||
let record = data.records[0];
|
let record = data.records[0];
|
||||||
console.log(record);
|
console.log(record);
|
||||||
|
|
@ -57,7 +52,7 @@ const getTitle = computed(() => {
|
||||||
if (!unref(isUpdate)) {
|
if (!unref(isUpdate)) {
|
||||||
return '新增维护设备';
|
return '新增维护设备';
|
||||||
} else {
|
} else {
|
||||||
return unref(showFooter) ? '指定派往机构' : '维护设备详情';
|
return unref(showFooter) ? '指定派往机构' : '详情';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const { adaptiveWidth } = useDrawerAdaptiveWidth();
|
const { adaptiveWidth } = useDrawerAdaptiveWidth();
|
||||||
|
|
@ -79,4 +74,15 @@ async function handleSubmit() {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style lang="less" scoped>
|
||||||
|
.card-class {
|
||||||
|
padding-top: 24px;
|
||||||
|
padding-bottom: 24px;
|
||||||
|
padding-left: 14px;
|
||||||
|
padding-right: 14px;
|
||||||
|
background-color: #fcfdff;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ export const formSchema: FormSchema[] = [
|
||||||
showCount: true,
|
showCount: true,
|
||||||
maxlength: 1000,
|
maxlength: 1000,
|
||||||
autosize:{
|
autosize:{
|
||||||
minRows: 5
|
minRows: 1
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue