Ver código fonte

删除导入导出记录功能

刘洋 2 anos atrás
pai
commit
521501f605

+ 2 - 1
server.config.ts

@@ -4,7 +4,8 @@ const server: ServerOptions = {
   proxy: {
   proxy: {
     '^/?(api|file)/': {
     '^/?(api|file)/': {
       // target: 'http://192.168.10.41:8200',
       // target: 'http://192.168.10.41:8200',
-      target: 'http://cet-test.markingtool.cn',
+      target: 'http://192.168.10.107:8200',
+      // target: 'http://cet-test.markingtool.cn',
       // target: 'http://cet-dev.markingtool.cn:8200',
       // target: 'http://cet-dev.markingtool.cn:8200',
     },
     },
   },
   },

+ 3 - 0
src/api/api-types/system.d.ts

@@ -135,6 +135,7 @@ export namespace System {
   /** 考生数据导入状态 */
   /** 考生数据导入状态 */
   type GetStudentImportStatus = BaseDefine<null, { importing: boolean; progress: number }>
   type GetStudentImportStatus = BaseDefine<null, { importing: boolean; progress: number }>
   type imortAndExportList = BaseDefine<MultipleQuery<{ taskType?: string }>, MultipleResult<importOrExportItem>>
   type imortAndExportList = BaseDefine<MultipleQuery<{ taskType?: string }>, MultipleResult<importOrExportItem>>
+  type removeImportOrExport = BaseDefine<{ id: string }>
   export interface ApiMap {
   export interface ApiMap {
     importMarkingData: ImportMarkingData
     importMarkingData: ImportMarkingData
     /** 创建评卷分配表 */
     /** 创建评卷分配表 */
@@ -156,5 +157,7 @@ export namespace System {
     getStudentImportStatus: GetStudentImportStatus
     getStudentImportStatus: GetStudentImportStatus
     /** 数据导入导出记录 */
     /** 数据导入导出记录 */
     imortAndExportList: imortAndExportList
     imortAndExportList: imortAndExportList
+    /** 删除单条导入导出记录 */
+    removeImportOrExport: removeImportOrExport
   }
   }
 }
 }

+ 2 - 0
src/api/system.ts

@@ -42,6 +42,8 @@ const SystemApi: DefineApiModule<System.ApiMap> = {
     download: true,
     download: true,
     timeout: 0,
     timeout: 0,
   },
   },
+  /**删除单条导入导出的记录 */
+  removeImportOrExport: '/api/operate/task/remove',
   /** 导入导出记录 */
   /** 导入导出记录 */
   imortAndExportList: '/api/operate/task/page',
   imortAndExportList: '/api/operate/task/page',
   /** 任务设置 - 按评卷员设置 */
   /** 任务设置 - 按评卷员设置 */

+ 25 - 3
src/modules/admin-data/imformation-report/index.vue

@@ -12,7 +12,18 @@
       <div class="p-base radius-base fill-blank">
       <div class="p-base radius-base fill-blank">
         <base-table ref="tableRef" :columns="columns" :data="data">
         <base-table ref="tableRef" :columns="columns" :data="data">
           <template #column-operation="{ row }">
           <template #column-operation="{ row }">
-            <el-link target="_blank" type="primary" :href="row.filePath">下载</el-link>
+            <el-link v-if="!!row.filePath" target="_blank" type="primary" :href="row.filePath">下载</el-link>
+            <el-popconfirm
+              v-if="row.status !== 'PROCESSING'"
+              :width="useVW(220)"
+              hide-icon
+              title="是否该条记录?"
+              @confirm="handleDeleteRecord(row)"
+            >
+              <template #reference>
+                <el-link style="margin-left: 15px" link type="primary">删除</el-link>
+              </template>
+            </el-popconfirm>
           </template>
           </template>
         </base-table>
         </base-table>
         <el-pagination
         <el-pagination
