feat: 仓储管理-物料出库模块

master
zhongwenkai 4 days ago
parent 89d1d13f6c
commit f88b28ae4a

@ -0,0 +1,55 @@
import request from '@/utils/request'
// 物料出库单创建
export function createMaterialOutbound(data) {
return request({
url: '/admin-api/erp/stock-out/create',
method: 'post',
data: { ...data, outType: '物料出库' }
})
}
// 物料出库单分页查询
export function getMaterialOutboundPage(params = {}) {
return request({
url: '/admin-api/erp/stock-out/page',
method: 'get',
params: { ...params, outType: '物料出库' }
})
}
// 物料出库单详情
export function getMaterialOutbound(id) {
return request({
url: '/admin-api/erp/stock-out/get',
method: 'get',
params: { id }
})
}
// 物料出库单提交审核
export function submitMaterialOutbound(data) {
return request({
url: '/admin-api/erp/stock-out/submit',
method: 'put',
data
})
}
// 物料出库单审核status: 20=通过, 1=驳回)
export function auditMaterialOutbound(data) {
return request({
url: '/admin-api/erp/stock-out/audit',
method: 'put',
data
})
}
// 物料出库单删除
export function deleteMaterialOutbound(id) {
return request({
url: '/admin-api/erp/stock-out/delete',
method: 'delete',
params: { ids: String(id) }
})
}

