feat(report): 新增设备参数异常报表、SPC统计过程控制报表和切换追溯报表功能
- 实现设备参数异常报表,支持日报、班报、月报和自定义时间范围查询 - 添加SPC统计过程控制报表,提供参数趋势图表和关键质量指标分析 - 开发切换追溯报表功能,追踪模具、物料、产品的切换对参数的影响 - 集成参数选项获取和各类报表数据查询API接口 - 设计并实现物料选择器组件用于物料相关报表筛选 - 优化报表界面布局和交互体验,提升数据分析效率master
parent
28423e07f0
commit
9ca9d1439e
@ -0,0 +1,37 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询参数选项
|
||||||
|
export function getParamOptions(query) {
|
||||||
|
return request({
|
||||||
|
url: '/report/deviceParamAnalysis/paramOptions',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询参数异常报表
|
||||||
|
export function listAnomalyReport(query) {
|
||||||
|
return request({
|
||||||
|
url: '/report/deviceParamAnalysis/anomaly/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询参数趋势/SPC报表
|
||||||
|
export function getSpcReport(query) {
|
||||||
|
return request({
|
||||||
|
url: '/report/deviceParamAnalysis/spc',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询模具/物料/产品切换追溯报表
|
||||||
|
export function listSwitchTraceReport(query) {
|
||||||
|
return request({
|
||||||
|
url: '/report/deviceParamAnalysis/switch/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="选择物料"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="960px"
|
||||||
|
append-to-body
|
||||||
|
@open="handleOpen"
|
||||||
|
>
|
||||||
|
<el-form :model="queryParams" size="small" :inline="true" label-width="68px">
|
||||||
|
<el-form-item label="物料编码">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.materialCode"
|
||||||
|
placeholder="请输入物料编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料名称">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.materialName"
|
||||||
|
placeholder="请输入物料名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
ref="materialTable"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="displayList"
|
||||||
|
height="420"
|
||||||
|
border
|
||||||
|
highlight-current-row
|
||||||
|
row-key="objId"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
@row-dblclick="handleRowDblclick"
|
||||||
|
>
|
||||||
|
<el-table-column label="物料编码" prop="materialCode" min-width="150" />
|
||||||
|
<el-table-column label="物料名称" prop="materialName" min-width="320" show-overflow-tooltip />
|
||||||
|
<el-table-column label="MATKL" prop="materialMatkl" min-width="120" />
|
||||||
|
<el-table-column label="计量单位" prop="materialUnit" min-width="100" />
|
||||||
|
<el-table-column label="所属工厂" prop="plantName" min-width="140" />
|
||||||
|
<el-table-column label="启用标识" prop="isFlag" min-width="90">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.isFlag === 0 ? '启用' : '停用' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<span style="float: left; color: #909399;">共 {{ displayList.length }} 条</span>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="handleConfirm">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listAllMaterialInfo } from '@/api/base/materialInfo'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'MaterialSelector',
|
||||||
|
props: {
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
selectedMaterialCode: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
loaded: false,
|
||||||
|
queryParams: {
|
||||||
|
materialCode: '',
|
||||||
|
materialName: ''
|
||||||
|
},
|
||||||
|
materialList: [],
|
||||||
|
displayList: [],
|
||||||
|
currentRow: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
dialogVisible: {
|
||||||
|
get() {
|
||||||
|
return this.visible
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$emit('update:visible', value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleOpen() {
|
||||||
|
this.resetQuery()
|
||||||
|
if (!this.loaded) {
|
||||||
|
this.loadMaterialList()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.syncCurrentSelection()
|
||||||
|
},
|
||||||
|
loadMaterialList() {
|
||||||
|
this.loading = true
|
||||||
|
listAllMaterialInfo()
|
||||||
|
.then(response => {
|
||||||
|
this.materialList = response.data || []
|
||||||
|
this.loaded = true
|
||||||
|
this.syncCurrentSelection()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
const codeKeyword = (this.queryParams.materialCode || '').trim().toLowerCase()
|
||||||
|
const nameKeyword = (this.queryParams.materialName || '').trim().toLowerCase()
|
||||||
|
this.displayList = this.materialList.filter(item => {
|
||||||
|
const materialCode = (item.materialCode || '').toLowerCase()
|
||||||
|
const materialName = (item.materialName || '').toLowerCase()
|
||||||
|
return materialCode.includes(codeKeyword) && materialName.includes(nameKeyword)
|
||||||
|
})
|
||||||
|
this.syncCurrentSelection()
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.queryParams.materialCode = ''
|
||||||
|
this.queryParams.materialName = ''
|
||||||
|
this.handleQuery()
|
||||||
|
},
|
||||||
|
handleCurrentChange(row) {
|
||||||
|
this.currentRow = row
|
||||||
|
},
|
||||||
|
handleRowDblclick(row) {
|
||||||
|
this.currentRow = row
|
||||||
|
this.handleConfirm()
|
||||||
|
},
|
||||||
|
handleConfirm() {
|
||||||
|
if (!this.currentRow) {
|
||||||
|
this.$modal.msgWarning('请选择物料')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$emit('confirm', this.currentRow)
|
||||||
|
this.dialogVisible = false
|
||||||
|
},
|
||||||
|
syncCurrentSelection() {
|
||||||
|
this.currentRow = this.displayList.find(item => item.materialCode === this.selectedMaterialCode) || null
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.$refs.materialTable) {
|
||||||
|
this.$refs.materialTable.setCurrentRow(this.currentRow || null)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -0,0 +1,227 @@
|
|||||||
|
<template>
|
||||||
|
<div class="report-pane">
|
||||||
|
<el-form :model="queryParams" size="small" :inline="true" label-width="84px" class="search-form">
|
||||||
|
<el-form-item label="设备">
|
||||||
|
<el-select v-model="queryParams.deviceCode" clearable filterable placeholder="全部设备" style="width: 180px;">
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.deviceCode"
|
||||||
|
:label="item.deviceName || item.deviceCode"
|
||||||
|
:value="item.deviceCode"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="切换类型">
|
||||||
|
<el-select v-model="queryParams.switchType" placeholder="请选择切换类型" style="width: 160px;">
|
||||||
|
<el-option label="全部" value="ALL" />
|
||||||
|
<el-option label="模具" value="MOLD" />
|
||||||
|
<el-option label="物料" value="MATERIAL" />
|
||||||
|
<el-option label="产品" value="PRODUCT" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="观察窗口">
|
||||||
|
<el-input-number v-model="queryParams.observeMinutes" :min="1" :max="1440" controls-position="right" />
|
||||||
|
<span class="form-suffix">分钟</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="时间范围">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="dateRange"
|
||||||
|
type="datetimerange"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始时间"
|
||||||
|
end-placeholder="结束时间"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
style="width: 360px;"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="tableList" border stripe :row-class-name="tableRowClassName">
|
||||||
|
<el-table-column label="设备" min-width="160">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>{{ scope.row.deviceName || '-' }}</div>
|
||||||
|
<div class="sub-text">{{ scope.row.deviceCode }}</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="切换类型" prop="switchType" width="100" align="center" />
|
||||||
|
<el-table-column label="参数" min-width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>{{ scope.row.paramName }}</div>
|
||||||
|
<div class="sub-text">{{ scope.row.paramCode }}</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="切换时间" width="170">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ parseTime(scope.row.changeTime) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="切换前" min-width="150" show-overflow-tooltip>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.beforeValue || "-" }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="切换后" min-width="150" show-overflow-tooltip>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.afterValue || "-" }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="产量增量" prop="outputIncrement" width="110" align="center" />
|
||||||
|
<el-table-column label="异常次数" prop="abnormalCount" width="100" align="center" />
|
||||||
|
<el-table-column label="观察状态" width="110" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="getStatusTagType(scope.row.latestStatus)">{{ scope.row.latestStatus || "未知" }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listSwitchTraceReport } from '@/api/report/deviceParamAnalysis'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SwitchTraceReport',
|
||||||
|
props: {
|
||||||
|
deviceList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
defaultDeviceCode: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
total: 0,
|
||||||
|
tableList: [],
|
||||||
|
dateRange: [],
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
deviceCode: '',
|
||||||
|
switchType: 'ALL',
|
||||||
|
observeMinutes: 30,
|
||||||
|
scene: 'switch',
|
||||||
|
startTime: '',
|
||||||
|
endTime: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initDefaultRange()
|
||||||
|
this.queryParams.deviceCode = this.defaultDeviceCode || ''
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initDefaultRange() {
|
||||||
|
const end = new Date()
|
||||||
|
const start = new Date(end.getTime() - 24 * 60 * 60 * 1000)
|
||||||
|
this.dateRange = [this.formatDateTime(start), this.formatDateTime(end)]
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
if (!this.dateRange || this.dateRange.length !== 2) {
|
||||||
|
this.$message.warning('请选择时间范围')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.queryParams.startTime = this.dateRange[0]
|
||||||
|
this.queryParams.endTime = this.dateRange[1]
|
||||||
|
this.loading = true
|
||||||
|
listSwitchTraceReport(this.queryParams).then(response => {
|
||||||
|
this.tableList = response.rows || []
|
||||||
|
this.total = response.total || 0
|
||||||
|
this.loading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.queryParams = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
deviceCode: this.defaultDeviceCode || '',
|
||||||
|
switchType: 'ALL',
|
||||||
|
observeMinutes: 30,
|
||||||
|
scene: 'switch',
|
||||||
|
startTime: '',
|
||||||
|
endTime: ''
|
||||||
|
}
|
||||||
|
this.tableList = []
|
||||||
|
this.total = 0
|
||||||
|
this.initDefaultRange()
|
||||||
|
},
|
||||||
|
formatDateTime(date) {
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = `${date.getMonth() + 1}`.padStart(2, '0')
|
||||||
|
const day = `${date.getDate()}`.padStart(2, '0')
|
||||||
|
const hour = `${date.getHours()}`.padStart(2, '0')
|
||||||
|
const minute = `${date.getMinutes()}`.padStart(2, '0')
|
||||||
|
const second = `${date.getSeconds()}`.padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
||||||
|
},
|
||||||
|
getStatusTagType(status) {
|
||||||
|
if (status === '报警') {
|
||||||
|
return 'danger'
|
||||||
|
}
|
||||||
|
if (status === '停机') {
|
||||||
|
return 'warning'
|
||||||
|
}
|
||||||
|
if (status === '运行') {
|
||||||
|
return 'success'
|
||||||
|
}
|
||||||
|
return 'info'
|
||||||
|
},
|
||||||
|
tableRowClassName({ row }) {
|
||||||
|
if ((row.abnormalCount || 0) > 0 || row.latestStatus === '报警') {
|
||||||
|
return 'danger-row'
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.report-pane {
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-form {
|
||||||
|
padding: 16px 16px 0;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
background: #fafafa;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-suffix {
|
||||||
|
margin-left: 8px;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-text {
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .danger-row {
|
||||||
|
background: #fff7f7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue