some UI
This commit is contained in:
@@ -17,12 +17,15 @@
|
||||
</q-input>
|
||||
</template>
|
||||
|
||||
<template v-slot:body-cell-name="p">
|
||||
<q-td class="flex justify-between items-center" :props="p">
|
||||
<div>
|
||||
{{ p.row.name }}
|
||||
<!-- <q-icon class="q-ml-xs" title="共有中です" name="people" :color="p.row.domainActive ? 'grey-8' : 'grey-4'" /> -->
|
||||
</div>
|
||||
<template v-slot:header-cell-active="p">
|
||||
<q-th auto-width :props="p">
|
||||
<q-select class="filter-header" v-model="activeFilter" :options="activeOptions" @update:model-value="activeFilterUpdate" borderless
|
||||
dense options-dense hide-bottom-space/>
|
||||
</q-th>
|
||||
</template>
|
||||
|
||||
<template v-slot:body-cell-active="p">
|
||||
<q-td auto-width :props="p">
|
||||
<q-badge v-if="!p.row.domainActive" color="grey">未启用</q-badge>
|
||||
<q-badge v-if="p.row.id == currentDomainId" color="primary">現在</q-badge>
|
||||
</q-td>
|
||||
@@ -30,11 +33,31 @@
|
||||
|
||||
<template v-slot:body-cell-actions="p">
|
||||
<q-td :props="p">
|
||||
<q-btn-group flat>
|
||||
<q-btn flat color="primary" padding="xs" size="1em" icon="edit_note" @click="editRow(p.row)" />
|
||||
<q-btn flat color="primary" padding="xs" size="1em" icon="person_add_alt" @click="openShareDg(p.row)" />
|
||||
<q-btn flat color="negative" padding="xs" size="1em" icon="delete_outline" @click="removeRow(p.row)" />
|
||||
</q-btn-group>
|
||||
<q-btn flat padding="xs" round size="1em" icon="more_vert">
|
||||
<q-menu >
|
||||
<q-list dense style="min-width: 100px">
|
||||
<q-item clickable v-close-popup @click="editRow(p.row)">
|
||||
<q-item-section>
|
||||
<q-icon size="1.2em" name="edit_note" />
|
||||
</q-item-section>
|
||||
<q-item-section>編集</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="openShareDg(p.row)">
|
||||
<q-item-section>
|
||||
<q-icon size="1.2em" name="person_add_alt" />
|
||||
</q-item-section>
|
||||
<q-item-section>共有</q-item-section>
|
||||
</q-item>
|
||||
<q-separator />
|
||||
<q-item class="text-red" clickable v-close-popup @click="removeRow(p.row)">
|
||||
<q-item-section>
|
||||
<q-icon size="1.2em" name="delete_outline" />
|
||||
</q-item-section>
|
||||
<q-item-section>削除</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
</template>
|
||||
|
||||
@@ -163,10 +186,11 @@ const columns = [
|
||||
// classes: inactiveRowClass
|
||||
// },
|
||||
{ name: 'name', label: '環境名', field: 'name', align: 'left', sortable: true, classes: inactiveRowClass },
|
||||
{ name: 'active', label: 'x', align: 'left', field: 'domainActive', classes: inactiveRowClass },
|
||||
{ name: 'url', label: 'URL', field: 'url', align: 'left', sortable: true, classes: inactiveRowClass },
|
||||
{ name: 'user', label: 'ログイン名', field: 'user', align: 'left', classes: inactiveRowClass },
|
||||
{ name: 'owner', label: '所有者', field: row => row.owner.fullName, align: 'left', classes: inactiveRowClass },
|
||||
{ name: 'actions', label: '操作', field: 'actions', classes: inactiveRowClass }
|
||||
{ name: 'actions', label: '', field: 'actions', classes: inactiveRowClass }
|
||||
];
|
||||
|
||||
const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 });
|
||||
@@ -180,6 +204,10 @@ const show = ref(false);
|
||||
const confirm = ref(false);
|
||||
const resetPsw = ref(false);
|
||||
|
||||
const activeOptions = ['全データ', '启用', '未启用']
|
||||
const activeFilter = ref('全データ');
|
||||
|
||||
|
||||
const currentDomainId = computed(() => authStore.currentDomain.id);
|
||||
// const tenantid = ref(authStore.currentDomain.id);
|
||||
const name = ref('');
|
||||
@@ -194,7 +222,21 @@ let editId = ref(0);
|
||||
const shareDg = ref(false);
|
||||
const shareDomain = ref<IDomainOwnerDisplay>();
|
||||
|
||||
const getDomain = async () => {
|
||||
const activeFilterUpdate = (selected) => {
|
||||
switch (selected) {
|
||||
case '启用':
|
||||
getDomain((row) => row.domainActive)
|
||||
break;
|
||||
case '未启用':
|
||||
getDomain((row) => !row.domainActive)
|
||||
break;
|
||||
default:
|
||||
getDomain()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const getDomain = async (filter = () => true) => {
|
||||
loading.value = true;
|
||||
const { data } = await api.get<{data:IDomain[]}>(`api/domains`);
|
||||
rows.value = data.data.map((item) => {
|
||||
@@ -217,7 +259,7 @@ const getDomain = async () => {
|
||||
isSuperuser: item.owner.is_superuser,
|
||||
}
|
||||
}
|
||||
});
|
||||
}).filter(filter);
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
@@ -333,8 +375,18 @@ const onReset = () => {
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.filter-header .q-field__native {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.filter-header .q-icon {
|
||||
width: 12px;
|
||||
}
|
||||
.q-table td.inactive-row {
|
||||
color: #aaa;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
.q-table tr > td.inactive-row:last-child {
|
||||
color: inherit;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user