diff --git a/core/core-backend/src/main/java/io/dataease/datasource/provider/ExcelUtils.java b/core/core-backend/src/main/java/io/dataease/datasource/provider/ExcelUtils.java index 6015cd38ec..eb84e609f3 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/provider/ExcelUtils.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/provider/ExcelUtils.java @@ -668,21 +668,23 @@ public class ExcelUtils { List fields = new ArrayList<>(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); String s = reader.readLine();// first line - String[] split = s.split(","); - for (int i = 0; i < split.length; i++) { - String filedName = split[i]; - if (StringUtils.isEmpty(filedName)) { - DEException.throwException(Translator.get("i18n_excel_error_first_row")); + if(StringUtils.isNotEmpty(s)){ + String[] split = s.split(","); + for (int i = 0; i < split.length; i++) { + String filedName = split[i]; + if (StringUtils.isEmpty(filedName)) { + DEException.throwException(Translator.get("i18n_excel_error_first_row")); + } + if (filedName.startsWith(UFEFF)) { + filedName = filedName.replace(UFEFF, ""); + } + TableField tableFiled = new TableField(); + tableFiled.setName(filedName); + tableFiled.setOriginName(filedName); + tableFiled.setFieldType(null); + tableFiled.setChecked(true); + fields.add(tableFiled); } - if (filedName.startsWith(UFEFF)) { - filedName = filedName.replace(UFEFF, ""); - } - TableField tableFiled = new TableField(); - tableFiled.setName(filedName); - tableFiled.setOriginName(filedName); - tableFiled.setFieldType(null); - tableFiled.setChecked(true); - fields.add(tableFiled); } List data = csvData(reader, isPreview, fields.size()); @@ -734,7 +736,7 @@ public class ExcelUtils { return excelSheetDataList; } - private static Map downLoadFromFtp(ExcelConfiguration remoteExcelRequest) { + public static Map downLoadFromFtp(ExcelConfiguration remoteExcelRequest) { Map fileNames = new HashMap<>(); String username = ""; String password = ""; diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index 5e1ad41f39..4e83ad2d48 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -1,5 +1,6 @@ export default { common: { + empty: ' ', component: { input: 'Input', textarea: 'Textarea', @@ -10,6 +11,8 @@ export default { dateRange: 'Date Range Picker', add_component_hint: 'Click or drag the component on the left to add a field' }, + local_excel: 'Local Excel/CSV', + remote_excel: 'Remote Excel/CSV', list_selection: 'List selection', date_setting: 'Date setting', openMobileTerminal: 'Open mobile terminal', diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts index f67cdf0371..a20237c1ef 100644 --- a/core/core-frontend/src/locales/tw.ts +++ b/core/core-frontend/src/locales/tw.ts @@ -1,5 +1,6 @@ export default { common: { + empty: '', component: { input: '單行輸入', textarea: '多行輸入', @@ -10,6 +11,8 @@ export default { dateRange: '時間範圍', add_component_hint: '點選或拖曳左側元件新增欄位' }, + local_excel: '本地 Excel/CSV', + remote_excel: '遠端 Excel/CSV', list_selection: '清單選擇', date_setting: '日期設定', openMobileTerminal: '開啟行動端', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 422013fcec..224de85a79 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -1,6 +1,9 @@ export default { common: { + empty: '', timeout_tips: '请求超时,请稍后再试', + local_excel: '本地 Excel/CSV', + remote_excel: '远程 Excel/CSV', watermarkManagement: '水印管理', list_selection: '列表选择', date_setting: '日期设置', diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/ExcelDetail.vue b/core/core-frontend/src/views/visualized/data/datasource/form/ExcelDetail.vue index e0b55e0eed..f06feafef8 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/ExcelDetail.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/ExcelDetail.vue @@ -641,14 +641,31 @@ defineExpose({ :rules="[ { required: true, - message: t('common.please_input') + t('datasource.datasource') + t('common.name') + message: + t('common.please_input') + + t('common.empty') + + t('datasource.datasource') + + t('common.empty') + + t('common.name') } ]" - :label="t('visualization.custom') + t('datasource.datasource') + t('common.name')" + :label=" + t('visualization.custom') + + t('common.empty') + + t('datasource.datasource') + + t('common.empty') + + t('common.name') + " > @@ -787,7 +804,8 @@ defineExpose({ background: #f5f6f7; padding: 16px; .btn-select { - width: 164px; + min-width: 164px; + padding: 0 6px; height: 32px; display: flex; align-items: center; @@ -805,7 +823,7 @@ defineExpose({ } .ed-button.is-text { height: 24px; - width: 74px; + min-width: 74px; line-height: 24px; } .ed-button + .ed-button { diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/ExcelRemoteDetail.vue b/core/core-frontend/src/views/visualized/data/datasource/form/ExcelRemoteDetail.vue index 59b8170501..f9639734d2 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/ExcelRemoteDetail.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/ExcelRemoteDetail.vue @@ -780,7 +780,7 @@ defineExpose({ { let excelRequest = JSON.parse(JSON.stringify(form2.configuration)) excelRequest.datasourceId = form2.id || 0 excelRequest.editType = form2.editType - excelRequest.userName = Base64.encode(request.userName) - excelRequest.passwd = Base64.encode(request.passwd) + excelRequest.userName = Base64.encode(excelRequest.userName) + excelRequest.passwd = Base64.encode(excelRequest.passwd) return loadRemoteFile(excelRequest) .then(res => { dsLoading.value = false diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/option.ts b/core/core-frontend/src/views/visualized/data/datasource/form/option.ts index 35479b8e2c..2e9a9b9cfd 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/option.ts +++ b/core/core-frontend/src/views/visualized/data/datasource/form/option.ts @@ -111,13 +111,13 @@ export const dsTypes = [ }, { type: 'Excel', - name: '本地 Excel/CSV', + name: t('common.local_excel'), catalog: 'LOCAL', extraParams: '' }, { type: 'ExcelRemote', - name: '远程 Excel/CSV', + name: t('common.remote_excel'), catalog: 'LOCAL', extraParams: '' }