From 512d5d7e79e0a64b36e24cbe5d7c5f8d0adc0b94 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 26 九月 2024 17:46:48 +0800 Subject: [PATCH] 1.升级了element-plus版本 2.对外支持模块新设备匹配工地功能完成 3.新增设备匹配模块单挑匹配记录编辑功能(未完成) --- src/composables/fetchData.js | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/composables/fetchData.js b/src/composables/fetchData.js index 3598753..4b5458e 100644 --- a/src/composables/fetchData.js +++ b/src/composables/fetchData.js @@ -1,13 +1,13 @@ // 鎺ュ彛鏁版嵁鐨勮幏鍙� -import { onActivated, onDeactivated, ref, watch } from 'vue'; +import { ref, watch, computed } from 'vue'; -export function useFetchData(fetch) { +export function useFetchData() { // 鍒嗛〉淇℃伅 - const currentPage = ref(1); - const totalPage = ref(1); + const page = ref(1); + const pageNum = ref(1); const pageSize = ref(20); const total = ref(0); - watch(currentPage, (nValue, oValue) => { + watch(page, (nValue, oValue) => { if (nValue != oValue) { fetchData(); } @@ -21,14 +21,20 @@ // 鍔犺浇鐘舵��, 0: 鍔犺浇瀹屾垚; 1: 鍔犺浇涓�; 2: 宸插叏閮ㄥ姞杞�; 3: 鍔犺浇澶辫触; const loadStatus = ref(0); + const loading = computed(() => { + return loadStatus.value == 1; + }); + // 鏁版嵁鑾峰彇 - function fetchData() { + function fetchData(fetch) { loadStatus.value = 1; - fetch(currentPage.value, pageSize.value) + fetch(page.value, pageSize.value) .then((pageInfo) => { - currentPage.value = pageInfo.currentPage; - totalPage.value = pageInfo.totalPage; - total.value = pageInfo.total; + if (pageInfo) { + page.value = pageInfo.page ? pageInfo.page : 1; + pageNum.value = pageInfo.pageNum ? pageInfo.pageNum : 1; + total.value = pageInfo.total ? pageInfo.total : 0; + } loadStatus.value = 0; }) @@ -40,5 +46,5 @@ }); } - return {currentPage, totalPage, pageSize, total, loadStatus, fetchData} + return { page, pageNum, pageSize, total, loadStatus, loading, fetchData }; } -- Gitblit v1.9.3