feat: 仓储管理-物料库存查询模块

master
zhongwenkai 4 days ago
parent 9a7bdc8284
commit fc9730dfdc

@ -75,6 +75,15 @@ export function getSparepartInventoryPage(params) {
}) })
} }
// 物料库存查询(分页)
export function getMaterialInventoryPage(params) {
return request({
url: '/admin-api/erp/stock/page',
method: 'get',
params
})
}
// 仓库简单列表 // 仓库简单列表
export function getWarehouseSimpleList() { export function getWarehouseSimpleList() {
return request({ return request({

@ -1730,5 +1730,23 @@ export default {
recentInTime: '最近入库', recentInTime: '最近入库',
recentOutTime: '最近出库', recentOutTime: '最近出库',
empty: '暂无备件库存数据' empty: '暂无备件库存数据'
},
materialInventory: {
moduleName: '物料库存查询',
searchPlaceholder: '请输入物料编码或名称',
allArea: '全部库区',
areaPlaceholder: '库区筛选',
productName: '物料名称',
barCode: '物料编码',
warehouse: '仓库',
area: '库区',
count: '基本数量',
stockDisplay: '库存展示',
unit: '单位',
category: '物料小类',
packagingRule: '包装/换算规则',
recentInTime: '最近入库',
recentOutTime: '最近出库',
empty: '暂无物料库存数据'
} }
} }

@ -535,6 +535,20 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "materialInventory/index",
"style": {
"navigationBarTitleText": "物料库存查询",
"navigationStyle": "custom"
}
},
{
"path": "materialInventory/detail",
"style": {
"navigationBarTitleText": "物料详情",
"navigationStyle": "custom"
}
},
{ {
"path": "materialInbound/index", "path": "materialInbound/index",
"style": { "style": {

@ -0,0 +1,288 @@
<template>
<view class="page-container">
<NavBar :title="'物料详情'" />
<view class="content-section" v-if="detail">
<view class="page-title-bar">
<view class="page-title-bar-line"></view>
<text class="page-title">物料基本信息</text>
</view>
<view class="detail-card">
<view class="info-row-top">
<view class="item-image-wrap">
<image v-if="detailImage" :src="detailImage" class="item-image" mode="aspectFill" />
<view v-else class="item-image-placeholder">📦</view>
</view>
<view class="item-info-col">
<view class="item-row"><text class="item-label">物料名称</text><text class="item-value">{{ textValue(detail.name) }}</text></view>
<view class="item-row"><text class="item-label">物料编码</text><text class="item-value">{{ textValue(detail.barCode) }}</text></view>
<view class="item-row"><text class="item-label">物料小类</text><text class="item-value">{{ textValue(detail.categoryName) }}</text></view>
</view>
</view>
<view class="info-list">
<view class="info-row"><text class="info-label">仓库</text><text class="info-value">{{ textValue(warehouseName) }}</text></view>
<view class="info-row"><text class="info-label">库区</text><text class="info-value">{{ textValue(areaName) }}</text></view>
<view class="info-row"><text class="info-label">库存展示</text><text class="info-value highlight">{{ textValue(detail.stockDisplay) }}</text></view>
<view class="info-row"><text class="info-label">基本数量</text><text class="info-value highlight">{{ textValue(stockCount) }}{{ stockUnit !== '-' ? stockUnit : '' }}</text></view>
<view class="info-row"><text class="info-label">包装/换算规则</text><text class="info-value">{{ textValue(packagingRule) }}</text></view>
<view class="info-row"><text class="info-label">最近入库</text><text class="info-value">{{ formatDateTime(recentInTime) }}</text></view>
<view class="info-row"><text class="info-label">最近出库</text><text class="info-value">{{ formatDateTime(recentOutTime) }}</text></view>
</view>
</view>
</view>
<view v-else-if="loading" class="hint">加载中...</view>
<view v-else class="hint">加载失败</view>
</view>
</template>
<script setup>
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import NavBar from '@/components/common/NavBar.vue'
import { getMaterialInventoryPage, getProductDetail } from '@/api/mes/sparepart'
const detail = ref(null)
const loading = ref(true)
const stockCount = ref(0)
const stockUnit = ref('-')
const packagingRule = ref('-')
const warehouseName = ref('-')
const areaName = ref('-')
const recentInTime = ref('')
const recentOutTime = ref('')
const detailImage = computed(() => {
const images = detail.value?.images
if (!images) return ''
if (Array.isArray(images) && images.length) return String(images[0])
return String(images).split(',')[0]?.trim() || ''
})
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 '-'
const n = Number(value)
if (Number.isFinite(n) && n > 0) {
const d = new Date(n < 1e12 ? n * 1000 : n)
if (!Number.isNaN(d.getTime())) {
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')} ${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}:${String(d.getSeconds()).padStart(2, '0')}`
}
}
return String(value)
}
onLoad(async (options) => {
const id = options?.id
const productId = options?.productId
const whId = options?.warehouseId
const arId = options?.areaId
if (!id && !productId) {
loading.value = false
uni.showToast({ title: '缺少物料信息', icon: 'none' })
return
}
try {
//
const cached = getApp().globalData._materialInventoryDetail
if (cached && String(cached.productId) === String(id || productId)) {
detail.value = {
name: cached.productName,
barCode: cached.barCode,
categoryName: cached.categoryName,
standard: cached.standard,
...cached
}
stockCount.value = Number(cached.count ?? 0)
stockUnit.value = cached.unitName || '-'
detail.value.stockDisplay = cached.stockDisplay || String(cached.count || '')
packagingRule.value = cached.packagingRule || '-'
warehouseName.value = cached.warehouseName || '-'
areaName.value = cached.areaName || '-'
recentInTime.value = cached.recentInTime || ''
recentOutTime.value = cached.recentOutTime || ''
//
if (!cached.images) {
getProductDetail(cached.productId).then(res => {
const pd = res?.data || res
if (pd?.images) detail.value = { ...detail.value, images: pd.images }
}).catch(() => {})
}
getApp().globalData._materialInventoryDetail = null
loading.value = false
return
}
// stock/page + product/get
const [pageRes, prodRes] = await Promise.all([
getMaterialInventoryPage({
pageNo: 1,
pageSize: 1,
productId: id || productId,
warehouseId: whId || undefined,
areaId: arId || undefined
}),
getProductDetail(id || productId)
])
const root = pageRes?.data || pageRes
const list = root?.list || root?.rows || root?.records || []
const item = list[0]
const pd = prodRes?.data || prodRes
if (item) {
detail.value = {
name: item.productName,
...item,
stockDisplay: item.stockDisplay || String(item.count || ''),
images: pd?.images || item.images
}
stockCount.value = Number(item.count ?? 0)
stockUnit.value = item.unitName || item.purchaseUnitName || '-'
packagingRule.value = item.packagingRule || '-'
warehouseName.value = item.warehouseName || '-'
areaName.value = item.areaName || '-'
recentInTime.value = item.recentInTime || ''
recentOutTime.value = item.recentOutTime || ''
} else {
detail.value = { name: '-', barCode: '-', categoryName: '-', standard: '-', stockDisplay: '-', images: pd?.images }
}
} catch (e) {
console.error('获取物料详情失败:', e)
} finally {
loading.value = false
}
})
</script>
<style lang="scss" scoped>
.page-container {
min-height: 100vh;
background: #f3f4f6;
padding-bottom: 40rpx;
}
.content-section {
padding: 24rpx 28rpx;
}
.page-title-bar {
display: flex;
align-items: center;
gap: 10rpx;
padding: 0 0 20rpx;
}
.page-title-bar-line {
width: 6rpx;
height: 32rpx;
border-radius: 3rpx;
background: #2563eb;
flex-shrink: 0;
}
.page-title {
font-size: 30rpx;
font-weight: 700;
color: #1a1a1a;
}
.detail-card {
background: #fff;
border-radius: 16rpx;
padding: 28rpx;
box-shadow: 0 2rpx 12rpx rgba(15, 23, 42, 0.04);
}
.info-row-top {
display: flex;
align-items: center;
padding-bottom: 20rpx;
border-bottom: 1rpx solid #f3f4f6;
margin-bottom: 20rpx;
}
.item-image-wrap {
width: 130rpx;
height: 130rpx;
border-radius: 12rpx;
overflow: hidden;
background: #f8fafc;
border: 1rpx solid #f0f0f0;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
}
.item-image { width: 100%; height: 100%; }
.item-image-placeholder { font-size: 48rpx; opacity: 0.2; }
.item-info-col {
flex: 1;
min-width: 0;
}
.item-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
padding: 8rpx 0;
&:last-child { padding-bottom: 0; }
}
.item-label {
font-size: 28rpx;
color: #9ca3af;
flex-shrink: 0;
}
.item-value {
font-size: 28rpx;
color: #374151;
text-align: right;
word-break: break-all;
}
.info-list {
display: flex;
flex-direction: column;
}
.info-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20rpx;
padding: 16rpx 0;
border-bottom: 1rpx solid #f3f4f6;
&:last-child { border-bottom: 0; }
}
.info-label {
font-size: 28rpx;
color: #9ca3af;
font-weight: 600;
flex-shrink: 0;
}
.info-value {
flex: 1;
text-align: right;
font-size: 28rpx;
color: #374151;
word-break: break-all;
&.highlight {
color: #1f4b79;
font-weight: 700;
}
}
.hint {
text-align: center;
padding: 160rpx 0;
font-size: 28rpx;
color: #9ca3af;
}
</style>

@ -0,0 +1,534 @@
<template>
<view class="page-container">
<NavBar :title="t('materialInventory.moduleName')" />
<view class="filter-bar">
<view class="scan-input-row">
<input
id="material-inventory-scan-input"
v-model="searchKeyword"
class="scan-input"
type="text"
placeholder="请输入物料编码或名称"
placeholder-class="scan-placeholder"
confirm-type="done"
@confirm="onScanInputConfirm"
/>
</view>
<view class="area-box" @click="openAreaPicker">
<text class="area-box-text">{{ selectedAreaLabel || t('materialInventory.allArea') }}</text>
<uni-icons type="bottom" size="14" color="#9ca3af"></uni-icons>
</view>
<view class="reset-filter-btn" @click="resetFilters">{{ t('functionCommon.reset') }}</view>
</view>
<scroll-view
scroll-y
class="content-scroll"
@scrolltolower="loadMore"
:lower-threshold="80"
>
<view class="list-wrap">
<view v-for="item in list" :key="item.id" class="inventory-card" @click="openDetail(item)">
<view class="card-main">
<view class="card-top">
<text class="product-name">{{ textValue(item.barCode) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('materialInventory.productName') }}</text>
<text class="info-value">{{ textValue(item.productName) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('materialInventory.area') }}</text>
<text class="info-value">{{ textValue(item.areaName) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('materialInventory.stockDisplay') }}</text>
<text class="info-value count-value">{{ textValue(item.stockDisplay) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('materialInventory.count') }}</text>
<text class="info-value count-value">{{ textValue(item.count) }}{{ textUnit(item.unitName) }}</text>
</view>
</view>
</view>
<view v-if="loading && pageNo === 1" class="loading-text">{{ t('functionCommon.loading') }}</view>
<view v-else-if="!list.length" class="empty-text">{{ t('materialInventory.empty') }}</view>
<view v-else-if="loadingMore" class="loading-text">{{ t('functionCommon.loadingMore') }}</view>
<view v-else-if="finished" class="finished-text">{{ t('functionCommon.noMoreData') }}</view>
</view>
</scroll-view>
<sv-focus-no-keyboard ref="focusNoKeyboardRef"></sv-focus-no-keyboard>
<uni-popup ref="areaPickerRef" type="bottom" background-color="#fff">
<view class="picker-content">
<view class="picker-header">
<text class="picker-title">{{ t('materialInventory.areaPlaceholder') }}</text>
<view class="picker-clear" @click="resetArea">
<text class="picker-clear-text">{{ t('functionCommon.reset') }}</text>
</view>
</view>
<scroll-view scroll-y class="picker-list">
<view
v-for="item in areaOptions"
:key="String(item.value)"
class="picker-item"
@click="selectArea(item)"
>
<text class="picker-text">{{ item.label }}</text>
<text v-if="selectedArea === item.value" class="picker-check"></text>
</view>
</scroll-view>
</view>
</uni-popup>
</view>
</template>
<script setup>
import { ref, computed, nextTick } from 'vue'
import { onLoad, onReady } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { getMaterialInventoryPage } from '@/api/mes/sparepart'
import { getWarehouseSimpleList, getWarehouseAreaSimpleList } from '@/api/mes/moldget'
const { t } = useI18n()
const areaPickerRef = ref(null)
const list = ref([])
const loading = ref(false)
const loadingMore = ref(false)
const finished = ref(false)
const pageNo = ref(1)
const pageSize = ref(10)
const total = ref(0)
const searchKeyword = ref('')
const selectedArea = ref('')
const areaOptions = ref([])
const materialWarehouseId = ref(null)
//
const focusNoKeyboardRef = ref(null)
const keywordInputSelector = '#material-inventory-scan-input input, input#material-inventory-scan-input'
function focusKeywordNoKeyboard() {
nextTick(() => {
setTimeout(() => {
focusNoKeyboardRef.value?.focus(keywordInputSelector)
}, 80)
})
}
const selectedAreaLabel = computed(() => {
const current = areaOptions.value.find((item) => item.value === selectedArea.value)
return current ? current.label : ''
})
onLoad(async () => {
await loadWarehouseThenAreas()
await fetchList(true)
})
onReady(() => {
focusKeywordNoKeyboard()
})
async function loadWarehouseThenAreas() {
try {
//
const whRes = await getWarehouseSimpleList()
const whData = Array.isArray(whRes) ? whRes : (Array.isArray(whRes?.data) ? whRes.data : [])
const rawWarehouse = whData.find(w => w.name === '原料仓')
if (rawWarehouse) {
materialWarehouseId.value = rawWarehouse.id
//
const areaRes = await getWarehouseAreaSimpleList(materialWarehouseId.value)
const areaData = Array.isArray(areaRes) ? areaRes : (Array.isArray(areaRes?.data) ? areaRes.data : [])
areaOptions.value = areaData.map((a) => ({
value: String(a.id),
label: a.name || a.areaName || String(a.id)
}))
}
} catch (e) {
console.error('loadWarehouseThenAreas error', e)
}
}
//
const allList = ref([])
async function fetchAllForSearch(areaId) {
const all = []
let currentPage = 1
const maxPage = 10
while (currentPage <= maxPage) {
const res = await getMaterialInventoryPage({
pageNo: currentPage,
pageSize: 100,
categoryType: 2,
areaId: areaId || undefined
})
const page = normalizePageData(res)
all.push(...page.list)
if (page.list.length < 100) break
currentPage++
}
return all
}
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 keyword = searchKeyword.value.trim().toLowerCase()
if (keyword && reset) {
const allData = await fetchAllForSearch(selectedArea.value)
allList.value = allData
const scanMatch = keyword.match(/(?:productmaterial|spare|material|product)[-_](\d+)/i)
let filtered
if (scanMatch) {
const targetId = Number(scanMatch[1])
filtered = allData.filter(item => Number(item.productId) === targetId)
} else {
filtered = allData.filter(item => {
const bc = String(item.barCode || '').toLowerCase()
const pn = String(item.productName || '').toLowerCase()
return bc.includes(keyword) || pn.includes(keyword)
})
}
list.value = filtered
total.value = filtered.length
finished.value = true
} else {
const res = await getMaterialInventoryPage({
pageNo: pageNo.value,
pageSize: pageSize.value,
categoryType: 2,
areaId: selectedArea.value || undefined
})
const page = normalizePageData(res)
total.value = page.total
list.value = reset ? page.list : [...list.value, ...page.list]
finished.value = list.value.length >= total.value || page.list.length < pageSize.value
}
} catch (e) {
if (!reset) pageNo.value = Math.max(1, pageNo.value - 1)
console.error('[materialInventory] fetchList error:', e)
uni.showToast({ title: t('functionCommon.loadFailed'), icon: 'none' })
} finally {
loading.value = false
loadingMore.value = false
}
}
function normalizePageData(res) {
const root = res && res.data !== undefined ? res.data : res
const pageResult = root?.pageResult || root?.data?.pageResult || root?.data || root || {}
const candidateList = pageResult?.list || pageResult?.rows || pageResult?.records || []
const candidateTotal = pageResult?.total ?? root?.total ?? root?.data?.total ?? candidateList.length
return {
list: Array.isArray(candidateList) ? candidateList : [],
total: Number(candidateTotal || 0)
}
}
async function onScanInputConfirm() {
const code = searchKeyword.value.trim()
if (!code) return
allList.value = []
await fetchList(true)
}
async function resetFilters() {
searchKeyword.value = ''
selectedArea.value = ''
allList.value = []
pageNo.value = 1
finished.value = false
await fetchList(true)
}
function openAreaPicker() {
areaPickerRef.value?.open()
}
async function selectArea(item) {
selectedArea.value = item.value
areaPickerRef.value?.close()
allList.value = []
pageNo.value = 1
finished.value = false
await fetchList(true)
}
async function resetArea() {
selectedArea.value = ''
areaPickerRef.value?.close()
allList.value = []
pageNo.value = 1
finished.value = false
await fetchList(true)
}
function openDetail(item) {
if (!item?.productId) return
getApp().globalData._materialInventoryDetail = item
uni.navigateTo({
url: `/pages_function/pages/materialInventory/detail?id=${item.productId}&warehouseId=${item.warehouseId || ''}&areaId=${item.areaId || ''}`
})
}
async function loadMore() {
if (searchKeyword.value.trim()) return
if (loading.value || loadingMore.value || finished.value) return
pageNo.value += 1
await fetchList(false)
}
function textValue(value) {
if (value === 0) return '0'
if (value === false) return t('functionCommon.no')
if (value === true) return t('functionCommon.yes')
if (value === null || value === undefined) return '-'
const text = String(value).trim()
return text || '-'
}
function textUnit(v) {
if (v == null || v === '') return ''
return String(v).trim()
}
function formatDateTime(value) {
if (!value) return '-'
if (Array.isArray(value) && value.length >= 3) {
const [y, m, d, hh = 0, mm = 0, ss = 0] = value
const pad = (n) => String(n).padStart(2, '0')
return `${y}-${pad(m)}-${pad(d)} ${pad(hh)}:${pad(mm)}:${pad(ss)}`
}
const text = String(value).trim()
if (!text) return '-'
const numeric = Number(text)
if (Number.isFinite(numeric)) {
const timestamp = text.length === 10 ? numeric * 1000 : numeric
const date = new Date(timestamp)
if (!Number.isNaN(date.getTime())) {
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}:${String(date.getSeconds()).padStart(2, '0')}`
}
}
const date = new Date(text)
if (!Number.isNaN(date.getTime())) {
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}:${String(date.getSeconds()).padStart(2, '0')}`
}
return text
}
</script>
<style lang="scss" scoped>
.page-container {
min-height: 100vh;
background-color: #f3f4f6;
}
.filter-bar {
display: flex;
align-items: center;
gap: 12rpx;
padding: 18rpx 24rpx 20rpx;
}
.scan-input-row {
flex: 1;
min-width: 0;
min-height: 72rpx !important;
height: 72rpx !important;
}
.scan-input {
width: 100%;
min-height: 72rpx !important;
height: 72rpx !important;
padding: 0 20rpx;
font-size: 26rpx;
color: #333;
background: #fff;
border: 1rpx solid #d0d5dd;
border-radius: 10rpx;
box-sizing: border-box;
}
.scan-placeholder {
color: #9ca3af;
}
.area-box {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
width: 180rpx;
height: 72rpx;
padding: 0 14rpx;
background: #ffffff;
border: 1rpx solid #d0d5dd;
border-radius: 10rpx;
box-sizing: border-box;
}
.area-box-text {
color: #374151;
font-size: 26rpx;
max-width: 110rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.reset-filter-btn {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
width: 96rpx;
height: 72rpx;
font-size: 24rpx;
color: #4b5563;
background: #ffffff;
border: 1rpx solid #d0d5dd;
border-radius: 10rpx;
box-sizing: border-box;
}
.content-scroll {
width: 100%;
height: calc(100vh - 120rpx);
}
.list-wrap {
padding: 0 28rpx 140rpx;
}
.inventory-card {
margin-bottom: 18rpx;
border-radius: 12rpx;
background: #ffffff;
box-shadow: none;
overflow: hidden;
}
.card-main {
padding: 24rpx;
}
.card-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
}
.product-name {
max-width: 420rpx;
font-size: 36rpx;
line-height: 44rpx;
color: #24456b;
font-weight: 700;
}
.info-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20rpx;
margin-top: 14rpx;
}
.info-label {
font-size: 28rpx;
color: #9ca3af;
font-weight: 600;
flex-shrink: 0;
}
.info-value {
flex: 1;
text-align: right;
font-size: 30rpx;
color: #374151;
word-break: break-all;
}
.count-value {
color: #1f4b79;
font-weight: 700;
}
.loading-text,
.empty-text,
.finished-text {
padding: 28rpx 0;
text-align: center;
color: #9ca3af;
font-size: 26rpx;
}
.empty-text {
padding-top: 160rpx;
}
.picker-content {
padding: 24rpx 24rpx 36rpx;
border-radius: 28rpx 28rpx 0 0;
}
.picker-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
}
.picker-title {
color: #1f2d3d;
font-size: 30rpx;
font-weight: 700;
}
.picker-clear-text {
color: #1f61ff;
font-size: 26rpx;
}
.picker-list {
max-height: 480rpx;
}
.picker-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 26rpx 6rpx;
border-bottom: 1rpx solid #edf1f6;
}
.picker-text {
color: #243447;
font-size: 28rpx;
}
.picker-check {
color: #1f61ff;
font-size: 30rpx;
}
</style>

@ -26,8 +26,7 @@
<view class="info-row"><text class="info-label">仓库</text><text class="info-value">{{ textValue(warehouseName) }}</text></view> <view class="info-row"><text class="info-label">仓库</text><text class="info-value">{{ textValue(warehouseName) }}</text></view>
<view class="info-row"><text class="info-label">库区</text><text class="info-value">{{ textValue(areaName) }}</text></view> <view class="info-row"><text class="info-label">库区</text><text class="info-value">{{ textValue(areaName) }}</text></view>
<view class="info-row"><text class="info-label">库存展示</text><text class="info-value highlight">{{ textValue(detail.stockDisplay) }}</text></view> <view class="info-row"><text class="info-label">库存展示</text><text class="info-value highlight">{{ textValue(detail.stockDisplay) }}</text></view>
<view class="info-row"><text class="info-label">基本数量</text><text class="info-value">{{ textValue(stockCount) }}</text></view> <view class="info-row"><text class="info-label">基本数量</text><text class="info-value highlight">{{ textValue(stockCount) }}{{ stockUnit !== '-' ? stockUnit : '' }}</text></view>
<view class="info-row"><text class="info-label">单位</text><text class="info-value">{{ textValue(stockUnit) }}</text></view>
<view class="info-row"><text class="info-label">包装/换算规则</text><text class="info-value">{{ textValue(packagingRule) }}</text></view> <view class="info-row"><text class="info-label">包装/换算规则</text><text class="info-value">{{ textValue(packagingRule) }}</text></view>
<view class="info-row"><text class="info-label">最近入库</text><text class="info-value">{{ formatDateTime(recentInTime) }}</text></view> <view class="info-row"><text class="info-label">最近入库</text><text class="info-value">{{ formatDateTime(recentInTime) }}</text></view>
<view class="info-row"><text class="info-label">最近出库</text><text class="info-value">{{ formatDateTime(recentOutTime) }}</text></view> <view class="info-row"><text class="info-label">最近出库</text><text class="info-value">{{ formatDateTime(recentOutTime) }}</text></view>

@ -38,14 +38,6 @@
<text class="info-label">{{ t('sparepartInventory.productName') }}</text> <text class="info-label">{{ t('sparepartInventory.productName') }}</text>
<text class="info-value">{{ textValue(item.productName) }}</text> <text class="info-value">{{ textValue(item.productName) }}</text>
</view> </view>
<view class="info-row">
<text class="info-label">{{ t('sparepartInventory.category') }}</text>
<text class="info-value">{{ textValue(item.categoryName) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('sparepartInventory.warehouse') }}</text>
<text class="info-value">{{ textValue(item.warehouseName) }}</text>
</view>
<view class="info-row"> <view class="info-row">
<text class="info-label">{{ t('sparepartInventory.area') }}</text> <text class="info-label">{{ t('sparepartInventory.area') }}</text>
<text class="info-value">{{ textValue(item.areaName) }}</text> <text class="info-value">{{ textValue(item.areaName) }}</text>
@ -56,23 +48,7 @@
</view> </view>
<view class="info-row"> <view class="info-row">
<text class="info-label">{{ t('sparepartInventory.count') }}</text> <text class="info-label">{{ t('sparepartInventory.count') }}</text>
<text class="info-value">{{ textValue(item.count) }}</text> <text class="info-value count-value">{{ textValue(item.count) }}{{ textUnit(item.unitName) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('sparepartInventory.unit') }}</text>
<text class="info-value">{{ textValue(item.unitName) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('sparepartInventory.packagingRule') }}</text>
<text class="info-value">{{ textValue(item.packagingRule) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('sparepartInventory.recentInTime') }}</text>
<text class="info-value">{{ formatDateTime(item.recentInTime) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('sparepartInventory.recentOutTime') }}</text>
<text class="info-value">{{ formatDateTime(item.recentOutTime) }}</text>
</view> </view>
</view> </view>
</view> </view>
@ -335,6 +311,11 @@ function textValue(value) {
return text || '-' return text || '-'
} }
function textUnit(v) {
if (v == null || v === '') return ''
return String(v).trim()
}
function formatDateTime(value) { function formatDateTime(value) {
if (!value) return '-' if (!value) return '-'
if (Array.isArray(value) && value.length >= 3) { if (Array.isArray(value) && value.length >= 3) {

@ -113,6 +113,8 @@ const MENU_ROUTE_MAP = {
'物料出库': '/pages_function/pages/materialOutbound/index', '物料出库': '/pages_function/pages/materialOutbound/index',
sparepartinventory: '/pages_function/pages/sparepartInventory/index', sparepartinventory: '/pages_function/pages/sparepartInventory/index',
'备件库存查询': '/pages_function/pages/sparepartInventory/index', '备件库存查询': '/pages_function/pages/sparepartInventory/index',
materialinventory: '/pages_function/pages/materialInventory/index',
'物料库存查询': '/pages_function/pages/materialInventory/index',
keypart: '/pages_function/pages/keypart/index', keypart: '/pages_function/pages/keypart/index',
product: '/pages_function/pages/product/index' product: '/pages_function/pages/product/index'
} }

Loading…
Cancel
Save