Explorar el Código

fix: 更新特种设备和风险管理模块,优化字段类型和表单验证规则;调整附件上传逻辑

sunqijun hace 1 mes
padre
commit
7aff224413

+ 1 - 1
src/api/production-safety/special-equipment.ts

@@ -29,7 +29,7 @@ export interface SpecialEquipment {
   typeName?: string; // 设备种类名称
   registerCode?: string; // 注册代码
   deviceCode?: string; // 设备编码
-  useDepartment?: string; // 使用部门名称
+  useDepartment?: string | number; // 使用部门名称
   responsiblePerson?: string; // 设备责任人姓名
   factoryNo?: string; // 出厂编号
   startUseDate?: string; // 启用日期 yyyy-MM-dd

+ 1 - 1
src/views/production-safety/risk-identification-and-control/hazard-approval-manage/audit.vue

@@ -59,7 +59,7 @@
           <el-table-column label="作业类别" width="180" prop="hazardOperationType" />
           <el-table-column label="申请状态" width="120" prop="statusName" />
           <el-table-column label="申请时间" width="180" prop="createdAt" />
-          <el-table-column label="备注" width="180" prop="remark" />
+          <!-- <el-table-column label="备注" width="180" prop="remark" /> -->
           <el-table-column label="当前节点名称" width="180" prop="nodeDescription" />
           <el-table-column fixed="right" min-width="140" label="操作">
             <template #default="scope">

+ 228 - 39
src/views/production-safety/risk-identification-and-control/hazard-approval-manage/view.vue

@@ -522,12 +522,24 @@
             <el-form-item label="危害辨识" prop="space.hazardIdentification" class="span-full"
               ><el-input size="large" placeholder="输入危害辨识" v-model="formValue.space.hazardIdentification" type="textarea"
             /></el-form-item>
-            <el-form-item label="作业附件" class="span-full" prop="space.attachment"
-              ><UploadFiles
+            <el-form-item label="作业附件" class="span-full" prop="space.attachment">
+                <!-- <UploadFiles
                 label="上传附件"
+                disabled
                 @upload-success="(l) => handleUpload('space', 'attachment', l)"
                 :fileList="listMap['space.attachment']"
-            /></el-form-item>
+                /> -->
+                <div class="file-list" v-if="listMap['space.attachment'].length > 0">
+                    <div v-for="file in listMap['space.attachment']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+        </el-form-item>
           </div>
 
           <div class="sub-group-box">
@@ -591,10 +603,6 @@
             >
           </el-table-column>
         </el-table>
-
-          <div class="form-grid mt-20">
-            
-          </div>
         </template>
 
         <template v-else-if="formValue.hazardOperationType === 2">
@@ -652,12 +660,23 @@
             <el-form-item label="危害辨识" prop="highAltitude.hazardIdentification" class="span-full"
               ><el-input size="large" placeholder="输入危害辨识" v-model="formValue.highAltitude.hazardIdentification" type="textarea"
             /></el-form-item>
-            <el-form-item label="作业附件" class="span-full" prop="highAltitude.attachment"
-              ><UploadFiles
+            <el-form-item label="作业附件" class="span-full" prop="highAltitude.attachment">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('highAltitude', 'attachment', l)"
                 :fileList="listMap['highAltitude.attachment']"
-            /></el-form-item>
+            /> -->
+                <div class="file-list" v-if="listMap['highAltitude.attachment'].length > 0">
+                    <div v-for="file in listMap['highAltitude.attachment']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+            </el-form-item>
           </div>
         </template>
 
@@ -680,6 +699,7 @@
                 v-model="formValue.electricityList.operationStartTime"
                 value-format="YYYY-MM-DD"
                 class="w-100"
+                style="width: 100%;"
             /></el-form-item>
             <el-form-item label="作业结束时间" prop="electricityList.operationEndTime"
               ><el-date-picker
@@ -688,6 +708,7 @@
                 v-model="formValue.electricityList.operationEndTime"
                 value-format="YYYY-MM-DD"
                 class="w-100"
+                style="width:100%"
             /></el-form-item>
             <el-form-item label="事由" prop="electricityList.reason" class="span-full"
               ><el-input size="large" placeholder="输入事由" v-model="formValue.electricityList.reason" type="textarea" rows="3" show-word-limit maxlength="300" 
@@ -710,12 +731,23 @@
             <el-form-item label="建设管理部负责人" prop="electricityList.constructionManager" class="span-full"
               ><el-input size="large" placeholder="输入建设管理部负责人" v-model="formValue.electricityList.constructionManager" 
             /></el-form-item>
-            <el-form-item label="申请附件" class="span-full" prop="electricityList.attachment"
-              ><UploadFiles
+            <el-form-item label="申请附件" class="span-full" prop="electricityList.attachment">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('electricityList', 'attachment', l)"
                 :fileList="listMap['electricityList.attachment']"
-            /></el-form-item>
+            /> -->
+            <div class="file-list" v-if="listMap['electricityList.attachment'].length > 0">
+                <div v-for="file in listMap['electricityList.attachment']" :key="file.fileId" class="file-item">
+                    <div class="file-info">
+                        <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                        <span class="file-name">{{ file.fileName }}</span>
+                    </div>
+                    <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                    <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                </div>
+            </div>
+        </el-form-item>
           </div>
         </template>
 
@@ -801,56 +833,144 @@
               ><el-input size="large" placeholder="输入动火操作现场防护措施及检查情况" v-model="formValue.hot.supervisorMeasures" type="textarea"
             /></el-form-item>
 
-            <el-form-item label="动火现场检查照片" prop="hot.photos"
-              ><UploadFiles
+            <el-form-item label="动火现场检查照片" prop="hot.photos">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('hot', 'photos', l)"
                 :fileList="listMap['hot.photos']"
-            /></el-form-item>
-            <el-form-item label="身份证复印件" prop="hot.idCard"
-              ><UploadFiles
+            /> -->
+                <div class="file-list" v-if="listMap['hot.photos'].length > 0">
+                    <div v-for="file in listMap['hot.photos']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+            </el-form-item>
+            <el-form-item label="身份证复印件" prop="hot.idCard">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('hot', 'idCard', l)"
                 :fileList="listMap['hot.idCard']"
-            /></el-form-item>
-            <el-form-item label="动火人特种作业操作证复印件" prop="hot.optionCard"
-              ><UploadFiles
+            /> -->
+                <div class="file-list" v-if="listMap['hot.idCard'].length > 0">
+                    <div v-for="file in listMap['hot.idCard']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+            </el-form-item>
+            <el-form-item label="动火人特种作业操作证复印件" prop="hot.optionCard">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('hot', 'optionCard', l)"
                 :fileList="listMap['hot.optionCard']"
-            /></el-form-item>
-            <el-form-item label="动火安全教育记录" prop="hot.safetyEducationPlan"
-              ><UploadFiles
+            /> -->
+                <div class="file-list" v-if="listMap['hot.optionCard'].length > 0">
+                    <div v-for="file in listMap['hot.optionCard']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+            </el-form-item>
+            <el-form-item label="动火安全教育记录" prop="hot.safetyEducationPlan">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('hot', 'safetyEducationPlan', l)"
                 :fileList="listMap['hot.safetyEducationPlan']"
-            /></el-form-item>
-            <el-form-item label="动火作业施工方案" prop="hot.constructionPlan"
-              ><UploadFiles
+            /> -->
+                <div class="file-list" v-if="listMap['hot.safetyEducationPlan'].length > 0">
+                    <div v-for="file in listMap['hot.safetyEducationPlan']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+            </el-form-item>
+            <el-form-item label="动火作业施工方案" prop="hot.constructionPlan">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('hot', 'constructionPlan', l)"
                 :fileList="listMap['hot.constructionPlan']"
-            /></el-form-item>
-            <el-form-item label="动火作业场所准备照片" prop="hot.preparationPhotos"
-              ><UploadFiles
+            /> -->
+                <div class="file-list" v-if="listMap['hot.constructionPlan'].length > 0">
+                    <div v-for="file in listMap['hot.constructionPlan']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+            </el-form-item>
+            <el-form-item label="动火作业场所准备照片" prop="hot.preparationPhotos">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('hot', 'preparationPhotos', l)"
                 :fileList="listMap['hot.preparationPhotos']"
-            /></el-form-item>
+            /> -->
+                <div class="file-list" v-if="listMap['hot.preparationPhotos'].length > 0">
+                    <div v-for="file in listMap['hot.preparationPhotos']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+            </el-form-item>
 
-            <el-form-item label="特种行业操作证网上查询情况照片" prop="hot.operationCertificates"
-              ><UploadFiles
+            <el-form-item label="特种行业操作证网上查询情况照片" prop="hot.operationCertificates">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('hot', 'operationCertificates', l)"
                 :fileList="listMap['hot.operationCertificates']"
-            /></el-form-item>
+            /> -->
+                <div class="file-list" v-if="listMap['hot.operationCertificates'].length > 0">
+                    <div v-for="file in listMap['hot.operationCertificates']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+            </el-form-item>
 
-            <el-form-item label="动火作业安全管理协议" prop="hot.safetyManagementAgreement"
-              ><UploadFiles
+            <el-form-item label="动火作业安全管理协议" prop="hot.safetyManagementAgreement">
+              <!-- <UploadFiles
                 label="上传附件"
                 @upload-success="(l) => handleUpload('hot', 'safetyManagementAgreement', l)"
                 :fileList="listMap['hot.safetyManagementAgreement']"
-            /></el-form-item>
+            /> -->
+                <div class="file-list" v-if="listMap['hot.safetyManagementAgreement'].length > 0">
+                    <div v-for="file in listMap['hot.safetyManagementAgreement']" :key="file.fileId" class="file-item">
+                        <div class="file-info">
+                            <img :src="FILE_TYPE_ICON[file.fileType as keyof typeof FILE_TYPE_ICON]" />
+                            <span class="file-name">{{ file.fileName }}</span>
+                        </div>
+                        <div link class="fileAction" @click="previewOnline(file.fileUrl, file.fileType as keyof typeof FILE_TYPE_ICON)">预览</div>
+                        <div link class="fileAction" @click.stop="downloadFile(file.fileUrl, file.fileName)">下载</div>
+                    </div>
+                </div>
+            </el-form-item>
           </div>
         </template>
 
@@ -881,6 +1001,8 @@
     <footer class="safety-platform-container__footer">
       <el-button size="large" @click="router.back()">返回</el-button>
     </footer>
+
+    <PreviewOnline ref="previewOnlineRef" />
   </div>
 </template>
 <script lang="ts" setup>
@@ -893,7 +1015,10 @@
   import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
   import { getAllDepartments } from '@/api/auth/dept';
   import { unformatAttachment, formatAttachmentList } from '@/components/UploadFiles/utils';
-
+  import PreviewOnline from '@/views/disaster/components/PreviewOnline.vue';
+  import { FILE_TYPE_ICON } from '@/components/UploadFiles/constants';
+  import type { FileItem } from '@/components/UploadFiles/types';
+  import { downloadFile } from '@/views/disaster/utils';
   const router = useRouter();
   const route = useRoute();
   const formRef = ref<any>(null);
@@ -917,6 +1042,7 @@
     'hot.safetyEducationPlan': [],
     'hot.constructionPlan': [],
     'hot.preparationPhotos': [],
+    'hot.operationCertificates': [],
     'hot.safetyManagementAgreement': [],
   });
 
