Compare commits
30 Commits
ffa0b2e8dd
...
projects/l
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e1c1d4c1a | |||
| b46e09e8ec | |||
| 00393f76c7 | |||
|
|
35fb0d8bfb | ||
|
|
0c52306cc6 | ||
| a5fba28ff7 | |||
|
|
1f8b994218 | ||
|
|
ccfa73f3bc | ||
|
|
89ff79bfd7 | ||
| 70a0fbb170 | |||
|
|
c86d94ac92 | ||
|
|
484ba6ca53 | ||
|
|
f403375594 | ||
| 1cd0b13aae | |||
|
|
d2b0565cd1 | ||
|
|
7661dc5691 | ||
| 1d698848c2 | |||
|
|
6d367b121c | ||
|
|
e2385cf813 | ||
| 552b1e6d6a | |||
| 4383067eb1 | |||
| f80644e07c | |||
|
|
1e12b653d6 | ||
|
|
b7ba173ca3 | ||
| c203f1e1dd | |||
|
|
ccb925003e | ||
|
|
b9f286005c | ||
| 0e343279ac | |||
| 00ac3dec45 | |||
| a84f765e73 |
6
.env.dev
6
.env.dev
@@ -12,8 +12,10 @@ ENV = 'development'
|
|||||||
VUE_APP_TITLE = 智能监控分析系统
|
VUE_APP_TITLE = 智能监控分析系统
|
||||||
|
|
||||||
# 芋道管理系统/开发环境
|
# 芋道管理系统/开发环境
|
||||||
# VUE_APP_BASE_API = 'http://192.168.8.22:48080'
|
# VUE_APP_BASE_API = 'http://172.16.33.187:48082'
|
||||||
VUE_APP_BASE_API = 'http://172.16.33.65:48082'
|
VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
|
||||||
|
# VUE_APP_BASE_API = 'http://172.16.19.12:48082'
|
||||||
|
|
||||||
|
|
||||||
# 路由懒加载
|
# 路由懒加载
|
||||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
"bpmn-js-token-simulation": "0.10.0",
|
"bpmn-js-token-simulation": "0.10.0",
|
||||||
"chinese-lunar": "^0.1.4",
|
"chinese-lunar": "^0.1.4",
|
||||||
"clipboard": "2.0.8",
|
"clipboard": "2.0.8",
|
||||||
"code-brick-zj": "^1.0.2",
|
"code-brick-zj": "^1.1.1",
|
||||||
"core-js": "^3.26.0",
|
"core-js": "^3.26.0",
|
||||||
"crypto-js": "^4.0.0",
|
"crypto-js": "^4.0.0",
|
||||||
"diagram-js": "^12.3.0",
|
"diagram-js": "^12.3.0",
|
||||||
|
|||||||
35
src/api/analysis/exception.js
Normal file
35
src/api/analysis/exception.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 获得设备健康分析周期报表list
|
||||||
|
export function getReportPage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/equipment-health-auto-report/reportList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}// 获得设备健康分析累计
|
||||||
|
export function getQueryPage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/equipment-health-auto-report/queryList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 导出
|
||||||
|
export function exportReportExcel(query) {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/equipment-health-auto-report/export-excel-report',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function exportQueryExcel(query) {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/equipment-health-auto-report/export-excel-query',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -59,3 +59,34 @@ export function getEquipmentAll() {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getTree(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/factory/getTreeSimple',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEquipmentOverall(data) {
|
||||||
|
return request({
|
||||||
|
url: '/monitoring/equipment-overall/get',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getParamMonitor(data) {
|
||||||
|
return request({
|
||||||
|
url: '/monitoring/equipment-monitor/paramMonitor',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function getAlarmDet(data) {
|
||||||
|
return request({
|
||||||
|
url: 'monitoring/equipment-overall/alarmDet',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
64
src/api/base/equipmentSectionShutdownLog.js
Normal file
64
src/api/base/equipmentSectionShutdownLog.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 创建计划停机配置
|
||||||
|
export function createPlan(data) {
|
||||||
|
return request({
|
||||||
|
url: '/base/equipment-section-shutdown-log/create',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新计划停机配置
|
||||||
|
export function updatePlan(data) {
|
||||||
|
return request({
|
||||||
|
url: '/base/equipment-section-shutdown-log/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得计划停机配置
|
||||||
|
export function getPlan(id) {
|
||||||
|
return request({
|
||||||
|
url: '/base/equipment-section-shutdown-log/get?id=' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计划停机配置list
|
||||||
|
export function planList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/equipment-section-shutdown-log/planList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 停机记录list
|
||||||
|
export function errorList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/equipment-section-shutdown-log/errorList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出计划停机配置list
|
||||||
|
export function exportPlanList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/equipment-section-shutdown-log/exportPlanList',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 导出停机记录list
|
||||||
|
export function exportErrorList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/equipment-section-shutdown-log/exportErrorList',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -52,3 +52,5 @@ export function exportEquipmentTypeExcel(query) {
|
|||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author: zhp
|
* @Author: zhp
|
||||||
* @Date: 2023-09-12 14:07:04
|
* @Date: 2023-09-12 14:07:04
|
||||||
* @LastEditTime: 2025-01-08 15:47:17
|
* @LastEditTime: 2026-04-28 11:13:17
|
||||||
* @LastEditors: zwq
|
* @LastEditors: zwq
|
||||||
* @Description:
|
* @Description:
|
||||||
*/
|
*/
|
||||||
@@ -14,6 +14,13 @@ export function getYieldAnalysisPageData(data) {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function getYieldAnalysisHandlePageData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/production-analysis/getOutputManual',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function getCT(data) {
|
export function getCT(data) {
|
||||||
return request({
|
return request({
|
||||||
@@ -46,3 +53,40 @@ export function getNewCTDet(data) {
|
|||||||
data:data
|
data:data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获得产线累计oee与teep
|
||||||
|
export function listHeader() {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/production-oee-auto-report/listHeader',
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得产线报表oee与teep
|
||||||
|
export function listLineReport(query) {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/production-oee-auto-report/listLineReport',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出生产分析teepExcel
|
||||||
|
export function exportTeepExcel(query) {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/production-oee-auto-report/export-excel-teep',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出生产分析oeeExcel
|
||||||
|
export function exportOeeExcel(query) {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/production-oee-auto-report/export-excel-oee',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,6 +50,15 @@ export function getPdlAutoReportNewSearchNow(data) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPdlAutoReportNewSearchLastGroup(data) {
|
||||||
|
return request({
|
||||||
|
url: '/monitoring/production-monitor/getPdlAutoReportNewSearchLastGroup',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
timeout: 60000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 班组自动报表分页
|
// 班组自动报表分页
|
||||||
export function getTeamReportPage(data) {
|
export function getTeamReportPage(data) {
|
||||||
@@ -93,3 +102,17 @@ export function getProcessAutoReportNew(data) {
|
|||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
export function getPLlistByFactory(data) {
|
||||||
|
return request({
|
||||||
|
url: 'base/production-line/listByFactory',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function getProcessAutoReportLastGroup(data) {
|
||||||
|
return request({
|
||||||
|
url: '/monitoring/production-monitor/getProcessAutoReportLastGroup',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* @Author: Do not edit
|
* @Author: Do not edit
|
||||||
* @Date: 2023-09-12 09:44:53
|
* @Date: 2023-09-12 09:44:53
|
||||||
* @LastEditTime: 2023-09-15 14:12:26
|
* @LastEditTime: 2026-03-30 15:01:38
|
||||||
* @LastEditors: DY
|
* @LastEditors: zwq
|
||||||
* @Description:
|
* @Description:
|
||||||
*/
|
*/
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
@@ -15,3 +15,12 @@ export function getPdlDataOneDay(data) {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获得近24小时产线生产数据-新版
|
||||||
|
export function getSectionDataOneDay(data) {
|
||||||
|
return request({
|
||||||
|
url: '/monitoring/production-monitor/getSectionDataOneDay',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
56
src/api/monitoring/defectSummary.js
Normal file
56
src/api/monitoring/defectSummary.js
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 创建能源监控配置
|
||||||
|
export function getDefectSummaryTable(data) {
|
||||||
|
return request({
|
||||||
|
url: '/extend/check-gaozhun-record/defectSummaryTable',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function getTranslucentPage(data) {
|
||||||
|
return request({
|
||||||
|
url: '/monitoring/translucent/page',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function exportTranslucent(data) {
|
||||||
|
return request({
|
||||||
|
url: '/monitoring/translucent/export-excel',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
responseType: 'blob',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDefectAnalysis(data) {
|
||||||
|
return request({
|
||||||
|
url: '/extend/check-gaozhun-record/defectAnalysis',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getSectionDefect(data) {
|
||||||
|
return request({
|
||||||
|
url: '/extend/check-gaozhun-record/sectionDefect',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function getDefectSummaryChart(data) {
|
||||||
|
return request({
|
||||||
|
url: '/extend/check-gaozhun-record/defectSummaryChart',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function getDefectSummaryDet(data) {
|
||||||
|
return request({
|
||||||
|
url: '/extend/check-gaozhun-record/defectSummaryDet',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
63
src/api/monitoring/qualityIsra.js
Normal file
63
src/api/monitoring/qualityIsra.js
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* @Author: zhp
|
||||||
|
* @Date: 2023-12-08 15:26:59
|
||||||
|
* @LastEditTime: 2023-12-11 15:21:44
|
||||||
|
* @LastEditors: zhp
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
export function getQualityIsraPage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/extend/check-isra-statistics/getIsraData',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getQualityIsraDayMap(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/quality-isra-statistics/dayMap',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getQualityIsraWeekMap(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/quality-isra-statistics/weekMap',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getQualityIsraMonthMap(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/quality-isra-statistics/monthMap',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getQualityIsraDayList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/quality-isra-statistics/dayList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getQualityIsraWeekList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/quality-isra-statistics/weekList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getQualityIsraMonthList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/quality-isra-statistics/monthList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
BIN
src/assets/images/equipmentNum.png
Normal file
BIN
src/assets/images/equipmentNum.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/images/equipmentNumImg.png
Normal file
BIN
src/assets/images/equipmentNumImg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
BIN
src/assets/images/runNum.png
Normal file
BIN
src/assets/images/runNum.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
src/assets/images/runNumImg.png
Normal file
BIN
src/assets/images/runNumImg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
BIN
src/assets/images/stopNum.png
Normal file
BIN
src/assets/images/stopNum.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/images/stopNumImg.png
Normal file
BIN
src/assets/images/stopNumImg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
@@ -1,10 +1,3 @@
|
|||||||
<!--
|
|
||||||
filename: index.vue
|
|
||||||
author: liubin
|
|
||||||
date: 2024-04-02 09:49:36
|
|
||||||
description:
|
|
||||||
-->
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- 按钮切换 -->
|
<!-- 按钮切换 -->
|
||||||
<div v-if="buttonMode" class="button-nav">
|
<div v-if="buttonMode" class="button-nav">
|
||||||
@@ -54,7 +47,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.currentMenu = this.menus[0];
|
// this.currentMenu = this.menus[0];
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currentMenu(val) {
|
currentMenu(val) {
|
||||||
|
|||||||
@@ -6,99 +6,43 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-form
|
<el-form ref="form" :model="form" :label-width="`${labelWidth}px`" :size="size" :label-position="labelPosition"
|
||||||
ref="form"
|
|
||||||
:model="form"
|
|
||||||
:label-width="`${labelWidth}px`"
|
|
||||||
:size="size"
|
|
||||||
:label-position="labelPosition"
|
|
||||||
v-loading="formLoading">
|
v-loading="formLoading">
|
||||||
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
|
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
|
||||||
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
|
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
|
||||||
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
|
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
|
||||||
<el-input
|
<el-input v-if="col.input" v-model="form[col.prop]" @change="$emit('update', form)"
|
||||||
v-if="col.input"
|
:placeholder="`请输入${col.label}`" v-bind="col.bind" />
|
||||||
v-model="form[col.prop]"
|
<el-input v-if="col.textarea" type="textarea" v-model="form[col.prop]" @change="$emit('update', form)"
|
||||||
@change="$emit('update', form)"
|
:placeholder="`请输入${col.label}`" v-bind="col.bind" />
|
||||||
:placeholder="`请输入${col.label}`"
|
<el-select v-if="col.select" v-model="form[col.prop]" :placeholder="`请选择${col.label}`"
|
||||||
v-bind="col.bind" />
|
@change="$emit('update', form)" v-bind="col.bind">
|
||||||
<el-input
|
<el-option v-for="opt in optionListOf[col.prop]" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||||
v-if="col.textarea"
|
|
||||||
type="textarea"
|
|
||||||
v-model="form[col.prop]"
|
|
||||||
@change="$emit('update', form)"
|
|
||||||
:placeholder="`请输入${col.label}`"
|
|
||||||
v-bind="col.bind" />
|
|
||||||
<el-select
|
|
||||||
v-if="col.select"
|
|
||||||
v-model="form[col.prop]"
|
|
||||||
:placeholder="`请选择${col.label}`"
|
|
||||||
@change="$emit('update', form)"
|
|
||||||
v-bind="col.bind">
|
|
||||||
<el-option
|
|
||||||
v-for="opt in optionListOf[col.prop]"
|
|
||||||
:key="opt.value"
|
|
||||||
:label="opt.label"
|
|
||||||
:value="opt.value" />
|
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-date-picker
|
<el-date-picker v-if="col.datetime" v-model="form[col.prop]" type="datetime" :placeholder="`请选择${col.label}`"
|
||||||
v-if="col.datetime"
|
value-format="timestamp" v-bind="col.bind"></el-date-picker>
|
||||||
v-model="form[col.prop]"
|
<el-switch v-if="col.switch" v-model="form[col.prop]" active-color="#0b58ff" inactive-color="#e1e1e1"
|
||||||
type="datetime"
|
v-bind="col.bind" @change="handleSwitchChange(col.prop)"></el-switch>
|
||||||
:placeholder="`请选择${col.label}`"
|
<component v-if="col.subcomponent" :key="col.key" :is="col.subcomponent" :inlineStyle="col.style"></component>
|
||||||
value-format="timestamp"
|
|
||||||
v-bind="col.bind"></el-date-picker>
|
|
||||||
<el-switch
|
|
||||||
v-if="col.switch"
|
|
||||||
v-model="form[col.prop]"
|
|
||||||
active-color="#0b58ff"
|
|
||||||
inactive-color="#e1e1e1"
|
|
||||||
v-bind="col.bind"></el-switch>
|
|
||||||
<component
|
|
||||||
v-if="col.subcomponent"
|
|
||||||
:key="col.key"
|
|
||||||
:is="col.subcomponent"
|
|
||||||
:inlineStyle="col.style"></component>
|
|
||||||
|
|
||||||
<div
|
<div class="upload-area" :class="uploadOpen ? '' : 'height-48'" ref="uploadArea" v-if="col.upload">
|
||||||
class="upload-area"
|
|
||||||
:class="uploadOpen ? '' : 'height-48'"
|
|
||||||
ref="uploadArea"
|
|
||||||
v-if="col.upload">
|
|
||||||
<span class="close-icon" :class="uploadOpen ? 'open' : ''">
|
<span class="close-icon" :class="uploadOpen ? 'open' : ''">
|
||||||
<el-button
|
<el-button type="text" icon="el-icon-arrow-right" @click="handleFilesOpen" />
|
||||||
type="text"
|
|
||||||
icon="el-icon-arrow-right"
|
|
||||||
@click="handleFilesOpen" />
|
|
||||||
</span>
|
</span>
|
||||||
<!-- :file-list="uploadedFileList" -->
|
<!-- :file-list="uploadedFileList" -->
|
||||||
<el-upload
|
<el-upload class="upload-in-dialog" v-if="col.upload" :action="uploadUrl" :headers="uploadHeaders"
|
||||||
class="upload-in-dialog"
|
:show-file-list="false" icon="el-icon-upload2" :before-upload="beforeUpload"
|
||||||
v-if="col.upload"
|
:on-success="handleUploadSuccess" v-bind="col.bind">
|
||||||
:action="uploadUrl"
|
|
||||||
:headers="uploadHeaders"
|
|
||||||
:show-file-list="false"
|
|
||||||
icon="el-icon-upload2"
|
|
||||||
:before-upload="beforeUpload"
|
|
||||||
:on-success="handleUploadSuccess"
|
|
||||||
v-bind="col.bind">
|
|
||||||
<el-button size="mini" :disabled="col.bind?.disabled || false">
|
<el-button size="mini" :disabled="col.bind?.disabled || false">
|
||||||
<svg-icon
|
<svg-icon icon-class="icon-upload" style="color: inherit"></svg-icon>
|
||||||
icon-class="icon-upload"
|
|
||||||
style="color: inherit"></svg-icon>
|
|
||||||
上传文件
|
上传文件
|
||||||
</el-button>
|
</el-button>
|
||||||
<div class="el-upload__tip" slot="tip" v-if="col.uploadTips">
|
<div class="el-upload__tip" slot="tip" v-if="col.uploadTips">
|
||||||
{{ col.uploadTips || '只能上传jpg/png文件, 大小不超过2MB' }}
|
{{ col.uploadTips || '只能上传jpg/png文件, 大小不超过2MB' }}
|
||||||
</div>
|
</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<uploadedFile
|
<uploadedFile class="file" v-for="file in form[col.prop] || []" :file="file" :key="file.fileUrl"
|
||||||
class="file"
|
@delete="handleDeleteFile(file)" @Preview="handlePreview(file)" />
|
||||||
v-for="file in form[col.prop] || []"
|
|
||||||
:file="file"
|
|
||||||
:key="file.fileUrl"
|
|
||||||
@delete="handleDeleteFile(file)"
|
|
||||||
@Preview="handlePreview(file)" />
|
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -135,6 +79,7 @@ const uploadedFile = {
|
|||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
handleDelete() {
|
handleDelete() {
|
||||||
this.$emit('delete', this.file);
|
this.$emit('delete', this.file);
|
||||||
},
|
},
|
||||||
@@ -252,6 +197,11 @@ export default {
|
|||||||
this.handleOptions();
|
this.handleOptions();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleSwitchChange(prop) {
|
||||||
|
// 触发 update 事件,将最新的 form 数据传递给父组件
|
||||||
|
this.$emit('update', { ...this.form });
|
||||||
|
console.log(`switch ${prop} 变化:`, this.form[prop]);
|
||||||
|
},
|
||||||
/** 模拟透传 ref */
|
/** 模拟透传 ref */
|
||||||
validate(cb) {
|
validate(cb) {
|
||||||
return this.$refs.form.validate(cb);
|
return this.$refs.form.validate(cb);
|
||||||
|
|||||||
@@ -6,14 +6,8 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-drawer
|
<el-drawer :visible="visible" :show-close="false" :wrapper-closable="false" class="drawer" custom-class="mes-drawer"
|
||||||
:visible="visible"
|
:size="size || '50%'" @closed="$emit('destroy')">
|
||||||
:show-close="false"
|
|
||||||
:wrapper-closable="false"
|
|
||||||
class="drawer"
|
|
||||||
custom-class="mes-drawer"
|
|
||||||
:size="size || '50%'"
|
|
||||||
@closed="$emit('destroy')">
|
|
||||||
<SmallTitle slot="title">
|
<SmallTitle slot="title">
|
||||||
{{
|
{{
|
||||||
mode.includes('detail')
|
mode.includes('detail')
|
||||||
@@ -29,9 +23,7 @@
|
|||||||
<section v-for="(section, index) in sections" :key="section.key">
|
<section v-for="(section, index) in sections" :key="section.key">
|
||||||
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
|
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
|
||||||
|
|
||||||
<div
|
<div class="form-part" v-if="section.key == 'base'"
|
||||||
class="form-part"
|
|
||||||
v-if="section.key == 'base'"
|
|
||||||
style="border-bottom: 1px solid #dfdfdf; margin-bottom: 24px">
|
style="border-bottom: 1px solid #dfdfdf; margin-bottom: 24px">
|
||||||
<el-skeleton v-if="!showForm" animated />
|
<el-skeleton v-if="!showForm" animated />
|
||||||
<!-- <BaseInfoForm
|
<!-- <BaseInfoForm
|
||||||
@@ -45,9 +37,7 @@
|
|||||||
<!-- if -->
|
<!-- if -->
|
||||||
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
|
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<div
|
<div class="title" style="font-weight: 700; font-size: 16px; margin: 8px 0">
|
||||||
class="title"
|
|
||||||
style="font-weight: 700; font-size: 16px; margin: 8px 0">
|
|
||||||
设备名
|
设备名
|
||||||
</div>
|
</div>
|
||||||
<div class="value" style="font-size: 14px">
|
<div class="value" style="font-size: 14px">
|
||||||
@@ -55,9 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<div
|
<div class="title" style="font-weight: 700; font-size: 16px; margin: 8px 0">
|
||||||
class="title"
|
|
||||||
style="font-weight: 700; font-size: 16px; margin: 8px 0">
|
|
||||||
关联表名
|
关联表名
|
||||||
</div>
|
</div>
|
||||||
<div class="value" style="font-size: 14px">
|
<div class="value" style="font-size: 14px">
|
||||||
@@ -69,37 +57,16 @@
|
|||||||
<el-row v-else style="margin-bottom: 24px" :gutter="20">
|
<el-row v-else style="margin-bottom: 24px" :gutter="20">
|
||||||
<el-form ref="form" :model="form">
|
<el-form ref="form" :model="form">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item
|
<el-form-item class="title" label="设备名" style="font-size: 16px; margin: 8px 0">
|
||||||
class="title"
|
<el-select v-model="form.equipmentId" filterable clearable placeholder="请选择设备">
|
||||||
label="设备名"
|
<el-option v-for="eq in eqList" :key="eq.id" :label="eq.name" :value="eq.id"></el-option>
|
||||||
style="font-size: 16px; margin: 8px 0">
|
|
||||||
<el-select
|
|
||||||
v-model="form.equipmentId"
|
|
||||||
filterable
|
|
||||||
clearable
|
|
||||||
placeholder="请选择设备">
|
|
||||||
<el-option
|
|
||||||
v-for="eq in eqList"
|
|
||||||
:key="eq.id"
|
|
||||||
:label="eq.name"
|
|
||||||
:value="eq.id"></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item
|
<el-form-item class="title" label="设备关联表名" style="font-size: 16px; margin: 8px 0">
|
||||||
class="title"
|
<el-select v-model="form.plcId" filterable clearable placeholder="请选择关联表">
|
||||||
label="设备关联表名"
|
<el-option v-for="plc in plcList" :key="plc.id" :label="plc.plcTableName"
|
||||||
style="font-size: 16px; margin: 8px 0">
|
|
||||||
<el-select
|
|
||||||
v-model="form.plcId"
|
|
||||||
filterable
|
|
||||||
clearable
|
|
||||||
placeholder="请选择关联表">
|
|
||||||
<el-option
|
|
||||||
v-for="plc in plcList"
|
|
||||||
:key="plc.id"
|
|
||||||
:label="plc.plcTableName"
|
|
||||||
:value="plc.id"></el-option>
|
:value="plc.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -108,73 +75,44 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div v-if="section.key == 'attrs'" style="position: relative; margin-top: 12px">
|
||||||
v-if="section.key == 'attrs'"
|
<div v-if="!mode.includes('detail')" style="position: absolute; top: -40px; right: 0">
|
||||||
style="position: relative; margin-top: 12px">
|
|
||||||
<div
|
|
||||||
v-if="!mode.includes('detail')"
|
|
||||||
style="position: absolute; top: -40px; right: 0">
|
|
||||||
<el-button @click="handleAddAttr" type="text">
|
<el-button @click="handleAddAttr" type="text">
|
||||||
<i class="el-icon-plus"></i>
|
<i class="el-icon-plus"></i>
|
||||||
添加参数
|
添加参数
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<base-table
|
<base-table v-loading="attrListLoading" :table-props="section.props" :page="attrQuery?.params.pageNo || 1"
|
||||||
v-loading="attrListLoading"
|
:limit="attrQuery?.params.pageSize || 10" :table-data="list" @emitFun="handleEmitFun">
|
||||||
:table-props="section.props"
|
|
||||||
:page="attrQuery?.params.pageNo || 1"
|
|
||||||
:limit="attrQuery?.params.pageSize || 10"
|
|
||||||
:table-data="list"
|
|
||||||
@emitFun="handleEmitFun">
|
|
||||||
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
|
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
|
||||||
@emitButtonClick="handleAddAttr" -->
|
@emitButtonClick="handleAddAttr" -->
|
||||||
<method-btn
|
<method-btn v-if="section.tableBtn && !mode.includes('detail')" slot="handleBtn" label="操作"
|
||||||
v-if="section.tableBtn && !mode.includes('detail')"
|
:method-list="tableBtn" @clickBtn="handleTableBtnClick" />
|
||||||
slot="handleBtn"
|
|
||||||
label="操作"
|
|
||||||
:method-list="tableBtn"
|
|
||||||
@clickBtn="handleTableBtnClick" />
|
|
||||||
</base-table>
|
</base-table>
|
||||||
|
|
||||||
<!-- 分页组件 -->
|
<!-- 分页组件 -->
|
||||||
<pagination
|
<pagination v-show="total > 0" :total="total" :page.sync="attrQuery.params.pageNo"
|
||||||
v-show="total > 0"
|
:limit.sync="attrQuery.params.pageSize" @pagination="getAttrList" />
|
||||||
:total="total"
|
|
||||||
:page.sync="attrQuery.params.pageNo"
|
|
||||||
:limit.sync="attrQuery.params.pageSize"
|
|
||||||
@pagination="getAttrList" />
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="drawer-body__footer">
|
<div class="drawer-body__footer">
|
||||||
<el-button style="" @click="handleCancel">取消</el-button>
|
<el-button style="" @click="handleCancel">取消</el-button>
|
||||||
<el-button
|
<el-button type="primary" v-if="!mode.includes('detail')" @click="handleSave">
|
||||||
type="primary"
|
|
||||||
v-if="!mode.includes('detail')"
|
|
||||||
@click="handleSave">
|
|
||||||
保存
|
保存
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 属性对话框 -->
|
<!-- 属性对话框 -->
|
||||||
<base-dialog
|
<base-dialog v-if="sections[1].allowAdd" :dialogTitle="attrTitle" :dialogVisible="attrFormVisible" width="45%"
|
||||||
v-if="sections[1].allowAdd"
|
:append-to-body="true" custom-class="baseDialog" @close="closeAttrForm" @cancel="closeAttrForm"
|
||||||
:dialogTitle="attrTitle"
|
|
||||||
:dialogVisible="attrFormVisible"
|
|
||||||
width="45%"
|
|
||||||
:append-to-body="true"
|
|
||||||
custom-class="baseDialog"
|
|
||||||
@close="closeAttrForm"
|
|
||||||
@cancel="closeAttrForm"
|
|
||||||
@confirm="submitAttrForm">
|
@confirm="submitAttrForm">
|
||||||
<!-- :disabled="mode.includes('detail')" -->
|
<!-- :disabled="mode.includes('detail')" -->
|
||||||
<DialogForm
|
<DialogForm v-if="attrFormVisible" ref="attrForm" v-model="attrForm" :data-form="attrForm"
|
||||||
v-if="attrFormVisible"
|
:rows="attrRows"
|
||||||
ref="attrForm"
|
@update="handleAttrFormUpdate"/>
|
||||||
v-model="attrForm"
|
|
||||||
:rows="attrRows" />
|
|
||||||
</base-dialog>
|
</base-dialog>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
@@ -233,6 +171,8 @@ export default {
|
|||||||
description: '',
|
description: '',
|
||||||
remark: '',
|
remark: '',
|
||||||
alarmContent: '',
|
alarmContent: '',
|
||||||
|
displayTip: false,
|
||||||
|
alarmTip: false,
|
||||||
},
|
},
|
||||||
attrFormVisible: false,
|
attrFormVisible: false,
|
||||||
attrRows: [
|
attrRows: [
|
||||||
@@ -342,6 +282,26 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
switch: true,
|
||||||
|
label: '是否展示',
|
||||||
|
prop: 'displayTip',
|
||||||
|
bind: {
|
||||||
|
'active-value': true,
|
||||||
|
'inactive-value': false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
switch: true,
|
||||||
|
label: '超出阈值是否报警',
|
||||||
|
prop: 'alarmTip',
|
||||||
|
bind: {
|
||||||
|
'active-value': true,
|
||||||
|
'inactive-value': false,
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -437,6 +397,23 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleAttrFormUpdate(updatedForm) {
|
||||||
|
console.log('updatedForm', updatedForm);
|
||||||
|
|
||||||
|
// 只同步需要的字段,避免覆盖其他数据
|
||||||
|
this.attrForm = {
|
||||||
|
...this.attrForm,
|
||||||
|
...updatedForm,
|
||||||
|
// 确保开关值是布尔类型(双重保险)
|
||||||
|
displayTip: Boolean(updatedForm.displayTip),
|
||||||
|
alarmTip: Boolean(updatedForm.alarmTip),
|
||||||
|
collection: Number(updatedForm.collection) // 采集开关保持数字类型
|
||||||
|
};
|
||||||
|
console.log('开关值同步:', {
|
||||||
|
displayTip: this.attrForm.displayTip,
|
||||||
|
alarmTip: this.attrForm.alarmTip
|
||||||
|
});
|
||||||
|
},
|
||||||
handleTableBtnClick({ type, data }) {
|
handleTableBtnClick({ type, data }) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
@@ -503,6 +480,7 @@ export default {
|
|||||||
plcParamName: '',
|
plcParamName: '',
|
||||||
unit: '',
|
unit: '',
|
||||||
collection: 1,
|
collection: 1,
|
||||||
|
|
||||||
minValue: '',
|
minValue: '',
|
||||||
maxValue: '',
|
maxValue: '',
|
||||||
defaultValue: '',
|
defaultValue: '',
|
||||||
@@ -511,6 +489,8 @@ export default {
|
|||||||
equipmentParamType: '',
|
equipmentParamType: '',
|
||||||
productionParamType: '',
|
productionParamType: '',
|
||||||
alarmContent: '',
|
alarmContent: '',
|
||||||
|
displayTip: false,
|
||||||
|
alarmTip: false,
|
||||||
};
|
};
|
||||||
this.attrTitle = '添加参数绑定信息';
|
this.attrTitle = '添加参数绑定信息';
|
||||||
this.attrFormVisible = true;
|
this.attrFormVisible = true;
|
||||||
@@ -524,7 +504,14 @@ export default {
|
|||||||
params: { id: attrId },
|
params: { id: attrId },
|
||||||
});
|
});
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.attrForm = res.data;
|
console.log('res.data', res.data);
|
||||||
|
|
||||||
|
this.attrForm = {
|
||||||
|
...res.data,
|
||||||
|
// // 强制转为数字类型,避免字符串类型导致绑定失败
|
||||||
|
// displayTip: Number(res.data.displayTip) || 0,
|
||||||
|
// alarmTip: Number(res.data.alarmTip) || 0
|
||||||
|
};
|
||||||
this.attrTitle = '编辑参数绑定信息';
|
this.attrTitle = '编辑参数绑定信息';
|
||||||
this.attrFormVisible = true;
|
this.attrFormVisible = true;
|
||||||
}
|
}
|
||||||
@@ -564,6 +551,7 @@ export default {
|
|||||||
if (!valid) {
|
if (!valid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log('this.attrForm', this.attrForm);
|
||||||
|
|
||||||
const isEdit = this.attrForm.id != null;
|
const isEdit = this.attrForm.id != null;
|
||||||
this.attrFormSubmitting = true;
|
this.attrFormSubmitting = true;
|
||||||
@@ -583,8 +571,9 @@ export default {
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
this.getAttrList();
|
|
||||||
this.shouldRefreshPageView = true;
|
this.shouldRefreshPageView = true;
|
||||||
|
this.getAttrList();
|
||||||
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
189
src/views/base/equipmentSectionShutdownLog/add-or-updata.vue
Normal file
189
src/views/base/equipmentSectionShutdownLog/add-or-updata.vue
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2023-08-01 13:52:10
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2026-04-16 15:13:53
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<el-form
|
||||||
|
:model="dataForm"
|
||||||
|
:rules="dataRule"
|
||||||
|
ref="dataForm"
|
||||||
|
v-if="visible"
|
||||||
|
@keyup.enter.native="dataFormSubmit()"
|
||||||
|
label-width="150px">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="产线" prop="lineId">
|
||||||
|
<el-select
|
||||||
|
v-model="dataForm.lineId"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
:style="{ width: '100%' }"
|
||||||
|
placeholder="请选择产线">
|
||||||
|
<el-option
|
||||||
|
v-for="item in lineOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="计划停机起止时间" prop="timeRange">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="dataForm.timeRange"
|
||||||
|
type="datetimerange"
|
||||||
|
:style="{ width: '100%' }"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
value-format="timestamp"
|
||||||
|
@change="handleTimeRangeChange"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="停机时长" prop="timeStopVal">
|
||||||
|
<span>{{ timeStopText }}</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="原因" prop="reason">
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
:rows="2"
|
||||||
|
placeholder="请输入原因"
|
||||||
|
v-model="dataForm.reason"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import basicAdd from '@/mixins/basic-add';
|
||||||
|
import {
|
||||||
|
createPlan,
|
||||||
|
updatePlan,
|
||||||
|
getPlan,
|
||||||
|
} from '@/api/base/equipmentSectionShutdownLog';
|
||||||
|
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mixins: [basicAdd],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
urlOptions: {
|
||||||
|
createURL: createPlan,
|
||||||
|
updateURL: updatePlan,
|
||||||
|
infoURL: getPlan,
|
||||||
|
optionArrUrl: [getProductionLinePage],
|
||||||
|
},
|
||||||
|
setData: true,
|
||||||
|
dataForm: {
|
||||||
|
id: undefined,
|
||||||
|
lineId: undefined,
|
||||||
|
timeRange: undefined,
|
||||||
|
reason: '',
|
||||||
|
timeStopVal: undefined, // 存储分钟数或秒数
|
||||||
|
},
|
||||||
|
lineOptions: [],
|
||||||
|
timeStopText: '', // 显示文本:x天x小时x分钟
|
||||||
|
dataRule: {
|
||||||
|
lineId: [
|
||||||
|
{ required: true, message: '产线不能为空', trigger: 'change' },
|
||||||
|
],
|
||||||
|
timeRange: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '计划停机起止时间不能为空',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {},
|
||||||
|
methods: {
|
||||||
|
getArr() {
|
||||||
|
getProductionLinePage({
|
||||||
|
page: 1,
|
||||||
|
limit: 500,
|
||||||
|
}).then((response) => {
|
||||||
|
this.lineOptions = response.data.list;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setDataForm() {
|
||||||
|
this.dataForm.timeRange =
|
||||||
|
this.dataForm.startTime && this.dataForm.endTime
|
||||||
|
? [this.dataForm.startTime, this.dataForm.endTime]
|
||||||
|
: undefined;
|
||||||
|
this.handleTimeRangeChange(this.dataForm.timeRange);
|
||||||
|
},
|
||||||
|
// 时间范围改变时计算停机时长
|
||||||
|
handleTimeRangeChange(val) {
|
||||||
|
if (!val || val.length < 2) {
|
||||||
|
this.timeStopText = '';
|
||||||
|
this.dataForm.timeStopVal = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const start = new Date(val[0]).getTime();
|
||||||
|
const end = new Date(val[1]).getTime();
|
||||||
|
|
||||||
|
if (end <= start) {
|
||||||
|
this.timeStopText = '结束时间必须大于开始时间';
|
||||||
|
this.dataForm.timeStopVal = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 总毫秒数 → 总分钟数
|
||||||
|
const totalMinutes = (end - start) / 1000 / 60;
|
||||||
|
|
||||||
|
// 计算天、小时、剩余分钟
|
||||||
|
const days = Math.floor(totalMinutes / 1440);
|
||||||
|
const hours = Math.floor((totalMinutes % 1440) / 60);
|
||||||
|
const minutes = Math.round(totalMinutes % 60);
|
||||||
|
|
||||||
|
// 拼接显示文本
|
||||||
|
let text = '';
|
||||||
|
if (days > 0) text += `${days}天`;
|
||||||
|
if (hours > 0) text += `${hours}小时`;
|
||||||
|
if (minutes > 0 || text === '') text += `${minutes}分钟`;
|
||||||
|
|
||||||
|
this.timeStopText = text;
|
||||||
|
this.dataForm.timeStopVal = totalMinutes; // 提交时可传总分钟数
|
||||||
|
},
|
||||||
|
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.dataForm.startTime = this.dataForm.timeRange
|
||||||
|
? this.dataForm.timeRange[0]
|
||||||
|
: undefined;
|
||||||
|
this.dataForm.endTime = this.dataForm.timeRange
|
||||||
|
? this.dataForm.timeRange[1]
|
||||||
|
: undefined;
|
||||||
|
// 修改的提交
|
||||||
|
if (this.dataForm.id) {
|
||||||
|
this.urlOptions.updateURL(this.dataForm).then((response) => {
|
||||||
|
this.$modal.msgSuccess('修改成功');
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit('refreshDataList');
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
this.urlOptions.createURL(this.dataForm).then((response) => {
|
||||||
|
this.$modal.msgSuccess('新增成功');
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit('refreshDataList');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
470
src/views/base/equipmentSectionShutdownLog/index.vue
Normal file
470
src/views/base/equipmentSectionShutdownLog/index.vue
Normal file
@@ -0,0 +1,470 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2026-04-16 14:03:22
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2026-04-17 15:50:29
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div style="background: #f2f4f9">
|
||||||
|
<div style="background: #f2f4f9; height: 38px; width: 100%">
|
||||||
|
<ButtonNav
|
||||||
|
ref="buttonNav"
|
||||||
|
:menus="['计划停机配置', '停机记录']"
|
||||||
|
@change="currentMenu">
|
||||||
|
<template v-slot:tab1>
|
||||||
|
<div>计划停机配置</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:tab2>
|
||||||
|
<div>停机记录</div>
|
||||||
|
</template>
|
||||||
|
</ButtonNav>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style="
|
||||||
|
background: #ffffff;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
padding: 10px 10px 0 10px;
|
||||||
|
">
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<search-bar
|
||||||
|
v-if="activeName === '计划停机配置'"
|
||||||
|
:formConfigs="formConfig"
|
||||||
|
ref="searchBarForm"
|
||||||
|
@headBtnClick="buttonClick" />
|
||||||
|
|
||||||
|
<div v-else class="searchBarBox">
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
ref="searchBarForm"
|
||||||
|
:model="formInline"
|
||||||
|
class="searchBar">
|
||||||
|
<span class="blue-block"></span>
|
||||||
|
<el-form-item label="产线/工段" prop="lineIds">
|
||||||
|
<el-cascader size="small"
|
||||||
|
v-model="formInline.lineIds"
|
||||||
|
:options="options"
|
||||||
|
:props="{
|
||||||
|
value: 'id',
|
||||||
|
label: 'name',
|
||||||
|
checkStrictly: true,
|
||||||
|
multiple: true,
|
||||||
|
emitPath: false,
|
||||||
|
}"></el-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="时间范围" prop="times">
|
||||||
|
<el-date-picker size="small"
|
||||||
|
v-model="formInline.times"
|
||||||
|
type="daterange"
|
||||||
|
format="yyyy-MM-dd"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始时间"
|
||||||
|
end-placeholder="结束时间"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="停机时长" prop="duration">
|
||||||
|
<el-select size="small"
|
||||||
|
v-model="durationJudge"
|
||||||
|
@change="handleCompareChange"
|
||||||
|
style="width: 100px; margin-right: 8px">
|
||||||
|
<el-option label="大于" value="1"></el-option>
|
||||||
|
<el-option label="大于等于" value="2"></el-option>
|
||||||
|
<el-option label="小于" value="3"></el-option>
|
||||||
|
<el-option label="小于等于" value="4"></el-option>
|
||||||
|
<el-option label="等于" value="5"></el-option>
|
||||||
|
<el-option label="介于" value="6"></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-input size="small"
|
||||||
|
v-model.number="duration1"
|
||||||
|
type="number"
|
||||||
|
placeholder="输入整数"
|
||||||
|
min="0"
|
||||||
|
style="width: 100px; margin-right: 8px"
|
||||||
|
@keydown="preventNonInteger"></el-input>
|
||||||
|
<span v-if="durationJudge === '6'" style="margin-right: 8px">
|
||||||
|
~
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<el-input size="small"
|
||||||
|
v-if="durationJudge === '6'"
|
||||||
|
v-model.number="duration2"
|
||||||
|
type="number"
|
||||||
|
placeholder="输入整数"
|
||||||
|
min="0"
|
||||||
|
style="width: 100px; margin-right: 8px"
|
||||||
|
@keydown="preventNonInteger"></el-input>
|
||||||
|
<!-- 时间单位下拉 -->
|
||||||
|
<el-select size="small" v-model="timeUnit" style="width: 100px">
|
||||||
|
<el-option label="分钟" value="minute"></el-option>
|
||||||
|
<el-option label="小时" value="hour"></el-option>
|
||||||
|
<el-option label="天" value="day"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button size="small" type="primary" @click="handleRecordSearch">
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button size="small" type="warning" @click="handleExport1">
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="app-container"
|
||||||
|
v-if="activeName === '计划停机配置'"
|
||||||
|
style="background: #ffffff">
|
||||||
|
<!-- 表 -->
|
||||||
|
<div>
|
||||||
|
<base-table
|
||||||
|
:page="1"
|
||||||
|
:limit="100"
|
||||||
|
:table-props="tableProps1"
|
||||||
|
:table-data="list"
|
||||||
|
:max-height="500">
|
||||||
|
<method-btn
|
||||||
|
v-if="tableBtn.length"
|
||||||
|
slot="handleBtn"
|
||||||
|
:width="90"
|
||||||
|
label="操作"
|
||||||
|
:method-list="tableBtn"
|
||||||
|
@clickBtn="handleClick" />
|
||||||
|
</base-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="app-container"
|
||||||
|
v-else-if="activeName === '停机记录'"
|
||||||
|
style="background: #ffffff">
|
||||||
|
<!-- 表 -->
|
||||||
|
<div>
|
||||||
|
<base-table
|
||||||
|
:page="1"
|
||||||
|
:limit="100"
|
||||||
|
:table-props="tableProps2"
|
||||||
|
:table-data="list"
|
||||||
|
:max-height="500"></base-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<base-dialog
|
||||||
|
:dialogTitle="addOrEditTitle"
|
||||||
|
:dialogVisible="addOrUpdateVisible"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
@confirm="handleConfirm"
|
||||||
|
:before-close="handleCancel"
|
||||||
|
width="40%">
|
||||||
|
<add-or-update
|
||||||
|
ref="addOrUpdate"
|
||||||
|
@refreshDataList="successSubmit"></add-or-update>
|
||||||
|
</base-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import ButtonNav from '@/components/ButtonNav';
|
||||||
|
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
||||||
|
import {
|
||||||
|
planList,
|
||||||
|
errorList,
|
||||||
|
exportPlanList,
|
||||||
|
exportErrorList,
|
||||||
|
} from '@/api/base/equipmentSectionShutdownLog';
|
||||||
|
import subDiv from './subDiv.vue';
|
||||||
|
import AddOrUpdate from './add-or-updata';
|
||||||
|
import basicPage from '@/mixins/basic-page';
|
||||||
|
import { getGroupPlanTree } from '@/api/group/Schedule';
|
||||||
|
|
||||||
|
const tableProps1 = [
|
||||||
|
{
|
||||||
|
prop: 'lineName',
|
||||||
|
label: '产线名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'timeVal',
|
||||||
|
label: '停机起止时间',
|
||||||
|
subcomponent: subDiv,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'durationStr',
|
||||||
|
label: '停机时长',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'reason',
|
||||||
|
label: '原因',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const tableProps2 = [
|
||||||
|
{
|
||||||
|
prop: 'lineName',
|
||||||
|
label: '产线名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'sectionName',
|
||||||
|
label: '工段名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'timeVal',
|
||||||
|
label: '停机起止时间',
|
||||||
|
subcomponent: subDiv,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'duration',
|
||||||
|
label: '停机时长',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
export default {
|
||||||
|
mixins: [basicPage],
|
||||||
|
name: '',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
urlOptions: {
|
||||||
|
exportURL: exportPlanList,
|
||||||
|
},
|
||||||
|
formConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'lineIds',
|
||||||
|
collapseTags: true,
|
||||||
|
multiple: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间范围',
|
||||||
|
dateType: 'daterange',
|
||||||
|
format: 'yyyy-MM-dd',
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeVal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separate',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '新增',
|
||||||
|
name: 'add',
|
||||||
|
color: 'success',
|
||||||
|
plain: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separate',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '导出',
|
||||||
|
name: 'export',
|
||||||
|
color: 'warning',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
tableBtn: [
|
||||||
|
{
|
||||||
|
type: 'edit',
|
||||||
|
btnName: '编辑',
|
||||||
|
},
|
||||||
|
].filter((v) => v),
|
||||||
|
activeName: '计划停机配置',
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
lineIds: null,
|
||||||
|
times: null,
|
||||||
|
},
|
||||||
|
tableProps1,
|
||||||
|
tableProps2,
|
||||||
|
list: [],
|
||||||
|
lineList: [],
|
||||||
|
formInline: {
|
||||||
|
lineIds: null,
|
||||||
|
times: null,
|
||||||
|
durationJudge: '1',
|
||||||
|
duration: 0,
|
||||||
|
},
|
||||||
|
options: [], // 产线/工段选项
|
||||||
|
// 停机时长筛选相关
|
||||||
|
durationJudge: '1',
|
||||||
|
duration1: 0,
|
||||||
|
duration2: '',
|
||||||
|
timeUnit: 'minute',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: { ButtonNav, AddOrUpdate },
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
getProductionLinePage({
|
||||||
|
page: 1,
|
||||||
|
limit: 500,
|
||||||
|
}).then((response) => {
|
||||||
|
this.formConfig[0].selectOptions = response.data.list;
|
||||||
|
});
|
||||||
|
if (this.$refs.buttonNav) {
|
||||||
|
this.$refs.buttonNav.currentMenu = '计划停机配置';
|
||||||
|
}
|
||||||
|
this.getDataList();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
currentMenu(val) {
|
||||||
|
this.activeName = val;
|
||||||
|
if (this.activeName == '计划停机配置') {
|
||||||
|
this.urlOptions.exportURL = exportPlanList;
|
||||||
|
this.getDataList();
|
||||||
|
} else {
|
||||||
|
this.urlOptions.exportURL = exportErrorList;
|
||||||
|
getGroupPlanTree().then((res) => {
|
||||||
|
this.options = res.data;
|
||||||
|
});
|
||||||
|
this.getErrorList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//计划停机配置list
|
||||||
|
getDataList() {
|
||||||
|
planList(this.queryParams).then((response) => {
|
||||||
|
this.list = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//停机记录list
|
||||||
|
getErrorList() {
|
||||||
|
errorList(this.formInline).then((response) => {
|
||||||
|
this.list = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 查询
|
||||||
|
buttonClick(val) {
|
||||||
|
switch (val.btnName) {
|
||||||
|
case 'search':
|
||||||
|
this.queryParams.lineIds = val.lineIds;
|
||||||
|
this.queryParams.type = val.type;
|
||||||
|
this.queryParams.times = val.timeVal;
|
||||||
|
this.getDataList();
|
||||||
|
break;
|
||||||
|
case 'add':
|
||||||
|
this.addOrEditTitle = '新增';
|
||||||
|
this.addOrUpdateVisible = true;
|
||||||
|
this.addOrUpdateHandle();
|
||||||
|
break;
|
||||||
|
case 'export':
|
||||||
|
this.handleExport();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//tableBtn点击
|
||||||
|
handleClick(val) {
|
||||||
|
if (val.type === 'edit') {
|
||||||
|
this.addOrUpdateVisible = true;
|
||||||
|
this.addOrEditTitle = '编辑';
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.addOrUpdate.init(val.data.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleCompareChange() {
|
||||||
|
// 切换为非between时清空第二个输入框
|
||||||
|
if (this.durationJudge !== '6') {
|
||||||
|
this.duration2 = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// * 禁止输入非数字字符
|
||||||
|
preventNonInteger(e) {
|
||||||
|
// 允许数字、退格、删除、方向键
|
||||||
|
const keyCode = e.keyCode;
|
||||||
|
if (
|
||||||
|
!(keyCode >= 48 && keyCode <= 57) && // 0-9
|
||||||
|
!(keyCode >= 96 && keyCode <= 105) && // 小键盘0-9
|
||||||
|
keyCode !== 8 && // Backspace
|
||||||
|
keyCode !== 46 && // Delete
|
||||||
|
!(keyCode >= 37 && keyCode <= 40) // 方向键
|
||||||
|
) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRecordSearch() {
|
||||||
|
this.formInline.durationJudge = this.durationJudge;
|
||||||
|
// 构建停机时长筛选条件
|
||||||
|
if (this.durationJudge === '6') {
|
||||||
|
if (this.duration1 !== '' && this.duration2 !== '') {
|
||||||
|
this.formInline.duration = undefined;
|
||||||
|
// 转分钟
|
||||||
|
let start = Number(this.duration1);
|
||||||
|
let end = Number(this.duration2);
|
||||||
|
if (this.timeUnit === 'hour') {
|
||||||
|
start *= 60;
|
||||||
|
end *= 60;
|
||||||
|
} else if (this.timeUnit === 'day') {
|
||||||
|
start *= 60 * 24;
|
||||||
|
end *= 60 * 24;
|
||||||
|
} //minute 则不处理
|
||||||
|
this.formInline.betweenDurationStart = start;
|
||||||
|
this.formInline.betweenDurationEnd = end;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.duration1 !== '') {
|
||||||
|
let val = Number(this.duration1);
|
||||||
|
if (this.timeUnit === 'hour') {
|
||||||
|
val *= 60;
|
||||||
|
} else if (this.timeUnit === 'day') {
|
||||||
|
val *= 60 * 24;
|
||||||
|
}
|
||||||
|
this.formInline.duration = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 调用接口查询数据
|
||||||
|
|
||||||
|
this.getErrorList();
|
||||||
|
},
|
||||||
|
handleExport1() {
|
||||||
|
this.handleRecordSearch()
|
||||||
|
// 处理查询参数
|
||||||
|
let params = { ...this.formInline };
|
||||||
|
params.pageNo = undefined;
|
||||||
|
params.pageSize = undefined;
|
||||||
|
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
|
||||||
|
this.exportLoading = true;
|
||||||
|
return this.urlOptions.exportURL(params);
|
||||||
|
}).then(response => {
|
||||||
|
this.$download.excel(response, '报表.xls');
|
||||||
|
this.exportLoading = false;
|
||||||
|
}).catch(() => { });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.searchBarBox {
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.searchBarBox::after {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.searchBar .blue-block {
|
||||||
|
display: inline-block;
|
||||||
|
width: 4px;
|
||||||
|
height: 16px;
|
||||||
|
background-color: #0b58ff;
|
||||||
|
border-radius: 1px;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
.searchBar .el-form-item {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
35
src/views/base/equipmentSectionShutdownLog/subDiv.vue
Normal file
35
src/views/base/equipmentSectionShutdownLog/subDiv.vue
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2024-07-01 14:53:55
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2026-03-18 14:32:19
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
parseTime(injectData.startTime, '{y}年{m}月{d}日') +
|
||||||
|
'-' +
|
||||||
|
parseTime(injectData.endTime, '{y}年{m}月{d}日')
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
injectData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
created() {},
|
||||||
|
methods: {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -89,6 +89,31 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {},
|
created() {},
|
||||||
methods: {
|
methods: {
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs["dataForm"].validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 修改的提交
|
||||||
|
if (this.dataForm.id) {
|
||||||
|
this.urlOptions.updateURL(this.dataForm).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit("refreshDataList");
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
this.urlOptions.createURL(this.dataForm).then(response => {
|
||||||
|
if (response.code === 1001033 || response.code === 1001034) {
|
||||||
|
return this.$modal.msgError(response.msg);
|
||||||
|
}
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit("refreshDataList");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
style="width: 75%"
|
style="width: 75%"
|
||||||
v-model="dataForm.price"
|
v-model="dataForm.price"
|
||||||
clearable
|
clearable
|
||||||
placeholder="请输入允许留存时间" />
|
placeholder="请输入单价" />
|
||||||
{{ unit }}
|
{{ unit }}
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -103,7 +103,7 @@ export default {
|
|||||||
id: null,
|
id: null,
|
||||||
code: '',
|
code: '',
|
||||||
materialId: '',
|
materialId: '',
|
||||||
price: '',
|
price: undefined,
|
||||||
startTime: new Date().getTime(),
|
startTime: new Date().getTime(),
|
||||||
endTime: null,
|
endTime: null,
|
||||||
remark: '',
|
remark: '',
|
||||||
@@ -141,15 +141,40 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
setCode() {
|
setCode() {
|
||||||
|
console.log('this.MaterialList', this.urlOptions.dictArr.dict0);
|
||||||
|
|
||||||
this.MaterialList.forEach((item) => {
|
this.MaterialList.forEach((item) => {
|
||||||
if (item.id === this.dataForm.materialId) {
|
if (item.id === this.dataForm.materialId) {
|
||||||
this.dataForm.code = item.code;
|
this.dataForm.code = item.code;
|
||||||
this.unit =
|
this.unit =
|
||||||
'元/' +
|
'元/' +
|
||||||
this.urlOptions.dictArr.dict0.find((d) => d.value === item.unit)
|
this.urlOptions.dictArr.dict0.find((d) => d.value == item.unit)
|
||||||
.label;
|
.label;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs["dataForm"].validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 修改的提交
|
||||||
|
if (this.dataForm.id) {
|
||||||
|
this.urlOptions.updateURL(this.dataForm).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit("refreshDataList");
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
this.urlOptions.createURL(this.dataForm).then(response => {
|
||||||
|
// console.log('response',);
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit("refreshDataList");
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,15 +47,15 @@ const tableProps = [
|
|||||||
prop: 'equipmentName',
|
prop: 'equipmentName',
|
||||||
label: '设备',
|
label: '设备',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
prop: 'size',
|
// prop: 'size',
|
||||||
label: '规格',
|
// label: '规格',
|
||||||
showOverflowtooltip: true,
|
// showOverflowtooltip: true,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
prop: 'process',
|
// prop: 'process',
|
||||||
label: '产品工艺',
|
// label: '产品工艺',
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
prop: 'standardCt',
|
prop: 'standardCt',
|
||||||
label: '标准节拍pcs/min',
|
label: '标准节拍pcs/min',
|
||||||
|
|||||||
295
src/views/core/analysis/balanceAnalysis/index-jiepai.vue
Normal file
295
src/views/core/analysis/balanceAnalysis/index-jiepai.vue
Normal file
@@ -0,0 +1,295 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: Do not edit
|
||||||
|
* @Date: 2023-08-29 14:59:29
|
||||||
|
* @LastEditTime: 2026-04-16 13:14:29
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<search-bar
|
||||||
|
:formConfigs="formConfig"
|
||||||
|
ref="searchBarForm"
|
||||||
|
@select-changed="handleSearchBarChanged"
|
||||||
|
@headBtnClick="buttonClick" />
|
||||||
|
<div v-if="showData.length">
|
||||||
|
<base-table
|
||||||
|
class="right-aside"
|
||||||
|
v-loading="dataListLoading"
|
||||||
|
:table-props="tableProps"
|
||||||
|
:page="1"
|
||||||
|
:limit="999"
|
||||||
|
:table-data="showData">
|
||||||
|
<method-btn
|
||||||
|
v-if="showData.length"
|
||||||
|
slot="handleBtn"
|
||||||
|
:width="80"
|
||||||
|
label="操作"
|
||||||
|
:method-list="tableBtn"
|
||||||
|
@clickBtn="handleClick" />
|
||||||
|
</base-table>
|
||||||
|
<barChart
|
||||||
|
v-for="item in chartData"
|
||||||
|
:key="item.name + 'echart'"
|
||||||
|
style="margin-top: 50px"
|
||||||
|
height="600px"
|
||||||
|
:id="item.name + 'echart'"
|
||||||
|
:title="item.name + ' 节拍趋势图'"
|
||||||
|
:bar-data="item" />
|
||||||
|
</div>
|
||||||
|
<div v-else class="no-data-bg"></div>
|
||||||
|
<base-dialog
|
||||||
|
:dialogTitle="addOrEditTitle"
|
||||||
|
:dialogVisible="addOrUpdateVisible"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
@confirm="handleConfirm"
|
||||||
|
:before-close="handleCancel"
|
||||||
|
close-on-click-modal
|
||||||
|
top="0"
|
||||||
|
width="50%">
|
||||||
|
<eq-detail ref="eqDetail" />
|
||||||
|
<slot name="footer">
|
||||||
|
<el-row slot="footer" type="flex" justify="end">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-button size="small" class="btnTextStyle" @click="handleCancel">
|
||||||
|
取消
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</slot>
|
||||||
|
</base-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import eqDetail from './eq-detail';
|
||||||
|
import { parseTime } from '../../mixins/code-filter';
|
||||||
|
import { getPLlistByFactory } from '@/api/core/monitoring/auto';
|
||||||
|
import { getNewCTNow, getNewCTCharts } from '@/api/core/analysis/index';
|
||||||
|
import { getFactoryPage } from '@/api/core/base/factory';
|
||||||
|
// import codeFilter from '../../mixins/code-filter'
|
||||||
|
import * as XLSX from 'xlsx';
|
||||||
|
import FileSaver from 'file-saver';
|
||||||
|
import barChart from './BarChart.vue';
|
||||||
|
|
||||||
|
const tableProps = [
|
||||||
|
{
|
||||||
|
prop: 'factoryName',
|
||||||
|
label: '工厂',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'lineName',
|
||||||
|
label: '产线',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'size',
|
||||||
|
label: '规格',
|
||||||
|
showOverflowtooltip: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'process',
|
||||||
|
label: '产品工艺',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'edgeCt',
|
||||||
|
label: '磨边当前节拍pcs/min',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'temperCt',
|
||||||
|
label: '钢化当前节拍pcs/min',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'downCt',
|
||||||
|
label: '下片当前节拍pcs/min',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
barChart,
|
||||||
|
eqDetail,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
urlOptions: {
|
||||||
|
getDataListURL: getNewCTNow,
|
||||||
|
},
|
||||||
|
listQuery: {
|
||||||
|
lineId: [],
|
||||||
|
},
|
||||||
|
fileName: '',
|
||||||
|
dataListLoading: false,
|
||||||
|
tableProps,
|
||||||
|
tableBtn: [
|
||||||
|
{
|
||||||
|
type: 'eq',
|
||||||
|
btnName: '详情',
|
||||||
|
},
|
||||||
|
].filter((v) => v),
|
||||||
|
showData: [],
|
||||||
|
tableData: [],
|
||||||
|
chartData: [],
|
||||||
|
formConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '工厂',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'factoryId',
|
||||||
|
collapseTags: true,
|
||||||
|
multiple: true,
|
||||||
|
onchange: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'lineId',
|
||||||
|
collapseTags: true,
|
||||||
|
multiple: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间范围',
|
||||||
|
dateType: 'datetimerange',
|
||||||
|
format: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
valueFormat: 'timestamp',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
defaultTime: ['00:00:00', '23:59:59'],
|
||||||
|
param: 'timeVal',
|
||||||
|
width: 350,
|
||||||
|
clearable: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
addOrEditTitle: '',
|
||||||
|
addOrUpdateVisible: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// 获取当前时间
|
||||||
|
const now = new Date();
|
||||||
|
// 获取前一天的同一时间
|
||||||
|
const yesterday = new Date(now.getTime());
|
||||||
|
// 设置为00:00:00
|
||||||
|
yesterday.setHours(0, 0, 0, 0);
|
||||||
|
// 设置为23:59:59
|
||||||
|
const end = new Date(yesterday.getTime());
|
||||||
|
end.setHours(23, 59, 59, 59);
|
||||||
|
this.listQuery.startTime = yesterday.getTime();
|
||||||
|
this.listQuery.endTime = end.getTime();
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.searchBarForm.formInline.timeVal = [
|
||||||
|
yesterday.getTime(),
|
||||||
|
end.getTime(),
|
||||||
|
];
|
||||||
|
});
|
||||||
|
this.getDataList();
|
||||||
|
this.getPdLineList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleExport() {
|
||||||
|
let tables = document.querySelector('.el-table').cloneNode(true);
|
||||||
|
const fix = tables.querySelector('.el-table__fixed');
|
||||||
|
const fixRight = tables.querySelector('.el-table__fixed-right');
|
||||||
|
if (fix) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed'));
|
||||||
|
}
|
||||||
|
if (fixRight) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed-right'));
|
||||||
|
}
|
||||||
|
let exportTable = XLSX.utils.table_to_book(tables);
|
||||||
|
|
||||||
|
var exportTableOut = XLSX.write(exportTable, {
|
||||||
|
bookType: 'xlsx',
|
||||||
|
bookSST: true,
|
||||||
|
type: 'array',
|
||||||
|
});
|
||||||
|
// sheetjs.xlsx为导出表格的标题名称
|
||||||
|
try {
|
||||||
|
FileSaver.saveAs(
|
||||||
|
new Blob([exportTableOut], {
|
||||||
|
type: 'application/octet-stream',
|
||||||
|
}),
|
||||||
|
this.fileName + '产线自动报表.xlsx'
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
if (typeof console !== 'undefined') console.log(e, exportTableOut);
|
||||||
|
}
|
||||||
|
return exportTableOut;
|
||||||
|
},
|
||||||
|
getPdLineList() {
|
||||||
|
// getPLlistByFactory().then((res) => {
|
||||||
|
// this.formConfig[1].selectOptions = res.data || [];
|
||||||
|
// });
|
||||||
|
const params = {
|
||||||
|
pageSize: 100,
|
||||||
|
pageNo: 1,
|
||||||
|
};
|
||||||
|
getFactoryPage(params).then((res) => {
|
||||||
|
this.formConfig[0].selectOptions = res.data.list || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttonClick(val) {
|
||||||
|
switch (val.btnName) {
|
||||||
|
case 'search':
|
||||||
|
this.listQuery.factoryId = val.factoryId || undefined;
|
||||||
|
this.listQuery.lineId = val.lineId ? val.lineId : [];
|
||||||
|
this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined;
|
||||||
|
this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined;
|
||||||
|
this.getDataList();
|
||||||
|
break;
|
||||||
|
case 'export':
|
||||||
|
this.handleExport();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取数据列表
|
||||||
|
getDataList() {
|
||||||
|
this.dataListLoading = true;
|
||||||
|
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
|
||||||
|
this.tableData = response.data;
|
||||||
|
this.dataListLoading = false;
|
||||||
|
this.showData = this.tableData;
|
||||||
|
});
|
||||||
|
getNewCTCharts(this.listQuery).then((response) => {
|
||||||
|
this.chartData = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleSearchBarChanged({ param, value }) {
|
||||||
|
this.listQuery.lineId = [];
|
||||||
|
this.$refs.searchBarForm.formInline.lineId = undefined;
|
||||||
|
getPLlistByFactory({ factoryIds: this.$refs.searchBarForm.formInline.factoryId }).then((res) => {
|
||||||
|
this.formConfig[1].selectOptions = res.data || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClick(val) {
|
||||||
|
this.addOrUpdateVisible = true;
|
||||||
|
this.addOrEditTitle =
|
||||||
|
val.data?.factoryName + '-' + val.data?.lineName + ' 详情';
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.eqDetail.init(
|
||||||
|
val.data.lineId,
|
||||||
|
this.listQuery.startTime,
|
||||||
|
this.listQuery.endTime
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.addOrUpdateVisible = false;
|
||||||
|
this.addOrEditTitle = '';
|
||||||
|
},
|
||||||
|
handleConfirm() {
|
||||||
|
this.handleCancel();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -1,296 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<search-bar
|
|
||||||
:formConfigs="formConfig"
|
|
||||||
ref="searchBarForm"
|
|
||||||
@headBtnClick="buttonClick" />
|
|
||||||
<div v-if="tableData.length">
|
|
||||||
<base-table
|
|
||||||
v-loading="dataListLoading"
|
|
||||||
:span-method="mergeColumnHandler"
|
|
||||||
:max-height="tableH"
|
|
||||||
:table-props="tableProps"
|
|
||||||
:table-data="tableData" />
|
|
||||||
<SearchBar :formConfigs="[{ label: '产线平衡分析图', type: 'title' }]" />
|
|
||||||
<balance-chart ref="lineChart" />
|
|
||||||
</div>
|
|
||||||
<div v-else class="no-data-bg"></div>
|
|
||||||
<!-- <pagination
|
|
||||||
:limit.sync="listQuery.pageSize"
|
|
||||||
:page.sync="listQuery.pageNo"
|
|
||||||
:total="listQuery.total"
|
|
||||||
@pagination="getDataList" /> -->
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// import basicPage from '../../mixins/basic-page';
|
|
||||||
import { parseTime } from '../../mixins/code-filter';
|
|
||||||
import { getCT } from '@/api/core/analysis/index';
|
|
||||||
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
|
||||||
import BalanceChart from '../balanceChart';
|
|
||||||
import { time } from 'echarts';
|
|
||||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
|
||||||
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
|
|
||||||
|
|
||||||
// const tableProps = [
|
|
||||||
// // {
|
|
||||||
// // prop: 'lineName',
|
|
||||||
// // label: '产线',
|
|
||||||
// // align: 'center',
|
|
||||||
// // },
|
|
||||||
// // {
|
|
||||||
// // prop: 'sum',
|
|
||||||
// // label: '合计',
|
|
||||||
// // align: 'center',
|
|
||||||
// // },
|
|
||||||
// // {
|
|
||||||
// // prop: 'dynamicValue',
|
|
||||||
// // label: 'dynamicName',
|
|
||||||
// // align: 'center',
|
|
||||||
// // children:[
|
|
||||||
|
|
||||||
// // ]
|
|
||||||
// // }
|
|
||||||
// ];
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
BalanceChart,
|
|
||||||
},
|
|
||||||
mixins: [tableHeightMixin],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
urlOptions: {
|
|
||||||
getDataListURL: getCT,
|
|
||||||
},
|
|
||||||
tableProps: [],
|
|
||||||
dataListLoading: false,
|
|
||||||
tableData: [],
|
|
||||||
listQuery: {
|
|
||||||
// time: ''
|
|
||||||
endTime: undefined,
|
|
||||||
lineId: undefined,
|
|
||||||
startTime: undefined,
|
|
||||||
},
|
|
||||||
timeList: [],
|
|
||||||
spanArr: [],
|
|
||||||
xData: [],
|
|
||||||
yData: [],
|
|
||||||
optionArrUrl: [getProductionLinePage],
|
|
||||||
formConfig: [
|
|
||||||
{
|
|
||||||
type: 'select',
|
|
||||||
label: '产线',
|
|
||||||
selectOptions: [],
|
|
||||||
param: 'lineIds',
|
|
||||||
defaultSelect: '',
|
|
||||||
multiple: false,
|
|
||||||
filterable: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'datePicker',
|
|
||||||
label: '时间',
|
|
||||||
dateType: 'datetimerange',
|
|
||||||
format: 'yyyy-MM-dd',
|
|
||||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
|
||||||
rangeSeparator: '-',
|
|
||||||
startPlaceholder: '开始时间',
|
|
||||||
endPlaceholder: '结束时间',
|
|
||||||
width: 350,
|
|
||||||
param: 'time',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'button',
|
|
||||||
btnName: '查询',
|
|
||||||
name: 'search',
|
|
||||||
color: 'primary',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.getArr();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getArr() {
|
|
||||||
const params = {
|
|
||||||
page: 1,
|
|
||||||
limit: 500,
|
|
||||||
};
|
|
||||||
this.optionArrUrl.forEach((item, index) => {
|
|
||||||
item(params).then((response) => {
|
|
||||||
this.formConfig[index].selectOptions = response.data.list;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
setRowSpan(arr) {
|
|
||||||
let count = 0;
|
|
||||||
arr.forEach((item, index) => {
|
|
||||||
if (index === 0) {
|
|
||||||
this.spanArr.push(1);
|
|
||||||
} else {
|
|
||||||
if (item === arr[index - 1]) {
|
|
||||||
this.spanArr[count] += 1;
|
|
||||||
this.spanArr.push(0);
|
|
||||||
} else {
|
|
||||||
count = index;
|
|
||||||
this.spanArr.push(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 合并table列的规则 */
|
|
||||||
mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
|
|
||||||
if (columnIndex == 0) {
|
|
||||||
if (this.spanArr[rowIndex]) {
|
|
||||||
return [
|
|
||||||
this.spanArr[rowIndex], // row span
|
|
||||||
1, // col span
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getData() {
|
|
||||||
// this.listQuery.lineId = '1672847052717821953'
|
|
||||||
// this.listQuery.startTime = '1693497600000';
|
|
||||||
// this.listQuery.endTime = '1693843200000';
|
|
||||||
this.urlOptions.getDataListURL(this.listQuery).then((res) => {
|
|
||||||
console.log(res);
|
|
||||||
let arr = [
|
|
||||||
{
|
|
||||||
prop: 'sectionName',
|
|
||||||
label: '工段',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'equName',
|
|
||||||
label: '设备',
|
|
||||||
align: 'center',
|
|
||||||
width: 150
|
|
||||||
},
|
|
||||||
];
|
|
||||||
let sectionArr = [];
|
|
||||||
res.data.data.forEach((ele, index) => {
|
|
||||||
let tempData = [];
|
|
||||||
let ggData = [];
|
|
||||||
let sbluData = [];
|
|
||||||
let sbsjData = [];
|
|
||||||
let cxluData = [];
|
|
||||||
let cxsjData = [];
|
|
||||||
ele.data.forEach((item, index) => {
|
|
||||||
item.children.forEach((params) => {
|
|
||||||
if (params.dynamicName === '生产规格') {
|
|
||||||
tempData[item.dynamicName + '_gg'] = params.dynamicValue;
|
|
||||||
ggData[index] = params.dynamicValue;
|
|
||||||
} else if (params.dynamicName === '设备理论速度') {
|
|
||||||
tempData[item.dynamicName + '_sblu'] = params.dynamicValue;
|
|
||||||
sbluData[index] = params.dynamicValue;
|
|
||||||
} else if (params.dynamicName === '设备实际速度') {
|
|
||||||
tempData[item.dynamicName + '_sbsj'] = params.dynamicValue;
|
|
||||||
sbsjData[index] = params.dynamicValue;
|
|
||||||
} else if (params.dynamicName === '产线理论速度') {
|
|
||||||
tempData[item.dynamicName + '_cxlu'] = params.dynamicValue;
|
|
||||||
cxluData[index] = params.dynamicValue;
|
|
||||||
} else if(params.dynamicName === '产线实际速度') {
|
|
||||||
tempData[item.dynamicName + '_cxsj'] = params.dynamicValue;
|
|
||||||
cxsjData[index] = params.dynamicValue;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
const equipment = {
|
|
||||||
name: ele.equName,
|
|
||||||
ggData: ggData,
|
|
||||||
sbluData: sbluData,
|
|
||||||
sbsjData: sbsjData,
|
|
||||||
cxluData: cxluData,
|
|
||||||
cxsjData: cxsjData,
|
|
||||||
};
|
|
||||||
tempData['equName'] = ele.equName;
|
|
||||||
tempData['sectionName'] = ele.sectionName;
|
|
||||||
this.tableData.push(tempData);
|
|
||||||
const { sectionName } = tempData;
|
|
||||||
sectionArr.push(sectionName);
|
|
||||||
this.yData.push(equipment);
|
|
||||||
});
|
|
||||||
this.setRowSpan(sectionArr);
|
|
||||||
res.data.nameData.forEach((item) => {
|
|
||||||
this.timeList.push(item.name);
|
|
||||||
});
|
|
||||||
const timeArray = Array.from(new Set(this.timeList));
|
|
||||||
console.log(timeArray)
|
|
||||||
for (const times of timeArray) {
|
|
||||||
if (times !== '生产规格' && times !== '设备理论速度' && times !== '设备实际速度'
|
|
||||||
&& times !== '产线理论速度' && times !== '产线实际速度'
|
|
||||||
) {
|
|
||||||
const subprop = {
|
|
||||||
label: times,
|
|
||||||
align: 'center',
|
|
||||||
children: [
|
|
||||||
{ prop: times + '_gg', label: '生产规格', align: 'center' },
|
|
||||||
{ prop: times + '_sblu', label: '设备理论速度[片/min]', align: 'center' },
|
|
||||||
{ prop: times + '_sbsj', label: '设备实际速度[片/min]', align: 'center' },
|
|
||||||
{ prop: times + '_cxlu', label: '产线理论速度[片/min]', align: 'center' },
|
|
||||||
{ prop: times + '_cxsj', label: '产线实际速度[片/min]', align: 'center' },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
arr.push(subprop);
|
|
||||||
this.xData.push(times);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.tableProps = arr;
|
|
||||||
|
|
||||||
console.log(this.$refs)
|
|
||||||
this.$nextTick(()=>{
|
|
||||||
this.$refs.lineChart.initChart(this.xData, this.yData);
|
|
||||||
})
|
|
||||||
// this.total = response.data.total;
|
|
||||||
// this.dataListLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buttonClick(val) {
|
|
||||||
// console.log(val)
|
|
||||||
switch (val.btnName) {
|
|
||||||
case 'search':
|
|
||||||
// this.listQuery.pageNo = 1;
|
|
||||||
// this.listQuery.pageSize = 10;
|
|
||||||
this.listQuery.lineId = val.lineIds;
|
|
||||||
this.listQuery.startTime = val.time
|
|
||||||
? String(new Date(val.time[0]).getTime())
|
|
||||||
: undefined;
|
|
||||||
this.listQuery.endTime = val.time
|
|
||||||
? String(new Date(val.time[1]).getTime())
|
|
||||||
: undefined;
|
|
||||||
if (val.time && val.lineIds) {
|
|
||||||
this.tableData = [];
|
|
||||||
this.xData = [];
|
|
||||||
this.yData = [];
|
|
||||||
this.tableProps = [];
|
|
||||||
this.spanArr = [];
|
|
||||||
this.timeList = [];
|
|
||||||
this.getData();
|
|
||||||
} else {
|
|
||||||
this.$message({
|
|
||||||
message: '请选择产线和时间',
|
|
||||||
type: 'warning',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'reset':
|
|
||||||
this.$refs.searchBarForm.resetForm();
|
|
||||||
this.listQuery = {
|
|
||||||
pageSize: 10,
|
|
||||||
pageNo: 1,
|
|
||||||
total: 1,
|
|
||||||
};
|
|
||||||
this.getDataList();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.log(val);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,162 +1,223 @@
|
|||||||
<!--
|
|
||||||
* @Author: Do not edit
|
|
||||||
* @Date: 2023-08-29 14:59:29
|
|
||||||
* @LastEditTime: 2025-01-09 10:27:53
|
|
||||||
* @LastEditors: zwq
|
|
||||||
* @Description:
|
|
||||||
-->
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div style="background: #f2f4f9">
|
||||||
|
<div style="background: #f2f4f9; height: 38px; width: 100%">
|
||||||
|
<ButtonNav
|
||||||
|
ref="buttonNav"
|
||||||
|
:menus="['OEE分析', 'TEEP分析', '节拍分析']"
|
||||||
|
@change="currentMenu">
|
||||||
|
<template v-slot:tab1>
|
||||||
|
<div>OEE分析</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:tab2>
|
||||||
|
<div>TEEP分析</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:tab3>
|
||||||
|
<div>节拍分析</div>
|
||||||
|
</template>
|
||||||
|
</ButtonNav>
|
||||||
|
</div>
|
||||||
|
<div class="scroll-container" v-if="activeName !== '节拍分析'">
|
||||||
|
<!-- 外层滚动容器 -->
|
||||||
|
<div class="card-scroll-wrapper">
|
||||||
|
<!-- 卡片列表 -->
|
||||||
|
<div
|
||||||
|
v-for="(item, index) in lineList"
|
||||||
|
:key="index"
|
||||||
|
class="efficiency-card">
|
||||||
|
<div class="card-label">
|
||||||
|
{{ item[activeName === 'OEE分析' ? 'oeename' : 'teepname'] }}
|
||||||
|
</div>
|
||||||
|
<div class="card-value">
|
||||||
|
{{ item[activeName === 'OEE分析' ? 'oeevalue' : 'teepvalue'] }}%
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style="
|
||||||
|
background: #ffffff;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
padding: 10px 10px 0 10px;
|
||||||
|
">
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
<search-bar
|
<search-bar
|
||||||
|
v-if="activeName !== '节拍分析'"
|
||||||
:formConfigs="formConfig"
|
:formConfigs="formConfig"
|
||||||
ref="searchBarForm"
|
ref="searchBarForm"
|
||||||
@select-changed="handleSearchBarChanged"
|
|
||||||
@headBtnClick="buttonClick" />
|
@headBtnClick="buttonClick" />
|
||||||
<div v-if="showData.length">
|
|
||||||
<base-table
|
|
||||||
class="right-aside"
|
|
||||||
v-loading="dataListLoading"
|
|
||||||
:table-props="tableProps"
|
|
||||||
:page="1"
|
|
||||||
:limit="999"
|
|
||||||
:table-data="showData">
|
|
||||||
<method-btn
|
|
||||||
v-if="showData.length"
|
|
||||||
slot="handleBtn"
|
|
||||||
:width="80"
|
|
||||||
label="操作"
|
|
||||||
:method-list="tableBtn"
|
|
||||||
@clickBtn="handleClick" />
|
|
||||||
</base-table>
|
|
||||||
<barChart
|
|
||||||
v-for="item in chartData"
|
|
||||||
:key="item.name + 'echart'"
|
|
||||||
style="margin-top: 50px"
|
|
||||||
height="600px"
|
|
||||||
:id="item.name + 'echart'"
|
|
||||||
:title="item.name + ' 节拍趋势图'"
|
|
||||||
:bar-data="item" />
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="no-data-bg"></div>
|
|
||||||
<base-dialog
|
<div
|
||||||
:dialogTitle="addOrEditTitle"
|
class="app-container"
|
||||||
:dialogVisible="addOrUpdateVisible"
|
v-if="activeName === 'OEE分析'"
|
||||||
@cancel="handleCancel"
|
style="background: #ffffff">
|
||||||
@confirm="handleConfirm"
|
<!-- 表 -->
|
||||||
:before-close="handleCancel"
|
<div>
|
||||||
close-on-click-modal
|
<base-table
|
||||||
top="0"
|
:page="1"
|
||||||
width="50%">
|
:limit="100"
|
||||||
<eq-detail ref="eqDetail" />
|
:table-props="tableProps1"
|
||||||
<slot name="footer">
|
:table-data="list"
|
||||||
<el-row slot="footer" type="flex" justify="end">
|
:max-height="500"></base-table>
|
||||||
<el-col :span="24">
|
</div>
|
||||||
<el-button size="small" class="btnTextStyle" @click="handleCancel">
|
</div>
|
||||||
取消
|
<div
|
||||||
</el-button>
|
class="app-container"
|
||||||
</el-col>
|
v-else-if="activeName === 'TEEP分析'"
|
||||||
</el-row>
|
style="background: #ffffff">
|
||||||
</slot>
|
<!-- 表 -->
|
||||||
</base-dialog>
|
<div>
|
||||||
|
<base-table
|
||||||
|
:page="1"
|
||||||
|
:limit="100"
|
||||||
|
:table-props="tableProps2"
|
||||||
|
:table-data="list"
|
||||||
|
:max-height="500"></base-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else style="background: #ffffff">
|
||||||
|
<indexJiepai />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import eqDetail from './eq-detail';
|
import ButtonNav from '@/components/ButtonNav';
|
||||||
import { parseTime } from '../../mixins/code-filter';
|
import indexJiepai from './index-jiepai.vue';
|
||||||
import { getPdList } from '@/api/core/monitoring/auto';
|
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
||||||
import { getNewCTNow, getNewCTCharts } from '@/api/core/analysis/index';
|
import {
|
||||||
import { getFactoryPage } from '@/api/core/base/factory';
|
listHeader,
|
||||||
// import codeFilter from '../../mixins/code-filter'
|
listLineReport,
|
||||||
import * as XLSX from 'xlsx';
|
exportTeepExcel,
|
||||||
import FileSaver from 'file-saver';
|
exportOeeExcel,
|
||||||
import barChart from './BarChart.vue';
|
} from '@/api/core/analysis/index';
|
||||||
|
import subDiv from './subDiv.vue';
|
||||||
|
|
||||||
const tableProps = [
|
const tableProps1 = [
|
||||||
{
|
{
|
||||||
prop: 'factoryName',
|
prop: 'name',
|
||||||
label: '工厂',
|
label: '名称',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'lineName',
|
prop: 'timeVal',
|
||||||
label: '产线',
|
label: '时间段',
|
||||||
|
subcomponent: subDiv,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'size',
|
prop: 'plannedProductionHours',
|
||||||
label: '规格',
|
label: '计划生产时长',
|
||||||
showOverflowtooltip: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'process',
|
prop: 'actualRunningHours',
|
||||||
label: '产品工艺',
|
label: '实际运行时长',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'edgeCt',
|
prop: 'actualDowntimeHours',
|
||||||
label: '磨边当前节拍pcs/min',
|
label: '实际停机时长',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'temperCt',
|
prop: 'inputQuantity',
|
||||||
label: '钢化当前节拍pcs/min',
|
label: '上片数量(片)',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'downCt',
|
prop: 'outputQuantity',
|
||||||
label: '下片当前节拍pcs/min',
|
label: '下片数量',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'qualityRate',
|
||||||
|
label: '良品率',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'availabilityRate',
|
||||||
|
label: '可用率',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'performanceRate',
|
||||||
|
label: '性能',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'oee',
|
||||||
|
label: 'OEE',
|
||||||
|
//filter: (val) => (val ? val.join(',') : ''),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const tableProps2 = [
|
||||||
export default {
|
{
|
||||||
components: {
|
prop: 'name',
|
||||||
barChart,
|
label: '产线名称',
|
||||||
eqDetail,
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'timeVal',
|
||||||
|
label: '时间段',
|
||||||
|
subcomponent: subDiv,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'teep',
|
||||||
|
label: 'TEEP',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'oee',
|
||||||
|
label: 'OEE',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'useRate',
|
||||||
|
label: '设备使用率',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'capacityUtilization',
|
||||||
|
label: '产能利用率',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
export default {
|
||||||
|
name: '',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
urlOptions: {
|
|
||||||
getDataListURL: getNewCTNow,
|
|
||||||
},
|
|
||||||
listQuery: {
|
|
||||||
lineId: [],
|
|
||||||
},
|
|
||||||
fileName: '',
|
|
||||||
dataListLoading: false,
|
|
||||||
tableProps,
|
|
||||||
tableBtn: [
|
|
||||||
{
|
|
||||||
type: 'eq',
|
|
||||||
btnName: '详情',
|
|
||||||
},
|
|
||||||
].filter((v) => v),
|
|
||||||
showData: [],
|
|
||||||
tableData: [],
|
|
||||||
chartData: [],
|
|
||||||
formConfig: [
|
formConfig: [
|
||||||
{
|
|
||||||
type: 'select',
|
|
||||||
label: '工厂',
|
|
||||||
selectOptions: [],
|
|
||||||
param: 'factoryId',
|
|
||||||
onchange: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: '产线',
|
label: '产线',
|
||||||
selectOptions: [],
|
selectOptions: [],
|
||||||
param: 'lineId',
|
param: 'lineId',
|
||||||
|
collapseTags: true,
|
||||||
multiple: true,
|
multiple: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '报表类型',
|
||||||
|
selectOptions: [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
name: '班',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '日',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// id: 2,
|
||||||
|
// name: '周',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: '月',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: '年',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
param: 'type',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'datePicker',
|
type: 'datePicker',
|
||||||
label: '时间范围',
|
label: '时间范围',
|
||||||
dateType: 'datetimerange',
|
dateType: 'daterange',
|
||||||
format: 'yyyy-MM-dd HH:mm:ss',
|
format: 'yyyy-MM-dd',
|
||||||
valueFormat: 'timestamp',
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
rangeSeparator: '-',
|
rangeSeparator: '-',
|
||||||
startPlaceholder: '开始时间',
|
startPlaceholder: '开始时间',
|
||||||
endPlaceholder: '结束时间',
|
endPlaceholder: '结束时间',
|
||||||
defaultTime: ['00:00:00', '23:59:59'],
|
|
||||||
param: 'timeVal',
|
param: 'timeVal',
|
||||||
width: 350,
|
|
||||||
clearable: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
@@ -164,139 +225,163 @@ export default {
|
|||||||
name: 'search',
|
name: 'search',
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// type: 'separate',
|
type: 'separate',
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// // type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
|
type: 'button',
|
||||||
// type: 'button',
|
btnName: '导出',
|
||||||
// btnName: '导出',
|
name: 'export',
|
||||||
// name: 'export',
|
color: 'warning',
|
||||||
// color: 'warning',
|
},
|
||||||
// },
|
|
||||||
],
|
],
|
||||||
addOrEditTitle: '',
|
activeName: 'OEE分析',
|
||||||
addOrUpdateVisible: false,
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
lineId: null,
|
||||||
|
type: null,
|
||||||
|
createTime: null,
|
||||||
|
},
|
||||||
|
tableProps1,
|
||||||
|
tableProps2,
|
||||||
|
list: [],
|
||||||
|
lineList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
components: { ButtonNav, indexJiepai },
|
||||||
// 获取当前时间
|
mounted() {
|
||||||
const now = new Date();
|
listHeader().then((response) => {
|
||||||
// 获取前一天的同一时间
|
this.lineList = response.data.map((item) => ({
|
||||||
const yesterday = new Date(now.getTime());
|
oeename: `${item.name}累计OEE综合效率`,
|
||||||
// 设置为00:00:00
|
teepname: `${item.name}累计TEEP综合效率`,
|
||||||
yesterday.setHours(0, 0, 0, 0);
|
oeevalue: item.oee.toFixed(2),
|
||||||
// 设置为23:59:59
|
teepvalue: item.teep.toFixed(2),
|
||||||
const end = new Date(yesterday.getTime());
|
}));
|
||||||
end.setHours(23, 59, 59, 59);
|
});
|
||||||
this.listQuery.startTime = yesterday.getTime();
|
this.$nextTick(() => {
|
||||||
this.listQuery.endTime = end.getTime();
|
getProductionLinePage({
|
||||||
this.$nextTick(() => {
|
page: 1,
|
||||||
this.$refs.searchBarForm.formInline.timeVal = [
|
limit: 500,
|
||||||
yesterday.getTime(),
|
}).then((response) => {
|
||||||
end.getTime(),
|
this.formConfig[0].selectOptions = response.data.list;
|
||||||
];
|
});
|
||||||
|
if (this.$refs.buttonNav) {
|
||||||
|
this.$refs.buttonNav.currentMenu = 'OEE分析';
|
||||||
|
}
|
||||||
|
this.getPage();
|
||||||
});
|
});
|
||||||
this.getDataList();
|
|
||||||
this.getPdLineList();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleExport() {
|
currentMenu(val) {
|
||||||
let tables = document.querySelector('.el-table').cloneNode(true);
|
this.activeName = val;
|
||||||
const fix = tables.querySelector('.el-table__fixed');
|
if (this.activeName !== '节拍分析') {
|
||||||
const fixRight = tables.querySelector('.el-table__fixed-right');
|
this.getPage();
|
||||||
if (fix) {
|
|
||||||
tables.removeChild(tables.querySelector('.el-table__fixed'));
|
|
||||||
}
|
}
|
||||||
if (fixRight) {
|
|
||||||
tables.removeChild(tables.querySelector('.el-table__fixed-right'));
|
|
||||||
}
|
|
||||||
let exportTable = XLSX.utils.table_to_book(tables);
|
|
||||||
|
|
||||||
var exportTableOut = XLSX.write(exportTable, {
|
|
||||||
bookType: 'xlsx',
|
|
||||||
bookSST: true,
|
|
||||||
type: 'array',
|
|
||||||
});
|
|
||||||
// sheetjs.xlsx为导出表格的标题名称
|
|
||||||
try {
|
|
||||||
FileSaver.saveAs(
|
|
||||||
new Blob([exportTableOut], {
|
|
||||||
type: 'application/octet-stream',
|
|
||||||
}),
|
|
||||||
this.fileName + '产线自动报表.xlsx'
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
if (typeof console !== 'undefined') console.log(e, exportTableOut);
|
|
||||||
}
|
|
||||||
return exportTableOut;
|
|
||||||
},
|
},
|
||||||
getPdLineList() {
|
getPage() {
|
||||||
getPdList().then((res) => {
|
listLineReport(this.queryParams).then((response) => {
|
||||||
this.formConfig[1].selectOptions = res.data || [];
|
this.list = response.data;
|
||||||
});
|
|
||||||
const params = {
|
|
||||||
pageSize: 100,
|
|
||||||
pageNo: 1,
|
|
||||||
};
|
|
||||||
getFactoryPage(params).then((res) => {
|
|
||||||
this.formConfig[0].selectOptions = res.data.list || [];
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 查询
|
||||||
buttonClick(val) {
|
buttonClick(val) {
|
||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
this.listQuery.factoryId = val.factoryId || undefined;
|
this.queryParams.lineId = val.lineId;
|
||||||
this.listQuery.lineId = val.lineId ? val.lineId : [];
|
this.queryParams.type = val.type;
|
||||||
this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined;
|
this.queryParams.createTime = val.timeVal;
|
||||||
this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined;
|
this.getPage();
|
||||||
this.getDataList();
|
|
||||||
break;
|
break;
|
||||||
case 'export':
|
case 'export':
|
||||||
|
this.queryParams.lineId = val.lineId;
|
||||||
|
this.queryParams.type = val.type;
|
||||||
|
this.queryParams.createTime = val.timeVal;
|
||||||
this.handleExport();
|
this.handleExport();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log(val);
|
console.log(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取数据列表
|
handleExport() {
|
||||||
getDataList() {
|
// 处理查询参数
|
||||||
this.dataListLoading = true;
|
const params = { ...this.queryParams };
|
||||||
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
|
params.pageNo = undefined;
|
||||||
this.tableData = response.data;
|
params.pageSize = undefined;
|
||||||
this.dataListLoading = false;
|
this.$modal
|
||||||
this.showData = this.tableData;
|
.confirm('是否确认导出所有数据项?')
|
||||||
});
|
.then(() => {
|
||||||
getNewCTCharts(this.listQuery).then((response) => {
|
this.exportLoading = true;
|
||||||
this.chartData = response.data;
|
return this.activeName == 'OEE分析'
|
||||||
});
|
? exportOeeExcel(params)
|
||||||
},
|
: exportTeepExcel(params);
|
||||||
handleSearchBarChanged({ param, value }) {
|
})
|
||||||
this.listQuery.lineId = [];
|
.then((response) => {
|
||||||
this.$refs.searchBarForm.formInline.lineId = undefined;
|
this.$download.excel(response, '报表.xls');
|
||||||
getPdList(value).then((res) => {
|
this.exportLoading = false;
|
||||||
this.formConfig[1].selectOptions = res.data || [];
|
})
|
||||||
});
|
.catch(() => {});
|
||||||
},
|
|
||||||
handleClick(val) {
|
|
||||||
this.addOrUpdateVisible = true;
|
|
||||||
this.addOrEditTitle =
|
|
||||||
val.data?.factoryName + '-' + val.data?.lineName + ' 详情';
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs.eqDetail.init(
|
|
||||||
val.data.lineId,
|
|
||||||
this.listQuery.startTime,
|
|
||||||
this.listQuery.endTime
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleCancel() {
|
|
||||||
this.addOrUpdateVisible = false;
|
|
||||||
this.addOrEditTitle = '';
|
|
||||||
},
|
|
||||||
handleConfirm() {
|
|
||||||
this.handleCancel();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
/* 外层容器:限制高度,提供背景 */
|
||||||
|
.scroll-container {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 0;
|
||||||
|
background-color: #f5f5f5; /* 背景色,可根据UI调整 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 核心样式:横向滚动 */
|
||||||
|
.card-scroll-wrapper {
|
||||||
|
/* 重要:开启Flex,让子元素横向排列 */
|
||||||
|
display: flex;
|
||||||
|
/* 重要:不换行,强制排在一行 */
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
/* 重要:添加横向滚动条 */
|
||||||
|
overflow-x: auto;
|
||||||
|
padding: 10px 15px;
|
||||||
|
/* 对齐方式 */
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 卡片样式:圆角、白色背景、阴影 */
|
||||||
|
.efficiency-card {
|
||||||
|
/* 固定宽度,也可以用 flex: 0 0 200px; 固定宽度 */
|
||||||
|
min-width: 200px;
|
||||||
|
height: 120px;
|
||||||
|
margin: 0 10px; /* 卡片之间的间距 */
|
||||||
|
padding: 20px 16px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 12px; /* 圆角 */
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); /* 轻微阴影 */
|
||||||
|
/* 卡片内部文字布局 */
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
/* 防止文字挤压 */
|
||||||
|
flex-shrink: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.efficiency-card:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 标签文字 */
|
||||||
|
.card-label {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666666;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
white-space: nowrap; /* 确保文字也不换行 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 数值文字(加粗放大) */
|
||||||
|
.card-value {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
35
src/views/core/analysis/balanceAnalysis/subDiv.vue
Normal file
35
src/views/core/analysis/balanceAnalysis/subDiv.vue
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2024-07-01 14:53:55
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2026-03-18 14:32:19
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
parseTime(injectData.startTime, '{y}年{m}月{d}日') +
|
||||||
|
'-' +
|
||||||
|
parseTime(injectData.endTime, '{y}年{m}月{d}日')
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
injectData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
created() {},
|
||||||
|
methods: {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
103
src/views/core/analysis/yieldAnalysis-handle/LineChart.vue
Normal file
103
src/views/core/analysis/yieldAnalysis-handle/LineChart.vue
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zhp
|
||||||
|
* @Date: 2023-09-13 09:02:25
|
||||||
|
* @LastEditTime: 2026-03-18 14:45:07
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div :class="className" :style="{ height: height, width: width }" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import * as echarts from 'echarts';
|
||||||
|
require('echarts/theme/macarons'); // echarts theme
|
||||||
|
// import resize from './mixins/resize'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// mixins: [resize],
|
||||||
|
props: {
|
||||||
|
className: {
|
||||||
|
type: String,
|
||||||
|
default: 'chart',
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '100%',
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: '350px',
|
||||||
|
},
|
||||||
|
// autoResize: {
|
||||||
|
// type: Boolean,
|
||||||
|
// default: true
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
chart: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// watch: {
|
||||||
|
// chartData: {
|
||||||
|
// deep: true,
|
||||||
|
// handler(val) {
|
||||||
|
// this.setOptions(val)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
mounted() {
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// this.initChart()
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
// beforeDestroy() {
|
||||||
|
// if (!this.chart) {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// this.chart.dispose()
|
||||||
|
// this.chart = null
|
||||||
|
// },
|
||||||
|
methods: {
|
||||||
|
initChart(xData, yData, lineName) {
|
||||||
|
this.chart = echarts.init(this.$el, 'macarons');
|
||||||
|
this.setOptions(xData, yData, lineName);
|
||||||
|
},
|
||||||
|
setOptions(xData, yData, lineName) {
|
||||||
|
let seriesData = [];
|
||||||
|
lineName.forEach((item, index) => {
|
||||||
|
seriesData.push(
|
||||||
|
{
|
||||||
|
name: item + '白班',
|
||||||
|
data: yData[index].map(item => item.day),
|
||||||
|
type: 'line',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: item + '夜班',
|
||||||
|
data: yData[index].map(item => item.night),
|
||||||
|
type: 'line',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
const result = lineName.flatMap((item) => [item + '白班', item + '夜班']);
|
||||||
|
this.chart.setOption(
|
||||||
|
{
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: xData,
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: result,
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
},
|
||||||
|
series: seriesData,
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
272
src/views/core/analysis/yieldAnalysis-handle/index.vue
Normal file
272
src/views/core/analysis/yieldAnalysis-handle/index.vue
Normal file
@@ -0,0 +1,272 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<search-bar
|
||||||
|
:formConfigs="formConfig"
|
||||||
|
ref="searchBarForm"
|
||||||
|
@headBtnClick="buttonClick" />
|
||||||
|
<div v-if="tableData.length">
|
||||||
|
<base-table
|
||||||
|
v-loading="dataListLoading"
|
||||||
|
:table-props="tableProps"
|
||||||
|
:max-height="tableH"
|
||||||
|
:table-data="tableData" />
|
||||||
|
<SearchBar :formConfigs="[{ label: '产品产量对比图', type: 'title' }]" />
|
||||||
|
<line-chart ref="lineChart" />
|
||||||
|
</div>
|
||||||
|
<div v-else class="no-data-bg"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { parseTime } from '../../mixins/code-filter';
|
||||||
|
import { getYieldAnalysisHandlePageData } from '@/api/core/analysis/index';
|
||||||
|
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
||||||
|
import lineChart from './LineChart';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
|
import subDiv from './subDiv.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
lineChart,
|
||||||
|
subDiv,
|
||||||
|
},
|
||||||
|
mixins: [tableHeightMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
urlOptions: {
|
||||||
|
getDataListURL: getYieldAnalysisHandlePageData,
|
||||||
|
},
|
||||||
|
tableProps: [],
|
||||||
|
dataListLoading: false,
|
||||||
|
tableData: [],
|
||||||
|
listQuery: {
|
||||||
|
lineIds: [],
|
||||||
|
time: '', // 存储时间选择器的选中值(时间戳/格式化字符串,根据接口要求调整)
|
||||||
|
},
|
||||||
|
dateLabelList: [],
|
||||||
|
optionArrUrl: [getProductionLinePage],
|
||||||
|
formConfig: [
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间',
|
||||||
|
dateType: 'month', // 单个月份选择
|
||||||
|
format: 'yyyy-MM', // 显示格式
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss', // 绑定值的格式
|
||||||
|
param: 'time',
|
||||||
|
defaultSelect: '', // 新增:默认月份值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'lineIds',
|
||||||
|
defaultSelect: [], // 产线默认选择值(多选数组)
|
||||||
|
multiple: true,
|
||||||
|
collapseTags: true,
|
||||||
|
filterable: true,
|
||||||
|
width: 300,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// 1. 初始化默认当月时间
|
||||||
|
this.initDefaultMonth();
|
||||||
|
// 2. 获取产线数据
|
||||||
|
this.getArr();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 初始化默认当月时间(单个月份)
|
||||||
|
*/
|
||||||
|
initDefaultMonth() {
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = now.getMonth(); // 月份从0开始,直接使用(取当月1号)
|
||||||
|
// 创建当月1号0点0分0秒的日期对象
|
||||||
|
const firstDayOfMonth = new Date(year, month, 1, 0, 0, 0);
|
||||||
|
// 转换为时间戳(毫秒级)
|
||||||
|
const defaultTimeStamp = firstDayOfMonth.getTime();
|
||||||
|
// 给时间选择器赋值默认值
|
||||||
|
this.formConfig[0].defaultSelect = firstDayOfMonth;
|
||||||
|
// this.listQuery.time = defaultTimeStamp;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取产线数据
|
||||||
|
*/
|
||||||
|
getArr() {
|
||||||
|
const params = {
|
||||||
|
page: 1,
|
||||||
|
limit: 500,
|
||||||
|
};
|
||||||
|
// 原代码forEach遍历冗余,直接调用第一个方法即可
|
||||||
|
this.optionArrUrl[0](params)
|
||||||
|
.then((response) => {
|
||||||
|
const lineList = response.data.list;
|
||||||
|
this.formConfig[1].selectOptions = lineList;
|
||||||
|
// 产线默认选择第一条数据(多选需用数组格式)
|
||||||
|
if (lineList.length > 0) {
|
||||||
|
const firstLineId = lineList[0].id;
|
||||||
|
this.formConfig[1].defaultSelect = [firstLineId];
|
||||||
|
// 给查询参数赋值
|
||||||
|
this.listQuery.lineIds = [firstLineId];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('获取产线数据失败:', err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取产量分析数据
|
||||||
|
*/
|
||||||
|
getData() {
|
||||||
|
this.dataListLoading = true; // 开启加载状态
|
||||||
|
this.urlOptions
|
||||||
|
.getDataListURL(this.listQuery)
|
||||||
|
.then((res) => {
|
||||||
|
let arr = [
|
||||||
|
{
|
||||||
|
prop: 'lineName',
|
||||||
|
label: '产线',
|
||||||
|
fixed: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'sum',
|
||||||
|
label: '合计[片]',
|
||||||
|
fixed: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: res.data ? res.data.nameData[0].name : undefined,
|
||||||
|
label: res.data ? res.data.nameData[0].name : undefined,
|
||||||
|
align: 'center',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
let xData = [];
|
||||||
|
let yAllData = [];
|
||||||
|
let lineName = [];
|
||||||
|
if (res.data) {
|
||||||
|
// 处理日期标签去重
|
||||||
|
let tempDateList = [];
|
||||||
|
res.data.nameData.forEach((date) => {
|
||||||
|
tempDateList.push(date.name);
|
||||||
|
});
|
||||||
|
this.dateLabelList = Array.from(new Set(tempDateList));
|
||||||
|
|
||||||
|
// 构造表头children和echarts横坐标
|
||||||
|
this.dateLabelList.forEach((item) => {
|
||||||
|
if (item.indexOf('年') === -1) {
|
||||||
|
arr[2].children.push({
|
||||||
|
prop: item,
|
||||||
|
label: item,
|
||||||
|
subcomponent: subDiv,
|
||||||
|
});
|
||||||
|
xData.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 构造表格数据
|
||||||
|
let tableDataArr = [];
|
||||||
|
res.data.data.forEach((item) => {
|
||||||
|
let obj = {
|
||||||
|
lineName: item.lineName,
|
||||||
|
sum: item.sum,
|
||||||
|
};
|
||||||
|
item.data.forEach((ele) => {
|
||||||
|
ele.children.forEach((e) => {
|
||||||
|
obj[e.dynamicName] = JSON.parse(e.dynamicValue || '{}');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
tableDataArr.push(obj);
|
||||||
|
});
|
||||||
|
this.tableData = tableDataArr;
|
||||||
|
this.tableProps = arr;
|
||||||
|
|
||||||
|
// 构造图表数据
|
||||||
|
res.data.data.forEach((item) => {
|
||||||
|
let yData = [];
|
||||||
|
lineName.push(item.lineName);
|
||||||
|
item.data.forEach((ele) => {
|
||||||
|
ele.children.forEach((e) => {
|
||||||
|
yData.push(JSON.parse(e.dynamicValue || '{}'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
yAllData.push(yData);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.tableProps = arr;
|
||||||
|
this.tableData = [];
|
||||||
|
xData = [];
|
||||||
|
yAllData = [];
|
||||||
|
lineName = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化图表
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.lineChart.initChart(xData, yAllData, lineName);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('获取产量数据失败:', err);
|
||||||
|
this.tableData = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.dataListLoading = false; // 关闭加载状态
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 搜索栏按钮点击事件
|
||||||
|
* @param {Object} val - 按钮/表单传递的参数
|
||||||
|
*/
|
||||||
|
buttonClick(val) {
|
||||||
|
switch (val.btnName) {
|
||||||
|
case 'search':
|
||||||
|
// 处理产线参数(避免undefined,空值设为空数组)
|
||||||
|
this.listQuery.lineIds = val.lineIds || [];
|
||||||
|
// 处理时间参数:如果是时间字符串,可转换为时间戳(根据接口要求调整)
|
||||||
|
if (val.time) {
|
||||||
|
// this.listQuery.time = val.time;
|
||||||
|
// 若接口需要时间戳,取消下面注释:
|
||||||
|
this.listQuery.time = new Date(val.time).getTime();
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
message: '请选择时间',
|
||||||
|
type: 'warning',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证产线是否选择(可选,根据业务需求调整)
|
||||||
|
if (this.listQuery.lineIds.length === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '请选择至少一条产线',
|
||||||
|
type: 'warning',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getData();
|
||||||
|
break;
|
||||||
|
case 'reset':
|
||||||
|
// 重置表单
|
||||||
|
this.$refs.searchBarForm.resetForm();
|
||||||
|
// 恢复默认值
|
||||||
|
this.listQuery = {
|
||||||
|
lineIds: this.formConfig[1].defaultSelect || [],
|
||||||
|
time: this.formConfig[0].defaultValue || '',
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
31
src/views/core/analysis/yieldAnalysis-handle/subDiv.vue
Normal file
31
src/views/core/analysis/yieldAnalysis-handle/subDiv.vue
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2024-07-01 14:53:55
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2026-03-18 14:32:19
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div style="text-align:center">
|
||||||
|
<div style="padding:3px 6px;border:1px solid black">{{ injectData[injectData.prop].day || '-' }}</div>
|
||||||
|
<div style="padding:3px 6px;border:1px solid black;background-color: black;color: #fff;">{{ injectData[injectData.prop].night || '-' }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
injectData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
methods: {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -1,56 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<search-bar
|
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||||
:formConfigs="formConfig"
|
|
||||||
ref="searchBarForm"
|
|
||||||
@headBtnClick="buttonClick" />
|
|
||||||
<div v-if="tableData.length">
|
<div v-if="tableData.length">
|
||||||
<base-table
|
<base-table v-loading="dataListLoading" :table-props="tableProps" :max-height="tableH" :table-data="tableData" />
|
||||||
v-loading="dataListLoading"
|
|
||||||
:table-props="tableProps"
|
|
||||||
:max-height="tableH"
|
|
||||||
:table-data="tableData" />
|
|
||||||
<SearchBar :formConfigs="[{ label: '产品产量对比图', type: 'title' }]" />
|
<SearchBar :formConfigs="[{ label: '产品产量对比图', type: 'title' }]" />
|
||||||
<line-chart ref="lineChart" />
|
<line-chart ref="lineChart" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="no-data-bg"></div>
|
<div v-else class="no-data-bg"></div>
|
||||||
<!-- <pagination
|
|
||||||
:limit.sync="listQuery.pageSize"
|
|
||||||
:page.sync="listQuery.pageNo"
|
|
||||||
:total="listQuery.total"
|
|
||||||
@pagination="getDataList" /> -->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import basicPage from '../../mixins/basic-page';
|
|
||||||
import { parseTime } from '../../mixins/code-filter';
|
import { parseTime } from '../../mixins/code-filter';
|
||||||
import { getYieldAnalysisPageData } from '@/api/core/analysis/index';
|
import { getYieldAnalysisPageData } from '@/api/core/analysis/index';
|
||||||
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
||||||
import lineChart from '../LineChart';
|
import lineChart from '../LineChart';
|
||||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
|
|
||||||
|
|
||||||
// const tableProps = [
|
|
||||||
// // {
|
|
||||||
// // prop: 'lineName',
|
|
||||||
// // label: '产线',
|
|
||||||
// // align: 'center',
|
|
||||||
// // },
|
|
||||||
// // {
|
|
||||||
// // prop: 'sum',
|
|
||||||
// // label: '合计',
|
|
||||||
// // align: 'center',
|
|
||||||
// // },
|
|
||||||
// // {
|
|
||||||
// // prop: 'dynamicValue',
|
|
||||||
// // label: 'dynamicName',
|
|
||||||
// // align: 'center',
|
|
||||||
// // children:[
|
|
||||||
|
|
||||||
// // ]
|
|
||||||
// // }
|
|
||||||
// ];
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -67,31 +32,30 @@ export default {
|
|||||||
tableData: [],
|
tableData: [],
|
||||||
listQuery: {
|
listQuery: {
|
||||||
lineIds: [],
|
lineIds: [],
|
||||||
time: '',
|
time: '', // 存储时间选择器的选中值(时间戳/格式化字符串,根据接口要求调整)
|
||||||
},
|
},
|
||||||
dateLabelList: [],
|
dateLabelList: [],
|
||||||
optionArrUrl: [getProductionLinePage],
|
optionArrUrl: [getProductionLinePage],
|
||||||
formConfig: [
|
formConfig: [
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间',
|
||||||
|
dateType: 'month', // 单个月份选择
|
||||||
|
format: 'yyyy-MM', // 显示格式
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss', // 绑定值的格式
|
||||||
|
param: 'time',
|
||||||
|
defaultSelect: '', // 新增:默认月份值
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: '产线',
|
label: '产线',
|
||||||
selectOptions: [],
|
selectOptions: [],
|
||||||
param: 'lineIds',
|
param: 'lineIds',
|
||||||
defaultSelect: [],
|
defaultSelect: [], // 产线默认选择值(多选数组)
|
||||||
multiple: true,
|
multiple: true,
|
||||||
|
collapseTags: true,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
width: 200,
|
width: 300,
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'datePicker',
|
|
||||||
label: '时间',
|
|
||||||
dateType: 'month',
|
|
||||||
format: 'yyyy-MM',
|
|
||||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
|
||||||
rangeSeparator: '-',
|
|
||||||
startPlaceholder: '开始时间',
|
|
||||||
endPlaceholder: '结束时间',
|
|
||||||
param: 'time',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
@@ -102,28 +66,60 @@ export default {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
mounted() {
|
||||||
|
// 1. 初始化默认当月时间
|
||||||
|
this.initDefaultMonth();
|
||||||
|
// 2. 获取产线数据
|
||||||
this.getArr();
|
this.getArr();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 初始化默认当月时间(单个月份)
|
||||||
|
*/
|
||||||
|
initDefaultMonth() {
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = now.getMonth(); // 月份从0开始,直接使用(取当月1号)
|
||||||
|
// 创建当月1号0点0分0秒的日期对象
|
||||||
|
const firstDayOfMonth = new Date(year, month, 1, 0, 0, 0);
|
||||||
|
// 转换为时间戳(毫秒级)
|
||||||
|
const defaultTimeStamp = firstDayOfMonth.getTime();
|
||||||
|
// 给时间选择器赋值默认值
|
||||||
|
this.formConfig[0].defaultSelect = firstDayOfMonth;
|
||||||
|
// this.listQuery.time = defaultTimeStamp;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取产线数据
|
||||||
|
*/
|
||||||
getArr() {
|
getArr() {
|
||||||
const params = {
|
const params = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 500,
|
limit: 500,
|
||||||
};
|
};
|
||||||
this.optionArrUrl.forEach((item, index) => {
|
// 原代码forEach遍历冗余,直接调用第一个方法即可
|
||||||
item(params).then((response) => {
|
this.optionArrUrl[0](params)
|
||||||
this.formConfig[index].selectOptions = response.data.list;
|
.then((response) => {
|
||||||
// this.formConfig[0].defaultSelect = response.data.list[0].id
|
const lineList = response.data.list;
|
||||||
// this.$set(this.formConfig[0], 'defaultSelect', response.data.list[0].id)
|
this.formConfig[1].selectOptions = lineList;
|
||||||
});
|
// 产线默认选择第一条数据(多选需用数组格式)
|
||||||
|
if (lineList.length > 0) {
|
||||||
|
const firstLineId = lineList[0].id;
|
||||||
|
this.formConfig[1].defaultSelect = [firstLineId];
|
||||||
|
// 给查询参数赋值
|
||||||
|
this.listQuery.lineIds = [firstLineId];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('获取产线数据失败:', err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 获取产量分析数据
|
||||||
|
*/
|
||||||
getData() {
|
getData() {
|
||||||
// this.listQuery.lineIds = ['1672847052717821953']
|
this.dataListLoading = true; // 开启加载状态
|
||||||
// this.listQuery.productId = val.productId;
|
this.urlOptions.getDataListURL(this.listQuery)
|
||||||
// this.listQuery.time = '1694486098000';
|
.then((res) => {
|
||||||
this.urlOptions.getDataListURL(this.listQuery).then((res) => {
|
|
||||||
let arr = [
|
let arr = [
|
||||||
{
|
{
|
||||||
prop: 'lineName',
|
prop: 'lineName',
|
||||||
@@ -142,49 +138,39 @@ export default {
|
|||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
// console.log(res.data.nameData.slice(1))
|
|
||||||
let xData = [];
|
let xData = [];
|
||||||
let yAllData = [];
|
let yAllData = [];
|
||||||
let lineName = [];
|
let lineName = [];
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
|
// 处理日期标签去重
|
||||||
let tempDateList = [];
|
let tempDateList = [];
|
||||||
res.data.nameData.forEach((date) => {
|
res.data.nameData.forEach((date) => {
|
||||||
tempDateList.push(date.name);
|
tempDateList.push(date.name);
|
||||||
});
|
});
|
||||||
this.dateLabelList = Array.from(new Set(tempDateList));
|
this.dateLabelList = Array.from(new Set(tempDateList));
|
||||||
|
|
||||||
|
// 构造表头children和echarts横坐标
|
||||||
this.dateLabelList.forEach((item) => {
|
this.dateLabelList.forEach((item) => {
|
||||||
if (item.indexOf('年') === -1) {
|
if (item.indexOf('年') === -1) {
|
||||||
// 构造表头
|
arr[2].children.push({
|
||||||
const props = {
|
|
||||||
prop: item,
|
prop: item,
|
||||||
label: item,
|
label: item,
|
||||||
};
|
});
|
||||||
arr[2].children.push(props);
|
|
||||||
|
|
||||||
// 构造echarts横坐标
|
|
||||||
xData.push(item);
|
xData.push(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// res.data.nameData.slice(1).forEach(item => {
|
|
||||||
// const props = {
|
// 构造表格数据
|
||||||
// 'prop': item.name,
|
|
||||||
// 'label': item.name,
|
|
||||||
// 'align': 'center'
|
|
||||||
// }
|
|
||||||
// arr[2].children.push(props)
|
|
||||||
// })
|
|
||||||
let tableDataArr = [];
|
let tableDataArr = [];
|
||||||
res.data.data.forEach((item) => {
|
res.data.data.forEach((item) => {
|
||||||
let obj = {};
|
let obj = {
|
||||||
(obj.lineName = item.lineName),
|
lineName: item.lineName,
|
||||||
(obj.sum = item.sum),
|
sum: item.sum,
|
||||||
item.data.forEach((ele, index) => {
|
};
|
||||||
// console.log(ele)
|
item.data.forEach((ele) => {
|
||||||
ele.children.forEach((e) => {
|
ele.children.forEach((e) => {
|
||||||
console.log(e.dynamicName);
|
obj[e.dynamicName] = e.dynamicValue;
|
||||||
obj['' + e.dynamicName + ''] = e.dynamicValue;
|
|
||||||
console.log(obj['' + e.dynamicName + '']);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
tableDataArr.push(obj);
|
tableDataArr.push(obj);
|
||||||
@@ -192,29 +178,17 @@ export default {
|
|||||||
this.tableData = tableDataArr;
|
this.tableData = tableDataArr;
|
||||||
this.tableProps = arr;
|
this.tableProps = arr;
|
||||||
|
|
||||||
// let tempList = []
|
// 构造图表数据
|
||||||
// res.data.nameData.slice(1).forEach(item => {
|
|
||||||
// tempList.push(item.name)
|
|
||||||
// // arr[2].children.push(props)
|
|
||||||
// })
|
|
||||||
// xData = Array.from(new Set(tempList))
|
|
||||||
|
|
||||||
res.data.data.forEach((item) => {
|
res.data.data.forEach((item) => {
|
||||||
let yData = [];
|
let yData = [];
|
||||||
lineName.push(item.lineName);
|
lineName.push(item.lineName);
|
||||||
// let obj = {}
|
item.data.forEach((ele) => {
|
||||||
// obj.lineName = item.lineName,
|
|
||||||
// obj.sum = item.sum,
|
|
||||||
item.data.forEach((ele, index) => {
|
|
||||||
// console.log(ele)
|
|
||||||
ele.children.forEach((e) => {
|
ele.children.forEach((e) => {
|
||||||
// let yData = []
|
|
||||||
yData.push(e.dynamicValue);
|
yData.push(e.dynamicValue);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
yAllData.push(yData);
|
yAllData.push(yData);
|
||||||
});
|
});
|
||||||
console.log(lineName);
|
|
||||||
} else {
|
} else {
|
||||||
this.tableProps = arr;
|
this.tableProps = arr;
|
||||||
this.tableData = [];
|
this.tableData = [];
|
||||||
@@ -222,47 +196,61 @@ export default {
|
|||||||
yAllData = [];
|
yAllData = [];
|
||||||
lineName = [];
|
lineName = [];
|
||||||
}
|
}
|
||||||
// res.data.data[0].data[0].children.forEach((item, index) => {
|
|
||||||
// // console.log(item)
|
// 初始化图表
|
||||||
// yData.push(item.dynamicValue)
|
|
||||||
// // let data = 'data' + Number(index+1)
|
|
||||||
// // obj['' + item.dynamicName + ''] = item.dynamicValue
|
|
||||||
// })
|
|
||||||
// console.log(this.yData)
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.lineChart.initChart(xData, yAllData, lineName);
|
this.$refs.lineChart.initChart(xData, yAllData, lineName);
|
||||||
});
|
});
|
||||||
// this.total = response.data.total;
|
})
|
||||||
// this.dataListLoading = false;
|
.catch((err) => {
|
||||||
|
console.error('获取产量数据失败:', err);
|
||||||
|
this.tableData = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.dataListLoading = false; // 关闭加载状态
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 搜索栏按钮点击事件
|
||||||
|
* @param {Object} val - 按钮/表单传递的参数
|
||||||
|
*/
|
||||||
buttonClick(val) {
|
buttonClick(val) {
|
||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
this.listQuery.lineIds = val.lineIds ? val.lineIds : undefined;
|
// 处理产线参数(避免undefined,空值设为空数组)
|
||||||
// this.listQuery.productId = val.productId;
|
this.listQuery.lineIds = val.lineIds || [];
|
||||||
this.listQuery.time = val.time
|
// 处理时间参数:如果是时间字符串,可转换为时间戳(根据接口要求调整)
|
||||||
? new Date(val.time).getTime()
|
|
||||||
: undefined;
|
|
||||||
// this.listQuery.pageNo = 1;
|
|
||||||
// this.listQuery.pageSize = 10;
|
|
||||||
if (val.time) {
|
if (val.time) {
|
||||||
this.getData();
|
// this.listQuery.time = val.time;
|
||||||
|
// 若接口需要时间戳,取消下面注释:
|
||||||
|
this.listQuery.time = new Date(val.time).getTime();
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请选择时间',
|
message: '请选择时间',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 验证产线是否选择(可选,根据业务需求调整)
|
||||||
|
if (this.listQuery.lineIds.length === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '请选择至少一条产线',
|
||||||
|
type: 'warning',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getData();
|
||||||
break;
|
break;
|
||||||
case 'reset':
|
case 'reset':
|
||||||
|
// 重置表单
|
||||||
this.$refs.searchBarForm.resetForm();
|
this.$refs.searchBarForm.resetForm();
|
||||||
|
// 恢复默认值
|
||||||
this.listQuery = {
|
this.listQuery = {
|
||||||
pageSize: 10,
|
lineIds: this.formConfig[1].defaultSelect || [],
|
||||||
pageNo: 1,
|
time: this.formConfig[0].defaultValue || '',
|
||||||
total: 1,
|
|
||||||
};
|
};
|
||||||
this.getDataList();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log(val);
|
console.log(val);
|
||||||
|
|||||||
@@ -280,6 +280,7 @@ export default {
|
|||||||
clearable: true,
|
clearable: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// select: true,
|
// select: true,
|
||||||
// label: '设备分组',
|
// label: '设备分组',
|
||||||
|
|||||||
@@ -92,7 +92,9 @@ export default {
|
|||||||
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||||
},
|
},
|
||||||
{ prop: 'name', label: '设备类型名称' },
|
{ prop: 'name', label: '设备类型名称' },
|
||||||
{ prop: 'code', label: '检测类型编码' },
|
{ prop: 'isCraft', label: '是否为生产设备',
|
||||||
|
filter: (val) => val?'是': '否', },
|
||||||
|
{ prop: 'code', label: '设备类型编码' },
|
||||||
{ prop: 'remark', label: '备注' },
|
{ prop: 'remark', label: '备注' },
|
||||||
],
|
],
|
||||||
searchBarFormConfig: [
|
searchBarFormConfig: [
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="产品类型" prop="typeDictValue">
|
<el-form-item label="玻璃类型" prop="typeDictValue">
|
||||||
<el-select v-model="dataForm.typeDictValue" style="width: 100%" :disabled="isdetail"
|
<el-select v-model="dataForm.typeDictValue" style="width: 100%" :disabled="isdetail"
|
||||||
placeholder="请选择产品类型">
|
placeholder="请选择玻璃类型">
|
||||||
<el-option v-for="dict in getDictDatas(DICT_TYPE.PRODUCT_TYPE)" :key="dict.value" :label="dict.label"
|
<el-option v-for="dict in getDictDatas(DICT_TYPE.PRODUCT_TYPE)" :key="dict.value" :label="dict.label"
|
||||||
:value="dict.value" />
|
:value="dict.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -66,20 +66,30 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="完成单位产品用时" prop="processTime">
|
<el-form-item label="完成单位产品用时(S)" prop="processTime">
|
||||||
<el-input :disabled="isdetail" v-model="dataForm.processTime" placeholder="请输入完成单位产品用时" />
|
<el-input :disabled="isdetail" v-model="dataForm.processTime" placeholder="请输入完成单位产品用时(S)" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label=" 加工属性" prop="processType">
|
<el-form-item label=" 产品工艺" prop="processTypes">
|
||||||
<el-select v-model="dataForm.processType" clearable style="width: 100%" :disabled="isdetail"
|
<el-select :disabled="isdetail" collapse-tags multiple v-model="dataForm.processTypes" clearable
|
||||||
placeholder="请选择加工属性">
|
style="width: 100%" placeholder="请选择产品工艺">
|
||||||
<el-option v-for="dict in processTypeList" :key="dict.id" :label="dict.label"
|
<el-option v-for="dict in processTypeList" :key="dict.value" :label="dict.label"
|
||||||
:value="dict.id" />
|
:value="dict.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<!-- <el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label=" 基板类型" prop="typeDictValue">
|
||||||
|
<el-select :disabled="isdetail" v-model="dataForm.typeDictValue" clearable
|
||||||
|
style="width: 100%" placeholder="请选择基板类型">
|
||||||
|
<el-option v-for="dict in typeList" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row> -->
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
||||||
@@ -144,7 +154,7 @@ import {
|
|||||||
import productAttrAdd from './attr-add';
|
import productAttrAdd from './attr-add';
|
||||||
import { parseTime } from '../../mixins/code-filter';
|
import { parseTime } from '../../mixins/code-filter';
|
||||||
import SmallTitle from './SmallTitle';
|
import SmallTitle from './SmallTitle';
|
||||||
|
import { listData } from "@/api/system/dict/data"; //数据字典接口
|
||||||
const tableBtn = [
|
const tableBtn = [
|
||||||
{
|
{
|
||||||
type: 'edit',
|
type: 'edit',
|
||||||
@@ -185,35 +195,36 @@ export default {
|
|||||||
name: '', // 产品名称
|
name: '', // 产品名称
|
||||||
code: '', // 产品编码
|
code: '', // 产品编码
|
||||||
area: 0, // 深加工单位平方数(float only)
|
area: 0, // 深加工单位平方数(float only)
|
||||||
typeDictValue: null, // 产品类型id
|
typeDictValue: null, // 玻璃类型id
|
||||||
processTime: null, // 单位产品用时 (s)
|
processTime: null, // 单位产品用时 (s)
|
||||||
specifications: '', // 深加工规格
|
specifications: '', // 深加工规格
|
||||||
unitDictValue: '', // 单位id
|
unitDictValue: '', // 单位id
|
||||||
originalSpecifications: '', // 原片规格
|
originalSpecifications: '', // 原片规格
|
||||||
originalArea: 0, // 原片单位平方数
|
originalArea: 0, // 原片单位平方数
|
||||||
processType:undefined,
|
processTypes: [],
|
||||||
},
|
},
|
||||||
|
typeList:[],
|
||||||
listQuery: {
|
listQuery: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
total: 0,
|
total: 0,
|
||||||
},
|
},
|
||||||
processTypeList: [
|
processTypeList: [
|
||||||
{
|
// {
|
||||||
id: '0',
|
// value: '1',
|
||||||
label:'压花丝印'
|
// label: '压花丝印'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
id: '1',
|
// value: '2',
|
||||||
label: '无印打孔'
|
// label: '无印打孔'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
id: '2',
|
// value: '3',
|
||||||
label: '单层镀膜'
|
// label: '单层镀膜'
|
||||||
}, {
|
// }, {
|
||||||
id: '3',
|
// value: '4',
|
||||||
label: '双层镀膜'
|
// label: '双层镀膜'
|
||||||
}
|
// }
|
||||||
],
|
],
|
||||||
dataRule: {
|
dataRule: {
|
||||||
code: [
|
code: [
|
||||||
@@ -239,7 +250,7 @@ export default {
|
|||||||
typeDictValue: [
|
typeDictValue: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '产品类型不能为空',
|
message: '玻璃类型不能为空',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -269,14 +280,37 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initData() {
|
async initData() {
|
||||||
this.productAttributeList.splice(0);
|
this.productAttributeList.splice(0);
|
||||||
this.listQuery.total = 0;
|
this.listQuery.total = 0;
|
||||||
|
const typeRes = await listData({
|
||||||
|
pageNo:
|
||||||
|
1,
|
||||||
|
pageSize
|
||||||
|
: 10,
|
||||||
|
dictType
|
||||||
|
: 'product_type'
|
||||||
|
})
|
||||||
|
|
||||||
|
this.typeList = typeRes.data.list
|
||||||
|
console.log('typeRes', this.typeList);
|
||||||
|
const processTypeRes = await listData({
|
||||||
|
pageNo:
|
||||||
|
1,
|
||||||
|
pageSize
|
||||||
|
: 10,
|
||||||
|
dictType
|
||||||
|
: 'process_type'
|
||||||
|
})
|
||||||
|
|
||||||
|
this.processTypeList = processTypeRes.data.list
|
||||||
|
console.log('typeRes', this.typeList);
|
||||||
},
|
},
|
||||||
init(id, isdetail) {
|
init(id, isdetail) {
|
||||||
this.initData();
|
this.initData();
|
||||||
this.isdetail = isdetail || false;
|
this.isdetail = isdetail || false;
|
||||||
this.dataForm.id = id || null;
|
this.dataForm.id = id || null;
|
||||||
|
// this.dataForm.processTypes = [] // 清空工艺选择
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -284,8 +318,25 @@ export default {
|
|||||||
|
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
// 获取产品详情
|
// 获取产品详情
|
||||||
getProduct(id).then((response) => {
|
getProduct(id).then((res) => {
|
||||||
this.dataForm = response.data;
|
const resData = res.data || {};
|
||||||
|
// 逐个字段赋值(保留响应式)
|
||||||
|
this.dataForm.name = resData.name || '';
|
||||||
|
this.dataForm.code = resData.code || '';
|
||||||
|
this.dataForm.area = resData.area || 0;
|
||||||
|
this.dataForm.typeDictValue = resData.typeDictValue || null;
|
||||||
|
this.dataForm.processTime = resData.processTime || null;
|
||||||
|
this.dataForm.specifications = resData.specifications || '';
|
||||||
|
this.dataForm.unitDictValue = resData.unitDictValue || '';
|
||||||
|
this.dataForm.originalSpecifications = resData.originalSpecifications || '';
|
||||||
|
this.dataForm.originalArea = resData.originalArea || 0;
|
||||||
|
|
||||||
|
// 处理工艺列表:确保是数组,过滤空值
|
||||||
|
this.dataForm.processTypes = resData.processType
|
||||||
|
? resData.processType.split(',').filter(Boolean)
|
||||||
|
: [];
|
||||||
|
|
||||||
|
console.log('工艺列表(编辑时):', this.dataForm.processTypes); // 验证是否为 ["1","2"] 格式
|
||||||
});
|
});
|
||||||
// 获取产品的属性列表
|
// 获取产品的属性列表
|
||||||
this.getList();
|
this.getList();
|
||||||
@@ -310,8 +361,7 @@ export default {
|
|||||||
handleClick(raw) {
|
handleClick(raw) {
|
||||||
if (raw.type === 'delete') {
|
if (raw.type === 'delete') {
|
||||||
this.$confirm(
|
this.$confirm(
|
||||||
`确定对${
|
`确定对${raw.data.name
|
||||||
raw.data.name
|
|
||||||
? '[名称=' + raw.data.name + ']'
|
? '[名称=' + raw.data.name + ']'
|
||||||
: '[序号=' + raw.data._pageIndex + ']'
|
: '[序号=' + raw.data._pageIndex + ']'
|
||||||
}进行删除操作?`,
|
}进行删除操作?`,
|
||||||
@@ -334,7 +384,7 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => { });
|
||||||
} else {
|
} else {
|
||||||
this.addNew(raw.data.id);
|
this.addNew(raw.data.id);
|
||||||
}
|
}
|
||||||
@@ -343,6 +393,7 @@ export default {
|
|||||||
dataFormSubmit() {
|
dataFormSubmit() {
|
||||||
this.$refs['dataForm'].validate((valid) => {
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
|
||||||
// 修改的提交
|
// 修改的提交
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
updateProduct(this.dataForm).then((response) => {
|
updateProduct(this.dataForm).then((response) => {
|
||||||
@@ -396,29 +447,30 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.drawer >>> .el-drawer {
|
.drawer>>>.el-drawer {
|
||||||
border-radius: 8px 0 0 8px;
|
border-radius: 8px 0 0 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .el-form-item__label {
|
.drawer>>>.el-form-item__label {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .el-drawer__header {
|
.drawer>>>.el-drawer__header {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 32px 32px 24px;
|
padding: 32px 32px 24px;
|
||||||
border-bottom: 1px solid #dcdfe6;
|
border-bottom: 1px solid #dcdfe6;
|
||||||
}
|
}
|
||||||
.drawer >>> .el-drawer__body {
|
|
||||||
|
.drawer>>>.el-drawer__body {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .content {
|
.drawer>>>.content {
|
||||||
padding: 30px 24px;
|
padding: 30px 24px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -426,16 +478,17 @@ export default {
|
|||||||
/* height: 100%; */
|
/* height: 100%; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .visual-part {
|
.drawer>>>.visual-part {
|
||||||
flex: 1 auto;
|
flex: 1 auto;
|
||||||
max-height: 76vh;
|
max-height: 76vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
padding-right: 10px; /* 调整滚动条样式 */
|
padding-right: 10px;
|
||||||
|
/* 调整滚动条样式 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .el-form,
|
.drawer>>>.el-form,
|
||||||
.drawer >>> .attr-list {
|
.drawer>>>.attr-list {
|
||||||
padding: 0 16px;
|
padding: 0 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog v-loading="isLoading" loading-text="处理中..." loading-spinner="el-icon-loading"
|
||||||
:visible.sync="visible"
|
loading-background="rgba(255, 255, 255, 0.7)" :visible.sync="visible" :width="'35%'" :append-to-body="true"
|
||||||
:width="'35%'"
|
:close-on-click-modal="false" class="dialog">
|
||||||
:append-to-body="true"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
class="dialog">
|
|
||||||
<template #title>
|
<template #title>
|
||||||
<slot name="title">
|
<slot name="title">
|
||||||
<div class="titleStyle">
|
<div class="titleStyle">
|
||||||
@@ -13,29 +10,19 @@
|
|||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-form
|
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px"
|
||||||
ref="dataForm"
|
|
||||||
:model="dataForm"
|
|
||||||
:rules="dataRule"
|
|
||||||
label-width="100px"
|
|
||||||
@keyup.enter.native="dataFormSubmit()">
|
@keyup.enter.native="dataFormSubmit()">
|
||||||
<el-form-item label="属性名" prop="name">
|
<el-form-item label="属性名" prop="name">
|
||||||
<el-input
|
<el-input v-model="dataForm.name" placeholder="请输入属性名" clearable />
|
||||||
v-model="dataForm.name"
|
|
||||||
placeholder="请输入属性名"
|
|
||||||
clearable />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="属性值" prop="value">
|
<el-form-item label="属性值" prop="value">
|
||||||
<el-input
|
<el-input v-model="dataForm.value" placeholder="请输入属性值" clearable />
|
||||||
v-model="dataForm.value"
|
|
||||||
placeholder="请输入属性值"
|
|
||||||
clearable />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row style="text-align: right">
|
<el-row style="text-align: right">
|
||||||
<el-button @click="visible = false">取消</el-button>
|
<el-button @click="visible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
<el-button :loading="isLoading" type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -57,6 +44,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
visible: false,
|
visible: false,
|
||||||
|
isLoading: false,
|
||||||
dataForm: {
|
dataForm: {
|
||||||
id: 0,
|
id: 0,
|
||||||
name: '',
|
name: '',
|
||||||
@@ -78,54 +66,69 @@ export default {
|
|||||||
const { name, value } = res.data;
|
const { name, value } = res.data;
|
||||||
this.dataForm.name = name;
|
this.dataForm.name = name;
|
||||||
this.dataForm.value = value;
|
this.dataForm.value = value;
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('获取属性详情失败:', err);
|
||||||
|
this.$modal.msgError('获取数据失败,请重试');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 表单提交
|
// 表单提交(优化加载状态和错误处理)
|
||||||
dataFormSubmit() {
|
async dataFormSubmit() {
|
||||||
this.$refs['dataForm'].validate((valid) => {
|
// 先验证表单
|
||||||
if (valid) {
|
const valid = await new Promise((resolve) => {
|
||||||
// 修改的提交
|
this.$refs['dataForm'].validate((isValid) => resolve(isValid));
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!valid) return;
|
||||||
|
|
||||||
|
this.isLoading = true; // 开始加载
|
||||||
|
|
||||||
|
try {
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
updateProductAttr({
|
// 编辑操作
|
||||||
|
await updateProductAttr({
|
||||||
...this.dataForm,
|
...this.dataForm,
|
||||||
productId: this.productId,
|
productId: this.productId,
|
||||||
}).then((response) => {
|
});
|
||||||
this.$modal.msgSuccess('修改成功');
|
this.$modal.msgSuccess('修改成功');
|
||||||
this.visible = false;
|
} else {
|
||||||
this.$emit('refreshDataList');
|
// 新增操作
|
||||||
});
|
await createProductAttr({
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 添加的提交
|
|
||||||
createProductAttr({
|
|
||||||
...this.dataForm,
|
...this.dataForm,
|
||||||
productId: this.productId,
|
productId: this.productId,
|
||||||
}).then((response) => {
|
});
|
||||||
this.$modal.msgSuccess('新增成功');
|
this.$modal.msgSuccess('新增成功');
|
||||||
|
}
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.$emit('refreshDataList');
|
this.$emit('refreshDataList');
|
||||||
});
|
} catch (error) {
|
||||||
|
// 错误处理
|
||||||
|
console.error('提交失败:', error);
|
||||||
|
this.$modal.msgError('操作失败,请重试');
|
||||||
|
} finally {
|
||||||
|
// 无论成功失败,都关闭加载状态
|
||||||
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.dialog >>> .el-dialog__body {
|
.dialog>>>.el-dialog__body {
|
||||||
padding: 30px 24px;
|
padding: 30px 24px;
|
||||||
}
|
}
|
||||||
.dialog >>> .el-dialog__header {
|
|
||||||
|
.dialog>>>.el-dialog__header {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: rgba(0, 0, 0, 0.85);
|
color: rgba(0, 0, 0, 0.85);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding: 13px 24px;
|
padding: 13px 24px;
|
||||||
border-bottom: 1px solid #e9e9e9;
|
border-bottom: 1px solid #e9e9e9;
|
||||||
}
|
}
|
||||||
.dialog >>> .el-dialog__header .titleStyle::before {
|
|
||||||
|
.dialog>>>.el-dialog__header .titleStyle::before {
|
||||||
content: '';
|
content: '';
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 4px;
|
width: 4px;
|
||||||
|
|||||||
@@ -104,6 +104,10 @@ export default {
|
|||||||
getDataListURL: getProductionLinePage,
|
getDataListURL: getProductionLinePage,
|
||||||
deleteURL: deleteProductionLine,
|
deleteURL: deleteProductionLine,
|
||||||
exportURL: exportProductionLineExcel,
|
exportURL: exportProductionLineExcel,
|
||||||
|
},
|
||||||
|
listQuery: {
|
||||||
|
pageSize: 20,
|
||||||
|
pageNo:1
|
||||||
},
|
},
|
||||||
tableProps,
|
tableProps,
|
||||||
tableBtn: [
|
tableBtn: [
|
||||||
@@ -212,7 +216,7 @@ export default {
|
|||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
this.listQuery.pageNo = 1;
|
this.listQuery.pageNo = 1;
|
||||||
this.listQuery.pageSize = 10;
|
this.listQuery.pageSize = 20;
|
||||||
this.listQuery.factoryId = val.factoryId || undefined;
|
this.listQuery.factoryId = val.factoryId || undefined;
|
||||||
this.listQuery.name = val.name;
|
this.listQuery.name = val.name;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
@@ -220,7 +224,7 @@ export default {
|
|||||||
case 'reset':
|
case 'reset':
|
||||||
this.$refs.searchBarForm.resetForm();
|
this.$refs.searchBarForm.resetForm();
|
||||||
this.listQuery = {
|
this.listQuery = {
|
||||||
pageSize: 10,
|
pageSize: 20,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
total: 1,
|
total: 1,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,14 +17,14 @@
|
|||||||
:table-props="tableProps"
|
:table-props="tableProps"
|
||||||
:table-data="tableData"
|
:table-data="tableData"
|
||||||
:max-height="tableH"
|
:max-height="tableH"
|
||||||
@emitFun="handleEmitFun"
|
:span-method="mergeColumnHandler"
|
||||||
/>
|
@emitFun="handleEmitFun" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getPdlDataOneDay } from '@/api/core/monitoring/data24'
|
import { getSectionDataOneDay } from '@/api/core/monitoring/data24';
|
||||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -35,7 +35,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
urlOptions: {
|
urlOptions: {
|
||||||
getDataListURL: getPdlDataOneDay
|
getDataListURL: getSectionDataOneDay,
|
||||||
},
|
},
|
||||||
initing: false,
|
initing: false,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@@ -45,6 +45,7 @@ export default {
|
|||||||
list: [],
|
list: [],
|
||||||
arr: [],
|
arr: [],
|
||||||
spanArr: [],
|
spanArr: [],
|
||||||
|
spanArrProLine: [], // 产线合并行数组
|
||||||
timeList: [],
|
timeList: [],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
tableProps: [],
|
tableProps: [],
|
||||||
@@ -58,78 +59,130 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
/** 构建tableProps - 依据第一个元素所提供的信息 */
|
/** 构建tableProps - 依据第一个元素所提供的信息 */
|
||||||
buildProps(plData) {
|
buildProps(plData) {
|
||||||
plData.forEach(item => {
|
this.timeList = []; // 重置避免重复
|
||||||
this.timeList.push(item.name)
|
this.arr = []; // 重置避免重复
|
||||||
})
|
plData.forEach((item) => {
|
||||||
const timeArray = Array.from(new Set(this.timeList))
|
this.timeList.push(item.name);
|
||||||
console.log('nihc', timeArray)
|
});
|
||||||
|
const timeArray = Array.from(new Set(this.timeList));
|
||||||
for (const times of timeArray) {
|
for (const times of timeArray) {
|
||||||
if (times !== '投入数量' && times !== '产出数量' && times !== '报废数量' && times !== '产出面积') {
|
if (!['投入数', '产出数', '报废数量', '报废比例'].includes(times)) {
|
||||||
const subprop = {
|
const subprop = {
|
||||||
label: times.slice(0, 10) + ' ' + times.slice(11),
|
label: `${times.slice(0, 10)} ${times.slice(11)}`,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
children: [
|
children: [
|
||||||
{ prop: times + '_in', label: '投入数量',
|
{
|
||||||
filter: (val) => (val != null ? val.toFixed(2) : '-'), },
|
prop: `${times}_in`,
|
||||||
{ prop: times + '_out', label: '产出数量',
|
label: '投入数',
|
||||||
filter: (val) => (val != null ? val.toFixed(2) : '-'), },
|
filter: (val) => (val != null ? val : '-'),
|
||||||
{ prop: times + '_junk', label: '报废数量',
|
|
||||||
filter: (val) => (val != null ? val.toFixed(2) : '-'), },
|
|
||||||
{ prop: times + '_area', label: '产出面积',
|
|
||||||
filter: (val) => (val != null ? val.toFixed(2) : '-'), }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
this.arr.push(subprop)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.tableProps = this.arr
|
|
||||||
},
|
},
|
||||||
setRowSpan(arr) {
|
{
|
||||||
let count = 0
|
prop: `${times}_out`,
|
||||||
|
label: '产出数',
|
||||||
|
filter: (val) => (val != null ? val : '-'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: `${times}_junk`,
|
||||||
|
label: '报废数量',
|
||||||
|
filter: (val) => (val != null ? val : '-'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: `${times}_area`,
|
||||||
|
label: '报废比例',
|
||||||
|
filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
this.arr.push(subprop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.tableProps = [
|
||||||
|
{
|
||||||
|
prop: 'proLineName',
|
||||||
|
label: '产线',
|
||||||
|
fixed: 'left',
|
||||||
|
width: 120,
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'spec',
|
||||||
|
label: '产品规格',
|
||||||
|
fixed: 'left',
|
||||||
|
width: 110,
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
filter: (val) => val != null ? val.join(' / ') : '-',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'sectionName',
|
||||||
|
label: '工段名称',
|
||||||
|
fixed: 'left',
|
||||||
|
width: 120,
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'allNum',
|
||||||
|
label: '生产总数',
|
||||||
|
fixed: 'left',
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
},
|
||||||
|
...this.arr
|
||||||
|
];
|
||||||
|
},
|
||||||
|
/** 通用合并行计算方法 */
|
||||||
|
calcRowSpan(arr) {
|
||||||
|
const spanArr = [];
|
||||||
|
let count = 0;
|
||||||
arr.forEach((item, index) => {
|
arr.forEach((item, index) => {
|
||||||
if(index === 0) {
|
if (index === 0) {
|
||||||
this.spanArr.push(1)
|
spanArr.push(1);
|
||||||
} else {
|
} else {
|
||||||
if (item === arr[index - 1]) {
|
if (item === arr[index - 1]) {
|
||||||
this.spanArr[count] += 1
|
spanArr[count] += 1;
|
||||||
this.spanArr.push(0)
|
spanArr.push(0);
|
||||||
} else {
|
} else {
|
||||||
count = index
|
count = index;
|
||||||
this.spanArr.push(1)
|
spanArr.push(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
console.log('打印数组长度', this.spanArr)
|
return spanArr;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 把 list 里的数据转换成 tableProps 对应的格式 */
|
/** 把 list 里的数据转换成 tableProps 对应的格式 */
|
||||||
convertList(list) {
|
convertList(list) {
|
||||||
let sectionArr= []
|
this.tableData = []; // 重置避免重复
|
||||||
console.log('打印看下数据list', list)
|
const proLineNames = []; // 存储产线名称用于计算合并
|
||||||
list.forEach((ele, index) => {
|
const specNames = []; // 存储规格名称用于计算合并
|
||||||
let tempData = []
|
|
||||||
ele.data.forEach(item => {
|
list.forEach((ele) => {
|
||||||
item.children.forEach(params => {
|
const tempData = {};
|
||||||
if (params.dynamicName === '投入数量') {
|
// 基础字段赋值
|
||||||
tempData[item.dynamicName + '_in'] = params.dynamicValue
|
tempData.proLineName = ele.proLineName;
|
||||||
} else if (params.dynamicName === '产出数量') {
|
tempData.spec = ele.spec;
|
||||||
tempData[item.dynamicName + '_out'] = params.dynamicValue
|
tempData.sectionName = ele.sectionName;
|
||||||
} else if (params.dynamicName === '报废数量') {
|
tempData.allNum = ele.allNum;
|
||||||
tempData[item.dynamicName + '_junk'] = params.dynamicValue
|
|
||||||
} else {
|
// 动态字段赋值
|
||||||
tempData[item.dynamicName + '_area'] = params.dynamicValue
|
ele.data.forEach((item) => {
|
||||||
}
|
item.children.forEach((params) => {
|
||||||
})
|
const keyMap = {
|
||||||
})
|
'投入数': `${item.dynamicName}_in`,
|
||||||
tempData['proLineName'] = ele.proLineName
|
'产出数': `${item.dynamicName}_out`,
|
||||||
tempData['spec'] = ele.spec
|
'报废数量': `${item.dynamicName}_junk`,
|
||||||
this.tableData.push(tempData)
|
'报废比例': `${item.dynamicName}_area`,
|
||||||
console.log('看看数据', this.tableData, tempData)
|
};
|
||||||
const { proLineName } = tempData
|
const key = keyMap[params.dynamicName];
|
||||||
sectionArr.push(proLineName)
|
if (key) tempData[key] = params.dynamicValue;
|
||||||
})
|
});
|
||||||
this.setRowSpan(sectionArr)
|
});
|
||||||
console.log('工段名称列表', sectionArr)
|
|
||||||
|
this.tableData.push(tempData);
|
||||||
|
proLineNames.push(ele.proLineName);
|
||||||
|
specNames.push(ele.spec);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 计算合并行数组
|
||||||
|
this.spanArrProLine = this.calcRowSpan(proLineNames);
|
||||||
},
|
},
|
||||||
|
|
||||||
buildData(data) {
|
buildData(data) {
|
||||||
@@ -138,38 +191,55 @@ export default {
|
|||||||
|
|
||||||
/** 合并table列的规则 */
|
/** 合并table列的规则 */
|
||||||
mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
|
mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
|
||||||
if (columnIndex == 0) {
|
// 列索引0: 产线列, 列索引1: 产品规格列
|
||||||
if (this.spanArr[rowIndex]) {
|
if (columnIndex === 0) {
|
||||||
return [
|
return {
|
||||||
this.spanArr[rowIndex], // row span
|
rowspan: this.spanArrProLine[rowIndex] || 0,
|
||||||
1, // col span
|
colspan: this.spanArrProLine[rowIndex] ? 1 : 0
|
||||||
];
|
};
|
||||||
} else {
|
|
||||||
return [0, 0];
|
|
||||||
}
|
}
|
||||||
|
if (columnIndex === 1) {
|
||||||
|
return {
|
||||||
|
rowspan: this.spanArrProLine[rowIndex] || 0,
|
||||||
|
colspan: this.spanArrProLine[rowIndex] ? 1 : 0
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
// 其他列不合并
|
||||||
|
return { rowspan: 1, colspan: 1 };
|
||||||
},
|
},
|
||||||
|
|
||||||
async getList() {
|
async getList() {
|
||||||
this.urlOptions.getDataListURL().then(res => {
|
this.urlOptions.getDataListURL().then((res) => {
|
||||||
console.log('看看数据', res)
|
console.log('看看数据', res);
|
||||||
this.arr = [
|
this.arr = [
|
||||||
{
|
{
|
||||||
prop: 'proLineName',
|
prop: 'proLineName',
|
||||||
label: '生产线',
|
label: '产线',
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
showOverflowTooltip: true
|
showOverflowTooltip: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'spec',
|
prop: 'spec',
|
||||||
label: '产品规格',
|
label: '产品规格',
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
showOverflowTooltip: true
|
showOverflowTooltip: true,
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
prop: 'sectionName',
|
||||||
|
label: '工段名称',
|
||||||
|
fixed: 'left',
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'allNum',
|
||||||
|
label: '生产总数',
|
||||||
|
fixed: 'left',
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
this.buildProps(res.data.nameData);
|
this.buildProps(res.data.nameData);
|
||||||
this.buildData(res.data.data);
|
this.buildData(res.data.data);
|
||||||
})
|
});
|
||||||
|
|
||||||
// // const data = this.res.data;
|
// // const data = this.res.data;
|
||||||
// // console.log('recent-24', data);
|
// // console.log('recent-24', data);
|
||||||
|
|||||||
278
src/views/core/monitoring/groupReport/baseTable.vue
Normal file
278
src/views/core/monitoring/groupReport/baseTable.vue
Normal file
@@ -0,0 +1,278 @@
|
|||||||
|
<template>
|
||||||
|
<div class="baseTable">
|
||||||
|
<el-table
|
||||||
|
:ref="id"
|
||||||
|
:data="renderData"
|
||||||
|
v-bind="$attrs"
|
||||||
|
:border="cancelBorder ? false : true"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
style="width: 100%"
|
||||||
|
:header-cell-style="{
|
||||||
|
background: '#F2F4F9',
|
||||||
|
color: '#606266',
|
||||||
|
}">
|
||||||
|
<!-- 多选 -->
|
||||||
|
<el-table-column
|
||||||
|
v-if="selectWidth"
|
||||||
|
type="selection"
|
||||||
|
:width="selectWidth" />
|
||||||
|
<!-- 序号 -->
|
||||||
|
<el-table-column
|
||||||
|
v-if="page && limit"
|
||||||
|
prop="_pageIndex"
|
||||||
|
:width="pageWidth"
|
||||||
|
align="center"
|
||||||
|
:fixed="cancelPageFixed ? false : true">
|
||||||
|
<template slot="header">
|
||||||
|
<el-popover placement="bottom-start" width="300" trigger="click">
|
||||||
|
<div
|
||||||
|
class="setting-box"
|
||||||
|
style="max-height: 400px; overflow-y: auto">
|
||||||
|
<el-checkbox
|
||||||
|
v-for="(item, index) in tableProps"
|
||||||
|
:key="'cb' + index"
|
||||||
|
v-model="selectedBox[index]"
|
||||||
|
:label="item.label" />
|
||||||
|
</div>
|
||||||
|
<i slot="reference" class="el-icon-s-tools" />
|
||||||
|
</el-popover>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
v-for="item in renderTableHeadList"
|
||||||
|
:key="item.prop"
|
||||||
|
v-bind="item"
|
||||||
|
:label="item.label"
|
||||||
|
:prop="item.prop"
|
||||||
|
:fixed="item.fixed || false"
|
||||||
|
:show-overflow-tooltip="item.showOverflowtooltip || false"
|
||||||
|
:sortable="item.sortable || false">
|
||||||
|
<template slot="header">
|
||||||
|
<span>{{ item.label }}</span>
|
||||||
|
</template>
|
||||||
|
<!-- 多表头 -->
|
||||||
|
<template v-if="item.children">
|
||||||
|
<el-table-column
|
||||||
|
v-for="sub in item.children"
|
||||||
|
:prop="sub.prop"
|
||||||
|
:key="sub.prop"
|
||||||
|
v-bind="sub"
|
||||||
|
:label="sub.label">
|
||||||
|
<template v-if="sub.children">
|
||||||
|
<el-table-column
|
||||||
|
v-for="ssub in sub.children"
|
||||||
|
:prop="ssub.prop"
|
||||||
|
:key="ssub.prop"
|
||||||
|
v-bind="ssub"
|
||||||
|
:label="ssub.label">
|
||||||
|
<template slot-scope="sscopeInner">
|
||||||
|
<component
|
||||||
|
:is="ssub.subcomponent"
|
||||||
|
v-if="ssub.subcomponent"
|
||||||
|
:key="sscopeInner.row.id"
|
||||||
|
:inject-data="{ ...sscopeInner.row, ...ssub }"
|
||||||
|
@emitData="emitData" />
|
||||||
|
<span v-else>
|
||||||
|
{{ sscopeInner.row[ssub.prop] | commonFilter(ssub.filter) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scopeInner">
|
||||||
|
<component
|
||||||
|
:is="sub.subcomponent"
|
||||||
|
v-if="sub.subcomponent"
|
||||||
|
:key="scopeInner.row.id"
|
||||||
|
:inject-data="{ ...scopeInner.row, ...sub }"
|
||||||
|
@emitData="emitData" />
|
||||||
|
<span v-else>
|
||||||
|
{{ scopeInner.row[sub.prop] | commonFilter(sub.filter) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<component
|
||||||
|
:is="item.subcomponent"
|
||||||
|
v-if="item.subcomponent"
|
||||||
|
:key="scope.row.id"
|
||||||
|
:itemProp="item.prop"
|
||||||
|
:inject-data="{ ...scope.row, ...item }"
|
||||||
|
@emitData="emitData" />
|
||||||
|
<span v-else>
|
||||||
|
{{ scope.row[item.prop] | commonFilter(item.filter) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<slot name="handleBtn" />
|
||||||
|
</el-table>
|
||||||
|
<!-- 表格底部加号 -->
|
||||||
|
<el-button
|
||||||
|
v-if="addButtonShow"
|
||||||
|
class="addButton"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="emitButtonClick">
|
||||||
|
{{ addButtonShow }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'BaseTable',
|
||||||
|
filters: {
|
||||||
|
commonFilter: (source, filterType = (a) => a) => {
|
||||||
|
return filterType(source);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
cancelBorder: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
cancelPageFixed: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
tableData: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
default: () => {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tableProps: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
pageWidth: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: 70,
|
||||||
|
},
|
||||||
|
limit: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
selectWidth: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
addButtonShow: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectedBox: new Array(100).fill(true),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
renderTableHeadList() {
|
||||||
|
return this.tableProps.filter((item, index) => {
|
||||||
|
return this.selectedBox[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
renderData() {
|
||||||
|
return this.tableData.map((item, index) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
_pageIndex: (this.page - 1) * this.limit + index + 1,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
beforeMount() {
|
||||||
|
this.selectedBox = new Array(100).fill(true);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
currentChange(newVal, oldVal) {
|
||||||
|
this.$emit('current-change', { newVal, oldVal });
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
this.$emit('selection-change', val);
|
||||||
|
},
|
||||||
|
emitData(val) {
|
||||||
|
this.$emit('emitFun', val);
|
||||||
|
},
|
||||||
|
emitButtonClick() {
|
||||||
|
this.$emit('emitButtonClick');
|
||||||
|
},
|
||||||
|
setCurrent(name, index) {
|
||||||
|
let _this = this;
|
||||||
|
let obj = _this.$refs[name].data[index];
|
||||||
|
_this.$refs[name].setCurrentRow(obj);
|
||||||
|
},
|
||||||
|
doLayout(name) {
|
||||||
|
this.$refs[name].doLayout();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<!-- <style scoped>
|
||||||
|
.baseTable .show-col-btn {
|
||||||
|
margin-right: 5px;
|
||||||
|
line-height: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.baseTable .el-icon-refresh {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.baseTable >>> .el-table .el-table__cell {
|
||||||
|
padding: 0;
|
||||||
|
height: 35px;
|
||||||
|
border: 1px solid rgb(220, 220, 220);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style>
|
||||||
|
.baseTable .el-table__body tr.current-row > td.el-table__cell {
|
||||||
|
background-color: #eaf1fc;
|
||||||
|
}
|
||||||
|
.baseTable .el-table .el-table__cell {
|
||||||
|
padding: 0;
|
||||||
|
height: 35px;
|
||||||
|
}
|
||||||
|
.baseTable .addButton {
|
||||||
|
width: 100%;
|
||||||
|
height: 35px;
|
||||||
|
border-top: none;
|
||||||
|
color: #0b58ff;
|
||||||
|
border-color: #ebeef5;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
.baseTable .addButton:hover {
|
||||||
|
color: #0b58ff;
|
||||||
|
border-color: #ebeef5;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.baseTable .addButton:focus {
|
||||||
|
border-color: #ebeef5;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-tooltip__popper.is-dark {
|
||||||
|
background: rgba(0, 0, 0, 0.6) !important;
|
||||||
|
}
|
||||||
|
.el-tooltip__popper .popper__arrow,
|
||||||
|
.el-tooltip__popper .popper__arrow::after {
|
||||||
|
border-top-color: rgba(0, 0, 0, 0.4) !important;
|
||||||
|
}
|
||||||
|
</style> -->
|
||||||
331
src/views/core/monitoring/groupReport/gr-detail.vue
Normal file
331
src/views/core/monitoring/groupReport/gr-detail.vue
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2023-08-24 14:47:58
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2025-02-25 14:03:40
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||||
|
<el-table id="detail" :data="tableData" :header-cell-style="{
|
||||||
|
background: '#F2F4F9',
|
||||||
|
color: '#606266',
|
||||||
|
}" border v-loading="dataListLoading" style="width: 100%" ref="dataList">
|
||||||
|
<el-table-column prop="lineName" label="产线" align="center" />
|
||||||
|
<!-- <el-table-column prop="sizes" width="105" showOverflowtooltip align="center" label="规格" /> -->
|
||||||
|
<!-- <el-table-column prop="process" label="产品工艺" align="center" /> -->
|
||||||
|
<el-table-column prop="inputN" label="磨边" align="center">
|
||||||
|
<el-table-column prop="edgeNum" label="投入数量/片" />
|
||||||
|
<el-table-column prop="edgeTime" label="数据上报时间">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.reportType === 0
|
||||||
|
? parseTime(scope.row.edgeTime)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="outputN" label="打孔/丝印" align="center">
|
||||||
|
<el-table-column prop="drillCoating" label="投入数量">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
(scope.row.drillNum ?? '-')
|
||||||
|
+ '/'
|
||||||
|
+ (scope.row.coatingNum ?? '-')
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="coatingTime" label="数据上报时间">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.reportType === 0
|
||||||
|
? parseTime(scope.row.coatingTime)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="lossN" label="镀膜" align="center">
|
||||||
|
<el-table-column prop="silkNum" label="投入数量" />
|
||||||
|
<el-table-column prop="silkTime" label="数据上报时间">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.reportType === 0
|
||||||
|
? parseTime(scope.row.silkTime)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="lossN" label="钢化" align="center">
|
||||||
|
<el-table-column prop="temperingNum" label="投入数量" />
|
||||||
|
<el-table-column prop="temperingTime" label="数据上报时间">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.reportType === 0
|
||||||
|
? parseTime(scope.row.temperingTime)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="lossN" label="包装" align="center">
|
||||||
|
<el-table-column prop="packingNum" label="投入数量" />
|
||||||
|
<el-table-column prop="packingTime" label="数据上报时间">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.reportType === 0
|
||||||
|
? parseTime(scope.row.packingTime)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column prop="lossRatio" label="不良率/%">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.lossRatio != null ? scope.row.lossRatio.toFixed(2) : '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="outputRatio" label="投入产出率/%">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.outputRatio != null
|
||||||
|
? scope.row.outputRatio.toFixed(2)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="processingRatio" label="加工成品率/%">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.processingRatio != null
|
||||||
|
? scope.row.processingRatio.toFixed(2)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="lossD" label="不良详情" align="center">
|
||||||
|
<el-table-column prop="original" label="原片" align="center">
|
||||||
|
<el-table-column prop="originalLossNum" label="原片不良/片" />
|
||||||
|
<el-table-column prop="originalLossArea" label="原片不良/m²">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.originalLossArea != null
|
||||||
|
? scope.row.originalLossArea.toFixed(2)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="edge" label="磨边" align="center">
|
||||||
|
<el-table-column prop="edgeLossNum" label="磨边不良/片" />
|
||||||
|
<el-table-column prop="edgeLossArea" label="磨边不良/m²">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.edgeLossArea != null
|
||||||
|
? scope.row.edgeLossArea.toFixed(2)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="drill" label="打孔" align="center">
|
||||||
|
<el-table-column prop="drillLossNum" label="打孔不良/片" />
|
||||||
|
<el-table-column prop="drillLossArea" label="打孔不良/m²">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.drillLossArea != null
|
||||||
|
? scope.row.drillLossArea.toFixed(2)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="coating" label="镀膜" align="center">
|
||||||
|
<el-table-column prop="coatingLossNum" label="镀膜不良/片" />
|
||||||
|
<el-table-column prop="coatingLossArea" label="镀膜不良/m²">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.coatingLossArea != null
|
||||||
|
? scope.row.coatingLossArea.toFixed(2)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="silk" label="丝印" align="center">
|
||||||
|
<el-table-column prop="silkLossNum" label="丝印不良/片" />
|
||||||
|
<el-table-column prop="silkLossArea" label="丝印不良/m²">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.silkLossArea != null
|
||||||
|
? scope.row.silkLossArea.toFixed(2)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="tempering" label="钢化" align="center">
|
||||||
|
<el-table-column prop="temperingLossNum" label="钢化不良/片" />
|
||||||
|
<el-table-column prop="temperingLossArea" label="钢化不良/m²">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
scope.row.temperingLossArea != null
|
||||||
|
? scope.row.temperingLossArea.toFixed(2)
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column prop="down" label="下片" align="center">
|
||||||
|
<el-table-column prop="downNum" label="成品数量" />
|
||||||
|
<el-table-column prop="scrapNum" label="废片数量" />
|
||||||
|
<el-table-column prop="inputOutputRate" label="投入产出率" />
|
||||||
|
<el-table-column prop="yieldRate" label="加工成品率" />
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getTeamReportPageDet, exportGroupProductReportExcel } from '@/api/core/monitoring/auto';
|
||||||
|
import * as XLSX from 'xlsx';
|
||||||
|
import FileSaver from 'file-saver';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableData: [],
|
||||||
|
id:null,
|
||||||
|
dataListLoading: false,
|
||||||
|
formConfig: [
|
||||||
|
{
|
||||||
|
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
|
||||||
|
type: 'button',
|
||||||
|
btnName: '导出',
|
||||||
|
name: 'export',
|
||||||
|
color: 'warning',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {},
|
||||||
|
created() {},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
// 获取数据列表
|
||||||
|
init(id) {
|
||||||
|
this.id = id
|
||||||
|
this.dataListLoading = true;
|
||||||
|
getTeamReportPageDet(id).then((response) => {
|
||||||
|
this.tableData = response.data?.map((item, index) => {
|
||||||
|
item.originalLossNum = item.original?.lossNum;
|
||||||
|
item.originalLossArea = item.original?.lossArea;
|
||||||
|
item.edgeLossNum = item.edge?.lossNum;
|
||||||
|
item.edgeLossArea = item.edge?.lossArea;
|
||||||
|
item.drillLossNum = item.drill?.lossNum;
|
||||||
|
item.drillLossArea = item.drill?.lossArea;
|
||||||
|
item.coatingLossNum = item.coating?.lossNum;
|
||||||
|
item.coatingLossArea = item.coating?.lossArea;
|
||||||
|
item.silkLossNum = item.silk?.lossNum;
|
||||||
|
item.silkLossArea = item.silk?.lossArea;
|
||||||
|
item.temperingLossNum = item.tempering?.lossNum;
|
||||||
|
item.temperingLossArea = item.tempering?.lossArea;
|
||||||
|
item.packingLossNum = item.packing?.lossNum;
|
||||||
|
item.packingLossArea = item.packing?.lossArea;
|
||||||
|
if (item.isSummaryReport) {
|
||||||
|
item.lineName = '合计';
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
this.dataListLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// arraySpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||||
|
// if (row.isSummaryReport) {
|
||||||
|
// if (columnIndex === 0) {
|
||||||
|
// return [1, 3];
|
||||||
|
// } else if (columnIndex === 1) {
|
||||||
|
// return [0, 0];
|
||||||
|
// } else if (columnIndex === 2) {
|
||||||
|
// return [0, 0];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
|
||||||
|
buttonClick(val) {
|
||||||
|
switch (val.btnName) {
|
||||||
|
case 'export':
|
||||||
|
this.handleExport();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleExport() {
|
||||||
|
this.$modal.confirm('是否确认导出').then(() => {
|
||||||
|
return exportGroupProductReportExcel({id:this.id});
|
||||||
|
}).then(response => {
|
||||||
|
console.log(response)
|
||||||
|
this.$download.excel(response, '班组生产报表-详情.xls');
|
||||||
|
}).catch(() => {})
|
||||||
|
// let tables = document.querySelector('#detail').cloneNode(true);
|
||||||
|
// let exportTable = XLSX.utils.table_to_book(tables);
|
||||||
|
|
||||||
|
// var exportTableOut = XLSX.write(exportTable, {
|
||||||
|
// bookType: 'xlsx',
|
||||||
|
// bookSST: true,
|
||||||
|
// type: 'array',
|
||||||
|
// });
|
||||||
|
// // sheetjs.xlsx为导出表格的标题名称
|
||||||
|
// try {
|
||||||
|
// FileSaver.saveAs(
|
||||||
|
// new Blob([exportTableOut], {
|
||||||
|
// type: 'application/octet-stream',
|
||||||
|
// }),
|
||||||
|
// '班组生产报表-详情.xlsx'
|
||||||
|
// );
|
||||||
|
// } catch (e) {
|
||||||
|
// if (typeof console !== 'undefined') console.log(e, exportTableOut);
|
||||||
|
// }
|
||||||
|
// return exportTableOut;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
594
src/views/core/monitoring/groupReport/index.vue
Normal file
594
src/views/core/monitoring/groupReport/index.vue
Normal file
@@ -0,0 +1,594 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: Do not edit
|
||||||
|
* @Date: 2023-08-29 14:59:29
|
||||||
|
* @LastEditTime: 2026-04-13 14:27:08
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<search-bar
|
||||||
|
:formConfigs="formConfig"
|
||||||
|
ref="searchBarForm"
|
||||||
|
@headBtnClick="buttonClick" />
|
||||||
|
<base-table-s
|
||||||
|
v-if="showData.length"
|
||||||
|
class="right-aside"
|
||||||
|
v-loading="dataListLoading"
|
||||||
|
:table-props="tableProps"
|
||||||
|
:page="listQuery.pageNo"
|
||||||
|
:limit="listQuery.pageSize"
|
||||||
|
:table-data="showData">
|
||||||
|
<method-btn
|
||||||
|
v-if="showData.length"
|
||||||
|
slot="handleBtn"
|
||||||
|
:width="80"
|
||||||
|
label="操作"
|
||||||
|
:method-list="tableBtn"
|
||||||
|
@clickBtn="handleClick" />
|
||||||
|
</base-table-s>
|
||||||
|
<div v-else class="no-data-bg"></div>
|
||||||
|
<pagination
|
||||||
|
:limit.sync="listQuery.pageSize"
|
||||||
|
:page.sync="listQuery.pageNo"
|
||||||
|
:total="listQuery.total"
|
||||||
|
@pagination="getDataList" />
|
||||||
|
<base-dialog
|
||||||
|
:dialogTitle="addOrEditTitle"
|
||||||
|
:dialogVisible="addOrUpdateVisible"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
@confirm="handleConfirm"
|
||||||
|
:before-close="handleCancel"
|
||||||
|
close-on-click-modal
|
||||||
|
top="0"
|
||||||
|
width="80%">
|
||||||
|
<gr-detail ref="grDetail" />
|
||||||
|
<slot name="footer">
|
||||||
|
<el-row slot="footer" type="flex" justify="end">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-button size="small" class="btnTextStyle" @click="handleCancel">
|
||||||
|
取消
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</slot>
|
||||||
|
</base-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import grDetail from './gr-detail';
|
||||||
|
import { getTeamReportPage } from '@/api/core/monitoring/auto';
|
||||||
|
import { getFactoryPage } from '@/api/core/base/factory';
|
||||||
|
import { getGroupTeamPage } from '@/api/base/groupTeam';
|
||||||
|
// import codeFilter from '../../mixins/code-filter'
|
||||||
|
import * as XLSX from 'xlsx';
|
||||||
|
import FileSaver from 'file-saver';
|
||||||
|
import baseTableS from './baseTable.vue';
|
||||||
|
import { parseTime } from '@/filter/code-filter';
|
||||||
|
|
||||||
|
const tableProps = [
|
||||||
|
{
|
||||||
|
prop: 'reportType',
|
||||||
|
label: '报表类型',
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'reportDate',
|
||||||
|
label: '日期',
|
||||||
|
width: 180,
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'factoryName',
|
||||||
|
label: '工厂',
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'teamName',
|
||||||
|
label: '班组',
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'edgeNum',
|
||||||
|
label: '磨边',
|
||||||
|
fixed: true
|
||||||
|
}, {
|
||||||
|
prop: 'drillOrCoating',
|
||||||
|
label: '打孔/丝印',
|
||||||
|
fixed: true
|
||||||
|
}, {
|
||||||
|
prop: 'silkNum',
|
||||||
|
label: '镀膜',
|
||||||
|
fixed: true
|
||||||
|
}, {
|
||||||
|
prop: 'temperingNum',
|
||||||
|
label: '钢化',
|
||||||
|
fixed: true
|
||||||
|
}, {
|
||||||
|
prop: 'packingNum',
|
||||||
|
label: '包装',
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'inputN',
|
||||||
|
label: '下片',
|
||||||
|
align: 'center',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
prop: 'downNum',
|
||||||
|
label: '成品数量',
|
||||||
|
width:100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'scrapNum',
|
||||||
|
label: '废片数量',
|
||||||
|
width:100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'inputOutputRate',
|
||||||
|
label: '投入产出率',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'yieldRate',
|
||||||
|
label: '加工成品率',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// prop: 'outputN',
|
||||||
|
// label: '产出',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'outputNum',
|
||||||
|
// label: '产出数量/片',
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'outputArea',
|
||||||
|
// label: '产出面积/㎡',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'lossN',
|
||||||
|
// label: '不良',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'lossNum',
|
||||||
|
// label: '不良数量/片',
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'lossArea',
|
||||||
|
// label: '不良面积/㎡',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'lossRatio',
|
||||||
|
// label: '不良率/%',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'outputRatio',
|
||||||
|
// label: '投入产出率/%',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:110
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'processingRatio',
|
||||||
|
// label: '加工成品率/%',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:110
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'lossD',
|
||||||
|
// label: '不良详情',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'original',
|
||||||
|
// label: '原片',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'originalLossNum',
|
||||||
|
// label: '原片不良/片',
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'originalLossArea',
|
||||||
|
// label: '原片不良/㎡',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'edge',
|
||||||
|
// label: '磨边',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'edgeLossNum',
|
||||||
|
// label: '磨边不良/片',
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'edgeLossArea',
|
||||||
|
// label: '磨边不良/㎡',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'drill',
|
||||||
|
// label: '打孔',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'drillLossNum',
|
||||||
|
// label: '打孔不良/片',
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'drillLossArea',
|
||||||
|
// label: '打孔不良/㎡',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'coating',
|
||||||
|
// label: '镀膜',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'coatingLossNum',
|
||||||
|
// label: '镀膜不良/片',
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'coatingLossArea',
|
||||||
|
// label: '镀膜不良/㎡',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'silk',
|
||||||
|
// label: '丝印',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'silkLossNum',
|
||||||
|
// label: '丝印不良/片',
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'silkLossArea',
|
||||||
|
// label: '丝印不良/㎡',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'tempering',
|
||||||
|
// label: '钢化',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'temperingLossNum',
|
||||||
|
// label: '钢化不良/片',
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'temperingLossArea',
|
||||||
|
// label: '钢化不良/㎡',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'packing',
|
||||||
|
// label: '包装',
|
||||||
|
// align: 'center',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// prop: 'packingLossNum',
|
||||||
|
// label: '包装不良/片',
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'packingLossArea',
|
||||||
|
// label: '包装不良/㎡',
|
||||||
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
// width:100
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
baseTableS,
|
||||||
|
grDetail,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
urlOptions: {
|
||||||
|
getDataListURL: getTeamReportPage,
|
||||||
|
},
|
||||||
|
listQuery: {
|
||||||
|
reportType: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
pageNo: 1,
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
total: 1,
|
||||||
|
},
|
||||||
|
fileName: '',
|
||||||
|
dataListLoading: false,
|
||||||
|
tableProps,
|
||||||
|
tableBtn: [
|
||||||
|
this.$auth.hasPermi(`monitoring:group-off:detail`)
|
||||||
|
? {
|
||||||
|
type: 'eq',
|
||||||
|
btnName: '详情',
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
|
|
||||||
|
].filter((v) => v),
|
||||||
|
showData: [],
|
||||||
|
tableData: [],
|
||||||
|
formConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '工厂',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'factoryId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '班组',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'teamId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '报表类型',
|
||||||
|
selectOptions: [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
name: '班',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '日',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// id: 2,
|
||||||
|
// name: '周',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: '月',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: '年',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
defaultSelect: 1,
|
||||||
|
param: 'reportType',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间范围',
|
||||||
|
dateType: 'daterange',
|
||||||
|
format: 'yyyy-MM-dd',
|
||||||
|
valueFormat: 'timestamp',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeVal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: this.$auth.hasPermi('monitoring:group-off:query') ? 'button' : '',
|
||||||
|
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separate',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: this.$auth.hasPermi('monitoring:group-off:export') ? 'button' : '',
|
||||||
|
// type: 'button',
|
||||||
|
btnName: '导出',
|
||||||
|
name: 'export',
|
||||||
|
color: 'warning',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
addOrEditTitle: '',
|
||||||
|
addOrUpdateVisible: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// 获取当前时间
|
||||||
|
const now = new Date();
|
||||||
|
// 获取前一天的同一时间
|
||||||
|
const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
||||||
|
// 设置为00:00:00
|
||||||
|
yesterday.setHours(0, 0, 0, 0);
|
||||||
|
// 设置为23:59:59
|
||||||
|
const end = new Date(yesterday.getTime());
|
||||||
|
end.setHours(23, 59, 59, 59);
|
||||||
|
this.listQuery.startTime = yesterday.getTime(), [end.getTime()];
|
||||||
|
this.listQuery.endTime = end.getTime()
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.searchBarForm.formInline.timeVal = [yesterday.getTime(),end.getTime()];
|
||||||
|
});
|
||||||
|
this.getDataList();
|
||||||
|
this.getPdLineList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleExport() {
|
||||||
|
let tables = document.querySelector('.el-table').cloneNode(true);
|
||||||
|
const fix = tables.querySelector('.el-table__fixed');
|
||||||
|
const fixRight = tables.querySelector('.el-table__fixed-right');
|
||||||
|
if (fix) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed'));
|
||||||
|
}
|
||||||
|
if (fixRight) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed-right'));
|
||||||
|
}
|
||||||
|
let exportTable = XLSX.utils.table_to_book(tables);
|
||||||
|
exportTable.Sheets.Sheet1.A1.v = '序号' //导出表格第一列表头为序号
|
||||||
|
|
||||||
|
var exportTableOut = XLSX.write(exportTable, {
|
||||||
|
bookType: 'xlsx',
|
||||||
|
bookSST: true,
|
||||||
|
type: 'array',
|
||||||
|
});
|
||||||
|
// sheetjs.xlsx为导出表格的标题名称
|
||||||
|
try {
|
||||||
|
FileSaver.saveAs(
|
||||||
|
new Blob([exportTableOut], {
|
||||||
|
type: 'application/octet-stream',
|
||||||
|
}),
|
||||||
|
this.fileName + '班组生产报表.xlsx'
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
if (typeof console !== 'undefined') console.log(e, exportTableOut);
|
||||||
|
}
|
||||||
|
return exportTableOut;
|
||||||
|
},
|
||||||
|
getPdLineList() {
|
||||||
|
const params = {
|
||||||
|
pageSize: 100,
|
||||||
|
pageNo: 1,
|
||||||
|
};
|
||||||
|
getGroupTeamPage(params).then((res) => {
|
||||||
|
this.formConfig[1].selectOptions = res.data.list || [];
|
||||||
|
});
|
||||||
|
getFactoryPage(params).then((res) => {
|
||||||
|
this.formConfig[0].selectOptions = res.data.list || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttonClick(val) {
|
||||||
|
switch (val.btnName) {
|
||||||
|
case 'search':
|
||||||
|
this.listQuery.pageNo = 1;
|
||||||
|
this.listQuery.pageSize = 10;
|
||||||
|
this.listQuery.factoryId = val.factoryId || undefined;
|
||||||
|
this.listQuery.teamId = val.teamId || undefined;
|
||||||
|
this.listQuery.reportType = val.reportType || undefined;
|
||||||
|
this.listQuery.startTime = val.timeVal
|
||||||
|
? val.timeVal[0]
|
||||||
|
: undefined;
|
||||||
|
this.listQuery.endTime = val.timeVal
|
||||||
|
? val.timeVal[1]
|
||||||
|
: undefined;
|
||||||
|
this.getDataList();
|
||||||
|
break;
|
||||||
|
case 'export':
|
||||||
|
this.handleExport();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取数据列表
|
||||||
|
getDataList() {
|
||||||
|
this.dataListLoading = true;
|
||||||
|
console.log(this.listQuery);
|
||||||
|
|
||||||
|
const arr = ['班', '日', '', '月', '年']; // 索引0对应班,1对应日,3对应月,4对应年,索引2留空
|
||||||
|
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
|
||||||
|
if (!response.data.list) {
|
||||||
|
this.showData = [];
|
||||||
|
this.dataListLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.tableData = response.data?.list.map((item, index) => {
|
||||||
|
item.reportType = arr[item.reportType] || item.reportType;
|
||||||
|
item.drillOrCoating = item.drillNum + "/" + item.coatingNum
|
||||||
|
item.originalLossNum = item.original?.lossNum;
|
||||||
|
item.originalLossArea = item.original?.lossArea;
|
||||||
|
item.edgeLossNum = item.edge?.lossNum;
|
||||||
|
item.edgeLossArea = item.edge?.lossArea;
|
||||||
|
item.drillLossNum = item.drill?.lossNum;
|
||||||
|
item.drillLossArea = item.drill?.lossArea;
|
||||||
|
item.coatingLossNum = item.coating?.lossNum;
|
||||||
|
item.coatingLossArea = item.coating?.lossArea;
|
||||||
|
item.silkLossNum = item.silk?.lossNum;
|
||||||
|
item.silkLossArea = item.silk?.lossArea;
|
||||||
|
item.temperingLossNum = item.tempering?.lossNum;
|
||||||
|
item.temperingLossArea = item.tempering?.lossArea;
|
||||||
|
item.packingLossNum = item.packing?.lossNum;
|
||||||
|
item.packingLossArea = item.packing?.lossArea;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
this.listQuery.total = response.data?.total;
|
||||||
|
this.dataListLoading = false;
|
||||||
|
this.showData = this.tableData;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClick(val) {
|
||||||
|
this.addOrUpdateVisible = true;
|
||||||
|
const time = val.data.timeVal ? parseTime(val.data.timeVal[0]) + '-' + parseTime(val.data.timeVal[1]) : '- '
|
||||||
|
const teamName = val.data.teamName?val.data.teamName:'- '
|
||||||
|
const teamLeader = val.data.teamLeader?val.data.teamLeader:'- '
|
||||||
|
this.addOrEditTitle =
|
||||||
|
'时间:' +
|
||||||
|
time +
|
||||||
|
' 班组:' +
|
||||||
|
teamName +
|
||||||
|
' 组长:' +
|
||||||
|
teamLeader +
|
||||||
|
' 详情';
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.grDetail.init(val.data.id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.addOrUpdateVisible = false;
|
||||||
|
this.addOrEditTitle = '';
|
||||||
|
},
|
||||||
|
handleConfirm() {
|
||||||
|
this.handleCancel();
|
||||||
|
},
|
||||||
|
// 每页数
|
||||||
|
sizeChangeHandle(val) {
|
||||||
|
this.listQuery.pageSize = val;
|
||||||
|
this.listQuery.pageNo = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
// 当前页
|
||||||
|
currentChangeHandle(val) {
|
||||||
|
this.listQuery.pageNo = val;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -262,6 +262,14 @@ export default {
|
|||||||
tooltip: {
|
tooltip: {
|
||||||
valueFormatter: (value) => `${value} %`,
|
valueFormatter: (value) => `${value} %`,
|
||||||
},
|
},
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: 'top',
|
||||||
|
distance: 6,
|
||||||
|
fontSize: 11,
|
||||||
|
color: '#333333',
|
||||||
|
formatter: (params) => `${params.value}` // 显示单位
|
||||||
|
},
|
||||||
data: this.barData.map((item) => item.processingRatio),
|
data: this.barData.map((item) => item.processingRatio),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -77,7 +77,7 @@ const tableProps = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'palletNum',
|
prop: 'palletNum',
|
||||||
label: '下片托数'
|
label: '一托玻璃数量/片'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'startTime',
|
prop: 'startTime',
|
||||||
@@ -92,7 +92,7 @@ const tableProps = [
|
|||||||
width: 160
|
width: 160
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'outputNum',
|
prop: 'length',
|
||||||
label: '玻璃长度/mm'
|
label: '玻璃长度/mm'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -101,7 +101,7 @@ const tableProps = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'thick',
|
prop: 'thick',
|
||||||
label: '玻璃长度/mm'
|
label: '玻璃厚度/mm'
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -204,93 +204,87 @@ export default {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
test() {
|
|
||||||
var target = document.getElementsByClassName("right-aside")[0]
|
|
||||||
target.style.background = '#FFFFFF'
|
|
||||||
var that = this
|
|
||||||
setTimeout(() => {
|
|
||||||
html2canvas(target).then(function(canvas) {
|
|
||||||
var contentWidth = canvas.width
|
|
||||||
var contentHeight = canvas.height
|
|
||||||
|
|
||||||
// 一页pdf显示html页面生成的canvas高度
|
|
||||||
var pageHeight = contentHeight / 592.28 * 841.89
|
|
||||||
// 未生成pdf的html页面高度
|
|
||||||
var leftHeight = contentHeight
|
|
||||||
// 页面偏移
|
|
||||||
var position = 0
|
|
||||||
// a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的高度
|
|
||||||
var imgWidth = 595.28
|
|
||||||
var imgHeight = 592.28 / contentWidth * contentHeight
|
|
||||||
|
|
||||||
var pageData = canvas.toDataURL('image/jpeg', 1.0)
|
|
||||||
|
|
||||||
console.log('nihc URL', leftHeight, pageHeight)
|
|
||||||
|
|
||||||
var pdf = new jsPDF('', 'pt', 'a4')
|
|
||||||
|
|
||||||
if (leftHeight < pageHeight) {
|
|
||||||
pdf.addImage(pageData, 'JPEG', 0, 20, imgWidth, imgHeight)
|
|
||||||
} else {
|
|
||||||
while(leftHeight > 0) {
|
|
||||||
pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
|
|
||||||
leftHeight -= pageHeight
|
|
||||||
position -= 841.89
|
|
||||||
// 避免空白页
|
|
||||||
if (leftHeight > 0) {
|
|
||||||
pdf.addPage()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pdf.save(that.fileName + '工段统计.pdf')
|
|
||||||
})
|
|
||||||
}, 300)
|
|
||||||
},
|
|
||||||
exportECL() {
|
|
||||||
let tables = document.querySelector('.el-table').cloneNode(true)
|
|
||||||
const fix = tables.querySelector('.el-table__fixed')
|
|
||||||
const fixRight = tables.querySelector('.el-table__fixed-right')
|
|
||||||
if (fix) {
|
|
||||||
tables.removeChild(tables.querySelector('.el-table__fixed'))
|
|
||||||
}
|
|
||||||
if (fixRight) {
|
|
||||||
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
|
|
||||||
}
|
|
||||||
let exportTable = XLSX.utils.table_to_book(tables)
|
|
||||||
|
|
||||||
var exportTableOut = XLSX.write(exportTable, {
|
|
||||||
bookType: 'xlsx', bookSST: true, type: 'array'
|
|
||||||
})
|
|
||||||
// sheetjs.xlsx为导出表格的标题名称
|
|
||||||
try {
|
|
||||||
FileSaver.saveAs(new Blob([exportTableOut], {
|
|
||||||
type: 'application/octet-stream'
|
|
||||||
}), this.fileName + '工段统计.xlsx')
|
|
||||||
} catch (e) {
|
|
||||||
if (typeof console !== 'undefined') console.log(e, exportTableOut)
|
|
||||||
}
|
|
||||||
return exportTableOut
|
|
||||||
},
|
|
||||||
exportPdf() {
|
|
||||||
this.test()
|
|
||||||
setTimeout(() =>{
|
|
||||||
this.dialogVisible = false
|
|
||||||
this.showData = this.tableData
|
|
||||||
}, 600)
|
|
||||||
|
|
||||||
},
|
|
||||||
exportXlsx() {
|
exportXlsx() {
|
||||||
this.exportECL()
|
if (!this.showData.length) {
|
||||||
this.dialogVisible = false
|
this.$message.warning('暂无数据可导出');
|
||||||
this.showData = this.tableData
|
return;
|
||||||
},
|
}
|
||||||
handleClose(done) {
|
|
||||||
this.$confirm('确认关闭?')
|
this.exportLoading = true;
|
||||||
.then(_ => {
|
|
||||||
done();
|
try {
|
||||||
})
|
// 1. 处理导出数据(格式化时间字段)
|
||||||
.catch(_ => {});
|
const exportData = this.showData.map(item => {
|
||||||
|
const formatItem = { ...item };
|
||||||
|
// 格式化时间字段
|
||||||
|
if (formatItem.startTime) formatItem.startTime = parseTime(formatItem.startTime);
|
||||||
|
if (formatItem.endTime) formatItem.endTime = parseTime(formatItem.endTime);
|
||||||
|
return formatItem;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. 构建表头映射:{ prop: label },只保留表格配置中存在的列
|
||||||
|
const headerMap = {};
|
||||||
|
this.tableProps.forEach(col => {
|
||||||
|
if (col.prop && col.label) {
|
||||||
|
headerMap[col.prop] = col.label;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. 转换数据:将prop键名替换为label,按tableProps顺序排列列
|
||||||
|
const formattedData = exportData.map(item => {
|
||||||
|
const newItem = {};
|
||||||
|
// 按表格配置顺序遍历列,确保Excel列顺序与表格一致
|
||||||
|
this.tableProps.forEach(col => {
|
||||||
|
const prop = col.prop;
|
||||||
|
const label = col.label;
|
||||||
|
if (prop && label) {
|
||||||
|
// 处理可能的undefined值,避免导出为空字符串
|
||||||
|
newItem[label] = item[prop] ?? '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return newItem;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 4. 创建工作表(使用处理后的带label表头的数据)
|
||||||
|
const worksheet = XLSX.utils.json_to_sheet(formattedData);
|
||||||
|
|
||||||
|
// 5. 创建工作簿并添加工作表
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, '下片日志数据');
|
||||||
|
|
||||||
|
// 6. 生成Excel文件
|
||||||
|
const excelBuffer = XLSX.write(workbook, {
|
||||||
|
bookType: 'xlsx',
|
||||||
|
type: 'array'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 7. 保存文件
|
||||||
|
const blob = new Blob([excelBuffer], {
|
||||||
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 8. 生成文件名(包含查询条件信息)
|
||||||
|
let fileName = '下片历史';
|
||||||
|
if (this.listQuery.productionLineId) {
|
||||||
|
const lineItem = this.formConfig[0].selectOptions.find(
|
||||||
|
item => item.id === this.listQuery.productionLineId
|
||||||
|
);
|
||||||
|
if (lineItem) fileName += lineItem.name + '_';
|
||||||
|
}
|
||||||
|
if (this.listQuery.thick) {
|
||||||
|
fileName += this.listQuery.thick + '_';
|
||||||
|
}
|
||||||
|
// 添加时间戳避免文件名重复
|
||||||
|
fileName + '.xlsx';
|
||||||
|
|
||||||
|
FileSaver.saveAs(blob, fileName);
|
||||||
|
this.$message.success('导出成功');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('导出失败:', error);
|
||||||
|
this.$message.error('导出失败,请重试');
|
||||||
|
} finally {
|
||||||
|
this.exportLoading = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getPdLineList() {
|
getPdLineList() {
|
||||||
getPdList().then((res) => {
|
getPdList().then((res) => {
|
||||||
@@ -314,15 +308,16 @@ export default {
|
|||||||
case 'search':
|
case 'search':
|
||||||
this.listQuery.pageNo = 1;
|
this.listQuery.pageNo = 1;
|
||||||
this.listQuery.pageSize = 10;
|
this.listQuery.pageSize = 10;
|
||||||
this.listQuery.productId = val.productId ? val.productId : undefined;
|
this.listQuery.productionLineId = val.productionLineId ? val.productionLineId : undefined;
|
||||||
this.listQuery.startTime = val.timeVal ? val.timeVal[0]: undefined;
|
this.listQuery.thick = val.thick ? val.thick : undefined;
|
||||||
this.listQuery.endTime = val.timeVal ? val.timeVal[1]: undefined;
|
this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined;
|
||||||
|
this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined;
|
||||||
|
|
||||||
//this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined;
|
//this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
break;
|
break;
|
||||||
case 'export':
|
case 'export':
|
||||||
this.handleExport();
|
this.exportXlsx();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log(val);
|
console.log(val);
|
||||||
@@ -350,12 +345,6 @@ export default {
|
|||||||
this.listQuery.pageNo = val;
|
this.listQuery.pageNo = val;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
handleExport() {
|
|
||||||
if (this.selectedList.length > 0) {
|
|
||||||
this.showData = this.selectedList
|
|
||||||
}
|
|
||||||
this.dialogVisible = true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ const tableProps = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'palletNum',
|
prop: 'palletNum',
|
||||||
label: '下片托数'
|
label: '一托玻璃数量/片'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'startTime',
|
prop: 'startTime',
|
||||||
@@ -92,7 +92,7 @@ const tableProps = [
|
|||||||
width: 160
|
width: 160
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'outputNum',
|
prop: 'length',
|
||||||
label: '玻璃长度/mm'
|
label: '玻璃长度/mm'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -358,8 +358,6 @@ export default {
|
|||||||
handleExport() {
|
handleExport() {
|
||||||
// 处理查询参数
|
// 处理查询参数
|
||||||
let params = { ...this.listQuery };
|
let params = { ...this.listQuery };
|
||||||
params.pageNo = undefined;
|
|
||||||
params.pageSize = undefined;
|
|
||||||
this.$modal.confirm('是否确认导出下片日志?').then(() => {
|
this.$modal.confirm('是否确认导出下片日志?').then(() => {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
return exportDownLogData(params);
|
return exportDownLogData(params);
|
||||||
|
|||||||
@@ -262,6 +262,14 @@ export default {
|
|||||||
tooltip: {
|
tooltip: {
|
||||||
valueFormatter: (value) => `${value} %`,
|
valueFormatter: (value) => `${value} %`,
|
||||||
},
|
},
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: 'top',
|
||||||
|
distance: 6,
|
||||||
|
fontSize: 11,
|
||||||
|
color: '#333333',
|
||||||
|
formatter: (params) => `${params.value}` // 显示单位
|
||||||
|
},
|
||||||
data: this.barData.map((item) => item.processingRatio),
|
data: this.barData.map((item) => item.processingRatio),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,8 @@
|
|||||||
<!--
|
|
||||||
* @Author: Do not edit
|
|
||||||
* @Date: 2023-08-29 14:59:29
|
|
||||||
* @LastEditTime: 2024-12-02 13:44:47
|
|
||||||
* @LastEditors: zwq
|
|
||||||
* @Description:
|
|
||||||
-->
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- :isFold="true" 控制展开 -->
|
<!-- :isFold="true" 控制展开 -->
|
||||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick"
|
||||||
|
@select-changed="selectType" />
|
||||||
<base-table v-if="tableData.length" class="right-aside" v-loading="dataListLoading" :table-props="tableProps"
|
<base-table v-if="tableData.length" class="right-aside" v-loading="dataListLoading" :table-props="tableProps"
|
||||||
:page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
|
:page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
||||||
@@ -17,34 +11,47 @@
|
|||||||
<div v-else class="no-data-bg"></div>
|
<div v-else class="no-data-bg"></div>
|
||||||
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
|
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
|
||||||
@pagination="getDataList" />
|
@pagination="getDataList" />
|
||||||
<!-- <el-dialog
|
|
||||||
title="提示"
|
|
||||||
:visible.sync="dialogVisible"
|
|
||||||
width="30%"
|
|
||||||
:before-close="handleClose">
|
|
||||||
<el-button type="primary" @click="exportXlsx">xlsx</el-button>
|
|
||||||
<el-button type="success" @click="exportPdf">pdf</el-button>
|
|
||||||
<span slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
||||||
<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
|
|
||||||
</span>
|
|
||||||
</el-dialog> -->
|
|
||||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" />
|
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Vue from 'vue';
|
||||||
import AddOrUpdate from './add-or-updata';
|
import AddOrUpdate from './add-or-updata';
|
||||||
|
|
||||||
import { parseTime } from '../../mixins/code-filter';
|
import { parseTime } from '../../mixins/code-filter';
|
||||||
import { getCostOriginRadioHisData, getPdList } from '@/api/core/monitoring/index'
|
import { getCostOriginRadioHisData, getPdList } from '@/api/core/monitoring/index';
|
||||||
import * as XLSX from 'xlsx'
|
|
||||||
import FileSaver from 'file-saver'
|
|
||||||
import jsPDF from 'jspdf'
|
|
||||||
import html2canvas from 'html2canvas'
|
|
||||||
import { exportCostOriginRadioHisData } from '../../../../api/core/monitoring';
|
import { exportCostOriginRadioHisData } from '../../../../api/core/monitoring';
|
||||||
|
|
||||||
const tableProps = [
|
// Vue2 中注册全局方法(如果需要)
|
||||||
|
Vue.prototype.$download = Vue.prototype.$download || {
|
||||||
|
excel: (response, fileName) => {
|
||||||
|
const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' });
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
const aLink = document.createElement('a');
|
||||||
|
aLink.style.display = 'none';
|
||||||
|
aLink.href = url;
|
||||||
|
aLink.setAttribute('download', fileName);
|
||||||
|
document.body.appendChild(aLink);
|
||||||
|
aLink.click();
|
||||||
|
document.body.removeChild(aLink);
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Vue.prototype.$modal = Vue.prototype.$modal || {
|
||||||
|
confirm: (message) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (window.confirm(message)) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const tableProps = [
|
||||||
{
|
{
|
||||||
prop: 'reportType',
|
prop: 'reportType',
|
||||||
label: '报表类型'
|
label: '报表类型'
|
||||||
@@ -52,7 +59,6 @@ const tableProps = [
|
|||||||
{
|
{
|
||||||
prop: 'time',
|
prop: 'time',
|
||||||
label: '日期',
|
label: '日期',
|
||||||
// filter: parseTime,
|
|
||||||
width: 160
|
width: 160
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -81,10 +87,72 @@ const tableProps = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'ratio',
|
prop: 'ratio',
|
||||||
label: '良品率'
|
label: '良品率/%'
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具函数:获取选择时间所在周的起始和结束时间(Vue2 兼容)
|
||||||
|
* @param {String|Date} selectTime - 选择的时间(支持格式:yyyy-MM-dd、yyyy-MM-dd HH:mm:ss 或 Date 对象)
|
||||||
|
* @returns {Array} [startDate, endDate] - 所在周周一 00:00:00 至 周日 23:59:59(Date 对象)
|
||||||
|
*/
|
||||||
|
function getSelectedWeekRange(selectTime) {
|
||||||
|
// 兼容 String 类型时间和 Date 对象,统一转为 Date 实例
|
||||||
|
const targetDate = new Date(selectTime);
|
||||||
|
// 处理无效日期(若传入非法时间,返回当前时间的本周范围)
|
||||||
|
// if (isNaN(targetDate.getTime())) {
|
||||||
|
// console.warn('传入的时间格式无效,将使用当前时间计算本周范围');
|
||||||
|
// return getCurrentWeekRange(); // 可根据需求改为抛出错误或返回空
|
||||||
|
// }
|
||||||
|
|
||||||
|
const day = targetDate.getDay() || 7; // 周日为 7(避免周日 -0 天仍为周日)
|
||||||
|
const start = new Date(targetDate);
|
||||||
|
start.setDate(targetDate.getDate() - day + 1); // 计算所在周的周一
|
||||||
|
start.setHours(0, 0, 0, 0); // 重置时分秒为 00:00:00.000
|
||||||
|
|
||||||
|
const end = new Date(start);
|
||||||
|
end.setDate(start.getDate() + 6); // 周一 +6 天 = 周日
|
||||||
|
end.setHours(23, 59, 59, 999); // 重置时分秒为 23:59:59.999
|
||||||
|
|
||||||
|
return [start, end];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具函数:获取选择时间所在年的起始和结束时间(Vue2 兼容)
|
||||||
|
* @param {String|Date} selectTime - 选择的时间(支持格式:yyyy-MM-dd、yyyy-MM-dd HH:mm:ss 或 Date 对象)
|
||||||
|
* @returns {Array} [startDate, endDate] - 所在年 1月1日 00:00:00 至 12月31日 23:59:59(Date 对象)
|
||||||
|
*/
|
||||||
|
function getSelectedYearRange(selectTime) {
|
||||||
|
// 兼容 String 类型时间和 Date 对象,统一转为 Date 实例
|
||||||
|
const targetDate = new Date(selectTime);
|
||||||
|
// 处理无效日期(若传入非法时间,返回当前时间的本年范围)
|
||||||
|
// if (isNaN(targetDate.getTime())) {
|
||||||
|
// console.warn('传入的时间格式无效,将使用当前时间计算本年范围');
|
||||||
|
// return getCurrentYearRange(); // 可根据需求改为抛出错误或返回空
|
||||||
|
// }
|
||||||
|
|
||||||
|
const year = targetDate.getFullYear(); // 获取选择时间的年份
|
||||||
|
const start = new Date(year, 0, 1); // 所在年 1月1日(月份从 0 开始)
|
||||||
|
start.setHours(0, 0, 0, 0); // 重置时分秒为 00:00:00.000
|
||||||
|
|
||||||
|
const end = new Date(year, 11, 31); // 所在年 12月31日(11 代表 12 月)
|
||||||
|
end.setHours(23, 59, 59, 999); // 重置时分秒为 23:59:59.999
|
||||||
|
|
||||||
|
return [start, end];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化时间为 yyyy-MM-dd HH:mm:ss(Vue2 兼容)
|
||||||
|
function formatDateTime(date) {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
AddOrUpdate
|
AddOrUpdate
|
||||||
@@ -101,8 +169,10 @@ export default {
|
|||||||
total: 1,
|
total: 1,
|
||||||
bindObjectId: undefined,
|
bindObjectId: undefined,
|
||||||
statisticType: undefined,
|
statisticType: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined
|
||||||
},
|
},
|
||||||
pdLineList:[],
|
pdLineList: [],
|
||||||
exportLoading: false,
|
exportLoading: false,
|
||||||
dataListLoading: false,
|
dataListLoading: false,
|
||||||
selectedList: [],
|
selectedList: [],
|
||||||
@@ -115,36 +185,107 @@ export default {
|
|||||||
type: 'edit',
|
type: 'edit',
|
||||||
btnName: '编辑',
|
btnName: '编辑',
|
||||||
},
|
},
|
||||||
].filter((v) => v),
|
].filter(v => v),
|
||||||
tableData: [],
|
|
||||||
fileName: '',
|
fileName: '',
|
||||||
formConfig: [
|
formConfig: [
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: '维度',
|
label: '报表类型',
|
||||||
|
onchange: true,
|
||||||
selectOptions: [
|
selectOptions: [
|
||||||
{
|
{ id: '0', name: '班组' },
|
||||||
id: '0',
|
{ id: '1', name: '日' },
|
||||||
name:'班组'
|
{ id: '2', name: '周' },
|
||||||
},
|
{ id: '3', name: '月' },
|
||||||
{
|
{ id: '4', name: '年' }
|
||||||
id: '1',
|
|
||||||
name: '日'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2',
|
|
||||||
name: '周'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3',
|
|
||||||
name: '月'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '4',
|
|
||||||
name: '年'
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
param: 'statisticType'
|
param: 'statisticType',
|
||||||
|
index: 1,
|
||||||
|
extraOptions: [
|
||||||
|
{
|
||||||
|
parent: 'statisticType',
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '统计时间',
|
||||||
|
dateType: 'daterange',
|
||||||
|
format: 'yyyy-MM-dd',
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeVal',
|
||||||
|
defaultTime: ['00:00:00', '23:59:59'],
|
||||||
|
defaultSelect: [],
|
||||||
|
width: 250,
|
||||||
|
key: 'datePicker-0', // 唯一 key,触发重新渲染
|
||||||
|
appendToBody: true // 优化定位:挂载到 body 下
|
||||||
|
},
|
||||||
|
// 日 - 日期范围选择
|
||||||
|
{
|
||||||
|
parent: 'statisticType',
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '统计时间',
|
||||||
|
dateType: 'daterange',
|
||||||
|
format: 'yyyy-MM-dd',
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeValDay',
|
||||||
|
defaultTime: ['00:00:00', '23:59:59'],
|
||||||
|
defaultSelect: [],
|
||||||
|
width: 250,
|
||||||
|
key: 'datePicker-1', // 唯一 key,触发重新渲染
|
||||||
|
appendToBody: true // 优化定位:挂载到 body 下
|
||||||
|
},
|
||||||
|
// 周 - 单个日期选择(自动获取本周范围)
|
||||||
|
{
|
||||||
|
parent: 'statisticType',
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '统计时间',
|
||||||
|
dateType: 'week',
|
||||||
|
placeholder: '选择日期',
|
||||||
|
format: 'yyyy 第 WW 周',
|
||||||
|
pickerOptions: {
|
||||||
|
firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推)
|
||||||
|
},
|
||||||
|
valueFormat: 'yyyy-MM-dd',
|
||||||
|
param: 'timeValWeek',
|
||||||
|
width: 250,
|
||||||
|
key: 'datePicker-2', // 唯一 key,触发重新渲染
|
||||||
|
appendToBody: true // 优化定位:挂载到 body 下
|
||||||
|
},
|
||||||
|
// 月 - 日期范围选择
|
||||||
|
{
|
||||||
|
parent: 'statisticType',
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '统计时间',
|
||||||
|
dateType: 'monthrange',
|
||||||
|
format: 'yyyy-MM-dd',
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeValMonth',
|
||||||
|
defaultTime: ['00:00:00', '23:59:59'],
|
||||||
|
width: 250,
|
||||||
|
key: 'datePicker-3', // 唯一 key,触发重新渲染
|
||||||
|
appendToBody: true // 优化定位:挂载到 body 下
|
||||||
|
},
|
||||||
|
// 年 - 单个日期选择(自动获取本年范围)
|
||||||
|
{
|
||||||
|
parent: 'statisticType',
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '统计时间',
|
||||||
|
dateType: 'year',
|
||||||
|
placeholder: '选择年份',
|
||||||
|
format: 'yyyy-MM-dd',
|
||||||
|
valueFormat: 'yyyy-MM-dd',
|
||||||
|
param: 'timeValYear',
|
||||||
|
width: 250,
|
||||||
|
key: 'datePicker-4', // 唯一 key,触发重新渲染
|
||||||
|
appendToBody: true // 优化定位:挂载到 body 下
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@@ -152,20 +293,6 @@ export default {
|
|||||||
selectOptions: [],
|
selectOptions: [],
|
||||||
param: 'bindObjectId'
|
param: 'bindObjectId'
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
type: 'datePicker',
|
|
||||||
label: '统计开始时间',
|
|
||||||
dateType: 'daterange',
|
|
||||||
format: 'yyyy-MM-dd',
|
|
||||||
valueFormat: "yyyy-MM-dd HH:mm:ss",
|
|
||||||
rangeSeparator: '-',
|
|
||||||
startPlaceholder: '开始时间',
|
|
||||||
endPlaceholder: '结束时间',
|
|
||||||
param: 'timeVal',
|
|
||||||
defaultTime: ['00:00:00', '23:59:59'],
|
|
||||||
defaultSelect: []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
btnName: '查询',
|
btnName: '查询',
|
||||||
@@ -176,7 +303,6 @@ export default {
|
|||||||
type: 'separate',
|
type: 'separate',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
|
|
||||||
type: 'button',
|
type: 'button',
|
||||||
btnName: '导出',
|
btnName: '导出',
|
||||||
name: 'export',
|
name: 'export',
|
||||||
@@ -185,97 +311,226 @@ export default {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听报表类型变化,强制刷新日期选择器
|
||||||
|
'listQuery.statisticType'(newVal, oldVal) {
|
||||||
|
if (newVal !== oldVal && this.$refs.searchBarForm) {
|
||||||
|
// 触发 search-bar 组件重新渲染(如果 search-bar 支持)
|
||||||
|
if (this.$refs.searchBarForm.$forceUpdate) {
|
||||||
|
this.$refs.searchBarForm.$forceUpdate();
|
||||||
|
}
|
||||||
|
// 延迟重置定位,确保 DOM 已更新
|
||||||
|
setTimeout(() => {
|
||||||
|
const datePickerEl = this.$refs.searchBarForm.$el.querySelector('.el-date-picker');
|
||||||
|
if (datePickerEl) {
|
||||||
|
// 触发 Element UI 日期选择器重新计算定位(内部方法)
|
||||||
|
const datePickerInstance = datePickerEl.__vue__;
|
||||||
|
if (datePickerInstance && datePickerInstance.updatePopper) {
|
||||||
|
datePickerInstance.updatePopper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
// Vue2 中 $refs 需在 $nextTick 中访问(确保 DOM 渲染完成)
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.$refs.searchBarForm) {
|
||||||
this.$refs.searchBarForm.formInline.statisticType = '1';
|
this.$refs.searchBarForm.formInline.statisticType = '1';
|
||||||
|
}
|
||||||
|
});
|
||||||
this.listQuery.statisticType = '1';
|
this.listQuery.statisticType = '1';
|
||||||
this.getDataList()
|
this.getDataList();
|
||||||
this.getPdLineList()
|
this.getPdLineList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
selectType(val) {
|
||||||
|
// 报表类型切换时的回调(如需扩展可在此添加逻辑)
|
||||||
|
console.log('报表类型切换:', val);
|
||||||
|
},
|
||||||
handleClick(val) {
|
handleClick(val) {
|
||||||
console.log(val);
|
console.log('操作按钮点击:', val);
|
||||||
if (val.type === 'edit') {
|
if (val.type === 'edit') {
|
||||||
this.addOrUpdateVisible= true
|
this.addOrUpdateVisible = true;
|
||||||
|
// Vue2 中 $nextTick 确保子组件已渲染
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.addOrUpdate.init(val.data);
|
this.$refs.addOrUpdate.init(val.data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getPdLineList() {
|
getPdLineList() {
|
||||||
getPdList().then((res) => {
|
getPdList().then(res => {
|
||||||
this.formConfig[1].selectOptions = res.data || []
|
// Vue2 中数组赋值需确保响应式
|
||||||
this.pdLineList = res.data || []; // 保存产线数据
|
this.$set(this.formConfig[1], 'selectOptions', res.data || []);
|
||||||
})
|
this.pdLineList = res.data || [];
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('获取产线列表失败:', err);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
selectChange(val) {
|
selectChange(val) {
|
||||||
console.log(val)
|
console.log('选择变更:', val);
|
||||||
this.selectedList = val
|
this.selectedList = val;
|
||||||
},
|
},
|
||||||
buttonClick(val) {
|
buttonClick(val) {
|
||||||
console.log('val', val);
|
console.log('头部按钮点击:', val);
|
||||||
|
|
||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
this.listQuery.pageNo = 1;
|
this.listQuery.pageNo = 1;
|
||||||
this.listQuery.pageSize = 10;
|
this.listQuery.pageSize = 10;
|
||||||
this.listQuery.bindObjectId = val.bindObjectId ? val.bindObjectId : undefined;
|
this.listQuery.bindObjectId = val.bindObjectId ? val.bindObjectId : undefined;
|
||||||
this.listQuery.statisticType = val.statisticType ? val.statisticType : undefined;
|
this.listQuery.statisticType = val.statisticType ? val.statisticType : undefined;
|
||||||
this.listQuery.startTime = val.timeVal ? val.timeVal[0]: undefined;
|
|
||||||
this.listQuery.endTime = val.timeVal ? val.timeVal[1]: undefined;
|
|
||||||
|
|
||||||
//this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined;
|
// 处理不同时间维度的时间范围
|
||||||
|
this.handleTimeRange(val);
|
||||||
|
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
break;
|
break;
|
||||||
case 'export':
|
case 'export':
|
||||||
this.handleExport();
|
this.handleExport();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log(val);
|
console.log('未知按钮:', val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 处理不同时间维度的时间范围
|
||||||
|
handleTimeRange(val) {
|
||||||
|
const statisticType = val.statisticType;
|
||||||
|
const timeVal = val.timeVal;
|
||||||
|
|
||||||
|
const timeValDay = val.timeValDay;
|
||||||
|
|
||||||
|
const timeValWeek = val.timeValWeek;
|
||||||
|
const timeValMonth = val.timeValMonth;
|
||||||
|
const timeValYear = val.timeValYear;
|
||||||
|
|
||||||
|
|
||||||
|
// 重置时间参数
|
||||||
|
this.listQuery.startTime = undefined;
|
||||||
|
this.listQuery.endTime = undefined;
|
||||||
|
|
||||||
|
switch (statisticType) {
|
||||||
|
case '0': // 班组 - 沿用原时间范围
|
||||||
|
if (timeVal && timeVal.length === 2) {
|
||||||
|
this.listQuery.startTime = timeVal[0];
|
||||||
|
this.listQuery.endTime = timeVal[1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '1': // 日 - 沿用原时间范围
|
||||||
|
if (timeValDay && timeValDay.length === 2) {
|
||||||
|
this.listQuery.startTime = timeValDay[0];
|
||||||
|
this.listQuery.endTime = timeValDay[1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '3': // 月 - 沿用原时间范围
|
||||||
|
if (timeValMonth && timeValMonth.length === 2) {
|
||||||
|
this.listQuery.startTime = timeValMonth[0];
|
||||||
|
this.listQuery.endTime = timeValMonth[1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '2': // 周 - 自动计算本周范围
|
||||||
|
if (timeValWeek) {
|
||||||
|
const [start, end] = getSelectedWeekRange(timeValWeek);
|
||||||
|
this.listQuery.startTime = formatDateTime(start);
|
||||||
|
this.listQuery.endTime = formatDateTime(end);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '4': // 年 - 自动计算本年范围
|
||||||
|
if (timeValYear) {
|
||||||
|
const [start, end] = getSelectedYearRange(timeValYear);
|
||||||
|
this.listQuery.startTime = formatDateTime(start);
|
||||||
|
this.listQuery.endTime = formatDateTime(end);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取数据列表
|
// 获取数据列表
|
||||||
getDataList() {
|
getDataList() {
|
||||||
this.dataListLoading = true;
|
this.dataListLoading = true;
|
||||||
this.urlOptions.getDataListURL(this.listQuery).then(response => {
|
this.urlOptions.getDataListURL(this.listQuery)
|
||||||
const arr = ['班组','日', '周', '月', '年'];
|
.then(response => {
|
||||||
this.tableData = response.data?.list?.map((item) => {
|
const arr = ['班组', '日', '周', '月', '年'];
|
||||||
item.reportType = arr[this.listQuery.statisticType];
|
// Vue2 中数组赋值确保响应式
|
||||||
item.statisticType = this.listQuery.statisticType
|
this.tableData = (response.data?.list || []).map(item => {
|
||||||
|
item.reportType = arr[this.listQuery.statisticType] || '';
|
||||||
|
item.statisticType = this.listQuery.statisticType;
|
||||||
|
|
||||||
// 匹配 bindObjectName
|
// 匹配产线名称
|
||||||
const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId);
|
// const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId);
|
||||||
item.bindObjectName = targetLine ? targetLine.name : ''; // 赋值名称,无匹配则为空
|
// item.bindObjectName = targetLine ? targetLine.name : ''
|
||||||
return item;
|
return item;
|
||||||
});
|
})
|
||||||
this.listQuery.total = response.data.total;
|
this.listQuery.total = response.data?.total || 0;
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('获取数据失败:', err);
|
||||||
|
this.tableData = [];
|
||||||
|
this.listQuery.total = 0;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
this.dataListLoading = false;
|
this.dataListLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 每页数
|
// 每页数变更
|
||||||
sizeChangeHandle(val) {
|
sizeChangeHandle(val) {
|
||||||
this.listQuery.pageSize = val;
|
this.listQuery.pageSize = val;
|
||||||
this.listQuery.pageNo = 1;
|
this.listQuery.pageNo = 1;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
// 当前页
|
// 当前页变更
|
||||||
currentChangeHandle(val) {
|
currentChangeHandle(val) {
|
||||||
this.listQuery.pageNo = val;
|
this.listQuery.pageNo = val;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
|
// 导出处理
|
||||||
handleExport() {
|
handleExport() {
|
||||||
// 处理查询参数
|
const params = { ...this.listQuery };
|
||||||
let params = { ...this.listQuery };
|
// 移除分页参数
|
||||||
params.pageNo = undefined;
|
delete params.pageNo;
|
||||||
params.pageSize = undefined;
|
delete params.pageSize;
|
||||||
this.$modal.confirm('是否确认导出原片报表?').then(() => {
|
delete params.total;
|
||||||
|
|
||||||
|
this.$modal.confirm('是否确认导出原片报表?')
|
||||||
|
.then(() => {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
return exportCostOriginRadioHisData(params);
|
return exportCostOriginRadioHisData(params);
|
||||||
}).then(response => {
|
})
|
||||||
|
.then(response => {
|
||||||
this.$download.excel(response, '原片报表.xls');
|
this.$download.excel(response, '原片报表.xls');
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('导出失败:', err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
this.exportLoading = false;
|
this.exportLoading = false;
|
||||||
}).catch(() => { });
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// Vue2 中监听数据变化(如需)
|
||||||
|
watch: {
|
||||||
|
'listQuery.statisticType'(newVal) {
|
||||||
|
console.log('报表类型变更:', newVal);
|
||||||
|
// 可添加类型变更后的额外逻辑
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.app-container {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-data-bg {
|
||||||
|
height: 400px;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-aside {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
274
src/views/core/monitoring/rawFilmReport/searchBar.vue
Normal file
274
src/views/core/monitoring/rawFilmReport/searchBar.vue
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
<template>
|
||||||
|
<div class="searchBarBox divHeight" ref="searchBarRef" :style="{ paddingRight: isFold ? '55px' : '0px' }">
|
||||||
|
<el-form :inline="true" ref="searchBarForm" :model="formInline" class="searchBar">
|
||||||
|
<span class="blue-block" v-if="removeBlue ? false : true"></span>
|
||||||
|
<template v-for="item in formConfig">
|
||||||
|
<el-form-item v-if="item.type !== ''" :key="item.param" :label="item.label ? item.label : ''"
|
||||||
|
:required="item.required ? item.required : false">
|
||||||
|
<el-input v-if="item.type === 'input'" v-model="formInline[item.param]"
|
||||||
|
:size="item.size ? item.size : 'small'" clearable :disabled="item.disabled ? item.disabled : false"
|
||||||
|
:style="item.width ? 'width:' + item.width + 'px' : 'width:200px'"
|
||||||
|
:placeholder="item.placeholder ? item.placeholder : ''" />
|
||||||
|
<el-select v-if="item.type === 'select'" v-model="formInline[item.param]"
|
||||||
|
:size="item.size ? item.size : 'small'" :filterable="item.filterable ? item.filterable : false"
|
||||||
|
:multiple="item.multiple ? item.multiple : false" :clearable="item.clearable === false ? false : true"
|
||||||
|
:style="item.width ? 'width:' + item.width + 'px' : 'width:200px'" :placeholder="item.label" @change="
|
||||||
|
item.onchange
|
||||||
|
? $emit('select-changed', {
|
||||||
|
param: item.param,
|
||||||
|
value: formInline[item.param]
|
||||||
|
})
|
||||||
|
: null
|
||||||
|
">
|
||||||
|
<el-option v-for="(sub, i) in item.selectOptions" :key="i"
|
||||||
|
:label="item.labelField ? sub[item.labelField] : sub['name']"
|
||||||
|
:value="item.valueField ? sub[item.valueField] : sub['id']" />
|
||||||
|
</el-select>
|
||||||
|
<el-date-picker v-if="item.type === 'datePicker'" :key="item.param" :size="item.size ? item.size : 'small'"
|
||||||
|
v-model="formInline[item.param]" :type="item.dateType" :format="item.format ? item.format : 'yyyy-MM-dd'"
|
||||||
|
:value-format="item.valueFormat ? item.valueFormat : null" :default-time="item.defaultTime || null"
|
||||||
|
:range-separator="item.rangeSeparator || null" :start-placeholder="item.startPlaceholder || null"
|
||||||
|
:end-placeholder="item.endPlaceholder || null" :placeholder="item.placeholder"
|
||||||
|
:picker-options="item.pickerOptions ? item.pickerOptions : null"
|
||||||
|
:clearable="item.clearable === false ? false : true"
|
||||||
|
:style="item.width ? 'width:' + item.width + 'px' : (item.dateType === 'datetimerange' ? 'width:340px' : (item.dateType === 'daterange' ? 'width:220px' : 'width:140px'))" />
|
||||||
|
<el-autocomplete v-if="item.type === 'autocomplete'" v-model="formInline[item.param]"
|
||||||
|
:value-key="item.valueKey ? item.valueKey : 'value'" :size="item.size ? item.size : 'small'"
|
||||||
|
:fetch-suggestions="item.querySearch" :placeholder="item.placeholder"
|
||||||
|
:clearable="item.clearable === false ? false : true"
|
||||||
|
:style="item.width ? 'width:' + item.width + 'px' : 'width:200px'" filterable />
|
||||||
|
<el-cascader v-if="item.type === 'cascader'" v-model="formInline[item.param]" :options="item.selectOptions"
|
||||||
|
:props="item.cascaderProps" :size="item.size ? item.size : 'small'"
|
||||||
|
:clearable="item.clearable === false ? false : true"
|
||||||
|
:show-all-levels="item.showAllLevels === false ? false : true"
|
||||||
|
:collapse-tags="item.collapseTags === true ? true : false"
|
||||||
|
:style="item.width ? 'width:' + item.width + 'px' : 'width:200px'" @change="
|
||||||
|
item.onChange
|
||||||
|
? $emit('cascader-change', {
|
||||||
|
param: item.param,
|
||||||
|
value: formInline[item.param]
|
||||||
|
})
|
||||||
|
: null
|
||||||
|
"></el-cascader>
|
||||||
|
<el-button v-if="item.type === 'button'" :type="item.color" :size="item.size ? item.size : 'small'"
|
||||||
|
:plain="item.plain ? item.plain : false" :round="item.round ? item.round : false"
|
||||||
|
@click="headBtnClick(item.name)">{{ item.btnName }}</el-button>
|
||||||
|
<span v-if="item.type === 'separate'" class="separateStyle"></span>
|
||||||
|
<!-- 可用于显示其他按钮 -->
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
<el-form-item>
|
||||||
|
<slot></slot>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span v-if="isFold" class="foldClass" @click='switchMode'>
|
||||||
|
{{ isExpand ? '收起' : '展开' }}
|
||||||
|
<i class="iconfont" :class="isExpand ? 'icon-upward' : 'icon-downward'"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'SearchBar',
|
||||||
|
props: {
|
||||||
|
formConfigs: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeBlue: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isFold: {// 多行模式(默认否)
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
const formInline = {}
|
||||||
|
const formConfig = this.formConfigs
|
||||||
|
let hasExtraOptions = false
|
||||||
|
for (const obj of formConfig) {
|
||||||
|
if (obj.type !== 'button') {
|
||||||
|
if (obj.defaultSelect === false || obj.defaultSelect === 0) {
|
||||||
|
formInline[obj.param] = obj.defaultSelect
|
||||||
|
} else {
|
||||||
|
formInline[obj.param] = obj.defaultSelect || '' // defaultSelect下拉框默认选中项
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (obj.extraOptions) {
|
||||||
|
hasExtraOptions = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
formInline,
|
||||||
|
formConfig,
|
||||||
|
hasExtraOptions,
|
||||||
|
isExpand: false // 是否展开(默认否)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
formConfig: {
|
||||||
|
handler() {
|
||||||
|
for (const obj of this.formConfig) {
|
||||||
|
if (obj.defaultSelect) {
|
||||||
|
this.formInline[obj.param] = obj.defaultSelect
|
||||||
|
} else if (obj.defaultSelect === null) {
|
||||||
|
// 需要手动从外部清除选项缓存的情况,确保在外部配置项中可直接设置null
|
||||||
|
this.formInline[obj.param] = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
},
|
||||||
|
formInline: {
|
||||||
|
handler: function () {
|
||||||
|
this.$forceUpdate()
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.init()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
if (this.hasExtraOptions) {
|
||||||
|
// 如果有额外参数就处理,如果没有就算了
|
||||||
|
for (const obj of this.formConfig) {
|
||||||
|
if (obj.extraOptions) {
|
||||||
|
// 注: 对obj.extraOptions的选择是互斥的!
|
||||||
|
this.$watch(
|
||||||
|
`formInline.${obj.param}`,
|
||||||
|
function (newVal) {
|
||||||
|
let deleteCount = 0
|
||||||
|
if (obj.index + 1 < this.formConfig.length) {
|
||||||
|
// 如果obj不是最后一个配置
|
||||||
|
const nextConfig = this.formConfig[obj.index + 1]
|
||||||
|
if (nextConfig.parent && nextConfig.parent === obj.param)
|
||||||
|
deleteCount = 1
|
||||||
|
}
|
||||||
|
const currentConfig = Object.assign(
|
||||||
|
{},
|
||||||
|
obj.extraOptions[newVal]
|
||||||
|
)
|
||||||
|
this.formConfig.splice(
|
||||||
|
obj.index + 1,
|
||||||
|
deleteCount,
|
||||||
|
currentConfig
|
||||||
|
)
|
||||||
|
// 修改 formInline
|
||||||
|
this.$set(this.formInline, currentConfig.param, '')
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
headBtnClick(btnName) {
|
||||||
|
this.formInline.btnName = btnName
|
||||||
|
this.$emit('headBtnClick', this.formInline)
|
||||||
|
},
|
||||||
|
resetForm() {
|
||||||
|
this.$refs.searchBarForm.resetFields()
|
||||||
|
const formInline = {}
|
||||||
|
const formConfig = this.formConfigs
|
||||||
|
for (const obj of formConfig) {
|
||||||
|
if (obj.type !== 'button') {
|
||||||
|
if (obj.defaultSelect === false || obj.defaultSelect === 0) {
|
||||||
|
formInline[obj.param] = obj.defaultSelect
|
||||||
|
} else {
|
||||||
|
formInline[obj.param] = obj.defaultSelect || '' // defaultSelect下拉框默认选中项
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.formInline = formInline
|
||||||
|
},
|
||||||
|
switchMode() {// 展开和收起切换
|
||||||
|
this.isExpand = !this.isExpand
|
||||||
|
const element = this.$refs.searchBarRef
|
||||||
|
if (this.isExpand) {
|
||||||
|
element.classList.remove('divHeight')
|
||||||
|
} else {
|
||||||
|
element.classList.add('divHeight')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.searchBarBox {
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchBarBox::after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divHeight {
|
||||||
|
height: 45px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchBar .blue-block {
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
width: 4px;
|
||||||
|
height: 16px;
|
||||||
|
background-color: #0B58FF;
|
||||||
|
border-radius: 1px;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchBar .el-form-item {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchBar .el-date-editor .el-range__icon {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #0B58FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchBar .el-input__prefix .el-icon-date {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #0B58FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchBar .el-input__prefix .el-icon-time {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #0B58FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchBar .separateStyle {
|
||||||
|
display: inline-block;
|
||||||
|
width: 1px;
|
||||||
|
height: 24px;
|
||||||
|
background: #E8E8E8;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchBarBox .foldClass {
|
||||||
|
position: absolute;
|
||||||
|
top: 14px;
|
||||||
|
right: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #0B58FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchBarBox .foldClass .iconfont {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,423 +1,430 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="home-page">
|
<div class="app-container">
|
||||||
<div class="date-tabs">
|
<!-- 顶部日期&筛选栏 -->
|
||||||
<!-- @tab-click="handleClick" -->
|
<el-row :gutter="20" class="top-bar">
|
||||||
<el-tabs v-model="activeName" @tab-click="timedayChange" :stretch="true">
|
<el-col :span="8">
|
||||||
<el-tab-pane
|
|
||||||
:label="'\u2002\u2002日\u2002\u2002'"
|
|
||||||
name="日"></el-tab-pane>
|
|
||||||
<el-tab-pane
|
|
||||||
:label="'\u2002\u2002周\u2002\u2002'"
|
|
||||||
name="周"></el-tab-pane>
|
|
||||||
<el-tab-pane
|
|
||||||
:label="'\u2002\u2002月\u2002\u2002'"
|
|
||||||
name="月"></el-tab-pane>
|
|
||||||
<el-tab-pane
|
|
||||||
:label="'\u2002\u2002年\u2002\u2002'"
|
|
||||||
name="年"></el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
<div class="detail">
|
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="timeday"
|
v-model="dateRange"
|
||||||
align="right"
|
type="daterange"
|
||||||
type="date"
|
range-separator="~"
|
||||||
format="yyyy-MM-dd"
|
start-placeholder="开始日期"
|
||||||
valueFormat="yyyy-MM-dd"
|
end-placeholder="结束日期"
|
||||||
:clearable="false"
|
value-format="yyyy-MM-dd" />
|
||||||
@change="timedayChange"
|
<el-button type="primary" style="margin-left: 10px">查询</el-button>
|
||||||
placeholder="选择日期"
|
|
||||||
:picker-options="pickerOptions"></el-date-picker>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<el-row class="main-top" :gutter="16">
|
|
||||||
<el-col :span="24" style="position: relative">
|
|
||||||
<div class="title">
|
|
||||||
<svg-icon icon-class="home-produce" />
|
|
||||||
<span class="title-inner">生产总成本</span>
|
|
||||||
</div>
|
|
||||||
<el-row class="box">
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.priceS }}万元</div>
|
|
||||||
<div class="unit-style">总计成本</div>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4" class="num-box shadow">
|
<el-col :span="16">
|
||||||
<div class="num-style">{{ homeData.matPriceS }}万元</div>
|
<el-tag type="info" @click="changeTime('yesterday')">昨日</el-tag>
|
||||||
<div class="unit-style">原料成本</div>
|
<el-tag type="info" @click="changeTime('week')">本周</el-tag>
|
||||||
</el-col>
|
<el-tag type="info" @click="changeTime('month')">本月</el-tag>
|
||||||
<el-col :span="4" class="num-box shadow">
|
<el-tag type="info" @click="changeTime('year')">本年</el-tag>
|
||||||
<div class="num-style">{{ homeData.energyPriceS }}万元</div>
|
|
||||||
<div class="unit-style">能源成本</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.otherPriceS }}万元</div>
|
|
||||||
<div class="unit-style">其他成本</div>
|
|
||||||
</el-col>
|
|
||||||
<!-- <el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.ratioS }}</div>
|
|
||||||
<div class="unit-style">综合良品率/%</div>
|
|
||||||
</el-col> -->
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.areaPriceS }}元</div>
|
|
||||||
<div class="unit-style">综合每平米成本</div>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-col>
|
|
||||||
<el-col :span="24" style="position: relative">
|
<!-- 成本概览卡片 -->
|
||||||
<div class="title">
|
<el-row :gutter="20" class="card-row">
|
||||||
<svg-icon icon-class="home-produce" />
|
<el-col :span="8">
|
||||||
<span class="title-inner">原片成本</span>
|
<el-card class="cost-card">
|
||||||
|
<div class="card-title">总制造成本(元/平米)</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div>
|
||||||
|
目标
|
||||||
|
<span class="target-val">16</span>
|
||||||
</div>
|
</div>
|
||||||
<el-row class="box">
|
<div>
|
||||||
<el-col :span="4" class="num-box shadow">
|
实际
|
||||||
<div class="num-style">{{ homeData.priceO }}万元</div>
|
<span class="actual-val">12.8</span>
|
||||||
<div class="unit-style">原片总成本</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.matPriceO }}万元</div>
|
|
||||||
<div class="unit-style">原料成本</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.energyPriceO }}万元</div>
|
|
||||||
<div class="unit-style">能源成本</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.otherPriceO }}万元</div>
|
|
||||||
<div class="unit-style">其他成本</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.ratioO }}</div>
|
|
||||||
<div class="unit-style">原片良品率/%</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.areaPriceO }}元</div>
|
|
||||||
<div class="unit-style">原片每平米成本</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24" style="position: relative">
|
|
||||||
<div class="title">
|
|
||||||
<svg-icon icon-class="home-produce" />
|
|
||||||
<span class="title-inner">深加工成本</span>
|
|
||||||
</div>
|
</div>
|
||||||
<el-row class="box">
|
<el-progress :stroke-width="13" :percentage="80" color="#42b983" />
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.priceD }}万元</div>
|
|
||||||
<div class="unit-style">深加工总成本</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.energyPriceD }}万元</div>
|
|
||||||
<div class="unit-style">能源成本</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.otherPriceD }}万元</div>
|
|
||||||
<div class="unit-style">其他成本</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.ratioD }}</div>
|
|
||||||
<div class="unit-style">深加工良品率/%</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="4" class="num-box shadow">
|
|
||||||
<div class="num-style">{{ homeData.areaPriceD }}元</div>
|
|
||||||
<div class="unit-style">深加工每平米成本</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row class="main-bottom" :gutter="16" v-if="false">
|
|
||||||
<el-col :span="9">
|
|
||||||
<div class="chart-wrapper">
|
|
||||||
<line-chart :chart-data="lineChartData" />
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="7">
|
|
||||||
<div class="chart-wrapper">
|
|
||||||
<pie-chart />
|
|
||||||
</div>
|
</div>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<div class="chart-wrapper">
|
<el-card class="cost-card">
|
||||||
<bar-chart />
|
<div class="card-title">原片成本(元/平米)</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div>
|
||||||
|
目标
|
||||||
|
<span class="target-val">16</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
实际
|
||||||
|
<span class="actual-val">12.8</span>
|
||||||
|
</div>
|
||||||
|
<el-progress :stroke-width="13" :percentage="99" color="#42b983" />
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-card class="cost-card">
|
||||||
|
<div class="card-title">加工成本(元/平米)</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div>
|
||||||
|
目标
|
||||||
|
<span class="target-val">16</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
实际
|
||||||
|
<span class="actual-val">12.8</span>
|
||||||
|
</div>
|
||||||
|
<el-progress :stroke-width="13" :percentage="99" color="#42b983" />
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 成本构成区域 -->
|
||||||
|
<el-row :gutter="20" class="composition-row">
|
||||||
|
<!-- 饼图 -->
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-card class="composition-card">
|
||||||
|
<div class="card-title">成本构成</div>
|
||||||
|
<div id="costPie" class="chart" style="height: 350px"></div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<!-- 原片/加工成本子项 -->
|
||||||
|
<el-col :span="18">
|
||||||
|
<el-card class="composition-card">
|
||||||
|
<div class="card-title">成本构成</div>
|
||||||
|
|
||||||
|
<!-- 原片成本子项 -->
|
||||||
|
<div class="sub-cost-group">
|
||||||
|
<div class="sub-cost-title">原片成本</div>
|
||||||
|
<div class="sub-cost">
|
||||||
<div
|
<div
|
||||||
class="main-footer"
|
v-for="(item, idx) in rawSubCosts"
|
||||||
style="
|
:key="idx"
|
||||||
color: #c7c7c7;
|
class="sub-cost-div">
|
||||||
user-select: none;
|
<div class="sub-cost-name">
|
||||||
font-size: 14px;
|
{{ item.name }}
|
||||||
letter-spacing: 1px;
|
<div class="sub-cost-val">{{ item.val }}</div>
|
||||||
height: 30px;
|
|
||||||
display: grid;
|
|
||||||
place-content: center;
|
|
||||||
">
|
|
||||||
© 中建材智能自动化研究院有限公司
|
|
||||||
</div>
|
</div>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<el-progress
|
||||||
|
type="circle"
|
||||||
|
:percentage="89"
|
||||||
|
:width="60"
|
||||||
|
:stroke-width="10"
|
||||||
|
:show-text="false"
|
||||||
|
color="#e74c3c" />
|
||||||
|
</div>
|
||||||
|
<div class="sub-cost-name">
|
||||||
|
目标
|
||||||
|
<span class="red-text">{{ item.target }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="sub-cost-name">
|
||||||
|
完成率
|
||||||
|
<span class="red-text">89%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-divider></el-divider>
|
||||||
|
<!-- 加工成本子项 -->
|
||||||
|
<div class="sub-cost-group" style="margin-top: 20px">
|
||||||
|
<div class="sub-cost-title">加工成本</div>
|
||||||
|
<div class="sub-cost">
|
||||||
|
<div
|
||||||
|
v-for="(item, idx) in processSubCosts"
|
||||||
|
:key="idx"
|
||||||
|
class="sub-cost-div">
|
||||||
|
<div class="sub-cost-name">
|
||||||
|
{{ item.name }}
|
||||||
|
<div class="sub-cost-val">{{ item.val }}</div>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<el-progress
|
||||||
|
type="circle"
|
||||||
|
:percentage="89"
|
||||||
|
:width="60"
|
||||||
|
:stroke-width="10"
|
||||||
|
:show-text="false"
|
||||||
|
color="#e74c3c" />
|
||||||
|
</div>
|
||||||
|
<div class="sub-cost-name">
|
||||||
|
目标
|
||||||
|
<span class="red-text">{{ item.target }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="sub-cost-name">
|
||||||
|
完成率
|
||||||
|
<span class="red-text">89%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 趋势图区域 -->
|
||||||
|
<el-row :gutter="20" class="trend-row">
|
||||||
|
<!-- 总制造成本趋势 -->
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-card class="trend-card">
|
||||||
|
<div class="card-title">总制造成本趋势</div>
|
||||||
|
<div id="totalTrend" class="chart" style="height: 300px"></div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<!-- 原片/加工成本趋势 -->
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-card class="trend-card">
|
||||||
|
<div class="card-title">原片/加工成本趋势</div>
|
||||||
|
<el-tabs v-model="costTab" type="card" style="margin-bottom: 10px">
|
||||||
|
<el-tab-pane label="原片成本" name="raw"></el-tab-pane>
|
||||||
|
<el-tab-pane label="加工成本" name="process"></el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<div id="rawProcessTrend" class="chart" style="height: 300px"></div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<!-- 单项成本趋势 -->
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-card class="trend-card">
|
||||||
|
<div class="card-title">单项成本趋势</div>
|
||||||
|
<el-tabs v-model="itemTab" type="card" style="margin-bottom: 10px">
|
||||||
|
<el-tab-pane label="人工成本" name="labor"></el-tab-pane>
|
||||||
|
<el-tab-pane label="原料成本" name="material"></el-tab-pane>
|
||||||
|
<el-tab-pane label="制造费用" name="expense"></el-tab-pane>
|
||||||
|
<el-tab-pane label="玻璃热耗" name="heat"></el-tab-pane>
|
||||||
|
<el-tab-pane label="原片成品率" name="yield"></el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<div id="itemTrend" class="chart" style="height: 300px"></div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import moment from 'moment';
|
import * as echarts from 'echarts';
|
||||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
|
||||||
import LineChart from '../dashboard/LineChart';
|
|
||||||
import PieChart from '../dashboard/PieChart';
|
|
||||||
import BarChart from '../dashboard/BarChart';
|
|
||||||
import PanelGroup from '../dashboard/PanelGroup';
|
|
||||||
import { getData } from '@/api/cost/allCost';
|
|
||||||
import { getUserProfile } from '@/api/system/user';
|
|
||||||
|
|
||||||
const lineChartData = {
|
|
||||||
newVisitis: {
|
|
||||||
expectedData: [100, 120, 161, 134, 105, 160, 165],
|
|
||||||
actualData: [120, 82, 91, 154, 162, 140, 145],
|
|
||||||
},
|
|
||||||
messages: {
|
|
||||||
expectedData: [200, 192, 120, 144, 160, 130, 140],
|
|
||||||
actualData: [180, 160, 151, 106, 145, 150, 130],
|
|
||||||
},
|
|
||||||
purchases: {
|
|
||||||
expectedData: [80, 100, 121, 104, 105, 90, 100],
|
|
||||||
actualData: [120, 90, 100, 138, 142, 130, 130],
|
|
||||||
},
|
|
||||||
shoppings: {
|
|
||||||
expectedData: [130, 140, 141, 142, 145, 150, 160],
|
|
||||||
actualData: [120, 82, 91, 154, 162, 140, 130],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Home',
|
name: 'CostDashboard',
|
||||||
mixins: [tableHeightMixin],
|
|
||||||
components: {
|
|
||||||
LineChart,
|
|
||||||
PieChart,
|
|
||||||
PanelGroup,
|
|
||||||
BarChart,
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
gradientBackground() {
|
|
||||||
return {
|
|
||||||
'background-image':
|
|
||||||
'linear-gradient(90deg, #f0f0f0 25%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 50%, #f0f0f0 50%, #f0f0f0 75%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0))',
|
|
||||||
'background-size': '100px 100px', // 调整条纹的大小
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeName: '日',
|
dateRange: ['2023-05-06', '2023-05-06'],
|
||||||
user: '',
|
costTab: 'raw',
|
||||||
lineChartData: lineChartData.newVisitis,
|
itemTab: 'labor',
|
||||||
homeData: {},
|
// 原片成本子项
|
||||||
timeday: moment(new Date()).subtract(1, 'days').format('YYYY-MM-DD'),
|
rawSubCosts: [
|
||||||
startTime:
|
{ name: '人工成本', val: 4.56, target: 4.32 },
|
||||||
moment(new Date()).subtract(0, 'days').format('YYYY-MM-DD') +
|
{ name: '原料成本', val: 4.56, target: 4.32 },
|
||||||
' 00:00:00',
|
{ name: '原片制造费用', val: 4.56, target: 4.32 },
|
||||||
endTime:
|
{ name: '玻璃热耗', val: 4.56, target: 4.32 },
|
||||||
moment(new Date()).subtract(-1, 'days').format('YYYY-MM-DD') +
|
{ name: '原片成品率', val: 4.56, target: 4.32 },
|
||||||
' 00:00:00',
|
|
||||||
|
|
||||||
pickerOptions: {
|
|
||||||
disabledDate(time) {
|
|
||||||
return time.getTime() + 3600 * 1000 * 24 > Date.now();
|
|
||||||
},
|
|
||||||
shortcuts: [
|
|
||||||
{
|
|
||||||
text: '今天',
|
|
||||||
onClick(picker) {
|
|
||||||
picker.$emit('pick', new Date());
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '昨天',
|
|
||||||
onClick(picker) {
|
|
||||||
const date = new Date();
|
|
||||||
date.setTime(date.getTime() - 3600 * 1000 * 24);
|
|
||||||
picker.$emit('pick', date);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '一周前',
|
|
||||||
onClick(picker) {
|
|
||||||
const date = new Date();
|
|
||||||
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
|
|
||||||
picker.$emit('pick', date);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
// 加工成本子项
|
||||||
|
processSubCosts: [
|
||||||
|
{ name: '人工成本', val: 4.56, target: 4.32 },
|
||||||
|
{ name: '加工动力成本', val: 4.56, target: 4.32 },
|
||||||
|
{ name: '加工制造费用', val: 4.56, target: 4.32 },
|
||||||
|
{ name: '加工投入产出率', val: 4.56, target: 4.32 },
|
||||||
|
],
|
||||||
|
// 趋势图模拟数据
|
||||||
|
trendX: ['00:00', '01:00', '02:00'],
|
||||||
|
trendY: [20, 40, 50],
|
||||||
|
targetY: 12.54,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
mounted() {
|
||||||
},
|
this.initCostPie();
|
||||||
beforeDestroy() {
|
this.initTotalTrend();
|
||||||
|
this.initRawProcessTrend();
|
||||||
|
this.initItemTrend();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getData() {
|
// 切换时间范围(示例)
|
||||||
let listQuery = {
|
changeTime(type) {
|
||||||
//分页
|
// 实际项目中需根据type请求对应数据
|
||||||
pageSize: 10,
|
console.log('切换时间:', type);
|
||||||
pageNo: 1,
|
|
||||||
statisticType: ['', '日', '周', '月', '年'].indexOf(this.activeName),
|
|
||||||
startTime: this.timeday + ' 00:00:00',
|
|
||||||
};
|
|
||||||
getData(listQuery).then((response) => {
|
|
||||||
this.homeData = response.data;
|
|
||||||
for (let i in this.homeData) {
|
|
||||||
this.homeData[i] = Number(this.homeData[i]).toFixed(2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
timedayChange() {
|
// 初始化成本构成饼图
|
||||||
let listQuery = {
|
initCostPie() {
|
||||||
//分页
|
const pieChart = echarts.init(document.getElementById('costPie'));
|
||||||
pageSize: 10,
|
pieChart.setOption({
|
||||||
pageNo: 1,
|
tooltip: { trigger: 'item' },
|
||||||
statisticType: ['', '日', '周', '月', '年'].indexOf(this.activeName),
|
legend: {
|
||||||
startTime: this.timeday + ' 00:00:00',
|
orient: 'horizontal', // 水平排列
|
||||||
};
|
bottom: 0, // 放在底部
|
||||||
getData(listQuery).then((response) => {
|
icon: 'circle',
|
||||||
this.homeData = response.data;
|
left: 'center',
|
||||||
for (let i in this.homeData) {
|
formatter: function (name) {
|
||||||
this.homeData[i] = Number(this.homeData[i]).toFixed(2);
|
return name;
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
goDetail() {
|
},
|
||||||
this.$router.push({ path: 'indexDetail' });
|
series: [
|
||||||
|
{
|
||||||
|
type: 'pie',
|
||||||
|
data: [
|
||||||
|
{ name: '原料成本(4.2元)', value: 29.9 },
|
||||||
|
{ name: '动力成本(2.1元)', value: 24 },
|
||||||
|
{ name: '人工成本(1.5元)', value: 24 },
|
||||||
|
{ name: '辅料成本(0.5元)', value: 21.2 },
|
||||||
|
{ name: '制造费用(0.5元)', value: 21.2 },
|
||||||
|
],
|
||||||
|
label: { show: false },
|
||||||
|
labelLine: { show: false },
|
||||||
|
bottom: 10,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
window.addEventListener('resize', () => pieChart.resize());
|
||||||
|
},
|
||||||
|
// 初始化总制造成本趋势图
|
||||||
|
initTotalTrend() {
|
||||||
|
const totalChart = echarts.init(document.getElementById('totalTrend'));
|
||||||
|
totalChart.setOption({
|
||||||
|
grid: { top: 20, bottom: 30, left: 30, right: 10 },
|
||||||
|
xAxis: { type: 'category', data: this.trendX },
|
||||||
|
yAxis: { type: 'value', min: -20, max: 60 },
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '实际值',
|
||||||
|
type: 'line',
|
||||||
|
data: this.trendY,
|
||||||
|
lineStyle: { color: '#409eff' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '目标值',
|
||||||
|
type: 'line',
|
||||||
|
data: [this.targetY, this.targetY, this.targetY],
|
||||||
|
lineStyle: { type: 'dashed', color: '#e6a23c' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
window.addEventListener('resize', () => totalChart.resize());
|
||||||
|
},
|
||||||
|
// 初始化原片/加工成本趋势图
|
||||||
|
initRawProcessTrend() {
|
||||||
|
const rpChart = echarts.init(document.getElementById('rawProcessTrend'));
|
||||||
|
rpChart.setOption({
|
||||||
|
grid: { top: 10, bottom: 20, left: 20, right: 10 },
|
||||||
|
xAxis: { type: 'category', data: this.trendX },
|
||||||
|
yAxis: { type: 'value', min: -20, max: 60 },
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '实际值',
|
||||||
|
type: 'line',
|
||||||
|
data: this.trendY,
|
||||||
|
lineStyle: { color: '#409eff' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '目标值',
|
||||||
|
type: 'line',
|
||||||
|
data: [this.targetY, this.targetY, this.targetY],
|
||||||
|
lineStyle: { type: 'dashed', color: '#e6a23c' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
window.addEventListener('resize', () => rpChart.resize());
|
||||||
|
},
|
||||||
|
// 初始化单项成本趋势图
|
||||||
|
initItemTrend() {
|
||||||
|
const itemChart = echarts.init(document.getElementById('itemTrend'));
|
||||||
|
itemChart.setOption({
|
||||||
|
grid: { top: 10, bottom: 20, left: 20, right: 10 },
|
||||||
|
xAxis: { type: 'category', data: this.trendX },
|
||||||
|
yAxis: { type: 'value', min: -20, max: 60 },
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '实际值',
|
||||||
|
type: 'line',
|
||||||
|
data: this.trendY,
|
||||||
|
lineStyle: { color: '#409eff' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '目标值',
|
||||||
|
type: 'line',
|
||||||
|
data: [this.targetY, this.targetY, this.targetY],
|
||||||
|
lineStyle: { type: 'dashed', color: '#e6a23c' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
window.addEventListener('resize', () => itemChart.resize());
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style scoped>
|
||||||
.home-page::before {
|
.top-bar {
|
||||||
background-image: url('~@/assets/img/home-bg.png');
|
|
||||||
background-size: cover;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center;
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
transform: rotate(180deg);
|
|
||||||
}
|
|
||||||
.date-tabs {
|
|
||||||
padding-left: 40px;
|
|
||||||
padding-top: 20px;
|
|
||||||
position: relative;
|
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
:deep(.date-tabs) {
|
.card-row,
|
||||||
.el-tabs__header {
|
.composition-row {
|
||||||
margin-bottom: 8px;
|
|
||||||
display: inline-block;
|
|
||||||
transform: translateY(-12px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-tabs__content {
|
|
||||||
overflow: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-tabs__item {
|
|
||||||
font-size: 18px;
|
|
||||||
color: #fff;
|
|
||||||
padding-left: 0 !important;
|
|
||||||
padding-right: 0 !important;
|
|
||||||
line-height: 36px !important;
|
|
||||||
height: 36px;
|
|
||||||
}
|
|
||||||
.el-tabs__item.is-active {
|
|
||||||
color: #0b58ff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.detail {
|
|
||||||
display: inline-block;
|
|
||||||
position: absolute;
|
|
||||||
left: 260px;
|
|
||||||
top: 10px;
|
|
||||||
}
|
|
||||||
:deep(.detail) {
|
|
||||||
.el-input__inner {
|
|
||||||
background-color: transparent;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// .current-date {
|
|
||||||
// color: #fff;
|
|
||||||
// font-size: 18px;
|
|
||||||
// position: absolute;
|
|
||||||
// left: 260px;
|
|
||||||
// top: 14px;
|
|
||||||
// }
|
|
||||||
.current-time {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 18px;
|
|
||||||
position: absolute;
|
|
||||||
right: 38px;
|
|
||||||
top: 14px;
|
|
||||||
}
|
|
||||||
.main-top {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 20px 0 40px;
|
|
||||||
.title {
|
|
||||||
position: absolute;
|
|
||||||
left: 34px;
|
|
||||||
top: 20px;
|
|
||||||
width: 180px;
|
|
||||||
font-size: 32px;
|
|
||||||
z-index: 10;
|
|
||||||
.title-inner {
|
|
||||||
position: absolute;
|
|
||||||
left: 42px;
|
|
||||||
top: 5px;
|
|
||||||
font-size: calc(100vw * 20 / 1920);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.box {
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 24px;
|
|
||||||
height: 192px;
|
|
||||||
padding: 40px 24px 32px 24px;
|
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
box-shadow: 0 8px 8px 0 gray;
|
}
|
||||||
.num-box {
|
.cost-card .card-title {
|
||||||
height: 120px;
|
font-size: 22px;
|
||||||
padding-top: 26px;
|
font-weight: bold;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
.cost-card .card-content {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
.target-val {
|
||||||
|
color: #666;
|
||||||
|
margin-left: 5px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.actual-val {
|
||||||
|
color: #42b983;
|
||||||
|
margin-left: 5px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.composition-card {
|
||||||
|
height: 480px;
|
||||||
|
}
|
||||||
|
.composition-card .card-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
.sub-cost {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.sub-cost-group .sub-cost-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.sub-cost-group .sub-cost-div {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px solid rgb(220, 220, 220, 0.5);
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.sub-cost-name {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
.num-style {
|
margin-top: 5px;
|
||||||
color: #000;
|
font-size: 14px;
|
||||||
font-size: calc(100vw * 40 / 1920);
|
|
||||||
}
|
|
||||||
.unit-style {
|
|
||||||
color: rgba(0, 0, 0, 0.7);
|
|
||||||
font-size: calc(100vw * 18 / 1920);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.shadow {
|
|
||||||
background: linear-gradient(90deg, #ffffff 80%, #f2f4f9 100%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.main-bottom {
|
.sub-cost-val {
|
||||||
width: 100%;
|
font-size: 16px;
|
||||||
margin-top: 20px;
|
font-weight: bold;
|
||||||
.chart-wrapper {
|
}
|
||||||
margin-left: 10px;
|
.completion {
|
||||||
height: 425px;
|
text-align: center;
|
||||||
background: #fff;
|
font-size: 12px;
|
||||||
border-radius: 5px;
|
color: #666;
|
||||||
box-shadow: 0 3px 3px 0 gray;
|
}
|
||||||
}
|
.red-text {
|
||||||
}
|
color: #e74c3c;
|
||||||
</style>
|
}
|
||||||
<style lang="scss">
|
.trend-card {
|
||||||
.home-page {
|
height: 450px;
|
||||||
.el-progress-bar__inner {
|
}
|
||||||
background-image: url('~@/assets/img/home-progress-bg.png');
|
.trend-card .card-title {
|
||||||
background-size: cover;
|
font-size: 16px;
|
||||||
}
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,17 +1,74 @@
|
|||||||
<!--
|
<!--
|
||||||
filename: index.vue
|
* @Author: zwq
|
||||||
author: liubin
|
* @Date: 2025-06-25 09:53:10
|
||||||
date: 2023-09-04 09:34:52
|
* @LastEditors: zwq
|
||||||
description: 设备异常分析
|
* @LastEditTime: 2026-04-28 10:59:33
|
||||||
|
* @Description:
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<SearchBar
|
<el-form
|
||||||
:formConfigs="searchBarFormConfig"
|
:inline="true"
|
||||||
ref="search-bar"
|
ref="searchBarForm"
|
||||||
@headBtnClick="handleSearchBarBtnClick" />
|
:model="queryParams"
|
||||||
|
class="searchBar">
|
||||||
|
<span class="blue-block"></span>
|
||||||
|
<el-form-item label="时间维度">
|
||||||
|
<el-radio-group size="small" v-model="queryParams.radio">
|
||||||
|
<el-radio :label="1">周期报表</el-radio>
|
||||||
|
<el-radio :label="2">累计</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="时间维度">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
size="small"
|
||||||
|
:disabled="queryParams.radio === 2"
|
||||||
|
placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in typeoptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="产线/工段">
|
||||||
|
<el-cascader
|
||||||
|
size="small"
|
||||||
|
:options="options"
|
||||||
|
ref="cascaderRef"
|
||||||
|
collapse-tags
|
||||||
|
@change="handleCascaderChange"
|
||||||
|
:props="{
|
||||||
|
value: 'id',
|
||||||
|
label: 'name',
|
||||||
|
checkStrictly: true,
|
||||||
|
multiple: true,
|
||||||
|
emitPath: false,
|
||||||
|
}"></el-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="时间范围" prop="recordTime">
|
||||||
|
<el-date-picker
|
||||||
|
size="small"
|
||||||
|
v-model="queryParams.recordTime"
|
||||||
|
type="daterange"
|
||||||
|
format="yyyy-MM-dd"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始时间"
|
||||||
|
end-placeholder="结束时间"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button size="small" type="primary" @click="handleRecordSearch">
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button size="small" type="warning" @click="handleExport1">
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<base-table
|
<base-table
|
||||||
@@ -43,6 +100,14 @@
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
|
import { getGroupPlanTree } from '@/api/group/Schedule';
|
||||||
|
import {
|
||||||
|
exportReportExcel,
|
||||||
|
exportQueryExcel,
|
||||||
|
getReportPage,
|
||||||
|
getQueryPage,
|
||||||
|
} from '@/api/analysis/exception';
|
||||||
|
import { parseTime } from '@/utils/ruoyi';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ExceptionAnalysis',
|
name: 'ExceptionAnalysis',
|
||||||
@@ -51,21 +116,6 @@ export default {
|
|||||||
props: {},
|
props: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
searchBarKeys: ['name', 'code'],
|
|
||||||
// tableBtn: [
|
|
||||||
// this.$auth.hasPermi('base:equipment-group:update')
|
|
||||||
// ? {
|
|
||||||
// type: 'edit',
|
|
||||||
// btnName: '修改',
|
|
||||||
// }
|
|
||||||
// : undefined,
|
|
||||||
// this.$auth.hasPermi('base:equipment-group:delete')
|
|
||||||
// ? {
|
|
||||||
// type: 'delete',
|
|
||||||
// btnName: '删除',
|
|
||||||
// }
|
|
||||||
// : undefined,
|
|
||||||
// ].filter((v) => v),
|
|
||||||
tableBtn: [
|
tableBtn: [
|
||||||
{
|
{
|
||||||
type: 'edit',
|
type: 'edit',
|
||||||
@@ -80,131 +130,147 @@ export default {
|
|||||||
{ prop: 'lineName', label: '产线' },
|
{ prop: 'lineName', label: '产线' },
|
||||||
{ prop: 'sectionName', label: '工段' },
|
{ prop: 'sectionName', label: '工段' },
|
||||||
{ prop: 'equipmentName', label: '设备' },
|
{ prop: 'equipmentName', label: '设备' },
|
||||||
|
{ prop: 'createTime', filter: parseTime, label: '日期' },
|
||||||
|
{
|
||||||
|
width: 128,
|
||||||
|
prop: 'actualRunningHours',
|
||||||
|
label: '运行时长(h)',
|
||||||
|
filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
|
},
|
||||||
|
{ prop: 'downtimeCount', label: '故障次数' },
|
||||||
{
|
{
|
||||||
width: 240,
|
width: 240,
|
||||||
prop: 'mtbf',
|
prop: 'avgDowntimeDuration',
|
||||||
label: '平均故障间隔时间[MTBF](h)',
|
label: '平均故障间隔时间[MTBF](h)',
|
||||||
filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
width: 240,
|
// width: 240,
|
||||||
prop: 'mttr',
|
// prop: 'mttr',
|
||||||
label: '平均维修时间[MTTR](h)',
|
// label: '平均维修时间[MTTR](h)',
|
||||||
filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
},
|
// },
|
||||||
{ width: 128, prop: 'workTime', label: '工作时长(h)',
|
// {
|
||||||
filter: (val) => (val != null ? val.toFixed(2) : '-'), },
|
// width: 128,
|
||||||
{ width: 128, prop: 'downTime', label: '故障时长(h)',
|
// prop: 'downTime',
|
||||||
filter: (val) => (val != null ? val.toFixed(2) : '-'), },
|
// label: '故障时长(h)',
|
||||||
{ prop: 'downCount', label: '故障次数' },
|
// filter: (val) => (val != null ? val.toFixed(2) : '-'),
|
||||||
],
|
// },
|
||||||
searchBarFormConfig: [
|
|
||||||
{
|
|
||||||
type: 'select',
|
|
||||||
label: '请选择月份',
|
|
||||||
placeholder: '请选择月份',
|
|
||||||
param: 'month',
|
|
||||||
selectOptions: Array(12)
|
|
||||||
.fill(0)
|
|
||||||
.map((v, i) => ({
|
|
||||||
id: i + 1,
|
|
||||||
name: `${i + 1}月`,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
__index: 'line',
|
|
||||||
type: 'select',
|
|
||||||
label: '产线',
|
|
||||||
placeholder: '请选择产线',
|
|
||||||
param: 'lineId',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'button',
|
|
||||||
btnName: '查询',
|
|
||||||
name: 'search',
|
|
||||||
color: 'primary',
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
lineId: null,
|
radio: 1,
|
||||||
|
type: null,
|
||||||
factoryId: null,
|
factoryId: null,
|
||||||
|
lineId: null,
|
||||||
|
sectionId: null,
|
||||||
|
equId: null,
|
||||||
recordTime: null,
|
recordTime: null,
|
||||||
},
|
},
|
||||||
|
typeoptions: [
|
||||||
|
{
|
||||||
|
value: '4',
|
||||||
|
label: '周',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '5',
|
||||||
|
label: '月',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '6',
|
||||||
|
label: '年',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: [], // 产线/工段选项
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
created() {
|
created() {
|
||||||
this.fillLineOptions();
|
getGroupPlanTree().then((res) => {
|
||||||
|
this.options = res.data;
|
||||||
|
});
|
||||||
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fillLineOptions() {
|
handleCascaderChange() {
|
||||||
const { data } = await this.$axios({
|
const checkedNodes = this.$refs.cascaderRef.getCheckedNodes();
|
||||||
url: '/base/production-line/listAll',
|
this.queryParams.factoryId = [];
|
||||||
method: 'get',
|
this.queryParams.lineId = [];
|
||||||
|
this.queryParams.sectionId = [];
|
||||||
|
this.queryParams.equId = [];
|
||||||
|
checkedNodes.forEach((node) => {
|
||||||
|
if (node.checked) {
|
||||||
|
if (node.level === 1) {
|
||||||
|
this.queryParams.factoryId.push(node.value);
|
||||||
|
} else if (node.level === 2) {
|
||||||
|
this.queryParams.lineId.push(node.value);
|
||||||
|
} else if (node.level === 3) {
|
||||||
|
this.queryParams.sectionId.push(node.value);
|
||||||
|
} else if (node.level === 4) {
|
||||||
|
this.queryParams.equId.push(node.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const cfg = this.searchBarFormConfig.find(
|
},
|
||||||
(item) => item.__index == 'line'
|
handleRecordSearch() {
|
||||||
);
|
if (
|
||||||
this.$set(
|
this.queryParams.recordTime &&
|
||||||
cfg,
|
this.queryParams.recordTime.length > 0
|
||||||
'selectOptions',
|
) {
|
||||||
data.map((item) => ({
|
this.queryParams.startTime = this.queryParams.recordTime[0];
|
||||||
id: item.id,
|
this.queryParams.endTime = this.queryParams.recordTime[1];
|
||||||
name: item.name,
|
}
|
||||||
}))
|
this.getList();
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async getList() {
|
async getList() {
|
||||||
|
const params = {
|
||||||
|
lineId: this.queryParams.lineId || null,
|
||||||
|
sectionId: this.queryParams.sectionId || null,
|
||||||
|
equipmentId: this.queryParams.equId || null,
|
||||||
|
startTime: this.queryParams.startTime || null,
|
||||||
|
endTime: this.queryParams.endTime || null,
|
||||||
|
type:
|
||||||
|
this.queryParams.radio === 1 ? this.queryParams.type || null : null,
|
||||||
|
};
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
// 执行查询
|
// 执行查询
|
||||||
const { code, data } = await this.$axios({
|
const { code, data } = await (this.queryParams.radio === 1
|
||||||
url: '/analysis/equipment-analysis/efficiency',
|
? getReportPage(params)
|
||||||
method: 'get',
|
: getQueryPage(params));
|
||||||
params: {
|
|
||||||
lineId: this.queryParams.lineId || null,
|
|
||||||
recordTime: this.queryParams.recordTime || null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
this.list = data;
|
this.list = data;
|
||||||
} else {
|
} else {
|
||||||
this.list.splice(0);
|
this.list.splice(0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleExport1() {
|
||||||
handleSearchBarBtnClick(btn) {
|
this.handleRecordSearch();
|
||||||
switch (btn.btnName) {
|
// 处理查询参数
|
||||||
case 'search':
|
const params = {
|
||||||
if (btn.month) {
|
lineId: this.queryParams.lineId || null,
|
||||||
this.queryParams.recordTime = [
|
sectionId: this.queryParams.sectionId || null,
|
||||||
moment()
|
equipmentId: this.queryParams.equId || null,
|
||||||
.month(btn.month - 1)
|
startTime: this.queryParams.startTime || null,
|
||||||
.format('YYYY-MM') + '-01 00:00:00',
|
endTime: this.queryParams.endTime || null,
|
||||||
moment().month(btn.month).format('YYYY-MM') + '-01 00:00:00',
|
type:
|
||||||
];
|
this.queryParams.radio === 1 ? this.queryParams.type || null : null,
|
||||||
} else {
|
};
|
||||||
this.queryParams.recordTime = null;
|
this.$modal
|
||||||
}
|
.confirm('是否确认导出所有数据项?')
|
||||||
this.queryParams.lineId = btn.lineId || null;
|
.then(() => {
|
||||||
this.handleQuery();
|
this.exportLoading = true;
|
||||||
break;
|
return this.queryParams.radio === 1
|
||||||
}
|
? exportReportExcel(params)
|
||||||
},
|
: exportQueryExcel(params);
|
||||||
|
})
|
||||||
/** 搜索按钮操作 */
|
.then((response) => {
|
||||||
handleQuery() {
|
this.$download.excel(response, '报表.xls');
|
||||||
// this.queryParams.pageNo = 1;
|
this.exportLoading = false;
|
||||||
this.getList();
|
})
|
||||||
},
|
.catch(() => {});
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm('queryForm');
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
65
src/views/equipment/equipmentOverview/SmallTitle.vue
Normal file
65
src/views/equipment/equipmentOverview/SmallTitle.vue
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2023-08-01 15:27:31
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2023-08-01 16:25:54
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div :class="[className, { 'p-0': noPadding }]">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
size: {
|
||||||
|
// 取值范围: xl lg md sm
|
||||||
|
type: String,
|
||||||
|
default: 'de',
|
||||||
|
validator: function (val) {
|
||||||
|
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
noPadding: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
className: function () {
|
||||||
|
return `${this.size}-title`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
|
||||||
|
$mgr: 8px;
|
||||||
|
@each $size, $height in $pxls {
|
||||||
|
.#{$size}-title {
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: $height;
|
||||||
|
color: #000;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
width: 4px;
|
||||||
|
height: $height + 2px;
|
||||||
|
border-radius: 1px;
|
||||||
|
margin-right: $mgr;
|
||||||
|
background-color: #0b58ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-0 {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
134
src/views/equipment/equipmentOverview/add-or-updata.vue
Normal file
134
src/views/equipment/equipmentOverview/add-or-updata.vue
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :visible.sync="visible" width="40%">
|
||||||
|
<small-title slot="title" :no-padding="true">
|
||||||
|
{{ this.dataForm.lineId + '·' + this.dataForm.equipmentName }}
|
||||||
|
</small-title>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="visual-part">
|
||||||
|
<base-table :table-props="tableProps"
|
||||||
|
:page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
|
||||||
|
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
||||||
|
@clickBtn="handleClick" /> -->
|
||||||
|
</base-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div slot="footer" class="dialog-footer">
|
||||||
|
<el-button style="" @click="goback()">取消</el-button>
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()">
|
||||||
|
确定
|
||||||
|
</el-button>
|
||||||
|
</div> -->
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const tableProps = [
|
||||||
|
|
||||||
|
{
|
||||||
|
prop: 'paramName',
|
||||||
|
label: '参数名称'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'paramValue',
|
||||||
|
label: '当前值',
|
||||||
|
// filter: parseTime,
|
||||||
|
// width: 160
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
import { getParamMonitor } from '@/api/base/equipment';
|
||||||
|
// import { parseTime } from '../../mixins/code-filter';
|
||||||
|
import SmallTitle from './SmallTitle';
|
||||||
|
export default {
|
||||||
|
components: { SmallTitle },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
tableProps,
|
||||||
|
tableData:[],
|
||||||
|
listQuery: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize:100,
|
||||||
|
},
|
||||||
|
addOrUpdateVisible: false,
|
||||||
|
dataForm: {
|
||||||
|
equipmentId:undefined,
|
||||||
|
equipmentName: undefined,
|
||||||
|
lineId: undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(data) {
|
||||||
|
console.log(data.paramMonitors,'data');
|
||||||
|
|
||||||
|
this.dataForm.equipmentId = data.equipmentId || '';
|
||||||
|
this.dataForm.equipmentName = data.equipmentName || '';
|
||||||
|
this.dataForm.lineId = data.lineId || '';
|
||||||
|
|
||||||
|
|
||||||
|
this.visible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// this.$refs['dataForm'].resetFields();
|
||||||
|
// getParamMonitor({
|
||||||
|
// equipmentId:this.dataForm.equipmentId
|
||||||
|
// }).then((res) => {
|
||||||
|
this.tableData = data.paramMonitors
|
||||||
|
// })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.drawer >>> .el-drawer {
|
||||||
|
border-radius: 8px 0 0 8px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer >>> .el-form-item__label {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer >>> .el-drawer__header {
|
||||||
|
margin: 0;
|
||||||
|
padding: 32px 32px 24px;
|
||||||
|
border-bottom: 1px solid #dcdfe6;
|
||||||
|
}
|
||||||
|
.drawer >>> .el-drawer__body {
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer >>> .content {
|
||||||
|
padding: 30px 24px;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
/* height: 100%; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer >>> .visual-part {
|
||||||
|
flex: 1 auto;
|
||||||
|
max-height: 76vh;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-y: scroll;
|
||||||
|
padding-right: 10px; /* 调整滚动条样式 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer >>> .el-form,
|
||||||
|
.drawer >>> .attr-list {
|
||||||
|
padding: 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer-body__footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding: 18px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
561
src/views/equipment/equipmentOverview/alarm-or-updata.vue
Normal file
561
src/views/equipment/equipmentOverview/alarm-or-updata.vue
Normal file
@@ -0,0 +1,561 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :visible.sync="visible" width="80%" @close="handleClose" title-class="dialog-title">
|
||||||
|
<small-title slot="title" :no-padding="true">
|
||||||
|
{{ dataForm.lineId + '·' + dataForm.equipmentName }}
|
||||||
|
</small-title>
|
||||||
|
<search-bar removeBlue :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||||
|
<el-tabs class="custom-tabs" v-model="activeLabel" :stretch="true" @tab-click="handleTabClick">
|
||||||
|
<el-tab-pane :label="'\u3000报警时长\u3000'" name="duration"></el-tab-pane>
|
||||||
|
<el-tab-pane :label="'\u3000报警次数\u3000'" name="times"></el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<div class="content">
|
||||||
|
<div class="visual-part">
|
||||||
|
<div v-if="hasData" style="display: flex; justify-content: space-around; gap: 20px; padding: 10px 0;">
|
||||||
|
<!-- 移除 v-if,始终渲染两个图表容器 -->
|
||||||
|
<div id="barChart" style="width: 48%; height: 400px;"></div>
|
||||||
|
<div id="pieChart" style="width: 48%; height: 400px;"></div>
|
||||||
|
</div>
|
||||||
|
<div v-if="!hasData" class="no-data">
|
||||||
|
<el-empty description="暂无相关报警数据"></el-empty>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getAlarmDet } from '@/api/base/equipment';
|
||||||
|
import * as echarts from 'echarts';
|
||||||
|
import SmallTitle from './SmallTitle';
|
||||||
|
|
||||||
|
const CHART_CONFIG = {
|
||||||
|
barColor: '#288AFF',
|
||||||
|
pieColors: [
|
||||||
|
'#288AFF', '#4096FF', '#69B1FF', '#91CFFF', '#B8E0FF',
|
||||||
|
'#E0F2FF', '#1890FF', '#096DD9', '#0050B3', '#003A8C'
|
||||||
|
],
|
||||||
|
fontColor: '#333',
|
||||||
|
lightFontColor: '#666',
|
||||||
|
borderRadius: 4
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { SmallTitle },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
hasData: false,
|
||||||
|
listQuery: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 100,
|
||||||
|
equipmentId: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined
|
||||||
|
},
|
||||||
|
formConfig: [
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间段',
|
||||||
|
dateType: 'daterange',
|
||||||
|
format: 'yyyy-MM-dd',
|
||||||
|
valueFormat: 'timestamp',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeVal',
|
||||||
|
defaultTime: ['00:00:00', '23:59:59'],
|
||||||
|
defaultSelect: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
activeLabel: 'duration', // 默认选中「报警时长」
|
||||||
|
dataForm: {
|
||||||
|
equipmentId: undefined,
|
||||||
|
equipmentName: undefined,
|
||||||
|
lineId: undefined
|
||||||
|
},
|
||||||
|
chartInstances: {
|
||||||
|
bar: null,
|
||||||
|
pie: null
|
||||||
|
},
|
||||||
|
isDomReady: false,
|
||||||
|
originData: null // 存储原始数据
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.isDomReady = true;
|
||||||
|
if (this.listQuery.equipmentId) {
|
||||||
|
this.getDataList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// Tab 切换时自动刷新图表(无需额外操作,依赖 handleTabClick 触发查询)
|
||||||
|
activeLabel() {
|
||||||
|
if (this.isDomReady && this.originData) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.renderBothCharts(); // 切换 Tab 后重新渲染两个图表
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initDefaultDate() {
|
||||||
|
const today = new Date();
|
||||||
|
const start = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0, 0).getTime();
|
||||||
|
const end = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 0).getTime();
|
||||||
|
|
||||||
|
this.formConfig[0].defaultSelect = [start, end];
|
||||||
|
this.listQuery.startTime = start;
|
||||||
|
this.listQuery.endTime = end;
|
||||||
|
|
||||||
|
if (this.$refs.searchBarForm) {
|
||||||
|
this.$refs.searchBarForm.form.timeVal = [start, end];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleTabClick() {
|
||||||
|
// 切换 Tab 时重新查询数据(或直接复用已有数据渲染)
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
|
||||||
|
buttonClick(val) {
|
||||||
|
switch (val.btnName) {
|
||||||
|
case 'search':
|
||||||
|
this.listQuery.startTime = val.timeVal?.[0];
|
||||||
|
this.listQuery.endTime = val.timeVal?.[1];
|
||||||
|
this.getDataList();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async getDataList() {
|
||||||
|
try {
|
||||||
|
if (!this.listQuery.equipmentId) {
|
||||||
|
console.warn('设备ID不能为空');
|
||||||
|
this.hasData = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const queryParams = {
|
||||||
|
equipmentId: this.listQuery.equipmentId,
|
||||||
|
startTime: this.listQuery.startTime,
|
||||||
|
endTime: this.listQuery.endTime,
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await getAlarmDet(queryParams);
|
||||||
|
const originData = res.data || [];
|
||||||
|
this.originData = originData;
|
||||||
|
this.hasData = originData.length > 0;
|
||||||
|
|
||||||
|
if (this.hasData && this.isDomReady) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.renderBothCharts(); // 数据查询成功后,同时渲染两个图表
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.destroyAllCharts();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取报警数据失败:', error);
|
||||||
|
this.hasData = false;
|
||||||
|
this.destroyAllCharts();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 核心方法:同时渲染柱状图和饼图(根据当前 Tab 类型)
|
||||||
|
renderBothCharts() {
|
||||||
|
if (this.activeLabel === 'duration') {
|
||||||
|
// 报警时长:柱状图(时长排序)+ 饼图(时长占比)
|
||||||
|
this.renderBarChart('duration');
|
||||||
|
this.renderPieChart('duration');
|
||||||
|
} else {
|
||||||
|
// 报警次数:柱状图(次数排序)+ 饼图(次数占比)
|
||||||
|
this.renderBarChart('times');
|
||||||
|
this.renderPieChart('times');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 渲染柱状图(支持两种数据类型)
|
||||||
|
renderBarChart(type) {
|
||||||
|
this.destroyChart('bar');
|
||||||
|
const chartDom = document.getElementById('barChart');
|
||||||
|
if (!chartDom || !this.originData.length) return;
|
||||||
|
|
||||||
|
// 根据类型排序和提取数据
|
||||||
|
let sortedData, xData, seriesData, yAxisName;
|
||||||
|
if (type === 'duration') {
|
||||||
|
// 报警时长:按时长降序
|
||||||
|
sortedData = [...this.originData].sort((a, b) => b.alarmDuration - a.alarmDuration);
|
||||||
|
seriesData = sortedData.map(item => item.alarmDuration);
|
||||||
|
yAxisName = '报警时长';
|
||||||
|
} else {
|
||||||
|
// 报警次数:按次数降序
|
||||||
|
sortedData = [...this.originData].sort((a, b) => b.alarmCount - a.alarmCount);
|
||||||
|
seriesData = sortedData.map(item => item.alarmCount);
|
||||||
|
yAxisName = '报警次数';
|
||||||
|
}
|
||||||
|
|
||||||
|
xData = sortedData.map(item => this.truncateText(item.alarmContent, 8));
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.chartInstances.bar = echarts.init(chartDom);
|
||||||
|
const option = {
|
||||||
|
title: {
|
||||||
|
text: `${yAxisName}统计(柱状图)`,
|
||||||
|
left: 'center',
|
||||||
|
textStyle: { fontSize: 14, color: CHART_CONFIG.fontColor }
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: { type: 'shadow' },
|
||||||
|
padding: 10,
|
||||||
|
textStyle: { fontSize: 11 },
|
||||||
|
formatter: (params) => {
|
||||||
|
const index = params[0].dataIndex;
|
||||||
|
const item = sortedData[index];
|
||||||
|
return `
|
||||||
|
<div style="text-align: left;">
|
||||||
|
<div>${item.alarmContent}</div>
|
||||||
|
<div>${yAxisName}:${type === 'duration' ? item.alarmDuration : item.alarmCount}</div>
|
||||||
|
<div>占比:${type === 'duration' ? item.alarmDurationRatio.toFixed(2) : item.alarmCountRatio.toFixed(2)}%</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '5%',
|
||||||
|
right: '5%',
|
||||||
|
bottom: '18%',
|
||||||
|
top: '15%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
xAxis: [
|
||||||
|
{
|
||||||
|
type: 'category',
|
||||||
|
data: xData,
|
||||||
|
axisTick: { alignWithLabel: true },
|
||||||
|
axisLabel: {
|
||||||
|
interval: 0,
|
||||||
|
fontSize: 12,
|
||||||
|
color: CHART_CONFIG.lightFontColor
|
||||||
|
},
|
||||||
|
axisLine: { lineStyle: { color: '#e8e8e8' } }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value',
|
||||||
|
name: yAxisName,
|
||||||
|
nameTextStyle: { fontSize: 11, color: CHART_CONFIG.lightFontColor },
|
||||||
|
axisLabel: {
|
||||||
|
fontSize: 11,
|
||||||
|
color: CHART_CONFIG.lightFontColor,
|
||||||
|
},
|
||||||
|
axisLine: { lineStyle: { color: '#e8e8e8' } },
|
||||||
|
splitLine: { lineStyle: { color: '#f5f5f5' } },
|
||||||
|
max: (value) => value.max * 1.2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: yAxisName,
|
||||||
|
type: 'bar',
|
||||||
|
itemStyle: {
|
||||||
|
color: CHART_CONFIG.barColor,
|
||||||
|
borderRadius: [CHART_CONFIG.borderRadius, CHART_CONFIG.borderRadius, 0, 0],
|
||||||
|
shadowBlur: 3,
|
||||||
|
shadowColor: 'rgba(40, 138, 255, 0.2)',
|
||||||
|
shadowOffsetY: 2
|
||||||
|
},
|
||||||
|
barWidth: '16',
|
||||||
|
data: seriesData,
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: 'top',
|
||||||
|
distance: 6,
|
||||||
|
fontSize: 11,
|
||||||
|
color: CHART_CONFIG.fontColor,
|
||||||
|
formatter: (params) => `${params.value}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.chartInstances.bar.setOption(option);
|
||||||
|
this.addResizeListener('bar');
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`${yAxisName}柱状图初始化失败:`, error);
|
||||||
|
setTimeout(() => this.renderBarChart(type), 200);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 渲染饼图(支持两种数据类型)
|
||||||
|
renderPieChart(type) {
|
||||||
|
this.destroyChart('pie');
|
||||||
|
const chartDom = document.getElementById('pieChart');
|
||||||
|
if (!chartDom || !this.originData.length) return;
|
||||||
|
|
||||||
|
// 根据类型处理饼图数据
|
||||||
|
let pieData, seriesName;
|
||||||
|
if (type === 'duration') {
|
||||||
|
// 报警时长:按时长占比处理
|
||||||
|
seriesName = '报警时长';
|
||||||
|
pieData = this.handlePieData(this.originData, 'alarmDuration', 'alarmDurationRatio');
|
||||||
|
} else {
|
||||||
|
// 报警次数:按次数占比处理
|
||||||
|
seriesName = '报警次数';
|
||||||
|
pieData = this.handlePieData(this.originData, 'alarmCount', 'alarmCountRatio');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.chartInstances.pie = echarts.init(chartDom);
|
||||||
|
const option = {
|
||||||
|
title: {
|
||||||
|
text: `${seriesName}统计(饼图)`,
|
||||||
|
left: 'center',
|
||||||
|
textStyle: { fontSize: 14, color: CHART_CONFIG.fontColor }
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item',
|
||||||
|
padding: 10,
|
||||||
|
textStyle: { fontSize: 11 },
|
||||||
|
formatter: (params) => {
|
||||||
|
return `
|
||||||
|
<div style="text-align: left;">
|
||||||
|
<div>${params.name}</div>
|
||||||
|
<div>${seriesName}:${params.value}${type === 'duration' ? '' : '次'}</div>
|
||||||
|
<div>占比:${params.percent.toFixed(2)}%</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: seriesName,
|
||||||
|
type: 'pie',
|
||||||
|
radius: ['50%', '70%'],
|
||||||
|
center: ['50%', '55%'],
|
||||||
|
color: CHART_CONFIG.pieColors,
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: 'outside',
|
||||||
|
distance: 15,
|
||||||
|
fontSize: 11,
|
||||||
|
color: CHART_CONFIG.lightFontColor,
|
||||||
|
formatter: (params) => {
|
||||||
|
const truncatedName = this.truncateText(params.name, 8);
|
||||||
|
return `${truncatedName}(${params.value}${type === 'duration' ? '' : '次'}, ${params.percent.toFixed(1)}%)`;
|
||||||
|
},
|
||||||
|
align: 'center',
|
||||||
|
baseline: 'middle'
|
||||||
|
},
|
||||||
|
labelLine: {
|
||||||
|
show: true,
|
||||||
|
length: 15,
|
||||||
|
length2: 20,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#ccc',
|
||||||
|
width: 1,
|
||||||
|
type: 'solid'
|
||||||
|
},
|
||||||
|
smooth: 0.2
|
||||||
|
},
|
||||||
|
data: pieData,
|
||||||
|
emphasis: {
|
||||||
|
itemStyle: {
|
||||||
|
shadowBlur: 10,
|
||||||
|
shadowColor: 'rgba(0, 0, 0, 0.1)'
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
color: CHART_CONFIG.fontColor,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: 500
|
||||||
|
},
|
||||||
|
labelLine: {
|
||||||
|
lineStyle: {
|
||||||
|
color: CHART_CONFIG.barColor,
|
||||||
|
width: 1.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.chartInstances.pie.setOption(option);
|
||||||
|
this.addResizeListener('pie');
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`${seriesName}饼图初始化失败:`, error);
|
||||||
|
setTimeout(() => this.renderPieChart(type), 200);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 通用饼图数据处理(支持动态字段)
|
||||||
|
handlePieData(data, valueKey, ratioKey) {
|
||||||
|
const threshold = 5; // 占比低于5%合并为「其他」
|
||||||
|
let otherCount = 0;
|
||||||
|
const mainData = data.filter(item => {
|
||||||
|
if (item[ratioKey] >= threshold) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
otherCount += item[valueKey];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).map(item => ({
|
||||||
|
name: item.alarmContent,
|
||||||
|
value: item[valueKey],
|
||||||
|
ratio: item[ratioKey]
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (otherCount > 0) {
|
||||||
|
mainData.push({
|
||||||
|
name: '其他',
|
||||||
|
value: otherCount,
|
||||||
|
ratio: 100 - mainData.reduce((sum, item) => sum + item.ratio, 0)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return mainData;
|
||||||
|
},
|
||||||
|
|
||||||
|
truncateText(text, maxLength) {
|
||||||
|
if (!text) return '';
|
||||||
|
return text.length > maxLength ? text.slice(0, maxLength) + '...' : text;
|
||||||
|
},
|
||||||
|
|
||||||
|
addResizeListener(type) {
|
||||||
|
const chart = this.chartInstances[type];
|
||||||
|
if (chart) {
|
||||||
|
const resizeHandler = () => chart.resize();
|
||||||
|
window.addEventListener('resize', resizeHandler);
|
||||||
|
chart.resizeHandler = resizeHandler;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
destroyChart(type) {
|
||||||
|
const chart = this.chartInstances[type];
|
||||||
|
if (chart) {
|
||||||
|
window.removeEventListener('resize', chart.resizeHandler);
|
||||||
|
chart.dispose();
|
||||||
|
this.chartInstances[type] = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
destroyAllCharts() {
|
||||||
|
Object.keys(this.chartInstances).forEach(type => {
|
||||||
|
this.destroyChart(type);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleClose() {
|
||||||
|
this.destroyAllCharts();
|
||||||
|
this.formConfig[0].defaultSelect = [];
|
||||||
|
this.listQuery.startTime = undefined;
|
||||||
|
this.listQuery.endTime = undefined;
|
||||||
|
this.originData = null;
|
||||||
|
this.hasData = true;
|
||||||
|
if (this.$refs.searchBarForm) {
|
||||||
|
// this.$refs.searchBarForm.form.timeVal = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
init(data) {
|
||||||
|
this.dataForm = {
|
||||||
|
equipmentId: data.equipmentId || '',
|
||||||
|
equipmentName: data.equipmentName || '',
|
||||||
|
lineId: data.lineId || ''
|
||||||
|
};
|
||||||
|
this.activeLabel = 'duration'
|
||||||
|
this.listQuery.equipmentId = data.equipmentId || undefined;
|
||||||
|
this.visible = true;
|
||||||
|
this.originData = null;
|
||||||
|
this.hasData = false;
|
||||||
|
|
||||||
|
this.initDefaultDate();
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.isDomReady = true;
|
||||||
|
this.getDataList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.destroyAllCharts();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 保持原有样式,优化图表容器布局 */
|
||||||
|
.drawer>>>.el-drawer {
|
||||||
|
border-radius: 8px 0 0 8px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer>>>.el-form-item__label {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer>>>.el-drawer__header {
|
||||||
|
margin: 0;
|
||||||
|
padding: 32px 32px 24px;
|
||||||
|
border-bottom: 1px solid #dcdfe6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer>>>.el-drawer__body {
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer>>>.content {
|
||||||
|
padding: 30px 24px;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer>>>.visual-part {
|
||||||
|
flex: 1 auto;
|
||||||
|
max-height: 76vh;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 优化图表容器响应式布局 */
|
||||||
|
@media (max-width: 1200px) {
|
||||||
|
.visual-part>div {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barChart,
|
||||||
|
#pieChart {
|
||||||
|
width: 100% !important;
|
||||||
|
height: 350px !important;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer>>>.el-form,
|
||||||
|
.drawer>>>.attr-list {
|
||||||
|
padding: 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer-body__footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding: 18px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
328
src/views/equipment/equipmentOverview/chart.js
Normal file
328
src/views/equipment/equipmentOverview/chart.js
Normal file
@@ -0,0 +1,328 @@
|
|||||||
|
import * as echarts from 'echarts'
|
||||||
|
|
||||||
|
function getStartTime(timestamp) {
|
||||||
|
return new Date(new Date(timestamp).toLocaleDateString()).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderItem(params, api) {
|
||||||
|
var categoryIndex = api.value(0);
|
||||||
|
var start = api.coord([api.value(1), categoryIndex]);
|
||||||
|
var end = api.coord([api.value(2), categoryIndex]);
|
||||||
|
|
||||||
|
var height = api.size([0, 1])[1] * 2;
|
||||||
|
var rectShape = echarts.graphic.clipRectByRect(
|
||||||
|
{
|
||||||
|
x: start[0],
|
||||||
|
y: start[1] - height / 2,
|
||||||
|
width: end[0] - start[0],
|
||||||
|
height: height,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
x: params.coordSys.x,
|
||||||
|
y: params.coordSys.y - 16,
|
||||||
|
width: params.coordSys.width,
|
||||||
|
height: params.coordSys.height,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
rectShape && {
|
||||||
|
type: 'rect',
|
||||||
|
transition: ['shape'],
|
||||||
|
shape: rectShape,
|
||||||
|
style: api.style(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// unused
|
||||||
|
function getXaxisRange(startTime) {
|
||||||
|
return Array(24)
|
||||||
|
.fill(startTime)
|
||||||
|
.map((item, index) => {
|
||||||
|
return new Date(item + index * 3600 * 1000)
|
||||||
|
.toLocaleTimeString()
|
||||||
|
.split(':')
|
||||||
|
.slice(0, 2)
|
||||||
|
.join(':');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTodayStart(today) {
|
||||||
|
const [y, m, d] = [
|
||||||
|
today.getFullYear(),
|
||||||
|
today.getMonth(),
|
||||||
|
today.getDate(),
|
||||||
|
];
|
||||||
|
// debugger;
|
||||||
|
return new Date(y, m, d).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** 颜色配置 */
|
||||||
|
const types = [
|
||||||
|
{ name: '运行', color: '#288AFF' },
|
||||||
|
{ name: '故障', color: '#FC9C91' },
|
||||||
|
{ name: '计划停机', color: '#FFDC94' },
|
||||||
|
{ name: '空白', color: '#F2F4F9' },
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
export default class GanttGraph {
|
||||||
|
// tooltip - 基本是固定的
|
||||||
|
tooltip = {
|
||||||
|
trigger: 'item',
|
||||||
|
axisPointer: {
|
||||||
|
type: 'none',
|
||||||
|
},
|
||||||
|
formatter: (params) => {
|
||||||
|
// debugger;
|
||||||
|
return `
|
||||||
|
<div style="display: flex; flex-direction: column;">
|
||||||
|
<span>${new Date(params.value[1]).toLocaleTimeString()} ~ ${new Date(params.value[2]).toLocaleTimeString()}</span>
|
||||||
|
<div style="display: flex; align-items: center; justify-content: space-between;">
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<span class="icon" style="width: 8px; height: 8px; border-radius: 2px; background: ${params.color}"></span>
|
||||||
|
<span class="eq-name" style="margin-left: 4px;">${params.seriesName}</span>
|
||||||
|
</div>
|
||||||
|
<span class="run-status" style="margin-left: 8px; opacity: 0.6">${params.name}</span>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
grid = []
|
||||||
|
xAxis = []
|
||||||
|
yAxis = []
|
||||||
|
series = []
|
||||||
|
|
||||||
|
constructor(el, startTime) {
|
||||||
|
this.el = el;
|
||||||
|
this.gridIndex = -1;
|
||||||
|
this.currentGraphIndex = -2;
|
||||||
|
this.startTime = new Date(startTime);
|
||||||
|
// this.startTime = new Date(new Date('2023/10/8').toLocaleDateString());
|
||||||
|
// console.log('<> Gantt Created', this.startTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造一个新的 grid
|
||||||
|
makeGrid() {
|
||||||
|
this.gridIndex++;
|
||||||
|
return {
|
||||||
|
id: 'GRID_' + this.gridIndex,
|
||||||
|
// top: 12 + 128 * this.gridIndex,
|
||||||
|
top: 12 + 104 * this.gridIndex,
|
||||||
|
right: 48,
|
||||||
|
left: 100,
|
||||||
|
height: 56
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造一个 xAxis
|
||||||
|
makeXaxis() {
|
||||||
|
const [id1, id2] = ['' + Math.random(), '' + Math.random()]
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: id1,
|
||||||
|
gridIndex: this.gridIndex,
|
||||||
|
axisTick: {
|
||||||
|
alignWithLabel: true,
|
||||||
|
inside: true,
|
||||||
|
},
|
||||||
|
type: 'time',
|
||||||
|
min: getTodayStart(this.startTime),
|
||||||
|
max: getStartTime(this.startTime.getTime() + 3600 * 24 * 1000),
|
||||||
|
splitNumber: 10,
|
||||||
|
axisLabel: {
|
||||||
|
margin: 12,
|
||||||
|
formatter: function (val) {
|
||||||
|
return new Date(val)
|
||||||
|
.toLocaleTimeString()
|
||||||
|
.split(':')
|
||||||
|
.slice(0, 2)
|
||||||
|
.join(':');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
axisLine: {
|
||||||
|
lineStyle: {
|
||||||
|
color: '#0005',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
boundaryGap: false,
|
||||||
|
// data: getXaxisRange(getTodayStart(new Date())),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: id2,
|
||||||
|
gridIndex: this.gridIndex,
|
||||||
|
axisLabel: { show: false },
|
||||||
|
axisLine: { show: false },
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 构造一个 yAxis
|
||||||
|
makeYaxis(equipmentName) {
|
||||||
|
const [id1, id2] = ['' + Math.random(), '' + Math.random()]
|
||||||
|
return [
|
||||||
|
// 主y轴
|
||||||
|
{
|
||||||
|
id: id1,
|
||||||
|
gridIndex: this.gridIndex,
|
||||||
|
type: 'value',
|
||||||
|
splitLine: { show: false },
|
||||||
|
name: equipmentName,
|
||||||
|
nameLocation: 'center',
|
||||||
|
nameGap: 14,
|
||||||
|
nameRotate: 0,
|
||||||
|
nameTextStyle: {
|
||||||
|
fontSize: 12,
|
||||||
|
color: '#000A'
|
||||||
|
},
|
||||||
|
axisLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#0005',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
axisLabel: { show: false },
|
||||||
|
axisTick: { show: false },
|
||||||
|
},
|
||||||
|
// 辅y轴
|
||||||
|
{
|
||||||
|
id: id2,
|
||||||
|
gridIndex: this.gridIndex,
|
||||||
|
type: 'value',
|
||||||
|
splitLine: { show: false },
|
||||||
|
axisLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#0005',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
axisLabel: { show: false },
|
||||||
|
axisTick: { show: false },
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造一个 series
|
||||||
|
makeSeries({ equipmentName, arr }) {
|
||||||
|
this.currentGraphIndex += 2;
|
||||||
|
const bgStartTime = this.startTime.getTime();
|
||||||
|
const bgEndTime = bgStartTime + 3600 * 24 * 1000;
|
||||||
|
return [
|
||||||
|
// 沉默的背景
|
||||||
|
{
|
||||||
|
xAxisIndex: this.currentGraphIndex,
|
||||||
|
yAxisIndex: this.currentGraphIndex,
|
||||||
|
type: 'custom',
|
||||||
|
renderItem: renderItem,
|
||||||
|
silent: true,
|
||||||
|
itemStyle: {
|
||||||
|
opacity: 0.8,
|
||||||
|
},
|
||||||
|
encode: {
|
||||||
|
x: [1, 2],
|
||||||
|
y: 0,
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
name: '无数据',
|
||||||
|
value: [0, bgStartTime, bgEndTime, 0],
|
||||||
|
tooltip: { show: false },
|
||||||
|
itemStyle: {
|
||||||
|
color: '#F2F4F9',
|
||||||
|
opacity: 0.3,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: equipmentName,
|
||||||
|
xAxisIndex: this.currentGraphIndex,
|
||||||
|
yAxisIndex: this.currentGraphIndex,
|
||||||
|
type: 'custom',
|
||||||
|
renderItem: renderItem,
|
||||||
|
itemStyle: {
|
||||||
|
opacity: 0.8,
|
||||||
|
},
|
||||||
|
encode: {
|
||||||
|
x: [1, 2],
|
||||||
|
y: 0,
|
||||||
|
},
|
||||||
|
data: arr.map(item => ({
|
||||||
|
name: ['运行', '故障', '计划停机'][item.status],
|
||||||
|
value: [0, item.startTime, item.startTime + item.duration * 60 * 1000, 0],
|
||||||
|
itemStyle: {
|
||||||
|
color: types[item.status].color,
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
init(data) {
|
||||||
|
if (!this.el) throw new Error('没有可供echarts初始化的容器')
|
||||||
|
if (typeof this.el == 'string') {
|
||||||
|
this.el = document.querySelector(this.el);
|
||||||
|
}
|
||||||
|
this.chart = echarts.init(this.el);
|
||||||
|
this.handleProps(data);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// debugger;
|
||||||
|
this.chart.setOption(this.option);
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(data) {
|
||||||
|
this.clear();
|
||||||
|
this.init(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
resize() {
|
||||||
|
this.chart.resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
get option() {
|
||||||
|
return {
|
||||||
|
tooltip: this.tooltip,
|
||||||
|
grid: this.grid,
|
||||||
|
xAxis: this.xAxis,
|
||||||
|
yAxis: this.yAxis,
|
||||||
|
series: this.series,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 每次 graphList 刷新都会重新渲染整个所有图表
|
||||||
|
// 可以改进的地方:添加一个 handleAdd() 方法,一次添加一个新的
|
||||||
|
handleProps(props) {
|
||||||
|
// props 是父组件的 graphList
|
||||||
|
console.log('props: ', props);
|
||||||
|
props.forEach(eqArr => {
|
||||||
|
this.grid.push(this.makeGrid());
|
||||||
|
this.xAxis.push(...this.makeXaxis());
|
||||||
|
this.yAxis.push(...this.makeYaxis(eqArr.key));
|
||||||
|
this.series.push(...this.makeSeries({ equipmentName: eqArr.key, arr: eqArr }))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// handleAdd
|
||||||
|
handleAdd() { }
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
this.grid = [];
|
||||||
|
this.xAxis = [];
|
||||||
|
this.yAxis = [];
|
||||||
|
this.series = [];
|
||||||
|
this.currentGraphIndex = -2;
|
||||||
|
this.gridIndex = -1;
|
||||||
|
this.chart.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
// print option
|
||||||
|
print() {
|
||||||
|
console.log(JSON.stringify(this.option, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
367
src/views/equipment/equipmentOverview/gantt.js
Normal file
367
src/views/equipment/equipmentOverview/gantt.js
Normal file
@@ -0,0 +1,367 @@
|
|||||||
|
import * as echarts from 'echarts'
|
||||||
|
|
||||||
|
function getStartTime(timestamp) {
|
||||||
|
return new Date(new Date(timestamp).toLocaleDateString()).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderItem(params, api) {
|
||||||
|
// 1. 校验value数据是否有效
|
||||||
|
const yIndex = api.value(0); // y轴索引
|
||||||
|
const startTime = api.value(1);
|
||||||
|
const endTime = api.value(2);
|
||||||
|
if (isNaN(startTime) || isNaN(endTime) || startTime >= endTime) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 转换坐标(x轴是time类型,需确保转换正确)
|
||||||
|
const startPoint = api.coord([startTime, yIndex]);
|
||||||
|
const endPoint = api.coord([endTime, yIndex]);
|
||||||
|
if (!startPoint || !endPoint) return null;
|
||||||
|
|
||||||
|
// 3. 计算矩形高度(加大高度,避免高度为0)
|
||||||
|
const cellHeight = api.size([0, 1])[1] * 0.8; // 从0.5改为0.8,提高可视性
|
||||||
|
const rectX = startPoint[0];
|
||||||
|
const rectY = startPoint[1] - cellHeight / 2;
|
||||||
|
const rectWidth = endPoint[0] - startPoint[0];
|
||||||
|
|
||||||
|
// 4. 避免宽度为负/0
|
||||||
|
if (rectWidth <= 0) return null;
|
||||||
|
|
||||||
|
// 5. 裁剪矩形(简化裁剪逻辑,避免过度裁剪)
|
||||||
|
const rectShape = echarts.graphic.clipRectByRect(
|
||||||
|
{
|
||||||
|
x: rectX,
|
||||||
|
y: rectY,
|
||||||
|
width: rectWidth,
|
||||||
|
height: cellHeight,
|
||||||
|
},
|
||||||
|
params.coordSys // 直接用坐标系范围,简化裁剪
|
||||||
|
);
|
||||||
|
|
||||||
|
return rectShape ? {
|
||||||
|
type: 'rect',
|
||||||
|
transition: ['shape'],
|
||||||
|
shape: rectShape,
|
||||||
|
style: api.style(),
|
||||||
|
} : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// unused
|
||||||
|
function getXaxisRange(startTime) {
|
||||||
|
return Array(24)
|
||||||
|
.fill(startTime)
|
||||||
|
.map((item, index) => {
|
||||||
|
return new Date(item + index * 3600 * 1000)
|
||||||
|
.toLocaleTimeString()
|
||||||
|
.split(':')
|
||||||
|
.slice(0, 2)
|
||||||
|
.join(':');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTodayStart(today) {
|
||||||
|
const [y, m, d] = [
|
||||||
|
today.getFullYear(),
|
||||||
|
today.getMonth(),
|
||||||
|
today.getDate(),
|
||||||
|
];
|
||||||
|
// debugger;
|
||||||
|
return new Date(y, m, d).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** 颜色配置 */
|
||||||
|
const types = [
|
||||||
|
{ name: '运行', color: '#288AFF' },
|
||||||
|
{ name: '计划停机', color: '#FFDC94' },
|
||||||
|
{ name: '故障', color: '#FC9C91' },
|
||||||
|
{ name: '空白', color: '#F2F4F9' },
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
export default class GanttGraph {
|
||||||
|
// tooltip - 基本是固定的
|
||||||
|
tooltip = {
|
||||||
|
trigger: 'item',
|
||||||
|
axisPointer: {
|
||||||
|
type: 'none',
|
||||||
|
},
|
||||||
|
formatter: (params) => {
|
||||||
|
// debugger;
|
||||||
|
const date1 = new Date(params.value[1]);
|
||||||
|
const date2 = new Date(params.value[2]);
|
||||||
|
return `
|
||||||
|
<div style="display: flex; flex-direction: column;">
|
||||||
|
<span>${date1.getMonth() + 1}-${date1.getDate()} ${String(date1.getHours()).padStart(2, '0')}:${String(date1.getMinutes()).padStart(2, '0')} ~ ${date2.getMonth() + 1}-${date2.getDate()} ${String(date2.getHours()).padStart(2, '0')}:${String(date2.getMinutes()).padStart(2, '0')}</span>
|
||||||
|
<div style="display: flex; align-items: center; justify-content: space-between;">
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<span class="icon" style="width: 8px; height: 8px; border-radius: 2px; background: ${params.color}"></span>
|
||||||
|
<span class="eq-name" style="margin-left: 4px;">${params.data.showName}</span>
|
||||||
|
</div>
|
||||||
|
<span class="run-status" style="margin-left: 8px; opacity: 0.6">${params.name}</span>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
grid = []
|
||||||
|
xAxis = []
|
||||||
|
yAxis = []
|
||||||
|
series = []
|
||||||
|
|
||||||
|
constructor(el, startTime) {
|
||||||
|
this.el = el;
|
||||||
|
this.startTime = new Date(startTime);
|
||||||
|
}
|
||||||
|
// 构造一个新的 grid
|
||||||
|
makeGrid() {
|
||||||
|
return {
|
||||||
|
top: 5,
|
||||||
|
right: 20,
|
||||||
|
left: 100,
|
||||||
|
bottom: 50,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造一个 xAxis
|
||||||
|
// 新增:从数据中提取时间范围的方法
|
||||||
|
getXaxisRangeFromData(data) {
|
||||||
|
let allTimes = [];
|
||||||
|
data.forEach(eqArr => {
|
||||||
|
eqArr.forEach(item => {
|
||||||
|
if (item.startTime) {
|
||||||
|
allTimes.push(item.startTime);
|
||||||
|
allTimes.push(item.startTime + (item.duration || 0) * 60 * 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (allTimes.length === 0) {
|
||||||
|
const today = new Date();
|
||||||
|
return [getTodayStart(today), getTodayStart(today) + 24 * 3600 * 1000];
|
||||||
|
}
|
||||||
|
const minTime = Math.min(...allTimes);
|
||||||
|
const maxTime = Math.max(...allTimes);
|
||||||
|
// 扩展1小时的缓冲
|
||||||
|
return [minTime - 3600 * 1000, maxTime + 3600 * 1000];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改makeXaxis方法,支持传入数据动态计算范围
|
||||||
|
makeXaxis(data = []) {
|
||||||
|
let [minTime, maxTime] = this.getXaxisRangeFromData(data);
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
axisTick: {
|
||||||
|
alignWithLabel: true,
|
||||||
|
inside: true,
|
||||||
|
},
|
||||||
|
type: 'time',
|
||||||
|
min: minTime,
|
||||||
|
max: maxTime,
|
||||||
|
splitNumber: 24,
|
||||||
|
axisLabel: {
|
||||||
|
margin: 12,
|
||||||
|
formatter: function (val) {
|
||||||
|
return new Date(val).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
axisLine: {
|
||||||
|
lineStyle: {
|
||||||
|
color: '#0005',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
boundaryGap: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 构造一个 yAxis
|
||||||
|
makeYaxis(equipmentName) {
|
||||||
|
return [
|
||||||
|
// 主y轴
|
||||||
|
{
|
||||||
|
data: equipmentName,
|
||||||
|
type: 'category'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造一个 series
|
||||||
|
makeSeries(xdata) {
|
||||||
|
const bgStartTime = this.startTime.getTime();
|
||||||
|
const bgEndTime = bgStartTime + 3600 * 24 * 1000;
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
type: 'custom',
|
||||||
|
renderItem: renderItem,
|
||||||
|
itemStyle: {
|
||||||
|
opacity: 0.8,
|
||||||
|
},
|
||||||
|
encode: {
|
||||||
|
x: [1, 2],
|
||||||
|
y: 0,
|
||||||
|
},
|
||||||
|
data: xdata,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
init(data) {
|
||||||
|
if (!this.el) throw new Error('没有可供echarts初始化的容器');
|
||||||
|
if (typeof this.el == 'string') {
|
||||||
|
this.el = document.querySelector(this.el);
|
||||||
|
}
|
||||||
|
this.chart = echarts.init(this.el);
|
||||||
|
this.handleProps(data);
|
||||||
|
|
||||||
|
// 调试:打印关键数据
|
||||||
|
console.log('=== 调试信息 ===');
|
||||||
|
console.log('x轴范围', this.xAxis[0]?.min, '~', this.xAxis[0]?.max);
|
||||||
|
console.log('y轴数据', this.yAxis[0]?.data);
|
||||||
|
console.log('series数据', this.series[0]?.data);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.chart.setOption(this.option);
|
||||||
|
// 强制渲染
|
||||||
|
this.chart.resize();
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(data) {
|
||||||
|
this.clear();
|
||||||
|
this.init(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
resize() {
|
||||||
|
this.chart.resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
get option() {
|
||||||
|
return {
|
||||||
|
tooltip: this.tooltip,
|
||||||
|
grid: this.grid,
|
||||||
|
xAxis: this.xAxis,
|
||||||
|
yAxis: this.yAxis,
|
||||||
|
series: this.series,
|
||||||
|
dataZoom: [
|
||||||
|
{
|
||||||
|
type: 'slider',
|
||||||
|
xAxisIndex: 0,
|
||||||
|
filterMode: 'weakFilter',
|
||||||
|
height: 20,
|
||||||
|
bottom: 0,
|
||||||
|
start: 0,
|
||||||
|
end: 80,
|
||||||
|
handleIcon:
|
||||||
|
'path://M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
|
||||||
|
handleSize: '80%',
|
||||||
|
showDetail: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'inside',
|
||||||
|
id: 'insideX',
|
||||||
|
xAxisIndex: 0,
|
||||||
|
filterMode: 'weakFilter',
|
||||||
|
start: 0,
|
||||||
|
end: 80,
|
||||||
|
zoomOnMouseWheel: true,
|
||||||
|
moveOnMouseMove: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'slider',
|
||||||
|
yAxisIndex: 0,
|
||||||
|
zoomLock: true,
|
||||||
|
width: 10,
|
||||||
|
right: 10,
|
||||||
|
top: 70,
|
||||||
|
bottom: 20,
|
||||||
|
start: 0,
|
||||||
|
end: 100,
|
||||||
|
handleSize: 0,
|
||||||
|
showDetail: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'inside',
|
||||||
|
id: 'insideY',
|
||||||
|
yAxisIndex: 0,
|
||||||
|
start: 0,
|
||||||
|
end: 100,
|
||||||
|
zoomOnMouseWheel: true,
|
||||||
|
moveOnMouseMove: true,
|
||||||
|
moveOnMouseWheel: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 每次 graphList 刷新都会重新渲染整个所有图表
|
||||||
|
// 可以改进的地方:添加一个 handleAdd() 方法,一次添加一个新的
|
||||||
|
handleProps(props) {
|
||||||
|
console.log('props: ', props);
|
||||||
|
let ylist = []
|
||||||
|
let xdata = []
|
||||||
|
|
||||||
|
// 第一步:提前获取x轴的实际min/max(从xAxis配置中取,而非重新计算)
|
||||||
|
const xAxisConfig = this.makeXaxis(props)[0];
|
||||||
|
const xMin = xAxisConfig.min;
|
||||||
|
const xMax = xAxisConfig.max;
|
||||||
|
|
||||||
|
props.forEach((eqArr, index) => {
|
||||||
|
if (!eqArr.key) return;
|
||||||
|
ylist.push(eqArr.key)
|
||||||
|
|
||||||
|
eqArr.forEach(item => {
|
||||||
|
if (!item.startTime || !item.duration || item.status === undefined) {
|
||||||
|
console.warn('数据缺失', item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const status = Math.max(0, Math.min(3, item.status));
|
||||||
|
const endTime = item.startTime + item.duration * 60 * 1000;
|
||||||
|
|
||||||
|
// 第二步:修正时间校验逻辑(只要数据和x轴范围有交集,就保留)
|
||||||
|
// 原逻辑:数据完全在x轴外才过滤 → 改为:数据和x轴无交集才过滤
|
||||||
|
const isOutOfRange = endTime < xMin || item.startTime > xMax;
|
||||||
|
if (isOutOfRange) {
|
||||||
|
console.warn('数据超出x轴范围', {
|
||||||
|
startTime: new Date(item.startTime).toLocaleString(),
|
||||||
|
endTime: new Date(endTime).toLocaleString(),
|
||||||
|
xMin: new Date(xMin).toLocaleString(),
|
||||||
|
xMax: new Date(xMax).toLocaleString()
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
xdata.push({
|
||||||
|
name: types[status].name,
|
||||||
|
showName: eqArr.key,
|
||||||
|
value: [index, item.startTime, endTime],
|
||||||
|
itemStyle: {
|
||||||
|
color: types[status].color,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.grid.push(this.makeGrid());
|
||||||
|
this.xAxis.push(...this.makeXaxis(props)); // 传入props
|
||||||
|
this.yAxis.push(...this.makeYaxis(ylist));
|
||||||
|
this.series.push(...this.makeSeries(xdata));
|
||||||
|
}
|
||||||
|
|
||||||
|
// handleAdd
|
||||||
|
handleAdd() { }
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
this.grid = [];
|
||||||
|
this.xAxis = [];
|
||||||
|
this.yAxis = [];
|
||||||
|
this.series = [];
|
||||||
|
this.chart.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
// print option
|
||||||
|
print() {
|
||||||
|
console.log(JSON.stringify(this.option, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
1309
src/views/equipment/equipmentOverview/index-eq.vue
Normal file
1309
src/views/equipment/equipmentOverview/index-eq.vue
Normal file
File diff suppressed because it is too large
Load Diff
487
src/views/equipment/equipmentOverview/index-his.vue
Normal file
487
src/views/equipment/equipmentOverview/index-his.vue
Normal file
@@ -0,0 +1,487 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2026-04-21 10:22:15
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2026-04-24 10:35:32
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="status-timegraph-container"
|
||||||
|
style="flex: 1; display: flex; flex-direction: column">
|
||||||
|
<el-row
|
||||||
|
class=""
|
||||||
|
style="
|
||||||
|
margin-bottom: 12px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 16px 16px 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
">
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
ref="searchBarForm"
|
||||||
|
:model="formInline"
|
||||||
|
class="searchBar">
|
||||||
|
<span class="blue-block"></span>
|
||||||
|
<el-form-item label="产线/工段">
|
||||||
|
<el-cascader
|
||||||
|
size="small"
|
||||||
|
:options="options"
|
||||||
|
ref="cascaderRef"
|
||||||
|
collapse-tags
|
||||||
|
@change="handleCascaderChange"
|
||||||
|
:props="{
|
||||||
|
value: 'id',
|
||||||
|
label: 'name',
|
||||||
|
checkStrictly: true,
|
||||||
|
multiple: true,
|
||||||
|
emitPath: false,
|
||||||
|
}"></el-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="时间范围" prop="recordTime">
|
||||||
|
<el-date-picker
|
||||||
|
size="small"
|
||||||
|
v-model="formInline.recordTime"
|
||||||
|
type="daterange"
|
||||||
|
format="yyyy-MM-dd"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始时间"
|
||||||
|
end-placeholder="结束时间"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button size="small" type="primary" @click="handleRecordSearch">
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row
|
||||||
|
class=""
|
||||||
|
style="
|
||||||
|
height: 1px;
|
||||||
|
flex: 1;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 16px 16px 32px;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
">
|
||||||
|
<el-row :gutter="20" style="margin-bottom: 10px">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="blue-title">关键设备运行率</div>
|
||||||
|
<line-chart
|
||||||
|
v-if="lineChartData.length"
|
||||||
|
ref="lineChart"
|
||||||
|
:chartData="lineChartData"></line-chart>
|
||||||
|
<h2 v-else class="no-data-bg"></h2>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="blue-title">今日停机/故障汇总</div>
|
||||||
|
<base-table
|
||||||
|
:page="1"
|
||||||
|
:limit="100"
|
||||||
|
:table-props="tableProps"
|
||||||
|
:table-data="tableData"
|
||||||
|
:height="300"></base-table>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-divider></el-divider>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="6">
|
||||||
|
<div class="blue-title">设备状态甘特图</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="18" class="legend-row">
|
||||||
|
<div class="legend">
|
||||||
|
<div class="icon running"></div>
|
||||||
|
<div>运行中</div>
|
||||||
|
</div>
|
||||||
|
<div class="legend">
|
||||||
|
<div class="icon fault"></div>
|
||||||
|
<div>故障</div>
|
||||||
|
</div>
|
||||||
|
<div class="legend">
|
||||||
|
<div class="icon stop"></div>
|
||||||
|
<div>计划停机</div>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<div
|
||||||
|
class="main-area"
|
||||||
|
style="flex: 1; display: flex; flex-direction: column">
|
||||||
|
<div
|
||||||
|
class="graphs"
|
||||||
|
v-show="graphList.length"
|
||||||
|
id="status-chart"
|
||||||
|
style="min-height: 400px; flex: 1"></div>
|
||||||
|
<h2 v-if="!graphList || graphList.length == 0" class="no-data-bg"></h2>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Gantt from './gantt';
|
||||||
|
import { getGroupPlanTree } from '@/api/group/Schedule';
|
||||||
|
import lineChart from './lineChart.vue';
|
||||||
|
import subDiv from './subDiv.vue';
|
||||||
|
|
||||||
|
const tableProps = [
|
||||||
|
{
|
||||||
|
prop: 'equipmentName',
|
||||||
|
label: '设备',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'sectionName',
|
||||||
|
label: '工段',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'stopCount',
|
||||||
|
label: '停机',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'downCount',
|
||||||
|
label: '故障',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'stopTime',
|
||||||
|
label: '停机时长',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'stopRate',
|
||||||
|
label: '占比',
|
||||||
|
subcomponent: subDiv,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: '',
|
||||||
|
components: {
|
||||||
|
lineChart,
|
||||||
|
},
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
chart: null,
|
||||||
|
formInline: {
|
||||||
|
factoryId: null,
|
||||||
|
lineId: null,
|
||||||
|
sectionId: null,
|
||||||
|
equId: null,
|
||||||
|
recordTime: null,
|
||||||
|
},
|
||||||
|
options: [], // 产线/工段选项
|
||||||
|
graphList: [],
|
||||||
|
startTime: null,
|
||||||
|
gantt: null,
|
||||||
|
lineChartData: [],
|
||||||
|
tableData: [],
|
||||||
|
tableProps,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
created() {
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(now.getDate()).padStart(2, '0');
|
||||||
|
const formattedDate = `${year}-${month}-${day} 00:00:00`;
|
||||||
|
this.startTime = new Date(formattedDate);
|
||||||
|
this.formInline.recordTime = formattedDate
|
||||||
|
? [
|
||||||
|
formattedDate,
|
||||||
|
new Date(new Date(formattedDate).getTime() + 24 * 3600 * 1000)
|
||||||
|
.toLocaleDateString()
|
||||||
|
.split('/')
|
||||||
|
.map((value, index) => {
|
||||||
|
if (index == 1 || index == 2) {
|
||||||
|
return value.padStart(2, '0');
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
})
|
||||||
|
.join('-') + ' 00:00:00',
|
||||||
|
]
|
||||||
|
: null;
|
||||||
|
|
||||||
|
getGroupPlanTree().then((res) => {
|
||||||
|
this.options = res.data;
|
||||||
|
});
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
watch: {
|
||||||
|
graphList: {
|
||||||
|
handler(val) {
|
||||||
|
if (val && val.length) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (!this.gantt) {
|
||||||
|
this.gantt = new Gantt('#status-chart', this.startTime);
|
||||||
|
this.gantt.init(val);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.gantt.update(val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleRecordSearch() {
|
||||||
|
if (!this.formInline.recordTime || this.formInline.recordTime.length <= 0) {
|
||||||
|
this.$message.warning('请选择时间段');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.startTime = new Date(this.formInline.recordTime);
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleCascaderChange() {
|
||||||
|
const checkedNodes = this.$refs.cascaderRef.getCheckedNodes();
|
||||||
|
this.formInline.factoryId = [];
|
||||||
|
this.formInline.lineId = [];
|
||||||
|
this.formInline.sectionId = [];
|
||||||
|
this.formInline.equId = [];
|
||||||
|
checkedNodes.forEach((node) => {
|
||||||
|
if (node.checked) {
|
||||||
|
if (node.level === 1) {
|
||||||
|
this.formInline.factoryId.push(node.value);
|
||||||
|
} else if (node.level === 2) {
|
||||||
|
this.formInline.lineId.push(node.value);
|
||||||
|
} else if (node.level === 3) {
|
||||||
|
this.formInline.sectionId.push(node.value);
|
||||||
|
} else if (node.level === 4) {
|
||||||
|
this.formInline.equId.push(node.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
findMin() {
|
||||||
|
let min = 0;
|
||||||
|
this.graphList.forEach((arr) => {
|
||||||
|
arr.forEach((item) => {
|
||||||
|
if (min < item.startTime) min = item.startTime;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return min;
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 对象到数组的转换 */
|
||||||
|
objectToArray(obj) {
|
||||||
|
return Object.keys(obj).map((key) => {
|
||||||
|
obj[key].sort((a, b) => a.startTime - b.startTime);
|
||||||
|
obj[key].key = key;
|
||||||
|
return obj[key];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
async getList() {
|
||||||
|
const { code, data } = await this.$axios({
|
||||||
|
url: '/monitoring/equipment-overall/getGantt',
|
||||||
|
method: 'get',
|
||||||
|
params: this.formInline,
|
||||||
|
});
|
||||||
|
if (code == 0) {
|
||||||
|
this.graphList = this.objectToArray(data);
|
||||||
|
}
|
||||||
|
const { code: code1, data: data1 } = await this.$axios({
|
||||||
|
url: '/monitoring/equipment-overall/getUseRate',
|
||||||
|
method: 'get',
|
||||||
|
params: this.formInline,
|
||||||
|
});
|
||||||
|
if (code1 == 0) {
|
||||||
|
this.lineChartData = data1;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.lineChartData.length) {
|
||||||
|
this.$refs.lineChart.initChart();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const { code: code2, data: data2 } = await this.$axios({
|
||||||
|
url: '/monitoring/equipment-overall/getHistoryStopAndError',
|
||||||
|
method: 'get',
|
||||||
|
params: this.formInline,
|
||||||
|
});
|
||||||
|
if (code2 == 0) {
|
||||||
|
this.tableData = data2;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.graph {
|
||||||
|
// border: 1px solid #ccc;
|
||||||
|
// padding: 12px 12px 28px 12px;
|
||||||
|
// margin: 64px 0;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-title {
|
||||||
|
// position: absolute;
|
||||||
|
// top: -64px;
|
||||||
|
// left: -1px;
|
||||||
|
// padding: 8px 18px;
|
||||||
|
padding: 0 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-content {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
padding: 22px 12px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-bottom-width: 2px;
|
||||||
|
border-top: none;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-content::after,
|
||||||
|
.graph-content::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
width: 3px;
|
||||||
|
height: 80%;
|
||||||
|
background: #fff;
|
||||||
|
right: -1px;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-content::before {
|
||||||
|
right: unset;
|
||||||
|
left: -1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-item,
|
||||||
|
.graph-item-fixed {
|
||||||
|
// height: 88px;
|
||||||
|
// width: 24px;
|
||||||
|
flex: 1;
|
||||||
|
// border: 1px solid #ccc;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-item-fixed {
|
||||||
|
flex: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-item::before,
|
||||||
|
.graph-item-fixed::before {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -16px;
|
||||||
|
left: 0;
|
||||||
|
content: attr(data-time);
|
||||||
|
// font-size - js
|
||||||
|
// rotate - js
|
||||||
|
// color - js, default:
|
||||||
|
color: #777;
|
||||||
|
transform-origin: left top;
|
||||||
|
transform: rotate(12deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-item-fixed::after,
|
||||||
|
.graph-item::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: -3px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-item.tick::after,
|
||||||
|
.graph-item-fixed.tick::after {
|
||||||
|
width: 1px;
|
||||||
|
height: 6px;
|
||||||
|
border-left: 1px solid #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
.running {
|
||||||
|
background-color: #288aff;
|
||||||
|
// background-color: #84f04e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waiting {
|
||||||
|
background-color: #5ad8a6;
|
||||||
|
// background-color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fault {
|
||||||
|
// background-color: #ea5b5b;
|
||||||
|
background-color: #fc9c91;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full {
|
||||||
|
// background-color: #e6a23c;
|
||||||
|
background-color: #598fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lack {
|
||||||
|
// background-color: #a69c8d;
|
||||||
|
background-color: #7585a2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stop {
|
||||||
|
background-color: #ffdc94;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-row {
|
||||||
|
margin: 6px 0;
|
||||||
|
padding-right: 12px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
|
||||||
|
> .legend:not(:last-child) {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-right: 4px;
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.blue-title {
|
||||||
|
position: relative;
|
||||||
|
padding: 4px 0;
|
||||||
|
padding-left: 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 6px;
|
||||||
|
height: 16px;
|
||||||
|
width: 4px;
|
||||||
|
border-radius: 1px;
|
||||||
|
background: #0b58ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.echarts__status-chart {
|
||||||
|
background: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.echarts__status-chart > div {
|
||||||
|
height: 100% !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
299
src/views/equipment/equipmentOverview/index-line.vue
Normal file
299
src/views/equipment/equipmentOverview/index-line.vue
Normal file
@@ -0,0 +1,299 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2025-02-10 09:15:55
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2025-02-25 15:48:59
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="app-container" style="overflow: auto">
|
||||||
|
<search-bar
|
||||||
|
:formConfigs="formConfig"
|
||||||
|
ref="searchBarForm"
|
||||||
|
@select-changed="handleSearchBarChanged"
|
||||||
|
@headBtnClick="buttonClick" />
|
||||||
|
<div class="top-tip">
|
||||||
|
<div class="block" style="background: #5b8ff9" />
|
||||||
|
运行
|
||||||
|
<div class="block" style="background: #f4b183" />
|
||||||
|
停机
|
||||||
|
<div class="block" style="background: #ff4f3e" />
|
||||||
|
故障
|
||||||
|
</div>
|
||||||
|
<div class="canvas-line" v-for="(item, index) in lineArr" :key="index">
|
||||||
|
<div class="title">{{ item.name }}</div>
|
||||||
|
<canvas
|
||||||
|
style="
|
||||||
|
box-shadow: 1px 1px 2px 2px #909399;
|
||||||
|
padding: 0;
|
||||||
|
height: 210px;
|
||||||
|
width: 100%;
|
||||||
|
"
|
||||||
|
@click="getclient($event, index + 1, item.num)"
|
||||||
|
:id="'mycanvas' + (index + 1)"></canvas>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getPdList } from '@/api/core/monitoring/auto';
|
||||||
|
import { getFactoryPage, getLineEqStatus } from '@/api/core/base/factory';
|
||||||
|
import linePot from './line-pot';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
listQuery: {
|
||||||
|
factoryId: null,
|
||||||
|
lineId: null,
|
||||||
|
},
|
||||||
|
ctx: '', //canvas
|
||||||
|
lineArr: [],
|
||||||
|
formConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '工厂',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'factoryId',
|
||||||
|
onchange: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'lineId',
|
||||||
|
multiple: true,
|
||||||
|
width: 410
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '搜索',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
linePot,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {},
|
||||||
|
created() {
|
||||||
|
this.getPdLineList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initCanvas(name) {
|
||||||
|
let canvas = document.getElementById(name);
|
||||||
|
canvas.width = canvas.clientWidth;
|
||||||
|
canvas.width = canvas.clientWidth;
|
||||||
|
canvas.height = 210;
|
||||||
|
this.ctx = canvas.getContext('2d');
|
||||||
|
this.ctx.lineWidth = 1;
|
||||||
|
this.ctx.strokeStyle = '#909399';
|
||||||
|
this.ctx.fillStyle = '#5b8ff9';
|
||||||
|
this.ctx.font = '12px 宋体'; //文字大小 字体样式
|
||||||
|
this.ctx.clearRect(0, 0, canvas.clientWidth, 210); //清空画布
|
||||||
|
},
|
||||||
|
//画长方形
|
||||||
|
fillRect(x, y, width, height, name, color) {
|
||||||
|
this.ctx.beginPath(); //开始
|
||||||
|
this.ctx.fillStyle = color ? color : '#5b8ff9'; //填充颜色
|
||||||
|
this.ctx.fillRect(x, y, width, height); //左上角点的坐标(x,y) 宽 高
|
||||||
|
this.ctx.strokeRect(x, y, width, height);
|
||||||
|
this.ctx.fillStyle = '#fff'; //填充颜色
|
||||||
|
if (height === 50) {
|
||||||
|
//判断是否特殊机器 机器文字y轴定位加10
|
||||||
|
this.ctx.fillText(name, x + 5, y + 30);
|
||||||
|
} else {
|
||||||
|
this.ctx.fillText(name, x + 5, y + 20);
|
||||||
|
}
|
||||||
|
this.ctx.closePath(); //结束
|
||||||
|
},
|
||||||
|
//画特殊形
|
||||||
|
fillLRect(LArr, name, color) {
|
||||||
|
this.ctx.beginPath(); //开始
|
||||||
|
LArr.forEach((item, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
this.ctx.moveTo(item[0], item[1]);
|
||||||
|
} else {
|
||||||
|
this.ctx.lineTo(item[0], item[1]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.ctx.closePath(); //结束 // 闭合路径
|
||||||
|
this.ctx.fillStyle = color ? color : '#5b8ff9'; //填充颜色
|
||||||
|
this.ctx.fill();
|
||||||
|
this.ctx.stroke();
|
||||||
|
this.ctx.fillStyle = '#fff'; //填充颜色
|
||||||
|
if (LArr[0][0] === LArr[1][0]) {
|
||||||
|
//判断L形第一截是竖着还是横着
|
||||||
|
this.ctx.fillText(name, LArr[1][0] + 5, LArr[1][1] + 20); //竖着
|
||||||
|
} else {
|
||||||
|
this.ctx.fillText(name, LArr[0][0] + 5, LArr[0][1] + 20);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setRect(item, index) {
|
||||||
|
const identifier = 'line' + item.num + 'canvas';
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.initCanvas('mycanvas' + (index + 1));
|
||||||
|
});
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.linePot[identifier].forEach((idItem) => {
|
||||||
|
item.children.forEach((eqItem) => {
|
||||||
|
if (eqItem.id === idItem.id) {
|
||||||
|
idItem.color = ['#5b8ff9', '#f4b183', '#ff4f3e'][
|
||||||
|
eqItem.equipmentStatus
|
||||||
|
];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (idItem.isL) {
|
||||||
|
this.fillLRect(idItem.line, idItem.name, idItem.color);
|
||||||
|
} else {
|
||||||
|
this.fillRect(
|
||||||
|
idItem.x,
|
||||||
|
idItem.y,
|
||||||
|
idItem.width,
|
||||||
|
idItem.height,
|
||||||
|
idItem.name,
|
||||||
|
idItem.color
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getclient(e, index, num) {
|
||||||
|
let canvas = document.getElementById('mycanvas' + index);
|
||||||
|
const rect = canvas.getBoundingClientRect();
|
||||||
|
const identifier = 'line' + num + 'canvas';
|
||||||
|
this.isEQ(e.clientX - rect.left, e.clientY - rect.top, identifier);
|
||||||
|
},
|
||||||
|
// 检查点击位置是否在设备内
|
||||||
|
isEQ(x, y, identifier) {
|
||||||
|
this.linePot[identifier].forEach((idItem) => {
|
||||||
|
if (idItem.isEQ) {
|
||||||
|
// 检查点击位置是否在矩形内
|
||||||
|
if (
|
||||||
|
x >= idItem.x &&
|
||||||
|
x <= idItem.x + idItem.width &&
|
||||||
|
y >= idItem.y &&
|
||||||
|
y <= idItem.y + idItem.height
|
||||||
|
) {
|
||||||
|
console.log(idItem.name, idItem.id);
|
||||||
|
this.$router.push({
|
||||||
|
path: '/equipment/analysis/timing-diagram/equipment-status',
|
||||||
|
query: { eqid: idItem.id },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getPdLineList() {
|
||||||
|
const params = {
|
||||||
|
pageSize: 100,
|
||||||
|
pageNo: 1,
|
||||||
|
};
|
||||||
|
getFactoryPage(params).then((res) => {
|
||||||
|
this.formConfig[0].selectOptions = res.data.list || [];
|
||||||
|
});
|
||||||
|
getPdList().then((res) => {
|
||||||
|
this.formConfig[1].selectOptions = res.data || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttonClick(val) {
|
||||||
|
switch (val.btnName) {
|
||||||
|
case 'search':
|
||||||
|
this.listQuery.pageNo = 1;
|
||||||
|
this.listQuery.pageSize = 100;
|
||||||
|
this.listQuery.factoryId = val.factoryId || undefined;
|
||||||
|
this.listQuery.lineId = val.lineId ? val.lineId : [];
|
||||||
|
this.getDataList();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleSearchBarChanged({ param, value }) {
|
||||||
|
this.listQuery.lineId = [];
|
||||||
|
this.$refs.searchBarForm.formInline.lineId = undefined;
|
||||||
|
getPdList(value).then((res) => {
|
||||||
|
this.formConfig[1].selectOptions = res.data || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getDataList() {
|
||||||
|
// this.lineArr = [
|
||||||
|
// {
|
||||||
|
// num: 1,
|
||||||
|
// name: 'A1',
|
||||||
|
// children: [],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// num: 2,
|
||||||
|
// name: 'A2',
|
||||||
|
// children: [],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// num: 3,
|
||||||
|
// name: 'A3',
|
||||||
|
// children: [],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// num: 4,
|
||||||
|
// name: 'A4',
|
||||||
|
// children: [],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// num: 5,
|
||||||
|
// name: 'A5',
|
||||||
|
// children: [],
|
||||||
|
// },
|
||||||
|
// ];
|
||||||
|
getLineEqStatus(this.listQuery).then((response) => {
|
||||||
|
this.lineArr = response.data;
|
||||||
|
this.lineArr.forEach((item, index) => {
|
||||||
|
const num = [
|
||||||
|
'20001',
|
||||||
|
'20002',
|
||||||
|
'20003',
|
||||||
|
'20004',
|
||||||
|
'20005',
|
||||||
|
].indexOf(item.id);
|
||||||
|
if (num > 0) {
|
||||||
|
item.num = num;
|
||||||
|
item.name = item.lineName;
|
||||||
|
this.setRect(item, index);
|
||||||
|
} else {
|
||||||
|
this.$message.warning('没有对应的产线!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.top-tip {
|
||||||
|
.block {
|
||||||
|
display: inline-block;
|
||||||
|
width: 20px;
|
||||||
|
height: 10px;
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.canvas-line {
|
||||||
|
margin-top: 20px;
|
||||||
|
min-width: 1600px;
|
||||||
|
.title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bolder;
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
background: rgb(39, 240, 17);
|
||||||
|
display: inline-block;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 3px;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
201
src/views/equipment/equipmentOverview/index.vue
Normal file
201
src/views/equipment/equipmentOverview/index.vue
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
<template>
|
||||||
|
<div style="background: #f2f4f9">
|
||||||
|
<div style="background: #f2f4f9; height: 38px; width: 100%">
|
||||||
|
<ButtonNav
|
||||||
|
ref="buttonNav"
|
||||||
|
:menus="['产线总览', '设备总览', '历史状态']"
|
||||||
|
@change="currentMenu">
|
||||||
|
<template v-slot:tab1>
|
||||||
|
<div>产线总览</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:tab2>
|
||||||
|
<div>设备总览</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:tab3>
|
||||||
|
<div>历史状态</div>
|
||||||
|
</template>
|
||||||
|
</ButtonNav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="app-container"
|
||||||
|
v-if="activeName === '产线总览'"
|
||||||
|
style="background: #ffffff">
|
||||||
|
<div>
|
||||||
|
<indexLine />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="app-container"
|
||||||
|
v-else-if="activeName === '设备总览'"
|
||||||
|
style="background: #ffffff">
|
||||||
|
<!-- 表 -->
|
||||||
|
<div>
|
||||||
|
<indexEq />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else style="background: #ffffff">
|
||||||
|
<div>
|
||||||
|
<indexHis />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import ButtonNav from '@/components/ButtonNav';
|
||||||
|
import indexEq from './index-eq.vue';
|
||||||
|
import indexLine from './index-line.vue';
|
||||||
|
import indexHis from './index-his.vue';
|
||||||
|
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
||||||
|
import { listLineReport } from '@/api/core/analysis/index';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: '',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'lineId',
|
||||||
|
collapseTags: true,
|
||||||
|
multiple: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '报表类型',
|
||||||
|
selectOptions: [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
name: '班',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '日',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// id: 2,
|
||||||
|
// name: '周',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: '月',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: '年',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
param: 'type',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间范围',
|
||||||
|
dateType: 'daterange',
|
||||||
|
format: 'yyyy-MM-dd',
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeVal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
activeName: '产线总览',
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: { ButtonNav, indexEq, indexLine, indexHis },
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
getProductionLinePage({
|
||||||
|
page: 1,
|
||||||
|
limit: 500,
|
||||||
|
}).then((response) => {
|
||||||
|
this.formConfig[0].selectOptions = response.data.list;
|
||||||
|
});
|
||||||
|
if (this.$refs.buttonNav) {
|
||||||
|
this.$refs.buttonNav.currentMenu = '产线总览';
|
||||||
|
}
|
||||||
|
this.getPage();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
currentMenu(val) {
|
||||||
|
this.activeName = val;
|
||||||
|
},
|
||||||
|
getPage() {
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
/* 外层容器:限制高度,提供背景 */
|
||||||
|
.scroll-container {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 0;
|
||||||
|
background-color: #f5f5f5; /* 背景色,可根据UI调整 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 核心样式:横向滚动 */
|
||||||
|
.card-scroll-wrapper {
|
||||||
|
/* 重要:开启Flex,让子元素横向排列 */
|
||||||
|
display: flex;
|
||||||
|
/* 重要:不换行,强制排在一行 */
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
/* 重要:添加横向滚动条 */
|
||||||
|
overflow-x: auto;
|
||||||
|
padding: 10px 15px;
|
||||||
|
/* 对齐方式 */
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 卡片样式:圆角、白色背景、阴影 */
|
||||||
|
.efficiency-card {
|
||||||
|
/* 固定宽度,也可以用 flex: 0 0 200px; 固定宽度 */
|
||||||
|
min-width: 200px;
|
||||||
|
height: 120px;
|
||||||
|
margin: 0 10px; /* 卡片之间的间距 */
|
||||||
|
padding: 20px 16px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 12px; /* 圆角 */
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); /* 轻微阴影 */
|
||||||
|
/* 卡片内部文字布局 */
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
/* 防止文字挤压 */
|
||||||
|
flex-shrink: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.efficiency-card:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 标签文字 */
|
||||||
|
.card-label {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666666;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
white-space: nowrap; /* 确保文字也不换行 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 数值文字(加粗放大) */
|
||||||
|
.card-value {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1810
src/views/equipment/equipmentOverview/line-pot.js
Normal file
1810
src/views/equipment/equipmentOverview/line-pot.js
Normal file
File diff suppressed because it is too large
Load Diff
92
src/views/equipment/equipmentOverview/lineChart.vue
Normal file
92
src/views/equipment/equipmentOverview/lineChart.vue
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
id="linechart"
|
||||||
|
style="width: 100%"
|
||||||
|
:style="{ height: chartHeight + 'px' }"></div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import * as echarts from 'echarts';
|
||||||
|
import resize from '@/utils/chartMixins/resize';
|
||||||
|
import moment from 'moment';
|
||||||
|
export default {
|
||||||
|
name: 'LineChart',
|
||||||
|
mixins: [resize],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
chartDom: '',
|
||||||
|
chart: '',
|
||||||
|
chartHeight: 300,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
chartData: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
chartData: function () {
|
||||||
|
this.initChart();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
initChart() {
|
||||||
|
if (
|
||||||
|
this.chart !== null &&
|
||||||
|
this.chart !== '' &&
|
||||||
|
this.chart !== undefined
|
||||||
|
) {
|
||||||
|
this.chart.dispose(); // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
||||||
|
}
|
||||||
|
this.chartDom = document.getElementById('linechart');
|
||||||
|
this.chart = echarts.init(this.chartDom);
|
||||||
|
let xData = this.chartData
|
||||||
|
? this.chartData[0].detailData.map((item) => item.lastDate)
|
||||||
|
: [];
|
||||||
|
let yData = this.chartData
|
||||||
|
? this.chartData.map((item) => {
|
||||||
|
return {
|
||||||
|
type: 'line',
|
||||||
|
name: item.equipmentName,
|
||||||
|
data: item.detailData.map((subItem) => subItem.runRate),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
: [];
|
||||||
|
|
||||||
|
var option = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: yData.map((item) => item.name),
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '4%',
|
||||||
|
right: '1%',
|
||||||
|
bottom: '1%',
|
||||||
|
containLabel: true,
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: xData,
|
||||||
|
axisLabel: {
|
||||||
|
rotate: '45',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
axisLabel: {
|
||||||
|
formatter: '{value} %',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
series: yData,
|
||||||
|
};
|
||||||
|
|
||||||
|
option && this.chart.setOption(option);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
29
src/views/equipment/equipmentOverview/subDiv.vue
Normal file
29
src/views/equipment/equipmentOverview/subDiv.vue
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2024-07-01 14:53:55
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2026-03-18 14:32:19
|
||||||
|
* @Description:
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-progress :percentage="injectData.stopRate"></el-progress>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
injectData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
created() {},
|
||||||
|
methods: {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: zwq
|
* @Author: zwq
|
||||||
* @Date: 2025-10-13 15:07:24
|
* @Date: 2025-10-13 15:07:24
|
||||||
* @LastEditors: zwq
|
* @LastEditors: zwq
|
||||||
* @LastEditTime: 2025-11-27 14:41:59
|
* @LastEditTime: 2025-12-03 15:48:26
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
@@ -642,11 +642,15 @@ export default {
|
|||||||
this.tableData1 = res.data?.stepTwo.groupPlanClassesBaseVOList;
|
this.tableData1 = res.data?.stepTwo.groupPlanClassesBaseVOList;
|
||||||
this.tableData2 = res.data?.stepTwo.groupPlanTeamBaseVOList;
|
this.tableData2 = res.data?.stepTwo.groupPlanTeamBaseVOList;
|
||||||
this.tableData2.forEach((item, index) => {
|
this.tableData2.forEach((item, index) => {
|
||||||
let lineName = '';
|
let lineName = [];
|
||||||
if (item.isProduction) {
|
if (item.isProduction) {
|
||||||
lineName = this.setLineName(item.bindLineTree);
|
lineName = this.setLineName(item.bindLineTree);
|
||||||
|
this.$set(
|
||||||
|
this.tableData2[index],
|
||||||
|
'lineName',
|
||||||
|
lineName.join(';')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
this.$set(this.tableData2[index], 'lineName', lineName.join(';'));
|
|
||||||
});
|
});
|
||||||
this.stepNum = 3;
|
this.stepNum = 3;
|
||||||
this.getThreeGroup(7); // 第三步,进来加载预览排班,默认7天预览周期
|
this.getThreeGroup(7); // 第三步,进来加载预览排班,默认7天预览周期
|
||||||
@@ -822,10 +826,14 @@ export default {
|
|||||||
});
|
});
|
||||||
checkPlan(data).then((RES) => {
|
checkPlan(data).then((RES) => {
|
||||||
createStepFour(this.dataForm.id).then((res) => {
|
createStepFour(this.dataForm.id).then((res) => {
|
||||||
|
if (res.code === 200 || res.code === 0) {
|
||||||
this.$modal.msgSuccess('创建计划成功');
|
this.$modal.msgSuccess('创建计划成功');
|
||||||
this.stepNum = 1;
|
this.stepNum = 1;
|
||||||
this.$emit('setSN', this.stepNum);
|
this.$emit('setSN', this.stepNum);
|
||||||
this.$emit('refreshDataList');
|
this.$emit('refreshDataList');
|
||||||
|
} else {
|
||||||
|
this.$message(res.msg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
* @Author: zwq
|
* @Author: zwq
|
||||||
* @Date: 2021-11-18 14:16:25
|
* @Date: 2021-11-18 14:16:25
|
||||||
* @LastEditors: zwq
|
* @LastEditors: zwq
|
||||||
* @LastEditTime: 2025-11-25 15:49:17
|
* @LastEditTime: 2026-01-10 23:19:01
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div style="width: 100%; display: flex; justify-content: center">
|
<div style="width: 100%; display: flex; justify-content: center">
|
||||||
<tree-transfer
|
<tree-transfer
|
||||||
|
class="treeCss"
|
||||||
:title="title"
|
:title="title"
|
||||||
:from_data="fromData"
|
:from_data="fromData"
|
||||||
:to_data="toData"
|
:to_data="toData"
|
||||||
@@ -20,7 +21,6 @@
|
|||||||
children: 'children',
|
children: 'children',
|
||||||
}"
|
}"
|
||||||
height="450px"
|
height="450px"
|
||||||
style="padding-bottom: 20px"
|
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
filter
|
filter
|
||||||
openAll></tree-transfer>
|
openAll></tree-transfer>
|
||||||
@@ -62,9 +62,9 @@ export default {
|
|||||||
},
|
},
|
||||||
processNode(node) {
|
processNode(node) {
|
||||||
// 创建唯一ID:类型-原始ID
|
// 创建唯一ID:类型-原始ID
|
||||||
const uniqueId = node.type+'L'+node.id;
|
const uniqueId = node.type + 'L' + node.id;
|
||||||
if (node.type > 0) {
|
if (node.type > 0) {
|
||||||
node.fid = (node.type - 1)+'L'+node.pid;
|
node.fid = node.type - 1 + 'L' + node.pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -108,3 +108,8 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.treeCss >>> .transfer-title {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: zwq
|
* @Author: zwq
|
||||||
* @Date: 2021-11-18 14:16:25
|
* @Date: 2021-11-18 14:16:25
|
||||||
* @LastEditors: zwq
|
* @LastEditors: zwq
|
||||||
* @LastEditTime: 2025-11-27 14:06:11
|
* @LastEditTime: 2025-12-11 10:47:50
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
format="yyyy-MM-dd"
|
format="yyyy-MM-dd"
|
||||||
value-format="--MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
@blur="$forceUpdate()"
|
@blur="$forceUpdate()"
|
||||||
:picker-options="pickerOptions"></el-date-picker>
|
:picker-options="pickerOptions"></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
v-model="dataForm.dateDayArr"
|
v-model="dataForm.dateDayArr"
|
||||||
type="daterange"
|
type="daterange"
|
||||||
format="yyyy-MM-dd"
|
format="yyyy-MM-dd"
|
||||||
value-format="--MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
range-separator="至"
|
range-separator="至"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
@@ -341,45 +341,70 @@ export default {
|
|||||||
this.$refs['dataForm'].resetFields();
|
this.$refs['dataForm'].resetFields();
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
getHoliday(this.dataForm.id).then((res) => {
|
getHoliday(this.dataForm.id).then((res) => {
|
||||||
|
//设置年份,不重复的直接用返回的年份,重复的直接用当年年份
|
||||||
|
let year = new Date().getFullYear();
|
||||||
|
if (res.data.calendarType == 1 && !res.data.repeat) {
|
||||||
|
year = res.data.noRepeatYear;
|
||||||
|
} else if (res.data.calendarType == 2 && !res.data.repeat) {
|
||||||
|
year = res.data.noRepeatYearChinese;
|
||||||
|
}
|
||||||
|
|
||||||
this.dataForm = res.data;
|
this.dataForm = res.data;
|
||||||
if (
|
if (
|
||||||
this.dataForm.dateType == 1 &&
|
this.dataForm.dateType == 1 &&
|
||||||
this.dataForm.calendarType == 1
|
this.dataForm.calendarType == 1
|
||||||
) {
|
) {
|
||||||
this.dataForm.dateDay = this.dataForm.oneDay;
|
this.dataForm.dateDay =
|
||||||
|
year + '-' + this.dataForm.oneDay.slice(-5);
|
||||||
} else if (
|
} else if (
|
||||||
this.dataForm.dateType == 2 &&
|
this.dataForm.dateType == 2 &&
|
||||||
this.dataForm.calendarType == 1
|
this.dataForm.calendarType == 1
|
||||||
) {
|
) {
|
||||||
|
let num = this.compareMonthDay(
|
||||||
|
this.dataForm.startDay.slice(-5),
|
||||||
|
this.dataForm.endDay.slice(-5)
|
||||||
|
);
|
||||||
this.dataForm.dateDayArr = [
|
this.dataForm.dateDayArr = [
|
||||||
this.dataForm.startDay,
|
year + '-' + this.dataForm.startDay.slice(-5),
|
||||||
this.dataForm.endDay,
|
(num > 0 ? year : year + 1) +
|
||||||
|
'-' +
|
||||||
|
this.dataForm.endDay.slice(-5),
|
||||||
];
|
];
|
||||||
} else if (
|
} else if (
|
||||||
this.dataForm.dateType == 1 &&
|
this.dataForm.dateType == 1 &&
|
||||||
this.dataForm.calendarType == 2
|
this.dataForm.calendarType == 2
|
||||||
) {
|
) {
|
||||||
this.dataForm.dateDayChinese =
|
this.dataForm.dateDayChinese =
|
||||||
'L' +
|
'L' + year + this.dataForm.oneDayChinese.slice(-6);
|
||||||
new Date().getFullYear() +
|
|
||||||
this.dataForm.oneDayChinese.slice(-6);
|
|
||||||
} else if (
|
} else if (
|
||||||
this.dataForm.dateType == 2 &&
|
this.dataForm.dateType == 2 &&
|
||||||
this.dataForm.calendarType == 2
|
this.dataForm.calendarType == 2
|
||||||
) {
|
) {
|
||||||
this.dataForm.dateDayArrChinese = [
|
let num = this.compareMonthDay(
|
||||||
'L' +
|
|
||||||
new Date().getFullYear() +
|
|
||||||
this.dataForm.startDayChinese.slice(-6),
|
this.dataForm.startDayChinese.slice(-6),
|
||||||
|
this.dataForm.endDayChinese.slice(-6)
|
||||||
|
);
|
||||||
|
this.dataForm.dateDayArrChinese = [
|
||||||
|
'L' + year + this.dataForm.startDayChinese.slice(-6),
|
||||||
'L' +
|
'L' +
|
||||||
new Date().getFullYear() +
|
(num > 0 ? year : year + 1) +
|
||||||
this.dataForm.endDayChinese.slice(-6),
|
+this.dataForm.endDayChinese.slice(-6),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
//用于比较日期大小,判断年份是否要加1
|
||||||
|
compareMonthDay(dateStr1, dateStr2) {
|
||||||
|
const [month1, day1] = dateStr1.split('-').map(Number);
|
||||||
|
const [month2, day2] = dateStr2.split('-').map(Number);
|
||||||
|
|
||||||
|
if (month1 !== month2) {
|
||||||
|
return month2 - month1;
|
||||||
|
}
|
||||||
|
return day2 - day1;
|
||||||
|
},
|
||||||
editHoliday() {
|
editHoliday() {
|
||||||
this.detail = false;
|
this.detail = false;
|
||||||
},
|
},
|
||||||
@@ -442,13 +467,16 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.dataForm.dateType == 1 && this.dataForm.calendarType == 1) {
|
if (this.dataForm.dateType == 1 && this.dataForm.calendarType == 1) {
|
||||||
this.dataForm.oneDay = this.dataForm.dateDay;
|
const [year, month, day] = this.dataForm.dateDay.split('-');
|
||||||
|
this.dataForm.oneDay = `--${month}-${day}`;
|
||||||
} else if (
|
} else if (
|
||||||
this.dataForm.dateType == 2 &&
|
this.dataForm.dateType == 2 &&
|
||||||
this.dataForm.calendarType == 1
|
this.dataForm.calendarType == 1
|
||||||
) {
|
) {
|
||||||
this.dataForm.startDay = this.dataForm.dateDayArr[0];
|
const [year, month, day] = this.dataForm.dateDayArr[0].split('-');
|
||||||
this.dataForm.endDay = this.dataForm.dateDayArr[1];
|
this.dataForm.startDay = `--${month}-${day}`;
|
||||||
|
const [year1, month1, day1] = this.dataForm.dateDayArr[1].split('-');
|
||||||
|
this.dataForm.endDay = `--${month1}-${day1}`;
|
||||||
} else if (
|
} else if (
|
||||||
this.dataForm.dateType == 1 &&
|
this.dataForm.dateType == 1 &&
|
||||||
this.dataForm.calendarType == 2
|
this.dataForm.calendarType == 2
|
||||||
@@ -464,10 +492,35 @@ export default {
|
|||||||
this.dataForm.endDayChinese =
|
this.dataForm.endDayChinese =
|
||||||
'--' + this.dataForm.dateDayArrChinese[1].slice(-5);
|
'--' + this.dataForm.dateDayArrChinese[1].slice(-5);
|
||||||
}
|
}
|
||||||
if (this.dataForm.calendarType == 1 && !this.dataForm.repeat) {
|
//是否每年重复,不重复的话需要传 年份
|
||||||
this.dataForm.noRepeatYear = new Date().getFullYear();
|
if (
|
||||||
} else if (this.dataForm.calendarType == 2 && !this.dataForm.repeat) {
|
this.dataForm.dateType == 1 &&
|
||||||
this.dataForm.noRepeatYearChinese = new Date().getFullYear();
|
this.dataForm.calendarType == 1 &&
|
||||||
|
!this.dataForm.repeat
|
||||||
|
) {
|
||||||
|
const [year, month, day] = this.dataForm.dateDay.split('-');
|
||||||
|
this.dataForm.noRepeatYear = year;
|
||||||
|
} else if (
|
||||||
|
this.dataForm.dateType == 2 &&
|
||||||
|
this.dataForm.calendarType == 1 &&
|
||||||
|
!this.dataForm.repeat
|
||||||
|
) {
|
||||||
|
const [year, month, day] = this.dataForm.dateDayArr[0].split('-');
|
||||||
|
this.dataForm.noRepeatYear = year;
|
||||||
|
} else if (
|
||||||
|
this.dataForm.dateType == 1 &&
|
||||||
|
this.dataForm.calendarType == 2 &&
|
||||||
|
!this.dataForm.repeat
|
||||||
|
) {
|
||||||
|
this.dataForm.noRepeatYearChinese =
|
||||||
|
this.dataForm.dateDayChinese.slice(1, 5);
|
||||||
|
} else if (
|
||||||
|
this.dataForm.dateType == 2 &&
|
||||||
|
this.dataForm.calendarType == 2 &&
|
||||||
|
!this.dataForm.repeat
|
||||||
|
) {
|
||||||
|
this.dataForm.noRepeatYearChinese =
|
||||||
|
this.dataForm.dateDayArrChinese[0].slice(1, 5);
|
||||||
}
|
}
|
||||||
// 修改的提交
|
// 修改的提交
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
@@ -475,6 +528,7 @@ export default {
|
|||||||
this.dataForm.inherited = false;
|
this.dataForm.inherited = false;
|
||||||
}
|
}
|
||||||
updateHoliday(this.dataForm).then((res) => {
|
updateHoliday(this.dataForm).then((res) => {
|
||||||
|
if (res.code === 0 || res.code === 200) {
|
||||||
if (!res.data.updateFlag) {
|
if (!res.data.updateFlag) {
|
||||||
this.$modal.msgSuccess('修改成功');
|
this.$modal.msgSuccess('修改成功');
|
||||||
this.$emit('refreshPage');
|
this.$emit('refreshPage');
|
||||||
@@ -502,11 +556,15 @@ export default {
|
|||||||
this.$emit('refreshPage');
|
this.$emit('refreshPage');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.$modal.msg(res.msg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 添加的提交
|
// 添加的提交
|
||||||
createHoliday(this.dataForm).then((res) => {
|
createHoliday(this.dataForm).then((res) => {
|
||||||
|
if (res.code === 0 || res.code === 200) {
|
||||||
if (!res.data.updateFlag) {
|
if (!res.data.updateFlag) {
|
||||||
this.$modal.msgSuccess('新增成功');
|
this.$modal.msgSuccess('新增成功');
|
||||||
this.$emit('refreshPage');
|
this.$emit('refreshPage');
|
||||||
@@ -534,6 +592,9 @@ export default {
|
|||||||
this.$emit('refreshPage');
|
this.$emit('refreshPage');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.$modal.msg(res.msg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -210,7 +210,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import JDatePickerScript from './jDatePicker.js'
|
// import JDatePickerScript from './JDatePicker.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
src="/static/videos/login.webm"
|
src="/static/videos/login.webm"
|
||||||
muted
|
muted
|
||||||
autoplay
|
autoplay
|
||||||
|
id="video"
|
||||||
loop
|
loop
|
||||||
style="
|
style="
|
||||||
user-select: none;
|
user-select: none;
|
||||||
@@ -339,6 +340,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
// 租户开关
|
// 租户开关
|
||||||
this.tenantEnable = getTenantEnable();
|
this.tenantEnable = getTenantEnable();
|
||||||
if (this.tenantEnable) {
|
if (this.tenantEnable) {
|
||||||
@@ -357,6 +359,13 @@ export default {
|
|||||||
? decodeURIComponent(this.$route.query.redirect)
|
? decodeURIComponent(this.$route.query.redirect)
|
||||||
: undefined;
|
: undefined;
|
||||||
this.getCookie();
|
this.getCookie();
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
const video = document.getElementById('video');
|
||||||
|
// 设置为0.5倍速,数值越小速度越慢(0.5为半速,0.75为0.75倍速等)
|
||||||
|
video.playbackRate = 0.2;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCode() {
|
getCode() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<div class="blue-title">各设备加工数量</div>
|
<div class="blue-title">各设备投入/产出数量</div>
|
||||||
<div class="chart" ref="chart"></div>
|
<div class="chart" ref="chart"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -24,7 +24,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
chart: null,
|
chart: null,
|
||||||
option: {
|
option: {
|
||||||
color: ['#288AFF'],
|
|
||||||
grid: {
|
grid: {
|
||||||
top: 64,
|
top: 64,
|
||||||
left: 56,
|
left: 56,
|
||||||
@@ -37,15 +36,8 @@ export default {
|
|||||||
type: 'shadow',
|
type: 'shadow',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
title: {
|
legend: {
|
||||||
show: false,
|
data: ['投入数量', '产出数量'],
|
||||||
text: '各设备加工数量',
|
|
||||||
textStyle: {
|
|
||||||
color: '#232323',
|
|
||||||
fontSize: 16,
|
|
||||||
},
|
|
||||||
left: 'center',
|
|
||||||
top: 24,
|
|
||||||
},
|
},
|
||||||
toolbox: {
|
toolbox: {
|
||||||
feature: {
|
feature: {
|
||||||
@@ -59,17 +51,20 @@ export default {
|
|||||||
},
|
},
|
||||||
dataZoom: [
|
dataZoom: [
|
||||||
{
|
{
|
||||||
type: 'slider',
|
type: 'inside',
|
||||||
yAxisIndex: 0,
|
|
||||||
filterMode: 'none',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'inside',
|
type: 'slider',
|
||||||
yAxisIndex: 0,
|
|
||||||
filterMode: 'none',
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
yAxis: {
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
name: '数量',
|
||||||
|
nameTextStyle: {
|
||||||
|
fontSize: 14,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: [],
|
data: [],
|
||||||
name: '设备名',
|
name: '设备名',
|
||||||
@@ -77,15 +72,22 @@ export default {
|
|||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
xAxis: {
|
|
||||||
type: 'value',
|
|
||||||
name: '数量',
|
|
||||||
nameTextStyle: {
|
|
||||||
fontSize: 14,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
|
name: '投入数量',
|
||||||
|
data: [],
|
||||||
|
type: 'bar',
|
||||||
|
barWidth: 20,
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
distance: 50,
|
||||||
|
formatter: '{c}',
|
||||||
|
},
|
||||||
|
large: true,
|
||||||
|
largeThreshold: 20,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '产出数量',
|
||||||
data: [],
|
data: [],
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: 20,
|
barWidth: 20,
|
||||||
@@ -106,7 +108,8 @@ export default {
|
|||||||
handler: function (newVal, oldVal) {
|
handler: function (newVal, oldVal) {
|
||||||
if (!this.chart) this.chart = echarts.init(this.$refs.chart);
|
if (!this.chart) this.chart = echarts.init(this.$refs.chart);
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.chart) this.chart.setOption(this.updateConfig(this.option),true);
|
if (this.chart)
|
||||||
|
this.chart.setOption(this.updateConfig(this.option), true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
@@ -118,13 +121,16 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
updateConfig(config) {
|
updateConfig(config) {
|
||||||
let nameData = [];
|
let nameData = [];
|
||||||
let valueData = [];
|
let inQuantity = [];
|
||||||
|
let outQuantity = [];
|
||||||
this.equipmentList.map((eq) => {
|
this.equipmentList.map((eq) => {
|
||||||
nameData.push(eq.equipmentName);
|
nameData.push(eq.equipmentName);
|
||||||
valueData.push(eq.totalQuantity);
|
inQuantity.push(eq.inQuantity);
|
||||||
|
outQuantity.push(eq.outQuantity);
|
||||||
});
|
});
|
||||||
config.yAxis.data = nameData;
|
config.xAxis.data = nameData;
|
||||||
config.series[0].data = valueData;
|
config.series[0].data = inQuantity;
|
||||||
|
config.series[1].data = outQuantity;
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -270,7 +270,8 @@ export default {
|
|||||||
// { prop: 'externalCode', label: '设备编码' },
|
// { prop: 'externalCode', label: '设备编码' },
|
||||||
{ prop: 'equipmentId', label: '设备编码' },
|
{ prop: 'equipmentId', label: '设备编码' },
|
||||||
{ prop: 'equipmentName', label: '设备名称' },
|
{ prop: 'equipmentName', label: '设备名称' },
|
||||||
{ prop: 'totalQuantity', label: '加工数量[片]' },
|
{ prop: 'inQuantity', label: '投入数量[片]' },
|
||||||
|
{ prop: 'outQuantity', label: '产出数量[片]' },
|
||||||
],
|
],
|
||||||
mode: 'table', // table | graph
|
mode: 'table', // table | graph
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
|||||||
355
src/views/quality/dpdda/defectAnalysis.vue
Normal file
355
src/views/quality/dpdda/defectAnalysis.vue
Normal file
@@ -0,0 +1,355 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
|
||||||
|
@emitFun="handleEmitFun">
|
||||||
|
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" :method-list="tableBtn"
|
||||||
|
@clickBtn="handleTableBtnClick" /> -->
|
||||||
|
</base-table>
|
||||||
|
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList" />
|
||||||
|
|
||||||
|
<!-- 对话框(添加 / 修改) -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
import {
|
||||||
|
getPdList,
|
||||||
|
} from '@/api/core/monitoring/auto';
|
||||||
|
import { getFactoryPage } from '@/api/core/base/factory';
|
||||||
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
import { getDefectAnalysis } from '@/api/monitoring/defectSummary';
|
||||||
|
import * as XLSX from 'xlsx'
|
||||||
|
import FileSaver from 'file-saver'
|
||||||
|
export default {
|
||||||
|
name: 'QualityInspectionType',
|
||||||
|
mixins: [basicPageMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// tableBtn: [
|
||||||
|
// this.$auth.hasPermi('base:quality-inspection-type:update')
|
||||||
|
// ? {
|
||||||
|
// type: 'edit',
|
||||||
|
// btnName: '修改',
|
||||||
|
// }
|
||||||
|
// : undefined,
|
||||||
|
// this.$auth.hasPermi('base:quality-inspection-type:delete')
|
||||||
|
// ? {
|
||||||
|
// type: 'delete',
|
||||||
|
// btnName: '删除',
|
||||||
|
// }
|
||||||
|
// : undefined,
|
||||||
|
// ].filter((v) => v),
|
||||||
|
tableProps: [
|
||||||
|
// {
|
||||||
|
// prop: 'createTime',
|
||||||
|
// label: '添加时间',
|
||||||
|
// fixed: true,
|
||||||
|
// width: 180,
|
||||||
|
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||||
|
// },
|
||||||
|
{ prop: 'factoryName', label: '工厂' },
|
||||||
|
{ prop: 'lineName', label: '产线' },
|
||||||
|
{ prop: 'remark', label: '玻璃编号' },
|
||||||
|
{
|
||||||
|
prop: 'checkTime',
|
||||||
|
label: '检测时间',
|
||||||
|
fixed: true,
|
||||||
|
width: 180,
|
||||||
|
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||||
|
},
|
||||||
|
{ prop: 'checkNum', label: '缺陷数' },
|
||||||
|
{
|
||||||
|
prop: 'glassGrade',
|
||||||
|
label: '等级',
|
||||||
|
filter: (val) => val === 0 ? '合格' : val === 1 ? '提示' : val === 2 ? '返修' : val === 3 ? '报废' : ''
|
||||||
|
},
|
||||||
|
{ prop: 'reason', label: '判等原因' },
|
||||||
|
{ prop: 'specifications', label: '规格' },
|
||||||
|
|
||||||
|
|
||||||
|
// {
|
||||||
|
// label: '操作',
|
||||||
|
// alignt: 'center',
|
||||||
|
// subcomponent: {
|
||||||
|
// render: function (h) {
|
||||||
|
// return h('div', null, [
|
||||||
|
// h(
|
||||||
|
// 'el-button',
|
||||||
|
// {
|
||||||
|
// props: {
|
||||||
|
// icon: 'el-icon-edit',
|
||||||
|
// size: 'mini',
|
||||||
|
// type: 'text',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ' 修改'
|
||||||
|
// ),
|
||||||
|
// h(
|
||||||
|
// 'el-button',
|
||||||
|
// {
|
||||||
|
// props: {
|
||||||
|
// icon: 'el-icon-edit',
|
||||||
|
// size: 'mini',
|
||||||
|
// type: 'text',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ' 修改'
|
||||||
|
// ),
|
||||||
|
// ]);
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
//
|
||||||
|
searchBarFormConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '工厂',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'factoryId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
multiple: true,
|
||||||
|
param: 'lineId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'input',
|
||||||
|
label: '缺陷数>',
|
||||||
|
// selectOptions: [],
|
||||||
|
param: 'checkNum',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间范围',
|
||||||
|
dateType: 'datetimerange',
|
||||||
|
format: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
valueFormat: 'timestamp',
|
||||||
|
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeVal',
|
||||||
|
width: 350,
|
||||||
|
defaultSelect: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: 'button',
|
||||||
|
// btnName: '重置',
|
||||||
|
// name: 'reset',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: 'separate',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: this.$auth.hasPermi('base:quality-inspection-type:create')
|
||||||
|
// ? 'button'
|
||||||
|
// : '',
|
||||||
|
// btnName: '新增',
|
||||||
|
// name: 'add',
|
||||||
|
// plain: true,
|
||||||
|
// color: 'success',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: this.$auth.hasPermi('base:quality-inspection-type:export')
|
||||||
|
? 'button'
|
||||||
|
: '',
|
||||||
|
btnName: '导出',
|
||||||
|
name: 'export',
|
||||||
|
color: 'warning',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// 表单配置
|
||||||
|
// formRows: [
|
||||||
|
// [
|
||||||
|
// {
|
||||||
|
// input: true,
|
||||||
|
// label: '检测类型名称',
|
||||||
|
// prop: 'name',
|
||||||
|
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||||
|
// // bind: {
|
||||||
|
// // disabled: true, // some condition, like detail mode...
|
||||||
|
// // }
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// [{ input: true, label: '检测类型编码', prop: 'code' }],
|
||||||
|
// [{ input: true, label: '备注', prop: 'remark' }],
|
||||||
|
// ],
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
lineId: undefined,
|
||||||
|
factoryId: undefined,
|
||||||
|
checkNum: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// watch: {
|
||||||
|
// form: {
|
||||||
|
// handler: (val) => {
|
||||||
|
// console.log('form changed', val);
|
||||||
|
// },
|
||||||
|
// deep: true
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
mounted() {
|
||||||
|
const { startTimestamp, endTimestamp } = this.getThreeDaysAgoThisTimeToNowTimeStamps();
|
||||||
|
// 找到时间范围的配置项并赋值(对应你代码中的timeVal参数)
|
||||||
|
this.searchBarFormConfig[3].defaultSelect = [startTimestamp, endTimestamp]; // 赋值给日期选择器
|
||||||
|
this.queryParams.startTime = startTimestamp;
|
||||||
|
this.queryParams.endTime = endTimestamp;
|
||||||
|
this.getList();
|
||||||
|
this.getDict()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThreeDaysAgoThisTimeToNowTimeStamps() {
|
||||||
|
const now = new Date();
|
||||||
|
// 1. 计算三天前的当前时刻(使用setDate直接修改日期,保留时分秒等信息)
|
||||||
|
const threeDaysAgoThisTime = new Date(now); // 复制当前日期对象,避免修改原对象
|
||||||
|
threeDaysAgoThisTime.setDate(threeDaysAgoThisTime.getDate() - 3); // 日期减3天,时分秒保持和当前一致
|
||||||
|
|
||||||
|
// 2. 获取时间戳(毫秒级和秒级)
|
||||||
|
// 开始时间戳:三天前的当前时刻
|
||||||
|
const startTimestamp = threeDaysAgoThisTime.getTime(); // 毫秒级
|
||||||
|
const startTimestampSec = Math.floor(startTimestamp / 1000); // 秒级
|
||||||
|
// 结束时间戳:当前时刻
|
||||||
|
const endTimestamp = now.getTime(); // 毫秒级
|
||||||
|
const endTimestampSec = Math.floor(endTimestamp / 1000); // 秒级
|
||||||
|
|
||||||
|
// 封装日期格式化函数,转换为yyyy-MM-dd HH:mm:ss格式
|
||||||
|
const formatDateTime = (date) => {
|
||||||
|
const y = date.getFullYear();
|
||||||
|
// 月份是从0开始的,所以要+1;补零确保是两位
|
||||||
|
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const d = String(date.getDate()).padStart(2, '0');
|
||||||
|
const h = String(date.getHours()).padStart(2, '0');
|
||||||
|
const min = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const s = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${y}-${m}-${d} ${h}:${min}:${s}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 格式化后的字符串:三天前的当前时刻 和 当前时刻
|
||||||
|
const startDateTimeStr = formatDateTime(threeDaysAgoThisTime);
|
||||||
|
const endDateTimeStr = formatDateTime(now);
|
||||||
|
|
||||||
|
return {
|
||||||
|
startTimestamp, // 三天前当前时刻的毫秒级时间戳
|
||||||
|
endTimestamp, // 当前时刻的毫秒级时间戳
|
||||||
|
startTimestampSec, // 三天前当前时刻的秒级时间戳
|
||||||
|
endTimestampSec, // 当前时刻的秒级时间戳
|
||||||
|
startDateTimeStr, // yyyy-MM-dd HH:mm:ss格式的开始时间字符串
|
||||||
|
endDateTimeStr // yyyy-MM-dd HH:mm:ss格式的结束时间字符串
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getDict() {
|
||||||
|
getPdList().then(res => {
|
||||||
|
this.searchBarFormConfig[1].selectOptions = res.data || [];
|
||||||
|
});
|
||||||
|
|
||||||
|
getFactoryPage({ pageSize: 100, pageNo: 1 }).then(res => {
|
||||||
|
this.searchBarFormConfig[0].selectOptions = res.data.list || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** base table related */
|
||||||
|
handleTableBtnClick({ data, type }) {
|
||||||
|
switch (type) {
|
||||||
|
case 'edit':
|
||||||
|
this.handleUpdate(data);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
this.handleDelete(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** search bar related */
|
||||||
|
handleSearchBarBtnClick(btn) {
|
||||||
|
// const keys = ['name'];
|
||||||
|
switch (btn.btnName) {
|
||||||
|
case 'search':
|
||||||
|
this.queryParams.lineId = btn.lineId ? btn.lineId : undefined
|
||||||
|
this.queryParams.factoryId = btn.factoryId ? btn.factoryId : undefined
|
||||||
|
this.queryParams.startTime = btn.timeVal ? btn.timeVal[0] : undefined
|
||||||
|
this.queryParams.endTime = btn.timeVal ? btn.timeVal[1] : undefined
|
||||||
|
this.queryParams.checkNum = btn.checkNum ? btn.checkNum : undefined
|
||||||
|
|
||||||
|
|
||||||
|
// keys.forEach((key) => {
|
||||||
|
// this.queryParams[key] = btn[key] || null;
|
||||||
|
// });
|
||||||
|
this.getList();
|
||||||
|
break;
|
||||||
|
case 'add':
|
||||||
|
this.handleAdd();
|
||||||
|
break;
|
||||||
|
case 'export':
|
||||||
|
this.handleExport();
|
||||||
|
break;
|
||||||
|
// case 'reset':
|
||||||
|
// this.$refs['search-bar'].resetForm();
|
||||||
|
// this.resetQuery();
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 执行查询
|
||||||
|
getDefectAnalysis(this.queryParams).then((response) => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let tables = document.querySelector('.el-table').cloneNode(true)
|
||||||
|
const fix = tables.querySelector('.el-table__fixed')
|
||||||
|
const fixRight = tables.querySelector('.el-table__fixed-right')
|
||||||
|
if (fix) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed'))
|
||||||
|
}
|
||||||
|
if (fixRight) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
|
||||||
|
}
|
||||||
|
let exportTable = XLSX.utils.table_to_book(tables)
|
||||||
|
|
||||||
|
var exportTableOut = XLSX.write(exportTable, {
|
||||||
|
bookType: 'xlsx', bookSST: true, type: 'array'
|
||||||
|
})
|
||||||
|
// sheetjs.xlsx为导出表格的标题名称
|
||||||
|
try {
|
||||||
|
FileSaver.saveAs(new Blob([exportTableOut], {
|
||||||
|
type: 'application/octet-stream'
|
||||||
|
}),'缺陷分析.xlsx')
|
||||||
|
} catch (e) {
|
||||||
|
if (typeof console !== 'undefined') console.log(e, exportTableOut)
|
||||||
|
}
|
||||||
|
return exportTableOut
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
606
src/views/quality/dpdda/defectSummary.vue
Normal file
606
src/views/quality/dpdda/defectSummary.vue
Normal file
@@ -0,0 +1,606 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
|
||||||
|
@emitFun="handleEmitFun">
|
||||||
|
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" :method-list="tableBtn"
|
||||||
|
@clickBtn="handleTableBtnClick" />
|
||||||
|
</base-table>
|
||||||
|
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList" />
|
||||||
|
<div v-if="chartData" class="charts-container">
|
||||||
|
<div v-for="(lineData, lineName) in chartData" :key="lineName" class="chart-wrapper">
|
||||||
|
<div class="blue-block"></div>
|
||||||
|
<h3 class="chart-title">{{ lineName }}</h3>
|
||||||
|
<div :id="`chart-${lineName}`" class="chart" style="width: 100%; height: 300px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<defect-summary-det ref="defectSummaryDetRef" v-if="defectVis" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
import {
|
||||||
|
getPdList,
|
||||||
|
} from '@/api/core/monitoring/auto';
|
||||||
|
import { getFactoryPage } from '@/api/core/base/factory';
|
||||||
|
import { getDefectSummaryTable, getDefectSummaryChart } from '@/api/monitoring/defectSummary';
|
||||||
|
import * as echarts from 'echarts';
|
||||||
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
import defectSummaryDet from './defectSummaryDet.vue'
|
||||||
|
export default {
|
||||||
|
name: 'QualityInspectionType',
|
||||||
|
mixins: [basicPageMixin],
|
||||||
|
components: {
|
||||||
|
defectSummaryDet
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableBtn: [
|
||||||
|
this.$auth.hasPermi('base:quality-inspection-type:update')
|
||||||
|
? {
|
||||||
|
type: 'detail',
|
||||||
|
btnName: '缺陷详情',
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
|
// this.$auth.hasPermi('base:quality-inspection-type:delete')
|
||||||
|
// ? {
|
||||||
|
// type: 'delete',
|
||||||
|
// btnName: '删除',
|
||||||
|
// }
|
||||||
|
// : undefined,
|
||||||
|
].filter((v) => v),
|
||||||
|
tableProps: [
|
||||||
|
// {
|
||||||
|
// prop: 'createTime',
|
||||||
|
// label: '添加时间',
|
||||||
|
// fixed: true,
|
||||||
|
// width: 180,
|
||||||
|
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||||
|
// },
|
||||||
|
{ prop: 'factoryName', label: '工厂' },
|
||||||
|
{ prop: 'lineName', label: '产线' },
|
||||||
|
{ prop: 'glassNum', label: '玻璃总数' },
|
||||||
|
{
|
||||||
|
prop: 'okNum',
|
||||||
|
label: '合格品数',
|
||||||
|
},
|
||||||
|
{ prop: 'okRate', label: '合格百分比' },
|
||||||
|
{ prop: 'repairNum', label: '返修品数' },
|
||||||
|
{ prop: 'repairRate', label: '返修百分比' },
|
||||||
|
{ prop: 'ngNum', label: '废片数' },
|
||||||
|
{ prop: 'ngRate', label: '废片百分比' },
|
||||||
|
{ prop: 'oneNgNum', label: '1类缺陷玻璃数量' },
|
||||||
|
{ prop: 'twoNgNum', label: '2类缺陷玻璃数量' },
|
||||||
|
{ prop: 'threeNgNum', label: '3类缺陷玻璃数量' },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// {
|
||||||
|
// label: '操作',
|
||||||
|
// alignt: 'center',
|
||||||
|
// subcomponent: {
|
||||||
|
// render: function (h) {
|
||||||
|
// return h('div', null, [
|
||||||
|
// h(
|
||||||
|
// 'el-button',
|
||||||
|
// {
|
||||||
|
// props: {
|
||||||
|
// icon: 'el-icon-edit',
|
||||||
|
// size: 'mini',
|
||||||
|
// type: 'text',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ' 修改'
|
||||||
|
// ),
|
||||||
|
// h(
|
||||||
|
// 'el-button',
|
||||||
|
// {
|
||||||
|
// props: {
|
||||||
|
// icon: 'el-icon-edit',
|
||||||
|
// size: 'mini',
|
||||||
|
// type: 'text',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ' 修改'
|
||||||
|
// ),
|
||||||
|
// ]);
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
//
|
||||||
|
searchBarFormConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '工厂',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'factoryId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
multiple: true,
|
||||||
|
param: 'lineId',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: 'input',
|
||||||
|
// label: '缺陷数>',
|
||||||
|
// // selectOptions: [],
|
||||||
|
// param: 'number',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间范围',
|
||||||
|
dateType: 'datetimerange',
|
||||||
|
format: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
valueFormat: 'timestamp',
|
||||||
|
defaultTime: ['00:00:00', '23:59:59'],
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeVal',
|
||||||
|
width: 350,
|
||||||
|
defaultSelect: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: 'button',
|
||||||
|
// btnName: '重置',
|
||||||
|
// name: 'reset',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: 'separate',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: this.$auth.hasPermi('base:quality-inspection-type:create')
|
||||||
|
// ? 'button'
|
||||||
|
// : '',
|
||||||
|
// btnName: '新增',
|
||||||
|
// name: 'add',
|
||||||
|
// plain: true,
|
||||||
|
// color: 'success',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: this.$auth.hasPermi('base:quality-inspection-type:export')
|
||||||
|
? 'button'
|
||||||
|
: '',
|
||||||
|
btnName: '导出',
|
||||||
|
name: 'export',
|
||||||
|
color: 'warning',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// 表单配置
|
||||||
|
// formRows: [
|
||||||
|
// [
|
||||||
|
// {
|
||||||
|
// input: true,
|
||||||
|
// label: '检测类型名称',
|
||||||
|
// prop: 'name',
|
||||||
|
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||||
|
// // bind: {
|
||||||
|
// // disabled: true, // some condition, like detail mode...
|
||||||
|
// // }
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// [{ input: true, label: '检测类型编码', prop: 'code' }],
|
||||||
|
// [{ input: true, label: '备注', prop: 'remark' }],
|
||||||
|
// ],
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
chartData: {},
|
||||||
|
charts: {},
|
||||||
|
defectVis:false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
lineId: undefined,
|
||||||
|
factoryId: undefined,
|
||||||
|
checkNum: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// watch: {
|
||||||
|
// form: {
|
||||||
|
// handler: (val) => {
|
||||||
|
// console.log('form changed', val);
|
||||||
|
// },
|
||||||
|
// deep: true
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
const { startTimestamp, endTimestamp } = this.getThreeDaysAgoThisTimeToNowTimeStamps();
|
||||||
|
// 找到时间范围的配置项并赋值(对应你代码中的timeVal参数)
|
||||||
|
this.searchBarFormConfig[2].defaultSelect = [startTimestamp, endTimestamp]; // 赋值给日期选择器
|
||||||
|
this.queryParams.startTime = startTimestamp;
|
||||||
|
this.queryParams.endTime = endTimestamp;
|
||||||
|
this.getList();
|
||||||
|
this.getDict()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThreeDaysAgoThisTimeToNowTimeStamps() {
|
||||||
|
const now = new Date();
|
||||||
|
// 1. 计算三天前的当前时刻(使用setDate直接修改日期,保留时分秒等信息)
|
||||||
|
const threeDaysAgoThisTime = new Date(now); // 复制当前日期对象,避免修改原对象
|
||||||
|
threeDaysAgoThisTime.setDate(threeDaysAgoThisTime.getDate() - 3); // 日期减3天,时分秒保持和当前一致
|
||||||
|
|
||||||
|
// 2. 获取时间戳(毫秒级和秒级)
|
||||||
|
// 开始时间戳:三天前的当前时刻
|
||||||
|
const startTimestamp = threeDaysAgoThisTime.getTime(); // 毫秒级
|
||||||
|
const startTimestampSec = Math.floor(startTimestamp / 1000); // 秒级
|
||||||
|
// 结束时间戳:当前时刻
|
||||||
|
const endTimestamp = now.getTime(); // 毫秒级
|
||||||
|
const endTimestampSec = Math.floor(endTimestamp / 1000); // 秒级
|
||||||
|
|
||||||
|
// 封装日期格式化函数,转换为yyyy-MM-dd HH:mm:ss格式
|
||||||
|
const formatDateTime = (date) => {
|
||||||
|
const y = date.getFullYear();
|
||||||
|
// 月份是从0开始的,所以要+1;补零确保是两位
|
||||||
|
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const d = String(date.getDate()).padStart(2, '0');
|
||||||
|
const h = String(date.getHours()).padStart(2, '0');
|
||||||
|
const min = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const s = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${y}-${m}-${d} ${h}:${min}:${s}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 格式化后的字符串:三天前的当前时刻 和 当前时刻
|
||||||
|
const startDateTimeStr = formatDateTime(threeDaysAgoThisTime);
|
||||||
|
const endDateTimeStr = formatDateTime(now);
|
||||||
|
|
||||||
|
return {
|
||||||
|
startTimestamp, // 三天前当前时刻的毫秒级时间戳
|
||||||
|
endTimestamp, // 当前时刻的毫秒级时间戳
|
||||||
|
startTimestampSec, // 三天前当前时刻的秒级时间戳
|
||||||
|
endTimestampSec, // 当前时刻的秒级时间戳
|
||||||
|
startDateTimeStr, // yyyy-MM-dd HH:mm:ss格式的开始时间字符串
|
||||||
|
endDateTimeStr // yyyy-MM-dd HH:mm:ss格式的结束时间字符串
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getDict() {
|
||||||
|
getPdList().then(res => {
|
||||||
|
this.searchBarFormConfig[1].selectOptions = res.data || [];
|
||||||
|
});
|
||||||
|
|
||||||
|
getFactoryPage({ pageSize: 100, pageNo: 1 }).then(res => {
|
||||||
|
this.searchBarFormConfig[0].selectOptions = res.data.list || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** base table related */
|
||||||
|
handleTableBtnClick({ data, type }) {
|
||||||
|
switch (type) {
|
||||||
|
case 'detail':
|
||||||
|
this.defectVis = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.defectSummaryDetRef.init({
|
||||||
|
factoryId:data.factoryId,
|
||||||
|
lineId: [data.lineId],
|
||||||
|
factoryName: data.factoryName,
|
||||||
|
lineName: data.lineName,
|
||||||
|
startTime: this.queryParams.startTime,
|
||||||
|
endTime: this.queryParams.endTime,
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
this.handleDelete(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// 销毁所有 ECharts 实例
|
||||||
|
Object.values(this.charts).forEach(chart => {
|
||||||
|
if (chart && chart.dispose) {
|
||||||
|
chart.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.charts = {};
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 初始化单个图表
|
||||||
|
* @param {string} lineName - 产线名称
|
||||||
|
* @param {Array} lineData - 该产线的原始数据
|
||||||
|
*/
|
||||||
|
initSingleChart(lineName, lineData) {
|
||||||
|
// 如果已有实例,先销毁
|
||||||
|
if (this.charts[lineName]) {
|
||||||
|
this.charts[lineName].dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
const chartDom = document.getElementById(`chart-${lineName}`);
|
||||||
|
if (!chartDom || !lineData || lineData.length === 0) {
|
||||||
|
console.warn(`图表容器 chart-${lineName} 未找到或数据为空`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const myChart = echarts.init(chartDom);
|
||||||
|
|
||||||
|
// --- 动态处理数据逻辑 ---
|
||||||
|
const startTime = this.queryParams.startTime;
|
||||||
|
const endTime = this.queryParams.endTime;
|
||||||
|
|
||||||
|
if (!startTime || !endTime) {
|
||||||
|
console.error("起始时间或结束时间为空,无法计算时间差。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const durationDays = (endTime - startTime) / (1000 * 60 * 60 * 24);
|
||||||
|
const isHourly = durationDays < 7;
|
||||||
|
|
||||||
|
// 使用Map来保证顺序,并能存储聚合后的数据和原始显示标签
|
||||||
|
const aggregatedMap = new Map();
|
||||||
|
|
||||||
|
lineData.forEach(item => {
|
||||||
|
let groupKey; // 用于分组的键
|
||||||
|
let displayLabel; // 用于显示的标签
|
||||||
|
|
||||||
|
if (isHourly) {
|
||||||
|
// --- 方法一:使用字符串分割 ---
|
||||||
|
const timePart = item.timePoint.split('T')[1];
|
||||||
|
groupKey = timePart ? timePart : item.timePoint; // 安全处理
|
||||||
|
|
||||||
|
displayLabel = item.timePoint.replace('T', ' ');
|
||||||
|
} else {
|
||||||
|
// 按天聚合:分组键和显示标签都到天
|
||||||
|
groupKey = item.timePoint.split('T')[0];
|
||||||
|
displayLabel = groupKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aggregatedMap.has(groupKey)) {
|
||||||
|
aggregatedMap.set(groupKey, {
|
||||||
|
displayLabel: displayLabel,
|
||||||
|
okNum: 0,
|
||||||
|
repairNum: 0,
|
||||||
|
ngNum: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const aggregatedItem = aggregatedMap.get(groupKey);
|
||||||
|
aggregatedItem.okNum += item.okNum || 0;
|
||||||
|
aggregatedItem.repairNum += item.repairNum || 0;
|
||||||
|
aggregatedItem.ngNum += item.ngNum || 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 准备 ECharts 所需的数据格式
|
||||||
|
const xAxisData = [];
|
||||||
|
const okNumData = [];
|
||||||
|
const repairNumData = [];
|
||||||
|
const ngNumData = [];
|
||||||
|
|
||||||
|
aggregatedMap.forEach(item => {
|
||||||
|
xAxisData.push(item.displayLabel);
|
||||||
|
okNumData.push(item.okNum);
|
||||||
|
repairNumData.push(item.repairNum);
|
||||||
|
ngNumData.push(item.ngNum);
|
||||||
|
});
|
||||||
|
|
||||||
|
// --- ECharts 配置项 ---
|
||||||
|
const option = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: { type: 'cross' },
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: ['合格品数', '返修品数', '废片数'],
|
||||||
|
itemHeight: 2,
|
||||||
|
itemWidth: 20,
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '3%',
|
||||||
|
right: '4%',
|
||||||
|
bottom: '20%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
boundaryGap: false,
|
||||||
|
data: xAxisData,
|
||||||
|
axisLabel: {
|
||||||
|
rotate: 45,
|
||||||
|
interval: 0, // 强制显示所有标签
|
||||||
|
formatter: function (value) {
|
||||||
|
if (isHourly) {
|
||||||
|
// 从 "2025-10-30 00:00" 中提取 "00:00" 进行显示
|
||||||
|
return value.split(' ')[1];
|
||||||
|
} else {
|
||||||
|
// 天级别,显示 "MM-DD"
|
||||||
|
const dateParts = value.split('-');
|
||||||
|
return `${dateParts[1]}-${dateParts[2]}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
min: 0
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '合格品数',
|
||||||
|
type: 'line',
|
||||||
|
showSymbol: false,
|
||||||
|
data: okNumData,
|
||||||
|
itemStyle: { color: 'rgba(40, 138, 255, 1)' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '返修品数',
|
||||||
|
type: 'line',
|
||||||
|
showSymbol: false,
|
||||||
|
data: repairNumData,
|
||||||
|
itemStyle: { color: 'rgba(115, 222, 147, 1)' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '废片数',
|
||||||
|
type: 'line',
|
||||||
|
showSymbol: false,
|
||||||
|
data: ngNumData,
|
||||||
|
itemStyle: { color: 'rgba(255, 206, 106, 1)' },
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
myChart.setOption(option);
|
||||||
|
this.charts[lineName] = myChart;
|
||||||
|
|
||||||
|
// 监听容器大小变化
|
||||||
|
const resizeObserver = new ResizeObserver(() => {
|
||||||
|
myChart.resize();
|
||||||
|
});
|
||||||
|
resizeObserver.observe(chartDom);
|
||||||
|
myChart._resizeObserver = resizeObserver;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据获取到的 chartData 更新所有图表
|
||||||
|
*/
|
||||||
|
updateAllCharts() {
|
||||||
|
if (!this.chartData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用 nextTick 确保 v-for 生成的 DOM 已存在
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const lineNames = Object.keys(this.chartData);
|
||||||
|
lineNames.forEach(lineName => {
|
||||||
|
this.initSingleChart(lineName, this.chartData[lineName]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** search bar related */
|
||||||
|
handleSearchBarBtnClick(btn) {
|
||||||
|
switch (btn.btnName) {
|
||||||
|
case 'search':
|
||||||
|
this.queryParams.lineId = btn.lineId ? btn.lineId : undefined
|
||||||
|
this.queryParams.factoryId = btn.factoryId ? btn.factoryId : undefined
|
||||||
|
this.queryParams.startTime = btn.timeVal ? btn.timeVal[0] : undefined
|
||||||
|
this.queryParams.endTime = btn.timeVal ? btn.timeVal[1] : undefined
|
||||||
|
this.getList();
|
||||||
|
break;
|
||||||
|
case 'add':
|
||||||
|
this.handleAdd();
|
||||||
|
break;
|
||||||
|
case 'export':
|
||||||
|
this.handleExport();
|
||||||
|
break;
|
||||||
|
// case 'reset':
|
||||||
|
// this.$refs['search-bar'].resetForm();
|
||||||
|
// this.resetQuery();
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 执行查询
|
||||||
|
getDefectSummaryTable(this.queryParams).then((response) => {
|
||||||
|
this.list = response.data;
|
||||||
|
// this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
getDefectSummaryChart(this.queryParams).then((res) => {
|
||||||
|
console.log('res.data', res.data);
|
||||||
|
|
||||||
|
this.chartData = res.data || {};
|
||||||
|
// 手动调用更新图表的方法
|
||||||
|
this.updateAllCharts();
|
||||||
|
// // this.total = response.data.total;
|
||||||
|
// this.loading = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
name: undefined,
|
||||||
|
code: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
};
|
||||||
|
this.resetForm('form');
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let tables = document.querySelector('.el-table').cloneNode(true)
|
||||||
|
const fix = tables.querySelector('.el-table__fixed')
|
||||||
|
const fixRight = tables.querySelector('.el-table__fixed-right')
|
||||||
|
if (fix) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed'))
|
||||||
|
}
|
||||||
|
if (fixRight) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
|
||||||
|
}
|
||||||
|
let exportTable = XLSX.utils.table_to_book(tables)
|
||||||
|
|
||||||
|
var exportTableOut = XLSX.write(exportTable, {
|
||||||
|
bookType: 'xlsx', bookSST: true, type: 'array'
|
||||||
|
})
|
||||||
|
// sheetjs.xlsx为导出表格的标题名称
|
||||||
|
try {
|
||||||
|
FileSaver.saveAs(new Blob([exportTableOut], {
|
||||||
|
type: 'application/octet-stream'
|
||||||
|
}), '缺陷汇总.xlsx')
|
||||||
|
} catch (e) {
|
||||||
|
if (typeof console !== 'undefined') console.log(e, exportTableOut)
|
||||||
|
}
|
||||||
|
return exportTableOut
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.charts-container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-wrapper {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 300px;
|
||||||
|
margin-top: 10px;
|
||||||
|
/* 最小宽度,防止缩得太小 */
|
||||||
|
/* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 4px; */
|
||||||
|
/* padding: 10px; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.blue-block {
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
width: 4px;
|
||||||
|
height: 16px;
|
||||||
|
background-color: #0B58FF;
|
||||||
|
border-radius: 1px;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-title {
|
||||||
|
text-align: left;
|
||||||
|
color: #333;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
224
src/views/quality/dpdda/defectSummaryDet.vue
Normal file
224
src/views/quality/dpdda/defectSummaryDet.vue
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-drawer title="详情" :visible.sync="visible" size="70%" @close='closeD'>
|
||||||
|
<div class="box">
|
||||||
|
<!-- 顶部信息展示区域 -->
|
||||||
|
<div class="info-header">
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="label">工厂:</span>
|
||||||
|
<span class="value">{{ factoryName }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="label">产线:</span>
|
||||||
|
<span class="value">{{ lineName }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="label">时间范围:</span>
|
||||||
|
<span class="value">{{ timeRange }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<el-button type="primary" @click="handleExport">导出</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 表格 -->
|
||||||
|
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps"
|
||||||
|
:table-data="tableData" :span-method="spanMethod" :max-height="tableH">
|
||||||
|
</base-table>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import moment from 'moment';
|
||||||
|
import * as XLSX from 'xlsx';
|
||||||
|
import { getDefectSummaryDet } from '@/api/monitoring/defectSummary';
|
||||||
|
// import { publicFormatter } from '@/utils/dict'
|
||||||
|
|
||||||
|
const tableProps = [
|
||||||
|
{ prop: 'defectLevel', label: '缺陷等级' },
|
||||||
|
{ prop: 'defectName', label: '缺陷类型' },
|
||||||
|
{ prop: 'defectNum', label: '玻璃数量' }
|
||||||
|
]
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'EnergyStatisticsDet',
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
tableProps,
|
||||||
|
tableData: [],
|
||||||
|
tableBtn: [],
|
||||||
|
tableH: this.tableHeight(115),
|
||||||
|
total: 0,
|
||||||
|
queryParams: { pageNo: 1, pageSize: 30 },
|
||||||
|
factoryName: '',
|
||||||
|
lineName: '',
|
||||||
|
timeRange: '',
|
||||||
|
name: '',
|
||||||
|
energyType: '',
|
||||||
|
energyTypeId: '',
|
||||||
|
addOrEditTitle: "",
|
||||||
|
centervisible: false,
|
||||||
|
collectionList: [
|
||||||
|
{ value: 0, label: '否' },
|
||||||
|
{ value: 1, label: '是' }
|
||||||
|
],
|
||||||
|
showBtn: true,
|
||||||
|
selectedList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
this.tableH = this.tableHeight(115)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
spanMethod({ row, column, rowIndex, columnIndex }) {
|
||||||
|
const fields = ['defectLevel']
|
||||||
|
const cellValue = row[column.property]
|
||||||
|
if (cellValue && fields.includes(column.property)) {
|
||||||
|
const prevRow = this.tableData[rowIndex - 1]
|
||||||
|
let nextRow = this.tableData[rowIndex + 1]
|
||||||
|
if (prevRow && prevRow[column.property] === cellValue) {
|
||||||
|
return { rowspan: 0, colspan: 0 }
|
||||||
|
} else {
|
||||||
|
let countRowspan = 1
|
||||||
|
while (nextRow && nextRow[column.property] === cellValue) {
|
||||||
|
nextRow = this.tableData[++countRowspan + rowIndex]
|
||||||
|
}
|
||||||
|
if (countRowspan > 1) {
|
||||||
|
return { rowspan: countRowspan, colspan: 1 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
init(data) {
|
||||||
|
this.visible = true;
|
||||||
|
this.factoryName = data.factoryName || '未知工厂';
|
||||||
|
this.lineName = data.lineName || '未知产线';
|
||||||
|
|
||||||
|
if (data.startTime && data.endTime) {
|
||||||
|
const start = moment(data.startTime).format('yyyy-MM-DD HH:mm:ss');
|
||||||
|
const end = moment(data.endTime).format('yyyy-MM-DD HH:mm:ss');
|
||||||
|
this.timeRange = `${start} - ${end}`;
|
||||||
|
} else {
|
||||||
|
this.timeRange = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.queryParams.factoryId = data.factoryId;
|
||||||
|
this.queryParams.lineId = data.lineId;
|
||||||
|
this.queryParams.startTime = data.startTime;
|
||||||
|
this.queryParams.endTime = data.endTime;
|
||||||
|
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
|
||||||
|
getList() {
|
||||||
|
getDefectSummaryDet({ ...this.queryParams }).then((res) => {
|
||||||
|
this.tableData = res.data || [];
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
closeD() {
|
||||||
|
this.$emit('closeDrawer');
|
||||||
|
},
|
||||||
|
|
||||||
|
closeDet() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
|
||||||
|
// --- 重写的导出方法 ---
|
||||||
|
// --- 修改后的导出方法 ---
|
||||||
|
handleExport() {
|
||||||
|
console.log("开始执行导出...");
|
||||||
|
this.$modal.confirm('确定要导出表格数据吗?').then(() => {
|
||||||
|
console.log("用户确认导出");
|
||||||
|
|
||||||
|
// 1. 准备数据
|
||||||
|
console.log("tableProps:", this.tableProps);
|
||||||
|
console.log("tableData:", this.tableData);
|
||||||
|
|
||||||
|
// 1.1 准备表头 (新增了 '工厂', '产线', '时间范围')
|
||||||
|
const headers = ['工厂', '产线', '时间范围', ...this.tableProps.map(prop => prop.label)];
|
||||||
|
console.log("生成的表头:", headers);
|
||||||
|
|
||||||
|
// 1.2 准备表格数据
|
||||||
|
const exportData = [];
|
||||||
|
this.tableData.forEach((row) => {
|
||||||
|
const newRow = [];
|
||||||
|
// 先添加顶部信息列
|
||||||
|
newRow.push(this.factoryName);
|
||||||
|
newRow.push(this.lineName);
|
||||||
|
newRow.push(this.timeRange);
|
||||||
|
|
||||||
|
// 再添加表格数据列
|
||||||
|
this.tableProps.forEach((prop) => {
|
||||||
|
// 直接填入所有数据,不再对 defectLevel 进行合并判断
|
||||||
|
newRow.push(row[prop.prop] !== undefined ? row[prop.prop] : '');
|
||||||
|
});
|
||||||
|
exportData.push(newRow);
|
||||||
|
});
|
||||||
|
console.log("处理后的数据:", exportData);
|
||||||
|
|
||||||
|
// 2. 创建工作簿和工作表
|
||||||
|
try {
|
||||||
|
const worksheet = XLSX.utils.aoa_to_sheet([headers, ...exportData]);
|
||||||
|
console.log("工作表创建成功");
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, '缺陷详情数据');
|
||||||
|
console.log("工作簿创建成功");
|
||||||
|
|
||||||
|
// 3. 触发下载
|
||||||
|
const fileName = `${this.factoryName}-${this.lineName}-缺陷汇总详情-${moment().format('YYYYMMDDHHmmss')}.xlsx`;
|
||||||
|
console.log("准备下载文件:", fileName);
|
||||||
|
XLSX.writeFile(workbook, fileName);
|
||||||
|
console.log("下载触发成功");
|
||||||
|
} catch (error) {
|
||||||
|
console.error("生成Excel文件时出错:", error);
|
||||||
|
this.$modal.msgError('导出失败,生成文件时出错!');
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch((error) => {
|
||||||
|
console.log("用户取消导出或发生错误:", error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.box {
|
||||||
|
padding: 0 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-header {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-around;
|
||||||
|
padding: 16px 0;
|
||||||
|
border-bottom: 1px solid #ebeef5;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
.info-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-right: 32px;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
|
||||||
|
.label {
|
||||||
|
color: #606266;
|
||||||
|
margin-right: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
462
src/views/quality/dpdda/sectionDefect.vue
Normal file
462
src/views/quality/dpdda/sectionDefect.vue
Normal file
@@ -0,0 +1,462 @@
|
|||||||
|
<template>
|
||||||
|
<div style="background: #f2f4f9; flex: 1; display: flex; flex-direction: column">
|
||||||
|
<el-row class="" style="
|
||||||
|
margin-bottom: 12px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 16px 16px 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
">
|
||||||
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||||
|
<base-table :max-height="tableH" :table-props="tableProps" :page="queryParams.pageNo"
|
||||||
|
:limit="queryParams.pageSize" :table-data="list" @emitFun="handleEmitFun" />
|
||||||
|
</el-row>
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
|
||||||
|
<!-- 用一个 div 包裹表格和图表,并使用 flex 布局 -->
|
||||||
|
<el-row class="" style="
|
||||||
|
height: 1px;
|
||||||
|
flex: 1;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 16px 16px 32px;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="24">
|
||||||
|
<div id="chart" style="width: 100%; height: 300px;"></div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getPdList,
|
||||||
|
} from '@/api/core/monitoring/auto';
|
||||||
|
import { getFactoryPage } from '@/api/core/base/factory';
|
||||||
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
import { getSectionDefect } from '@/api/monitoring/defectSummary';
|
||||||
|
import * as echarts from 'echarts';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
|
export default {
|
||||||
|
name: 'QualityInspectionType',
|
||||||
|
mixins: [basicPageMixin, tableHeightMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableBtn: [
|
||||||
|
this.$auth.hasPermi('base:quality-inspection-type:update')
|
||||||
|
? {
|
||||||
|
type: 'edit',
|
||||||
|
btnName: '修改',
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
|
this.$auth.hasPermi('base:quality-inspection-type:delete')
|
||||||
|
? {
|
||||||
|
type: 'delete',
|
||||||
|
btnName: '删除',
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
|
].filter((v) => v),
|
||||||
|
tableProps: [
|
||||||
|
// {
|
||||||
|
// prop: 'createTime',
|
||||||
|
// label: '添加时间',
|
||||||
|
// fixed: true,
|
||||||
|
// width: 180,
|
||||||
|
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||||
|
// },
|
||||||
|
{ prop: 'factoryName', label: '工厂' },
|
||||||
|
{ prop: 'lineName', label: '产线' },
|
||||||
|
{ prop: 'checkCount', label: '检测片数' },
|
||||||
|
{
|
||||||
|
prop: 'ngCount',
|
||||||
|
label: '不良合计',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'ngRate',
|
||||||
|
label: '不良率',
|
||||||
|
},
|
||||||
|
{ prop: 'originalNgCount', label: '原片不良' },
|
||||||
|
{ prop: 'edgeNgCount', label: '磨边不良' },
|
||||||
|
{ prop: 'silkNgCount', label: '丝印不良' },
|
||||||
|
{ prop: 'drillNgCount', label: '打孔不良' },
|
||||||
|
{ prop: 'coatingNgCount', label: '镀膜不良' },
|
||||||
|
{ prop: 'packNgCount', label: '钢包不良' },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// {
|
||||||
|
// label: '操作',
|
||||||
|
// alignt: 'center',
|
||||||
|
// subcomponent: {
|
||||||
|
// render: function (h) {
|
||||||
|
// return h('div', null, [
|
||||||
|
// h(
|
||||||
|
// 'el-button',
|
||||||
|
// {
|
||||||
|
// props: {
|
||||||
|
// icon: 'el-icon-edit',
|
||||||
|
// size: 'mini',
|
||||||
|
// type: 'text',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ' 修改'
|
||||||
|
// ),
|
||||||
|
// h(
|
||||||
|
// 'el-button',
|
||||||
|
// {
|
||||||
|
// props: {
|
||||||
|
// icon: 'el-icon-edit',
|
||||||
|
// size: 'mini',
|
||||||
|
// type: 'text',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ' 修改'
|
||||||
|
// ),
|
||||||
|
// ]);
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
//
|
||||||
|
searchBarFormConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '工厂',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'factoryId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
multiple: true,
|
||||||
|
param: 'lineId',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: 'input',
|
||||||
|
// label: '缺陷数>',
|
||||||
|
// // selectOptions: [],
|
||||||
|
// param: 'number',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间范围',
|
||||||
|
dateType: 'datetimerange',
|
||||||
|
format: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
valueFormat: 'timestamp',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeVal',
|
||||||
|
width: 350,
|
||||||
|
defaultSelect: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: 'button',
|
||||||
|
// btnName: '重置',
|
||||||
|
// name: 'reset',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: 'separate',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: this.$auth.hasPermi('base:quality-inspection-type:create')
|
||||||
|
// ? 'button'
|
||||||
|
// : '',
|
||||||
|
// btnName: '新增',
|
||||||
|
// name: 'add',
|
||||||
|
// plain: true,
|
||||||
|
// color: 'success',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: this.$auth.hasPermi('base:quality-inspection-type:export')
|
||||||
|
? 'button'
|
||||||
|
: '',
|
||||||
|
btnName: '导出',
|
||||||
|
name: 'export',
|
||||||
|
color: 'warning',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// 表单配置
|
||||||
|
// formRows: [
|
||||||
|
// [
|
||||||
|
// {
|
||||||
|
// input: true,
|
||||||
|
// label: '检测类型名称',
|
||||||
|
// prop: 'name',
|
||||||
|
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||||
|
// // bind: {
|
||||||
|
// // disabled: true, // some condition, like detail mode...
|
||||||
|
// // }
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// [{ input: true, label: '检测类型编码', prop: 'code' }],
|
||||||
|
// [{ input: true, label: '备注', prop: 'remark' }],
|
||||||
|
// ],
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
lineId: undefined,
|
||||||
|
factoryId: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// watch: {
|
||||||
|
// form: {
|
||||||
|
// handler: (val) => {
|
||||||
|
// console.log('form changed', val);
|
||||||
|
// },
|
||||||
|
// deep: true
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
const { startTimestamp, endTimestamp } = this.getThreeDaysAgoThisTimeToNowTimeStamps();
|
||||||
|
// 找到时间范围的配置项并赋值(对应你代码中的timeVal参数)
|
||||||
|
this.searchBarFormConfig[2].defaultSelect = [startTimestamp, endTimestamp]; // 赋值给日期选择器
|
||||||
|
this.queryParams.startTime = startTimestamp;
|
||||||
|
this.queryParams.endTime = endTimestamp;
|
||||||
|
this.getList();
|
||||||
|
this.getDict()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThreeDaysAgoThisTimeToNowTimeStamps() {
|
||||||
|
const now = new Date();
|
||||||
|
// 1. 计算三天前的当前时刻(使用setDate直接修改日期,保留时分秒等信息)
|
||||||
|
const threeDaysAgoThisTime = new Date(now); // 复制当前日期对象,避免修改原对象
|
||||||
|
threeDaysAgoThisTime.setDate(threeDaysAgoThisTime.getDate() - 3); // 日期减3天,时分秒保持和当前一致
|
||||||
|
|
||||||
|
// 2. 获取时间戳(毫秒级和秒级)
|
||||||
|
// 开始时间戳:三天前的当前时刻
|
||||||
|
const startTimestamp = threeDaysAgoThisTime.getTime(); // 毫秒级
|
||||||
|
const startTimestampSec = Math.floor(startTimestamp / 1000); // 秒级
|
||||||
|
// 结束时间戳:当前时刻
|
||||||
|
const endTimestamp = now.getTime(); // 毫秒级
|
||||||
|
const endTimestampSec = Math.floor(endTimestamp / 1000); // 秒级
|
||||||
|
|
||||||
|
// 封装日期格式化函数,转换为yyyy-MM-dd HH:mm:ss格式
|
||||||
|
const formatDateTime = (date) => {
|
||||||
|
const y = date.getFullYear();
|
||||||
|
// 月份是从0开始的,所以要+1;补零确保是两位
|
||||||
|
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const d = String(date.getDate()).padStart(2, '0');
|
||||||
|
const h = String(date.getHours()).padStart(2, '0');
|
||||||
|
const min = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const s = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${y}-${m}-${d} ${h}:${min}:${s}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 格式化后的字符串:三天前的当前时刻 和 当前时刻
|
||||||
|
const startDateTimeStr = formatDateTime(threeDaysAgoThisTime);
|
||||||
|
const endDateTimeStr = formatDateTime(now);
|
||||||
|
|
||||||
|
return {
|
||||||
|
startTimestamp, // 三天前当前时刻的毫秒级时间戳
|
||||||
|
endTimestamp, // 当前时刻的毫秒级时间戳
|
||||||
|
startTimestampSec, // 三天前当前时刻的秒级时间戳
|
||||||
|
endTimestampSec, // 当前时刻的秒级时间戳
|
||||||
|
startDateTimeStr, // yyyy-MM-dd HH:mm:ss格式的开始时间字符串
|
||||||
|
endDateTimeStr // yyyy-MM-dd HH:mm:ss格式的结束时间字符串
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getDict() {
|
||||||
|
getPdList().then(res => {
|
||||||
|
this.searchBarFormConfig[1].selectOptions = res.data || [];
|
||||||
|
});
|
||||||
|
|
||||||
|
getFactoryPage({ pageSize: 100, pageNo: 1 }).then(res => {
|
||||||
|
this.searchBarFormConfig[0].selectOptions = res.data.list || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** base table related */
|
||||||
|
handleTableBtnClick({ data, type }) {
|
||||||
|
switch (type) {
|
||||||
|
case 'edit':
|
||||||
|
this.handleUpdate(data);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
this.handleDelete(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** search bar related */
|
||||||
|
handleSearchBarBtnClick(btn) {
|
||||||
|
switch (btn.btnName) {
|
||||||
|
case 'search':
|
||||||
|
this.queryParams.lineId = btn.lineId ? btn.lineId : undefined
|
||||||
|
this.queryParams.factoryId = btn.factoryId ? btn.factoryId : undefined
|
||||||
|
this.queryParams.startTime = btn.timeVal ? btn.timeVal[0] : undefined
|
||||||
|
this.queryParams.endTime = btn.timeVal ? btn.timeVal[1] : undefined
|
||||||
|
this.getList();
|
||||||
|
break;
|
||||||
|
case 'add':
|
||||||
|
this.handleAdd();
|
||||||
|
break;
|
||||||
|
case 'export':
|
||||||
|
this.handleExport();
|
||||||
|
break;
|
||||||
|
case 'reset':
|
||||||
|
this.$refs['search-bar'].resetForm();
|
||||||
|
this.resetQuery();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 执行查询
|
||||||
|
getSectionDefect(this.queryParams).then((response) => {
|
||||||
|
this.list = response.data;
|
||||||
|
// 定义颜色数组,与你提供的顺序一致
|
||||||
|
const colors = [
|
||||||
|
'rgba(99, 189, 255, 1)',
|
||||||
|
'rgba(113, 100, 255, 1)',
|
||||||
|
'rgba(255, 104, 96, 1)',
|
||||||
|
'rgba(255, 151, 71, 1)',
|
||||||
|
'rgba(176, 235, 66, 1)',
|
||||||
|
'rgba(214, 128, 255, 1)',
|
||||||
|
'rgba(0, 67, 210, 1)'
|
||||||
|
];
|
||||||
|
|
||||||
|
const series = response.data.map((item, index) => {
|
||||||
|
// 为每个系列分配颜色,index 从 0 开始,依次对应 colors 数组
|
||||||
|
const color = colors[index % colors.length]; // 使用取模确保不越界
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: item.lineName,
|
||||||
|
type: 'bar',
|
||||||
|
stack: 'Ad',
|
||||||
|
barWidth: '20',
|
||||||
|
emphasis: {
|
||||||
|
focus: 'series'
|
||||||
|
},
|
||||||
|
itemStyle: {
|
||||||
|
color: color // 指定当前系列的颜色
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
item.originalNgCount,
|
||||||
|
item.edgeNgCount,
|
||||||
|
item.silkNgCount,
|
||||||
|
item.drillNgCount,
|
||||||
|
item.coatingNgCount,
|
||||||
|
item.packNgCount
|
||||||
|
]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.loading = false;
|
||||||
|
this.getChart(series);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getChart(series) {
|
||||||
|
var chartDom = document.getElementById('chart');
|
||||||
|
var myChart = echarts.init(chartDom);
|
||||||
|
var option;
|
||||||
|
option = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: {
|
||||||
|
type: 'shadow'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: 30,
|
||||||
|
top: 20,
|
||||||
|
right: 30,
|
||||||
|
bottom:20
|
||||||
|
},
|
||||||
|
legend: {},
|
||||||
|
xAxis: [
|
||||||
|
{
|
||||||
|
type: 'category',
|
||||||
|
data: ['原片不良', '磨边不良', '丝印不良', '打孔不良', '镀膜不良', ' 钢包不良']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: series
|
||||||
|
};
|
||||||
|
|
||||||
|
option && myChart.setOption(option);
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let tables = document.querySelector('.el-table').cloneNode(true)
|
||||||
|
const fix = tables.querySelector('.el-table__fixed')
|
||||||
|
const fixRight = tables.querySelector('.el-table__fixed-right')
|
||||||
|
if (fix) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed'))
|
||||||
|
}
|
||||||
|
if (fixRight) {
|
||||||
|
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
|
||||||
|
}
|
||||||
|
let exportTable = XLSX.utils.table_to_book(tables)
|
||||||
|
|
||||||
|
var exportTableOut = XLSX.write(exportTable, {
|
||||||
|
bookType: 'xlsx', bookSST: true, type: 'array'
|
||||||
|
})
|
||||||
|
// sheetjs.xlsx为导出表格的标题名称
|
||||||
|
try {
|
||||||
|
FileSaver.saveAs(new Blob([exportTableOut], {
|
||||||
|
type: 'application/octet-stream'
|
||||||
|
}), '工段不良.xlsx')
|
||||||
|
} catch (e) {
|
||||||
|
if (typeof console !== 'undefined') console.log(e, exportTableOut)
|
||||||
|
}
|
||||||
|
return exportTableOut
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
/* 添加 scoped 以避免样式污染 */
|
||||||
|
.app-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
/* 垂直排列 */
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
.table-container,
|
||||||
|
.chart-container {
|
||||||
|
flex: 1;
|
||||||
|
/* 让两个容器平分父容器的空间 */
|
||||||
|
min-height: 300px;
|
||||||
|
/* 设置最小高度,防止内容过少时变形 */
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
/* 添加一个边框,方便看清分隔 */
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确保图表容器的父元素也有高度,ECharts 才能正确渲染 */
|
||||||
|
.chart-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
674
src/views/quality/qualityIsra/defectVisualization.vue
Normal file
674
src/views/quality/qualityIsra/defectVisualization.vue
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
<template>
|
||||||
|
<div class="status-timegraph-container" style="background: #f2f4f9; flex: 1; display: flex; flex-direction: column">
|
||||||
|
<el-row class="" style="
|
||||||
|
height: 1px;
|
||||||
|
flex: 1;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 16px 16px 32px;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="24">
|
||||||
|
<div class="blue-title">
|
||||||
|
图表时间维度
|
||||||
|
<div style="position: relative; display: flex; align-items: center; gap: 10px; margin-top: 10px;">
|
||||||
|
<el-button type="primary" @click="handleExport"
|
||||||
|
style="position: absolute;top: 0px;right: 10px;z-index: 9999;">
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
|
<el-tabs v-model="activeName" type="card" @tab-click="handleClick" style="flex: 1;">
|
||||||
|
|
||||||
|
<!-- 班组标签页 -->
|
||||||
|
<el-tab-pane label="班组" name="group">
|
||||||
|
<!-- 修改:使用四宫格布局容器 -->
|
||||||
|
<div class="chart-grid">
|
||||||
|
<div id="mapGroupMain" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="mapGroupMainScrap" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="listGroupMain" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="listGroupMainScrap" class="chart-container" style="height: 400px;"></div>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<!-- 日标签页 -->
|
||||||
|
<el-tab-pane label="日" name="day">
|
||||||
|
<!-- 修改:使用四宫格布局容器 -->
|
||||||
|
<div class="chart-grid">
|
||||||
|
<div id="mapDayMain" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="mapDayMainScrap" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="listDayMain" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="listDayMainScrap" class="chart-container" style="height: 400px;"></div>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<!-- 周标签页 -->
|
||||||
|
<el-tab-pane label="周" name="week">
|
||||||
|
<!-- 修改:使用四宫格布局容器 -->
|
||||||
|
<div class="chart-grid">
|
||||||
|
<div id="mapWeekMain" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="mapWeekMainScrap" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="listWeekMain" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="listWeekMainScrap" class="chart-container" style="height: 400px;"></div>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<!-- 月标签页 -->
|
||||||
|
<el-tab-pane label="月" name="month">
|
||||||
|
<!-- 修改:使用四宫格布局容器 -->
|
||||||
|
<div class="chart-grid">
|
||||||
|
<div id="mapMonthMain" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="mapMonthMainScrap" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="listMonthMain" class="chart-container" style="height: 400px;"></div>
|
||||||
|
<div id="listMonthMainScrap" class="chart-container" style="height: 400px;"></div>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getQualityIsraPage,
|
||||||
|
} from '@/api/monitoring/qualityIsra';
|
||||||
|
import moment from 'moment';
|
||||||
|
import * as echarts from 'echarts';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
|
import { parseTime } from '@/utils/ruoyi';
|
||||||
|
import { getPdList } from '@/api/core/monitoring/auto';
|
||||||
|
import html2canvas from 'html2canvas';
|
||||||
|
export default {
|
||||||
|
name: 'QualityIsra',
|
||||||
|
mixins: [tableHeightMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isFold: false,
|
||||||
|
list: [],
|
||||||
|
dynamicProps: [],
|
||||||
|
activeName: 'group', // 默认激活“日”标签页
|
||||||
|
// 新增:班组图表接口URL(与后端确认一致)
|
||||||
|
groupMapUrl: '/extend/check-isra-statistics/groupMap',
|
||||||
|
groupListUrl: '/extend/check-isra-statistics/groupList',
|
||||||
|
// 原有接口URL:保持不变
|
||||||
|
dayMapUrl: '/extend/check-isra-statistics/dayMap',
|
||||||
|
weekMapUrl: '/extend/check-isra-statistics/weekMap',
|
||||||
|
monthMapUrl: '/extend/check-isra-statistics/monthMap',
|
||||||
|
dayListUrl: '/extend/check-isra-statistics/dayList',
|
||||||
|
weekListUrl: '/extend/check-isra-statistics/weekList',
|
||||||
|
monthListUrl: '/extend/check-isra-statistics/monthList',
|
||||||
|
searchBarFormConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '是否报废',
|
||||||
|
placeholder: '请选择是否报废',
|
||||||
|
param: 'checkDiscard',
|
||||||
|
selectOptions: [
|
||||||
|
{ name: '否', id: 0 },
|
||||||
|
{ name: '是', id: 1 }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '缺陷类型',
|
||||||
|
placeholder: '请选择缺陷类型',
|
||||||
|
param: 'checkType',
|
||||||
|
selectOptions: [],
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'name',
|
||||||
|
defaultSelect: [],
|
||||||
|
filterable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'name',
|
||||||
|
param: 'lineName',
|
||||||
|
filterable: true,
|
||||||
|
defaultSelect: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间段',
|
||||||
|
dateType: 'datetimerange',
|
||||||
|
format: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始日期',
|
||||||
|
endPlaceholder: '结束日期',
|
||||||
|
defaultTime: ['00:00:00', '23:59:59'],
|
||||||
|
param: 'checkTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
checkDiscard: undefined,
|
||||||
|
// checkType: undefined,
|
||||||
|
// lineName: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// 初始化折叠状态(如需使用可取消注释)
|
||||||
|
// this.isFold = this.searchBarWidth('QualityIsraBox', 1198);
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
tableProps() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
prop: 'checkType',
|
||||||
|
label: '缺陷类型',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'sumNum',
|
||||||
|
label: '缺陷总数',
|
||||||
|
},
|
||||||
|
...this.dynamicProps,
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// 从路由参数获取产线信息并回显
|
||||||
|
if (this.$route.query.lineName) {
|
||||||
|
this.queryParams.lineName = this.$route.query.lineName;
|
||||||
|
this.searchBarFormConfig[2].defaultSelect = this.$route.query.lineName;
|
||||||
|
}
|
||||||
|
// 从路由参数获取时间信息并回显
|
||||||
|
if (this.$route.query.originalGlassOutputTime) {
|
||||||
|
const time = new Date(Number(this.$route.query.originalGlassOutputTime));
|
||||||
|
this.queryParams.startTime = parseTime(time);
|
||||||
|
this.queryParams.endTime = parseTime(time);
|
||||||
|
this.searchBarFormConfig[3].defaultSelect = [
|
||||||
|
this.queryParams.startTime,
|
||||||
|
this.queryParams.endTime,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
// 初始化数据
|
||||||
|
this.getData();
|
||||||
|
this.getDict();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 标签页切换事件 */
|
||||||
|
handleClick() {
|
||||||
|
this.getData();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 核心:获取并渲染图表数据(支持班组/日/周/月) */
|
||||||
|
getData() {
|
||||||
|
// 1. 根据当前激活的标签页,选择对应的接口URL和图表容器ID
|
||||||
|
let mapUrl, listUrl, mapDomId, listDomId, mapDomIdScrap, listDomIdScrap;
|
||||||
|
switch (this.activeName) {
|
||||||
|
case 'group':
|
||||||
|
mapUrl = this.groupMapUrl;
|
||||||
|
listUrl = this.groupListUrl;
|
||||||
|
mapDomId = 'mapGroupMain';
|
||||||
|
listDomId = 'listGroupMain';
|
||||||
|
mapDomIdScrap = 'mapGroupMainScrap';
|
||||||
|
listDomIdScrap = 'listGroupMainScrap';
|
||||||
|
break;
|
||||||
|
case 'day':
|
||||||
|
mapUrl = this.dayMapUrl;
|
||||||
|
listUrl = this.dayListUrl;
|
||||||
|
mapDomId = 'mapDayMain';
|
||||||
|
listDomId = 'listDayMain';
|
||||||
|
mapDomIdScrap = 'mapGroupDayScrap';
|
||||||
|
listDomIdScrap = 'listGroupDayScrap';
|
||||||
|
break;
|
||||||
|
case 'week':
|
||||||
|
mapUrl = this.weekMapUrl;
|
||||||
|
listUrl = this.weekListUrl;
|
||||||
|
mapDomId = 'mapWeekMain';
|
||||||
|
listDomId = 'listWeekMain';
|
||||||
|
mapDomIdScrap = 'mapGroupWeekScrap';
|
||||||
|
listDomIdScrap = 'listGroupWeekScrap';
|
||||||
|
break;
|
||||||
|
case 'month':
|
||||||
|
mapUrl = this.monthMapUrl;
|
||||||
|
listUrl = this.monthListUrl;
|
||||||
|
mapDomId = 'mapMonthMain';
|
||||||
|
listDomId = 'listMonthMain';
|
||||||
|
mapDomIdScrap = 'mapGroupMonthScrap';
|
||||||
|
listDomIdScrap = 'listGroupMonthScrap';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 请求“各类型缺陷对比图”数据
|
||||||
|
this.$axios({
|
||||||
|
url: mapUrl,
|
||||||
|
method: 'get',
|
||||||
|
params: this.queryParams
|
||||||
|
}).then((res) => {
|
||||||
|
const mapArr = [];
|
||||||
|
const mapLegendData = [];
|
||||||
|
// 处理接口返回数据(确保与后端数据格式匹配)
|
||||||
|
for (const type in res.data) {
|
||||||
|
const dataArr = [];
|
||||||
|
const xAxisData = [];
|
||||||
|
res.data[type].forEach(ele => {
|
||||||
|
dataArr.push(ele.num); // 缺陷数量
|
||||||
|
// 班组标签页使用“班组名称”作为X轴,其他标签页使用“时间”
|
||||||
|
xAxisData.push(ele.checkTime);
|
||||||
|
});
|
||||||
|
mapArr.push({
|
||||||
|
name: type, // 缺陷类型名称
|
||||||
|
type: 'line', // 折线图
|
||||||
|
data: dataArr,
|
||||||
|
xAxisData: xAxisData // 存储当前系列的X轴数据
|
||||||
|
});
|
||||||
|
mapLegendData.push(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 渲染“各类型缺陷对比图”
|
||||||
|
const mapChartDom = document.getElementById(mapDomId);
|
||||||
|
if (mapChartDom) {
|
||||||
|
const myChart = echarts.init(mapChartDom);
|
||||||
|
myChart.clear(); // 清除原有图表
|
||||||
|
myChart.setOption({
|
||||||
|
title: { text: '所有缺陷对比图' },
|
||||||
|
tooltip: { trigger: 'axis' },
|
||||||
|
legend: { data: mapLegendData, top: '10%', y: 'top', x: 'left' },
|
||||||
|
grid: { left: '3%', right: '4%', bottom: '3%', top: '20%', containLabel: true },
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: mapArr.length > 0 ? mapArr[0].xAxisData : [] // 使用第一个系列的X轴数据
|
||||||
|
},
|
||||||
|
yAxis: { type: 'value', name: '缺陷数量' },
|
||||||
|
series: mapArr
|
||||||
|
});
|
||||||
|
// 监听窗口 resize,自动调整图表大小
|
||||||
|
window.addEventListener('resize', () => myChart.resize());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$axios({
|
||||||
|
url: mapUrl,
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
startTime: this.queryParams.startTime,
|
||||||
|
endTime: this.queryParams.endTime,
|
||||||
|
checkDiscard:true
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
const mapArr = [];
|
||||||
|
const mapLegendData = [];
|
||||||
|
// 处理接口返回数据(确保与后端数据格式匹配)
|
||||||
|
for (const type in res.data) {
|
||||||
|
const dataArr = [];
|
||||||
|
const xAxisData = [];
|
||||||
|
res.data[type].forEach(ele => {
|
||||||
|
dataArr.push(ele.num); // 缺陷数量
|
||||||
|
// 班组标签页使用“班组名称”作为X轴,其他标签页使用“时间”
|
||||||
|
xAxisData.push(ele.checkTime);
|
||||||
|
});
|
||||||
|
mapArr.push({
|
||||||
|
name: type, // 缺陷类型名称
|
||||||
|
type: 'line', // 折线图
|
||||||
|
data: dataArr,
|
||||||
|
xAxisData: xAxisData // 存储当前系列的X轴数据
|
||||||
|
});
|
||||||
|
mapLegendData.push(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 渲染“各类型缺陷对比图”
|
||||||
|
const mapChartDom = document.getElementById(mapDomIdScrap);
|
||||||
|
if (mapChartDom) {
|
||||||
|
const myChart = echarts.init(mapChartDom);
|
||||||
|
myChart.clear(); // 清除原有图表
|
||||||
|
myChart.setOption({
|
||||||
|
title: { text: '所有缺陷对比图' },
|
||||||
|
tooltip: { trigger: 'axis' },
|
||||||
|
legend: { data: mapLegendData, top: '10%', y: 'top', x: 'left' },
|
||||||
|
grid: { left: '3%', right: '4%', bottom: '3%', top: '20%', containLabel: true },
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: mapArr.length > 0 ? mapArr[0].xAxisData : [] // 使用第一个系列的X轴数据
|
||||||
|
},
|
||||||
|
yAxis: { type: 'value', name: '缺陷数量' },
|
||||||
|
series: mapArr
|
||||||
|
});
|
||||||
|
// 监听窗口 resize,自动调整图表大小
|
||||||
|
window.addEventListener('resize', () => myChart.resize());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. 请求“缺陷率趋势图”数据
|
||||||
|
this.$axios({
|
||||||
|
url: listUrl,
|
||||||
|
method: 'get',
|
||||||
|
params: this.queryParams
|
||||||
|
}).then((res) => {
|
||||||
|
const listNumArr = []; // 缺陷数量
|
||||||
|
const listRatioArr = []; // 缺陷率
|
||||||
|
const listXAxisData = []; // X轴数据
|
||||||
|
|
||||||
|
// 处理接口返回数据(确保与后端数据格式匹配)
|
||||||
|
res.data.forEach(ele => {
|
||||||
|
listNumArr.push(ele.num);
|
||||||
|
listRatioArr.push(ele.ratio); // 缺陷率(百分比)
|
||||||
|
// 班组标签页使用“班组名称”作为X轴,其他标签页使用“时间”
|
||||||
|
listXAxisData.push(this.activeName === 'group' ? ele.groupName : ele.checkTime);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 渲染“缺陷率趋势图”
|
||||||
|
const listChartDom = document.getElementById(listDomId);
|
||||||
|
if (listChartDom) {
|
||||||
|
const myChart = echarts.init(listChartDom);
|
||||||
|
myChart.clear(); // 清除原有图表
|
||||||
|
myChart.setOption({
|
||||||
|
title: { text: '所有缺陷率趋势图' },
|
||||||
|
tooltip: { trigger: 'axis' },
|
||||||
|
legend: { data: ['缺陷数量', '缺陷率'], top: '10%' },
|
||||||
|
grid: { left: '3%', right: '4%', bottom: '3%', top: '20%', containLabel: true },
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: listXAxisData
|
||||||
|
},
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value',
|
||||||
|
name: '缺陷数量',
|
||||||
|
axisLabel: { formatter: '{value}' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'value',
|
||||||
|
name: '缺陷率',
|
||||||
|
axisLabel: { formatter: '{value} %' },
|
||||||
|
position: 'right' // 缺陷率Y轴放在右侧
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '缺陷数量',
|
||||||
|
type: 'bar',
|
||||||
|
barWidth: '3%',
|
||||||
|
data: listNumArr,
|
||||||
|
itemStyle: { color: 'rgba(40, 138, 255, 1)' } // 柱状图颜色
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '缺陷率',
|
||||||
|
type: 'line',
|
||||||
|
yAxisIndex: 1, // 关联右侧Y轴
|
||||||
|
data: listRatioArr,
|
||||||
|
itemStyle: { color: 'rgba(115, 222, 147, 1)' }, // 折线图颜色
|
||||||
|
symbol: 'circle', // 标记点样式
|
||||||
|
symbolSize: 6
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
// 监听窗口 resize,自动调整图表大小
|
||||||
|
window.addEventListener('resize', () => myChart.resize());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$axios({
|
||||||
|
url: listUrl,
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
startTime: this.queryParams.startTime,
|
||||||
|
endTime: this.queryParams.endTime,
|
||||||
|
checkDiscard: true
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
const listNumArr = []; // 缺陷数量
|
||||||
|
const listRatioArr = []; // 缺陷率
|
||||||
|
const listXAxisData = []; // X轴数据
|
||||||
|
|
||||||
|
// 处理接口返回数据(确保与后端数据格式匹配)
|
||||||
|
res.data.forEach(ele => {
|
||||||
|
listNumArr.push(ele.num);
|
||||||
|
listRatioArr.push(ele.ratio); // 缺陷率(百分比)
|
||||||
|
// 班组标签页使用“班组名称”作为X轴,其他标签页使用“时间”
|
||||||
|
listXAxisData.push(this.activeName === 'group' ? ele.groupName : ele.checkTime);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 渲染“缺陷率趋势图”
|
||||||
|
const listChartDom = document.getElementById(listDomIdScrap);
|
||||||
|
if (listChartDom) {
|
||||||
|
const myChart = echarts.init(listChartDom);
|
||||||
|
myChart.clear(); // 清除原有图表
|
||||||
|
myChart.setOption({
|
||||||
|
title: { text: '所有缺陷率趋势图' },
|
||||||
|
tooltip: { trigger: 'axis' },
|
||||||
|
legend: { data: ['缺陷数量', '缺陷率'], top: '10%' },
|
||||||
|
grid: { left: '3%', right: '4%', bottom: '3%', top: '20%', containLabel: true },
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: listXAxisData
|
||||||
|
},
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value',
|
||||||
|
name: '缺陷数量',
|
||||||
|
axisLabel: { formatter: '{value}' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'value',
|
||||||
|
name: '缺陷率',
|
||||||
|
axisLabel: { formatter: '{value} %' },
|
||||||
|
position: 'right' // 缺陷率Y轴放在右侧
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '缺陷数量',
|
||||||
|
type: 'bar',
|
||||||
|
barWidth: '3%',
|
||||||
|
data: listNumArr,
|
||||||
|
itemStyle: { color: 'rgba(40, 138, 255, 1)' } // 柱状图颜色
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '缺陷率',
|
||||||
|
type: 'line',
|
||||||
|
yAxisIndex: 1, // 关联右侧Y轴
|
||||||
|
data: listRatioArr,
|
||||||
|
itemStyle: { color: 'rgba(115, 222, 147, 1)' }, // 折线图颜色
|
||||||
|
symbol: 'circle', // 标记点样式
|
||||||
|
symbolSize: 6
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
// 监听窗口 resize,自动调整图表大小
|
||||||
|
window.addEventListener('resize', () => myChart.resize());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 新增:导出数据功能 */
|
||||||
|
handleExport() {
|
||||||
|
// 1. 找到当前激活标签页内的 .chart-wrapper 容器
|
||||||
|
const container = document.querySelector(`.el-tab-pane[aria-selected="true"] .chart-wrapper`);
|
||||||
|
|
||||||
|
if (!container) {
|
||||||
|
this.$message.warning('未找到图表容器');
|
||||||
|
console.error('导出失败:未找到 .chart-wrapper 容器');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$message.info('正在生成图片,请稍候...');
|
||||||
|
|
||||||
|
// 2. 获取当前标签页的两个图表实例,并强制刷新它们
|
||||||
|
// 这是解决问题的关键步骤
|
||||||
|
const chartIds = this.getChartIdsByActiveName();
|
||||||
|
chartIds.forEach(id => {
|
||||||
|
const chartDom = document.getElementById(id);
|
||||||
|
if (chartDom) {
|
||||||
|
const chartInstance = echarts.getInstanceByDom(chartDom);
|
||||||
|
if (chartInstance) {
|
||||||
|
chartInstance.resize(); // 强制图表重新渲染
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. 使用 setTimeout 等待图表渲染完成后再进行截图
|
||||||
|
// 延迟时间可以根据你的图表复杂度调整,一般 100-300ms 足够
|
||||||
|
setTimeout(() => {
|
||||||
|
html2canvas(container, {
|
||||||
|
scale: 2,
|
||||||
|
useCORS: true,
|
||||||
|
logging: false,
|
||||||
|
backgroundColor: null,
|
||||||
|
// 增加一个配置,确保能捕获到所有元素
|
||||||
|
windowWidth: container.scrollWidth,
|
||||||
|
windowHeight: container.scrollHeight
|
||||||
|
}).then(canvas => {
|
||||||
|
const imgBase64 = canvas.toDataURL('image/png');
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = imgBase64;
|
||||||
|
|
||||||
|
const titleMap = { group: '班组', day: '日', week: '周', month: '月' };
|
||||||
|
const title = titleMap[this.activeName] || '数据';
|
||||||
|
link.download = `${title}度缺陷分析报告.png`;
|
||||||
|
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
|
||||||
|
this.$message.success('图表导出成功!');
|
||||||
|
}).catch(error => {
|
||||||
|
this.$message.error('图表导出失败!');
|
||||||
|
console.error('html2canvas 截图失败:', error);
|
||||||
|
});
|
||||||
|
}, 200); // 等待 200 毫秒
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增一个辅助方法,根据当前激活的标签页获取对应的图表 ID
|
||||||
|
getChartIdsByActiveName() {
|
||||||
|
switch (this.activeName) {
|
||||||
|
case 'group':
|
||||||
|
return ['mapGroupMain', 'listGroupMain'];
|
||||||
|
case 'day':
|
||||||
|
return ['mapDayMain', 'listDayMain'];
|
||||||
|
case 'week':
|
||||||
|
return ['mapWeekMain', 'listWeekMain'];
|
||||||
|
case 'month':
|
||||||
|
return ['mapMonthMain', 'listMonthMain'];
|
||||||
|
default:
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 获取搜索栏的字典数据(缺陷类型、产线列表) */
|
||||||
|
async getDict() {
|
||||||
|
// 获取缺陷类型列表
|
||||||
|
const defectRes = await this.$axios({
|
||||||
|
url: '/extend/check-isra-standards/page',
|
||||||
|
method: 'get',
|
||||||
|
params: { pageSize: 100, pageNo: 1 }
|
||||||
|
});
|
||||||
|
this.searchBarFormConfig[1].selectOptions = defectRes.data.list || [];
|
||||||
|
|
||||||
|
// 获取产线列表
|
||||||
|
const lineRes = await getPdList();
|
||||||
|
this.searchBarFormConfig[2].selectOptions = lineRes.data || [];
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 查询列表数据(如需使用表格可取消注释) */
|
||||||
|
// getList() {
|
||||||
|
// this.getDataList();
|
||||||
|
// },
|
||||||
|
|
||||||
|
/** 表格数据查询(如需使用表格可取消注释) */
|
||||||
|
// async getDataList() {
|
||||||
|
// this.loading = true;
|
||||||
|
// try {
|
||||||
|
// const { data } = await getQualityIsraPage(this.queryParams);
|
||||||
|
// this.dynamicProps = this.filterNameData(data.nameData);
|
||||||
|
// this.list = this.filterData(data.data);
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('获取表格数据失败:', error);
|
||||||
|
// } finally {
|
||||||
|
// this.loading = false;
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
|
||||||
|
/** 过滤动态表格列名(如需使用表格可取消注释) */
|
||||||
|
// filterNameData(nameData) {
|
||||||
|
// const nameSet = new Set(nameData.map(nd => nd.name));
|
||||||
|
// return Array.from(nameSet).sort().map(name => ({ prop: name, label: name }));
|
||||||
|
// },
|
||||||
|
|
||||||
|
/** 过滤表格数据(如需使用表格可取消注释) */
|
||||||
|
// filterData(data) {
|
||||||
|
// return data.map(item => {
|
||||||
|
// const keyValuePairs = {};
|
||||||
|
// item.data.forEach(d => {
|
||||||
|
// keyValuePairs[d.dynamicName] = d.dynamicValue;
|
||||||
|
// });
|
||||||
|
// return { ...keyValuePairs, sumNum: item.sumNum, checkType: item.checkType };
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
|
||||||
|
/** 搜索按钮点击事件(如需使用搜索栏可取消注释) */
|
||||||
|
// handleSearchBarBtnClick(val) {
|
||||||
|
// if (val.btnName === 'search') {
|
||||||
|
// this.queryParams.checkDiscard = (val?.checkDiscard === 0 || val?.checkDiscard === 1) ? val?.checkDiscard : undefined;
|
||||||
|
// this.queryParams.lineName = val.lineName ? val.lineName : undefined;
|
||||||
|
// this.queryParams.checkType = val.checkType ? val.checkType : undefined;
|
||||||
|
// this.queryParams.startTime = val.checkTime ? val.checkTime[0] : undefined;
|
||||||
|
// this.queryParams.endTime = val.checkTime ? val.checkTime[1] : undefined;
|
||||||
|
|
||||||
|
// this.getList();
|
||||||
|
// this.getData();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.blue-title {
|
||||||
|
position: relative;
|
||||||
|
padding: 4px 0;
|
||||||
|
padding-left: 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 6px;
|
||||||
|
height: 16px;
|
||||||
|
width: 4px;
|
||||||
|
border-radius: 1px;
|
||||||
|
background: #0b58ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 新增:四宫格布局样式 */
|
||||||
|
.chart-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
/* 创建两列,宽度相等 */
|
||||||
|
grid-template-rows: repeat(2, auto);
|
||||||
|
/* 创建两行,高度自适应内容 */
|
||||||
|
gap: 20px;
|
||||||
|
/* 图表之间的间距 */
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-container {
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #f0f0f0;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
270
src/views/quality/qualityIsra/dialogForm.vue
Normal file
270
src/views/quality/qualityIsra/dialogForm.vue
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
<!--
|
||||||
|
filename: dialogForm.vue
|
||||||
|
author: liubin
|
||||||
|
date: 2023-09-11 15:55:13
|
||||||
|
description: DialogForm for qualityInspectionRecord only
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
:model="innerDataForm"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="formLoading">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
label="检测内容"
|
||||||
|
prop="inspectionDetId"
|
||||||
|
:rules="[{ required: true, message: '检测内容不能为空', trigger: 'blur' }]">
|
||||||
|
<el-select
|
||||||
|
v-model="innerDataForm.inspectionDetId"
|
||||||
|
placeholder="请选择检测内容"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
@change="handleInspectionDetChange">
|
||||||
|
<el-option
|
||||||
|
v-for="opt in inspectionDetList"
|
||||||
|
:key="opt.value"
|
||||||
|
:label="opt.label"
|
||||||
|
:value="opt.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
label="来源"
|
||||||
|
prop="source"
|
||||||
|
:rules="[{ required: true, message: '来源不能为空', trigger: 'blur' }]">
|
||||||
|
<el-select
|
||||||
|
v-model="innerDataForm.source"
|
||||||
|
placeholder="请选择来源"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
@change="$emit('update', innerDataForm)">
|
||||||
|
<el-option
|
||||||
|
v-for="opt in [
|
||||||
|
{ label: '手动', value: 1 },
|
||||||
|
{ label: '自动', value: 2 },
|
||||||
|
]"
|
||||||
|
:key="opt.value"
|
||||||
|
:label="opt.label"
|
||||||
|
:value="opt.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
label="产线"
|
||||||
|
prop="productionLineId"
|
||||||
|
:rules="[{ required: true, message: '产线不能为空', trigger: 'blur' }]">
|
||||||
|
<el-select
|
||||||
|
v-model="innerDataForm.productionLineId"
|
||||||
|
placeholder="请选择产线"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
@change="handleProductlineChange">
|
||||||
|
<el-option
|
||||||
|
v-for="opt in productionLineList"
|
||||||
|
:key="opt.value"
|
||||||
|
:label="opt.label"
|
||||||
|
:value="opt.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
label="工段"
|
||||||
|
prop="sectionId"
|
||||||
|
:rules="[{ required: true, message: '工段不能为空', trigger: 'blur' }]">
|
||||||
|
<el-select
|
||||||
|
v-model="innerDataForm.sectionId"
|
||||||
|
placeholder="请选择工段"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
@change="$emit('update', innerDataForm)">
|
||||||
|
<el-option
|
||||||
|
v-for="opt in sectionList"
|
||||||
|
:key="opt.value"
|
||||||
|
:label="opt.label"
|
||||||
|
:value="opt.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="检测人员" prop="checkPerson">
|
||||||
|
<el-input
|
||||||
|
v-model="innerDataForm.checkPerson"
|
||||||
|
clearable
|
||||||
|
@change="$emit('update', innerDataForm)"
|
||||||
|
placeholder="请输入检测人员" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
label="检测时间"
|
||||||
|
prop="checkTime"
|
||||||
|
:rules="[{ required: true, message: '检测时间不能为空', trigger: 'blur' }]">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="innerDataForm.checkTime"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="请选择检测时间"
|
||||||
|
value-format="timestamp"
|
||||||
|
@change="$emit('update', innerDataForm)"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col>
|
||||||
|
<el-form-item label="描述" prop="explainText">
|
||||||
|
<el-input
|
||||||
|
v-model="innerDataForm.explainText"
|
||||||
|
placeholder="请输入描述信息"
|
||||||
|
@change="$emit('update', innerDataForm)"
|
||||||
|
type="textarea"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="innerDataForm.remark"
|
||||||
|
@change="$emit('update', innerDataForm)"
|
||||||
|
placeholder="请输入备注"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'DialogForm',
|
||||||
|
model: {
|
||||||
|
prop: 'dataForm',
|
||||||
|
event: 'update',
|
||||||
|
},
|
||||||
|
emits: ['update'],
|
||||||
|
components: {},
|
||||||
|
props: {
|
||||||
|
dataForm: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formLoading: true,
|
||||||
|
inspectionDetList: [],
|
||||||
|
productionLineList: [],
|
||||||
|
sectionList: [],
|
||||||
|
innerDataForm: {},
|
||||||
|
cacheInspectionDetList: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
Promise.all([this.getProductLineList(), this.getInspectionDetList()]).then(
|
||||||
|
() => {
|
||||||
|
this.formLoading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 'innerDataForm.productionLineId': {
|
||||||
|
// handler: async function (plId) {
|
||||||
|
// if (plId) await this.getWorksectionList(plId);
|
||||||
|
// },
|
||||||
|
// immediate: true,
|
||||||
|
// },
|
||||||
|
dataForm: {
|
||||||
|
handler: function (dataForm) {
|
||||||
|
this.innerDataForm = Object.assign({}, dataForm);
|
||||||
|
|
||||||
|
if (dataForm.productionLineId)
|
||||||
|
this.getWorksectionList(dataForm.productionLineId);
|
||||||
|
},
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 模拟透传 ref */
|
||||||
|
validate(cb) {
|
||||||
|
return this.$refs.form.validate(cb);
|
||||||
|
},
|
||||||
|
resetFields(args) {
|
||||||
|
return this.$refs.form.resetFields(args);
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInspectionDetChange(value) {
|
||||||
|
const { id, content } = this.cacheInspectionDetList.find(
|
||||||
|
(item) => item.id == value
|
||||||
|
);
|
||||||
|
this.innerDataForm.inspectionDetId = id;
|
||||||
|
this.innerDataForm.inspectionDetContent = content;
|
||||||
|
this.$emit('update', this.innerDataForm);
|
||||||
|
},
|
||||||
|
|
||||||
|
async handleProductlineChange(id) {
|
||||||
|
// await this.getWorksectionList(id);
|
||||||
|
this.innerDataForm.sectionId = null;
|
||||||
|
this.$emit('update', this.innerDataForm);
|
||||||
|
},
|
||||||
|
|
||||||
|
// getCode
|
||||||
|
async getCode(url) {
|
||||||
|
const response = await this.$axios(url);
|
||||||
|
return response.data;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取产线列表
|
||||||
|
async getProductLineList() {
|
||||||
|
const response = await this.$axios('/base/core-production-line/listAll');
|
||||||
|
this.productionLineList = response.data.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.id,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取检测内容列表
|
||||||
|
async getInspectionDetList() {
|
||||||
|
const response = await this.$axios(
|
||||||
|
'/base/quality-inspection-det/listAll'
|
||||||
|
);
|
||||||
|
this.cacheInspectionDetList = response.data;
|
||||||
|
this.inspectionDetList = response.data.map((item) => ({
|
||||||
|
label: item.content,
|
||||||
|
value: item.id,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取工段列表
|
||||||
|
async getWorksectionList(plId) {
|
||||||
|
const response = await this.$axios(
|
||||||
|
'/base/workshop-section/listByParentId',
|
||||||
|
{
|
||||||
|
params: {
|
||||||
|
id: plId,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.sectionList = response.data.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.id,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.el-date-editor,
|
||||||
|
.el-select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
468
src/views/quality/qualityIsra/index.vue
Normal file
468
src/views/quality/qualityIsra/index.vue
Normal file
@@ -0,0 +1,468 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- <div class="blue-title">生产节拍时序图</div> -->
|
||||||
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<base-table :max-height="tableH" :table-props="tableProps" :page="1" :limit="20" :table-data="list">
|
||||||
|
</base-table>
|
||||||
|
<!-- </el-row> -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getQualityIsraPage,
|
||||||
|
// getQualityIsraDayMap,
|
||||||
|
// getQualityIsraWeekMap,
|
||||||
|
// getQualityIsraMonthMap,
|
||||||
|
// getQualityIsraDayList,
|
||||||
|
// getQualityIsraWeekList,
|
||||||
|
// getQualityIsraMonthList,
|
||||||
|
} from '@/api/monitoring/qualityIsra';
|
||||||
|
// import Editor from '@/components/Editor';
|
||||||
|
import moment from 'moment';
|
||||||
|
// import DialogForm from './dialogForm.vue';
|
||||||
|
import * as echarts from 'echarts';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
|
// import { getPdList } from '@/api/base/coreProductionLine';
|
||||||
|
import { parseTime } from '@/utils/ruoyi';
|
||||||
|
import { getPdList, } from '@/api/core/monitoring/auto';
|
||||||
|
// import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
export default {
|
||||||
|
name: 'QualityIsra',
|
||||||
|
// components: {
|
||||||
|
// DialogForm,
|
||||||
|
// },
|
||||||
|
mixins: [tableHeightMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isFold: false,
|
||||||
|
list: [],
|
||||||
|
dynamicProps: [],
|
||||||
|
activeName: 'day',
|
||||||
|
dayMapUrl: '/extend/check-isra-statistics/dayMap',
|
||||||
|
weekMapUrl: '/extend/check-isra-statistics/weekMap',
|
||||||
|
monthMapUrl: '/extend/check-isra-statistics/monthMap',
|
||||||
|
dayListUrl: '/extend/check-isra-statistics/dayList',
|
||||||
|
weekListUrl: '/extend/check-isra-statistics/weekList',
|
||||||
|
monthListUrl: '/extend/check-isra-statistics/monthList',
|
||||||
|
searchBarFormConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '是否报废',
|
||||||
|
placeholder: '请选择是否报废',
|
||||||
|
param: 'checkDiscard',
|
||||||
|
selectOptions: [
|
||||||
|
{ name: '否', id: 0 },
|
||||||
|
{ name: '是', id: 1 }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '缺陷类型',
|
||||||
|
placeholder: '请选择缺陷类型',
|
||||||
|
param: 'checkType',
|
||||||
|
selectOptions: [],
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'name',
|
||||||
|
defaultSelect: [],
|
||||||
|
filterable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'name',
|
||||||
|
param: 'lineName',
|
||||||
|
filterable: true,
|
||||||
|
defaultSelect: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间段',
|
||||||
|
dateType: 'datetimerange', // datetimerange
|
||||||
|
// format: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
format: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始日期',
|
||||||
|
endPlaceholder: '结束日期',
|
||||||
|
defaultTime: ['00:00:00', '23:59:59'],
|
||||||
|
param: 'checkTime',
|
||||||
|
// width: 350,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type:'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
checkDiscard: undefined,
|
||||||
|
checkType:undefined,
|
||||||
|
lineName: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
// productionLineId: null,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// this.getProductLineList();
|
||||||
|
// this.isFold = this.searchBarWidth('QualityIsraBox', 1198);
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
tableProps() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
// width: 128,
|
||||||
|
prop: 'checkType',
|
||||||
|
label: '缺陷类型',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// width: 128,
|
||||||
|
prop: 'sumNum',
|
||||||
|
label: '缺陷总数',
|
||||||
|
},
|
||||||
|
...this.dynamicProps,
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
if (this.$route.query.lineName) {
|
||||||
|
// console.log('打印看看产线', this.$route.query.lineName)
|
||||||
|
this.queryParams.lineName = this.$route.query.lineName
|
||||||
|
this.searchBarFormConfig[2].defaultSelect = this.$route.query.lineName
|
||||||
|
}
|
||||||
|
if (this.$route.query.originalGlassOutputTime) {
|
||||||
|
console.log('你好', this.$route.query.originalGlassOutputTime)
|
||||||
|
this.queryParams.startTime = parseTime(new Date(Number(this.$route.query.originalGlassOutputTime)))
|
||||||
|
this.queryParams.endTime = parseTime(new Date(Number(this.$route.query.originalGlassOutputTime)))
|
||||||
|
this.searchBarFormConfig[3].defaultSelect = [
|
||||||
|
this.queryParams.startTime,
|
||||||
|
this.queryParams.endTime,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
this.getList()
|
||||||
|
this.getData()
|
||||||
|
this.getDict()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClick() {
|
||||||
|
this.getData()
|
||||||
|
},
|
||||||
|
getData() {
|
||||||
|
this.$axios({
|
||||||
|
url: this.activeName === 'day' ? this.dayMapUrl : this.activeName === 'week' ? this.weekMapUrl : this.monthMapUrl,
|
||||||
|
method: 'get',
|
||||||
|
params: this.queryParams
|
||||||
|
}).then((res) => {
|
||||||
|
let mapArr= []
|
||||||
|
let mapLegendData = []
|
||||||
|
let obj = {
|
||||||
|
name: '',
|
||||||
|
type: 'line',
|
||||||
|
// stack: 'Total',
|
||||||
|
data: [],
|
||||||
|
mapXAxisData: [],
|
||||||
|
}
|
||||||
|
// let mapXAxisData = []
|
||||||
|
for (let i in res.data) {
|
||||||
|
|
||||||
|
// console.log(i)
|
||||||
|
let dataArr = []
|
||||||
|
res.data[i].forEach(ele => {
|
||||||
|
dataArr.push(ele.num)
|
||||||
|
obj.mapXAxisData.push(ele.checkTime)
|
||||||
|
})
|
||||||
|
obj.name = i
|
||||||
|
obj.data = dataArr
|
||||||
|
mapLegendData.push(i)
|
||||||
|
mapArr.push(obj)
|
||||||
|
}
|
||||||
|
console.log(mapArr);
|
||||||
|
// console.log(res.data[res]);
|
||||||
|
var chartDom = this.activeName === 'day' ? document.getElementById('mapDayMain') : this.activeName === 'week' ? document.getElementById('mapWeekMain') : document.getElementById('mapMonthMain')
|
||||||
|
var myChart = echarts.init(chartDom);
|
||||||
|
var option;
|
||||||
|
option = {
|
||||||
|
title: {
|
||||||
|
text: '各类型缺陷对比图',
|
||||||
|
// top:'5px'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: mapLegendData,
|
||||||
|
top: "10%",
|
||||||
|
y: 'top',
|
||||||
|
x:'left'
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '3%',
|
||||||
|
right: '4%',
|
||||||
|
bottom: '3%',
|
||||||
|
top:'20%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
// toolbox: {
|
||||||
|
// feature: {
|
||||||
|
// saveAsImage: {}
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
// boundaryGap: false,
|
||||||
|
data: mapArr[0].mapXAxisData
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value'
|
||||||
|
},
|
||||||
|
series: mapArr
|
||||||
|
}
|
||||||
|
myChart.clear()
|
||||||
|
option && myChart.setOption(option);
|
||||||
|
})
|
||||||
|
this.$axios({
|
||||||
|
url: this.activeName === 'day' ? this.dayListUrl : this.activeName === 'week' ? this.weekListUrl : this.monthListUrl,
|
||||||
|
method: 'get',
|
||||||
|
params: this.queryParams
|
||||||
|
}).then((res) => {
|
||||||
|
// console.log(res);
|
||||||
|
let listNumArr = []
|
||||||
|
let listRatioArr = []
|
||||||
|
// let listLegendData = []
|
||||||
|
let listXAxisData = []
|
||||||
|
// for (let i in res.data) {
|
||||||
|
// console.log(i)
|
||||||
|
// let dataArr = []
|
||||||
|
res.data.forEach(ele => {;
|
||||||
|
listNumArr.push(ele.num)
|
||||||
|
listRatioArr.push(ele.ratio)
|
||||||
|
listXAxisData.push(ele.checkTime)
|
||||||
|
})
|
||||||
|
console.log(listNumArr);
|
||||||
|
// obj.name = i
|
||||||
|
// obj.data = dataArr
|
||||||
|
// listLegendData.push(i)
|
||||||
|
// listArr.push(obj)
|
||||||
|
// }
|
||||||
|
// console.log(res.data[res]);
|
||||||
|
var chartDom = this.activeName === 'day' ? document.getElementById('listDayMain') : this.activeName === 'week' ? document.getElementById('listWeekMain') : document.getElementById('listMonthMain')
|
||||||
|
var myChart = echarts.init(chartDom);
|
||||||
|
var option;
|
||||||
|
option = {
|
||||||
|
title: {
|
||||||
|
text: '缺陷率趋势图'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: ['缺陷数量', '缺陷率'],
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '3%',
|
||||||
|
right: '4%',
|
||||||
|
bottom: '3%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
// toolbox: {
|
||||||
|
// feature: {
|
||||||
|
// saveAsImage: {}
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
// boundaryGap: false,
|
||||||
|
data: listXAxisData
|
||||||
|
},
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value',
|
||||||
|
name: '缺陷数量',
|
||||||
|
// min: 0,
|
||||||
|
// max: 250,
|
||||||
|
// interval: 50,
|
||||||
|
// axisLabel: {
|
||||||
|
// formatter: '{value} ml'
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'value',
|
||||||
|
name: '缺陷率',
|
||||||
|
// min: 0,
|
||||||
|
// max: 25,
|
||||||
|
// interval: 5,
|
||||||
|
axisLabel: {
|
||||||
|
formatter: '{value} %'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '缺陷数量',
|
||||||
|
type: 'bar',
|
||||||
|
barWidth: '3%',
|
||||||
|
data: listNumArr,
|
||||||
|
// label: {
|
||||||
|
// show: true, //开启显示
|
||||||
|
// position: 'top', //在上方显示
|
||||||
|
// // formatter: '{c}%',//显示百分号
|
||||||
|
// textStyle: { //数值样式
|
||||||
|
// color: 'black',//字体颜色
|
||||||
|
// fontSize: 12//字体大小
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '缺陷率',
|
||||||
|
type: 'line',
|
||||||
|
yAxisIndex: 1,
|
||||||
|
tooltip: {
|
||||||
|
valueFormatter: function (value) {
|
||||||
|
return value + '%';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: listRatioArr
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
myChart.clear()
|
||||||
|
option && myChart.setOption(option);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 获取搜索栏的产线列表 */
|
||||||
|
async getDict() {
|
||||||
|
// const res = await getProductList()
|
||||||
|
// const result = await getWorkOrderList()
|
||||||
|
const res = await this.$axios({
|
||||||
|
url: '/extend/check-isra-standards/page',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
pageSize: 100,
|
||||||
|
pageNo:1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// console.log(res)
|
||||||
|
this.searchBarFormConfig[1].selectOptions = res.data.list
|
||||||
|
await getPdList().then((res) => {
|
||||||
|
// console.log(res);
|
||||||
|
this.searchBarFormConfig[2].selectOptions = res.data;
|
||||||
|
})
|
||||||
|
// this.searchBarFormConfig[1].selectOptions = res.data.map((item) => {
|
||||||
|
// return {
|
||||||
|
// name: item.name,
|
||||||
|
// id:item.id
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// this.searchBarFormConfig[0].selectOptions = result.data.map((item) => {
|
||||||
|
// return {
|
||||||
|
// name: item.name,
|
||||||
|
// id: item.id
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
// getProductLineList() {
|
||||||
|
// this.$axios('/base/production-line/listAll').then((response) => {
|
||||||
|
// this.searchBarFormConfig[0].selectOptions = response.data.map(
|
||||||
|
// (item) => {
|
||||||
|
// return {
|
||||||
|
// name: item.name,
|
||||||
|
// id: item.id,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
getList() {
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
/** 查询列表 */
|
||||||
|
async getDataList() {
|
||||||
|
console.log('查询条件', this.queryParams);
|
||||||
|
this.loading = true;
|
||||||
|
// 执行查询
|
||||||
|
const {
|
||||||
|
data: { data, otherList, otherMap, nameData },
|
||||||
|
} = await getQualityIsraPage(this.queryParams)
|
||||||
|
console.log(this.queryParams);
|
||||||
|
this.dynamicProps = this.filterNameData(nameData)
|
||||||
|
this.list = this.filterData(data);
|
||||||
|
},
|
||||||
|
filterNameData(nameData) {
|
||||||
|
const ndSet = new Set();
|
||||||
|
nameData.forEach((nd) => {
|
||||||
|
ndSet.add(nd.name);
|
||||||
|
});
|
||||||
|
return Array.from(ndSet.values())
|
||||||
|
.sort()
|
||||||
|
.map((name) => ({
|
||||||
|
prop: name,
|
||||||
|
label: name,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
filterData(data) {
|
||||||
|
return data.map((item) => {
|
||||||
|
const { data: innerData } = item;
|
||||||
|
const keyValuePairs = {};
|
||||||
|
innerData.map((d) => {
|
||||||
|
keyValuePairs[d.dynamicName] = d.dynamicValue;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
// inspectionContent: item.inspectionContent,
|
||||||
|
...keyValuePairs,
|
||||||
|
sumNum: item.sumNum,
|
||||||
|
// sumInput: item.sumInput,
|
||||||
|
// productionName: item.productionName,
|
||||||
|
checkType: item.checkType,
|
||||||
|
// scrapRatio: item.scrapRatio,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
handleSearchBarBtnClick(val) {
|
||||||
|
console.log('11111', val)
|
||||||
|
if (val.btnName === 'search') {
|
||||||
|
this.queryParams.checkDiscard = (val?.checkDiscard === 0 || val?.checkDiscard === 1) ? val?.checkDiscard : undefined
|
||||||
|
this.queryParams.lineName = val.lineName ? val.lineName : undefined
|
||||||
|
this.queryParams.checkType = val.checkType ? val.checkType : undefined
|
||||||
|
// this.queryParams.productionId = val.productionId ? val.productionId : undefined
|
||||||
|
this.queryParams.startTime = val.checkTime ? val.checkTime[0] : undefined
|
||||||
|
this.queryParams.endTime = val.checkTime ? val.checkTime[1] : undefined
|
||||||
|
|
||||||
|
this.getList()
|
||||||
|
this.getData()
|
||||||
|
}
|
||||||
|
console.log(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.blue-title {
|
||||||
|
position: relative;
|
||||||
|
padding: 4px 0;
|
||||||
|
padding-left: 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 6px;
|
||||||
|
height: 16px;
|
||||||
|
width: 4px;
|
||||||
|
border-radius: 1px;
|
||||||
|
background: #0b58ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
305
src/views/quality/transmittanceTesting.vue
Normal file
305
src/views/quality/transmittanceTesting.vue
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<base-table :max-height="tableH" :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize"
|
||||||
|
:table-data="list" @emitFun="handleEmitFun">
|
||||||
|
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" :method-list="tableBtn"
|
||||||
|
@clickBtn="handleTableBtnClick" /> -->
|
||||||
|
</base-table>
|
||||||
|
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList" />
|
||||||
|
|
||||||
|
<!-- 对话框(添加 / 修改) -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import moment from 'moment';
|
||||||
|
import { getPdList,} from '@/api/core/monitoring/auto';
|
||||||
|
import { getFactoryPage } from '@/api/core/base/factory';
|
||||||
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
import { getTranslucentPage, exportTranslucent } from '@/api/monitoring/defectSummary';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
|
export default {
|
||||||
|
name: 'QualityInspectionType',
|
||||||
|
mixins: [basicPageMixin, tableHeightMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// tableBtn: [
|
||||||
|
// this.$auth.hasPermi('base:quality-inspection-type:update')
|
||||||
|
// ? {
|
||||||
|
// type: 'edit',
|
||||||
|
// btnName: '修改',
|
||||||
|
// }
|
||||||
|
// : undefined,
|
||||||
|
// this.$auth.hasPermi('base:quality-inspection-type:delete')
|
||||||
|
// ? {
|
||||||
|
// type: 'delete',
|
||||||
|
// btnName: '删除',
|
||||||
|
// }
|
||||||
|
// : undefined,
|
||||||
|
// ].filter((v) => v),
|
||||||
|
tableProps: [
|
||||||
|
// {
|
||||||
|
// prop: 'createTime',
|
||||||
|
// label: '添加时间',
|
||||||
|
// fixed: true,
|
||||||
|
// width: 180,
|
||||||
|
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||||
|
// },
|
||||||
|
{ prop: 'factoryName', label: '工厂' },
|
||||||
|
{ prop: 'lineName', label: '产线' },
|
||||||
|
{ prop: 'timeVal', label: '时间段' },
|
||||||
|
{ prop: 'totalNum', label: '玻璃总数' },
|
||||||
|
{ prop: 'goodNum', label: '一等品数量' },
|
||||||
|
{ prop: 'passNum', label: '二等品数量' },
|
||||||
|
{ prop: 'scrapNum', label: '废片数' },
|
||||||
|
{ prop: 'passRate', label: '合格率' },
|
||||||
|
],
|
||||||
|
//
|
||||||
|
searchBarFormConfig: [
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '工厂',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'factoryId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
label: '产线',
|
||||||
|
selectOptions: [],
|
||||||
|
param: 'lineId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'datePicker',
|
||||||
|
label: '时间范围',
|
||||||
|
dateType: 'datetimerange',
|
||||||
|
format: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rangeSeparator: '-',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间',
|
||||||
|
param: 'timeVal',
|
||||||
|
width: 350
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: 'button',
|
||||||
|
// btnName: '重置',
|
||||||
|
// name: 'reset',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: 'separate',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: this.$auth.hasPermi('base:quality-inspection-type:create')
|
||||||
|
// ? 'button'
|
||||||
|
// : '',
|
||||||
|
// btnName: '新增',
|
||||||
|
// name: 'add',
|
||||||
|
// plain: true,
|
||||||
|
// color: 'success',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: this.$auth.hasPermi('monitoring:translucent:export')
|
||||||
|
? 'button'
|
||||||
|
: '',
|
||||||
|
btnName: '导出',
|
||||||
|
name: 'export',
|
||||||
|
color: 'warning',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// 表单配置
|
||||||
|
// formRows: [
|
||||||
|
// [
|
||||||
|
// {
|
||||||
|
// input: true,
|
||||||
|
// label: '检测类型名称',
|
||||||
|
// prop: 'name',
|
||||||
|
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||||
|
// // bind: {
|
||||||
|
// // disabled: true, // some condition, like detail mode...
|
||||||
|
// // }
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// [{ input: true, label: '检测类型编码', prop: 'code' }],
|
||||||
|
// [{ input: true, label: '备注', prop: 'remark' }],
|
||||||
|
// ],
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
lineId: undefined,
|
||||||
|
factoryId: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// watch: {
|
||||||
|
// form: {
|
||||||
|
// handler: (val) => {
|
||||||
|
// console.log('form changed', val);
|
||||||
|
// },
|
||||||
|
// deep: true
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getDict()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getDict() {
|
||||||
|
getPdList().then(res => {
|
||||||
|
this.searchBarFormConfig[1].selectOptions = res.data || [];
|
||||||
|
});
|
||||||
|
getFactoryPage({ pageSize: 100, pageNo: 1 }).then(res => {
|
||||||
|
this.searchBarFormConfig[0].selectOptions = res.data.list || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** base table related */
|
||||||
|
handleTableBtnClick({ data, type }) {
|
||||||
|
switch (type) {
|
||||||
|
case 'edit':
|
||||||
|
this.handleUpdate(data);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
this.handleDelete(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** search bar related */
|
||||||
|
handleSearchBarBtnClick(btn) {
|
||||||
|
console.log('btn',btn);
|
||||||
|
|
||||||
|
// const keys = ['name'];
|
||||||
|
switch (btn.btnName) {
|
||||||
|
case 'search':
|
||||||
|
this.queryParams.lineId = btn.lineId ? btn.lineId : undefined
|
||||||
|
this.queryParams.factoryId = btn.factoryId ? btn.factoryId : undefined
|
||||||
|
this.queryParams.startTime = btn.timeVal ? btn.timeVal[0] : undefined
|
||||||
|
this.queryParams.endTime = btn.timeVal ? btn.timeVal[1] : undefined
|
||||||
|
// keys.forEach((key) => {
|
||||||
|
// this.queryParams[key] = btn[key] || null;
|
||||||
|
// });
|
||||||
|
this.getList();
|
||||||
|
break;
|
||||||
|
case 'add':
|
||||||
|
this.handleAdd();
|
||||||
|
break;
|
||||||
|
case 'export':
|
||||||
|
this.handleExport();
|
||||||
|
break;
|
||||||
|
case 'reset':
|
||||||
|
this.$refs['search-bar'].resetForm();
|
||||||
|
this.resetQuery();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 执行查询
|
||||||
|
getTranslucentPage(this.queryParams).then((res) => {
|
||||||
|
this.list = res.data.list ? res.data.list.map((item) => {
|
||||||
|
const startTime = item.startTime ? moment(item.startTime).format('YYYY-MM-DD HH:mm:ss') : '';
|
||||||
|
const endTime = item.endTime ? moment(item.endTime).format('YYYY-MM-DD HH:mm:ss') : '';
|
||||||
|
|
||||||
|
// 拼接开始时间和结束时间,中间用“至”连接
|
||||||
|
const timeVal = startTime && endTime ? `${startTime} 至 ${endTime}` : '';
|
||||||
|
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
timeVal: timeVal
|
||||||
|
};
|
||||||
|
}) :[]
|
||||||
|
this.total = res.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
// reset() {
|
||||||
|
// this.form = {
|
||||||
|
// id: undefined,
|
||||||
|
// name: undefined,
|
||||||
|
// code: undefined,
|
||||||
|
// remark: undefined,
|
||||||
|
// };
|
||||||
|
// this.resetForm('form');
|
||||||
|
// },
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
// handleAdd() {
|
||||||
|
// this.reset();
|
||||||
|
// this.open = true;
|
||||||
|
// this.title = '添加质量检测类型基础';
|
||||||
|
// },
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
// handleUpdate(row) {
|
||||||
|
// this.reset();
|
||||||
|
// const id = row.id;
|
||||||
|
// getQualityInspectionType(id).then((response) => {
|
||||||
|
// this.form = response.data;
|
||||||
|
// this.open = true;
|
||||||
|
// this.title = '修改质量检测类型基础';
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
/** 提交按钮 */
|
||||||
|
// submitForm() {
|
||||||
|
// // console.log('this.$refs.form', this.$refs.form);
|
||||||
|
// // return;
|
||||||
|
// this.$refs['form'].validate((valid) => {
|
||||||
|
// if (!valid) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// console.log('final form', JSON.stringify(this.form));
|
||||||
|
// // 修改的提交
|
||||||
|
// if (this.form.id != null) {
|
||||||
|
// updateQualityInspectionType(this.form).then((response) => {
|
||||||
|
// this.$modal.msgSuccess('修改成功');
|
||||||
|
// this.open = false;
|
||||||
|
// this.getList();
|
||||||
|
// });
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// // 添加的提交
|
||||||
|
// createQualityInspectionType(this.form).then((response) => {
|
||||||
|
// this.$modal.msgSuccess('新增成功');
|
||||||
|
// this.open = false;
|
||||||
|
// this.getList();
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let params = { ...this.queryParams };
|
||||||
|
// params.pageNo = undefined;
|
||||||
|
// params.pageSize = undefined;
|
||||||
|
this.$modal
|
||||||
|
.confirm('是否确认导出透光率检测?')
|
||||||
|
.then(() => {
|
||||||
|
this.exportLoading = true;
|
||||||
|
return exportTranslucent(params);
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
this.$download.excel(response, '透光率检测.xls');
|
||||||
|
this.exportLoading = false;
|
||||||
|
})
|
||||||
|
.catch(() => { });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
46
src/views/report/files/index.vue
Normal file
46
src/views/report/files/index.vue
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<!-- index.vue 完整代码 -->
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<i-frame :src="url" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import iFrame from "@/components/iFrame/index";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { iFrame },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
url: "http://192.168.0.33:7777/files/",
|
||||||
|
isLoginSuccess: false, // 登录成功后再加载iframe
|
||||||
|
};
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
try {
|
||||||
|
// 1. 调用目标网页的登录接口(需替换为实际登录接口地址)
|
||||||
|
const loginRes = await axios.post(
|
||||||
|
"http://192.168.0.33:7777/api/login", // 目标网页的登录接口
|
||||||
|
{
|
||||||
|
username: "admin",
|
||||||
|
password: "VSKqN1Wnr_id355z",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// 关键:允许跨域请求携带Cookie
|
||||||
|
withCredentials: true,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 2. 登录成功后标记状态,加载iframe
|
||||||
|
if (loginRes.data.code === 200) {
|
||||||
|
this.isLoginSuccess = true;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("免登失败:", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user