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

besure_bit
黄伟杰 2 weeks ago
parent b6a88bce86
commit bcf714a7c8

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

@ -2602,6 +2602,9 @@ export default {
detail: 'Detail', detail: 'Detail',
moldUp: 'Mold Up', moldUp: 'Mold Up',
moldDown: 'Mold Down', 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', repair: 'Repair',
qrcode: 'QR Code', qrcode: 'QR Code',
edit: 'Edit', edit: 'Edit',

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

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

@ -149,11 +149,13 @@
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import { ProductApi, type ProductVO } from '@/api/erp/product/product' import { ProductApi, type ProductVO } from '@/api/erp/product/product'
import { MoldBrandApi, type MoldBrandVO } from '@/api/erp/mold' import { MoldBrandApi, type MoldBrandVO } from '@/api/erp/mold'
import { MoldOperateApi } from '@/api/mes/moldoperate'
import { DeviceLedgerApi, type DeviceLedgerVO } from '@/api/mes/deviceledger' import { DeviceLedgerApi, type DeviceLedgerVO } from '@/api/mes/deviceledger'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter, formatDate } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import QrcodeActionCard from '@/components/QrcodeActionCard/index.vue' import QrcodeActionCard from '@/components/QrcodeActionCard/index.vue'
import { useUserStore } from '@/store/modules/user'
defineOptions({ name: 'MoldBrand' }) defineOptions({ name: 'MoldBrand' })
@ -161,6 +163,7 @@ const { t } = useI18n()
const message = useMessage() const message = useMessage()
const { push } = useRouter() const { push } = useRouter()
const route = useRoute() const route = useRoute()
const userStore = useUserStore()
const loading = ref(false) const loading = ref(false)
const exportLoading = ref(false) const exportLoading = ref(false)
const list = ref<MoldBrandVO[]>([]) 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 operateType.value = type
currentMold.value = row currentMold.value = row
operateFormVisible.value = true operateFormVisible.value = true
@ -353,8 +391,9 @@ const closeOperateForm = () => {
currentMold.value = null currentMold.value = null
} }
const onOperateSuccess = () => { const onOperateSuccess = async () => {
// closeOperateForm()
await getList()
} }
// //

Loading…
Cancel
Save