mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
add subtypes to imported file types
This commit is contained in:
+17
-13
@@ -29,19 +29,23 @@ const supportedImportFileTypes = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'qif_ymd',
|
type: 'qif',
|
||||||
name: 'Quicken Interchange Format (QIF) File (Year-month-day format)',
|
name: 'Quicken Interchange Format (QIF) File',
|
||||||
extensions: '.qif'
|
extensions: '.qif',
|
||||||
},
|
subTypes: [
|
||||||
{
|
{
|
||||||
type: 'qif_mdy',
|
type: 'qif_ymd',
|
||||||
name: 'Quicken Interchange Format (QIF) File (Month-day-year format)',
|
name: 'Year-month-day format',
|
||||||
extensions: '.qif'
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'qif_mdy',
|
||||||
type: 'qif_dmy',
|
name: 'Month-day-year format',
|
||||||
name: 'Quicken Interchange Format (QIF) File (Day-month-year format)',
|
},
|
||||||
extensions: '.qif'
|
{
|
||||||
|
type: 'qif_dmy',
|
||||||
|
name: 'Day-month-year format',
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'feidee_mymoney_csv',
|
type: 'feidee_mymoney_csv',
|
||||||
|
|||||||
@@ -1299,10 +1299,24 @@ function getAllSupportedImportFileTypes(i18nGlobal, translateFn) {
|
|||||||
document = null;
|
document = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const subTypes = [];
|
||||||
|
|
||||||
|
if (fileType.subTypes) {
|
||||||
|
for (let i = 0; i < fileType.subTypes.length; i++) {
|
||||||
|
const subType = fileType.subTypes[i];
|
||||||
|
|
||||||
|
subTypes.push({
|
||||||
|
type: subType.type,
|
||||||
|
displayName: translateFn(subType.name),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
allSupportedImportFileTypes.push({
|
allSupportedImportFileTypes.push({
|
||||||
type: fileType.type,
|
type: fileType.type,
|
||||||
displayName: translateFn(fileType.name),
|
displayName: translateFn(fileType.name),
|
||||||
extensions: fileType.extensions,
|
extensions: fileType.extensions,
|
||||||
|
subTypes: subTypes.length ? subTypes : undefined,
|
||||||
document: document
|
document: document
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -1518,9 +1518,10 @@
|
|||||||
"How to export this file?": "How to export this file?",
|
"How to export this file?": "How to export this file?",
|
||||||
"ezbookkeeping Data Export File (CSV)": "ezbookkeeping Data Export File (CSV)",
|
"ezbookkeeping Data Export File (CSV)": "ezbookkeeping Data Export File (CSV)",
|
||||||
"ezbookkeeping Data Export File (TSV)": "ezbookkeeping Data Export File (TSV)",
|
"ezbookkeeping Data Export File (TSV)": "ezbookkeeping Data Export File (TSV)",
|
||||||
"Quicken Interchange Format (QIF) File (Year-month-day format)": "Quicken Interchange Format (QIF) File (Year-month-day format)",
|
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) File",
|
||||||
"Quicken Interchange Format (QIF) File (Month-day-year format)": "Quicken Interchange Format (QIF) File (Month-day-year format)",
|
"Year-month-day format": "Year-month-day format",
|
||||||
"Quicken Interchange Format (QIF) File (Day-month-year format)": "Quicken Interchange Format (QIF) File (Day-month-year format)",
|
"Month-day-year format": "Month-day-year format",
|
||||||
|
"Day-month-year format": "Day-month-year format",
|
||||||
"Firefly III Data Export File": "Firefly III Data Export File",
|
"Firefly III Data Export File": "Firefly III Data Export File",
|
||||||
"Feidee MyMoney (App) Data Export File": "Feidee MyMoney (App) Data Export File",
|
"Feidee MyMoney (App) Data Export File": "Feidee MyMoney (App) Data Export File",
|
||||||
"Feidee MyMoney (Web) Data Export File": "Feidee MyMoney (Web) Data Export File",
|
"Feidee MyMoney (Web) Data Export File": "Feidee MyMoney (Web) Data Export File",
|
||||||
|
|||||||
@@ -1518,9 +1518,10 @@
|
|||||||
"How to export this file?": "如何导出该文件?",
|
"How to export this file?": "如何导出该文件?",
|
||||||
"ezbookkeeping Data Export File (CSV)": "ezbookkeeping 数据导出文件 (CSV)",
|
"ezbookkeeping Data Export File (CSV)": "ezbookkeeping 数据导出文件 (CSV)",
|
||||||
"ezbookkeeping Data Export File (TSV)": "ezbookkeeping 数据导出文件 (TSV)",
|
"ezbookkeeping Data Export File (TSV)": "ezbookkeeping 数据导出文件 (TSV)",
|
||||||
"Quicken Interchange Format (QIF) File (Year-month-day format)": "Quicken Interchange Format (QIF) 文件 (年-月-日 格式)",
|
"Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) 文件",
|
||||||
"Quicken Interchange Format (QIF) File (Month-day-year format)": "Quicken Interchange Format (QIF) 文件 (月-日-年 格式)",
|
"Year-month-day format": "年-月-日 格式",
|
||||||
"Quicken Interchange Format (QIF) File (Day-month-year format)": "Quicken Interchange Format (QIF) 文件 (日-月-年 格式)",
|
"Month-day-year format": "月-日-年 格式",
|
||||||
|
"Day-month-year format": "日-月-年 格式",
|
||||||
"Firefly III Data Export File": "Firefly III 数据导出文件",
|
"Firefly III Data Export File": "Firefly III 数据导出文件",
|
||||||
"Feidee MyMoney (App) Data Export File": "金蝶随手记 (App) 数据导出文件",
|
"Feidee MyMoney (App) Data Export File": "金蝶随手记 (App) 数据导出文件",
|
||||||
"Feidee MyMoney (Web) Data Export File": "金蝶随手记 (Web版) 数据导出文件",
|
"Feidee MyMoney (Web) Data Export File": "金蝶随手记 (Web版) 数据导出文件",
|
||||||
|
|||||||
@@ -78,6 +78,18 @@
|
|||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
|
<v-col cols="12" md="12" v-if="allFileSubTypes">
|
||||||
|
<v-select
|
||||||
|
item-title="displayName"
|
||||||
|
item-value="type"
|
||||||
|
:disabled="submitting"
|
||||||
|
:label="$t('Type')"
|
||||||
|
:placeholder="$t('Type')"
|
||||||
|
:items="allFileSubTypes"
|
||||||
|
v-model="fileSubType"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
<v-col cols="12" md="12">
|
<v-col cols="12" md="12">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
readonly
|
readonly
|
||||||
@@ -523,6 +535,7 @@ export default {
|
|||||||
clientSessionId: '',
|
clientSessionId: '',
|
||||||
currentStep: 'uploadFile',
|
currentStep: 'uploadFile',
|
||||||
fileType: 'ezbookkeeping_csv',
|
fileType: 'ezbookkeeping_csv',
|
||||||
|
fileSubType: '',
|
||||||
importFile: null,
|
importFile: null,
|
||||||
importTransactions: null,
|
importTransactions: null,
|
||||||
editingTransaction: null,
|
editingTransaction: null,
|
||||||
@@ -579,6 +592,9 @@ export default {
|
|||||||
allSupportedImportFileTypes() {
|
allSupportedImportFileTypes() {
|
||||||
return this.$locale.getAllSupportedImportFileTypes();
|
return this.$locale.getAllSupportedImportFileTypes();
|
||||||
},
|
},
|
||||||
|
allFileSubTypes() {
|
||||||
|
return getNameByKeyValue(this.allSupportedImportFileTypes, this.fileType, 'type', 'subTypes');
|
||||||
|
},
|
||||||
allTransactionTypes() {
|
allTransactionTypes() {
|
||||||
return transactionConstants.allTransactionTypes;
|
return transactionConstants.allTransactionTypes;
|
||||||
},
|
},
|
||||||
@@ -826,6 +842,10 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
fileType: function () {
|
fileType: function () {
|
||||||
|
if (this.allFileSubTypes && this.allFileSubTypes.length) {
|
||||||
|
this.fileSubType = this.allFileSubTypes[0].type;
|
||||||
|
}
|
||||||
|
|
||||||
this.importFile = null;
|
this.importFile = null;
|
||||||
this.importTransactions = null;
|
this.importTransactions = null;
|
||||||
this.editingTransaction = null;
|
this.editingTransaction = null;
|
||||||
@@ -893,8 +913,14 @@ export default {
|
|||||||
const self = this;
|
const self = this;
|
||||||
self.submitting = true;
|
self.submitting = true;
|
||||||
|
|
||||||
|
let fileType = self.fileType;
|
||||||
|
|
||||||
|
if (self.allFileSubTypes) {
|
||||||
|
fileType = self.fileSubType;
|
||||||
|
}
|
||||||
|
|
||||||
self.transactionsStore.parseImportTransaction({
|
self.transactionsStore.parseImportTransaction({
|
||||||
fileType: self.fileType,
|
fileType: fileType,
|
||||||
importFile: self.importFile
|
importFile: self.importFile
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
const parsedTransactions = response.items;
|
const parsedTransactions = response.items;
|
||||||
|
|||||||
Reference in New Issue
Block a user