diff --git a/data-room-ui/packages/DataSetManagement/src/HttpEditForm.vue b/data-room-ui/packages/DataSetManagement/src/HttpEditForm.vue index 5da0393b..5280e2af 100644 --- a/data-room-ui/packages/DataSetManagement/src/HttpEditForm.vue +++ b/data-room-ui/packages/DataSetManagement/src/HttpEditForm.vue @@ -504,6 +504,7 @@ :data="dataPreviewList" max-height="400" :border="true" + height="500px" class="bs-el-table bs-scrollbar" > { - this.dataPreviewList = res.data && Array.isArray(res.data) ? res.data : [] + const { resp, response } = res + // this.dataPreviewList = res.data && Array.isArray(res.data) ? res.data : [] + this.dataPreviewList = [{}] + for (const item in response.data) { + this.dataPreviewList[0][item] = response.data[item] + } // 获取数据后更新输出字段 this.updateOoutputFieldList(this.dataPreviewList) this.$message.success('解析并执行成功') diff --git a/data-room-ui/packages/js/mixins/commonMixins.js b/data-room-ui/packages/js/mixins/commonMixins.js index a297cda1..c9343e13 100644 --- a/data-room-ui/packages/js/mixins/commonMixins.js +++ b/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 = _res.resp } 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 = _res.resp } if (res.data.datasetType === 'js') { try { diff --git a/data-room-ui/packages/js/utils/httpParamsFormatting.js b/data-room-ui/packages/js/utils/httpParamsFormatting.js index a1f85154..f65afe46 100644 --- a/data-room-ui/packages/js/utils/httpParamsFormatting.js +++ b/data-room-ui/packages/js/utils/httpParamsFormatting.js @@ -33,19 +33,18 @@ export default function axiosFormatting (customConfig) { /** 添加响应拦截器 **/ instance.interceptors.response.use(response => { - if (response.data.code === 200) { - // 执行响应脚本 - // eslint-disable-next-line no-new-func + console.log('response', response) + // 执行响应脚本 + // eslint-disable-next-line no-new-func + if (newCustomConfig.responseScript) { const getResp = new Function('response', newCustomConfig.responseScript) const resp = getResp(response) - console.log(resp) - return Promise.resolve(resp) + console.log('resp', resp) + return Promise.resolve({ resp, response }) } else { - Message({ - message: response.data.message, - type: 'error' - }) - return Promise.reject(response.data.message) + console.log(response.data) + const resp = response + return Promise.resolve({ resp, response }) } }) const body = {}