diff --git a/.env.dev b/.env.dev index 4436bae..f9e9a5f 100644 --- a/.env.dev +++ b/.env.dev @@ -22,7 +22,7 @@ VITE_DROP_CONSOLE=false VITE_SOURCEMAP=true # 打包路径 -VITE_BASE_PATH='http://server.ayaojies.com.cn:48080' +VITE_BASE_PATH='http://106.118.88.15:48080' # 输出路径 VITE_OUT_DIR=dist diff --git a/.env.local b/.env.local index 4cfb0f3..2662574 100644 --- a/.env.local +++ b/.env.local @@ -4,7 +4,7 @@ NODE_ENV=development VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://server.ayaojies.com.cn:48080' +VITE_BASE_URL='http://106.118.88.15:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 VITE_UPLOAD_TYPE=server diff --git a/.env.prod b/.env.prod index 7bf2746..3eee7d1 100644 --- a/.env.prod +++ b/.env.prod @@ -4,7 +4,7 @@ NODE_ENV=production VITE_DEV=false # 请求路径 -VITE_BASE_URL='http://server.ayaojies.com.cn:48080' +VITE_BASE_URL='http://106.118.88.15:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 VITE_UPLOAD_TYPE=server diff --git a/.env.stage b/.env.stage index 380e3ca..a910ed0 100644 --- a/.env.stage +++ b/.env.stage @@ -4,7 +4,7 @@ NODE_ENV=production VITE_DEV=false # 请求路径 -VITE_BASE_URL='http://server.ayaojies.com.cn:48080' +VITE_BASE_URL='http://106.118.88.15:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 VITE_UPLOAD_TYPE=server diff --git a/.env.test b/.env.test index 2364857..3cdb19d 100644 --- a/.env.test +++ b/.env.test @@ -4,7 +4,7 @@ NODE_ENV=production VITE_DEV=false # 请求路径 -VITE_BASE_URL='http://server.ayaojies.com.cn:48080' +VITE_BASE_URL='http://106.118.88.15:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 VITE_UPLOAD_TYPE=server diff --git a/public/map/components/CompanyShorePower.vue b/public/map/components/CompanyShorePower.vue index fe43fab..3fff534 100644 --- a/public/map/components/CompanyShorePower.vue +++ b/public/map/components/CompanyShorePower.vue @@ -1,25 +1,31 @@ @@ -275,26 +317,16 @@ import { ref, computed } from 'vue' import ShorePowerHistoryDialog from './ShorePowerHistoryDialog.vue' import ShipHistoryDialog from './ShipHistoryDialog.vue' import { MapApi } from "@/api/shorepower/map"; +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 { formatDuration, formatTimestamp, getValueById, showStatus } from './utils'; // 定义组件属性 -interface ShipItem { - id: string; - shipBasicInfo: { - name: string; - }; - shorePowerEquipment: { - name: string; - measureValue: string; - }; - shorePowerAndShip?: { - status?: string; - powerUsage?: number; - }; - modelInstance?: any; -} +type ShipItem = ShipRespVo & { id: string; modelInstance?: any; }; interface Props { shipStatusData: ShipItem[]; shorePowerStatusData: ShipItem[]; + realtimeDeviceData: RealtimeDeviceData[]; // selectedItem: ShipItem | null; } @@ -304,34 +336,23 @@ const props = defineProps() const searchKeyword = ref('') const storeSearchKeyword = ref('') const show_type = ref('ship') -const selectedItem = ref(null) +const shipSelectedItem = ref(null) +const shorepowerSelectedItem = ref(null) // 历史记录弹窗相关 -const shorePowerHistoryVisible = ref(false) -const shipHistoryVisible = ref(false) -const currentShorePower = ref(null) +const shorePowerHistoryVisible = ref({ + visible: false, + shorePowerId: 0 +}) +const shipHistoryVisible = ref({ + visible: false, + shipId: 0 +}) +const currentShorePower = ref(null) const currentShip = ref(null) -// 岸电箱历史记录表格列 -const shorePowerHistoryColumns = [ - { prop: 'id', label: '记录ID', width: 80 }, - { prop: 'time', label: '时间', width: 180 }, - { prop: 'operation', label: '操作类型' }, - { prop: 'voltage', label: '电压(V)' }, - { prop: 'current', label: '电流(A)' }, - { prop: 'power', label: '功率(kW)' }, - { prop: 'energy', label: '用电量(kWh)' } -] - -// 船舶靠泊历史记录表格列 -const shipHistoryColumns = [ - { prop: 'id', label: '记录ID', width: 80 }, - { prop: 'time', label: '时间', width: 180 }, - { prop: 'operation', label: '操作类型' }, - { prop: 'berthPosition', label: '泊位位置' }, - { prop: 'duration', label: '停泊时长(小时)' }, - { prop: 'powerConsumption', label: '用电量(kWh)' } -] +const ShorePowerList = ref<(ShorePowerBerth & { position: string; })[]>([]) + // 过滤后的船舶数据 const filteredShipStatusData = computed(() => { if (!searchKeyword.value) { @@ -392,7 +413,7 @@ const handleSelectItem = async (item: ShipItem) => { const deviceId = item.shorePower?.totalPowerDeviceId; const res = await MapApi.getRealtimeDataByIdList({ ids: deviceId }) console.log(res) - selectedItem.value = { + shipSelectedItem.value = { ...item, shorePowerEquipment: { ...item.shorePowerEquipment, @@ -416,15 +437,23 @@ const handleSearch = () => { } // 显示岸电箱历史记录 -const showShorePowerHistory = (shorepower: ShipItem) => { +const showShorePowerHistory = (shorepower: ShorePowerBerth) => { + console.log('shorepower', shorepower) currentShorePower.value = shorepower - shorePowerHistoryVisible.value = true + shorePowerHistoryVisible.value = { + visible: true, + shorePowerId: shorepower.id || 0 + } } // 显示船舶历史记录 const showShipHistory = (ship: ShipItem) => { + console.log('ship', ship) currentShip.value = ship - shipHistoryVisible.value = true + shipHistoryVisible.value = { + visible: true, + shipId: ship.shipBasicInfo.id + } } // 处理岸电箱历史记录搜索 @@ -482,6 +511,15 @@ const handleSwitch = (ship: ShipItem, type: string) => { handleSelectItem(ship) } +const handleSelectShorePower = async (shorepower: ShorePowerBerth & { position: string }) => { + console.log('shorepower', shorepower) + // selectedItem.value = shorepower + shorepowerSelectedItem.value = shorepower + show_type.value = 'shorepower' + // const data = await MapApi.getRealtimeDataByIdList({ ids: shorepower.totalPowerDeviceId }) + // console.log('voltageDeviceId', data) +} + const shorePowerStatusMap = { 1: '待靠泊', 2: '靠泊中', @@ -493,10 +531,28 @@ const shorePowerStatusMap = { 9: '未使用岸电' } +const StatusMap = { + 1: '故障', + 2: '故障', + 3: '在线', + 4: '在线', + 5: '离线', + 6: '在线', + 8: '故障', + 9: '离线', +} + +// 状态转换函数 +const StatusText = (status: number | string) => { + const statusNum = Number(status); + // console.log(status) + return StatusMap[statusNum] || status; +} + // 状态转换函数 const getShorePowerStatusText = (status: number | string) => { const statusNum = Number(status); - console.log(status) + // console.log(status) return shorePowerStatusMap[statusNum] || status; } @@ -504,6 +560,8 @@ const getStatusClass = (status: string) => { switch (status) { case '正常': return 'status-normal' + case '在线': + return 'status-normal' case '空闲': return 'status-idle' case '故障': @@ -521,12 +579,26 @@ const getStatusClass = (status: string) => { } } -onMounted(() => { - console.log(props.shipStatusData) +const handleGetStorePower = async () => { + // console.log('loading') + 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(() => { - console.log(props.shorePowerStatusData) + // console.log(props.shorePowerStatusData) }) diff --git a/public/map/components/ShipHistoryDialog.vue b/public/map/components/ShipHistoryDialog.vue index 87f8a55..22e2652 100644 --- a/public/map/components/ShipHistoryDialog.vue +++ b/public/map/components/ShipHistoryDialog.vue @@ -7,7 +7,8 @@
- + - +
- +
@@ -56,16 +58,19 @@
- - + +
- +
@@ -80,25 +85,31 @@