Ver Fonte

瑞恒日报

yanghao há 1 semana atrás
pai
commit
184d8066ca
2 ficheiros alterados com 34 adições e 1 exclusões
  1. 1 1
      .env.local
  2. 33 0
      src/views/pms/iotrydailyreport/ry-form.vue

+ 1 - 1
.env.local

@@ -4,7 +4,7 @@ NODE_ENV=development
 VITE_DEV=true
 
 # 请求路径  http://192.168.188.60:48080  https://iot.deepoil.cc:5443  http://172.26.0.56:48080  http://192.168.188.198:48080
-VITE_BASE_URL='http://192.168.188.86:48080'
+VITE_BASE_URL='https://iot.deepoil.cc:5443'
 
 # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务
 VITE_UPLOAD_TYPE=server

+ 33 - 0
src/views/pms/iotrydailyreport/ry-form.vue

@@ -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)]"