迁移预警中心模块
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled

- 新增计划与生产预警中心 V2 页面

- 新增预警中心接口、路由和中英文文案

- 更新迁移任务列表中的预警中心状态
This commit is contained in:
sheng
2026-06-22 15:24:59 +08:00
parent 8ef087676f
commit b942d24f2c
6 changed files with 476 additions and 3 deletions

View File

@@ -0,0 +1,59 @@
import { request } from '@/api/_service'
const BASE = 'planning_production/produce/pin_check/'
function apiParams (method, data = {}) {
return {
method,
platform: 'background',
...data
}
}
export function getPincheckWorkstation (data) {
return request({
url: BASE + 'workstation',
method: 'get',
params: apiParams('planning_production_produce_pincheck_workstation', data)
})
}
export function getDevicePinCheckList (data) {
return request({
url: BASE + 'list',
method: 'get',
params: apiParams('planning_production_produce_pincheck_list', data)
})
}
export function getPinCheckDetail (data) {
return request({
url: BASE + 'detail',
method: 'get',
params: apiParams('planning_production_produce_pincheck_detail', data)
})
}
export function setPinCheckClean (data) {
return request({
url: BASE + 'clean',
method: 'get',
params: apiParams('planning_production_produce_pincheck_clean', data)
})
}
export function setPinCheckCleanSingle (data) {
return request({
url: BASE + 'clean_single_channel',
method: 'get',
params: apiParams('planning_production_produce_pincheck_clean_single_channel', data)
})
}
export function getWorkstationSearch (data) {
return request({
url: BASE + 'search',
method: 'get',
params: apiParams('planning_production_produce_pincheck_search', data)
})
}

View File

@@ -994,6 +994,51 @@
"previous_process": "Previous Process",
"current_process": "Current Process"
}
},
"alert_center": {
"refresh": "Refresh",
"continuous_count": "Consecutive Channel Errors (3x)",
"cumulative_count": "Cumulative Channel Errors (10x)",
"continuous": "3 Consecutive Errors",
"cumulative": "10 Cumulative Errors",
"error_channel_count": "Error Channel Count",
"last_clear_time": "Last Cleared At",
"update_time": "Update Time",
"detail_continuous": "3 Consecutive Error Details",
"detail_cumulative": "10 Cumulative Error Details",
"view_data": "View Data",
"operation": "Actions",
"detail": "Details",
"clear": "Clear",
"confirm": "Confirm",
"cancel": "Cancel",
"error_code": "Error Code",
"error_message": "Error Message",
"error_time": "Error Time",
"clear_confirm": "Confirmed resolved. Clear alarm data?",
"clear_success": "Cleared successfully",
"clear_cancel": "Operation canceled",
"prompt": "Notice",
"device_name": "Device Name",
"channel": "Channel",
"channel_no": "Channel No.",
"device_code": "Device Code",
"query": "Search",
"reset": "Reset",
"export": "Export",
"select_time": "Select Time",
"start_date": "Start Date",
"end_date": "End Date",
"workstation": "Workstation",
"select_device": "Please select device",
"select_workstation": "Please select workstation",
"please_select_time": "Please select time",
"please_select_workstation": "Please select a workstation to query",
"export_confirm_message": "Exporting requires creating a download task first. Continue?",
"create_download_task_success": "Download task created successfully",
"continuous_detail": "{device_name} ({device_code}): 3 Consecutive Error Details",
"accumulated_detail": "{device_name} ({device_code}): 10 Cumulative Error Details",
"workstation_detail": "Workstation [{device_name}] Channel Error Details"
}
}
},

View File

@@ -994,6 +994,51 @@
"previous_process": "上一工序",
"current_process": "当前工序"
}
},
"alert_center": {
"refresh": "刷新",
"continuous_count": "连续3次通道异常设备数量",
"cumulative_count": "累计10次通道异常设备数量",
"continuous": "连续3次通道异常",
"cumulative": "累计10次通道异常",
"error_channel_count": "异常通道数量",
"last_clear_time": "上次清除时间",
"update_time": "更新时间",
"detail_continuous": "3次连续通道异常详情",
"detail_cumulative": "10次累计通道异常详情",
"view_data": "查看数据",
"operation": "操作",
"detail": "详情",
"clear": "清除",
"confirm": "确定",
"cancel": "取消",
"error_code": "异常码",
"error_message": "异常信息",
"error_time": "异常时间",
"clear_confirm": "此操作是已确认通道报警信息已解决,是否继续清除",
"clear_success": "清除成功!",
"clear_cancel": "已取消操作",
"prompt": "提示",
"device_name": "设备名称",
"channel": "通道",
"channel_no": "通道号",
"device_code": "设备编码",
"query": "查询",
"reset": "重置",
"export": "导出",
"select_time": "选择时间",
"start_date": "开始日期",
"end_date": "结束日期",
"workstation": "工作站",
"select_device": "请选择设备",
"select_workstation": "请选择工作站",
"please_select_time": "请选择时间",
"please_select_workstation": "请选择要查询工作站",
"export_confirm_message": "数据导出需要先创建下载任务(可在系统顶部系统下载任务中查看下载进度并下载文件),是否继续?",
"create_download_task_success": "创建下载任务成功",
"continuous_detail": "{device_name}({device_code}) 3次连续通道异常详情",
"accumulated_detail": "{device_name}({device_code}) 10次累计通道异常详情",
"workstation_detail": "【{device_name}】工作站设备通道异常详情"
}
}
},

