From 6012a3d94a16bbd2682cb08299c7672a68493878 Mon Sep 17 00:00:00 2001 From: zhongwenkai <3478244299@qq.com> Date: Wed, 17 Jun 2026 18:08:33 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=B8=8A=E4=B8=8B=E6=A8=A1?= =?UTF-8?q?=E3=80=81=E5=A4=87=E4=BB=B6=E5=87=BA=E5=85=A5=E5=BA=93-?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/moldoperate/dismount.vue | 24 ++++- .../pages/moldoperate/index.vue | 23 ++++- .../pages/sparepartInbound/create.vue | 24 ++++- .../pages/sparepartOutbound/create.vue | 22 ++++- .../sparepartOutbound/sparepartConfirm.vue | 88 ++++++++----------- 5 files changed, 118 insertions(+), 63 deletions(-) diff --git a/src/pages_function/pages/moldoperate/dismount.vue b/src/pages_function/pages/moldoperate/dismount.vue index ceffcd5..5a5dff4 100644 --- a/src/pages_function/pages/moldoperate/dismount.vue +++ b/src/pages_function/pages/moldoperate/dismount.vue @@ -13,11 +13,11 @@ @@ -159,12 +159,14 @@ + + diff --git a/src/pages_function/pages/sparepartOutbound/sparepartConfirm.vue b/src/pages_function/pages/sparepartOutbound/sparepartConfirm.vue index 18fe57a..f04fea5 100644 --- a/src/pages_function/pages/sparepartOutbound/sparepartConfirm.vue +++ b/src/pages_function/pages/sparepartOutbound/sparepartConfirm.vue @@ -5,7 +5,7 @@ - 已选备?/text> + 已选备件 @@ -14,24 +14,24 @@ 📦 - 备件名称?/text>{{ textValue(sparepart.name) }} - 规格?/text>{{ textValue(sparepart.standard || sparepart.deviceSpec) }} - 当前库存?/text>{{ sparepart.count != null ? sparepart.count : 0 }}{{ textUnit(sparepart.unitName || sparepart.minStockUnitName || '?) }} + 备件名称:{{ textValue(sparepart.name) }} + 规格:{{ textValue(sparepart.standard || sparepart.deviceSpec) }} + 当前库存:{{ sparepart.count != null ? sparepart.count : 0 }}{{ textUnit(sparepart.unitName || sparepart.minStockUnitName || '个') }} - 采购单位?/text>{{ textValue(sparepart.purchaseUnitName) }} - 库存单位?/text>{{ textValue(sparepart.unitName || sparepart.minStockUnitName || '?) }} + 采购单位:{{ textValue(sparepart.purchaseUnitName) }} + 库存单位:{{ textValue(sparepart.unitName || sparepart.minStockUnitName || '个') }} - 换算关系?/text>1{{ textValue(sparepart.purchaseUnitName) }}={{ textValue(sparepart.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(sparepart) }} + 换算关系:1{{ textValue(sparepart.purchaseUnitName) }}={{ textValue(sparepart.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(sparepart) }} - + - 出库用?/text> + 出库用途 @@ -59,15 +59,15 @@ {{ selectedDevice ? selectedDevice.label : '请选择' }} - ?/text> + {{ item.label }} - ?/text> + - 加载?.. + 加载中... {{ selectedPurpose === 'maintain' ? '暂无保养设备' : '暂无设备数据' }} @@ -78,15 +78,15 @@ {{ currentOrder ? currentOrder.label : '请选择' }} - ?/text> + {{ item.label }} - ?/text> + - {{ selectedPurpose === 'repair' ? '暂无维修? : '暂无保养? }} + {{ selectedPurpose === 'repair' ? '暂无维修单' : '暂无保养单' }} @@ -101,7 +101,7 @@ 出库数量 - + 单位:{{ textValue(sparepart.purchaseUnitName) }} @@ -111,20 +111,19 @@ {{ currentStockText }} {{ outboundQty || 0 }}{{ textValue(sparepart.purchaseUnitName) }} × {{ textValue(sparepart.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(sparepart) }} = {{ calculatedStock }}{{ stockUnitLabel(sparepart) }} - - ?/text> + - 当前库存不足,不能出?/text> - 当前库存:{{ stockCount }}{{ stockUnitLabel(sparepart) }}({{ stockPackText }}?/text> - 本次出库:{{ calculatedStock }}{{ stockUnitLabel(sparepart) }}({{ outboundPackText }}?/text> + 当前库存不足,不能出库 + 当前库存:{{ stockCount }}{{ stockUnitLabel(sparepart) }}({{ stockPackText }}) + 本次出库:{{ calculatedStock }}{{ stockUnitLabel(sparepart) }}({{ outboundPackText }}) - + - 供应?/text> + 供应商 @@ -143,13 +142,13 @@ {{ selectedWarehouse ? selectedWarehouse.label : '请选择' }} - ?/text> + {{ item.label }} - ?/text> + @@ -159,14 +158,14 @@ 库区 - {{ selectedArea ? selectedArea.label : (loadingAreas ? '加载?..' : '请选择') }} - ?/text> + {{ selectedArea ? selectedArea.label : (loadingAreas ? '加载中...' : '请选择') }} + {{ item.label }} - ?/text> + @@ -224,7 +223,6 @@ const showOrderDropdown = ref(false) const currentOrder = computed(() => selectedPurpose.value === 'repair' ? selectedRepairOrder.value : selectedMaintainOrder.value) const currentOrderOptions = computed(() => selectedPurpose.value === 'repair' ? repairOrderOptions.value : maintainOrderOptions.value) -// 仓库/库区 const warehouseOptions = ref([]) const selectedWarehouse = ref(null) const showWarehouseDropdown = ref(false) @@ -252,7 +250,6 @@ const stockExceeded = computed(() => { return outboundQty.value > 0 && calculatedStock.value > stockCount.value }) -// 库存格式化:X包Y根(带单位) function formatStockPack(count) { const ratio = Number(sparepart.value.purchaseUnitConvertQuantity) || 1 if (ratio === 1) return '' @@ -266,13 +263,11 @@ function formatStockPack(count) { const currentStockText = computed(() => { const text = formatStockPack(stockCount.value) - return text ? `当前库存?{text}` : '' + return text ? `当前库存:${text}` : '' }) - const stockPackText = computed(() => { return formatStockPack(stockCount.value) || `${stockCount.value}${stockUnitLabel(sparepart)}` }) - const outboundPackText = computed(() => { return formatStockPack(calculatedStock.value) || `${calculatedStock.value}${stockUnitLabel(sparepart)}` }) @@ -290,30 +285,26 @@ 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?, 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: `当前库存:${stockCount.value}${stockUnitLabel(sparepart)}(${stockPackText.value})\n本次出库:${calculatedStock.value}${stockUnitLabel(sparepart)}(${outboundPackText.value})`, showCancel: false, - confirmText: '知道? + confirmText: '知道了' }) return } - if (selectedPurpose.value === 'repair' && !selectedDevice.value) { - uni.showToast({ title: '请选择关联设备', icon: 'none' }); return - } - if (selectedPurpose.value === 'maintain' && !selectedDevice.value) { + if ((selectedPurpose.value === 'repair' || selectedPurpose.value === 'maintain') && !selectedDevice.value) { uni.showToast({ title: '请选择关联设备', icon: 'none' }); return } if (!selectedWarehouse.value) { @@ -355,7 +346,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 @@ -363,7 +354,6 @@ function handleConfirm() { }, 800) } -// Device dropdown function toggleDeviceDropdown() { showDeviceDropdown.value = !showDeviceDropdown.value if (showDeviceDropdown.value && selectedPurpose.value === 'maintain' && maintainDeviceIds.value.size === 0) { @@ -458,7 +448,6 @@ async function loadRepairOrdersById(deviceId) { } catch (e) { console.error('loadRepairOrdersById error', e) } } -// 仓库 function toggleWarehouseDropdown() { showWarehouseDropdown.value = !showWarehouseDropdown.value } function handleSelectWarehouse(item) { selectedWarehouse.value = item; showWarehouseDropdown.value = false; selectedArea.value = null; areaOptions.value = []; loadAreas(item.value) } async function loadWarehouses() { @@ -466,13 +455,11 @@ 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) {} } -// 库区 function toggleAreaDropdown() { if (!selectedWarehouse.value) { uni.showToast({ title: '请先选择仓库', icon: 'none' }); return }; showAreaDropdown.value = !showAreaDropdown.value } function handleSelectArea(item) { selectedArea.value = item; showAreaDropdown.value = false } async function loadAreas(warehouseId) { @@ -483,8 +470,7 @@ 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 } } @@ -587,4 +573,4 @@ onHide(() => { showDeviceDropdown.value = false; showOrderDropdown.value = false .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; } - + \ No newline at end of file