|
|
|
|
@ -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()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 维护操作函数
|
|
|
|
|
|