liyongli преди 1 година
родител
ревизия
093acbc908
променени са 1 файла, в които са добавени 24 реда и са изтрити 4 реда
  1. 24 4
      src/view/plagiarismCheck/index.vue

+ 24 - 4
src/view/plagiarismCheck/index.vue

@@ -100,7 +100,14 @@
       <el-dialog v-model="showimport" title="导入文件">
         <el-form label-width="auto">
           <el-form-item label="标书文件">
-            <el-upload v-model:file-list="file" style="width: 100%;" :limit="1" :auto-upload="false">
+            <el-upload
+              v-model:file-list="file"
+              style="width: 100%"
+              :on-exceed="handleExceed"
+              :limit="1"
+              ref="up"
+              :auto-upload="false"
+            >
               <el-button type="primary">选择</el-button>
               <template #tip>
                 <div>请选择一个基准文件</div>
@@ -108,7 +115,7 @@
             </el-upload>
           </el-form-item>
           <el-form-item label="对比文件">
-            <el-upload v-model:file-list="file1" style="width: 100%;" :auto-upload="false" multiple>
+            <el-upload v-model:file-list="file1" style="width: 100%" :auto-upload="false" multiple>
               <el-button type="primary">选择</el-button>
               <template #tip>
                 <div>请选择一个或多个对比文件</div>
@@ -153,7 +160,12 @@
             <template #default="scope"> {{ (scope.row.fileSize / 1048576).toFixed(2) }}M </template>
           </el-table-column>
           <el-table-column prop="similarity" label="相似度">
-            <template #default="scope"> <span :style="'color: ' + (scope.row.color || '#606266')" v-text="scope.row.similarity + '%'"></span> </template>
+            <template #default="scope">
+              <span
+                :style="'color: ' + (scope.row.color || '#606266')"
+                v-text="scope.row.similarity + '%'"
+              ></span>
+            </template>
           </el-table-column>
           <el-table-column prop="compareTime" label="对比时间" />
         </el-table>
@@ -172,9 +184,10 @@ import {
   upFiles
 } from '../../api/plagiarismCheck';
 import header_local from '../allMedia/components/header.vue';
-import { ElMessage, ElLoading } from 'element-plus';
+import { ElMessage, ElLoading, genFileId } from 'element-plus';
 import { Delete, Tickets, Notification } from '@element-plus/icons-vue';
 import { ref } from 'vue';
+const up = ref(null);
 const dialogVisible = ref(false);
 const showimport = ref(false);
 const showlook = ref(false);
@@ -203,6 +216,13 @@ const lunxun = () => {
   }, 5000);
 };
 
+const handleExceed = (files) => {
+  up.value.clearFiles();
+  const file = files[0];
+  file.uid = genFileId();
+  up.value.handleStart(file);
+};
+
 const create = () => {
   importId = '';
   dialogVisible.value = true;