|
@@ -27,7 +27,7 @@
|
|
|
</div>
|
|
|
<div class="part-box">
|
|
|
<a-space
|
|
|
- v-if="searchModel.examSiteId && searchModel.taskId"
|
|
|
+ v-if="searchModel.examSiteId && searchModel.taskId && tableData.length"
|
|
|
class="part-action"
|
|
|
:size="12"
|
|
|
>
|
|
@@ -35,7 +35,7 @@
|
|
|
<span style="color: #ff9a2e">时段关联最小单位是考点</span>
|
|
|
</a-space>
|
|
|
<div
|
|
|
- v-if="searchModel.examSiteId && searchModel.taskId"
|
|
|
+ v-if="searchModel.examSiteId && searchModel.taskId && !userStore.isAdmin"
|
|
|
class="part-action"
|
|
|
:size="12"
|
|
|
style="display: flex; align-items: center"
|
|
@@ -51,16 +51,27 @@
|
|
|
>
|
|
|
</div>
|
|
|
<a-table
|
|
|
+ :key="tableKey"
|
|
|
class="page-table"
|
|
|
:columns="columns"
|
|
|
:data="tableData"
|
|
|
:pagination="false"
|
|
|
:scroll="{ x: 1200 }"
|
|
|
:bordered="false"
|
|
|
- :loading="saveLoading"
|
|
|
+ :loading="saveLoading || tableLoading"
|
|
|
>
|
|
|
<template #dateStr="{ record }"> {{ record.dateStr }} </template>
|
|
|
- <!-- <template #batch="{ record }"> <a-switch /></template> -->
|
|
|
+ <template #batch="{ record, rowIndex }">
|
|
|
+ <a-switch
|
|
|
+ :default-checked="record.batchStatus"
|
|
|
+ @change="(bool:string | number | boolean)=>{
|
|
|
+ switchBatchChange(rowIndex,bool as boolean)
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <template #checked> 开启 </template>
|
|
|
+ <template #unchecked> 关闭 </template>
|
|
|
+ </a-switch></template
|
|
|
+ >
|
|
|
<template
|
|
|
v-for="head in sliceTimeArr"
|
|
|
#[head]="{ record, rowIndex }"
|
|
@@ -98,12 +109,15 @@
|
|
|
import useTable from '@/hooks/table';
|
|
|
import { timestampFilter } from '@/utils/filter';
|
|
|
import { modalConfirm } from '@/utils/arco';
|
|
|
- import { useAppStore } from '@/store';
|
|
|
+ import { useAppStore, useUserStore } from '@/store';
|
|
|
|
|
|
defineOptions({
|
|
|
name: 'ReservationSet',
|
|
|
});
|
|
|
+ const userStore = useUserStore();
|
|
|
+ const tableLoading = ref(false);
|
|
|
|
|
|
+ const tableKey = ref(`${Date.now()}`);
|
|
|
const appStore = useAppStore();
|
|
|
appStore.setInfo({ breadcrumbs: ['考试预约管理', '考点预约设置'] });
|
|
|
|
|
@@ -156,14 +170,22 @@
|
|
|
if (!searchModel.taskId) {
|
|
|
Message.error('请选择任务');
|
|
|
tableData.value = [];
|
|
|
+ tableKey.value = `${Date.now()}`;
|
|
|
return;
|
|
|
}
|
|
|
getTimeSilce();
|
|
|
- getDateAndTimeList({ examSiteId: searchModel.examSiteId || null }).then(
|
|
|
- (res) => {
|
|
|
- tableData.value = res || [];
|
|
|
- }
|
|
|
- );
|
|
|
+ tableLoading.value = true;
|
|
|
+ getDateAndTimeList({ examSiteId: searchModel.examSiteId || null })
|
|
|
+ .then((res: any) => {
|
|
|
+ tableData.value = (res || []).map((item: any) => {
|
|
|
+ item.batchStatus = false;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ tableKey.value = `${Date.now()}`;
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ tableLoading.value = false;
|
|
|
+ });
|
|
|
};
|
|
|
// watch(
|
|
|
// () => searchModel.examSiteId,
|
|
@@ -179,6 +201,14 @@
|
|
|
).enable = bool;
|
|
|
};
|
|
|
|
|
|
+ const switchBatchChange = (rowIndex: number, bool: boolean) => {
|
|
|
+ tableData.value[rowIndex].batchStatus = bool;
|
|
|
+ tableData.value[rowIndex].timePeriodList.forEach((item: any) => {
|
|
|
+ item.enable = bool;
|
|
|
+ });
|
|
|
+ tableKey.value = `${Date.now()}`;
|
|
|
+ };
|
|
|
+
|
|
|
const saveLoading = ref(false);
|
|
|
const save = () => {
|
|
|
saveLoading.value = true;
|