This commit is contained in:
yangjun 2023-11-09 08:28:53 +08:00
commit d96b6ffc95
3 changed files with 74 additions and 13 deletions

View File

@ -7,7 +7,12 @@
<a-card class="cardDiv">
<template #title>
<div style="float: left;">教室情况</div>
<div style="float: right"><a-button type="primary" @click="refreshLogsFn()">设备检测</a-button></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]">
@ -106,7 +111,10 @@
<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 type="primary" @click="refreshLogsFn(item.jxlName)">设备检测</a-button></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})"><span>{{ item.jsNum }}</span></a-col>
@ -120,6 +128,7 @@
<a-col :span="6" >
<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>
@ -519,8 +528,11 @@ const onLineTitle:Ref<any> = ref({
'red':'设备异常',
});
const btnStatus:Ref<any> = ref({});
// onMounted(() => {
// loadData();
//loadData();
// getJianceBtnStatus();
// });
const filterComputedDataSource:Ref<any> = ref([]);
@ -529,15 +541,8 @@ const filterComputedDataSource:Ref<any> = ref([]);
// return filterDataSource();
// });
const thisOptions = computed(() => {
console.log('',queryParam.value.jxlName,);
if(queryParam.value.jxlName){
let index = cardList.value.findIndex(x => x.jxlName == queryParam.value.jxlName);
console.log(`🚀 ------------------------------------------------------🚀`);
console.log(`🚀 ~ file: index.vue:536 ~ thisOptions ~ index:`, index,cardList);
console.log(`🚀 ------------------------------------------------------🚀`);
if(index != -1){
return cardList.value[index]?.child??[];
}
@ -552,6 +557,8 @@ enum Api {
xxhbjsjbxxList = '/xxhbjsjbxx/xxhbjsjbxx/list',
getRefreshLogList = '/jiaoshi/kcZhihuijiaoshiStateLog/list',
refreshLogs = '/jiaoshi/kcZhihuijiaoshi/refreshLogs',
getRedisKey = '/jiaoshi/kcZhihuijiaoshi/getRedisKey',
resettingRedisKeys = '/jiaoshi/kcZhihuijiaoshi/resettingRedisKeys',
}
/**
* 列表接口
@ -563,6 +570,8 @@ const changeAvyLiveApi = (params) => defHttp.get({ url: Api.changeAvyLiveApi, pa
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>({});
@ -589,6 +598,50 @@ const ipagination = ref(
}
);
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);
@ -672,6 +725,7 @@ function loadData(){
indexDetailRef.value.changeLoadDataLoading(false);
console.log('leftList ->',leftList);
getJianceBtnStatusFor();
}
@ -735,13 +789,20 @@ function getJsjbxxList(){
}
function refreshLogsFn(jxlName?){
createInfoModal({ title: '结果',content: '执行中请等待3~5分钟后刷新页面' });
//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();
})
}

View File

@ -17,7 +17,7 @@
</span>
<span style="margin-left: 10px;background: #1c84c6;color: #fff;padding: 3px;border-radius: 5px;font-size: 12px;" @click="() => tingKeZuJiAddModal.view({ ketangbiaoid: route.query.ktId })">填写评价表</span>
<div style="font-size: .5rem;">
{{ ktangInfo.zc || ' ' }}-{{ ktangInfo.skjs || ' ' }}
{{ ktangInfo.zc || ' ' }}-{{ ktangInfo.skjs || ' ' }}-学分{{ ktangInfo.xf || ' ' }}-选课人数{{ ktangInfo.xkrs || ' ' }}-课程性质{{ ktangInfo.kcxz || ' ' }}-开课单位{{ ktangInfo.kkdw || ' ' }}
</div>
</template>
<div style="padding: 1rem;">

View File

@ -18,7 +18,7 @@
</span>
<!-- <span style="margin-left: 10px;background: #1c84c6;color: #fff;padding: 3px;border-radius: 5px;font-size: 12px;" @click="() => tingKeZuJiAddModal.view({ ketangbiaoid: route.query.ktId })">填写评价表</span> -->
<div style="font-size: .5rem;">
{{ ktangInfo.zc || ' ' }}-{{ ktangInfo.skjs || ' ' }}
{{ ktangInfo.zc || ' ' }}-{{ ktangInfo.skjs || ' ' }}-学分{{ ktangInfo.xf || ' ' }}-选课人数{{ ktangInfo.xkrs || ' ' }}-课程性质{{ ktangInfo.kcxz || ' ' }}-开课单位{{ ktangInfo.kkdw || ' ' }}
</div>
</span>
<span v-else>