数据库不存在则创建
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/node_modules/
|
||||
/.idea
|
||||
/wwwroot
|
||||
/.playwright-cli/
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="data:," />
|
||||
<title>ECAP</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Generated
+167
-792
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -17,7 +17,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^6.1.0",
|
||||
"@antv/g6": "^5.1.1",
|
||||
"@dagrejs/dagre": "^3.1.1",
|
||||
"@xyflow/react": "^12.11.2",
|
||||
"antd": "^5.29.1",
|
||||
"axios": "^1.8.4",
|
||||
"cesium": "^1.143.0",
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import {useEffect, useRef, useState} from "react"
|
||||
import {amis_fetcher} from "./amis_fetcher.ts"
|
||||
import {embed_amis} from "./amis_runtime.ts"
|
||||
import {embed_amis, type Amis_Fetcher} from "./amis_runtime.ts"
|
||||
type Amis_Panel_Props = {
|
||||
schema: Record<string, unknown>
|
||||
data?: Record<string, unknown>
|
||||
fetcher?: Amis_Fetcher
|
||||
}
|
||||
export function AmisPanel({schema}: Amis_Panel_Props) {
|
||||
export function AmisPanel({schema, data, fetcher = amis_fetcher}: Amis_Panel_Props) {
|
||||
const container = useRef<HTMLDivElement>(null)
|
||||
const [error, set_error] = useState("")
|
||||
useEffect(() => {
|
||||
@@ -13,11 +15,11 @@ export function AmisPanel({schema}: Amis_Panel_Props) {
|
||||
}
|
||||
set_error("")
|
||||
try {
|
||||
const scoped = embed_amis(container.current, schema, amis_fetcher)
|
||||
const scoped = embed_amis(container.current, schema, fetcher, data)
|
||||
return () => scoped.unmount()
|
||||
} catch (reason) {
|
||||
set_error(reason instanceof Error ? reason.message : String(reason))
|
||||
}
|
||||
}, [schema])
|
||||
}, [data, fetcher, schema])
|
||||
return error ? <div style={{color: "#ff4d4f"}}>{error}</div> : <div ref={container} />
|
||||
}
|
||||
|
||||
+700
-247
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
.ecap-amis-overlay-root {
|
||||
position: fixed !important;
|
||||
inset: 0 !important;
|
||||
z-index: 2000 !important;
|
||||
background: transparent !important;
|
||||
overflow: visible !important;
|
||||
pointer-events: none !important;
|
||||
}
|
||||
.ecap-amis-overlay-root > * {
|
||||
pointer-events: auto !important;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import "./amis_runtime.css"
|
||||
type Amis_Request = {
|
||||
url: string
|
||||
method?: string
|
||||
@@ -6,7 +7,7 @@ type Amis_Request = {
|
||||
responseType?: XMLHttpRequest["responseType"]
|
||||
config?: Record<string, unknown>
|
||||
}
|
||||
type Amis_Fetcher = (request: Amis_Request) => Promise<unknown>
|
||||
export type Amis_Fetcher = (request: Amis_Request) => Promise<unknown>
|
||||
interface Amis_Scoped {
|
||||
unmount(): void
|
||||
}
|
||||
@@ -19,10 +20,19 @@ declare global {
|
||||
}
|
||||
}
|
||||
export type {Amis_Request}
|
||||
export function embed_amis(container: HTMLElement, schema: Record<string, unknown>, fetcher: Amis_Fetcher): Amis_Scoped {
|
||||
if (!window.amisRequire) {
|
||||
let overlay_root: HTMLDivElement | null = null
|
||||
function get_overlay_root(): HTMLDivElement {
|
||||
if(overlay_root)
|
||||
return overlay_root
|
||||
overlay_root = document.createElement("div")
|
||||
overlay_root.className = "amis-scope ecap-amis-overlay-root"
|
||||
document.body.appendChild(overlay_root)
|
||||
return overlay_root
|
||||
}
|
||||
export function embed_amis(container: HTMLElement, schema: Record<string, unknown>, fetcher: Amis_Fetcher, data: Record<string, unknown> = {}): Amis_Scoped {
|
||||
if(!window.amisRequire) {
|
||||
throw new Error("AMIS SDK runtime is not loaded")
|
||||
}
|
||||
const module = window.amisRequire("amis/embed") as Amis_Embed_Module
|
||||
return module.embed(container, schema, {}, {fetcher, theme: "cxd"})
|
||||
return module.embed(container, schema, {data}, {fetcher, getModalContainer: get_overlay_root, theme: "cxd"})
|
||||
}
|
||||
|
||||
+3
-1
@@ -139,10 +139,12 @@ const spaAliasPaths = new Set([
|
||||
'/map3d',
|
||||
'/aircraftlist',
|
||||
'/settings',
|
||||
'/topology',
|
||||
'/ui/map',
|
||||
'/ui/map3d',
|
||||
'/ui/aircraftlist',
|
||||
'/ui/settings'
|
||||
'/ui/settings',
|
||||
'/ui/topology'
|
||||
])
|
||||
function spaAliasesPlugin() {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user