瀏覽代碼

故障类型

yanghao 3 周之前
父節點
當前提交
3e778e12d4
共有 2 個文件被更改,包括 9 次插入15 次删除
  1. 5 11
      src/views/pms/failure/IotFailureReportForm.vue
  2. 4 4
      src/views/pms/failure/index.vue

+ 5 - 11
src/views/pms/failure/IotFailureReportForm.vue

@@ -52,8 +52,8 @@
                 prop="typeDesc"
                 :rules="typeDescRule">
                 <el-input
-                  type="textarea"
                   v-model="formData.typeDesc"
+                  type="textarea"
                   placeholder="请输入其他故障描述"
                   :disabled="disabled"
                   class="form-control" />
@@ -79,15 +79,6 @@
                   @clear="handleClear" />
               </el-form-item>
             </el-col>
-            <el-col :xs="24" :sm="12">
-              <el-form-item :label="t('faultForm.faultySystem')" prop="failureSystem">
-                <el-input
-                  v-model="formData.failureSystem"
-                  :placeholder="t('faultForm.faultySystemHolder')"
-                  :disabled="disabled"
-                  class="form-control" />
-              </el-form-item>
-            </el-col>
             <el-col :xs="24" :sm="12">
               <el-form-item :label="t('faultForm.failureTime')" prop="failureTime">
                 <el-date-picker
@@ -384,7 +375,7 @@ const approvalRule = [{ required: true, message: '审批人不能为空', trigge
 const formRef = ref() // 表单 Ref
 const disabled = ref(false)
 /** 打开弹窗 */
-const open = async (type: string, id?: number, disable?: boolean) => {
+const open = async (type: string, id?: number, disable?: boolean, fallbackData?: Partial<IotFailureReportVO>) => {
   disabled.value = disable
   dialogVisible.value = true
   dialogTitle.value = t('action.' + type)
@@ -397,6 +388,9 @@ const open = async (type: string, id?: number, disable?: boolean) => {
     formLoading.value = true
     try {
       formData.value = await IotFailureReportApi.getIotFailureReport(id)
+      if (formData.value.failureType === 'other' && formData.value.typeDesc == null) {
+        formData.value.typeDesc = fallbackData?.typeDesc ?? ''
+      }
     } finally {
       formLoading.value = false
     }

+ 4 - 4
src/views/pms/failure/index.vue

@@ -207,7 +207,7 @@
                   <el-button
                     link
                     type="primary"
-                    @click="openForm('detail', scope.row.id, true)"
+                    @click="openForm('detail', scope.row.id, true, scope.row)"
                     v-hasPermi="['rq:iot-failure-report:query']">
                     {{ t('fault.view') }}
                   </el-button>
@@ -215,7 +215,7 @@
                     link
                     v-if="scope.row.auditStatus === '30'"
                     type="primary"
-                    @click="openForm('update', scope.row.id, false)"
+                    @click="openForm('update', scope.row.id, false, scope.row)"
                     v-hasPermi="['rq:iot-failure-report:update']">
                     {{ t('fault.edit') }}
                   </el-button>
@@ -344,8 +344,8 @@ const handleCurrentChange = (val: number) => {
 
 /** 添加/修改操作 */
 const formRef = ref()
-const openForm = (type: string, id?: number, disable?: boolean) => {
-  formRef.value.open(type, id, disable)
+const openForm = (type: string, id?: number, disable?: boolean, row?: any) => {
+  formRef.value.open(type, id, disable, row)
 }
 
 /** 删除按钮操作 */