查询排班详请
This commit is contained in:
parent
963c1ac9c0
commit
13f79986f8
@ -207,8 +207,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
await getGroupList();
|
||||
modalApi.modalLoading(true);
|
||||
await getGroupList();
|
||||
// await markInitialized();
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
|
@ -120,12 +120,13 @@ export const columns: VxeGridProps['columns'] = [
|
||||
minWidth: 200,
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
if(!row.attendanceShift) return '/';
|
||||
if (row.attendanceShift.startTime && row.attendanceShift.endTime) {
|
||||
if (
|
||||
row.attendanceShift.restEndTime &&
|
||||
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 {
|
||||
return `${row.attendanceShift.startTime}~${row.attendanceShift.endTime}`;
|
||||
}
|
||||
|
@ -192,7 +192,6 @@ async function handleConfirm() {
|
||||
});
|
||||
}
|
||||
}
|
||||
console.log(tableData);
|
||||
resetInitialized();
|
||||
emit('reload', tableData);
|
||||
tableData = [];
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, onMounted } from 'vue';
|
||||
import { reactive, onMounted,computed } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import {
|
||||
@ -102,7 +102,7 @@ const columns = [
|
||||
];
|
||||
const editDate = ref<string | undefined>('');
|
||||
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) {
|
||||
tableData.splice(index, 1);
|
||||
@ -133,7 +133,7 @@ function handleTableData(newTableData: any) {
|
||||
for (const newUser of newItem.users) {
|
||||
// 检查该用户是否已存在
|
||||
const userExists = existingDept?.users.some(
|
||||
(existingUser) => existingUser.id === newUser.id,
|
||||
(existingUser) => existingUser.userId === newUser.userId,
|
||||
);
|
||||
if (!userExists) {
|
||||
// 用户不存在,添加到现有部门
|
||||
@ -159,8 +159,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
await getGroupList();
|
||||
modalApi.modalLoading(true);
|
||||
await getGroupList();
|
||||
const { id, date } = modalApi.getData() as {
|
||||
id?: number | string;
|
||||
date?: string;
|
||||
@ -178,8 +178,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
const deptMap = new Map();
|
||||
|
||||
for (const item of record.userGroupList) {
|
||||
const deptId = item.deptId;
|
||||
const deptName = item.deptName;
|
||||
const deptId = item.sysUser.deptId;
|
||||
const deptName = item.sysUser.deptName;
|
||||
|
||||
if (!deptMap.has(deptId)) {
|
||||
deptMap.set(deptId, {
|
||||
@ -188,19 +188,23 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
});
|
||||
}
|
||||
deptMap.get(deptId).users.push({
|
||||
id: item.employeeId,
|
||||
userName: item.employeeName,
|
||||
userId: item.sysUser.userId,
|
||||
userName: item.sysUser.userName,
|
||||
});
|
||||
}
|
||||
// 转换为 tableData 格式
|
||||
tableData.splice(0, 0, ...Array.from(deptMap.values()));
|
||||
}
|
||||
}
|
||||
console.log(tableData);
|
||||
|
||||
// await markInitialized();
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
const totalSelected: number = 0;
|
||||
const totalSelected = computed(() =>
|
||||
tableData.reduce((sum, row) => sum + (row.users?.length || 0), 0),
|
||||
);
|
||||
async function getGroupList() {
|
||||
const res = await groupList({
|
||||
pageSize: 1000000000,
|
||||
@ -233,11 +237,13 @@ async function handleConfirm() {
|
||||
modalApi.lock(true);
|
||||
await formRef.value.validate(); // 先校验
|
||||
const data = formModal;
|
||||
console.log(tableData);
|
||||
|
||||
data.userGroupList = tableData.flatMap((item) =>
|
||||
item.users.map((user) => ({
|
||||
deptId: item.dept.unitId,
|
||||
deptName: item.dept.unitName,
|
||||
employeeId: user.id,
|
||||
employeeId: user.userId,
|
||||
employeeName: user.userName,
|
||||
})),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user