From 47b272441ce119712adf2a22e81ce2944c31051b Mon Sep 17 00:00:00 2001 From: Ironsp <1522278303@qq.com> Date: Thu, 11 Jun 2026 09:29:11 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E4=BC=98=E5=8C=96=E6=8A=A5=E8=AD=A6?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/warnningList.ts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/store/modules/warnningList.ts b/src/store/modules/warnningList.ts index d82a209..29e80ed 100644 --- a/src/store/modules/warnningList.ts +++ b/src/store/modules/warnningList.ts @@ -1,12 +1,11 @@ import { listDemo, updateDemo } from '@/api/WarningList/index'; import { defineStore } from 'pinia'; import { ref, computed } from 'vue'; -import type { WarningListResult } from '@/api/WarningList/types'; export const useWarningListStore = defineStore('warningListStore', () => { // --- State (状态) --- // 相当于 Vuex 中的 state,用 ref 或 reactive 定义 - const warningList = ref({ rows: [], total: 0 }); + const warningList = ref([]); const warningListTotal = ref(0); // --- Getters (计算属性) --- // 相当于 Vuex 中的 getters,直接用 computed 定义 @@ -21,28 +20,17 @@ export const useWarningListStore = defineStore('warningListStore', () => { pageNum: 1, pageSize: 300 }); - // console.log('6666666666666666666', response); - warningList.value = response.data || {}; + warningList.value = response.data || []; warningListTotal.value = response.data.total || 0; } catch (error) { console.error('获取消息列表失败', error); } } - async function hanldeAction(ids: string | number | Array) { - try { - await updateDemo(ids); - await getWarningList(); - } catch (error) { - console.error('处理告警失败', error); - } - } - // 核心点:必须把需要暴露出去的变量和方法 return 出去! return { warningList, warningListTotal, - getWarningList, - hanldeAction + getWarningList }; });