|
|
@@ -1,7 +1,254 @@
|
|
|
<template>
|
|
|
- <div>组卷历史</div>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="试卷名称" prop="name">
|
|
|
+ <el-input v-model="queryParams.name" placeholder="请输入试卷名称" clearable @keyup.enter="handleQuery"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="科目" prop="subjectId">
|
|
|
+ <el-select v-model="queryParams.subjectId" clearable placeholder="请选择科目" style="width: 170px;">
|
|
|
+ <el-option v-for="s in subjectList" :label="s.subjectName" :value="s.subjectId"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="组卷类型" prop="buildType">
|
|
|
+ <el-select v-model="queryParams.buildType" clearable placeholder="请选择组卷类型" style="width: 170px;">
|
|
|
+ <!-- TODO: 组卷类型 -->
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="试卷批次" prop="batchId">
|
|
|
+ <el-select v-model="queryParams.batchId" clearable placeholder="请选择批次" style="width: 170px;">
|
|
|
+ <el-option v-for="b in batchList" :label="b.name" :value="b.batchId"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="考生类型" prop="examType">
|
|
|
+ <el-select v-model="queryParams.examType" placeholder="请选择考生类型" clearable style="width: 170px;">
|
|
|
+ <el-option v-for="dict in exam_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="发送情况" prop="state">
|
|
|
+ <el-select v-model="queryParams.state" placeholder="请选择考生类型" clearable style="width: 170px;">
|
|
|
+ <!-- TODO: 发送情况 -->
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <!-- <el-col :span="1.5">-->
|
|
|
+ <!-- <el-button-->
|
|
|
+ <!-- type="primary"-->
|
|
|
+ <!-- plain-->
|
|
|
+ <!-- icon="Plus"-->
|
|
|
+ <!-- @click="handleAdd"-->
|
|
|
+ <!-- v-hasPermi="['dz:subject:add']"-->
|
|
|
+ <!-- >新增</el-button>-->
|
|
|
+ <!-- </el-col>-->
|
|
|
+ <!-- <el-col :span="1.5">-->
|
|
|
+ <!-- <el-button-->
|
|
|
+ <!-- type="success"-->
|
|
|
+ <!-- plain-->
|
|
|
+ <!-- icon="Edit"-->
|
|
|
+ <!-- :disabled="single"-->
|
|
|
+ <!-- @click="handleUpdate"-->
|
|
|
+ <!-- v-hasPermi="['dz:subject:edit']"-->
|
|
|
+ <!-- >修改</el-button>-->
|
|
|
+ <!-- </el-col>-->
|
|
|
+ <!-- <el-col :span="1.5">-->
|
|
|
+ <!-- <el-button-->
|
|
|
+ <!-- type="danger"-->
|
|
|
+ <!-- plain-->
|
|
|
+ <!-- icon="Delete"-->
|
|
|
+ <!-- :disabled="multiple"-->
|
|
|
+ <!-- @click="handleDelete"-->
|
|
|
+ <!-- v-hasPermi="['dz:subject:remove']"-->
|
|
|
+ <!-- >删除</el-button>-->
|
|
|
+ <!-- </el-col>-->
|
|
|
+ <!-- <el-col :span="1.5">-->
|
|
|
+ <!-- <el-button-->
|
|
|
+ <!-- type="warning"-->
|
|
|
+ <!-- plain-->
|
|
|
+ <!-- icon="Download"-->
|
|
|
+ <!-- @click="handleExport"-->
|
|
|
+ <!-- v-hasPermi="['dz:subject:export']"-->
|
|
|
+ <!-- >导出</el-button>-->
|
|
|
+ <!-- </el-col>-->
|
|
|
+ <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="paperList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column label="试卷ID" align="center" prop="id" width="80"/>
|
|
|
+ <el-table-column label="试卷名称" align="center" prop="paperName"/>
|
|
|
+ <el-table-column label="科目" align="center" prop="subjectName"/>
|
|
|
+ <el-table-column label="试卷批次" align="center" prop="batchName"/>
|
|
|
+ <el-table-column label="组卷类型" align="center" prop="buildType"/>
|
|
|
+ <el-table-column label="状态" align="center" prop="state"/>
|
|
|
+ <el-table-column label="创建人" align="center" prop="createBy"/>
|
|
|
+ <el-table-column label="试卷分类" align="center" prop="paperType"/>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button link type="primary" icon="Edit" @click="handleEdit(scope.row)"
|
|
|
+ v-hasPermi="['dz:paper:edit']">编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button link type="primary" icon="Download" @click="handleDownload(scope.row)"
|
|
|
+ v-hasPermi="['dz:paper:download']">下载
|
|
|
+ </el-button>
|
|
|
+ <el-button link type="primary" icon="Finished" @click="handlePublish(scope.row)"
|
|
|
+ v-hasPermi="['dz:paper:download']">发布试卷
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination v-show="total>0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
+ v-model:limit="queryParams.pageSize" @pagination="getList"/>
|
|
|
+
|
|
|
+ <!-- 添加或修改科目对话框 -->
|
|
|
+ <el-dialog :title="publishDialogTitle" v-model="openPublish" width="500px" append-to-body>
|
|
|
+ <paper-publish :paper="openPaper" />
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="handlePublishConfirm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
-<script setup></script>
|
|
|
+<script setup name="PaperList">
|
|
|
+
|
|
|
+import {getPaperBatches, getPaperList, getPaperSubjects} from "@/api/dz/papers.js";
|
|
|
+import PaperPublish from "@/views/dz/papers/components/paper-publish.vue";
|
|
|
+
|
|
|
+const {proxy} = getCurrentInstance()
|
|
|
+const {exam_type} = proxy.useDict('build_type', 'exam_type')
|
|
|
+
|
|
|
+const paperList = ref([])
|
|
|
+const open = ref(false)
|
|
|
+const loading = ref(false)
|
|
|
+const showSearch = ref(true)
|
|
|
+const ids = ref([])
|
|
|
+const single = ref(true)
|
|
|
+const multiple = ref(true)
|
|
|
+const total = ref(0)
|
|
|
+
|
|
|
+const subjectList = ref([])
|
|
|
+const batchList = ref([])
|
|
|
+const subjectMap = computed(() => {
|
|
|
+ const obj = {}
|
|
|
+ subjectList.value.forEach(s => obj[s.subjectId] = s.subjectName)
|
|
|
+ return obj
|
|
|
+})
|
|
|
+const batchMap = computed(() => {
|
|
|
+ const obj = {}
|
|
|
+ batchList.value.forEach(b => obj[b.batchId] = b.name)
|
|
|
+ return obj
|
|
|
+})
|
|
|
+
|
|
|
+const openPublish = ref(false)
|
|
|
+const openPaper = ref(null)
|
|
|
+const publishDialogTitle = computed(() => `发布试卷:${openPaper?.paperName}`)
|
|
|
+
|
|
|
+const data = reactive({
|
|
|
+ form: {},
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ name: null,
|
|
|
+ subjectId: null,
|
|
|
+ buildType: null,
|
|
|
+ batchId: null,
|
|
|
+ state: null,
|
|
|
+ examType: null
|
|
|
+ },
|
|
|
+ rules: {}
|
|
|
+})
|
|
|
+
|
|
|
+const {queryParams, form, rules} = toRefs(data)
|
|
|
+
|
|
|
+function getList() {
|
|
|
+ loading.value = true
|
|
|
+
|
|
|
+ getPaperList(queryParams.value).then(response => {
|
|
|
+ response.rows.forEach(p => {
|
|
|
+ p.subjectName = subjectMap.value[p.subjectId] || ''
|
|
|
+ p.batchName = batchMap.value[p.batchId] || ''
|
|
|
+ })
|
|
|
+ paperList.value = response.rows
|
|
|
+ total.value = response.total
|
|
|
+ loading.value = false
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 取消按钮
|
|
|
+function cancel() {
|
|
|
+ open.value = false
|
|
|
+ reset()
|
|
|
+}
|
|
|
+
|
|
|
+// 表单重置
|
|
|
+function reset() {
|
|
|
+ form.value = {
|
|
|
+ subjectId: null,
|
|
|
+ subjectName: null,
|
|
|
+ pinyin: null,
|
|
|
+ sort: null,
|
|
|
+ locations: null,
|
|
|
+ examTypes: null
|
|
|
+ }
|
|
|
+ proxy.resetForm("subjectRef")
|
|
|
+}
|
|
|
+
|
|
|
+/** 搜索按钮操作 */
|
|
|
+function handleQuery() {
|
|
|
+ queryParams.value.pageNum = 1
|
|
|
+ getList()
|
|
|
+}
|
|
|
+
|
|
|
+/** 重置按钮操作 */
|
|
|
+function resetQuery() {
|
|
|
+ proxy.resetForm("queryRef")
|
|
|
+ handleQuery()
|
|
|
+}
|
|
|
+
|
|
|
+// 多选框选中数据
|
|
|
+function handleSelectionChange(selection) {
|
|
|
+ ids.value = selection.map(item => item.subjectId)
|
|
|
+ single.value = selection.length != 1
|
|
|
+ multiple.value = !selection.length
|
|
|
+}
|
|
|
+
|
|
|
+// operations
|
|
|
+const handleEdit = function (paper) {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+const handleDownload = function (paper) {
|
|
|
+ proxy.download('/learn/paper/export', {
|
|
|
+ paperId: paper.id
|
|
|
+ }, `${paper.paperName}_${new Date().getTime()}.xlsx`)
|
|
|
+}
|
|
|
+
|
|
|
+const handlePublish = function (paper) {
|
|
|
+ openPublish.value = true
|
|
|
+ openPaper.value = paper
|
|
|
+}
|
|
|
+
|
|
|
+const handlePublishConfirm = function () {
|
|
|
+ openPublish.value = false
|
|
|
+}
|
|
|
+
|
|
|
+// hooks
|
|
|
+onMounted(async () => {
|
|
|
+ const resSubject = await getPaperSubjects()
|
|
|
+ subjectList.value = resSubject.data
|
|
|
+ const resBatch = await getPaperBatches()
|
|
|
+ batchList.value = resBatch.data
|
|
|
+ getList()
|
|
|
+})
|
|
|
+</script>
|
|
|
|
|
|
<style lang="scss" scoped></style>
|