diff --git a/klp-ui/src/views/wms/coil/typing.vue b/klp-ui/src/views/wms/coil/typing.vue index b5687c27..a0ecd24b 100644 --- a/klp-ui/src/views/wms/coil/typing.vue +++ b/klp-ui/src/views/wms/coil/typing.vue @@ -7,6 +7,7 @@ 钢卷信息更新
+ 暂存内容 保存更新
@@ -331,6 +332,38 @@ 确 定 + + + +
+ + 暂存的表单数据 + + {{ parsedCacheData && parsedCacheData.updateForm && parsedCacheData.updateForm.currentCoilNo || '-' }} + {{ parsedCacheData && parsedCacheData.updateForm && parsedCacheData.updateForm.team || '-' }} + {{ parsedCacheData && parsedCacheData.updateForm && parsedCacheData.updateForm.materialType || '-' }} + {{ parsedCacheData && parsedCacheData.updateForm && parsedCacheData.updateForm.qualityStatus || '-' }} + {{ parsedCacheData && parsedCacheData.updateForm && parsedCacheData.updateForm.netWeight || '-' }} + {{ parsedCacheData && parsedCacheData.updateForm && parsedCacheData.updateForm.remark || '-' }} + + 暂存的异常信息({{ parsedCacheData.abnormals.length }}条) +
+
+
+
+
{{ getAbnormalPositionText(abnormal.position) }}
+
{{ getAbnormalCodeText(abnormal.defectCode) }}
+
+
+
+
+
+ +
@@ -339,6 +372,7 @@ import { getMaterialCoil, updateMaterialCoil, getMaterialCoilTrace } from '@/api import { completeAction, getPendingAction } from '@/api/wms/pendingAction'; import { listWarehouse } from '@/api/wms/warehouse'; import { getAcidTypingPrefill } from '@/api/pocket/acidTyping'; +import { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache'; import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect"; import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect"; import ProductSelect from "@/components/KLPService/ProductSelect"; @@ -489,6 +523,10 @@ export default { remark: null }, contractList: [], + // 缓存相关 + cacheDialogVisible: false, + currentCache: null, + parsedCacheData: null, }; }, computed: { @@ -625,6 +663,27 @@ export default { if (actionId) { this.actionId = actionId; } + + // 检测是否有暂存数据 + if (coilId) { + try { + const res = await getCoilCacheByCoilId(coilId); + if (res.code === 200 && res.data) { + this.currentCache = res.data; + try { + this.parsedCacheData = JSON.parse(res.data.coilJson); + } catch (e) { + this.parsedCacheData = null; + this.$message.warning('暂存数据解析失败'); + return; + } + // 显示缓存对话框 + this.cacheDialogVisible = true; + } + } catch (error) { + console.error('查询暂存失败', error); + } + } }, methods: { // 处理材料类型变化 @@ -963,6 +1022,60 @@ export default { if (!dict) return code; const item = dict.find(item => item.value === code); return item ? item.label : code; + }, + + // 暂存表单内容 + async saveTemp() { + try { + this.loading = true; + const cacheData = { + updateForm: this.updateForm, + abnormals: this.abnormals + }; + const data = { + coilId: this.currentInfo.coilId, + coilJson: JSON.stringify(cacheData) + }; + const res = await saveCoilCache(data); + if (res.code === 200) { + this.$message.success('暂存成功'); + } else { + this.$message.error('暂存失败:' + res.msg); + } + } catch (error) { + this.$message.error('暂存异常:' + error.message); + } finally { + this.loading = false; + } + }, + + // 使用暂存数据 + useCacheData() { + if (this.parsedCacheData && this.parsedCacheData.updateForm) { + this.updateForm = { ...this.parsedCacheData.updateForm }; + if (this.parsedCacheData.abnormals) { + this.abnormals = [...this.parsedCacheData.abnormals]; + } + this.$message.success('已恢复暂存数据'); + } + this.cacheDialogVisible = false; + }, + + // 删除暂存 + async deleteCache() { + this.$confirm('确定要删除这个暂存吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(async () => { + try { + await delCoilCache(this.currentCache.cacheId); + this.$message.success('删除暂存成功'); + this.cacheDialogVisible = false; + } catch (error) { + this.$message.error('删除暂存失败:' + error.message); + } + }); } } };