1. 修改后的代码
| var YM_ID = this.options.form.getWidgetByName("YM_ID").getValue(); |
| var ACCOUNT_CODE = this.options.form.getWidgetByName("ACCOUNT_CODE").getValue(); |
|
|
| // 双重编码参数并新开窗口 |
| window.open( |
| "${servletURL}?reportlet=" + encodeURIComponent("PC_FIN/FIN_GL_BALANCE_UDD_R_WD.cpt") + |
| "&YM_ID=" + encodeURIComponent(YM_ID) + |
| "&ACCOUNT_CODE=" + encodeURIComponent(ACCOUNT_CODE) |
| ); |
2. 关键改进点
新窗口打开使用window.open()替代window.location实现新标签页跳转
参数安全编码
双重编码说明GET请求需双重编码防止容器自动解码乱码:
encodeURIComponent(encodeURIComponent(value))
3. 效果验证
参数含特殊字符如#、&时仍能正常传递
中文参数不会出现乱码
始终保持在新窗口打开