diff --git a/src/api/mes/mold.js b/src/api/mes/mold.js
index d84a059..107fd58 100644
--- a/src/api/mes/mold.js
+++ b/src/api/mes/mold.js
@@ -1,11 +1,11 @@
import upload from '@/utils/upload'
import request from '@/utils/request'
-export function getMoldDetail(id) {
+export function getMoldDetail(id, params = {}) {
return request({
url: '/admin-api/erp/mold-brand/mold/get',
method: 'get',
- params: { id }
+ params: { id, ...params }
})
}
diff --git a/src/pages_function/pages/mold/detail.vue b/src/pages_function/pages/mold/detail.vue
index e0ce46f..405cb83 100644
--- a/src/pages_function/pages/mold/detail.vue
+++ b/src/pages_function/pages/mold/detail.vue
@@ -207,6 +207,8 @@ import { DICT_TYPE, getDictLabel, initAllDict } from '@/utils/dict'
const loading = ref(false)
const moldId = ref(undefined)
+const moldCode = ref(undefined)
+const moldType = ref(undefined)
const detailData = ref(null)
const inspectionList = ref([])
const maintainList = ref([])
@@ -312,24 +314,30 @@ function handleTabChange(e) {
}
onLoad((query) => {
- const rawId = query && (query.id !== undefined ? query.id : query.code)
+ const rawId = query && query.id
const decoded = rawId ? decodeURIComponent(String(rawId)) : ''
moldId.value = decoded ? decoded : undefined
+ moldType.value = query && query.type
+ moldCode.value = query && query.code
fetchAll()
})
async function fetchAll() {
- if (!moldId.value) {
+ if (!moldId.value && !moldCode.value) {
uni.showToast({ title: '缺少模具ID', icon: 'none' })
return
}
loading.value = true
try {
+ const isScan = moldType.value === 'scan'
+ const idParam = isScan ? { id: moldId.value } : { code: moldCode.value }
+ const moldIdParam = isScan ? { moldId: moldId.value } : { code: moldCode.value }
+
const [detailRes, inspectionRes, maintainRes, repairRes] = await Promise.all([
- getMoldDetail(moldId.value),
- getMoldInspectionByMoldId(moldId.value),
- getMoldMaintenanceByMoldId(moldId.value),
- getMoldRepairListByMoldId(moldId.value)
+ getMoldDetail(moldId.value, idParam),
+ getMoldInspectionByMoldId(moldId.value, moldIdParam),
+ getMoldMaintenanceByMoldId(moldId.value, moldIdParam),
+ getMoldRepairListByMoldId(moldId.value, moldIdParam)
])
detailData.value = detailRes.data
inspectionList.value = normalizeList(inspectionRes)
diff --git a/src/pages_function/pages/mold/index.vue b/src/pages_function/pages/mold/index.vue
index c182840..6299256 100644
--- a/src/pages_function/pages/mold/index.vue
+++ b/src/pages_function/pages/mold/index.vue
@@ -11,7 +11,7 @@
自动扫描
点击启动扫描模具编码
-
+
@@ -35,13 +35,8 @@
手动输入模具编码
-
+
确定
@@ -119,13 +114,21 @@ function confirmInput() {
});
return;
}
-
- navigateToDetail(moldCode.value.trim());
+
+ navigateToDetail(moldCode.value.trim(), 'input');
}
-function navigateToDetail(id) {
+function navigateToDetail(id, type = 'scan') {
+ let url
+ if (type === 'scan') {
+ // 扫码
+ url = `/pages_function/pages/mold/detail?id=${encodeURIComponent(id)}&type=${type}`
+ } else {
+ // 手动输入
+ url = `/pages_function/pages/mold/detail?code=${moldCode.value}&type=${type}`
+ }
uni.navigateTo({
- url: `/pages_function/pages/mold/detail?id=${encodeURIComponent(id)}`
+ url: url
});
}
@@ -154,7 +157,7 @@ function navigateToDetail(id) {
display: flex;
flex-direction: column;
align-items: center;
-
+
&:active {
opacity: 0.8;
}
@@ -169,7 +172,7 @@ function navigateToDetail(id) {
align-items: center;
justify-content: center;
margin-bottom: 30rpx;
-
+
.icon-text {
font-size: 72rpx;
}
@@ -223,9 +226,11 @@ function navigateToDetail(id) {
0% {
top: 20rpx;
}
+
50% {
top: 260rpx;
}
+
100% {
top: 20rpx;
}
@@ -290,13 +295,13 @@ function navigateToDetail(id) {
display: flex;
align-items: center;
margin-bottom: 30rpx;
-
+
.divider-line {
flex: 1;
height: 2rpx;
background: #e8eaed;
}
-
+
.divider-text {
padding: 0 30rpx;
font-size: 28rpx;
@@ -331,7 +336,7 @@ function navigateToDetail(id) {
font-size: 30rpx;
color: #333333;
border: 2rpx solid transparent;
-
+
&:focus {
border-color: #1a3a5c;
background: #ffffff;
@@ -350,16 +355,16 @@ function navigateToDetail(id) {
align-items: center;
justify-content: center;
transition: all 0.3s ease;
-
+
&.active {
background: linear-gradient(135deg, #1a3a5c 0%, #2d5a87 100%);
-
+
&:active {
opacity: 0.8;
transform: scale(0.98);
}
}
-
+
.btn-text {
font-size: 32rpx;
font-weight: 600;