fix: 修复编辑考勤组人员展示bug
Some checks failed
/ Explore-Gitea-Actions (push) Failing after 5m22s

This commit is contained in:
fyy
2025-08-19 11:50:57 +08:00
parent 1a9927e60a
commit 87fc96500a
2 changed files with 10 additions and 11 deletions

View File

@@ -77,7 +77,7 @@ const columns = [
}, },
{ {
title: '部门', title: '部门',
dataIndex: ['dept', 'unitName'], dataIndex: ['dept', 'deptName'],
key: 'dept', key: 'dept',
width: 120, width: 120,
customRender: ({ customRender: ({
@@ -443,7 +443,7 @@ onMounted(() => {});
:columns="columns" :columns="columns"
:dataSource="tableData" :dataSource="tableData"
:pagination="false" :pagination="false"
rowKey="dept.unitId" rowKey="dept.deptId"
bordered bordered
/> />
</div> </div>

View File

@@ -44,7 +44,7 @@ const groupOptions = ref<any[]>([]); //考勤组
const areaOptions = ref<any[]>([]); //区域 const areaOptions = ref<any[]>([]); //区域
const groupMap = ref<Record<string, any>>({}); // 用于快速查找 const groupMap = ref<Record<string, any>>({}); // 用于快速查找
let tableData = reactive< let tableData = reactive<
{ dept: { unitId: string | number; unitName: string }; users: PersonVO[] }[] { dept: { deptId: string | number; deptName: string }; users: PersonVO[] }[]
>([]); //存放考勤组人员列表数据 >([]); //存放考勤组人员列表数据
const columns = [ const columns = [
{ {
@@ -56,10 +56,10 @@ const columns = [
}, },
{ {
title: '部门', title: '部门',
dataIndex: ['dept', 'unitName'], dataIndex: ['dept', 'deptName'],
key: 'dept', key: 'dept',
width: 120, width: 120,
customRender: ({ record }: { record: any }) => record.dept.unitName, customRender: ({ record }: { record: any }) => record.dept.deptName,
}, },
{ {
title: '已选人数', title: '已选人数',
@@ -124,12 +124,11 @@ function handleTableData(newTableData: any) {
if (newTableData.length === 0) { if (newTableData.length === 0) {
return; return;
} }
// 处理有数据的情况 // 处理有数据的情况
for (const newItem of newTableData) { for (const newItem of newTableData) {
// 查找是否已存在相同部门 // 查找是否已存在相同部门
const existingDeptIndex = tableData.findIndex( const existingDeptIndex = tableData.findIndex(
(item) => item.dept.unitId === newItem.dept.unitId, (item) => item.dept.deptId === newItem.dept.deptId,
); );
if (existingDeptIndex !== -1) { if (existingDeptIndex !== -1) {
@@ -191,7 +190,7 @@ const [BasicModal, modalApi] = useVbenModal({
if (!deptMap.has(deptId)) { if (!deptMap.has(deptId)) {
deptMap.set(deptId, { deptMap.set(deptId, {
dept: { unitId: deptId, unitName: deptName }, dept: { deptId: deptId, deptName: deptName },
users: [], users: [],
}); });
} }
@@ -252,8 +251,8 @@ async function handleConfirm() {
const data = formModal; const data = formModal;
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.deptId,
deptName: item.dept.unitName, deptName: item.dept.deptName,
employeeId: user.userId, employeeId: user.userId,
employeeName: user.userName, employeeName: user.userName,
})), })),
@@ -351,7 +350,7 @@ onMounted(() => {});
:columns="columns" :columns="columns"
:dataSource="tableData" :dataSource="tableData"
:pagination="false" :pagination="false"
rowKey="dept.unitId" rowKey="dept.deptId"
bordered bordered
/> />
</div> </div>