Browse Source

feat(system): 优化商业比赛结构和赛事列表页面

- 为 structures 页面的上传组件添加删除功能和自定义文件列表
- 修改 tournaments 页面的赛事状态列显示- 统一使用 Element Plus组件和样式
fugui001 5 tháng trước cách đây
mục cha
commit
85a09afd9e

+ 23 - 2
src/views/system/business/structures/index.vue

@@ -97,20 +97,31 @@
               class="upload-demo"
               action="#"
               :on-change="handleFileChange"
+              :on-remove="handleFileRemove"
               :file-list="fileList"
               :auto-upload="false"
               :limit="1"
               accept=".xlsx,.xls"
             >
+              <!-- 触发上传按钮 -->
               <template #trigger>
                 <el-button type="primary">点击上传盲注表</el-button>
               </template>
 
+              <!-- 自定义文件列表 -->
+              <template #file="{ file }">
+                <div style="display: flex; align-items: center">
+                  <span class="el-upload__tip">{{ file.name }}</span>
+                  <el-button type="text" icon="el-icon-delete" @click.stop="() => handleFileRemove(file)" style="margin-left: auto"> 删除 </el-button>
+                </div>
+              </template>
+
+              <!-- 提示信息 -->
               <template #tip>
                 <div class="el-upload__tip">
-                  <el-link type="primary" @click="downloadTemplate"> <el-icon name="download" /> 模板下载 </el-link>
+                  <el-link type="primary" @click="downloadTemplate"> <i class="el-icon-download"></i> 模板下载 </el-link>
                   |
-                  <el-button link @click="openPreview"> <el-icon name="document" /> 预 览 </el-button>
+                  <el-button link @click="openPreview"> <i class="el-icon-document"></i> 预 览 </el-button>
                 </div>
               </template>
             </el-upload>
@@ -403,6 +414,16 @@ const handleFileChange = (file) => {
   }
 };
 
+// 删除文件处理函数
+const handleFileRemove = (file) => {
+  const index = fileList.value.findIndex((f) => f.uid === file.uid);
+  if (index > -1) {
+    const newFileList = [...fileList.value];
+    newFileList.splice(index, 1);
+    fileList.value = newFileList;
+  }
+};
+
 // 预览数据
 const previewData = ref<any[]>([]);
 const previewHeaders = ref<string[]>([]); // 新增表头数组

+ 1 - 1
src/views/system/business/tournaments/index.vue

@@ -104,7 +104,7 @@
           </template>
         </el-table-column>
 
-        <el-table-column label="赛事状态" align="center" prop="status" />
+        <el-table-column label="赛事状态" align="center" prop="statusText" />
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
           <template #default="scope">
             <div style="display: flex; flex-direction: column; gap: 5px">