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