فهرست منبع

cet成绩导出增加文件格式选择

刘洋 2 سال پیش
والد
کامیت
453fd7e57a
2فایلهای تغییر یافته به همراه33 افزوده شده و 9 حذف شده
  1. 1 1
      src/api/api-types/system.d.ts
  2. 32 8
      src/modules/admin-data/export/index.vue

+ 1 - 1
src/api/api-types/system.d.ts

@@ -99,7 +99,7 @@ export namespace System {
 
   type GetCetScoreList = BaseDefine<MultipleQuery<{ subjectCode: string }>, MultipleResult<ScoreListItem>>
 
-  type ExportCetScoreList = BaseDefine<{ subjectCode: string }, null>
+  type ExportCetScoreList = BaseDefine<{ subjectCode: string; exportFileType?: string }, null>
 
   /** 任务设置 - 按评卷员设置 */
   type MarkerSetCount = BaseDefine<{ markDayCount?: number; markTotalCount?: number; userId: number[] }>

+ 32 - 8
src/modules/admin-data/export/index.vue

@@ -20,20 +20,32 @@
         ></el-pagination>
       </div>
     </div>
+    <base-dialog v-model="modalVisible" title="选择导出文件的格式" destroy-on-close :width="350">
+      <el-radio-group v-model="exportFileType" class="ml-4">
+        <el-radio label="TXT" size="large">TXT</el-radio>
+        <el-radio label="DBF" size="large">DBF</el-radio>
+      </el-radio-group>
+      <template #footer>
+        <div class="flex justify-end">
+          <confirm-button @confirm="sureExport" @cancel="cancelExport"></confirm-button>
+        </div>
+      </template>
+    </base-dialog>
   </div>
 </template>
 
 <script setup lang="ts" name="DataExport">
 /** CET成绩导出 */
-import { reactive, watch, computed } from 'vue'
-import { ElButton, ElPagination, ElMessage } from 'element-plus'
+import { reactive, watch, computed, ref } from 'vue'
+import { ElButton, ElPagination, ElMessage, ElRadio, ElRadioGroup } from 'element-plus'
 import BaseForm from '@/components/element/BaseForm.vue'
 import BaseTable from '@/components/element/BaseTable.vue'
 import useForm from '@/hooks/useForm'
 import useTable from '@/hooks/useTable'
 import useOptions from '@/hooks/useOptions'
 import useFetch from '@/hooks/useFetch'
-import useVW from '@/hooks/useVW'
+import BaseDialog from '@/components/element/BaseDialog.vue'
+import ConfirmButton from '@/components/common/ConfirmButton.vue'
 
 import type { ExtractMultipleApiParams } from '@/api/api'
 import type { EpFormItem, EpTableColumn, EpFormRules } from 'global-type'
@@ -43,7 +55,8 @@ const { subjectList, dataModel, changeModelValue } = useOptions(['subject'])
 const model = reactive<ExtractMultipleApiParams<'getCetScoreList'>>({
   subjectCode: dataModel.subject || '',
 })
-
+const modalVisible = ref(false)
+const exportFileType = ref('TXT')
 const { formRef, elFormRef, defineColumn, _ } = useForm()
 
 watch(dataModel, () => {
@@ -101,15 +114,26 @@ const onExport = async () => {
   try {
     const valid = await elFormRef?.value?.validate()
     if (valid) {
-      try {
-        await exportCetScoreList(model)
-        ElMessage.success('操作成功,后台导出中,您可以稍后去“任务信息报告”页面进行查询')
-      } catch (err) {}
+      // try {
+      //   await exportCetScoreList(model)
+      //   ElMessage.success('操作成功,后台导出中,您可以稍后去“任务信息报告”页面进行查询')
+      // } catch (err) {}
+      modalVisible.value = true
     }
   } catch (error) {
     console.error(error)
   }
 }
+const sureExport = async () => {
+  try {
+    await exportCetScoreList({ ...model, exportFileType: exportFileType.value })
+    ElMessage.success('操作成功,后台导出中,您可以稍后去“任务信息报告”页面进行查询')
+    modalVisible.value = false
+  } catch (err) {}
+}
+const cancelExport = () => {
+  modalVisible.value = false
+}
 </script>
 
 <style scoped lang="scss"></style>