From ba94ceae1315174798ae1967ef62268c6d16cd5b Mon Sep 17 00:00:00 2001
From: Codex Assistant <codex@example.com>
Date: 星期一, 06 十月 2025 22:07:06 +0800
Subject: [PATCH] feat: 评审与活动相关改动 - backend(GraphQL): Activity schema 增加 updateActivityState(id, state);实现 resolver/service 仅更新 state=2 作为逻辑删除 - backend(GraphQL): region.graphqls 新增 Query leafRegions - backend(GraphQL): player.graphqls 的 projectReviewApplications 增加可选参数 regionId - backend(Service): listProjectReviewApplications 绑定 regionId 参数,修复 QueryParameterException - frontend(web): 新增 api/activity.js 的 updateActivityState 并接入 activity-list 删除逻辑 - frontend(web): review-list.vue 权限仅校验登录,移除角色限制;查询参数修正为 name/regionId - frontend(web): 删除未引用的 ActivityList.vue - frontend(web): projectReviewNew.js GraphQL 查询增加 name 参数

---
 web/src/views/activity-list.vue |  134 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 100 insertions(+), 34 deletions(-)

diff --git a/web/src/views/activity-list.vue b/web/src/views/activity-list.vue
index 33e97f9..65b8f86 100644
--- a/web/src/views/activity-list.vue
+++ b/web/src/views/activity-list.vue
@@ -19,6 +19,20 @@
           @keyup.enter="handleSearch"
           @clear="handleClear"
         />
+        <el-select
+          v-model="searchForm.state"
+          placeholder="姣旇禌鐘舵��"
+          style="width: 160px"
+          clearable
+          @change="handleStateChange"
+        >
+          <el-option
+            v-for="option in stateOptions"
+            :key="option.value"
+            :label="option.label"
+            :value="option.value"
+          />
+        </el-select>
         <el-button type="primary" @click="handleSearch">
           <el-icon><Search /></el-icon>
           鏌ヨ
@@ -43,18 +57,18 @@
         <el-table-column label="鎿嶄綔" width="120" fixed="right" align="center">
           <template #default="{ row }">
             <div class="table-actions">
-              <el-button 
-                text 
-                :icon="Edit" 
-                size="small" 
+              <el-button
+                text
+                :icon="Edit"
+                size="small"
                 @click="handleEdit(row)"
                 class="action-btn edit-btn"
                 title="缂栬緫"
               />
-              <el-button 
-                text 
-                :icon="Delete" 
-                size="small" 
+              <el-button
+                text
+                :icon="Delete"
+                size="small"
                 @click="handleDelete(row)"
                 class="action-btn delete-btn"
                 title="鍒犻櫎"
@@ -81,19 +95,28 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref, onMounted } from 'vue'
+import { reactive, ref, onMounted, onActivated, watch } from 'vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { useRouter } from 'vue-router'
-import { getActivities } from '@/api/activity'
+import { getActivities, updateActivityState } from '@/api/activity'
 import { Search, Plus, Edit, Delete } from '@element-plus/icons-vue'
+
+console.log('=== activity-list.vue 缁勪欢寮�濮嬪姞杞� ===')
 
 const loading = ref(false)
 const router = useRouter()
 
 // 鎼滅储琛ㄥ崟
 const searchForm = reactive({
-  name: ''
+  name: '',
+  state: ''
 })
