diff --git a/package-lock.json b/package-lock.json index de63566..c862a31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "dexie": "^4.0.11", "echarts": "^5.6.0", "element-plus": "^2.9.5", + "g6-extension-vue": "^0.1.0", "jszmq": "^0.1.2", "lodash-es": "^4.17.21", "pinia": "^3.0.1", @@ -5020,6 +5021,46 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/g6-extension-vue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/g6-extension-vue/-/g6-extension-vue-0.1.0.tgz", + "integrity": "sha512-2RtL2CdcIdnrCFJYETxsI7TNtsE2m3y1oNyXQwM3EUciPMdxjet5okLk6dzY8ohLRUz8sMk4dM4cAE3ljtQXfA==", + "license": "MIT", + "dependencies": { + "@antv/g": "^6.1.27", + "vue-demi": "^0.14.10" + }, + "peerDependencies": { + "@antv/g6": ">=5.0.0", + "vue": "^2.0.0 || >=3.0.0" + } + }, + "node_modules/g6-extension-vue/node_modules/vue-demi": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", + "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", diff --git a/package.json b/package.json index 146b2f1..421b83b 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "dexie": "^4.0.11", "echarts": "^5.6.0", "element-plus": "^2.9.5", + "g6-extension-vue": "^0.1.0", "jszmq": "^0.1.2", "lodash-es": "^4.17.21", "pinia": "^3.0.1", diff --git a/src/views/testG6/components/Node.vue b/src/views/testG6/components/Node.vue index 3499f9b..9baf735 100644 --- a/src/views/testG6/components/Node.vue +++ b/src/views/testG6/components/Node.vue @@ -1,10 +1,99 @@ + + +const typeToIconMap: Record = { + [DeviceType.Ems]: { + icon: EmsIcon, + bgColor: '#0769FF' + }, + [DeviceType.Ecu]: { + icon: EcuIcon, + bgColor: '#0769FF' + }, + [DeviceType.Em]: { + icon: EmIcon, + bgColor: '#2CA02C' + }, + [DeviceType['Em-Measure']]: { + icon: EmIcon, + bgColor: '#2CA02C' + }, + [DeviceType.Bms]: { + icon: BmsIcon, + bgColor: '#FF7F50' + }, + [DeviceType.Cac]: { + icon: CacIcon, + bgColor: '#17BECF' + }, + [DeviceType.Dgs]: { + icon: DgsIcon, + bgColor: '#9467BD' + }, + [DeviceType.Ffs]: { + icon: FfsIcon, + bgColor: '#17BECF' + }, + [DeviceType.Mppt]: { + icon: MpptIcon, + bgColor: '#9467BD' + }, + [DeviceType.Pcs]: { + icon: PcsIcon, + bgColor: '#FF7F50' + }, + [DeviceType.Wpp]: { + icon: WppIcon, + bgColor: '#9467BD' + }, + [DeviceType.Tms]: { + icon: TmsIcon, + bgColor: '#17BECF' + }, +} - +const props = defineProps<{ + data: MyNodeData; +}>() + +const Device = computed(() => { + const style = typeToIconMap[props.data.data.type]; + return Object.assign(props.data.data, style); +}) + +