|
@@ -0,0 +1,162 @@
|
|
|
+<template>
|
|
|
+ <BasicModal
|
|
|
+ @ok="handleSubmit"
|
|
|
+ :destroyOnClose="true"
|
|
|
+ :maskClosable="false"
|
|
|
+ v-bind="$attrs"
|
|
|
+ @register="registerModal"
|
|
|
+ :title="getTitle"
|
|
|
+ :width="1002"
|
|
|
+ showFooter
|
|
|
+ :default-fullscreen="true"
|
|
|
+ >
|
|
|
+ <div class="h-full">
|
|
|
+ <div style="height: 112px">
|
|
|
+ <Descriptions layout="vertical" :column="6" bordered>
|
|
|
+ <Descriptions.Item label="考试学期">{{ modelRef?.semesterName }}a</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="考试计划">{{ modelRef?.examPlanName }}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="录入科目">{{ modelRef?.courseSubjectName }}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="录入班级">{{ modelRef?.className }}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="学生总数量">{{ modelRef?.allCount || 0 }}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="已录入数量">{{ modelRef?.handleCount || 0 }}</Descriptions.Item>
|
|
|
+ </Descriptions>
|
|
|
+ </div>
|
|
|
+ <div style="height: calc(100% - 112px)">
|
|
|
+ <BasicTable @register="registerTable" :search-info="searchInfo">
|
|
|
+ <template #toolbar>
|
|
|
+ <a-button type="primary" @click="handelImport">批量导入</a-button>
|
|
|
+ </template>
|
|
|
+ <template #score="{ record }">
|
|
|
+ <InputNumber v-model:value="record.score" :min="0" default-value="0" />
|
|
|
+ </template>
|
|
|
+ <template #classRanking="{ record }">
|
|
|
+ <InputNumber v-model:value="record.classRanking" :min="0" default-value="0" />
|
|
|
+ </template>
|
|
|
+ <template #gradeRanking="{ record }">
|
|
|
+ <InputNumber v-model:value="record.gradeRanking" :min="0" default-value="0" />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <FormImport @register="registerImportModal" @success="handleSuccess" />
|
|
|
+ </BasicModal>
|
|
|
+</template>
|
|
|
+<script setup lang="ts">
|
|
|
+ import { ref, computed, unref, reactive } from 'vue';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { BasicModal, useModal, useModalInner } from '/@/components/Modal';
|
|
|
+ import { BasicTable, useTable } from '/@/components/Table';
|
|
|
+ import { tableDetailColumns, searchDetailFormSchema } from './data.config';
|
|
|
+ import { InputNumber, Descriptions } from 'ant-design-vue';
|
|
|
+
|
|
|
+ import {
|
|
|
+ postExamSubjectScoreEnterExportQuery,
|
|
|
+ getExamSubjectScoreEnterInfo,
|
|
|
+ postExamSubjectScoreEnterImport,
|
|
|
+ } from '/@/services/apis/ExamSubjectScoreEnterController';
|
|
|
+ import {
|
|
|
+ getExamSubjectScoreEnterList,
|
|
|
+ putXycxeduExamSubjectScore,
|
|
|
+ } from '/@/services/apis/ExamSubjectScoreController';
|
|
|
+ import FormImport from '/@/views/sys/import/index.vue';
|
|
|
+
|
|
|
+ const isUpdate = ref(true);
|
|
|
+ const modelRef = ref<Recordable>({});
|
|
|
+ const emit = defineEmits(['success', 'register']);
|
|
|
+ const { createMessage } = useMessage();
|
|
|
+ const searchInfo = reactive<Recordable>({});
|
|
|
+ const [registerImportModal, { openModal: openImportModal }] = useModal();
|
|
|
+
|
|
|
+ const [registerTable, { reload, getForm, getDataSource }] = useTable({
|
|
|
+ api: getExamSubjectScoreEnterList,
|
|
|
+ title: '考试记录表',
|
|
|
+ rowKey: 'id',
|
|
|
+ columns: tableDetailColumns,
|
|
|
+ formConfig: {
|
|
|
+ labelWidth: 120,
|
|
|
+ schemas: searchDetailFormSchema,
|
|
|
+ },
|
|
|
+ useSearchForm: true,
|
|
|
+ showTableSetting: true,
|
|
|
+ bordered: true,
|
|
|
+ immediate: false,
|
|
|
+ canResize: true,
|
|
|
+ pagination: false,
|
|
|
+ });
|
|
|
+
|
|
|
+ const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
|
|
|
+ setModalProps({ confirmLoading: true, loading: true });
|
|
|
+ isUpdate.value = !!data?.isUpdate;
|
|
|
+ // modelRef.value = { ...data.baseData };
|
|
|
+
|
|
|
+ const { updateSchema } = getForm();
|
|
|
+
|
|
|
+ const resData = await getExamSubjectScoreEnterInfo({ id: data.baseData.id });
|
|
|
+ modelRef.value = { ...resData };
|
|
|
+
|
|
|
+ const options: Recordable[] = [];
|
|
|
+ resData.classList.forEach((item) => {
|
|
|
+ options.push({ label: item.name, value: item.id });
|
|
|
+ });
|
|
|
+
|
|
|
+ updateSchema({ field: 'classId', componentProps: { options } });
|
|
|
+
|
|
|
+ searchInfo.examSubjectScoreEnterId = data.baseData.id;
|
|
|
+ await reload();
|
|
|
+ setModalProps({ confirmLoading: false, loading: false });
|
|
|
+ });
|
|
|
+
|
|
|
+ const getTitle = computed(() => (!unref(isUpdate) ? '成绩录入' : '成绩录入'));
|
|
|
+ const handleSubmit = async () => {
|
|
|
+ try {
|
|
|
+ setModalProps({ confirmLoading: true });
|
|
|
+ const dataSource = getDataSource();
|
|
|
+ const postData: Recordable[] = [];
|
|
|
+
|
|
|
+ dataSource.forEach((item) => {
|
|
|
+ if (item.score > 0 || item.classRanking > 0 || item.gradeRanking > 0) {
|
|
|
+ postData.push({
|
|
|
+ id: item.id,
|
|
|
+ score: item.score || 0,
|
|
|
+ classRanking: item.classRanking || 0,
|
|
|
+ gradeRanking: item.gradeRanking || 0,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (postData.length > 0) {
|
|
|
+ await putXycxeduExamSubjectScore(postData);
|
|
|
+ closeModal();
|
|
|
+ emit('success');
|
|
|
+ } else {
|
|
|
+ createMessage.success('请输入成绩');
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ setModalProps({ confirmLoading: false });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const handelImport = () => {
|
|
|
+ const postData = getForm().getFieldsValue();
|
|
|
+ Object.assign(postData, { examSubjectScoreEnterId: unref(modelRef).id });
|
|
|
+ openImportModal(true, {
|
|
|
+ baseData: {
|
|
|
+ title: '导入学生成绩',
|
|
|
+ upload: postExamSubjectScoreEnterImport,
|
|
|
+ params: { id: unref(modelRef).id },
|
|
|
+ errorName: '学生成绩错误',
|
|
|
+ download: postExamSubjectScoreEnterExportQuery,
|
|
|
+ downloadParams: { ...postData },
|
|
|
+ // templatePath:
|
|
|
+ // 'https://zhxy.cqtlzjzx.com/minio/static/resources/%E5%AD%A6%E7%94%9F%E6%88%90%E7%BB%A9%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF-%E5%AD%A6%E7%94%9F%E7%A7%91%E7%9B%AE%E6%88%90%E7%BB%A9.xlsx',
|
|
|
+ templateName: '学生成绩导入模板',
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleSuccess = () => {
|
|
|
+ reload();
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="less"></style>
|