|
|
|
|
@ -5,7 +5,7 @@
|
|
|
|
|
<view class="sparepart-section">
|
|
|
|
|
<view class="section-title-bar">
|
|
|
|
|
<view class="section-bar-line"></view>
|
|
|
|
|
<text class="section-title">已选备件</text>
|
|
|
|
|
<text class="section-title">已选备�/text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="sparepart-card">
|
|
|
|
|
<view class="card-top">
|
|
|
|
|
@ -14,24 +14,24 @@
|
|
|
|
|
<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(sparepart.name) }}</text></view>
|
|
|
|
|
<view class="info-item"><text class="info-label">规格:</text><text class="info-value">{{ textValue(sparepart.standard || sparepart.deviceSpec) }}</text></view>
|
|
|
|
|
<view class="info-item"><text class="info-label">当前库存:</text><text class="info-value stock-highlight">{{ sparepart.count != null ? sparepart.count : 0 }}{{ textUnit(sparepart.unitName || sparepart.minStockUnitName || '个') }}</text></view>
|
|
|
|
|
<view class="info-item"><text class="info-label">备件å<EFBFBD><EFBFBD>ç§°ï¼?/text><text class="info-name">{{ textValue(sparepart.name) }}</text></view>
|
|
|
|
|
<view class="info-item"><text class="info-label">è§„æ ¼ï¼?/text><text class="info-value">{{ textValue(sparepart.standard || sparepart.deviceSpec) }}</text></view>
|
|
|
|
|
<view class="info-item"><text class="info-label">当å‰<EFBFBD>库å˜ï¼?/text><text class="info-value stock-highlight">{{ sparepart.count != null ? sparepart.count : 0 }}{{ textUnit(sparepart.unitName || sparepart.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(sparepart.purchaseUnitName) }}</text></view>
|
|
|
|
|
<view class="detail-col"><text class="detail-label">库存单位:</text><text class="detail-value">{{ textValue(sparepart.unitName || sparepart.minStockUnitName || '个') }}</text></view>
|
|
|
|
|
<view class="detail-col"><text class="detail-label">采è´å<EFBFBD>•ä½<EFBFBD>ï¼?/text><text class="detail-value">{{ textValue(sparepart.purchaseUnitName) }}</text></view>
|
|
|
|
|
<view class="detail-col"><text class="detail-label">库å˜å<EFBFBD>•ä½<EFBFBD>ï¼?/text><text class="detail-value">{{ textValue(sparepart.unitName || sparepart.minStockUnitName || 'ä¸?) }}</text></view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="detail-row"><text class="detail-label">换算关系:</text><text class="detail-value">1{{ textValue(sparepart.purchaseUnitName) }}={{ textValue(sparepart.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(sparepart) }}</text></view>
|
|
|
|
|
<view class="detail-row"><text class="detail-label">æ<EFBFBD>¢ç®—关系ï¼?/text><text class="detail-value">1{{ textValue(sparepart.purchaseUnitName) }}={{ textValue(sparepart.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(sparepart) }}</text></view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 出库用途 -->
|
|
|
|
|
<!-- 出库用�-->
|
|
|
|
|
<view class="section-title-bar" style="padding-top: 24rpx;">
|
|
|
|
|
<view class="section-bar-line"></view>
|
|
|
|
|
<text class="section-title">出库用途</text>
|
|
|
|
|
<text class="section-title">出库用�/text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="purpose-card">
|
|
|
|
|
<view class="purpose-item" :class="{ active: selectedPurpose === 'repair' }" @click="setPurpose('repair')">
|
|
|
|
|
@ -59,17 +59,17 @@
|
|
|
|
|
<view class="warehouse-area-dropdown" @click="toggleDeviceDropdown">
|
|
|
|
|
<view class="dropdown-input">
|
|
|
|
|
<text :class="['dropdown-value', { placeholder: !selectedDevice }]">{{ selectedDevice ? selectedDevice.label : '请选择' }}</text>
|
|
|
|
|
<text class="dropdown-arrow">▼</text>
|
|
|
|
|
<text class="dropdown-arrow">â–?/text>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="showDeviceDropdown" class="dropdown-panel">
|
|
|
|
|
<scroll-view scroll-y class="dropdown-scroll">
|
|
|
|
|
<view class="dropdown-scroll">
|
|
|
|
|
<view v-for="item in filteredDeviceOptions" :key="item.value" class="dropdown-item" :class="{ active: selectedDevice?.value === item.value }" @click.stop="handleSelectDevice(item)">
|
|
|
|
|
<text class="dropdown-item-text">{{ item.label }}</text>
|
|
|
|
|
<text v-if="selectedDevice?.value === item.value" class="dropdown-check">✓</text>
|
|
|
|
|
<text v-if="selectedDevice?.value === item.value" class="dropdown-check">�/text>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="deviceLoading" class="dropdown-empty">加载中...</view>
|
|
|
|
|
<view v-if="deviceLoading" class="dropdown-empty">åŠ è½½ä¸?..</view>
|
|
|
|
|
<view v-else-if="!filteredDeviceOptions.length" class="dropdown-empty">{{ selectedPurpose === 'maintain' ? '暂无保养设备' : '暂无设备数据' }}</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -78,16 +78,16 @@
|
|
|
|
|
<view class="warehouse-area-dropdown" @click="toggleOrderDropdown">
|
|
|
|
|
<view class="dropdown-input">
|
|
|
|
|
<text :class="['dropdown-value', { placeholder: !currentOrder }]">{{ currentOrder ? currentOrder.label : '请选择' }}</text>
|
|
|
|
|
<text class="dropdown-arrow">▼</text>
|
|
|
|
|
<text class="dropdown-arrow">â–?/text>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="showOrderDropdown" class="dropdown-panel">
|
|
|
|
|
<scroll-view scroll-y class="dropdown-scroll">
|
|
|
|
|
<view class="dropdown-scroll">
|
|
|
|
|
<view v-for="item in currentOrderOptions" :key="item.value" class="dropdown-item" :class="{ active: currentOrder?.value === item.value }" @click.stop="handleSelectOrder(item)">
|
|
|
|
|
<text class="dropdown-item-text">{{ item.label }}</text>
|
|
|
|
|
<text v-if="currentOrder?.value === item.value" class="dropdown-check">✓</text>
|
|
|
|
|
<text v-if="currentOrder?.value === item.value" class="dropdown-check">�/text>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="!currentOrderOptions.length" class="dropdown-empty">{{ selectedPurpose === 'repair' ? '暂无维修单' : '暂无保养单' }}</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
<view v-if="!currentOrderOptions.length" class="dropdown-empty">{{ selectedPurpose === 'repair' ? 'æš‚æ— ç»´ä¿®å<EFBFBD>? : 'æš‚æ— ä¿<EFBFBD>å…»å<EFBFBD>? }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -101,7 +101,7 @@
|
|
|
|
|
<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" />
|
|
|
|
|
<input v-model="outboundQty" class="form-input" placeholder="请输� confirm-type="done" />
|
|
|
|
|
<text class="form-suffix-text">单位:{{ textValue(sparepart.purchaseUnitName) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="convert-row">
|
|
|
|
|
@ -113,18 +113,18 @@
|
|
|
|
|
<view class="convert-formula-inline">{{ outboundQty || 0 }}{{ textValue(sparepart.purchaseUnitName) }} × {{ textValue(sparepart.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(sparepart) }} = {{ calculatedStock }}{{ stockUnitLabel(sparepart) }}</view>
|
|
|
|
|
<!-- 库存不足提示 -->
|
|
|
|
|
<view v-if="stockExceeded" class="stock-warning">
|
|
|
|
|
<text class="warning-icon">⚠</text>
|
|
|
|
|
<text class="warning-icon">âš?/text>
|
|
|
|
|
<view class="warning-text">
|
|
|
|
|
<text class="warning-line">当前库存不足,不能出库</text>
|
|
|
|
|
<text class="warning-line">当前库存:{{ stockCount }}{{ stockUnitLabel(sparepart) }}({{ stockPackText }})</text>
|
|
|
|
|
<text class="warning-line">本次出库:{{ calculatedStock }}{{ stockUnitLabel(sparepart) }}({{ outboundPackText }})</text>
|
|
|
|
|
<text class="warning-line">当å‰<EFBFBD>库å˜ä¸<EFBFBD>足,ä¸<EFBFBD>能出åº?/text>
|
|
|
|
|
<text class="warning-line">当å‰<EFBFBD>库å˜ï¼š{{ stockCount }}{{ stockUnitLabel(sparepart) }}({{ stockPackText }}ï¼?/text>
|
|
|
|
|
<text class="warning-line">本次出库:{{ calculatedStock }}{{ stockUnitLabel(sparepart) }}({{ 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 class="section-bar-line"></view><text class="section-title">供应�/text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="select-row-card">
|
|
|
|
|
<view class="full-dropdown">
|
|
|
|
|
@ -143,15 +143,15 @@
|
|
|
|
|
<view class="warehouse-area-dropdown" @click="toggleWarehouseDropdown">
|
|
|
|
|
<view class="dropdown-input">
|
|
|
|
|
<text :class="['dropdown-value', { placeholder: !selectedWarehouse }]">{{ selectedWarehouse ? selectedWarehouse.label : '请选择' }}</text>
|
|
|
|
|
<text class="dropdown-arrow">▼</text>
|
|
|
|
|
<text class="dropdown-arrow">â–?/text>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="showWarehouseDropdown" class="dropdown-panel">
|
|
|
|
|
<scroll-view scroll-y class="dropdown-scroll">
|
|
|
|
|
<view class="dropdown-scroll">
|
|
|
|
|
<view v-for="item in warehouseOptions" :key="item.value" class="dropdown-item" :class="{ active: selectedWarehouse?.value === item.value }" @click.stop="handleSelectWarehouse(item)">
|
|
|
|
|
<text class="dropdown-item-text">{{ item.label }}</text>
|
|
|
|
|
<text v-if="selectedWarehouse?.value === item.value" class="dropdown-check">✓</text>
|
|
|
|
|
<text v-if="selectedWarehouse?.value === item.value" class="dropdown-check">�/text>
|
|
|
|
|
</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -159,16 +159,16 @@
|
|
|
|
|
<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>
|
|
|
|
|
<text :class="['dropdown-value', { placeholder: !selectedArea }]">{{ selectedArea ? selectedArea.label : (loadingAreas ? 'åŠ è½½ä¸?..' : '请选择') }}</text>
|
|
|
|
|
<text class="dropdown-arrow">â–?/text>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="showAreaDropdown" class="dropdown-panel">
|
|
|
|
|
<scroll-view scroll-y class="dropdown-scroll">
|
|
|
|
|
<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>
|
|
|
|
|
<text v-if="selectedArea?.value === item.value" class="dropdown-check">�/text>
|
|
|
|
|
</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -266,7 +266,7 @@ function formatStockPack(count) {
|
|
|
|
|
|
|
|
|
|
const currentStockText = computed(() => {
|
|
|
|
|
const text = formatStockPack(stockCount.value)
|
|
|
|
|
return text ? `当前库存:${text}` : ''
|
|
|
|
|
return text ? `当å‰<EFBFBD>库å˜ï¼?{text}` : ''
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const stockPackText = computed(() => {
|
|
|
|
|
@ -290,23 +290,23 @@ const defaultSupplierName = computed(() => {
|
|
|
|
|
|
|
|
|
|
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) { return item.unitName || item.minStockUnitName || '个' }
|
|
|
|
|
function stockUnitLabel(item) { return item.unitName || item.minStockUnitName || '� }
|
|
|
|
|
|
|
|
|
|
function handleCancel() { uni.navigateBack() }
|
|
|
|
|
|
|
|
|
|
// 用途映射:repair→1, maintain→2, other→3
|
|
|
|
|
// ç”¨é€”æ˜ å°„ï¼šrepairâ†?, maintainâ†?, otherâ†?
|
|
|
|
|
const PURPOSE_MAP = { repair: 1, maintain: 2, other: 3 }
|
|
|
|
|
|
|
|
|
|
function handleConfirm() {
|
|
|
|
|
if (!outboundQty.value || Number(outboundQty.value) <= 0) {
|
|
|
|
|
uni.showToast({ title: '请输入出库数量', icon: 'none' }); return
|
|
|
|
|
uni.showToast({ title: '请输入出库数�, icon: 'none' }); return
|
|
|
|
|
}
|
|
|
|
|
if (stockExceeded.value) {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '库存不足',
|
|
|
|
|
content: `当前库存:${stockCount.value}${stockUnitLabel(sparepart)}(${stockPackText.value})\n本次出库:${calculatedStock.value}${stockUnitLabel(sparepart)}(${outboundPackText.value})`,
|
|
|
|
|
content: `当å‰<EFBFBD>库å˜ï¼?{stockCount.value}${stockUnitLabel(sparepart)}ï¼?{stockPackText.value})\n本次出库ï¼?{calculatedStock.value}${stockUnitLabel(sparepart)}ï¼?{outboundPackText.value})`,
|
|
|
|
|
showCancel: false,
|
|
|
|
|
confirmText: '知道了'
|
|
|
|
|
confirmText: '知é<EFBFBD>“äº?
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
@ -355,7 +355,7 @@ function handleConfirm() {
|
|
|
|
|
}
|
|
|
|
|
getApp().globalData._sparepartOutboundItems.push(item)
|
|
|
|
|
|
|
|
|
|
uni.showToast({ title: '已添加: ' + (sparepart.value.name || ''), icon: 'success', duration: 1200 })
|
|
|
|
|
uni.showToast({ title: '已添� ' + (sparepart.value.name || ''), icon: 'success', duration: 1200 })
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
const fromScan = getApp().globalData._sparepartFromScan
|
|
|
|
|
getApp().globalData._sparepartFromScan = false
|
|
|
|
|
@ -466,8 +466,8 @@ async function loadWarehouses() {
|
|
|
|
|
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 || '') }))
|
|
|
|
|
// 默认选中"备件仓"
|
|
|
|
|
const defaultWh = warehouseOptions.value.find(w => (w.label || '').includes('备件仓'))
|
|
|
|
|
// 默认选ä¸"备件ä»?
|
|
|
|
|
const defaultWh = warehouseOptions.value.find(w => (w.label || '').includes('备件�))
|
|
|
|
|
if (defaultWh) { selectedWarehouse.value = defaultWh; loadAreas(defaultWh.value) }
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
}
|
|
|
|
|
@ -483,8 +483,8 @@ async function loadAreas(warehouseId) {
|
|
|
|
|
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 || '') }))
|
|
|
|
|
// 默认选中"备件库"
|
|
|
|
|
const defaultArea = areaOptions.value.find(a => (a.label || '').includes('备件库'))
|
|
|
|
|
// 默认选ä¸"备件åº?
|
|
|
|
|
const defaultArea = areaOptions.value.find(a => (a.label || '').includes('备件�))
|
|
|
|
|
if (defaultArea) selectedArea.value = defaultArea
|
|
|
|
|
} catch (e) {} finally { loadingAreas.value = false }
|
|
|
|
|
}
|
|
|
|
|
@ -577,7 +577,7 @@ onHide(() => { showDeviceDropdown.value = false; showOrderDropdown.value = false
|
|
|
|
|
.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; } }
|
|
|
|
|
.dropdown-item-text { font-size: 27rpx; color: #333; }
|
|
|
|
|
.dropdown-check { font-size: 28rpx; color: #2563eb; font-weight: 700; }
|
|
|
|
|
|