diff --git a/src/pages_function/pages/sparepartInbound/create.vue b/src/pages_function/pages/sparepartInbound/create.vue
index 5d20c75..5886951 100644
--- a/src/pages_function/pages/sparepartInbound/create.vue
+++ b/src/pages_function/pages/sparepartInbound/create.vue
@@ -4,16 +4,17 @@
-
-
-
-
- {{ t('sparepartInbound.scanSparepart') }}
+
+
-
-
-
{{ t('sparepartInbound.selectSparepart') }}
@@ -43,7 +44,7 @@
▼
-
+
✓
暂无数据
-
+
@@ -160,6 +161,44 @@ import { getSimpleUserList } from '@/api/mes/moldget'
const { t } = useI18n()
const itemList = ref([])
+const scanCodeInput = ref('') // 扫码/输入备件码
+
+// 红外扫码或手动输入备件码确认
+function onScanInputConfirm() {
+ const code = scanCodeInput.value.trim()
+ if (!code) return
+ handleScanCode(code)
+}
+
+async function handleScanCode(code) {
+ let sparepartId = null
+ if (code.toUpperCase().startsWith('SPARE-')) {
+ sparepartId = code.replace(/SPARE-/i, '')
+ } else {
+ const idMatch = code.match(/(\d+)$/)
+ if (idMatch) sparepartId = idMatch[1]
+ }
+ if (!sparepartId) {
+ uni.showToast({ title: '无法识别备件码', icon: 'none' })
+ return
+ }
+ try {
+ const apiRes = await getSparepartDetail(sparepartId)
+ const detail = apiRes?.data || apiRes
+ if (detail && detail.id) {
+ getApp().globalData._sparepartFromScan = true
+ getApp().globalData._sparepartBeforeConfirm = detail
+ uni.navigateTo({
+ url: '/pages_function/pages/sparepartInbound/sparepartConfirm'
+ })
+ } else {
+ uni.showToast({ title: '未找到备件: ' + sparepartId, icon: 'none' })
+ }
+ } catch (e) {
+ console.error('[备件入库] 扫码查询备件失败:', e)
+ uni.showToast({ title: '扫码失败', icon: 'none' })
+ }
+}
// 入库时间
const inboundDate = ref(formatDate(new Date()))
@@ -209,36 +248,11 @@ function handleScan() {
uni.scanCode({
onlyFromCamera: false,
scanType: ['barCode', 'qrCode'],
- success: async (res) => {
+ success: (res) => {
const code = (res.result || '').trim()
if (!code) return
- let sparepartId = null
- if (code.toUpperCase().startsWith('SPARE-')) {
- sparepartId = code.replace(/SPARE-/i, '')
- } else {
- const idMatch = code.match(/(\d+)$/)
- if (idMatch) sparepartId = idMatch[1]
- }
- if (!sparepartId) {
- uni.showToast({ title: '无法识别备件码', icon: 'none' })
- return
- }
- try {
- const apiRes = await getSparepartDetail(sparepartId)
- const detail = apiRes?.data || apiRes
- if (detail && detail.id) {
- getApp().globalData._sparepartFromScan = true
- getApp().globalData._sparepartBeforeConfirm = detail
- uni.navigateTo({
- url: '/pages_function/pages/sparepartInbound/sparepartConfirm'
- })
- } else {
- uni.showToast({ title: '未找到备件: ' + sparepartId, icon: 'none' })
- }
- } catch (e) {
- console.error('[备件入库] 扫码查询备件失败:', e)
- uni.showToast({ title: '扫码失败', icon: 'none' })
- }
+ scanCodeInput.value = code
+ handleScanCode(code)
},
fail: () => {
uni.showToast({ title: '扫码失败', icon: 'none' })
@@ -418,26 +432,46 @@ onHide(() => {
/* 操作按钮区 */
.action-row {
display: flex;
- gap: 20rpx;
+ align-items: center;
+ gap: 16rpx;
padding: 20rpx 24rpx;
}
-.action-btn {
+.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;
- gap: 12rpx;
- height: 96rpx;
- border-radius: 12rpx;
+ height: 72rpx;
+ padding: 0 24rpx;
+ border-radius: 10rpx;
background: #1f4b79;
color: #fff;
- font-size: 28rpx;
+ 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: 28rpx; font-weight: 600; color: #fff; }
+ .btn-text { font-size: 26rpx; font-weight: 600; color: #fff; }
}
/* 备件列表 */
@@ -505,7 +539,7 @@ onHide(() => {
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: 360rpx; }
+.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; }
diff --git a/src/pages_function/pages/sparepartInbound/index.vue b/src/pages_function/pages/sparepartInbound/index.vue
index 179d30a..a675193 100644
--- a/src/pages_function/pages/sparepartInbound/index.vue
+++ b/src/pages_function/pages/sparepartInbound/index.vue
@@ -188,14 +188,14 @@ function textValue(v) {
function formatDateTime(value) {
if (!value) return '-'
if (Array.isArray(value) && value.length >= 3) {
- const [year, month, day, hour = 0, minute = 0, second = 0] = value
+ const [year, month, day] = value
const pad = (n) => String(n).padStart(2, '0')
- return `${year}-${pad(month)}-${pad(day)} ${pad(hour)}:${pad(minute)}:${pad(second)}`
+ 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())} ${pad(date.getHours())}:${pad(date.getMinutes())}`
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
}
const STATUS_MAP = { 0: '待入库', 10: '待审核', 20: '已入库', 1: '已驳回' }
diff --git a/src/pages_function/pages/sparepartInbound/sparepartConfirm.vue b/src/pages_function/pages/sparepartInbound/sparepartConfirm.vue
index 8a0ec6f..d3fdcda 100644
--- a/src/pages_function/pages/sparepartInbound/sparepartConfirm.vue
+++ b/src/pages_function/pages/sparepartInbound/sparepartConfirm.vue
@@ -110,7 +110,7 @@
▼
-
+
✓
暂无数据
-
+
@@ -136,7 +136,7 @@
▼
-
+
✓
暂无数据
-
+
@@ -470,7 +470,7 @@ onHide(() => {
.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 { height: 360rpx; }
+.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; }
diff --git a/src/pages_function/pages/sparepartOutbound/create.vue b/src/pages_function/pages/sparepartOutbound/create.vue
index 44831d6..2ed89c7 100644
--- a/src/pages_function/pages/sparepartOutbound/create.vue
+++ b/src/pages_function/pages/sparepartOutbound/create.vue
@@ -4,12 +4,17 @@
-
-
- 扫备件码
+
+
-
选择备件
@@ -37,13 +42,13 @@
{{ selectedOperator ? selectedOperator.label : '请选择经办人' }}
▼
-
+
{{ item.label }}
✓
暂无数据
-
+
@@ -146,25 +151,38 @@ function handleSelectSparepart() {
uni.navigateTo({ url: '/pages_function/pages/sparepartInbound/sparepartSelect' })
}
+const scanCodeInput = ref('')
+
+function onScanInputConfirm() {
+ const code = scanCodeInput.value.trim()
+ if (!code) return
+ handleScanCode(code)
+}
+
+async function handleScanCode(code) {
+ let sparepartId = null
+ if (code.toUpperCase().startsWith('SPARE-')) sparepartId = code.replace(/SPARE-/i, '')
+ else { const idMatch = code.match(/(\d+)$/); if (idMatch) sparepartId = idMatch[1] }
+ if (!sparepartId) { uni.showToast({ title: '无法识别备件码', icon: 'none' }); return }
+ try {
+ const apiRes = await getSparepartDetail(sparepartId)
+ const detail = apiRes?.data || apiRes
+ if (detail && detail.id) {
+ getApp().globalData._sparepartFromScan = true
+ getApp().globalData._sparepartBeforeConfirm = detail
+ uni.navigateTo({ url: '/pages_function/pages/sparepartOutbound/sparepartConfirm' })
+ } else { uni.showToast({ title: '未找到备件: ' + sparepartId, icon: 'none' }) }
+ } catch (e) { console.error(e); uni.showToast({ title: '扫码失败', icon: 'none' }) }
+}
+
function handleScan() {
uni.scanCode({
onlyFromCamera: false, scanType: ['barCode', 'qrCode'],
- success: async (res) => {
+ success: (res) => {
const code = (res.result || '').trim()
if (!code) return
- let sparepartId = null
- if (code.toUpperCase().startsWith('SPARE-')) sparepartId = code.replace(/SPARE-/i, '')
- else { const idMatch = code.match(/(\d+)$/); if (idMatch) sparepartId = idMatch[1] }
- if (!sparepartId) { uni.showToast({ title: '无法识别备件码', icon: 'none' }); return }
- try {
- const apiRes = await getSparepartDetail(sparepartId)
- const detail = apiRes?.data || apiRes
- if (detail && detail.id) {
- getApp().globalData._sparepartFromScan = true
- getApp().globalData._sparepartBeforeConfirm = detail
- uni.navigateTo({ url: '/pages_function/pages/sparepartOutbound/sparepartConfirm' })
- } else { uni.showToast({ title: '未找到备件: ' + sparepartId, icon: 'none' }) }
- } catch (e) { console.error(e); uni.showToast({ title: '扫码失败', icon: 'none' }) }
+ scanCodeInput.value = code
+ handleScanCode(code)
},
fail: () => { uni.showToast({ title: '扫码失败', icon: 'none' }) }
})
@@ -251,8 +269,10 @@ onHide(() => { showOperatorDropdown.value = false })