Browse Source

feat(inspection): 添加验货数量修改功能

- 在 myInspectionList 页面为已排程状态的验货清单添加修改数量按钮
- 实现 handleEditQty 方法用于处理验货数量修改逻辑
- 添加输入验证确保验货数量为有效正数
- 集成 updateMyInspectionQty API 接口进行数量更新
- 添加相应的提示信息和错误处理机制
- 限制仅已排程且未创建 IQC 检验单时可修改数量
master
qiankanghui 1 month ago
parent
commit
f904daad41
  1. 3
      src/api/inspection/inspectionRequestHeader.js
  2. 41
      src/views/modules/inspection/myInspectionList.vue

3
src/api/inspection/inspectionRequestHeader.js

@ -85,6 +85,9 @@ export const getMyInspectionList = (data) => createAPI(`/inspection/getMyInspect
// 我的验货清单删除明细(仅已排程/验货中状态,一并删除关联IQC检验单)
export const deleteMyInspectionDetail = (data) => createAPI(`/inspection/deleteMyInspectionDetail`, 'post', data)
// 我的验货清单修改验货数量(仅已排程且未创建IQC检验单时可用)
export const updateMyInspectionQty = (data) => createAPI(`/inspection/updateMyInspectionQty`, 'post', data)
// 创建IQC检验单
export const createIqc = (data) => createAPI(`/qms/qc/createIqc`, 'post', data)

41
src/views/modules/inspection/myInspectionList.vue

@ -38,6 +38,7 @@
<el-table-column fixed="right" header-align="center" align="center" width="180" label="操作">
<template slot-scope="scope">
<a v-if="scope.row.statusDb === 'Scheduled'" class="customer-a" @click="startInspection(scope.row)">开始验货</a>
<a v-if="scope.row.statusDb === 'Scheduled'" class="customer-a" @click="handleEditQty(scope.row)">修改数量</a>
<a v-if="scope.row.statusDb === 'Inspecting'" class="customer-a" @click="goToIQCResult(scope.row)">跳转</a>
<a v-if="scope.row.statusDb === 'Scheduled' || scope.row.statusDb === 'Inspecting'" class="customer-a" style="color: #f56c6c;" @click="deleteInspection(scope.row)">删除</a>
<span v-if="scope.row.statusDb === 'ChangeApplying'" style="color: #f56c6c;">等待变更审核</span>
@ -60,7 +61,7 @@
</template>
<script>
import { getMyInspectionList, createIqc, startInspection, deleteMyInspectionDetail } from '@/api/inspection/inspectionRequestHeader.js'
import { getMyInspectionList, createIqc, startInspection, deleteMyInspectionDetail, updateMyInspectionQty } from '@/api/inspection/inspectionRequestHeader.js'
import { actionIQCInspection, qcIQCInspectionSearch } from '@/api/qc/qc.js'
@ -197,6 +198,44 @@ export default {
})
},
// 修改验货数量(仅未创建IQC检验单前)
handleEditQty (row) {
if (row.statusDb !== 'Scheduled') {
this.$message.warning('只有已排程且未开始验货的申请可以修改验货数量,请刷新列表后重试')
this.getList()
return
}
this.$prompt('请输入新的验货数量', '修改验货数量', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputValue: row.qty == null ? '' : String(row.qty),
inputPattern: /^\d+(\.\d+)?$/,
inputErrorMessage: '请输入有效的正数',
inputValidator: (val) => {
if (val === '' || val === null) return '验货数量不能为空'
if (Number(val) <= 0) return '验货数量必须大于0'
return true
}
}).then(({ value }) => {
updateMyInspectionQty({
requestNo: row.requestNo,
itemNo: row.itemNo,
qty: Number(value)
}).then(({ data }) => {
if (data.code === 0) {
this.$message.success('修改验货数量成功')
this.getList()
} else {
this.$message.error((data && data.msg) || '修改验货数量失败')
}
}).catch((error) => {
this.$message.error('修改验货数量失败:' + error.message)
})
}).catch(() => {
// 用户取消操作
})
},
// 开始验货
startInspection (row) {
// 校验单子状态是否为已排程(防止页面数据滞后)

Loading…
Cancel
Save