Browse Source

api re-define

abpcoder 2 weeks ago
parent
commit
09d79b6c09

+ 63 - 113
back-ui/src/api/dz/papers.js

@@ -46,15 +46,6 @@ export function getPaperExamTypes(query) {
 
 /// 院校
 export function getPaperUniversities(query) {
-    // // TODO: remove test code
-    // return Promise.resolve({
-    //     code: 200,
-    //     data: [
-    //         {id: 1, name: '湖南民政职业技术学院'},
-    //         {id: 2, name: '湖南铁道职业技术学院'},
-    //         {id: 3, name: '湖南大众传媒'},
-    //     ]
-    // })
     // query: {batchId}
     return request({
         url: '/learn/teaching/universities',
@@ -65,15 +56,6 @@ export function getPaperUniversities(query) {
 
 /// 专业组
 export function getPaperMajors(query) {
-    // // TODO: remove test code
-    // return Promise.resolve({
-    //     code: 200,
-    //     data: [
-    //         {id: 1, majorGroup: '默认组', majorName: '电子信息'},
-    //         {id: 2, majorGroup: '专业组一', majorName: '商务英文'},
-    //         {id: 3, majorGroup: '专业组一', majorName: '商务管理'},
-    //     ]
-    // })
     // query: {location, examType, batchId, universityId}
     return request({
         url: '/learn/teaching/majors',
@@ -84,15 +66,6 @@ export function getPaperMajors(query) {
 
 /// 试卷批次
 export function getPaperBatches() {
-    // // TODO: remove test code
-    // return Promise.resolve({
-    //     code: 200,
-    //     data: [
-    //         {name: '第二批', batchId: 2},
-    //         {name: '第一批', batchId: 1}
-    //     ]
-    // })
-
     return request({
         url: '/learn/test/list',
         method: 'get'
@@ -137,61 +110,6 @@ export function getPaperStudents(query) {
     })
 }
 
-// 自动组卷
-export function buildPaperAuto(data) {
-    return request({
-        url: '/learn/teaching/build/auto',
-        method: 'post',
-        data
-    })
-}
-
-// 手工组卷
-export function buildPaperManual(data) {
-    return request({
-        url: '/learn/teaching/build/manual',
-        method: 'post',
-        data
-    })
-}
-
-// 发布试卷
-export function publishPaper(data) {
-    return request({
-        url: '/learn/teaching/publish/paper',
-        method: 'post',
-        data
-    })
-}
-
-// 批量发布试卷
-export function publishPapers(data) {
-    return request({
-        url: '/learn/teaching/publish/papers',
-        method: 'post',
-        data
-    })
-}
-
-export function getPaperList(query) {
-    // TODO: remove test code
-    return Promise.resolve({
-        code: 200,
-        total: 4,
-        rows: [
-            {id: 1, buildType: '定向智能', classId: 1, className: '2501班', batchName: '第一批', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15},
-            {id: 2, buildType: '定向智能', classId: 2, className: '2502班', batchName: '第一批', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15},
-            {id: 3, buildType: '定向智能', classId: 3, className: '2503班', batchName: '第一批', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15},
-            {id: 4, buildType: '定向智能', classId: 4, className: '2504班', batchName: '第一批', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15},
-        ]
-    })
-    return request({
-        url: '/learn/teaching/papers',
-        method: 'get',
-        params: query
-    })
-}
-
 export function getPaperDetail(query) {
     return request({
         url: '/learn/teaching/paper',
@@ -201,38 +119,28 @@ export function getPaperDetail(query) {
 }
 
 export function getPaperClassStatistic(query) {
-    // // TODO: remove test code
-    // return Promise.resolve({
-    //     code: 200,
-    //     data: [
-    //         {classId: 1, className: '2501班', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15},
-    //         {classId: 2, className: '2502班', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15},
-    //         {classId: 3, className: '2503班', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15},
-    //         {classId: 4, className: '2504班', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15}
-    //     ]
-    // })
     // 2025.10.16 新增班级统计,用于组卷生成
-    const queryDemo = {
-        buildType: '', // 试卷构建类型,定义枚举?
-        batchId: '', // 批次
-        examType: '',
-        subjectId: '',
-        universityId: '',
-        majorGroup: '',
-        majorPlanId: ''
-    }
-    const responseDemo = {
-        classId: '',
-        className: '',
-        total: '',
-        built: '',
-        sent: '',
-        finished: '',
-        exact: '',
-        exactNew: '',
-        lastBuiltTime: '',
-        lastSentTime: ''
-    }
+    // const queryDemo = {
+    //     buildType: '', // 试卷构建类型,定义枚举?
+    //     batchId: '', // 批次
+    //     examType: '',
+    //     subjectId: '',
+    //     universityId: '',
+    //     majorGroup: '',
+    //     majorPlanId: ''
+    // }
+    // const responseDemo = {
+    //     classId: '',
+    //     className: '',
+    //     total: '',
+    //     built: '',
+    //     sent: '',
+    //     finished: '',
+    //     exact: '',
+    //     exactNew: '',
+    //     lastBuiltTime: '',
+    //     lastSentTime: ''
+    // }
 
     return request({
         url: '/learn/teaching/classStatistic',
@@ -275,4 +183,46 @@ export function buildPaperFullHand(data) {
         method: 'post',
         data
     })
+}
+
+export function getBuiltPaper(params) {
+    // 与上面的4个build接口参数一样,只不过走1个接口,返回试卷详情
+    return request({
+        url: '/learn/teaching/build/getBuiltPaper',
+        method: 'get',
+        params
+    })
+}
+
+export function getPaperClassRecords(params) {
+    // {id: 1, buildType: '定向智能', classId: 1, className: '2501班', batchName: '第一批', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15}
+    // TODO: remove test code
+    return Promise.resolve({
+        code: 200,
+        total: 1,
+        rows: [
+            {id: 1, buildType: '定向智能', classId: 1, className: '2501班', batchName: '第一批', total: 50, unexact: 10, exact: 40, unsend: 10, send: 20, unfinish: 5, finish: 15}
+        ]
+    })
+    return request({
+        url: '/learn/teaching/getPaperClassRecords',
+        method: 'get',
+        params
+    })
+}
+
+export function getPaperStudentRecords(params) {
+    return request({
+        url: '/learn/teaching/getPaperStudentRecords',
+        method: 'get',
+        params
+    })
+}
+
+export function getPaperStudentDetail(params) {
+    return request({
+        url: '/learn/teaching/getPaperStudentDetail',
+        method: 'get',
+        params
+    })
 }

+ 2 - 3
back-ui/src/views/dz/papers/components/list-exact-intelligent.vue

@@ -7,7 +7,7 @@
         </el-form-item>
         <el-form-item label="班级" prop="classId">
             <el-select v-model="queryParams.classId" clearable @change="handleQuery" style="width: 172px">
-                <el-option v-for="c in classList" :label="c.className" :value="c.classId"/>
+                <el-option v-for="c in classList" :label="c.name" :value="c.classId"/>
             </el-select>
         </el-form-item>
         <el-form-item>
@@ -47,9 +47,8 @@ const actions = [
 ]
 
 const type = consts.enums.buildType.ExactIntelligent
-const classList = ref([])
 const {batchList} = useProvidePaperBatchCondition(type)
-const {queryParams, rules, handleQuery, resetQuery, list, total, getList} = useProvidePaperList(options)
+const {queryParams, rules, handleQuery, resetQuery, list, total, getList, classList} = useProvidePaperList(options)
 const drawer = ref(false)
 
 const handleAction = function (action, row) {

+ 16 - 0
back-ui/src/views/dz/papers/components/list-full-intelligent.vue

@@ -3,6 +3,22 @@
 </template>
 
 <script setup name="ListFullIntelligent">
+import consts from "@/utils/consts.js";
+
+const options = {
+    queryDefine: {
+        batchId: '',
+        classId: ''
+    }
+}
+const columns = [
+    {label: '组卷类型', prop: 'buildType'},
+    {label: '班级', prop: 'className'},
+    {label: '批次', prop: 'batchName'},
+    {label: '班级人数', prop: 'total'},
+    ...consts.config.exactColumns
+]
+
 </script>
 
 <style scoped>

+ 4 - 1
back-ui/src/views/dz/papers/components/paper-full-intelligent.vue

@@ -14,7 +14,9 @@
                 </el-form-item>
                 <el-form-item label="科目">
                     <el-select v-model="subjectId" clearable style="width: 227px">
-                        <el-option v-for="s in subjectList" :label="s.subjectName" :value="s.subjectId"/>
+                        <el-option-group v-for="g in groupedSubjects" :label="g.label">
+                            <el-option v-for="s in g.items" :label="s.subjectName" :value="s.subjectId"/>
+                        </el-option-group>
                     </el-select>
                 </el-form-item>
             </el-form>
@@ -54,6 +56,7 @@ const {
     examTypes,
     subjectId,
     subjectList,
+    groupedSubjects,
     onConditionReady
 } = useProvidePaperFullCondition(type)
 const {selectedClasses, classList, loadClassStatistic} = useProvidePaperClassStatisticCondition()

+ 16 - 1
back-ui/src/views/dz/papers/hooks/usePaperFullCondition.js

@@ -11,6 +11,21 @@ export const useProvidePaperFullCondition = function (type) {
 
     const subjectId = ref('')
     const subjectList = ref([])
+    const groupedSubjects = computed(() => {
+        const groups = []
+        subjectList.value.forEach(s => {
+            const match = groups.find(g => g.label ==  s.groupName)
+            if (!match) {
+                groups.push({
+                    label: s.groupName,
+                    items: [s]
+                })
+            } else {
+                match.items.push(s)
+            }
+        })
+        return groups
+    })
 
     const conditionArgs = computed(() => ({
         buildType: toValue(buildType),
@@ -46,7 +61,7 @@ export const useProvidePaperFullCondition = function (type) {
 
     const payload = {buildType, batchId, batchList,
         examType, examTypes,
-        subjectId, subjectList,
+        subjectId, subjectList, groupedSubjects,
         conditionArgs, conditionData,
         onConditionReady: readyEvent.on}
     provideLocal(key, payload)

+ 9 - 3
back-ui/src/views/dz/papers/hooks/usePaperList.js

@@ -1,6 +1,6 @@
 import {useInjectGlobalLoading} from "@/views/hooks/useGlobalLoading.js";
 import {injectLocal, provideLocal} from "@vueuse/core";
-import {getPaperList} from "@/api/dz/papers.js";
+import {getPaperClasses, getPaperClassRecords} from "@/api/dz/papers.js";
 
 const key = Symbol('PaperList')
 
@@ -27,6 +27,8 @@ export const useProvidePaperList = function (opts = defaultOptions) {
     const multiple = ref(true)
     const total = ref(0)
 
+    const classList = ref([])
+
     const data = reactive({
         form: {...options.formDefine},
         queryParams: {
@@ -82,7 +84,7 @@ export const useProvidePaperList = function (opts = defaultOptions) {
     function getList() {
         loading.value = true
 
-        getPaperList(queryParams.value).then(response => {
+        getPaperClassRecords(queryParams.value).then(response => {
             list.value = response.rows
             total.value = response.total
             loading.value = false
@@ -90,11 +92,15 @@ export const useProvidePaperList = function (opts = defaultOptions) {
     }
 
     onMounted(() => getList())
+    onMounted(async () => {
+        const res = await getPaperClasses()
+        classList.value = res.data
+    })
 
     const payload = {
         queryParams, form, rules,
         open, showSearch, ids, single, multiple,
-        total, list,
+        total, list, classList,
         handleQuery, resetQuery, handleSelectionChange, reset, cancel, getList
     }
     provideLocal(key, payload)

+ 9 - 4
back-ui/src/views/dz/papers/hooks/usePaperQuestionCondition.js

@@ -32,6 +32,10 @@ export const useProvidePaperQuestionCondition = function (exactMode, handMode) {
         const demoId = cart.value[0].subjectId
         return conditionData.value.subjectList.find(s => s.subjectId == demoId)
     })
+    const subjectStat = computed(() => {
+        const results = []
+
+    })
     const groupedQuestions = computed(() => {
         const results = {}
         cart.value.forEach(q => {
@@ -50,9 +54,10 @@ export const useProvidePaperQuestionCondition = function (exactMode, handMode) {
         if (idx > -1) cart.value.splice(idx, 1)
     }
     const addQuestion = (q) => {
-        if (currentSubject.value && currentSubject.value.subjectId != q.subjectId) {
-            return ElMessage.error(`当前科目【${currentSubject.value.subjectName}】冲突`)
-        }
+        // 2025.10.25 取消科目限制,让用户随意添加
+        // if (currentSubject.value && currentSubject.value.subjectId != q.subjectId) {
+        //     return ElMessage.error(`当前科目【${currentSubject.value.subjectName}】冲突`)
+        // }
         cart.value.push(q)
     }
     const removeQuestionGroup = (qtpye) => {
@@ -104,7 +109,7 @@ export const useProvidePaperQuestionCondition = function (exactMode, handMode) {
 
     const payload = {
         keyword, qtpye, qTypes, pageNum, pageSize, total, questionList, getQuestionList,
-        cart, currentSubject, groupedQuestions,
+        cart, currentSubject, groupedQuestions, subjectStat,
         hasQuestion, addQuestion, removeQuestion, removeQuestionGroup, clearCart
     }
     provideLocal(key, payload)