mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 17:54:30 +08:00
modify style
This commit is contained in:
@@ -10,6 +10,32 @@ export function getOuterHeight(element) {
|
|||||||
.reduce((prev, cur) => prev + cur);
|
.reduce((prev, cur) => prev + cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getNavSideBarOuterHeight(element) {
|
||||||
|
if (!element) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const contentEl = element.querySelectorAll('.v-navigation-drawer__content');
|
||||||
|
|
||||||
|
if (!contentEl || !contentEl[0]) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const children = contentEl[0].children;
|
||||||
|
|
||||||
|
if (!children || children.length < 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
let totalHeight = 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < children.length; i++) {
|
||||||
|
totalHeight += getOuterHeight(children[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalHeight;
|
||||||
|
}
|
||||||
|
|
||||||
export function getCssValue(element, name) {
|
export function getCssValue(element, name) {
|
||||||
if (!element) {
|
if (!element) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
{ name: $t('Expense'), value: allCategoryTypes.Expense },
|
{ name: $t('Expense'), value: allCategoryTypes.Expense },
|
||||||
{ name: $t('Income'), value: allCategoryTypes.Income },
|
{ name: $t('Income'), value: allCategoryTypes.Income },
|
||||||
{ name: $t('Transfer'), value: allCategoryTypes.Transfer }
|
{ name: $t('Transfer'), value: allCategoryTypes.Transfer }
|
||||||
]" v-model="activeCategoryType" @update:modelValue="switchActiveCategoryType" />
|
]" v-model="activeCategoryType" @update:modelValue="switchAllPrimaryCategories" />
|
||||||
</div>
|
</div>
|
||||||
<v-divider />
|
<v-divider />
|
||||||
<v-tabs show-arrows class="my-4" direction="vertical"
|
<v-tabs show-arrows class="my-4" direction="vertical"
|
||||||
:disabled="loading" v-model="primaryCategoryId">
|
:disabled="loading" v-model="primaryCategoryId">
|
||||||
<v-tab class="tab-text-truncate" value="0" @click="primaryCategoryId = '0'">
|
<v-tab class="tab-text-truncate" value="0" @click="switchAllPrimaryCategories">
|
||||||
<span class="text-truncate">{{ $t('Primary Categories') }}</span>
|
<span class="text-truncate">{{ $t('Primary Categories') }}</span>
|
||||||
</v-tab>
|
</v-tab>
|
||||||
<template :key="category.id" v-for="category in primaryCategories">
|
<template :key="category.id" v-for="category in primaryCategories">
|
||||||
@@ -191,7 +191,7 @@ import { mapStores } from 'pinia';
|
|||||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||||
|
|
||||||
import categoryConstants from '@/consts/category.js';
|
import categoryConstants from '@/consts/category.js';
|
||||||
import { getOuterHeight } from '@/lib/ui.desktop.js';
|
import { getNavSideBarOuterHeight } from '@/lib/ui.desktop.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
mdiRefresh,
|
mdiRefresh,
|
||||||
@@ -391,6 +391,8 @@ export default {
|
|||||||
if (result && result.message) {
|
if (result && result.message) {
|
||||||
self.$refs.snackbar.showMessage(result.message);
|
self.$refs.snackbar.showMessage(result.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.updateCardMinHeight();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
if (error) {
|
if (error) {
|
||||||
self.$refs.snackbar.showError(error);
|
self.$refs.snackbar.showError(error);
|
||||||
@@ -407,6 +409,8 @@ export default {
|
|||||||
if (result && result.message) {
|
if (result && result.message) {
|
||||||
self.$refs.snackbar.showMessage(result.message);
|
self.$refs.snackbar.showMessage(result.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.updateCardMinHeight();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
if (error) {
|
if (error) {
|
||||||
self.$refs.snackbar.showError(error);
|
self.$refs.snackbar.showError(error);
|
||||||
@@ -425,6 +429,8 @@ export default {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
self.updating = false;
|
self.updating = false;
|
||||||
self.categoryHiding[category.id] = false;
|
self.categoryHiding[category.id] = false;
|
||||||
|
|
||||||
|
self.updateCardMinHeight();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
self.updating = false;
|
self.updating = false;
|
||||||
self.categoryHiding[category.id] = false;
|
self.categoryHiding[category.id] = false;
|
||||||
@@ -446,6 +452,8 @@ export default {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
self.updating = false;
|
self.updating = false;
|
||||||
self.categoryRemoving[category.id] = false;
|
self.categoryRemoving[category.id] = false;
|
||||||
|
|
||||||
|
self.updateCardMinHeight();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
self.updating = false;
|
self.updating = false;
|
||||||
self.categoryRemoving[category.id] = false;
|
self.categoryRemoving[category.id] = false;
|
||||||
@@ -462,10 +470,6 @@ export default {
|
|||||||
this.reload(false);
|
this.reload(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
switchActiveCategoryType() {
|
|
||||||
this.primaryCategoryId = '0';
|
|
||||||
this.updateCardMinHeight();
|
|
||||||
},
|
|
||||||
isCategorySupportSwitch(category) {
|
isCategorySupportSwitch(category) {
|
||||||
if (!category || category.hidden) {
|
if (!category || category.hidden) {
|
||||||
return false;
|
return false;
|
||||||
@@ -473,6 +477,10 @@ export default {
|
|||||||
|
|
||||||
return !category.parentId || category.parentId === '' || category.parentId === '0';
|
return !category.parentId || category.parentId === '' || category.parentId === '0';
|
||||||
},
|
},
|
||||||
|
switchAllPrimaryCategories() {
|
||||||
|
this.primaryCategoryId = '0';
|
||||||
|
this.updateCardMinHeight();
|
||||||
|
},
|
||||||
switchPrimaryCategory(category) {
|
switchPrimaryCategory(category) {
|
||||||
if (!category || category.hidden) {
|
if (!category || category.hidden) {
|
||||||
return;
|
return;
|
||||||
@@ -481,17 +489,16 @@ export default {
|
|||||||
if (!category.parentId || category.parentId === '' || category.parentId === '0') {
|
if (!category.parentId || category.parentId === '' || category.parentId === '0') {
|
||||||
this.primaryCategoryId = category.id;
|
this.primaryCategoryId = category.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateCardMinHeight();
|
||||||
},
|
},
|
||||||
updateCardMinHeight() {
|
updateCardMinHeight() {
|
||||||
const self = this
|
const self = this
|
||||||
|
|
||||||
self.$nextTick(() => {
|
self.$nextTick(() => {
|
||||||
if (self.$refs.navbar && self.$refs.navbar.$el && self.$refs.navbar.$el.nextElementSibling) {
|
if (self.$refs.navbar && self.$refs.navbar.$el && self.$refs.navbar.$el.nextElementSibling) {
|
||||||
let navbarHeight = getOuterHeight(self.$refs.navbar.$el.nextElementSibling);
|
let navbarHeight = getNavSideBarOuterHeight(self.$refs.navbar.$el.nextElementSibling);
|
||||||
|
self.cardMinHeight = Math.max(navbarHeight, 680);
|
||||||
if (navbarHeight > self.cardMinHeight) {
|
|
||||||
self.cardMinHeight = navbarHeight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user