mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
import transactions from custom xlsx/xls file
This commit is contained in:
+1
-1
@@ -78,7 +78,7 @@ export const SPECIFIED_API_NOT_FOUND_ERRORS: Record<string, SpecifiedApiError> =
|
||||
'/api/v1/users/2fa/recovery/regenerate.json': {
|
||||
message: 'Two-factor authentication is disabled'
|
||||
},
|
||||
'/api/v1/transactions/parse_dsv_file.json': {
|
||||
'/api/v1/transactions/parse_custom_file.json': {
|
||||
message: 'Transaction importing is disabled'
|
||||
},
|
||||
'/api/v1/transactions/parse_import.json': {
|
||||
|
||||
+22
-1
@@ -180,7 +180,28 @@ export const SUPPORTED_IMPORT_FILE_CATEGORY_AND_TYPES: ImportFileCategoryAndType
|
||||
supportMultiLanguages: true,
|
||||
anchor: 'how-to-import-delimiter-separated-values-dsv-file-or-data'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'excel',
|
||||
name: 'Excel Workbook File',
|
||||
extensions: '.xlsx,.xls',
|
||||
subTypes: [
|
||||
{
|
||||
type: 'custom_xlsx',
|
||||
name: 'Excel Workbook File (.xlsx)',
|
||||
extensions: '.xlsx',
|
||||
},
|
||||
{
|
||||
type: 'custom_xls',
|
||||
name: 'Excel 97-2003 Workbook File (.xls)',
|
||||
extensions: '.xls',
|
||||
}
|
||||
],
|
||||
document: {
|
||||
supportMultiLanguages: true,
|
||||
anchor: 'how-to-import-delimiter-separated-values-dsv-file-or-data'
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -570,6 +570,9 @@ export class KnownDateTimeFormat {
|
||||
|
||||
public static readonly YYYYMMDD = new KnownDateTimeFormat('YYYYMMDD', DateFormatOrder.YMD, /^\d{4}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])$/);
|
||||
|
||||
public static readonly MMDDYYDash = new KnownDateTimeFormat('MM-DD-YY', DateFormatOrder.MDY, /^(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])-\d{2}$/);
|
||||
public static readonly MMDDYYSlash = new KnownDateTimeFormat('MM/DD/YY', DateFormatOrder.MDY, /^(0[1-9]|1[0-2])\/(0[1-9]|[1-2][0-9]|3[0-1])\/\d{2}$/);
|
||||
|
||||
public readonly format: string;
|
||||
public readonly type: DateFormatOrder;
|
||||
private readonly regex: RegExp;
|
||||
|
||||
+2
-2
@@ -617,8 +617,8 @@ export default {
|
||||
deleteTransaction: (req: TransactionDeleteRequest): ApiResponsePromise<boolean> => {
|
||||
return axios.post<ApiResponse<boolean>>('v1/transactions/delete.json', req);
|
||||
},
|
||||
parseImportDsvFile: ({ fileType, fileEncoding, importFile }: { fileType: string, fileEncoding?: string, importFile: File }): ApiResponsePromise<string[][]> => {
|
||||
return axios.postForm<ApiResponse<string[][]>>('v1/transactions/parse_dsv_file.json', {
|
||||
parseImportCustomFile: ({ fileType, fileEncoding, importFile }: { fileType: string, fileEncoding?: string, importFile: File }): ApiResponsePromise<string[][]> => {
|
||||
return axios.postForm<ApiResponse<string[][]>>('v1/transactions/parse_custom_file.json', {
|
||||
fileType: fileType,
|
||||
fileEncoding: fileEncoding,
|
||||
file: importFile
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Other Finance App File Format",
|
||||
"ezbookkeeping Data Export File": "ezBookkeeping-Datenexportdatei",
|
||||
"Excel Workbook File": "Excel Workbook File",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX)-Datei",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX)-Datei",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF)-Datei",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Other Finance App File Format",
|
||||
"ezbookkeeping Data Export File": "ezbookkeeping Data Export File",
|
||||
"Excel Workbook File": "Excel Workbook File",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX) File",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX) File",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) File",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Otro Formato de Archivo de Aplicación Financiera",
|
||||
"ezbookkeeping Data Export File": "Datos exportados de ezBookkeeping",
|
||||
"Excel Workbook File": "Archivo Excel",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Archivo OFX (Open Financial Exchange)",
|
||||
"Quicken Financial Exchange (QFX) File": "Archivo QFX (Quicken Financial Exchange)",
|
||||
"Quicken Interchange Format (QIF) File": "Archivo QIF (Quicken Interchange Format)",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Format de fichier d'autre app financière",
|
||||
"ezbookkeeping Data Export File": "Fichier d'exportation de données ezbookkeeping",
|
||||
"Excel Workbook File": "Fichier de classeur Excel",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Fichier Open Financial Exchange (OFX)",
|
||||
"Quicken Financial Exchange (QFX) File": "Fichier Quicken Financial Exchange (QFX)",
|
||||
"Quicken Interchange Format (QIF) File": "Fichier Quicken Interchange Format (QIF)",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Other Finance App File Format",
|
||||
"ezbookkeeping Data Export File": "File esportazione dati ezBookkeeping",
|
||||
"Excel Workbook File": "Excel Workbook File",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "File Open Financial Exchange (OFX)",
|
||||
"Quicken Financial Exchange (QFX) File": "File Quicken Financial Exchange (QFX)",
|
||||
"Quicken Interchange Format (QIF) File": "File Quicken Interchange Format (QIF)",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Other Finance App File Format",
|
||||
"ezbookkeeping Data Export File": "ezbookkeepingデータエクスポートファイル",
|
||||
"Excel Workbook File": "Excel Workbook File",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX) ファイル",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX) ファイル",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) ファイル",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "ಇತರೆ ಹಣಕಾಸು ಅಪ್ ಫೈಲ್ ರೂಪ",
|
||||
"ezbookkeeping Data Export File": "ezBookkeeping ಡೇಟಾ ರಫ್ತು ಫೈಲ್",
|
||||
"Excel Workbook File": "Excel ವರ್ಕ್ಬುಕ್ ಫೈಲ್",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX) ಫೈಲ್",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX) ಫೈಲ್",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) ಫೈಲ್",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "기타 금융 앱 파일 형식",
|
||||
"ezbookkeeping Data Export File": "ezbookkeeping 데이터 내보내기 파일",
|
||||
"Excel Workbook File": "Excel 통합 문서 파일",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX) 파일",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX) 파일",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) 파일",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Other Finance App File Format",
|
||||
"ezbookkeeping Data Export File": "ezBookkeeping-gegevensexportbestand",
|
||||
"Excel Workbook File": "Excel-werkmap",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX)-bestand",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX)-bestand",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF)-bestand",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Other Finance App File Format",
|
||||
"ezbookkeeping Data Export File": "Arquivo de Exportação de Dados ezbookkeeping",
|
||||
"Excel Workbook File": "Excel Workbook File",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Arquivo Open Financial Exchange (OFX)",
|
||||
"Quicken Financial Exchange (QFX) File": "Arquivo Quicken Financial Exchange (QFX)",
|
||||
"Quicken Interchange Format (QIF) File": "Arquivo Quicken Interchange Format (QIF)",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Формат файла другого финансового приложения",
|
||||
"ezbookkeeping Data Export File": "Файл экспорта данных ezbookkeeping",
|
||||
"Excel Workbook File": "Файл рабочей книги Excel",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Файл Open Financial Exchange (OFX)",
|
||||
"Quicken Financial Exchange (QFX) File": "Файл Quicken Financial Exchange (QFX)",
|
||||
"Quicken Interchange Format (QIF) File": "Файл Quicken Interchange Format (QIF)",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Format datoteke druge finančne aplikacije",
|
||||
"ezbookkeeping Data Export File": "ezbookkeeping datoteka za izvoz podatkov",
|
||||
"Excel Workbook File": "Excelova delovni zvezek",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX) datoteka",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX) datoteka",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) datoteka",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "இதர நிதி ஆப் கோப்பு வடிவம்",
|
||||
"ezbookkeeping Data Export File": "ezBookkeeping தரவு ஏற்றுமதி கோப்பு",
|
||||
"Excel Workbook File": "Excel வேலைபுத்தகம் கோப்பு",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX) கோப்பு",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX) கோப்பு",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) கோப்பு",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "รูปแบบไฟแอปการเงินอื่น",
|
||||
"ezbookkeeping Data Export File": "ไฟล์ส่งออกข้อมูล ezBookkeeping",
|
||||
"Excel Workbook File": "ไฟล์ Excel",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "ไฟล์ Open Financial Exchange (OFX)",
|
||||
"Quicken Financial Exchange (QFX) File": "ไฟล์ Quicken Financial Exchange (QFX)",
|
||||
"Quicken Interchange Format (QIF) File": "ไฟล์ Quicken Interchange Format (QIF)",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Diğer Finans Uygulaması Dosya Formatı",
|
||||
"ezbookkeeping Data Export File": "ezBookkeeping Veri Dışa Aktarım Dosyası",
|
||||
"Excel Workbook File": "Excel Çalışma Kitabı Dosyası",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX) Dosyası",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX) Dosyası",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) Dosyası",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Other Finance App File Format",
|
||||
"ezbookkeeping Data Export File": "Файл експорту даних ezbookkeeping",
|
||||
"Excel Workbook File": "Excel Workbook File",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Файл Open Financial Exchange (OFX)",
|
||||
"Quicken Financial Exchange (QFX) File": "Файл Quicken Financial Exchange (QFX)",
|
||||
"Quicken Interchange Format (QIF) File": "Файл Quicken Interchange Format (QIF)",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "Other Finance App File Format",
|
||||
"ezbookkeeping Data Export File": "Tệp xuất dữ liệu ezbookkeeping",
|
||||
"Excel Workbook File": "Excel Workbook File",
|
||||
"Excel Workbook File (.xlsx)": "Excel Workbook File (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 Workbook File (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "Tệp Open Financial Exchange (OFX)",
|
||||
"Quicken Financial Exchange (QFX) File": "Tệp Quicken Financial Exchange (QFX)",
|
||||
"Quicken Interchange Format (QIF) File": "Tệp Quicken Interchange Format (QIF)",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "其他金融应用文件格式",
|
||||
"ezbookkeeping Data Export File": "ezbookkeeping 数据导出文件",
|
||||
"Excel Workbook File": "Excel 工作簿文件",
|
||||
"Excel Workbook File (.xlsx)": "Excel 工作簿文件 (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 工作簿文件 (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "开放式金融交换 (OFX) 文件",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX) 文件",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) 文件",
|
||||
|
||||
@@ -1974,6 +1974,8 @@
|
||||
"Other Finance App File Format": "其他金融應用程式檔案格式",
|
||||
"ezbookkeeping Data Export File": "ezbookkeeping 資料匯出檔案",
|
||||
"Excel Workbook File": "Excel 工作簿檔案",
|
||||
"Excel Workbook File (.xlsx)": "Excel 工作簿檔案 (.xlsx)",
|
||||
"Excel 97-2003 Workbook File (.xls)": "Excel 97-2003 工作簿檔案 (.xls)",
|
||||
"Open Financial Exchange (OFX) File": "開放式金融交換 (OFX) 檔案",
|
||||
"Quicken Financial Exchange (QFX) File": "Quicken Financial Exchange (QFX) 檔案",
|
||||
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) 檔案",
|
||||
|
||||
@@ -1260,9 +1260,9 @@ export const useTransactionsStore = defineStore('transactions', () => {
|
||||
services.cancelRequest(cancelableUuid);
|
||||
}
|
||||
|
||||
function parseImportDsvFile({ fileType, fileEncoding, importFile }: { fileType: string, fileEncoding?: string, importFile: File }): Promise<string[][]> {
|
||||
function parseImportCustomFile({ fileType, fileEncoding, importFile }: { fileType: string, fileEncoding?: string, importFile: File }): Promise<string[][]> {
|
||||
return new Promise((resolve, reject) => {
|
||||
services.parseImportDsvFile({ fileType, fileEncoding, importFile }).then(response => {
|
||||
services.parseImportCustomFile({ fileType, fileEncoding, importFile }).then(response => {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
@@ -1476,7 +1476,7 @@ export const useTransactionsStore = defineStore('transactions', () => {
|
||||
deleteTransaction,
|
||||
recognizeReceiptImage,
|
||||
cancelRecognizeReceiptImage,
|
||||
parseImportDsvFile,
|
||||
parseImportCustomFile,
|
||||
parseImportTransaction,
|
||||
importTransactions,
|
||||
getImportTransactionsProcess,
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" md="12" v-if="fileType === 'dsv' || fileType === 'dsv_data'">
|
||||
<v-col cols="12" md="12" v-if="isCustomFileFormat">
|
||||
<v-select
|
||||
item-title="displayName"
|
||||
item-value="type"
|
||||
@@ -150,10 +150,10 @@
|
||||
:label="tt('Handling Method')"
|
||||
:placeholder="tt('Handling Method')"
|
||||
:items="[
|
||||
{ displayName: tt('Column Mapping'), type: ImportDSVProcessMethod.ColumnMapping },
|
||||
{ displayName: tt('Custom Script'), type: ImportDSVProcessMethod.CustomScript }
|
||||
{ displayName: tt('Column Mapping'), type: ImportCustomFileFormatProcessMethod.ColumnMapping },
|
||||
{ displayName: tt('Custom Script'), type: ImportCustomFileFormatProcessMethod.CustomScript }
|
||||
]"
|
||||
v-model="processDSVMethod"
|
||||
v-model="processCustomFileFormatMethod"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
@@ -210,8 +210,8 @@
|
||||
<v-col cols="12" md="12" v-if="exportFileGuideDocumentUrl">
|
||||
<a :href="exportFileGuideDocumentUrl" :class="{ 'disabled': submitting }" target="_blank">
|
||||
<v-icon :icon="mdiHelpCircleOutline" size="16" />
|
||||
<span class="ms-1" v-if="fileType === 'dsv' || fileType === 'dsv_data'">{{ tt('How to import this file?') }}</span>
|
||||
<span class="ms-1" v-if="fileType !== 'dsv' && fileType !== 'dsv_data'">{{ tt('How to export this file?') }}</span>
|
||||
<span class="ms-1" v-if="isCustomFileFormat">{{ tt('How to import this file?') }}</span>
|
||||
<span class="ms-1" v-if="!isCustomFileFormat">{{ tt('How to export this file?') }}</span>
|
||||
<span class="ms-1" v-if="exportFileGuideDocumentLanguageName">[{{ exportFileGuideDocumentLanguageName }}]</span>
|
||||
</a>
|
||||
</v-col>
|
||||
@@ -334,7 +334,7 @@ type ImportTransactionExecuteCustomScriptTabType = InstanceType<typeof ImportTra
|
||||
type ImportTransactionCheckDataTabType = InstanceType<typeof ImportTransactionCheckDataTab>;
|
||||
|
||||
type ImportTransactionDialogStep = 'uploadFile' | 'defineColumn' | 'executeCustomScript' | 'checkData' | 'finalResult';
|
||||
enum ImportDSVProcessMethod {
|
||||
enum ImportCustomFileFormatProcessMethod {
|
||||
ColumnMapping,
|
||||
CustomScript
|
||||
};
|
||||
@@ -400,7 +400,7 @@ const fileSubType = ref<string>('ezbookkeeping_csv');
|
||||
const fileEncoding = ref<string>('auto');
|
||||
const detectingFileEncoding = ref<boolean>(false);
|
||||
const autoDetectedFileEncoding = ref<string | undefined>(undefined);
|
||||
const processDSVMethod = ref<ImportDSVProcessMethod>(ImportDSVProcessMethod.ColumnMapping);
|
||||
const processCustomFileFormatMethod = ref<ImportCustomFileFormatProcessMethod>(ImportCustomFileFormatProcessMethod.ColumnMapping);
|
||||
const importFile = ref<File | null>(null);
|
||||
const importData = ref<string>('');
|
||||
const importAdditionalOptions = ref<ImportFileTypeSupportedAdditionalOptions>({});
|
||||
@@ -451,6 +451,7 @@ const allSupportedEncodings = computed<LocalizedImportFileTypeSupportedEncodings
|
||||
|
||||
return ret;
|
||||
});
|
||||
const isCustomFileFormat = computed<boolean>(() => fileType.value === 'dsv' || fileType.value === 'dsv_data' || fileType.value === 'excel');
|
||||
const isImportDataFromTextbox = computed<boolean>(() => allSupportedImportFileTypesMap.value[fileType.value]?.dataFromTextbox ?? false);
|
||||
const supportedAdditionalOptions = computed<ImportFileTypeSupportedAdditionalOptions | undefined>(() => allSupportedImportFileTypesMap.value[fileType.value]?.supportedAdditionalOptions);
|
||||
|
||||
@@ -463,8 +464,8 @@ const allSteps = computed<StepBarItem[]>(() => {
|
||||
}
|
||||
];
|
||||
|
||||
if (fileType.value === 'dsv' || fileType.value === 'dsv_data') {
|
||||
if (processDSVMethod.value === ImportDSVProcessMethod.CustomScript) {
|
||||
if (isCustomFileFormat.value) {
|
||||
if (processCustomFileFormatMethod.value === ImportCustomFileFormatProcessMethod.CustomScript) {
|
||||
steps.push({
|
||||
name: 'executeCustomScript',
|
||||
title: tt('Execute Custom Script'),
|
||||
@@ -608,7 +609,7 @@ function open(): Promise<void> {
|
||||
fileEncoding.value = 'auto';
|
||||
detectingFileEncoding.value = false;
|
||||
autoDetectedFileEncoding.value = undefined;
|
||||
processDSVMethod.value = ImportDSVProcessMethod.ColumnMapping;
|
||||
processCustomFileFormatMethod.value = ImportCustomFileFormatProcessMethod.ColumnMapping;
|
||||
currentStep.value = 'uploadFile';
|
||||
importProcess.value = 0;
|
||||
importFile.value = null;
|
||||
@@ -780,18 +781,16 @@ function parseData(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
const isDsvFileType: boolean = fileType.value === 'dsv' || fileType.value === 'dsv_data';
|
||||
|
||||
if (isDsvFileType && currentStep.value === 'uploadFile') {
|
||||
if (isCustomFileFormat.value && currentStep.value === 'uploadFile') {
|
||||
submitting.value = true;
|
||||
|
||||
transactionsStore.parseImportDsvFile({
|
||||
transactionsStore.parseImportCustomFile({
|
||||
fileType: type,
|
||||
fileEncoding: encoding,
|
||||
importFile: uploadFile
|
||||
}).then(response => {
|
||||
if (response && response.length) {
|
||||
if (processDSVMethod.value === ImportDSVProcessMethod.CustomScript) {
|
||||
if (processCustomFileFormatMethod.value === ImportCustomFileFormatProcessMethod.CustomScript) {
|
||||
importTransactionExecuteCustomScriptTab.value?.reset();
|
||||
parsedFileData.value = response;
|
||||
currentStep.value = 'executeCustomScript';
|
||||
@@ -825,7 +824,7 @@ function parseData(): void {
|
||||
let geoLocationOrder: string | undefined = undefined;
|
||||
let tagSeparator: string | undefined = undefined;
|
||||
|
||||
if (isDsvFileType && processDSVMethod.value === ImportDSVProcessMethod.ColumnMapping) {
|
||||
if (isCustomFileFormat.value && processCustomFileFormatMethod.value === ImportCustomFileFormatProcessMethod.ColumnMapping) {
|
||||
const defineColumnResult = importTransactionDefineColumnTab.value?.generateResult();
|
||||
|
||||
if (!defineColumnResult) {
|
||||
@@ -842,7 +841,7 @@ function parseData(): void {
|
||||
geoLocationSeparator = defineColumnResult.geoLocationSeparator;
|
||||
geoLocationOrder = defineColumnResult.geoLocationOrder;
|
||||
tagSeparator = defineColumnResult.tagSeparator;
|
||||
} else if (isDsvFileType && processDSVMethod.value === ImportDSVProcessMethod.CustomScript) {
|
||||
} else if (isCustomFileFormat.value && processCustomFileFormatMethod.value === ImportCustomFileFormatProcessMethod.CustomScript) {
|
||||
const executeCustomScriptResult = importTransactionExecuteCustomScriptTab.value?.generateResult();
|
||||
|
||||
if (!executeCustomScriptResult) {
|
||||
|
||||
Reference in New Issue
Block a user