dbsd_kczx/src/views/kc/jiaoshi/index.vue

1310 lines
48 KiB
Vue

<template>
<div style="width:100%;height: 100%;">
<div class="" style="padding: 10px 10px 0 10px;">
<a-row :gutter="[16,16]">
<a-col :span="12">
<a-card class="cardDiv">
<template #title>
<div style="float: left;">教室情况</div>
<div style="float: right">
<a-button v-if="btnStatus.all" type="primary" disabled="disabled">检测中</a-button>
<a-button v-else type="primary" @click="refreshLogsFn()">设备检测</a-button>
<a-button hidden type="primary" style="margin-left: 1rem;" @click="resettingRedisKeysFn()">重置状态</a-button>
<div hidden>{{ btnStatus }}</div>
</div>
</template>
<!-- -<i class="fa-sharp fa-solid fa-user"></i>- -->
<a-row class="" :gutter="[16,16]">
<a-col :span="6">
<div class="numberBlob handleCss" @click="openJxlDetail({ })">
<div class="numSpan">{{ allClassNum }}</div>
<div class="numberName">
<!-- <StockOutlined class="blue"/> -->
总数
</div>
</div>
</a-col>
<a-col :span="6">
<div class="numberBlob handleCss" @click="openDetail({})">
<div class="numSpan blue">{{ leftList.filter(x => x.zbgn == '0').length || 0 }}</div>
<div class="numberName">
<!-- <RiseOutlined class="orange"/> -->
可直播
</div>
</div>
</a-col>
<a-col :span="6">
<div class="numberBlob handleCss" @click="openDetail({ onLineClassType: ['green', 'yellow'] })">
<!-- <div class="numberBlob handleCss" @click="openDetail({ sfyx: '0' })"> -->
<!-- <div class="numSpan orange">{{ getSysConfig().flag5 == 0?'否': leftList.filter(x => x.sfyx == 0).length || 0}}</div> -->
<div class="numSpan orange">{{ getSysConfig().flag5 == 0?'否': leftList.filter(x => ['green', 'yellow'].indexOf(x.onLineClassType) != -1).length || 0}}</div>
<div class="numberName">
<!-- <RiseOutlined class="orange"/> -->
开放听课
</div>
</div>
</a-col>
<a-col :span="6">
<div class="numberBlob handleCss" @click="openDetail({ onLineClassType: ['red', 'yellow'] })">
<div v-if="!statusLogList.length" class="numSpan orange">未检测</div>
<div v-else class="numSpan orange">{{ statusLogList.filter(x => x.type != 'green' ).length || 0 }}</div>
<div class="numberName">
<!-- <RiseOutlined class="orange"/> -->
设备异常
</div>
<div v-if="statusLogList.length" style="font-size: .5rem;">{{ statusLogList[0]?.createTime }}</div>
</div>
</a-col>
</a-row>
<!-- <a-divider /> -->
<!-- <div class="buttomDiv"></div> -->
</a-card>
</a-col>
<a-col :span="12">
<a-card class="cardDiv" title="开放听课教室上课情况">
<!-- -<i class="fa-sharp fa-solid fa-user"></i>- -->
<a-row class="" :gutter="[16,16]">
<a-col :span="8">
<div class="numberBlob handleCss" @click="openDetail({ nowIsClass: true })">
<div class="numSpan">{{ (leftList.filter(x => x?.nowIsClass).length || 0) }}</div>
<div class="numberName">
<!-- <StockOutlined class="blue"/> -->
正在上课
</div>
</div>
</a-col>
<a-col :span="8">
<div class="numberBlob handleCss" @click="openDetail({ nowIsClass: true, onLineClassType: ['green', 'yellow'] })">
<div class="numSpan blue">{{ (leftList.filter(x => x.nowIsClass && x?.child['教师近景']?.isOnLine).length || 0) }}</div>
<div class="numberName">
<!-- <RiseOutlined class="orange"/> -->
正在直播
</div>
</div>
</a-col>
<a-col :span="8">
<div class="numberBlob handleCss" @click="openDetail({ nowIsClass: true, onLineClassType: 'red' })">
<div class="numSpan orange">{{ (leftList.filter(x => x.nowIsClass && !x?.child['教师近景']?.isOnLine).length || 0) }}</div>
<div class="numberName">
<!-- <RiseOutlined class="orange"/> -->
直播异常
</div>
</div>
</a-col>
</a-row>
<!-- <a-divider /> -->
<!-- <div class="buttomDiv"></div> -->
</a-card>
</a-col>
</a-row>
</div>
<!-- <div style="float:right"><a-button type="link" >切换视图</a-button></div> -->
<div style="float:right">
<a-switch checkedChildren="卡片" unCheckedChildren="列表" v-model:checked="twoShowType" />
</div>
<div v-show="twoShowType" class="" style="padding: 10px 10px 0 10px;">
<a-row :gutter="[16,16]">
<a-col :span="6" v-for="(item,index) of cardList" :key="index">
<a-card bordered hoverable @click="() => (currentCardIndex = index,searchReset())" :class="currentCardIndex == index?'active':''">
<template #title>
<div class="fjdskf" style="float: left;font-size: 15px;font-weight: 600;margin-top: 5px;">{{ item.jxlName }}</div>
<div class="bgshua" style="float: right">
<a-button v-if="btnStatus.all || btnStatus[item.jxlName]" type="primary" disabled="disabled">检测中</a-button>
<a-button v-else type="primary" @click="refreshLogsFn(item.jxlName)">设备检测</a-button>
</div>
</template>
<a-row style="margin-bottom: 10px;text-align: center;border-bottom: 1px #f0f0f0 solid ;padding-bottom: 10px;">
<a-col class="hover handleCss" :span="6" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, zbgn: undefined })"><span>{{ item.jsNum }}</span></a-col>
<a-col class="hover" :span="6" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName })"><span>{{ item.child.filter(x => x.zbgn == '0').length || 0 }}</span></a-col>
<a-col class="hover" :span="6" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, sfyx: '0' })"><span>{{ item.child.filter(x => x.sfyx == 0).length || 0 }}</span></a-col>
<a-col class="" :span="6" style="font-weight: 600;" v-if="!statusLogList.length"><span>未检测</span></a-col>
<a-col class="hover handleCss" :span="6" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, onLineClassType: ['red', 'yellow'] })" v-else><span>{{ statusLogList.filter(x => x.jxlName == item.jxlName && x.type != 'green' ).length }}</span></a-col>
<a-col class="hover" :span="6" @click="openDetail({ jxlName: item.jxlName, zbgn: undefined })"><span>总数</span></a-col>
<a-col class="hover" :span="6" @click="openDetail({ jxlName: item.jxlName })"><span>可直播</span></a-col>
<a-col class="hover" :span="6" @click="openDetail({ jxlName: item.jxlName, sfyx: '0' })"><span>开放听课</span></a-col>
<a-col :span="6" @click="openDetail({ jxlName: item.jxlName, onLineClassType: ['red', 'yellow'] })">
<div>设备异常</div>
<!-- <div v-if="statusLogList.length" style="font-size: .5rem;">{{ statusLogList[0]?.createTime }}</div> -->
<div v-if="statusLogList.length" style="font-size: .5rem;">{{ statusLogList.find(x => x.jxlName == item.jxlName)?.createTime }}</div>
</a-col>
<!-- <div v-if="!statusLogList.length" class="numSpan orange" style="font-size: 24px;height: 50px;line-height: 50px;">未检测</div>
<div v-else class="numSpan orange" style="font-size: 24px;height: 50px;line-height: 50px;"></div>
<div class="numberName">
设备异常
</div>
<div v-if="statusLogList.length" style="font-size: .5rem;">{{ statusLogList[0]?.createTime }}</div> -->
</a-row>
<a-row style="text-align: center;">
<a-col class="hover" :span="8" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, nowIsClass: true })"><span>{{ item.child.filter(x => x?.nowIsClass).length || 0}}</span></a-col>
<a-col class="hover" :span="8" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, nowIsClass: true, onLineClassType: 'green' })"><span>{{ item.child.filter(x => x?.nowIsClass && x?.child['教师近景']?.isOnLine).length || 0}}</span></a-col>
<a-col class="hover" :span="8" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, nowIsClass: true, onLineClassType: 'red' })"><span>{{ item.child.filter(x => x?.nowIsClass && !x?.child['教师近景']?.isOnLine).length || 0 }}</span></a-col>
<!-- <a-col :span="8" style="font-weight: 600;" >&nbsp;</a-col> -->
<a-col class="hover" :span="8" @click="openDetail({ jxlName: item.jxlName, nowIsClass: true })"><span>正在上课</span></a-col>
<a-col class="hover" :span="8" @click="openDetail({ jxlName: item.jxlName, nowIsClass: true, onLineClassType: 'green' })"><span>正在直播</span></a-col>
<a-col class="hover" :span="8" @click="openDetail({ jxlName: item.jxlName, nowIsClass: true, onLineClassType: 'red' })"><span>直播异常</span></a-col>
<!-- <a-col :span="8" >&nbsp;</a-col> -->
</a-row>
</a-card>
</a-col>
</a-row>
</div>
<div v-show="!twoShowType" style="padding: 10px 10px 0 10px;">
<a-table
rowKey="jsbh"
v-show="true"
:loading="loading"
:data-source="cardList"
:pagination="false"
bordered
size="middle"
class="ant-table-striped"
:scroll="{ y: 650 }"
:rowSelection="{ type: 'radio', onChange: onSelectChange2 }"
>
<a-table-column width="70px" title="序号" align="center" data-index="index">
<template #default="{ index }">
{{ index+1 }}
</template>
</a-table-column>
<a-table-column title="教学楼" data-index="jxlName"/>
<!-- @click="() => (currentCardIndex = index,searchReset())" -->
<!-- <div class="bgshua" style="float: right"><a-button type="primary" @click="refreshLogsFn(item.jxlName)">设备检测</a-button></div> -->
<a-table-column title="总数" data-index="_">
<template #default="{ record }">
<span @click="openDetail({ jxlName: record.jxlName })">
{{ record.jsNum }}
</span>
</template>
</a-table-column>
<a-table-column title="可直播" data-index="_">
<template #default="{ record }">
<span @click="openDetail({ jxlName: record.jxlName })">
{{ record.child.length }}
</span>
</template>
</a-table-column>
<a-table-column title="开放听课" data-index="_">
<template #default="{ record }">
<span @click="openDetail({ jxlName: record.jxlName, sfyx: '0' })">
{{ record.child.filter(x => x.sfyx == 0).length || 0 }}
</span>
</template>
</a-table-column>
<a-table-column title="设备异常" data-index="_">
<template #default="{ record }">
<span v-if="!statusLogList.length">未检测</span>
<span v-else>{{ statusLogList.filter(x => x.jxlName == record.jxlName && x.type != 'green' ).length }}</span>
</template>
</a-table-column>
<a-table-column title="正在上课" data-index="_">
<template #default="{ record }">
<span @click="openDetail({ jxlName: record.jxlName, nowIsClass: true })">
{{ record.child.filter(x => x?.nowIsClass).length || 0}}
</span>
</template>
</a-table-column>
<a-table-column title="正在直播" data-index="_">
<template #default="{ record }">
<span @click="openDetail({ jxlName: record.jxlName, nowIsClass: true, onLineClassType: 'green' })">
{{ record.child.filter(x => x?.nowIsClass && x?.child['教师近景']?.isOnLine).length || 0}}
</span>
</template>
</a-table-column>
<a-table-column title="直播异常" data-index="_">
<template #default="{ record }">
<span @click="openDetail({ jxlName: record.jxlName, nowIsClass: true, onLineClassType: 'red' })">
{{ record.child.filter(x => x?.nowIsClass && !x?.child['教师近景']?.isOnLine).length || 0 }}
</span>
</template>
</a-table-column>
<!-- <a-col :span="6" @click="openDetail({ jxlName: item.jxlName})">总数</a-col>
<a-col :span="6" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName})">{{ item.jsNum }}</a-col> -->
<!-- <a-col :span="6" @click="openDetail({ jxlName: item.jxlName, sfyx: '0'})">可直播</a-col>
<a-col :span="6" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, sfyx: '0'})">{{ item.child.length }}</a-col> -->
<!-- <a-col :span="6" @click="openDetail({ jxlName: item.jxlName })">开放听课</a-col>
<a-col :span="6" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName})">{{ item.child.filter(x => x.sfyx == 0).length || 0 }}</a-col> -->
<!-- <a-col :span="6" ><div>设备异常</div></a-col>
<a-col :span="6" style="font-weight: 600;" v-if="!statusLogList.length">未检测</a-col>
<a-col :span="6" style="font-weight: 600;" v-else>{{ statusLogList.filter(x => x.jxlName == item.jxlName && x.type != 'green' ).length }}</a-col> -->
<!-- <a-col :span="8" @click="openDetail({ jxlName: item.jxlName, nowIsClass: true})">正在上课</a-col>
<a-col :span="8" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, nowIsClass: true})">{{ item.child.filter(x => x?.nowIsClass).length || 0}}</a-col> -->
<!-- <a-col :span="8" @click="openDetail({ jxlName: item.jxlName, onLineClassType: 'green'})">正在直播</a-col>
<a-col :span="8" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, onLineClassType: 'green'})">{{ item.child.filter(x => x?.nowIsClass && x?.child['教师近景']?.isOnLine).length || 0}}</a-col> -->
<!-- <a-col :span="8" @click="openDetail({ jxlName: item.jxlName, onLineClassType: 'red'})">直播异常</a-col>
<a-col :span="8" style="font-weight: 600;" @click="openDetail({ jxlName: item.jxlName, onLineClassType: 'red'})">{{ item.child.filter(x => x?.nowIsClass && !x?.child['教师近景']?.isOnLine).length || 0 }}</a-col> -->
</a-table>
</div>
<div style="height: 1rem;"></div>
<div class="jeecg-basic-table-form-container">
<a-form @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="5" style="padding: 0 10px 0 0;">
<a-form-item label="教学楼">
<!-- <j-dict-select-tag placeholder="请选择教室" v-model:value="queryParam.xqxn" dictCode="kc_xqxn_history,title,title"/> -->
<!-- <a-input placeholder="请输入" v-model:value="queryParam.jxlName"/> -->
<!-- <a-select placeholder="请选择" v-model:value="queryParam.jxlName">
<a-select-option :value="undefined">全部</a-select-option>
<a-select-option v-for="(jxl,jxlIndex) in cardList" :key="jxlIndex" :value="jxl.jxlName">{{jxl.jxlName}}</a-select-option>
</a-select> -->
<a-select
v-model:value="queryParam.jxlName"
allowClear
show-search
placeholder="请选择"
:options="cardList"
:filter-option="jxlNameFilterOptionFn"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="5" style="padding: 0 10px 0 0;">
<a-form-item label="教室">
<!-- <a-input placeholder="请输入" v-model:value="queryParam.jsmc"/> -->
<a-select
v-model:value="queryParam.jsmc"
allowClear
show-search
placeholder="请选择"
:options="thisOptions"
:filter-option="jxlNameFilterOptionFn"
>
</a-select>
<!-- -{{thisOptions}}- -->
</a-form-item>
</a-col>
<a-col :lg="5" style="padding: 0 10px 0 0;">
<a-form-item label="直播功能">
<a-select placeholder="请选择" v-model:value="queryParam.zbgn">
<a-select-option :value="undefined">请选择</a-select-option>
<a-select-option value="0">是</a-select-option>
<a-select-option value="1">尚未接入</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="5" style="padding: 0 10px 0 0;">
<a-form-item label="开放听课">
<a-select placeholder="请选择" v-model:value="queryParam.sfyx">
<a-select-option :value="undefined">请选择</a-select-option>
<a-select-option value="0">是</a-select-option>
<a-select-option value="1">否</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="4" style="padding: 0 10px 0 0;">
<a-form-item label="直播状态">
<a-select placeholder="请选择" v-model:value="queryParam.onLineClassType">
<a-select-option :value="undefined">请选择</a-select-option>
<a-select-option value="green">正常</a-select-option>
<a-select-option value="yellow">部分正常</a-select-option>
<a-select-option value="red">异常</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="5" style="padding: 0 10px 0 0;">
<a-form-item label="下节有课">
<a-select placeholder="请选择" v-model:value="queryParam.nextIsClass">
<a-select-option :value="undefined">请选择</a-select-option>
<a-select-option :value="true">是</a-select-option>
<a-select-option :value="false">否</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="5" style="padding: 0 10px 0 0;">
<a-form-item label="(即将/当前)有课">
<a-select placeholder="请选择" v-model:value="queryParam.nowIsClass">
<a-select-option :value="undefined">请选择</a-select-option>
<a-select-option :value="true">是</a-select-option>
<a-select-option :value="false">否</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
<!-- <a-button type="primary" preIcon="ant-design:check-square-outlined" @click="closeQuartz" v-if="shangXianQuartz.status == 0" style="margin-left: 8px">停止自动调整教室</a-button> -->
<!-- 永远开启 <a-button type="primary" preIcon="ant-design:border-outlined" @click="openQuartz" v-if="shangXianQuartz.status == -1" style="margin-left: 8px">开启自动调整教室</a-button> -->
<!--<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
</a>-->
</span>
</a-col>
</a-row>
</a-form>
</div>
<div class="jeecg-basic-table-form-container">
<a-row :gutter="24">
<a-col :lg="24" style="padding: 10px 50px 10px 10px;">
<div style="float: right;">
<a-button type="primary" :loading="btnLoading" @click="batchLiveOpen" style="margin-left: 8px">批量打开直播</a-button>
<a-button type="primary" :loading="btnLoading" @click="batchLiveClose" style="margin-left: 8px">批量关闭直播</a-button>
<a-button type="primary" :loading="btnLoading" @click="batchTingkeOpen" style="margin-left: 8px">批量打开听课</a-button>
<a-button type="primary" :loading="btnLoading" @click="batchTingkeClose" style="margin-left: 8px">批量关闭听课</a-button>
</div>
</a-col>
</a-row>
</div>
<a-table
rowKey="jsbh"
v-show="true"
:loading="loading"
:data-source="filterComputedDataSource"
:pagination="false"
bordered
size="middle"
class="ant-table-striped"
:scroll="{ y: 650 }"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
>
<a-table-column width="70px" title="序号" align="center" data-index="index">
<template #default="{ index }">
{{ index+1 }}
</template>
</a-table-column>
<a-table-column title="教学楼" data-index="jxlName"/>
<a-table-column title="教室" data-index="jsmc">
<template #default="{ text, record }">
<a :href="'http://'+record.ip" target="_blank">{{ text }}</a>
</template>
</a-table-column>
<a-table-column title="直播功能" align="center" data-index="zbgn">
<template #default="{ text }">
{{ text == 0?'是':'尚未接入' }}
</template>
</a-table-column>
<a-table-column title="开放听课" align="center" data-index="sfyx">
<template #default="{ text, record }">
<template v-if="record.zbgn == 0">{{ text == 0?'是':'否' }}</template>
<template v-else>-</template>
</template>
</a-table-column>
<!-- 5.开放听课(是、否)?? -->
<a-table-column title="直播状态" align="center" data-index="child_教师近景">
<template #default="{ record }">
<template v-if="record.zbgn == 0">
<span :class="getIsOnLineClass(record)" :title="onLineTitle[getIsOnLineClass(record)]">
<i class="fas fa-circle" />
</span>
</template>
<template v-else>
-
</template>
</template>
</a-table-column>
<a-table-column title="(即将/当前)有课" align="center" data-index="nowIsClass">
<template #default="{ record }">
{{ record?.nowIsClass?'是':'否' }}
</template>
</a-table-column>
<a-table-column title="下节有课" align="center" data-index="nextIsClass">
<template #default="{ record }">
{{ record?.nextIsClass?'是':'否' }}
</template>
</a-table-column>
<a-table-column title="备注" data-index="bfStatusInfo"/>
<!-- <a-table-column title="教师近景" align="center" data-index="child_教师近景">
<template #default="{ record }">
<span :class="record?.child['教师近景']?.isOnLine?'green':'red'">
<i class="fas fa-circle"/>
</span>
</template>
</a-table-column>
<a-table-column title="教师全景" align="center" data-index="child_教师全景">
<template #default="{ record }">
<span :class="record?.child['教师全景']?.isOnLine?'green':'red'">
<i class="fas fa-circle"/>
</span>
</template>
</a-table-column>
<a-table-column title="学生全景" align="center" data-index="child_学生全景">
<template #default="{ record }">
<span :class="record?.child['学生全景']?.isOnLine?'green':'red'">
<i class="fas fa-circle"/>
</span>
</template>
</a-table-column>
<a-table-column title="PPT" align="center" data-index="child_PPT">
<template #default="{ record }">
<span :class="record?.child['PPT']?.isOnLine?'green':'red'">
<i class="fas fa-circle"/>
</span>
</template>
</a-table-column>
<a-table-column title="直播推流" align="center" data-index="child_直播推流">
<template #default="{ record }">
<span :class="record?.child['教师全景']?.isOnLine?'green':'red'">
<i class="fas fa-circle"/>
</span>
</template>
</a-table-column> -->
<!-- <a-table-column title="数量" data-index="allIsOnLine"/> -->
<a-table-column width="210px" title="操作" data-index="action">
<template #default="{ record }">
<template v-if="record.zbgn == 0">
<a-button type="link" style="padding: 0" :disabled="record.allIsOnLine == 0" @click="ylLiveNew(record)">预览 |</a-button>
<!-- <a v-if="record.allIsOnLine == 0" :disabled="true" @click="ylLiveNew(record)" >预览 |</a>
<a v-else @click="ylLiveNew(record)" >预览 |</a> -->
<a v-if="!record?.child['教师全景']?.isOnLine" @click="changeLive(record,true)">开启直播 |</a>
<a v-else @click="changeLive(record,false)">关闭直播 |</a>
<a v-if="record.sfyx == 1" @click="changeKt(record,true)">开放听课</a>
<a v-else-if="record.sfyx == 0" @click="changeKt(record,false)">关闭听课</a>
<!-- {{ record.id }} -->
</template>
<template v-else>
<a-button type="link" style="padding: 0" disabled @click="ylLiveNew(record)">预览 |</a-button>
<a-button type="link" style="padding: 0" disabled v-if="!record?.child['教师全景']?.isOnLine" @click="changeLive(record,true)">开启直播 |</a-button>
<a-button type="link" style="padding: 0" disabled v-else @click="changeLive(record,false)">关闭直播 |</a-button>
<a-button type="link" style="padding: 0" disabled v-if="record.sfyx == 1" @click="changeKt(record,true)">开放听课</a-button>
<a-button type="link" style="padding: 0" disabled v-else-if="record.sfyx == 0" @click="changeKt(record,false)">关闭听课</a-button>
</template>
</template>
</a-table-column>
</a-table>
</div>
<a-modal :visible="isShowAllLive" width="80%" style="top: 20px" title="直播" :ok-button-props="{ style: { display: 'none' } }" cancelText="关闭" @cancel="() => (isShowAllLive = false,showAllLiveRef.close())">
<showAllLive ref="showAllLiveRef" :currentItem="currentItem" :isShowAllLive="isShowAllLive"/>
</a-modal>
<indexDetail ref="indexDetailRef" :leftList="leftList" @reload="loadData"/>
<indexJxlDetail ref="indexJxlDetailRef" @reload="loadData"/>
</template>
<script lang="ts" setup name="zhihuijiaoshiIndexPage">
import { defHttp } from '/@/utils/http/axios';
import { ref, onMounted, Ref, watch, reactive, computed } from 'vue';
import { nextTick } from 'vue';
import videojs from "video.js";
import { useMessage } from '/@/hooks/web/useMessage';
import showAllLive from './showAllLive.vue';
import indexDetail from './indexDetail.vue';
import indexJxlDetail from './indexJxlDetail.vue';
import { execAvyApi, getAvyCtrlLiveOpenOrCloseUrl } from "/@/views/site/utils/index";
import { JInput } from '/@/components/Form';
import { resumeJob, pauseJob } from '/@/views/monitor/quartz/quartz.api';
import { useRouter } from 'vue-router';
import { getSysConfig } from '/@/views/site/utils/index';
import { list as jiaoshirongliangList } from './KcJiaoshirongliang.api';
// const _document:any = window.document;
const showAllLiveRef = ref();
const indexDetailRef = ref();
const indexJxlDetailRef = ref();
const leftList:Ref<any> = ref([]);
const cardList:Ref<any> = ref([]);
const selectedRowKeys :Ref<any> = ref([]);
const currentItem:Ref<any> = ref({});
const statusLogList:Ref<any> = ref([]);
const currentCardIndex:Ref<any> = ref(0);
const allClassNum:Ref<any> = ref(0);
// const topWidth:any = ref('0');
// const isfirst:any = ref(false);
const showAllLiveKey:Ref<string> = ref('showAllLiveKey');
const isShowAllLive:Ref<boolean> = ref(false);
const loading:Ref<boolean> = ref(false);
const btnLoading:Ref<boolean> = ref(false);
const twoShowType:Ref<boolean> = ref(true);
const { createMessage, createInfoModal, createErrorModal } = useMessage();
const route = useRouter();
const queryParam:Ref<any> = ref({
zbgn: '0'
});
const onLineTitle:Ref<any> = ref({
'green':'直播正常',
'yellow':'部分异常',
'red':'设备异常',
});
const btnStatus:Ref<any> = ref({});
// onMounted(() => {
//loadData();
// getJianceBtnStatus();
// });
const filterComputedDataSource:Ref<any> = ref([]);
// const filterComputedDataSource = computed(() => {
// return filterDataSource();
// });
const thisOptions = computed(() => {
if(queryParam.value.jxlName){
let index = cardList.value.findIndex(x => x.jxlName == queryParam.value.jxlName);
if(index != -1){
return cardList.value[index]?.child??[];
}
}
return [];
})
enum Api {
list = '/jiaoshi/kcZhihuijiaoshi/list',
updateAllLive = '/jiaoshi/kcZhihuijiaoshi/updateAllLive',
changeAvyLiveApi = '/httpinterface/runAvyApiByIds',
xxhbjsjbxxList = '/xxhbjsjbxx/xxhbjsjbxx/list',
getRefreshLogList = '/jiaoshi/kcZhihuijiaoshiStateLog/list',
refreshLogs = '/jiaoshi/kcZhihuijiaoshi/refreshLogs',
getRedisKey = '/jiaoshi/kcZhihuijiaoshi/getRedisKey',
resettingRedisKeys = '/jiaoshi/kcZhihuijiaoshi/resettingRedisKeys',
}
/**
* 列表接口
* @param params
*/
const list = (params) => defHttp.get({ url: Api.list, params });
const updateAllLive = (params) => defHttp.get({ url: Api.updateAllLive, params });
const changeAvyLiveApi = (params) => defHttp.get({ url: Api.changeAvyLiveApi, params,timeout: 9000000 });
const jsjbxxList = (params) => defHttp.get({ url: Api.xxhbjsjbxxList, params,timeout: 9000000 });
const refreshLogs = (params) => defHttp.get({ url: Api.refreshLogs, params,timeout: 9000000 });
const getRefreshLogList = (params) => defHttp.get({ url: Api.getRefreshLogList, params,timeout: 9000000 });
const getRedisKey = (params) => defHttp.get({ url: Api.getRedisKey, params,timeout: 9000000 });
const resettingRedisKeys = (params) => defHttp.get({ url: Api.resettingRedisKeys, params,timeout: 9000000 });
const shangXianQuartz = ref<any>({});
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 10 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 14 },
});
const ipagination = ref(
{
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条';
},
showQuickJumper: true,
showSizeChanger: true,
total: 0,
}
);
function resettingRedisKeysFn(){
let keyList:any = [];
keyList.push('all');
cardList.value.forEach(x => {
keyList.push(x.jxlName);
});
resettingRedisKeys({ key: keyList.join(',')}).then(res => {
createInfoModal({ title: '结果',content: res });
getJianceBtnStatus()
})
}
function getJianceBtnStatusFor() {
getJianceBtnStatus();
setTimeout(() => {
if(btnStatus.value.all){
getJianceBtnStatusFor();
}else{
//加载数据
getRefreshLogListFn();
}
},10000);
}
function getJianceBtnStatus() {
getRedisKey({ key: 'zhihuijiaos:all:btnStatus'}).then(res => {
console.log(`🚀 --------------------------------------------------🚀`);
console.log(`🚀 ~ file: index.vue:597 ~ getRedisKey ~ res:`, res);
console.log(`🚀 --------------------------------------------------🚀`);
btnStatus.value.all = res;
});
cardList.value.forEach(x => {
getRedisKey({ key: `zhihuijiaos:${ x.jxlName }:btnStatus`}).then(res => {
console.log(`🚀 --------------------------------------------------🚀`);
console.log(`🚀 ~ file: index.vue:597 ~ getRedisKey ~ res:`, res);
console.log(`🚀 --------------------------------------------------🚀`);
if(res){
btnStatus.value.all = true;
}
btnStatus.value[x.jxlName] = res
});
});
}
function loadData(){
loading.value = true;
indexDetailRef.value.changeLoadDataLoading(true);
let getListAction:any = [];
cardList.value = [];
let liveIsExist = (x) => {
return new Promise((resolve,reject) => {
videojs.xhr.get(x.pullUrl,(err, resp, body) => {
if(err){
reject(false);
x.isOnLine = false
// reject(true);
// x.isOnLine = true
}else{
resolve(true);
x.isOnLine = true
}
})
//此法不行,会跨域
// defHttp.get({ url: x.pullUrl }, { isExternal: true, withToken: true }).then(res => {
// resolve(true);
// x.isOnLine = true;
// }).catch(eres => {
// reject(false);
// x.isOnLine = false;
// })
})
}
list({ pageSize: -1, changshang: '奥威亚', queryNoZhiHuiJiaoShi: true, ...queryParam.value }).then(res => {
let list = (res?.records) ?? [];
//聚合
let map = {};
let jxlMap = {};
list.forEach(x => {
// x.nowIsClass = true //debug
x.zbgn = 0;
if(!x.xm){
x.zbgn = 1;
}
let item = map[x.jsmc];
x.isOnLine = false;
if(item){
item.child[x.xm] = x;
}else{
let child = {};
child[x.xm] = x;
map[x.jsmc] = {
...x,
child,
value: x.jsmc,
label: x.jsmc,
};
item = map[x.jsmc];
}
});
leftList.value = Object.values(map);
let changeAllList = () => {
leftList.value.forEach(x => {
let item = jxlMap[x.jxlId];
getIsOnLineClass(x);
if(item){
item.child.push(x);
}else{
let child = [x];
jxlMap[x.jxlId] = {
...x,
child,
value: x.jxlName,
label: x.jxlName,
};
item = jxlMap[x.jxlId];
}
//提前执行一遍,为了数量
//console.log('getIsOnLineClass(item) -> ',getIsOnLineClass(item));
});
cardList.value = Object.values(jxlMap);
filterComputedDataSource.value = filterDataSource();
loading.value = false;
indexDetailRef.value.changeLoadDataLoading(false);
console.log('leftList ->',leftList);
getJianceBtnStatusFor();
}
nextTick(() => {
leftList.value.forEach(item => {
let child = item.child;
Object.values(child).forEach(item => {
let x:any = item;
// if(x.pullUrl == 'https://kczx.nenu.edu.cn:9553/live_hls/yfjxl101s_lbzj.m3u8')
if(x.pullUrl){
getListAction.push(liveIsExist(x));
}
});
});
Promise.all(getListAction).then(resList => {
console.log(`🚀 ~ file: index.vue:685 ~ Promise.all ~ ress:`, resList);
// loading.value = false;
//queryParam.value._ = resList;
//changeAllList();
}).catch((e) => {
console.error(`🚀 ~ file: index.vue:690 ~ Promise.all Error ~ ress:`, e);
//changeAllList();
// loading.value = false;
}).finally((...d) => {
console.log("正常执行!",...d);
changeAllList();
});
});
//计算左侧菜单高度
// let mainDiv:any = _document?.querySelector('.ant-layout .jeecg-default-layout-main > div');
// topWidth.value =mainDiv?.style?.height?? '0';
});
getAutoShangXianQuartz();
getJsjbxxList();
getRefreshLogListFn();
}
function openDetail(param){
indexDetailRef.value.open(param);
// indexDetailRef.value.changeQueryParam(param);
}
function openJxlDetail(param){
indexJxlDetailRef.value.open(param);
}
function jxlNameFilterOptionFn(input: string, option: any){
console.log(input, option);
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
// return true;
}
function getJsjbxxList(){
// jsjbxxList({ pageSize: -1, changshang: '奥威亚',...queryParam.value }).then(res => {
// let list = (res?.records) ?? [];
// allClassNum.value = list.length;
// });
jiaoshirongliangList({ pageSize: -1 }).then(res => {
let list = (res?.records) ?? [];
allClassNum.value = list.length;
});
}
function refreshLogsFn(jxlName?){
//createInfoModal({ title: '结果',content: '执行中请等待3~5分钟后刷新页面' });
if(jxlName){
btnStatus.value[jxlName] = true;
btnStatus.value.all = true;
}else{
btnStatus.value.all = true;
}
refreshLogs({ jxlName }).then(res => {
let list = (res?.records) ?? (res) ?? [];
console.log(`🚀 ----------------------------------------------------------🚀`);
console.log(`🚀 ~ file: index.vue:539 ~ refreshLogsFn ~ list:`, list);
console.log(`🚀 ----------------------------------------------------------🚀`);
statusLogList.value = list;
getJianceBtnStatus();
})
}
function getRefreshLogListFn(){
getRefreshLogList({ pageSize: -1 }).then(res => {
let list = (res?.records) ?? [];
console.log(`🚀 ----------------------------------------------------------🚀`);
console.log(`🚀 ~ file: index.vue:539 ~ getRefreshLogList ~ list:`, list);
console.log(`🚀 ----------------------------------------------------------🚀`);
statusLogList.value = list;
})
}
//获取class样式
function getIsOnLineClass(record){
let resClas = 'red';
// let allIsOnLine = sfYxMap.value[record?.child['教师近景']?.id]?1:0 + sfYxMap.value[record?.child['教师全景']?.id]?1:0 + sfYxMap.value[record?.child['学生全景']?.id]?1:0 + sfYxMap.value[record?.child['PPT']?.id]?1:0;
let allIsOnLine = (record?.child['教师近景']?.isOnLine?1:0) + (record?.child['教师全景']?.isOnLine?1:0) + (record?.child['学生全景']?.isOnLine?1:0) + (record?.child['PPT']?.isOnLine?1:0);
record.allIsOnLine = allIsOnLine;
let bfStatusInfo = '';
record.bfStatusInfo = bfStatusInfo;
let bfStatusInfoList:any = [];
if(!record?.child['教师近景']?.isOnLine){
bfStatusInfoList.push('教师近景没有信号');
}
if(!record?.child['教师全景']?.isOnLine){
bfStatusInfoList.push('教师全景没有信号');
}
if(!record?.child['学生全景']?.isOnLine){
bfStatusInfoList.push('学生全景没有信号');
}
if(!record?.child['PPT']?.isOnLine){
bfStatusInfoList.push('PPT没有信号');
}
if(allIsOnLine == 4){
resClas = 'green';
}else if(allIsOnLine == 0){
resClas = 'red';
}else{
resClas = 'yellow';
record.bfStatusInfo = bfStatusInfoList.join(',');
}
record.onLineClassType = resClas;
return resClas;
}
function ylLive(record){
isShowAllLive.value = true
nextTick(() => {
currentItem.value = record
})
}
function onSelectChange(selectedRowKeyList: string | number[]){
selectedRowKeys.value = selectedRowKeyList;
}
function onSelectChange2(key,selectedRowKeyList: string | number[]){
// console.log(`🚀 ------------------------------------------------------------------------------------🚀`);
// console.log(`🚀 ~ file: index.vue:741 ~ onSelectChange2 ~ selectedRowKeyList:`, selectedRowKeyList,...d);
// console.log(`🚀 ------------------------------------------------------------------------------------🚀`);
// let c = selectedRowKeyList[0]
let index = cardList.value.findIndex(x => x.jsbh == key);
currentCardIndex.value = index
searchReset()
// selectedRowKeys.value = selectedRowKeyList;
}
function checkSelectValue(){
return checkIsList(selectedRowKeys.value);
}
function checkIsList(list){
let r = !!(list??[]).length;
if(!r){
createErrorModal({ title: '错误', content: '请选择有效数据!' });
}
return !r;
}
function getSelectData(expression){
//筛选数据
let keyMaps = {};
selectedRowKeys.value.forEach(x => keyMaps[x] = true);
let changeList = filterComputedDataSource.value.filter(x => keyMaps[x.jsbh] && expression(x));
return changeList;
}
function batchLive(type: boolean){
if(checkSelectValue()) return;
let changeList = getSelectData((x) => x?.child['教师全景']?.isOnLine == !type);
if(checkIsList(changeList)) return;
btnLoading.value = true;
//调用接口
let ids:any = [];
let isEnable = type;
changeList.forEach(x => ids.push(x?.child['教师全景']?.id))
if(!ids) return;
changeAvyLiveApi({ ids:ids.join(','), type: isEnable?1:0 }).then(res => {
let content = '';
res.forEach(x => {
// content += x.jsmc + "-" + x.xm
content += x.jsmc
let text = '';
if(x.resText){
if(x.resText.includes('ok')){
text = (isEnable?'开启':'关闭')+'直播-操作成功!'
}else{
text = (isEnable?'开启':'关闭')+'直播-操作失败: 录播主机故障,请联系管理员。'
}
}
content += " " + text + "<br/>"
});
if(content.includes('直播-操作成功!')){
//延迟12秒
setTimeout(() => {
loadData();
createInfoModal({ width:'50%', title: '结果',content })
}, 10*1000);//10秒
}else{
loadData();
createInfoModal({ width:'50%', title: '结果',content })
}
}).catch(e => {
console.error(e);
btnLoading.value = false;
createInfoModal({title: '错误结果',content:e})
})
}
function batchTingke(type: boolean){
if(checkSelectValue()) return;
let changeList = getSelectData((x) => x?.sfyx == type?1:0);
if(checkIsList(changeList)) return;
btnLoading.value = true;
//调用接口
let ids:any = [];
changeList.forEach(record => Object.values(record.child).forEach(x => {
let item:any = x;
ids.push(item.id);
}))
if(!ids) return;
updateAllLive({ ids: ids.join(','), sfyx: type?0:1}).then(res => {
loadData();
}).catch(e => {
console.error(e);
btnLoading.value = false;
});
}
function batchLiveOpen(){
batchLive(true);
}
function batchLiveClose(){
batchLive(false);
}
function batchTingkeOpen(){
batchTingke(true);
}
function batchTingkeClose(){
batchTingke(false);
}
function ylLiveNew(record) {
let routeData = route.resolve({ path:'/site/liveRoom2',query:{ id: record.jsbh, ktId: record.nowIsClassId } });
window.open(routeData.href, '_blank');
}
function changeLive(record, isEnable){
console.log('createInfoModal ->',createInfoModal);
loading.value = true;
let ids:any = [];
let changeLiveEnd:any = [];
Object.values(record.child).forEach(x => {
let item:any = x;
//收集ID
if(item.xm == '教师近景'){
ids.push(item.id);
}
});
changeAvyLiveApi({ ids:ids.join(','), type: isEnable?1:0 }).then(res => {
console.log(`🚀 -------------------------------------------------------🚀`);
console.log(`🚀 ~ file: index.vue:295 ~ changeAvyLiveApi ~ res:`, res);
console.log(`🚀 -------------------------------------------------------🚀`);
let content = '';
res.forEach(x => {
// content += x.jsmc + "-" + x.xm
content += x.jsmc
let text = '';
if(x.resText){
if(x.resText.includes('ok')){
text = (isEnable?'开启':'关闭')+'直播-操作成功!'
}else{
text = (isEnable?'开启':'关闭')+'直播-操作失败: 录播主机故障,请联系管理员。'
}
}
content += " " + text + "<br/>"
});
if(content.includes('直播-操作成功!')){
//延迟12秒
setTimeout(() => {
loadData();
createInfoModal({ width:'50%', title: '结果',content })
}, 12*1000);
}else{
loadData();
createInfoModal({ width:'50%', title: '结果',content })
}
}).catch(e => {
console.error(e);
loading.value = false;
createInfoModal({title: '错误结果',content:e})
})
}
function changeKt(record, isEnable){
loading.value = true;
let ids:any = [];
Object.values(record.child).forEach(x => {
let item:any = x;
ids.push(item.id);
});
if(!ids) return;
updateAllLive({ ids: ids.join(','), sfyx: isEnable?0:1}).then(res => {
loadData();
}).catch(e => {
console.error(e);
loading.value = false;
})
}
function tableChange(pagination) {
ipagination.value.current = pagination.current;
ipagination.value.pageSize = pagination.pageSize;
loadData();
}
function filterDataSource() {
let dataSource:any = [];
//let list = cardList.value[currentCardIndex.value]?.child??[];
let list = leftList.value??[];
let qw = queryParam.value;
console.log('->',qw, qw.nowIsClass);
list.forEach(x => {
let isReturn = true;
if(qw.jxlName){
if(isReturn) isReturn = x.jxlName?.includes(qw.jxlName);
}
if(qw.jsmc){
if(isReturn) isReturn = x.jsmc?.includes(qw.jsmc);
}
if(qw.sfyx){
if(isReturn) isReturn = x.sfyx == qw.sfyx;
}
if(qw.zbgn){
if(isReturn) isReturn = x.zbgn == qw.zbgn;
}
if(qw.onLineClassType){
if(isReturn) isReturn = x.onLineClassType == qw.onLineClassType;
}
if(qw.nowIsClass != undefined){
if(qw.nowIsClass == true){
if(isReturn) isReturn = x.nowIsClass == true;
}else{
if(isReturn) isReturn = x.nowIsClass == false || x.nowIsClass == undefined || x.nowIsClass == null;
}
}
if(qw.nextIsClass != undefined){
if(qw.nextIsClass == true){
if(isReturn) isReturn = x.nextIsClass == true;
}else{
if(isReturn) isReturn = x.nextIsClass == false || x.nextIsClass == undefined || x.nextIsClass == null;
}
}
if(isReturn){
dataSource.push(x);
}
})
return dataSource;
}
/**
* 查询
*/
function searchQuery() {
filterComputedDataSource.value = filterDataSource();
//loadData();
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {
zbgn: '0'
};
//刷新数据
filterComputedDataSource.value = filterDataSource();
//loadData();
}
function getAutoShangXianQuartz(){
defHttp.get({ url: '/jiaoshi/kcZhihuijiaoshi/getAutoShangXianQuartz', params: {} }).then(res => {
shangXianQuartz.value = res;
})
}
/**
* 启动
*/
async function openQuartz(){
await resumeJob({ id: shangXianQuartz.value.id }, loadData);
}
/**
* 暂停
*/
async function closeQuartz(){
await pauseJob({ id: shangXianQuartz.value.id }, loadData);
}
</script>
<style lang="less" scoped>
.videoMax{
width: 25%;
}
.videoCardMain {
:deep(.ant-card-body) {
padding: 0;
}
}
/* 隐藏video 进度条 */
video::-webkit-media-controls-timeline {
display: none;
}
.green {
color: green;
}
.red {
color: red;
}
.yellow {
color: yellow;
}
// .green {
// color: #1ab394;
// }
.orange {
color: #ed9535;
}
.blue {
color: #1c84c6;
}
.jeecg-basic-table-form-container {
.ant-form {
padding: 12px 10px 0 10px;
margin-bottom: 8px;
background-color: #fff;
border-radius: 2px;
}
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
}
.jeecg-basic-table-form-containera{
line-height: 24px;
background: #fff;
padding: 20px 0 0 10px;
margin-bottom: -20px;
}
.jeecg-basic-table .ant-table-wrapper .ant-table-title {
min-height: 0px !important;
padding: 0 0 8px 0 !important;
}
.active{
background-color: #36b395;
color: #ffffff;
}
.active .fjdskf{
color: #ffffff;
}
.active .bgshua .ant-btn-primary{
background-color: #ffffff;
color: #36b395;
border-color: #fff;
}
.cardDiv {
:deep(.ant-divider-horizontal) {
margin: 12px 0;
}
:deep(.ant-card-head-title) {
font-weight: 700;
line-height: 32px;
}
}
.numberBlob {
text-align: center;
// height: 100px;
height: 5rem;
.numSpan {
font-size: 2rem;
}
.numberName {
font-weight: 700;
}
.fs3r {
font-size: 2rem;
}
}
.handleCss{
cursor:pointer;
// :hover {
// color: red;
// }
}
.hover :hover{
color:#1c84c6;
//font-size: 1.1rem;
font-weight: bold;
}
.iconel{
float: left;
width: 50px;
margin-right: 8px;
}
.iconer{
float: left;
}
.ictitle{
font-size: 15px;
color: #000000;
font-weight: 600;
text-align: left;
}
.ant-form-item{
margin-bottom: 10px;
}
</style>