forked from github/dataease
feat: API数据源支持输入jsonpath
This commit is contained in:
parent
cde7bae4a6
commit
444d7c52ac
@ -407,7 +407,7 @@ public class ApiProvider extends Provider {
|
||||
List<String[]> dataList = new LinkedList<>();
|
||||
if(apiDefinition.isUseJsonPath()){
|
||||
List<LinkedHashMap> currentData = new ArrayList<>();
|
||||
Object object = JsonPath.read(result, apiDefinition.getDataPath());
|
||||
Object object = JsonPath.read(result, apiDefinition.getJsonPath());
|
||||
if (object instanceof List) {
|
||||
currentData = (List<LinkedHashMap>) object;
|
||||
} else {
|
||||
|
@ -538,9 +538,9 @@
|
||||
|
||||
<el-form-item
|
||||
:label="$t('datasource.isUseJsonPath')"
|
||||
prop="url"
|
||||
>
|
||||
<el-input
|
||||
:disabled="!apiItem.useJsonPath"
|
||||
v-model="apiItem.jsonPath"
|
||||
:placeholder="$t('datasource.jsonpath_info')"
|
||||
class="input-with-select"
|
||||
@ -1103,6 +1103,10 @@ export default {
|
||||
this.$message.error(i18n.t('datasource.has_repeat_name'))
|
||||
return
|
||||
}
|
||||
if (this.apiItem.useJsonPath && !this.apiItem.jsonPath) {
|
||||
this.$message.error(i18n.t('datasource.please_input_dataPath'))
|
||||
return
|
||||
}
|
||||
this.$refs.apiItemBasicInfo.validate((valid) => {
|
||||
if (valid) {
|
||||
const data = Base64.encode(JSON.stringify(this.apiItem))
|
||||
|
Loading…
Reference in New Issue
Block a user