mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 08:44:25 +08:00
support choosing invalid items in import transaction dialog
This commit is contained in:
@@ -1278,6 +1278,8 @@
|
|||||||
"Select All in This Page": "Select All in This Page",
|
"Select All in This Page": "Select All in This Page",
|
||||||
"Select None in This Page": "Select None in This Page",
|
"Select None in This Page": "Select None in This Page",
|
||||||
"Invert Selection in This Page": "Invert Selection in This Page",
|
"Invert Selection in This Page": "Invert Selection in This Page",
|
||||||
|
"Select All Valid Items": "Select All Valid Items",
|
||||||
|
"Select All Invalid Items": "Select All Invalid Items",
|
||||||
"Back": "Back",
|
"Back": "Back",
|
||||||
"Load More": "Load More",
|
"Load More": "Load More",
|
||||||
"No data": "No data",
|
"No data": "No data",
|
||||||
@@ -1504,6 +1506,7 @@
|
|||||||
"Alipay Data Export File": "Alipay Data Export File",
|
"Alipay Data Export File": "Alipay Data Export File",
|
||||||
"Data File": "Data File",
|
"Data File": "Data File",
|
||||||
"No data to import": "No data to import",
|
"No data to import": "No data to import",
|
||||||
|
"Cannot import invalid transactions": "Cannot import invalid transactions",
|
||||||
"Unable to parse import file": "Unable to parse import file",
|
"Unable to parse import file": "Unable to parse import file",
|
||||||
"Tags": "Tags",
|
"Tags": "Tags",
|
||||||
"Your transaction description (optional)": "Your transaction description (optional)",
|
"Your transaction description (optional)": "Your transaction description (optional)",
|
||||||
|
|||||||
@@ -1278,6 +1278,8 @@
|
|||||||
"Select All in This Page": "本页全选",
|
"Select All in This Page": "本页全选",
|
||||||
"Select None in This Page": "本页不选",
|
"Select None in This Page": "本页不选",
|
||||||
"Invert Selection in This Page": "本页反选",
|
"Invert Selection in This Page": "本页反选",
|
||||||
|
"Select All Valid Items": "选择全部有效项目",
|
||||||
|
"Select All Invalid Items": "选择全部无效项目",
|
||||||
"Back": "返回",
|
"Back": "返回",
|
||||||
"Load More": "加载更多",
|
"Load More": "加载更多",
|
||||||
"No data": "没有数据",
|
"No data": "没有数据",
|
||||||
@@ -1504,6 +1506,7 @@
|
|||||||
"Alipay Data Export File": "支付宝数据导出文件",
|
"Alipay Data Export File": "支付宝数据导出文件",
|
||||||
"Data File": "数据文件",
|
"Data File": "数据文件",
|
||||||
"No data to import": "没有可以导入的数据",
|
"No data to import": "没有可以导入的数据",
|
||||||
|
"Cannot import invalid transactions": "不能导入无效的交易",
|
||||||
"Unable to parse import file": "无法解析导入的文件",
|
"Unable to parse import file": "无法解析导入的文件",
|
||||||
"Tags": "标签",
|
"Tags": "标签",
|
||||||
"Your transaction description (optional)": "你的交易描述 (可选)",
|
"Your transaction description (optional)": "你的交易描述 (可选)",
|
||||||
|
|||||||
@@ -68,6 +68,15 @@
|
|||||||
>
|
>
|
||||||
<v-menu activator="parent" location="bottom">
|
<v-menu activator="parent" location="bottom">
|
||||||
<v-list>
|
<v-list>
|
||||||
|
<v-list-item :prepend-icon="icons.selectAll"
|
||||||
|
:title="$t('Select All Valid Items')"
|
||||||
|
:disabled="loading || submitting"
|
||||||
|
@click="selectAllValid"></v-list-item>
|
||||||
|
<v-list-item :prepend-icon="icons.selectAll"
|
||||||
|
:title="$t('Select All Invalid Items')"
|
||||||
|
:disabled="loading || submitting"
|
||||||
|
@click="selectAllInvalid"></v-list-item>
|
||||||
|
<v-divider class="my-2"/>
|
||||||
<v-list-item :prepend-icon="icons.selectAll"
|
<v-list-item :prepend-icon="icons.selectAll"
|
||||||
:title="$t('Select All')"
|
:title="$t('Select All')"
|
||||||
:disabled="loading || submitting"
|
:disabled="loading || submitting"
|
||||||
@@ -99,7 +108,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #item.data-table-select="{ item }">
|
<template #item.data-table-select="{ item }">
|
||||||
<v-checkbox density="compact"
|
<v-checkbox density="compact"
|
||||||
:disabled="loading || submitting || !item.valid"
|
:disabled="loading || submitting"
|
||||||
v-model="item.selected"></v-checkbox>
|
v-model="item.selected"></v-checkbox>
|
||||||
</template>
|
</template>
|
||||||
<template #item.valid="{ item }">
|
<template #item.valid="{ item }">
|
||||||
@@ -308,7 +317,9 @@
|
|||||||
<template #bottom>
|
<template #bottom>
|
||||||
<div class="title-and-toolbar d-flex align-center text-no-wrap mt-2"
|
<div class="title-and-toolbar d-flex align-center text-no-wrap mt-2"
|
||||||
v-if="importTransactions && importTransactions.length > 10">
|
v-if="importTransactions && importTransactions.length > 10">
|
||||||
<span>{{ $t('format.misc.selectedCount', { count: selectedImportTransactionCount, totalCount: importTransactions.length }) }}</span>
|
<span :class="{ 'text-error': selectedInvalidTransactionCount > 0 }">
|
||||||
|
{{ $t('format.misc.selectedCount', { count: selectedImportTransactionCount, totalCount: importTransactions.length }) }}
|
||||||
|
</span>
|
||||||
<v-spacer/>
|
<v-spacer/>
|
||||||
<span>{{ $t('Transactions Per Page') }}</span>
|
<span>{{ $t('Transactions Per Page') }}</span>
|
||||||
<v-select class="ml-2" density="compact" max-width="100"
|
<v-select class="ml-2" density="compact" max-width="100"
|
||||||
@@ -378,7 +389,7 @@
|
|||||||
{{ $t('Next') }}
|
{{ $t('Next') }}
|
||||||
<v-progress-circular indeterminate size="22" class="ml-2" v-if="submitting"></v-progress-circular>
|
<v-progress-circular indeterminate size="22" class="ml-2" v-if="submitting"></v-progress-circular>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn color="teal" :disabled="submitting || selectedImportTransactionCount < 1"
|
<v-btn color="teal" :disabled="submitting || selectedImportTransactionCount < 1 || selectedInvalidTransactionCount > 0"
|
||||||
:append-icon="!submitting ? icons.next : null" @click="submit"
|
:append-icon="!submitting ? icons.next : null" @click="submit"
|
||||||
v-if="currentStep === 'checkData'">
|
v-if="currentStep === 'checkData'">
|
||||||
{{ $t('Import') }}
|
{{ $t('Import') }}
|
||||||
@@ -659,6 +670,17 @@ export default {
|
|||||||
|
|
||||||
return count;
|
return count;
|
||||||
},
|
},
|
||||||
|
selectedInvalidTransactionCount() {
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < this.importTransactions.length; i++) {
|
||||||
|
if (!this.importTransactions[i].valid && this.importTransactions[i].selected) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
},
|
||||||
anyButNotAllTransactionSelected: {
|
anyButNotAllTransactionSelected: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.selectedImportTransactionCount > 0 && this.selectedImportTransactionCount !== this.importTransactions.length;
|
return this.selectedImportTransactionCount > 0 && this.selectedImportTransactionCount !== this.importTransactions.length;
|
||||||
@@ -781,6 +803,9 @@ export default {
|
|||||||
|
|
||||||
if (transaction.valid && transaction.selected) {
|
if (transaction.valid && transaction.selected) {
|
||||||
transactions.push(transaction);
|
transactions.push(transaction);
|
||||||
|
} else if (!transaction.valid && transaction.selected) {
|
||||||
|
self.$refs.snackbar.showError('Cannot import invalid transactions');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,13 +855,25 @@ export default {
|
|||||||
|
|
||||||
this.showState = false;
|
this.showState = false;
|
||||||
},
|
},
|
||||||
selectAll() {
|
selectAllValid() {
|
||||||
for (let i = 0; i < this.importTransactions.length; i++) {
|
for (let i = 0; i < this.importTransactions.length; i++) {
|
||||||
if (this.importTransactions[i].valid) {
|
if (this.importTransactions[i].valid) {
|
||||||
this.importTransactions[i].selected = true;
|
this.importTransactions[i].selected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
selectAllInvalid() {
|
||||||
|
for (let i = 0; i < this.importTransactions.length; i++) {
|
||||||
|
if (!this.importTransactions[i].valid) {
|
||||||
|
this.importTransactions[i].selected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectAll() {
|
||||||
|
for (let i = 0; i < this.importTransactions.length; i++) {
|
||||||
|
this.importTransactions[i].selected = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
selectNone() {
|
selectNone() {
|
||||||
for (let i = 0; i < this.importTransactions.length; i++) {
|
for (let i = 0; i < this.importTransactions.length; i++) {
|
||||||
this.importTransactions[i].selected = false;
|
this.importTransactions[i].selected = false;
|
||||||
@@ -844,9 +881,7 @@ export default {
|
|||||||
},
|
},
|
||||||
selectInvert() {
|
selectInvert() {
|
||||||
for (let i = 0; i < this.importTransactions.length; i++) {
|
for (let i = 0; i < this.importTransactions.length; i++) {
|
||||||
if (this.importTransactions[i].valid || this.importTransactions[i].selected) {
|
this.importTransactions[i].selected = !this.importTransactions[i].selected;
|
||||||
this.importTransactions[i].selected = !this.importTransactions[i].selected;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectAllInThisPage() {
|
selectAllInThisPage() {
|
||||||
|
|||||||
Reference in New Issue
Block a user