!289 添加日期范围支持重复添加多组日期范围,请求参数中对象的属性为null、undefined不进行拼接
Merge pull request !289 from wangzhaoqiang/master
This commit is contained in:
commit
6f51f729ba
@ -28,9 +28,11 @@ service.interceptors.request.use(config => {
|
||||
if (value !== null && typeof(value) !== "undefined") {
|
||||
if (typeof value === 'object') {
|
||||
for (const key of Object.keys(value)) {
|
||||
let params = propName + '[' + key + ']';
|
||||
var subPart = encodeURIComponent(params) + "=";
|
||||
url += subPart + encodeURIComponent(value[key]) + "&";
|
||||
if (value[key] !== null && typeof (value[key]) !== 'undefined') {
|
||||
let params = propName + '[' + key + ']'
|
||||
let subPart = encodeURIComponent(params) + '='
|
||||
url += subPart + encodeURIComponent(value[key]) + '&'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
url += part + encodeURIComponent(value) + "&";
|
||||
|
@ -55,18 +55,17 @@ export function resetForm(refName) {
|
||||
|
||||
// 添加日期范围
|
||||
export function addDateRange(params, dateRange, propName) {
|
||||
var search = params;
|
||||
search.params = {};
|
||||
if (null != dateRange && '' != dateRange) {
|
||||
if (typeof (propName) === "undefined") {
|
||||
search.params["beginTime"] = dateRange[0];
|
||||
search.params["endTime"] = dateRange[1];
|
||||
let search = params
|
||||
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}
|
||||
dateRange = Array.isArray(dateRange) ? dateRange : []
|
||||
if (typeof (propName) === 'undefined') {
|
||||
search.params['beginTime'] = dateRange[0]
|
||||
search.params['endTime'] = dateRange[1]
|
||||
} else {
|
||||
search.params["begin" + propName] = dateRange[0];
|
||||
search.params["end" + propName] = dateRange[1];
|
||||
search.params['begin' + propName] = dateRange[0]
|
||||
search.params['end' + propName] = dateRange[1]
|
||||
}
|
||||
}
|
||||
return search;
|
||||
return search
|
||||
}
|
||||
|
||||
// 回显数据字典
|
||||
|
Loading…
Reference in New Issue
Block a user