Răsfoiți Sursa

feat(history): 增加发牌信息展示并优化事件列显示

- 在表格上方添加公共牌信息展示
- 事件列改为自定义渲染,高亮显示小盲和大盲
- 移除多余的注释代码
- 新增 highlightBlinds 函数用于高亮处理
fugui001 4 luni în urmă
părinte
comite
6c6cbc8235

+ 3 - 0
src/api/system/business/history/types.ts

@@ -53,6 +53,9 @@ export interface HistoryVO {
    *
    */
   createdAt: string;
+
+  parseBlindsInfo: string;
+  publicInfoText: string;
 }
 
 export interface HistoryForm extends BaseEntity {

+ 47 - 7
src/views/system/business/history/index.vue

@@ -86,6 +86,16 @@
     <el-card shadow="never">
       <template #header>
         <el-row :gutter="10" class="mb8">
+          <!-- 发牌信息显示 -->
+<!--          <el-col :span="24" style="font-size: 14px; color: #333; margin-bottom: 6px;">
+            <strong>发牌信息:</strong>
+            <span v-html="blindsInfoText"></span>
+          </el-col>-->
+          <el-col :span="24" style="font-size: 14px; color: #333; margin-bottom: 6px;">
+            <strong>公共牌:</strong>
+            <span v-html="publicInfoText"></span>
+          </el-col>
+
           <!--          <el-col :span="1.5">
             <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:history:add']">新增</el-button>
           </el-col>
@@ -109,18 +119,23 @@
       <el-table v-loading="loading" border :data="historyList" @selection-change="handleSelectionChange">
         <!--        <el-table-column type="selection" width="55" align="center" />-->
         <el-table-column label="" align="center" prop="id" v-if="false" />
-        <el-table-column label="事件" align="center" prop="operateText" />
-        <el-table-column label="公共牌" align="center" prop="publicBrand" />
-        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-          <!--          <template #default="scope">
+        <!-- 事件列:自定义渲染,高亮“小盲”和“大盲” -->
+        <el-table-column label="事件" align="left">
+          <template #default="scope">
+            <span v-html="highlightBlinds(scope.row.operateText)"></span>
+          </template>
+        </el-table-column>
+<!--        <el-table-column label="公共牌" align="center" prop="publicBrand" />-->
+<!--        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          &lt;!&ndash;          <template #default="scope">
             <el-tooltip content="修改" placement="top">
               <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:history:edit']"></el-button>
             </el-tooltip>
             <el-tooltip content="删除" placement="top">
               <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:history:remove']"></el-button>
             </el-tooltip>
-          </template>-->
-        </el-table-column>
+          </template>&ndash;&gt;
+        </el-table-column>-->
       </el-table>
 
       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
@@ -184,7 +199,10 @@ const total = ref(0);
 const queryFormRef = ref<ElFormInstance>();
 const historyFormRef = ref<ElFormInstance>();
 const showMore = ref(false); // 定义 showMore 状态
-
+// 响应式变量
+const blindsInfoText = ref<string>('');
+//公共牌
+const publicInfoText = ref<string>('');
 const dialog = reactive<DialogOption>({
   visible: false,
   title: ''
@@ -255,6 +273,19 @@ const getList = async () => {
   /*  queryParams.value.tournamentId = 5147;
   queryParams.value.historyId = 46569;*/
   const res = await listHistory2(queryParams.value);
+
+  // ✅ 提取第一条数据的 parseBlindsInfo
+  if (res.rows && res.rows.length > 0 && res.rows[0]?.parseBlindsInfo) {
+    blindsInfoText.value = highlightBlinds(res.rows[0].parseBlindsInfo);
+  } else {
+    blindsInfoText.value = '';
+  }
+  if (res.rows && res.rows.length > 0 && res.rows[0]?.publicBrand) {
+    publicInfoText.value = highlightBlinds(res.rows[0].publicBrand);
+  } else {
+    publicInfoText.value = '';
+  }
+
   historyList.value = res.rows;
   total.value = res.total;
   loading.value = false;
@@ -430,6 +461,7 @@ const tournamentInfo = ref<Partial<TournamentsVO>>({
   await getList(); // 如果 getList 也是异步函数,这里也使用 await
 });*/
 
+
 watch(
   () => route.query,
   async (newQuery) => {
@@ -467,6 +499,14 @@ const handleTableClick = (table: any) => {
   queryParams.value.historyId = table.id;
   getList();
 };
+
+// 高亮小盲、大盲
+function highlightBlinds(text: string): string {
+  if (!text) return '';
+  return text
+    .replace(/小盲/g, '<span style="color: blue; font-weight: bold;">小盲</span>')
+    .replace(/大盲/g, '<span style="color: red; font-weight: bold;">大盲</span>');
+}
 </script>
 <style scoped>
 .table-card {