[UI] Fix behavious when delete user domain

This commit is contained in:
xue jiahao
2024-11-27 18:05:48 +08:00
parent 024645e16a
commit bca2f46ea5
8 changed files with 93 additions and 49 deletions

View File

@@ -5,7 +5,7 @@
<q-breadcrumbs-el icon="domain" label="ドメイン管理" />
</q-breadcrumbs>
</div>
<q-table title="Treats" :rows="rows" :columns="columns" row-key="id" :filter="filter" :loading="loading" :pagination="pagination">
<q-table :rows="rows" :columns="columns" row-key="id" :filter="filter" :loading="loading" :pagination="pagination">
<template v-slot:top>
<q-btn color="primary" :disable="loading" label="新規" @click="addRow" />
@@ -21,7 +21,7 @@
<q-td class="flex justify-between items-center" :props="p">
{{ p.row.name }}
<q-badge v-if="!p.row.domainActive" color="grey">未启用</q-badge>
<q-badge v-if="p.row.id == currendDomainId" color="primary">現在</q-badge>
<q-badge v-if="p.row.id == currentDomainId" color="primary">現在</q-badge>
</q-td>
</template>
@@ -145,8 +145,7 @@ const columns = [
name: 'tenantid',
required: true,
label: 'テナントID',
field: row => row.tenantid,
format: val => `${val}`,
field: 'tenantid',
align: 'left',
sortable: true,
classes: inactiveRowClass
@@ -165,7 +164,7 @@ const show = ref(false);
const confirm = ref(false);
const resetPsw = ref(false);
const currendDomainId = computed(() => authStore.currentDomain.id);
const currentDomainId = computed(() => authStore.currentDomain.id);
const tenantid = ref(authStore.currentDomain.id);
const name = ref('');
const url = ref('');
@@ -180,9 +179,8 @@ let ownerid = ref('');
const getDomain = async () => {
loading.value = true;
const userId = authStore.userId;
const result = await api.get<IDomain[]>(`api/domains`);
rows.value = result.data.data.map((item) => {
const { data } = await api.get<{data:IDomain[]}>(`api/domains`);
rows.value = data.data.map((item) => {
return {
id: item.id,
tenantid: item.tenantid,
@@ -215,6 +213,7 @@ const removeRow = (row: IDomainDisplay) => {
const deleteDomain = () => {
api.delete(`api/domain/${editId.value}`).then(() => {
getDomain();
// authStore.setCurrentDomain();
})
editId.value = 0; // set in removeRow()
};