From 4ecfd960c94cbb2286fde28b00c8311acd4f87db Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Mon, 11 Aug 2025 17:05:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20sop=E4=BB=8E=E6=96=87=E4=BB=B6=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=97=B6=EF=BC=8C=E6=A3=80=E6=9F=A5=E6=AF=8F=E4=B8=80?= =?UTF-8?q?=E8=A1=8C=E6=89=80=E6=9C=89=E7=9A=84=E9=94=99=E8=AF=AF=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/services/linsight/sop_manage.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/backend/bisheng/api/services/linsight/sop_manage.py b/src/backend/bisheng/api/services/linsight/sop_manage.py index 5f33dff70..68a3bea7d 100644 --- a/src/backend/bisheng/api/services/linsight/sop_manage.py +++ b/src/backend/bisheng/api/services/linsight/sop_manage.py @@ -229,17 +229,22 @@ class SOPManageService: name = sheet.cell(row=i, column=1).value description = sheet.cell(row=i, column=2).value content = sheet.cell(row=i, column=3).value + error_msg = [] if not name: - error_rows.append(f"• 第{i}行: 缺少名称") - elif not content: - error_rows.append(f"• 第{i}行: 缺少详细内容") - elif len(str(name)) >= 500: - error_rows.append(f"• 第{i}行: 名称长度超过500字符") - elif len(str(content)) >= 50000: - error_rows.append(f"• 第{i}行: 详细内容长度超过50000字符") - elif description and len(str(description)) >= 1000: - error_rows.append(f"• 第{i}行: 描述长度超过1000字符") - elif name and content: + error_msg.append("缺少名称") + if not content: + error_msg.append("缺少详细内容") + if len(str(name)) >= 500: + error_msg.append("名称长度超过500字符") + if len(str(content)) >= 50000: + error_msg.append("详细内容长度超过50000字符") + if description and len(str(description)) >= 1000: + error_msg.append("描述长度超过1000字符") + + if error_msg: + error_msg = "、".join(error_msg) + error_rows.extend(f"• 第{i}行: {error_msg}") + else: success_rows.append({ "name": str(name), "description": str(description) if description is not None else "",