@@ -944,6 +1070,7 @@
       safetyEducationPlan: '',
       constructionPlan: '',
       preparationPhotos: '',
+      operationCertificates: '',
       safetyManagementAgreement: '',
     },
     measure: [],
@@ -1083,7 +1210,13 @@ const rules = reactive({
       ElMessage.error('详情回显失败');
     }
   };
-
+  // 预览
+  const previewOnlineRef = ref<InstanceType<typeof PreviewOnline>>();
+  const previewOnline = (url: string | undefined, type: keyof typeof FILE_TYPE_ICON) => {
+    if (url) {
+      previewOnlineRef.value?.open(url, type);
+    }
+  };
   /**
    * 辅助:表格行操作
    */
@@ -1147,4 +1280,60 @@ const rules = reactive({
       }
     }
   }
+  .file-list {
+    margin-top: 16px;
+    display: flex;
+    flex-wrap: wrap;
+    gap: 8px;
+    &:first-child {
+        margin-top: 0;
+    }
+  }
+
+  .file-item {
+    @include flex-center;
+    justify-content: space-between;
+    gap: 10px;
+    height: 32px;
+    border: 1px solid #e5e7eb;
+    border-radius: 6px;
+    padding: 12px;
+    transition: all 0.2s ease;
+
+    &:hover {
+      background-color: #f8fafc;
+    }
+  }
+
+  .file-info {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+
+    img {
+      width: 10px;
+    }
+  }
+
+  .file-name {
+    flex: 1;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    font-size: 14px;
+    color: rgba($text-color, 0.65);
+  }
+  .fileAction {
+    width: 60px;
+    text-align: center;
+    cursor: pointer;
+    color: #1777ff;
+  }
+  .delete-button {
+    color: #ef4444;
+    background: none;
+    border: none;
+    cursor: pointer;
+    font-size: 12px;
+  }
 </style>

