This commit is contained in:
yangjun 2024-02-28 08:36:19 +08:00
commit 06e21726d7
3 changed files with 254 additions and 5 deletions

View File

@ -56,7 +56,11 @@ export const columns: BasicColumn[] = [
title: '状态指示',
align: "center",
dataIndex: 'type',
},
{
title: '状态指示(标记)',
align: "center",
dataIndex: 'forceState',
},
];

View File

@ -46,9 +46,9 @@
</div>
</a-col>
<a-col :span="6">
<div class="numberBlob handleCss" @click="openDetail({ onLineClassType: ['red', 'yellow'] })">
<div class="numberBlob handleCss" @click="openLogDetail({ forceStateIsBad: 'red' })">
<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 v-else class="numSpan orange">{{ statusLogList.filter(x => x.forceState == 'red' || x.type != 'green' ).length || 0 }}</div>
<div class="numberName">
<!-- <RiseOutlined class="orange"/> -->
设备异常
@ -123,11 +123,11 @@
<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.tjKftkzt == 1).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 handleCss" :span="6" style="font-weight: 600;" @click="openLogDetail({ jxlName: item.jxlName, forceStateIsBad: 'red' })" v-else><span>{{ statusLogList.filter(x => x.jxlName == item.jxlName && ( x.forceState == 'red' || 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, tjKftkzt:'1' })"><span>开放听课</span></a-col>
<a-col :span="6" @click="openDetail({ jxlName: item.jxlName, onLineClassType: ['red', 'yellow'] })">
<a-col :span="6" @click="openLogDetail({ jxlName: item.jxlName })">
<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>
@ -492,6 +492,11 @@
<a v-if="record.tjKftkzt == 0" @click="changeKftk(record,'1')"> | 开放听课</a>
<a v-else-if="record.tjKftkzt == 1" @click="changeKftk(record,'0')"> | 关闭听课</a>
<a @click="changeSdjc(record)"> | 手动检测</a>
<a-button type="link" style="padding: 0" @click="jcZhiHuiJiaoShi(record)">检测教室 |</a-button>
<a-button type="link" style="padding: 0" v-if="!record.forceState || record.forceState == 'red'" @click="changeFlag(record, 'green')">标记为有效 |</a-button>
<a-button type="link" style="padding: 0" v-if="record.forceState == 'green'" @click="changeFlag(record, 'red')">标记为无效 |</a-button>
<!-- {{ record.id }} -->
</template>
<template v-else>
@ -503,6 +508,10 @@
<a-button v-if="record.tjKftkzt == 0" @click="changeKftk(record,'1')"> | 开放听课</a-button>
<a-button v-else-if="record.tjKftkzt == 1" @click="changeKftk(record,'0')"> | 关闭听课</a-button>
<a-button @click="changeSdjc(record)"> | 手动检测</a-button>
<a-button type="link" style="padding: 0" disabled @click="jcZhiHuiJiaoShi(record)">检测教室 |</a-button>
<a-button type="link" style="padding: 0" disabled v-if="!record.forceState || record.forceState == 'red'" @click="changeFlag(record, 'green')">标记为有效 |</a-button>
<a-button type="link" style="padding: 0" disabled v-if="record.forceState == 'green'" @click="changeFlag(record, 'red')">标记为无效 |</a-button>
</template>
</template>
</a-table-column>
@ -513,6 +522,7 @@
</a-modal>
<indexDetail ref="indexDetailRef" :leftList="leftList" @reload="loadData"/>
<indexJxlDetail ref="indexJxlDetailRef" @reload="loadData"/>
<indexLogDetail ref="indexLogDetailRef" @reload="loadData"/>
</template>
<script lang="ts" setup name="zhihuijiaoshiIndexPage">
import { defHttp } from '/@/utils/http/axios';
@ -523,6 +533,7 @@ import { useMessage } from '/@/hooks/web/useMessage';
import showAllLive from './showAllLive.vue';
import indexDetail from './indexDetail.vue';
import indexJxlDetail from './indexJxlDetail.vue';
import indexLogDetail from './indexLogDetail.vue';
import { execAvyApi, getAvyCtrlLiveOpenOrCloseUrl } from "/@/views/site/utils/index";
import { JInput } from '/@/components/Form';
import { resumeJob, pauseJob } from '/@/views/monitor/quartz/quartz.api';
@ -537,6 +548,7 @@ import { list as jiaoshirongliangList } from './KcJiaoshirongliang.api';
const showAllLiveRef = ref();
const indexDetailRef = ref();
const indexJxlDetailRef = ref();
const indexLogDetailRef = ref();
const leftList:Ref<any> = ref([]);
const cardList:Ref<any> = ref([]);
@ -820,6 +832,10 @@ function openJxlDetail(param){
indexJxlDetailRef.value.open(param);
}
function openLogDetail(param){
indexLogDetailRef.value.open(param);
}
function jxlNameFilterOptionFn(input: string, option: any){
console.log(input, option);
@ -908,6 +924,7 @@ function getIsOnLineClass(record){
resClas = 'green';
}else if(allIsOnLine == 0){
resClas = 'red';
record.bfStatusInfo = '设备连接异常';
}else{
resClas = 'yellow';
record.bfStatusInfo = bfStatusInfoList.join(',');
@ -1126,6 +1143,120 @@ function changeKt(record, isEnable){
}
//
function jcZhiHuiJiaoShi(record){
let jxlMap = {};
let getListAction:any = [];
let liveIsExist = (x) => {
return new Promise((resolve,reject) => {
videojs.xhr.get(x.pullUrl,(err, resp, body) => {
if(err){
reject(x);
x.isOnLine = false
}else{
resolve(x);
x.isOnLine = true
}
})
})
}
// 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();
// }
// leftList.value.forEach(item => {
let child = record.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 => {
// createMessage.success('' + resList.join(','));
// console.log(resList);
// let msgList:any = [];
// resList.forEach((x) => {
// console.log(x);
// msgList.push(x.xm + '');
// })
// createInfoModal({ title: '',content: msgList.join(',') });
}).catch((e) => {
console.error(`🚀 ~ file: index.vue:1170 ~ Promise.all Error ~ ress:`, e);
// let msgList:any = [];
// if(e){
// e.forEach((x) => {
// console.log(x);
// msgList.push(x.xm + '');
// })
// createInfoModal({ title: '',content: msgList.join(',') });
// }
// createMessage.error('' + resList.join(','));
}).finally((...d) => {
console.log("正常执行!",...d);
//
let isSuccess = true;
let msgList:any = [];
let child = record.child;
Object.values(child).forEach(item => {
let _item = item as any;
if(_item.isOnLine){
msgList.push(_item.xm + ':连接成功!');
}else{
msgList.push(_item.xm + ':连接失败!');
isSuccess = false;
}
});
if(msgList.length){
if(isSuccess){
createInfoModal({ title: '成功!', content: msgList.join(',') });
}else{
createErrorModal({ title: '失败!', content: msgList.join(',') });
}
}
//createMessage.error('JTreeSelect-conditionjson!');
// changeAllList();
});
}
function changeFlag(record, flag){
record.forceState = flag;
defHttp.post({ url: '/jiaoshi/kcZhihuijiaoshiStateLog/updateByJsbh', params: {
jsbh: record.jsbh,
forceState: flag
}});
}
function tableChange(pagination) {
ipagination.value.current = pagination.current;
ipagination.value.pageSize = pagination.pageSize;

View File

@ -0,0 +1,114 @@
<template>
<a-modal :visible="isShowPage" width="80%" style="top: 20px" title="详情" :ok-button-props="{ style: { display: 'none' } }" cancelText="关闭" @cancel="() => (isShowPage = false)">
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
</BasicTable>
</a-modal>
</template>
<script lang="ts" name="jiaoshi-kcJiaoshirongliang" setup>
import {ref, computed, unref, Ref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import { columns, searchFormSchema } from './KcZhihuijiaoshiStateLog.data';
import { list } from './KcZhihuijiaoshiStateLog.api';
const queryParam:any = ref({});
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, { openModal }] = useModal();
//table
const { tableContext } = useListPage({
tableProps:{
title: '教室容量',
api: list,
columns,
canResize:false,
showActionColumn: false,
immediate: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToNumber: [
],
fieldMapToTime: [
],
},
beforeFetch: (params) => {
params.column = '',params.order = '';//
return Object.assign(params, queryParam.value);
},
actionColumn: {
width: 120,
fixed:'right'
},
},
})
const [registerTable, { reload },{ rowSelection, selectedRowKeys }] = tableContext
const isShowPage:Ref<boolean> = ref(false);
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}
]
}
function getDropDownAction(record){
return []
}
function open(param){
// changeQueryParam(param);
queryParam.value = Object.assign({ }, param);
reload();
isShowPage.value = true;
}
function close(){
isShowPage.value = false;
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
defineExpose({
open,
close,
});
</script>
<style scoped>
</style>