feat: 🚀 导出账单
This commit is contained in:
parent
476d4677a5
commit
9ab999189d
|
@ -3,6 +3,14 @@ import type { BaseResult, ResultTable } from '@/api/service/types';
|
||||||
|
|
||||||
/** 邮件模板表---获取邮件模板表列表 */
|
/** 邮件模板表---获取邮件模板表列表 */
|
||||||
export const fetchGetEmailTemplateList = (data: any) => {
|
export const fetchGetEmailTemplateList = (data: any) => {
|
||||||
|
data = {
|
||||||
|
templateName: data.templateName,
|
||||||
|
subject: data.subject,
|
||||||
|
body: data.body,
|
||||||
|
type: data.type,
|
||||||
|
pageSize: data.pageSize,
|
||||||
|
currentPage: data.currentPage,
|
||||||
|
};
|
||||||
return http.request<BaseResult<ResultTable>>('get', `emailTemplate/getEmailTemplateList/${data.currentPage}/${data.pageSize}`, { params: data });
|
return http.request<BaseResult<ResultTable>>('get', `emailTemplate/getEmailTemplateList/${data.currentPage}/${data.pageSize}`, { params: data });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,14 @@ import type { BaseResult, ResultTable } from '@/api/service/types';
|
||||||
|
|
||||||
/** 邮箱用户发送配置管理---获取邮箱用户发送配置管理列表 */
|
/** 邮箱用户发送配置管理---获取邮箱用户发送配置管理列表 */
|
||||||
export const fetchGetEmailUsersList = (data: any) => {
|
export const fetchGetEmailUsersList = (data: any) => {
|
||||||
|
data = {
|
||||||
|
email: data.email,
|
||||||
|
host: data.host,
|
||||||
|
port: data.port,
|
||||||
|
smtpAgreement: data.smtpAgreement,
|
||||||
|
pageSize: data.pageSize,
|
||||||
|
currentPage: data.currentPage,
|
||||||
|
};
|
||||||
return http.request<BaseResult<ResultTable>>('get', `emailUsers/getEmailUsersList/${data.currentPage}/${data.pageSize}`, { params: data });
|
return http.request<BaseResult<ResultTable>>('get', `emailUsers/getEmailUsersList/${data.currentPage}/${data.pageSize}`, { params: data });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,11 @@ export const fetchGetBillList = (data: any) => {
|
||||||
return http.request<BaseResult<ResultTable>>('get', `bill/getBillList/${data.currentPage}/${data.pageSize}`, { params: data });
|
return http.request<BaseResult<ResultTable>>('get', `bill/getBillList/${data.currentPage}/${data.pageSize}`, { params: data });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 账单信息---导出用户账单信息 */
|
||||||
|
export const fetchExportBill = (data: any) => {
|
||||||
|
return http.request<BaseResult<object>>('post', 'bill/exportBillByAdmin', { data, responseType: 'blob' });
|
||||||
|
};
|
||||||
|
|
||||||
/** 账单信息---添加账单信息 */
|
/** 账单信息---添加账单信息 */
|
||||||
export const fetchAddBill = (data: any) => {
|
export const fetchAddBill = (data: any) => {
|
||||||
return http.request<BaseResult<object>>('post', 'bill/addBill', { data });
|
return http.request<BaseResult<object>>('post', 'bill/addBill', { data });
|
||||||
|
|
|
@ -18,7 +18,14 @@ export const fetchGetUserBillList = (data: any) => {
|
||||||
/** 账单信息---账单收入和支出 */
|
/** 账单信息---账单收入和支出 */
|
||||||
export const fetchGetExpendOrIncome = (data: any) => {
|
export const fetchGetExpendOrIncome = (data: any) => {
|
||||||
data = { userId: data.userId, type: data.type, startDate: data.startDate, endDate: data.endDate };
|
data = { userId: data.userId, type: data.type, startDate: data.startDate, endDate: data.endDate };
|
||||||
return http.request<BaseResult<object>>('get', 'bill/noManage/getExpendOrIncome', { params: data });
|
return http.request<BaseResult<object>>('get', 'bill/noManage/getExpendOrIncome', {
|
||||||
|
params: data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 账单信息---导出用户账单信息 */
|
||||||
|
export const fetchExportBill = (data: any) => {
|
||||||
|
return http.request<BaseResult<object>>('post', 'bill/noManage/exportBill', { data, responseType: 'blob' });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 账单信息---添加账单信息 */
|
/** 账单信息---添加账单信息 */
|
||||||
|
|
|
@ -12,6 +12,6 @@ export const fetchUploadFile = (data: any) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 账单信息---首页内容展示 */
|
/** 账单信息---首页内容展示 */
|
||||||
export const fetchHomeDatalist = (data: any) => {
|
export const fetchHomeDatalist = () => {
|
||||||
return http.request<BaseResult<object>>('get', 'noManage/homeDatalist', { params: data });
|
return http.request<BaseResult<object>>('get', 'noManage/homeDatalist', {});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { fetchAddEmailTemplate, fetchDeleteEmailTemplate, fetchGetEmailTemplateList, fetchGetEmailTypes, fetchUpdateEmailTemplate } from '@/api/v1/email/emailTemplate';
|
import {
|
||||||
|
fetchAddEmailTemplate,
|
||||||
|
fetchDeleteEmailTemplate,
|
||||||
|
fetchGetEmailTemplateList,
|
||||||
|
fetchGetEmailTypes,
|
||||||
|
fetchUpdateEmailTemplate,
|
||||||
|
} from '@/api/v1/email/emailTemplate';
|
||||||
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';
|
||||||
|
@ -51,9 +57,6 @@ export const useEmailTemplateStore = defineStore('emailTemplateStore', {
|
||||||
async getEmailTemplateList() {
|
async getEmailTemplateList() {
|
||||||
// 整理请求参数
|
// 整理请求参数
|
||||||
const data = { ...this.pagination, ...this.form };
|
const data = { ...this.pagination, ...this.form };
|
||||||
delete data.pageSizes;
|
|
||||||
delete data.total;
|
|
||||||
delete data.background;
|
|
||||||
|
|
||||||
// 获取邮件模板表列表
|
// 获取邮件模板表列表
|
||||||
const result = await fetchGetEmailTemplateList(data);
|
const result = await fetchGetEmailTemplateList(data);
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { fetchAddEmailUsers, fetchDeleteEmailUsers, fetchGetEmailUsersList, fetchUpdateEmailUsers, fetchUpdateEmailUserStatus } from '@/api/v1/email/emailUsers';
|
import {
|
||||||
|
fetchAddEmailUsers,
|
||||||
|
fetchDeleteEmailUsers,
|
||||||
|
fetchGetEmailUsersList,
|
||||||
|
fetchUpdateEmailUsers,
|
||||||
|
fetchUpdateEmailUserStatus,
|
||||||
|
} from '@/api/v1/email/emailUsers';
|
||||||
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,9 +48,6 @@ export const useEmailUsersStore = defineStore('emailUsersStore', {
|
||||||
async getEmailUsersList() {
|
async getEmailUsersList() {
|
||||||
// 整理请求参数
|
// 整理请求参数
|
||||||
const data = { ...this.pagination, ...this.form };
|
const data = { ...this.pagination, ...this.form };
|
||||||
delete data.pageSizes;
|
|
||||||
delete data.total;
|
|
||||||
delete data.background;
|
|
||||||
|
|
||||||
// 获取邮箱用户发送配置列表
|
// 获取邮箱用户发送配置列表
|
||||||
const result = await fetchGetEmailUsersList(data);
|
const result = await fetchGetEmailUsersList(data);
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { fetchAddBill, fetchDeleteBill, fetchGetBillList, fetchUpdateBill } from '@/api/v1/financial/admin/bill';
|
import { fetchAddBill, fetchDeleteBill, fetchExportBill, fetchGetBillList, fetchUpdateBill } from '@/api/v1/financial/admin/bill';
|
||||||
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';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import { download } from '@/utils/sso';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账单信息 Store
|
* 账单信息 Store
|
||||||
|
@ -63,6 +65,20 @@ export const useBillStore = defineStore('billStore', {
|
||||||
return pagination(result);
|
return pagination(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 导出账单*/
|
||||||
|
async exportBill(data: any) {
|
||||||
|
const userDataList = data.userDataList;
|
||||||
|
const userinfo = userDataList.filter(item => item.id === data.userId)[0];
|
||||||
|
|
||||||
|
data = {
|
||||||
|
userId: data.userId,
|
||||||
|
startDate: dayjs(data.transactionDate[0]).format('YYYY-MM-DD'),
|
||||||
|
endDate: dayjs(data.transactionDate[1]).format('YYYY-MM-DD'),
|
||||||
|
};
|
||||||
|
const result = await fetchExportBill(data);
|
||||||
|
download(result, `${userinfo.username}-${data.startDate}~${data.endDate}.xlsx`);
|
||||||
|
},
|
||||||
|
|
||||||
/** 添加账单信息 */
|
/** 添加账单信息 */
|
||||||
async addBill(data: any) {
|
async addBill(data: any) {
|
||||||
const result = await fetchAddBill(data);
|
const result = await fetchAddBill(data);
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { fetchAddUserBill, fetchDeleteUserBill, fetchGetUserBillList, fetchUpdateUserBill } from '@/api/v1/financial/user/billUser';
|
import { fetchAddUserBill, fetchDeleteUserBill, fetchExportBill, fetchGetUserBillList, fetchUpdateUserBill } from '@/api/v1/financial/user/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';
|
||||||
import { getCurrentMouthDate } from '@/utils/date';
|
import { getCurrentMouthDate } from '@/utils/date';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import { download } from '@/utils/sso';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账单信息 Store
|
* 账单信息 Store
|
||||||
|
@ -41,7 +43,6 @@ export const useBillUserStore = defineStore('billUserStore', {
|
||||||
loading: false,
|
loading: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getters: {},
|
|
||||||
actions: {
|
actions: {
|
||||||
/** 获取账单信息 */
|
/** 获取账单信息 */
|
||||||
async getBillList() {
|
async getBillList() {
|
||||||
|
@ -65,6 +66,13 @@ export const useBillUserStore = defineStore('billUserStore', {
|
||||||
return pagination(result);
|
return pagination(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 导出账单*/
|
||||||
|
async exportBill(data: any) {
|
||||||
|
data = { startDate: dayjs(data[0]).format('YYYY-MM-DD'), endDate: dayjs(data[1]).format('YYYY-MM-DD') };
|
||||||
|
const result = await fetchExportBill(data);
|
||||||
|
download(result, `${data.startDate}~${data.endDate}.xlsx`);
|
||||||
|
},
|
||||||
|
|
||||||
/** 添加账单信息 */
|
/** 添加账单信息 */
|
||||||
async addBill(data: any) {
|
async addBill(data: any) {
|
||||||
const result = await fetchAddUserBill(data);
|
const result = await fetchAddUserBill(data);
|
||||||
|
@ -83,4 +91,5 @@ export const useBillUserStore = defineStore('billUserStore', {
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
getters: {},
|
||||||
});
|
});
|
||||||
|
|
|
@ -62,7 +62,7 @@ defineExpose({ formRef });
|
||||||
<el-form-item :label="$t('transactionDate')" prop="transactionDate">
|
<el-form-item :label="$t('transactionDate')" prop="transactionDate">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.transactionDate"
|
v-model="form.transactionDate"
|
||||||
:placeholder="$t('input') + $t('transactionDate')"
|
:placeholder="$t('select') + $t('transactionDate')"
|
||||||
format="YYYY/MM/DD HH:mm:ss"
|
format="YYYY/MM/DD HH:mm:ss"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { FormInstance } from 'element-plus';
|
||||||
|
import { FormProps } from '@/views/financial-user/account-bill/bill/utils/types';
|
||||||
|
import { $t } from '@/plugins/i18n';
|
||||||
|
import { currentMouth, currentWeek, currentYear } from '@/enums/dateEnums';
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<FormProps>(), {
|
||||||
|
formInline: () => ({
|
||||||
|
// 交易日期
|
||||||
|
transactionDate: currentMouth,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// 日期范围选择
|
||||||
|
const shortcuts = [
|
||||||
|
{ text: $t('thisWeek'), value: currentWeek },
|
||||||
|
{ text: $t('thisMonth'), value: currentMouth },
|
||||||
|
{ text: $t('thisYear'), value: currentYear },
|
||||||
|
];
|
||||||
|
|
||||||
|
const formRef = ref<FormInstance>();
|
||||||
|
const form = ref(props.formInline);
|
||||||
|
|
||||||
|
defineExpose({ formRef });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="{
|
||||||
|
transactionDate: [{ required: true, message: `${$t('select')}${$t('transactionDate')}`, trigger: 'blur' }],
|
||||||
|
}"
|
||||||
|
label-width="auto"
|
||||||
|
>
|
||||||
|
<!-- 交易日期 -->
|
||||||
|
<el-form-item :label="$t('transactionDate')" prop="transactionDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.transactionDate"
|
||||||
|
:end-placeholder="$t('endDate')"
|
||||||
|
:shortcuts="shortcuts"
|
||||||
|
:start-placeholder="$t('startDate')"
|
||||||
|
class="!w-[210px]"
|
||||||
|
clearable
|
||||||
|
type="daterange"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
|
@ -3,8 +3,9 @@ import { onMounted, ref } from 'vue';
|
||||||
import { columns } from '@/views/financial-user/account-bill/bill/utils/columns';
|
import { columns } from '@/views/financial-user/account-bill/bill/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 Upload from '@iconify-icons/ep/upload';
|
||||||
import PureTable from '@pureadmin/table';
|
import PureTable from '@pureadmin/table';
|
||||||
import { deleteIds, onAdd, onDelete, onDeleteBatch, onSearch, onUpdate } from '@/views/financial-user/account-bill/bill/utils/hooks';
|
import { deleteIds, onAdd, onDelete, onDeleteBatch, onExportBill, onSearch, onUpdate } from '@/views/financial-user/account-bill/bill/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';
|
||||||
|
@ -93,6 +94,7 @@ onMounted(() => {
|
||||||
|
|
||||||
<PureTableBar :columns="columns" title="账单信息" @fullscreen="tableRef.setAdaptive()" @refresh="onSearch">
|
<PureTableBar :columns="columns" title="账单信息" @fullscreen="tableRef.setAdaptive()" @refresh="onSearch">
|
||||||
<template #buttons>
|
<template #buttons>
|
||||||
|
<el-button :icon="useRenderIcon(Upload)" type="primary" @click="onExportBill"> {{ $t('exportBill') }} </el-button>
|
||||||
<el-button :icon="useRenderIcon(AddFill)" type="primary" @click="onAdd"> {{ $t('addNew') }}</el-button>
|
<el-button :icon="useRenderIcon(AddFill)" type="primary" @click="onAdd"> {{ $t('addNew') }}</el-button>
|
||||||
|
|
||||||
<!-- 批量删除按钮 -->
|
<!-- 批量删除按钮 -->
|
||||||
|
|
|
@ -7,6 +7,8 @@ import type { FormItemProps } from '@/views/financial-user/account-bill/bill/uti
|
||||||
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 dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
import ExportBill from '@/views/financial-user/account-bill/bill/export-bill.vue';
|
||||||
|
import { currentMouth } from '@/enums/dateEnums';
|
||||||
|
|
||||||
export const formRef = ref();
|
export const formRef = ref();
|
||||||
// 删除ids
|
// 删除ids
|
||||||
|
@ -170,3 +172,27 @@ export const onDeleteBatch = async () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 导出账单 */
|
||||||
|
export const onExportBill = () => {
|
||||||
|
const formExportBillRef = ref();
|
||||||
|
|
||||||
|
addDialog({
|
||||||
|
title: $t('exportBill'),
|
||||||
|
width: '30%',
|
||||||
|
props: { formInline: { transactionDate: currentMouth } },
|
||||||
|
draggable: true,
|
||||||
|
fullscreenIcon: true,
|
||||||
|
closeOnClickModal: false,
|
||||||
|
contentRenderer: () => h(ExportBill, { ref: formExportBillRef }),
|
||||||
|
beforeSure: (done, { options }) => {
|
||||||
|
formExportBillRef.value.formRef.validate(async (valid: any) => {
|
||||||
|
if (!valid) return;
|
||||||
|
const result = billStore.exportBill(options.props.formInline.transactionDate);
|
||||||
|
if (!result) return;
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { FormInstance } from 'element-plus';
|
||||||
|
import { FormProps } from '@/views/financial-user/account-bill/bill/utils/types';
|
||||||
|
import { $t } from '@/plugins/i18n';
|
||||||
|
import { currentMouth, currentWeek, currentYear } from '@/enums/dateEnums';
|
||||||
|
import LoadingSvg from '@/assets/svg/loading.svg';
|
||||||
|
import { useAdminUserStore } from '@/store/system/adminUser';
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<FormProps>(), {
|
||||||
|
formInline: () => ({
|
||||||
|
// 交易日期
|
||||||
|
transactionDate: currentMouth,
|
||||||
|
// 绑定的用户id
|
||||||
|
userId: undefined,
|
||||||
|
userDataList: undefined,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// 日期范围选择
|
||||||
|
const shortcuts = [
|
||||||
|
{ text: $t('thisWeek'), value: currentWeek },
|
||||||
|
{ text: $t('thisMonth'), value: currentMouth },
|
||||||
|
{ text: $t('thisYear'), value: currentYear },
|
||||||
|
];
|
||||||
|
|
||||||
|
const formRef = ref<FormInstance>();
|
||||||
|
const form = ref(props.formInline);
|
||||||
|
// 用户信息列表
|
||||||
|
const userDataList = ref();
|
||||||
|
// 搜索用户加载
|
||||||
|
const loading = ref(false);
|
||||||
|
const adminUserStore = useAdminUserStore();
|
||||||
|
|
||||||
|
/** 搜索 */
|
||||||
|
const onSearchUserinfo = async (keyword: string) => {
|
||||||
|
loading.value = true;
|
||||||
|
userDataList.value = await adminUserStore.queryUser({ keyword });
|
||||||
|
loading.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({ formRef });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="{
|
||||||
|
userId: [{ required: true, message: `${$t('input')}${$t('userId')}`, trigger: 'blur' }],
|
||||||
|
transactionDate: [{ required: true, message: `${$t('select')}${$t('transactionDate')}`, trigger: 'blur' }],
|
||||||
|
}"
|
||||||
|
label-width="auto"
|
||||||
|
>
|
||||||
|
<!-- 绑定的用户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
|
||||||
|
@change="form.userDataList = userDataList"
|
||||||
|
>
|
||||||
|
<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('transactionDate')" prop="transactionDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.transactionDate"
|
||||||
|
:end-placeholder="$t('endDate')"
|
||||||
|
:shortcuts="shortcuts"
|
||||||
|
:start-placeholder="$t('startDate')"
|
||||||
|
class="!w-[210px]"
|
||||||
|
clearable
|
||||||
|
type="daterange"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
|
@ -4,7 +4,7 @@ import { columns } from '@/views/financial/account-bill/bill/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/account-bill/bill/utils/hooks';
|
import { deleteIds, onAdd, onDelete, onDeleteBatch, onExportBill, onSearch, onUpdate } from '@/views/financial/account-bill/bill/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';
|
||||||
|
@ -16,6 +16,7 @@ import { incomeOrExpend } from '@/enums/baseConstant';
|
||||||
import { selectUserinfo } from '@/components/Table/Userinfo/columns';
|
import { selectUserinfo } from '@/components/Table/Userinfo/columns';
|
||||||
import LoadingSvg from '@/assets/svg/loading.svg';
|
import LoadingSvg from '@/assets/svg/loading.svg';
|
||||||
import { useAdminUserStore } from '@/store/system/adminUser';
|
import { useAdminUserStore } from '@/store/system/adminUser';
|
||||||
|
import Upload from '@iconify-icons/ep/upload';
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
@ -129,6 +130,7 @@ onMounted(() => {
|
||||||
|
|
||||||
<PureTableBar :columns="columns" title="账单信息" @fullscreen="tableRef.setAdaptive()" @refresh="onSearch">
|
<PureTableBar :columns="columns" title="账单信息" @fullscreen="tableRef.setAdaptive()" @refresh="onSearch">
|
||||||
<template #buttons>
|
<template #buttons>
|
||||||
|
<el-button :icon="useRenderIcon(Upload)" type="primary" @click="onExportBill"> {{ $t('exportBill') }} </el-button>
|
||||||
<el-button :icon="useRenderIcon(AddFill)" type="primary" @click="onAdd"> {{ $t('addNew') }}</el-button>
|
<el-button :icon="useRenderIcon(AddFill)" type="primary" @click="onAdd"> {{ $t('addNew') }}</el-button>
|
||||||
|
|
||||||
<!-- 批量删除按钮 -->
|
<!-- 批量删除按钮 -->
|
||||||
|
|
|
@ -6,6 +6,8 @@ import { message, messageBox } from '@/utils/message';
|
||||||
import type { FormItemProps } from '@/views/financial/account-bill/bill/utils/types';
|
import type { FormItemProps } from '@/views/financial/account-bill/bill/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 { currentMouth } from '@/enums/dateEnums';
|
||||||
|
import ExportBill from '@/views/financial/account-bill/bill/export-bill.vue';
|
||||||
|
|
||||||
export const formRef = ref();
|
export const formRef = ref();
|
||||||
// 删除ids
|
// 删除ids
|
||||||
|
@ -132,3 +134,27 @@ export const onDeleteBatch = async () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 导出账单 */
|
||||||
|
export const onExportBill = () => {
|
||||||
|
const formExportBillRef = ref();
|
||||||
|
|
||||||
|
addDialog({
|
||||||
|
title: $t('exportBill'),
|
||||||
|
width: '30%',
|
||||||
|
props: { formInline: { transactionDate: currentMouth, userId: undefined } },
|
||||||
|
draggable: true,
|
||||||
|
fullscreenIcon: true,
|
||||||
|
closeOnClickModal: false,
|
||||||
|
contentRenderer: () => h(ExportBill, { ref: formExportBillRef }),
|
||||||
|
beforeSure: (done, { options }) => {
|
||||||
|
formExportBillRef.value.formRef.validate(async (valid: any) => {
|
||||||
|
if (!valid) return;
|
||||||
|
const result = billStore.exportBill(options.props.formInline);
|
||||||
|
if (!result) return;
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue