From 6207d774798180e59ffa7b92c8e4ecab815ef62e Mon Sep 17 00:00:00 2001 From: wangyan Date: Sat, 28 Feb 2026 18:12:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(notice):=20=E4=BF=AE=E5=A4=8D=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8F=91=E5=B8=83=E8=A1=A8=E5=8D=95=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复了分子公司选择为空时的返回逻辑 - 移除了调试用的 console.log 语句 - 调整了防止重复提交的逻辑位置 - 修正了表单验证失败后的处理流程 - 修复了条件判断语句的格式问题 - 清理了文件末尾的多余空行 --- src/pages/Container/Notice/Add/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/pages/Container/Notice/Add/index.js b/src/pages/Container/Notice/Add/index.js index cb1fec4..27db8c7 100644 --- a/src/pages/Container/Notice/Add/index.js +++ b/src/pages/Container/Notice/Add/index.js @@ -29,7 +29,8 @@ function Add(props) { // 监听分子公司选择变化,处理"全部"选项逻辑 const publishCorpinfoIdsValue = Form.useWatch("publishCorpinfoIds", form); useEffect(() => { - if (!publishCorpinfoIdsValue || publishCorpinfoIdsValue.length === 0) return; + if (!publishCorpinfoIdsValue || publishCorpinfoIdsValue.length === 0) + return; const hasAll = publishCorpinfoIdsValue.includes("ALL"); const hasOther = publishCorpinfoIdsValue.some(id => id !== "ALL"); @@ -60,7 +61,6 @@ function Add(props) { }, []); useEffect(() => { - console.log(props); props["corpInfoListAll"]({ inType: "0,1,6", eqUseFlag: 1 }).then((res) => { if (res.data) { console.log(res.data); @@ -77,13 +77,12 @@ function Add(props) { const onSubmit = async () => { // 防止重复提交 - if (submitting) return; setSubmitting(true); try { await form.validateFields(); // 触发表单校验 - } catch { - setSubmitting(false); + } + catch { return; // 阻止后续逻辑 } const values = await form.validateFields(); @@ -100,7 +99,8 @@ function Add(props) { .filter(item => item.bianma !== "ALL") .map(item => item.bianma); values.publishCorpinfoIds = allIds.join(","); - } else { + } + else { values.publishCorpinfoIds = values.publishCorpinfoIds.join(","); } } @@ -115,7 +115,8 @@ function Add(props) { }).finally(() => { setSubmitting(false); }); - } else { + } + else { props["noticeAdd"](values).then((res) => { if (res.success) { message.success("新增成功!"); @@ -205,4 +206,4 @@ function Add(props) { ); } -export default Connect([NS_NOTICE, NS_CORPINFO], true)(Add); \ No newline at end of file +export default Connect([NS_NOTICE, NS_CORPINFO], true)(Add);