瀏覽代碼

feat: 导入评卷数据也显示图片路径

chenhao 2 年之前
父節點
當前提交
f4e80c6dfc
共有 2 個文件被更改,包括 32 次插入4 次删除
  1. 27 3
      src/modules/admin-data/marking/index.vue
  2. 5 1
      types/api.d.ts

+ 27 - 3
src/modules/admin-data/marking/index.vue

@@ -10,6 +10,11 @@
         :items="items"
         :rules="rules"
       >
+        <template #form-item-address>
+          <span class="flex items-center">
+            {{ filePath }}
+          </span>
+        </template>
         <template #form-item-import>
           <div class="flex items-center">
             <el-input v-model="fileName" disabled placeholder="导入文件"></el-input>
@@ -56,6 +61,8 @@ import useVW from '@/hooks/useVW'
 import type { FormGroup, EpFormItem, EpFormRules } from 'global-type'
 import type { ExtractApiParams } from 'api-type'
 
+const { fetch: getImportFilePath, result: filePath } = useFetch('getImportFilePath')
+
 const { fileList, upload, percentage, setPercentage, onExceed, onUploadProgress } = useUploadFile()
 
 const fileName = computed(() => fileList.value?.[0]?.name)
@@ -76,6 +83,17 @@ const model = reactive<ExtractApiParams<'importMarkingData'>>({
   subjectCode: '',
 })
 
+watch([() => model.subjectCode, () => model.mainNumber], () => {
+  /** 获取导入文件路径 */
+  model.subjectCode &&
+    model.mainNumber &&
+    getImportFilePath({
+      filePathType: 'SLICE',
+      subjectCode: model.subjectCode,
+      mainNumber: model.mainNumber,
+    })
+})
+
 watch(
   fileList,
   () => {
@@ -94,8 +112,8 @@ const rules: EpFormRules = {
 
 const groups: FormGroup[] = [
   { groupTitle: '选择大题', rowKeys: ['row-1'] },
-  { groupTitle: '任务设置', rowKeys: ['row-2', 'row-3'] },
-  { groupTitle: '选择文件', rowKeys: ['row-4'] },
+  { groupTitle: '任务设置', rowKeys: ['row-2', 'row-3', 'row-4'] },
+  { groupTitle: '选择文件', rowKeys: ['row-5'] },
 ]
 
 const span6 = defineColumn(_, '', { span: 6 })
@@ -133,12 +151,18 @@ const items = computed<EpFormItem[]>(() => {
     }),
     span6({
       rowKey: 'row-4',
+      label: '图片路径',
+      slotName: 'address',
+      itemDescription: { description: '试卷图片请按路径存放' },
+    }),
+    span6({
+      rowKey: 'row-5',
       label: '导入文件',
       prop: 'file',
       slotName: 'import',
     }),
     span6({
-      rowKey: 'row-5',
+      rowKey: 'row-6',
       slotName: 'progress',
     }),
   ]

+ 5 - 1
types/api.d.ts

@@ -279,7 +279,11 @@ declare module 'api-type' {
 
     /** 获取导入文件路径 */
     type GetImportFilePath = BaseDefine<
-      { filePathType: 'SAMPLE_A' | 'SAMPLE_B' | 'RF' | 'MARK_STANDARD'; mainNumber?: number; subjectCode: string },
+      {
+        filePathType: 'SLICE' | 'SAMPLE_A' | 'SAMPLE_B' | 'RF' | 'MARK_STANDARD'
+        mainNumber?: number
+        subjectCode: string
+      },
       { rfPath: string; sampleAPath: string; sampleBPath: string; markStandardPath: string }
     >