@ -1589,6 +1589,27 @@ export default {
empty: '暂无出库单据',
createTitle: '新增备件出库'
},
materialOutbound: {
moduleName: '物料出库',
tabPending: '待出库',
tabAuditing: '待审核',
searchPlaceholder: '搜索出库单号',
sparepartInfo: '物料信息',
materialInfo: '物料信息',
outboundTime: '出库时间',
creator: '创建人',
quantity: '数量',
reviewer: '审核人',
approve: '已出库',
reject: '驳回',
confirmApprove: '确定审核通过该出库单吗?',
confirmReject: '确定驳回该出库单吗?',
approveSuccess: '审核通过',
rejectSuccess: '已驳回',
deleteSuccess: '删除成功',
empty: '暂无出库单据',
createTitle: '新增物料出库'
},
sparepartInventory: {
moduleName: '备件库存查询',
searchPlaceholder: '请输入备件编码或名称',

@ -521,6 +521,34 @@
"navigationStyle": "custom"
}
},
{
"path": "materialOutbound/index",
"style": {
"navigationBarTitleText": "物料出库",
"navigationStyle": "custom"
}
},
{
"path": "materialOutbound/create",
"style": {
"navigationBarTitleText": "新增物料出库",
"navigationStyle": "custom"
}
},
{
"path": "materialOutbound/detail",
"style": {
"navigationBarTitleText": "物料出库详情",
"navigationStyle": "custom"
}
},
{
"path": "materialOutbound/materialConfirm",
"style": {
"navigationBarTitleText": "确认物料出库",
"navigationStyle": "custom"
}
},
{
"path": "sparepartCheck/index",
"style": {

@ -234,7 +234,7 @@ function handleCancel() {
function handleSelectMaterial() {
getApp().globalData._materialSelectFrom = 'inbound'
uni.navigateTo({
url: '/pages_function/pages/materialInbound/materialSelect'
url: '/pages_function/pages/materialInbound/materialSelect?from=inbound'
})
}

@ -74,6 +74,10 @@
<text class="label">创建人</text>
<text class="value">{{ textValue(item.creatorName || item.creator) }}</text>
</view>
<view class="row">
<text class="label">经办人</text>
<text class="value">{{ textValue(item.stockUserName) }}</text>
</view>
<view class="row">
<text class="label">数量</text>
<text class="value highlight">{{ textValue(item.totalCount) }}</text>

@ -69,7 +69,7 @@
<script setup>
import { ref, computed } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { onLoad, onShow } from '@dcloudio/uni-app'
import NavBar from '@/components/common/NavBar.vue'
import { getMaterialSimpleList } from '@/api/mes/sparepart'
@ -77,6 +77,7 @@ const materialList = ref([])
const selectedId = ref(null)
const searchText = ref('')
const loading = ref(false)
const fromSource = ref('inbound')
function textValue(v) {
if (v === 0) return '0'
@ -142,11 +143,19 @@ function handleConfirm() {
const item = materialList.value.find((d) => d.id === selectedId.value)
if (!item) return
getApp().globalData._materialBeforeConfirm = item
const from = fromSource.value || getApp().globalData._materialSelectFrom || 'inbound'
const url = from === 'outbound'
? '/pages_function/pages/materialOutbound/materialConfirm'
: '/pages_function/pages/materialInbound/materialConfirm'
uni.navigateTo({
url: '/pages_function/pages/materialInbound/materialConfirm'
url
})
}
onLoad((options) => {
fromSource.value = String(options?.from || getApp().globalData?._materialSelectFrom || 'inbound')
})
onShow(async () => {
await loadMaterials()
})

@ -0,0 +1,431 @@
<template>
<view class="page-container">
<NavBar :title="t('materialOutbound.createTitle')" />
<!-- 操作按钮区 -->
<view class="action-row">
<view class="scan-input-row">
<input
id="material-outbound-scan-input"
class="scan-input"
v-model="scanCodeInput"
placeholder="红外扫码或输入物料码"
confirm-type="done"
@confirm="onScanInputConfirm"
/>
</view>
<view class="action-btn select-btn" @click="handleSelectMaterial">
<text class="btn-text">选择物料</text>
</view>
</view>
<!-- 出库信息 -->
<view class="form-section">
<!-- 出库时间 -->
<view class="section-title-bar">
<view class="section-bar-line"></view>
<text class="section-title"><text class="required">*</text>出库时间</text>
</view>
<picker mode="date" :value="outboundDate" @change="handleDateChange">
<view class="form-row-card">
<text :class="{ placeholder: !outboundDate }">{{ outboundDate || '请选择出库时间' }}</text>
<text class="form-row-arrow"></text>
</view>
</picker>
<!-- 经办人 -->
<view class="section-title-bar" style="padding-top: 24rpx;">
<view class="section-bar-line"></view>
<text class="section-title"><text class="required">*</text>经办人</text>
</view>
<view class="form-row-card" @click="goSelectOperator">
<text :class="{ placeholder: !selectedOperatorName }">{{ selectedOperatorName || '请选择经办人' }}</text>
<text class="form-row-arrow"></text>
</view>
<!-- 备注 -->
<view class="section-title-bar" style="padding-top: 24rpx;">
<view class="section-bar-line"></view>
<text class="section-title">备注</text>
</view>
<view class="form-row-card remark-card">
<textarea v-model="remark" class="remark-textarea" placeholder="请输入备注信息" placeholder-class="remark-placeholder" :maxlength="500" auto-height />
</view>
<!-- 附件 -->
<view class="section-title-bar" style="padding-top: 24rpx;">
<view class="section-bar-line"></view>
<text class="section-title">附件</text>
</view>
<view class="attachment-area">
<view v-if="attachmentFileName" class="attachment-file-item">
<view class="file-icon">
<text class="file-icon-text">{{ getFileIcon(attachmentFileName) }}</text>
</view>
<view class="file-info">
<text class="file-name" :title="attachmentFileName">{{ attachmentFileName }}</text>
<text v-if="attachmentFileSize" class="file-size">{{ formatFileSize(attachmentFileSize) }}</text>
</view>
<view v-if="uploadLoading" class="file-uploading">
<text class="uploading-text">上传中...</text>
</view>
<view v-else class="file-delete" @click="removeAttachment">
<text class="delete-icon-sm"></text>
</view>
</view>
<view class="attachment-add-file" @click="handleAddAttachment" v-if="!attachmentFileName">
<text class="add-text">选取文件</text>
</view>
</view>
</view>
<!-- 出库清单 -->
<view class="material-section">
<view class="section-title-bar">
<view class="section-bar-line"></view>
<text class="section-title">出库清单{{ itemList.length }}</text>
</view>
<view v-if="itemList.length" class="item-list">
<view v-for="(item, idx) in itemList" :key="idx" class="item-card">
<view class="item-delete-top" @click="removeItem(idx)"><text class="delete-icon"></text></view>
<view class="item-left">
<view class="item-image-wrap">
<image v-if="item._material && getItemImage(item._material)" :src="getItemImage(item._material)" class="item-image" mode="aspectFill" />
<text v-else class="item-image-empty">📦</text>
</view>
<view class="item-info">
<text class="item-name">{{ item.productName }}</text>
<text class="item-spec">{{ item.productBarCode || '-' }}</text>
</view>
</view>
<view class="item-right">
<view class="item-qty-row">
<text class="item-qty-label">出库数量</text>
<text class="item-qty-value">{{ item.inputCount }}{{ item.purchaseUnitName }}</text>
</view>
</view>
</view>
</view>
<view v-else class="empty-wrap"><text class="empty-text">请扫码或选择物料</text></view>
</view>
<!-- 底部操作栏 -->
<view class="bottom-actions">
<view class="bottom-btn cancel-btn" @click="handleCancel"></view>
<view class="bottom-btn confirm-btn" @click="handleSubmit"></view>
</view>
<sv-focus-no-keyboard ref="focusNoKeyboardRef"></sv-focus-no-keyboard>
</view>
</template>
<script setup>
import { ref, nextTick } from 'vue'
import { onReady, onShow, onHide } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { createMaterialOutbound } from '@/api/mes/materialOutbound'
import { getProductDetail } from '@/api/mes/sparepart'
import { getBaseUrl } from '@/utils/request'
import { getToken } from '@/utils/auth'
const { t } = useI18n()
const itemList = ref([])
const outboundDate = ref(formatDate(new Date()))
const selectedOperatorId = ref(null)
const selectedOperatorName = ref('')
const remark = ref('')
//
const fileUrl = ref('')
const attachmentFileName = ref('')
const attachmentFileSize = ref(0)
const uploadLoading = ref(false)
function formatDate(date) { const y = date.getFullYear(); const m = String(date.getMonth() + 1).padStart(2, '0'); const d = String(date.getDate()).padStart(2, '0'); return `${y}-${m}-${d}` }
function handleDateChange(e) { outboundDate.value = e.detail.value }
function getItemImage(material) { if (!material.images) return ''; if (Array.isArray(material.images)) return String(material.images[0] || ''); return String(material.images).split(',')[0]?.trim() || '' }
function handleCancel() { getApp().globalData._materialOutboundItems = []; uni.navigateBack() }
function handleSelectMaterial() {
getApp().globalData._materialSelectFrom = 'outbound'
uni.navigateTo({ url: '/pages_function/pages/materialInbound/materialSelect?from=outbound' })
}
const scanCodeInput = ref('')
//
const focusNoKeyboardRef = ref(null)
const keywordInputSelector = '#material-outbound-scan-input input, input#material-outbound-scan-input'
function focusKeywordNoKeyboard() {
nextTick(() => {
setTimeout(() => {
focusNoKeyboardRef.value?.focus(keywordInputSelector)
}, 80)
})
}
function onScanInputConfirm() {
const code = scanCodeInput.value.trim()
if (!code) return
handleScanCode(code)
}
async function handleScanCode(code) {
let materialId = null
if (code.toUpperCase().startsWith('SPARE-')) materialId = code.replace(/SPARE-/i, '')
else { const idMatch = code.match(/(\d+)$/); if (idMatch) materialId = idMatch[1] }
if (!materialId) { uni.showToast({ title: '无法识别物料码', icon: 'none' }); return }
try {
const apiRes = await getProductDetail(materialId)
const detail = apiRes?.data || apiRes
if (detail && detail.id) {
getApp().globalData._materialFromScan = true
getApp().globalData._materialBeforeConfirm = detail
uni.navigateTo({ url: '/pages_function/pages/materialOutbound/materialConfirm' })
} else { uni.showToast({ title: '未找到物料: ' + materialId, icon: 'none' }) }
} catch (e) { console.error(e); uni.showToast({ title: '扫码失败', icon: 'none' }) }
}
function handleScan() {
uni.scanCode({
onlyFromCamera: false, scanType: ['barCode', 'qrCode'],
success: (res) => {
const code = (res.result || '').trim()
if (!code) return
scanCodeInput.value = code
handleScanCode(code)
},
fail: () => { uni.showToast({ title: '扫码失败', icon: 'none' }) }
})
}
function removeItem(idx) { itemList.value.splice(idx, 1); getApp().globalData._materialOutboundItems = [...itemList.value] }
//
function goSelectOperator() {
getApp().globalData._materialOutboundUserFrom = 'outbound'
uni.navigateTo({
url: '/pages_function/pages/moldRepair/userSelect?field=operator&from=materialOutbound'
})
}
//
function getFileIcon(fileName) {
const ext = (fileName || '').split('.').pop()?.toLowerCase()
const iconMap = { pdf: '📄', doc: '📝', docx: '📝', xls: '📊', xlsx: '📊', ppt: '📽', pptx: '📽', txt: '📃', zip: '📦', rar: '📦', jpg: '🖼', jpeg: '🖼', png: '🖼', gif: '🖼', webp: '🖼' }
return iconMap[ext] || '📎'
}
function formatFileSize(bytes) {
if (!bytes) return '0 B'
if (bytes < 1024) return bytes + ' B'
if (bytes < 1048576) return (bytes / 1024).toFixed(1) + ' KB'
return (bytes / 1048576).toFixed(1) + ' MB'
}
const ALLOWED_EXTS = ['png', 'jpg', 'jpeg', 'doc', 'xls', 'ppt', 'txt', 'pdf']
const MAX_FILE_SIZE = 100 * 1024 * 1024
function handleAddAttachment() {
// #ifdef APP-PLUS
plus.gallery.pick(
(res) => {
const file = res?.files?.[0]
if (!file) return
const ext = (file.name || '').split('.').pop()?.toLowerCase()
if (!ALLOWED_EXTS.includes(ext)) { uni.showToast({ title: '不支持的文件类型:.' + (ext || '未知'), icon: 'none' }); return }
if (file.size > MAX_FILE_SIZE) { uni.showToast({ title: '文件大小不能超过100MB', icon: 'none' }); return }
uploadFile(file)
},
(e) => { console.log('选择文件失败:', e) },
{ filter: 'all', multiple: false }
)
// #endif
// #ifndef APP-PLUS
uni.chooseFile({
count: 1, type: 'all',
success: (res) => {
const tempFile = res.tempFiles?.[0]
if (!tempFile) return
const ext = (tempFile.name || '').split('.').pop()?.toLowerCase()
if (!ALLOWED_EXTS.includes(ext)) { uni.showToast({ title: '不支持的文件类型:.' + (ext || '未知'), icon: 'none' }); return }
if (tempFile.size > MAX_FILE_SIZE) { uni.showToast({ title: '文件大小不能超过100MB', icon: 'none' }); return }
uploadFile(tempFile)
},
fail: () => {
uni.chooseImage({
count: 1, sizeType: ['compressed'], sourceType: ['album', 'camera'],
success: (imgRes) => {
const path = imgRes.tempFilePaths?.[0]
if (!path) return
const parts = path.split('/')
uploadFile({ path, name: parts[parts.length - 1] || 'image.jpg', size: 0 })
}
})
}
})
// #endif
}
async function uploadFile(file) {
uploadLoading.value = true
attachmentFileName.value = file.name || 'unknown'
attachmentFileSize.value = file.size || 0
try {
const res = await new Promise((resolve, reject) => {
uni.uploadFile({
url: getBaseUrl() + '/admin-api/infra/file/upload',
filePath: file.path,
name: 'file',
header: { 'Authorization': 'Bearer ' + (getToken() || ''), 'tenantId': '1' },
success: (uploadRes) => {
if (uploadRes.statusCode === 200) {
try { resolve(JSON.parse(uploadRes.data)) }
catch (e) { reject(new Error('解析上传结果失败')) }
} else { reject(new Error('上传失败,状态码:' + uploadRes.statusCode)) }
},
fail: (err) => { reject(err) }
})
})
if (res.code === 0 && res.data) {
const { fileName, fileUrl: url } = res.data
fileUrl.value = JSON.stringify({ fileName: fileName || file.name, fileUrl: url })
attachmentFileName.value = fileName || file.name
uni.showToast({ title: '上传成功', icon: 'success' })
} else {
throw new Error(res.msg || '上传失败')
}
} catch (e) {
attachmentFileName.value = ''; attachmentFileSize.value = 0; fileUrl.value = ''
uni.showToast({ title: String(e?.message || '上传失败').substring(0, 50), icon: 'none' })
} finally {
uploadLoading.value = false
}
}
function removeAttachment() {
attachmentFileName.value = ''; attachmentFileSize.value = 0; fileUrl.value = ''
}
async function handleSubmit() {
if (!itemList.value.length) { uni.showToast({ title: '请先添加物料', icon: 'none' }); return }
if (!outboundDate.value) { uni.showToast({ title: '请选择出库时间', icon: 'none' }); return }
if (!selectedOperatorId.value) { uni.showToast({ title: '请选择经办人', icon: 'none' }); return }
const now = new Date()
const [y, m, d] = outboundDate.value.split('-').map(Number)
const outTime = new Date(y, m - 1, d, now.getHours(), now.getMinutes(), now.getSeconds()).getTime()
let totalCount = 0
const items = itemList.value.map(item => {
totalCount += Number(item.count) || 0
const it = {
warehouseId: item.warehouseId || null,
areaId: item.areaId || null,
productId: item.productId,
count: Number(item.count) || 0
}
return it
})
const submitData = {
isCode: true,
outTime: outTime,
stockUserId: String(selectedOperatorId.value),
responserId: Number(selectedOperatorId.value),
status: 0,
totalCount: totalCount,
totalPrice: 0,
remark: remark.value || '',
items: items
}
if (fileUrl.value) { submitData.fileUrl = fileUrl.value }
console.log('=== 出库提交 ===')
console.log(JSON.stringify(submitData))
uni.showLoading({ title: '提交中...', mask: true })
try {
await createMaterialOutbound(submitData)
uni.hideLoading(); getApp().globalData._materialOutboundItems = []
uni.showToast({ title: t('functionCommon.createSuccess'), icon: 'success' })
setTimeout(() => uni.navigateBack(), 1500)
} catch (e) {
uni.hideLoading(); const msg = e?.message || e?.data?.msg || e?.response?.data?.msg || t('functionCommon.saveFailed')
console.error('出库提交失败:', e, JSON.stringify(e))
uni.showToast({ title: String(msg).substring(0, 50), icon: 'none' })
}
}
onReady(() => { focusKeywordNoKeyboard() })
onShow(() => { const items = getApp().globalData?._materialOutboundItems; if (Array.isArray(items)) itemList.value = [...items]; const userResult = getApp().globalData?._materialOutboundUserSelectResult; if (userResult) { selectedOperatorId.value = userResult.user.id; selectedOperatorName.value = userResult.user.nickname || userResult.user.userName || userResult.user.name || ''; getApp().globalData._materialOutboundUserSelectResult = null } })
onHide(() => {})
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f6f8; padding-bottom: calc(120rpx + env(safe-area-inset-bottom)); }
.action-row { display: flex; align-items: center; gap: 16rpx; padding: 20rpx 24rpx; }
.scan-input-row { flex: 1; display: flex; align-items: center; height: 72rpx; border-radius: 10rpx; overflow: hidden; }
.scan-input { flex: 1; height: 72rpx; padding: 0 20rpx; font-size: 26rpx; color: #333; background: #fff; border: 1rpx solid #d0d5dd; border-radius: 10rpx; }
.action-btn { display: flex; align-items: center; justify-content: center; height: 72rpx; padding: 0 24rpx; border-radius: 10rpx; background: #1f4b79; color: #fff; font-size: 26rpx; font-weight: 600; white-space: nowrap; .btn-icon-wrap { width: 44rpx; height: 44rpx; display: flex; align-items: center; justify-content: center; } .btn-icon { font-size: 36rpx; color: #fff; } .btn-text { font-size: 26rpx; font-weight: 600; color: #fff; } }
.form-section { padding-bottom: 16rpx; }
.section-title-bar { display: flex; align-items: center; gap: 10rpx; padding: 24rpx 24rpx 18rpx; }
.section-bar-line { width: 6rpx; height: 32rpx; border-radius: 3rpx; background: #2563eb; flex-shrink: 0; }
.section-title { font-size: 30rpx; font-weight: 700; color: #1a1a1a; }
.required { color: #ef4444; margin-right: 2rpx; }
.form-row-card { position: relative; display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 16rpx; padding: 26rpx 24rpx; margin: 0 24rpx 16rpx; box-shadow: 0 4rpx 16rpx rgba(15,23,42,0.04); font-size: 28rpx; color: #374151; .placeholder { color: #9ca3af; } }
.form-row-arrow { font-size: 20rpx; color: #999; flex-shrink: 0; }
.dropdown-panel { position: absolute; top: 100%; left: 0; right: 0; z-index: 200; margin-top: 4rpx; background: #fff; border: 1rpx solid #e0e0e0; border-radius: 12rpx; box-shadow: 0 8rpx 30rpx rgba(0,0,0,0.1); overflow: hidden; }
.dropdown-scroll { max-height: 360rpx; overflow-y: auto; }
.dropdown-item { display: flex; align-items: center; justify-content: space-between; padding: 20rpx 24rpx; border-bottom: 1rpx solid #f0f0f0; &:last-child { border-bottom: 0; } &.active { background: #f0f5ff; } }
.dropdown-item-text { font-size: 27rpx; color: #333; }
.dropdown-check { font-size: 28rpx; color: #2563eb; font-weight: 700; }
.dropdown-empty { padding: 32rpx; text-align: center; color: #999; font-size: 26rpx; }
.remark-card { padding: 20rpx 24rpx; }
.remark-textarea { width: 100%; min-height: 120rpx; font-size: 27rpx; color: #374151; line-height: 1.6; box-sizing: border-box; }
.remark-placeholder { color: #bbb; }
.attachment-area { padding: 0 24rpx 16rpx; }
.attachment-list { display: flex; flex-direction: column; gap: 12rpx; }
.attachment-file-item { display: flex; align-items: center; gap: 16rpx; background: #fff; border-radius: 12rpx; padding: 18rpx 20rpx; box-shadow: 0 2rpx 8rpx rgba(15,23,42,0.03); }
.file-icon { width: 72rpx; height: 72rpx; border-radius: 10rpx; background: #f1f5f9; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-icon-text { font-size: 36rpx; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 26rpx; color: #1f2937; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 22rpx; color: #9ca3af; margin-top: 4rpx; display: block; }
.file-delete { width: 48rpx; height: 48rpx; border-radius: 24rpx; background: #fee2e2; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.delete-icon-sm { font-size: 22rpx; color: #dc2626; }
.file-uploading { flex-shrink: 0; .uploading-text { font-size: 22rpx; color: #2563eb; } }
.attachment-add-file { display: flex; align-items: center; justify-content: center; height: 88rpx; background: #fff; border: 2rpx dashed #cbd5e1; border-radius: 12rpx; }
.add-text { font-size: 26rpx; color: #6b7280; }
.material-section { padding: 0; }
.item-list { padding: 0 24rpx; }
.item-card { position: relative; display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 14rpx; padding: 20rpx; margin-bottom: 16rpx; box-shadow: 0 2rpx 12rpx rgba(15,23,42,0.04); }
.item-delete-top { position: absolute; top: 10rpx; right: 10rpx; width: 40rpx; height: 40rpx; border-radius: 20rpx; background: #fee2e2; display: flex; align-items: center; justify-content: center; z-index: 1; .delete-icon { font-size: 20rpx; color: #dc2626; } }
.item-left { display: flex; align-items: center; flex: 1; min-width: 0; padding-right: 36rpx; }
.item-image-wrap { width: 80rpx; height: 80rpx; border-radius: 10rpx; overflow: hidden; background: #f8fafc; border: 1rpx solid #f0f0f0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.item-image { width: 100%; height: 100%; }
.item-image-empty { font-size: 36rpx; opacity: 0.3; }
.item-info { margin-left: 16rpx; flex: 1; min-width: 0; }
.item-name { font-size: 28rpx; font-weight: 600; color: #1a1a1a; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-spec { font-size: 24rpx; color: #9ca3af; margin-top: 6rpx; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-right { display: flex; flex-direction: column; align-items: flex-end; margin-left: 16rpx; flex-shrink: 0; padding-right: 50rpx; }
.item-qty-row { display: flex; flex-direction: column; align-items: flex-end; }
.item-qty-label { font-size: 22rpx; color: #9ca3af; }
.item-qty-value { font-size: 28rpx; font-weight: 700; color: #2563eb; margin-top: 4rpx; }
.empty-wrap { padding: 160rpx 0; text-align: center; }
.empty-text { font-size: 28rpx; color: #94a3b8; }
.bottom-actions { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 18rpx; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -8rpx 24rpx rgba(15,23,42,0.06); z-index: 99; }
.bottom-btn { flex: 1; height: 84rpx; line-height: 84rpx; text-align: center; border-radius: 16rpx; font-size: 30rpx; font-weight: 600; &:active { opacity: 0.85; } }
.cancel-btn { background: #eef2f7; color: #475569; }
.confirm-btn { background: #1f4b79; color: #ffffff; }
</style>

@ -0,0 +1,235 @@
<template>
<view class="page-container">
<NavBar title="物料出库详情" />
<view v-if="loading" class="hint">...</view>
<view v-else-if="!detail.id" class="hint">暂无详情</view>
<view v-else class="content">
<view class="summary-card">
<view class="summary-header">
<text class="summary-no">{{ textValue(detail.no) }}</text>
<text :class="['status-tag', statusClass(detail.status)]">{{ statusText(detail.status) }}</text>
</view>
<view class="row"><text class="label">出库时间</text><text class="value">{{ formatDateTime(detail.outTime || detail.createTime) }}</text></view>
<view class="row"><text class="label">经办人</text><text class="value">{{ textValue(detail.responserName || detail.stockUserName || detail.creatorName || detail.creator) }}</text></view>
<view class="row"><text class="label">审核人</text><text class="value">{{ textValue(detail.auditUserName) }}</text></view>
<view class="row"><text class="label">总数量</text><text class="value highlight">{{ textValue(detail.totalCount) }}</text></view>
<view class="row"><text class="label">备注</text><text class="value">{{ textValue(detail.remark) }}</text></view>
</view>
<view class="section-title-bar">
<view class="section-bar-line"></view>
<text class="section-title">出库明细</text>
</view>
<view v-if="items.length" class="item-list">
<view v-for="(item, index) in items" :key="item.id || index" class="item-card">
<view class="item-title">{{ textValue(item.productName || item.name) }}</view>
<view class="row"><text class="label">物料编码</text><text class="value">{{ textValue(item.productBarCode || item.barCode) }}</text></view>
<view class="row"><text class="label">仓库/库区</text><text class="value">{{ warehouseAreaText(item) }}</text></view>
<view class="row"><text class="label">出库数量</text><text class="value highlight">{{ textValue(item.inputCount || item.count) }}{{ textUnit(item.purchaseUnitName || item.productUnitName) }}</text></view>
<view class="row"><text class="label">库存数量</text><text class="value">{{ textValue(item.count) }}{{ textUnit(item.productUnitName) }}</text></view>
</view>
</view>
<view v-else class="hint">暂无明细</view>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import NavBar from '@/components/common/NavBar.vue'
import { getMaterialOutbound } from '@/api/mes/materialOutbound'
const loading = ref(false)
const detail = ref({})
const items = computed(() => {
const source = detail.value.items || detail.value.itemList || detail.value.details || detail.value.detailList || []
return Array.isArray(source) ? source : []
})
function textValue(value) {
if (value === 0) return '0'
if (value == null) return '-'
const text = String(value).trim()
return text || '-'
}
function textUnit(value) {
if (value === 0) return '0'
if (value == null) return ''
return String(value).trim()
}
function formatDateTime(value) {
if (!value) return '-'
if (Array.isArray(value) && value.length >= 3) {
const [year, month, day] = value
const pad = (n) => String(n).padStart(2, '0')
return `${year}-${pad(month)}-${pad(day)}`
}
const date = new Date(Number(value))
if (Number.isNaN(date.getTime())) return String(value)
const pad = (n) => String(n).padStart(2, '0')
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
}
const STATUS_MAP = {
0: '待出库',
1: '已驳回',
10: '待审核',
20: '已出库'
}
function statusText(status) {
return STATUS_MAP[Number(status)] || textValue(status)
}
function statusClass(status) {
const value = Number(status)
if (value === 0) return 'pending'
if (value === 10) return 'auditing'
if (value === 20) return 'success'
if (value === 1) return 'danger'
return ''
}
function warehouseAreaText(item) {
const warehouse = item.warehouseName || item.warehouse?.name || ''
const area = item.areaName || item.area?.name || ''
return [warehouse, area].filter(Boolean).join(' / ') || '-'
}
async function loadDetail(id) {
if (!id) return
loading.value = true
try {
const res = await getMaterialOutbound(id)
detail.value = res?.data || res || {}
} catch (error) {
detail.value = {}
uni.showToast({ title: '加载失败', icon: 'none' })
} finally {
loading.value = false
}
}
onLoad((options) => {
loadDetail(options?.id)
})
</script>
<style lang="scss" scoped>
.page-container {
min-height: 100vh;
background: #f4f5f7;
padding-bottom: 32rpx;
}
.content {
padding: 20rpx 24rpx 32rpx;
}
.summary-card,
.item-card {
background: #ffffff;
border-radius: 14rpx;
padding: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(15, 23, 42, 0.04);
}
.summary-header {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 18rpx;
margin-bottom: 14rpx;
border-bottom: 1rpx solid #eef2f7;
}
.summary-no {
font-size: 32rpx;
font-weight: 700;
color: #111827;
}
.status-tag {
padding: 6rpx 16rpx;
border-radius: 999rpx;
font-size: 24rpx;
color: #2563eb;
background: #eff6ff;
}
.status-tag.auditing { color: #d97706; background: #fffbeb; }
.status-tag.success { color: #16a34a; background: #f0fdf4; }
.status-tag.danger { color: #dc2626; background: #fef2f2; }
.row {
display: flex;
align-items: flex-start;
gap: 18rpx;
padding: 10rpx 0;
}
.label {
width: 150rpx;
flex-shrink: 0;
font-size: 26rpx;
color: #6b7280;
}
.value {
flex: 1;
min-width: 0;
font-size: 26rpx;
color: #374151;
word-break: break-all;
}
.highlight {
color: #1f4b79;
font-weight: 700;
}
.section-title-bar {
display: flex;
align-items: center;
gap: 10rpx;
padding: 28rpx 0 18rpx;
}
.section-bar-line {
width: 6rpx;
height: 28rpx;
border-radius: 4rpx;
background: #1f4b79;
}
.section-title {
font-size: 30rpx;
font-weight: 700;
color: #1f2937;
}
.item-list {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.item-title {
margin-bottom: 12rpx;
font-size: 30rpx;
font-weight: 700;
color: #111827;
}
.hint {
padding: 96rpx 24rpx;
text-align: center;
font-size: 28rpx;
color: #9ca3af;
}
</style>

@ -0,0 +1,285 @@
<template>
<view class="page-container">
<NavBar :title="t('materialOutbound.moduleName')" />
<view class="filter-bar">
<view class="keyword-box">
<input v-model="searchKeyword" class="keyword-input" :placeholder="t('materialOutbound.searchPlaceholder')" confirm-type="search" @input="handleKeywordInput" @confirm="handleSearch" />
</view>
<view class="status-box-wrapper">
<view class="status-box" @click="toggleStatusDropdown"><text class="status-box-text">{{ currentStatusLabel }}</text><uni-icons type="bottom" size="14" color="#9ca3af"></uni-icons></view>
<view v-if="showStatusDropdown" class="status-dropdown-panel">
<view v-for="(item, idx) in statusOptions" :key="idx" class="status-dropdown-item" :class="{ active: selectedStatus === item.value }" @click.stop="selectStatus(item, idx)">
<text class="status-dropdown-item-text">{{ item.label }}</text>
<text v-if="selectedStatus === item.value" class="status-dropdown-check"></text>
</view>
</view>
</view>
<view class="reset-filter-btn" @click="resetFilters">{{ t('functionCommon.reset') }}</view>
</view>
<scroll-view scroll-y class="list-scroll" :scroll-top="scrollTop" @scroll="onScroll" @scrolltolower="loadMore" :lower-threshold="80">
<view class="list-wrap">
<view v-for="item in list" :key="item.id" class="task-card" @click="openDetail(item)">
<view class="card-header">
<view class="header-main">
<view class="header-left"><text class="task-no">{{ textValue(item.no) }}</text></view>
<view class="header-tags"><text :class="['record-tag', statusClass(item.status)]">{{ statusText(item.status) }}</text></view>
</view>
</view>
<view class="card-body">
<view class="row"><text class="label">{{ t('materialOutbound.materialInfo') }}</text><text class="value">{{ textValue(item.productNames) }}</text></view>
<view class="row"><text class="label">{{ t('materialOutbound.outboundTime') }}</text><text class="value">{{ formatDateTime(item.outTime || item.createTime) }}</text></view>
<view class="row"><text class="label">{{ t('materialOutbound.creator') }}</text><text class="value">{{ textValue(item.creatorName || item.creator) }}</text></view>
<view class="row"><text class="label">经办人</text><text class="value">{{ textValue(item.stockUserName) }}</text></view>
<view class="row"><text class="label">{{ t('materialOutbound.quantity') }}</text><text class="value highlight">{{ textValue(item.totalCount) }}</text></view>
<view class="row"><text class="label">{{ t('materialOutbound.reviewer') }}</text><text class="value">{{ textValue(item.auditUserName) }}</text></view>
</view>
<view v-if="Number(item.status) === 0" class="card-actions">
<view class="action-btn submit-btn" @click.stop="openSubmitAudit(item)">提交审核</view>
</view>
<view v-if="Number(item.status) === 10" class="card-actions">
<view class="action-btn approve-btn" @click.stop="handleApprove(item)">审核通过</view>
<view class="action-btn reject-btn" @click.stop="handleReject(item)">审核驳回</view>
</view>
</view>
<view v-if="loading && pageNo === 1" class="hint">{{ t('functionCommon.loading') }}</view>
<view v-else-if="!list.length" class="hint">{{ t('materialOutbound.empty') }}</view>
<view v-else-if="loadingMore" class="hint">{{ t('functionCommon.loadingMore') }}</view>
<view v-else-if="finished" class="hint">{{ t('functionCommon.noMoreData') }}</view>
</view>
</scroll-view>
<view v-if="showGoTop" class="go-top-btn" @click="goTop"><uni-icons type="arrow-up" size="20" color="#1f4b79"></uni-icons></view>
<view class="add-btn" @click="goAdd"><text class="add-icon">+</text></view>
<!-- 提交审核弹框 -->
<view v-if="showAuditModal" class="modal-overlay" @click="closeAuditModal">
<view class="modal-card" @click.stop>
<view class="modal-header"><text class="modal-title">提交审核</text><text class="modal-close" @click="closeAuditModal"></text></view>
<view class="modal-body">
<view class="modal-field">
<text class="modal-label"><text class="required">*</text>审核人</text>
<view class="modal-dropdown" @click="toggleAuditorDropdown">
<text :class="{ placeholder: !selectedAuditor }">{{ selectedAuditor ? selectedAuditor.label : '请选择' }}</text>
<text class="dropdown-arrow"></text>
<view v-if="showAuditorDropdown" class="dropdown-panel">
<scroll-view scroll-y class="dropdown-scroll">
<view v-for="u in auditorOptions" :key="u.value" class="dropdown-item" :class="{ active: selectedAuditor?.value === u.value }" @click.stop="selectAuditor(u)">
<text class="dropdown-item-text">{{ u.label }}</text>
<text v-if="selectedAuditor?.value === u.value" class="dropdown-check"></text>
</view>
</scroll-view>
</view>
</view>
</view>
<view class="modal-field">
<text class="modal-label">备注</text>
<textarea v-model="auditRemark" class="modal-textarea" placeholder="请输入备注" placeholder-class="textarea-placeholder" :maxlength="200" />
</view>
</view>
<view class="modal-footer">
<view class="modal-btn cancel-btn" @click="closeAuditModal"></view>
<view class="modal-btn confirm-btn" @click="confirmSubmitAudit"></view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue'
import { onShow, onUnload, onHide } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { getMaterialOutboundPage, auditMaterialOutbound, submitMaterialOutbound } from '@/api/mes/materialOutbound'
import { getSimpleUserList } from '@/api/mes/moldget'
const { t } = useI18n()
const selectedStatus = ref('')
const searchKeyword = ref('')
const showStatusDropdown = ref(false)
const statusOptions = computed(() => [
{ label: t('functionCommon.all'), value: '' },
{ label: t('materialOutbound.tabPending'), value: '0' },
{ label: t('materialOutbound.tabAuditing'), value: '10' },
{ label: t('materialOutbound.approve'), value: '20' },
{ label: '已驳回', value: '1' }
])
const currentStatusLabel = computed(() => { const cur = statusOptions.value.find(i => i.value === selectedStatus.value); return cur ? cur.label : t('functionCommon.all') })
const list = ref([])
const loading = ref(false)
const loadingMore = ref(false)
const finished = ref(false)
const pageNo = ref(1)
const pageSize = ref(10)
const scrollTop = ref(0)
const showGoTop = ref(false)
let searchTimer = null
function textValue(v) { if (v === 0) return '0'; if (v == null) return '-'; const s = String(v).trim(); return s || '-' }
function formatDateTime(value) {
if (!value) return '-'
if (Array.isArray(value) && value.length >= 3) { const [y,m,d]=value; const p=n=>String(n).padStart(2,'0'); return `${y}-${p(m)}-${p(d)}` }
const date = new Date(Number(value)); if (Number.isNaN(date.getTime())) return String(value)
const p=n=>String(n).padStart(2,'0'); return `${date.getFullYear()}-${p(date.getMonth()+1)}-${p(date.getDate())}`
}
const STATUS_MAP = { 0: '待出库', 10: '待审核', 20: '已出库', 1: '已驳回' }
function statusText(s) { const num = Number(s); return STATUS_MAP[num] || textValue(num) }
function statusClass(s) {
const num = Number(s)
if (num === 0) return 'text-primary'
if (num === 10) return 'text-warning'
if (num === 20) return 'text-success'
if (num === 1) return 'text-danger'
return ''
}
function normalizePageData(res) {
const root = res && res.data !== undefined ? res.data : res
const l = root?.list || root?.rows || root?.records || root?.data?.list || root?.data?.rows || []
const t = root?.total ?? root?.data?.total ?? (Array.isArray(l) ? l.length : 0)
return { list: Array.isArray(l) ? l : [], total: Number(t || 0) }
}
async function fetchList(reset) {
if (reset) { pageNo.value = 1; finished.value = false }
if (pageNo.value === 1) loading.value = true; else loadingMore.value = true
try {
const params = { pageNo: pageNo.value, pageSize: pageSize.value, no: searchKeyword.value.trim() || undefined, statusList: selectedStatus.value !== '' ? [Number(selectedStatus.value)] : undefined }
const res = await getMaterialOutboundPage(params)
const page = normalizePageData(res)
list.value = reset ? page.list : [...list.value, ...page.list]
finished.value = list.value.length >= page.total || page.list.length < pageSize.value
} catch (e) { if (!reset) pageNo.value = Math.max(1, pageNo.value - 1); uni.showToast({ title: t('functionCommon.loadFailed'), icon: 'none' }) }
finally { loading.value = false; loadingMore.value = false }
}
function toggleStatusDropdown() { showStatusDropdown.value = !showStatusDropdown.value }
function selectStatus(item, _idx) { selectedStatus.value = item.value; showStatusDropdown.value = false; fetchList(true) }
function handleSearch() { clearSearchTimer(); uni.hideKeyboard(); fetchList(true) }
function handleKeywordInput() { clearSearchTimer(); searchTimer = setTimeout(() => fetchList(true), 300) }
function resetFilters() { clearSearchTimer(); searchKeyword.value = ''; selectedStatus.value = ''; fetchList(true) }
async function loadMore() { if (loading.value || loadingMore.value || finished.value) return; pageNo.value += 1; await fetchList(false) }
function openDetail(item) { if (!item?.id) { uni.showToast({ title: t('functionCommon.noIdView'), icon: 'none' }); return }; uni.navigateTo({ url: `/pages_function/pages/materialOutbound/detail?id=${encodeURIComponent(String(item.id))}` }) }
async function handleApprove(item) {
if (!item?.id) return
uni.showModal({ title: t('functionCommon.confirmTitle'), content: t('materialOutbound.confirmApprove'), confirmColor: '#16a34a',
success: async (res) => { if (res.confirm) { try { await auditMaterialOutbound({ id: item.id, status: 20 }); uni.showToast({ title: t('materialOutbound.approveSuccess'), icon: 'success' }); fetchList(true) } catch (e) { uni.showToast({ title: t('functionCommon.saveFailed'), icon: 'none' }) } } }
})
}
async function handleReject(item) {
if (!item?.id) return
uni.showModal({ title: t('functionCommon.confirmTitle'), content: t('materialOutbound.confirmReject'), confirmColor: '#dc2626',
success: async (res) => { if (res.confirm) { try { await auditMaterialOutbound({ id: item.id, status: 1 }); uni.showToast({ title: t('materialOutbound.rejectSuccess'), icon: 'success' }); fetchList(true) } catch (e) { uni.showToast({ title: t('functionCommon.saveFailed'), icon: 'none' }) } } }
})
}
//
const showAuditModal = ref(false)
const currentAuditItem = ref(null)
const auditorOptions = ref([])
const selectedAuditor = ref(null)
const showAuditorDropdown = ref(false)
const auditRemark = ref('')
function openSubmitAudit(item) { currentAuditItem.value = item; selectedAuditor.value = null; auditRemark.value = ''; showAuditModal.value = true; loadAuditorOptions() }
function closeAuditModal() { showAuditModal.value = false; currentAuditItem.value = null; showAuditorDropdown.value = false }
function toggleAuditorDropdown() { showAuditorDropdown.value = !showAuditorDropdown.value }
function selectAuditor(u) { selectedAuditor.value = u; showAuditorDropdown.value = false }
async function loadAuditorOptions() { if (auditorOptions.value.length) return; try { const res = await getSimpleUserList(); const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : []); auditorOptions.value = data.map(u => ({ value: u.id || u.userId, label: u.nickname || u.userName || u.name || String(u.id || '') })) } catch (e) {} }
async function confirmSubmitAudit() {
if (!selectedAuditor.value) { uni.showToast({ title: '请选择审核人', icon: 'none' }); return }
if (!currentAuditItem.value?.id) return
try { uni.showLoading({ title: '提交中...', mask: true }); await submitMaterialOutbound({ id: currentAuditItem.value.id, auditUserId: selectedAuditor.value.value, remark: auditRemark.value || undefined }); uni.hideLoading(); uni.showToast({ title: '提交审核成功', icon: 'success' }); closeAuditModal(); fetchList(true) }
catch (e) { uni.hideLoading(); uni.showToast({ title: '提交失败', icon: 'none' }) }
}
function onScroll(e) { showGoTop.value = (e?.detail?.scrollTop || 0) > 600 }
function goTop() { scrollTop.value = 0 }
function goAdd() { uni.navigateTo({ url: '/pages_function/pages/materialOutbound/create' }) }
function clearSearchTimer() { if (searchTimer) { clearTimeout(searchTimer); searchTimer = null } }
onShow(() => { fetchList(true) })
onUnload(() => { clearSearchTimer() })
onHide(() => { showStatusDropdown.value = false })
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f4f5f7; }
.filter-bar { display: flex; align-items: center; gap: 12rpx; padding: 18rpx 24rpx; background: #fff; }
.keyword-box { flex: 1; min-width: 0; height: 66rpx; padding: 0 28rpx; background: #f4f5f7; border: 1rpx solid #e5e7eb; border-radius: 12rpx; display: flex; align-items: center; }
.keyword-input { width: 100%; font-size: 24rpx; color: #374151; }
.status-box-wrapper { position: relative; flex-shrink: 0; }
.status-box { display: flex; align-items: center; justify-content: space-between; height: 66rpx; padding: 0 28rpx; min-width: 160rpx; background: #fff; border: 1rpx solid #e5e7eb; border-radius: 12rpx; }
.status-dropdown-panel { position: absolute; top: 74rpx; left: 0; right: 0; z-index: 200; background: #fff; border: 1rpx solid #e0e0e0; border-radius: 12rpx; box-shadow: 0 8rpx 30rpx rgba(0,0,0,0.12); overflow: hidden; }
.status-dropdown-item { display: flex; align-items: center; justify-content: space-between; padding: 18rpx 24rpx; border-bottom: 1rpx solid #f0f0f0; &:last-child { border-bottom: 0; } &.active { background: #f0f5ff; } }
.status-dropdown-item-text { font-size: 26rpx; color: #374151; }
.status-dropdown-check { font-size: 26rpx; color: #2563eb; font-weight: 700; }
.status-box-text { font-size: 24rpx; color: #374151; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reset-filter-btn { height: 66rpx; line-height: 66rpx; padding: 0 28rpx; font-size: 24rpx; color: #4b5563; background: #fff; border: 1rpx solid #e5e7eb; border-radius: 12rpx; flex-shrink: 0; }
.list-scroll { height: calc(100vh - 194rpx); }
.list-wrap { padding: 0 24rpx 60rpx; }
.task-card { position: relative; margin-top: 20rpx; padding: 28rpx; background: #fff; border-radius: 22rpx; box-shadow: 0 8rpx 28rpx rgba(15,23,42,0.06); }
.card-header { margin-bottom: 18rpx; }
.header-main { display: flex; align-items: center; justify-content: space-between; gap: 16rpx; }
.header-left { min-width: 0; flex: 1; }
.task-no { font-size: 32rpx; font-weight: 700; color: #0f172a; }
.header-tags { display: flex; align-items: center; gap: 12rpx; flex-shrink: 0; }
.record-tag { padding: 8rpx 18rpx; border-radius: 999rpx; font-size: 22rpx; line-height: 1; background: #e2e8f0; color: #64748b; }
.card-body .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20rpx; margin-top: 12rpx; &:first-child { margin-top: 0; } }
.label { width: 140rpx; font-size: 25rpx; color: #94a3b8; flex-shrink: 0; }
.value { flex: 1; text-align: right; font-size: 27rpx; color: #334155; line-height: 1.5; &.highlight { color: #1f4b79; font-weight: 600; } }
.card-actions { display: flex; gap: 16rpx; margin-top: 20rpx; padding-top: 20rpx; border-top: 1rpx solid #f0f0f0; }
.action-btn { flex: 1; height: 64rpx; line-height: 64rpx; text-align: center; border-radius: 10rpx; font-size: 26rpx; font-weight: 500;
&.approve-btn { background: #dcfce7; color: #16a34a; }
&.reject-btn { background: #fee2e2; color: #dc2626; }
&.submit-btn { background: #dbeafe; color: #1d4ed8; }
&:active { opacity: 0.8; }
}
.text-success { color: #16a34a; } .text-danger { color: #dc2626; } .text-warning { color: #d97706; } .text-primary { color: #2563eb; }
.record-tag.text-success { color: #15803d; background: #dcfce7; }
.record-tag.text-danger { color: #dc2626; background: #fee2e2; }
.record-tag.text-warning { color: #d97706; background: #fef3c7; }
.record-tag.text-primary { color: #1d4ed8; background: #dbeafe; }
.hint { padding: 36rpx 0; text-align: center; color: #94a3b8; font-size: 26rpx; }
.go-top-btn { position: fixed; right: 28rpx; bottom: calc(140rpx + env(safe-area-inset-bottom)); width: 92rpx; height: 92rpx; border-radius: 46rpx; background: rgba(255,255,255,0.96); box-shadow: 0 8rpx 24rpx rgba(15,23,42,0.12); display: flex; align-items: center; justify-content: center; }
.add-btn { position: fixed; right: 28rpx; bottom: calc(56rpx + env(safe-area-inset-bottom)); width: 92rpx; height: 92rpx; border-radius: 46rpx; background: #1f4b79; box-shadow: 0 14rpx 30rpx rgba(24,63,108,0.24); display: flex; align-items: center; justify-content: center; }
.add-icon { color: #fff; font-size: 64rpx; line-height: 1; margin-top: -4rpx; }
/* 提交审核弹框 */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); z-index: 999; display: flex; align-items: center; justify-content: center; }
.modal-card { width: 640rpx; background: #fff; border-radius: 20rpx; box-shadow: 0 16rpx 48rpx rgba(0,0,0,0.15); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 32rpx 32rpx 20rpx; border-bottom: 1rpx solid #f0f0f0; }
.modal-title { font-size: 32rpx; font-weight: 700; color: #1a1a1a; }
.modal-close { font-size: 32rpx; color: #999; padding: 8rpx; }
.modal-body { padding: 28rpx 32rpx; }
.modal-field { margin-bottom: 28rpx; &:last-child { margin-bottom: 0; } }
.modal-label { font-size: 28rpx; color: #374151; font-weight: 500; margin-bottom: 14rpx; display: block; }
.modal-label .required { color: #ef4444; }
.modal-dropdown { position: relative; display: flex; align-items: center; justify-content: space-between; height: 80rpx; padding: 0 24rpx; background: #f8fafc; border: 1rpx solid #e0e0e0; border-radius: 12rpx; font-size: 28rpx; color: #374151;
.placeholder { color: #bbb; }
.dropdown-arrow { font-size: 20rpx; color: #999; }
}
.modal-textarea { width: 100%; min-height: 140rpx; padding: 20rpx; background: #f8fafc; border: 1rpx solid #e0e0e0; border-radius: 12rpx; font-size: 27rpx; color: #374151; box-sizing: border-box; }
.textarea-placeholder { color: #bbb; }
.dropdown-panel { position: absolute; top: 100%; left: 0; right: 0; z-index: 200; margin-top: 4rpx; background: #fff; border: 1rpx solid #e0e0e0; border-radius: 12rpx; box-shadow: 0 8rpx 30rpx rgba(0,0,0,0.1); overflow: hidden; }
.dropdown-scroll { height: 300rpx; }
.dropdown-item { display: flex; align-items: center; justify-content: space-between; padding: 20rpx 24rpx; border-bottom: 1rpx solid #f0f0f0; &:last-child { border-bottom: 0; } &.active { background: #f0f5ff; } }
.dropdown-item-text { font-size: 27rpx; color: #333; }
.dropdown-check { font-size: 28rpx; color: #2563eb; font-weight: 700; }
.modal-footer { display: flex; gap: 18rpx; padding: 24rpx 32rpx; border-top: 1rpx solid #f0f0f0; }
.modal-btn { flex: 1; height: 80rpx; line-height: 80rpx; text-align: center; border-radius: 14rpx; font-size: 30rpx; font-weight: 600; &:active { opacity: 0.85; }
&.cancel-btn { background: #f0f0f0; color: #6b7280; }
&.confirm-btn { background: #1f4b79; color: #fff; }
}
</style>

@ -0,0 +1,392 @@
<template>
<view class="page-container">
<NavBar :title="'确认物料出库'" />
<view class="material-section">
<view class="section-title-bar">
<view class="section-bar-line"></view>
<text class="section-title">已选物料</text>
</view>
<view class="material-card">
<view class="card-top">
<view class="card-image-wrap">
<image v-if="materialImage" :src="materialImage" class="card-image" mode="aspectFill" />
<view v-else class="card-image-empty"><text class="empty-img-icon">📦</text></view>
</view>
<view class="card-info-right">
<view class="info-item"><text class="info-label">物料名称</text><text class="info-name">{{ textValue(material.name) }}</text></view>
<view class="info-item"><text class="info-label">规格</text><text class="info-value">{{ textValue(material.standard || material.deviceSpec) }}</text></view>
<view class="info-item"><text class="info-label">当前总库存</text><text class="info-value stock-highlight">{{ material.count != null ? material.count : 0 }}{{ textUnit(material.unitName || material.minStockUnitName || '个') }}</text></view>
</view>
</view>
<view class="card-bottom">
<view class="detail-row two-col">
<view class="detail-col"><text class="detail-label">采购单位</text><text class="detail-value">{{ textValue(material.purchaseUnitName) }}</text></view>
<view class="detail-col"><text class="detail-label">库存单位</text><text class="detail-value">{{ textValue(material.unitName || material.minStockUnitName || '个') }}</text></view>
</view>
<view class="detail-row"><text class="detail-label">换算关系</text><text class="detail-value">1{{ textValue(material.purchaseUnitName) }}={{ textValue(material.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(material) }}</text></view>
</view>
</view>
<!-- 仓库/库区 -->
<view class="section-title-bar" style="padding-top: 24rpx;">
<view class="section-bar-line"></view><text class="section-title">仓库/库区</text>
</view>
<view class="select-row-card warehouse-area-card">
<view class="warehouse-area-rows">
<!-- 仓库固定为原料仓不可选 -->
<view class="warehouse-area-row">
<text class="warehouse-area-label">仓库</text>
<view class="warehouse-area-dropdown">
<view class="dropdown-input">
<text :class="['dropdown-value', { placeholder: !selectedWarehouse }]">{{ selectedWarehouse ? selectedWarehouse.label : '未找到原料仓' }}</text>
</view>
</view>
</view>
<view class="warehouse-area-row">
<text class="warehouse-area-label">库区</text>
<view class="warehouse-area-dropdown" @click="toggleAreaDropdown">
<view class="dropdown-input">
<text :class="['dropdown-value', { placeholder: !selectedArea }]">{{ selectedArea ? selectedArea.label : (loadingAreas ? '加载中...' : '请选择') }}</text>
<text class="dropdown-arrow"></text>
</view>
<view v-if="showAreaDropdown" class="dropdown-panel">
<view class="dropdown-scroll">
<view v-for="item in areaOptions" :key="item.value" class="dropdown-item" :class="{ active: selectedArea?.value === item.value }" @click.stop="handleSelectArea(item)">
<text class="dropdown-item-text">{{ item.label }}</text>
<text v-if="selectedArea?.value === item.value" class="dropdown-check"></text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 出库数量 -->
<view class="section-title-bar" style="padding-top: 24rpx;">
<view class="section-bar-line"></view><text class="section-title">出库数量</text>
</view>
<view class="qty-input-card">
<view class="form-field">
<text class="form-label">出库数量</text>
<input v-model="outboundQty" class="form-input" placeholder="请输入" confirm-type="done" />
<text class="form-suffix-text">单位{{ textValue(material.purchaseUnitName) }}</text>
</view>
<view v-if="!hasWarehouseArea" class="warehouse-hint"></view>
<view v-if="hasWarehouseArea" class="convert-row">
<text class="convert-label-inline">出库后当前仓库/库区的剩余库存</text>
<text :class="['convert-value-inline', { 'text-danger': stockExceeded }]">{{ remainingStock }}</text>
<text class="convert-unit-inline">{{ stockUnitLabel(material) }}</text>
</view>
<view v-if="hasWarehouseArea" class="convert-helper">{{ currentStockText }}</view>
<view class="convert-formula-inline">{{ outboundQty || 0 }}{{ textValue(material.purchaseUnitName) }} × {{ textValue(material.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(material) }} = {{ calculatedStock }}{{ stockUnitLabel(material) }}</view>
<view v-if="stockExceeded" class="stock-warning">
<text class="warning-icon"></text>
<view class="warning-text">
<text class="warning-line">当前仓库/库区的库存不足不能出库</text>
<text class="warning-line">当前仓库/库区的库存{{ stockCount }}{{ stockUnitLabel(material) }}{{ stockPackText }}</text>
<text class="warning-line">本次出库{{ calculatedStock }}{{ stockUnitLabel(material) }}{{ outboundPackText }}</text>
</view>
</view>
</view>
<!-- 供应商 -->
<view class="section-title-bar" style="padding-top: 24rpx;">
<view class="section-bar-line"></view><text class="section-title">供应商</text>
</view>
<view class="select-row-card">
<view class="full-dropdown">
<text :class="{ placeholder: !defaultSupplierName }">{{ defaultSupplierName || '未配置默认供应商' }}</text>
</view>
</view>
</view>
<view class="bottom-actions">
<view class="bottom-btn cancel-btn" @click="handleCancel"></view>
<view class="bottom-btn confirm-btn" @click="handleConfirm"></view>
</view>
</view>
</template>
<script setup>
import { ref, computed } from 'vue'
import { onShow, onHide } from '@dcloudio/uni-app'
import NavBar from '@/components/common/NavBar.vue'
import { getWarehouseSimpleList, getWarehouseAreaSimpleList } from '@/api/mes/moldget'
import { getProductDetail, getSparepartStock, getSparepartStockCount } from '@/api/mes/sparepart'
const material = ref({})
const outboundQty = ref(null)
const hasWarehouseArea = computed(() => selectedWarehouse.value && selectedArea.value)
const warehouseOptions = ref([])
const selectedWarehouse = ref(null)
const areaOptions = ref([])
const selectedArea = ref(null)
const showAreaDropdown = ref(false)
const loadingAreas = ref(false)
const materialImage = computed(() => {
const images = material.value.images
if (!images) return ''
if (Array.isArray(images)) return String(images[0] || '')
return String(images).split(',')[0]?.trim() || ''
})
// / 0
const warehouseAreaStockCount = ref(0)
const stockCount = computed(() => warehouseAreaStockCount.value)
const calculatedStock = computed(() => {
const qty = Number(outboundQty.value) || 0
const ratio = Number(material.value.purchaseUnitConvertQuantity) || 1
const result = qty * ratio
return Number.isFinite(result) ? result : 0
})
const remainingStock = computed(() => {
const sc = Number.isFinite(stockCount.value) ? stockCount.value : 0
const cs = Number.isFinite(calculatedStock.value) ? calculatedStock.value : 0
return Math.max(sc - cs, 0)
})
const stockExceeded = computed(() => {
const sc = Number.isFinite(stockCount.value) ? stockCount.value : 0
const cs = Number.isFinite(calculatedStock.value) ? calculatedStock.value : 0
return outboundQty.value > 0 && cs > sc
})
function formatStockPack(count) {
const ratio = Number(material.value.purchaseUnitConvertQuantity) || 1
if (ratio === 1) return ''
const packs = Math.floor(count / ratio)
const remain = count % ratio
const parts = []
if (packs > 0) parts.push(`${packs}${textValue(material.value.purchaseUnitName)}`)
if (remain > 0) parts.push(`${remain}${stockUnitLabel(material)}`)
return parts.join('') || ''
}
const currentStockText = computed(() => {
const text = formatStockPack(stockCount.value)
return text ? `当前仓库/库区的库存:${text}` : ''
})
const stockPackText = computed(() => {
return formatStockPack(stockCount.value) || `${stockCount.value}${stockUnitLabel(material)}`
})
const outboundPackText = computed(() => {
return formatStockPack(calculatedStock.value) || `${calculatedStock.value}${stockUnitLabel(material)}`
})
const defaultSupplierName = computed(() => {
const suppliers = material.value.suppliers
if (!suppliers || !suppliers.length) return ''
const defaultId = material.value.defaultSupplierId
if (defaultId) {
const found = suppliers.find(s => s.supplierId === defaultId || s.id === defaultId)
if (found) return found.supplierName || ''
}
const firstDefault = suppliers.find(s => s.defaultStatus === 1)
return firstDefault?.supplierName || ''
})
function textValue(v) { if (v === 0) return '0'; if (v == null) return '-'; const s = String(v).trim(); return s || '-' }
function textUnit(v) { if (v === 0) return '0'; if (v == null) return ''; return String(v).trim() }
function stockUnitLabel(item) {
const target = item?.value || item || {}
return target.unitName || target.minStockUnitName || '个'
}
function handleCancel() { uni.navigateBack() }
function handleConfirm() {
if (!outboundQty.value || Number(outboundQty.value) <= 0) {
uni.showToast({ title: '请输入出库数量', icon: 'none' }); return
}
if (!selectedWarehouse.value) {
uni.showToast({ title: '未找到原料仓', icon: 'none' }); return
}
if (!selectedArea.value) {
uni.showToast({ title: '请选择库区', icon: 'none' }); return
}
if (stockExceeded.value) {
uni.showModal({
title: '库存不足',
content: `当前仓库/库区的库存:${stockCount.value}${stockUnitLabel(material)}${stockPackText.value}\n本次出库${calculatedStock.value}${stockUnitLabel(material)}${outboundPackText.value}`,
showCancel: false,
confirmText: '知道了'
})
return
}
const item = {
productId: material.value.id,
productName: material.value.name || '',
productBarCode: material.value.barCode || '',
productUnitName: material.value.unitName || material.value.minStockUnitName || '',
purchaseUnitName: material.value.purchaseUnitName || '',
purchaseUnitConvertQuantity: Number(material.value.purchaseUnitConvertQuantity) || 1,
inputCount: Number(outboundQty.value),
count: Number(outboundQty.value) * (Number(material.value.purchaseUnitConvertQuantity) || 1),
supplierId: material.value.defaultSupplierId,
supplierName: defaultSupplierName.value,
warehouseId: selectedWarehouse.value?.value,
warehouseName: selectedWarehouse.value?.label || '',
areaId: selectedArea.value?.value,
areaName: selectedArea.value?.label || '',
_material: { ...material.value }
}
if (!getApp().globalData._materialOutboundItems) {
getApp().globalData._materialOutboundItems = []
}
getApp().globalData._materialOutboundItems.push(item)
uni.showToast({ title: '已添加: ' + (material.value.name || ''), icon: 'success', duration: 1200 })
setTimeout(() => {
const fromScan = getApp().globalData._materialFromScan
getApp().globalData._materialFromScan = false
uni.navigateBack({ delta: fromScan ? 1 : 2 })
}, 800)
}
async function loadWarehouses() {
try {
const res = await getWarehouseSimpleList()
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
warehouseOptions.value = data.map(w => ({ value: w.id, label: w.name || String(w.id || '') }))
// 使
if (warehouseOptions.value.length && !selectedWarehouse.value) {
selectedWarehouse.value = warehouseOptions.value.find(w => w.label === '原料仓') || null
if (selectedWarehouse.value) {
loadAreas(selectedWarehouse.value.value)
}
}
} catch (e) {}
}
function toggleAreaDropdown() { if (!selectedWarehouse.value) { uni.showToast({ title: '请先选择仓库', icon: 'none' }); return }; showAreaDropdown.value = !showAreaDropdown.value }
function handleSelectArea(item) { selectedArea.value = item; showAreaDropdown.value = false; loadStockCount() }
async function loadAreas(warehouseId) {
if (!warehouseId) return
loadingAreas.value = true
areaOptions.value = []
try {
const res = await getWarehouseAreaSimpleList(warehouseId)
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
areaOptions.value = data.map(a => ({ value: a.id, label: a.name || a.areaName || String(a.id || '') }))
} catch (e) {} finally { loadingAreas.value = false }
}
onShow(async () => {
const selectResult = getApp().globalData?._materialBeforeConfirm
if (selectResult) {
material.value = selectResult
outboundQty.value = null
getApp().globalData._materialBeforeConfirm = null
if (selectResult.id) {
try {
const res = await getProductDetail(selectResult.id)
const detail = res?.data || res
if (detail) { material.value = { ...material.value, ...detail }; loadTotalStockCount() }
} catch (e) { console.error('获取物料详情失败:', e) }
}
}
loadWarehouses()
})
// get-count
async function loadTotalStockCount() {
const id = material.value.id
if (!id) return
try {
const res = await getSparepartStockCount(id)
material.value.count = (res?.data ?? res) != null ? Number(res?.data ?? res) : 0
} catch (e) { material.value.count = 0 }
}
//
async function loadStockCount() {
const id = material.value.id
if (!id) return
const whId = selectedWarehouse.value?.value
const arId = selectedArea.value?.value
if (!whId || !arId) {
warehouseAreaStockCount.value = 0
return
}
try {
const res = await getSparepartStock(id, whId, arId)
const detail = res?.data || res
const count = (detail != null && typeof detail === 'object') ? Number(detail.count || 0) : Number(detail || 0)
warehouseAreaStockCount.value = Number.isFinite(count) ? count : 0
} catch (e) { warehouseAreaStockCount.value = 0 }
}
onHide(() => { showAreaDropdown.value = false })
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f6f8; padding-bottom: calc(120rpx + env(safe-area-inset-bottom)); }
.material-section { padding: 0; }
.section-title-bar { display: flex; align-items: center; gap: 10rpx; padding: 24rpx 24rpx 18rpx; }
.section-bar-line { width: 6rpx; height: 32rpx; border-radius: 3rpx; background: #2563eb; flex-shrink: 0; }
.section-title { font-size: 30rpx; font-weight: 700; color: #1a1a1a; }
.material-card { background: #fff; border-radius: 16rpx; padding: 24rpx; margin: 0 24rpx 20rpx; box-shadow: 0 4rpx 16rpx rgba(15,23,42,0.04); }
.card-top { display: flex; position: relative; }
.card-image-wrap { width: 160rpx; height: 160rpx; border-radius: 12rpx; overflow: hidden; background: #f8fafc; border: 1rpx solid #f0f0f0; flex-shrink: 0; margin-right: 20rpx; }
.card-image { width: 100%; height: 100%; }
.card-image-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #f8fafc; }
.empty-img-icon { font-size: 56rpx; opacity: 0.3; }
.card-info-right { flex: 1; min-width: 0; }
.info-item { display: flex; align-items: center; margin-bottom: 8rpx; }
.info-label { font-size: 26rpx; color: #6b7280; flex-shrink: 0; }
.info-name { font-size: 30rpx; font-weight: 700; color: #0f172a; }
.info-value { font-size: 26rpx; color: #374151; }
.stock-highlight { font-size: 30rpx; font-weight: 700; color: #1f2937; }
.card-bottom { margin-top: 20rpx; padding-top: 20rpx; border-top: 1rpx solid #f0f0f0; }
.detail-row { display: flex; align-items: center; margin-bottom: 14rpx; &:last-child { margin-bottom: 0; } &.two-col { justify-content: space-between; } }
.detail-col { display: flex; align-items: center; flex: 1; }
.detail-label { font-size: 24rpx; color: #9ca3af; flex-shrink: 0; }
.detail-value { font-size: 24rpx; color: #4b5563; }
.qty-input-card { background: #fff; border-radius: 16rpx; padding: 24rpx; margin: 0 24rpx; box-shadow: 0 4rpx 16rpx rgba(15,23,42,0.04); }
.form-field { display: flex; flex-direction: column; gap: 12rpx; }
.form-label { font-size: 26rpx; color: #4b5563; font-weight: 500; }
.form-input { width: 100%; height: 88rpx; padding: 0 24rpx; font-size: 28rpx; color: #374151; background: #f8fafc; border-radius: 14rpx; box-sizing: border-box; }
.form-suffix-text { display: block; margin-top: 10rpx; font-size: 24rpx; color: #9ca3af; }
.convert-row { margin-top: 20rpx; padding-top: 20rpx; border-top: 1rpx solid #f0f0f0; display: flex; align-items: center; }
.convert-label-inline { font-size: 26rpx; color: #6b7280; }
.convert-value-inline { font-size: 36rpx; font-weight: 700; color: #1f2937; margin-left: auto; }
.convert-unit-inline { font-size: 24rpx; color: #64748b; margin-left: 8rpx; }
.warehouse-hint { margin-top: 16rpx; padding: 16rpx 20rpx; background: #fefce8; border: 1rpx solid #fef08a; border-radius: 10rpx; font-size: 24rpx; color: #a16207; }
.convert-formula-inline { margin-top: 10rpx; font-size: 22rpx; color: #9ca3af; }
.convert-helper { margin-top: 8rpx; font-size: 24rpx; color: #9ca3af; }
.text-danger { color: #dc2626 !important; }
.stock-warning { display: flex; gap: 12rpx; margin-top: 20rpx; padding: 20rpx; background: #fef2f2; border: 1rpx solid #fecaca; border-radius: 12rpx; }
.warning-icon { font-size: 32rpx; flex-shrink: 0; }
.warning-text { flex: 1; display: flex; flex-direction: column; gap: 6rpx; }
.warning-line { font-size: 24rpx; color: #991b1b; line-height: 1.6; display: block; }
.select-row-card { position: relative; display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 16rpx; padding: 24rpx; margin: 0 24rpx 20rpx; box-shadow: 0 4rpx 16rpx rgba(15,23,42,0.04); }
.full-dropdown { display: flex; align-items: center; justify-content: space-between; width: 100%; font-size: 28rpx; color: #374151; .placeholder { color: #9ca3af; } }
.warehouse-area-card { align-items: flex-start; }
.warehouse-area-rows { width: 100%; display: flex; flex-direction: column; gap: 16rpx; }
.warehouse-area-row { display: flex; align-items: center; }
.warehouse-area-label { width: 120rpx; font-size: 26rpx; color: #6b7280; flex-shrink: 0; }
.warehouse-area-dropdown { flex: 1; min-width: 0; position: relative;
.dropdown-panel { position: absolute; top: 100%; left: 0; right: 0; z-index: 200; margin-top: 4rpx; background: #fff; border: 1rpx solid #e0e0e0; border-radius: 12rpx; box-shadow: 0 8rpx 30rpx rgba(0,0,0,0.15); overflow: hidden; }
}
.dropdown-input { display: flex; align-items: center; height: 64rpx; padding: 0 20rpx; border: 1rpx solid #e0e0e0; border-radius: 10rpx; background: #f9fafb; }
.dropdown-value { flex: 1; font-size: 27rpx; color: #333; &.placeholder { color: #bbb; } }
.dropdown-arrow { font-size: 20rpx; color: #999; flex-shrink: 0; }
.dropdown-panel { position: absolute; top: 68rpx; left: 0; right: 0; z-index: 200; background: #fff; border: 1rpx solid #e0e0e0; border-radius: 12rpx; box-shadow: 0 8rpx 30rpx rgba(0,0,0,0.1); overflow: hidden; }
.dropdown-scroll { max-height: 360rpx; overflow-y: auto; }
.dropdown-item { display: flex; align-items: center; justify-content: space-between; padding: 20rpx 24rpx; border-bottom: 1rpx solid #f0f0f0; &:last-child { border-bottom: 0; } &.active { background: #f0f5ff; } }
.dropdown-item-text { font-size: 27rpx; color: #333; }
.dropdown-check { font-size: 28rpx; color: #2563eb; font-weight: 700; }
.dropdown-empty { padding: 32rpx; text-align: center; color: #999; font-size: 26rpx; }
.bottom-actions { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 18rpx; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -8rpx 24rpx rgba(15,23,42,0.06); z-index: 99; }
.bottom-btn { flex: 1; height: 84rpx; line-height: 84rpx; text-align: center; border-radius: 16rpx; font-size: 30rpx; font-weight: 600; &:active { opacity: 0.85; } }
.cancel-btn { background: #eef2f7; color: #475569; }
.confirm-btn { background: #1f4b79; color: #ffffff; }
</style>

@ -63,7 +63,7 @@ const selectedId = ref('')
const searchText = ref('')
const userList = ref([])
const loading = ref(false)
const fromSource = ref('moldRepair') // moldRepair | sparepartInbound | sparepartOutbound | materialInbound
const fromSource = ref('moldRepair') // moldRepair | sparepartInbound | sparepartOutbound | materialInbound | materialOutbound
let searchTimer = null
const pageTitle = computed(() => {
@ -124,7 +124,12 @@ function handleConfirm() {
return
}
// 使 globalData key
const keyMap = { sparepartInbound: '_sparepartInboundUserSelectResult', sparepartOutbound: '_sparepartOutboundUserSelectResult', materialInbound: '_materialInboundUserSelectResult' }
const keyMap = {
sparepartInbound: '_sparepartInboundUserSelectResult',
sparepartOutbound: '_sparepartOutboundUserSelectResult',
materialInbound: '_materialInboundUserSelectResult',
materialOutbound: '_materialOutboundUserSelectResult'
}
const key = keyMap[fromSource.value] || '_moldRepairUserSelectResult'
getApp().globalData[key] = {
field: field.value === 'confirmBy' ? 'confirmBy' : 'acceptedBy',

@ -68,6 +68,10 @@
<text class="label">{{ t('sparepartInbound.creator') }}</text>
<text class="value">{{ textValue(item.creatorName || item.creator) }}</text>
</view>
<view class="row">
<text class="label">经办人</text>
<text class="value">{{ textValue(item.stockUserName) }}</text>
</view>
<view class="row">
<text class="label">{{ t('sparepartInbound.quantity') }}</text>
<text class="value highlight">{{ textValue(item.totalCount) }}</text>

@ -337,6 +337,8 @@ async function handleSubmit() {
const submitData = {
isCode: true,
outTime: outTime,
stockUserId: String(selectedOperatorId.value),
stockUserName: selectedOperatorName.value || '',
responserId: Number(selectedOperatorId.value),
status: 0,
totalCount: totalCount,

@ -31,6 +31,7 @@
<view class="row"><text class="label">{{ t('sparepartOutbound.sparepartInfo') }}</text><text class="value">{{ textValue(item.productNames) }}</text></view>
<view class="row"><text class="label">{{ t('sparepartOutbound.outboundTime') }}</text><text class="value">{{ formatDateTime(item.outTime || item.createTime) }}</text></view>
<view class="row"><text class="label">{{ t('sparepartOutbound.creator') }}</text><text class="value">{{ textValue(item.creatorName || item.creator) }}</text></view>
<view class="row"><text class="label">经办人</text><text class="value">{{ textValue(item.stockUserName) }}</text></view>
<view class="row"><text class="label">{{ t('sparepartOutbound.quantity') }}</text><text class="value highlight">{{ textValue(item.totalCount) }}</text></view>
<view class="row"><text class="label">{{ t('sparepartOutbound.reviewer') }}</text><text class="value">{{ textValue(item.auditUserName) }}</text></view>
</view>

@ -104,6 +104,9 @@ const MENU_ROUTE_MAP = {
materialInbound: '/pages_function/pages/materialInbound/index',
materialinbound: '/pages_function/pages/materialInbound/index',
'物料入库': '/pages_function/pages/materialInbound/index',
materialOutbound: '/pages_function/pages/materialOutbound/index',
materialoutbound: '/pages_function/pages/materialOutbound/index',
'物料出库': '/pages_function/pages/materialOutbound/index',
sparepartinventory: '/pages_function/pages/sparepartInventory/index',
'备件库存查询': '/pages_function/pages/sparepartInventory/index',
keypart: '/pages_function/pages/keypart/index',

Loading…
Cancel
Save