78 lines
1.9 KiB
TypeScript
78 lines
1.9 KiB
TypeScript
import { defineStore } from 'pinia';
|
|
import { fetchAddDebtTracking, fetchDeleteDebtTracking, fetchGetDebtTrackingList, fetchUpdateDebtTracking } from '@/api/v1/financial/debtTracking';
|
|
import { pageSizes } from '@/enums/baseConstant';
|
|
import { storeMessage } from '@/utils/message';
|
|
import { storePagination } from '@/store/useStorePagination';
|
|
|
|
/**
|
|
* 债务追踪 Store
|
|
*/
|
|
export const useDebtTrackingStore = defineStore('debtTrackingStore', {
|
|
state() {
|
|
return {
|
|
// 债务追踪列表
|
|
datalist: [],
|
|
// 查询表单
|
|
form: {
|
|
// 绑定的用户
|
|
userId: undefined,
|
|
// 债务人姓名
|
|
debtorName: undefined,
|
|
// 债务金额
|
|
debtAmount: undefined,
|
|
// 债务类型
|
|
debtType: undefined,
|
|
// 债务状态
|
|
debtStatus: undefined,
|
|
// 还款截止日期
|
|
dueDate: undefined,
|
|
},
|
|
// 分页查询结果
|
|
pagination: {
|
|
currentPage: 1,
|
|
pageSize: 30,
|
|
total: 1,
|
|
pageSizes,
|
|
},
|
|
// 加载
|
|
loading: false,
|
|
};
|
|
},
|
|
getters: {},
|
|
actions: {
|
|
/** 获取债务追踪 */
|
|
async getDebtTrackingList() {
|
|
// 整理请求参数
|
|
const data = { ...this.pagination, ...this.form };
|
|
delete data.pageSizes;
|
|
delete data.total;
|
|
delete data.background;
|
|
|
|
// 获取债务追踪列表
|
|
const result = await fetchGetDebtTrackingList(data);
|
|
|
|
// 公共页面函数hook
|
|
const pagination = storePagination.bind(this);
|
|
return pagination(result);
|
|
},
|
|
|
|
/** 添加债务追踪 */
|
|
async addDebtTracking(data: any) {
|
|
const result = await fetchAddDebtTracking(data);
|
|
return storeMessage(result);
|
|
},
|
|
|
|
/** 修改债务追踪 */
|
|
async updateDebtTracking(data: any) {
|
|
const result = await fetchUpdateDebtTracking(data);
|
|
return storeMessage(result);
|
|
},
|
|
|
|
/** 删除债务追踪 */
|
|
async deleteDebtTracking(data: any) {
|
|
const result = await fetchDeleteDebtTracking(data);
|
|
return storeMessage(result);
|
|
},
|
|
},
|
|
});
|