2023年10月26日 新增批量操作
This commit is contained in:
parent
083396d3a6
commit
e793d48ff0
|
@ -70,7 +70,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :xs="{ span: 6 }" :sm="{ span: 6 }" :lg="{ span: 6 }">
|
||||
<a-col :xs="{ span: 6 }" :sm="{ span: 6 }" :lg="{ span: 6 }">
|
||||
<div class="numberBlob handleCss" @click="() => (queryParam = {},queryParam.onLineClassType = 'red')">
|
||||
<div class="numSpan orange">{{ (leftList.filter(x => !x?.child['教师近景']?.isOnLine).length || 0) }}</div>
|
||||
<div class="numberName">
|
||||
|
@ -116,38 +116,38 @@
|
|||
<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="8">
|
||||
<a-col :lg="4">
|
||||
<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-input placeholder="请输入" v-model:value="queryParam.jxlName"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="8">
|
||||
<a-col :lg="4">
|
||||
<a-form-item label="教室">
|
||||
<a-input placeholder="请输入教室" v-model:value="queryParam.jsmc"/>
|
||||
<a-input placeholder="请输入" v-model:value="queryParam.jsmc"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="8">
|
||||
<a-col :lg="4">
|
||||
<a-form-item label="直播功能">
|
||||
<a-select placeholder="请选择直播功能" v-model:value="queryParam.sfyx">
|
||||
<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="8">
|
||||
<a-col :lg="4">
|
||||
<a-form-item label="开放听课">
|
||||
<a-select placeholder="请选择开放听课" v-model:value="queryParam.sfyx2">
|
||||
<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="8">
|
||||
<a-col :lg="4">
|
||||
<a-form-item label="直播状态">
|
||||
<a-select placeholder="请选择直播状态" v-model:value="queryParam.onLineClassType">
|
||||
<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>
|
||||
|
@ -155,18 +155,18 @@
|
|||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="8">
|
||||
<a-col :lg="4">
|
||||
<a-form-item label="当前有课">
|
||||
<a-select placeholder="请选择当前有课" v-model:value="queryParam.nowIsClass">
|
||||
<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 :lg="8">
|
||||
<a-col :lg="4">
|
||||
<a-form-item label="下节有课">
|
||||
<a-select placeholder="请选择下节有课" v-model:value="queryParam.nextIsClass">
|
||||
<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>
|
||||
|
@ -175,24 +175,39 @@
|
|||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<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: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>-->
|
||||
</a-col>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" :loading="loading" @click="batchLiveOpen" style="margin-left: 8px">批量打开直播</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" :loading="loading" @click="batchLiveClose" style="margin-left: 8px">批量关闭直播</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" :loading="loading" @click="batchTingkeOpen" style="margin-left: 8px">批量打开听课</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" :loading="loading" @click="batchTingkeClose" 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>
|
||||
|
||||
<a-table v-show="true" :loading="loading" :data-source="filterComputedDataSource" :pagination="false" bordered size="middle" class="ant-table-striped" :scroll="{ y: 650 }">
|
||||
<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 }}
|
||||
|
@ -205,7 +220,7 @@
|
|||
</template>
|
||||
</a-table-column>
|
||||
|
||||
<a-table-column title="直播功能" align="center" data-index="sfyx">
|
||||
<a-table-column title="直播功能" align="center" data-index="zbgn">
|
||||
<template #default="{ text }">
|
||||
{{ text == 0?'是':'否' }}
|
||||
</template>
|
||||
|
@ -310,6 +325,7 @@ const showAllLiveRef = ref();
|
|||
|
||||
const leftList:Ref<any> = ref([]);
|
||||
const cardList:Ref<any> = ref([]);
|
||||
const selectedRowKeys :Ref<any> = ref([]);
|
||||
const currentItem:Ref<any> = ref({});
|
||||
const currentCardIndex:Ref<any> = ref(0);
|
||||
const allClassNum:Ref<any> = ref(0);
|
||||
|
@ -318,7 +334,7 @@ const allClassNum:Ref<any> = ref(0);
|
|||
const showAllLiveKey:Ref<string> = ref('showAllLiveKey');
|
||||
const isShowAllLive:Ref<boolean> = ref(false);
|
||||
const loading:Ref<boolean> = ref(false);
|
||||
const { createMessage, createInfoModal } = useMessage();
|
||||
const { createMessage, createInfoModal, createErrorModal } = useMessage();
|
||||
const route = useRouter();
|
||||
const queryParam:Ref<any> = ref({});
|
||||
|
||||
|
@ -351,11 +367,11 @@ const shangXianQuartz = ref<any>({});
|
|||
|
||||
const labelCol = reactive({
|
||||
xs: { span: 24 },
|
||||
sm: { span: 7 },
|
||||
sm: { span: 6 },
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
sm: { span: 19 },
|
||||
});
|
||||
|
||||
const ipagination = ref(
|
||||
|
@ -407,6 +423,7 @@ function loadData(){
|
|||
let map = {};
|
||||
let jxlMap = {};
|
||||
list.forEach(x => {
|
||||
x.zbgn = 0;
|
||||
let item = map[x.jsmc];
|
||||
x.isOnLine = false;
|
||||
if(item){
|
||||
|
@ -523,6 +540,109 @@ function ylLive(record){
|
|||
})
|
||||
}
|
||||
|
||||
function onSelectChange(selectedRowKeyList: string | number[]){
|
||||
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;
|
||||
loading.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 })
|
||||
}, 12*1000);
|
||||
}else{
|
||||
loadData();
|
||||
createInfoModal({ width:'50%', title: '结果',content })
|
||||
}
|
||||
|
||||
}).catch(e => {
|
||||
console.error(e);
|
||||
loading.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;
|
||||
//调用接口
|
||||
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);
|
||||
loading.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 } });
|
||||
window.open(routeData.href, '_blank');
|
||||
|
@ -620,8 +740,8 @@ function filterDataSource() {
|
|||
if(qw.sfyx){
|
||||
isReturn = x.sfyx == qw.sfyx;
|
||||
}
|
||||
if(qw.sfyx2){
|
||||
isReturn = x.sfyx == qw.sfyx2;
|
||||
if(qw.zbgn){
|
||||
isReturn = x.zbgn == qw.zbgn;
|
||||
}
|
||||
if(qw.onLineClassType){
|
||||
isReturn = x.onLineClassType == qw.onLineClassType;
|
||||
|
|
Loading…
Reference in New Issue