[feature] Add id field in FlowChart page

This commit is contained in:
xue jiahao
2024-11-18 18:47:25 +08:00
parent f26ef1dd42
commit d833ebb086
4 changed files with 41 additions and 21 deletions

View File

@@ -45,21 +45,7 @@ import { useAuthStore } from 'stores/useAuthStore';
import { useFlowEditorStore } from 'stores/flowEditor';
import { router } from 'src/router';
import { date } from 'quasar'
interface IUser{
first_name:string;
last_name:string;
email:string;
}
interface IManagedApp{
appid:string;
appname:string;
domainurl:string;
version:string;
user:IUser;
update_time:string;
}
import { IManagedApp } from 'src/types/AppTypes';
interface IAppDisplay{
id:string;
@@ -70,7 +56,6 @@ interface IAppDisplay{
updatetime:string;
}
const authStore = useAuthStore();
const columns = [
@@ -89,8 +74,6 @@ const filter = ref('');
const rows = ref<IAppDisplay[]>([]);
const store = useFlowEditorStore();
const tenantid = ref(authStore.currentDomain.id);
const getApps = async () => {
loading.value = true;
const result = await api.get('api/apps');
@@ -133,6 +116,6 @@ const editFlow = (app:IAppDisplay) => {
appId: app.id,
name: app.name
});
router.push('/FlowChart');
router.push('/FlowChart/' + app.id);
};
</script>

View File

@@ -62,16 +62,22 @@
</template>
<action-select ref="appDg" name="model" :filter="filter" type="single" @clearFilter="onClearFilter" ></action-select>
</ShowDialog>
<q-inner-loading
:showing="initLoading"
label="読み込み中..."
/>
</q-page>
</template>
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { IActionNode, ActionNode, IActionFlow, ActionFlow, RootAction, IActionProperty } from 'src/types/ActionTypes';
import { IManagedApp } from 'src/types/AppTypes';
import { storeToRefs } from 'pinia';
import { useFlowEditorStore } from 'stores/flowEditor';
import { useAuthStore } from 'stores/useAuthStore';
import { api } from 'boot/axios';
import NodeItem from 'src/components/main/NodeItem.vue';
import ShowDialog from 'components/ShowDialog.vue';
@@ -81,12 +87,15 @@ import AppDisplay from 'components/left/AppDisplay.vue';
import EventTree from 'components/left/EventTree.vue';
import { FlowCtrl } from '../control/flowctrl';
import { useQuasar } from 'quasar';
const deployLoading = ref(false);
const saveLoading = ref(false);
const initLoading = ref(true);
const drawerLeft = ref(false);
const $q = useQuasar();
const store = useFlowEditorStore();
const authStore = useAuthStore();
const route = useRoute()
const appDg = ref();
const prevNodeIfo = ref({
@@ -289,10 +298,24 @@ const onSaveAllFlow= async ()=>{
}
const fetchData = async () => {
initLoading.value = true;
if (store.appInfo === undefined && route?.params?.id !== undefined) {
const { appid, appname } = await fetchAppById(route.params.id as string);
store.setApp({
appId: appid,
name: appname
});
};
await store.loadFlow();
initLoading.value = false
drawerLeft.value = true;
}
const fetchAppById = async(id: string) => {
const result = await api.get('api/apps');
return result.data.find((item: IManagedApp) => item.appid === id ) as IManagedApp;
}
const onClearFilter=()=>{
filter.value='';
}

View File

@@ -6,7 +6,7 @@ const routes: RouteRecordRaw[] = [
component: () => import('pages/LoginPage.vue')
},
{
path:'/FlowChart',
path:'/FlowChart/:id',
component:()=>import('layouts/MainLayout.vue'),
children:[
{path:'',component:()=>import('pages/FlowChart.vue')}

View File

@@ -0,0 +1,14 @@
interface IUser {
first_name: string;
last_name: string;
email: string;
}
export interface IManagedApp {
appid: string;
appname: string;
domainurl: string;
version: string;
user: IUser;
update_time: string;
}