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