View File

@@ -32,6 +32,12 @@ export default {
meta: { ...meta, cache: true, title: '生产批次不良报表' },
component: _import('planning-production/batch-management/batch-defect-report')
},
{
path: 'produce/report/pin_check',
name: `${pre}report-pin_check`,
meta: { ...meta, cache: true, title: '预警中心' },
component: _import('planning-production/alert-center')
},
{
path: 'produce/monitor/tray_manage',
name: `${pre}monitor-tray_manage`,

View File

@@ -0,0 +1,318 @@
<template>
<d2-container>
<template #header>
<div class="toolbar">
<el-button size="mini" type="primary" icon="el-icon-refresh" :disabled="loading" @click="fetchData">
{{ $t(key('refresh')) }}
</el-button>
</div>
</template>
<div v-loading="loading" class="alert-center">
<el-empty v-if="!workstations.length" :description="$t('暂无数据')" />
<div v-else class="station-grid">
<div v-for="item in workstations" :key="item.workstation_id || item.id || item.name" class="station-card">
<div class="station-title">
<span>{{ $t(key('device_name')) }}: {{ item.name }}</span>
</div>
<div class="station-body">
<el-badge :value="item.consecutive_error_device_count" type="primary">
<el-button size="small" class="metric-btn">
{{ $t(key('continuous_count')) }}
</el-button>
</el-badge>
<el-badge :value="item.cumulative_error_device_count" type="warning">
<el-button size="small" class="metric-btn">
{{ $t(key('cumulative_count')) }}
</el-button>
</el-badge>
<el-button
v-if="Number(item.consecutive_error_device_count) > 0 || Number(item.cumulative_error_device_count) > 0"
type="primary"
size="mini"
@click="openWorkstation(item)"
>
{{ $t(key('view_data')) }}
</el-button>
</div>
</div>
</div>
</div>
<el-dialog
:title="workstationDialogTitle"
:visible.sync="workstationDialogVisible"
fullscreen
:before-close="closeWorkstationDialog"
>
<el-row :gutter="20">
<el-col :span="12">
<el-card>
<div slot="header">{{ $t(key('continuous')) }}</div>
<el-table :data="consecutiveData" border v-loading="detailLoading">
<el-table-column type="expand">
<template #default="{ row }">
<div class="channel-list">
<el-badge
v-for="(value, channel) in row.consecutive_error_times"
:key="channel"
:value="value"
>
<el-button size="small" @click="clearSingle(row, 'continuous', channel)">
{{ $t(key('channel')) }} {{ Number(channel) + 1 }}
</el-button>
</el-badge>
</div>
</template>
</el-table-column>
<el-table-column prop="device_name" :label="$t(key('device_name'))" min-width="130" />
<el-table-column prop="device_code" :label="$t(key('device_code'))" min-width="130" />
<el-table-column prop="consecutive_error_channel_count" :label="$t(key('error_channel_count'))" min-width="120" />
<el-table-column prop="consecutive_last_clear_date" :label="$t(key('last_clear_time'))" min-width="150" />
<el-table-column prop="date" :label="$t(key('update_time'))" min-width="180" />
<el-table-column :label="$t(key('operation'))" align="center" min-width="160">
<template #default="{ row }">
<el-button size="mini" type="text" @click="openDetail(row, 'continuous')">
{{ $t(key('detail')) }}
</el-button>
<el-button size="mini" type="text" @click="clearDevice(row, 'continuous')">
{{ $t(key('clear')) }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="12">
<el-card>
<div slot="header">{{ $t(key('cumulative')) }}</div>
<el-table :data="cumulativeData" border v-loading="detailLoading">
<el-table-column type="expand">
<template #default="{ row }">
<div class="channel-list">
<el-badge
v-for="(value, channel) in row.cumulative_error_times"
:key="channel"
:value="value"
>
<el-button size="small" @click="clearSingle(row, 'cumulative', channel)">
{{ $t(key('channel')) }} {{ Number(channel) + 1 }}
</el-button>
</el-badge>
</div>
</template>
</el-table-column>
<el-table-column prop="device_name" :label="$t(key('device_name'))" min-width="130" />
<el-table-column prop="device_code" :label="$t(key('device_code'))" min-width="130" />
<el-table-column prop="cumulative_error_channel_count" :label="$t(key('error_channel_count'))" min-width="120" />
<el-table-column prop="cumulative_last_clear_date" :label="$t(key('last_clear_time'))" min-width="150" />
<el-table-column prop="date" :label="$t(key('update_time'))" min-width="180" />
<el-table-column :label="$t(key('operation'))" align="center" min-width="160">
<template #default="{ row }">
<el-button size="mini" type="text" @click="openDetail(row, 'cumulative')">
{{ $t(key('detail')) }}
</el-button>
<el-button size="mini" type="text" @click="clearDevice(row, 'cumulative')">
{{ $t(key('clear')) }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-dialog>
<el-dialog :title="detailTitle" :visible.sync="detailDialogVisible" width="80%">
<el-table :data="detailData" border v-loading="detailTableLoading" height="600">
<el-table-column prop="device_name" :label="$t(key('device_name'))" min-width="130" show-overflow-tooltip />
<el-table-column prop="device_code" :label="$t(key('device_code'))" min-width="130" show-overflow-tooltip />
<el-table-column prop="channel" :label="$t(key('channel_no'))" min-width="100" />
<el-table-column prop="pin_code" :label="$t(key('error_code'))" min-width="120" />
<el-table-column prop="msg" :label="$t(key('error_message'))" min-width="160" />
<el-table-column prop="happen_time" :label="$t(key('error_time'))" min-width="160" />
</el-table>
</el-dialog>
</d2-container>
</template>
<script>
import { i18nMixin } from '@/composables/useI18n'
import {
getPincheckWorkstation,
getDevicePinCheckList,
getPinCheckDetail,
setPinCheckClean,
setPinCheckCleanSingle
} from '@/api/planning-production/alert-center'
export default {
name: 'planning-production-alert-center',
mixins: [i18nMixin('page.planning_production.alert_center')],
data () {
return {
loading: false,
detailLoading: false,
detailTableLoading: false,
workstations: [],
currentWorkstation: null,
workstationDialogVisible: false,
workstationDialogTitle: '',
consecutiveData: [],
cumulativeData: [],
detailDialogVisible: false,
detailTitle: '',
detailData: []
}
},
mounted () {
this.fetchData()
},
methods: {
normalizeData (res) {
const data = res && res.data !== undefined ? res.data : res
return data || []
},
fetchData () {
this.loading = true
getPincheckWorkstation({})
.then(res => {
this.workstations = this.normalizeData(res)
})
.finally(() => {
this.loading = false
})
},
openWorkstation (item) {
this.currentWorkstation = item
this.workstationDialogTitle = this.$t(this.key('workstation_detail'), { device_name: item.name })
this.workstationDialogVisible = true
this.fetchDeviceDetails(item)
},
fetchDeviceDetails (item) {
this.detailLoading = true
getDevicePinCheckList({ device_category_id: item.workstation_id })
.then(res => {
const data = this.normalizeData(res)
this.consecutiveData = data.consecutive_data || []
this.cumulativeData = data.cumulative_data || []
})
.finally(() => {
this.detailLoading = false
})
},
closeWorkstationDialog () {
this.workstationDialogVisible = false
},
openDetail (row, type) {
this.detailDialogVisible = true
this.detailTableLoading = true
this.detailTitle = this.$t(this.key(type === 'continuous' ? 'continuous_detail' : 'accumulated_detail'), {
device_name: row.device_name,
device_code: row.device_code
})
getPinCheckDetail({
device_category_id: row.workstation_id,
device_code: row.device_code,
type
})
.then(res => {
this.detailData = this.normalizeData(res)
})
.finally(() => {
this.detailTableLoading = false
})
},
confirmClear (handler) {
this.$confirm(this.$t(this.key('clear_confirm')), this.$t(this.key('prompt')), {
confirmButtonText: this.$t(this.key('confirm')),
cancelButtonText: this.$t(this.key('cancel')),
type: 'warning',
center: true
})
.then(handler)
.catch(() => {
this.$message.info(this.$t(this.key('clear_cancel')))
})
},
clearDevice (row, type) {
this.confirmClear(() => {
return setPinCheckClean({
device_code: row.device_code,
type
}).then(() => {
this.refreshAfterClear(row)
})
})
},
clearSingle (row, type, channel) {
this.confirmClear(() => {
return setPinCheckCleanSingle({
device_code: row.device_code,
type,
indexs: channel
}).then(() => {
this.refreshAfterClear(row)
})
})
},
refreshAfterClear (row) {
this.$message.success(this.$t(this.key('clear_success')))
this.fetchData()
this.fetchDeviceDetails({
workstation_id: row.workstation_id,
name: row.device_name
})
}
}
}
</script>
<style scoped>
.toolbar {
margin-bottom: -18px;
}
.alert-center {
height: 100%;
overflow: auto;
}
.station-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 14px;
}
.station-card {
min-height: 220px;
border: 1px solid #dcdfe6;
border-radius: 8px;
background: #fff;
text-align: center;
overflow: hidden;
}
.station-title {
min-height: 58px;
border-bottom: 1px solid #dcdfe6;
display: flex;
align-items: center;
justify-content: center;
padding: 8px;
font-size: 14px;
}
.station-body {
display: flex;
flex-direction: column;
gap: 18px;
align-items: center;
padding: 22px 10px;
}
.metric-btn {
width: 170px;
white-space: normal;
}
.channel-list {
display: flex;
flex-wrap: wrap;
gap: 18px;
padding: 10px;
}
</style>