|
@@ -10,8 +10,12 @@
|
|
<el-space wrap>
|
|
<el-space wrap>
|
|
<el-button type="primary" @click="toPage(1)">查询</el-button>
|
|
<el-button type="primary" @click="toPage(1)">查询</el-button>
|
|
<el-button @click="onAdd">新增</el-button>
|
|
<el-button @click="onAdd">新增</el-button>
|
|
- <el-button @click="onDataCheck">数量校对</el-button>
|
|
|
|
- <el-button @click="onClose">关闭</el-button>
|
|
|
|
|
|
+ <el-button :disabled="checkLoading" @click="onDataCheck"
|
|
|
|
+ >数量校对</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button :disabled="closeLoading" @click="onBatchClose"
|
|
|
|
+ >关闭</el-button
|
|
|
|
+ >
|
|
<el-button @click="onSetTrialCount">设置试评数量</el-button>
|
|
<el-button @click="onSetTrialCount">设置试评数量</el-button>
|
|
</el-space>
|
|
</el-space>
|
|
</div>
|
|
</div>
|
|
@@ -72,6 +76,40 @@
|
|
>
|
|
>
|
|
修改
|
|
修改
|
|
</el-button>
|
|
</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ size="small"
|
|
|
|
+ link
|
|
|
|
+ :disabled="startMarkLoading"
|
|
|
|
+ @click="onStartMark(scope.row)"
|
|
|
|
+ >
|
|
|
|
+ 开始正评
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ type="danger"
|
|
|
|
+ size="small"
|
|
|
|
+ link
|
|
|
|
+ :disabled="releaseLoading"
|
|
|
|
+ @click="onRelease(scope.row)"
|
|
|
|
+ >回收</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ type="danger"
|
|
|
|
+ size="small"
|
|
|
|
+ link
|
|
|
|
+ :disabled="closeLoading"
|
|
|
|
+ @click="onClose(scope.row)"
|
|
|
|
+ >结束</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ type="danger"
|
|
|
|
+ size="small"
|
|
|
|
+ link
|
|
|
|
+ :disabled="deleteLoading"
|
|
|
|
+ @click="onDelete(scope.row)"
|
|
|
|
+ >
|
|
|
|
+ 删除
|
|
|
|
+ </el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -98,9 +136,13 @@
|
|
getMarkGroupList,
|
|
getMarkGroupList,
|
|
markGroupDataCheck,
|
|
markGroupDataCheck,
|
|
markGroupClose,
|
|
markGroupClose,
|
|
|
|
+ markGroupDelete,
|
|
|
|
+ markGroupTaskRecycle,
|
|
|
|
+ markGroupUpdateStatus,
|
|
} from '@/api/mark';
|
|
} from '@/api/mark';
|
|
import { MarkGroupItem, MarkGroupListFilter } from '@/api/types/mark';
|
|
import { MarkGroupItem, MarkGroupListFilter } from '@/api/types/mark';
|
|
import useTable from '@/hooks/table';
|
|
import useTable from '@/hooks/table';
|
|
|
|
+ import useLoading from '@/hooks/loading';
|
|
import { modalConfirm } from '@/utils/ui';
|
|
import { modalConfirm } from '@/utils/ui';
|
|
|
|
|
|
import SetTrialCountDialog from './components/SetTrialCountDialog.vue';
|
|
import SetTrialCountDialog from './components/SetTrialCountDialog.vue';
|
|
@@ -112,6 +154,7 @@
|
|
const searchModel = reactive<MarkGroupListFilter>({
|
|
const searchModel = reactive<MarkGroupListFilter>({
|
|
subjectCode: null,
|
|
subjectCode: null,
|
|
});
|
|
});
|
|
|
|
+ // const curRow = ref<MarkGroupItem>();
|
|
|
|
|
|
const setTrialCountDialogRef =
|
|
const setTrialCountDialogRef =
|
|
ref<InstanceType<typeof SetTrialCountDialog>>();
|
|
ref<InstanceType<typeof SetTrialCountDialog>>();
|
|
@@ -127,9 +170,9 @@
|
|
handleSelectionChange,
|
|
handleSelectionChange,
|
|
} = useTable<MarkGroupItem>(getMarkGroupList, searchModel, false);
|
|
} = useTable<MarkGroupItem>(getMarkGroupList, searchModel, false);
|
|
|
|
|
|
- // 计算选中的分组ID列表
|
|
|
|
- const selectedGroupIds = computed(() => {
|
|
|
|
- return selectedRows.value.map((row) => row.id);
|
|
|
|
|
|
+ // 计算选中的分组列表
|
|
|
|
+ const selectedGroupNumbers = computed(() => {
|
|
|
|
+ return selectedRows.value.map((row) => row.groupNumber);
|
|
});
|
|
});
|
|
|
|
|
|
// 新增分组
|
|
// 新增分组
|
|
@@ -144,24 +187,36 @@
|
|
// TODO: 实现修改分组的逻辑,功能空着留着后面做
|
|
// TODO: 实现修改分组的逻辑,功能空着留着后面做
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 设置试评数量
|
|
|
|
+ function onSetTrialCount() {
|
|
|
|
+ setTrialCountDialogRef.value?.open();
|
|
|
|
+ }
|
|
|
|
+
|
|
// 数量校对
|
|
// 数量校对
|
|
|
|
+ const { loading: checkLoading, setLoading: setCheckLoading } = useLoading();
|
|
async function onDataCheck() {
|
|
async function onDataCheck() {
|
|
|
|
+ if (checkLoading.value) return;
|
|
if (!searchModel.subjectCode) {
|
|
if (!searchModel.subjectCode) {
|
|
ElMessage.warning('请选择科目');
|
|
ElMessage.warning('请选择科目');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ setCheckLoading(true);
|
|
try {
|
|
try {
|
|
await markGroupDataCheck(searchModel.subjectCode);
|
|
await markGroupDataCheck(searchModel.subjectCode);
|
|
ElMessage.success('数量校对成功');
|
|
ElMessage.success('数量校对成功');
|
|
getList();
|
|
getList();
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('数量校对失败:', error);
|
|
console.error('数量校对失败:', error);
|
|
|
|
+ } finally {
|
|
|
|
+ setCheckLoading(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // 关闭分组
|
|
|
|
- async function onClose() {
|
|
|
|
|
|
+ // 批量关闭分组
|
|
|
|
+ const { loading: closeLoading, setLoading: setCloseLoading } = useLoading();
|
|
|
|
+ async function onBatchClose() {
|
|
|
|
+ if (closeLoading.value) return;
|
|
if (!selectedRows.value.length) {
|
|
if (!selectedRows.value.length) {
|
|
ElMessage.warning('请选择分组');
|
|
ElMessage.warning('请选择分组');
|
|
return;
|
|
return;
|
|
@@ -173,17 +228,114 @@
|
|
).catch(() => false);
|
|
).catch(() => false);
|
|
if (!confirm) return;
|
|
if (!confirm) return;
|
|
|
|
|
|
|
|
+ setCloseLoading(true);
|
|
try {
|
|
try {
|
|
- await markGroupClose(selectedGroupIds.value);
|
|
|
|
|
|
+ await markGroupClose(
|
|
|
|
+ searchModel.subjectCode!,
|
|
|
|
+ selectedGroupNumbers.value
|
|
|
|
+ );
|
|
ElMessage.success('批量关闭成功');
|
|
ElMessage.success('批量关闭成功');
|
|
getList();
|
|
getList();
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('批量关闭失败:', error);
|
|
console.error('批量关闭失败:', error);
|
|
|
|
+ } finally {
|
|
|
|
+ setCloseLoading(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // 设置试评数量
|
|
|
|
- function onSetTrialCount() {
|
|
|
|
- setTrialCountDialogRef.value?.open();
|
|
|
|
|
|
+ // 关闭分组
|
|
|
|
+ async function onClose(row: MarkGroupItem) {
|
|
|
|
+ if (closeLoading.value) return;
|
|
|
|
+ const confirm = await modalConfirm(
|
|
|
|
+ `确认关闭分组 ${row.groupNumber} 的评卷吗?`,
|
|
|
|
+ '提示 '
|
|
|
|
+ ).catch(() => false);
|
|
|
|
+ if (!confirm) return;
|
|
|
|
+
|
|
|
|
+ setCloseLoading(true);
|
|
|
|
+ try {
|
|
|
|
+ await markGroupClose(searchModel.subjectCode!, [row.groupNumber!]);
|
|
|
|
+ ElMessage.success('关闭成功');
|
|
|
|
+ getList();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('关闭失败:', error);
|
|
|
|
+ } finally {
|
|
|
|
+ setCloseLoading(false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 回收分组任务
|
|
|
|
+ const { loading: releaseLoading, setLoading: setReleaseLoading } =
|
|
|
|
+ useLoading();
|
|
|
|
+ // 回收分组任务
|
|
|
|
+ async function onRelease(row: MarkGroupItem) {
|
|
|
|
+ if (releaseLoading.value) return;
|
|
|
|
+ const confirm = await modalConfirm(
|
|
|
|
+ `确认回收分组 ${row.groupNumber} 的任务吗?`,
|
|
|
|
+ '提示 '
|
|
|
|
+ ).catch(() => false);
|
|
|
|
+ if (!confirm) return;
|
|
|
|
+
|
|
|
|
+ setReleaseLoading(true);
|
|
|
|
+ try {
|
|
|
|
+ await markGroupTaskRecycle({
|
|
|
|
+ subjectCode: row.subjectCode!,
|
|
|
|
+ number: row.groupNumber!,
|
|
|
|
+ });
|
|
|
|
+ ElMessage.success('回收成功');
|
|
|
|
+ getList();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('回收失败:', error);
|
|
|
|
+ } finally {
|
|
|
|
+ setReleaseLoading(false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 删除
|
|
|
|
+ const { loading: deleteLoading, setLoading: setDeleteLoading } = useLoading();
|
|
|
|
+ async function onDelete(row: MarkGroupItem) {
|
|
|
|
+ if (deleteLoading.value) return;
|
|
|
|
+
|
|
|
|
+ setDeleteLoading(true);
|
|
|
|
+ const params = {
|
|
|
|
+ subjectCode: row.subjectCode!,
|
|
|
|
+ number: row.groupNumber!,
|
|
|
|
+ };
|
|
|
|
+ let res = true;
|
|
|
|
+ await markGroupDelete(params).catch(() => {
|
|
|
|
+ res = false;
|
|
|
|
+ });
|
|
|
|
+ setDeleteLoading(false);
|
|
|
|
+ if (!res) return;
|
|
|
|
+
|
|
|
|
+ ElMessage.success(`删除成功!`);
|
|
|
|
+ getList();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 开始正评
|
|
|
|
+ const { loading: startMarkLoading, setLoading: setStartMarkLoading } =
|
|
|
|
+ useLoading();
|
|
|
|
+ async function onStartMark(row: MarkGroupItem) {
|
|
|
|
+ if (startMarkLoading.value) return;
|
|
|
|
+ const confirm = await modalConfirm(
|
|
|
|
+ `确认开始分组 ${row.groupNumber} 的正评吗?`,
|
|
|
|
+ '提示 '
|
|
|
|
+ ).catch(() => false);
|
|
|
|
+ if (!confirm) return;
|
|
|
|
+
|
|
|
|
+ setStartMarkLoading(true);
|
|
|
|
+ try {
|
|
|
|
+ await markGroupUpdateStatus({
|
|
|
|
+ subjectCode: row.subjectCode!,
|
|
|
|
+ number: row.groupNumber!,
|
|
|
|
+ status: 'FORMAL',
|
|
|
|
+ });
|
|
|
|
+ ElMessage.success('开始正评成功');
|
|
|
|
+ getList();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('开始正评失败:', error);
|
|
|
|
+ } finally {
|
|
|
|
+ setStartMarkLoading(false);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|