+ 15 - 6
src/views/production-safety/risk-identification-and-control/labor-products-requisition-manage/add.vue

@@ -15,7 +15,7 @@
       <el-form-item label="职业危害因素" prop="hazardFactor">
         <el-input v-model="form.hazardFactor" placeholder="请输入职业危害因素" clearable />
       </el-form-item>
-      <el-form-item label="发放人" prop="issuerUserId">
+      <el-form-item label="发放人" prop="issuerCode">
         <el-select
           v-model="issuerUserId"
           placeholder="请选择发放人"
@@ -76,8 +76,8 @@
         </el-form-item>
         <el-form-item label="用品状态" prop="status">
           <el-radio-group v-model="form.status">
-            <el-radio :label="1">启用</el-radio>
-            <el-radio :label="0">禁用</el-radio>
+            <el-radio :value="1">启用</el-radio>
+            <el-radio :value="0">禁用</el-radio>
           </el-radio-group>
         </el-form-item>
         <el-form-item label="领用备注" prop="remark">
@@ -135,13 +135,13 @@
 
   const onIssuerChange = (userId: number | null) => {
     const u = issuerUserList.value.find((x) => x.id === userId);
-    form.issuerCode = u?.username ?? '';
+    form.issuerCode = u?.id ?? '';
     form.issuerName = u?.realname ?? '';
   };
 
   const onReceiverChange = (userId: number | null) => {
     const u = receiverUserList.value.find((x) => x.id === userId);
-    form.receiverCode = u?.username ?? '';
+    form.receiverCode = u?.id ?? '';
     form.receiverName = u?.realname ?? '';
   };
 
