feat: 全项目列表页操作列规范统一 + 问题.md 六条整改

- 操作列按6条标准统一(WMS 13页/MES 18页):fixed right、宽160超限折更多、一列一填充、危险操作link+二次确认置末、页面级新建移工具栏
- 修复MES物料档案启用报错:改走 POST /product-types/status 专用端点,不再被全字段必填校验拦截
- 附件归档清理由按年改为用户选月(精确到月,截止月最晚6个月前,默认当前月-6),前后端同步
- 序列号文案统一为「是=逐件录SN,否=按数量(不录SN)」,MES 下拉改单选框
- 入库货架/层/位置必填校验(InboundEntry 前端 + inbound.go 后端),杜绝有区域无货架的新脏数据
- 生产流程卡新增列表Tab(新接口 GET /process-card/list 分页),去掉筛选默认时间
- 清理遗留 assets_bak/public_bak 备份目录;更新 WMS/MES 前端构建产物(index.html)
This commit is contained in:
SunYF
2026-10-10 18:09:17 +08:00
parent f6a26256c5
commit 56d56648f9
224 changed files with 687 additions and 1874 deletions
@@ -48,7 +48,7 @@
<span v-else>全部</span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center" fixed="right">
<el-table-column label="操作" width="160" align="center" fixed="right">
<template #default="{ row }">
<el-button link type="info" size="small" @click="openDetail(row)">详情</el-button>
<el-button v-if="can('sys.account:edit')" link type="primary" size="small" :disabled="lockedUser(row)"
@@ -25,12 +25,12 @@
<el-table-column label="操作工签字时间" min-width="160">
<template #default="{ row }">{{ row.operatorSignedAt || row.signedAt || '-' }}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center" fixed="right">
<template #default="{ row }">
<el-button type="success" size="small" :loading="row._doing" @click="approve(row)">审核通过</el-button>
<el-button type="danger" size="small" :loading="row._doing" @click="reject(row)">退回重做</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="160" align="center" fixed="right">
<template #default="{ row }">
<el-button type="primary" size="small" :loading="row._doing" @click="approve(row)">审核通过</el-button>
<el-button link type="danger" size="small" :loading="row._doing" @click="reject(row)">退回重做</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination v-if="total > pageSize" style="margin-top:12px;justify-content:flex-end"
layout="prev,pager,next,total" :total="total" :page-size="pageSize"
+29 -15
View File
@@ -81,15 +81,19 @@
</template>
</el-table-column>
<el-table-column prop="operator" label="操作人" min-width="90" />
<el-table-column label="操作" width="330">
<el-table-column label="操作" width="160" fixed="right">
<template #default="{ row }">
<el-button size="small" type="primary" link @click="openCell(row)">详情</el-button>
<el-button v-if="can('produce.workorder:dailyplan') && (row.status === 'PENDING' || row.status === 'CONFIRMED')"
size="small" :type="row.status === 'CONFIRMED' ? 'warning' : 'success'" @click="toggleStatus(row)">
{{ row.status === 'CONFIRMED' ? '停用' : '启用' }}
</el-button>
<el-button v-if="can('produce.workorder:dailyplan')" size="small" @click="openEdit(row)">编辑</el-button>
<el-button v-if="can('produce.workorder:dailyplan')" size="small" type="danger" @click="del(row)">删除</el-button>
<el-button link type="primary" size="small" @click="openCell(row)">详情</el-button>
<el-dropdown trigger="click" @command="(c) => planCommand(row, c)">
<el-button link type="primary" size="small">更多 ▾</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-if="can('produce.workorder:dailyplan')" command="edit">编辑</el-dropdown-item>
<el-dropdown-item v-if="can('produce.workorder:dailyplan') && (row.status === 'PENDING' || row.status === 'CONFIRMED')" :command="row.status === 'CONFIRMED' ? 'disable' : 'enable'" :style="row.status === 'CONFIRMED' ? 'color:#f56c6c' : ''">{{ row.status === 'CONFIRMED' ? '停用' : '启用' }}</el-dropdown-item>
<el-dropdown-item v-if="can('produce.workorder:dailyplan')" command="del" divided style="color:#f56c6c">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
@@ -130,16 +134,20 @@
<el-table-column prop="operator" label="操作人" min-width="90">
<template #default="{ row }">{{ row._isGroup ? '—' : (row.operator || '-') }}</template>
</el-table-column>
<el-table-column label="操作" width="240">
<el-table-column label="操作" width="160" fixed="right">
<template #default="{ row }">
<template v-if="row._isGroup"><span class="dock-empty">展开查看明细</span></template>
<template v-else>
<el-button v-if="can('produce.workorder:dailyplan') && (row.status === 'PENDING' || row.status === 'CONFIRMED')"
size="small" :type="row.status === 'CONFIRMED' ? 'warning' : 'success'" @click="toggleStatus(row)">
{{ row.status === 'CONFIRMED' ? '停用' : '启用' }}
</el-button>
<el-button v-if="can('produce.workorder:dailyplan')" size="small" @click="openEdit(row)">编辑</el-button>
<el-button v-if="can('produce.workorder:dailyplan')" size="small" type="danger" @click="del(row)">删除</el-button>
<el-dropdown trigger="click" @command="(c) => planCommand(row, c)">
<el-button link type="primary" size="small">更多 ▾</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-if="can('produce.workorder:dailyplan')" command="edit">编辑</el-dropdown-item>
<el-dropdown-item v-if="can('produce.workorder:dailyplan') && (row.status === 'PENDING' || row.status === 'CONFIRMED')" :command="row.status === 'CONFIRMED' ? 'disable' : 'enable'" :style="row.status === 'CONFIRMED' ? 'color:#f56c6c' : ''">{{ row.status === 'CONFIRMED' ? '停用' : '启用' }}</el-dropdown-item>
<el-dropdown-item v-if="can('produce.workorder:dailyplan')" command="del" divided style="color:#f56c6c">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</template>
</el-table-column>
@@ -654,6 +662,12 @@ async function toggleStatus(row) {
ElMessage.success(`已${label}`)
fetchPage()
}
// 操作列「更多 ▾」分发:编辑 / 停用·启用 / 删除
function planCommand(row, c) {
if (c === 'edit') openEdit(row)
else if (c === 'disable' || c === 'enable') toggleStatus(row)
else if (c === 'del') del(row)
}
onMounted(async () => {
searchWorkOrders('') // 首屏只拉最近 50 条供下拉,其余走远程搜索
productTypes.value = (await request.get('/product-types')) || []
+327 -232
View File
@@ -3,256 +3,302 @@
<el-card>
<el-alert type="info" :closable="false" style="margin-bottom:12px"
title="生产流程卡(工单维度主卡):以工单为唯一主键,展示该工单的工序实绩、用料清单(序列号=是/序列号=否分组、类型取自物料档案)、成品明细与签字确认。成品 SN 是工单卡下的追溯子视图;产品型号仅作筛选入口(按型号查该型号下的工单列表)。可打印或另存为 PDF。" />
<el-form inline>
<el-form-item label="产品型号">
<el-select v-model="modelCode" filterable clearable placeholder="按型号筛选工单" style="width:260px" @change="onModelChange">
<el-option v-for="p in productTypes" :key="p.id" :label="p.name + (p.code ? ' / ' + p.code : '')" :value="p.code" />
</el-select>
</el-form-item>
<el-form-item label="工单号">
<el-input v-model="workOrderNo" placeholder="输入工单号查主卡" clearable style="width:220px" @keyup.enter="query" />
</el-form-item>
<el-form-item label="成品SN">
<el-input v-model="sn" placeholder="输入成品SN查追溯卡" clearable style="width:220px" @keyup.enter="query" />
</el-form-item>
<el-form-item label="时间范围" v-if="mode === 'model' || (!workOrderNo && !sn)">
<el-date-picker v-model="dateRange" type="monthrange" range-separator="至" start-placeholder="起始月" end-placeholder="结束月" value-format="YYYY-MM-DD" style="width:260px" />
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="loading" @click="query">查询</el-button>
<el-button :disabled="!canPrint" @click="printCurrent">打印 / 导出 PDF</el-button>
<el-button @click="reset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-alert v-if="error" :title="error" type="error" show-icon closable style="margin-top:12px" />
<el-tabs v-model="activeTab" @tab-change="onTabChange" style="margin-top:12px">
<!-- ============ Tab1:流程卡列表(分页,不要求任何条件即可看全部) ============ -->
<el-tab-pane label="流程卡列表" name="list">
<el-card>
<el-form inline>
<el-form-item label="工单号">
<el-input v-model="listQuery.orderNo" clearable placeholder="工单号" style="width:200px" @keyup.enter="loadList" />
</el-form-item>
<el-form-item label="产品型号">
<el-input v-model="listQuery.productCode" clearable placeholder="产品型号" style="width:200px" @keyup.enter="loadList" />
</el-form-item>
<el-form-item label="成品SN/关键字">
<el-input v-model="listQuery.keyword" clearable placeholder="成品SN 或关键字" style="width:220px" @keyup.enter="loadList" />
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="listLoading" @click="loadList">查询</el-button>
<el-button @click="resetList">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="listRows" border size="small" v-loading="listLoading" empty-text="暂无流程卡">
<el-table-column prop="workOrderNo" label="工单号" min-width="190" show-overflow-tooltip />
<el-table-column prop="productCode" label="产品型号" width="140" show-overflow-tooltip />
<el-table-column prop="productName" label="产品名称" min-width="160" show-overflow-tooltip />
<el-table-column prop="productSerial" label="成品SN" min-width="160" show-overflow-tooltip />
<el-table-column label="状态" width="100" align="center">
<template #default="{ row }">{{ row.status || '-' }}</template>
</el-table-column>
<el-table-column prop="createdAt" label="创建时间" width="160" />
<el-table-column label="操作" width="100" align="center" fixed="right">
<template #default="{ row }">
<el-button link type="primary" size="small" @click="goDetail(row.workOrderNo)">详情</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top:12px;justify-content:flex-end" background layout="total, prev, pager, next, sizes"
:total="listTotal" :page-size="listPageSize" v-model:current-page="listPage" :page-sizes="[20, 50, 100]"
@current-change="loadList" @size-change="(s) => { listPageSize = s; listPage = 1; loadList() }" />
</el-card>
</el-tab-pane>
<!-- 工单主卡 -->
<el-card v-if="mode === 'workorder' && card" style="margin-top:12px">
<template #header>
<div class="hd"><span class="t">生产流程卡(工单维度)</span><span class="sub">{{ card.workOrderNo }}</span></div>
</template>
<!-- ============ Tab2:流程卡详情(复用现有查询与卡片渲染) ============ -->
<el-tab-pane label="流程卡详情" name="detail">
<el-card>
<el-form inline>
<el-form-item label="产品型号">
<el-select v-model="modelCode" filterable clearable placeholder="按型号筛选工单" style="width:260px" @change="onModelChange">
<el-option v-for="p in productTypes" :key="p.id" :label="p.name + (p.code ? ' / ' + p.code : '')" :value="p.code" />
</el-select>
</el-form-item>
<el-form-item label="工单号">
<el-input v-model="workOrderNo" placeholder="输入工单号查主卡" clearable style="width:220px" @keyup.enter="query" />
</el-form-item>
<el-form-item label="成品SN">
<el-input v-model="sn" placeholder="输入成品SN查追溯卡" clearable style="width:220px" @keyup.enter="query" />
</el-form-item>
<el-form-item label="时间范围" v-if="mode === 'model' || (!workOrderNo && !sn)">
<el-date-picker v-model="dateRange" type="monthrange" range-separator="至" start-placeholder="起始月" end-placeholder="结束月" value-format="YYYY-MM-DD" style="width:260px" />
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="loading" @click="query">查询</el-button>
<el-button :disabled="!canPrint" @click="printCurrent">打印 / 导出 PDF</el-button>
<el-button @click="reset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-descriptions :column="4" border size="small" style="margin-bottom:14px">
<el-descriptions-item label="工单号">{{ card.workOrderNo }}</el-descriptions-item>
<el-descriptions-item label="产品型号">{{ card.productCode || '-' }}</el-descriptions-item>
<el-descriptions-item label="产品名称">{{ card.productName || '-' }}</el-descriptions-item>
<el-descriptions-item label="图号">{{ card.drawingNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="计划数">{{ card.planQty }}</el-descriptions-item>
<el-descriptions-item label="完成数">{{ card.finishedNum }}</el-descriptions-item>
<el-descriptions-item label="不良数">{{ card.failNum }}</el-descriptions-item>
<el-descriptions-item label="状态">{{ card.status || '-' }}</el-descriptions-item>
<el-descriptions-item label="计划开始">{{ card.planStart || '-' }}</el-descriptions-item>
<el-descriptions-item label="计划结束">{{ card.planEnd || '-' }}</el-descriptions-item>
<el-descriptions-item label="实际开始">{{ card.actualStart || '-' }}</el-descriptions-item>
<el-descriptions-item label="实际结束">{{ card.actualFinish || '-' }}</el-descriptions-item>
<el-descriptions-item label="生成时间">{{ card.generatedAt }}</el-descriptions-item>
</el-descriptions>
<el-alert v-if="error" :title="error" type="error" show-icon closable style="margin-top:12px" />
<h3 class="sec">一、工序实绩</h3>
<el-table :data="card.processSteps || []" border size="small" empty-text="暂无工序实绩">
<el-table-column prop="seq" label="序号" width="70" align="center" />
<el-table-column prop="processName" label="工序" min-width="160" show-overflow-tooltip />
<el-table-column prop="stationNo" label="工位" width="80" align="center" />
<el-table-column prop="planHours" label="计划工时" width="90" align="center" />
<el-table-column prop="actualStart" label="实绩开始" width="150" />
<el-table-column prop="actualEnd" label="实绩结束" width="150" />
<el-table-column prop="operators" label="操作人" min-width="150" show-overflow-tooltip />
<el-table-column label="状态" width="90" align="center">
<template #default="{ row }">
<el-tag :type="row.status === '完成' ? 'success' : (row.status === '进行中' ? 'warning' : 'info')" size="small">{{ row.status }}</el-tag>
<!-- 工单主卡 -->
<el-card v-if="mode === 'workorder' && card" style="margin-top:12px">
<template #header>
<div class="hd"><span class="t">生产流程卡(工单维度)</span><span class="sub">{{ card.workOrderNo }}</span></div>
</template>
</el-table-column>
<el-table-column label="审核人" min-width="160">
<template #default="{ row }">
<span v-if="row.auditor">{{ row.auditor }}<small v-if="row.auditRole" class="muted">({{ row.auditRole }})</small></span>
<span v-else class="muted">-</span>
<el-descriptions :column="4" border size="small" style="margin-bottom:14px">
<el-descriptions-item label="工单号">{{ card.workOrderNo }}</el-descriptions-item>
<el-descriptions-item label="产品型号">{{ card.productCode || '-' }}</el-descriptions-item>
<el-descriptions-item label="产品名称">{{ card.productName || '-' }}</el-descriptions-item>
<el-descriptions-item label="图号">{{ card.drawingNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="计划数">{{ card.planQty }}</el-descriptions-item>
<el-descriptions-item label="完成数">{{ card.finishedNum }}</el-descriptions-item>
<el-descriptions-item label="不良数">{{ card.failNum }}</el-descriptions-item>
<el-descriptions-item label="状态">{{ card.status || '-' }}</el-descriptions-item>
<el-descriptions-item label="计划开始">{{ card.planStart || '-' }}</el-descriptions-item>
<el-descriptions-item label="计划结束">{{ card.planEnd || '-' }}</el-descriptions-item>
<el-descriptions-item label="实际开始">{{ card.actualStart || '-' }}</el-descriptions-item>
<el-descriptions-item label="实际结束">{{ card.actualFinish || '-' }}</el-descriptions-item>
<el-descriptions-item label="生成时间">{{ card.generatedAt }}</el-descriptions-item>
</el-descriptions>
<h3 class="sec">一、工序实绩</h3>
<el-table :data="card.processSteps || []" border size="small" empty-text="暂无工序实绩">
<el-table-column prop="seq" label="序号" width="70" align="center" />
<el-table-column prop="processName" label="工序" min-width="160" show-overflow-tooltip />
<el-table-column prop="stationNo" label="工位" width="80" align="center" />
<el-table-column prop="planHours" label="计划工时" width="90" align="center" />
<el-table-column prop="actualStart" label="实绩开始" width="150" />
<el-table-column prop="actualEnd" label="实绩结束" width="150" />
<el-table-column prop="operators" label="操作人" min-width="150" show-overflow-tooltip />
<el-table-column label="状态" width="90" align="center">
<template #default="{ row }">
<el-tag :type="row.status === '完成' ? 'success' : (row.status === '进行中' ? 'warning' : 'info')" size="small">{{ row.status }}</el-tag>
</template>
</el-table-column>
<el-table-column label="审核人" min-width="160">
<template #default="{ row }">
<span v-if="row.auditor">{{ row.auditor }}<small v-if="row.auditRole" class="muted">({{ row.auditRole }})</small></span>
<span v-else class="muted">-</span>
</template>
</el-table-column>
<el-table-column prop="auditedAt" label="审核时间" width="150" />
</el-table>
<h3 class="sec">二、用料清单 · 序列号=是(逐件追溯)</h3>
<el-table :data="card.serialMaterials || []" border size="small" empty-text="暂无序列号=是实绩">
<el-table-column prop="materialCode" label="图号" min-width="140" show-overflow-tooltip />
<el-table-column prop="materialName" label="名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="materialType" label="类型" width="100" align="center" />
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip />
<el-table-column prop="unit" label="单位" width="70" align="center" />
<el-table-column label="物料SN" min-width="220">
<template #default="{ row }">{{ (row.snList || []).join(' ') || '-' }}</template>
</el-table-column>
<el-table-column prop="qty" label="数量" width="80" align="center" />
<el-table-column prop="stationNo" label="装配工位" width="90" align="center" />
<el-table-column prop="operator" label="装配人" min-width="100" />
</el-table>
<h3 class="sec">三、用料清单 · 序列号=否(按批追溯)</h3>
<el-table :data="card.batchMaterials || []" border size="small" empty-text="暂无序列号=否实绩">
<el-table-column prop="materialCode" label="图号" min-width="140" show-overflow-tooltip />
<el-table-column prop="materialName" label="名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="materialType" label="类型" width="100" align="center" />
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip />
<el-table-column prop="unit" label="单位" width="70" align="center" />
<el-table-column prop="batchNo" label="批次号" min-width="160" show-overflow-tooltip />
<el-table-column prop="qty" label="数量" width="80" align="center" />
<el-table-column prop="stationNo" label="装配工位" width="90" align="center" />
<el-table-column prop="operator" label="装配人" min-width="100" />
</el-table>
<h3 class="sec">四、成品明细</h3>
<el-table :data="card.products || []" border size="small" empty-text="暂无成品记录" max-height="320">
<el-table-column prop="sn" label="SN" min-width="180" show-overflow-tooltip />
<el-table-column prop="status" label="状态" width="100" align="center" />
<el-table-column prop="doneAt" label="完工时间" width="160" />
</el-table>
<h3 class="sec">五、签字确认</h3>
<el-descriptions :column="4" border size="small">
<el-descriptions-item label="操作工">
<span v-if="card.signs && card.signs.operator">{{ card.signs.operator.names }}({{ card.signs.operator.count }}次,最近 {{ card.signs.operator.latestTime }})</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="检验员">
<span v-if="card.signs && card.signs.inspector">{{ card.signs.inspector.names }}({{ card.signs.inspector.count }}次,最近 {{ card.signs.inspector.latestTime }})</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="审核人">
<span v-if="card.signs && card.signs.auditor">{{ card.signs.auditor.names }}({{ card.signs.auditor.count }}次,最近 {{ card.signs.auditor.latestTime }})</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="批准人"><span class="muted">手签</span></el-descriptions-item>
</el-descriptions>
</el-card>
<!-- 成品 SN 追溯卡 -->
<el-card v-else-if="mode === 'sn' && snCard" style="margin-top:12px">
<template #header>
<div class="hd"><span class="t">成品追溯卡(SN 维度)</span><span class="sub">{{ snCard.sn }}</span></div>
</template>
</el-table-column>
<el-table-column prop="auditedAt" label="审核时间" width="150" />
</el-table>
<h3 class="sec">二、用料清单 · 序列号=是(逐件追溯)</h3>
<el-table :data="card.serialMaterials || []" border size="small" empty-text="暂无序列号=是实绩">
<el-table-column prop="materialCode" label="图号" min-width="140" show-overflow-tooltip />
<el-table-column prop="materialName" label="名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="materialType" label="类型" width="100" align="center" />
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip />
<el-table-column prop="unit" label="单位" width="70" align="center" />
<el-table-column label="物料SN" min-width="220">
<template #default="{ row }">{{ (row.snList || []).join(' ') || '-' }}</template>
</el-table-column>
<el-table-column prop="qty" label="数量" width="80" align="center" />
<el-table-column prop="stationNo" label="装配工位" width="90" align="center" />
<el-table-column prop="operator" label="装配人" min-width="100" />
</el-table>
<el-descriptions :column="4" border size="small" style="margin-bottom:14px">
<el-descriptions-item label="SN">{{ snCard.sn }}</el-descriptions-item>
<el-descriptions-item label="工单号">{{ snCard.workOrderNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="产品型号">{{ snCard.productCode || '-' }}</el-descriptions-item>
<el-descriptions-item label="状态">{{ snCard.status || '-' }}</el-descriptions-item>
<el-descriptions-item label="完工时间">{{ snCard.doneAt || '-' }}</el-descriptions-item>
<el-descriptions-item label="生成时间">{{ snCard.generatedAt }}</el-descriptions-item>
</el-descriptions>
<h3 class="sec">三、用料清单 · 序列号=否(按批追溯)</h3>
<el-table :data="card.batchMaterials || []" border size="small" empty-text="暂无序列号=否实绩">
<el-table-column prop="materialCode" label="图号" min-width="140" show-overflow-tooltip />
<el-table-column prop="materialName" label="名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="materialType" label="类型" width="100" align="center" />
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip />
<el-table-column prop="unit" label="单位" width="70" align="center" />
<el-table-column prop="batchNo" label="批次号" min-width="160" show-overflow-tooltip />
<el-table-column prop="qty" label="数量" width="80" align="center" />
<el-table-column prop="stationNo" label="装配工位" width="90" align="center" />
<el-table-column prop="operator" label="装配人" min-width="100" />
</el-table>
<h3 class="sec">一、工序实绩</h3>
<el-table :data="snCard.processes || []" border size="small" empty-text="暂无工序实绩">
<el-table-column prop="stationNo" label="工位" width="90" align="center" />
<el-table-column prop="processName" label="工序" min-width="160" show-overflow-tooltip />
<el-table-column prop="startAt" label="开始" width="150" />
<el-table-column prop="endAt" label="结束" width="150" />
<el-table-column prop="operator" label="操作人" min-width="100" />
<el-table-column prop="status" label="状态" width="90" align="center" />
<el-table-column label="结果" width="90" align="center">
<template #default="{ row }">
<el-tag :type="row.result === 'NG' ? 'danger' : 'success'" size="small">{{ row.result || '-' }}</el-tag>
</template>
</el-table-column>
</el-table>
<h3 class="sec">四、成品明细</h3>
<el-table :data="card.products || []" border size="small" empty-text="暂无成品记录" max-height="320">
<el-table-column prop="sn" label="SN" min-width="180" show-overflow-tooltip />
<el-table-column prop="status" label="状态" width="100" align="center" />
<el-table-column prop="doneAt" label="完工时间" width="160" />
</el-table>
<h3 class="sec">二、用料清单 · 序列号=是</h3>
<el-table :data="snCard.serialMaterials || []" border size="small" empty-text="暂无序列号=是实绩">
<el-table-column prop="materialCode" label="图号" min-width="140" show-overflow-tooltip />
<el-table-column prop="materialName" label="名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="materialType" label="类型" width="100" align="center" />
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip />
<el-table-column prop="unit" label="单位" width="70" align="center" />
<el-table-column label="物料SN" min-width="220">
<template #default="{ row }">{{ (row.snList || []).join(' ') || '-' }}</template>
</el-table-column>
<el-table-column prop="qty" label="数量" width="80" align="center" />
<el-table-column prop="stationNo" label="装配工位" width="90" align="center" />
<el-table-column prop="operator" label="装配人" min-width="100" />
</el-table>
<h3 class="sec">五、签字确认</h3>
<el-descriptions :column="4" border size="small">
<el-descriptions-item label="操作工">
<span v-if="card.signs && card.signs.operator">{{ card.signs.operator.names }}({{ card.signs.operator.count }}次,最近 {{ card.signs.operator.latestTime }})</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="检验员">
<span v-if="card.signs && card.signs.inspector">{{ card.signs.inspector.names }}({{ card.signs.inspector.count }}次,最近 {{ card.signs.inspector.latestTime }})</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="审核人">
<span v-if="card.signs && card.signs.auditor">{{ card.signs.auditor.names }}({{ card.signs.auditor.count }}次,最近 {{ card.signs.auditor.latestTime }})</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="批准人"><span class="muted">手签</span></el-descriptions-item>
</el-descriptions>
</el-card>
<h3 class="sec">三、用料清单 · 序列号=否</h3>
<el-table :data="snCard.batchMaterials || []" border size="small" empty-text="暂无序列号=否实绩">
<el-table-column prop="materialCode" label="图号" min-width="140" show-overflow-tooltip />
<el-table-column prop="materialName" label="名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="materialType" label="类型" width="100" align="center" />
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip />
<el-table-column prop="unit" label="单位" width="70" align="center" />
<el-table-column prop="batchNo" label="批次号" min-width="160" show-overflow-tooltip />
<el-table-column prop="qty" label="数量" width="80" align="center" />
<el-table-column prop="stationNo" label="装配工位" width="90" align="center" />
<el-table-column prop="operator" label="装配人" min-width="100" />
</el-table>
<!-- 成品 SN 追溯卡 -->
<el-card v-else-if="mode === 'sn' && snCard" style="margin-top:12px">
<template #header>
<div class="hd"><span class="t">成品追溯卡(SN 维度)</span><span class="sub">{{ snCard.sn }}</span></div>
</template>
<h3 class="sec" v-if="(snCard.torqueRows || []).length">四、拧紧数据</h3>
<el-table v-if="(snCard.torqueRows || []).length" :data="snCard.torqueRows" border size="small">
<el-table-column prop="screwNo" label="螺丝编号" width="110" />
<el-table-column prop="torque" label="扭矩(N·m)" width="110" align="center" />
<el-table-column prop="angle" label="角度(°)" width="100" align="center" />
<el-table-column label="结果" width="90" align="center">
<template #default="{ row }"><el-tag :type="row.result === 'NG' ? 'danger' : 'success'" size="small">{{ row.result || '-' }}</el-tag></template>
</el-table-column>
<el-table-column prop="operator" label="操作人" width="100" />
<el-table-column prop="time" label="时间" min-width="160" />
</el-table>
<el-descriptions :column="4" border size="small" style="margin-bottom:14px">
<el-descriptions-item label="SN">{{ snCard.sn }}</el-descriptions-item>
<el-descriptions-item label="工单号">{{ snCard.workOrderNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="产品型号">{{ snCard.productCode || '-' }}</el-descriptions-item>
<el-descriptions-item label="状态">{{ snCard.status || '-' }}</el-descriptions-item>
<el-descriptions-item label="完工时间">{{ snCard.doneAt || '-' }}</el-descriptions-item>
<el-descriptions-item label="生成时间">{{ snCard.generatedAt }}</el-descriptions-item>
</el-descriptions>
<h3 class="sec">五、签字确认</h3>
<el-descriptions :column="4" border size="small">
<el-descriptions-item label="操作工">
<span v-if="snCard.signs && snCard.signs.operator">{{ snCard.signs.operator.names }}</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="检验员">
<span v-if="snCard.signs && snCard.signs.inspector">{{ snCard.signs.inspector.names }}</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="审核人">
<span v-if="snCard.signs && snCard.signs.auditor">{{ snCard.signs.auditor.names }}</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="批准人"><span class="muted">手签</span></el-descriptions-item>
</el-descriptions>
</el-card>
<h3 class="sec">一、工序实绩</h3>
<el-table :data="snCard.processes || []" border size="small" empty-text="暂无工序实绩">
<el-table-column prop="stationNo" label="工位" width="90" align="center" />
<el-table-column prop="processName" label="工序" min-width="160" show-overflow-tooltip />
<el-table-column prop="startAt" label="开始" width="150" />
<el-table-column prop="endAt" label="结束" width="150" />
<el-table-column prop="operator" label="操作人" min-width="100" />
<el-table-column prop="status" label="状态" width="90" align="center" />
<el-table-column label="结果" width="90" align="center">
<template #default="{ row }">
<el-tag :type="row.result === 'NG' ? 'danger' : 'success'" size="small">{{ row.result || '-' }}</el-tag>
<!-- 按型号查工单列表 -->
<el-card v-else-if="mode === 'model' && modelData" style="margin-top:12px">
<template #header>
<div class="hd"><span class="t">型号工单列表</span><span class="sub">{{ modelData.productCode }}({{ modelData.productName || '-' }})</span></div>
</template>
</el-table-column>
</el-table>
<el-descriptions :column="4" border size="small" style="margin-bottom:14px">
<el-descriptions-item label="工单总数">{{ modelData.totalOrders }}</el-descriptions-item>
<el-descriptions-item label="计划总数">{{ modelData.totalPlanQty }}</el-descriptions-item>
<el-descriptions-item label="完成总数">{{ modelData.totalFinished }}</el-descriptions-item>
<el-descriptions-item label="筛选区间">{{ dateLabel }}</el-descriptions-item>
</el-descriptions>
<el-table :data="modelOrders" border size="small" empty-text="该时间范围内暂无工单">
<el-table-column prop="no" label="工单号" min-width="180" show-overflow-tooltip />
<el-table-column prop="productCode" label="产品型号" width="140" />
<el-table-column prop="productName" label="产品名称" min-width="160" show-overflow-tooltip />
<el-table-column prop="status" label="状态" width="100" align="center" />
<el-table-column prop="planStart" label="计划开始" width="150" />
<el-table-column prop="planEnd" label="计划结束" width="150" />
<el-table-column prop="quantity" label="计划数" width="90" align="center" />
<el-table-column prop="finishedNum" label="完成数" width="90" align="center" />
<el-table-column prop="createdAt" label="创建时间" width="160" />
<el-table-column label="操作" width="100" align="center" fixed="right">
<template #default="{ row }">
<el-button link type="primary" size="small" @click="openOrder(row.no)">查看主卡</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<h3 class="sec">二、用料清单 · 序列号=是</h3>
<el-table :data="snCard.serialMaterials || []" border size="small" empty-text="暂无序列号=是实绩">
<el-table-column prop="materialCode" label="图号" min-width="140" show-overflow-tooltip />
<el-table-column prop="materialName" label="名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="materialType" label="类型" width="100" align="center" />
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip />
<el-table-column prop="unit" label="单位" width="70" align="center" />
<el-table-column label="物料SN" min-width="220">
<template #default="{ row }">{{ (row.snList || []).join(' ') || '-' }}</template>
</el-table-column>
<el-table-column prop="qty" label="数量" width="80" align="center" />
<el-table-column prop="stationNo" label="装配工位" width="90" align="center" />
<el-table-column prop="operator" label="装配人" min-width="100" />
</el-table>
<h3 class="sec">三、用料清单 · 序列号=否</h3>
<el-table :data="snCard.batchMaterials || []" border size="small" empty-text="暂无序列号=否实绩">
<el-table-column prop="materialCode" label="图号" min-width="140" show-overflow-tooltip />
<el-table-column prop="materialName" label="名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="materialType" label="类型" width="100" align="center" />
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip />
<el-table-column prop="unit" label="单位" width="70" align="center" />
<el-table-column prop="batchNo" label="批次号" min-width="160" show-overflow-tooltip />
<el-table-column prop="qty" label="数量" width="80" align="center" />
<el-table-column prop="stationNo" label="装配工位" width="90" align="center" />
<el-table-column prop="operator" label="装配人" min-width="100" />
</el-table>
<h3 class="sec" v-if="(snCard.torqueRows || []).length">四、拧紧数据</h3>
<el-table v-if="(snCard.torqueRows || []).length" :data="snCard.torqueRows" border size="small">
<el-table-column prop="screwNo" label="螺丝编号" width="110" />
<el-table-column prop="torque" label="扭矩(N·m)" width="110" align="center" />
<el-table-column prop="angle" label="角度(°)" width="100" align="center" />
<el-table-column label="结果" width="90" align="center">
<template #default="{ row }"><el-tag :type="row.result === 'NG' ? 'danger' : 'success'" size="small">{{ row.result || '-' }}</el-tag></template>
</el-table-column>
<el-table-column prop="operator" label="操作人" width="100" />
<el-table-column prop="time" label="时间" min-width="160" />
</el-table>
<h3 class="sec">五、签字确认</h3>
<el-descriptions :column="4" border size="small">
<el-descriptions-item label="操作工">
<span v-if="snCard.signs && snCard.signs.operator">{{ snCard.signs.operator.names }}</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="检验员">
<span v-if="snCard.signs && snCard.signs.inspector">{{ snCard.signs.inspector.names }}</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="审核人">
<span v-if="snCard.signs && snCard.signs.auditor">{{ snCard.signs.auditor.names }}</span>
<span v-else class="muted">待签</span>
</el-descriptions-item>
<el-descriptions-item label="批准人"><span class="muted">手签</span></el-descriptions-item>
</el-descriptions>
</el-card>
<!-- 按型号查工单列表 -->
<el-card v-else-if="mode === 'model' && modelData" style="margin-top:12px">
<template #header>
<div class="hd"><span class="t">型号工单列表</span><span class="sub">{{ modelData.productCode }}({{ modelData.productName || '-' }})</span></div>
</template>
<el-descriptions :column="4" border size="small" style="margin-bottom:14px">
<el-descriptions-item label="工单总数">{{ modelData.totalOrders }}</el-descriptions-item>
<el-descriptions-item label="计划总数">{{ modelData.totalPlanQty }}</el-descriptions-item>
<el-descriptions-item label="完成总数">{{ modelData.totalFinished }}</el-descriptions-item>
<el-descriptions-item label="筛选区间">{{ dateLabel }}</el-descriptions-item>
</el-descriptions>
<el-table :data="modelOrders" border size="small" empty-text="该时间范围内暂无工单">
<el-table-column prop="no" label="工单号" min-width="180" show-overflow-tooltip />
<el-table-column prop="productCode" label="产品型号" width="140" />
<el-table-column prop="productName" label="产品名称" min-width="160" show-overflow-tooltip />
<el-table-column prop="status" label="状态" width="100" align="center" />
<el-table-column prop="planStart" label="计划开始" width="150" />
<el-table-column prop="planEnd" label="计划结束" width="150" />
<el-table-column prop="quantity" label="计划数" width="90" align="center" />
<el-table-column prop="finishedNum" label="完成数" width="90" align="center" />
<el-table-column prop="createdAt" label="创建时间" width="160" />
<el-table-column label="操作" width="100" align="center" fixed="right">
<template #default="{ row }">
<el-button link type="primary" size="small" @click="openOrder(row.no)">查看主卡</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card v-else style="margin-top:12px">
<el-empty description="请选择产品型号(或填写工单号 / 成品SN)后点击「查询」" />
</el-card>
<el-card v-else style="margin-top:12px">
<el-empty description="请在上方选择产品型号(或填写工单号 / 成品SN)后点击「查询」;或在「流程卡列表」中点「详情」查看" />
</el-card>
</el-tab-pane>
</el-tabs>
</div>
<PageHelp :data="helpProcessCard" page="ProcessCard" />
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import { ref, reactive, computed, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import request from '../utils/request'
import { openPrintableHtml } from '../utils/print'
@@ -271,6 +317,15 @@ const modelData = ref(null)
const loading = ref(false)
const error = ref('')
// Tab 切换:列表页 / 详情页
const activeTab = ref('list')
const listLoading = ref(false)
const listQuery = reactive({ orderNo: '', productCode: '', keyword: '' })
const listRows = ref([])
const listTotal = ref(0)
const listPage = ref(1)
const listPageSize = ref(20)
function lastMonthRange() {
const now = new Date()
const y = now.getFullYear()
@@ -305,6 +360,45 @@ async function query() {
}
}
// 流程卡列表(Tab1):分页、可无条件查全部
async function loadList() {
listLoading.value = true
try {
const data = await request.get('/process-card/list', {
params: {
page: listPage.value,
pageSize: listPageSize.value,
orderNo: listQuery.orderNo.trim() || undefined,
productCode: listQuery.productCode.trim() || undefined,
keyword: listQuery.keyword.trim() || undefined
}
})
listRows.value = (data && data.list) || []
listTotal.value = (data && data.total) || 0
} catch {
listRows.value = []
listTotal.value = 0
} finally {
listLoading.value = false
}
}
function resetList() {
listQuery.orderNo = ''
listQuery.productCode = ''
listQuery.keyword = ''
listPage.value = 1
loadList()
}
// 从列表点「详情」跳到 Tab2 并复用现有「查看主卡」接口
function goDetail(no) {
workOrderNo.value = no
activeTab.value = 'detail'
loadWorkOrder(no)
}
function onTabChange(name) {
if (name === 'list') loadList()
}
async function loadWorkOrder(no) {
loading.value = true
error.value = ''
@@ -350,7 +444,7 @@ async function loadModel(code) {
}
}
// 型号列表按时间范围(默认上月)客户端过滤;不依赖后端时间参数
// 型号列表按时间范围(默认无时间筛选,避免默认时间挡住历史卡)客户端过滤
const modelOrders = computed(() => {
const rows = (modelData.value && modelData.value.workOrders) || []
if (!dateRange.value || !dateRange.value.length) return rows
@@ -385,7 +479,7 @@ function reset() {
modelCode.value = ''
workOrderNo.value = ''
sn.value = ''
dateRange.value = lastMonthRange()
dateRange.value = []
mode.value = ''
card.value = null
snCard.value = null
@@ -394,12 +488,13 @@ function reset() {
}
onMounted(async () => {
dateRange.value = lastMonthRange()
dateRange.value = []
try {
productTypes.value = (await request.get('/product-types')) || []
} catch {
productTypes.value = []
}
await loadList()
})
</script>
@@ -54,19 +54,13 @@
<el-table-column label="创建时间" width="150">
<template #default="{ row }">{{ fmt(row.createdAt) }}</template>
</el-table-column>
<el-table-column label="操作" width="220" align="center" fixed="right">
<template #default="{ row }">
<el-button
v-if="can('produce.processflow:add') || can('produce.processflow:edit')"
size="small" @click="openFlow(row)">编辑</el-button>
<el-button
v-if="can('produce.processflow:edit')"
size="small" :type="row.status === 'ACTIVE' ? 'danger' : 'success'" @click="toggleStatus(row)">
{{ row.status === 'ACTIVE' ? '停用' : '启用' }}
</el-button>
<el-button v-if="can('produce.processflow:delete')" size="small" type="danger" @click="delFlow(row)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="160" align="center" fixed="right">
<template #default="{ row }">
<el-button v-if="can('produce.processflow:add') || can('produce.processflow:edit')" link type="primary" size="small" @click="openFlow(row)">编辑</el-button>
<el-button v-if="can('produce.processflow:edit')" link :type="row.status === 'ACTIVE' ? 'danger' : 'primary'" size="small" @click="toggleStatus(row)">{{ row.status === 'ACTIVE' ? '停用' : '启用' }}</el-button>
<el-button v-if="can('produce.processflow:delete')" link type="danger" size="small" @click="delFlow(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top:12px;justify-content:flex-end" background layout="total, prev, pager, next" :total="flowTotal" :page-size="flowPageSize" v-model:current-page="flowPage" @current-change="loadFlows" />
</el-tab-pane>
@@ -63,15 +63,19 @@
<el-table-column label="创建时间" width="160">
<template #default="{ row }">{{ fmtTime(row.createdAt) }}</template>
</el-table-column>
<el-table-column label="操作" width="300" fixed="right" align="center">
<el-table-column label="操作" width="160" fixed="right" align="center">
<template #default="{ row }">
<el-button size="small" type="primary" plain @click="printCard(row)">路线卡</el-button>
<el-button v-if="can('produce.productprocess:edit')" size="small" :disabled="row.usedByWorkOrders > 0"
@click="openEdit(row)">{{ row.usedByWorkOrders > 0 ? '只读' : '编辑' }}</el-button>
<el-button v-if="can('produce.productprocess:edit')" size="small" @click="toggleStatus(row)">
{{ row.status === 'ACTIVE' ? '停用' : '启用' }}</el-button>
<el-button v-if="can('produce.productprocess:delete')" size="small" type="danger"
:disabled="row.usedByWorkOrders > 0" @click="remove(row)">删除</el-button>
<el-button v-if="can('produce.productprocess:edit')" link type="primary" size="small" :disabled="row.usedByWorkOrders > 0" @click="openEdit(row)">{{ row.usedByWorkOrders > 0 ? '只读' : '编辑' }}</el-button>
<el-dropdown trigger="click" @command="(c) => ppCommand(row, c)">
<el-button link type="primary" size="small">更多 ▾</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="print">路线卡</el-dropdown-item>
<el-dropdown-item v-if="can('produce.productprocess:edit')" :command="row.status === 'ACTIVE' ? 'disable' : 'enable'" :style="row.status === 'ACTIVE' ? 'color:#f56c6c' : ''">{{ row.status === 'ACTIVE' ? '停用' : '启用' }}</el-dropdown-item>
<el-dropdown-item v-if="can('produce.productprocess:delete')" command="del" divided style="color:#f56c6c" :disabled="row.usedByWorkOrders > 0">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
@@ -260,6 +264,13 @@ async function printCard(row) {
await openPrintableHtml('/product-processes/card', { id: row.id })
}
// 操作列「更多 ▾」分发:路线卡 / 停用·启用 / 删除
function ppCommand(row, c) {
if (c === 'print') printCard(row)
else if (c === 'disable' || c === 'enable') toggleStatus(row)
else if (c === 'del') remove(row)
}
onMounted(async () => {
load()
try {
+18 -18
View File
@@ -60,11 +60,11 @@
<el-table-column label="创建时间" width="160">
<template #default="{row}">{{ row.createdAt ? fmtTime(row.createdAt) : '-' }}</template>
</el-table-column>
<el-table-column label="操作" width="140" fixed="right">
<el-table-column label="操作" width="160" fixed="right">
<template #default="{row}">
<el-button size="small" @click="openAttach(row)">附件</el-button>
<el-button v-if="can('produce.product:edit')" size="small" @click="openEdit(row)">编辑</el-button>
<el-button v-if="can('produce.product:delete')" size="small" :type="row.isActive ? 'danger' : 'success'" @click="toggleActive(row)">{{ row.isActive ? '停用' : '启用' }}</el-button>
<el-button v-if="can('produce.product:edit')" link type="primary" size="small" @click="openEdit(row)">编辑</el-button>
<el-button link type="primary" size="small" @click="openAttach(row)">附件</el-button>
<el-button v-if="can('produce.product:delete')" link :type="row.isActive ? 'danger' : 'primary'" size="small" @click="toggleActive(row)">{{ row.isActive ? '停用' : '启用' }}</el-button>
</template>
</el-table-column>
</el-table>
@@ -92,11 +92,11 @@
</el-select>
</el-form-item>
<el-form-item label="序列号" required>
<el-select v-model="dialog.snMode" style="width:100%" placeholder="请选择">
<el-option :value="0" label="请选择" disabled />
<el-option :value="1" label="序列号=是(逐件录SN)" />
<el-option :value="2" label="序列号=否(按批次数量)" />
</el-select>
<el-radio-group v-model="dialog.snMode">
<el-radio :label="1">是</el-radio>
<el-radio :label="2">否</el-radio>
</el-radio-group>
<span style="margin-left:8px;color:#909399;font-size:12px">是=逐件录SN,否=按数量(不录SN)</span>
</el-form-item>
<el-form-item label="启用"><el-switch v-model="dialog.isActive" /></el-form-item>
</el-form>
@@ -209,15 +209,15 @@ async function save() {
load()
}
async function toggleActive(row) {
// 两库对等定稿(2026-09-29 M5):物料档案一律不物理删除;启用/停用通过 isActive 双态切换并同步 WMS
if (row.isActive) {
await ElMessageBox.confirm('确认停用该物料档案?停用后不再出现在新建下拉,历史工单/库存不受影响。', '停用确认', { type: 'warning' })
await request.delete(`/product-types/${row.id}`)
ElMessage.success('已停用')
} else {
await request.put('/product-types', { id: row.id, isActive: true })
ElMessage.success('已启用')
}
// 两库对等定稿(2026-09-29 M5):物料档案一律不物理删除;启用/停用通过 isActive 双态切换并同步 WMS。
// 走专用端点 POST /product-types/status(仅改 isActive 列,避免被 name/spec/unit 必填校验拦截)。
const to = !row.isActive
const action = to ? '启用' : '停用'
try {
await ElMessageBox.confirm(`确认${action}该物料档案「${row.name}」?停用后不再出现在新建下拉,历史工单/库存不受影响。`, `${action}确认`, { type: 'warning' })
} catch { return }
await request.post('/product-types/status', { id: row.id, isActive: to })
ElMessage.success(`已${action}`)
load()
}
function openAttach(row) { Object.assign(attachDrawer, { visible: true, code: row.code, name: row.name }) }
+11 -4
View File
@@ -71,12 +71,19 @@
<el-table-column label="处理时间" width="150">
<template #default="{row}">{{ row.handledAt ? fmtTime(row.handledAt) : '-' }}</template>
</el-table-column>
<el-table-column label="操作" width="210" fixed="right" align="center">
<el-table-column label="操作" width="160" fixed="right" align="center">
<template #default="{row}">
<template v-if="isPending(row.status) && can('produce.qty:handle')">
<el-button size="small" type="success" :disabled="row.diffQty <= 0" @click="doHandle(row, 'REPLENISH')">补发</el-button>
<el-button size="small" type="warning" :disabled="row.diffQty >= 0" @click="doHandle(row, 'RETURN')">退库</el-button>
<el-button size="small" @click="doHandle(row, 'ADJUST')">调整</el-button>
<el-button size="small" type="primary" :disabled="row.diffQty <= 0" @click="doHandle(row, 'REPLENISH')">补发</el-button>
<el-dropdown trigger="click" @command="(c) => doHandle(row, c)">
<el-button size="small" link>更多 ▾</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="RETURN" :disabled="row.diffQty >= 0">退库</el-dropdown-item>
<el-dropdown-item command="ADJUST">调整</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<span v-else class="muted">{{ isPending(row.status) ? '无处理权限' : '已处理' }}</span>
</template>
@@ -65,13 +65,18 @@
<el-table-column label="记录日期" width="160">
<template #default="{ row }">{{ fmtTime(row.createdAt) }}</template>
</el-table-column>
<el-table-column label="操作" width="260" fixed="right">
<el-table-column label="操作" width="160" fixed="right">
<template #default="{ row }">
<el-button size="small" @click="viewAttachments(row)">附件</el-button>
<template v-if="row.result === 'NG'">
<el-button size="small" type="warning" @click="downloadReport(row)">不合格单</el-button>
<el-button v-if="can(row.category === 'QC_PROCESS' ? 'produce.quality:process' : 'produce.quality:final')" size="small" type="primary" @click="openDisposal(row)">处置</el-button>
</template>
<el-button v-if="row.result === 'NG' && can(row.category === 'QC_PROCESS' ? 'produce.quality:process' : 'produce.quality:final')" size="small" type="primary" @click="openDisposal(row)">处置</el-button>
<el-dropdown trigger="click" @command="(c) => qcCommand(row, c)">
<el-button size="small" link>更多 ▾</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="attach">附件</el-dropdown-item>
<el-dropdown-item v-if="row.result === 'NG'" command="report">不合格单</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
@@ -243,6 +248,11 @@ async function viewAttachments(row) {
attDialog.loading = false
}
}
// 操作列「更多 ▾」分发:附件 / 不合格单
function qcCommand(row, c) {
if (c === 'attach') viewAttachments(row)
else if (c === 'report') downloadReport(row)
}
async function downloadAttachment(row) {
const token = getToken()
// 统一存储后按附件 id 下载(服务端回中文文件名 + Content-Disposition)
@@ -38,7 +38,7 @@
<el-table-column label="创建时间" width="160" align="center">
<template #default="{ row }">{{ fmtTime(row.createdAt) }}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center" fixed="right">
<el-table-column label="操作" width="160" align="center" fixed="right">
<template #default="{ row }">
<el-button link type="primary" size="small" @click="openDetail(row)">详情</el-button>
<el-button v-if="can('sys.role:edit')" link type="primary" size="small"
+19 -5
View File
@@ -86,12 +86,19 @@
<span v-else style="color:#909399">全部显示</span>
</template>
</el-table-column>
<el-table-column label="操作" width="230" align="center" fixed="right">
<el-table-column label="操作" width="160" align="center" fixed="right">
<template #default="{ row }">
<el-button v-if="can('produce.station:edit')" size="small" :type="row.status === 'ENABLED' ? 'warning' : 'success'" @click="toggleStationStatus(row)">{{ row.status === 'ENABLED' ? '停用' : '启用' }}</el-button>
<el-button v-if="can('produce.station:edit')" size="small" @click="openName(row)">改名</el-button>
<el-button v-if="can('produce.station:edit')" size="small" @click="openTabs(row)">页签</el-button>
<el-button v-if="can('produce.station:delete') && !row.isBuiltin" size="small" type="danger" @click="remove(row)">删除</el-button>
<el-button v-if="can('produce.station:edit')" link type="primary" size="small" @click="openName(row)">改名</el-button>
<el-dropdown trigger="click" @command="(c) => stationCommand(row, c)">
<el-button link type="primary" size="small">更多 ▾</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="tabs">页签</el-dropdown-item>
<el-dropdown-item v-if="can('produce.station:edit')" :command="row.status === 'ENABLED' ? 'disable' : 'enable'" :style="row.status === 'ENABLED' ? 'color:#f56c6c' : ''">{{ row.status === 'ENABLED' ? '停用' : '启用' }}</el-dropdown-item>
<el-dropdown-item v-if="can('produce.station:delete') && !row.isBuiltin" command="del" divided style="color:#f56c6c">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
@@ -219,6 +226,13 @@ async function toggleStationStatus(row) {
load()
}
// 操作列「更多 ▾」分发:页签 / 停用·启用 / 删除(启停互斥:启用显「停用」、停用显「启用」)
function stationCommand(row, c) {
if (c === 'tabs') openTabs(row)
else if (c === 'disable' || c === 'enable') toggleStationStatus(row)
else if (c === 'del') remove(row)
}
const dlg = reactive({ show: false, isAdd: false, title: '', id: 0, stationNo: 1, name: '', stationType: 'OFFLINE', isBuiltin: false })
// 终端可见页签编辑(空数组 = 显示全部)
+17 -28
View File
@@ -70,34 +70,20 @@
<el-table-column label="开始时间" width="110">
<template #default="{ row }">{{ fmtDateOnly(row.planStart) }}</template>
</el-table-column>
<el-table-column label="操作" width="390" fixed="right">
<el-table-column label="操作" width="160" fixed="right">
<template #default="{ row }">
<el-button size="small" @click="openDetail(row)">详情</el-button>
<el-button size="small" @click="openUsage(row)">用料</el-button>
<el-tooltip v-if="can('produce.workorder:dailyplan') && !['DONE','CANCELLED'].includes(row.status)"
:disabled="hasCombination(row)" content="请先选择工艺组合" placement="top">
<span style="margin-right:12px">
<el-button size="small" type="success" plain :disabled="!hasCombination(row)" @click="openAutoSchedule(row)">自动排产</el-button>
</span>
</el-tooltip>
<el-dropdown
v-if="can('produce.workorder:edit') && statusActions(row.status).length"
trigger="click" @command="(cmd) => changeStatus(row, cmd)">
<el-button size="small" type="primary">{{ statusActionBtn(row.status) }}</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-for="a in statusActions(row.status)" :key="a.v" :command="a.v">{{ a.l }}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-dropdown
v-if="(row.status === 'CREATED' && can('produce.workorder:edit')) || (can('produce.workorder:delete') && ['CREATED','PENDING','CONFIRMED'].includes(row.status))"
trigger="click" @command="(cmd) => moreAction(row, cmd)">
<el-button link type="primary" size="small" @click="openDetail(row)">详情</el-button>
<el-dropdown trigger="click" @command="(cmd) => onRowCmd(row, cmd)">
<el-button size="small">更多 ▾</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-if="can('produce.workorder:edit') && row.status === 'CREATED'" command="edit">编辑</el-dropdown-item>
<el-dropdown-item v-if="can('produce.workorder:delete') && ['CREATED','PENDING','CONFIRMED'].includes(row.status)" command="del" divided>删除</el-dropdown-item>
<el-dropdown-item command="usage">用料</el-dropdown-item>
<el-dropdown-item v-if="can('produce.workorder:dailyplan') && !['DONE','CANCELLED'].includes(row.status)"
:disabled="!hasCombination(row)" command="schedule">自动排产</el-dropdown-item>
<el-dropdown-item v-for="a in statusActions(row.status)" :key="a.v" :command="'st:' + a.v">{{ a.l }}</el-dropdown-item>
<el-dropdown-item v-if="can('produce.workorder:edit') && row.status === 'CREATED'" command="edit" divided>编辑</el-dropdown-item>
<el-dropdown-item v-if="can('produce.workorder:delete') && ['CREATED','PENDING','CONFIRMED'].includes(row.status)"
command="del" divided style="color:#f56c6c">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
@@ -613,10 +599,13 @@ async function del(row) {
load()
}
// 操作列「更多」菜单分发:工位组合 / 编辑 / 删除
function moreAction(row, cmd) {
if (cmd === 'edit') openEdit(row)
else if (cmd === 'del') del(row)
// 操作列「更多 ▾」菜单分发:用料 / 自动排产 / 状态操作 / 编辑 / 删除
function onRowCmd(row, cmd) {
if (cmd === 'usage') return openUsage(row)
if (cmd === 'schedule') return openAutoSchedule(row)
if (cmd === 'edit') return openEdit(row)
if (cmd === 'del') return del(row)
if (cmd.startsWith('st:')) return changeStatus(row, cmd.slice(3))
}
// ---- 自动排产(引导式,M9 定稿:预览逐日可调、总数据必须对上)----