123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <div class="panel panel-warning">
- <div class="panel-heading">
- <h4 class="panel-title">
- <span class="glyphicon glyphicon-filter btn-xs"></span>
- 查找/筛选/过滤
- <small>(带*项目可模糊查询)</small>
- </h4>
- </div>
- <div class="panel-body">
- <form class="form-inline" action="" method="GET" onsubmit="return procFilterData();">
- {% for i in textitems %}
- <div class="form-group">
- <label class="sr-only" for="{{i.ctid}}">{{i.title}}</label>
- <input type="text" class="form-control" id="{{i.ctid}}" name="{{i.ctname}}" placeholder="{{i.title}}" value="{{i.value}}" />
- </div>
- {% endfor %}
- {% for i in valitems %}
- <div class="form-group">
- <label class="sr-only" for="{{i.ctid}}">{{i.title}}</label>
- <input type="text" class="form-control" id="{{i.ctid}}" name="{{i.ctname}}" placeholder="{{i.title}}" value="{{i.value}}" />
- </div>
- {% endfor %}
- {% for i in dateeqi %}
- <div class="form-group">
- <label class="sr-only" for="{{i.ctid}}">{{i.title}}</label>
- <input type="text" class="form-control" id="{{i.ctid}}" name="{{i.ctname}}" placeholder="{{i.title}}" value="{{i.value}}" />
- </div>
- {% endfor %}
- {% for i in datergi %}
- <div class="form-group">
- <label class="sr-only" for="{{i.ctid}}">{{i.title}}</label>
- <input type="hidden" id="{{i.ctid}}" class="datergi-res" name="{{i.ctname}}"/>
- <input type="text" class="form-control datergi-st" id="rgl_{{i.ctid}}" name="{{i.ctname}}" placeholder="{{i.title}}(起始日期)" value="{{i.valuest}}" />~
- <input type="text" class="form-control datergi-ed" id="rgr_{{i.ctid}}" name="{{i.ctname}}" placeholder="{{i.title}}(结束日期)" value="{{i.valueed}}" />
- </div>
- {% endfor %}
- {% for i in scitems %}
- <div class="form-group">
- <label for="{{i.ctid}}">{{i.title}}</label>
- <select class="form-control" id="{{i.ctid}}" name="{{i.ctname}}">
- <option value="all">全部</option>
- {% for j in i.oplst %}
- <option value="{{forloop.counter0}}">{{j}}</option>
- {% endfor %}
- </select>
- </div>
- {% endfor %}
- {% for i in mcitems %}
- <div class="form-group">
- <label for="{{i.ctid}}">{{i.title}}</label>
- <input type="hidden" id="smf_{{i.ctid}}" class="cmcres" name="{{i.ctname}}"/>
- <select multiple class="form-control cmcbox" id="{{i.ctid}}">
- {% for j in i.oplst %}
- <option value="{{forloop.counter0}}">{{j}}</option>
- {% endfor %}
- </select>
- </div>
- {% endfor %}
- <button type="submit" class="btn btn-primary">
- <span class="glyphicon glyphicon-ok btn-xs"></span>
- 提交
- </button>
- </form>
- <script type="text/javascript">
- function InitSC(){
- {% for i in scitems %}
- $("#{{i.ctid}}").val("{{i.value}}");
- {% endfor %}
- }
- function MCSet(ctid,sllt){
- var ar=Array();
- ar=sllt.split(',');
- for (var i = ar.length - 1; i >= 0; i--) {
- var ia=ar[i];
- console.log("#"+ctid+" option[value="+ia+"]");
- $("#"+ctid+" option[value="+ia+"]").attr('selected',true);
- };
- $("#"+ctid).val("{{i.value}}");
- }
- function InitMC(){
- {% for i in mcitems %}
- MCSet("{{i.ctid}}","{{i.value}}");
- {% endfor %}
- }
- function procFilterData(){
- $(".datergi-res").each(
- function(){
- var oid=$(this).attr('id');
- if($('#rgl_'+oid).val() && $('#rgr_'+oid).val()){
- $(this).val($('#rgl_'+oid).val()+"~"+$('#rgr_'+oid).val());
- }else{
- $(this).remove();
- }
- $('#rgl_'+oid).remove();
- $('#rgr_'+oid).remove();
- }
- );
- $(".cmcbox").each(
- function(){
- var sla=Array();
- var oid=$(this).attr('id');
- var sol=$("#"+oid+' option:selected');
- for (var i = sol.length - 1; i >= 0; i--) {
- var iv=$(sol[i]);
- sla.push(iv.val());
- };
- $("#smf_"+oid).val(sla.join(','));
- //$(this).remove();
- }
- );
-
- $("select").each(
- function(){
- if(!$(this).val()){
- $(this).remove();
- }
- if($(this).val()=="all"){
- $(this).remove();
- }
- }
- );
- $("input").each(
- function(){
- if(!$(this).val()){
- $(this).remove();
- }
- }
- );
- //return confirm('确认***吗??');
- }
- InitSC();
- InitMC();
- </script>
- </div>
- </div>
|