diff --git a/src/locales/en.ts b/src/locales/en.ts index a7f988b8..f38a1791 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -2448,6 +2448,193 @@ export default { qrcodeEmpty: 'No QR code' }, + MoldBrandPage: { + all: 'All', + onMachine: 'On Machine', + standby: 'Standby', + repairing: 'Repairing', + scrapped: 'Scrapped', + image: 'Image', + code: 'Code', + name: 'Name', + productName: 'Product Model', + version: 'Version', + status: 'Status', + currentDevice: 'Current Device', + moldSize: 'Sub Mold Count', + createTime: 'Create Time', + operate: 'Operate', + detail: 'Detail', + moldUp: 'Mold Up', + moldDown: 'Mold Down', + repair: 'Repair', + qrcode: 'QR Code', + edit: 'Edit', + delete: 'Delete', + add: 'Add', + export: 'Export', + reset: 'Reset', + query: 'Query', + placeholderKeyword: 'Please input code/name/product model', + placeholderStatus: 'Mold Status', + placeholderProduct: 'Product Model', + placeholderDevice: 'Current Device', + deleteSuccess: 'Delete success', + exportFilename: 'MoldLedger.xls', + reservedAction: '{action} function is reserved', + back: 'Back', + moldCode: 'Mold Code', + moldName: 'Mold Name', + lastChangeTime: 'Last Change Time', + targetLine: 'Target Line', + lineName: 'Line Name', + targetDevice: 'Target Device', + mold: 'Mold', + operateTime: 'Operation Time', + operator: 'Operator', + remark: 'Remark', + placeholderTargetLine: 'Please select line', + placeholderTargetDevice: 'Please select device', + placeholderMold: 'Please select mold', + placeholderOperateTime: 'Please select time', + placeholderOperator: 'Please select operator', + placeholderRemark: 'Please input remark (optional)', + cancel: 'Cancel', + submit: 'Submit', + validatorMoldRequired: 'Please select mold', + validatorTargetLineRequired: 'Please select target line', + validatorTargetDeviceRequired: 'Please select target device', + validatorOperateTimeRequired: 'Please select operation time', + validatorOperatorRequired: 'Please select operator', + moldUpSuccess: 'Mold up success', + moldDownSuccess: 'Mold down success', + submitFailed: 'Submit failed', + recentRecords: 'Recent Mold Up/Down Records', + operateType: 'Operation Type', + installUp: 'Up Mold', + uninstallDown: 'Down Mold', + noRecords: 'No operation records', + qrcodeDialogTitle: 'Mold QR Code', + qrcodePrintTitle: '{name} Code Print Preview', + qrcodeEmpty: 'No QR code', + qrcodeLoadError: 'QR code load failed', + qrcodeRefreshConfirm: 'Confirm to refresh this mold QR code?' + }, + + MoldBrandDetail: { + back: 'Back', + moldUp: 'Mold Up', + moldDown: 'Mold Down', + repair: 'Repair', + noImage: 'No Image', + qrcodeTitle: 'Mold QR Code', + qrcodePrintTitle: '{name} Code Print Preview', + qrcodeEmpty: 'No QR code', + qrcodeLoadError: 'QR code load failed', + qrcodeRefreshConfirm: 'Confirm to refresh this mold QR code?', + code: 'Code', + currentDevice: 'Current Device', + productName: 'Product Model', + version: 'Version', + lifeStatus: 'Life Status', + childMoldCount: 'Sub Mold Count', + tabMolds: 'Sub Molds', + tabInspection: 'Inspection Records', + tabRepair: 'Repair Records', + tabMaintain: 'Maintenance Records', + tabInstall: 'Installation Records', + time: 'Time', + startTime: 'Start Time', + endTime: 'End Time', + to: 'To', + query: 'Query', + reset: 'Reset', + export: 'Export', + inspectionMethod: 'Inspection Method', + criteria: 'Criteria', + inspectionTime: 'Inspection Time', + remark: 'Remark', + operator: 'Operator', + projectContent: 'Project Content', + repairResult: 'Repair Result', + finishDate: 'Finish Date', + totalItems: '{count} items in total', + maintainMethod: 'Maintenance Method', + maintainTime: 'Maintenance Time', + mold: 'Mold', + selectMold: 'Select Mold', + remarkPlaceholder: 'Remark', + moldName: 'Mold Name', + deviceName: 'Device', + creatorName: 'Operator', + createTime: 'Operation Time', + noInstallRecords: 'No installation records', + pending: 'Pending', + pass: 'Pass', + fail: 'Fail', + reservedAction: '{action} function is reserved', + missingBrandId: 'Missing mold brand ID', + inspectionExportTip: 'Inspection export pending backend confirmation', + maintainExportTip: 'Maintenance export pending backend confirmation', + repairExportTip: 'Repair export pending backend confirmation' + }, + + MoldBrandFormPage: { + code: 'Code', + name: 'Name', + productName: 'Product Model', + version: 'Version', + status: 'Status', + moldSize: 'Cavity Number', + useTime: 'Expected Life', + images: 'Image', + remark: 'Remark', + isEnable: 'Is Enable', + enable: 'Enable', + disable: 'Disable', + save: 'Save', + close: 'Close', + placeholderCode: 'Please input model code', + placeholderName: 'Please input model name', + placeholderProduct: 'Please select product model', + placeholderVersion: 'Please input version, e.g. 1.0', + placeholderStatus: 'Please select status', + placeholderRemark: 'Please input remark', + validatorCodeRequired: 'Model code can not be empty', + validatorNameRequired: 'Model name can not be empty', + validatorProductRequired: 'Product model can not be empty', + validatorMoldSizeRequired: 'Cavity number can not be empty', + validatorIsEnableRequired: 'Please select enable status', + createTitle: 'Add Mold Brand', + updateTitle: 'Edit Mold Brand', + createSuccess: 'Create success', + updateSuccess: 'Update success' + }, + + MoldListPage: { + code: 'Code', + name: 'Name', + query: 'Query', + reset: 'Reset', + addSubMold: 'Add Sub Mold', + export: 'Export', + index: 'Index', + subMoldName: 'Sub Mold Name', + type: 'Type', + installLocation: 'Install Location', + material: 'Material', + quantity: 'Quantity', + operate: 'Operate', + edit: 'Edit', + delete: 'Delete', + placeholderCode: 'Please input code', + placeholderName: 'Please input name', + selectBrandTip: 'Please select a mold model', + formNotReady: 'Form component not ready, please retry later', + deleteSuccess: 'Delete success', + exportFilename: 'SubMold.xls' + }, + MoldReturn: { moduleName: 'Mold Stock In', no: 'Stock In No', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 2190c399..dc66ea36 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -1947,6 +1947,201 @@ export default { qrcodeEmpty: '暂无二维码' }, + MoldBrandPage: { + all: '全部', + onMachine: '在机', + standby: '待用', + repairing: '维修', + scrapped: '报废', + image: '图片', + code: '编码', + name: '名称', + productName: '产品型号', + version: '版本', + status: '状态', + currentDevice: '当前设备', + moldSize: '子模数', + createTime: '创建时间', + operate: '操作', + detail: '详情', + moldUp: '上模', + moldDown: '下模', + repair: '维修', + qrcode: '二维码', + edit: '编辑', + delete: '删除', + add: '新增', + export: '导出', + reset: '重置', + query: '查询', + placeholderKeyword: '请输入编码/名称/产品型号', + placeholderStatus: '模具状态', + placeholderProduct: '产品型号', + placeholderDevice: '当前设备', + deleteSuccess: '删除成功', + exportFilename: '模具台账.xls', + reservedAction: '{action}功能预留中', + // 上下模操作 + back: '返回', + moldCode: '模具编码', + moldName: '模具名称', + lastChangeTime: '上次更换时间', + targetLine: '目标产线', + lineName: '产线名称', + targetDevice: '目标设备', + mold: '模具', + operateTime: '操作时间', + operator: '操作人', + remark: '备注', + placeholderTargetLine: '请选择产线', + placeholderTargetDevice: '请选择设备', + placeholderMold: '请选择模具', + placeholderOperateTime: '请选择时间', + placeholderOperator: '请选择操作人', + placeholderRemark: '请输入备注(选填)', + cancel: '取消', + submit: '提交', + validatorMoldRequired: '请选择模具', + validatorTargetLineRequired: '请选择目标产线', + validatorTargetDeviceRequired: '请选择目标设备', + validatorOperateTimeRequired: '请选择操作时间', + validatorOperatorRequired: '请选择操作人', + moldUpSuccess: '上模成功', + moldDownSuccess: '下模成功', + submitFailed: '提交失败', + recentRecords: '最近上下模记录', + operateType: '操作类型', + installUp: '上模', + uninstallDown: '下模', + noRecords: '暂无操作记录', + qrcodeDialogTitle: '模具二维码', + qrcodePrintTitle: '{name}码打印预览', + qrcodeEmpty: '暂无二维码', + qrcodeLoadError: '二维码加载失败', + qrcodeRefreshConfirm: '确认刷新该模具二维码吗?' + }, + + MoldBrandDetail: { + back: '返回', + moldUp: '上模', + moldDown: '下模', + repair: '维修', + noImage: '暂无图片', + qrcodeTitle: '模具二维码', + qrcodePrintTitle: '{name}码打印预览', + qrcodeEmpty: '暂无二维码', + qrcodeLoadError: '二维码加载失败', + qrcodeRefreshConfirm: '确认刷新该模具二维码吗?', + code: '编码', + currentDevice: '当前设备', + productName: '产品型号', + version: '版本', + lifeStatus: '寿命状态', + childMoldCount: '子模数量', + // tabs + tabMolds: '子模具', + tabInspection: '点检记录', + tabRepair: '维修记录', + tabMaintain: '保养记录', + tabInstall: '安装记录', + // 筛选 + time: '时间', + startTime: '开始时间', + endTime: '结束时间', + to: '至', + query: '查询', + reset: '重置', + export: '导出', + // 点检 + inspectionMethod: '点检方式', + criteria: '判定标准', + inspectionTime: '点检时间', + remark: '备注', + operator: '操作人', + // 维修 + projectContent: '项目内容', + repairResult: '维修结果', + finishDate: '完成日期', + totalItems: '共{count}条', + // 保养 + maintainMethod: '保养方式', + maintainTime: '保养时间', + // 安装记录 + mold: '模具', + selectMold: '选择模具', + remarkPlaceholder: '备注', + moldName: '模具名称', + deviceName: '设备', + creatorName: '操作人', + createTime: '操作时间', + noInstallRecords: '暂无安装记录', + // 检测结果 + pending: '待检测', + pass: '通过', + fail: '不通过', + reservedAction: '{action}功能预留中', + missingBrandId: '缺少模具组ID', + inspectionExportTip: '点检记录导出功能待后端确认后接入', + maintainExportTip: '保养记录导出功能待后端确认后接入', + repairExportTip: '维修记录导出功能待后端确认后接入' + }, + + MoldBrandFormPage: { + code: '编码', + name: '名称', + productName: '产品型号', + version: '版本', + status: '状态', + moldSize: '模穴数', + useTime: '预期寿命', + images: '图片', + remark: '备注', + isEnable: '是否启用', + enable: '启用', + disable: '停用', + save: '保存', + close: '关闭', + placeholderCode: '请输入型号编码', + placeholderName: '请输入型号名称', + placeholderProduct: '请选择产品型号', + placeholderVersion: '请输入版本号,如1.0', + placeholderStatus: '请选择状态', + placeholderRemark: '请输入备注', + validatorCodeRequired: '型号编码不能为空', + validatorNameRequired: '型号名称不能为空', + validatorProductRequired: '产品型号不能为空', + validatorMoldSizeRequired: '模穴数不能为空', + validatorIsEnableRequired: '请选择启用状态', + createTitle: '新增模具组', + updateTitle: '编辑模具组', + createSuccess: '新增成功', + updateSuccess: '更新成功' + }, + + MoldListPage: { + code: '编码', + name: '名称', + query: '查询', + reset: '重置', + addSubMold: '新增子模具', + export: '导出', + index: '序号', + subMoldName: '子模具名称', + type: '类型', + installLocation: '安装位置', + material: '材质', + quantity: '数量', + operate: '操作', + edit: '编辑', + delete: '删除', + placeholderCode: '请输入编码', + placeholderName: '请输入名称', + selectBrandTip: '请选择一个模具型号', + formNotReady: '表单组件未就绪,请稍后重试', + deleteSuccess: '删除成功', + exportFilename: '子模具.xls' + }, + MoldReturn: { moduleName: '模具入库', no: '入库单号', diff --git a/src/views/erp/mold/MoldBrandForm.vue b/src/views/erp/mold/MoldBrandForm.vue index 9b1913a0..b23eb975 100644 --- a/src/views/erp/mold/MoldBrandForm.vue +++ b/src/views/erp/mold/MoldBrandForm.vue @@ -3,10 +3,10 @@ - + - +
@@ -17,62 +17,62 @@ - - + + - - + + - - + + - - + + - + - + - + - - + + - + - 启用 - 停用 + {{ t('MoldManagement.MoldBrandFormPage.enable') }} + {{ t('MoldManagement.MoldBrandFormPage.disable') }} @@ -85,6 +85,7 @@ import { useDictStoreWithOut } from '@/store/modules/dict' defineOptions({ name: 'MoldBrandForm' }) +const { t } = useI18n() const message = useMessage() const dictStore = useDictStoreWithOut() const productList = ref([]) @@ -120,7 +121,7 @@ const validateCode = (_rule: any, value: any, callback: any) => { return } if (value === undefined || value === null || String(value).trim() === '') { - callback(new Error('型号编码不能为空')) + callback(new Error(t('MoldManagement.MoldBrandFormPage.validatorCodeRequired'))) return } callback() @@ -150,11 +151,11 @@ const addVersionPrefix = (val: any): string => { const formRules = reactive({ code: [{ validator: validateCode, trigger: 'blur' }], - name: [{ required: true, message: '型号名称不能为空', trigger: 'blur' }], - moldType: [{ required: true, message: '模具类型不能为空', trigger: 'blur' }], - productId: [{ required: true, message: '产品型号不能为空', trigger: 'change' }], - moldSize: [{ required: true, message: '模穴数不能为空', trigger: 'blur' }], - isEnable: [{ required: true, message: '请选择启用状态', trigger: 'change' }] + name: [{ required: true, message: t('MoldManagement.MoldBrandFormPage.validatorNameRequired'), trigger: 'blur' }], + moldType: [{ required: true, message: t('MoldManagement.MoldBrandFormPage.validatorNameRequired'), trigger: 'blur' }], + productId: [{ required: true, message: t('MoldManagement.MoldBrandFormPage.validatorProductRequired'), trigger: 'change' }], + moldSize: [{ required: true, message: t('MoldManagement.MoldBrandFormPage.validatorMoldSizeRequired'), trigger: 'blur' }], + isEnable: [{ required: true, message: t('MoldManagement.MoldBrandFormPage.validatorIsEnableRequired'), trigger: 'change' }] }) const resetForm = () => { @@ -168,7 +169,7 @@ const resetForm = () => { productIds: [], images: '', version: '', - status: 0, + status: 1, useTime: 0, maintainType: undefined, maintainTime: undefined, @@ -188,7 +189,7 @@ const handleProductChange = (value?: number) => { const open = async (type: string, id?: number) => { dialogVisible.value = true - dialogTitle.value = type === 'create' ? '新增模具组' : '编辑模具组' + dialogTitle.value = type === 'create' ? t('MoldManagement.MoldBrandFormPage.createTitle') : t('MoldManagement.MoldBrandFormPage.updateTitle') formType.value = type resetForm() await dictStore.setDictMap() @@ -233,10 +234,10 @@ const submitForm = async () => { } if (formType.value === 'create') { await MoldBrandApi.createMoldBrand(payload) - message.success('新增成功') + message.success(t('MoldManagement.MoldBrandFormPage.createSuccess')) } else { await MoldBrandApi.updateMoldBrand(payload) - message.success('更新成功') + message.success(t('MoldManagement.MoldBrandFormPage.updateSuccess')) } dialogVisible.value = false emit('success') diff --git a/src/views/erp/mold/components/MoldForm.vue b/src/views/erp/mold/components/MoldForm.vue index 926acc0c..b52d803b 100644 --- a/src/views/erp/mold/components/MoldForm.vue +++ b/src/views/erp/mold/components/MoldForm.vue @@ -33,16 +33,16 @@ :placeholder="t('MoldManagement.Mold.placeholderName')" /> - - + + - - + + - - + + - - + + - 查询 - 重置 - 新增子模具 - 导出 + {{ t('MoldManagement.MoldListPage.query') }} + {{ t('MoldManagement.MoldListPage.reset') }} + {{ t('MoldManagement.MoldListPage.addSubMold') }} + {{ t('MoldManagement.MoldListPage.export') }} - - - + + + - + - + - + - + @@ -51,6 +51,7 @@ import download from '@/utils/download' import { DICT_TYPE } from '@/utils/dict' import { MoldBrandApi } from '@/api/erp/mold' +const { t } = useI18n() const message = useMessage() // 消息弹窗 const MoldForm = defineAsyncComponent(() => import('./MoldForm.vue') as any) const MoldRecordForm = defineAsyncComponent(() => import('@/views/erp/mold/components/MoldRecordForm.vue') as any) @@ -115,12 +116,12 @@ watch( const formRef = ref() const openForm = async (type: string, id?: number) => { if (!props.brandId) { - message.error('请选择一个模具型号') + message.error(t('MoldManagement.MoldListPage.selectBrandTip')) return } await nextTick() if (!formRef.value || typeof formRef.value.open !== 'function') { - message.error('表单组件未就绪,请稍后重试') + message.error(t('MoldManagement.MoldListPage.formNotReady')) return } formRef.value.open(type, id, props.brandId) @@ -133,7 +134,7 @@ const handleDelete = async (id: number) => { await message.delConfirm() // 发起删除 await MoldBrandApi.deleteMold(id) - message.success('删除成功') + message.success(t('common.delSuccess')) // 刷新列表 await getList() } catch { } @@ -142,7 +143,7 @@ const handleDelete = async (id: number) => { /** 导出按钮操作 */ const handleExport = async () => { if (!props.brandId) { - message.error('请选择一个模具型号') + message.error(t('MoldManagement.MoldListPage.selectBrandTip')) return } try { @@ -152,7 +153,7 @@ const handleExport = async () => { ...queryParams, brandId: props.brandId }) - download.excel(data, '子模具.xls') + download.excel(data, t('MoldManagement.MoldListPage.exportFilename')) } catch { } finally { exportLoading.value = false diff --git a/src/views/erp/mold/detail/brand.vue b/src/views/erp/mold/detail/brand.vue index b47340f5..9cbc2dab 100644 --- a/src/views/erp/mold/detail/brand.vue +++ b/src/views/erp/mold/detail/brand.vue @@ -6,15 +6,15 @@
- +
-
模具二维码
+
{{ t('MoldManagement.MoldBrandDetail.qrcodeTitle') }}
{{ detailData?.code || '-' }}
@@ -30,49 +30,50 @@
- 返回 - 上模 - 下模 - 维修 + {{ t('MoldManagement.MoldBrandDetail.back') }} + {{ t('MoldManagement.MoldBrandDetail.moldUp') }} + {{ t('MoldManagement.MoldBrandDetail.moldDown') }} + {{ t('MoldManagement.MoldBrandDetail.repair') }}
-
编码{{ detailData?.code || '-' }}
-
当前设备{{ detailData?.currentDevice || +
{{ t('MoldManagement.MoldBrandDetail.code') }}{{ detailData?.code || '-' }}
+
{{ t('MoldManagement.MoldBrandDetail.currentDevice') }}{{ detailData?.currentDevice || detailData?.machineName || '-' }}
-
产品型号{{ detailData?.productName || '-' }} +
{{ t('MoldManagement.MoldBrandDetail.productName') }}{{ detailData?.productName || '-' }}
-
版本{{ detailData?.version || '-' }}
+
{{ t('MoldManagement.MoldBrandDetail.version') }}{{ detailData?.version || '-' }}
- 寿命状态 + {{ t('MoldManagement.MoldBrandDetail.lifeStatus') }}
-
-
子模数量{{ childMolds.length || detailData?.moldSize +
{{ t('MoldManagement.MoldBrandDetail.childMoldCount') }}{{ childMolds.length || detailData?.moldSize || 0 }}
- + - + +
- + - 查询 - 重置 + {{ t('MoldManagement.MoldBrandDetail.query') }} + {{ t('MoldManagement.MoldBrandDetail.reset') }} 导出 + @click="handleExportInspection">{{ t('MoldManagement.MoldBrandDetail.export') }} @@ -82,7 +83,7 @@ +
- + +
- + - 查询 - 重置 + {{ t('MoldManagement.MoldBrandDetail.query') }} + {{ t('MoldManagement.MoldBrandDetail.reset') }} 导出 + @click="handleExportRepair">{{ t('MoldManagement.MoldBrandDetail.export') }} @@ -134,7 +137,7 @@
@@ -146,21 +149,21 @@
项目内容{{ t('MoldManagement.MoldBrandDetail.projectContent') }}{{ row.subjectContent ?? '-' }}
维修结果{{ t('MoldManagement.MoldBrandDetail.repairResult') }}{{ getResultLabel(row.repairResult ?? row.result) }}
完成日期{{ t('MoldManagement.MoldBrandDetail.finishDate') }}{{ String(formatHistoryTime(row.finishDate)).split(' ')[0] }}
备注{{ t('MoldManagement.MoldBrandDetail.remark') }}{{ row.remark ?? '-' }}
@@ -168,19 +171,21 @@
+
- + +
- + - 查询 - 重置 + {{ t('MoldManagement.MoldBrandDetail.query') }} + {{ t('MoldManagement.MoldBrandDetail.reset') }} 导出 + @click="handleExportMaintain">{{ t('MoldManagement.MoldBrandDetail.export') }} @@ -190,7 +195,7 @@ +
- + +
- - - + + :start-placeholder="t('MoldManagement.MoldBrandDetail.startTime')" :end-placeholder="t('MoldManagement.MoldBrandDetail.endTime')" :range-separator="t('MoldManagement.MoldBrandDetail.to')" :unlink-panels="true" /> - 查询 - 重置 + {{ t('MoldManagement.MoldBrandDetail.query') }} + {{ t('MoldManagement.MoldBrandDetail.reset') }} - - - - - + + + + + - + +
@@ -272,6 +280,7 @@ import QrcodeActionCard from '@/components/QrcodeActionCard/index.vue' defineOptions({ name: 'ErpMoldBrandDetail' }) +const { t } = useI18n() const message = useMessage() const route = useRoute() const router = useRouter() @@ -281,6 +290,7 @@ const detailLoading = ref(false) const detailData = ref<(MoldBrandVO & Record) | null>(null) const childMolds = ref([]) const activeTab = ref('molds') +const loadedTabs = ref>(new Set(['molds'])) const inspectionHistory = ref([]) const maintainHistory = ref([]) const repairList = ref([]) @@ -298,6 +308,10 @@ const repairDateRange = ref() const inspectionExportLoading = ref(false) const maintainExportLoading = ref(false) const repairExportLoading = ref(false) +const inspectionLoading = ref(false) +const repairLoading = ref(false) +const maintainLoading = ref(false) +const installLoading = ref(false) const imageList = computed(() => parseImages(detailData.value?.images)) const lifeRate = computed(() => { @@ -340,9 +354,9 @@ const getResultLabel = (value: any) => { const v = value === '' || value === null || value === undefined ? undefined : String(value) if (!v) return '-' const upper = v.toUpperCase() - if (v === '0') return '待检测' - if (v === '1' || upper === 'OK') return '通过' - if (v === '2' || upper === 'NG') return '不通过' + if (v === '0') return t('MoldManagement.MoldBrandDetail.pending') + if (v === '1' || upper === 'OK') return t('MoldManagement.MoldBrandDetail.pass') + if (v === '2' || upper === 'NG') return t('MoldManagement.MoldBrandDetail.fail') return v } @@ -452,8 +466,12 @@ const goBack = () => { router.push('/mold/mold-brand') } +const goOperate = (type: number) => { + router.push({ path: '/mold/mold-brand', query: { operateType: String(type), moldId: String(detailData.value?.id) } }) +} + const handleReservedAction = (action: string) => { - message.info(`${action}功能预留中`) + message.info(t('MoldManagement.MoldBrandDetail.reservedAction', { action })) } let getChildMoldsPromise: Promise | null = null @@ -493,49 +511,69 @@ const collectByChildMolds = async (worker: (moldId: number) => Promise, mer const fetchInspectionHistory = async () => { if (!brandId.value) return - const params: any = { moldId: brandId.value } - if (inspectionDateRange.value && inspectionDateRange.value.length === 2) { - params.startTime = inspectionDateRange.value[0] - params.endTime = inspectionDateRange.value[1] + inspectionLoading.value = true + try { + const params: any = { moldId: brandId.value } + if (inspectionDateRange.value && inspectionDateRange.value.length === 2) { + params.startTime = inspectionDateRange.value[0] + params.endTime = inspectionDateRange.value[1] + } + const data = await TicketManagementApi.getInspectionByMoldId(params) + inspectionHistory.value = Array.isArray(data) ? data : [] + } finally { + inspectionLoading.value = false } - const data = await TicketManagementApi.getInspectionByMoldId(params) - inspectionHistory.value = Array.isArray(data) ? data : [] } const fetchMaintainHistory = async () => { if (!brandId.value) return - const params: any = { moldId: brandId.value } - if (maintainDateRange.value && maintainDateRange.value.length === 2) { - params.startTime = maintainDateRange.value[0] - params.endTime = maintainDateRange.value[1] + maintainLoading.value = true + try { + const params: any = { moldId: brandId.value } + if (maintainDateRange.value && maintainDateRange.value.length === 2) { + params.startTime = maintainDateRange.value[0] + params.endTime = maintainDateRange.value[1] + } + const data = await TicketManagementApi.getMaintenanceByMoldId(params) + maintainHistory.value = Array.isArray(data) ? data : [] + } finally { + maintainLoading.value = false } - const data = await TicketManagementApi.getMaintenanceByMoldId(params) - maintainHistory.value = Array.isArray(data) ? data : [] } const fetchRepairHistory = async () => { if (!brandId.value) return - const params: any = { moldId: brandId.value } - if (repairDateRange.value && repairDateRange.value.length === 2) { - params.startTime = repairDateRange.value[0] - params.endTime = repairDateRange.value[1] + repairLoading.value = true + try { + const params: any = { moldId: brandId.value } + if (repairDateRange.value && repairDateRange.value.length === 2) { + params.startTime = repairDateRange.value[0] + params.endTime = repairDateRange.value[1] + } + const data = await MoldRepairApi.getRepairListByMoldId(params) + repairList.value = Array.isArray(data) ? data : [] + repairActiveNames.value = repairGroups.value.map((item) => item.key) + } finally { + repairLoading.value = false } - const data = await MoldRepairApi.getRepairListByMoldId(params) - repairList.value = Array.isArray(data) ? data : [] - repairActiveNames.value = repairGroups.value.map((item) => item.key) } const fetchInstallRecords = async () => { if (!brandId.value) return - const params: any = { pageNo: installPageNo.value, pageSize: installPageSize.value, brandId: brandId.value } - if (installMoldId.value) params.moldId = installMoldId.value - if (installRemark.value) params.remark = installRemark.value - if (installDateRange.value && installDateRange.value.length === 2) { - params.createTime = [installDateRange.value[0], installDateRange.value[1]] + installLoading.value = true + try { + const params: any = { pageNo: installPageNo.value, pageSize: installPageSize.value, brandId: brandId.value } + if (installMoldId.value) params.moldId = installMoldId.value + if (installRemark.value) params.remark = installRemark.value + if (installDateRange.value && installDateRange.value.length === 2) { + params.createTime = [installDateRange.value[0], installDateRange.value[1]] + } + const data = await MoldOperateApi.getMoldOperatePage(params) + installRecords.value = data?.list ?? [] + installTotal.value = data?.total ?? 0 + } finally { + installLoading.value = false } - const data = await MoldOperateApi.getMoldOperatePage(params) - installRecords.value = data?.list ?? [] - installTotal.value = data?.total ?? 0 } const handleQueryInstall = () => { @@ -562,7 +600,7 @@ const handleResetInspection = async () => { const handleExportInspection = async () => { inspectionExportLoading.value = true - message.info('点检记录导出功能待后端确认后接入') + message.info(t('MoldManagement.MoldBrandDetail.inspectionExportTip')) inspectionExportLoading.value = false } @@ -577,7 +615,7 @@ const handleResetMaintain = async () => { const handleExportMaintain = async () => { maintainExportLoading.value = true - message.info('保养记录导出功能待后端确认后接入') + message.info(t('MoldManagement.MoldBrandDetail.maintainExportTip')) maintainExportLoading.value = false } @@ -592,25 +630,50 @@ const handleResetRepair = async () => { const handleExportRepair = async () => { repairExportLoading.value = true - message.info('维修记录导出功能待后端确认后接入') + message.info(t('MoldManagement.MoldBrandDetail.repairExportTip')) repairExportLoading.value = false } const getDetail = async () => { if (!brandId.value) { - message.error('缺少模具组ID') + message.error(t('MoldManagement.MoldBrandDetail.missingBrandId')) return } detailLoading.value = true try { detailData.value = await MoldBrandApi.getMoldBrand(brandId.value) - await getChildMolds() - await Promise.all([fetchInspectionHistory(), fetchMaintainHistory(), fetchRepairHistory(), fetchInstallRecords()]) } finally { detailLoading.value = false } } +const loadTabData = async (tab: string) => { + if (loadedTabs.value.has(tab)) return + loadedTabs.value.add(tab) + switch (tab) { + case 'inspection': + await getChildMolds() + fetchInspectionHistory() + break + case 'repair': + await getChildMolds() + fetchRepairHistory() + break + case 'maintain': + await getChildMolds() + fetchMaintainHistory() + break + case 'install': + await getChildMolds() + fetchInstallRecords() + break + } +} + +watch(activeTab, (val) => { + loadTabData(val) +}) + onMounted(() => { getDetail() }) diff --git a/src/views/erp/mold/index.vue b/src/views/erp/mold/index.vue index 76bc80c0..956829e9 100644 --- a/src/views/erp/mold/index.vue +++ b/src/views/erp/mold/index.vue @@ -19,14 +19,14 @@ - + - + - + - 重置 - 查询 + {{ t('MoldManagement.MoldBrandPage.reset') }} + {{ t('MoldManagement.MoldBrandPage.query') }} - 新增 + {{ t('MoldManagement.MoldBrandPage.add') }} - 导出 + {{ t('MoldManagement.MoldBrandPage.export') }} - - + + - - - - - + + + + + - + - - - + + + @@ -117,17 +117,7 @@ - + @@ -259,7 +246,7 @@ @@ -707,7 +704,7 @@ onMounted(async () => { } .mold-operate-page__history { - width: 420px; + width: 30vw; background: #fff; border-radius: 12px; padding: 20px;