Revert assign role in same dialog

This commit is contained in:
xue jiahao
2024-12-16 10:09:35 +08:00
parent 6b94af76c1
commit 35270e32f5

View File

@@ -22,8 +22,7 @@
:display-value="canSharedUserFilter?`${canSharedUserFilter.fullName} ${canSharedUserFilter.email}`:''">
<template v-slot:after>
<!-- <q-select class="q-mr-sm" v-model="canSharedRole" :options="roleOptions" /> -->
<q-btn :disable="!canSharedUserFilter" :loading="addLoading" label="付与" color="primary" @click="shareTo(canSharedUserFilter as IUserDisplayWithShareRole)" />
<q-btn :disable="!canSharedUserFilter" :loading="addLoading" label="付与" color="primary" @click="shareTo(canSharedUserFilter as IUserDisplay)" />
</template>
<template v-slot:option="scope">
@@ -36,13 +35,7 @@
</q-select>
<sharing-user-list class="q-mt-md" style="height: 330px" :users="sharedUsers" :loading="loading" title="ドメイン利用権限を持つユーザー">
<template v-slot:actions="{ row }">
<div class="row no-wrap justify-end items-center">
<!-- <q-select class="col-auto" :options="roleOptions" emit-value map-options v-model="row.role" borderless dense options-dense hide-bottom-space
@update:model-value="updateSharedRole(row, $event)"/> -->
<div class="col-auto">
<q-btn round title="解除" flat color="primary" padding="xs" size="1em" :loading="row.id == removingUser?.id" icon="person_off" @click="removeShareTo(row)" />
</div>
</div>
<q-btn title="解除" flat color="primary" padding="xs" size="1em" :loading="row.id == removingUser?.id" icon="person_off" @click="removeShareTo(row)" />
</template>
</sharing-user-list>
</q-card-section>
@@ -91,11 +84,6 @@ const sharedUsersIdSet = new Set<number>();
const canSharedUsers = ref<IUserDisplayWithShareRole[]>([]);
const canSharedUserFilter = ref<IUserDisplayWithShareRole>();
const canSharedUserFilteredOptions = ref<IUserDisplayWithShareRole[]>([]);
const roleOptions = [
{ value: 0, label: '利用者' },
{ value: 1, label: '管理者' },
]
const canSharedRole = ref<{value: number, label: string}>(roleOptions[0]);
const filterFn = (val:string, update: (cb: () => void) => void) => {
update(() => {
@@ -115,7 +103,6 @@ watch(
visible.value = newValue;
sharedUsers.value = [];
canSharedUserFilter.value = undefined
canSharedRole.value = roleOptions[0];
loading.value = false;
addLoading.value = false;
if (newValue) {
@@ -166,7 +153,6 @@ const shareTo = async (user: IUserDisplayWithShareRole) => {
})
await loadShared();
canSharedUserFilter.value = undefined;
canSharedRole.value = roleOptions[0];
loading.value = false;
addLoading.value = false;
}
@@ -180,25 +166,6 @@ const removeShareTo = async (user: IUserDisplayWithShareRole) => {
removingUser.value = undefined;
};
const updateSharedRole = async (user: IUserDisplayWithShareRole, role: number) => {
Dialog.create({
message: roleOptions[role].label + 'に切り替えますか?',
persistent: true,
ok: {
color: 'primary',
label: 'はい'
},
cancel: 'いいえ',
}).onCancel(() => {
user.role = role == 0 ? 1 : 0;
}).onOk(async () => {
loading.value = true;
// TODO
// await
loading.value = false;
});
};
const loadShared = async () => {
loading.value = true;
sharedUsersIdSet.clear();