Merge branch 'dev-zn' into 'dev'

修复:用户信息弹窗,删除用户的问题index的取值不对的,更新为record获取

See merge request itc-framework/ma/2024/front!25
This commit is contained in:
gao yq
2025-01-14 02:31:05 +00:00

View File

@ -48,8 +48,8 @@
</template>
<template v-else>{{ column.customTitle }}</template>
</template>
<template #action="{ index }">
<a-button type="link" danger @click="handleDelete(index, 1)">删除</a-button>
<template #action="{ index, record }">
<a-button type="link" danger @click="handleDelete(index, 1, record)">删除</a-button>
</template>
</BasicTable>
</a-tab-pane>
@ -61,8 +61,8 @@
</template>
<template v-else>{{ column.customTitle }}</template>
</template>
<template #action="{ index }">
<a-button type="link" danger @click="handleDelete(index, 2)">删除</a-button>
<template #action="{ index, record }">
<a-button type="link" danger @click="handleDelete(index, 2, record)">删除</a-button>
</template>
</BasicTable>
</a-tab-pane>
@ -74,8 +74,8 @@
</template>
<template v-else>{{ column.customTitle }}</template>
</template>
<template #action="{ index }">
<a-button type="link" danger @click="handleDelete(index, 3)">删除</a-button>
<template #action="{ index, record }">
<a-button type="link" danger @click="handleDelete(index, 3, record)">删除</a-button>
</template>
</BasicTable>
</a-tab-pane>
@ -87,8 +87,8 @@
</template>
<template v-else>{{ column.customTitle }}</template>
</template>
<template #action="{ index }">
<a-button type="link" danger @click="handleDelete(index, 4)">删除</a-button>
<template #action="{ index, record }">
<a-button type="link" danger @click="handleDelete(index, 4, record)">删除</a-button>
</template>
</BasicTable>
</a-tab-pane>
@ -702,20 +702,22 @@
orgs: deptDatasource.value,
});
};
const handleDelete = (index, type) => {
switch (type) {
case 1:
roleDatasource.value.splice(index, 1);
break;
case 2:
postDatasource.value.splice(index, 1);
break;
case 3:
orgDatasource.value.splice(index, 1);
break;
case 4:
deptDatasource.value.splice(index, 1);
break;
const handleDelete = (index, type, record) => {
// 映射不同类型对应的数据源
const dataSources = {
1: roleDatasource,
2: postDatasource,
3: orgDatasource,
4: deptDatasource,
};
// 获取对应的数据源
const dataSource = dataSources[type]?.value;
if (dataSource) {
const index = dataSource.findIndex(item => item.id === record.id);
if (index !== -1) {
dataSource.splice(index, 1);
}
}
};