diff --git a/src/pages_function/pages/moldRepair/userSelect.vue b/src/pages_function/pages/moldRepair/userSelect.vue
index 0a920ac..f58c6c0 100644
--- a/src/pages_function/pages/moldRepair/userSelect.vue
+++ b/src/pages_function/pages/moldRepair/userSelect.vue
@@ -67,7 +67,9 @@ const fromSource = ref('moldRepair') // moldRepair | sparepartInbound | sparepa
let searchTimer = null
const pageTitle = computed(() => {
- if (field.value === 'operator') return '选择经办人'
+ if (field.value === 'operator') {
+ return fromSource.value === 'moldoperate' ? '选择操作人' : '选择经办人'
+ }
return field.value === 'confirmBy' ? t('moldRepair.confirmBy') : t('moldRepair.acceptedBy')
})
@@ -131,7 +133,8 @@ function handleConfirm() {
materialOutbound: '_materialOutboundUserSelectResult',
productInbound: '_productInboundUserSelectResult',
productOutbound: '_productOutboundUserSelectResult',
- productCheck: '_productCheckUserSelectResult'
+ productCheck: '_productCheckUserSelectResult',
+ moldoperate: '_moldoperateUserSelectResult'
}
const key = keyMap[fromSource.value] || '_moldRepairUserSelectResult'
getApp().globalData[key] = {
diff --git a/src/pages_function/pages/moldoperate/deviceSelect.vue b/src/pages_function/pages/moldoperate/deviceSelect.vue
index 22e7673..499322d 100644
--- a/src/pages_function/pages/moldoperate/deviceSelect.vue
+++ b/src/pages_function/pages/moldoperate/deviceSelect.vue
@@ -17,8 +17,8 @@
v-for="device in filteredList"
:key="device.id"
class="device-card"
- :class="{ active: selectedId === device.id }"
- @click="selectedId = device.id"
+ :class="{ active: selectedId === device.id, disabled: fromType === 'up' && hasMoldOnDevice(device) }"
+ @click="handleDeviceClick(device)"
>
-
-
-
- ⇄
- {{ t('moldOperate.changeTarget') }}
-
@@ -111,8 +105,9 @@
*{{ t('moldOperate.operator') }}
-
- {{ currentUserName }}
+
+ {{ selectedOperator?.label || currentUserName || '请选择操作人' }}
+
@@ -496,6 +491,13 @@ function autoSetOperator() {
}
}
+function goSelectOperator() {
+ const currentId = selectedOperator.value?.value || currentUserId.value || ''
+ uni.navigateTo({
+ url: `/pages_function/pages/moldRepair/userSelect?field=operator&from=moldoperate&selectedId=${currentId}`
+ })
+}
+
function goToHistory() {
uni.navigateTo({ url: '/pages_function/pages/moldoperate/history?type=down' })
}
@@ -535,6 +537,7 @@ async function handleConfirm() {
// 添加操作人和备注
if (selectedOperator.value) {
payload.operatorId = selectedOperator.value.value
+ payload.operatorName = selectedOperator.value.label
}
if (remarkText.value.trim()) {
payload.remark = remarkText.value.trim()
@@ -568,6 +571,15 @@ onReady(() => {
onShow(async () => {
autoSetOperator()
await Promise.allSettled([loadDevices(), loadLineTree()])
+ // 从 globalData 读取用户选择页回传的操作人
+ const userResult = getApp().globalData?._moldoperateUserSelectResult
+ if (userResult) {
+ selectedOperator.value = {
+ value: userResult.user.id,
+ label: userResult.user.nickname || userResult.user.userName || userResult.user.name || ''
+ }
+ getApp().globalData._moldoperateUserSelectResult = null
+ }
// 从 globalData 读取设备选择页回传的设备
const device = getApp().globalData._deviceSelectResult
if (device) {
diff --git a/src/pages_function/pages/moldoperate/history.vue b/src/pages_function/pages/moldoperate/history.vue
index a3fac77..47c22ad 100644
--- a/src/pages_function/pages/moldoperate/history.vue
+++ b/src/pages_function/pages/moldoperate/history.vue
@@ -72,7 +72,7 @@
{{ t('moldOperate.operator') }}
- {{ item.creatorName || item.operator || '-' }}
+ {{ item.operatorName || item.creatorName || item.operator || '-' }}
{{ t('moldOperate.remark') }}
diff --git a/src/pages_function/pages/moldoperate/index.vue b/src/pages_function/pages/moldoperate/index.vue
index c428b44..4ce1871 100644
--- a/src/pages_function/pages/moldoperate/index.vue
+++ b/src/pages_function/pages/moldoperate/index.vue
@@ -31,7 +31,7 @@
- {{ t('moldOperate.selectedDevice') }}
+ 设备信息
@@ -51,7 +51,8 @@
{{ t('moldOperate.currentMold') }}
- {{ currentMoldDisplay }}
+ {{ currentMoldDisplay }}
+
@@ -63,45 +64,57 @@
+
+
+
+
+
+ 选择模具
+
+
+
- {{ t('moldOperate.selectMountMold') }}
+ 模具信息
-
-
-
-
- {{ t('moldOperate.moldName') }}
- {{ textValue(mold.name || mold.moldName) }}
-
-
- {{ t('moldOperate.moldCode') }}
- {{ textValue(mold.code || mold.moldCode) }}
-
+
+
+
+ {{ t('moldOperate.moldName') }}
+ {{ textValue(selectedMountMolds[0]?.name || selectedMountMolds[0]?.moldName) }}
+
-
-
- {{ t('moldOperate.product') }}
- {{ textValue(mold.productName) }}
-
-
- {{ t('moldOperate.status') }}
- {{ getMoldStatusText(mold.status) }}
-
+
+ {{ t('moldOperate.moldCode') }}
+ {{ textValue(selectedMountMolds[0]?.code || selectedMountMolds[0]?.moldCode) }}
-
-
-
- ⇄
- {{ t('moldOperate.changeMountTarget') }}
+
+
+ {{ t('moldOperate.product') }}
+ {{ textValue(selectedMountMolds[0]?.productName) }}
+
+
+ {{ t('moldOperate.status') }}
+ {{ getMoldStatusText(selectedMountMolds[0]?.status) }}
+
-
-
- + {{ t('moldOperate.clickSelectMold') }}
+
+
+
+
+ ⇄
+ {{ t('moldOperate.changeMountTarget') }}
@@ -115,8 +128,9 @@
*{{ t('moldOperate.operator') }}
-
- {{ currentUserName }}
+
+ {{ selectedOperator?.label || currentUserName || '请选择操作人' }}
+
@@ -264,8 +278,56 @@ const tempSelectedDeviceId = ref(null)
const remarkText = ref('')
const selectedOperator = ref(null)
const scanCodeInput = ref('') // 扫码/输入设备码
+const moldScanCodeInput = ref('') // 扫码/输入模具码
+
+// 红外扫码确认时,通过 API 搜索模具(与模具台账搜索一致)
+async function onMoldScanInputConfirm() {
+ const code = moldScanCodeInput.value.trim()
+ if (!code) return
+ try {
+ const res = await getMoldBrandPage({
+ pageNo: 1,
+ pageSize: 10,
+ code: code,
+ name: code
+ })
+ const root = (res && res.data !== undefined) ? res.data : res
+ function findList(obj, depth = 0) {
+ if (!obj || typeof obj !== 'object' || depth > 3) return []
+ if (Array.isArray(obj)) return obj
+ for (const key of ['list', 'rows', 'records', 'items', 'data']) {
+ if (Array.isArray(obj[key])) return obj[key]
+ }
+ for (const val of Object.values(obj)) {
+ const found = findList(val, depth + 1)
+ if (found.length) return found
+ }
+ return []
+ }
+ const list = findList(root)
+ if (list.length > 0) {
+ const matched = list[0]
+ if (Number(matched.status) === 0) {
+ uni.showToast({ title: '该模具已在机,不能重复上模', icon: 'none' })
+ return
+ }
+ selectedMountMolds.value = [{
+ id: matched.id,
+ name: matched.name || matched.moldName,
+ code: matched.code || matched.moldCode,
+ productName: matched.productName || '-',
+ status: matched.status
+ }]
+ moldScanCodeInput.value = ''
+ } else {
+ uni.showToast({ title: '未找到该模具', icon: 'none' })
+ }
+ } catch (e) {
+ console.error('mold scan search error', e)
+ uni.showToast({ title: '搜索失败,请重试', icon: 'none' })
+ }
+}
-// 聚焦阻止键盘弹出
const focusNoKeyboardRef = ref(null)
const keywordInputSelector = '#mold-scan-input input, input#mold-scan-input'
@@ -387,6 +449,10 @@ function validFormMount() {
async function handleConfirmMount() {
if (!validFormMount()) return
+ if (currentMoldList.value.length > 0) {
+ uni.showToast({ title: '该设备已有在机模具,请先下模再上模', icon: 'none', duration: 2000 })
+ return
+ }
try {
const moldIds = selectedMountMolds.value.map((m) => m.id)
const payload = {
@@ -399,6 +465,7 @@ async function handleConfirmMount() {
// 添加操作人和备注
if (selectedOperator.value) {
payload.operatorId = selectedOperator.value.value
+ payload.operatorName = selectedOperator.value.label
}
if (remarkText.value.trim()) {
payload.remark = remarkText.value.trim()
@@ -481,6 +548,13 @@ function onScanInputConfirm() {
}
}
+function goSelectOperator() {
+ const currentId = selectedOperator.value?.value || currentUserId.value || ''
+ uni.navigateTo({
+ url: `/pages_function/pages/moldRepair/userSelect?field=operator&from=moldoperate&selectedId=${currentId}`
+ })
+}
+
function handleCancel() {
selectedDevice.value = {}
selectedMountMolds.value = []
@@ -502,6 +576,15 @@ onReady(() => {
onShow(async () => {
autoSetOperator()
await Promise.allSettled([loadDevices(), loadLineTree()])
+ // 从 globalData 读取用户选择页回传的操作人
+ const userResult = getApp().globalData?._moldoperateUserSelectResult
+ if (userResult) {
+ selectedOperator.value = {
+ value: userResult.user.id,
+ label: userResult.user.nickname || userResult.user.userName || userResult.user.name || ''
+ }
+ getApp().globalData._moldoperateUserSelectResult = null
+ }
// 从 globalData 读取设备选择页回传的设备
const device = getApp().globalData._deviceSelectResult
if (device) {