feat&refactor: 完成多模块功能迭代与配置优化
本次提交覆盖多个业务模块的功能完善与体验优化:
1. **鉴权与配置调整**:
- 统一JWT滑动续签逻辑,简化Token存储,移除RefreshToken相关冗余代码
- 调整多项目配置文件中JWT过期时间为3600秒,统一会话闲置窗口
- 工位配置放开1~12限制,改为仅校验大于0
2. **术语统一替换**:全链路将"精密件"替换为"电气件",修正物料管理描述
3. **功能新增**:
- 新增工位类型、工艺路线与产线点位台账模块
- 添加工艺PDF预览面板、工位终端代理转发接口
- 新增操作日志按操作人列表筛选、工位登出日志记录
- 新增PLC移料指令与产线点位状态管理
4. **业务流程优化**:
- 调整BOM物料删除校验逻辑,优化工单备料计算
- 补充物料图号、检测单号等追溯字段
- 完善工艺流程图与工位绑定关系说明
- 优化前端页面文案与交互细节
5. **代码规范与维护**:
- 新增通用工具函数与前端静态资源
- 整理路由权限与中间件逻辑
- 修复部分接口与配置的不兼容问题
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
defineOptions({ name: 'Inbound' })
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import request from '../utils/request'
|
||||
import { getRealName } from '../utils/auth'
|
||||
import { fmtTime } from '../utils/format'
|
||||
@@ -15,8 +15,8 @@ import { helpInbound } from '../help'
|
||||
const route = useRoute()
|
||||
const operator = getRealName()
|
||||
|
||||
// ===== 多 Tab:结构件入库 / 精密件 SN 入库 在前(常操作),入库记录在后 =====
|
||||
const activeTab = ref('batch') // batch=结构件入库 / sn=精密件SN入库 / records=入库记录
|
||||
// ===== 多 Tab:结构件入库 / 电气件 SN 入库 在前(常操作),入库记录在后 =====
|
||||
const activeTab = ref('batch') // batch=结构件入库 / sn=电气件SN入库 / records=入库记录
|
||||
|
||||
// 公共字典:区域(物料下拉由 MaterialSelect 组件按需远程搜索,最近 100 条)
|
||||
const zones = ref([])
|
||||
@@ -32,7 +32,7 @@ const submitting1 = ref(false)
|
||||
const lastInboundNo = ref('')
|
||||
const form1 = reactive({
|
||||
materialCode: '', batchNo: '', quantity: 1,
|
||||
zoneCode: '', productionDate: '', supplier: '', remark: ''
|
||||
zoneCode: '', productionDate: '', supplier: '', remark: '', inspectionNo: ''
|
||||
})
|
||||
const rules1 = {
|
||||
materialCode: [{ required: true, message: '请选择物料', trigger: 'change' }],
|
||||
@@ -46,6 +46,15 @@ async function submitBatch() {
|
||||
ElMessage.warning('数量必须大于 0')
|
||||
return
|
||||
}
|
||||
if (!form1.inspectionNo.trim()) {
|
||||
ElMessage.warning('请填写检测单号')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
'确认入库:物料 ' + form1.materialCode + '|批次 ' + form1.batchNo + '|数量 ' + form1.quantity + '|区域 ' + form1.zoneCode + '?',
|
||||
'入库提交确认', { type: 'warning' })
|
||||
} catch { return }
|
||||
submitting1.value = true
|
||||
try {
|
||||
const data = await request.post('/inbound/create', {
|
||||
@@ -57,6 +66,7 @@ async function submitBatch() {
|
||||
productionDate: form1.productionDate,
|
||||
supplier: form1.supplier.trim(),
|
||||
remark: form1.remark.trim(),
|
||||
inspectionNo: form1.inspectionNo.trim(),
|
||||
operator
|
||||
})
|
||||
lastInboundNo.value = data?.inboundNo || ''
|
||||
@@ -70,11 +80,11 @@ async function submitBatch() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ===================== Tab2 精密件 SN 入库(连续扫码、实时已扫数量) ===================== */
|
||||
/* ===================== Tab2 电气件 SN 入库(连续扫码、实时已扫数量) ===================== */
|
||||
const snInput = ref('')
|
||||
const submitting2 = ref(false)
|
||||
const snList = ref([])
|
||||
const form2 = reactive({ materialCode: '', zoneCode: '', remark: '' })
|
||||
const form2 = reactive({ materialCode: '', zoneCode: '', remark: '', inspectionNo: '' })
|
||||
|
||||
// 支持多种分隔符:中英文逗号、中英文句号、分号、顿号、空格、回车、制表符等
|
||||
const SN_SEP = /[,,.。;;、\s]+/
|
||||
@@ -103,10 +113,19 @@ async function submitSn() {
|
||||
ElMessage.warning('请选择入库区域')
|
||||
return
|
||||
}
|
||||
if (!form2.inspectionNo.trim()) {
|
||||
ElMessage.warning('请填写检测单号')
|
||||
return
|
||||
}
|
||||
if (!snList.value.length) {
|
||||
ElMessage.warning('请先扫码录入 SN(输入后点击【录入到列表】)')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
'确认 SN 入库:物料 ' + form2.materialCode + '|数量 ' + snList.value.length + ' 件|区域 ' + form2.zoneCode + '?',
|
||||
'入库提交确认', { type: 'warning' })
|
||||
} catch { return }
|
||||
submitting2.value = true
|
||||
try {
|
||||
const data = await request.post('/inbound/create', {
|
||||
@@ -115,6 +134,7 @@ async function submitSn() {
|
||||
zoneCode: form2.zoneCode,
|
||||
snList: [...snList.value],
|
||||
remark: form2.remark.trim(),
|
||||
inspectionNo: form2.inspectionNo.trim(),
|
||||
operator
|
||||
})
|
||||
ElMessage.success(`入库成功:入库单号 ${data?.inboundNo || ''},SN 共 ${snList.value.length} 条`)
|
||||
@@ -127,7 +147,7 @@ async function submitSn() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ===================== 各 Tab 批量导入(结构件 batch / 精密件 sn) ===================== */
|
||||
/* ===================== 各 Tab 批量导入(结构件 batch / 电气件 sn) ===================== */
|
||||
const importing = ref(false)
|
||||
const excelResult = ref(null)
|
||||
const batchUploadRef = ref()
|
||||
@@ -175,7 +195,7 @@ const list = ref([])
|
||||
const total = ref(0)
|
||||
const page = reactive({ current: 1, size: 10 })
|
||||
|
||||
// 列表数据:结构件(manageMode=1)与精密件(manageMode=2)同主表(inbound_order)
|
||||
// 列表数据:结构件(manageMode=1)与电气件(manageMode=2)同主表(inbound_order)
|
||||
async function loadRecords() {
|
||||
loadingRec.value = true
|
||||
try {
|
||||
@@ -256,7 +276,7 @@ function changeDetailPage(p) {
|
||||
}
|
||||
|
||||
function typeLabel(m) {
|
||||
return m === 1 ? '结构件' : m === 2 ? '精密件' : '-'
|
||||
return m === 1 ? '结构件' : m === 2 ? '电气件' : '-'
|
||||
}
|
||||
|
||||
function onTabChange(tab) {
|
||||
@@ -306,8 +326,11 @@ onMounted(() => {
|
||||
<el-input v-model="form1.supplier" placeholder="供应商名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form1.remark" placeholder="备注(可空)" clearable />
|
||||
</el-form-item>
|
||||
<el-input v-model="form1.remark" placeholder="备注(可空)" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="检测单号" required>
|
||||
<el-input v-model="form1.inspectionNo" placeholder="入库检报告单号(必填)" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="submitting1" @click="submitBatch">提交入库</el-button>
|
||||
</el-form-item>
|
||||
@@ -332,12 +355,12 @@ onMounted(() => {
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- ============ Tab2 精密件 SN 入库 ============ -->
|
||||
<el-tab-pane :label="`精密件 SN 入库${snList.length ? `(已扫 ${snList.length})` : ''}`" name="sn">
|
||||
<!-- ============ Tab2 电气件 SN 入库 ============ -->
|
||||
<el-tab-pane :label="`电气件 SN 入库${snList.length ? `(已扫 ${snList.length})` : ''}`" name="sn">
|
||||
<el-card shadow="never">
|
||||
<el-form label-width="110px" style="max-width:680px">
|
||||
<el-form-item label="物料" required>
|
||||
<MaterialSelect v-model="form2.materialCode" :manage-mode="2" placeholder="请选择精密件物料(必填)" />
|
||||
<MaterialSelect v-model="form2.materialCode" :manage-mode="2" placeholder="请选择电气件物料(必填)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="区域" required>
|
||||
<el-select v-model="form2.zoneCode" placeholder="请选择入库区域(必填)" clearable style="width:100%">
|
||||
@@ -355,8 +378,11 @@ onMounted(() => {
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form2.remark" type="textarea" :rows="2" placeholder="本批 SN 的统一备注(可空)" />
|
||||
</el-form-item>
|
||||
<el-input v-model="form2.remark" type="textarea" :rows="2" placeholder="本批 SN 的统一备注(可空)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="检测单号" required>
|
||||
<el-input v-model="form2.inspectionNo" placeholder="入库检报告单号(必填)" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div style="margin-bottom:8px">
|
||||
@@ -385,7 +411,7 @@ onMounted(() => {
|
||||
</div>
|
||||
<el-upload ref="snUploadRef" :auto-upload="false" accept=".xlsx" :limit="1" drag style="max-width:680px"
|
||||
:on-exceed="(f) => onExceed(f, 'sn')">
|
||||
<div class="dropzone">将精密件 .xlsx 拖到此处,或点击选择</div>
|
||||
<div class="dropzone">将电气件 .xlsx 拖到此处,或点击选择</div>
|
||||
</el-upload>
|
||||
<el-button type="primary" :loading="importing" style="margin-top:8px"
|
||||
@click="importExcel('sn', 'sn')">开始批量导入</el-button>
|
||||
@@ -407,7 +433,7 @@ onMounted(() => {
|
||||
<el-select v-model="filters.manageMode" placeholder="全部" clearable style="width:120px" @change="search">
|
||||
<el-option label="全部" value="" />
|
||||
<el-option label="结构件" value="1" />
|
||||
<el-option label="精密件" value="2" />
|
||||
<el-option label="电气件" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称">
|
||||
@@ -427,7 +453,7 @@ onMounted(() => {
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 入库单列表(一单一行,结构件/精密件同表) -->
|
||||
<!-- 入库单列表(一单一行,结构件/电气件同表) -->
|
||||
<el-card shadow="never" header="入库单(每行一笔入库;点「明细」在右侧抽屉查看该单的行)">
|
||||
<el-table :data="list" border size="small" v-loading="loadingRec" empty-text="暂无入库数据">
|
||||
<el-table-column prop="id" label="ID" width="70" align="center" />
|
||||
@@ -453,8 +479,11 @@ onMounted(() => {
|
||||
<template #default="{ row }">{{ row.zoneCode || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="operator" label="操作人" width="100">
|
||||
<template #default="{ row }">{{ row.operator || '-' }}</template>
|
||||
</el-table-column>
|
||||
<template #default="{ row }">{{ row.operator || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="inspectionNo" label="检测单号" min-width="130" align="center">
|
||||
<template #default="{ row }">{{ row.inspectionNo || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入库时间" width="160" align="center">
|
||||
<template #default="{ row }">{{ fmtTime(row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
@@ -477,7 +506,7 @@ onMounted(() => {
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!-- 批量导入结果(结构件/精密件共用) -->
|
||||
<!-- 批量导入结果(结构件/电气件共用) -->
|
||||
<el-card v-if="excelResult" shadow="never" class="mb12"
|
||||
:header="excelResult.failed > 0 ? '导入结果:被拒绝(整体回退,未发生写入)' : '导入结果:成功'">
|
||||
<el-alert v-if="excelResult.failed > 0" type="error" :closable="false"
|
||||
|
||||
Reference in New Issue
Block a user