diff --git a/src/api/mes/sparepart.js b/src/api/mes/sparepart.js
index 7b7ba32..1afc49a 100644
--- a/src/api/mes/sparepart.js
+++ b/src/api/mes/sparepart.js
@@ -11,3 +11,12 @@ export function getSparepartSimpleList(pageNo = 1) {
}
})
}
+
+// 备件详情(含供应商、图片等完整信息)
+export function getSparepartDetail(id) {
+ return request({
+ url: '/admin-api/erp/product/get',
+ method: 'get',
+ params: { id }
+ })
+}
diff --git a/src/api/mes/sparepartOutbound.js b/src/api/mes/sparepartOutbound.js
new file mode 100644
index 0000000..5325f84
--- /dev/null
+++ b/src/api/mes/sparepartOutbound.js
@@ -0,0 +1,28 @@
+import request from '@/utils/request'
+
+// 备件出库单分页查询
+export function getSparepartOutboundPage(params = {}) {
+ return request({
+ url: '/admin-api/erp/stock-out/page',
+ method: 'get',
+ params: { ...params, outType: '备件出库' }
+ })
+}
+
+// 备件出库单审核(status: 20=通过, 1=驳回)
+export function auditSparepartOutbound(data) {
+ return request({
+ url: '/admin-api/erp/stock-out/audit',
+ method: 'put',
+ data
+ })
+}
+
+// 备件出库单删除
+export function deleteSparepartOutbound(id) {
+ return request({
+ url: '/admin-api/erp/stock-out/delete',
+ method: 'delete',
+ params: { ids: String(id) }
+ })
+}
diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js
index 41327b8..ef11324 100644
--- a/src/locales/zh-CN.js
+++ b/src/locales/zh-CN.js
@@ -1411,5 +1411,25 @@ export default {
qtyPlaceholder: '请输入',
noSparepartData: '暂无备件数据',
validatorSparepartRequired: '请选择备件'
+ },
+ sparepartOutbound: {
+ moduleName: '备件出库',
+ tabPending: '待提交',
+ tabAuditing: '待审核',
+ searchPlaceholder: '搜索出库单号',
+ sparepartInfo: '备件信息',
+ outboundTime: '出库时间',
+ creator: '创建人',
+ quantity: '数量',
+ reviewer: '审核人',
+ approve: '已通过',
+ reject: '驳回',
+ confirmApprove: '确定审核通过该出库单吗?',
+ confirmReject: '确定驳回该出库单吗?',
+ approveSuccess: '审核通过',
+ rejectSuccess: '已驳回',
+ deleteSuccess: '删除成功',
+ empty: '暂无出库单据',
+ createTitle: '新增备件出库'
}
}
diff --git a/src/pages.json b/src/pages.json
index f4c1a77..169b348 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -388,6 +388,20 @@
"navigationStyle": "custom"
}
},
+ {
+ "path": "sparepartOutbound/index",
+ "style": {
+ "navigationBarTitleText": "备件出库",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "sparepartOutbound/create",
+ "style": {
+ "navigationBarTitleText": "新增备件出库",
+ "navigationStyle": "custom"
+ }
+ },
{
"path": "keypart/index",
diff --git a/src/pages_function/pages/sparepartInbound/create.vue b/src/pages_function/pages/sparepartInbound/create.vue
index 9c9c8ad..6bafaee 100644
--- a/src/pages_function/pages/sparepartInbound/create.vue
+++ b/src/pages_function/pages/sparepartInbound/create.vue
@@ -30,8 +30,8 @@
@@ -107,17 +107,16 @@
-
+
供应商
-
+
-
- {{ supplierInfo.name || '请选择供应商' }}
+
+ {{ defaultSupplierName || '未配置默认供应商' }}
- ▼
@@ -236,12 +235,37 @@ import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { getSimpleUserList, getWarehouseSimpleList, getWarehouseAreaSimpleList } from '@/api/mes/moldget'
import { createSparepartInbound } from '@/api/mes/sparepartInbound'
+import { getSparepartDetail } from '@/api/mes/sparepart'
const { t } = useI18n()
const selectedSparepart = ref({})
const inboundQty = ref(null)
-const supplierInfo = ref({})
+
+// 备件默认供应商(从备件数据中取)
+const defaultSupplierName = computed(() => {
+ const suppliers = selectedSparepart.value.suppliers
+ const defaultId = selectedSparepart.value.defaultSupplierId
+ if (!suppliers || !suppliers.length) return ''
+ 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 || ''
+})
+const defaultSupplierId = computed(() => {
+ const suppliers = selectedSparepart.value.suppliers
+ const defaultId = selectedSparepart.value.defaultSupplierId
+ if (!suppliers || !suppliers.length) return undefined
+ if (defaultId) {
+ const found = suppliers.find(s => s.supplierId === defaultId || s.id === defaultId)
+ if (found) return found.supplierId || found.id
+ }
+ const firstDefault = suppliers.find(s => s.defaultStatus === 1)
+ return firstDefault?.supplierId || firstDefault?.id
+})
// 经办人下拉
const operatorOptions = ref([])
@@ -259,6 +283,14 @@ const selectedArea = ref(null)
const showAreaDropdown = ref(false)
const loadingAreas = ref(false)
+// 备件图片(后端返回 images 字段,逗号分隔多图 URL,取第一张)
+const sparepartImage = computed(() => {
+ const images = selectedSparepart.value.images
+ if (!images) return ''
+ if (Array.isArray(images)) return String(images[0] || '')
+ return String(images).split(',')[0]?.trim() || ''
+})
+
// 折算后库存数量
const calculatedStock = computed(() => {
const qty = Number(inboundQty.value) || 0
@@ -308,10 +340,6 @@ function handleSelectSparepart() {
})
}
-function handleSelectSupplier() {
- uni.showToast({ title: '选择供应商功能开发中', icon: 'none' })
-}
-
function toggleOperatorDropdown() {
showOperatorDropdown.value = !showOperatorDropdown.value
}
@@ -422,7 +450,7 @@ async function handleSubmit() {
isCode: true,
inTime: Date.now(),
stockUserId: String(selectedOperator.value.value),
- supplierId: undefined,
+ supplierId: defaultSupplierId.value,
status: 0,
totalCount: count,
totalPrice: 0,
@@ -457,10 +485,25 @@ async function handleSubmit() {
}
}
-onShow(() => {
+onShow(async () => {
const selectResult = getApp().globalData?._sparepartSelectResult
if (selectResult) {
selectedSparepart.value = selectResult
+ console.log('[sparepartInbound] 已选备件 suppliers:', JSON.stringify(selectResult.suppliers))
+ console.log('[sparepartInbound] 已选备件 defaultSupplierId:', selectResult.defaultSupplierId)
+ // 补充获取备件详情(含供应商、图片等)
+ if (selectResult.id) {
+ try {
+ const res = await getSparepartDetail(selectResult.id)
+ const detail = res?.data || res
+ if (detail && detail.suppliers) {
+ console.log('[sparepartInbound] 详情接口 suppliers:', JSON.stringify(detail.suppliers))
+ selectedSparepart.value = { ...selectedSparepart.value, ...detail }
+ }
+ } catch (e) {
+ console.error('获取备件详情失败:', e)
+ }
+ }
inboundQty.value = null
getApp().globalData._sparepartSelectResult = null
}
diff --git a/src/pages_function/pages/sparepartOutbound/create.vue b/src/pages_function/pages/sparepartOutbound/create.vue
new file mode 100644
index 0000000..005d667
--- /dev/null
+++ b/src/pages_function/pages/sparepartOutbound/create.vue
@@ -0,0 +1,711 @@
+
+
+
+
+
+
+
+
+
+
+ 扫备件码
+
+
+
+
+
+ 选择备件
+
+
+
+
+
+
+
+ 已选备件
+
+
+
+
+
+
+ 📦
+
+
+
+
+ 备件名称:
+ {{ textValue(selectedSparepart.name) }}
+
+
+ 规格:
+ {{ textValue(selectedSparepart.standard || selectedSparepart.deviceSpec) }}
+
+
+ 当前库存:
+ {{ textValue(selectedSparepart.stock) }}{{ textUnit(selectedSparepart.minStockUnitName) }}
+
+
+
+
+
+
+ 采购单位:
+ {{ textValue(selectedSparepart.purchaseUnitName) }}
+
+
+ 库存单位:
+ {{ textValue(selectedSparepart.unitName || selectedSparepart.minStockUnitName) }}
+
+
+
+ 换算关系:
+ 1{{ textValue(selectedSparepart.purchaseUnitName) }}={{ textValue(selectedSparepart.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(selectedSparepart) }}
+
+
+
+
+
+
+
+ 出库用途
+
+
+
+
+ 维修领用
+
+
+
+ 保养领用
+
+
+
+
+
+
+ 关联信息
+
+
+
+
+ 关联设备
+
+
+ {{ selectedDevice ? selectedDevice.label : '请选择' }}
+ ▼
+
+
+
+
+ {{ item.label }}
+ ✓
+
+ 暂无设备数据
+
+
+
+
+
+ {{ selectedPurpose === 'repair' ? '维修单号' : '保养单号' }}
+
+
+ {{ currentOrder ? currentOrder.label : '请选择' }}
+ ▼
+
+
+
+
+ {{ item.label }}
+ ✓
+
+ {{ selectedPurpose === 'repair' ? '暂无维修单' : '暂无保养单' }}
+
+
+
+
+
+
+
+
+
+
+
+ 出库数量
+
+
+
+ 出库数量
+
+ 单位:{{ textValue(selectedSparepart.purchaseUnitName) }}
+
+
+ 折算后库存数量:
+ {{ calculatedStock }}
+ {{ stockUnitLabel(selectedSparepart) }}
+
+
+ {{ outboundQty || 0 }}{{ textValue(selectedSparepart.purchaseUnitName) }} × {{ textValue(selectedSparepart.purchaseUnitConvertQuantity) }}{{ stockUnitLabel(selectedSparepart) }} = {{ calculatedStock }}{{ stockUnitLabel(selectedSparepart) }}
+
+
+
+
+
+
+ 经办人
+
+
+
+
+ {{ selectedOperator ? selectedOperator.label : '请选择经办人' }}
+
+ ▼
+
+
+
+
+ {{ item.label }}
+ ✓
+
+ 暂无数据
+
+
+
+
+
+
+
+
+ 请扫码或选择备件
+
+
+
+
+ 取消
+ 确认出库
+
+
+
+
+
+
+
diff --git a/src/pages_function/pages/sparepartOutbound/index.vue b/src/pages_function/pages/sparepartOutbound/index.vue
new file mode 100644
index 0000000..985b2a6
--- /dev/null
+++ b/src/pages_function/pages/sparepartOutbound/index.vue
@@ -0,0 +1,594 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{ currentStatusLabel }}
+
+
+
+ {{ t('functionCommon.reset') }}
+
+
+
+
+
+
+
+
+
+ {{ t('sparepartOutbound.sparepartInfo') }}
+ {{ textValue(item.productNames) }}
+
+
+ {{ t('sparepartOutbound.outboundTime') }}
+ {{ formatDateTime(item.outTime || item.createTime) }}
+
+
+ {{ t('sparepartOutbound.creator') }}
+ {{ textValue(item.creatorName || item.creator) }}
+
+
+ {{ t('sparepartOutbound.quantity') }}
+ {{ textValue(item.totalCount) }}
+
+
+ {{ t('sparepartOutbound.reviewer') }}
+ {{ textValue(item.auditUserName) }}
+
+
+
+
+ {{ t('sparepartOutbound.approve') }}
+ {{ t('sparepartOutbound.reject') }}
+
+
+
+ {{ t('functionCommon.loading') }}
+ {{ t('sparepartOutbound.empty') }}
+ {{ t('functionCommon.loadingMore') }}
+ {{ t('functionCommon.noMoreData') }}
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
diff --git a/src/utils/permissionMenu.js b/src/utils/permissionMenu.js
index ef56ef7..f431de9 100644
--- a/src/utils/permissionMenu.js
+++ b/src/utils/permissionMenu.js
@@ -88,6 +88,8 @@ const MENU_ROUTE_MAP = {
equipment: '/pages_function/pages/equipment/index',
spare: '/pages_function/pages/spare/index',
sparepartInbound: '/pages_function/pages/sparepartInbound/index',
+ sparepartoutbound: '/pages_function/pages/sparepartOutbound/index',
+ '备件出库': '/pages_function/pages/sparepartOutbound/index',
sparepartinbound: '/pages_function/pages/sparepartInbound/index',
sparepartIn: '/pages_function/pages/sparepartInbound/index',
'备件入库': '/pages_function/pages/sparepartInbound/index',