xiongzhu 2 년 전
부모
커밋
5f5119db5a
2개의 변경된 파일13개의 추가작업 그리고 1개의 파일을 삭제
  1. 12 1
      src/views/GameView.vue
  2. 1 0
      src/views/RoomView.vue

+ 12 - 1
src/views/GameView.vue

@@ -1,6 +1,9 @@
 <template>
     <PagingTable url="/game" :where="where" ref="table">
         <template #filter>
+            <ElSelect v-model="where.roomId" clearable placeholder="筛选房间">
+                <ElOption v-for="item in rooms" :key="item.id" :label="item.name" :value="item.id" />
+            </ElSelect>
             <ElButton :icon="Plus" @click="onEdit()">添加</ElButton>
         </template>
         <ElTableColumn prop="id" label="#" width="80" />
@@ -106,7 +109,7 @@
     </ElDialog>
 </template>
 <script setup>
-import { ref } from 'vue'
+import { onMounted, ref } from 'vue'
 import PagingTable from '@/components/PagingTable.vue'
 import { useEnumFormatter, useTimeFormatter } from '@/utils/formatter'
 import { Plus } from '@vicons/tabler'
@@ -147,6 +150,14 @@ const rules = {
         }
     ]
 }
+
+const rooms = ref([])
+onMounted(() => {
+    http.post('/room').then((res) => {
+        rooms.value = res.items
+    })
+})
+
 const { showEditDialog, onEdit } = setupEditDialog(model)
 async function submit() {
     await http.put(model.value.id ? `/game/${model.value.id}` : '/game', model.value)

+ 1 - 0
src/views/RoomView.vue

@@ -7,6 +7,7 @@
         <ElTableColumn prop="name" label="名称" />
         <ElTableColumn prop="platform" label="平台" :formatter="platformFormatter" />
         <ElTableColumn prop="channelId" label="频道" />
+        <ElTableColumn prop="currentGameId" label="当前游戏" />
         <ElTableColumn prop="active" label="直播中" width="100" align="center">
             <template #default="{ row }">
                 <ElSwitch v-model="row.active" @change="onActiveChange($event, row)" />