Forráskód Böngészése

受压元件导入

徐展城 5 napja
szülő
commit
439330ac3e

+ 20 - 29
yudao-ui-admin-vue3/src/views/pressure2/equipboiler/EquipBoilerForm.vue

@@ -1357,42 +1357,27 @@ const handleDownloadTemplate = async () => {
   download.excel(data, '锅炉受压元件导入模板.xls')
 }
 
-// 文件选择后的处理:通过受压元件名称匹配,已存在则修改、不存在则新增
+// 文件选择后的处理:全量追加到受压元件列表
 const handleFileChange = async (event: Event) => {
   const target = event.target as HTMLInputElement
   if (!target.files || target.files.length === 0) return
   const file = target.files[0]
   try {
-    const importedList = await EquipBoilerApi.importPressureParts(file)
-    if (importedList && importedList.length > 0) {
-      let addCount = 0
-      let updateCount = 0
+    const result = await EquipBoilerApi.importPressureParts(file)
+    console.log('importPressureParts raw result:', JSON.stringify(result))
+    const importedList = Array.isArray(result) ? result : (result?.data || [])
+    console.log('importPressureParts list:', JSON.stringify(importedList))
+    if (importedList.length > 0) {
       importedList.forEach((item: any) => {
-        const partName = item.partName || ''
-        const existingIndex = pressureParts.value.findIndex(p => p.partName === partName && partName !== '')
-        if (existingIndex >= 0) {
-          // 已存在,修改
-          pressureParts.value[existingIndex] = {
-            partType: item.partType || '',
-            partName: item.partName || '',
-            specification: item.specification || '',
-            material: item.material || '',
-            remark: item.remark || ''
-          }
-          updateCount++
-        } else {
-          // 不存在,新增
-          pressureParts.value.push({
-            partType: item.partType || '',
-            partName: item.partName || '',
-            specification: item.specification || '',
-            material: item.material || '',
-            remark: item.remark || ''
-          })
-          addCount++
-        }
+        pressureParts.value.push({
+          partType: item.partType || '',
+          partName: item.partName || '',
+          specification: item.specification || '',
+          material: item.material || '',
+          remark: item.remark || ''
+        })
       })
-      message.success(`导入完成:新增 ${addCount} 条,更新 ${updateCount} 条`)
+      message.success(`导入完成:新增 ${importedList.length} 条`)
     } else {
       message.warning('导入的数据为空')
     }
@@ -1464,6 +1449,12 @@ const changeAddress = ()=> {
 
 :deep(.form-section .el-collapse-item__wrap) {
   border-bottom: none;
+  overflow: visible !important;
+}
+
+:deep(.form-section .el-collapse-item__content) {
+  overflow: visible !important;
+  padding-bottom: 0;
 }
 
 .form-grid {