@@ -160,7 +160,16 @@
     remark: '',
   });
 
-  const formRules: FormRules = {  };
+  const formRules: FormRules = { 
+        hazardFactor: [{ required: true, message: '请输入职业危害因素', trigger: 'blur' }],
+        issuerCode: [{ required: true, message: '请选择发放人', trigger: 'blur' }],
+        issueTime: [{ required: true, message: '请选择发放时间', trigger: 'blur' }],
+        receiveNum: [{ required: true, message: '请输入领用数量', trigger: 'blur' }],
+        ppeName: [{ required: true, message: '请输入防护用品名称', trigger: 'blur' }],
+        version: [{ required: true, message: '请输入型号', trigger: 'blur' }],
+        status: [{ required: true, message: '请选择状态', trigger: 'blur' }],
+        remark: [{ required: true, message: '请输入备注', trigger: 'blur' }],
+   };
 
   onMounted(() => {
     loadUserList();

+ 15 - 6
src/views/production-safety/risk-identification-and-control/labor-products-requisition-manage/edit.vue

@@ -16,7 +16,7 @@
         <el-form-item label="职业危害因素" prop="hazardFactor">
           <el-input v-model="form.hazardFactor" placeholder="请输入职业危害因素" clearable />
         </el-form-item>
-        <el-form-item label="发放人" prop="issuerUserId">
+        <el-form-item label="发放人" prop="issuerCode">
           <el-select
             v-model="issuerUserId"
             placeholder="请选择发放人"
@@ -77,8 +77,8 @@
         </el-form-item>
         <el-form-item label="用品状态" prop="status">
           <el-radio-group v-model="form.status">
-            <el-radio :label="1">启用</el-radio>
-            <el-radio :label="0">禁用</el-radio>
+            <el-radio :value="1">启用</el-radio>
+            <el-radio :value="0">禁用</el-radio>
           </el-radio-group>
         </el-form-item>
         <el-form-item label="领用备注" prop="remark">
@@ -141,13 +141,13 @@
 
   const onIssuerChange = (userId: number | null) => {
     const u = issuerUserList.value.find((x) => x.id === userId);
-    form.issuerCode = u?.username ?? '';
+    form.issuerCode = u?.id ?? '';
     form.issuerName = u?.realname ?? '';
   };
 
   const onReceiverChange = (userId: number | null) => {
     const u = receiverUserList.value.find((x) => x.id === userId);
-    form.receiverCode = u?.username ?? '';
+    form.receiverCode = u?.id ?? '';
     form.receiverName = u?.realname ?? '';
   };
 
@@ -184,7 +184,16 @@
     remark: '',
   });
 
