$("#DOWLOAD").on("click",function (e) { var account = $("#account").val();//账套 var calcType=$("#inqu_status-0-calcType").val();//成本科目 var ym=$("#inqu_status-0-ym").val();//年 var subjectDesc=$("#inqu_status-0-subjectDesc").val();//成本中心 var costCenter=$("#inqu_status-0-costCenter").val();//成本中心 var subjectDesc=$("#inqu_status-0-subjectDesc").val();//成本科目 var predictPrice=$("#inqu_status-0- predictPrice").val();//归属码 var whereSql="account='"+account+"' and YM='"+ym+"'"; if(costCenter!="")whereSql+= " and COST_CENTER='"+costCenter+"'"; if(calcType!="")whereSql+= " and calcType='"+calcType+"'"; //动态生成xls文件下载 window.location.href = IPLATUI.CONTEXT_PATH + "/downLoadFileCX/doGetFile?downloadType=downloadWECJCF15&whereSql="+encodeURIComponent(whereSql); });什么作用
时间: 2024-04-26 12:23:45 浏览: 22
这段代码是一个 jQuery 事件监听器,当 `#DOWLOAD` 元素被点击时,会执行其中的函数。
在函数内部,首先获取了一些表单元素的值,包括账套、成本科目、年、成本中心、归属码等。然后根据这些值构造了一个查询语句 `whereSql`,用于向后台查询符合条件的数据。
最后,通过拼接字符串的方式,构造了一个下载链接,并将浏览器页面重定向到该链接,从而实现了动态生成 Excel 文件并提供下载的功能。其中,`encodeURIComponent()` 函数用于对查询语句进行 URL 编码,以防止特殊字符对链接的解析造成影响。
相关问题
selenium savefile.default_directory和dowload.default_directory
`selenium`中`savefile.default_directory`和`download.default_directory`是两个不同的属性。
`savefile.default_directory`属性用于设置文件保存的默认目录,而`download.default_directory`属性用于设置文件下载的默认目录。
具体来说,`savefile.default_directory`属性是在使用`selenium`的`send_keys`方法上传文件时使用的,默认情况下,该属性的值为空字符串,即文件将保存在浏览器默认的下载目录中。如果要设置文件保存的目录,可以使用如下代码:
```python
from selenium import webdriver
options = webdriver.ChromeOptions()
prefs = {'savefile.default_directory': '/path/to/directory'}
options.add_experimental_option('prefs', prefs)
driver = webdriver.Chrome(options=options)
```
而`download.default_directory`属性用于设置文件下载的默认目录,可以使用如下代码:
```python
from selenium import webdriver
options = webdriver.ChromeOptions()
prefs = {'download.default_directory': '/path/to/directory'}
options.add_experimental_option('prefs', prefs)
driver = webdriver.Chrome(options=options)
```
注意,在设置以上属性时,需要将`options`添加到`webdriver.Chrome()`方法中创建`driver`对象。
亲测解决Error: Not a genuine ST Device! Abort connection.&&Error:Flash dowload failed CortexM3
你好!对于错误消息 "Not a genuine ST Device! Abort connection.",这通常表示你使用的是非正版的ST设备,而ST-Link工具无法与其建立连接。解决此问题的方法是确保你使用的ST设备是正版的,并且与ST-Link工具兼容。
至于错误消息 "Flash download failed CortexM3",这通常表示在尝试将固件下载到Cortex-M3处理器上时发生了错误。解决此问题的方法可能包括以下几点:
1. 检查你的连接:确保你的ST设备正确连接到计算机,并且连接稳定。
2. 检查芯片和固件:确保你选择的芯片和固件与目标设备兼容,并且版本正确。
3. 检查编程器设置:检查编程器的设置,例如下载速度、擦除选项等。有时候调整这些设置可以解决问题。
4. 检查目标设备状态:如果目标设备处于保护模式或锁定状态,可能会导致下载失败。尝试将其解锁或重置到正常状态。
如果以上方法都不能解决问题,那么可能需要更多的具体信息来帮助进一步诊断和解决该问题。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)