Просмотр исходного кода

feat: 导入数据必填校验

chenhao 2 лет назад
Родитель
Сommit
f0e997774d

+ 2 - 3
electron/main/main.ts

@@ -9,7 +9,6 @@ if (!app.requestSingleInstanceLock()) {
 }
 
 async function createWindow() {
-  // console.log(screen.getPrimaryDisplay())
   const loadingView = new BrowserWindow({
     width: 520,
     height: 150,
@@ -18,7 +17,7 @@ async function createWindow() {
     transparent: true,
     show: true,
     webPreferences: {
-      // preload: path.join(__dirname, '../preload/preload'),
+      preload: path.join(__dirname, '../preload/preload'),
     },
   })
   loadingView.loadFile(resolve(__dirname, 'loading.html'))
@@ -45,7 +44,7 @@ async function createWindow() {
       experimentalFeatures: true,
       navigateOnDragDrop: false,
       disableHtmlFullscreenWindowResize: false,
-      // preload: path.join(__dirname, '../preload/preload'),
+      preload: path.join(__dirname, '../preload/preload'),
     },
   })
 

+ 27 - 0
src/api/statistics.ts

@@ -119,6 +119,33 @@ const StatisticsApi: DefineApiModule<Statistics.ApiMap> = {
   /** 系统抽查卷浏览 */
   viewSystemSpotPaper: '/api/system/check/view',
   /** 决策分析-监控统计-客观题分数分布(按小组) */
+  getStatisticObjectiveByGroup: {
+    url: '/api/statistic/question/objective/score/distributed/for/group',
+    headers: {
+      'Content-Type': 'application/json',
+    },
+  },
+  /** 决策分析-监控统计-客观题分数分布(按评卷员) */
+  getStatisticObjectiveByMarker: {
+    url: '/api/statistic/question/objective/score/distributed/for/marker',
+    headers: {
+      'Content-Type': 'application/json',
+    },
+  },
+  /** 决策分析-监控统计-主观题分数分布(按小组) */
+  getStatisticSubjectiveByGroup: {
+    url: '/api/statistic/question/subjective/score/distributed/for/group',
+    headers: {
+      'Content-Type': 'application/json',
+    },
+  },
+  /** 决策分析-监控统计-主观题分数分布(按评卷员) */
+  getStatisticSubjectiveByMarker: {
+    url: '/api/statistic/question/subjective/score/distributed/for/marker',
+    headers: {
+      'Content-Type': 'application/json',
+    },
+  },
 }
 
 export default StatisticsApi

+ 0 - 1
src/hooks/useUploadFile.ts