@@ -33,10 +44,11 @@ import type { EpFormItem, EpTableColumn, EpFormRules } from 'global-type'
 import useVW from '@/hooks/useVW'
 import useVW from '@/hooks/useVW'
 import useTable from '@/hooks/useTable'
 import useTable from '@/hooks/useTable'
 import useForm from '@/hooks/useForm'
 import useForm from '@/hooks/useForm'
-import { ElButton, ElPagination, ElLink } from 'element-plus'
+import { ElButton, ElPagination, ElLink, ElMessage, ElPopconfirm } from 'element-plus'
 import BaseForm from '@/components/element/BaseForm.vue'
 import BaseForm from '@/components/element/BaseForm.vue'
 import BaseTable from '@/components/element/BaseTable.vue'
 import BaseTable from '@/components/element/BaseTable.vue'
 import { TaskTypeOption } from '@/constants/dicts'
 import { TaskTypeOption } from '@/constants/dicts'
+import useFetch from '@/hooks/useFetch'
 const { formRef, elFormRef, defineColumn, _ } = useForm()
 const { formRef, elFormRef, defineColumn, _ } = useForm()
 
 
 const OneRowSpan5 = defineColumn(_, 'row-1', { span: 5 })
 const OneRowSpan5 = defineColumn(_, 'row-1', { span: 5 })
@@ -70,11 +82,21 @@ const onSearch = async () => {
 }
 }
 const columns: EpTableColumn[] = [
 const columns: EpTableColumn[] = [
   { label: 'ID', prop: 'id' },
   { label: 'ID', prop: 'id' },
-  { label: '文件路径', prop: 'filePath' },
+  // { label: '文件路径', prop: 'filePath' },
   { label: '用时', prop: 'spentTime' },
   { label: '用时', prop: 'spentTime' },
   { label: '状态', prop: 'statusName' },
   { label: '状态', prop: 'statusName' },
   { label: '状态描述', prop: 'statusMsg' },
   { label: '状态描述', prop: 'statusMsg' },
   { label: '任务类型', prop: 'taskTypeName' },
   { label: '任务类型', prop: 'taskTypeName' },
   { label: '操作', slotName: 'operation', showOverflowTooltip: false, minWidth: 80 },
   { label: '操作', slotName: 'operation', showOverflowTooltip: false, minWidth: 80 },
 ]
 ]
+const { fetch: deleteRecord } = useFetch('removeImportOrExport')
+const handleDeleteRecord = async (row: any) => {
+  try {
+    await deleteRecord({ id: row.id })
+    ElMessage.success(`删除成功`)
+    fetchTable()
+  } catch (error) {
+    console.error(error)
+  }
+}
 </script>
 </script>

+ 31 - 29
src/modules/admin-data/marking/index.vue

@@ -30,9 +30,9 @@
             </el-upload>
             </el-upload>
           </div>
           </div>
         </template>
         </template>
-        <template #form-item-progress>
+        <!-- <template #form-item-progress>
           <el-progress v-show="showProgress" class="flex-1" :percentage="percentage" color="#00BA97" />
           <el-progress v-show="showProgress" class="flex-1" :percentage="percentage" color="#00BA97" />
-        </template>
+        </template> -->
         <el-form-item class="m-t-base form-footer">
         <el-form-item class="m-t-base form-footer">
           <confirm-button
           <confirm-button
             ok-text="确定导入"
             ok-text="确定导入"
@@ -51,7 +51,7 @@
 <script setup lang="ts" name="DataMarking">
 <script setup lang="ts" name="DataMarking">
 /** 导入评卷数据 */
 /** 导入评卷数据 */
 import { computed, nextTick, reactive, ref, watch } from 'vue'
 import { computed, nextTick, reactive, ref, watch } from 'vue'
-import { ElButton, ElInput, ElCard, ElFormItem, ElUpload, ElProgress } from 'element-plus'
+import { ElButton, ElInput, ElCard, ElFormItem, ElUpload, ElProgress, ElMessage } from 'element-plus'
 import { useTimeoutFn } from '@vueuse/core'
 import { useTimeoutFn } from '@vueuse/core'
 import ConfirmButton from '@/components/common/ConfirmButton.vue'
 import ConfirmButton from '@/components/common/ConfirmButton.vue'
 import BaseForm from '@/components/element/BaseForm.vue'
 import BaseForm from '@/components/element/BaseForm.vue'
