optimize: ♻️ 优化日期查询
This commit is contained in:
parent
3cea26c1f3
commit
00fe865e15
|
@ -6,7 +6,7 @@ import ReCol from '@/components/MyCol';
|
|||
import CharLine from '@/components/Analyse/char-line.vue';
|
||||
import CharPie from '@/components/Analyse/char-pie.vue';
|
||||
import { $t } from '@/plugins/i18n';
|
||||
import { currentMouth, currentWeek, currentYear } from '@/enums/dateEnums';
|
||||
import { currentMouth, currentWeek, currentYear, shortcutsAllMouth } from '@/enums/dateEnums';
|
||||
import AnalyseTable from '@/components/Analyse/table/analyse-table.vue';
|
||||
|
||||
interface Title {
|
||||
|
@ -76,6 +76,7 @@ const shortcuts = [
|
|||
{ text: $t('thisWeek'), value: currentWeek },
|
||||
{ text: $t('thisMonth'), value: currentMouth },
|
||||
{ text: $t('thisYear'), value: currentYear },
|
||||
...shortcutsAllMouth(),
|
||||
];
|
||||
|
||||
/** 选择查询日期 */
|
||||
|
@ -89,7 +90,14 @@ const onChangeDateRange = () => {
|
|||
<div>
|
||||
<el-row :gutter="24" justify="space-around">
|
||||
<!-- 分析概览 -->
|
||||
<re-col v-motion :enter="{ opacity: 1, y: 0, transition: { delay: 400 } }" :initial="{ opacity: 0, y: 100 }" :value="18" :xs="24" class="mb-[18px]">
|
||||
<re-col
|
||||
v-motion
|
||||
:enter="{ opacity: 1, y: 0, transition: { delay: 400 } }"
|
||||
:initial="{ opacity: 0, y: 100 }"
|
||||
:value="18"
|
||||
:xs="24"
|
||||
class="mb-[18px]"
|
||||
>
|
||||
<el-card class="bar-card" shadow="never">
|
||||
<div class="flex justify-between">
|
||||
<span class="text-md font-medium">{{ title.analyse }}</span>
|
||||
|
@ -129,7 +137,14 @@ const onChangeDateRange = () => {
|
|||
</re-col>
|
||||
|
||||
<!-- 数据统计表格 -->
|
||||
<re-col v-motion :enter="{ opacity: 1, y: 0, transition: { delay: 560 } }" :initial="{ opacity: 0, y: 100 }" :value="18" :xs="24" class="mb-[18px]">
|
||||
<re-col
|
||||
v-motion
|
||||
:enter="{ opacity: 1, y: 0, transition: { delay: 560 } }"
|
||||
:initial="{ opacity: 0, y: 100 }"
|
||||
:value="18"
|
||||
:xs="24"
|
||||
class="mb-[18px]"
|
||||
>
|
||||
<el-card class="h-[580px]" shadow="never">
|
||||
<div class="flex justify-between">
|
||||
<span class="text-md font-medium">{{ title.table }}</span>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import dayjs from 'dayjs';
|
||||
import { $t } from '@/plugins/i18n';
|
||||
|
||||
export const currentWeek = () => {
|
||||
const dayjs1 = [dayjs().day(1), dayjs().day(7)];
|
||||
|
@ -8,3 +9,25 @@ export const currentWeek = () => {
|
|||
export const currentMouth = [dayjs().startOf('month'), dayjs().endOf('month')];
|
||||
export const currentYear = [dayjs().startOf('year'), dayjs().endOf('year')];
|
||||
export const days = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
||||
|
||||
/**
|
||||
* 自动生成查询月份选择
|
||||
* @param start 开始月份
|
||||
* @param end 结束月份
|
||||
* @param deleteCurrentMouth 是否跳过当前月
|
||||
*/
|
||||
export const allMouth = (start = 0, end = 11, deleteCurrentMouth = true) => {
|
||||
let mouths = [...Array(end - start + 1).keys()].map(i => i + start);
|
||||
if (deleteCurrentMouth) {
|
||||
mouths = mouths.filter(mouth => mouth != dayjs().month());
|
||||
}
|
||||
|
||||
return mouths.map(mouth => [dayjs().month(mouth).startOf('month'), dayjs().month(mouth).endOf('month')]);
|
||||
};
|
||||
|
||||
/** 选择日期所有的月份 */
|
||||
export const shortcutsAllMouth = () =>
|
||||
allMouth().map((mouths, index) => ({
|
||||
text: index + 1 + $t('month'),
|
||||
value: mouths,
|
||||
}));
|
||||
|
|
|
@ -8,10 +8,10 @@ import ResetPasswordDialog from '@/components/Table/ResetPasswords.vue';
|
|||
import { removeToken } from '@/utils/auth';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const router = useRouter();
|
||||
// 重置密码表单校验Ref
|
||||
const ruleFormByRestPasswordRef = ref();
|
||||
const adminUserStore = useAdminUserStore();
|
||||
const router = useRouter();
|
||||
|
||||
// 重置密码表单
|
||||
const restPasswordForm = reactive({
|
||||
|
|
|
@ -17,12 +17,8 @@ export const columns: TableColumnList = [
|
|||
{ label: $t('userLoginLog_ipAddress'), prop: 'ipAddress', width: 140 },
|
||||
// 登录Ip归属地
|
||||
{ label: $t('userLoginLog_ipRegion'), prop: 'ipRegion' },
|
||||
// // 登录时代理
|
||||
// { label: $t('userLoginLog_userAgent'), prop: 'userAgent' },
|
||||
// 操作类型
|
||||
{ label: $t('userLoginLog_type'), prop: 'type' },
|
||||
// // 标识客户端是否是通过Ajax发送请求的
|
||||
// { label: $t('userLoginLog_xRequestedWith'), prop: 'xRequestedWith', width: 150 },
|
||||
// 创建时间也就是操作时间
|
||||
{
|
||||
label: $t('op_time'),
|
||||
|
|
|
@ -15,10 +15,18 @@ import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
|
|||
import { FormInstance } from 'element-plus';
|
||||
import { incomeOrExpend } from '@/enums/baseConstant';
|
||||
import { getCurrentMouthDate } from '@/utils/date';
|
||||
import { currentMouth, currentWeek, currentYear, shortcutsAllMouth } from '@/enums/dateEnums';
|
||||
|
||||
const tableRef = ref();
|
||||
const formRef = ref();
|
||||
const billStore = useBillUserStore();
|
||||
// 日期范围选择
|
||||
const shortcuts = [
|
||||
{ text: $t('thisWeek'), value: currentWeek },
|
||||
{ text: $t('thisMonth'), value: currentMouth },
|
||||
{ text: $t('thisYear'), value: currentYear },
|
||||
...shortcutsAllMouth(),
|
||||
];
|
||||
|
||||
/** 当前页改变时 */
|
||||
const onCurrentPageChange = async (value: number) => {
|
||||
|
@ -77,6 +85,7 @@ onMounted(() => {
|
|||
<el-date-picker
|
||||
v-model="billStore.form.date"
|
||||
:end-placeholder="$t('endDate')"
|
||||
:shortcuts="shortcuts"
|
||||
:start-placeholder="$t('startDate')"
|
||||
class="!w-[210px]"
|
||||
clearable
|
||||
|
@ -125,7 +134,9 @@ onMounted(() => {
|
|||
@page-current-change="onCurrentPageChange"
|
||||
>
|
||||
<template #operation="{ row }">
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)">
|
||||
{{ $t('modify') }}
|
||||
</el-button>
|
||||
<el-popconfirm :title="`${$t('delete')}${row.description}?`" @confirm="onDelete(row)">
|
||||
<template #reference>
|
||||
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">
|
||||
|
|
|
@ -53,7 +53,6 @@ export const columns: TableColumnList = [
|
|||
},
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
// 绑定的用户id
|
||||
{ label: $t('table.operation'), fixed: 'right', width: 210, slot: 'operation' },
|
||||
];
|
||||
|
||||
|
|
|
@ -69,7 +69,15 @@ onMounted(() => {
|
|||
|
||||
<!-- 债务类型 -->
|
||||
<el-form-item :label="$t('debtType')" prop="debtType">
|
||||
<el-select v-model="debtTrackingUserStore.form.debtType" :placeholder="$t('debtType')" class="!w-[180px]" clearable filterable remote remote-show-suffix>
|
||||
<el-select
|
||||
v-model="debtTrackingUserStore.form.debtType"
|
||||
:placeholder="$t('debtType')"
|
||||
class="!w-[180px]"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
remote-show-suffix
|
||||
>
|
||||
<el-option v-for="item in debtType" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
@ -170,7 +178,9 @@ onMounted(() => {
|
|||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)">
|
||||
{{ $t('modify') }}
|
||||
</el-button>
|
||||
<el-popconfirm :title="`${$t('delete')}?`" @confirm="onDelete(row)">
|
||||
<template #reference>
|
||||
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">
|
||||
|
|
|
@ -17,6 +17,7 @@ import { selectUserinfo } from '@/components/Table/Userinfo/columns';
|
|||
import LoadingSvg from '@/assets/svg/loading.svg';
|
||||
import { useAdminUserStore } from '@/store/system/adminUser';
|
||||
import Upload from '@iconify-icons/ep/upload';
|
||||
import { currentMouth, currentWeek, currentYear, shortcutsAllMouth } from '@/enums/dateEnums';
|
||||
|
||||
const tableRef = ref();
|
||||
const formRef = ref();
|
||||
|
@ -26,6 +27,13 @@ const userDataList = ref();
|
|||
const loading = ref(false);
|
||||
const adminUserStore = useAdminUserStore();
|
||||
const billStore = useBillStore();
|
||||
// 日期范围选择
|
||||
const shortcuts = [
|
||||
{ text: $t('thisWeek'), value: currentWeek },
|
||||
{ text: $t('thisMonth'), value: currentMouth },
|
||||
{ text: $t('thisYear'), value: currentYear },
|
||||
...shortcutsAllMouth(),
|
||||
];
|
||||
|
||||
/** 当前页改变时 */
|
||||
const onCurrentPageChange = async (value: number) => {
|
||||
|
@ -113,6 +121,7 @@ onMounted(() => {
|
|||
<el-date-picker
|
||||
v-model="billStore.form.date"
|
||||
:end-placeholder="$t('endDate')"
|
||||
:shortcuts="shortcuts"
|
||||
:start-placeholder="$t('startDate')"
|
||||
class="!w-[210px]"
|
||||
clearable
|
||||
|
@ -179,7 +188,9 @@ onMounted(() => {
|
|||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)">
|
||||
{{ $t('modify') }}
|
||||
</el-button>
|
||||
<el-popconfirm :title="`${$t('delete')}${row.description}?`" @confirm="onDelete(row)">
|
||||
<template #reference>
|
||||
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">
|
||||
|
|
|
@ -51,7 +51,6 @@ export const columns: TableColumnList = [
|
|||
},
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
// 用户名
|
||||
{ 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 },
|
||||
|
|
|
@ -150,9 +150,10 @@ export const onExportBill = () => {
|
|||
beforeSure: (done, { options }) => {
|
||||
formExportBillRef.value.formRef.validate(async (valid: any) => {
|
||||
if (!valid) return;
|
||||
const result = billStore.exportBill(options.props.formInline);
|
||||
if (!result) return;
|
||||
|
||||
const result = billStore.exportBill(options.props.formInline);
|
||||
|
||||
if (!result) return;
|
||||
done();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -4,7 +4,15 @@ import { columns } from '@/views/financial/account-bill/category/utils/columns';
|
|||
import PureTableBar from '@/components/TableBar/src/bar';
|
||||
import AddFill from '@iconify-icons/ri/add-circle-line';
|
||||
import PureTable from '@pureadmin/table';
|
||||
import { deleteIds, onAdd, onDelete, onDeleteBatch, onSearch, onUpdate, onUpdateIsBuiltin } from '@/views/financial/account-bill/category/utils/hooks';
|
||||
import {
|
||||
deleteIds,
|
||||
onAdd,
|
||||
onDelete,
|
||||
onDeleteBatch,
|
||||
onSearch,
|
||||
onUpdate,
|
||||
onUpdateIsBuiltin,
|
||||
} from '@/views/financial/account-bill/category/utils/hooks';
|
||||
import Delete from '@iconify-icons/ep/delete';
|
||||
import EditPen from '@iconify-icons/ep/edit-pen';
|
||||
import Refresh from '@iconify-icons/ep/refresh';
|
||||
|
@ -105,7 +113,9 @@ onMounted(() => {
|
|||
|
||||
<!-- 查询 -->
|
||||
<el-form-item>
|
||||
<el-button :icon="useRenderIcon('ri:search-line')" :loading="categoryStore.loading" type="primary" @click="onSearch"> {{ $t('search') }} </el-button>
|
||||
<el-button :icon="useRenderIcon('ri:search-line')" :loading="categoryStore.loading" type="primary" @click="onSearch">
|
||||
{{ $t('search') }}
|
||||
</el-button>
|
||||
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)"> {{ $t('buttons.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -176,7 +186,9 @@ onMounted(() => {
|
|||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)">
|
||||
{{ $t('modify') }}
|
||||
</el-button>
|
||||
<el-popconfirm :title="`${$t('delete')}${row.categoryName}?`" @confirm="onDelete(row)">
|
||||
<template #reference>
|
||||
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">
|
||||
|
|
|
@ -12,7 +12,6 @@ export const columns: TableColumnList = [
|
|||
{ label: $t('isBuiltin'), prop: 'isBuiltin', slot: 'isBuiltin' },
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
// 绑定的用户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 },
|
||||
|
|
|
@ -53,7 +53,6 @@ export const columns: TableColumnList = [
|
|||
},
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
// 绑定的用户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 },
|
||||
|
|
|
@ -52,7 +52,6 @@ export const columns: TableColumnList = [
|
|||
},
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
// 绑定的用户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 },
|
||||
|
|
|
@ -60,7 +60,6 @@ export const columns: TableColumnList = [
|
|||
},
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
// 绑定的用户
|
||||
{ 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 },
|
||||
|
|
|
@ -99,14 +99,30 @@ onMounted(() => {
|
|||
|
||||
<!-- 债务类型 -->
|
||||
<el-form-item :label="$t('debtType')" prop="debtType">
|
||||
<el-select v-model="debtTrackingStore.form.debtType" :placeholder="$t('debtType')" class="!w-[180px]" clearable filterable remote remote-show-suffix>
|
||||
<el-select
|
||||
v-model="debtTrackingStore.form.debtType"
|
||||
:placeholder="$t('debtType')"
|
||||
class="!w-[180px]"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
remote-show-suffix
|
||||
>
|
||||
<el-option v-for="item in debtType" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 债务状态 -->
|
||||
<el-form-item :label="$t('debtStatus')" prop="debtStatus">
|
||||
<el-select v-model="debtTrackingStore.form.debtStatus" :placeholder="$t('debtStatus')" class="!w-[180px]" clearable filterable remote remote-show-suffix>
|
||||
<el-select
|
||||
v-model="debtTrackingStore.form.debtStatus"
|
||||
:placeholder="$t('debtStatus')"
|
||||
class="!w-[180px]"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
remote-show-suffix
|
||||
>
|
||||
<el-option v-for="item in debtTracking" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
@ -127,7 +143,9 @@ onMounted(() => {
|
|||
|
||||
<!-- 搜索和重置 -->
|
||||
<el-form-item>
|
||||
<el-button :icon="useRenderIcon('ri:search-line')" :loading="debtTrackingStore.loading" type="primary" @click="onSearch"> {{ $t('search') }} </el-button>
|
||||
<el-button :icon="useRenderIcon('ri:search-line')" :loading="debtTrackingStore.loading" type="primary" @click="onSearch">
|
||||
{{ $t('search') }}
|
||||
</el-button>
|
||||
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)"> {{ $t('buttons.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -190,7 +208,9 @@ onMounted(() => {
|
|||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)">
|
||||
{{ $t('modify') }}
|
||||
</el-button>
|
||||
<el-popconfirm :title="`${$t('delete')}?`" @confirm="onDelete(row)">
|
||||
<template #reference>
|
||||
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">
|
||||
|
|
|
@ -41,7 +41,6 @@ export const columns: TableColumnList = [
|
|||
},
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
// 绑定的用户
|
||||
{ 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 },
|
||||
|
|
|
@ -10,14 +10,11 @@ import ChartLine from '@/views/welcome/components/chart-line.vue';
|
|||
import { chartData, expendData, expendPercent, form, homeRanks, incomeData, onSearch, xAxis } from '@/views/welcome/utils/hooks';
|
||||
import ChartRound from '@/views/welcome/components/chart-round.vue';
|
||||
import { $t } from '@/plugins/i18n';
|
||||
import { currentMouth, currentYear } from '@/enums/dateEnums';
|
||||
import { currentMouth, currentYear, shortcutsAllMouth } from '@/enums/dateEnums';
|
||||
|
||||
const { isDark } = useDark();
|
||||
// 日期范围选择
|
||||
const shortcuts = [
|
||||
{ text: $t('thisMonth'), value: currentMouth },
|
||||
{ text: $t('thisYear'), value: currentYear },
|
||||
];
|
||||
const shortcuts = [{ text: $t('thisMonth'), value: currentMouth }, { text: $t('thisYear'), value: currentYear }, ...shortcutsAllMouth()];
|
||||
|
||||
onMounted(() => {
|
||||
onSearch();
|
||||
|
|
Loading…
Reference in New Issue