This commit is contained in:
xue jiahao
2024-12-10 21:19:16 +08:00
parent b928f2f3ef
commit 40cadc82d0
2 changed files with 25 additions and 54 deletions

View File

@@ -30,7 +30,7 @@
</template> </template>
<template v-slot:body-cell-actions="p"> <template v-slot:body-cell-actions="p">
<q-td :props="p"> <q-td :props="p">
<table-action-menu :row="p.row" :actions="actionList" /> <table-action-menu :row="p.row" minWidth="180px" max-width="200px" :actions="actionList" />
</q-td> </q-td>
</template> </template>
</q-table> </q-table>

View File

@@ -3,31 +3,22 @@
<div class="q-gutter-sm row items-start"> <div class="q-gutter-sm row items-start">
<q-breadcrumbs> <q-breadcrumbs>
<q-breadcrumbs-el icon="widgets" label="アプリ管理" to="/app" /> <q-breadcrumbs-el icon="widgets" label="アプリ管理" to="/app" />
<q-breadcrumbs-el :label="app?.name" /> <q-breadcrumbs-el>
</q-breadcrumbs> <template v-slot>
<a class="full-width" :href="app?.url" target="_blank" title="Kiontoneへ">
{{ app?.name }}
<q-icon
class="q-ma-xs"
name="open_in_new"
color="grey-9"
/>
</a>
</template>
</q-breadcrumbs-el>
</q-breadcrumbs>
</div> </div>
<q-table card-class="bg-grey-1" :rows="[app]" :columns="appColumns" class="q-mt-sm q-mb-lg" :loading="appLoading" hide-bottom> <q-table :rows="rows" title="バージョン履歴" :columns="columns" :loading="versionLoading" :pagination="pagination" :filter="filter" >
<template v-slot:body-cell-name="prop">
<q-td :props="prop">
<q-btn flat dense :label="prop.row.name" @click="toEditFlowPage(prop.row)" ></q-btn>
</q-td>
</template>
<template v-slot:body-cell-url="prop">
<q-td :props="prop">
<a :href="prop.row.url" target="_blank" :title="prop.row.name" >
{{ prop.row.url }}
</a>
</q-td>
</template>
<template v-slot:body-cell-actions="p">
<q-td :props="p">
<table-action-menu :row="p.row" :actions="appActionList" />
</q-td>
</template>
</q-table>
<q-table class="q-ma-md" flat bordered :rows="rows" title="バージョン履歴" :columns="columns" :loading="versionLoading" :pagination="pagination" :filter="filter" >
<template v-slot:top-right> <template v-slot:top-right>
<q-input borderless dense filled clearable debounce="300" v-model="filter" placeholder="検索"> <q-input borderless dense filled clearable debounce="300" v-model="filter" placeholder="検索">
<template v-slot:append> <template v-slot:append>
@@ -35,11 +26,12 @@
</template> </template>
</q-input> </q-input>
</template> </template>
<template v-slot:body-cell-id="p"> <template v-slot:body-cell-id="p">
<q-td :props="p"> <q-td :props="p">
<div class="flex justify-between"> <div class="flex justify-between">
<span>{{ p.row.id }}</span> <span>{{ p.row.id }}</span>
<q-badge v-if="p.row.id === app.version" color="primary">現在</q-badge> <q-badge v-if="p.row.id === app.version" color="primary">適用中</q-badge>
</div> </div>
</q-td> </q-td>
</template> </template>
@@ -60,8 +52,6 @@
<q-dialog v-model="confirmDialog" persistent> <q-dialog v-model="confirmDialog" persistent>
<q-card> <q-card>
<q-card-section class="row items-center"> <q-card-section class="row items-center">
@@ -93,20 +83,7 @@ const route = useRoute()
const $q = useQuasar(); const $q = useQuasar();
const appLoading = ref(false);
const app = ref<IAppDisplay>({} as IAppDisplay); const app = ref<IAppDisplay>({} as IAppDisplay);
const appColumns = [
{ name: 'id', label: 'ID', field: 'id', align: 'left', classes: 'q-td--no-hover' },
{ name: 'name', label: 'アプリ名', field: 'name', align: 'left', classes: 'q-td--no-hover' },
{ name: 'url', label: 'URL', field: 'url', align: 'left', classes: 'q-td--no-hover' },
{ name: 'updateUser', label: '最後更新者', field: (row: IAppDisplay) => row?.updateUser?.fullName, align: 'left', classes: 'q-td--no-hover'},
{ name: 'updateTime', label: '最後更新日', field: 'updateTime', align: 'left', classes: 'q-td--no-hover'},
{ name: 'version', label: 'バージョン', field: 'version', align: 'left', classes: 'q-td--no-hover' },
{ name: 'actions', label: '', field: 'actions', classes: 'q-td--no-hover' }
];
const appActionList = ref([
{ label: '設定', icon: 'account_tree', action: toEditFlowPage },
]);
const rows = ref<IAppVersionDisplay[]>([]); const rows = ref<IAppVersionDisplay[]>([]);
const columns = [ const columns = [
@@ -129,8 +106,6 @@ const store = useFlowEditorStore();
const confirmDialog = ref(false); const confirmDialog = ref(false);
const deleteUserLoading = ref(false); const deleteUserLoading = ref(false);
const actionList = ref([ const actionList = ref([
{ label: 'プル', icon: 'flag', action: changeVersion }, { label: 'プル', icon: 'flag', action: changeVersion },
// { label: 'プレビュー', icon: 'visibility', action: toVersionHistoryPage }, // { label: 'プレビュー', icon: 'visibility', action: toVersionHistoryPage },
@@ -138,12 +113,8 @@ const actionList = ref([
// { label: '削除', icon: 'delete_outline', class: 'text-red', action: removeRow }, // { label: '削除', icon: 'delete_outline', class: 'text-red', action: removeRow },
]); ]);
const getApps = async (suppressLoading: false) => { const getApps = async () => {
if (!suppressLoading) {
appLoading.value = true;
}
await appStore.loadApps(); await appStore.loadApps();
appLoading.value = false;
} }
const getAppById = () => { const getAppById = () => {
@@ -183,7 +154,7 @@ async function changeVersion(version: IAppVersionDisplay) {
versionLoading.value = true; versionLoading.value = true;
target.value = version; target.value = version;
await appStore.changeVersion(app.value, version); await appStore.changeVersion(app.value, version);
await getApps(true); await getApps();
getAppById(); getAppById();
versionLoading.value = false; versionLoading.value = false;
} }
@@ -198,14 +169,14 @@ async function changeVersion(version: IAppVersionDisplay) {
// } // }
// } // }
async function toEditFlowPage(app:IAppDisplay) { async function toEditFlowPage() {
store.setApp({ store.setApp({
appId: app.id, appId: app.value.id,
name: app.name name: app.value.name
}); });
store.selectFlow(undefined); store.selectFlow(undefined);
try { try {
await router.push('/FlowChart/' + app.id); await router.push('/FlowChart/' + app.value.id);
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
@@ -214,9 +185,9 @@ async function toEditFlowPage(app:IAppDisplay) {
<style lang="scss"> <style lang="scss">
.description-cell { .description-cell {
height: 50px; height: 30px;
min-width: 300px; min-width: 300px;
max-height: 50px; max-height: 30px;
white-space: break-spaces; white-space: break-spaces;
.q-scrollarea__content { .q-scrollarea__content {