fix: 🧩 账单分类完成和账单部分缺陷修复
This commit is contained in:
parent
974bcf4fcb
commit
9a0062c0a4
|
@ -6,7 +6,7 @@ export const fetchGetBudgetCategoryList = (data: any) => {
|
||||||
return http.request<BaseResult<ResultTable>>('get', `budgetCategory/getBudgetCategoryList/${data.currentPage}/${data.pageSize}`, { params: data });
|
return http.request<BaseResult<ResultTable>>('get', `budgetCategory/getBudgetCategoryList/${data.currentPage}/${data.pageSize}`, { params: data });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 预算分类表---添加预算分类表 */
|
/** 预算分类表---返回所有父级对象 */
|
||||||
export const fetchGetAllParentList = () => {
|
export const fetchGetAllParentList = () => {
|
||||||
return http.request<BaseResult<object>>('get', 'budgetCategory/noManage/getAllParentList');
|
return http.request<BaseResult<object>>('get', 'budgetCategory/noManage/getAllParentList');
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,11 @@ export const fetchGetCategoryList = (data: any) => {
|
||||||
return http.request<BaseResult<ResultTable>>('get', `category/getCategoryList/${data.currentPage}/${data.pageSize}`, { params: data });
|
return http.request<BaseResult<ResultTable>>('get', `category/getCategoryList/${data.currentPage}/${data.pageSize}`, { params: data });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 分类信息---查询当前用户下所有的分类 */
|
||||||
|
export const fetchGetCategoryAllList = (data: any) => {
|
||||||
|
return http.request<BaseResult<object>>('get', 'category/noManage/getCategoryUserAllList', { params: data });
|
||||||
|
};
|
||||||
|
|
||||||
/** 分类信息---添加分类信息 */
|
/** 分类信息---添加分类信息 */
|
||||||
export const fetchAddCategory = (data: any) => {
|
export const fetchAddCategory = (data: any) => {
|
||||||
return http.request<BaseResult<object>>('post', 'category/addCategory', { data });
|
return http.request<BaseResult<object>>('post', 'category/addCategory', { data });
|
||||||
|
|
|
@ -2,23 +2,23 @@ import { http } from '@/api/service/request';
|
||||||
import type { BaseResult, ResultTable } from '@/api/service/types';
|
import type { BaseResult, ResultTable } from '@/api/service/types';
|
||||||
|
|
||||||
/** 账单信息---获取账单信息列表 */
|
/** 账单信息---获取账单信息列表 */
|
||||||
export const fetchGetBillList = (data: any) => {
|
export const fetchGetUserBillList = (data: any) => {
|
||||||
// 删除这个请求参数
|
// 删除这个请求参数
|
||||||
delete data.date;
|
delete data.date;
|
||||||
return http.request<BaseResult<ResultTable>>('get', `bill/noManage/getUserBillList/${data.currentPage}/${data.pageSize}`, { params: data });
|
return http.request<BaseResult<ResultTable>>('get', `bill/noManage/getUserBillList/${data.currentPage}/${data.pageSize}`, { params: data });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 账单信息---添加账单信息 */
|
/** 账单信息---添加账单信息 */
|
||||||
export const fetchAddBill = (data: any) => {
|
export const fetchAddUserBill = (data: any) => {
|
||||||
return http.request<BaseResult<object>>('post', 'bill/noManage/addUserBill', { data });
|
return http.request<BaseResult<object>>('post', 'bill/noManage/addUserBill', { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 账单信息---更新账单信息 */
|
/** 账单信息---更新账单信息 */
|
||||||
export const fetchUpdateBill = (data: any) => {
|
export const fetchUpdateUserBill = (data: any) => {
|
||||||
return http.request<BaseResult<object>>('put', 'bill/noManage/updateUserBill', { data });
|
return http.request<BaseResult<object>>('put', 'bill/noManage/updateUserBill', { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 账单信息---删除账单信息 */
|
/** 账单信息---删除账单信息 */
|
||||||
export const fetchDeleteBill = (data: any) => {
|
export const fetchDeleteUserBill = (data: any) => {
|
||||||
return http.request<BaseResult<object>>('delete', 'bill/noManage/deleteUserBill', { data });
|
return http.request<BaseResult<object>>('delete', 'bill/noManage/deleteUserBill', { data });
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { http } from '@/api/service/request';
|
||||||
|
import type { BaseResult, ResultTable } from '@/api/service/types';
|
||||||
|
|
||||||
|
/** 预算分类表---获取预算分类表列表 */
|
||||||
|
export const fetchGetUserBudgetCategoryList = (data: any) => {
|
||||||
|
return http.request<BaseResult<ResultTable>>('get', `budgetCategory/noManage/getUserBudgetCategoryList/${data.currentPage}/${data.pageSize}`, {
|
||||||
|
params: data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 预算分类表---返回当前用户所有父级对象 */
|
||||||
|
export const fetchGetAllUserParentList = () => {
|
||||||
|
return http.request<BaseResult<object>>('get', 'budgetCategory/noManage/getAllUserParentList');
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 预算分类表---添加预算分类表 */
|
||||||
|
export const fetchAddUserBudgetCategory = (data: any) => {
|
||||||
|
return http.request<BaseResult<object>>('post', 'budgetCategory/noManage/addUserBudgetCategory', { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 预算分类表---更新预算分类表 */
|
||||||
|
export const fetchUpdateUserBudgetCategory = (data: any) => {
|
||||||
|
return http.request<BaseResult<object>>('put', 'budgetCategory/noManage/updateUserBudgetCategory', { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 预算分类表---删除预算分类表 */
|
||||||
|
export const fetchDeleteUserBudgetCategory = (data: any) => {
|
||||||
|
return http.request<BaseResult<object>>('delete', 'budgetCategory/noManage/deleteUserBudgetCategory', { data });
|
||||||
|
};
|
|
@ -1,18 +1,19 @@
|
||||||
export default [
|
export default [
|
||||||
// 财务管理
|
// 财务管理
|
||||||
{
|
{
|
||||||
path: '/financial',
|
path: '/financial-user',
|
||||||
name: 'Financial',
|
name: 'FinancialUser',
|
||||||
redirect: '/financial/bill-user',
|
redirect: '/financial-user/bill',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'mdi:finance',
|
icon: 'mdi:finance',
|
||||||
title: 'financialManagement',
|
title: 'financialManagement',
|
||||||
|
rank: 1,
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
// 账单查询
|
// 账单查询
|
||||||
{
|
{
|
||||||
path: '/financial/bill-user',
|
path: '/financial-user/bill',
|
||||||
name: 'Bill',
|
name: 'BillUser',
|
||||||
component: () => import('@/views/financial-user/account-bill/bill/index.vue'),
|
component: () => import('@/views/financial-user/account-bill/bill/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'grommet-icons:money',
|
icon: 'grommet-icons:money',
|
||||||
|
@ -21,7 +22,7 @@ export default [
|
||||||
},
|
},
|
||||||
// 用户分类
|
// 用户分类
|
||||||
{
|
{
|
||||||
path: '/financial/category',
|
path: '/financial-user/category',
|
||||||
name: 'CategoryUser',
|
name: 'CategoryUser',
|
||||||
component: () => import('@/views/financial-user/account-bill/category/index.vue'),
|
component: () => import('@/views/financial-user/account-bill/category/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
|
@ -31,38 +32,39 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// // 预算和储值
|
// 预算和储值
|
||||||
// {
|
{
|
||||||
// path: '/budgetSavings',
|
path: '/budget-saving-user',
|
||||||
// name: 'BudgetSavings',
|
name: 'BudgetSavingsUser',
|
||||||
// redirect: '/budgetSavings/budgetCategory',
|
redirect: '/budget-saving-user/budget-category',
|
||||||
// meta: {
|
meta: {
|
||||||
// icon: 'arcticons:budgetbakers-wallet',
|
icon: 'arcticons:budgetbakers-wallet',
|
||||||
// title: 'budgetSavings',
|
title: 'budgetSavings',
|
||||||
// },
|
rank: 1,
|
||||||
// children: [
|
},
|
||||||
// // 预算分类
|
children: [
|
||||||
// {
|
// 预算分类
|
||||||
// path: '/budgetSavings/budgetCategory',
|
{
|
||||||
// name: 'budgetCategory',
|
path: '/budget-saving-user/budget-category',
|
||||||
// component: () => import('@/views/financial/budgetCategory/index.vue'),
|
name: 'budgetCategoryUser',
|
||||||
// meta: {
|
component: () => import('@/views/financial-user/budget-saving/budget-category/index.vue'),
|
||||||
// icon: 'simple-icons:actualbudget',
|
meta: {
|
||||||
// title: 'budgetCategory',
|
icon: 'simple-icons:actualbudget',
|
||||||
// },
|
title: 'budgetCategory',
|
||||||
// },
|
},
|
||||||
// // 预算储值
|
},
|
||||||
// {
|
// 预算储值
|
||||||
// path: '/budgetSavings/savingGoal',
|
{
|
||||||
// name: 'savingGoal',
|
path: '/budget-saving-user/saving-goal',
|
||||||
// component: () => import('@/views/financial/savingGoal/index.vue'),
|
name: 'savingGoalUser',
|
||||||
// meta: {
|
component: () => import('@/views/financial-user/budget-saving/saving-goal/index.vue'),
|
||||||
// icon: 'fluent:savings-16-regular',
|
meta: {
|
||||||
// title: 'savingGoal',
|
icon: 'fluent:savings-16-regular',
|
||||||
// },
|
title: 'savingGoal',
|
||||||
// },
|
},
|
||||||
// ],
|
},
|
||||||
// },
|
],
|
||||||
|
},
|
||||||
// // 账务管理
|
// // 账务管理
|
||||||
// {
|
// {
|
||||||
// path: '/debtManagement',
|
// path: '/debtManagement',
|
|
@ -52,11 +52,13 @@ export const useBudgetCategoryStore = defineStore('budgetCategoryStore', {
|
||||||
this.form.startPeriod = this.form.period[0];
|
this.form.startPeriod = this.form.period[0];
|
||||||
this.form.endPeriod = this.form.period[1];
|
this.form.endPeriod = this.form.period[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 整理请求参数
|
// 整理请求参数
|
||||||
const data = { ...this.pagination, ...this.form };
|
const data = { ...this.pagination, ...this.form };
|
||||||
delete data.pageSizes;
|
delete data.pageSizes;
|
||||||
delete data.total;
|
delete data.total;
|
||||||
delete data.background;
|
delete data.background;
|
||||||
|
delete data.period;
|
||||||
|
|
||||||
// 获取预算分类表列表
|
// 获取预算分类表列表
|
||||||
const result = await fetchGetBudgetCategoryList(data);
|
const result = await fetchGetBudgetCategoryList(data);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { fetchAddCategory, fetchDeleteCategory, fetchGetCategoryList, fetchUpdateCategory } from '@/api/v1/financial/category';
|
import { fetchAddCategory, fetchDeleteCategory, fetchGetCategoryAllList, fetchGetCategoryList, fetchUpdateCategory } from '@/api/v1/financial/category';
|
||||||
import { pageSizes } from '@/enums/baseConstant';
|
import { pageSizes } from '@/enums/baseConstant';
|
||||||
import { storeMessage } from '@/utils/message';
|
import { storeMessage } from '@/utils/message';
|
||||||
import { storePagination } from '@/store/useStorePagination';
|
import { storePagination } from '@/store/useStorePagination';
|
||||||
|
@ -12,6 +12,8 @@ export const useCategoryStore = defineStore('categoryStore', {
|
||||||
return {
|
return {
|
||||||
// 分类信息列表
|
// 分类信息列表
|
||||||
datalist: [],
|
datalist: [],
|
||||||
|
// 所有分类
|
||||||
|
allCategoryList: [],
|
||||||
// 查询表单
|
// 查询表单
|
||||||
form: {
|
form: {
|
||||||
// 绑定的用户id
|
// 绑定的用户id
|
||||||
|
@ -50,6 +52,14 @@ export const useCategoryStore = defineStore('categoryStore', {
|
||||||
return pagination(result);
|
return pagination(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 查询当前用户下所有的分类 */
|
||||||
|
async getCategoryAllList(data: any) {
|
||||||
|
const result = await fetchGetCategoryAllList(data);
|
||||||
|
if (result.code === 200) {
|
||||||
|
this.allCategoryList = result.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/** 添加分类信息 */
|
/** 添加分类信息 */
|
||||||
async addCategory(data: any) {
|
async addCategory(data: any) {
|
||||||
const result = await fetchAddCategory(data);
|
const result = await fetchAddCategory(data);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { fetchAddBill, fetchDeleteBill, fetchGetBillList, fetchUpdateBill } from '@/api/v1/financialUser/billUser';
|
import { fetchAddUserBill, fetchDeleteUserBill, fetchGetUserBillList, fetchUpdateUserBill } from '@/api/v1/financialUser/billUser';
|
||||||
import { pageSizes } from '@/enums/baseConstant';
|
import { pageSizes } from '@/enums/baseConstant';
|
||||||
import { storeMessage } from '@/utils/message';
|
import { storeMessage } from '@/utils/message';
|
||||||
import { storePagination } from '@/store/useStorePagination';
|
import { storePagination } from '@/store/useStorePagination';
|
||||||
|
@ -42,10 +42,7 @@ export const useBillUserStore = defineStore('billUserStore', {
|
||||||
/** 获取账单信息 */
|
/** 获取账单信息 */
|
||||||
async getBillList() {
|
async getBillList() {
|
||||||
// 将日期格式赋值
|
// 将日期格式赋值
|
||||||
if (!this.form.date) {
|
if (this.form.date) {
|
||||||
this.form.startDate = undefined;
|
|
||||||
this.form.endDate = undefined;
|
|
||||||
} else {
|
|
||||||
this.form.startDate = this.form.date[0];
|
this.form.startDate = this.form.date[0];
|
||||||
this.form.endDate = this.form.date[1];
|
this.form.endDate = this.form.date[1];
|
||||||
}
|
}
|
||||||
|
@ -57,7 +54,7 @@ export const useBillUserStore = defineStore('billUserStore', {
|
||||||
delete data.background;
|
delete data.background;
|
||||||
|
|
||||||
// 获取账单信息列表
|
// 获取账单信息列表
|
||||||
const result = await fetchGetBillList(data);
|
const result = await fetchGetUserBillList(data);
|
||||||
|
|
||||||
// 公共页面函数hook
|
// 公共页面函数hook
|
||||||
const pagination = storePagination.bind(this);
|
const pagination = storePagination.bind(this);
|
||||||
|
@ -66,19 +63,19 @@ export const useBillUserStore = defineStore('billUserStore', {
|
||||||
|
|
||||||
/** 添加账单信息 */
|
/** 添加账单信息 */
|
||||||
async addBill(data: any) {
|
async addBill(data: any) {
|
||||||
const result = await fetchAddBill(data);
|
const result = await fetchAddUserBill(data);
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 修改账单信息 */
|
/** 修改账单信息 */
|
||||||
async updateBill(data: any) {
|
async updateBill(data: any) {
|
||||||
const result = await fetchUpdateBill(data);
|
const result = await fetchUpdateUserBill(data);
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 删除账单信息 */
|
/** 删除账单信息 */
|
||||||
async deleteBill(data: any) {
|
async deleteBill(data: any) {
|
||||||
const result = await fetchDeleteBill(data);
|
const result = await fetchDeleteUserBill(data);
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import { pageSizes } from '@/enums/baseConstant';
|
||||||
|
import { storeMessage } from '@/utils/message';
|
||||||
|
import { storePagination } from '@/store/useStorePagination';
|
||||||
|
import {
|
||||||
|
fetchAddUserBudgetCategory,
|
||||||
|
fetchDeleteUserBudgetCategory,
|
||||||
|
fetchGetUserBudgetCategoryList,
|
||||||
|
fetchUpdateUserBudgetCategory,
|
||||||
|
} from '@/api/v1/financialUser/budgetCategoryUser';
|
||||||
|
import { getDefaultDateRange } from '@/utils/date';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预算分类表 Store
|
||||||
|
*/
|
||||||
|
export const userBudgetCategoryUser = defineStore('budgetCategoryUserStore', {
|
||||||
|
state() {
|
||||||
|
return {
|
||||||
|
// 预算分类表列表
|
||||||
|
datalist: [],
|
||||||
|
// 查询表单
|
||||||
|
form: {
|
||||||
|
// 父级id
|
||||||
|
parentId: undefined,
|
||||||
|
// 分类名称
|
||||||
|
categoryName: undefined,
|
||||||
|
// 预算名称
|
||||||
|
budgetName: undefined,
|
||||||
|
// 完成状态
|
||||||
|
statusType: undefined,
|
||||||
|
// 预算金额
|
||||||
|
amount: undefined,
|
||||||
|
// 预算周期
|
||||||
|
period: getDefaultDateRange(2, 30),
|
||||||
|
// 开始预算时间
|
||||||
|
startPeriod: undefined,
|
||||||
|
// 结束预算时间
|
||||||
|
endPeriod: undefined,
|
||||||
|
},
|
||||||
|
// 分页查询结果
|
||||||
|
pagination: {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 30,
|
||||||
|
total: 1,
|
||||||
|
pageSizes,
|
||||||
|
},
|
||||||
|
// 加载
|
||||||
|
loading: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getters: {},
|
||||||
|
actions: {
|
||||||
|
/** 获取预算分类表 */
|
||||||
|
async getBudgetCategoryList() {
|
||||||
|
if (this.form.period) {
|
||||||
|
this.form.startPeriod = this.form.period[0];
|
||||||
|
this.form.endPeriod = this.form.period[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 整理请求参数
|
||||||
|
const data = { ...this.pagination, ...this.form };
|
||||||
|
delete data.pageSizes;
|
||||||
|
delete data.total;
|
||||||
|
delete data.background;
|
||||||
|
delete data.period;
|
||||||
|
|
||||||
|
// 获取预算分类表列表
|
||||||
|
const result = await fetchGetUserBudgetCategoryList(data);
|
||||||
|
|
||||||
|
// 公共页面函数hook
|
||||||
|
const pagination = storePagination.bind(this);
|
||||||
|
return pagination(result);
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 添加预算分类表 */
|
||||||
|
async addBudgetCategory(data: any) {
|
||||||
|
const result = await fetchAddUserBudgetCategory(data);
|
||||||
|
return storeMessage(result);
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 修改预算分类表 */
|
||||||
|
async updateBudgetCategory(data: any) {
|
||||||
|
const result = await fetchUpdateUserBudgetCategory(data);
|
||||||
|
return storeMessage(result);
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 删除预算分类表 */
|
||||||
|
async deleteBudgetCategory(data: any) {
|
||||||
|
const result = await fetchDeleteUserBudgetCategory(data);
|
||||||
|
return storeMessage(result);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
|
@ -72,6 +72,7 @@ onMounted(() => {
|
||||||
v-model="billStore.form.date"
|
v-model="billStore.form.date"
|
||||||
:end-placeholder="$t('endDate')"
|
:end-placeholder="$t('endDate')"
|
||||||
:start-placeholder="$t('startDate')"
|
:start-placeholder="$t('startDate')"
|
||||||
|
class="!w-[210px]"
|
||||||
clearable
|
clearable
|
||||||
type="daterange"
|
type="daterange"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { FormInstance } from 'element-plus';
|
import { FormInstance } from 'element-plus';
|
||||||
import { rules } from '@/views/financial/budget-saving/budget-category/utils/columns';
|
import { rules } from '@/views/financial-user/budget-saving/budget-category/utils/columns';
|
||||||
import { FormProps } from '@/views/financial/budget-saving/budget-category/utils/types';
|
import { FormProps } from '@/views/financial-user/budget-saving/budget-category/utils/types';
|
||||||
import { $t } from '@/plugins/i18n';
|
import { $t } from '@/plugins/i18n';
|
||||||
import LoadingSvg from '@/assets/svg/loading.svg';
|
|
||||||
import { useAdminUserStore } from '@/store/system/adminUser';
|
import { useAdminUserStore } from '@/store/system/adminUser';
|
||||||
import { fetchGetAllParentList } from '@/api/v1/financial/budgetCategory';
|
|
||||||
import { budget } from '@/enums/bill/budget';
|
import { budget } from '@/enums/bill/budget';
|
||||||
|
import { fetchGetAllUserParentList } from '@/api/v1/financialUser/budgetCategoryUser';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<FormProps>(), {
|
const props = withDefaults(defineProps<FormProps>(), {
|
||||||
formInline: () => ({
|
formInline: () => ({
|
||||||
// 父级id
|
// 父级id
|
||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
// 绑定的用户id
|
|
||||||
userId: undefined,
|
|
||||||
// 分类名称
|
// 分类名称
|
||||||
categoryName: undefined,
|
categoryName: undefined,
|
||||||
// 预算名称
|
// 预算名称
|
||||||
|
@ -47,7 +44,7 @@ const onSearchUserinfo = async (keyword: string) => {
|
||||||
|
|
||||||
/** 获取所有父级内容 */
|
/** 获取所有父级内容 */
|
||||||
const getAllParentList = async () => {
|
const getAllParentList = async () => {
|
||||||
const result = await fetchGetAllParentList();
|
const result = await fetchGetAllUserParentList();
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
allParentList.value = result.data;
|
allParentList.value = result.data;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +61,7 @@ defineExpose({ formRef });
|
||||||
<template>
|
<template>
|
||||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto">
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto">
|
||||||
<!-- 父级id -->
|
<!-- 父级id -->
|
||||||
<el-form-item :label="$t('parentId')" prop="parentId">
|
<el-form-item :label="$t('parent')" prop="parentId">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
v-model="form.parentId"
|
v-model="form.parentId"
|
||||||
:options="allParentList"
|
:options="allParentList"
|
||||||
|
@ -80,27 +77,6 @@ defineExpose({ formRef });
|
||||||
</el-cascader>
|
</el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 绑定的用户id -->
|
|
||||||
<el-form-item :label="$t('user')" prop="userId">
|
|
||||||
<el-select
|
|
||||||
v-model="form.userId"
|
|
||||||
:loading="loading"
|
|
||||||
:placeholder="$t('user')"
|
|
||||||
:remote-method="onSearchUserinfo"
|
|
||||||
clearable
|
|
||||||
filterable
|
|
||||||
remote
|
|
||||||
remote-show-suffix
|
|
||||||
>
|
|
||||||
<el-option v-for="item in userDataList" :key="item.id" :label="item.username" :value="item.id" />
|
|
||||||
<template #loading>
|
|
||||||
<el-icon class="is-loading">
|
|
||||||
<LoadingSvg />
|
|
||||||
</el-icon>
|
|
||||||
</template>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<!-- 分类名称 -->
|
<!-- 分类名称 -->
|
||||||
<el-form-item :label="$t('categoryName')" prop="categoryName">
|
<el-form-item :label="$t('categoryName')" prop="categoryName">
|
||||||
<el-input v-model="form.categoryName" :placeholder="$t('input') + $t('categoryName')" autocomplete="off" type="text" />
|
<el-input v-model="form.categoryName" :placeholder="$t('input') + $t('categoryName')" autocomplete="off" type="text" />
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { columns } from '@/views/financial/budget-saving/budget-category/utils/columns';
|
import { columns } from '@/views/financial-user/budget-saving/budget-category/utils/columns';
|
||||||
import PureTableBar from '@/components/TableBar/src/bar';
|
import PureTableBar from '@/components/TableBar/src/bar';
|
||||||
import AddFill from '@iconify-icons/ri/add-circle-line';
|
import AddFill from '@iconify-icons/ri/add-circle-line';
|
||||||
import PureTable from '@pureadmin/table';
|
import PureTable from '@pureadmin/table';
|
||||||
import { deleteIds, onAdd, onDelete, onDeleteBatch, onSearch, onUpdate } from '@/views/financial/budget-saving/budget-category/utils/hooks';
|
import { deleteIds, onAdd, onDelete, onDeleteBatch, onSearch, onUpdate } from '@/views/financial-user/budget-saving/budget-category/utils/hooks';
|
||||||
import Delete from '@iconify-icons/ep/delete';
|
import Delete from '@iconify-icons/ep/delete';
|
||||||
import EditPen from '@iconify-icons/ep/edit-pen';
|
import EditPen from '@iconify-icons/ep/edit-pen';
|
||||||
import Refresh from '@iconify-icons/ep/refresh';
|
import Refresh from '@iconify-icons/ep/refresh';
|
||||||
import { selectUserinfo } from '@/components/Table/Userinfo/columns';
|
import { selectUserinfo } from '@/components/Table/Userinfo/columns';
|
||||||
import { $t } from '@/plugins/i18n';
|
import { $t } from '@/plugins/i18n';
|
||||||
import { useBudgetCategoryStore } from '@/store/financial/budgetCategory';
|
|
||||||
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
|
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
|
||||||
import { FormInstance } from 'element-plus';
|
import { FormInstance } from 'element-plus';
|
||||||
import { useAdminUserStore } from '@/store/system/adminUser';
|
import { useAdminUserStore } from '@/store/system/adminUser';
|
||||||
import LoadingSvg from '@/assets/svg/loading.svg';
|
|
||||||
import { budget } from '@/enums/bill/budget';
|
import { budget } from '@/enums/bill/budget';
|
||||||
import { handleTree } from '@pureadmin/utils';
|
import { handleTree } from '@pureadmin/utils';
|
||||||
|
import { userBudgetCategoryUser } from '@/store/financialUser/budgetCategoryUser';
|
||||||
|
import { getDefaultDateRange } from '@/utils/date';
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
@ -25,7 +25,7 @@ const userDataList = ref();
|
||||||
// 搜索用户加载
|
// 搜索用户加载
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const adminUserStore = useAdminUserStore();
|
const adminUserStore = useAdminUserStore();
|
||||||
const budgetCategoryStore = useBudgetCategoryStore();
|
const budgetCategoryStore = userBudgetCategoryUser();
|
||||||
const datalist = computed(() => handleTree(budgetCategoryStore.datalist));
|
const datalist = computed(() => handleTree(budgetCategoryStore.datalist));
|
||||||
|
|
||||||
/** 当前页改变时 */
|
/** 当前页改变时 */
|
||||||
|
@ -49,19 +49,12 @@ const onSelectionChange = (rows: Array<any>) => {
|
||||||
const resetForm = async (formEl: FormInstance | undefined) => {
|
const resetForm = async (formEl: FormInstance | undefined) => {
|
||||||
if (!formEl) return;
|
if (!formEl) return;
|
||||||
formEl.resetFields();
|
formEl.resetFields();
|
||||||
budgetCategoryStore.form.period = undefined;
|
budgetCategoryStore.form.period = getDefaultDateRange(2, 30);
|
||||||
budgetCategoryStore.form.startPeriod = undefined;
|
budgetCategoryStore.form.startPeriod = undefined;
|
||||||
budgetCategoryStore.form.endPeriod = undefined;
|
budgetCategoryStore.form.endPeriod = undefined;
|
||||||
await onSearch();
|
await onSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 搜索 */
|
|
||||||
const onSearchUserinfo = async (keyword: string) => {
|
|
||||||
loading.value = true;
|
|
||||||
userDataList.value = await adminUserStore.queryUser({ keyword });
|
|
||||||
loading.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
onSearch();
|
onSearch();
|
||||||
});
|
});
|
||||||
|
@ -70,28 +63,6 @@ onMounted(() => {
|
||||||
<template>
|
<template>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<el-form ref="formRef" :inline="true" :model="budgetCategoryStore.form" class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto">
|
<el-form ref="formRef" :inline="true" :model="budgetCategoryStore.form" class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto">
|
||||||
<!-- 绑定的用户id -->
|
|
||||||
<el-form-item :label="$t('user')" prop="userId">
|
|
||||||
<el-select
|
|
||||||
v-model="budgetCategoryStore.form.userId"
|
|
||||||
:loading="loading"
|
|
||||||
:placeholder="$t('user')"
|
|
||||||
:remote-method="onSearchUserinfo"
|
|
||||||
class="!w-[180px]"
|
|
||||||
clearable
|
|
||||||
filterable
|
|
||||||
remote
|
|
||||||
remote-show-suffix
|
|
||||||
>
|
|
||||||
<el-option v-for="item in userDataList" :key="item.id" :label="item.username" :value="item.id" />
|
|
||||||
<template #loading>
|
|
||||||
<el-icon class="is-loading">
|
|
||||||
<LoadingSvg />
|
|
||||||
</el-icon>
|
|
||||||
</template>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<!-- 分类名称 -->
|
<!-- 分类名称 -->
|
||||||
<el-form-item :label="$t('categoryName')" prop="categoryName">
|
<el-form-item :label="$t('categoryName')" prop="categoryName">
|
||||||
<el-input v-model="budgetCategoryStore.form.categoryName" :placeholder="`${$t('input')}${$t('categoryName')}`" class="!w-[180px]" clearable />
|
<el-input v-model="budgetCategoryStore.form.categoryName" :placeholder="`${$t('input')}${$t('categoryName')}`" class="!w-[180px]" clearable />
|
||||||
|
|
|
@ -41,16 +41,11 @@ export const columns: TableColumnList = [
|
||||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||||
// 绑定的用户id
|
// 绑定的用户id
|
||||||
{ label: $t('username'), prop: 'username', slot: 'username', width: 130 },
|
|
||||||
{ label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 130 },
|
|
||||||
{ label: $t('table.updateUser'), prop: 'updateUser', slot: 'updateUser', width: 130 },
|
|
||||||
{ label: $t('table.operation'), fixed: 'right', width: 210, slot: 'operation' },
|
{ label: $t('table.operation'), fixed: 'right', width: 210, slot: 'operation' },
|
||||||
];
|
];
|
||||||
|
|
||||||
// 添加规则
|
// 添加规则
|
||||||
export const rules = reactive<FormRules>({
|
export const rules = reactive<FormRules>({
|
||||||
// 绑定的用户
|
|
||||||
userId: [{ required: true, message: `${$t('input')}${$t('userId')}`, trigger: 'blur' }],
|
|
||||||
// 分类名称
|
// 分类名称
|
||||||
categoryName: [{ required: true, message: `${$t('input')}${$t('categoryName')}`, trigger: 'blur' }],
|
categoryName: [{ required: true, message: `${$t('input')}${$t('categoryName')}`, trigger: 'blur' }],
|
||||||
// 预算名称
|
// 预算名称
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { addDialog } from '@/components/BaseDialog/index';
|
import { addDialog } from '@/components/BaseDialog/index';
|
||||||
import BudgetCategoryDialog from '@/views/financial/budget-saving/budget-category/budget-category-dialog.vue';
|
import BudgetCategoryDialog from '@/views/financial-user/budget-saving/budget-category/budget-category-dialog.vue';
|
||||||
import { useBudgetCategoryStore } from '@/store/financial/budgetCategory';
|
|
||||||
import { h, ref } from 'vue';
|
import { h, ref } from 'vue';
|
||||||
import { message, messageBox } from '@/utils/message';
|
import { message, messageBox } from '@/utils/message';
|
||||||
import type { FormItemProps } from '@/views/financial/budget-saving/budget-category/utils/types';
|
import type { FormItemProps } from '@/views/financial-user/budget-saving/budget-category/utils/types';
|
||||||
import { $t } from '@/plugins/i18n';
|
import { $t } from '@/plugins/i18n';
|
||||||
import DeleteBatchDialog from '@/components/Table/DeleteBatchDialog.vue';
|
import DeleteBatchDialog from '@/components/Table/DeleteBatchDialog.vue';
|
||||||
|
import { userBudgetCategoryUser } from '@/store/financialUser/budgetCategoryUser';
|
||||||
|
|
||||||
export const formRef = ref();
|
export const formRef = ref();
|
||||||
// 删除ids
|
// 删除ids
|
||||||
export const deleteIds = ref([]);
|
export const deleteIds = ref([]);
|
||||||
const budgetCategoryStore = useBudgetCategoryStore();
|
const budgetCategoryStore = userBudgetCategoryUser();
|
||||||
|
|
||||||
/** 搜索初始化预算分类表 */
|
/** 搜索初始化预算分类表 */
|
||||||
export async function onSearch() {
|
export async function onSearch() {
|
||||||
|
@ -66,7 +66,6 @@ export function onUpdate(row: any) {
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
parentId: row.parentId ? row.parentId : '0',
|
parentId: row.parentId ? row.parentId : '0',
|
||||||
userId: row.userId,
|
|
||||||
categoryName: row.categoryName,
|
categoryName: row.categoryName,
|
||||||
budgetName: row.budgetName,
|
budgetName: row.budgetName,
|
||||||
statusType: row.statusType,
|
statusType: row.statusType,
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
export interface FormItemProps {
|
export interface FormItemProps {
|
||||||
// 父级id
|
// 父级id
|
||||||
parentId: number;
|
parentId: number;
|
||||||
// 绑定的用户id
|
|
||||||
userId: string;
|
|
||||||
// 分类名称
|
// 分类名称
|
||||||
categoryName: string;
|
categoryName: string;
|
||||||
// 预算名称
|
// 预算名称
|
||||||
|
|
|
@ -5,11 +5,11 @@ import { rules } from '@/views/financial/account-bill/bill/utils/columns';
|
||||||
import { FormProps } from '@/views/financial/account-bill/bill/utils/types';
|
import { FormProps } from '@/views/financial/account-bill/bill/utils/types';
|
||||||
import { $t } from '@/plugins/i18n';
|
import { $t } from '@/plugins/i18n';
|
||||||
import { incomeOrExpend } from '@/enums/baseConstant';
|
import { incomeOrExpend } from '@/enums/baseConstant';
|
||||||
import { useCategoryUserStore } from '@/store/financialUser/categoryUser';
|
|
||||||
import { onSearch } from '@/views/financial/account-bill/bill/utils/hooks';
|
import { onSearch } from '@/views/financial/account-bill/bill/utils/hooks';
|
||||||
import { useBillStore } from '@/store/financial/bill';
|
import { useBillStore } from '@/store/financial/bill';
|
||||||
import { useAdminUserStore } from '@/store/system/adminUser';
|
import { useAdminUserStore } from '@/store/system/adminUser';
|
||||||
import LoadingSvg from '@/assets/svg/loading.svg';
|
import LoadingSvg from '@/assets/svg/loading.svg';
|
||||||
|
import { useCategoryStore } from '@/store/financial/category';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<FormProps>(), {
|
const props = withDefaults(defineProps<FormProps>(), {
|
||||||
formInline: () => ({
|
formInline: () => ({
|
||||||
|
@ -35,7 +35,7 @@ const userDataList = ref();
|
||||||
// 搜索用户加载
|
// 搜索用户加载
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const billStore = useBillStore();
|
const billStore = useBillStore();
|
||||||
const categoryUserStore = useCategoryUserStore();
|
const categoryStore = useCategoryStore();
|
||||||
const adminUserStore = useAdminUserStore();
|
const adminUserStore = useAdminUserStore();
|
||||||
|
|
||||||
/** 搜索 */
|
/** 搜索 */
|
||||||
|
@ -59,9 +59,15 @@ const onSubmit = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 修改用户Id获取这个用户下的分类 */
|
||||||
|
const changeUserid = () => {
|
||||||
|
const userId = form.value.userId;
|
||||||
|
categoryStore.getCategoryAllList({ userId });
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
onSearchUserinfo();
|
onSearchUserinfo();
|
||||||
categoryUserStore.getCategoryUserAllList();
|
changeUserid();
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ formRef });
|
defineExpose({ formRef });
|
||||||
|
@ -87,6 +93,7 @@ defineExpose({ formRef });
|
||||||
filterable
|
filterable
|
||||||
remote
|
remote
|
||||||
remote-show-suffix
|
remote-show-suffix
|
||||||
|
@change="changeUserid"
|
||||||
>
|
>
|
||||||
<el-option v-for="item in userDataList" :key="item.id" :label="item.username" :value="item.id" />
|
<el-option v-for="item in userDataList" :key="item.id" :label="item.username" :value="item.id" />
|
||||||
<template #loading>
|
<template #loading>
|
||||||
|
@ -111,8 +118,8 @@ defineExpose({ formRef });
|
||||||
|
|
||||||
<!-- 类别id -->
|
<!-- 类别id -->
|
||||||
<el-form-item :label="$t('category')" prop="categoryId">
|
<el-form-item :label="$t('category')" prop="categoryId">
|
||||||
<el-select v-model="form.categoryId" :placeholder="$t('select') + $t('category')" clearable filterable>
|
<el-select v-model="form.categoryId" :disabled="!form.userId" :placeholder="$t('select') + $t('category')" clearable filterable>
|
||||||
<el-option v-for="item in categoryUserStore.allCategoryList" :key="item.id" :label="item.categoryName" :navigationBar="false" :value="item.id">
|
<el-option v-for="item in categoryStore.allCategoryList" :key="item.id" :label="item.categoryName" :navigationBar="false" :value="item.id">
|
||||||
<el-text v-if="item.isBuiltin" effect="plain" size="large" type="info">{{ item.categoryName }}</el-text>
|
<el-text v-if="item.isBuiltin" effect="plain" size="large" type="info">{{ item.categoryName }}</el-text>
|
||||||
<el-text v-else effect="plain" size="large" type="success">{{ item.categoryName }}</el-text>
|
<el-text v-else effect="plain" size="large" type="success">{{ item.categoryName }}</el-text>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
|
Loading…
Reference in New Issue