Merge remote-tracking branch 'origin/master'

master
黄伟杰 15 hours ago
commit 39e9a39e90

@ -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] = {

@ -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)"
>
<view class="device-card-header">
<text class="device-name">{{ textValue(device.deviceName) }}</text>
@ -154,6 +154,14 @@ function getCurrentMold(device) {
}
//
function handleDeviceClick(device) {
if (fromType.value === 'up' && hasMoldOnDevice(device)) {
uni.showToast({ title: '该设备已有在机模具,不能选择上模', icon: 'none' })
return
}
selectedId.value = device.id
}
function hasMoldOnDevice(device) {
if (!device) return false
const deviceName = device.deviceName

@ -68,7 +68,7 @@
<view class="grid-row">
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.moldName') }}</text>
<text class="grid-value highlight">{{ textValue(selectedMold.moldName) }}</text>
<text class="grid-value">{{ textValue(selectedMold.moldName) }}</text>
</view>
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.moldCode') }}</text>
@ -82,12 +82,6 @@
</view>
</view>
</view>
<!-- 更换下模对象按钮 -->
<view class="change-target-btn" @click="openLowerMoldPicker">
<text class="change-icon">&#8644;</text>
<text class="change-text">{{ t('moldOperate.changeTarget') }}</text>
</view>
</template>
<!-- 已选设备但无在机模具 -->
@ -111,8 +105,9 @@
<view class="form-row">
<view class="form-cell">
<text class="form-label"><text class="required">*</text>{{ t('moldOperate.operator') }}</text>
<view class="dropdown-input readonly-input">
<text class="dropdown-value">{{ currentUserName }}</text>
<view class="dropdown-input select-field" @click="goSelectOperator">
<text :class="['dropdown-value', selectedOperator ? '' : 'placeholder']">{{ selectedOperator?.label || currentUserName || '请选择操作人' }}</text>
<uni-icons type="right" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
</view>
@ -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) {

@ -72,7 +72,7 @@
</view>
<view class="info-row">
<text class="info-label">{{ t('moldOperate.operator') }}</text>
<text class="info-value">{{ item.creatorName || item.operator || '-' }}</text>
<text class="info-value">{{ item.operatorName || item.creatorName || item.operator || '-' }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('moldOperate.remark') }}</text>

@ -31,7 +31,7 @@
<view class="section-card">
<view class="section-title-bar">
<view class="section-bar-line"></view>
<text class="section-title">{{ t('moldOperate.selectedDevice') }}</text>
<text class="section-title">设备信息</text>
</view>
<view class="card-body-grid">
<view class="grid-row">
@ -51,7 +51,8 @@
</view>
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.currentMold') }}</text>
<text class="grid-value highlight">{{ currentMoldDisplay }}</text>
<text class="grid-value">{{ currentMoldDisplay }}</text>
</view>
</view>
<view class="grid-row">
@ -63,45 +64,57 @@
</view>
</view>
<view class="action-row mold-scan-row">
<view class="scan-input-row">
<input
v-model="moldScanCodeInput"
class="scan-input"
placeholder="红外扫码或输入模具码"
confirm-type="done"
@blur="onMoldScanInputConfirm"
@confirm="onMoldScanInputConfirm"
/>
</view>
<view class="action-btn select-btn" @click="openMountMoldPicker">
<text class="btn-text">选择模具</text>
</view>
</view>
<!-- 选择待上模模具 -->
<view class="section-card">
<view class="section-title-bar">
<view class="section-bar-line"></view>
<text class="section-title">{{ t('moldOperate.selectMountMold') }}</text>
<text class="section-title">模具信息</text>
</view>
<template v-if="selectedMountMolds.length > 0">
<view v-for="(mold, index) in selectedMountMolds" :key="mold.id || index" class="card-body-grid">
<view class="grid-row">
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.moldName') }}</text>
<text class="grid-value highlight">{{ textValue(mold.name || mold.moldName) }}</text>
</view>
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.moldCode') }}</text>
<text class="grid-value">{{ textValue(mold.code || mold.moldCode) }}</text>
</view>
<view class="card-body-grid">
<view class="grid-row">
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.moldName') }}</text>
<text class="grid-value">{{ textValue(selectedMountMolds[0]?.name || selectedMountMolds[0]?.moldName) }}</text>
</view>
<view class="grid-row">
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.product') }}</text>
<text class="grid-value">{{ textValue(mold.productName) }}</text>
</view>
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.status') }}</text>
<view :class="['status-tag', getMoldStatusClass(mold.status)]">{{ getMoldStatusText(mold.status) }}</view>
</view>
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.moldCode') }}</text>
<text class="grid-value">{{ textValue(selectedMountMolds[0]?.code || selectedMountMolds[0]?.moldCode) }}</text>
</view>
</view>
<!-- 更换上模对象按钮 -->
<view class="change-target-btn" @click="openMountMoldPicker">
<text class="change-icon">&#8644;</text>
<text class="change-text">{{ t('moldOperate.changeMountTarget') }}</text>
<view class="grid-row">
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.product') }}</text>
<text class="grid-value">{{ textValue(selectedMountMolds[0]?.productName) }}</text>
</view>
<view class="grid-cell">
<text class="grid-label">{{ t('moldOperate.status') }}</text>
<view :class="['status-tag', getMoldStatusClass(selectedMountMolds[0]?.status)]">{{ getMoldStatusText(selectedMountMolds[0]?.status) }}</view>
</view>
</view>
</template>
<view v-else class="empty-mold-hint" @click="openMountMoldPicker">
<text class="empty-mold-text">+ {{ t('moldOperate.clickSelectMold') }}</text>
</view>
<!-- 更换上模对象按钮 -->
<view class="change-target-btn" @click="openMountMoldPicker" v-if="selectedMountMolds.length > 0">
<text class="change-icon">&#8644;</text>
<text class="change-text">{{ t('moldOperate.changeMountTarget') }}</text>
</view>
</view>
@ -115,8 +128,9 @@
<view class="form-row">
<view class="form-cell">
<text class="form-label"><text class="required">*</text>{{ t('moldOperate.operator') }}</text>
<view class="dropdown-input readonly-input">
<text class="dropdown-value">{{ currentUserName }}</text>
<view class="dropdown-input select-field" @click="goSelectOperator">
<text :class="['dropdown-value', selectedOperator ? '' : 'placeholder']">{{ selectedOperator?.label || currentUserName || '请选择操作人' }}</text>
<uni-icons type="right" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
</view>
@ -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) {

Loading…
Cancel
Save