diff --git a/backend/src/main/resources/db/migration/V36__1.12.sql b/backend/src/main/resources/db/migration/V36__1.12.sql index 5ded5a0267..908b821a69 100644 --- a/backend/src/main/resources/db/migration/V36__1.12.sql +++ b/backend/src/main/resources/db/migration/V36__1.12.sql @@ -19,3 +19,17 @@ CREATE TABLE `chart_view_field` `last_sync_time` bigint(13) DEFAULT NULL COMMENT '同步时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; + +DROP TABLE IF EXISTS `sql_variable`; +CREATE TABLE `sql_variable` +( + `id` varchar(50) NOT NULL COMMENT 'ID', + `table_id` varchar(50) NOT NULL COMMENT '数据集ID', + `variable_name` varchar(255) NOT NULL COMMENT '名称', + `alias` varchar(255) NOT NULL COMMENT '别名', + `type` varchar(50) NOT NULL COMMENT '类型', + `details` longtext DEFAULT NULL COMMENT '明细', + `default_value` longtext DEFAULT NULL COMMENT '默认值', + `required` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否必填', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; \ No newline at end of file diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 2d9678c76b..64c76e1e8c 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -2080,5 +2080,8 @@ export default { }, plugin_style: { border: '边框' + }, + sql_variable: { + variable_mgm: '参数设置' } } diff --git a/frontend/src/views/dataset/add/AddSQL.vue b/frontend/src/views/dataset/add/AddSQL.vue index b52b880061..80c161e7a6 100644 --- a/frontend/src/views/dataset/add/AddSQL.vue +++ b/frontend/src/views/dataset/add/AddSQL.vue @@ -46,6 +46,7 @@ + {{ $t('sql_variable.variable_mgm') }} @@ -94,6 +95,20 @@ + + + + + + + + + + + + + + @@ -161,6 +176,10 @@ export default { selectedDatasource: {}, engineMode: 'local', disabledSync: true, + showVariableMgm: false, + dialogTitle: '', + variables: [], + variablesTmp: [] } }, computed: { @@ -335,7 +354,18 @@ export default { this.fields = [] this.mode = '0' this.syncType = 'sync_now' - } + }, + + variableMgm() { + var reg = new RegExp("${(.*?)}", "gim"); + var match = this.sql.match(reg); + console.log(match) + this.dialogTitle = this.$t('sql_variable.variable_mgm') + this.showVariableMgm = true + }, + closeVariableMgm() { + this.showVariableMgm = false + }, } }