diff --git a/modeler/src/style.less b/modeler/src/style.less index 254371c..3d33b61 100644 --- a/modeler/src/style.less +++ b/modeler/src/style.less @@ -853,6 +853,7 @@ .ks-model-builder-content, .ks-model-builder-right { height: calc(100vh - 90px); + overflow: auto; .ant-card-body { padding: 6px; @@ -987,6 +988,7 @@ .ant-collapse-content-box { max-height: 37vh; + height: fit-content; overflow: auto; } } @@ -1555,6 +1557,44 @@ border: 1px solid #0f4a7c; color: #eee; } + + // 修复 mini 模式分页滚动条问题 + &.ant-pagination-mini { + height: 24px; + line-height: 24px; + + .ant-pagination-simple-pager { + height: 24px; + line-height: 24px; + + input { + height: 22px; + line-height: 20px; + padding: 0 4px; + margin: 0 2px; + box-sizing: border-box; + } + } + + .ant-pagination-total-text { + height: 24px; + line-height: 24px; + } + + .ant-pagination-prev, + .ant-pagination-next, + .ant-pagination-jump-prev, + .ant-pagination-jump-next { + height: 24px; + line-height: 22px; + + .ant-pagination-item-link { + height: 22px; + line-height: 20px; + padding: 0; + } + } + } } diff --git a/modeler/src/views/decision/designer/designer.vue b/modeler/src/views/decision/designer/designer.vue index 732c0d2..72b8b08 100644 --- a/modeler/src/views/decision/designer/designer.vue +++ b/modeler/src/views/decision/designer/designer.vue @@ -5,8 +5,13 @@
+ @@ -78,6 +83,7 @@ import { findAllBasicPlatforms, findAllNodeCommands } from '../api'; import type { NodeCommand, Platform } from '../types'; import { createTree, findOneTreeById, findOneTreeByPlatformId, updateTree, findSubPlatforms } from './api'; import TressCard from './trees-card.vue'; +import ScenariosCard from './scenarios-card.vue'; import NodesCard from './nodes-card.vue'; const TeleportContainer = defineComponent(getTeleport()); @@ -86,6 +92,7 @@ registerNodeElement(); export default defineComponent({ components: { + ScenariosCard, TressCard, NodesCard, Wrapper, @@ -111,11 +118,12 @@ export default defineComponent({ const selectedModelNode = ref | null>(null); const selectedNodeTaskElement = ref(null); const changed = ref(false); + const scenariosCardRef = ref | null>(null); const treesCardRef = ref | null>(null); const platforms = ref([]); const subPlatforms = ref([]); const nodeCommands = ref([]) - const currentScenarioId = ref(null); + const currentScenarioId = ref(); const currentPlatformId = ref(null); const { @@ -262,7 +270,7 @@ export default defineComponent({ const handleSelectTree = (tree: BehaviorTree) => { destroyGraph(); currentPlatformId.value = null; - currentScenarioId.value = null; + // currentScenarioId.value = undefined; console.info('handleSelectTree', tree); findOneTreeById(tree.id).then(r => { @@ -327,11 +335,13 @@ export default defineComponent({ }; const resolveQuery = ()=> { + console.log(currentRoute); + let scenarioId = Number(currentRoute.query.scenario); if (!isNaN(scenarioId)) { currentScenarioId.value = scenarioId; } else { - currentScenarioId.value = null; + currentScenarioId.value = undefined; } let platformId = Number(currentRoute.query.platform); if (!isNaN(platformId)) { @@ -341,6 +351,11 @@ export default defineComponent({ } } + // 处理选择场景 + const handleSelectScenario = (scenario: any) => { + currentScenarioId.value = scenario.id; + }; + const handleCreateTree = () => { destroyGraph(); @@ -423,15 +438,19 @@ export default defineComponent({ const init = () => { console.info('init'); + + nextTick(() => { initGraph(); window.addEventListener('resize', handleResize); console.log('节点挂载完成'); - - resolveQuery(); - - if (currentPlatformId.value) { + + resolveQuery(); + + if (currentPlatformId.value) { findOneTreeByPlatformId(currentPlatformId.value).then(r => { + console.log(r); + if (r.data) { handleSelectTree(r.data); } else { @@ -511,8 +530,10 @@ export default defineComponent({ currentScenarioId, platforms, subPlatforms, + scenariosCardRef, treesCardRef, handleCreateTree, + handleSelectScenario, currentTreeEditing, currentBehaviorTree, currentGraph, diff --git a/modeler/src/views/decision/designer/scenarios-card.vue b/modeler/src/views/decision/designer/scenarios-card.vue new file mode 100644 index 0000000..7dad255 --- /dev/null +++ b/modeler/src/views/decision/designer/scenarios-card.vue @@ -0,0 +1,179 @@ + + + + + diff --git a/modeler/src/views/decision/designer/tree.ts b/modeler/src/views/decision/designer/tree.ts index b1acb18..3704d15 100644 --- a/modeler/src/views/decision/designer/tree.ts +++ b/modeler/src/views/decision/designer/tree.ts @@ -25,6 +25,7 @@ export interface BehaviorTree { export interface BehaviorTreeRequest extends BehaviorTree { pageNum: number, pageSize: number, + scenarioId?: number, } diff --git a/modeler/src/views/decision/designer/trees-card.vue b/modeler/src/views/decision/designer/trees-card.vue index 7f73600..34f5983 100644 --- a/modeler/src/views/decision/designer/trees-card.vue +++ b/modeler/src/views/decision/designer/trees-card.vue @@ -50,19 +50,24 @@ v-model:current="behaviorTreeQuery.pageNum" :page-size="behaviorTreeQuery.pageSize" :total="totalTress" + style="position: unset; margin: 5px 0;" simple size="small" @change="handleChange" />