Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into master_hella

master_hella_20240701
songguoqiang 5 months ago
parent
commit
cbe0c9973a
  1. 7
      src/components/BasicForm/src/BasicForm.vue
  2. 5
      src/components/Dialog/src/Dialog.vue
  3. 248
      src/views/qms/inspectionScheme/addForm.vue
  4. 7
      src/views/qms/inspectionTemplate/addForm.vue

7
src/components/BasicForm/src/BasicForm.vue

@ -5,10 +5,11 @@
:width="dialogWidth" :width="dialogWidth"
:close-on-click-modal="false" :close-on-click-modal="false"
:vLoading="formLoading" :vLoading="formLoading"
@updateFullscreen="updateFullscreen"
> >
<div <div
style="max-height: 60vh;overflow-y: auto;"> style="overflow-y: auto;" :style="{'max-height':formHeight}">
<Form <Form
ref="formRef" ref="formRef"
:rules="rules" :rules="rules"
@ -329,6 +330,10 @@ if (props.basicFormWidth) {
} else { } else {
dialogWidth.value = props.isBusiness ? '60%' : '40%' dialogWidth.value = props.isBusiness ? '60%' : '40%'
} }
const formHeight = ref('60vh')
const updateFullscreen = (isFullscreen)=>{
formHeight.value = isFullscreen?'auto':'60vh'
}
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //

5
src/components/Dialog/src/Dialog.vue

