diff --git a/src/api/qms/inspectionJob/inspectionJobMain/index.ts b/src/api/qms/inspectionJob/inspectionJobMain/index.ts index aca7fd268..3346beae4 100644 --- a/src/api/qms/inspectionJob/inspectionJobMain/index.ts +++ b/src/api/qms/inspectionJob/inspectionJobMain/index.ts @@ -51,12 +51,14 @@ export const abandonInspectionJobMain = async (id) => { export const closeInspectionJobMain = async (id) => { return await request.put({ url: `/qms/inspection-job-main/close?id=` + id }) } - +// 发布检验任务 +export const releaseInspectionJobMain = async (id) => { + return await request.put({ url: `/qms/inspection-job-main/release?id=` + id }) +} // 导出检验申请 Excel export const exportInspectionJobMain = async (params) => { return await request.download({ url: `/qms/inspection-job-main/export-excel`, params }) } - // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/qms/inspection-job-main/get-import-template' }) diff --git a/src/views/qms/inspectionJob/addForm.vue b/src/views/qms/inspectionJob/addForm.vue index 1a9f11a80..aaa8f4bb8 100644 --- a/src/views/qms/inspectionJob/addForm.vue +++ b/src/views/qms/inspectionJob/addForm.vue @@ -369,7 +369,7 @@ // 总数量值是 样品份数 乘 每份样品量 allSamplePieceSize.value += parseFloat((parseFloat(item.inspectionJobCharacteristicsUpdateReqVO.sampleQty) * parseFloat(item.inspectionJobCharacteristicsUpdateReqVO.samplePieceSize)).toFixed(2)) // rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true - if(!item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList){ + if (!item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList) { // 单个录入时 if (item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 0) { // rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true @@ -397,7 +397,7 @@ ) } } - + // 编辑判断上限下限目标值是否必填 if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsCapping) { rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true @@ -425,17 +425,17 @@ 设置采样数量,默认第一个包装采样数量<总数量,显示数量字段,第二个包装和剩下的总数量对比,以此类推, 第一个包装采样数量>总数量 则显示总数量 */ - + for (let i = 0; i < data.value.packageList.length; i++) { - if(data.value.packageList[i].sampleAmount==null){ - if (allSamplePieceSize.value > data.value.packageList[i].amount) { - data.value.packageList[i].sampleAmount = data.value.packageList[i].amount - allSamplePieceSize.value = parseFloat((allSamplePieceSize.value - data.value.packageList[i].amount).toFixed(2)) - } else { - data.value.packageList[i].sampleAmount = allSamplePieceSize.value - allSamplePieceSize.value = 0 - // return; - } + if (data.value.packageList[i].sampleAmount == null) { + if (allSamplePieceSize.value > data.value.packageList[i].amount) { + data.value.packageList[i].sampleAmount = data.value.packageList[i].amount + allSamplePieceSize.value = parseFloat((allSamplePieceSize.value - data.value.packageList[i].amount).toFixed(2)) + } else { + data.value.packageList[i].sampleAmount = allSamplePieceSize.value + allSamplePieceSize.value = 0 + // return; + } } } // data.value.packageList.forEach(item=>{ @@ -604,14 +604,11 @@ let numberList = []//判断合格数量和不合格数量之和是否等于主表数量 let parseFloatList = []//判断合格数量和不合格数量是否是整数 data.value.subList.forEach((item, index) => { - - console.log("woxianlai") - console.log(item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList) if (item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 1) { arrBol.push( item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some( (cur, key) => { - return cur.qualifiedQuantity==='' || cur.unqualifiedQuantity==='' + return cur.qualifiedQuantity === '' || cur.unqualifiedQuantity === '' } ) ) @@ -657,8 +654,6 @@ ) } }) - console.log("wolaile") - console.log(arrBol) let isEmpty1 = arrBol.some(item => item == true) let isEmptyNumberList = numberList.some(item => item == true) let isParseFloat = parseFloatList.some(item => item == true) @@ -732,7 +727,7 @@ arrBol.push( item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some( (cur, key) => { - return !cur.qualifiedQuantity || !cur.unqualifiedQuantity + return cur.qualifiedQuantity === '' || cur.unqualifiedQuantity === '' } ) ) diff --git a/src/views/qms/inspectionJob/index.vue b/src/views/qms/inspectionJob/index.vue index dcc7d81b3..3566e702d 100644 --- a/src/views/qms/inspectionJob/index.vue +++ b/src/views/qms/inspectionJob/index.vue @@ -159,6 +159,15 @@ return true } } + + // 根据状态返回该按钮是否显示 + const isShowMainButton2 = (row, val) => { + if (val.indexOf(row.isStaging) > -1) { + return false + } else { + return true + } + } // 列表-操作按钮 const butttondata = (row) => { @@ -167,6 +176,7 @@ defaultButtons.mainListJobCloBtn({hide:isShowMainButton(row,['1']),hasPermi:'qms:inspection-job-main:close'}), // 关闭 defaultButtons.mainListJobAbaBtn({hide:isShowMainButton(row,['2']),hasPermi:'qms:inspection-job-main:abandon'}), // 放弃 defaultButtons.mainListJobExeBtn({hide:isShowMainButton(row,['2']),hasPermi:'qms:inspection-job-main:execute'}), // 执行 + defaultButtons.mainListOrderPubBtn({hide:isShowMainButton2(row,['TRUE']),hasPermi:'qms:inspection-job-main:execute'}), // 发布 defaultButtons.mainListPackageBtn(null), // 包装 ] } @@ -185,6 +195,8 @@ const list = ref([]) handleAbandon(row.id) } else if (val == 'mainJobClo') { // 关闭 handleClose(row.id) + } else if (val == 'mainOrderPub') { // 发布 + handleRelease(row.id) } else if (val == 'mainJobAcc') { // 承接 handleAccept(row.id) } @@ -220,6 +232,18 @@ const list = ref([]) await getList() } catch { } } + /** 发布按钮操作 */ + const handleRelease = async (id : number) => { + try { + // 发布的二次确认 + await message.confirm('确认发布吗?') + // 发起发布 + await InspectionJobMainApi.releaseInspectionJobMain(id) + message.success('发布成功!') + // 刷新列表 + await getList() + } catch { } + } // 承接 const handleAccept = async (id : number) => { try {