|
|
|
|
@ -47,6 +47,8 @@ import request from '@/utils/request'
|
|
|
|
|
import AppTitleHeader from '@/components/common/AppTitleHeader.vue'
|
|
|
|
|
|
|
|
|
|
const spareId = ref(undefined)
|
|
|
|
|
const spareCode = ref(undefined)
|
|
|
|
|
const spareType = ref(undefined)
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const detailData = ref(null)
|
|
|
|
|
const unitList = ref([])
|
|
|
|
|
@ -98,17 +100,20 @@ const unitLabel = computed(() => {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
async function fetchAll() {
|
|
|
|
|
if (!spareId.value) {
|
|
|
|
|
if (!spareId.value && !spareCode.value) {
|
|
|
|
|
uni.showToast({ title: '缺少备件ID', icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const isScan = spareType.value === 'scan'
|
|
|
|
|
const params = isScan ? { id: spareId.value } : { code: spareCode.value }
|
|
|
|
|
|
|
|
|
|
const [detailRes, unitRes] = await Promise.all([
|
|
|
|
|
request({
|
|
|
|
|
url: '/admin-api/erp/product/get',
|
|
|
|
|
method: 'get',
|
|
|
|
|
params: { id: spareId.value },
|
|
|
|
|
params: params,
|
|
|
|
|
showLoading: false
|
|
|
|
|
}),
|
|
|
|
|
request({
|
|
|
|
|
@ -127,9 +132,11 @@ async function fetchAll() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onLoad((query) => {
|
|
|
|
|
const rawId = query && (query.id !== undefined ? query.id : query.code)
|
|
|
|
|
const rawId = query && query.id
|
|
|
|
|
const decoded = rawId ? decodeURIComponent(String(rawId)) : ''
|
|
|
|
|
spareId.value = decoded ? decoded : undefined
|
|
|
|
|
spareType.value = query && query.type
|
|
|
|
|
spareCode.value = query && query.code
|
|
|
|
|
fetchAll()
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|