|
|
@@ -135,7 +135,7 @@
|
|
|
'.fillContent'
|
|
|
"
|
|
|
label-position="top"
|
|
|
- :rules="rules[attrItem.description]">
|
|
|
+ :rules="getAttrRules(attrItem)">
|
|
|
<div v-if="fillStatus === '1'">
|
|
|
<el-select
|
|
|
disabled
|
|
|
@@ -691,6 +691,25 @@ const validateOtherReason = (_rule: any, value: any, callback: any) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const validateFaultSituation = (_rule: any, value: any, callback: any) => {
|
|
|
+ if (!['ry', 'rh'].includes(companyName.value)) {
|
|
|
+ callback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const engineeringQuality = Number(
|
|
|
+ attrList.value.find((item) => item.name === '工程质量H')?.fillContent || 0
|
|
|
+ )
|
|
|
+ const hasFaultSituation = value !== undefined && value !== null && String(value).trim() !== ''
|
|
|
+
|
|
|
+ if (engineeringQuality > 0 && !hasFaultSituation) {
|
|
|
+ callback(new Error('工程质量H大于0时,故障情况必填'))
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ callback()
|
|
|
+}
|
|
|
+
|
|
|
const rules = reactive<FormRules>({
|
|
|
dailyInjectGasTime: [
|
|
|
{ required: true, message: '请输入当日运转时间' },
|
|
|
@@ -738,6 +757,22 @@ const rules = reactive<FormRules>({
|
|
|
otherNptReason: [{ validator: validateOtherReason }]
|
|
|
})
|
|
|
|
|
|
+const getAttrRules = (attrItem: any) => {
|
|
|
+ const baseRules = rules[attrItem.description]
|
|
|
+
|
|
|
+ if (attrItem.name !== '故障情况') {
|
|
|
+ return baseRules
|
|
|
+ }
|
|
|
+
|
|
|
+ const normalizedRules = Array.isArray(baseRules) ? [...baseRules] : baseRules ? [baseRules] : []
|
|
|
+ normalizedRules.push({
|
|
|
+ validator: validateFaultSituation,
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ })
|
|
|
+
|
|
|
+ return normalizedRules
|
|
|
+}
|
|
|
+
|
|
|
const totalValidatorComputed = computed(() => {
|
|
|
if (attrList.value.some((item) => item.description === 'dailyInjectGasTime')) {
|
|
|
return rhValidateTotalTime
|