From 4d511295cc6e432cf8df4f5c2c405cc17f2252d7 Mon Sep 17 00:00:00 2001 From: Bunny <1319900154@qq.com> Date: Fri, 15 Nov 2024 00:41:32 +0800 Subject: [PATCH] =?UTF-8?q?page:=20=F0=9F=93=84=20=E5=82=A8=E5=80=BC?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/enums/baseConstant.tsx | 59 ------------- src/enums/bill/budget.tsx | 60 ++++++++++++++ src/enums/bill/savingGoal.tsx | 58 +++++++++++++ src/store/financial/savingGoal.ts | 21 ++--- .../budget-category-dialog.vue | 4 +- src/views/financial/budget-category/index.vue | 8 +- src/views/financial/category/index.vue | 2 +- .../financial/debt-repayment-plan/index.vue | 15 +++- .../debt-repayment-plan/utils/columns.ts | 2 + .../debt-repayment-plan/utils/hooks.ts | 2 +- src/views/financial/debt-tracking/index.vue | 15 +++- .../financial/debt-tracking/utils/columns.ts | 2 + .../financial/debt-tracking/utils/hooks.ts | 2 +- src/views/financial/saving-goal/index.vue | 82 +++++++++++++++++-- .../saving-goal/saving-goal-dialog.vue | 56 +++++++++++-- .../utils/{columns.ts => columns.tsx} | 39 +++++++-- .../financial/saving-goal/utils/hooks.ts | 14 +++- .../financial/saving-goal/utils/types.ts | 4 + 19 files changed, 344 insertions(+), 103 deletions(-) create mode 100644 src/enums/bill/budget.tsx create mode 100644 src/enums/bill/savingGoal.tsx rename src/views/financial/saving-goal/utils/{columns.ts => columns.tsx} (58%) diff --git a/.env.development b/.env.development index b57434a..bd0cc3d 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,5 @@ # 平台本地运行端口号 -VITE_PORT=7000 +VITE_PORT=7700 # 预发布环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数") VITE_ROUTER_HISTORY="hash" diff --git a/src/enums/baseConstant.tsx b/src/enums/baseConstant.tsx index 95edddd..91558e7 100644 --- a/src/enums/baseConstant.tsx +++ b/src/enums/baseConstant.tsx @@ -1,6 +1,5 @@ import { computed } from 'vue'; import { $t } from '@/plugins/i18n'; -import { ElTag } from 'element-plus'; /** 是否默认 */ export const isDefaultOptions = [ @@ -45,64 +44,6 @@ export const incomeOrExpend = [ { value: -1, label: $t('expend') }, ]; -// 预算状态类型 -export const budgetStateType = [ - { - value: 'InProgress', - label: $t('inProgress'), - el: ( - - {$t('inProgress')} - - ), - }, - { - value: 'Completed', - label: $t('completed'), - el: ( - - {$t('completed')} - - ), - }, - { - value: 'OverSpending', - label: $t('overSpending'), - el: ( - - {$t('overSpending')} - - ), - }, - { - value: 'NotStarted', - label: $t('notStarted'), - el: ( - - {$t('notStarted')} - - ), - }, - { - value: 'Pause', - label: $t('pause'), - el: ( - - {$t('pause')} - - ), - }, - { - value: 'Cancel', - label: $t('cancel'), - el: ( - - {$t('cancel')} - - ), - }, -]; - /** 分页默认数组个数 */ export const pageSizes: number[] = [15, 30, 50, 100, 150]; export const tableSelectButtonClass = computed(() => ['!h-[20px]', 'reset-margin', '!text-gray-500', 'dark:!text-white', 'dark:hover:!text-primary']); diff --git a/src/enums/bill/budget.tsx b/src/enums/bill/budget.tsx new file mode 100644 index 0000000..06ea31a --- /dev/null +++ b/src/enums/bill/budget.tsx @@ -0,0 +1,60 @@ +// 预算状态类型 +import { $t } from '@/plugins/i18n'; +import { ElTag } from 'element-plus'; + +export const budget = [ + { + value: 'InProgress', + label: $t('inProgress'), + el: () => ( + + {$t('inProgress')} + + ), + }, + { + value: 'Completed', + label: $t('completed'), + el: () => ( + + {$t('completed')} + + ), + }, + { + value: 'OverSpending', + label: $t('overSpending'), + el: () => ( + + {$t('overSpending')} + + ), + }, + { + value: 'NotStarted', + label: $t('notStarted'), + el: () => ( + + {$t('notStarted')} + + ), + }, + { + value: 'Pause', + label: $t('pause'), + el: () => ( + + {$t('pause')} + + ), + }, + { + value: 'Cancel', + label: $t('cancel'), + el: () => ( + + {$t('cancel')} + + ), + }, +]; diff --git a/src/enums/bill/savingGoal.tsx b/src/enums/bill/savingGoal.tsx new file mode 100644 index 0000000..f6605ee --- /dev/null +++ b/src/enums/bill/savingGoal.tsx @@ -0,0 +1,58 @@ +import { $t } from '@/plugins/i18n'; + +export const savingGoal = [ + { + value: 'InProgress', + label: $t('inProgress'), + el: () => ( + + {$t('inProgress')} + + ), + }, + { + value: 'Uncompleted', + label: $t('uncompleted'), + el: () => ( + + {$t('uncompleted')} + + ), + }, + { + value: 'Completed', + label: $t('completed'), + el: () => ( + + {$t('completed')} + + ), + }, + { + value: 'NotStarted', + label: $t('notStarted'), + el: () => ( + + {$t('notStarted')} + + ), + }, + { + value: 'Pause', + label: $t('pause'), + el: () => ( + + {$t('pause')} + + ), + }, + { + value: 'Cancel', + label: $t('cancel'), + el: () => ( + + {$t('cancel')} + + ), + }, +]; diff --git a/src/store/financial/savingGoal.ts b/src/store/financial/savingGoal.ts index 9a39f3b..16e909f 100644 --- a/src/store/financial/savingGoal.ts +++ b/src/store/financial/savingGoal.ts @@ -14,16 +14,13 @@ export const useSavingGoalStore = defineStore('savingGoalStore', { datalist: [], // 查询表单 form: { - // 绑定的用户id - userId: undefined, - // 完成状态 - statusType: undefined, - // 储值目标名称 - savingGoalName: undefined, - // 目标金额 - amount: undefined, - // 目标时长 - duration: undefined, + userId: undefined, // 绑定的用户id + statusType: undefined, // 完成状态 + savingGoalName: undefined, // 储值目标名称 + amount: undefined, // 目标金额 + duration: undefined, // 目标时长 + startDuration: undefined, // 开始目标时长 + endDuration: undefined, // 结束目标时长 }, // 分页查询结果 pagination: { @@ -40,6 +37,10 @@ export const useSavingGoalStore = defineStore('savingGoalStore', { actions: { /** 获取用户储值 */ async getSavingGoalList() { + if (this.form.duration) { + this.form.startDuration = this.form.duration[0]; + this.form.endDuration = this.form.duration[1]; + } // 整理请求参数 const data = { ...this.pagination, ...this.form }; delete data.pageSizes; diff --git a/src/views/financial/budget-category/budget-category-dialog.vue b/src/views/financial/budget-category/budget-category-dialog.vue index aa86c6c..7ce117e 100644 --- a/src/views/financial/budget-category/budget-category-dialog.vue +++ b/src/views/financial/budget-category/budget-category-dialog.vue @@ -6,8 +6,8 @@ import { FormProps } from '@/views/financial/budget-category/utils/types'; import { $t } from '@/plugins/i18n'; import LoadingSvg from '@/assets/svg/loading.svg'; import { useAdminUserStore } from '@/store/system/adminUser'; -import { budgetStateType } from '@/enums/baseConstant'; import { fetchGetAllParentList } from '@/api/v1/financial/budgetCategory'; +import { budget } from '@/enums/bill/budget'; const props = withDefaults(defineProps(), { formInline: () => ({ @@ -114,7 +114,7 @@ defineExpose({ formRef }); - + diff --git a/src/views/financial/budget-category/index.vue b/src/views/financial/budget-category/index.vue index 385cb98..be5cd47 100644 --- a/src/views/financial/budget-category/index.vue +++ b/src/views/financial/budget-category/index.vue @@ -15,7 +15,7 @@ import { useRenderIcon } from '@/components/CommonIcon/src/hooks'; import { FormInstance } from 'element-plus'; import { useAdminUserStore } from '@/store/system/adminUser'; import LoadingSvg from '@/assets/svg/loading.svg'; -import { budgetStateType } from '@/enums/baseConstant'; +import { budget } from '@/enums/bill/budget'; import { handleTree } from '@pureadmin/utils'; const tableRef = ref(); @@ -113,7 +113,7 @@ onMounted(() => { remote remote-show-suffix > - + @@ -145,7 +145,7 @@ onMounted(() => { :columns="columns" :isExpandAll="true" :tableRef="tableRef?.getTableRef()" - title="预算分类" + :title="$t('budgetCategory')" @fullscreen="tableRef.setAdaptive()" @refresh="onSearch" > @@ -181,7 +181,7 @@ onMounted(() => { @page-current-change="onCurrentPageChange" >