+
+const stateOptions = [
+  { label: '鏈彂甯�', value: 0 },
+  { label: '鍙戝竷', value: 1 },
+  { label: '鍏抽棴', value: 2 }
+]
 
 // 鍒嗛〉淇℃伅
 const pagination = reactive({
@@ -105,13 +128,26 @@
 // 琛ㄦ牸鏁版嵁
 const tableData = ref([])
 
+// 璋冭瘯鐢ㄩ�旓細鐩戝惉琛ㄦ牸鏁版嵁鍙樺寲
+watch(
+  tableData,
+  newVal => {
+    console.log('=== tableData 鍙戠敓鍙樺寲 ===', newVal)
+    console.log('tableData.value.length:', newVal.length)
+  },
+  { deep: true }
+)
+
 // 鑾峰彇鐘舵�佹爣绛剧被鍨�
 const getStatusType = (status: string) => {
   const typeMap: Record<string, string> = {
-    '杩涜涓�': 'success',
-    '鎶ュ悕涓�': 'warning',
-    '寰呭紑濮�': 'info',
-    '宸茬粨鏉�': 'info'
+    宸插彂甯�: 'success',
+    鍙戝竷: 'success',
+    杩涜涓�: 'success',
+    鎶ュ悕涓�: 'warning',
+    寰呭紑濮�: 'info',
+    宸茬粨鏉�: 'info',
+    鍏抽棴: 'danger'
   }
   return typeMap[status] || 'info'
 }
@@ -122,35 +158,45 @@
   loadData()
 }
 
+const handleStateChange = () => {
+  pagination.page = 1
+  loadData()
+}
+
 // 娓呯┖鎼滅储
 const handleClear = () => {
   searchForm.name = ''
   loadData()
 }
 
- // 鏂板姣旇禌
+// 鏂板姣旇禌
 const handleAdd = () => {
   router.push('/activity/new')
 }
 
- // 缂栬緫姣旇禌
+// 缂栬緫姣旇禌
 const handleEdit = (row: any) => {
   router.push(`/activity/edit/${row.id}`)
 }
 
- // 鍒犻櫎姣旇禌
+// 鍒犻櫎姣旇禌
 const handleDelete = async (row: any) => {
   try {
-    await ElMessageBox.confirm(`纭畾瑕佸垹闄ゆ瘮璧�"${row.name}"鍚楋紵`, '鎻愮ず', {
-      confirmButtonText: '纭畾',
-      cancelButtonText: '鍙栨秷',
-      type: 'warning'
-    })
-    
+    await ElMessageBox.confirm(
+      `纭畾瑕佸垹闄ゆ瘮璧� 鈥�${row.name}鈥� 鍚楋紵`,
+      '鎻愮ず',
+      {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }
+    )
+
+    await updateActivityState(row.id, 2)
     ElMessage.success('鍒犻櫎鎴愬姛')
     loadData()
   } catch {
-    // 鐢ㄦ埛鍙栨秷
+    // 鐢ㄦ埛鍙栨秷鎿嶄綔
   }
 }
 
@@ -170,17 +216,37 @@
 const loadData = async () => {
   loading.value = true
   try {
-    const data = await getActivities(pagination.page - 1, pagination.size, searchForm.name || '')
-    tableData.value = (data && data.content) ? data.content : []
-    pagination.total = (data && data.totalElements) ? data.totalElements : 0
-  } catch (e) {
-    ElMessage.error((e && e.message) ? e.message : '鍔犺浇姣旇禌鍒楄〃澶辫触')
+    const keyword = (searchForm.name || '').trim()
+    const data = await getActivities(
+      pagination.page - 1,
+      pagination.size,
+      keyword,
+      searchForm.state
+    )
+
+    // 鏁版嵁鏄犲皠锛氬皢 API 杩斿洖瀛楁杞崲涓鸿〃鏍奸渶瑕佺殑瀛楁
+    const mappedData = (data?.content || []).map(item => ({
+      ...item,
+      playerCount: item.playerCount || 0,
+      stateName: item.stateName || ''
+    }))
+
+    tableData.value = mappedData
+    pagination.total = data?.totalElements || 0
+  } catch (e: any) {
+    console.error('鍔犺浇鏁版嵁澶辫触:', e)
+    ElMessage.error(e?.message || '鍔犺浇姣旇禌鍒楄〃澶辫触')
   } finally {
     loading.value = false
   }
 }
 
 onMounted(() => {
+  loadData()
+})
+
+// 椤甸潰婵�娲绘椂閲嶆柊鍔犺浇鏁版嵁锛堣В鍐充粠鏂板/缂栬緫杩斿洖鍚庡垪琛ㄤ笉鍚屾鐨勯棶棰橈級
+onActivated(() => {
   loadData()
 })
 </script>
@@ -242,7 +308,7 @@
   margin-bottom: 20px;
 }
 
-/* 鎼滅储妗嗘牱寮� */
+/* 鎼滅储鎸夐挳 */
 .search-icon {
   color: #999;
 }
@@ -298,15 +364,15 @@
     align-items: stretch;
     gap: 16px;
   }
-  
+
   .toolbar {
     flex-wrap: wrap;
     gap: 8px;
   }
-  
+
   .toolbar .el-input {
     width: 100% !important;
     max-width: 280px;
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0