From c8bb551ed17fec84e1eec452639da7eecbfd489c Mon Sep 17 00:00:00 2001 From: xue jiahao Date: Fri, 6 Dec 2024 11:45:27 +0800 Subject: [PATCH] Fix text --- .../ShareDomain/ShareDomainDialog.vue | 10 +-- frontend/src/components/TableActionMenu.vue | 56 +++++++++++++++ frontend/src/layouts/MainLayout.vue | 2 +- frontend/src/pages/AppManagement.vue | 41 ++++------- frontend/src/pages/TenantDomain.vue | 71 ++++++++----------- 5 files changed, 103 insertions(+), 77 deletions(-) create mode 100644 frontend/src/components/TableActionMenu.vue diff --git a/frontend/src/components/ShareDomain/ShareDomainDialog.vue b/frontend/src/components/ShareDomain/ShareDomainDialog.vue index 580aee5..a6d6e14 100644 --- a/frontend/src/components/ShareDomain/ShareDomainDialog.vue +++ b/frontend/src/components/ShareDomain/ShareDomainDialog.vue @@ -2,7 +2,7 @@ - 「{{domain.name}}」のドメインを共有する + 「{{domain.name}}」のドメイン利用権限設定 @@ -17,12 +17,12 @@ input-debounce="0" :options="canSharedUserFilteredOptions" clearable - :placeholder="canSharedUserFilter ? '' : domain.domainActive ? '共有するユーザーを選択' : 'ドメインが有効でないため、共有ができない。'" + :placeholder="canSharedUserFilter ? '' : domain.domainActive ? '権限を付与するユーザーを選択' : 'ドメインが無効なため、権限を付与できません'" @filter="filterFn" :display-value="canSharedUserFilter?`${canSharedUserFilter.fullName} (${canSharedUserFilter.email})`:''"> - + diff --git a/frontend/src/components/TableActionMenu.vue b/frontend/src/components/TableActionMenu.vue new file mode 100644 index 0000000..43bbb95 --- /dev/null +++ b/frontend/src/components/TableActionMenu.vue @@ -0,0 +1,56 @@ + + + \ No newline at end of file diff --git a/frontend/src/layouts/MainLayout.vue b/frontend/src/layouts/MainLayout.vue index 04247fc..4d613ea 100644 --- a/frontend/src/layouts/MainLayout.vue +++ b/frontend/src/layouts/MainLayout.vue @@ -128,7 +128,7 @@ const version = process.env.version; const productName = process.env.productName; onMounted(() => { - authStore.toggleLeftMenu(); + authStore.setLeftMenu(true); }); function toggleLeftDrawer() { diff --git a/frontend/src/pages/AppManagement.vue b/frontend/src/pages/AppManagement.vue index ec5fbb6..387f249 100644 --- a/frontend/src/pages/AppManagement.vue +++ b/frontend/src/pages/AppManagement.vue @@ -30,31 +30,7 @@ @@ -83,6 +59,7 @@ import { date } from 'quasar' import { IManagedApp } from 'src/types/AppTypes'; import ShowDialog from 'src/components/ShowDialog.vue'; import AppSelectBox from 'src/components/AppSelectBox.vue'; +import TableActionMenu from 'components/TableActionMenu.vue'; interface IAppDisplay{ id:string; @@ -119,6 +96,13 @@ const appDialog = ref(); const showSelectApp=ref(false); const isAdding = ref(false); +const actionList = [ + { label: '設定', icon: 'account_tree', action: toEditFlowPage }, + { label: '履歴', icon: 'history', action: showHistory }, + { separator: true }, + { label: '削除', icon: 'delete_outline', class: 'text-red', action: removeRow }, +]; + const getApps = async () => { loading.value = true; rowIds.clear(); @@ -140,7 +124,6 @@ const getApps = async () => { } onMounted(async () => { - authStore.setLeftMenu(false); await getApps(); }); @@ -166,11 +149,11 @@ const closeSelectAppDialog = async (val: 'OK'|'Cancel') => { isAdding.value = false; } -const removeRow = (app:IAppDisplay) => { +function removeRow(app:IAppDisplay) { return } -const showHistory = (app:IAppDisplay) => { +function showHistory(app:IAppDisplay) { return } @@ -186,7 +169,7 @@ const appToAppDisplay = (app: IManagedApp) => { } } -const toEditFlowPage = (app:IAppDisplay) => { +function toEditFlowPage(app:IAppDisplay) { store.setApp({ appId: app.id, name: app.name diff --git a/frontend/src/pages/TenantDomain.vue b/frontend/src/pages/TenantDomain.vue index cc8ba07..4518044 100644 --- a/frontend/src/pages/TenantDomain.vue +++ b/frontend/src/pages/TenantDomain.vue @@ -33,31 +33,7 @@ @@ -138,7 +114,7 @@ - 共有ユーザーのチェック + ドメイン利用権限を確認中 @@ -146,7 +122,7 @@ - 共有ユーザーが存在し、キャンセルする必要がある + ドメイン利用権限が存在し、キャンセルする必要がある @@ -168,6 +144,7 @@ import { api } from 'boot/axios'; import { useAuthStore } from 'stores/useAuthStore'; import { useDomainStore } from 'stores/useDomainStore'; import ShareDomainDialog from 'components/ShareDomain/ShareDomainDialog.vue'; +import TableActionMenu from 'components/TableActionMenu.vue'; import { IDomain, IDomainOwnerDisplay, IDomainSubmit } from '../types/DomainTypes'; const authStore = useAuthStore(); @@ -204,10 +181,6 @@ 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(''); @@ -220,14 +193,21 @@ const domainActive = ref(true); const isCreate = ref(true); let editId = ref(0); const shareDg = ref(false); -const shareDomain = ref(); +const shareDomain = ref({} as IDomainOwnerDisplay); -const activeFilterUpdate = (selected) => { - switch (selected) { - case '启用': +const activeOptions = [ + { value: 0, label: '全状態' }, + { value: 1, label: '使用' }, + { value: 2, label: '未使用'} +] +const activeFilter = ref(activeOptions[0]); + +const activeFilterUpdate = (option: {value: number}) => { + switch (option.value) { + case 1: getDomain((row) => row.domainActive) break; - case '未启用': + case 2: getDomain((row) => !row.domainActive) break; default: @@ -236,7 +216,14 @@ const activeFilterUpdate = (selected) => { } } -const getDomain = async (filter = () => true) => { +const actionList = [ + { label: '編集', icon: 'edit_note', action: editRow }, + { label: '利用権限設定', icon: 'person_add_alt', action: openShareDg }, + { separator: true }, + { label: '削除', icon: 'delete_outline', class: 'text-red', action: removeRow }, +]; + +const getDomain = async (filter?: (row: IDomainOwnerDisplay) => boolean) => { loading.value = true; const { data } = await api.get<{data:IDomain[]}>(`api/domains`); rows.value = data.data.map((item) => { @@ -259,7 +246,7 @@ const getDomain = async (filter = () => true) => { isSuperuser: item.owner.is_superuser, } } - }).filter(filter); + }).filter(filter || (() => true)); loading.value = false; } @@ -274,7 +261,7 @@ const addRow = () => { show.value = true; } -const removeRow = async (row: IDomainOwnerDisplay) => { +async function removeRow(row: IDomainOwnerDisplay) { confirm.value = true; deleteLoadingState.value = -1; editId.value = row.id; @@ -295,7 +282,7 @@ const deleteDomain = () => { deleteLoadingState.value = -1; }; -const editRow = (row) => { +function editRow(row) { isCreate.value = false editId.value = row.id; // tenantid.value = row.tenantid; @@ -349,7 +336,7 @@ const onSubmit = () => { }) } -const openShareDg = (row: IDomainOwnerDisplay|number) => { +function openShareDg(row: IDomainOwnerDisplay|number) { if (typeof row === 'number') { row = rows.value.find(item => item.id === row) as IDomainOwnerDisplay; } @@ -357,7 +344,7 @@ const openShareDg = (row: IDomainOwnerDisplay|number) => { shareDg.value = true; }; -const closeShareDg = () => { +function closeShareDg() { shareDg.value = false; }