Browse Source

暂存功能提交

master_hella_20240701
parent
commit
24ed368b86
  1. 6
      src/api/qms/inspectionJob/inspectionJobMain/index.ts
  2. 14
      src/utils/disposition/defaultButtons.ts
  3. 128
      src/views/qms/inspection/inspectionJob/addForm.vue
  4. 1
      src/views/qms/inspection/inspectionJob/index.vue

6
src/api/qms/inspectionJob/inspectionJobMain/index.ts

@ -22,6 +22,11 @@ export const createInspectionJobMain = async (data) => {
return await request.post({ url: `/qms/inspection-job-main/create`, data }) return await request.post({ url: `/qms/inspection-job-main/create`, data })
} }
// 暂存检验任务
export const stagingInspectionJobMain = async (data) => {
return await request.post({ url: `/qms/inspection-job-main/staging`, data })
}
// 修改检验任务 // 修改检验任务
export const updateInspectionJobMain = async (data) => { export const updateInspectionJobMain = async (data) => {
return await request.put({ url: `/qms/inspection-job-main/update`, data }) return await request.put({ url: `/qms/inspection-job-main/update`, data })
@ -46,6 +51,7 @@ export const abandonInspectionJobMain = async (id) => {
export const closeInspectionJobMain = async (id) => { export const closeInspectionJobMain = async (id) => {
return await request.put({ url: `/qms/inspection-job-main/close?id=` + id }) return await request.put({ url: `/qms/inspection-job-main/close?id=` + id })
} }
// 导出检验申请 Excel // 导出检验申请 Excel
export const exportInspectionJobMain = async (params) => { export const exportInspectionJobMain = async (params) => {
return await request.download({ url: `/qms/inspection-job-main/export-excel`, params }) return await request.download({ url: `/qms/inspection-job-main/export-excel`, params })

14
src/utils/disposition/defaultButtons.ts

@ -187,6 +187,20 @@ export function formCloseBtn(option:any) {
}) })
} }
// form表单-关闭按钮
export function formStagingBtn(option:any) {
return __defaultBtnOption(option,{
label: t(`btn.暂存`).replace('btn.', ''),
name: 'staging',
hide: false,
color: '',
float:'right',
hasPermi: ''
})
}
// drawer抽屉头部-编辑按钮 // drawer抽屉头部-编辑按钮
export function drawerEditBtn(option:any) { export function drawerEditBtn(option:any) {
return __defaultBtnOption(option,{ return __defaultBtnOption(option,{

128
src/views/qms/inspection/inspectionJob/addForm.vue

@ -522,6 +522,10 @@ const buttonBaseClick =async(val) => {
// await InspectionJobMainApi.abandonInspectionJobMain(data.value.id) // await InspectionJobMainApi.abandonInspectionJobMain(data.value.id)
dialogVisible.value = false dialogVisible.value = false
} }
//
else if (val == 'staging') {
staging()
}
} }
// //
const emit = defineEmits(['submitForm', 'searchTableSuccess']) const emit = defineEmits(['submitForm', 'searchTableSuccess'])
@ -661,12 +665,136 @@ const submitForm = async () => {
console.log(111) console.log(111)
} }
} }
const staging = async () => {
try {
console.log(data.value.subList)
const elForm = unref(formMainRef)?.getElFormRef()
//
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
console.log(11,data.value.packageList)
if(data.value.packageList?.length>0){
const validateForm1 = await tableFormRef.value.validateForm()
if (!validateForm1) return
let isPass = data.value.packageList.some(cur=>parseFloat(cur.sampleAmount)>parseFloat(cur.amount))
if(isPass){
message.error(`采样数量不能大于数量`)
return
}
// let number = 0
// data.value.packageList.forEach(cur=>{
// number += parseFloat(cur.sampleAmount)
// })
// number = number.toFixed('2')
// if(number != data.value.sampleTotalAmount){
// message.error(``)
// return
// }
}
const bol2 = await validateForm(formFeaturesRef.value)
if (!bol2) {
message.error(`模板中有检验工序和检验特性未填写完全`)
return
}
//
let arrBol = []
let isOutweigh = []//
let numberList = []//
let parseFloatList = []//
data.value.subList.forEach((item, index) => {
if (item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 1) {
arrBol.push(
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
(cur, key) => {
return !cur.qualifiedQuantity || !cur.unqualifiedQuantity
}
)
)
}
if (item.inspectionJobCharacteristicsUpdateReqVO.featureType == 0) {
arrBol.push(
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
(cur, key) => {
return !cur.inspectionValue
}
)
)
}
if (item.inspectionJobCharacteristicsUpdateReqVO.featureType == 1) {
arrBol.push(
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
(cur, key) => {
return !cur.qualitativeCode
}
)
)
}
//
if (item.inspectionJobCharacteristicsUpdateReqVO.inspectionStartTime >item.inspectionJobCharacteristicsUpdateReqVO.inspectionEndTime) {
isOutweigh.push(item.inspectionJobCharacteristicsUpdateReqVO.inspectionStartTime)
}
//
if (item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 1) {
parseFloatList.push(
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
(cur, key) => {
return String(cur.qualifiedQuantity).indexOf('.')>-1 || String(cur.unqualifiedQuantity).indexOf('.')>-1
}
)
)
//
numberList.push(
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
(cur, key) => {
console.log(12,cur.qualifiedQuantity)
console.log(13,cur.unqualifiedQuantity)
console.log(14,item.inspectionJobCharacteristicsUpdateReqVO.sampleQty)
return parseFloat(cur.qualifiedQuantity) + parseFloat(cur.unqualifiedQuantity) != parseFloat(item.inspectionJobCharacteristicsUpdateReqVO.sampleQty)
}
)
)
}
})
let isEmpty1 = arrBol.some(item=>item == true)
let isEmptyNumberList = numberList.some(item=>item == true)
let isParseFloat = parseFloatList.some(item=>item == true)
if(isEmpty1){
message.error('检验工序和检验特性有字段未填写完全')
return;
}
if(isOutweigh?.length>0){
message.error('检验特性中有开始时间大于结束时间')
return;
}
if(isParseFloat){
message.error('合格数量和不合格数量之和不可以是小数')
return;
}
if(isEmptyNumberList){
message.error('合格数量和不合格数量之和必须等于样品份数')
return;
}
await InspectionJobMainApi.stagingInspectionJobMain(data.value)
message.success('暂存成功!')
} catch {
console.log(111)
}
}
/** 弹窗按钮 */ /** 弹窗按钮 */
let Butttondata: any = [] let Butttondata: any = []
if (props.footButttondata) { if (props.footButttondata) {
Butttondata = props.footButttondata Butttondata = props.footButttondata
} else { } else {
Butttondata = [ Butttondata = [
defaultButtons.formStagingBtn(null), //
defaultButtons.formSaveBtn(null), // defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) // defaultButtons.formCloseBtn(null) //
] ]

1
src/views/qms/inspection/inspectionJob/index.vue

@ -203,7 +203,6 @@ const list = ref([])
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionJobMain') detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionJobMain')
} }
// //
const formRef = ref() const formRef = ref()
const execute = async (type : string, row ?: number) => { const execute = async (type : string, row ?: number) => {
formRef.value.open(type, row) formRef.value.open(type, row)

Loading…
Cancel
Save