fix: 角色分配给用户列表属性错误

This commit is contained in:
TsMask
2025-03-13 16:54:21 +08:00
parent 0e238be98a
commit 3fcf79fe13
2 changed files with 13 additions and 11 deletions

View File

@@ -42,7 +42,7 @@ let queryParams = reactive({
/**角色ID */ /**角色ID */
roleId: roleId, roleId: roleId,
/**是否已分配 */ /**是否已分配 */
allocated: true, auth: true,
/**当前页数 */ /**当前页数 */
pageNum: 1, pageNum: 1,
/**每页条数 */ /**每页条数 */
@@ -207,8 +207,8 @@ function fnModalOk(userIds: string[] | number[]) {
message.loading({ content: t('common.loading'), key }); message.loading({ content: t('common.loading'), key });
authUserChecked({ authUserChecked({
checked: true, checked: true,
userIds: userIds.join(','), userIds: userIds.map(v => Number(v)),
roleId: roleId, roleId: Number(roleId),
}).then(res => { }).then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
modalState.openBySelectUser = false; modalState.openBySelectUser = false;
@@ -244,7 +244,8 @@ function fnRecordDelete(userId: string | number) {
onOk() { onOk() {
const key = 'authUserChecked'; const key = 'authUserChecked';
message.loading({ content: t('common.loading'), key }); message.loading({ content: t('common.loading'), key });
authUserChecked({ checked: false, userIds: userId, roleId: roleId }).then( const userIds = `${userId}`.split(',').map(v => Number(v));
authUserChecked({ checked: false, userIds, roleId: Number(roleId) }).then(
res => { res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success({
@@ -286,7 +287,7 @@ function fnGetList(pageNum?: number) {
queryParams.pageNum = pageNum; queryParams.pageNum = pageNum;
} }
authUserList(toRaw(queryParams)).then(res => { authUserList(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
// 取消勾选 // 取消勾选
if (tableState.selectedRowKeys.length > 0) { if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = []; tableState.selectedRowKeys = [];
@@ -294,7 +295,11 @@ function fnGetList(pageNum?: number) {
const { total, rows } = res.data; const { total, rows } = res.data;
tablePagination.total = total; tablePagination.total = total;
tableState.data = rows; tableState.data = rows;
if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) { if (
tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize &&
queryParams.pageNum !== 1
) {
tableState.loading = false; tableState.loading = false;
fnGetList(queryParams.pageNum - 1); fnGetList(queryParams.pageNum - 1);
} }
@@ -346,10 +351,7 @@ onMounted(() => {
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :xs="24"> <a-col :lg="6" :md="12" :xs="24">
<a-form-item <a-form-item :label="t('views.system.role.phone')" name="phone">
:label="t('views.system.role.phone')"
name="phone"
>
<a-input <a-input
v-model:value="queryParams.phone" v-model:value="queryParams.phone"
allow-clear allow-clear

View File

@@ -46,7 +46,7 @@ let queryParams = reactive({
/**角色ID */ /**角色ID */
roleId: props.roleId, roleId: props.roleId,
/**是否已分配 */ /**是否已分配 */
allocated: false, auth: false,
/**当前页数 */ /**当前页数 */
pageNum: 1, pageNum: 1,
/**每页条数 */ /**每页条数 */