From e2e984385b6a1e91c7041487450f3bbb9f5e1de5 Mon Sep 17 00:00:00 2001 From: ForeverSmiYng Date: Sat, 22 Jun 2024 16:38:30 +0800 Subject: [PATCH] =?UTF-8?q?'=E5=AD=97=E6=AE=B5=E9=94=99=E8=AF=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=96=87=E4=BB=B6=E6=A0=BC=E5=BC=8F=E7=94=B1HTML?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E4=B8=BAJS'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 字段错误提示.html | 56 ----------------------------------------------- 字段错误提示.js | 54 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 56 deletions(-) delete mode 100644 字段错误提示.html create mode 100644 字段错误提示.js diff --git a/字段错误提示.html b/字段错误提示.html deleted file mode 100644 index 6282568..0000000 --- a/字段错误提示.html +++ /dev/null @@ -1,56 +0,0 @@ - \ No newline at end of file diff --git a/字段错误提示.js b/字段错误提示.js new file mode 100644 index 0000000..fcf55b9 --- /dev/null +++ b/字段错误提示.js @@ -0,0 +1,54 @@ +function showPrompt(SP_fieldid, SP_content, SP_tabid, SP_rowIndex) {//添加提示,SP_rowIndex选填;如要填SP_rowIndex,SP_tabid必填,可填null + if (SP_rowIndex === null || SP_rowIndex === undefined) { + $(`.myprom_${SP_fieldid}`).remove(); + if ($(`.${SP_fieldid}_swapDiv`).length > 0) { + $(`.${SP_fieldid}_swapDiv`).after(`
`); + } + } else { + $(`.myprom_${SP_fieldid}_${SP_rowIndex}`).remove(); + if ($(`.${SP_fieldid}_${SP_rowIndex}_swapDiv`).length > 0) { + $(`.${SP_fieldid}_${SP_rowIndex}_swapDiv`).after(`
`); + } + } +} + +function eraseFieldPrompt(EFP_fieldid, EFP_rowIndex) {//移除提示,SP_rowIndex选填 + if (EFP_rowIndex === null || EFP_rowIndex === undefined) { + $(`.myprom_${EFP_fieldid}`).remove(); + } else { + $(`.myprom_${EFP_fieldid}_${EFP_rowIndex}`).remove(); + } +} + +function checkPrompt() {//提交前判断,先做一次if ($(".myprom").length > 0) {}判断,true则触发该方法,并禁断提交,false不执行 + WfForm.showMessage("请参考提示修正内容。", 1, 5); + let tab_id = $(".myprom")[0].getAttribute("data_tab_id"); + if (tab_id === "null" || tab_id === "undefined") { + let scroll_to_windowTop = $(".wf-req-form-scroll")[0].getBoundingClientRect().top;//scroll框距离window顶部的距离 + let dom_to_scrollTop = $(".myprom")[0].getBoundingClientRect().top - scroll_to_windowTop;//DOM节点距离scroll框顶部的距离 + let scroll_display_height = window.innerHeight - scroll_to_windowTop;//scroll框最大显示高度 + if (dom_to_scrollTop < scroll_display_height / 4 || dom_to_scrollTop > scroll_display_height / 4 * 3) { + $(".wf-req-form-scroll")[0].scrollTo({ + top: dom_to_scrollTop + $(".wf-req-form-scroll")[0].scrollTop - scroll_display_height / 2, + behavior: "smooth" + }); + } + } else { + $("#tab_" + tab_id)[0].click(); + let myInterval2; + myInterval2 = setInterval(() => { + if ($("#tab_" + tab_id + "_content").css("display") == "block") { + clearInterval(myInterval2); + let scroll_to_windowTop = $(".wf-req-form-scroll")[0].getBoundingClientRect().top;//scroll框距离window顶部的距离 + let dom_to_scrollTop = $(".myprom")[0].getBoundingClientRect().top - scroll_to_windowTop;//DOM节点距离scroll框顶部的距离 + let scroll_display_height = window.innerHeight - scroll_to_windowTop;//scroll框最大显示高度 + if (dom_to_scrollTop < scroll_display_height / 4 || dom_to_scrollTop > scroll_display_height / 4 * 3) { + $(".wf-req-form-scroll")[0].scrollTo({ + top: dom_to_scrollTop + $(".wf-req-form-scroll")[0].scrollTop - scroll_display_height / 2, + behavior: "smooth" + }); + } + } + }, 50); + } +} \ No newline at end of file