Browse Source

system.router / 后台启动错误bugfix

master
修宁 6 months ago
parent
commit
7d59ebb6e2
  1. 23
      pnpm-lock.yaml
  2. 21
      src/editor/ModelMain.vue
  3. 30
      src/main.ts
  4. 17
      src/router/index.ts
  5. 7
      src/runtime/System.ts

23
pnpm-lock.yaml

@ -11,6 +11,9 @@ importers:
'@vueuse/core':
specifier: ^13.2.0
version: 13.2.0(vue@3.5.14(typescript@5.8.3))
echarts:
specifier: ^5.6.0
version: 5.6.0
devDependencies:
'@ease-forge/runtime':
specifier: ^1.0.15
@ -1050,6 +1053,9 @@ packages:
eastasianwidth@0.2.0:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
echarts@5.6.0:
resolution: {integrity: sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==}
electron-to-chromium@1.5.155:
resolution: {integrity: sha512-ps5KcGGmwL8VaeJlvlDlu4fORQpv3+GIcF5I3f9tUKUlJ/wsysh6HU8P5L1XWRYeXfA0oJd4PyM8ds8zTFf6Ng==}
@ -1729,6 +1735,9 @@ packages:
troika-worker-utils@0.52.0:
resolution: {integrity: sha512-W1CpvTHykaPH5brv5VHLfQo9D1OYuo0cSBEUQFFT/nBUzM8iD6Lq2/tgG/f1OelbAS1WtaTPQzE5uM49egnngw==}
tslib@2.3.0:
resolution: {integrity: sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==}
tslib@2.8.1:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
@ -1898,6 +1907,9 @@ packages:
resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==}
engines: {node: '>=18'}
zrender@5.6.1:
resolution: {integrity: sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==}
snapshots:
'@ampproject/remapping@2.3.0':
@ -2808,6 +2820,11 @@ snapshots:
eastasianwidth@0.2.0: {}
echarts@5.6.0:
dependencies:
tslib: 2.3.0
zrender: 5.6.1
electron-to-chromium@1.5.155: {}
element-plus@2.9.10(vue@3.5.14(typescript@5.8.3)):
@ -3469,6 +3486,8 @@ snapshots:
troika-worker-utils@0.52.0: {}
tslib@2.3.0: {}
tslib@2.8.1: {}
typescript@5.8.3: {}
@ -3621,3 +3640,7 @@ snapshots:
yallist@3.1.1: {}
yoctocolors@2.1.1: {}
zrender@5.6.1:
dependencies:
tslib: 2.3.0

21
src/editor/ModelMain.vue

