diff --git a/packages/business/package.json b/packages/business/package.json index 7756e8b28..079c23410 100644 --- a/packages/business/package.json +++ b/packages/business/package.json @@ -20,6 +20,7 @@ "axios": "catalog:", "cron-parser": "catalog:", "dayjs": "catalog:", + "json5": "^2.2.3", "juice": "catalog:", "lodash": "catalog:", "monaco-editor": "catalog:", diff --git a/packages/business/src/views/data-server/Drawer.vue b/packages/business/src/views/data-server/Drawer.vue index b9c81c7e0..31ced82c5 100644 --- a/packages/business/src/views/data-server/Drawer.vue +++ b/packages/business/src/views/data-server/Drawer.vue @@ -453,6 +453,11 @@ const save = async (type?: boolean) => { } } + const normalizedCustomWhere = + apiType === 'customerQuery' && fullCustomQuery + ? mqlEditor.value?.normalize(customWhere) ?? customWhere + : customWhere + const params = form.value?.params ?.filter((t: any) => t.name) .map((t: any) => { @@ -537,12 +542,16 @@ const save = async (type?: boolean) => { fields, path, fullCustomQuery, - customWhere, + customWhere: normalizedCustomWhere, }, ], pathSetting: pathSettingList, } + if (apiType === 'customerQuery' && fullCustomQuery) { + form.value.customWhere = normalizedCustomWhere + } + if (!type && connectionId && tableName) { formData.fields = allFields.value // const fieldList = await getAllFields() diff --git a/packages/business/src/views/data-server/MqlEditor.vue b/packages/business/src/views/data-server/MqlEditor.vue index 39eb2def1..fb8dfc5fd 100644 --- a/packages/business/src/views/data-server/MqlEditor.vue +++ b/packages/business/src/views/data-server/MqlEditor.vue @@ -1,10 +1,12 @@