diff --git a/.eslintrc.js b/.eslintrc.js index b28255c..496cfb9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -70,6 +70,7 @@ module.exports = defineConfig({ 'vue/no-v-html': 'off', 'prettier/prettier': 'off', // 芋艿:默认关闭 prettier 的 ESLint 校验,因为我们使用的是 IDE 的 Prettier 插件 '@unocss/order': 'off', // 芋艿:禁用 unocss 【css】顺序的提示,因为暂时不需要这么严格,警告也有点繁琐 - '@unocss/order-attributify': 'off' // 芋艿:禁用 unocss 【属性】顺序的提示,因为暂时不需要这么严格,警告也有点繁琐 + '@unocss/order-attributify': 'off', // 芋艿:禁用 unocss 【属性】顺序的提示,因为暂时不需要这么严格,警告也有点繁琐 + 'vue/first-attribute-linebreak': 'off' // 禁用属性换行检查,解决与格式化工具的冲突 } }) diff --git a/public.zip b/public.zip deleted file mode 100644 index 467acd8..0000000 Binary files a/public.zip and /dev/null differ diff --git a/public/map/.index.vue.swp b/public/map/.index.vue.swp deleted file mode 100644 index 05064c4..0000000 Binary files a/public/map/.index.vue.swp and /dev/null differ diff --git a/public/map/components/CompanyShorePower.vue b/public/map/components/CompanyShorePower.vue index ee82048..633cddc 100644 --- a/public/map/components/CompanyShorePower.vue +++ b/public/map/components/CompanyShorePower.vue @@ -1,7 +1,7 @@ @@ -128,11 +241,18 @@ const getStatusClass = (status: string) => { height: 100%; } +.right-two-row { + display: flex; + gap: 10px; + height: 100%; +} + .search-container { height: 100%; width: 200px; border-radius: 4px; border: 1px solid rgb(10, 130, 170); + color: #FFF; padding: 0 10px; margin-bottom: 8px; background-color: rgba(255, 255, 255, 0.1); diff --git a/public/map/components/ShipShorePower.vue b/public/map/components/ShipShorePower.vue index 4e3f936..5e0d3bc 100644 --- a/public/map/components/ShipShorePower.vue +++ b/public/map/components/ShipShorePower.vue @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/public/map/components/ShorePowerUsage.vue b/public/map/components/ShorePowerUsage.vue index d745c4d..eacfc9f 100644 --- a/public/map/components/ShorePowerUsage.vue +++ b/public/map/components/ShorePowerUsage.vue @@ -1,94 +1,165 @@ - \ No newline at end of file diff --git a/public/map/components/cesiumMap.vue b/public/map/components/cesiumMap.vue index e3c5aba..f2ce4d1 100644 --- a/public/map/components/cesiumMap.vue +++ b/public/map/components/cesiumMap.vue @@ -3,7 +3,7 @@
+ style="margin-right: 10px;">获取当前视角 --> @@ -44,7 +39,58 @@ :no-shore-power-ships="noShorePowerShips" :ship-data="shipData" /> +
@@ -73,7 +119,8 @@ const activeHeadGroup = ref(-1) interface PublicMapComponentsType { switchView: (viewName: string) => void dataWithModels: any[] - switchModelView: () => void + switchModelView: (data: any) => void + setElectricalBoxClickCallback: (callback: (data: any) => void) => void } const mapComponentRef = ref(null) @@ -94,17 +141,17 @@ const selectHeadGroup = async (value: number) => { const currentTime = ref(dayjs().format('YYYY-MM-DD HH:mm:ss')) // 总览数据 -const totalPower = ref('857525.45') -const fuelReduction = ref('108.04') -const co2Reduction = ref('574542.06') -const pm25Reduction = ref('1251.99') -const noxReduction = ref('15521.21') -const so2Reduction = ref('9004.03') +const totalPower = ref(857525.45) +const fuelReduction = ref(108.04) +const co2Reduction = ref(574542.06) +const pm25Reduction = ref(1251.99) +const noxReduction = ref(15521.21) +const so2Reduction = ref(9004.03) // 船舶岸电使用情况数据 -const berthingShips = ref('13') -const shorePowerShips = ref('3') -const noShorePowerShips = ref('10') +const berthingShips = ref(13) +const shorePowerShips = ref(3) +const noShorePowerShips = ref(10) // 船舶数据列表 const shipData = ref([ @@ -152,35 +199,44 @@ const updateTime = () => { } const selectedShip = ref(null) +const selectedElectricalBox = ref(null) +/* 回到初始视角 */ +const handleOverviewClick = () => { + mapComponentRef.value?.switchView('overview') +} + +/* 切换至模型视角 */ const handleSwitch = (item) => { console.log(item) selectedShip.value = item mapComponentRef.value?.switchModelView(item.modelInstance) } -const shorePowerStatusMap = { - 1: '待靠泊', - 2: '靠泊中', - 3: '岸电接入中', - 4: '用电中', - 5: '岸电卸载中', - 6: '岸电卸载完成', - 7: '离泊', - 9: '未使用岸电' -} +// 处理岸电箱点击事件 +const handleElectricalBoxClick = (data) => { + activeHeadGroup.value = 4 + console.log('岸电箱被点击:', data); + // 设置选中的岸电箱数据 + selectedElectricalBox.value = data; + // 这里可以添加更多的处理逻辑,比如切换到特定的视图等 +}; -// 状态转换函数 -const getShorePowerStatusText = (status: number | string) => { - const statusNum = Number(status); - console.log(status) - return shorePowerStatusMap[statusNum] || status; -} +// 关闭岸电箱详情面板 +const closeElectricalBoxInfo = () => { + activeHeadGroup.value = -1; + selectedElectricalBox.value = null; +}; // 启动定时器更新时间 let timer: NodeJS.Timeout onMounted(() => { timer = setInterval(updateTime, 1000) + + // 设置岸电箱点击回调 + if (mapComponentRef.value) { + mapComponentRef.value.setElectricalBoxClickCallback(handleElectricalBoxClick); + } }) // 组件卸载时清除所有资源 @@ -348,102 +404,6 @@ watch( { deep: true } ) -// 模拟折线图数据 -const lineChartData = ref([ - { name: '1月', value: 120 }, - { name: '2月', value: 132 }, - { name: '3月', value: 101 }, - { name: '4月', value: 134 }, - { name: '5月', value: 90 }, - { name: '6月', value: 230 }, - { name: '7月', value: 210 }, - { name: '8月', value: 150 }, - { name: '9月', value: 180 }, - { name: '10月', value: 200 }, - { name: '11月', value: 190 }, - { name: '12月', value: 220 } -]) - -// 减少燃油(吨)数据 -const fuelReductionData = ref([ - { name: '1月', value: 80 }, - { name: '2月', value: 85 }, - { name: '3月', value: 70 }, - { name: '4月', value: 90 }, - { name: '5月', value: 60 }, - { name: '6月', value: 150 }, - { name: '7月', value: 140 }, - { name: '8月', value: 100 }, - { name: '9月', value: 120 }, - { name: '10月', value: 130 }, - { name: '11月', value: 125 }, - { name: '12月', value: 145 } -]) - -// 减少二氧化碳排放(千克)数据 -const co2ReductionData = ref([ - { name: '1月', value: 200 }, - { name: '2月', value: 220 }, - { name: '3月', value: 180 }, - { name: '4月', value: 240 }, - { name: '5月', value: 160 }, - { name: '6月', value: 380 }, - { name: '7月', value: 350 }, - { name: '8月', value: 260 }, - { name: '9月', value: 300 }, - { name: '10月', value: 320 }, - { name: '11月', value: 310 }, - { name: '12月', value: 360 } -]) - -// 减少PM2.5排放(千克)数据 -const pm25ReductionData = ref([ - { name: '1月', value: 15 }, - { name: '2月', value: 18 }, - { name: '3月', value: 12 }, - { name: '4月', value: 20 }, - { name: '5月', value: 10 }, - { name: '6月', value: 35 }, - { name: '7月', value: 32 }, - { name: '8月', value: 22 }, - { name: '9月', value: 28 }, - { name: '10月', value: 30 }, - { name: '11月', value: 29 }, - { name: '12月', value: 33 } -]) - -// 减少氮氧化物(千克)数据 -const noxReductionData = ref([ - { name: '1月', value: 25 }, - { name: '2月', value: 28 }, - { name: '3月', value: 22 }, - { name: '4月', value: 30 }, - { name: '5月', value: 18 }, - { name: '6月', value: 45 }, - { name: '7月', value: 42 }, - { name: '8月', value: 32 }, - { name: '9月', value: 38 }, - { name: '10月', value: 40 }, - { name: '11月', value: 39 }, - { name: '12月', value: 43 } -]) - -// 减少二氧化硫(千克)数据 -const so2ReductionData = ref([ - { name: '1月', value: 20 }, - { name: '2月', value: 22 }, - { name: '3月', value: 18 }, - { name: '4月', value: 25 }, - { name: '5月', value: 15 }, - { name: '6月', value: 38 }, - { name: '7月', value: 35 }, - { name: '8月', value: 28 }, - { name: '9月', value: 32 }, - { name: '10月', value: 34 }, - { name: '11月', value: 33 }, - { name: '12月', value: 37 } -]) - // 三个公司的岸电使用对比数据 const companyComparisonData = ref([ { @@ -493,16 +453,6 @@ const selectedCompany = ref('华能码头') // 饼图数据 const pieChartData = ref>([]) -// 处理公司选择变化 -const handleCompanyChange = (companyName: string) => { - const selectedCompanyData = companyComparisonData.value.find(company => company.name === companyName) - if (selectedCompanyData && selectedCompanyData.children) { - pieChartData.value = selectedCompanyData.children - } else { - pieChartData.value = [] - } -} - // 初始化饼图数据 onMounted(async () => { // 默认选中华能码头的数据 @@ -561,29 +511,6 @@ const shipStatusData = computed(() => { }) }) -// 获取状态对应的样式类 -const getStatusClass = (status: string) => { - switch (status) { - case '正常': - return 'status-normal' - case '空闲': - return 'status-idle' - case '故障': - return 'status-fault' - case '异常': - return 'status-abnormal' - case '维修中': - return 'status-maintenance' - case '岸电使用中': - return 'status-shorepower' - // case '岸电故障': - // return 'status-fault' - default: - return 'status-default' - } -} - -