@@ -24,7 +24,6 @@ const useUploadFile = () => {
 
   const reset = () => {
     fileList.value = []
-    percentage.value = 0
   }
 
   return {

+ 1 - 0
src/modules/admin-data/marking/index.vue

@@ -178,6 +178,7 @@ async function onSubmit() {
     const valid = await elFormRef?.value?.validate()
     if (valid) {
       showProgress.value = true
+      setPercentage(0)
       await fetch(model)
       setPercentage(100)
       ElMessage.success(`导入成功`)

+ 19 - 2
src/modules/admin-data/paper/components/rf.vue

@@ -1,5 +1,13 @@
 <template>
-  <base-form ref="formRef" :label-width="useVW(88)" :groups="groups" :items="items" :model="model" :disabled="loading">
+  <base-form
+    ref="formRef"
+    :label-width="useVW(88)"
+    :rules="rules"
+    :groups="groups"
+    :items="items"
+    :model="model"
+    :disabled="loading"
+  >
     <template #form-item-prefix>
       <span class="flex items-center">
         <el-input v-model="model.prefix"></el-input>
@@ -46,7 +54,7 @@ import useOptions from '@/hooks/useOptions'
 import useUploadFile from '@/hooks/useUploadFile'
 import useVW from '@/hooks/useVW'
 
-import type { FormGroup, EpFormItem } from 'global-type'
+import type { FormGroup, EpFormItem, EpFormRules } from 'global-type'
 import type { ExtractApiParams } from 'api-type'
 
 const showProgress = ref(false)
@@ -95,6 +103,14 @@ watch(
   { deep: true }
 )
 
+const rules: EpFormRules = {
+  subjectCode: [{ required: true, message: '请选择科目' }],
+  mainNumber: [{ required: true, message: '请选择大题' }],
+  prefix: [{ required: true, message: '请设置试卷密码前缀' }],
+  separator: [{ required: true, message: '请设置分隔符' }],
+  file: [{ required: true, message: '请选择导入文件' }],
+}
+
 const groups: FormGroup[] = [
   { groupTitle: '选择大题', rowKeys: ['row-1'] },
   { groupTitle: '试卷设置', rowKeys: ['row-2', 'row-3', 'row-4'] },
@@ -158,6 +174,7 @@ async function onSubmit() {
     const valid = await elFormRef?.value?.validate()
     if (valid) {
       showProgress.value = true
+      setPercentage(0)
       await fetch(model)
       setPercentage(100)
       ElMessage.success(`导入成功`)

+ 20 - 2
src/modules/admin-data/paper/components/sample.vue

@@ -1,5 +1,13 @@
 <template>
-  <base-form ref="formRef" :label-width="useVW(88)" :groups="groups" :items="items" :model="model" :disabled="loading">
+  <base-form
+    ref="formRef"
+    :label-width="useVW(88)"
+    :groups="groups"
+    :rules="rules"
+    :items="items"
+    :model="model"
+    :disabled="loading"
+  >
     <template #form-item-prefix>
       <span class="flex items-center">
         <el-input v-model="model.prefix"></el-input>
@@ -46,7 +54,7 @@ import useOptions from '@/hooks/useOptions'
 import useUploadFile from '@/hooks/useUploadFile'
 import useVW from '@/hooks/useVW'
 
-import type { FormGroup, EpFormItem } from 'global-type'
+import type { FormGroup, EpFormItem, EpFormRules } from 'global-type'
 import type { ExtractApiParams } from 'api-type'
 
 const showProgress = ref(false)
@@ -97,6 +105,15 @@ watch(
   { deep: true }
 )
 
+const rules: EpFormRules = {
+  subjectCode: [{ required: true, message: '请选择科目' }],
+  mainNumber: [{ required: true, message: '请选择大题' }],
+  paperType: [{ required: true, message: '请选择分组代码' }],
+  prefix: [{ required: true, message: '请设置试卷密码前缀' }],
+  separator: [{ required: true, message: '请设置分隔符' }],
+  file: [{ required: true, message: '请选择导入文件' }],
+}
+
 const groups: FormGroup[] = [
   { groupTitle: '选择大题', rowKeys: ['row-1'] },
   { groupTitle: '试卷设置', rowKeys: ['row-2', 'row-3', 'row-4', 'row-5'] },
@@ -173,6 +190,7 @@ async function onSubmit() {
     const valid = await elFormRef?.value?.validate()
     if (valid) {
       showProgress.value = true
+      setPercentage(0)
       await fetch(model)
       setPercentage(100)
       ElMessage.success(`导入成功`)

+ 16 - 2
src/modules/admin-data/paper/components/standard.vue

@@ -1,5 +1,13 @@
 <template>
-  <base-form ref="formRef" :label-width="useVW(88)" :groups="groups" :items="items" :model="model" :disabled="loading">
+  <base-form
+    ref="formRef"
+    :label-width="useVW(88)"
+    :groups="groups"
+    :rule="rules"
+    :items="items"
+    :model="model"
+    :disabled="loading"
+  >
     <template #form-item-address>
       <span class="flex items-center">
         {{ filePath }}
@@ -40,7 +48,7 @@ import useOptions from '@/hooks/useOptions'
 import useUploadFile from '@/hooks/useUploadFile'
 import useVW from '@/hooks/useVW'
 
-import type { FormGroup, EpFormItem } from 'global-type'
+import type { FormGroup, EpFormItem, EpFormRules } from 'global-type'
 import type { ExtractApiParams } from 'api-type'
 
 const showProgress = ref(false)
@@ -87,6 +95,11 @@ watch(
   { deep: true }
 )
 
+const rules: EpFormRules = {
+  subjectCode: [{ required: true, message: '请选择科目' }],
+  mainNumber: [{ required: true, message: '请选择大题' }],
+}
+
 const groups: FormGroup[] = [
   { groupTitle: '选择大题', rowKeys: ['row-1'] },
   { groupTitle: '试卷设置', rowKeys: ['row-2'] },
@@ -136,6 +149,7 @@ async function onSubmit() {
     const valid = await elFormRef?.value?.validate()
     if (valid) {
       showProgress.value = true
+      setPercentage(0)
       await fetch(model)
       setPercentage(100)
       ElMessage.success(`导入成功`)

+ 47 - 0
types/api.d.ts

@@ -1763,6 +1763,45 @@ declare module 'api-type' {
     /** 系统抽查卷浏览 */
     type ViewSystemSpotPaper = BaseDefine<{ id?: number }>
 
+    interface StatisticByGroup {
+      subjectCode: string
+      questionMainNumber?: number
+      markingGroupNumber?: number
+      startTime: string
+      endTime: string
+    }
+
+    interface StatisticByMarker {
+      markerId?: number
+      endTime: string
+      startTime: string
+    }
+
+    interface StatisticInfo {
+      count: number
+      rate: number
+      scoreEnd: number
+      scoreStart: number
+    }
+
+    interface StatisticResult {
+      segmentsByAll: StatisticInfo[]
+      segmentsByGroup: StatisticInfo[]
+      segmentsByUser: StatisticInfo[]
+    }
+
+    /** 决策分析-监控统计-客观题分数分布(按小组) */
+    type GetStatisticObjectiveByGroup = BaseDefine<StatisticByGroup, StatisticResult>
+
+    /** 决策分析-监控统计-客观题分数分布(按评卷员) */
+    type GetStatisticObjectiveByMarker = BaseDefine<StatisticByMarker, StatisticResult>
+
+    /** 决策分析-监控统计-主观题分数分布(按小组) */
+    type GetStatisticSubjectiveByGroup = BaseDefine<StatisticByGroup, StatisticResult>
+
+    /** 决策分析-监控统计-主观题分数分布(按评卷员) */
+    type GetStatisticSubjectiveByMarker = BaseDefine<StatisticByMarker, StatisticResult>
+
     interface ApiMap {
       /** 质量统计-自查一致性分析 */
       selfCheckAnalysis: SelfCheckAnalysis
@@ -1838,6 +1877,14 @@ declare module 'api-type' {
       rejectSystemSpotPaper: RejectSystemSpotPaper
       /** 系统抽查卷浏览 */
       viewSystemSpotPaper: ViewSystemSpotPaper
+      /** 决策分析-监控统计-客观题分数分布(按小组) */
+      getStatisticObjectiveByGroup: GetStatisticObjectiveByGroup
+      /** 决策分析-监控统计-客观题分数分布(按评卷员) */
+      getStatisticObjectiveByMarker: GetStatisticObjectiveByMarker
+      /** 决策分析-监控统计-主观题分数分布(按小组) */
+      getStatisticSubjectiveByGroup: GetStatisticSubjectiveByGroup
+      /** 决策分析-监控统计-主观题分数分布(按评卷员) */
+      getStatisticSubjectiveByMarker: GetStatisticSubjectiveByMarker
     }
   }
 }