Преглед изворни кода

Merge branch 'master' of http://1.94.244.160:3000/shuzhihua/pms-iot-vue

Zimo пре 1 дан
родитељ
комит
3aed4f7777
1 измењених фајлова са 25 додато и 0 уклоњено
  1. 25 0
      src/views/pms/iotopeationfill/index1.vue

+ 25 - 0
src/views/pms/iotopeationfill/index1.vue

@@ -738,6 +738,26 @@ const rules = reactive<FormRules>({
   otherNptReason: [{ validator: validateOtherReason }]
 })
 
+const checkFaultSituationBeforeSubmit = async () => {
+  if (!['ry', 'rh'].includes(companyName.value)) {
+    return true
+  }
+
+  const engineeringQuality = Number(
+    attrList.value.find((item) => item.name === '工程质量H')?.fillContent || 0
+  )
+  const faultSituation = attrList.value.find((item) => item.name === '故障情况')?.fillContent
+  const hasFaultSituation =
+    faultSituation !== undefined && faultSituation !== null && String(faultSituation).trim() !== ''
+
+  if (engineeringQuality > 0 && !hasFaultSituation) {
+    await message.alert('非生产时间中工程质量H大于0时,请填写故障情况')
+    return false
+  }
+
+  return true
+}
+
 const totalValidatorComputed = computed(() => {
   if (attrList.value.some((item) => item.description === 'dailyInjectGasTime')) {
     return rhValidateTotalTime
@@ -1035,6 +1055,11 @@ const getFillInfo = async () => {
     const validations = formRef.value.map((form) => form.validate())
     await Promise.all(validations)
 
+    const canSubmit = await checkFaultSituationBeforeSubmit()
+    if (!canSubmit) {
+      return
+    }
+
     const company = await IotOpeationFillApi.getOrgName(route.params.id.toString().split(',')[0])
 
     if (devName != '生产日报') {