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