|
|
@@ -99,6 +99,7 @@ interface FormOriginal {
|
|
|
auditStatus: number
|
|
|
|
|
|
nextPlan: string
|
|
|
+ malfunction: string
|
|
|
location: string
|
|
|
}
|
|
|
|
|
|
@@ -148,6 +149,7 @@ const FORM_KEYS: (keyof FormOriginal)[] = [
|
|
|
'otherNptReason',
|
|
|
'auditStatus',
|
|
|
'nextPlan',
|
|
|
+ 'malfunction',
|
|
|
'location'
|
|
|
]
|
|
|
|
|
|
@@ -321,6 +323,15 @@ const validateOtherReason = (_rule: any, value: any, callback: any) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const validateMalfunction = (_rule: any, value: any, callback: any) => {
|
|
|
+ const accidentTime = Number(form.value.accidentTime || 0)
|
|
|
+ if (accidentTime > 0 && !String(value || '').trim()) {
|
|
|
+ callback(new Error('工程质量大于0时,故障情况必填'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const validateLastCurrentDepth = (_rule: any, value: any, callback: any) => {
|
|
|
if (value && value < (form.value.lastCurrentDepth ?? 0)) {
|
|
|
callback(new Error(`当前深度需大于等于上一次填报深度 ${form.value.lastCurrentDepth}`))
|
|
|
@@ -352,6 +363,7 @@ const rules = reactive<FormRules>({
|
|
|
{ validator: validateTotalTime(), trigger: ['blur', 'change'] }
|
|
|
],
|
|
|
otherProductionTime: [{ validator: validateTotalTime(), trigger: ['blur', 'change'] }],
|
|
|
+ malfunction: [{ validator: validateMalfunction, trigger: ['blur', 'change'] }],
|
|
|
otherNptReason: [{ validator: validateOtherReason, trigger: ['blur', 'change'] }]
|
|
|
})
|
|
|
|
|
|
@@ -383,6 +395,17 @@ watch(
|
|
|
)
|
|
|
|
|
|
// --- 提交 ---
|
|
|
+watch(
|
|
|
+ () => form.value.accidentTime,
|
|
|
+ () => {
|
|
|
+ if (!isMainFieldDisabled.value) {
|
|
|
+ nextTick(() => {
|
|
|
+ formRef.value?.validateField('malfunction')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
const submitForm = async () => {
|
|
|
if (!formRef.value) return
|
|
|
|
|
|
@@ -884,6 +907,16 @@ const inputCurrentDepth = useDebounceFn(function inputCurrentDepth() {
|
|
|
</el-form-item>
|
|
|
|
|
|
<!-- 时间信息 -->
|
|
|
+ <el-form-item class="col-span-2" label="故障情况" prop="malfunction">
|
|
|
+ <el-input
|
|
|
+ v-model="form.malfunction"
|
|
|
+ type="textarea"
|
|
|
+ autosize
|
|
|
+ maxlength="1000"
|
|
|
+ placeholder="请输入故障情况"
|
|
|
+ :disabled="isMainFieldDisabled" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<div class="col-span-2 flex items-center gap-2 mt-4">
|
|
|
<div class="bg-[var(--el-color-primary)] w-1 h-5 rounded-full"></div>
|
|
|
<div class="text-lg font-medium text-[var(--el-text-color-primary)]"
|