style:模具组-下模逻辑修改

main
黄伟杰 1 week ago
parent b6a88bce86
commit bcf714a7c8

@ -15,6 +15,8 @@ export interface MoldBrandVO {
status?: number // 状态
currentPosition?: string // 当前位置
currentDevice?: string // 当前设备
deviceId?: number // 当前设备ID
deviceName?: string // 当前设备
machineName?: string // 当前设备
useTime?: number // 预期寿命(小时)
maintainType?: number // 维保模式

@ -2602,6 +2602,9 @@ export default {
detail: 'Detail',
moldUp: 'Mold Up',
moldDown: 'Mold Down',
confirmMoldDown: 'Confirm mold down?',
currentDeviceRequired: 'Current mold has no linked device, unable to mold down',
currentOperatorRequired: 'Current login operator was not found, unable to mold down',
repair: 'Repair',
qrcode: 'QR Code',
edit: 'Edit',

@ -2079,6 +2079,9 @@ export default {
detail: '详情',
moldUp: '上模',
moldDown: '下模',
confirmMoldDown: '是否确认下模?',
currentDeviceRequired: '当前模具未关联设备,无法下模',
currentOperatorRequired: '未获取到当前登录操作人,无法下模',
repair: '维修',
qrcode: '二维码',
edit: '编辑',

@ -251,6 +251,9 @@ const submitOperateForm = async () => {
await MoldOperateApi.createMoldOperate(submitData)
message.success(props.type === 1 ? t('MoldManagement.MoldBrandPage.moldUpSuccess') : t('MoldManagement.MoldBrandPage.moldDownSuccess'))
fetchRecentOperateList()
if (props.type === 1) {
await new Promise((resolve) => setTimeout(resolve, 2000))
}
emit('success')
} catch (error) {
console.error(t('MoldManagement.MoldBrandPage.submitFailed'), error)

@ -149,11 +149,13 @@
import { defineAsyncComponent } from 'vue'
import { ProductApi, type ProductVO } from '@/api/erp/product/product'
import { MoldBrandApi, type MoldBrandVO } from '@/api/erp/mold'
import { MoldOperateApi } from '@/api/mes/moldoperate'
import { DeviceLedgerApi, type DeviceLedgerVO } from '@/api/mes/deviceledger'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import { dateFormatter, formatDate } from '@/utils/formatTime'
import download from '@/utils/download'
import QrcodeActionCard from '@/components/QrcodeActionCard/index.vue'
import { useUserStore } from '@/store/modules/user'
defineOptions({ name: 'MoldBrand' })
@ -161,6 +163,7 @@ const { t } = useI18n()
const message = useMessage()
const { push } = useRouter()
const route = useRoute()
const userStore = useUserStore()
const loading = ref(false)
const exportLoading = ref(false)
const list = ref<MoldBrandVO[]>([])
@ -335,7 +338,42 @@ const openDetail = (id: number) => {
}
//
const openOperateForm = (type: number, row: MoldBrandVO) => {
const getCurrentOperatorId = () => {
const user = userStore.getUser as any
return user?.operatorId ?? user?.id
}
const handleMoldDown = async (row: MoldBrandVO) => {
try {
await message.confirm(t('MoldManagement.MoldBrandPage.confirmMoldDown'))
const deviceId = (row as any).deviceId
const operatorId = getCurrentOperatorId()
if (!deviceId) {
message.warning(t('MoldManagement.MoldBrandPage.currentDeviceRequired'))
return
}
if (!operatorId) {
message.warning(t('MoldManagement.MoldBrandPage.currentOperatorRequired'))
return
}
await MoldOperateApi.createMoldOperate({
operateType: 2,
moldId: row.id,
deviceId,
lineName: '',
operateTime: formatDate(new Date()),
operatorId: String(operatorId)
} as any)
message.success(t('MoldManagement.MoldBrandPage.moldDownSuccess'))
await getList()
} catch {}
}
const openOperateForm = async (type: number, row: MoldBrandVO) => {
if (type === 2) {
await handleMoldDown(row)
return
}
operateType.value = type
currentMold.value = row
operateFormVisible.value = true
@ -353,8 +391,9 @@ const closeOperateForm = () => {
currentMold.value = null
}
const onOperateSuccess = () => {
//
const onOperateSuccess = async () => {
closeOperateForm()
await getList()
}
//

Loading…
Cancel
Save