From 4ee451528a1c2bf588f87e15fe74f5dc128f05d4 Mon Sep 17 00:00:00 2001
From: fuliqiang <1348994179@qq.com>
Date: Fri, 24 May 2024 15:59:42 +0800
Subject: [PATCH 1/5] =?UTF-8?q?useBaseTable=E7=BB=84=E5=90=88=E5=BC=8F?=
=?UTF-8?q?=E5=87=BD=E6=95=B0=E6=B7=BB=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
bigtop-manager-ui/.env.development | 3 +-
.../src/components/job-info/job.vue | 93 +++++++------------
bigtop-manager-ui/src/hooks/useBaseTable.ts | 72 ++++++++++++++
3 files changed, 108 insertions(+), 60 deletions(-)
create mode 100644 bigtop-manager-ui/src/hooks/useBaseTable.ts
diff --git a/bigtop-manager-ui/.env.development b/bigtop-manager-ui/.env.development
index 4af78b5..d7f2127 100644
--- a/bigtop-manager-ui/.env.development
+++ b/bigtop-manager-ui/.env.development
@@ -17,7 +17,8 @@ NODE_ENV=development
VITE_APP_BASE='/'
#VITE_APP_BASE_URL='http://172.29.40.96:8080'
-VITE_APP_BASE_URL='http://localhost:8080'
+# VITE_APP_BASE_URL='http://localhost:8080'
+VITE_APP_BASE_URL='http://bmdebug.v7.idcfengye.com'
VITE_APP_BASE_API='/api'
#VITE_APP_BASE_WS_URL='ws://172.29.40.96:8080'
VITE_APP_BASE_WS_URL='ws://localhost:8080'
diff --git a/bigtop-manager-ui/src/components/job-info/job.vue b/bigtop-manager-ui/src/components/job-info/job.vue
index 14082de..170c365 100644
--- a/bigtop-manager-ui/src/components/job-info/job.vue
+++ b/bigtop-manager-ui/src/components/job-info/job.vue
@@ -18,12 +18,15 @@
-->
@@ -304,11 +278,12 @@
{{ $t(column.title) }}
diff --git a/bigtop-manager-ui/src/hooks/useBaseTable.ts b/bigtop-manager-ui/src/hooks/useBaseTable.ts
new file mode 100644
index 0000000..cd2fc1d
--- /dev/null
+++ b/bigtop-manager-ui/src/hooks/useBaseTable.ts
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { ref } from 'vue'
+import type { TablePaginationConfig, TableColumnType } from 'ant-design-vue'
+
+const useTable = (
+ columns: TableColumnType[],
+ list?: T[],
+ pagination?: TablePaginationConfig | false | undefined
+) => {
+ const loading = ref(false)
+ const dataSource = ref(list || [])
+ const columnsProp = ref(columns)
+ const paginateProp = ref({
+ current: 1,
+ pageSize: 10,
+ total: dataSource.value.length,
+ size: 'small',
+ showSizeChanger: true,
+ pageSizeOptions: ['10', '20', '30', '40', '50']
+ })
+
+ // merge pagination config
+ if (pagination) {
+ paginateProp.value = Object.assign(paginateProp.value, pagination)
+ }
+
+ const handleChange = (pagination: TablePaginationConfig) => {
+ loading.value = true
+ paginateProp.value = Object.assign(paginateProp.value, pagination)
+ }
+
+ const restState = () => {
+ dataSource.value = []
+ paginateProp.value = {
+ current: 1,
+ pageSize: 10,
+ total: dataSource.value.length || 0,
+ size: 'small',
+ showSizeChanger: true,
+ pageSizeOptions: ['10', '20', '30', '40', '50']
+ }
+ }
+
+ return {
+ columnsProp,
+ dataSource,
+ loading,
+ paginateProp,
+ handleChange,
+ restState
+ }
+}
+
+export default useTable
--
Gitee
From abf7a0e8809e4eeda9cbb3897f8155bacad2b99e Mon Sep 17 00:00:00 2001
From: fuliqiang <1348994179@qq.com>
Date: Fri, 24 May 2024 16:40:25 +0800
Subject: [PATCH 2/5] =?UTF-8?q?useTable=E6=8F=90=E4=BE=9B=E6=B3=9B?=
=?UTF-8?q?=E5=9E=8B=E5=8C=B9=E9=85=8DdataSource+=E4=BF=AE=E6=94=B9job-inf?=
=?UTF-8?q?o=5Fstage=E9=A1=B5=E9=9D=A2=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/job-info/stage.vue | 46 ++++++-------------
bigtop-manager-ui/src/hooks/useBaseTable.ts | 11 +++--
2 files changed, 23 insertions(+), 34 deletions(-)
diff --git a/bigtop-manager-ui/src/components/job-info/stage.vue b/bigtop-manager-ui/src/components/job-info/stage.vue
index 9e74c63..3909ea5 100644
--- a/bigtop-manager-ui/src/components/job-info/stage.vue
+++ b/bigtop-manager-ui/src/components/job-info/stage.vue
@@ -19,29 +19,31 @@