-  const formRules: FormRules = {};
+  const formRules: FormRules = { 
+        hazardFactor: [{ required: true, message: '请输入职业危害因素', trigger: 'blur' }],
+        issuerCode: [{ required: true, message: '请选择发放人', trigger: 'blur' }],
+        issueTime: [{ required: true, message: '请选择发放时间', trigger: 'blur' }],
+        receiveNum: [{ required: true, message: '请输入领用数量', trigger: 'blur' }],
+        ppeName: [{ required: true, message: '请输入防护用品名称', trigger: 'blur' }],
+        version: [{ required: true, message: '请输入型号', trigger: 'blur' }],
+        status: [{ required: true, message: '请选择状态', trigger: 'blur' }],
+        remark: [{ required: true, message: '请输入备注', trigger: 'blur' }],
+   };
 
   const getDetail = async () => {
     if (!id.value) {

+ 2 - 2
src/views/production-safety/risk-identification-and-control/labor-products-requisition-manage/view.vue

@@ -64,8 +64,8 @@
         </el-form-item>
         <el-form-item label="用品状态" prop="status">
           <el-radio-group v-model="form.status" disabled>
-            <el-radio :label="true">启用</el-radio>
-            <el-radio :label="false">禁用</el-radio>
+            <el-radio :value="true">启用</el-radio>
+            <el-radio :value="false">禁用</el-radio>
           </el-radio-group>
         </el-form-item>
         <el-form-item label="领用备注" prop="remark">

+ 2 - 1
src/views/production-safety/risk-identification-and-control/risk-manage/change.vue

@@ -363,7 +363,7 @@
     emergencyPlanName: '',
     emergencyPlanNumber: '',
     rectificationPlan: '',
-    riskLevel: '',
+    riskLevel: 0,
     remarks: '',
     changeReason: '',
     responsibleDepartmentTodo: '',
@@ -446,6 +446,7 @@
       Object.keys(formValue).forEach((key) => {
         if (res[key] !== undefined) {
           formValue[key] = res[key];
+          formValue.riskLevel = Number(res.riskLevel)
           // 进入详情变更默认为空
           formValue.roomSafetyResponsibleTodo = ''
           formValue.responsibleDepartmentTodo = ''

+ 2 - 1
src/views/production-safety/risk-identification-and-control/risk-manage/edit.vue

@@ -288,7 +288,7 @@
     emergencyPlanName: '',
     emergencyPlanNumber: '',
     rectificationPlan: '',
-    riskLevel: '',
+    riskLevel: 0,
     remarks: '',
     responsibleDepartmentId: [],
   });
@@ -373,6 +373,7 @@
       Object.keys(formValue).forEach((key) => {
         if (res[key] !== undefined) {
           formValue[key] = res[key];
+          formValue.riskLevel = Number(res.riskLevel)
           formValue['responsibleDepartmentId'] = res['responsibleDepartmentId']
             ? res['responsibleDepartmentId'].split(',').map((item: string) => Number(item))
             : [];

+ 2 - 1
src/views/production-safety/risk-identification-and-control/risk-manage/view.vue

@@ -319,7 +319,7 @@
     emergencyPlanName: '',
     emergencyPlanNumber: '',
     rectificationPlan: '',
-    riskLevel: '',
+    riskLevel: 0,
     remarks: '',
     responsibleDepartmentId: [],
   });
@@ -388,6 +388,7 @@
       Object.keys(formValue).forEach((key) => {
         if (res[key] !== undefined) {
           formValue[key] = res[key];
+          formValue.riskLevel = Number(res.riskLevel)
           formValue['responsibleDepartmentId'] = res['responsibleDepartmentId']
             ? res['responsibleDepartmentId'].split(',').map((item: string) => Number(item))
             : [];

+ 3 - 1
src/views/production-safety/risk-identification-and-control/special-equipment-manage/configs/form.ts

@@ -213,7 +213,8 @@ export const SPECIAL_EQUIPMENT_FORM_DATA = {
   licenseNo: '',
   deviceCode: '',
   safeLocation: '',
-  useDepartment: '',
+  useDepartment: undefined as number | undefined,
+  isUseDepartmentName: '',
   responsibilityDeptId: undefined as number | undefined,
   responsiblePerson: '',
   jobNo: '',
@@ -225,6 +226,7 @@ export const SPECIAL_EQUIPMENT_FORM_DATA = {
   inspectionTime: '',
   deviceStatus: 1,
   nextInspectionDate: '',
+  remark: ''
 };
 
 export const SPECIAL_EQUIPMENT_FORM_RULES = {

+ 5 - 4
src/views/production-safety/risk-identification-and-control/special-equipment-manage/edit.vue

@@ -94,7 +94,7 @@
   };
 
   const formRules = SPECIAL_EQUIPMENT_FORM_RULES;
-
+  
   const loadDeptTree = async () => {
     try {
       const res = await getAllDepartments();
@@ -118,8 +118,8 @@
         dfs(deptOptions.value, []);
       }
       // 使用部门回显:根据名称在树中查找路径
-      if ((formData as any).useDepartment) {
-        useDepartmentPath.value = getDeptPathByName(deptOptions.value, (formData as any).useDepartment);
+      if (formData.useDepartment) {
+          useDepartmentPath.value =  getDeptPathByName(deptOptions.value, formData.isUseDepartmentName);
       }
     } catch (e) {
       console.error('获取部门树失败:', e);
@@ -193,6 +193,7 @@
         (formData as any).typeId = res.typeId;
         (formData as any).registerCode = res.registerCode ?? '';
         (formData as any).deviceCode = res.deviceCode ?? '';
+        formData.isUseDepartmentName = res.isUseDepartmentName?? '',
         (formData as any).useDepartment = res.isUseDepartment ?? '';
         (formData as any).responsiblePerson = res.responsiblePerson ?? '';
         (formData as any).factoryNo = res.factoryNo ?? '';
@@ -209,7 +210,7 @@
         formData.deviceStatus = res.deviceStatus ?? 1;
         formData.nextInspectionDate = res.nextInspectionDate ?? '';
         formData.remark = res.remark ?? '';
-        useDepartmentPath.value = res.isUseDepartment ?? [];
+        // useDepartmentPath.value = res.isUseDepartment ?? [];
       }
     } catch (e) {
       console.error('获取特种设备设施详情失败:', e);

+ 2 - 2
src/views/production-safety/risk-identification-and-control/special-equipment-manage/view.vue

@@ -132,7 +132,7 @@
         formData.licenseNo = res.licenseNo ?? '';
         formData.deviceCode = res.deviceCode ?? '';
         formData.safeLocation = res.safeLocation ?? '';
-        formData.useDepartment = res.useDepartment ?? '';
+        formData.useDepartment = res.isUseDepartment ?? undefined;
         (formData as any).responsibilityDeptId = res.responsibilityDeptId ?? undefined;
         formData.responsiblePerson = res.responsiblePerson ?? '';
         formData.jobNo = res.jobNo ?? '';
@@ -168,7 +168,7 @@
             dfs(deptOptions.value, []);
           }
           if (formData.useDepartment) {
-            useDepartmentPath.value = getDeptPathByName(deptOptions.value, formData.useDepartment);
+            useDepartmentPath.value = getDeptPathByName(deptOptions.value, res.isUseDepartmentName);
           }
         } catch (e) {
           console.error('获取部门树失败:', e);