feat: 完成多模块迭代更新

- 新增过程巡检按步骤上报、数量不符上报、工位退料功能
- 增加工单工程编号三级归属字段
- 新增物料安全库存与缺货预警
- 新增附件管理、退库单管理模块
- 优化生产看板展示逻辑与前端页面文案
- 清理冗余的工艺路线相关代码与备份文件
This commit is contained in:
SunYF
2026-09-15 16:37:39 +08:00
parent 951f3dfecd
commit 4a5e2d7bac
494 changed files with 24702 additions and 139223 deletions
@@ -0,0 +1,122 @@
<script setup>
// 通用附件区(内嵌在业务页里使用,不建独立"附件中心"菜单)
// 用法:<AttachmentPanel biz-type="inbound" :biz-id="row.inboundNo" />
defineOptions({ name: 'AttachmentPanel' })
import { ref, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import request from '../utils/request'
import { fmtTime } from '../utils/format'
const props = defineProps({
bizType: { type: String, required: true },
bizId: { type: String, default: '' },
title: { type: String, default: '附件' },
disabled: { type: Boolean, default: false },
})
const list = ref([])
const loading = ref(false)
const uploading = ref(false)
async function load() {
if (!props.bizId) {
list.value = []
return
}
loading.value = true
try {
const d = await request.get('/attachments', { params: { bizType: props.bizType, bizId: props.bizId } })
list.value = d?.list || []
} catch (e) {
list.value = []
} finally {
loading.value = false
}
}
// 自定义上传:走统一 axios(自动带 Bearer token + 统一错误提示)
async function doUpload(opt) {
const fd = new FormData()
fd.append('file', opt.file)
fd.append('bizType', props.bizType)
fd.append('bizId', props.bizId)
uploading.value = true
try {
await request.post('/attachments/upload', fd)
ElMessage.success('上传成功')
await load()
} finally {
uploading.value = false
}
}
function preview(row) {
window.open(row.url, '_blank')
}
async function remove(row) {
try {
await ElMessageBox.confirm(`确认删除附件「${row.fileName}」?`, '删除确认', { type: 'warning' })
} catch {
return
}
await request.post('/attachments/delete', { id: row.id })
ElMessage.success('已删除')
await load()
}
function sizeText(n) {
if (!n) return '-'
if (n < 1024) return n + ' B'
if (n < 1024 * 1024) return (n / 1024).toFixed(1) + ' KB'
return (n / 1024 / 1024).toFixed(2) + ' MB'
}
watch(() => [props.bizType, props.bizId], load, { immediate: true })
defineExpose({ load })
</script>
<template>
<div class="attachment-panel">
<div class="ap-head">
<span class="ap-title">{{ title }}</span>
<el-upload
:auto-upload="true"
:show-file-list="false"
:http-request="doUpload"
accept=".pdf,.png,.jpg,.jpeg,.gif,.xlsx,.xls,.doc,.docx,.dwg,.dxf,.zip,.txt,.csv"
:disabled="!bizId || disabled"
>
<el-button type="primary" plain size="small" :loading="uploading" :disabled="!bizId || disabled">
上传附件
</el-button>
</el-upload>
<span class="ap-tip">支持 PDF / 图纸 / 图片 / Office,单个不超过 20MB;点「查看」新窗口打开</span>
</div>
<el-table :data="list" size="small" border v-loading="loading" empty-text="暂无附件">
<el-table-column prop="fileName" label="文件名" min-width="200" show-overflow-tooltip />
<el-table-column label="大小" width="100" align="center">
<template #default="{ row }">{{ sizeText(row.fileSize) }}</template>
</el-table-column>
<el-table-column prop="uploadedBy" label="上传人" width="110" align="center">
<template #default="{ row }">{{ row.uploadedBy || '-' }}</template>
</el-table-column>
<el-table-column label="上传时间" width="165" align="center">
<template #default="{ row }">{{ fmtTime(row.createdAt) }}</template>
</el-table-column>
<el-table-column label="操作" width="130" align="center">
<template #default="{ row }">
<el-button link type="primary" size="small" @click="preview(row)">查看</el-button>
<el-button link type="danger" size="small" :disabled="disabled" @click="remove(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<style scoped>
.attachment-panel { margin-top: 6px; }
.ap-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ap-title { font-weight: 600; color: #303133; }
.ap-tip { color: #909399; font-size: 12px; }
</style>
@@ -9,6 +9,7 @@ const props = defineProps({
modelValue: { type: [String, Array], default: '' },
multiple: { type: Boolean, default: false },
manageMode: { type: Number, default: 0 }, // 0=全部 1=结构件 2=电气件
itemType: { type: Number, default: 0 }, // 0=全部 1原材料 2半成品 3成品 4其他
placeholder: { type: String, default: '选择物料' },
clearable: { type: Boolean, default: true },
width: { type: String, default: '100%' }
@@ -23,7 +24,11 @@ async function load(kw = '') {
loading.value = true
try {
const data = await request.get('/material/query', {
params: { page: 1, pageSize: 100, keyword: kw || '', manageMode: props.manageMode || '' }
params: {
page: 1, pageSize: 100, keyword: kw || '',
manageMode: props.manageMode || '',
itemType: props.itemType || ''
}
})
options.value = data?.list || []
} catch {