优化交易分类选择逻辑,调整条件判断并移除高亮样式
This commit is contained in:
@@ -256,7 +256,7 @@ const onSubmit = async () => {
|
|||||||
const selectClassify = (classify) => {
|
const selectClassify = (classify) => {
|
||||||
editForm.classify = classify
|
editForm.classify = classify
|
||||||
|
|
||||||
if(editForm.id > 0 && editForm.type > 0) {
|
if(editForm.id > 0 && editForm.type >= 0) {
|
||||||
// 直接保存
|
// 直接保存
|
||||||
onSubmit()
|
onSubmit()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,6 @@
|
|||||||
v-for="(category) in expenseCategoriesView"
|
v-for="(category) in expenseCategoriesView"
|
||||||
:key="category.classify"
|
:key="category.classify"
|
||||||
class="category-item clickable"
|
class="category-item clickable"
|
||||||
:class="{ 'highlighted': category._highlighted }"
|
|
||||||
@click="goToCategoryBills(category.classify, 0)"
|
@click="goToCategoryBills(category.classify, 0)"
|
||||||
>
|
>
|
||||||
<div class="category-info">
|
<div class="category-info">
|
||||||
@@ -137,7 +136,6 @@
|
|||||||
v-for="category in incomeCategoriesView"
|
v-for="category in incomeCategoriesView"
|
||||||
:key="category.classify"
|
:key="category.classify"
|
||||||
class="category-item clickable"
|
class="category-item clickable"
|
||||||
:class="{ 'highlighted': category._highlighted }"
|
|
||||||
@click="goToCategoryBills(category.classify, 1)"
|
@click="goToCategoryBills(category.classify, 1)"
|
||||||
>
|
>
|
||||||
<div class="category-info">
|
<div class="category-info">
|
||||||
@@ -168,7 +166,6 @@
|
|||||||
v-for="category in noneCategoriesView"
|
v-for="category in noneCategoriesView"
|
||||||
:key="category.classify"
|
:key="category.classify"
|
||||||
class="category-item clickable"
|
class="category-item clickable"
|
||||||
:class="{ 'highlighted': category._highlighted }"
|
|
||||||
@click="goToCategoryBills(category.classify, 2)"
|
@click="goToCategoryBills(category.classify, 2)"
|
||||||
>
|
>
|
||||||
<div class="category-info">
|
<div class="category-info">
|
||||||
@@ -377,7 +374,6 @@ const expenseCategoriesView = computed(() => {
|
|||||||
const unclassifiedIndex = sorted.findIndex(c => !c.classify)
|
const unclassifiedIndex = sorted.findIndex(c => !c.classify)
|
||||||
if (unclassifiedIndex !== -1) {
|
if (unclassifiedIndex !== -1) {
|
||||||
const [unclassified] = sorted.splice(unclassifiedIndex, 1)
|
const [unclassified] = sorted.splice(unclassifiedIndex, 1)
|
||||||
unclassified._highlighted = true
|
|
||||||
sorted.unshift(unclassified)
|
sorted.unshift(unclassified)
|
||||||
}
|
}
|
||||||
return sorted
|
return sorted
|
||||||
@@ -388,7 +384,6 @@ const incomeCategoriesView = computed(() => {
|
|||||||
const unclassifiedIndex = sorted.findIndex(c => !c.classify)
|
const unclassifiedIndex = sorted.findIndex(c => !c.classify)
|
||||||
if (unclassifiedIndex !== -1) {
|
if (unclassifiedIndex !== -1) {
|
||||||
const [unclassified] = sorted.splice(unclassifiedIndex, 1)
|
const [unclassified] = sorted.splice(unclassifiedIndex, 1)
|
||||||
unclassified._highlighted = true
|
|
||||||
sorted.unshift(unclassified)
|
sorted.unshift(unclassified)
|
||||||
}
|
}
|
||||||
return sorted
|
return sorted
|
||||||
@@ -399,7 +394,6 @@ const noneCategoriesView = computed(() => {
|
|||||||
const unclassifiedIndex = sorted.findIndex(c => !c.classify)
|
const unclassifiedIndex = sorted.findIndex(c => !c.classify)
|
||||||
if (unclassifiedIndex !== -1) {
|
if (unclassifiedIndex !== -1) {
|
||||||
const [unclassified] = sorted.splice(unclassifiedIndex, 1)
|
const [unclassified] = sorted.splice(unclassifiedIndex, 1)
|
||||||
unclassified._highlighted = true
|
|
||||||
sorted.unshift(unclassified)
|
sorted.unshift(unclassified)
|
||||||
}
|
}
|
||||||
return sorted
|
return sorted
|
||||||
@@ -1102,13 +1096,6 @@ onBeforeUnmount(() => {
|
|||||||
background-color: #ff6b6b;
|
background-color: #ff6b6b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-item.highlighted {
|
|
||||||
background-color: var(--van-primary-color);
|
|
||||||
opacity: 0.1;
|
|
||||||
border-left: 3px solid var(--van-primary-color);
|
|
||||||
padding-left: 9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 趋势图 */
|
/* 趋势图 */
|
||||||
.trend-chart {
|
.trend-chart {
|
||||||
padding: 20px 16px;
|
padding: 20px 16px;
|
||||||
|
|||||||
Reference in New Issue
Block a user