|
|
@ -1,13 +1,17 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<Dialog :title="dialogTitle" v-model="dialogVisible" :width="dialogWidth" :close-on-click-modal="false" :vLoading="formLoading"> |
|
|
|
<Dialog :title="dialogTitle" v-model="dialogVisible" :width="dialogWidth" :close-on-click-modal="false" |
|
|
|
:vLoading="formLoading"> |
|
|
|
<div style="max-height: 80vh; overflow-y: auto; padding: 0px 20px"> |
|
|
|
<Form ref="formMainRef" :rules="rules" :schema="formSchema" :is-col="true" @opensearchTable="opensearchTable" /> |
|
|
|
<div class="small-title">包装列表</div> |
|
|
|
<div style="border:1px solid #dedede;margin-bottom:20px;display: flex;"> |
|
|
|
<TableForm ref="tableFormRef" style="width:100%;" :maxHeight = "490" :tableFields="tableAllSchemas.tableFormColumns" :tableFormRules="tableFormRules" :tableData="data.packageList" :isShowButton="false" :isShowReduceButton="false" /> |
|
|
|
<TableForm ref="tableFormRef" style="width:100%;" :maxHeight="490" |
|
|
|
:tableFields="tableAllSchemas.tableFormColumns" :tableFormRules="tableFormRules" |
|
|
|
:tableData="data.packageList" :isShowButton="false" :isShowReduceButton="false" /> |
|
|
|
</div> |
|
|
|
<el-tabs v-model="editableTabsValue" class="demo-tabs" @edit="handleTabsEdit" type="border-card" tab-position="left" :stretch="false"> |
|
|
|
<el-tabs v-model="editableTabsValue" class="demo-tabs" @edit="handleTabsEdit" type="border-card" |
|
|
|
tab-position="left" :stretch="false"> |
|
|
|
<el-tab-pane v-for="item in data.subList" :key="item.name" :label="item.processDescribe" :name="item.name"> |
|
|
|
<div class="small-title">检验工序</div> |
|
|
|
<el-form :model="item" label-width="auto" :rules="rules" ref="formProcessRef"> |
|
|
@ -39,7 +43,8 @@ |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="编码"> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.number" placeholder="根据系统生成" :disabled="true" /> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.number" placeholder="根据系统生成" |
|
|
|
:disabled="true" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
@ -50,21 +55,24 @@ |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="检验方法" prop="inspectionJobCharacteristicsUpdateReqVO.inspectionMethodCode"> |
|
|
|
<div style="display: flex; width: 100%"> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.inspectionMethodName" disabled placeholder="请选择检验方法" /> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.inspectionMethodName" disabled |
|
|
|
placeholder="请选择检验方法" /> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="采样过程编码" prop="inspectionJobCharacteristicsUpdateReqVO.samplingProcessCode"> |
|
|
|
<div style="display: flex; width: 100%"> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.samplingProcessName" disabled placeholder="请选择采样过程编码" /> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.samplingProcessName" disabled |
|
|
|
placeholder="请选择采样过程编码" /> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="样品份数" prop="inspectionJobCharacteristicsUpdateReqVO.sampleQty"> |
|
|
|
<div style="display: flex; width: 100%"> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.sampleQty" disabled placeholder="请输入样品份数" /> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.sampleQty" disabled |
|
|
|
placeholder="请输入样品份数" /> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
@ -72,7 +80,8 @@ |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="每份样品量" prop="inspectionJobCharacteristicsUpdateReqVO.samplePieceSize"> |
|
|
|
<div style="display: flex; width: 100%"> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.samplePieceSize" disabled placeholder="请输入样品份数" /> |
|
|
|
<el-input v-model="item.inspectionJobCharacteristicsUpdateReqVO.samplePieceSize" disabled |
|
|
|
placeholder="请输入样品份数" /> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
@ -83,37 +92,47 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="结果录入方式" prop="inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod"> |
|
|
|
<el-select v-model="item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod" placeholder="请选择结果录入方式" @change="resultEntryMethodChange($event, item)" disabled> |
|
|
|
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY)" :key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
<el-select v-model="item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod" |
|
|
|
placeholder="请选择结果录入方式" @change="resultEntryMethodChange($event, item)" disabled> |
|
|
|
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY)" |
|
|
|
:key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="特征类型" prop="inspectionJobCharacteristicsUpdateReqVO.featureType"> |
|
|
|
<el-select v-model="item.inspectionJobCharacteristicsUpdateReqVO.featureType" placeholder="请选择特征类型" @change="changeFeatureType" disabled> |
|
|
|
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE)" :key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
<el-select v-model="item.inspectionJobCharacteristicsUpdateReqVO.featureType" placeholder="请选择特征类型" |
|
|
|
@change="changeFeatureType" disabled> |
|
|
|
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE)" |
|
|
|
:key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="开始时间" prop="inspectionJobCharacteristicsUpdateReqVO.inspectionStartTime"> |
|
|
|
<el-date-picker v-model="item.inspectionJobCharacteristicsUpdateReqVO.inspectionStartTime" type="datetime" placeholder="请选择开始时间" style="width: 100%" value-format="x" /> |
|
|
|
<el-date-picker v-model="item.inspectionJobCharacteristicsUpdateReqVO.inspectionStartTime" |
|
|
|
type="datetime" placeholder="请选择开始时间" style="width: 100%" value-format="x" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="结束时间" prop="inspectionJobCharacteristicsUpdateReqVO.inspectionEndTime"> |
|
|
|
<el-date-picker v-model="item.inspectionJobCharacteristicsUpdateReqVO.inspectionEndTime" type="datetime" placeholder="请选择结束时间" style="width: 100%" value-format="x" /> |
|
|
|
<el-date-picker v-model="item.inspectionJobCharacteristicsUpdateReqVO.inspectionEndTime" |
|
|
|
type="datetime" placeholder="请选择结束时间" style="width: 100%" value-format="x" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 手动评估的时候显示 --> |
|
|
|
<el-col :span="12" v-if="item.samplingProcessRespVO.evaluationMode == 1"> |
|
|
|
<el-form-item label="评估代码" required> |
|
|
|
<el-select v-model="item.inspectionJobCharacteristicsUpdateReqVO.estimateCode" placeholder="请选择评估代码" @change="changeFeatureType"> |
|
|
|
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.EVALUATION_CODE)" :key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
<el-select v-model="item.inspectionJobCharacteristicsUpdateReqVO.estimateCode" placeholder="请选择评估代码" |
|
|
|
@change="changeFeatureType"> |
|
|
|
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.EVALUATION_CODE)" :key="dict.value" |
|
|
|
:label="dict.label" :value="dict.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="24" v-for="(cur, i) in item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList" :key="i" style="border: 1px solid #dedede; border-radius: 4px; padding-top: 16px; margin-bottom: 10px;"> |
|
|
|
<el-col :span="24" |
|
|
|
v-for="(cur, i) in item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList" :key="i" |
|
|
|
style="border: 1px solid #dedede; border-radius: 4px; padding-top: 16px; margin-bottom: 10px;"> |
|
|
|
<el-row> |
|
|
|
<!-- 汇总录入的时候显示 --> |
|
|
|
<el-col :span="12" v-if="item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 1"> |
|
|
@ -133,8 +152,10 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="12" v-if="item.inspectionJobCharacteristicsUpdateReqVO.featureType == '1'"> |
|
|
|
<el-form-item label="选定集" required> |
|
|
|
<el-select v-model="cur.qualitativeCode" placeholder="请选择选定集" @change="changeQualitativeCode($event, item, cur)"> |
|
|
|
<el-option v-for="dict in item.selectedProjectRespVOList" :key="dict.dictionaryValue" :label="dict.dictionaryLabel" :value="dict.dictionaryValue" /> |
|
|
|
<el-select v-model="cur.qualitativeCode" placeholder="请选择选定集" |
|
|
|
@change="changeQualitativeCode($event, item, cur)"> |
|
|
|
<el-option v-for="dict in item.selectedProjectRespVOList" :key="dict.dictionaryValue" |
|
|
|
:label="dict.dictionaryLabel" :value="dict.dictionaryValue" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
@ -401,6 +422,7 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any |
|
|
|
设置采样数量,默认第一个包装采样数量<总数量,显示数量字段,第二个包装和剩下的总数量对比,以此类推, |
|
|
|
第一个包装采样数量>总数量 则显示总数量 |
|
|
|
*/ |
|
|
|
|
|
|
|
for (let i = 0; i < data.value.packageList.length; i++) { |
|
|
|
if (allSamplePieceSize.value > data.value.packageList[i].amount) { |
|
|
|
data.value.packageList[i].sampleAmount = data.value.packageList[i].amount |
|
|
@ -522,6 +544,10 @@ const buttonBaseClick =async(val) => { |
|
|
|
// await InspectionJobMainApi.abandonInspectionJobMain(data.value.id) |
|
|
|
dialogVisible.value = false |
|
|
|
} |
|
|
|
// 暂存 |
|
|
|
else if (val == 'staging') { |
|
|
|
staging() |
|
|
|
} |
|
|
|
} |
|
|
|
// 传递给父类 |
|
|
|
const emit = defineEmits(['submitForm', 'searchTableSuccess']) |
|
|
@ -661,12 +687,133 @@ const submitForm = async () => { |
|
|
|
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); |
|
|
|
} catch { |
|
|
|
console.log(111) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 弹窗按钮 */ |
|
|
|
let Butttondata : any = [] |
|
|
|
if (props.footButttondata) { |
|
|
|
Butttondata = props.footButttondata |
|
|
|
} else { |
|
|
|
Butttondata = [ |
|
|
|
defaultButtons.formStagingBtn(null), // 暂存 |
|
|
|
defaultButtons.formSaveBtn(null), // 保存 |
|
|
|
defaultButtons.formCloseBtn(null) // 关闭 |
|
|
|
] |
|
|
@ -854,6 +1001,7 @@ const changeQualitativeCode = (e, item, cur) => { |
|
|
|
min-height: 700px !important; |
|
|
|
min-width: 150px !important; |
|
|
|
} |
|
|
|
|
|
|
|
.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left { |
|
|
|
min-width: 120px !important; |
|
|
|
} |
|
|
|