更新页面
This commit is contained in:
BIN
src/components/Consultation.zip
Normal file
BIN
src/components/Consultation.zip
Normal file
Binary file not shown.
@ -1,20 +1,31 @@
|
||||
<template>
|
||||
<div class="mt20 flex align-center">
|
||||
<el-input style="width:200px" class="mr10" v-model="keyWoed" placeholder="输入编号"></el-input>
|
||||
<el-button @click="handleBtn('无人机视频')">无人机视频</el-button>
|
||||
<el-button @click="handleBtn('音频')">音频</el-button>
|
||||
</div>
|
||||
<DraggableResizableVue id="call_div" v-model:x="element.x" v-model:y="element.y" v-model:h="element.height" v-model:w="element.width" v-model:active="element.isActive" class="container">
|
||||
<div>
|
||||
<el-row justify="space-around">
|
||||
<a-tag v-for="item in speakers" :key="item.number" bordered color="green">{{ item.alias || item.number }}</a-tag>
|
||||
<el-tag v-for="item in speakers" :key="item.number" bordered color="green">{{ item.alias || item.number }}</el-tag>
|
||||
</el-row>
|
||||
<div id="voice_wave" class="wave"></div>
|
||||
<audio ref="audioRef" :volume="80 / 100" autoplay controls hidden />
|
||||
<video id="video" ref="videoRef" autoplay playsinline :hidden="!showVideo" class="video"/>
|
||||
<video id="localvideo" ref="localvideoRef" autoplay playsinline :hidden="!showlocalVideo" class="video"/>
|
||||
<video id="pushVideo" ref="pushVideoRef" autoplay playsinline :hidden="!showPushlVideo" class="video" />
|
||||
<audio ref="fileAudioRef" autoplay :hidden="true"/>
|
||||
<el-row class="buttonContainer" justify="space-around">
|
||||
<el-button circle @click="setMuteMic">
|
||||
<img v-if="micMuted" src="@/assets/images/webPuc/svgs/microphone.svg" alt="">
|
||||
<img v-else src="@/assets/images/webPuc/svgs/microphone_mute.svg" alt="">
|
||||
</el-button>
|
||||
<el-button circle @click="setMuteEar">
|
||||
<img v-if="earpieceMuted" src="@/assets/images/webPuc/svgs/earpiece.svg" alt="">
|
||||
<img v-else src="@/assets/images/webPuc/svgs/trumpet_mute.svg" alt="">
|
||||
</el-button>
|
||||
<el-button circle @click="camera">
|
||||
<img v-if="cameraOff" src="@/assets/images/webPuc/svgs/camera.svg" alt="">
|
||||
<img v-else src="@/assets/images/webPuc/svgs/camera_mute.svg" alt="">
|
||||
</el-button>
|
||||
<el-button circle @click="transferVideoCall">
|
||||
<img src="@/assets/images/webPuc/svgs/share_video.svg" alt="">
|
||||
</el-button>
|
||||
<el-button :type="selfGranted ? 'success' : 'pramary'" shape="round" @click="applayFloor">话权</el-button>
|
||||
<el-button type="danger" shape="round" @click="hangup">挂断</el-button>
|
||||
</el-row>
|
||||
@ -23,12 +34,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import useCallModule from '@/sdk/call';
|
||||
import useRecorder from '@/hooks/recorder';
|
||||
import useCallModule from '@/components/Consultation/sdk/call';
|
||||
import useRecorder from '@/components/Consultation/hooks/recorder';
|
||||
import DraggableResizableVue from "draggable-resizable-vue3";
|
||||
import { nextTick, onMounted, onUnmounted, ref } from "vue";
|
||||
import { nextTick, onMounted, onUnmounted, ref, defineProps, defineEmits } from "vue";
|
||||
import SiriWave from "siriwave";
|
||||
import { init } from "echarts";
|
||||
const props = defineProps({
|
||||
modelValue:Boolean,
|
||||
})
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const baseInfo = localStorage.getItem('rhInfo') ? JSON.parse(localStorage.getItem('rhInfo')) : {};
|
||||
let waveContainer;
|
||||
let audioWave = SiriWave || undefined;
|
||||
const element = ref({
|
||||
@ -42,16 +57,16 @@ let rootView;
|
||||
let streamCbId;
|
||||
let hangupCbId;
|
||||
let grantCbId;
|
||||
const micMuted = ref(false);
|
||||
const earpieceMuted = ref(false);
|
||||
const cameraOff = ref(false);
|
||||
|
||||
// 本端视频流 local video stream
|
||||
let localVideoStream;
|
||||
// 远端视频流 remote video stream
|
||||
let remoteVideoStream;
|
||||
|
||||
const selfGranted = ref(false);
|
||||
// 54040254001310305009 视频
|
||||
// 38467417 音频
|
||||
const keyWoed = ref('38467417') //关键字
|
||||
|
||||
|
||||
// 是否 半双工用一个Video来显示远端流和本地流。 true 为 共用一个video。 false 为 2个video,分别显示。
|
||||
const useOneVideoShow = true;
|
||||
@ -65,16 +80,41 @@ const showVideo = ref(false);
|
||||
|
||||
const localvideoRef = ref(); // 本端Video
|
||||
const showlocalVideo = ref(false); // 显示本端流
|
||||
|
||||
const fileAudioRef = ref();
|
||||
const pushVideoRef = ref();
|
||||
// 显示推送流 show push video
|
||||
const showPushlVideo = ref(false);
|
||||
|
||||
const showPanel = ref(false);
|
||||
const speakers = ref([]);
|
||||
|
||||
const codeId = ref(null)
|
||||
|
||||
// 54040254001310305009 视频
|
||||
// 38467417 对讲机
|
||||
const keyWoed = ref('38467417') //关键字
|
||||
|
||||
const setMuteMic = () => {
|
||||
CALL.setMuteMic(!micMuted.value).then((resp) => {
|
||||
console.log('mute mic result ', resp);
|
||||
micMuted.value = !micMuted.value;
|
||||
});
|
||||
};
|
||||
const setMuteEar = () => {
|
||||
CALL.setMuteCall(!earpieceMuted.value);
|
||||
earpieceMuted.value = !earpieceMuted.value;
|
||||
};
|
||||
|
||||
const camera = () => {
|
||||
CALL.setMuteCamera(!cameraOff.value).then((resp) => {
|
||||
console.log('mute camera result ', resp);
|
||||
cameraOff.value = !cameraOff.value;
|
||||
});
|
||||
};
|
||||
|
||||
const transferVideoCall = () => {
|
||||
// CALL.forwardVideoCall();
|
||||
};
|
||||
|
||||
|
||||
// 处理按钮
|
||||
const handleBtn = (type) =>{
|
||||
@ -83,21 +123,20 @@ const handleBtn = (type) =>{
|
||||
lemon.basedata.fetchDeviceList(params).then(resp => {
|
||||
if(resp.device_list[0].basedata_id){
|
||||
let basedata_id = resp.device_list[0].basedata_id
|
||||
debugger
|
||||
switch(type){
|
||||
case '无人机视频':
|
||||
case '无人机':
|
||||
let obj = { basedata_id , video_frame_size: 3, hook_flag: 0 }
|
||||
window.lemon.call.makeVideoCall(obj)?.then((resp) => {
|
||||
console.log('无人机视频', resp);
|
||||
console.log('无人机', resp);
|
||||
codeId.value = resp.call_id
|
||||
});
|
||||
break;
|
||||
case '音频':
|
||||
let obj1 = { basedata_id,"hook_flag":0 }
|
||||
window.lemon.call.makeVoiceCall(obj1)?.then((resp) => {
|
||||
console.log('音频', resp);
|
||||
codeId.value = resp.call_id
|
||||
});
|
||||
case '对讲机':
|
||||
let obj1 = { basedata_id,"hook_flag":0,"duplex_flag":0 }
|
||||
CALL.makeVoiceCall(obj1)
|
||||
// window.lemon.call.makeVoiceCall(obj1)?.then((resp) => {
|
||||
// codeId.value = resp.call_id
|
||||
// });
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -109,7 +148,6 @@ const handleBtn = (type) =>{
|
||||
const registerStream = () => {
|
||||
streamCbId = window.lemon.call.addMediaStream((call_id, stream, type) => {
|
||||
console.log(type,'============监听播放类型');
|
||||
showPanel.value = true;
|
||||
rootView.style.display = 'unset';
|
||||
if (type === 'audio_dst') {
|
||||
setAudio(stream);
|
||||
@ -140,6 +178,7 @@ const registerStream = () => {
|
||||
};
|
||||
|
||||
const setAudio = (stream) => {
|
||||
console.log(audioRef.value);
|
||||
if (audioRef.value) {
|
||||
audioRef.value.srcObject = stream;
|
||||
} else {
|
||||
@ -149,13 +188,13 @@ const setAudio = (stream) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 挂断事件(包含主叫挂断和被叫挂断)
|
||||
const registerhangupEvent = () => {
|
||||
hangupCbId = window.lemon.call.addHangupEvt(() => {
|
||||
speakers.value.length = 0;
|
||||
selfGranted.value = false;
|
||||
showVideo.value = false;
|
||||
showlocalVideo.value = false;
|
||||
showPanel.value = false;
|
||||
try {
|
||||
videoRef.value.pause();
|
||||
} catch (error) {
|
||||
@ -205,14 +244,13 @@ const registerGrantEvent = () => {
|
||||
|
||||
|
||||
const close = () => {
|
||||
if (rootView) {
|
||||
rootView.style.display = 'none';
|
||||
}
|
||||
console.log('=======关闭');
|
||||
if (rootView) rootView.style.display = 'none';
|
||||
};
|
||||
|
||||
const applayFloor = () => {
|
||||
const self = sessionStorage.getItem('user_id');
|
||||
const index = speakers.value?.findIndex((item) => item.number === self);
|
||||
const index = speakers.value?.findIndex((item) => item.number === baseInfo.basedata_id);
|
||||
console.log( index,'-1','=== speakers.value');
|
||||
if (index >= 0) {
|
||||
CALL.releaseFloor();
|
||||
} else {
|
||||
@ -221,41 +259,10 @@ const applayFloor = () => {
|
||||
};
|
||||
|
||||
const hangup = () => {
|
||||
emit('update:modelValue',false)
|
||||
CALL.hangup(codeId.value);
|
||||
};
|
||||
|
||||
|
||||
const Init = () => {
|
||||
let token = window.localStorage.getItem("rhToken");
|
||||
if (!token) {
|
||||
let userInfo = {
|
||||
username: "sgxtcs",
|
||||
password: "123456",
|
||||
realm: "puc.com",
|
||||
webpucUrl: "https://89.40.9.95:16888"
|
||||
};
|
||||
lemon.login.login(userInfo).then((esacpe) => {
|
||||
token = esacpe.token;
|
||||
window.localStorage.setItem("rhToken", esacpe.token);
|
||||
});
|
||||
} else {
|
||||
ConnectWebsocket(token);
|
||||
}
|
||||
};
|
||||
|
||||
const ConnectWebsocket = (token) => {
|
||||
lemon.login.reConnectWebsocket({
|
||||
username: "sgxtcs",
|
||||
realm: "puc.com",
|
||||
webpucUrl: "https://89.40.9.95:16888",
|
||||
token: token
|
||||
}).then((resp) => {
|
||||
console.log(resp,"ConnectWebsocket")
|
||||
window.lemon.call.addMediaStream((call_id, stream, type) => {
|
||||
console.log(call_id, stream, type);
|
||||
});
|
||||
});
|
||||
};
|
||||
const initWave = () => {
|
||||
if (!waveContainer) {
|
||||
waveContainer = document.getElementById('voice_wave');
|
||||
@ -277,17 +284,17 @@ const initVideo = () => {
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
Init();
|
||||
registerStream();
|
||||
registerhangupEvent();
|
||||
registerGrantEvent();
|
||||
nextTick(() => {
|
||||
videoRef.value.onloadedmetadata = initVideo;
|
||||
initWave();
|
||||
});
|
||||
|
||||
rootView = document.getElementById('call_div');
|
||||
window.video = pushVideoRef.value;
|
||||
window.audio = fileAudioRef.value;
|
||||
window.showVideo = showPushlVideo;
|
||||
window.videoViewRoot = rootView;
|
||||
|
||||
@ -297,6 +304,7 @@ onUnmounted(() => {
|
||||
window.lemon.call.removeHangupEvt(hangupCbId);
|
||||
window.lemon.floor.removeGrantEvt(grantCbId);
|
||||
});
|
||||
defineExpose({ handleBtn });
|
||||
|
||||
</script>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script setup>
|
||||
import { toRef } from 'vue';
|
||||
import { Button } from 'element-plus';
|
||||
import useCallModule from '@/views/consultation/sdk/call';
|
||||
import useCallModule from '@/components/Consultation/sdk/call';
|
||||
|
||||
const props = defineProps({
|
||||
answer: {
|
||||
@ -1,7 +1,7 @@
|
||||
import { ref, onUnmounted } from 'vue';
|
||||
import { ElNotification } from 'element-plus';
|
||||
import emitter from "@/utils/eventBus.js";
|
||||
import useConferenceControlModule from '@/views/consultation/sdk/conferenceControl';
|
||||
import useConferenceControlModule from '@/components/Consultation/sdk/conferenceControl';
|
||||
import store from '@/store'
|
||||
|
||||
const sdkConfernceControlModule = useConferenceControlModule();
|
||||
@ -1,7 +1,7 @@
|
||||
import { ref, getCurrentInstance, onUnmounted } from 'vue';
|
||||
import { ElNotification } from 'element-plus';
|
||||
import { ConferenceCallingNotification } from '@/views/consultation/hooks/callingNotification';
|
||||
import useConfernceModule from '@/views/consultation/sdk/conference';
|
||||
import { ConferenceCallingNotification } from '@/components/Consultation/hooks/callingNotification';
|
||||
import useConfernceModule from '@/components/Consultation/sdk/conference';
|
||||
import store from '@/store'
|
||||
import emitter from "@/utils/eventBus.js";
|
||||
|
||||
@ -175,10 +175,10 @@ import MicPop from './micPop.vue';
|
||||
import emitter from "@/utils/eventBus.js";
|
||||
// import MemberMangerModal from '../memberMangerModal/index.vue';
|
||||
import { nextTick, onMounted,defineEmits,defineExpose,onUnmounted,defineProps, ref, getCurrentInstance, computed, watch } from 'vue';
|
||||
import useConferenceControlModule, { CONFERENCE_ROLE_NORMAL, CONFERENCE_ROLE_HOST, MICROPHONE_STATUS_NO, MICROPHONE_STATUS_OPEN, MICROPHONE_STATUS_CLOSE, MUTE_STATUS_Y, PROHIBITION_STATUS_Y, PROHIBITION_STATUS_N, MUTE_STATUS_N, CAMERA_STATUS_NO, CAMERA_STATUS_OPEN, CAMERA_STATUS_CLOSE } from '@/views/consultation/sdk/conferenceControl';
|
||||
import useConferenceControlModule, { CONFERENCE_ROLE_NORMAL, CONFERENCE_ROLE_HOST, MICROPHONE_STATUS_NO, MICROPHONE_STATUS_OPEN, MICROPHONE_STATUS_CLOSE, MUTE_STATUS_Y, PROHIBITION_STATUS_Y, PROHIBITION_STATUS_N, MUTE_STATUS_N, CAMERA_STATUS_NO, CAMERA_STATUS_OPEN, CAMERA_STATUS_CLOSE } from '@/components/Consultation/sdk/conferenceControl';
|
||||
import { ElMessage} from "element-plus";
|
||||
import DraggableResizableVue from 'draggable-resizable-vue3';
|
||||
import useConferenceModule from '@/views/consultation/sdk/conference';
|
||||
import useConferenceModule from '@/components/Consultation/sdk/conference';
|
||||
import useConfernceControlEvent from './js/useConfernceControlEvent';
|
||||
import { useStore } from "vuex";
|
||||
const props = defineProps({
|
||||
@ -760,6 +760,7 @@ onUnmounted(() => {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
margin: 2px;
|
||||
background: rgb(28,32,41);
|
||||
border: 2px dashed #e8e8e8;
|
||||
@ -1,55 +1,33 @@
|
||||
|
||||
<template>
|
||||
<div class="meeting-box">
|
||||
<ul class="meun">
|
||||
<li class="item">
|
||||
<span>会商</span>
|
||||
<span class="edg"></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="list-box">
|
||||
<div class="tr">
|
||||
<el-popover placement="bottom" :width="80" trigger="click">
|
||||
<template #reference>
|
||||
<el-button>新增</el-button>
|
||||
</template>
|
||||
<div class="lh30 f12 pointer" v-for="item in LIST_DATA" :key="item.value" @click="chooseItem(item)">
|
||||
{{item.label}}
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
<div class="list">
|
||||
<!-- 调度台、临时组 -->
|
||||
<el-collapse v-model="activeName">
|
||||
<el-collapse-item v-for="item in LIST_DATA_TREE" :key="item.value" :title="item.label" :name="item.label">
|
||||
<ul>
|
||||
<li class="lh30" v-for="(it,idx) in meetList" :key="idx" @click="joinMeeting(it)">{{ it.subject }}</li>
|
||||
</ul>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cnt"></div>
|
||||
</div>
|
||||
<!-- 音视频会议 -->
|
||||
<AudioAndVoice v-model="showDailog" v-if="showDailog" @save="saveData"></AudioAndVoice>
|
||||
<!-- 无人机拖动视频 -->
|
||||
<DraggerAble v-if="showVideo" v-model="showVideo" ref="RefEqripment"></DraggerAble>
|
||||
<!-- 新增音视频会议 -->
|
||||
<AudioAndVoice v-model="showDailog" v-if="showDailog"></AudioAndVoice>
|
||||
<!-- 音视频会议窗口 -->
|
||||
<MeetingView v-model="openMeeting" v-if="openMeeting" ></MeetingView>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { timeValidate } from '@/utils/tools'
|
||||
import DraggerAble from './components/draggerAble.vue'
|
||||
import useConfernceEvent from './components/js/useConfernceEvent';
|
||||
import { ElMessage,ElMessageBox,ElNotification } from "element-plus";
|
||||
import useBaseDataModule from '@/components/Consultation/sdk/baseData';
|
||||
import AudioAndVoice from './components/audioAndVoice.vue'
|
||||
import MeetingView from './components/meetingView.vue'
|
||||
import { computed , nextTick, onMounted, ref} from 'vue';
|
||||
import { defineExpose , nextTick, onMounted, onUnmounted, ref} from 'vue';
|
||||
import { useStore } from "vuex";
|
||||
const modleType = ref('')
|
||||
const store = useStore();
|
||||
const showDailog = ref(false)
|
||||
const sdkBDModule = useBaseDataModule();
|
||||
const baseInfo = localStorage.getItem('rhInfo') ? JSON.parse(localStorage.getItem('rhInfo')) : {};
|
||||
const showVideo = ref(false)//拖动视频
|
||||
const showDailog = ref(false)//showDailog
|
||||
const openMeeting = ref(false) //打开会议
|
||||
const activeName = ref('音视频会议')
|
||||
const tempModalType = ref('') //点击类型
|
||||
const jsonData = ref('');
|
||||
const loginStatusCallbackId = ref() //token监听状态
|
||||
const RefEqripment = ref()
|
||||
const meetList = ref([
|
||||
{
|
||||
"basedata_id": "8180e3882a0c27f4d3ba998b3dc95c0d280d8e2e7a9d53e4ac36c7ade2c76653",
|
||||
@ -106,96 +84,51 @@ const meetList = ref([
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
// 临时组类别列表
|
||||
const LIST_DATA = computed(() => {
|
||||
return [
|
||||
// 音视频会议
|
||||
{
|
||||
label: '音视频会议',
|
||||
value: 8,
|
||||
// component: AdvancedConference,
|
||||
isOpenRoot: ref(false),
|
||||
isLoading: ref(false),
|
||||
},
|
||||
// 拨号入会
|
||||
{
|
||||
label: '进入会议',
|
||||
value: 9,
|
||||
component: null,
|
||||
isOpenRoot: ref(false),
|
||||
isLoading: ref(false),
|
||||
},
|
||||
// 快速会议
|
||||
{
|
||||
label: '快速会议',
|
||||
value: 10,
|
||||
component: null,
|
||||
isOpenRoot: ref(false),
|
||||
isLoading: ref(false),
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
const LIST_DATA_TREE = computed(() => {
|
||||
return LIST_DATA.value.filter((v) => ![9, 10].includes(v.value));
|
||||
});
|
||||
|
||||
|
||||
function chooseItem (val) {
|
||||
tempModalType.value = val.value;
|
||||
switch(val.label){
|
||||
case '音视频会议':
|
||||
showDailog.value = true
|
||||
break;
|
||||
}
|
||||
// n 推迟几分钟 - 不传默认10
|
||||
const handleTime = (n=10) =>{
|
||||
var currentDate = new Date();
|
||||
var preDate = new Date(currentDate.getTime() + n * 60 * 1000)
|
||||
let time = timeValidate(preDate);
|
||||
return new Date(time).toISOString()
|
||||
}
|
||||
|
||||
function saveData (data){
|
||||
switch(tempModalType.value){
|
||||
case 8:
|
||||
console.info('-----------音视频会议-----------');
|
||||
conferenceActionSDK(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create or update conference
|
||||
*/
|
||||
const conferenceActionSDK = async (record ) => {
|
||||
// 创建会议
|
||||
const conferenceActionSDK = async (record ) => {
|
||||
const createRes = await lemon.conference.createConference({
|
||||
subject: record.subject, //主题
|
||||
subject: record.glxsmc, //主题
|
||||
type: 1, //会议类型 0=即时会议,1=预约会议
|
||||
emergency_flag: 0, //会议紧急标识 0 = 非紧急会议,1 = 紧急会议
|
||||
duration: Number(record.duration), //预计时长 (分钟)
|
||||
pre_alarm_time: record.alarm, //提前通知时间(分钟)
|
||||
remark: record.remark,
|
||||
appointment: '2025-12-10T14:57:24Z', // start_date 和 start_time 对应的 UTC 时间
|
||||
members:record.members,
|
||||
duration: 60, //预计时长 (分钟)
|
||||
pre_alarm_time: 10, //提前通知时间(分钟)
|
||||
remark: '',
|
||||
appointment: handleTime(), // start_date 和 start_time 对应的 UTC 时间
|
||||
members:[
|
||||
{
|
||||
alias:baseInfo.dispatcher_name,
|
||||
basedata_id:baseInfo.basedata_id,
|
||||
guid:baseInfo.user_guid,
|
||||
number:baseInfo.user_id,
|
||||
}
|
||||
],//当前创建人
|
||||
});
|
||||
console.log(createRes,'===========创建的会议');
|
||||
if (createRes.result === 0) {
|
||||
ElMessage.success(jsonData.value['data']['conference.book.result.ok']);
|
||||
fetchConferences()
|
||||
record.number = createRes.meeting.number;
|
||||
enterConferenceByNumber(record) //进入会议
|
||||
} else {
|
||||
ElMessage.error(jsonData.value['errorCode'][createRes?.result]);
|
||||
}
|
||||
};
|
||||
|
||||
// 加入会议
|
||||
const joinMeeting = (it) =>{
|
||||
ElMessageBox.confirm('确定开始会议?','提示',{
|
||||
confirmButtonText:'确定',
|
||||
cancelButtonText:'取消',
|
||||
type:'warning',
|
||||
}).then(res=>{
|
||||
// 通过会议编号进入会议
|
||||
const enterConferenceByNumber = (it) =>{
|
||||
openMeeting.value = true;
|
||||
nextTick(()=>{
|
||||
let params = {
|
||||
"number": it.number,
|
||||
"nick": it.subject,
|
||||
"mute_status": it.status,
|
||||
"nick": it.glxsmc,
|
||||
"mute_status": 0,
|
||||
"microphone_status": 1,
|
||||
"camera_status": 1
|
||||
}
|
||||
@ -205,18 +138,16 @@ const joinMeeting = (it) =>{
|
||||
console.log(err,' 加入会议失败......');
|
||||
})
|
||||
})
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// 获取会议
|
||||
const fetchConferences = () =>{
|
||||
const fetchConferences = (it) =>{
|
||||
lemon.conference.fetchConferences().then(res=> {
|
||||
console.log(res.conferenceList,'获取会议');
|
||||
meetList.value = res.conferenceList;
|
||||
activeName.value = '音视频会议'
|
||||
let obj = meetList.value.find(v=>v.number == it.number);
|
||||
// 会议存在 ? 进入会议 : 创建会议 ;
|
||||
obj ? enterConferenceByNumber(it) : conferenceActionSDK(it) ;
|
||||
}).catch(err=> {})
|
||||
}
|
||||
|
||||
@ -233,10 +164,7 @@ const Init = () => {
|
||||
lemon.login.login(userInfo).then((esacpe) => {
|
||||
token = esacpe.token;
|
||||
window.localStorage.setItem("rhToken", esacpe.token);
|
||||
getLoginAccountInfo();
|
||||
fetchConferences()
|
||||
// 注册会议管理相关事件
|
||||
useConfernceEvent()
|
||||
listenerEvents()
|
||||
});
|
||||
} else {
|
||||
ConnectWebsocket(token);
|
||||
@ -251,17 +179,27 @@ const ConnectWebsocket = (token) => {
|
||||
token: token
|
||||
}).then((resp) => {
|
||||
if(resp.result != 0){
|
||||
ElMessage.error(jsonData.value['errorCode'][resp.result]);
|
||||
exsit()
|
||||
localStorage.removeItem('rhToken')
|
||||
localStorage.removeItem('user_basedata_id')
|
||||
let messge = jsonData.value['errorCode'][resp.result] +',请重新刷新页面'
|
||||
ElMessage.error(messge);
|
||||
lemon.login.logout().then(res=> {}).catch(err=> {})
|
||||
}else{
|
||||
getLoginAccountInfo()
|
||||
fetchConferences()
|
||||
// 注册会议管理相关事件
|
||||
useConfernceEvent()
|
||||
listenerEvents();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化后需要监听的方法
|
||||
const listenerEvents = () =>{
|
||||
getLoginAccountInfo() //前账号的登录信息
|
||||
useConfernceEvent()// 注册会议管理相关事件
|
||||
// 无人机对讲机的监听时事件
|
||||
window.lemon.call.addMediaStream((call_id, stream, type) => {
|
||||
console.log(call_id, stream, type,'=======无人机对讲机的监听时事件==');
|
||||
});
|
||||
}
|
||||
|
||||
const getLoginAccountInfo =() =>{
|
||||
lemon.login.getLoginAccountInfo().then(res => {
|
||||
let info = JSON.stringify(res.account_info)
|
||||
@ -272,24 +210,44 @@ const getLoginAccountInfo =() =>{
|
||||
})
|
||||
}
|
||||
|
||||
const exsit = () =>{
|
||||
lemon.login.logout().then(res=> {
|
||||
|
||||
}).catch(err=> {
|
||||
// 加入会议
|
||||
const openInit = (it,type) =>{
|
||||
modleType.value = type;
|
||||
if(type == '会议'){
|
||||
// 判断是否有会议号
|
||||
let into = it.number ? '确定开始会议?' : '没有找到会议,是否创建会议?'
|
||||
ElMessageBox.confirm(into,'提示',{
|
||||
confirmButtonText:'确定',
|
||||
cancelButtonText:'取消',
|
||||
type:'warning',
|
||||
}).then(res=>{
|
||||
// 会议号存在 ? 获取会议列表里面是否包含该条会议 : 创建会议 ;
|
||||
it.number ? fetchConferences(it) : conferenceActionSDK(it);
|
||||
}).catch(()=>{ })
|
||||
}
|
||||
|
||||
if(['对讲机','无人机'].includes(type)){
|
||||
showVideo.value = true;
|
||||
nextTick(()=>{
|
||||
RefEqripment.value.handleBtn(type)
|
||||
})
|
||||
}
|
||||
|
||||
function changeCooll () {
|
||||
|
||||
}
|
||||
|
||||
|
||||
onMounted(()=>{
|
||||
jsonData.value = require('./components/zh_CN.json');
|
||||
nextTick(()=>{
|
||||
Init();
|
||||
})
|
||||
});
|
||||
|
||||
onUnmounted(()=>{
|
||||
// 页面关闭时卸载
|
||||
lemon.login.removeLoginStatusChangeListener(loginStatusCallbackId.value);
|
||||
})
|
||||
|
||||
defineExpose({openInit});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@ -1,9 +1,9 @@
|
||||
import { h } from 'vue';
|
||||
import { ElNotification} from "element-plus";
|
||||
import { IconClose } from "element-plus"
|
||||
import Content from '@/views/consultation/components/content.vue';
|
||||
import Footer from '@/views/consultation/components/footer.vue';
|
||||
import { formatShowNameFin } from '@/views/consultation/utils/format-show-name';
|
||||
import Content from '@/components/Consultation/components/content.vue';
|
||||
import Footer from '@/components/Consultation/components/footer.vue';
|
||||
import { formatShowNameFin } from '@/components/Consultation/utils/format-show-name';
|
||||
|
||||
export default function handleCallingNotification(propsObj) {
|
||||
const { callInfo, text } = propsObj;
|
||||
@ -79,7 +79,7 @@ div(
|
||||
<script lang="ts" setup>
|
||||
import tableColAvatar from '@/views/webPuc/org/components/tableColAvatarByNumType.vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { formatShowNameFin } from '@/views/consultation/utils/format-show-name';
|
||||
import { formatShowNameFin } from '@/components/Consultation/utils/format-show-name';
|
||||
import { $t } from '@/locale';
|
||||
import { useGlobalStore } from '@/store';
|
||||
import {
|
||||
@ -93,7 +93,7 @@ div(
|
||||
CAMERA_STATUS_CLOSE,
|
||||
CONFERENCE_MEMBER_STATE_CALLING,
|
||||
PROHIBITION_STATUS_N,
|
||||
} from '@/views/consultation/sdk/conferenceControl';
|
||||
} from '@/components/Consultation/sdk/conferenceControl';
|
||||
|
||||
const globalStore = useGlobalStore();
|
||||
|
||||
@ -115,6 +115,7 @@ a-modal(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import { $t } from '@/locale';
|
||||
import useCallModule from '@/sdk/call';
|
||||
import useBaseDataModule from '@/components/Consultation/sdk/baseData';
|
||||
import useConferenceControlModule, {
|
||||
CONFERENCE_ROLE_NORMAL,
|
||||
CONFERENCE_ROLE_HOST,
|
||||
@ -126,8 +127,8 @@ a-modal(
|
||||
CAMERA_STATUS_NO,
|
||||
CAMERA_STATUS_OPEN,
|
||||
CAMERA_STATUS_CLOSE,
|
||||
} from '@/views/consultation/sdk/conferenceControl';
|
||||
import useConferencModule from '@/views/consultation/sdk/conferenceControl';
|
||||
} from '@/components/Consultation/sdk/conferenceControl';
|
||||
import useConferencModule from '@/components/Consultation/sdk/conferenceControl';
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import UserItem from './components/UserItem.vue';
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
@ -191,6 +192,7 @@ a-modal(
|
||||
|
||||
const CALL = useCallModule();
|
||||
|
||||
const useBDModule = useBaseDataModule();
|
||||
const conferenceControlModule = useConferenceControlModule();
|
||||
const conferenceModule = useConferencModule();
|
||||
|
||||
@ -159,11 +159,6 @@ export const publicRoutes = [
|
||||
name: "home",
|
||||
component: () => import("@/views/home/index") //系统登录
|
||||
},
|
||||
{
|
||||
path: "/consultation",
|
||||
name: "consultation",
|
||||
component: () => import("@/views/consultation/demo")
|
||||
},
|
||||
{
|
||||
path: "/KeyPopulations",
|
||||
name: "KeyPopulations",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { CONFERENCE_ROLE_NORMAL } from '@/views/consultation/sdk/conferenceControl';
|
||||
import { CONFERENCE_ROLE_NORMAL } from '@/components/Consultation/sdk/conferenceControl';
|
||||
export default {
|
||||
id: 'global',
|
||||
state: () => ({
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
<template>
|
||||
<div class="titleBox">
|
||||
<PageTitle title="网上会议室">
|
||||
<PageTitle title="网上会议室55">
|
||||
<el-button type="primary" @click="addEdit('add', '')">
|
||||
<el-icon style="vertical-align: middle"><CirclePlus /></el-icon>
|
||||
<span style="vertical-align: middle">新增</span>
|
||||
</el-button>
|
||||
<el-button type="primary" @click="openDemo">
|
||||
<span style="vertical-align: middle">DEMO</span>
|
||||
</el-button>
|
||||
</PageTitle>
|
||||
</div>
|
||||
<div ref="searchBox">
|
||||
@ -32,7 +29,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-button type="primary" size="small" @click="joinMeeting(item)">加入会议</el-button>
|
||||
<el-button type="primary" size="small" @click="joinMeeting(item,'会议')">加入会议</el-button>
|
||||
<el-button type="primary" size="small">反馈情况</el-button>
|
||||
<el-button type="primary" size="small">处置下发</el-button>
|
||||
</div>
|
||||
@ -71,13 +68,14 @@
|
||||
<ConferenceRoom v-model="conferenceRoomVisible" titleValue="会议详情" />
|
||||
|
||||
<!-- 音视频会议窗口 -->
|
||||
<MeetingView v-model="openMeeting" v-if="openMeeting" ></MeetingView>
|
||||
<MeetingView ref="refMeetingView"></MeetingView>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import MeetingView from '@/components/Consultation/demo.vue'
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import * as MOSTY from "@/components/MyComponents/index";
|
||||
import MeetingView from "@/views/consultation/components/meetingView.vue";
|
||||
import PageTitle from "@/components/aboutTable/PageTitle.vue";
|
||||
import Pages from "@/components/aboutTable/Pages.vue";
|
||||
import Search from "@/components/aboutTable/Search.vue";
|
||||
@ -93,6 +91,7 @@
|
||||
const detailDiloag = ref();
|
||||
const searchBox = ref(); //搜索框
|
||||
const openMeeting = ref(false); // 打开会议窗口
|
||||
const refMeetingView = ref()
|
||||
const searchConfiger = ref([
|
||||
{
|
||||
label: "会议主题",
|
||||
@ -119,7 +118,7 @@
|
||||
});
|
||||
const jsonData = ref('')
|
||||
onMounted(() => {
|
||||
jsonData.value = require('@/views/consultation/components/zh_CN.json');
|
||||
jsonData.value = require('@/components/Consultation/components/zh_CN.json');
|
||||
nextTick(()=>{
|
||||
Init();
|
||||
})
|
||||
@ -186,12 +185,6 @@ const exsit = () =>{
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function openDemo() {
|
||||
const NPShref = router.resolve({ path: '/consultation', query: {}});
|
||||
window.open(NPShref.href, "_blank");
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const onSearch = (val) => {
|
||||
queryFrom.value = { ...val };
|
||||
@ -244,33 +237,9 @@ const exsit = () =>{
|
||||
})
|
||||
};
|
||||
// 加入会议
|
||||
const joinMeeting = (item) => {
|
||||
console.log(item.hybh,'===========00');
|
||||
|
||||
ElMessageBox.confirm('确定开始会议?','提示',{ confirmButtonText:'确定', cancelButtonText:'取消', type:'warning' }).then(res=>{
|
||||
openMeeting.value = true;
|
||||
nextTick(()=>{
|
||||
let params = {
|
||||
"number": it.number,
|
||||
"nick": it.subject,
|
||||
"mute_status": it.status,
|
||||
"microphone_status": 1,
|
||||
"camera_status": 1
|
||||
}
|
||||
// lemon.conference.enterConferenceByNumber(params).then(res=> {
|
||||
// console.log(res,'加入会议......');
|
||||
// }).catch(err=> {
|
||||
// console.log(err,' 加入会议失败......');
|
||||
// })
|
||||
})
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
|
||||
// conferenceRoomVisible.value = true;
|
||||
// qcckPost({id:item.id},'/mosty-gsxt/wshs/addWshyRy').then((res)=>{
|
||||
// getList();
|
||||
// })
|
||||
const joinMeeting = (item,type) => {
|
||||
item.number = item.hybh;
|
||||
refMeetingView.value.openInit(item,type)
|
||||
};
|
||||
|
||||
// 删除
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,46 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { showErrorMsgDesc } from '@/hooks/error';
|
||||
|
||||
const $axios = axios.create();
|
||||
|
||||
$axios.defaults.timeout = 50000;
|
||||
let options = {};
|
||||
$axios.interceptors.request.use(
|
||||
(config) => {
|
||||
options = config;
|
||||
// const { headers } = config;
|
||||
|
||||
return config;
|
||||
},
|
||||
(error) => {
|
||||
console.info('request error', error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
$axios.interceptors.response.use(
|
||||
(response) => {
|
||||
const { result, desc, msg } = response.data;
|
||||
// @ts-ignore
|
||||
const { isCatch } = options;
|
||||
if (isCatch) return response.data;
|
||||
if (result && result !== 0) {
|
||||
showErrorMsgDesc(result, desc || msg);
|
||||
return {};
|
||||
}
|
||||
return response.data;
|
||||
},
|
||||
(error) => {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return new Promise((resolve, reject) => {
|
||||
// @ts-ignore
|
||||
const { isCatch } = options;
|
||||
console.info('response error', JSON.stringify(error), isCatch);
|
||||
if (isCatch) return reject(error);
|
||||
Message.error(error.message);
|
||||
resolve('');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
export default $axios;
|
||||
@ -1,57 +0,0 @@
|
||||
import { h } from 'vue';
|
||||
import { Notification } from '@arco-design/web-vue';
|
||||
import { Random } from 'mockjs';
|
||||
import { $i18n } from '@/locale';
|
||||
|
||||
/*
|
||||
* 使用示例:
|
||||
* import { showErrorMsgDesc } from '@/hooks/error';
|
||||
* showErrorMsgDesc('2101006', 'HBP service run error', '出错了');
|
||||
* showErrorMsgDesc('2101006', 'HBP service run error');
|
||||
* showErrorMsgDesc('2101006');
|
||||
* showErrorMsgDesc('77778888');
|
||||
* */
|
||||
|
||||
export const showErrorMsgDesc = (code = '', desc = '', msg = '') => {
|
||||
const id = `note_msg_${Random.guid()}`;
|
||||
const existI18nMsg = $i18n.global.t(`errorCode.${code}`);
|
||||
Notification.error({
|
||||
id,
|
||||
class: 'notification-center-message',
|
||||
closable: true,
|
||||
duration: 15000,
|
||||
showIcon: true,
|
||||
style: {
|
||||
'width': '500px',
|
||||
'padding': '10px 20px',
|
||||
'align-items': 'center',
|
||||
},
|
||||
title: () => {
|
||||
const titTxt = msg || existI18nMsg;
|
||||
return h('span', [
|
||||
h('span', titTxt),
|
||||
h(
|
||||
'a',
|
||||
{
|
||||
style: {
|
||||
'margin-left': '16px',
|
||||
'font-size': '14px',
|
||||
'color': '#f53f3f',
|
||||
},
|
||||
onClick: () => {
|
||||
Notification.error({
|
||||
id,
|
||||
title: titTxt,
|
||||
content: desc,
|
||||
});
|
||||
},
|
||||
},
|
||||
desc ? $i18n.global.t('error.code.detail') : ''
|
||||
),
|
||||
]);
|
||||
},
|
||||
content: () => h('div'),
|
||||
});
|
||||
};
|
||||
|
||||
export default null;
|
||||
@ -1,16 +0,0 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default function useLoading(initValue = false) {
|
||||
const loading = ref(initValue);
|
||||
const setLoading = (value: boolean) => {
|
||||
loading.value = value;
|
||||
};
|
||||
const toggle = () => {
|
||||
loading.value = !loading.value;
|
||||
};
|
||||
return {
|
||||
loading,
|
||||
setLoading,
|
||||
toggle,
|
||||
};
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
import { computed } from 'vue';
|
||||
import { $i18n, loadLocaleMessages, setI18nLanguage } from '@/locale';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
|
||||
export default function useLocale() {
|
||||
const currentLocale = computed(() => {
|
||||
return $i18n.global.locale;
|
||||
});
|
||||
const changeLocale = (value: string) => {
|
||||
localStorage.setItem('arco-locale-webPuc', value);
|
||||
loadLocaleMessages($i18n, value).then(() => {
|
||||
setI18nLanguage($i18n, value);
|
||||
|
||||
Message.success($i18n.global.t('navbar.action.locale'));
|
||||
});
|
||||
};
|
||||
return {
|
||||
currentLocale,
|
||||
changeLocale,
|
||||
};
|
||||
}
|
||||
@ -1,149 +0,0 @@
|
||||
/* eslint-disable no-bitwise */
|
||||
|
||||
import { DEVICE_STATE, DEVICE_TYPE } from '@/utils/contants';
|
||||
|
||||
/* 获取执法记录仪数据 如果以后基础数据变多,可以考虑用pinia在页面加载是进行初始化控制 */
|
||||
const rvmTypes = [];
|
||||
|
||||
export default function useStaticData() {
|
||||
/**
|
||||
* 获取设备状态值方法(第三版本)以v2逻辑为主,整合v1业务逻辑
|
||||
* @param deviceInfo
|
||||
* @returns
|
||||
*/
|
||||
const getDeviceStatusNumberV3 = (deviceInfo): number => {
|
||||
const {
|
||||
status,
|
||||
conference_guid,
|
||||
number,
|
||||
device_type,
|
||||
basedata_id,
|
||||
latitude,
|
||||
longitude,
|
||||
terminal_model,
|
||||
} = deviceInfo;
|
||||
|
||||
let deviceState = 0;
|
||||
// console.debug('getDeviceStatusNumberV3--->', deviceInfo);
|
||||
const number_type = window.lemon.basedata.getNumberType(basedata_id);
|
||||
/* 会议类型 */
|
||||
if (conference_guid) return DEVICE_STATE.DEVICE_STATE_TYPE_CONFERENCE;
|
||||
/* PSTN电话 */
|
||||
if (number_type === DEVICE_STATE.DEVICE_STATE_TYPE_EXTERNAL)
|
||||
return DEVICE_STATE.DEVICE_STATE_TYPE_EXTERNAL;
|
||||
|
||||
/* 设备类型 */
|
||||
if (
|
||||
number_type === window.lemon.NUMBER_TYPE.INDIVIDUAL ||
|
||||
number_type === window.lemon.NUMBER_TYPE.ROIP_INDIVIDUAL
|
||||
) {
|
||||
// 判断是否是执法记录仪
|
||||
const isRvm = rvmTypes.includes(terminal_model);
|
||||
// 判断是否是摄像头
|
||||
const isCamera = device_type === DEVICE_TYPE.DEVICE_TYPE_CAMERA;
|
||||
// 设备号码类型
|
||||
// 执法记录仪
|
||||
if (isRvm) {
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_TYPE_RVM;
|
||||
}
|
||||
// 摄像头
|
||||
else if (isCamera) {
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_TYPE_CAMERA;
|
||||
} else {
|
||||
deviceState |= number_type;
|
||||
}
|
||||
|
||||
// 设备号码状态(是否遥晕遥毙..)
|
||||
switch (status?.lock_state) {
|
||||
case 0: // 遥醒
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_LOCK_REVICE;
|
||||
break;
|
||||
case 1: // 遥晕
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_LOCK_STUN;
|
||||
break;
|
||||
case 3: // 遥毙
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_LOCK_KILL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* 在线状态 */
|
||||
// 摄像头设备
|
||||
if (isCamera) {
|
||||
if (status?.online === 1) {
|
||||
// 根据经纬度数据确认是否上报GPS数据
|
||||
deviceState |=
|
||||
latitude !== 0 || longitude !== 0
|
||||
? DEVICE_STATE.DEVICE_STATE_GPS_REPORT_Y
|
||||
: DEVICE_STATE.DEVICE_STATE_GPS_REPORT_N;
|
||||
// 上线状态
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_ONLINE_ALL;
|
||||
} else {
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_ONLINE_NULL;
|
||||
}
|
||||
}
|
||||
// 多模设备
|
||||
else if (
|
||||
number_type === DEVICE_STATE.DEVICE_STATE_TYPE_ROIP_GROUP ||
|
||||
number_type === DEVICE_STATE.DEVICE_STATE_TYPE_ROIP_INDIVIDUAL
|
||||
) {
|
||||
// 窄带在线
|
||||
if (status.narrowband === window.lemon.ONLINE_STATE.ON) {
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_ONLINE_NARROW;
|
||||
}
|
||||
// 宽带在线
|
||||
if (status.broadband === window.lemon.ONLINE_STATE.ON) {
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_ONLINE_BROAD;
|
||||
}
|
||||
}
|
||||
// 单模设备 || 执法记录仪
|
||||
else if (
|
||||
number_type === DEVICE_STATE.DEVICE_STATE_TYPE_INDIVIDUAL ||
|
||||
number_type === DEVICE_STATE.DEVICE_STATE_TYPE_GROUP ||
|
||||
isRvm
|
||||
) {
|
||||
// 单模只要有一个模式在线就可以认为是在线了
|
||||
if (
|
||||
status?.narrowband === window.lemon.ONLINE_STATE.ON ||
|
||||
status?.broadband === window.lemon.ONLINE_STATE.ON
|
||||
) {
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_ONLINE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
// 订阅
|
||||
if (deviceInfo.is_subscribe === 1) {
|
||||
deviceState |= DEVICE_STATE.DEVICE_STATE_SUBSCRIBE_Y;
|
||||
}
|
||||
|
||||
// console.debug(
|
||||
// 'getDeviceStatusNumberV3--->',
|
||||
// number,
|
||||
// deviceState.toString(2)
|
||||
// );
|
||||
return deviceState;
|
||||
}
|
||||
|
||||
/* 组类型 */
|
||||
if (
|
||||
number_type === window.lemon.NUMBER_TYPE.GROUP ||
|
||||
number_type === window.lemon.NUMBER_TYPE.ROIP_GROUP
|
||||
) {
|
||||
// roip组在线图标
|
||||
if (number_type === 23) {
|
||||
return DEVICE_STATE.DEVICE_STATE_TYPE_ROIP_GROUP;
|
||||
}
|
||||
// 全呼组类型图标
|
||||
if (number_type === 3) {
|
||||
return DEVICE_STATE.DEVICE_STATE_TYPE_ALL_CALL;
|
||||
}
|
||||
// 其他组类型暂时返回默认组图标
|
||||
return DEVICE_STATE.DEVICE_STATE_TYPE_GROUP;
|
||||
}
|
||||
return deviceState;
|
||||
};
|
||||
|
||||
return {
|
||||
getDeviceStatusNumberV3,
|
||||
};
|
||||
}
|
||||
@ -1,390 +0,0 @@
|
||||
/**
|
||||
* 通用返回对象
|
||||
* @typedef {object} RetReslut
|
||||
* @property {number} result 响应码,0成功,其他失败
|
||||
*/
|
||||
|
||||
/**
|
||||
* GPS上报数据
|
||||
* @typedef {object} GpsData
|
||||
* @property {string} basedata_id 能根据这个信息定位到设备、组、群组等identifier
|
||||
* @property {string} long_we 经度标识 取值:E:东经 W:西经
|
||||
* @property {number} longitude 经度
|
||||
* @property {string} lat_ns 纬度标识 取值:S:南纬 N:北纬
|
||||
* @property {number} latitude 纬度
|
||||
* @property {number} speed 速度 单位是海里/小时
|
||||
* @property {number} direction 方向(360度)
|
||||
* @property {string} receive_time 接收时间(UTC 时间)
|
||||
* @property {string} electricity 电量等级
|
||||
* @property {number} current_interval_time 当前的上拉周期(秒)
|
||||
* @property {string} device_alias 上报设备名称
|
||||
* @property {string} device_staff_name 上报设备实名制名称 (PDT 系统才有)
|
||||
* @property {string} device_number 上报设备号码
|
||||
*/
|
||||
|
||||
/**
|
||||
* GPS上报对象
|
||||
* @typedef {object} GpsReportInfo
|
||||
* @property {string} user_id 用户账号
|
||||
* @property {Array.<GpsData>} gps_list 上报GPS数据列表
|
||||
*/
|
||||
|
||||
/**
|
||||
* 单次上拉的 GPS信息对象
|
||||
* @typedef {object} GpsInfo
|
||||
* @property {number} result 响应码,0成功,其他失败
|
||||
* @property {string} user_id 用户账号
|
||||
* @property {GpsData} gps_data GPS数据
|
||||
*/
|
||||
|
||||
/**
|
||||
* 订阅参数对象
|
||||
* @typedef {object} Subscriber
|
||||
* @property {string} basedata_id 基础数据对象id,必填项
|
||||
* @property {number} interval_time 订阅间隔时间(s),必填项
|
||||
* @property {number} distance 订阅距离,选填项 default 0
|
||||
* @property {number} speed 订阅速度,选填项 default 0
|
||||
* @property {number} sub_type 订阅类型,选填。 1:标识只启用按距离上传 2: 标识只启用按时间上传 3:标识启用按时间与距离上传 4: 标识启用按时间或距离上传
|
||||
*/
|
||||
|
||||
/**
|
||||
* 取消订阅参数对象
|
||||
* @typedef {object} UnSubscriber
|
||||
* @property {string} basedata_id 基础数据对象id
|
||||
*/
|
||||
|
||||
/**
|
||||
* 历史轨迹查询参数对象
|
||||
* @typedef {object} RecordGpsParams
|
||||
* @property {string} basedata_id 基础数据对象id,必填项
|
||||
* @property {string} start_time 查询开始时间 必填项 ,时间格式参考示例,UTC时间 "2021-05-13T09:45:41Z"
|
||||
* @property {string} end_time 查询结束时间 必填项 ,时间格式 如 "2021-05-13T09:45:41Z"
|
||||
* @property {number} max_number 返回最多的轨迹点数,选填项 不能超过 10000. 取值范围 1000-10000。如果不填就默认10000个点。
|
||||
*/
|
||||
|
||||
/**
|
||||
* 轨迹点信息 对象
|
||||
* @typedef {object} GpsRecord
|
||||
* @property {string} long_we 经度标识 取值:E:东经 W:西经
|
||||
* @property {number} longitude 经度
|
||||
* @property {string} lat_ns 纬度标识 取值:S:南纬 N:北纬
|
||||
* @property {number} latitude 纬度
|
||||
* @property {number} speed 速度 单位是海里/小时
|
||||
* @property {number} direction 方向
|
||||
* @property {string} gps_datetime : GPS时间(UTC 时间)
|
||||
* @property {string} receive_time 接收时间(UTC 时间)
|
||||
*/
|
||||
|
||||
/**
|
||||
* 历史轨迹查询结果 对象
|
||||
* @typedef {object} GpsRecordResult
|
||||
* @property {number} result 响应码,0成功 其他是失败
|
||||
* @property {boolean} exceeded_the_maximum 是否超出最大值的轨迹点数,超出最大值,只返回最大值的点数。
|
||||
* @property {Array.<GpsRecord>} gps_record_list 轨迹点列表
|
||||
*/
|
||||
|
||||
/**
|
||||
* 分页获取订阅列表数据参数结构
|
||||
* @typedef {object} SubDeviecesParams
|
||||
* @property {number} page_index 当前页码 必填项
|
||||
* @property {number} page_size 单页容量 必填项
|
||||
* @property {string} filter_key 通过这个关键字去匹配设备号码 非必填项
|
||||
*/
|
||||
|
||||
/**
|
||||
* 分页获取订阅列表返回 对象
|
||||
* @typedef {object} SubDeviecesResult
|
||||
* @property {number} result 响应码,0成功 其他是失败
|
||||
* @property {number} total_number 总的订阅数据
|
||||
* @property {Array.<SubDevieceInfo>} sub_device_list 订阅设备列表
|
||||
*/
|
||||
|
||||
/**
|
||||
* 订阅设备信息
|
||||
* @typedef {object} SubDevieceInfo
|
||||
* @property {String} basedata_id 基础数据对象id,必填项
|
||||
* @property {string} alias 被订阅设备名称
|
||||
* @property {string} number 被订阅设备号码
|
||||
* @property {string} staff_name 被订阅设备实名制名称 (PDT 系统才有)
|
||||
* @property {number} actual_report_cycle 实际上报周期,当前上拉周期
|
||||
* @property {number} min_cycle 允许最小订阅周期
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取订阅设备的订阅关系参数
|
||||
* @typedef {object} SubDeviceRelationParams
|
||||
* @property {string} basedata_id 基础数据对象id
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取订阅设备的订阅关系 返回结果
|
||||
* @typedef {object} SubDeviceRelationResult
|
||||
* @property {number} result 响应码,0成功 其他是失败
|
||||
* @property {string} basedata_id 基础数据对象id
|
||||
* @property {Array.<SubscriberRelation>} subscriber_list 订阅关系列表
|
||||
*/
|
||||
|
||||
/**
|
||||
* 订阅关系对象
|
||||
* @typedef {object} SubscriberRelation
|
||||
* @property {string} dispatcher_id 调度台id
|
||||
* @property {number} interval_time 订阅周期
|
||||
*/
|
||||
|
||||
/**
|
||||
* 取消调度员订阅参数对象
|
||||
* @typedef {object} UnSubDispatcher
|
||||
* @property {string} basedata_id 基础数据对象id
|
||||
*/
|
||||
|
||||
/**
|
||||
* 调度员取消订阅通知信息
|
||||
* @typedef {object} DispatcherCancelSubNofify
|
||||
* @property {string} user_id 用户账号,被取消订阅的用户账号,一般是当前账号,因为只能收到自己被取消订阅的通知
|
||||
* @property {string} realm 用户账号登录域名
|
||||
* @property {string} handle_dispatcher 取消订阅操作的调度员
|
||||
* @property {string} handle_time 取消订阅操作的时间
|
||||
*/
|
||||
|
||||
/**
|
||||
* 设备被取消订阅通知信息
|
||||
* @typedef {object} DeviceCancelSubInfo
|
||||
* @property {string} number 设备号码
|
||||
* @property {string} basedata_id 设备的basedata id
|
||||
* @property {string} handle_dispatcher 取消订阅操作的调度员
|
||||
* @property {string} handle_time 取消订阅操作的时间
|
||||
*/
|
||||
/**
|
||||
* 设备被取消订阅通知信息
|
||||
* @typedef {object} DeviceCancelSubNofify
|
||||
* @property {string} user_id 用户账号,被取消订阅的用户账号,一般是当前账号,因为只能收到自己被取消订阅的通知
|
||||
* @property {string} realm 用户账号登录域名
|
||||
* @property {Array.<DeviceCancelSubInfo>} cancel_sub_list 设备取消订阅列表
|
||||
*/
|
||||
|
||||
/**
|
||||
* 全网订阅参数
|
||||
* @typedef {object} WholeNetSubParams
|
||||
* @property {number} sub_pull_mode 订阅拉取模式 0:禁止;1:全网上拉2:部分上拉
|
||||
* @property {number} whole_net_sub_cycle 订阅拉取周期
|
||||
* @property {number} recovery_time 恢复时间
|
||||
* @property {number} min_sub_cycle 全网允许最小订阅周期
|
||||
*/
|
||||
/**
|
||||
* 全网订阅参数结果
|
||||
* @typedef {object} WholeNetSubParamsResult
|
||||
* @property {number} result 响应码,0成功 其他是失败
|
||||
* @property {string} min_sub_cycle_setter 全网允许最小订阅周期设置者
|
||||
* @property {WholeNetSubParams} whole_net_sub_params 全网订阅参数
|
||||
*/
|
||||
|
||||
/**
|
||||
* 取消调度员订阅参数对象
|
||||
* @typedef {object} Device
|
||||
* @property {string} basedata_id 基础数据对象id
|
||||
*/
|
||||
|
||||
/**
|
||||
* 设置设备最小订阅周期 请求参数
|
||||
* @typedef {object} DeviceMinSubCycleParams
|
||||
* @property {number} min_sub_cycle 终端允许最小订阅周期,该值必须必须大于或等于全网最小订阅周期
|
||||
* @property {Array.<Device>} device_list 终端的basedata id 列表
|
||||
*/
|
||||
export default function useGisModule() {
|
||||
/**
|
||||
* 发起GPS订阅(支持批量)
|
||||
* @param {object} subscriberListParam 订阅列表
|
||||
* @param {Array.<Subscriber} subscriberListParam.subscriber_list 订阅列表
|
||||
* @returns
|
||||
*/
|
||||
const startSubscribeGps = (subscriberListParam) => {
|
||||
return window.lemon.gis.startSubscribeGps(subscriberListParam);
|
||||
};
|
||||
|
||||
/**
|
||||
* 取消对该设备(调用者的)订阅 (支持批量),但是不影响其他人的订阅关系
|
||||
* @param {Array.<UnSubscriber>} unSubscribeListParam
|
||||
* @param {Array.<UnSubscriber>} unSubscribeListParam.cancel_subscribe_list
|
||||
* @returns
|
||||
*/
|
||||
const stopSubscribeGps = (unSubscribeListParam) => {
|
||||
return window.lemon.gis.stopSubscribeGps(unSubscribeListParam);
|
||||
};
|
||||
|
||||
/**
|
||||
* 取消该设备的全部订阅,连同其他的人对该设备的订阅也将取消去掉 (支持批量)
|
||||
* @param {object} unSubscribeListParam
|
||||
* @param {Array.<UnSubscriber>} unSubscribeListParam.cancel_subscribe_list
|
||||
* @returns
|
||||
*/
|
||||
const cancelDeviceAllGpsSub = (unSubscribeListParam) => {
|
||||
return window.lemon.gis.cancelDeviceAllGpsSub(unSubscribeListParam);
|
||||
};
|
||||
|
||||
/**
|
||||
* 单次获取位置信息
|
||||
* @param {object} gpsInfoParam 基础数据对象id,必填项
|
||||
* @param {string} gpsInfoParam.basedata_id 基础数据对象id,必填项
|
||||
* @param {boolean} gpsInfoParam.is_encryption 是否加密, 选填。 默认加密
|
||||
* @returns {Promise.<GpsInfo>}
|
||||
*/
|
||||
const getGpsInfo = (gpsInfoParam) => {
|
||||
return window.lemon.gis.getGpsInfo(gpsInfoParam);
|
||||
};
|
||||
|
||||
/**
|
||||
* 添加GPS 上报回调
|
||||
* @param {GpsCallback} callback 回调函数
|
||||
* @returns {string} callbackId {@link removeGPSReportListener } 需要根据这个id找到对应的回调函数
|
||||
*/
|
||||
const addGPSReportListener = (callback) => {
|
||||
return window.lemon.gis.addGPSReportListener(callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据callbackId删除之前注册的回调
|
||||
*
|
||||
* @param {string} callbackId
|
||||
*/
|
||||
const removeGPSReportListener = (callbackId) => {
|
||||
return window.lemon.gis.removeGPSReportListener(callbackId);
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取已订阅列表
|
||||
* @param {SubDeviecesParams} subDeviecesParams 订阅列表参数对象
|
||||
* @returns {Promise.<SubDeviecesResult>}
|
||||
*/
|
||||
const fetchSubDeviceList = (subDeviecesParams) => {
|
||||
return window.lemon.gis.fetchSubDeviceList(subDeviecesParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取订阅设备的订阅关系
|
||||
* @param {SubDeviceRelationParams} subDeviceRelationParams 订阅列表参数对象
|
||||
* @returns {Promise.<SubDeviceRelationResult>}
|
||||
*/
|
||||
const fetchSubDeviceRelation = (subDeviceRelationParams) => {
|
||||
return window.lemon.gis.fetchSubDeviceRelation(subDeviceRelationParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取全网订阅参数
|
||||
* @returns {Promise.<WholeNetSubParamsResult>}
|
||||
*/
|
||||
const getWholeNetSubParams = () => {
|
||||
return window.lemon.gis.getWholeNetSubParams();
|
||||
};
|
||||
/**
|
||||
* 设置全网订阅参数
|
||||
* @param {WholeNetSubParams} wholeNetSubParams
|
||||
* @returns {Promise.<RetReslut>}
|
||||
*/
|
||||
const setWholeNetSubParams = (wholeNetSubParams) => {
|
||||
return window.lemon.gis.setWholeNetSubParams(wholeNetSubParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* 同步订阅功能
|
||||
* @returns {Promise.<RetReslut>}
|
||||
*/
|
||||
const syncSubscribeList = () => {
|
||||
return window.lemon.gis.syncSubscribeList();
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置终端最小订阅周期
|
||||
* @param {DeviceMinSubCycleParams} deviceMinSubCycleParams
|
||||
* @returns {Promise.<RetReslut>}
|
||||
*/
|
||||
const setDeviceMinSubCycle = (deviceMinSubCycleParams) => {
|
||||
return window.lemon.gis.setDeviceMinSubCycle(deviceMinSubCycleParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* 取消终端允许最小订阅周期
|
||||
* @param {object} cancelDeviceParam
|
||||
* @param {Array.<Device>} cancelDeviceParam.cancel_device_list
|
||||
* @returns {Promise.<RetReslut>}
|
||||
*/
|
||||
const cancelDeviceMinSubCycle = (cancelDeviceParam) => {
|
||||
return window.lemon.gis.cancelDeviceMinSubCycle(cancelDeviceParam);
|
||||
};
|
||||
|
||||
/**
|
||||
* 取消调度员的全部订阅操作
|
||||
* @param {object>} dispatcherListParam
|
||||
* @param {Array.<UnSubDispatcher>} dispatcherListParam.cancel_subscribe_list
|
||||
* @returns
|
||||
*/
|
||||
const cancelDispatcherAllGpsSub = (dispatcherListParam) => {
|
||||
return window.lemon.gis.cancelDispatcherAllGpsSub(dispatcherListParam);
|
||||
};
|
||||
|
||||
/**
|
||||
* 添加 调度台取消订阅通知回调
|
||||
* @param {DeviceCallback} callback 回调函数
|
||||
* @returns {string} callbackId {@link removeGPSReportListener } 需要根据这个id找到对应的回调函数
|
||||
*/
|
||||
const addCXLDispatcherSubListener = (callback) => {
|
||||
return window.lemon.gis.addCXLDispatcherSubListener(callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据callbackId删除之前注册的回调
|
||||
*
|
||||
* @param {string} callbackId
|
||||
*/
|
||||
const removeCXLDispatcherSubListener = (callbackId) => {
|
||||
return window.lemon.gis.removeCXLDispatcherSubListener(callbackId);
|
||||
};
|
||||
|
||||
/**
|
||||
* 添加 设备取消订阅通知回调
|
||||
* @param {DeviceCallback} callback 回调函数
|
||||
* @returns {string} callbackId {@link removeCXLDeviceSubListener } 需要根据这个id找到对应的回调函数
|
||||
*/
|
||||
const addCXLDeviceSubListener = (callback) => {
|
||||
return window.lemon.gis.addCXLDeviceSubListener(callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据callbackId删除之前注册的回调
|
||||
*
|
||||
* @param {string} callbackId
|
||||
*/
|
||||
const removeCXLDeviceSubListener = (callbackId) => {
|
||||
return window.lemon.gis.removeCXLDispatcherSubListener(callbackId);
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询历史轨迹
|
||||
* @param {RecordGpsParams} recordGpsParams 历史轨迹查询参数对象
|
||||
* @returns {Promise.<GpsRecordResult>}
|
||||
*/
|
||||
const queryRecordGPS = (recordGpsParams) => {
|
||||
return window.lemon.gis.queryRecordGPS(recordGpsParams);
|
||||
};
|
||||
|
||||
return {
|
||||
startSubscribeGps,
|
||||
stopSubscribeGps,
|
||||
cancelDeviceAllGpsSub,
|
||||
getGpsInfo,
|
||||
addGPSReportListener,
|
||||
removeGPSReportListener,
|
||||
fetchSubDeviceList,
|
||||
fetchSubDeviceRelation,
|
||||
getWholeNetSubParams,
|
||||
setWholeNetSubParams,
|
||||
syncSubscribeList,
|
||||
setDeviceMinSubCycle,
|
||||
cancelDeviceMinSubCycle,
|
||||
addCXLDispatcherSubListener,
|
||||
removeCXLDispatcherSubListener,
|
||||
addCXLDeviceSubListener,
|
||||
removeCXLDeviceSubListener,
|
||||
cancelDispatcherAllGpsSub,
|
||||
queryRecordGPS,
|
||||
};
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
export default function useLogModule() {
|
||||
/**
|
||||
* set log level
|
||||
* 0 : no log
|
||||
* 1 : error
|
||||
* 2 : warn
|
||||
* 3 : info
|
||||
* 4 : debug
|
||||
* @param {日志级别 int} level
|
||||
*/
|
||||
const setLevel = (level) => {
|
||||
window.lemon.log.setLevel(level);
|
||||
};
|
||||
|
||||
const getLevel = () => {
|
||||
return window.lemon.log.getLevel();
|
||||
};
|
||||
|
||||
return {
|
||||
setLevel,
|
||||
getLevel,
|
||||
};
|
||||
}
|
||||
@ -1,73 +0,0 @@
|
||||
export interface UserInfo {
|
||||
username: string;
|
||||
password: string;
|
||||
realm: string;
|
||||
webpucUrl: string;
|
||||
}
|
||||
|
||||
export default function useLoginModule() {
|
||||
/**
|
||||
* login
|
||||
* @returns
|
||||
*/
|
||||
const login = (userInfo: UserInfo) => {
|
||||
return window.lemon.login.login(userInfo);
|
||||
};
|
||||
|
||||
/**
|
||||
* logout
|
||||
* @returns
|
||||
*/
|
||||
const logout = () => {
|
||||
return window.lemon.login.logout();
|
||||
};
|
||||
|
||||
/**
|
||||
* get login account infomation
|
||||
* @returns
|
||||
*/
|
||||
const getLoginAccountInfo = () => {
|
||||
return window.lemon.login.getLoginAccountInfo();
|
||||
};
|
||||
|
||||
/**
|
||||
* Connect Websocket
|
||||
* @returns
|
||||
*/
|
||||
const reConnectWebsocket = (reConnectInfo) => {
|
||||
return window.lemon.login.reConnectWebsocket(reConnectInfo);
|
||||
};
|
||||
|
||||
/**
|
||||
* get the account login status
|
||||
* @returns ture is login in, false is not logged in
|
||||
*/
|
||||
const isLogin = () => {
|
||||
return window.lemon.login.isLogin();
|
||||
};
|
||||
|
||||
/**
|
||||
* add login status change listener
|
||||
* @returns callbackid
|
||||
*/
|
||||
const addLoginStatusChangeListener = (onLoginStatusChange) => {
|
||||
return window.lemon.login.addLoginStatusChangeListener(onLoginStatusChange);
|
||||
};
|
||||
|
||||
/**
|
||||
* remove login status change listener
|
||||
*/
|
||||
const removeLoginStatusChangeListener = (loginStatusGuid: string) => {
|
||||
window.lemon.login.removeLoginStatusChangeListener(loginStatusGuid);
|
||||
};
|
||||
|
||||
return {
|
||||
login,
|
||||
logout,
|
||||
reConnectWebsocket,
|
||||
getLoginAccountInfo,
|
||||
isLogin,
|
||||
addLoginStatusChangeListener,
|
||||
removeLoginStatusChangeListener,
|
||||
};
|
||||
}
|
||||
@ -1,86 +0,0 @@
|
||||
export interface FormatedMsg {
|
||||
sender: {
|
||||
number: string;
|
||||
alias: string;
|
||||
basedata_id: string;
|
||||
};
|
||||
recipient: {
|
||||
number: string;
|
||||
alias: string;
|
||||
basedata_id: string;
|
||||
};
|
||||
|
||||
file_parm: string;
|
||||
sds_type: string;
|
||||
sds_content: string;
|
||||
time_stamp: string;
|
||||
times: number;
|
||||
sds_text: string;
|
||||
}
|
||||
|
||||
export default function useMessageModule() {
|
||||
/**
|
||||
* download message File
|
||||
* @returns
|
||||
*/
|
||||
const downloadFile = (downloadParams: { url: string }) => {
|
||||
return window.lemon.message.downloadFile(downloadParams);
|
||||
};
|
||||
const dateTimeFormat = () => {
|
||||
const date = new Date();
|
||||
|
||||
const hour = String(date.getHours()).padStart(2, '0');
|
||||
const minute = String(date.getMinutes()).padStart(2, '0');
|
||||
const second = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${[hour, minute, second].join(':')}`;
|
||||
};
|
||||
const formatMessage = (message: any): FormatedMsg => {
|
||||
const resInfo: FormatedMsg = {
|
||||
sender: {
|
||||
number: message.caller.number,
|
||||
alias: message.caller.number_alias,
|
||||
basedata_id: message.caller.basedata_id,
|
||||
},
|
||||
recipient: {
|
||||
number: message.callee.number,
|
||||
alias: message.callee.number_alias,
|
||||
basedata_id: message.callee.basedata_id,
|
||||
},
|
||||
file_parm: message.file_parm,
|
||||
sds_type: message.sds_type,
|
||||
sds_content: message.sds_content,
|
||||
time_stamp: dateTimeFormat(),
|
||||
times: new Date().getTime(),
|
||||
sds_text: message.sds_text,
|
||||
};
|
||||
return resInfo;
|
||||
};
|
||||
/**
|
||||
* send text message
|
||||
* @param basedata_id target send to
|
||||
* @param content message content
|
||||
* @returns
|
||||
*/
|
||||
const sendTxtMessage = (basedata_id: string, content: string) => {
|
||||
return window.lemon.message.sendMessageText({
|
||||
basedata_id,
|
||||
message_content: content,
|
||||
});
|
||||
};
|
||||
|
||||
const addCallback = (callback: (data) => void) => {
|
||||
return window.lemon.message.addMessageReportListener(callback);
|
||||
};
|
||||
|
||||
const removeCallback = (id: string) => {
|
||||
return window.lemon.message.removeMessageReportListener(id);
|
||||
};
|
||||
|
||||
return {
|
||||
downloadFile,
|
||||
formatMessage,
|
||||
sendTxtMessage,
|
||||
addCallback,
|
||||
removeCallback,
|
||||
};
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
// cache all monitor data
|
||||
const monitorData = new Map<string, object>();
|
||||
|
||||
let callback_id;
|
||||
|
||||
export default function useMonitorModule() {
|
||||
/**
|
||||
* recover history monitor relationship,callback will receive results
|
||||
* @returns
|
||||
*/
|
||||
const recoverHistory = () => {
|
||||
return window.lemon.monitor.initQueue();
|
||||
};
|
||||
|
||||
/**
|
||||
* cancel or monitor a object,like deivce、gorup or something else
|
||||
* @param basedata_id
|
||||
* @param alias
|
||||
* @returns
|
||||
*/
|
||||
const monitor = (basedata_id: string, alias: string) => {
|
||||
const has = monitorData.has(basedata_id);
|
||||
console.log('try monitor->', has);
|
||||
return window.lemon.monitor.change({
|
||||
basedata_id,
|
||||
name: alias,
|
||||
monitor_type: has ? 0 : 1,
|
||||
});
|
||||
};
|
||||
|
||||
const removeCallback = (id?: string) => {
|
||||
let inner;
|
||||
if (!id) {
|
||||
id = callback_id;
|
||||
inner = true;
|
||||
}
|
||||
window.lemon.monitor.removeChangeListener(id);
|
||||
if (inner) {
|
||||
callback_id = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const addCallback = (callback: (data) => void) => {
|
||||
return window.lemon.monitor.addChangeListener(callback);
|
||||
};
|
||||
|
||||
const registerResultCallback = () => {
|
||||
console.log('try register monitor ');
|
||||
if (callback_id) {
|
||||
console.log('there is already a callback,remove first');
|
||||
removeCallback();
|
||||
}
|
||||
callback_id = addCallback((data) => {
|
||||
if (data.result !== 0) {
|
||||
return;
|
||||
}
|
||||
// if not in list
|
||||
if (data.monitor_type === 0) {
|
||||
const deleteFlag = monitorData.delete(data.basedata_id);
|
||||
|
||||
console.log('deleteFlag', deleteFlag);
|
||||
}
|
||||
if (data.monitor_type === 1) {
|
||||
monitorData.set(data.basedata_id, data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
recoverHistory,
|
||||
monitor,
|
||||
registerResultCallback,
|
||||
addCallback,
|
||||
removeCallback,
|
||||
};
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
export default function useReportFormModule() {
|
||||
/**
|
||||
* query Call Record
|
||||
* @returns
|
||||
*/
|
||||
const queryCallRecord = (callRecordParams) => {
|
||||
return window.lemon.reportForm.queryCallRecord(callRecordParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* fetch Call Recording File Url
|
||||
* @returns
|
||||
*/
|
||||
const fetchCallRecordingFileUrl = (param: { sound_file: string }) => {
|
||||
return window.lemon.reportForm.fetchCallRecordingFileUrl(param);
|
||||
};
|
||||
|
||||
/**
|
||||
* query message Record
|
||||
* @returns
|
||||
*/
|
||||
const queryMsgRecord = (msgRecordParams) => {
|
||||
return window.lemon.reportForm.queryMsgRecord(msgRecordParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* query rrs Record
|
||||
* @returns
|
||||
*/
|
||||
const queryRrsRecord = (rrsRecordParams) => {
|
||||
return window.lemon.reportForm.queryRrsRecord(rrsRecordParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* query emg alarm Record
|
||||
* @returns
|
||||
*/
|
||||
const queryEmgAlarmRecord = (emgAlarmRecordParams) => {
|
||||
return window.lemon.reportForm.queryEmgAlarmRecord(emgAlarmRecordParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* query Geofencing alarm Record
|
||||
* @returns
|
||||
*/
|
||||
const queryGeofencingAlarmRecord = (geofencingAlarmRecordParams) => {
|
||||
return window.lemon.reportForm.queryGeofencingAlarmRecord(
|
||||
geofencingAlarmRecordParams
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* query speed alarm Record
|
||||
* @returns
|
||||
*/
|
||||
const querySpeedAlarmRecord = (speedAlarmRecordParams) => {
|
||||
return window.lemon.reportForm.querySpeedAlarmRecord(
|
||||
speedAlarmRecordParams
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* query CallBack Record
|
||||
* @returns
|
||||
*/
|
||||
const queryCallBackRecord = (callBackRecordParams) => {
|
||||
return window.lemon.reportForm.queryCallBackRecord(callBackRecordParams);
|
||||
};
|
||||
|
||||
return {
|
||||
queryCallRecord,
|
||||
fetchCallRecordingFileUrl,
|
||||
queryMsgRecord,
|
||||
queryRrsRecord,
|
||||
queryEmgAlarmRecord,
|
||||
queryGeofencingAlarmRecord,
|
||||
querySpeedAlarmRecord,
|
||||
queryCallBackRecord,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user