mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 17:54:30 +08:00
code refactor
This commit is contained in:
@@ -36,6 +36,7 @@ import { useUserStore } from '@/stores/user.js';
|
|||||||
|
|
||||||
import transactionConstants from '@/consts/transaction.js';
|
import transactionConstants from '@/consts/transaction.js';
|
||||||
import { removeAll } from '@/lib/common.js';
|
import { removeAll } from '@/lib/common.js';
|
||||||
|
import logger from '@/lib/logger.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
@@ -75,7 +76,8 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (val >= transactionConstants.minAmountNumber && val <= transactionConstants.maxAmountNumber) || self.$t('Amount value exceeds limitation');
|
return (val >= transactionConstants.minAmountNumber && val <= transactionConstants.maxAmountNumber) || self.$t('Amount value exceeds limitation');
|
||||||
} catch (e) {
|
} catch (ex) {
|
||||||
|
logger.warn('cannot parse amount in amount input, original value is ' + v, ex);
|
||||||
return self.$t('Amount value is not number');
|
return self.$t('Amount value is not number');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,8 +251,8 @@ export default {
|
|||||||
this.currentValue = finalValue;
|
this.currentValue = finalValue;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (ex) {
|
||||||
e.target.value = '0';
|
ex.target.value = '0';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPaste(e) {
|
onPaste(e) {
|
||||||
|
|||||||
@@ -245,9 +245,9 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
exchangeRateAmount = getConvertedAmount(this.baseAmount / 100, fromExchangeRate, toExchangeRate);
|
exchangeRateAmount = getConvertedAmount(this.baseAmount / 100, fromExchangeRate, toExchangeRate);
|
||||||
} catch (e) {
|
} catch (ex) {
|
||||||
exchangeRateAmount = 0;
|
exchangeRateAmount = 0;
|
||||||
logger.warn('failed to convert amount by exchange rates, original base amount is ' + this.baseAmount)
|
logger.warn('failed to convert amount by exchange rates, original base amount is ' + this.baseAmount, ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.$locale.formatExchangeRateAmount(this.userStore, exchangeRateAmount);
|
return this.$locale.formatExchangeRateAmount(this.userStore, exchangeRateAmount);
|
||||||
|
|||||||
@@ -1448,7 +1448,7 @@ export default {
|
|||||||
amount2 = parseInt(filterItems[2]);
|
amount2 = parseInt(filterItems[2]);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
logger.warn('cannot parse amount from filter value, original value is ' + this.query.amountFilter);
|
logger.warn('cannot parse amount from filter value, original value is ' + this.query.amountFilter, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ export default {
|
|||||||
amount2 = parseInt(filterItems[2]);
|
amount2 = parseInt(filterItems[2]);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
logger.warn('cannot parse amount from filter value, original value is ' + query.value);
|
logger.warn('cannot parse amount from filter value, original value is ' + query.value, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user