|
|
@ -10,7 +10,7 @@ |
|
|
<span class="title-text">岸电箱状态</span> |
|
|
<span class="title-text">岸电箱状态</span> |
|
|
</div> |
|
|
</div> |
|
|
<input class="search-container" type="text" placeholder="搜索岸电设备" v-model="storeSearchKeyword" |
|
|
<input class="search-container" type="text" placeholder="搜索岸电设备" v-model="storeSearchKeyword" |
|
|
@input="handleSearch" /> |
|
|
@input="handlStoreSearch" /> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class=" card-content"> |
|
|
<div class=" card-content"> |
|
|
@ -21,7 +21,7 @@ |
|
|
<div class="ship-table-column ship-status-header">历史</div> |
|
|
<div class="ship-table-column ship-status-header">历史</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="ship-table-body"> |
|
|
<div class="ship-table-body"> |
|
|
<div v-for="shorepower in ShorePowerList" :key="shorepower.id" class="ship-table-row" |
|
|
<div v-for="shorepower in filteredShorePowerList" :key="shorepower.id" class="ship-table-row" |
|
|
@click="handleSelectShorePower(shorepower)"> |
|
|
@click="handleSelectShorePower(shorepower)"> |
|
|
<div class="ship-table-column ship-name"> |
|
|
<div class="ship-table-column ship-name"> |
|
|
<div class="ship-icon">⚡</div> |
|
|
<div class="ship-icon">⚡</div> |
|
|
@ -66,7 +66,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
<div class="ship-table-body"> |
|
|
<div class="ship-table-body"> |
|
|
<div v-for="ship in filteredShipStatusData" :key="ship.id" class="ship-table-row" |
|
|
<div v-for="ship in filteredShipStatusData" :key="ship.id" class="ship-table-row" |
|
|
@click="handleSwitch(ship, 'ship')"> |
|
|
@click="handleSelectItem(ship)"> |
|
|
<div class="ship-table-column ship-name"> |
|
|
<div class="ship-table-column ship-name"> |
|
|
<div class="ship-icon">🚢</div> |
|
|
<div class="ship-icon">🚢</div> |
|
|
<span class="ship-name-text">{{ ship.shipBasicInfo.name }}</span> |
|
|
<span class="ship-name-text">{{ ship.shipBasicInfo.name }}</span> |
|
|
@ -92,7 +92,8 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="right" :style="`width: ${show_type === 'ship' ? '45%' : '20%'}`"> |
|
|
<div v-if="shipSelectedItem || shorepowerSelectedItem" class="right" |
|
|
|
|
|
:style="`width: ${show_type === 'ship' ? '45%' : '20%'}`"> |
|
|
<div v-if="shipSelectedItem && show_type === 'ship'" class="right-two-row"> |
|
|
<div v-if="shipSelectedItem && show_type === 'ship'" class="right-two-row"> |
|
|
<div class="card digital-twin-card--deep-blue"> |
|
|
<div class="card digital-twin-card--deep-blue"> |
|
|
<div class="card-title"> |
|
|
<div class="card-title"> |
|
|
@ -263,27 +264,6 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<!-- <div class="card digital-twin-card--deep-blue"> |
|
|
|
|
|
<div class="card-title"> |
|
|
|
|
|
<div class="vertical-line"></div> |
|
|
|
|
|
<img src="@/assets/svgs/data.svg" class="title-icon" /> |
|
|
|
|
|
<span class="title-text">岸电信息</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="card-content"> |
|
|
|
|
|
<div class="ship-detail"> |
|
|
|
|
|
<div class="detail-item"> |
|
|
|
|
|
<span class="label">停泊状态:</span> |
|
|
|
|
|
<span class="value">{{ selectedItem.shorePowerAndShip.type === 'left' ? '左舷停泊' : |
|
|
|
|
|
selectedItem.shorePowerAndShip.type === 'right' ? '右舷停泊' : selectedItem.shorePowerAndShip.type |
|
|
|
|
|
}}</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="detail-item"> |
|
|
|
|
|
<span class="label">靠泊状态:</span> |
|
|
|
|
|
<span class="value">{{ getShorePowerStatusText(selectedItem.shorePowerAndShip.status) }}</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> --> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<!-- <div v-else class="card digital-twin-card--deep-blue" style="flex: 1;"> |
|
|
<!-- <div v-else class="card digital-twin-card--deep-blue" style="flex: 1;"> |
|
|
@ -297,28 +277,17 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> --> |
|
|
</div> --> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<ShipHistoryDialog v-model="shipHistoryVisible.visible" :ship-param="shipHistoryVisible.searchParams" |
|
|
<!-- 岸电箱历史记录弹窗 --> |
|
|
|
|
|
<ShorePowerHistoryDialog v-model="shorePowerHistoryVisible.visible" :data="shorePowerHistoryData" |
|
|
|
|
|
:ship-connection-data="shorePowerConnectionData" @search="handleShorePowerHistorySearch" |
|
|
|
|
|
@ship-connection-search="handleShorePowerConnectionSearch" |
|
|
|
|
|
:shore-power-id="shorePowerHistoryVisible.shorePowerId" /> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 船舶历史记录弹窗 --> |
|
|
|
|
|
<ShipHistoryDialog v-model="shipHistoryVisible.visible" :berthing-data="shipHistoryData" |
|
|
|
|
|
:shore-power-connection-data="shipShorePowerConnectionData" @berthing-search="handleShipHistorySearch" |
|
|
|
|
|
@shore-power-connection-search="handleShipShorePowerConnectionSearch" :ship-id="shipHistoryVisible.shipId" |
|
|
|
|
|
:realtime-device-data="realtimeDeviceData" /> |
|
|
:realtime-device-data="realtimeDeviceData" /> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { ref, computed } from 'vue' |
|
|
import { ref, computed } from 'vue' |
|
|
import ShorePowerHistoryDialog from './ShorePowerHistoryDialog.vue' |
|
|
|
|
|
import ShipHistoryDialog from './ShipHistoryDialog.vue' |
|
|
import ShipHistoryDialog from './ShipHistoryDialog.vue' |
|
|
import { MapApi } from "@/api/shorepower/map"; |
|
|
import { MapApi } from "@/api/shorepower/map"; |
|
|
import { RealtimeDeviceData, ShipRespVo, ShorePowerBerth } from '@/types/shorepower'; |
|
|
import { RealtimeDeviceData, ShipRespVo, ShorePowerBerth } from '@/types/shorepower'; |
|
|
import { BERTH_TYPE, DOCK_DISTRICT, getOperationTypeLabel, HARBOR_DISTRICT, SHORE_POWER_STATUS, UNUSED_SHORE_POWER_REASON } from './dictionaryTable'; |
|
|
import { BERTH_TYPE, getOperationTypeLabel, SHORE_POWER_STATUS, UNUSED_SHORE_POWER_REASON } from './dictionaryTable'; |
|
|
import { formatDuration, formatTimestamp, getValueById, showStatus } from './utils'; |
|
|
import { formatDuration, formatTimestamp, getValueById, showStatus } from './utils'; |
|
|
// 定义组件属性 |
|
|
// 定义组件属性 |
|
|
type ShipItem = ShipRespVo & { id: string; modelInstance?: any; }; |
|
|
type ShipItem = ShipRespVo & { id: string; modelInstance?: any; }; |
|
|
@ -327,6 +296,8 @@ interface Props { |
|
|
shipStatusData: ShipItem[]; |
|
|
shipStatusData: ShipItem[]; |
|
|
shorePowerStatusData: ShipItem[]; |
|
|
shorePowerStatusData: ShipItem[]; |
|
|
realtimeDeviceData: RealtimeDeviceData[]; |
|
|
realtimeDeviceData: RealtimeDeviceData[]; |
|
|
|
|
|
shorePowerList: (ShorePowerBerth & { position: string; })[]; |
|
|
|
|
|
shipDataList: ShipRespVo[]; |
|
|
// selectedItem: ShipItem | null; |
|
|
// selectedItem: ShipItem | null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -339,77 +310,41 @@ const show_type = ref('ship') |
|
|
const shipSelectedItem = ref<ShipItem | null>(null) |
|
|
const shipSelectedItem = ref<ShipItem | null>(null) |
|
|
const shorepowerSelectedItem = ref<ShorePowerBerth & { position: string; } | null>(null) |
|
|
const shorepowerSelectedItem = ref<ShorePowerBerth & { position: string; } | null>(null) |
|
|
|
|
|
|
|
|
// 历史记录弹窗相关 |
|
|
|
|
|
const shorePowerHistoryVisible = ref({ |
|
|
|
|
|
visible: false, |
|
|
|
|
|
shorePowerId: 0 |
|
|
|
|
|
}) |
|
|
|
|
|
const shipHistoryVisible = ref({ |
|
|
const shipHistoryVisible = ref({ |
|
|
visible: false, |
|
|
visible: false, |
|
|
shipId: 0 |
|
|
searchParams: { |
|
|
|
|
|
shipId: 0 as number | null, |
|
|
|
|
|
ids: [] as number[] | null, |
|
|
|
|
|
type: 1 as number |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
const currentShorePower = ref<ShorePowerBerth | null>(null) |
|
|
const currentShorePower = ref<ShorePowerBerth | null>(null) |
|
|
const currentShip = ref<ShipItem | null>(null) |
|
|
const currentShip = ref<ShipItem | null>(null) |
|
|
|
|
|
|
|
|
const ShorePowerList = ref<(ShorePowerBerth & { position: string; })[]>([]) |
|
|
// const ShorePowerList = ref<(ShorePowerBerth & { position: string; })[]>([]) |
|
|
|
|
|
|
|
|
// 过滤后的船舶数据 |
|
|
// 过滤后的船舶数据 |
|
|
const filteredShipStatusData = computed(() => { |
|
|
const filteredShipStatusData = computed(() => { |
|
|
if (!searchKeyword.value) { |
|
|
if (!searchKeyword.value) { |
|
|
return props.shipStatusData |
|
|
return props.shipDataList |
|
|
} |
|
|
} |
|
|
return props.shipStatusData.filter(ship => |
|
|
return props.shipDataList.filter(ship => |
|
|
ship.shipBasicInfo.name.toLowerCase().includes(searchKeyword.value.toLowerCase()) |
|
|
ship.shipBasicInfo.name.toLowerCase().includes(searchKeyword.value.toLowerCase()) |
|
|
) |
|
|
) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 模拟岸电箱历史数据 |
|
|
// 过滤后的岸电箱数据 |
|
|
const shorePowerHistoryData = ref<any[]>([ |
|
|
const filteredShorePowerList = computed(() => { |
|
|
{ id: 1, time: '2023-05-01 08:30:00', operation: '连接', voltage: '380', current: '120', power: '45.6', energy: '12.5' }, |
|
|
if (!storeSearchKeyword.value) { |
|
|
{ id: 2, time: '2023-05-01 12:15:00', operation: '运行', voltage: '382', current: '118', power: '45.1', energy: '35.2' }, |
|
|
return props.shorePowerList |
|
|
{ id: 3, time: '2023-05-01 16:45:00', operation: '断开', voltage: '0', current: '0', power: '0', energy: '0' }, |
|
|
} |
|
|
{ id: 4, time: '2023-05-02 09:20:00', operation: '连接', voltage: '379', current: '122', power: '46.3', energy: '8.7' }, |
|
|
return props.shorePowerList.filter(shorepower => |
|
|
{ id: 5, time: '2023-05-02 14:30:00', operation: '运行', voltage: '381', current: '119', power: '45.4', energy: '28.9' }, |
|
|
shorepower.name.toLowerCase().includes(storeSearchKeyword.value.toLowerCase()) |
|
|
{ id: 6, time: '2023-05-02 18:50:00', operation: '断开', voltage: '0', current: '0', power: '0', energy: '0' }, |
|
|
) |
|
|
{ id: 7, time: '2023-05-03 07:45:00', operation: '连接', voltage: '380', current: '121', power: '45.9', energy: '15.3' }, |
|
|
}) |
|
|
{ id: 8, time: '2023-05-03 13:20:00', operation: '运行', voltage: '382', current: '120', power: '45.8', energy: '42.1' }, |
|
|
|
|
|
{ id: 9, time: '2023-05-03 17:30:00', operation: '断开', voltage: '0', current: '0', power: '0', energy: '0' }, |
|
|
|
|
|
{ id: 10, time: '2023-05-04 10:15:00', operation: '连接', voltage: '378', current: '123', power: '46.5', energy: '9.8' } |
|
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
// 模拟船舶靠泊历史数据 |
|
|
|
|
|
const shipHistoryData = ref<any[]>([ |
|
|
|
|
|
{ id: 1, time: '2023-04-15 09:30:00', operation: '靠泊', berthPosition: '1号泊位', duration: '12.5', powerConsumption: '125.6' }, |
|
|
|
|
|
{ id: 2, time: '2023-04-16 14:20:00', operation: '离泊', berthPosition: '1号泊位', duration: '0', powerConsumption: '0' }, |
|
|
|
|
|
{ id: 3, time: '2023-04-20 08:45:00', operation: '靠泊', berthPosition: '3号泊位', duration: '8.2', powerConsumption: '89.3' }, |
|
|
|
|
|
{ id: 4, time: '2023-04-21 16:30:00', operation: '离泊', berthPosition: '3号泊位', duration: '0', powerConsumption: '0' }, |
|
|
|
|
|
{ id: 5, time: '2023-04-25 11:15:00', operation: '靠泊', berthPosition: '2号泊位', duration: '15.7', powerConsumption: '156.8' }, |
|
|
|
|
|
{ id: 6, time: '2023-04-26 18:40:00', operation: '离泊', berthPosition: '2号泊位', duration: '0', powerConsumption: '0' }, |
|
|
|
|
|
{ id: 7, time: '2023-05-01 07:20:00', operation: '靠泊', berthPosition: '1号泊位', duration: '18.3', powerConsumption: '189.2' }, |
|
|
|
|
|
{ id: 8, time: '2023-05-02 15:50:00', operation: '离泊', berthPosition: '1号泊位', duration: '0', powerConsumption: '0' }, |
|
|
|
|
|
{ id: 9, time: '2023-05-05 09:10:00', operation: '靠泊', berthPosition: '4号泊位', duration: '6.4', powerConsumption: '67.5' }, |
|
|
|
|
|
{ id: 10, time: '2023-05-06 13:45:00', operation: '离泊', berthPosition: '4号泊位', duration: '0', powerConsumption: '0' } |
|
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
// 模拟岸电箱连接船舶数据 |
|
|
|
|
|
const shorePowerConnectionData = ref<any[]>([ |
|
|
|
|
|
{ id: 1, shipName: '远航号', time: '2023-05-01 08:30:00', duration: '4.5', powerConsumption: '125.6', status: '已断开' }, |
|
|
|
|
|
{ id: 2, shipName: '海鹰号', time: '2023-05-01 12:15:00', duration: '3.2', powerConsumption: '89.3', status: '已断开' }, |
|
|
|
|
|
{ id: 3, shipName: '巨轮号', time: '2023-05-02 09:20:00', duration: '6.8', powerConsumption: '189.2', status: '连接中' }, |
|
|
|
|
|
{ id: 4, shipName: '远洋号', time: '2023-05-03 07:45:00', duration: '2.1', powerConsumption: '67.5', status: '已断开' }, |
|
|
|
|
|
{ id: 5, shipName: '海豚号', time: '2023-05-04 10:15:00', duration: '5.3', powerConsumption: '156.8', status: '连接中' } |
|
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
// 模拟船舶连接岸电箱数据 |
|
|
|
|
|
const shipShorePowerConnectionData = ref<any[]>([ |
|
|
|
|
|
{ id: 1, shorePowerName: '1号岸电箱', time: '2023-05-01 08:30:00', duration: '4.5', powerConsumption: '125.6', status: '已断开' }, |
|
|
|
|
|
{ id: 2, shorePowerName: '2号岸电箱', time: '2023-05-01 12:15:00', duration: '3.2', powerConsumption: '89.3', status: '已断开' }, |
|
|
|
|
|
{ id: 3, shorePowerName: '1号岸电箱', time: '2023-05-02 09:20:00', duration: '6.8', powerConsumption: '189.2', status: '连接中' }, |
|
|
|
|
|
{ id: 4, shorePowerName: '3号岸电箱', time: '2023-05-03 07:45:00', duration: '2.1', powerConsumption: '67.5', status: '已断开' }, |
|
|
|
|
|
{ id: 5, shorePowerName: '2号岸电箱', time: '2023-05-04 10:15:00', duration: '5.3', powerConsumption: '156.8', status: '连接中' } |
|
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
const handleSelectItem = async (item: ShipItem) => { |
|
|
const handleSelectItem = async (item: ShipRespVo) => { |
|
|
const deviceId = item.shorePower?.totalPowerDeviceId; |
|
|
const deviceId = item.shorePower?.totalPowerDeviceId; |
|
|
const res = await MapApi.getRealtimeDataByIdList({ ids: deviceId }) |
|
|
const res = await MapApi.getRealtimeDataByIdList({ ids: deviceId }) |
|
|
console.log(res) |
|
|
console.log(res) |
|
|
@ -420,29 +355,37 @@ const handleSelectItem = async (item: ShipItem) => { |
|
|
'measureValue': res[0].measureValue || 'N/A', |
|
|
'measureValue': res[0].measureValue || 'N/A', |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
emit('item-click', { |
|
|
|
|
|
type: 'ship', |
|
|
|
|
|
item: item |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const filteredShorePowerStatusData = computed(() => { |
|
|
|
|
|
if (!storeSearchKeyword.value) { |
|
|
|
|
|
return props.shipStatusData |
|
|
|
|
|
} |
|
|
|
|
|
return props.shipStatusData.filter(ship => |
|
|
|
|
|
ship.shorePowerEquipment.name.toLowerCase().includes(storeSearchKeyword.value.toLowerCase()) |
|
|
|
|
|
) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 处理搜索输入 |
|
|
// 处理搜索输入 |
|
|
const handleSearch = () => { |
|
|
const handleSearch = () => { |
|
|
// 输入处理逻辑(如果需要额外处理可以在这里添加) |
|
|
// 输入处理逻辑(如果需要额外处理可以在这里添加) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 处理岸电箱搜索输入 |
|
|
|
|
|
const handlStoreSearch = () => { |
|
|
|
|
|
// 输入处理逻辑(如果需要额外处理可以在这里添加) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 显示岸电箱历史记录 |
|
|
// 显示岸电箱历史记录 |
|
|
const showShorePowerHistory = (shorepower: ShorePowerBerth) => { |
|
|
const showShorePowerHistory = (shorepower: ShorePowerBerth) => { |
|
|
console.log('shorepower', shorepower) |
|
|
console.log('shorepower', shorepower) |
|
|
currentShorePower.value = shorepower |
|
|
currentShorePower.value = shorepower |
|
|
shorePowerHistoryVisible.value = { |
|
|
/* shorePowerHistoryVisible.value = { |
|
|
visible: true, |
|
|
visible: true, |
|
|
shorePowerId: shorepower.id || 0 |
|
|
shorePowerId: shorepower.id || 0 |
|
|
|
|
|
} */ |
|
|
|
|
|
shipHistoryVisible.value = { |
|
|
|
|
|
visible: true, |
|
|
|
|
|
searchParams: { |
|
|
|
|
|
shipId: null, |
|
|
|
|
|
ids: [shorepower.id], |
|
|
|
|
|
type: 5, |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -452,53 +395,18 @@ const showShipHistory = (ship: ShipItem) => { |
|
|
currentShip.value = ship |
|
|
currentShip.value = ship |
|
|
shipHistoryVisible.value = { |
|
|
shipHistoryVisible.value = { |
|
|
visible: true, |
|
|
visible: true, |
|
|
shipId: ship.shipBasicInfo.id |
|
|
searchParams: { |
|
|
|
|
|
shipId: ship.shipBasicInfo.id, |
|
|
|
|
|
ids: null, |
|
|
|
|
|
type: 1, |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 处理岸电箱历史记录搜索 |
|
|
|
|
|
const handleShorePowerHistorySearch = (params: any) => { |
|
|
|
|
|
console.log('岸电箱历史记录搜索参数:', params) |
|
|
|
|
|
// 实际项目中这里会调用接口获取数据 |
|
|
|
|
|
// 模拟延迟 |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
console.log('岸电箱历史记录搜索完成') |
|
|
|
|
|
}, 500) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 处理船舶历史记录搜索 |
|
|
|
|
|
const handleShipHistorySearch = (params: any) => { |
|
|
|
|
|
console.log('船舶历史记录搜索参数:', params) |
|
|
|
|
|
// 实际项目中这里会调用接口获取数据 |
|
|
|
|
|
// 模拟延迟 |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
console.log('船舶历史记录搜索完成') |
|
|
|
|
|
}, 500) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 处理岸电箱连接船舶记录搜索 |
|
|
|
|
|
const handleShorePowerConnectionSearch = (params: any) => { |
|
|
|
|
|
console.log('岸电箱连接船舶记录搜索参数:', params) |
|
|
|
|
|
// 实际项目中这里会调用接口获取数据 |
|
|
|
|
|
// 模拟延迟 |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
console.log('岸电箱连接船舶记录搜索完成') |
|
|
|
|
|
}, 500) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 处理船舶连接岸电箱记录搜索 |
|
|
|
|
|
const handleShipShorePowerConnectionSearch = (params: any) => { |
|
|
|
|
|
console.log('船舶连接岸电箱记录搜索参数:', params) |
|
|
|
|
|
// 实际项目中这里会调用接口获取数据 |
|
|
|
|
|
// 模拟延迟 |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
console.log('船舶连接岸电箱记录搜索完成') |
|
|
|
|
|
}, 500) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 定义事件 |
|
|
// 定义事件 |
|
|
const emit = defineEmits<{ |
|
|
const emit = defineEmits<{ |
|
|
(e: 'switch-ship', ship: ShipItem): void; |
|
|
(e: 'switch-ship', ship: ShipItem): void; |
|
|
|
|
|
(e: 'item-click', item: any): void; |
|
|
// handleSelectItem(ship) |
|
|
// handleSelectItem(ship) |
|
|
|
|
|
|
|
|
}>() |
|
|
}>() |
|
|
@ -516,21 +424,14 @@ const handleSelectShorePower = async (shorepower: ShorePowerBerth & { position: |
|
|
// selectedItem.value = shorepower |
|
|
// selectedItem.value = shorepower |
|
|
shorepowerSelectedItem.value = shorepower |
|
|
shorepowerSelectedItem.value = shorepower |
|
|
show_type.value = 'shorepower' |
|
|
show_type.value = 'shorepower' |
|
|
|
|
|
emit('item-click', { |
|
|
|
|
|
type: 'shorepower_box', |
|
|
|
|
|
item: shorepower |
|
|
|
|
|
}) |
|
|
// const data = await MapApi.getRealtimeDataByIdList({ ids: shorepower.totalPowerDeviceId }) |
|
|
// const data = await MapApi.getRealtimeDataByIdList({ ids: shorepower.totalPowerDeviceId }) |
|
|
// console.log('voltageDeviceId', data) |
|
|
// console.log('voltageDeviceId', data) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const shorePowerStatusMap = { |
|
|
|
|
|
1: '待靠泊', |
|
|
|
|
|
2: '靠泊中', |
|
|
|
|
|
3: '岸电接入中', |
|
|
|
|
|
4: '用电中', |
|
|
|
|
|
5: '岸电卸载中', |
|
|
|
|
|
6: '岸电卸载完成', |
|
|
|
|
|
7: '离泊', |
|
|
|
|
|
9: '未使用岸电' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const StatusMap = { |
|
|
const StatusMap = { |
|
|
1: '故障', |
|
|
1: '故障', |
|
|
2: '故障', |
|
|
2: '故障', |
|
|
@ -549,13 +450,6 @@ const StatusText = (status: number | string) => { |
|
|
return StatusMap[statusNum] || status; |
|
|
return StatusMap[statusNum] || status; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 状态转换函数 |
|
|
|
|
|
const getShorePowerStatusText = (status: number | string) => { |
|
|
|
|
|
const statusNum = Number(status); |
|
|
|
|
|
// console.log(status) |
|
|
|
|
|
return shorePowerStatusMap[statusNum] || status; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getStatusClass = (status: string) => { |
|
|
const getStatusClass = (status: string) => { |
|
|
switch (status) { |
|
|
switch (status) { |
|
|
case '正常': |
|
|
case '正常': |
|
|
@ -579,22 +473,8 @@ const getStatusClass = (status: string) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const handleGetStorePower = async () => { |
|
|
watch(() => props.shipDataList, (newVal) => { |
|
|
// console.log('loading') |
|
|
console.log('newVal', newVal) |
|
|
const harborDistrictId = 1 |
|
|
|
|
|
const harborDistrictList = await HARBOR_DISTRICT() |
|
|
|
|
|
const dockDistrictList = await DOCK_DISTRICT() |
|
|
|
|
|
const res = await MapApi.getShorepowerIdAndNameListByHarborDistrictId(harborDistrictId) |
|
|
|
|
|
ShorePowerList.value = res.map(item => ({ |
|
|
|
|
|
...item, |
|
|
|
|
|
position: `${getOperationTypeLabel(harborDistrictId, harborDistrictList)}${getOperationTypeLabel(item.shorePowerEquipmentInfo.dockId, dockDistrictList)}${item.name} `, |
|
|
|
|
|
})) |
|
|
|
|
|
console.log('11', res) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => { |
|
|
|
|
|
await handleGetStorePower() |
|
|
|
|
|
// console.log(props.shipStatusData) |
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
|