style:产线运行看板-接口添加orgId入参,产量趋势模块对接

main
黄伟杰 5 days ago
parent 68eb8d86ec
commit d26482d4cb

@ -73,8 +73,8 @@ getPlan: async () => {
getTodoList: async () => {
return await request.get({ url: `/mes/dashboard/getTodoList` })
},
getDeviceOperationalStatus: async () => {
return await request.get({ url: `/iot/device/getDeviceOperationalStatus` })
getDeviceOperationalStatus: async (params?: any) => {
return await request.get({ url: `/iot/device/getDeviceOperationalStatus`, params })
},
getDeviceRepairLineOptions: async () => {
return await request.get({ url: `/mes/dashboard/getDeviceRepairLineOptions` })
@ -85,11 +85,11 @@ getDeviceTypePieOptions: async () => {
getMoldTypeBarOptions: async () => {
return await request.get({ url: `/mes/dashboard/getMoldTypeBarOptions` })
},
getTaskStatistics: async () => {
return await request.get<TaskStatisticsResponse>({ url: `/mes/dashboard/getTaskStatistics` })
getTaskStatistics: async (params?: any) => {
return await request.get<TaskStatisticsResponse>({ url: `/mes/dashboard/getTaskStatistics`, params })
},
getAllTaskList: async () => {
return await request.get<DashboardTaskListResponse>({ url: `/mes/dashboard/getAllTaskList` })
getAllTaskList: async (params?: any) => {
return await request.get<DashboardTaskListResponse>({ url: `/mes/dashboard/getAllTaskList`, params })
}
}

@ -98,7 +98,7 @@ export const DeviceApi = {
},
// 批量获取设备属性列表
getDeviceAttributeBatchList: async (params: { deviceIds: string }) => {
getDeviceAttributeBatchList: async (params: { deviceIds: string; orgId?: number | string }) => {
return await request.get({ url: `/iot/device/device-attribute/batchList`, params })
},
// 修改物联设备

@ -24,5 +24,9 @@ export const DeviceWarningRecordApi = {
// 获得实时报警记录列表
getList: async (params?: any) => {
return await request.get({ url: `/iot/device-warinning-record/getList`, params })
},
// 获得最近7小时产量
getLastSevenHoursCount: async (params?: any) => {
return await request.get({ url: `/iot/device-warinning-record/getLastSevenHoursCount`, params })
}
}

@ -43,7 +43,7 @@ export const EnergyTypeApi = {
},
// 获得能耗类型列表
getEnergyTypeList: async () => {
return await request.get({ url: `/mes/energy-type/list`})
getEnergyTypeList: async (params?: any) => {
return await request.get({ url: `/mes/energy-type/list`, params })
},
}

@ -47,10 +47,10 @@
</div>
</div>
<div class="header-right">
<div class="back-btn" @click="goBack">
<!-- <div class="back-btn" @click="goBack">
<Icon icon="ep:back" />
<span>返回</span>
</div>
</div> -->
<div class="weather">
<Icon icon="fa-solid:cloud-sun" class="weather-icon" />
<div class="weather-meta">

@ -37,7 +37,7 @@ let chart: echarts.ECharts | null = null
const getEnergyTypes = async () => {
try {
const res = await EnergyTypeApi.getEnergyTypeList()
const res = await EnergyTypeApi.getEnergyTypeList({ orgId })
const list = (res as any).data || (Array.isArray(res) ? res : [])
energyTypes.value = list
if (list.length > 0) {

@ -13,27 +13,60 @@
<script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import * as echarts from 'echarts'
import { colors, style } from '../utils'
import { DeviceWarningRecordApi } from '@/api/iot/deviceWarningRecord'
const route = useRoute()
const chartRef = ref<HTMLElement | null>(null)
let chart: echarts.ECharts | null = null
const render = () => {
const render = async () => {
if (!chart) return
const x = ['9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00']
const output = [320, 460, 520, 610, 720, 690, 780]
const passRate = [98.5, 99.2, 98.1, 98.9, 99.0, 98.6, 99.3]
let x: string[] = []
let output: number[] = []
try {
const orgId = route.query.orgId
const res = await DeviceWarningRecordApi.getLastSevenHoursCount({ orgId })
const raw = res && typeof res === 'object' && 'data' in (res as any) ? (res as any).data : res
const list = Array.isArray(raw) ? raw : []
if (list.length > 0) {
x = list.map((item: any) => {
const h = item.hour || item.time || item.key || item.name || ''
if (typeof h === 'string' && h.includes(' ')) {
return h.split(' ')[1]
}
return h
})
output = list.map((item: any) => {
const val = item.count ?? item.value ?? item.output ?? 0
const n = Number(val)
return Number.isFinite(n) ? n : 0
})
}
} catch (e) {
console.error('Fetch production trend failed:', e)
}
chart.setOption({
backgroundColor: 'transparent',
tooltip: { trigger: 'axis' },
grid: { top: '18%', left: '6%', right: '6%', bottom: '12%', containLabel: true },
xAxis: { type: 'category', data: x, axisLine: style.axisLine, axisLabel: { ...style.axisLabel, fontSize: 10 } },
yAxis: [
{ type: 'value', axisLine: { show: false }, axisLabel: { ...style.axisLabel, fontSize: 10 }, splitLine: style.splitLine },
{ type: 'value', min: 96, max: 100, axisLine: { show: false }, axisLabel: { ...style.axisLabel, fontSize: 10 }, splitLine: { show: false } }
],
grid: { top: '18%', left: '6%', right: '6%', bottom: '16%', containLabel: true },
xAxis: {
type: 'category',
data: x,
axisLine: style.axisLine,
axisLabel: { ...style.axisLabel, fontSize: 10, rotate: 40 }
},
yAxis: {
type: 'value',
axisLine: { show: false },
axisLabel: { ...style.axisLabel, fontSize: 10 },
splitLine: style.splitLine
},
series: [
{
name: '产量',
@ -47,15 +80,6 @@ const render = () => {
])
},
data: output
},
{
name: '良率',
type: 'line',
yAxisIndex: 1,
smooth: true,
showSymbol: false,
lineStyle: { width: 2, color: colors.cyan },
data: passRate
}
]
})

@ -99,6 +99,7 @@ import ProductionTrend from './components/ProductionTrend.vue'
const route = useRoute()
const deviceIds = route.query.deviceIds as string
const orgId = route.query.orgId
interface DeviceAttribute {
attributeName: string
@ -129,7 +130,7 @@ const getBottomLeft = (index: number) => {
const loadDeviceAttributes = async () => {
if (!deviceIds) return
try {
const res = await DeviceApi.getDeviceAttributeBatchList({ deviceIds })
const res = await DeviceApi.getDeviceAttributeBatchList({ deviceIds, orgId })
const list = (res && Array.isArray(res) ? res : []) as any[]
// list deviceIds deviceId

@ -11,10 +11,10 @@
</div>
</div>
<div class="header-right">
<el-button class="back-btn" type="primary" size="small" plain @click="goBack">
<!-- <el-button class="back-btn" type="primary" size="small" plain @click="goBack">
<Icon icon="fa-solid:arrow-left" class="back-icon" />
<span>返回</span>
</el-button>
</el-button> -->
<span class="chip">
<Icon icon="fa-regular:clock" class="chip-icon" />
<span>{{ timeStr }}</span>

@ -39,7 +39,7 @@ let chart: echarts.ECharts | null = null
const getEnergyTypes = async () => {
try {
const res = await EnergyTypeApi.getEnergyTypeList()
const res = await EnergyTypeApi.getEnergyTypeList({ orgId })
const list = (res as any).data || (Array.isArray(res) ? res : [])
energyTypes.value = list
if (list.length > 0 && !selectedEnergyTypeId.value) {
@ -110,14 +110,6 @@ const render = (data: any = []) => {
])
},
data: actual
},
{
name: '基准能耗(kWh)',
type: 'line',
smooth: true,
showSymbol: false,
lineStyle: { width: 2, color: colors.green },
data: baseline
}
]
})

Loading…
Cancel
Save