diff --git a/src/enums/dateEnums.ts b/src/enums/dateEnums.ts
index f6621a0..828a9b8 100644
--- a/src/enums/dateEnums.ts
+++ b/src/enums/dateEnums.ts
@@ -1,6 +1,10 @@
import dayjs from 'dayjs';
-export const currentWeek = [dayjs().startOf('week').add(1, 'day'), dayjs().endOf('week').add(1, 'day')];
-export const currentMouth = [dayjs().startOf('month'), dayjs().endOf('month').add(1, 'day')];
+export const currentWeek = () => {
+ const dayjs1 = [dayjs().day(1), dayjs().day(7)];
+ const dayjs2 = [dayjs().day(-6), dayjs().day(0)];
+ return dayjs().day() != 0 ? dayjs1 : dayjs2;
+};
+export const currentMouth = [dayjs().startOf('month'), dayjs().endOf('month')];
export const currentYear = [dayjs().startOf('year'), dayjs().endOf('year')];
export const days = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
diff --git a/src/store/financial/bill.ts b/src/store/financial/bill.ts
index 8995ceb..90785fb 100644
--- a/src/store/financial/bill.ts
+++ b/src/store/financial/bill.ts
@@ -17,6 +17,8 @@ export const useBillStore = defineStore('billStore', {
userId: undefined,
// 类型:1 - 收入,-1 - 支出
type: undefined,
+ // 金额
+ amount: undefined,
// 描述
description: undefined,
// 交易日志
diff --git a/src/store/financialUser/billUser.ts b/src/store/financialUser/billUser.ts
index 94135ad..6100c18 100644
--- a/src/store/financialUser/billUser.ts
+++ b/src/store/financialUser/billUser.ts
@@ -3,7 +3,7 @@ import { fetchAddUserBill, fetchDeleteUserBill, fetchGetUserBillList, fetchUpdat
import { pageSizes } from '@/enums/baseConstant';
import { storeMessage } from '@/utils/message';
import { storePagination } from '@/store/useStorePagination';
-import { getDefaultDateRange } from '@/utils/date';
+import { getCurrentMouthDate } from '@/utils/date';
/**
* 账单信息 Store
@@ -19,6 +19,8 @@ export const useBillUserStore = defineStore('billUserStore', {
form: {
// 类型:1 - 收入,-1 - 支出
type: undefined,
+ // 金额
+ amount: undefined,
// 描述
description: undefined,
// 开始交易日期
@@ -26,7 +28,7 @@ export const useBillUserStore = defineStore('billUserStore', {
// 结束交易日期
endDate: undefined,
// 交易日期
- date: getDefaultDateRange(),
+ date: getCurrentMouthDate(),
},
// 分页查询结果
pagination: {
diff --git a/src/store/financialUser/budgetCategoryUser.ts b/src/store/financialUser/budgetCategoryUser.ts
index dc5dd01..b188f54 100644
--- a/src/store/financialUser/budgetCategoryUser.ts
+++ b/src/store/financialUser/budgetCategoryUser.ts
@@ -8,7 +8,7 @@ import {
fetchGetUserBudgetCategoryList,
fetchUpdateUserBudgetCategory,
} from '@/api/v1/financial/user/budgetCategoryUser';
-import { getDefaultDateRange } from '@/utils/date';
+import { getCurrentMouthDate } from '@/utils/date';
/**
* 预算分类表 Store
@@ -31,7 +31,7 @@ export const userBudgetCategoryUserStore = defineStore('budgetCategoryUserStore'
// 预算金额
amount: undefined,
// 预算周期
- period: getDefaultDateRange(2, 30),
+ period: getCurrentMouthDate(),
// 开始预算时间
startPeriod: undefined,
// 结束预算时间
diff --git a/src/store/financialUser/savingGoalUser.ts b/src/store/financialUser/savingGoalUser.ts
index f231777..639a868 100644
--- a/src/store/financialUser/savingGoalUser.ts
+++ b/src/store/financialUser/savingGoalUser.ts
@@ -8,7 +8,7 @@ import {
fetchGetUserSavingGoalList,
fetchUpdateUserSavingGoal,
} from '@/api/v1/financial/user/savingGoalUser';
-import { getDefaultDateRange } from '@/utils/date';
+import { getCurrentMouthDate } from '@/utils/date';
/**
* 用户储值 Store
@@ -24,7 +24,7 @@ export const useSavingGoalUserStore = defineStore('savingGoalUserStore', {
statusType: undefined, // 完成状态
savingGoalName: undefined, // 储值目标名称
amount: undefined, // 目标金额
- duration: getDefaultDateRange(2, 30), // 目标时长
+ duration: getCurrentMouthDate(), // 目标时长
startDuration: undefined, // 开始目标时长
endDuration: undefined, // 结束目标时长
},
diff --git a/src/utils/date.ts b/src/utils/date.ts
index 4417828..000726c 100644
--- a/src/utils/date.ts
+++ b/src/utils/date.ts
@@ -1,4 +1,5 @@
import dayjs from 'dayjs';
+import { currentMouth } from '@/enums/dateEnums';
/** 设置默认时间 */
export const getDefaultDateRange = (start = 1, end = 7) => {
@@ -15,6 +16,14 @@ export const getDefaultDateRange = (start = 1, end = 7) => {
return [dayjs(startDate).format('YYYY-MM-DD'), dayjs(endDate).format('YYYY-MM-DD')];
};
+/** 获取当前月的日期*/
+export const getCurrentMouthDate = () => {
+ const start = currentMouth[0];
+ const end = currentMouth[1];
+
+ return [start.format('YYYY-MM-DD'), end.format('YYYY-MM-DD')];
+};
+
/** 格式化日期 */
export const dateformat = (date: any) => {
return dayjs(date).format('YYYY-MM-DD HH:mm:ss');
diff --git a/src/views/financial-user/account-bill/bill/bill-dialog.vue b/src/views/financial-user/account-bill/bill/bill-dialog.vue
index 0b6b460..ec38c6d 100644
--- a/src/views/financial-user/account-bill/bill/bill-dialog.vue
+++ b/src/views/financial-user/account-bill/bill/bill-dialog.vue
@@ -71,7 +71,7 @@ defineExpose({ formRef });
-
+
{{ item.categoryName }}
{{ item.categoryName }}
diff --git a/src/views/financial-user/account-bill/bill/index.vue b/src/views/financial-user/account-bill/bill/index.vue
index 01c70ab..edfac8e 100644
--- a/src/views/financial-user/account-bill/bill/index.vue
+++ b/src/views/financial-user/account-bill/bill/index.vue
@@ -13,7 +13,7 @@ import { useBillUserStore } from '@/store/financialUser/billUser';
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
import { FormInstance } from 'element-plus';
import { incomeOrExpend } from '@/enums/baseConstant';
-import { getDefaultDateRange } from '@/utils/date';
+import { getCurrentMouthDate } from '@/utils/date';
const tableRef = ref();
const formRef = ref();
@@ -40,7 +40,7 @@ const onSelectionChange = (rows: Array) => {
const resetForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.resetFields();
- billStore.form.date = getDefaultDateRange();
+ billStore.form.date = getCurrentMouthDate();
billStore.form.startDate = undefined;
billStore.form.endDate = undefined;
await onSearch();
@@ -61,6 +61,11 @@ onMounted(() => {
+
+
+
+
+
diff --git a/src/views/financial-user/account-bill/bill/utils/hooks.ts b/src/views/financial-user/account-bill/bill/utils/hooks.ts
index 30fb9a7..0a78a73 100644
--- a/src/views/financial-user/account-bill/bill/utils/hooks.ts
+++ b/src/views/financial-user/account-bill/bill/utils/hooks.ts
@@ -43,8 +43,9 @@ export function onAdd() {
label: $t('cancel'),
text: true,
bg: true,
- btnClick: ({ dialog: { options, index } }) => {
+ btnClick: async ({ dialog: { options, index } }) => {
closeDialog(options, index);
+ await onSearch();
},
},
{
diff --git a/src/views/financial-user/account-bill/expend/index.vue b/src/views/financial-user/account-bill/expend/index.vue
index 3a4c91a..1f0c94f 100644
--- a/src/views/financial-user/account-bill/expend/index.vue
+++ b/src/views/financial-user/account-bill/expend/index.vue
@@ -39,7 +39,7 @@ const onSearch = async () => {
// 分析概览
analyseData.value = [];
analyseXAxis.value = [];
- result.data.list.forEach(item => {
+ result.data.chartList.forEach(item => {
const transactionDate = item.transactionDate;
const date = `${dayjs(transactionDate).format('MM-DD')} ${days[dayjs(transactionDate).day()]}`;
analyseData.value.push(item.amount);
diff --git a/src/views/financial-user/account-bill/income/index.vue b/src/views/financial-user/account-bill/income/index.vue
index fc04f8d..430f819 100644
--- a/src/views/financial-user/account-bill/income/index.vue
+++ b/src/views/financial-user/account-bill/income/index.vue
@@ -40,7 +40,7 @@ const onSearch = async () => {
// 分析概览
analyseData.value = [];
analyseXAxis.value = [];
- result.data.list.forEach(item => {
+ result.data.chartList.forEach(item => {
const transactionDate = item.transactionDate;
const date = `${dayjs(transactionDate).format('MM-DD')} ${days[dayjs(transactionDate).day()]}`;
analyseData.value.push(item.amount);
diff --git a/src/views/financial-user/budget-saving/budget-category/index.vue b/src/views/financial-user/budget-saving/budget-category/index.vue
index b369491..07e5d1a 100644
--- a/src/views/financial-user/budget-saving/budget-category/index.vue
+++ b/src/views/financial-user/budget-saving/budget-category/index.vue
@@ -16,7 +16,7 @@ import { useAdminUserStore } from '@/store/system/adminUser';
import { budget } from '@/enums/bill/budget';
import { handleTree } from '@pureadmin/utils';
import { userBudgetCategoryUserStore } from '@/store/financialUser/budgetCategoryUser';
-import { getDefaultDateRange } from '@/utils/date';
+import { getCurrentMouthDate } from '@/utils/date';
const tableRef = ref();
const formRef = ref();
@@ -49,7 +49,7 @@ const onSelectionChange = (rows: Array) => {
const resetForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.resetFields();
- budgetCategoryStore.form.period = getDefaultDateRange(2, 30);
+ budgetCategoryStore.form.period = getCurrentMouthDate();
budgetCategoryStore.form.startPeriod = undefined;
budgetCategoryStore.form.endPeriod = undefined;
await onSearch();
diff --git a/src/views/financial-user/budget-saving/saving-goal/index.vue b/src/views/financial-user/budget-saving/saving-goal/index.vue
index bb775c1..d885ad6 100644
--- a/src/views/financial-user/budget-saving/saving-goal/index.vue
+++ b/src/views/financial-user/budget-saving/saving-goal/index.vue
@@ -16,7 +16,7 @@ import { budget } from '@/enums/bill/budget';
import { selectUserinfo } from '@/components/Table/Userinfo/columns';
import { savingGoal } from '@/enums/bill/savingGoal';
import { useSavingGoalUserStore } from '@/store/financialUser/savingGoalUser';
-import { getDefaultDateRange } from '@/utils/date';
+import { getCurrentMouthDate } from '@/utils/date';
const tableRef = ref();
const formRef = ref();
@@ -48,7 +48,7 @@ const onSelectionChange = (rows: Array) => {
const resetForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.resetFields();
- savingGoalUserStore.form.duration = getDefaultDateRange(2, 30);
+ savingGoalUserStore.form.duration = getCurrentMouthDate();
savingGoalUserStore.form.startDuration = undefined;
savingGoalUserStore.form.endDuration = undefined;
await onSearch();
diff --git a/src/views/financial/account-bill/bill/index.vue b/src/views/financial/account-bill/bill/index.vue
index a1c7cad..60ee6f4 100644
--- a/src/views/financial/account-bill/bill/index.vue
+++ b/src/views/financial/account-bill/bill/index.vue
@@ -97,6 +97,11 @@ onMounted(() => {
+
+
+
+
+
diff --git a/src/views/welcome/components/chart-bar.vue b/src/views/welcome/components/chart-bar.vue
index f987920..5dd4fcf 100644
--- a/src/views/welcome/components/chart-bar.vue
+++ b/src/views/welcome/components/chart-bar.vue
@@ -1,6 +1,7 @@