From 78688a73586f17eaa69b0e8dc78a01de9c3a2fba Mon Sep 17 00:00:00 2001
From: zhongwenkai <3478244299@qq.com>
Date: Wed, 10 Jun 2026 10:33:47 +0800
Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=A8=A1=E5=85=B7=E7=AE=A1?=
=?UTF-8?q?=E7=90=86-=E4=B8=8A=E4=B8=8B=E6=A8=A1=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/mes/moldoperate.js | 4 +-
src/components/common/PermissionMenuPage.vue | 1 +
src/locales/en-US.js | 31 +-
src/locales/index.js | 2 +
src/locales/zh-CN.js | 31 +-
src/pages.json | 23 +-
.../pages/moldoperate/deviceSelect.vue | 366 +++++
.../pages/moldoperate/dismount.vue | 733 ++++++++++
.../pages/moldoperate/index.vue | 1214 +++++++----------
.../pages/moldoperate/moldSelect.vue | 351 +++++
src/utils/permissionMenu.js | 43 +-
src/utils/request.ts | 7 +-
12 files changed, 2045 insertions(+), 761 deletions(-)
create mode 100644 src/pages_function/pages/moldoperate/deviceSelect.vue
create mode 100644 src/pages_function/pages/moldoperate/dismount.vue
create mode 100644 src/pages_function/pages/moldoperate/moldSelect.vue
diff --git a/src/api/mes/moldoperate.js b/src/api/mes/moldoperate.js
index 8ecd716..5ed7229 100644
--- a/src/api/mes/moldoperate.js
+++ b/src/api/mes/moldoperate.js
@@ -50,8 +50,8 @@ export function getLowerMoldList(id) {
export function getDeviceLedgerList(params = {}) {
return request({
- url: '/admin-api/mes/device-ledger/list',
+ url: '/admin-api/mes/device-ledger/page',
method: 'get',
- params
+ params: { pageNo: params.pageNo || 1, pageSize: params.pageSize || 100, ...params }
})
}
diff --git a/src/components/common/PermissionMenuPage.vue b/src/components/common/PermissionMenuPage.vue
index b468d99..8e1b115 100644
--- a/src/components/common/PermissionMenuPage.vue
+++ b/src/components/common/PermissionMenuPage.vue
@@ -211,6 +211,7 @@ function getUviewIconName(icon) {
function handleClick(menu) {
const url = resolveMenuUrl(menu)
+ console.log('[PermissionMenu] 点击菜单:', menu?.name, '| _splitKey:', menu?._splitKey, '| 路由:', url)
if (url) {
uni.navigateTo({ url })
return
diff --git a/src/locales/en-US.js b/src/locales/en-US.js
index 89dcbf1..79f8846 100644
--- a/src/locales/en-US.js
+++ b/src/locales/en-US.js
@@ -183,6 +183,7 @@ export default {
search: 'Search',
reset: 'Reset',
cancel: 'Cancel',
+ confirm: 'Confirm',
save: 'Save',
loading: 'Loading...',
loadingMore: 'Loading more...',
@@ -339,7 +340,35 @@ export default {
validatorMoldRequired: 'Select at least one mold for mounting',
validatorLowerMoldRequired: 'Select at least one mold for dismounting',
loadEditFailed: 'Failed to load edit data',
- confirmDelete: 'Confirm delete this mold operate record?'
+ confirmDelete: 'Confirm delete this mold operate record?',
+ scanDevice: 'Scan Device',
+ selectDevice: 'Select Device',
+ selectedDevice: 'Selected Device',
+ deviceCode: 'Device Code',
+ productionLine: 'Production Line',
+ currentMold: 'Current Mold',
+ deviceStatus: 'Device Status',
+ statusRunning: 'Running',
+ statusStop: 'Stopped',
+ statusFault: 'Fault',
+ selectMountMold: 'Select Mold to Mount',
+ product: 'Product',
+ status: 'Status',
+ pendingMount: 'Pending Mount',
+ confirmMount: 'Confirm Mount',
+ clickSelectMold: 'Click to select mold',
+ noDeviceData: 'No device data',
+ deviceNotFound: 'Device not found',
+ deviceInfo: 'Device Info',
+ currentMoldInfo: 'Current Mold on Machine',
+ mountTime: 'Mount Time',
+ useCount: 'Usage Count',
+ countUnit: '',
+ changeMountTarget: 'Change Mount Target',
+ changeTarget: 'Change Dismount Target',
+ confirmDismount: 'Confirm Dismount',
+ clickSelectDeviceFirst: 'Please select a device first',
+ noMoldOnDevice: 'No mold on this device'
},
moldInspectionItems: {
moduleName: 'Inspection Items',
diff --git a/src/locales/index.js b/src/locales/index.js
index 7d2c852..0f309b8 100644
--- a/src/locales/index.js
+++ b/src/locales/index.js
@@ -106,6 +106,8 @@ const literalMap = {
'模具入库': 'moldReturn.moduleName',
'模具入库详情': 'moldReturn.detailTitle',
'上下模': 'moldOperate.moduleName',
+ '上模': 'moldOperate.tabUp',
+ '下模': 'moldOperate.tabDown',
'上下模详情': 'moldOperate.detailTitle',
'点检项库': 'moldInspectionItems.moduleName',
'点检项库详情': 'moldInspectionItems.detailTitle',
diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js
index 55b3315..3dcec29 100644
--- a/src/locales/zh-CN.js
+++ b/src/locales/zh-CN.js
@@ -183,6 +183,7 @@ export default {
search: '查询',
reset: '重置',
cancel: '取消',
+ confirm: '确认',
save: '保存',
loading: '加载中...',
loadingMore: '正在加载更多...',
@@ -339,7 +340,35 @@ export default {
validatorMoldRequired: '请至少选择一个上模模具',
validatorLowerMoldRequired: '请至少选择一个下模模具',
loadEditFailed: '加载编辑数据失败',
- confirmDelete: '确认删除该上下模记录吗?'
+ confirmDelete: '确认删除该上下模记录吗?',
+ scanDevice: '扫设备码',
+ selectDevice: '选择设备',
+ selectedDevice: '已选设备',
+ deviceCode: '设备编码',
+ productionLine: '所属产线',
+ currentMold: '当前在机模具',
+ deviceStatus: '设备状态',
+ statusRunning: '运行中',
+ statusStop: '已停止',
+ statusFault: '故障',
+ selectMountMold: '选择待上模模具',
+ product: '产品',
+ status: '状态',
+ pendingMount: '待上模',
+ confirmMount: '确认上模',
+ clickSelectMold: '点击选择模具',
+ noDeviceData: '暂无设备数据',
+ deviceNotFound: '未找到对应设备',
+ deviceInfo: '设备信息',
+ currentMoldInfo: '当前在机模具',
+ mountTime: '上模时间',
+ useCount: '使用次数',
+ countUnit: '次',
+ changeMountTarget: '更换上模对象',
+ changeTarget: '更换下模对象',
+ confirmDismount: '确认下模',
+ clickSelectDeviceFirst: '请先选择设备',
+ noMoldOnDevice: '该设备暂无在机模具'
},
moldInspectionItems: {
moduleName: '点检项库',
diff --git a/src/pages.json b/src/pages.json
index 36ea8fe..d7a1c5f 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -578,7 +578,7 @@
{
"path": "moldoperate/index",
"style": {
- "navigationBarTitleText": "上下模",
+ "navigationBarTitleText": "上模",
"navigationStyle": "custom"
}
},
@@ -589,6 +589,27 @@
"navigationStyle": "custom"
}
},
+ {
+ "path": "moldoperate/dismount",
+ "style": {
+ "navigationBarTitleText": "下模",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "moldoperate/deviceSelect",
+ "style": {
+ "navigationBarTitleText": "选择设备",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "moldoperate/moldSelect",
+ "style": {
+ "navigationBarTitleText": "选择待上模模具",
+ "navigationStyle": "custom"
+ }
+ },
{
"path": "moldRepair/index",
"style": {
diff --git a/src/pages_function/pages/moldoperate/deviceSelect.vue b/src/pages_function/pages/moldoperate/deviceSelect.vue
new file mode 100644
index 0000000..8ff61e4
--- /dev/null
+++ b/src/pages_function/pages/moldoperate/deviceSelect.vue
@@ -0,0 +1,366 @@
+
+
+
+
+
+
+
+
+
+ ✕
+
+
+
+
+
+
+
+
+
+ {{ t('moldOperate.deviceCode') }}
+ {{ textValue(device.deviceCode) }}
+
+
+ {{ t('moldOperate.productionLine') }}
+ {{ textValue(device.workshopName) }}
+
+
+ {{ t('moldOperate.currentMold') }}
+ {{ getCurrentMold(device) }}
+
+
+ {{ t('moldOperate.deviceStatus') }}
+ {{ getStatusLabel(device) }}
+
+
+
+
+
+
+
+ {{ t('functionCommon.loading') }}
+ {{ t('moldOperate.noDeviceData') }}
+
+
+
+
+
+ {{ t('functionCommon.confirm') }}
+
+
+
+
+
+
+
+
diff --git a/src/pages_function/pages/moldoperate/dismount.vue b/src/pages_function/pages/moldoperate/dismount.vue
new file mode 100644
index 0000000..e802b79
--- /dev/null
+++ b/src/pages_function/pages/moldoperate/dismount.vue
@@ -0,0 +1,733 @@
+
+
+
+
+
+
+
+
+
+
+ {{ t('moldOperate.scanDevice') }}
+
+
+
+
+
+ {{ t('moldOperate.selectDevice') }}
+
+
+
+
+
+
+
+ {{ t('moldOperate.deviceInfo') }}
+
+
+
+
+ {{ t('moldOperate.deviceName') }}
+ {{ textValue(selectedDevice.deviceName) }}
+
+
+ {{ t('moldOperate.deviceCode') }}
+ {{ textValue(selectedDevice.deviceCode) }}
+
+
+
+
+ {{ t('moldOperate.productionLine') }}
+ {{ textValue(selectedDevice.workshopName) }}
+
+
+ {{ t('moldOperate.deviceStatus') }}
+ {{ deviceStatusLabel }}
+
+
+
+
+
+
+
+
+
+ {{ t('moldOperate.currentMoldInfo') }}
+
+
+
+
+
+
+ {{ t('moldOperate.moldName') }}
+ {{ textValue(selectedMold.moldName) }}
+
+
+ {{ t('moldOperate.moldCode') }}
+ {{ textValue(selectedMold.moldCode) }}
+
+
+
+
+ {{ t('moldOperate.product') }}
+ {{ textValue(selectedMold.productName) }}
+
+
+ {{ t('moldOperate.mountTime') }}
+ {{ textValue(selectedMold.mountTime) }}
+
+
+
+
+ {{ t('moldOperate.useCount') }}
+ {{ formatUseCount(selectedMold.useCount) }}
+
+
+
+
+
+
+ ⇄
+ {{ t('moldOperate.changeTarget') }}
+
+
+
+
+
+ {{ t('moldOperate.noMoldOnDevice') }}
+
+
+
+
+ + {{ t('moldOperate.clickSelectDeviceFirst') }}
+
+
+
+
+
+ {{ t('moldOperate.confirmDismount') }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages_function/pages/moldoperate/index.vue b/src/pages_function/pages/moldoperate/index.vue
index 217aca3..fbf033c 100644
--- a/src/pages_function/pages/moldoperate/index.vue
+++ b/src/pages_function/pages/moldoperate/index.vue
@@ -1,922 +1,630 @@
-
-
-
-
- {{
- t('moldOperate.tabUp') }}
- {{
- t('moldOperate.tabDown') }}
+
+
+
+ <
+
+ {{ t('moldOperate.tabUp') }}
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+ {{ t('moldOperate.scanDevice') }}
+
+
+
+
+
+ {{ t('moldOperate.selectDevice') }}
- {{ t('functionCommon.search') }}
-
-
-
- {{ moldFilterLabel }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ + {{ t('moldOperate.clickSelectMold') }}
-
-
-
-
-
+
diff --git a/src/pages_function/pages/moldoperate/moldSelect.vue b/src/pages_function/pages/moldoperate/moldSelect.vue
new file mode 100644
index 0000000..f7692e1
--- /dev/null
+++ b/src/pages_function/pages/moldoperate/moldSelect.vue
@@ -0,0 +1,351 @@
+
+
+
+
+
+
+
+
+
+ ✕
+
+
+
+
+
+
+
+
+
+ {{ t('moldOperate.moldCode') }}
+ {{ textValue(mold.code) }}
+
+
+ 产品型号
+ {{ textValue(mold.productName) }}
+
+
+ {{ t('moldOperate.status') }}
+ {{ getStatusText(mold.status) }}
+
+
+
+
+
+
+
+ {{ t('functionCommon.loading') }}
+ {{ t('moldOperate.noMoldData') }}
+
+
+
+
+
+ {{ t('functionCommon.confirm') }}{{ selectedIds.size > 0 ? `(${selectedIds.size})` : '' }}
+
+
+
+
+
+
+
+
diff --git a/src/utils/permissionMenu.js b/src/utils/permissionMenu.js
index a4e6847..b4a7d31 100644
--- a/src/utils/permissionMenu.js
+++ b/src/utils/permissionMenu.js
@@ -73,6 +73,8 @@ const MENU_ROUTE_MAP = {
moldget: '/pages_function/pages/moldget/index',
moldreturn: '/pages_function/pages/moldreturn/index',
moldoperate: '/pages_function/pages/moldoperate/index',
+ moldmount: '/pages_function/pages/moldoperate/index',
+ molddismount: '/pages_function/pages/moldoperate/dismount',
mold: '/pages_function/pages/mold/index',
equipment: '/pages_function/pages/equipment/index',
spare: '/pages_function/pages/spare/index',
@@ -228,6 +230,32 @@ export function findTabMenuByPage(menus, pagePath) {
return dynamicMenus.find((menu) => normalizePagePath(resolveMenuUrl(menu)) === targetPath) || null
}
+// 上下模拆分映射
+const MOLD_OPERATE_SPLIT_MAP = {
+ '上下模': [
+ { name: '上模', key: 'moldmount' },
+ { name: '下模', key: 'molddismount' }
+ ],
+ moldoperate: [
+ { name: '上模', key: 'moldmount' },
+ { name: '下模', key: 'molddismount' }
+ ]
+}
+
+function splitMoldOperateEntry(entry) {
+ const keys = [String(entry.name || '').trim(), normalizeMenuKey(entry.component || ''), normalizeMenuKey(entry.enName || '')]
+ for (const k of keys) {
+ if (MOLD_OPERATE_SPLIT_MAP[k]) {
+ return MOLD_OPERATE_SPLIT_MAP[k].map((item) => ({
+ ...entry,
+ name: item.name,
+ _splitKey: item.key
+ }))
+ }
+ }
+ return null
+}
+
export function buildPageModules(tabMenu) {
return toArray(tabMenu?.children)
.map((module) => {
@@ -236,12 +264,18 @@ export function buildPageModules(tabMenu) {
if (hasNestedEntries) {
return {
...module,
- children: directChildren.flatMap((child) => toArray(child.children))
+ children: directChildren.flatMap((child) => toArray(child.children).flatMap((entry) => {
+ const splitted = splitMoldOperateEntry(entry)
+ return splitted || [entry]
+ }))
}
}
return {
...module,
- children: directChildren
+ children: directChildren.flatMap((entry) => {
+ const splitted = splitMoldOperateEntry(entry)
+ return splitted || [entry]
+ })
}
})
.filter((module) => (module.children || []).length > 0)
@@ -252,6 +286,11 @@ export function resolveMenuUrl(menu) {
return '/pages/index'
}
+ // 拆分后的上下模子项,优先用 _splitKey 匹配(必须在 directRoute 之前)
+ if (menu?._splitKey && MENU_ROUTE_MAP[menu._splitKey]) {
+ return MENU_ROUTE_MAP[menu._splitKey]
+ }
+
const directRoute = getDirectRoute(menu?.path) || getDirectRoute(menu?.component)
if (directRoute) {
return directRoute
diff --git a/src/utils/request.ts b/src/utils/request.ts
index 2e621db..425503b 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -21,6 +21,10 @@ const request = (config: RequestConfig): Promise> => {
if (getToken() && !isToken) {
config.header['Authorization'] = 'Bearer ' + getToken()
}
+ // POST/PUT 请求明确设置 Content-Type 为 application/json
+ if ((config.method === 'POST' || config.method === 'PUT') && config.data) {
+ config.header['Content-Type'] = 'application/json'
+ }
// get请求映射params参数
if (config.params) {
let url = config.url + '?' + tansParams(config.params)
@@ -65,7 +69,8 @@ const request = (config: RequestConfig): Promise> => {
return
} else if (code === 500) {
toast(msg)
- reject('500')
+ // 将完整的 data 对象 reject,便于调用方拿到后端错误信息
+ reject(data)
return
} else if (code !== 200) {
toast(msg)