@ -3,6 +3,10 @@ import { propTypes } from '@/utils/propTypes'
import { isNumber } from '@/utils/is' import { isNumber } from '@/utils/is'
defineOptions({ name: 'Dialog' }) defineOptions({ name: 'Dialog' })
//
const emit = defineEmits([
'updateFullscreen'
])
const slots = useSlots() const slots = useSlots()
const props = defineProps({ const props = defineProps({
@ -32,6 +36,7 @@ const isFullscreen = ref(false)
const toggleFull = () => { const toggleFull = () => {
isFullscreen.value = !unref(isFullscreen) isFullscreen.value = !unref(isFullscreen)
emit('updateFullscreen',isFullscreen.value)
} }
const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight) const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight)

248
src/views/qms/inspectionScheme/addForm.vue

@ -169,7 +169,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> --> </el-col> -->
<el-col :span="12" v-if="isShowField !=0"> <el-col :span="12" v-if="isShowField != 0">
<el-form-item label="aql" prop="aql"> <el-form-item label="aql" prop="aql">
<el-select v-model="data.aql" placeholder="请选择aql"> <el-select v-model="data.aql" placeholder="请选择aql">
<el-option <el-option
@ -181,7 +181,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="isShowField!=0"> <el-col :span="12" v-if="isShowField != 0">
<el-form-item label="检验水平" prop="inspectionLevel"> <el-form-item label="检验水平" prop="inspectionLevel">
<el-select v-model="data.inspectionLevel" placeholder="请选择检验水平"> <el-select v-model="data.inspectionLevel" placeholder="请选择检验水平">
<el-option <el-option
@ -195,7 +195,11 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="每份样品量" prop="samplePieceSize"> <el-form-item label="每份样品量" prop="samplePieceSize">
<el-input v-model="data.samplePieceSize" placeholder="请填写每份样品量" :disabled='isSamplePieceSizeDisabled'/> <el-input
v-model="data.samplePieceSize"
placeholder="请填写每份样品量"
:disabled="isSamplePieceSizeDisabled"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -229,6 +233,7 @@
</el-form> </el-form>
<el-tabs <el-tabs
v-model="editableTabsValue" v-model="editableTabsValue"
editable
class="demo-tabs" class="demo-tabs"
@edit="handleTabsEdit" @edit="handleTabsEdit"
type="border-card" type="border-card"
@ -447,7 +452,7 @@
<el-select <el-select
v-model="item.inspectionCharacteristicsBaseVO.featureType" v-model="item.inspectionCharacteristicsBaseVO.featureType"
placeholder="请选择特征类型" placeholder="请选择特征类型"
@change="changeFeatureType($event,item)" @change="changeFeatureType($event, item)"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
> >
<el-option <el-option
@ -462,10 +467,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"> <el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-form-item <el-form-item label="计量单位" prop="inspectionCharacteristicsBaseVO.quantifyUom">
label="计量单位"
prop="inspectionCharacteristicsBaseVO.quantifyUom"
>
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" v-model="item.inspectionCharacteristicsBaseVO.quantifyUom"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
@ -490,7 +492,7 @@
> >
<el-switch <el-switch
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping"
@change="changeIsCapping($event,item)" @change="changeIsCapping($event, item)"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/> />
</el-form-item> </el-form-item>
@ -502,7 +504,7 @@
> >
<el-switch <el-switch
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
@change="changeLowlimit($event,item)" @change="changeLowlimit($event, item)"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/> />
</el-form-item> </el-form-item>
@ -514,12 +516,18 @@
> >
<el-switch <el-switch
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget" v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget"
@change="changeIsTarget($event,item)" @change="changeIsTarget($event, item)"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO. quantifyIsCapping"> <el-col
:span="12"
v-if="
item.inspectionCharacteristicsBaseVO.featureType == 0 &&
item.inspectionCharacteristicsBaseVO.quantifyIsCapping
"
>
<el-form-item <el-form-item
label="上限值" label="上限值"
prop="inspectionCharacteristicsBaseVO.quantifyCapping" prop="inspectionCharacteristicsBaseVO.quantifyCapping"
@ -527,11 +535,18 @@
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
type="number"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit"> <el-col
:span="12"
v-if="
item.inspectionCharacteristicsBaseVO.featureType == 0 &&
item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit
"
>
<el-form-item <el-form-item
label="下限值" label="下限值"
prop="inspectionCharacteristicsBaseVO.quantifyLowlimit" prop="inspectionCharacteristicsBaseVO.quantifyLowlimit"
@ -539,11 +554,18 @@
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
type="number"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO. quantifyIsTarget"> <el-col
:span="12"
v-if="
item.inspectionCharacteristicsBaseVO.featureType == 0 &&
item.inspectionCharacteristicsBaseVO.quantifyIsTarget
"
>
<el-form-item <el-form-item
label="目标值" label="目标值"
prop="inspectionCharacteristicsBaseVO.quantifyTarget" prop="inspectionCharacteristicsBaseVO.quantifyTarget"
@ -551,16 +573,15 @@
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
type="number"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 1"> <el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 1">
<el-form-item <el-form-item
label="选定集" label="选定集"
prop="inspectionCharacteristicsBaseVO.quantifyQuantifyCode" prop="inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
> >
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input <el-input
@ -648,7 +669,7 @@ import * as DynamicRuleApi from '@/api/qms/dynamicRule' //动态修改规则
import { DynamicRule } from '@/views/qms/dynamicRule/dynamicRule.data' // import { DynamicRule } from '@/views/qms/dynamicRule/dynamicRule.data' //
import * as SelectedSetApi from '@/api/qms/selectedSet' // import * as SelectedSetApi from '@/api/qms/selectedSet' //
import { SelectedSet } from '@/views/qms/selectedSet/selectedSet.data' // import { SelectedSet } from '@/views/qms/selectedSet/selectedSet.data' //
import {validateTwoNum} from '@/utils/validator' import { validateInteger, validateMaxNumber5, validateTwoNum } from '@/utils/validator'
const message = useMessage() // const message = useMessage() //
@ -698,7 +719,7 @@ const data = ref({
code: '', code: '',
itemCode: '', itemCode: '',
version: '', version: '',
inspectionType:'', inspectionType: '',
programmeTemplateCode: '', programmeTemplateCode: '',
splitRule: '', splitRule: '',
aql: '', aql: '',
@ -707,9 +728,9 @@ const data = ref({
expirationDate: '', expirationDate: '',
available: 'TRUE', available: 'TRUE',
dynamicUpdateCode: '', dynamicUpdateCode: '',
description:'', description: '',
samplePieceSize:'', samplePieceSize: '',
uom:'', uom: '',
process: [] process: []
}) })
@ -730,20 +751,21 @@ const rules = ref({
programmeTemplateCode: [ programmeTemplateCode: [
{ required: true, message: '请选择检验模板', trigger: ['blur', 'change'] } { required: true, message: '请选择检验模板', trigger: ['blur', 'change'] }
], ],
description: [ description: [{ required: true, message: '请选择描述', trigger: 'blur' }],
{ required: true, message: '请选择描述', trigger: 'blur' }
],
// splitRule: [{ required: true, message: '', trigger: ['blur', 'change'] }], // splitRule: [{ required: true, message: '', trigger: ['blur', 'change'] }],
aql: [{ required: true, message: '请选择aql', trigger: ['blur', 'change'] }], aql: [{ required: true, message: '请选择aql', trigger: ['blur', 'change'] }],
inspectionLevel: [ inspectionLevel: [{ required: true, message: '请选择检验水平', trigger: ['blur', 'change'] }],
{ required: true, message: '请选择检验水平', trigger: ['blur', 'change'] },
],
samplePieceSize: [ samplePieceSize: [
{ required: true, message: '请输入每份样品量', trigger: ['blur', 'change']}, { required: true, message: '请输入每份样品量', trigger: ['blur', 'change'] },
{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}, { validator: validateTwoNum, message: '小数点后最多2位', trigger: 'blur' }
], ],
effectiveDate: [{ required: true, message: '请选择生效时间', trigger: ['blur', 'change'] }], effectiveDate: [{ required: true, message: '请选择生效时间', trigger: ['blur', 'change'] }],
expirationDate: [{ required: true, message: '请选择失效时间', trigger: ['blur', 'change'] }], expirationDate: [{ required: true, message: '请选择失效时间', trigger: ['blur', 'change'] }],
sequenceCode: [
{ required: true, message: '请填写顺序号', trigger: 'blur' },
{ validator: validateInteger, message: '请输入正确的整数', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.description': [ 'inspectionCharacteristicsBaseVO.description': [
{ required: true, message: '请填写描述', trigger: ['blur', 'change'] } { required: true, message: '请填写描述', trigger: ['blur', 'change'] }
], ],
@ -766,7 +788,7 @@ const rules = ref({
{ required: true, message: '请输入目标值', trigger: 'blur' } { required: true, message: '请输入目标值', trigger: 'blur' }
], ],
'inspectionCharacteristicsBaseVO.quantifyCapping': [ 'inspectionCharacteristicsBaseVO.quantifyCapping': [
{ required: true, message: '请输入上限值', trigger: ['blur','change'] } { required: true, message: '请输入上限值', trigger: ['blur', 'change'] }
], ],
'inspectionCharacteristicsBaseVO.quantifyLowlimit': [ 'inspectionCharacteristicsBaseVO.quantifyLowlimit': [
{ required: true, message: '请输入下限值', trigger: 'blur' } { required: true, message: '请输入下限值', trigger: 'blur' }
@ -775,13 +797,15 @@ const rules = ref({
{ required: true, message: '请选择计量单位', trigger: 'blur' } { required: true, message: '请选择计量单位', trigger: 'blur' }
], ],
'inspectionCharacteristicsBaseVO.quantifyDecimal': [ 'inspectionCharacteristicsBaseVO.quantifyDecimal': [
{ required: true, message: '请输入小数位', trigger: 'blur' } { required: true, message: '请输入小数位', trigger: 'blur' },
{ validator: validateInteger, message: '请输入正确的整数', trigger: 'blur' },
{ validator: validateMaxNumber5, message: '不能大于5', trigger: 'blur' }
], ],
'inspectionCharacteristicsBaseVO.quantifyQuantifyCode': [ 'inspectionCharacteristicsBaseVO.quantifyQuantifyCode': [
{ required: true, message: '请输入选定集', trigger: 'blur' } { required: true, message: '请输入选定集', trigger: 'blur' }
] ]
}) })
const isShowField = ref(0)//aql 0 0 const isShowField = ref(0) //aql 0 0
/** 打开弹窗 */ /** 打开弹窗 */
let tabIndex = 1 let tabIndex = 1
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => { const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
@ -792,7 +816,7 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
} }
formType.value = type formType.value = type
isShowField.value=0//isShowField == 0aql isShowField.value = 0 //isShowField == 0aql
if (row) { if (row) {
data.value = JSON.parse(JSON.stringify(row)) data.value = JSON.parse(JSON.stringify(row))
let list = [] let list = []
@ -805,11 +829,14 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
list.forEach((item, index) => { list.forEach((item, index) => {
editableTabsValue.value = index+1 editableTabsValue.value = index + 1
item.name = index + 1 item.name = index + 1
// rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true // rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
// //
if (item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsCapping) { if (
item.inspectionCharacteristicsBaseVO.featureType == 0 &&
item.inspectionCharacteristicsBaseVO.quantifyIsCapping
) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} }
if (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit) { if (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit) {
@ -818,15 +845,15 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
if (item.inspectionCharacteristicsBaseVO.quantifyIsTarget) { if (item.inspectionCharacteristicsBaseVO.quantifyIsTarget) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} }
if(item.inspectionCharacteristicsBaseVO.sampleType == 4){ if (item.inspectionCharacteristicsBaseVO.sampleType == 4) {
isShowField.value+=1//isShowField > 0aql isShowField.value += 1 //isShowField > 0aql
} }
}) })
// aql // aql
if( isShowField.value>0){ if (isShowField.value > 0) {
rules.value.aql[0].required = true rules.value.aql[0].required = true
rules.value.aql[0].required = true rules.value.aql[0].required = true
}else{ } else {
rules.value.aql[0].required = false rules.value.aql[0].required = false
rules.value.aql[0].required = false rules.value.aql[0].required = false
} }
@ -844,10 +871,10 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
effectiveDate: '', effectiveDate: '',
expirationDate: '', expirationDate: '',
available: 'TRUE', available: 'TRUE',
dynamicUpdateCode:'', dynamicUpdateCode: '',
description:"", description: '',
samplePieceSize:"", samplePieceSize: '',
uom:"", uom: '',
process: [] process: []
} }
} }
@ -894,20 +921,20 @@ const buttonBaseClick1 = (val) => {
name: newTabName, name: newTabName,
inspectionCode: '', inspectionCode: '',
sequenceCode: '', sequenceCode: '',
dynamicUpdateCode:'', dynamicUpdateCode: '',
inspectionCharCode: '', inspectionCharCode: '',
inspectionCharacteristicsBaseVO: { inspectionCharacteristicsBaseVO: {
describe: '', describe: '',
inspectionMethodCode: '', inspectionMethodCode: '',
dynamicUpdateCode: '', dynamicUpdateCode: '',
inspectionMethod: '', inspectionMethod: '',
isCanUpdate: '', isCanUpdate: true,
isDestructionInspection: '', isDestructionInspection: '',
resultEntryMethod: '', resultEntryMethod: '',
featureType: '', featureType: '',
quantifyIsCapping: '', quantifyIsCapping: false,
quantifyIsLowlimit: '', quantifyIsLowlimit: false,
quantifyIsTarget: '', quantifyIsTarget: false,
quantifyTarget: '', quantifyTarget: '',
quantifyCapping: '', quantifyCapping: '',
quantifyLowlimit: '', quantifyLowlimit: '',
@ -954,10 +981,29 @@ const validateForm = (formRef) => {
return false return false
}) })
} }
// true \ false
const hasDuplicates = (array) => {
const seen = new Set()
const repeatCode = new Set()
let arr = array.map((item) => parseInt(item.sequenceCode))
arr.forEach((item) => {
if (seen.has(item)) {
repeatCode.add(item)
} else {
seen.add(item)
}
})
const arr1 = Array.from(repeatCode)
if (arr1.length > 0) {
return true
} else {
return false
}
}
const submitForm = async () => { const submitForm = async () => {
try { try {
const aa = await getStrDictOptions(DICT_TYPE.SPLIT_RULES);// const aa = await getStrDictOptions(DICT_TYPE.SPLIT_RULES) //
data.value.splitRule = aa[0].value data.value.splitRule = aa[0].value
const validateForm1 = await validateForm(formProcessRef.value) const validateForm1 = await validateForm(formProcessRef.value)
await formMainRef.value.validate() await formMainRef.value.validate()
@ -965,6 +1011,11 @@ const submitForm = async () => {
message.error(`请添加工序`) message.error(`请添加工序`)
return return
} }
// debugger
if (hasDuplicates(data.value.process)) {
message.error(`检验工序顺序号不能相同`)
return
}
const bol1 = await validateForm(formProcessRef.value) const bol1 = await validateForm(formProcessRef.value)
const bol2 = await validateForm(formFeaturesRef.value) const bol2 = await validateForm(formFeaturesRef.value)
if (!bol1 || !bol2) { if (!bol1 || !bol2) {
@ -984,8 +1035,65 @@ const submitForm = async () => {
message.error(`${str}是否设定上线,是否设定下限,是否是定目标值至少一项为是`) message.error(`${str}是否设定上线,是否设定下限,是否是定目标值至少一项为是`)
return return
} }
// ,,
console.log(data.value.process)
const arr1 = data.value.process.filter(
(item) =>
((item.inspectionCharacteristicsBaseVO.quantifyIsCapping &&
String(item.inspectionCharacteristicsBaseVO.quantifyCapping).split('.')[1]?.length >
Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)) ||
(item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit &&
String(item.inspectionCharacteristicsBaseVO.quantifyLowlimit).split('.')[1]?.length >
Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)) ||
(item.inspectionCharacteristicsBaseVO.quantifyIsTarget &&
String(item.inspectionCharacteristicsBaseVO.quantifyTarget).split('.')[1]?.length >
Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal))) &&
item.inspectionCharacteristicsBaseVO.featureType == 0
)
if (arr1 && arr1.length > 0) {
const str = arr1.map((item) => item.description).join(',')
message.error(`${str}工序上限值,下限值,目标值小数位数不可以大于小数位`)
return
}
//
const arr2 = data.value.process.filter((item) => {
// ,
return (
(item.inspectionCharacteristicsBaseVO.quantifyIsCapping &&
item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit &&
!item.inspectionCharacteristicsBaseVO.quantifyIsTarget &&
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyCapping) <=
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyLowlimit)) ||
//
(item.inspectionCharacteristicsBaseVO.quantifyIsCapping &&
item.inspectionCharacteristicsBaseVO.quantifyIsTarget &&
!item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit &&
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyCapping) <=
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget)) ||
//
(item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit &&
item.inspectionCharacteristicsBaseVO.quantifyIsTarget &&
!item.inspectionCharacteristicsBaseVO.quantifyIsCapping &&
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyLowlimit) >=
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget)) ||
//
(item.inspectionCharacteristicsBaseVO.quantifyIsCapping &&
item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit &&
item.inspectionCharacteristicsBaseVO.quantifyIsTarget &&
(parseFloat(item.inspectionCharacteristicsBaseVO.quantifyCapping) <=
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyLowlimit) ||
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyCapping) <=
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget) ||
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyLowlimit) >=
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget)))
)
})
if (arr2 && arr2.length > 0) {
const str = arr2.map((item) => item.description).join(',')
message.error(`${str}工序上限值应大于目标值大于下限值`)
return
}
if (formType.value == 'create') { if (formType.value == 'create') {
// //
emit('submitForm', formType.value, data.value) emit('submitForm', formType.value, data.value)
} else { } else {
@ -1007,15 +1115,15 @@ if (props.footButttondata) {
] ]
} }
// //
const changeFeatureType = (e,item) => { const changeFeatureType = (e, item) => {
item.inspectionCharacteristicsBaseVO.quantifyIsCapping = false item.inspectionCharacteristicsBaseVO.quantifyIsCapping = false
item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit = false item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit = false
item.inspectionCharacteristicsBaseVO.quantifyIsTarget = false item.inspectionCharacteristicsBaseVO.quantifyIsTarget = false
item.inspectionCharacteristicsBaseVO.quantifyCapping = '' item.inspectionCharacteristicsBaseVO.quantifyCapping = ''
item.inspectionCharacteristicsBaseVO.quantifyLowlimit = '' item.inspectionCharacteristicsBaseVO.quantifyLowlimit = ''
item.inspectionCharacteristicsBaseVO.quantifyTarget= '' item.inspectionCharacteristicsBaseVO.quantifyTarget = ''
item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode= '' item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode = ''
item.inspectionCharacteristicsBaseVO.quantifyQuantifyName= '' item.inspectionCharacteristicsBaseVO.quantifyQuantifyName = ''
console.log(e) console.log(e)
if (e) { if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyQuantifyCode'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyQuantifyCode'][0].required = true
@ -1098,7 +1206,7 @@ const opensearchTable = (
_searchCondition _searchCondition
) )
} }
const isSamplePieceSizeDisabled = ref(false)// const isSamplePieceSizeDisabled = ref(false) //
// //
// val row // val row
const searchTableSuccess = async (formField, searchField, val, type, row) => { const searchTableSuccess = async (formField, searchField, val, type, row) => {
@ -1120,17 +1228,17 @@ const searchTableSuccess = async (formField, searchField, val, type, row) => {
if (formField == 'itemCode') { if (formField == 'itemCode') {
data.value.itemName = val[0].name data.value.itemName = val[0].name
data.value.uom = val[0].uom data.value.uom = val[0].uom
if(data.value.uom == 'EA'){ if (data.value.uom == 'EA') {
data.value.samplePieceSize = 1 data.value.samplePieceSize = 1
isSamplePieceSizeDisabled.value = true isSamplePieceSizeDisabled.value = true
}else{ } else {
data.value.samplePieceSize = '' data.value.samplePieceSize = ''
isSamplePieceSizeDisabled.value = false isSamplePieceSizeDisabled.value = false
} }
} else if (formField == 'inspectionType') { } else if (formField == 'inspectionType') {
data.value.testTypeName = val[0].description data.value.testTypeName = val[0].description
} else if (formField == 'programmeTemplateCode') { } else if (formField == 'programmeTemplateCode') {
isShowField.value=0//isShowField == 0aql isShowField.value = 0 //isShowField == 0aql
data.value.programmeTemplateName = val[0].description data.value.programmeTemplateName = val[0].description
data.value['dynamicUpdateCode'] = val[0].dynamicUpdateCode data.value['dynamicUpdateCode'] = val[0].dynamicUpdateCode
data.value.dynamicUpdateName = val[0].dynamicUpdateName data.value.dynamicUpdateName = val[0].dynamicUpdateName
@ -1139,11 +1247,14 @@ const searchTableSuccess = async (formField, searchField, val, type, row) => {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
list.forEach((item, index) => { list.forEach((item, index) => {
editableTabsValue.value = index+1 editableTabsValue.value = index + 1
item.name = index + 1 item.name = index + 1
// rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true // rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
// //
if (item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsCapping) { if (
item.inspectionCharacteristicsBaseVO.featureType == 0 &&
item.inspectionCharacteristicsBaseVO.quantifyIsCapping
) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} }
if (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit) { if (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit) {
@ -1152,20 +1263,20 @@ const searchTableSuccess = async (formField, searchField, val, type, row) => {
if (item.inspectionCharacteristicsBaseVO.quantifyIsTarget) { if (item.inspectionCharacteristicsBaseVO.quantifyIsTarget) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} }
if(item.inspectionCharacteristicsBaseVO.sampleType == 4){ if (item.inspectionCharacteristicsBaseVO.sampleType == 4) {
isShowField.value+=1//isShowField > 0aql isShowField.value += 1 //isShowField > 0aql
} }
}) })
// aql // aql
if( isShowField.value>0){ if (isShowField.value > 0) {
rules.value.aql[0].required = true rules.value.aql[0].required = true
rules.value.aql[0].required = true rules.value.aql[0].required = true
}else{ } else {
rules.value.aql[0].required = false rules.value.aql[0].required = false
rules.value.aql[0].required = false rules.value.aql[0].required = false
} }
data.value.process = list data.value.process = list
}else if (formField == 'dynamicUpdateCode') { } else if (formField == 'dynamicUpdateCode') {
data.value[formField] = val[0].code data.value[formField] = val[0].code
data.value.dynamicUpdateName = val[0].description data.value.dynamicUpdateName = val[0].description
} }
@ -1174,17 +1285,16 @@ const searchTableSuccess = async (formField, searchField, val, type, row) => {
// emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row) // emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
} }
// //
const changeIsCapping = (e,item) => { const changeIsCapping = (e, item) => {
item.inspectionCharacteristicsBaseVO.quantifyCapping = '' item.inspectionCharacteristicsBaseVO.quantifyCapping = ''
if (e) { if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} else { } else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
} }
} }
// //
const changeLowlimit = (e,item) => { const changeLowlimit = (e, item) => {
item.inspectionCharacteristicsBaseVO.quantifyLowlimit = '' item.inspectionCharacteristicsBaseVO.quantifyLowlimit = ''
if (e) { if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
@ -1193,7 +1303,7 @@ const changeLowlimit = (e,item) => {
} }
} }
// //
const changeIsTarget = (e,item) => { const changeIsTarget = (e, item) => {
item.inspectionCharacteristicsBaseVO.quantifyTarget = '' item.inspectionCharacteristicsBaseVO.quantifyTarget = ''
if (e) { if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true

7
src/views/qms/inspectionTemplate/addForm.vue

@ -297,7 +297,8 @@
prop="inspectionCharacteristicsBaseVO.quantifyDecimal" prop="inspectionCharacteristicsBaseVO.quantifyDecimal"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal" /> <el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal"
type="number"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"> <el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
@ -822,10 +823,6 @@ const submitForm = async () => {
console.log(data.value.process) console.log(data.value.process)
const arr1 = data.value.process.filter( const arr1 = data.value.process.filter(
(item) => (item) =>
// {
// console.log(String(item.inspectionCharacteristicsBaseVO.quantifyCapping).split('.')[1]?.length)
// console.log(Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal))
// }
((item.inspectionCharacteristicsBaseVO.quantifyIsCapping && (String(item.inspectionCharacteristicsBaseVO.quantifyCapping).split('.')[1]?.length>Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)))|| ((item.inspectionCharacteristicsBaseVO.quantifyIsCapping && (String(item.inspectionCharacteristicsBaseVO.quantifyCapping).split('.')[1]?.length>Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)))||
(item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && (String(item.inspectionCharacteristicsBaseVO.quantifyLowlimit).split('.')[1]?.length>Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)))|| (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && (String(item.inspectionCharacteristicsBaseVO.quantifyLowlimit).split('.')[1]?.length>Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)))||
(item.inspectionCharacteristicsBaseVO.quantifyIsTarget && (String(item.inspectionCharacteristicsBaseVO.quantifyTarget).split('.')[1]?.length>Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)))) && (item.inspectionCharacteristicsBaseVO.quantifyIsTarget && (String(item.inspectionCharacteristicsBaseVO.quantifyTarget).split('.')[1]?.length>Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)))) &&

Loading…
Cancel
Save