Browse Source

feat:http数据集修改输出字段

liu.shiyi 1 year ago
parent
commit
9949277310

+ 1 - 1
data-room-ui/packages/DataSetManagement/src/HttpEditForm.vue

@@ -1115,7 +1115,7 @@ export default {
           this.dataPreviewList = res && Array.isArray(res) ? res : [{ ...res }]
           // 获取数据后更新输出字段
           console.log(res)
-          this.updateOoutputFieldList(res?.data)
+          this.updateOoutputFieldList(this.dataPreviewList)
           this.$message.success('解析并执行成功')
         })
       } else {

+ 13 - 0
data-room-ui/packages/js/mixins/commonMixins.js

@@ -77,6 +77,7 @@ export default {
           if (res.executionByFrontend) {
             if (res.data.datasetType === 'http') {
               _res = await axiosFormatting(res.data)
+              _res = this.httpDataFormatting(res, _res)
             }
             if (res.data.datasetType === 'js') {
               try {
@@ -123,6 +124,7 @@ export default {
           if (res.executionByFrontend) {
             if (res.data.datasetType === 'http') {
               _res = await axiosFormatting(res.data)
+              _res = this.httpDataFormatting(res, _res)
             }
             if (res.data.datasetType === 'js') {
               try {
@@ -154,6 +156,17 @@ export default {
         })
       })
     },
+    // http前台代理需要对返回的数据进行重新组装
+    httpDataFormatting (chartRes, httpRes) {
+      let result = {}
+      result = {
+        columnData: chartRes.columnData,
+        data: httpRes,
+        success: chartRes.success
+
+      }
+      return result
+    },
     dataFormatting (config, data) {
       // 覆盖
     },