From 4160b3b1ac15b282ac59e5357d8ef99928a52b55 Mon Sep 17 00:00:00 2001
From: Raod <1130305001@qq.com>
Date: Tue, 16 Nov 2021 16:36:29 +0800
Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E6=B7=BB=E5=8A=A0ht?=
=?UTF-8?q?tp=EF=BC=8C=E5=8D=95=E7=8B=AC=E7=BB=B4=E6=8A=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../db/migration/V1.0.13__update_set.sql | 14 +++++
.../resultset/components/EditDataSet.vue | 54 ++++++++++++++--
.../src/views/report/resultset/index.vue | 62 ++++++++++++++-----
3 files changed, 108 insertions(+), 22 deletions(-)
create mode 100644 report-core/src/main/resources/db/migration/V1.0.13__update_set.sql
diff --git a/report-core/src/main/resources/db/migration/V1.0.13__update_set.sql b/report-core/src/main/resources/db/migration/V1.0.13__update_set.sql
new file mode 100644
index 00000000..37f591bb
--- /dev/null
+++ b/report-core/src/main/resources/db/migration/V1.0.13__update_set.sql
@@ -0,0 +1,14 @@
+use
+aj_report;
+
+-- 增加字段
+ALTER TABLE `gaea_report_data_set` DROP COLUMN `set_type`;
+-- 将该字段值全更新为sql
+update gaea_report_data_set set set_type = 'sql';
+
+-- 字典
+INSERT INTO `gaea_dict`(`id`, `dict_name`, `dict_code`, `remark`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES (default, '数据集类型', 'SET_TYPE', '数据集类型', 'admin', '2021-11-16 14:43:12', 'admin', '2021-11-16 14:43:12', 1);
+INSERT INTO `gaea_dict_item`(`id`, `dict_code`, `item_name`, `item_value`, `item_extend`, `enabled`, `locale`, `remark`, `sort`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES (default , 'SET_TYPE', 'sql', 'sql', NULL, 1, 'zh', NULL, NULL, 'admin', '2021-11-16 14:43:42', 'admin', '2021-11-16 14:43:42', 1);
+INSERT INTO `gaea_dict_item`(`id`, `dict_code`, `item_name`, `item_value`, `item_extend`, `enabled`, `locale`, `remark`, `sort`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES (default , 'SET_TYPE', 'http', 'http', NULL, 1, 'zh', NULL, NULL, 'admin', '2021-11-16 14:43:51', 'admin', '2021-11-16 14:43:51', 1);
+
+
diff --git a/report-ui/src/views/report/resultset/components/EditDataSet.vue b/report-ui/src/views/report/resultset/components/EditDataSet.vue
index 4d747fad..27cb9a4d 100644
--- a/report-ui/src/views/report/resultset/components/EditDataSet.vue
+++ b/report-ui/src/views/report/resultset/components/EditDataSet.vue
@@ -15,7 +15,7 @@
label-width="130px"
>
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -508,7 +530,13 @@ export default {
setName: "",
setCode: ""
},
-
+ setType: '', //数据集类型,主要用于区分http addSql addHttp edit
+ httpForm: { //http数据源相关数据
+ apiUrl: '',
+ method: 'GET',
+ header: '{"Content-Type":"application/json;charset=UTF-8"}',
+ body: '',
+ },
//待删除
dictionaryOptions: [], // 数据源类型
list: null,
@@ -541,7 +569,11 @@ export default {
mounted() {},
methods: {
// 编辑数据集,获取单条数据详情
- async addOrEditDataSet(row) {
+ async addOrEditDataSet(row, type) {
+ this.setType = type
+ if (type == 'http' && row.dynSentence) {
+ this.httpForm = JSON.parse(row.dynSentence)
+ }
//获取数据源下拉
const { code, data } = await queryAllDataSourceSet();
if (code != "200") return;
@@ -636,12 +668,18 @@ export default {
// 测试预览
async handleClickTabs(tab, event) {
+ if (this.setType == 'http') {
+ //针对http数据源
+ console.log("http数据集" + this.httpForm);
+ this.formData.dynSentence = JSON.stringify(this.httpForm)
+ }
if (tab.paneName == "third") {
const params = {
sourceCode: this.formData.sourceCode,
dynSentence: this.formData.dynSentence,
dataSetParamDtoList: this.tableData,
- dataSetTransformDtoList: this.itemFilterList
+ dataSetTransformDtoList: this.itemFilterList,
+ setType: this.setType
};
const { code, data } = await testTransformSet(params);
if (code != "200") return;
@@ -831,6 +869,12 @@ export default {
});
},
async submit(formName) {
+ if (this.setType == 'http') {
+ //针对http数据源
+ console.log("http数据集" + this.httpForm);
+ this.formData.dynSentence = JSON.stringify(this.httpForm)
+ }
+ this.formData.setType = this.setType
this.$refs[formName].validate(async (valid, obj) => {
if (valid) {
if (this.testMassageCode == 200) {
diff --git a/report-ui/src/views/report/resultset/index.vue b/report-ui/src/views/report/resultset/index.vue
index cb5aaf4f..82fe522d 100644
--- a/report-ui/src/views/report/resultset/index.vue
+++ b/report-ui/src/views/report/resultset/index.vue
@@ -1,13 +1,19 @@
- 新增
-
+
+
+ 新增
+
+
+
+ SQL
+ HTTP
+
+
@@ -15,7 +21,7 @@
type="text"
@click="operateDataset('edit', props)"
v-permission="'resultsetManage:update'"
- >编辑
+ >编辑
@@ -24,7 +30,7 @@
type="text"
@click="dataView(props)"
v-permission="'resultsetManage:query'"
- >数据预览
+ >数据预览
@@ -95,7 +101,15 @@ export default {
},
label: "数据源",
field: "sourceCode"
- }
+ },
+ {
+ inputType: "anji-select", //form表单类型 input|input-number|anji-select(传递url或者dictCode)|anji-tree(左侧树)|date|datetime|datetimerange
+ anjiSelectOption: {
+ dictCode: "SET_TYPE"
+ },
+ label: "数据集类型",
+ field: "setType"
+ },
],
// 操作按钮
buttons: {
@@ -143,7 +157,7 @@ export default {
editField: "setCode",
inputType: "input",
rules: [
- { min: 1, max: 50, message: "不超过50个字符", trigger: "blur" }
+ {min: 1, max: 50, message: "不超过50个字符", trigger: "blur"}
],
disabled: false
},
@@ -154,7 +168,7 @@ export default {
editField: "setName",
inputType: "input",
rules: [
- { min: 1, max: 100, message: "不超过100个字符", trigger: "blur" }
+ {min: 1, max: 100, message: "不超过100个字符", trigger: "blur"}
],
disabled: false
},
@@ -165,7 +179,7 @@ export default {
editField: "setDesc",
inputType: "input",
rules: [
- { min: 1, max: 255, message: "不超过255个字符", trigger: "blur" }
+ {min: 1, max: 255, message: "不超过255个字符", trigger: "blur"}
],
disabled: false
},
@@ -176,7 +190,18 @@ export default {
editField: "sourceCode",
inputType: "input",
rules: [
- { min: 1, max: 50, message: "不超过50个字符", trigger: "blur" }
+ {min: 1, max: 50, message: "不超过50个字符", trigger: "blur"}
+ ],
+ disabled: false
+ },
+ {
+ label: "数据集类型", //数据源编码
+ placeholder: "",
+ field: "setType",
+ editField: "setType",
+ inputType: "input",
+ rules: [
+ {min: 1, max: 50, message: "不超过50个字符", trigger: "blur"}
],
disabled: false
},
@@ -245,16 +270,19 @@ export default {
};
},
- created() {},
+ created() {
+ },
methods: {
operateDataset(type, prop) {
+ debugger
this.dialogVisibleSetDataSet = true;
- if (prop) {
+ if (prop && prop.msg) {
this.dataSet = prop.msg;
+ type = prop.msg.setType;
} else {
this.dataSet = {};
}
- this.$refs.EditDataSet.addOrEditDataSet(this.dataSet);
+ this.$refs.EditDataSet.addOrEditDataSet(this.dataSet, type);
},
refreshList() {
this.$refs.listPage.handleQueryForm("query");