From 00ae5a8a618670b2b8c0f1325e6df0af786dbf1a Mon Sep 17 00:00:00 2001
From: 1iyc <5212514+liycone@user.noreply.gitee.com>
Date: Wed, 6 Nov 2024 13:11:58 +0800
Subject: [PATCH] v 1.2.1
Signed-off-by: 1iyc <5212514+liycone@user.noreply.gitee.com>
---
src/api/gather/pool/pool.js | 4 +-
src/components/TabComponent/index.vue | 153 ++++++++++++++++++++----
src/views/gather/pool/index.vue | 163 +++++++++++++++++---------
3 files changed, 240 insertions(+), 80 deletions(-)
diff --git a/src/api/gather/pool/pool.js b/src/api/gather/pool/pool.js
index 1232e9d..51a2a95 100644
--- a/src/api/gather/pool/pool.js
+++ b/src/api/gather/pool/pool.js
@@ -11,7 +11,7 @@ export function getNav(query) {
export function getTasks(queryParams) {
return request({
- url: '/gather/task/page/',
+ url: '/gather/task/page',
method: 'GET',
params: queryParams,
});
@@ -20,7 +20,7 @@ export function getTasks(queryParams) {
export function getDataList(dataSource, queryParams) {
return request({
- url: '/kis/supplier/list/' + dataSource,
+ url: '/kis/supplier/list' + dataSource,
method: 'GET',
params: queryParams,
});
diff --git a/src/components/TabComponent/index.vue b/src/components/TabComponent/index.vue
index c367685..b44b734 100644
--- a/src/components/TabComponent/index.vue
+++ b/src/components/TabComponent/index.vue
@@ -14,9 +14,8 @@
- {{ tab.title }}{{ index }}
+ {{ tab.title }}
@@ -34,14 +33,42 @@
>
- 修改
- 断开
- 打开
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+ />
+
+
+
+
+ 修改
+
+ 同步
+
+
+
@@ -132,15 +181,30 @@ export default {
name: 'TabComponent',
initMenuItem: {
type: Array,
- default: () => []
+ default: () => [{
+ title: '数据库',
+ }]
},
callBackSelect: {
type: Function,
default: () => ({})
},
+ initForm: {
+ type: Array,
+ default: () => [{
+ type: 'input',
+ label: '表名',
+ prop: 'tableName',
+ placeholder: '请输入表名',
+ }]
+ },
initColumns: {
type: Array,
- default: () => []
+ default: () => [{
+ type: 'id',
+ width: 55,
+ align: 'center'
+ }]
},
initTableData: {
type: Array,
@@ -156,6 +220,7 @@ export default {
return {
active: this.initActive,
tabs: this.initMenuItem,
+ form: this.initForm,
columns: this.initColumns,
tableData: this.initTableData,
loading: false,
@@ -175,7 +240,8 @@ export default {
total: 0,
queryParams: {
pageNum: 1,
- pageSize: 10
+ pageSize: 10,
+ activeTab: {},
},
}
}
@@ -183,24 +249,52 @@ export default {
mounted() {
// console.log(JSON.stringify(this.initMenuItem))
// console.log(JSON.stringify(this.columns))
+ this.setDefaultValue()
+ this.onSelect(this.active)
}
,
methods: {
-
+ getComponentType(type) {
+ switch (type) {
+ case 'input':
+ return 'el-input';
+ case 'textarea':
+ return 'el-input';
+ case 'select':
+ return 'el-select';
+ case 'checkbox':
+ return 'el-checkbox';
+ case 'radio':
+ return 'el-radio';
+ case 'date':
+ return 'el-date-picker';
+ case 'button':
+ return 'el-button';
+ default:
+ return 'el-input';
+ }
+ },
+ /* 设置默认值*/
+ setDefaultValue() {
+ this.form.forEach(field => {
+ if (field.type === 'select' && field.options) {
+ const defaultOption = field.options.find(option => option.default);
+ if (defaultOption) {
+ this.queryParams[field.prop] = defaultOption.value;
+ }
+ }
+ });
+ },
/* 选中菜单 */
onSelect(index) {
- this.active = index
- this.loading = true
- this.callBackSelect(this.active, this.queryParams)
- this.loading = false
+ this.queryParams.activeTab = this.tabs[index]
+ this.callBackSelect(this.queryParams)
},
- /* tabs 单击实践 */
+ /* tabs 单击事件 */
onClick(tab) {
- this.active = tab.name;
- this.loading = true
- this.callBackSelect(this.active, this.queryParams)
- this.loading = false
+ this.queryParams.activeTab = this.tabs[tab.name]
+ this.callBackSelect(this.queryParams)
},
/* 加载表格数据*/
@@ -210,8 +304,18 @@ export default {
},
getList() {
- this.callBackSelect(this.active, this.queryParams)
+ this.callBackSelect(this.queryParams)
+ },
+
+
+ handleQuery() {
+ this.getList();
},
+ resetQuery() {
+ this.resetForm("queryForm");
+ this.handleQuery();
+ },
+
showDialog(mode, index = null) {
this.dialogTitle = mode === 'add' ? '新建标签页' : '修改标签页';
@@ -265,10 +369,6 @@ export default {
}
,
- disconnectTab(index) {
- console.log(`断开标签页 ${index}`);
- }
- ,
handleClose(done, event) {
@@ -285,6 +385,9 @@ export default {
}
}
,
+ handleUpdate(row) {
+ alert(row.id)
+ }
}
diff --git a/src/views/gather/pool/index.vue b/src/views/gather/pool/index.vue
index 65faf4a..675f9ee 100644
--- a/src/views/gather/pool/index.vue
+++ b/src/views/gather/pool/index.vue
@@ -1,11 +1,15 @@
+
+
@@ -19,51 +23,99 @@ export default {
data() {
return {
addTabDialogVisible: false,
- tabs: [],
- currentActiveTab: {},
- column: [
- {
- type: 'id',
- width: 55,
- align: 'center'
- },
- {
- title: '表名称',
- key: 'tableName',
- align: 'center'
- },
- {
- title: '描述',
- key: 'tableDescription',
- align: 'center'
- },
- {
- title: '表注',
- key: 'tableNote',
- align: 'center'
- },
- {
- title: '启用',
- key: 'enable',
- align: 'center'
- },
- {
- title: 'cron (定时)',
- key: 'cron',
- align: 'center'
- },
- {
- title: '操作',
- key: 'oper',
- align: 'center'
- }
- ],
- total: 0,
- rows: [],
+ table: {
+ form: [
+ {
+ type: 'input',
+ label: '表名',
+ prop: 'tableName',
+ placeholder: '请输入表名',
+ },
+ {
+ type: 'input',
+ label: '表描述',
+ prop: 'tableDescription',
+ placeholder: '请输入表描述',
+ span: 6
+ },
+ {
+ type: 'input',
+ label: '表注',
+ prop: 'tableNote',
+ placeholder: '请输入表注',
+ },
+ {
+ type: 'select',
+ label: '是否启用',
+ prop: 'enable',
+ placeholder: '请选择是否启用',
+ options: [
+ {
+ label: '是',
+ value: '1',
+ default: true
+ },
+ {
+ label: '否',
+ value: '0'
+ }
+ ]
+ },
+ ],
+ column: [
+ {
+ type: 'id',
+ width: 55,
+ align: 'center'
+ },
+ {
+ title: '表名称',
+ key: 'tableName',
+ align: 'center'
+ },
+ {
+ title: '描述',
+ key: 'tableDescription',
+ align: 'center'
+ },
+ {
+ title: '表注',
+ key: 'tableNote',
+ align: 'center'
+ },
+ {
+ title: '启用',
+ key: 'enable',
+ align: 'center',
+ },
+ {
+ title: 'cron (定时)',
+ key: 'cron',
+ align: 'center'
+ }
+ ],
+ rows: [],
+ },
initActiveTab: "0",
+
+ tabs: [],
+ activeTab: {
+ title: undefined,
+ name: undefined,
+ dbType: undefined,
+ url: undefined,
+ username: undefined,
+ driverClassName: undefined,
+ },
queryParams: {
pageNum: 1,
- pageSize: 10
+ pageSize: 10,
+ name: undefined,
+ tableName: undefined,
+ enable: undefined,
+ tableDescription: undefined,
+ tableNote: undefined,
+ cron: undefined,
}
};
},
@@ -84,25 +136,30 @@ export default {
driverClassName: item.driverClassName
}));
if (this.tabs.length > 0) {
- this.currentActiveTab = this.tabs[0];
- this.getDataList(this.queryParams);
+ this.activeTab = this.tabs[0];
+ this.queryParams.name = this.activeTab.name
+ this.getDataList();
}
}).catch(error => {
console.error('Failed to fetch navigation data:', error);
});
},
- backSelect(index, queryParams) {
- this.currentActiveTab = this.tabs[index];
- this.getDataList(queryParams);
+ backSelect(callBackActiveTab) {
+ console.log(JSON.stringify(callBackActiveTab));
+ this.activeTab = callBackActiveTab.activeTab
+ this.queryParams.pageNum = callBackActiveTab.pageNum
+ this.queryParams.pageSize = callBackActiveTab.pageSize
+ this.queryParams.enable = callBackActiveTab.enable
+ this.queryParams.name = this.activeTab.name
+ this.getDataList();
},
- getDataList(queryParams) {
- getTasks(queryParams)
+ getDataList() {
+ console.log('getDataList', JSON.stringify(this.queryParams));
+ getTasks(this.queryParams)
.then(response => {
- this.rows = response.rows;
- this.total = response.total;
- this.$refs.tabComponent.loadTableData(this.rows, this.total);
+ this.$refs.tabComponent.loadTableData(response.rows, response.total);
})
.catch(error => {
console.error('Failed to fetch data list:', error);