增加月度账单筛选

This commit is contained in:
zhx 2026-05-29 20:55:40 +08:00
parent 2ef1aa24ea
commit b94e6db9af

View File

@ -6,6 +6,8 @@ import {
watch,
} from 'vue';
import dayjs from 'dayjs';
import { Page } from '@vben/common-ui';
import { useAccessStore } from '@vben/stores';
@ -21,6 +23,7 @@ import { getAllowedSysOrigins } from '#/views/system/shared';
import {
Button,
Card,
DatePicker,
Modal,
Select,
Space,
@ -59,6 +62,7 @@ const salarySortKey = ref<'' | SalarySortKey>('');
const salarySortOrder = ref<SalarySortOrder>('');
const query = reactive({
billBelong: dayjs().format('YYYYMM'),
countryCode: '',
cursor: 1,
limit: 20,
@ -168,7 +172,7 @@ watch(
);
watch(
[() => query.sysOrigin, () => query.countryCode, () => query.userId],
[() => query.sysOrigin, () => query.countryCode, () => query.userId, () => query.billBelong],
() => {
selectedUserIds.value = [];
},
@ -256,6 +260,13 @@ function countryLabel(code?: string) {
return `${country.phonePrefix || ''} ${country.countryName || country.aliasName || code}`;
}
function billBelongLabel() {
if (!query.billBelong || query.billBelong.length !== 6) {
return '当前账期';
}
return `${query.billBelong.slice(0, 4)}-${query.billBelong.slice(4, 6)}`;
}
function getRowKey(record: Record<string, any>) {
return String(record.id || record.userProfile?.account || record.userId || '');
}
@ -327,6 +338,7 @@ function toggleSalarySort(key?: number | string) {
async function submitManualSalary(userIds?: string[]) {
const hasSelectedUsers = !!userIds?.length;
resultRows.value = await confirmManualSalary({
billBelong: Number(query.billBelong),
countryCode: query.countryCode,
sysOrigin: query.sysOrigin,
...(hasSelectedUsers ? { userIds } : {}),
@ -354,8 +366,8 @@ function confirmPay() {
? '本次只发放已勾选的用户。'
: '未勾选用户,本次将发放当前筛选国家的所有可发工资用户。',
title: hasSelectedUsers
? `确认发放已选择的 ${userIds.length}当前账期工资?`
: `确认发放 ${countryLabel(query.countryCode)} 当前账期工资?`,
? `确认发放已选择的 ${userIds.length} ${billBelongLabel()} 工资?`
: `确认发放 ${countryLabel(query.countryCode)} ${billBelongLabel()} 工资?`,
async onOk() {
paying.value = true;
try {
@ -383,7 +395,7 @@ function settleUser(record: Record<string, any>) {
content: payableSalary < 0
? '该用户应发小于实收本次发放0并置为已结算不会对用户扣款。'
: '本次只结算当前这一行用户的工资。',
title: `确认结算用户 ${record.userProfile?.account || userId}当前账期工资?`,
title: `确认结算用户 ${record.userProfile?.account || userId} ${billBelongLabel()} 工资?`,
async onOk() {
settlingUserId.value = userId;
try {
@ -428,6 +440,16 @@ void loadCountries();
@change="loadData(true)"
@search="countryKeyword = $event"
/>
<DatePicker
v-model:value="query.billBelong"
:allow-clear="false"
format="YYYYMM"
picker="month"
placeholder="账期月份"
style="width: 140px"
value-format="YYYYMM"
@change="loadData(true)"
/>
<AccountInput
v-model:value="query.userId"
:sys-origin="query.sysOrigin"