142 lines
5.8 KiB
Vue
142 lines
5.8 KiB
Vue
<template>
|
|
<el-card>
|
|
<el-form inline>
|
|
<el-form-item label="位置">
|
|
<el-select v-model="stationNo" clearable placeholder="全部工位" style="width:180px" @change="load">
|
|
<el-option label="待流转" value="pending" />
|
|
<el-option v-for="s in stations" :key="s.stationNo" :label="`${s.name || ('工位' + s.stationNo)}`" :value="s.stationNo" />
|
|
<el-option label="末端待取件" value="end-pending" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="产品工号">
|
|
<el-input v-model="orderNo" clearable placeholder="产品工号(模糊)" style="width:200px" @keyup.enter="load" />
|
|
</el-form-item>
|
|
<el-form-item label="状态">
|
|
<el-select v-model="statusFilter" clearable placeholder="全部状态" style="width:140px">
|
|
<el-option label="已上线" value="ONLINE" />
|
|
<el-option label="在制" value="PROCESSING" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="load">查询</el-button>
|
|
<el-button @click="resetFilters">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-alert type="info" :closable="false" style="margin-bottom:12px"
|
|
title="在制品 = 已进线但尚未完工的工件(含跨天继续停留)。日排产仅排「未开工数量」,不会重复排产。" />
|
|
|
|
<el-row :gutter="16" style="margin-bottom:14px">
|
|
<el-col :span="6">
|
|
<el-card shadow="never" class="stat-card"><div class="stat-label">在制品总数</div><div class="stat-value">{{ filtered.length }}</div></el-card>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-card shadow="never" class="stat-card"><div class="stat-label">已上线</div><div class="stat-value">{{ countBy('ONLINE') }}</div></el-card>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-card shadow="never" class="stat-card"><div class="stat-label">在制</div><div class="stat-value ok">{{ countBy('PROCESSING') }}</div></el-card>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-table :data="filtered" border stripe size="small" v-loading="loading" :row-class-name="rowClass">
|
|
<el-table-column prop="sn" label="工件SN" min-width="150" show-overflow-tooltip />
|
|
<el-table-column prop="orderNo" label="产品工号" min-width="140" show-overflow-tooltip />
|
|
<el-table-column prop="productCode" label="产品序号" min-width="120" show-overflow-tooltip />
|
|
<el-table-column prop="productName" label="产品名称" min-width="120" show-overflow-tooltip />
|
|
<el-table-column prop="currentStationName" label="当前工位" width="130" />
|
|
<el-table-column label="状态" width="90" align="center">
|
|
<template #default="{ row }">
|
|
<el-tag :type="statusTag(row.status)" effect="plain">{{ statusText(row.status) }}</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="进度" width="120" align="center">
|
|
<template #default="{ row }">{{ row.doneSteps }} / {{ row.totalSteps }}</template>
|
|
</el-table-column>
|
|
<el-table-column prop="onlineAt" label="上线时间" width="170" />
|
|
<el-table-column label="停留时长" width="130" align="right">
|
|
<template #default="{ row }">
|
|
<span :style="row.dwellSec > 86400 ? 'color:#f56c6c;font-weight:600' : ''">{{ fmtDur(row.dwellSec) }}</span>
|
|
<el-tag v-if="row.dwellSec > 86400" type="danger" size="small" effect="plain" style="margin-left:4px">超期</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-empty v-if="!loading && !filtered.length" description="当前无在制品" />
|
|
</el-card>
|
|
<PageHelp :data="helpWip" page="Wip" />
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, computed, onMounted } from 'vue'
|
|
import request from '../utils/request'
|
|
import { loadStations } from '../utils/stations'
|
|
import PageHelp from '../components/PageHelp.vue'
|
|
import { helpWip } from '../help'
|
|
|
|
const stations = ref([])
|
|
const stationNo = ref('')
|
|
const orderNo = ref('')
|
|
const statusFilter = ref('')
|
|
const list = ref([])
|
|
const loading = ref(false)
|
|
function resetFilters() {
|
|
stationNo.value = ''
|
|
orderNo.value = ''
|
|
statusFilter.value = ''
|
|
load()
|
|
}
|
|
|
|
const filtered = computed(() =>
|
|
statusFilter.value ? list.value.filter((x) => x.status === statusFilter.value) : list.value
|
|
)
|
|
function countBy(st) { return list.value.filter((x) => x.status === st).length }
|
|
// 超期(停留 >1 天)高亮
|
|
function rowClass({ row }) { return row.dwellSec > 86400 ? 'wip-overdue' : '' }
|
|
|
|
function statusText(s) {
|
|
return { ONLINE: '已上线', PROCESSING: '在制' }[s] || s
|
|
}
|
|
function statusTag(s) {
|
|
return { ONLINE: 'info', PROCESSING: 'success' }[s] || 'info'
|
|
}
|
|
function fmtDur(sec) {
|
|
const s = Number(sec) || 0
|
|
if (s <= 0) return '-'
|
|
if (s < 60) return s + '秒'
|
|
const m = Math.floor(s / 60)
|
|
if (m < 60) return `${m}分${s % 60}秒`
|
|
const h = Math.floor(m / 60)
|
|
return `${h}时${m % 60}分`
|
|
}
|
|
|
|
async function load() {
|
|
loading.value = true
|
|
try {
|
|
const params = {}
|
|
// 位置口径:'pending'/'end-pending' 走 scope(业务语义);数字工位号走 stationNo
|
|
if (stationNo.value === 'pending' || stationNo.value === 'end-pending') {
|
|
params.scope = stationNo.value
|
|
} else if (stationNo.value !== '' && stationNo.value !== null) {
|
|
params.stationNo = stationNo.value
|
|
}
|
|
if (orderNo.value.trim()) params.orderNo = orderNo.value.trim()
|
|
list.value = (await request.get('/workpieces/in-process', { params })) || []
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
onMounted(async () => {
|
|
stations.value = await loadStations()
|
|
load()
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
.stat-card { text-align: center; }
|
|
.stat-label { color: #909399; font-size: 13px; margin-bottom: 6px; }
|
|
.stat-value { font-size: 26px; font-weight: 700; color: #303133; }
|
|
.stat-value.ok { color: #67c23a; }
|
|
.stat-value.ng { color: #f56c6c; }
|
|
:deep(.wip-overdue) { background: #fef0f0; }
|
|
</style>
|