|
|
|
|
@ -19,7 +19,7 @@ alt="banner" :src="bannerImg" fit="contain" class="home-welcome-image"
|
|
|
|
|
<div>
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="productionOverviewRange" type="daterange" unlink-panels value-format="YYYY-MM-DD"
|
|
|
|
|
start-placeholder="开始日期" end-placeholder="结束日期" size="small" />
|
|
|
|
|
start-placeholder="开始日期" end-placeholder="结束日期" size="small" @change="handleProductionOverviewRangeChange" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<el-row class="production-overview-row" :gutter="0">
|
|
|
|
|
@ -534,6 +534,38 @@ const moldTypeBarOptionsData = ref<EChartsOption>({
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
|
|
|
|
|
|
|
|
|
|
let productionOverviewRequestId = 0
|
|
|
|
|
const buildProductionOverviewParams = () => {
|
|
|
|
|
const startTime = productionOverviewRange.value
|
|
|
|
|
if (Array.isArray(startTime) && startTime.length === 2 && startTime[0] && startTime[1]) {
|
|
|
|
|
const normalizeStart = (value: string) => {
|
|
|
|
|
const v = String(value || '').trim()
|
|
|
|
|
if (!v) return ''
|
|
|
|
|
if (v.includes(' ') || v.includes('T')) return v
|
|
|
|
|
return `${v} 00:00:00`
|
|
|
|
|
}
|
|
|
|
|
const normalizeEnd = (value: string) => {
|
|
|
|
|
const v = String(value || '').trim()
|
|
|
|
|
if (!v) return ''
|
|
|
|
|
if (v.includes(' ') || v.includes('T')) return v
|
|
|
|
|
return `${v} 23:59:59`
|
|
|
|
|
}
|
|
|
|
|
return { startTime: [normalizeStart(startTime[0]), normalizeEnd(startTime[1])] }
|
|
|
|
|
}
|
|
|
|
|
return {}
|
|
|
|
|
}
|
|
|
|
|
const loadProductionOverview = async () => {
|
|
|
|
|
const currentId = ++productionOverviewRequestId
|
|
|
|
|
const data = await DashboardApi.getProduction(buildProductionOverviewParams())
|
|
|
|
|
if (currentId !== productionOverviewRequestId) return
|
|
|
|
|
production.value = data
|
|
|
|
|
productionOverviewLeft.value = production.value.taskItems
|
|
|
|
|
productionOverviewCenter.value = production.value.planItems
|
|
|
|
|
}
|
|
|
|
|
const handleProductionOverviewRangeChange = async () => {
|
|
|
|
|
await loadProductionOverview()
|
|
|
|
|
}
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
// 加载
|
|
|
|
|
@ -544,7 +576,7 @@ onMounted(async () => {
|
|
|
|
|
// todayWeather.value = weatherList.value[0]
|
|
|
|
|
// weatherCity = data.city
|
|
|
|
|
// }
|
|
|
|
|
production.value = await DashboardApi.getProduction(productionOverviewRange.value)
|
|
|
|
|
await loadProductionOverview()
|
|
|
|
|
plan.value = await DashboardApi.getPlan()
|
|
|
|
|
deviceStatusCards.value = await DashboardApi.getDevice()
|
|
|
|
|
moldStatusCards.value = await DashboardApi.getMold()
|
|
|
|
|
@ -559,8 +591,6 @@ onMounted(async () => {
|
|
|
|
|
console.log(moldTypeOptions)
|
|
|
|
|
moldTypeBarOptionsData.value.xAxis!.data = moldTypeOptions.xaxis
|
|
|
|
|
moldTypeBarOptionsData.value.series![0].data = moldTypeOptions.series
|
|
|
|
|
productionOverviewLeft.value = production.value.taskItems
|
|
|
|
|
productionOverviewCenter.value = production.value.planItems
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|