@ -10,9 +10,12 @@
</div>
</div>
<div class="user">
<span>
<component :is="renderIcon('element User')"></component>
</span>
<span style="margin-right: 10px;">
<component :is="renderIcon('Home')" @click="toHome"></component>
</span>
<span>
<component :is="renderIcon('element User')"></component>
</span>
</div>
</div>
<div class="app-section" v-if="worldModel.state.isOpened">
@ -60,7 +63,7 @@
<Model3DViewer />
</el-tab-pane>
<el-tab-pane label="楼层定义" name="ModelFile" lazy>
<CatalogDefine/>
<CatalogDefine />
</el-tab-pane>
<el-tab-pane label="模型定义" name="ModelDataSet" lazy>
<el-empty description="暂无数据" />
@ -117,6 +120,7 @@ import CatalogDefine from './CatalogDefine.vue'
import Logo from '@/assets/images/logo.png'
import './ModelMain.less'
import EventBus from '@/runtime/EventBus.js'
import { useRouter } from 'vue-router'
export default {
components: { Model2DEditor, Model3DViewer, Split, SplitArea, CatalogDefine },
@ -188,9 +192,9 @@ export default {
}
},
computed: {
isModelOpen() {
return this.worldModel.state.isOpened;
},
isModelOpen() {
return this.worldModel.state.isOpened
},
worldModel() {
return window['worldModel']
},
@ -241,6 +245,9 @@ export default {
methods: {
renderIcon,
getWidgetBySide,
toHome() {
system.router.push({ name: 'home' })
},
setCurrentViewport(viewport) {
this.currentViewport = viewport
},

30
src/main.ts

@ -5,27 +5,27 @@ import router from './router'
import * as webIndex from '@/components/webindex'
import { directive, menusEvent, Vue3Menus } from 'vue3-menus'
import ElementPlus from 'element-plus'
import { globalConfig } from "@/config.ts";
import { globalConfig } from '@/config.ts'
import System from '@/runtime/System'
import { getCurrentUser } from "@/currentUser.ts";
import { getCurrentUser } from '@/currentUser.ts'
import 'ag-grid-community/styles/ag-grid.css'
import 'ag-grid-community/styles/ag-theme-alpine.css'
import 'element-plus/dist/index.css'
import './main.less'
async function main() {
const app = createApp(App)
app.use(createPinia())
app.use(ElementPlus)
app.component('vue3-menus', Vue3Menus)
app.directive('menus', directive)
app.config.globalProperties.$menusEvent = menusEvent
window['system'] = new System(app)
app.use(router)
app.use(webIndex)
app.mount('#app')
globalConfig();
await getCurrentUser();
const app = createApp(App)
app.use(createPinia())
app.use(ElementPlus)
app.component('vue3-menus', Vue3Menus)
app.directive('menus', directive)
app.config.globalProperties.$menusEvent = menusEvent
window['system'] = new System(app, router)
app.use(router)
app.use(webIndex)
app.mount('#app')
globalConfig()
await getCurrentUser()
}
main().finally();
main().finally()

17
src/router/index.ts

@ -20,15 +20,12 @@ const router = createRouter({
{
path: '/modelingSimulation',
name: 'modelingSimulation',
meta: {
title: '建模仿真控制平台'
},
component: () => import('@/views/modelingSimulation/index.vue')
redirect: '/editor'
},
{
path: '/taskManagement',
name: 'taskManagement',
children:[
children: [
{
path: '/taskQuery',
name: 'taskQuery',
@ -50,7 +47,7 @@ const router = createRouter({
{
path: '/log',
name: 'log',
children:[
children: [
{
path: '/upstream',
name: 'upstream',
@ -72,7 +69,7 @@ const router = createRouter({
{
path: '/device',
name: 'device',
children:[
children: [
{
path: '/points',
name: 'points',
@ -110,7 +107,7 @@ const router = createRouter({
{
path: '/inventory',
name: 'inventory',
children:[
children: [
{
path: '/query',
name: 'query',
@ -132,7 +129,7 @@ const router = createRouter({
{
path: '/user',
name: 'user',
children:[
children: [
{
path: '/users',
name: 'users',
@ -182,7 +179,7 @@ const router = createRouter({
path: '/JsDemo',
name: 'JsDemo',
component: () => import('@/pages/JsDemo.vue')
},
}
]
})

7
src/runtime/System.ts

@ -10,6 +10,7 @@ import { createShortUUID, getQueryParams, renderIcon, setQueryParam } from '@/ut
import type { showDialogOption } from '@/SystemOption'
import ShowDialogWrap from '@/components/ShowDialogWrap.vue'
import LoadingDialog from '@/components/LoadingDialog.vue'
import type { Router } from 'vue-router'
export default class System {
_ = _
@ -41,9 +42,11 @@ export default class System {
createUUID = createShortUUID
setQueryParam = setQueryParam
getQueryParams = getQueryParams
router: Router
constructor(app: App) {
constructor(app: App, router: Router) {
this.app = app
this.router = router
window['_'] = _
window['$'] = $
window['JSON5'] = JSON5
@ -290,5 +293,5 @@ export interface ShowDialogOption {
showOkButton?: boolean
cancelButtonText?: string
okButtonText?: string
onMounted?: (dialog:any)=> void;
onMounted?: (dialog: any) => void;
}

Loading…
Cancel
Save