<div class="row">
<div class="col-sm-7">
<div class="input-group mb-3">
{% if filters %}
{% for f in filters %}
{% if "date" in f.name %}
<input type="text" name={{ f.name }} class="form-control pick-date"
placeholder="  {{ f.placeholder }}" autocomplete="off">
{% else %}
<input type="text" name={{ f.name }} class="form-control"
placeholder={{ f.placeholder }} autocomplete="off">
{% endif %}
{% endfor %}
<input type="hidden" name="source" value={{ source }}>
{% if 'hidden' in request.GET %}
<input type="hidden" name="hidden" value="1">
{% endif %}
<button class="btn btn-primary" type="submit" id="chaxun">查 询</button>
{% endif %}
</div>
</div>
</div>
<script>
$('.pick-date').datepicker({
format: "yyyy-mm-dd",
maxViewMode: 1,
language: "zh-CN",
defaultDate : new Date()
});
$("input:text", document.forms[0]).each(function(){
$(this).val(getUrlParam(this.name))
});
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null)
return decodeURI(r[2]);
return null; //返回参数值
}
</script>