chore: update project changes

This commit is contained in:
meswork764
2026-06-09 08:37:50 +08:00
parent 6f9f8fe148
commit 0bf5f3f704
14 changed files with 3429 additions and 145 deletions

View File

@@ -164,7 +164,7 @@ let clockTimer = null
let resizeHandler = null
const summary = reactive({
equipmentTotal: 18,
equipmentTotal: 23,
running: 10,
running2: 0,
standby: 4,
@@ -595,11 +595,14 @@ const searchPlanExecuteData = () => {
const applyDashboardData = rows => {
const first = getFirstRow(rows)
summary.equipmentTotal = 18
summary.equipmentTotal = 23
summary.running = first.运行数量 || 0
summary.standby = first.待机数量 || 0
summary.alarm = first.报警数量 || 0
summary.shutdown = first.关机数量 || 0
// summary.standby = first.待机数量 || 0
// summary.alarm = first.报警数量 || 0
// summary.shutdown = first.关机数量 || 0
summary.standby = 0
summary.alarm = 0
summary.shutdown = 0
}
const applydeviceData = rows => {
@@ -924,6 +927,10 @@ onMounted(() => {
initCharts()
})
searchDashboardData()
setInterval(function(){
searchDashboardData()
},600000)
})
onUnmounted(() => {

View File

@@ -115,28 +115,28 @@ const summaryCards = ref([
className: 'urgent-card',
valueClass: 'blue-text'
},
{
title: '关键工序任务',
value: 14,
unit: '单',
icon: icons.shield,
className: 'key-card',
valueClass: 'purple-text'
},
{
title: '缺勤人员',
value: 4,
unit: '人',
icon: icons.user,
className: 'absence-card',
valueClass: 'orange-text',
people: [
{ name: '张三', station: '铣床1#' },
{ name: '王五', station: '车床2#' },
{ name: '孙八', station: '磨床1#' },
{ name: '郑十一', station: '检验台1#' }
]
}
// {
// title: '关键工序任务',
// value: 14,
// unit: '单',
// icon: icons.shield,
// className: 'key-card',
// valueClass: 'purple-text'
// },
// {
// title: '缺勤人员',
// value: 4,
// unit: '人',
// icon: icons.user,
// className: 'absence-card',
// valueClass: 'orange-text',
// people: [
// { name: '张三', station: '铣床1#' },
// { name: '王五', station: '车床2#' },
// { name: '孙八', station: '磨床1#' },
// { name: '郑十一', station: '检验台1#' }
// ]
// }
])
const urgentRows = ref([])
@@ -257,12 +257,121 @@ const boardBaseConfig = {
// 格式化工序进度详情为HTML
// 格式化工序进度详情为HTML
// 格式化工序进度详情为HTML
const blueProcessStyle = 'color: #09a8ff; font-weight: 700;'
const greenProcessStyle = 'color: #28d961; font-weight: 700;'
const toNumber = value => {
const num = Number(value)
return Number.isFinite(num) ? num : 0
}
const parseProcessStep = step => {
const parts = step.split('|')
const hasLineNo = parts[4] !== undefined && parts[4] !== '' && !Number.isNaN(Number(parts[4]))
return {
name: parts[0] || '',
status: parts[1] || '0',
count: parts[2] || '0',
planDate: parts[3] || '',
assignee: hasLineNo ? '' : (parts[4] || ''),
outsourceGroup: hasLineNo ? (parts[5] || '') : (parts[5] || ''),
lineNo: hasLineNo ? toNumber(parts[4]) : null,
issueQty: hasLineNo ? toNumber(parts[6]) : 0,
badQty: hasLineNo ? toNumber(parts[7]) : 0
}
}
const isBlueProcess = (status, count) => {
const statusNum = parseInt(status)
const countNum = parseInt(count)
return statusNum === 6 || statusNum === 3 || countNum > 0
}
const isOutsourceProcess = process => (
process.assignee === '外协' ||
process.name.includes('(外协)') ||
process.name.includes('(外协)')
)
const isGreenProcess = process => (
isOutsourceProcess(process) &&
process.issueQty > toNumber(process.count) + toNumber(process.badQty)
)
const getProcessBaseStyle = process => {
if (isGreenProcess(process)) {
return greenProcessStyle
}
if (isBlueProcess(process.status, process.count)) {
return blueProcessStyle
}
const statusNum = parseInt(process.status)
if (statusNum === 2 || statusNum === 4) {
return greenProcessStyle
}
return 'color: #ff3f37; font-weight: 700;'
}
const getOutsourceGroupStyleState = steps => {
const styles = new Map()
const processes = steps.map(parseProcessStep)
let currentIndexes = []
let lastProcess = null
const flushOutsourceRun = () => {
if (currentIndexes.length > 0 && lastProcess) {
const style = getProcessBaseStyle(lastProcess)
currentIndexes.forEach(index => styles.set(index, style))
}
currentIndexes = []
lastProcess = null
}
const isSameContinuousGroup = process => {
if (!lastProcess) {
return true
}
if (process.lineNo === null || lastProcess.lineNo === null) {
return false
}
return process.lineNo === lastProcess.lineNo + 1 &&
(process.outsourceGroup || '') === (lastProcess.outsourceGroup || '')
}
processes.forEach((process, index) => {
if (!isOutsourceProcess(process)) {
flushOutsourceRun()
return
}
if (!isSameContinuousGroup(process)) {
flushOutsourceRun()
}
currentIndexes.push(index)
lastProcess = process
})
flushOutsourceRun()
return { styles }
}
const getOutsourceGroupStyle = (process, index, outsourceGroupStyleState) => {
if (!isOutsourceProcess(process)) {
return ''
}
return outsourceGroupStyleState.styles.get(index) || ''
}
const formatProcessDetail = (processDetailStr) => {
if (!processDetailStr || typeof processDetailStr !== 'string') {
return ''
}
const steps = processDetailStr.split(' -> ')
const outsourceGroupStyleState = getOutsourceGroupStyleState(steps)
const maxPerRow = 8
const rows = Math.ceil(steps.length / maxPerRow)
@@ -281,15 +390,17 @@ const formatProcessDetail = (processDetailStr) => {
// 计划开始时间行
tableHtml += '<tr>'
rowSteps.forEach((step, index) => {
const parts = step.split('|')
const planDate = parts[3] || ''
const status = parts[1] || '0'
const count = parts[2] || '0'
const process = parseProcessStep(step)
// 获取颜色
const colorStyle = getProcessColor(status, count)
const colorStyle = getProcessColor(
process.status,
process.count,
process,
getOutsourceGroupStyle(process, startIndex + index, outsourceGroupStyleState)
)
tableHtml += `<td class="plan-date-cell" style="${colorStyle}">${planDate}</td>`
tableHtml += `<td class="plan-date-cell" style="${colorStyle}">${process.planDate}</td>`
if (index < rowSteps.length - 1) {
tableHtml += '<td class="arrow-cell-hidden"></td>'
}
@@ -299,14 +410,16 @@ const formatProcessDetail = (processDetailStr) => {
// 工序名称行
tableHtml += '<tr>'
rowSteps.forEach((step, index) => {
const parts = step.split('|')
const name = parts[0] || ''
const status = parts[1] || '0'
const count = parts[2] || '0'
const process = parseProcessStep(step)
const colorStyle = getProcessColor(status, count)
const colorStyle = getProcessColor(
process.status,
process.count,
process,
getOutsourceGroupStyle(process, startIndex + index, outsourceGroupStyleState)
)
tableHtml += `<td style="${colorStyle}">${name}</td>`
tableHtml += `<td style="${colorStyle}">${process.name}</td>`
if (index < rowSteps.length - 1) {
tableHtml += '<td class="arrow-cell">→</td>'
}
@@ -316,13 +429,16 @@ const formatProcessDetail = (processDetailStr) => {
// 完成数量行
tableHtml += '<tr>'
rowSteps.forEach((step, index) => {
const parts = step.split('|')
const count = parts[2] || '0'
const status = parts[1] || '0'
const process = parseProcessStep(step)
const colorStyle = getProcessColor(status, count)
const colorStyle = getProcessColor(
process.status,
process.count,
process,
getOutsourceGroupStyle(process, startIndex + index, outsourceGroupStyleState)
)
tableHtml += `<td class="count-cell" style="${colorStyle}">合格${count}</td>`
tableHtml += `<td class="count-cell" style="${colorStyle}">合格${process.count}</td>`
if (index < rowSteps.length - 1) {
tableHtml += '<td class="arrow-cell-hidden"></td>'
}
@@ -336,21 +452,28 @@ const formatProcessDetail = (processDetailStr) => {
}
// 获取颜色函数
const getProcessColor = (status, count) => {
const getProcessColor = (status, count, process = null, groupStyle = '') => {
if (groupStyle) {
return groupStyle
}
if (process) {
return getProcessBaseStyle(process)
}
const statusNum = parseInt(status)
const countNum = parseInt(count)
// 加工状态=2或4 绿色
if (statusNum === 2 || statusNum === 4) {
return 'color: #28d961; font-weight: 700;'
return greenProcessStyle
}
// 加工状态=6 蓝色
if (statusNum === 6 || statusNum === 3) {
return 'color: #09a8ff; font-weight: 700;'
return blueProcessStyle
}
// 完成数量>0 蓝色
if (countNum > 0) {
return 'color: #09a8ff; font-weight: 700;'
return blueProcessStyle
}
// 其余红色
return 'color: #ff3f37; font-weight: 700;'
@@ -358,7 +481,7 @@ const getProcessColor = (status, count) => {
function makeTaskBoard(rows) {
return {
...boardBaseConfig,
rowNum: 12,
rowNum: 8,
columnWidth: [150, 132, 200, 82, 750],
header: ['生产订单', '物料名称', '物料编码', '加急数量', '进度'],
data: extendRows(rows, 12).map(row => [
@@ -932,4 +1055,4 @@ onUnmounted(() => {
min-height: 50px;
line-height: 1.4 !important;
}
</style>
</style>