| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form label-width="68px">
- <el-form-item label="批次">
- <el-select v-model="batchId" clearable style="width: 227px">
- <el-option v-for="b in batchList" :label="b.name" :value="b.batchId"/>
- </el-select>
- </el-form-item>
- </el-form>
- </el-col>
- <el-col :span="16">
- <class-statistic-table exact-mode/>
- </el-col>
- </el-row>
- <el-divider/>
- <div class="text-center">
- <el-button type="primary" size="large" @click="handleSubmit">生成试卷</el-button>
- </div>
- </template>
- <script setup name="PaperExactIntelligent">
- import consts from "@/utils/consts.js";
- import {useProvidePaperBatchCondition} from "@/views/dz/papers/components/conditions/usePaperBatchCondition.js";
- import {
- useProvidePaperClassStatisticCondition
- } from "@/views/dz/papers/components/conditions/usePaperClassStatisticCondition.js";
- import ClassStatisticTable from "@/views/dz/papers/components/plugs/class-statistic-table.vue";
- import {ElMessage} from "element-plus";
- import {buildPaperExactIntelligent} from "@/api/dz/papers.js";
- import {useInjectGlobalLoading} from "@/views/hooks/useGlobalLoading.js";
- const type = consts.enums.buildType.ExactIntelligent
- const {batchId, batchList, onBatchReady} = useProvidePaperBatchCondition(type)
- const {selectedClasses, classList, loadClassStatistic} = useProvidePaperClassStatisticCondition()
- const {loading} = useInjectGlobalLoading()
- const handleSubmit = async function () {
- const classIds = selectedClasses.value.map(c => c.classId)
- if (!batchId.value) return ElMessage.error('请选择批次')
- if (!classIds.length) return ElMessage.error('请选择班级')
- try {
- loading.value = true
- const commit = {buildType: type, batchId: batchId.value, classIds}
- await buildPaperExactIntelligent(commit)
- ElMessage.success('生成成功')
- await _loadClassStatistic()
- } finally {
- loading.value = false
- }
- }
- let statArgs = null // 保留参数,生成组卷后刷新用
- const _loadClassStatistic = async () => {
- selectedClasses.value = []
- classList.value = []
- await loadClassStatistic(statArgs)
- }
- onBatchReady(async (payload) => {
- statArgs = payload
- await _loadClassStatistic()
- })
- </script>
- <style scoped>
- </style>
|