@@ -64,19 +64,20 @@ import useVW from '@/hooks/useVW'
 import type { FormGroup, EpFormItem, EpFormRules } from 'global-type'
 import type { FormGroup, EpFormItem, EpFormRules } from 'global-type'
 import type { ExtractApiParams } from '@/api/api'
 import type { ExtractApiParams } from '@/api/api'
 
 
-const allowImport = ref<boolean>(false)
+// const allowImport = ref<boolean>(false)
+const allowImport = ref<boolean>(true)
 
 
-const { start, stop } = useTimeoutFn(checkImportStatus, 1000)
+// const { start, stop } = useTimeoutFn(checkImportStatus, 1000)
 
 
-const { fetch: getStudentImportStatus, result: importStatus } = useFetch('getStudentImportStatus')
+// const { fetch: getStudentImportStatus, result: importStatus } = useFetch('getStudentImportStatus')
 
 
-watch(importStatus, () => {
-  allowImport.value = importStatus.value && !importStatus.value.importing
+// watch(importStatus, () => {
+//   allowImport.value = importStatus.value && !importStatus.value.importing
 
 
-  if (allowImport.value) {
-    stop()
-  }
-})
+//   if (allowImport.value) {
+//     stop()
+//   }
+// })
 
 
 const { subjectList, mainQuestionList, dataModel, changeModelValue } = useOptions(['subject', 'question'])
 const { subjectList, mainQuestionList, dataModel, changeModelValue } = useOptions(['subject', 'question'])
 
 
@@ -84,14 +85,14 @@ const { fetch: getImportFilePath, result: filePath } = useFetch('getImportFilePa
 
 
 const { fileList, upload, percentage, setPercentage, onExceed } = useUploadFile()
 const { fileList, upload, percentage, setPercentage, onExceed } = useUploadFile()
 
 
-watch(
-  () => importStatus.value?.progress,
-  () => {
-    if (importStatus.value?.progress) {
-      setPercentage(importStatus.value.progress)
-    }
-  }
-)
+// watch(
+//   () => importStatus.value?.progress,
+//   () => {
+//     if (importStatus.value?.progress) {
+//       setPercentage(importStatus.value.progress)
+//     }
+//   }
+// )
 
 
 const fileName = computed(() => fileList.value?.[0]?.name)
 const fileName = computed(() => fileList.value?.[0]?.name)
 
 
@@ -215,13 +216,13 @@ const items = computed<EpFormItem[]>(() => {
 })
 })
 
 
 function checkImportStatus() {
 function checkImportStatus() {
-  getStudentImportStatus().finally(() => {
-    nextTick(() => {
-      if (!allowImport.value) {
-        start()
-      }
-    })
-  })
+  // getStudentImportStatus().finally(() => {
+  //   nextTick(() => {
+  //     if (!allowImport.value) {
+  //       start()
+  //     }
+  //   })
+  // })
 }
 }
 
 
 async function onSubmit() {
 async function onSubmit() {
@@ -231,7 +232,8 @@ async function onSubmit() {
       showProgress.value = true
       showProgress.value = true
       setPercentage(0)
       setPercentage(0)
       await importMarkingData(model)
       await importMarkingData(model)
-      checkImportStatus()
+      ElMessage.success(`导入成功,您可以稍后去“任务信息报告”页面进行查询`)
+      // checkImportStatus()
     }
     }
   } catch (error) {
   } catch (error) {
     showProgress.value = false
     showProgress.value = false
@@ -258,7 +260,7 @@ async function exportMarkTasks() {
   }
   }
 }
 }
 
 
-getStudentImportStatus()
+// getStudentImportStatus()
 </script>
 </script>
 
 
 <style scoped lang="scss"></style>
 <style scoped lang="scss"></style>