|
|
@@ -100,6 +100,7 @@ interface FormOriginal {
|
|
|
opinion: string
|
|
|
|
|
|
auditStatus: number
|
|
|
+ malfunction: string
|
|
|
location: string
|
|
|
daySupervisors: string
|
|
|
nightSupervisors: string
|
|
|
@@ -149,6 +150,7 @@ const FORM_KEYS: (keyof FormOriginal)[] = [
|
|
|
'otherNptTime',
|
|
|
'otherNptReason',
|
|
|
'auditStatus',
|
|
|
+ 'malfunction',
|
|
|
'location',
|
|
|
'daySupervisors',
|
|
|
'nightSupervisors'
|
|
|
@@ -329,6 +331,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 rules = reactive<FormRules>({
|
|
|
repairStatus: [{ required: true, message: '请选择施工状态', trigger: ['change', 'blur'] }],
|
|
|
daySupervisors: [{ required: true, message: '请输入白班跟班干部', trigger: ['change', 'blur'] }],
|
|
|
@@ -355,6 +366,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'] }]
|
|
|
})
|
|
|
|
|
|
@@ -382,6 +394,17 @@ watch(
|
|
|
)
|
|
|
|
|
|
// --- 提交 ---
|
|
|
+watch(
|
|
|
+ () => form.value.accidentTime,
|
|
|
+ () => {
|
|
|
+ if (!isMainFieldDisabled.value) {
|
|
|
+ nextTick(() => {
|
|
|
+ formRef.value?.validateField('malfunction')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
const submitForm = async () => {
|
|
|
if (!formRef.value) return
|
|
|
|
|
|
@@ -869,6 +892,16 @@ const allocatedTimeDisabled = computed(() => {
|
|
|
</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)]"
|