feat(钢卷分条): 添加分条表单暂存功能
- 新增钢卷缓存API模块,提供暂存数据的增删改查功能 - 在分条表单中添加暂存按钮和恢复缓存数据功能 - 增加缓存数据展示弹窗,支持恢复或删除暂存数据 - 优化表格显示,添加序号列和高亮当前行
This commit is contained in:
61
klp-ui/src/api/wms/coilCache.js
Normal file
61
klp-ui/src/api/wms/coilCache.js
Normal file
@@ -0,0 +1,61 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询钢卷缓存列表
|
||||
export function listCoilCache(query) {
|
||||
return request({
|
||||
url: '/wms/coilCache/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询钢卷缓存详细
|
||||
export function getCoilCache(cacheId) {
|
||||
return request({
|
||||
url: '/wms/coilCache/' + cacheId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增钢卷缓存
|
||||
export function addCoilCache(data) {
|
||||
return request({
|
||||
url: '/wms/coilCache',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改钢卷缓存
|
||||
export function updateCoilCache(data) {
|
||||
return request({
|
||||
url: '/wms/coilCache',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除钢卷缓存
|
||||
export function delCoilCache(cacheId) {
|
||||
return request({
|
||||
url: '/wms/coilCache/' + cacheId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 存储缓存
|
||||
export function saveCoilCache(data) {
|
||||
return request({
|
||||
url: '/wms/coilCache/save',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取缓存
|
||||
export function getCoilCacheByCoilId(coilId) {
|
||||
return request({
|
||||
url: '/wms/coilCache/getByCoilId/' + coilId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
</div>
|
||||
|
||||
<!-- 查询所有的合同和当前localstorage中的合同,可以对localstorage中的合同进行新增和删除,手动新增的合同带有手动添加的标记 -->
|
||||
<el-dialog title="可选合同配置" :visible.sync="dialogVisible" width="80%">
|
||||
<el-dialog title="可选合同配置" :visible.sync="dialogVisible" width="80%" append-to-body>
|
||||
<el-tabs v-model="activeTab">
|
||||
<!-- 已配置合同tab -->
|
||||
<el-tab-pane label="可选合同" name="configured">
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
</el-row>
|
||||
|
||||
<el-descriptions :column="2" border title="待分条钢卷信息">
|
||||
<template slot="extra">
|
||||
<el-button v-if="showSplitForm" type="info" @click="copyFromSourceCoil" icon="el-icon-document-copy">复制源卷信息</el-button>
|
||||
</template>
|
||||
<el-descriptions-item label="入场钢卷号">{{ coilInfo.enterCoilNo || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="当前钢卷号">{{ coilInfo.currentCoilNo || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="厂家原料卷号">{{ coilInfo.supplierCoilNo || '-' }}</el-descriptions-item>
|
||||
@@ -87,7 +90,8 @@
|
||||
<el-descriptions :column="1" border title="镀锌二级数据"
|
||||
v-if="actionType == 501 && showSplitForm"></el-descriptions>
|
||||
<el-table v-if="actionType == 501 && showSplitForm" v-loading="zincLoading" :data="zincList" border stripe
|
||||
@row-click="handleZincItemClick">
|
||||
@row-click="handleZincItemClick" highlight-current-row>
|
||||
<el-table-column type="index" label="序号" width="50" />
|
||||
<el-table-column prop="enterCoilNo" label="入场钢卷号" />
|
||||
<el-table-column prop="createTime" label="生产开始时间" />
|
||||
<el-table-column prop="endTime" label="生产结束时间" />
|
||||
@@ -228,7 +232,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="info" @click="copyFromSourceCoil" icon="el-icon-document-copy">复制源卷信息</el-button>
|
||||
<el-button :loading="buttonLoading" type="success" plain @click="saveSplitForm">暂存内容</el-button>
|
||||
<el-button :loading="buttonLoading" type="primary" @click="addSplit">提交分条</el-button>
|
||||
<el-button :loading="buttonLoading" @click="resetSplitForm">重置</el-button>
|
||||
</el-form-item>
|
||||
@@ -306,12 +310,47 @@
|
||||
<el-button type="primary" @click="saveAbnormal">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 缓存数据展示弹窗 -->
|
||||
<el-dialog title="发现暂存数据" :visible.sync="cacheDialogVisible" width="800px" append-to-body>
|
||||
<div>
|
||||
<el-alert title="检测到您之前有暂存的分条数据,是否恢复使用?" type="info" show-icon :closable="false"></el-alert>
|
||||
<el-divider content-position="left">暂存的表单数据</el-divider>
|
||||
<el-descriptions :column="2" border size="small">
|
||||
<el-descriptions-item label="入场钢卷号">{{ parsedCacheData && parsedCacheData.splitForm && parsedCacheData.splitForm.enterCoilNo || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="当前钢卷号">{{ parsedCacheData && parsedCacheData.splitForm && parsedCacheData.splitForm.currentCoilNo || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="所在库位">{{ parsedCacheData && parsedCacheData.splitForm && parsedCacheData.splitForm.warehouseId || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="班组">{{ parsedCacheData && parsedCacheData.splitForm && parsedCacheData.splitForm.team || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="材料类型">{{ parsedCacheData && parsedCacheData.splitForm && parsedCacheData.splitForm.materialType || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="质量状态">{{ parsedCacheData && parsedCacheData.splitForm && parsedCacheData.splitForm.qualityStatus || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="净重">{{ parsedCacheData && parsedCacheData.splitForm && parsedCacheData.splitForm.netWeight || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ parsedCacheData && parsedCacheData.splitForm && parsedCacheData.splitForm.remark || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-divider v-if="parsedCacheData && parsedCacheData.abnormals && parsedCacheData.abnormals.length > 0" content-position="left">暂存的异常信息 ({{ parsedCacheData.abnormals.length }}条)</el-divider>
|
||||
<div v-if="parsedCacheData && parsedCacheData.abnormals && parsedCacheData.abnormals.length > 0" class="abnormal-container" style="margin-bottom: 20px;">
|
||||
<div v-for="(abnormal, index) in parsedCacheData.abnormals" :key="index" class="abnormal-item">
|
||||
<div class="abnormal-content">
|
||||
<div class="abnormal-info">
|
||||
<div class="abnormal-position">{{ getAbnormalPositionText(abnormal.position) }}</div>
|
||||
<div class="abnormal-code">{{ getAbnormalCodeText(abnormal.defectCode) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cacheDialogVisible = false">暂不使用</el-button>
|
||||
<el-button type="danger" @click="deleteCache">删除暂存</el-button>
|
||||
<el-button type="primary" @click="useCacheData">使用暂存数据</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMaterialCoil, listMaterialCoil, createSpecialChild, completeSpecialSplit, updateMaterialCoilSimple, checkCoilNo, delMaterialCoil } from '@/api/wms/coil'
|
||||
import { completeAction, getPendingAction, updatePendingAction } from '@/api/wms/pendingAction'
|
||||
import { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache'
|
||||
import { getGalvanize1TypingPrefill } from '@/api/pocket/acidTyping';
|
||||
import ProductSelect from "@/components/KLPService/ProductSelect";
|
||||
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
||||
@@ -443,6 +482,10 @@ export default {
|
||||
|
||||
zincList: [],
|
||||
zincLoading: false,
|
||||
// 缓存相关
|
||||
cacheDialogVisible: false,
|
||||
currentCache: null,
|
||||
parsedCacheData: null,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -577,6 +620,24 @@ export default {
|
||||
this.selectedSplitItem = null
|
||||
this.resetSplitForm()
|
||||
this.splitForm.enterCoilNo = this.coilInfo.enterCoilNo || ''
|
||||
// 查询是否有缓存
|
||||
try {
|
||||
const res = await getCoilCacheByCoilId(this.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)
|
||||
}
|
||||
},
|
||||
|
||||
// 重置分条表单
|
||||
@@ -901,6 +962,58 @@ export default {
|
||||
};
|
||||
|
||||
this.$message.success('已复制源卷信息,请根据需要修改');
|
||||
},
|
||||
|
||||
// 暂存表单内容
|
||||
async saveSplitForm() {
|
||||
try {
|
||||
this.buttonLoading = true
|
||||
const cacheData = {
|
||||
splitForm: this.splitForm,
|
||||
abnormals: this.abnormals
|
||||
}
|
||||
const data = {
|
||||
coilId: this.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.buttonLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
// 使用缓存数据
|
||||
useCacheData() {
|
||||
if (this.parsedCacheData) {
|
||||
this.splitForm = { ...this.parsedCacheData.splitForm }
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user