Compare commits

...

2 Commits

Author SHA1 Message Date
fyy
8da35d2d4b Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-08-12 17:33:39 +08:00
fyy
13f79986f8 查询排班详请 2025-08-12 17:30:57 +08:00
4 changed files with 19 additions and 13 deletions

View File

@ -207,8 +207,8 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) { if (!isOpen) {
return null; return null;
} }
await getGroupList();
modalApi.modalLoading(true); modalApi.modalLoading(true);
await getGroupList();
// await markInitialized(); // await markInitialized();
modalApi.modalLoading(false); modalApi.modalLoading(false);
}, },

View File

@ -120,12 +120,13 @@ export const columns: VxeGridProps['columns'] = [
minWidth: 200, minWidth: 200,
slots: { slots: {
default: ({ row }) => { default: ({ row }) => {
if(!row.attendanceShift) return '/';
if (row.attendanceShift.startTime && row.attendanceShift.endTime) { if (row.attendanceShift.startTime && row.attendanceShift.endTime) {
if ( if (
row.attendanceShift.restEndTime && row.attendanceShift.restEndTime &&
row.attendanceShift.restStartTime row.attendanceShift.restStartTime
) { ) {
return `${row.attendanceShift.startTime}${row.attendanceShift.endTime} ${row.shift.restStartTime}${row.shift.restEndTime}`; return `${row.attendanceShift.startTime}${row.attendanceShift.endTime} ${row.attendanceShift.restStartTime}${row.attendanceShift.restEndTime}`;
} else { } else {
return `${row.attendanceShift.startTime}${row.attendanceShift.endTime}`; return `${row.attendanceShift.startTime}${row.attendanceShift.endTime}`;
} }

View File

@ -192,7 +192,6 @@ async function handleConfirm() {
}); });
} }
} }
console.log(tableData);
resetInitialized(); resetInitialized();
emit('reload', tableData); emit('reload', tableData);
tableData = []; tableData = [];

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { reactive, onMounted } from 'vue'; import { reactive, onMounted,computed } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { import {
@ -102,7 +102,7 @@ const columns = [
]; ];
const editDate = ref<string | undefined>(''); const editDate = ref<string | undefined>('');
function handleRemoveUser(row: any, user: any) { function handleRemoveUser(row: any, user: any) {
row.users = row.users.filter((u: any) => u.id !== user.id); row.users = row.users.filter((u: any) => u.userId !== user.userId);
} }
function handleRemoveRow(index: number) { function handleRemoveRow(index: number) {
tableData.splice(index, 1); tableData.splice(index, 1);
@ -133,7 +133,7 @@ function handleTableData(newTableData: any) {
for (const newUser of newItem.users) { for (const newUser of newItem.users) {
// //
const userExists = existingDept?.users.some( const userExists = existingDept?.users.some(
(existingUser) => existingUser.id === newUser.id, (existingUser) => existingUser.userId === newUser.userId,
); );
if (!userExists) { if (!userExists) {
// //
@ -159,8 +159,8 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) { if (!isOpen) {
return null; return null;
} }
await getGroupList();
modalApi.modalLoading(true); modalApi.modalLoading(true);
await getGroupList();
const { id, date } = modalApi.getData() as { const { id, date } = modalApi.getData() as {
id?: number | string; id?: number | string;
date?: string; date?: string;
@ -178,8 +178,8 @@ const [BasicModal, modalApi] = useVbenModal({
const deptMap = new Map(); const deptMap = new Map();
for (const item of record.userGroupList) { for (const item of record.userGroupList) {
const deptId = item.deptId; const deptId = item.sysUser.deptId;
const deptName = item.deptName; const deptName = item.sysUser.deptName;
if (!deptMap.has(deptId)) { if (!deptMap.has(deptId)) {
deptMap.set(deptId, { deptMap.set(deptId, {
@ -188,19 +188,23 @@ const [BasicModal, modalApi] = useVbenModal({
}); });
} }
deptMap.get(deptId).users.push({ deptMap.get(deptId).users.push({
id: item.employeeId, userId: item.sysUser.userId,
userName: item.employeeName, userName: item.sysUser.userName,
}); });
} }
// tableData // tableData
tableData.splice(0, 0, ...Array.from(deptMap.values())); tableData.splice(0, 0, ...Array.from(deptMap.values()));
} }
} }
console.log(tableData);
// await markInitialized(); // await markInitialized();
modalApi.modalLoading(false); modalApi.modalLoading(false);
}, },
}); });
const totalSelected: number = 0; const totalSelected = computed(() =>
tableData.reduce((sum, row) => sum + (row.users?.length || 0), 0),
);
async function getGroupList() { async function getGroupList() {
const res = await groupList({ const res = await groupList({
pageSize: 1000000000, pageSize: 1000000000,
@ -233,11 +237,13 @@ async function handleConfirm() {
modalApi.lock(true); modalApi.lock(true);
await formRef.value.validate(); // await formRef.value.validate(); //
const data = formModal; const data = formModal;
console.log(tableData);
data.userGroupList = tableData.flatMap((item) => data.userGroupList = tableData.flatMap((item) =>
item.users.map((user) => ({ item.users.map((user) => ({
deptId: item.dept.unitId, deptId: item.dept.unitId,
deptName: item.dept.unitName, deptName: item.dept.unitName,
employeeId: user.id, employeeId: user.userId,
employeeName: user.userName, employeeName: user.userName,
})), })),
); );