<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>备件申请-待出库</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="decorator" content="base" />
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/static/css/reset.css" />
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/lib/font/iconfont.css" />
</head>
<body>

<div class="layui-fluid">
    <div class="layui-form layui-card">
      <div class="layui-tab layui-tab-brief">
          <ul class="layui-tab-title">
              <sfTags:pagePermission authFlag="WDGD_FWZ_FWZ_T" html='<a href="${ctx}/order/getInServiceOrders"><li class="layui-this">服务中工单</li></a>'/>
              <button class="layui-btn f-r mt-10 mr-15 pl-10 pr-10"  lay-submit lay-filter="resetButton" >
                  <i class="layui-icon fs-12">&#xe615;</i>
                  重置
              </button>
              <button class="layui-btn f-r mt-10 mr-15 pl-10 pr-10" id="searchBtn" lay-submit lay-filter="LAY-user-back-search">
                  <i class="layui-icon fs-12">&#xe615;</i>
                  查询
              </button>
          </ul>
      </div>
      <div class="layui-card-body layuiadmin-card-header-auto">
          <form class="layui-form layui-card" action="" id="searchForm">
          <div class="layui-form-item" >
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">工单编号：</label>
                  <div class="layui-input-block">
                      <input type="text" name="number" class="layui-input" >
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">服务商名称：</label>
                  <div class="layui-input-block">
                      <select name="siteId" lay-search>
                          <option value="">请选择</option>
                          <c:forEach var="site" items="${siteList}">
                              <option value="${site.columns.id}">${site.columns.name}</option>
                          </c:forEach>
                      </select>
                  </div>
              </div>

              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">派工单状态：</label>
                  <div class="layui-input-block" >
                      <select name="site_status" lay-filter="aihao">
                          <option value="">请选择</option>
                          <option value="1" >待服务商接单</option>
                          <option value="3" >待服务商派工</option>
                          <option value="4" >待工程师接单</option>
                          <option value="5">待上门</option>
                          <option value="6">服务中</option>
                      </select>
                  </div>
              </div>

              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">服务类型：</label>
                  <div class="layui-input-block" >
                      <select name="service_type" lay-filter="aihao" lay-search>
                          <option value="">请选择</option>
                          <option value="安装" >安装</option>
                          <option value="维修" >维修</option>
                          <option value="咨询" >咨询</option>
                      </select>
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">设备类型：</label>
                  <div class="layui-input-block" >
                      <select name="appliance_category" lay-search>
                          <option value="">请选择</option>
                          <option value="光伏组件">光伏组件</option>
                          <option value="逆变器">逆变器</option>
                          <option value="通讯模块">通讯模块</option>
                          <option value="并网箱">并网箱</option>
                          <option value="线缆">线缆</option>
                          <option value="配件">配件</option>
                      </select>
                  </div>
              </div>

              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">服务措施：</label>
                  <div class="layui-input-block">
                      <select name="service_measures" lay-search>
                          <option value="">请选择</option>
                          <c:forEach var="measures" items="${measures}">
                              <option value="${measures.columns.service_measures}">${measures.columns.service_measures}</option>
                          </c:forEach>
                      </select>
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">设备型号：</label>
                  <div class="layui-input-block">
                      <input type="text" name="appliance_model" class="layui-input" >
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">用户姓名：</label>
                  <div class="layui-input-block">
                      <input type="text" name="customer_name" class="layui-input" >
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">用户电话：</label>
                  <div class="layui-input-block">
                      <input type="text" name="customer_mobile" class="layui-input" >
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">用户地址：</label>
                  <div class="layui-input-block">
                      <input type="text" name="customer_address" class="layui-input" >
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">电站名称：</label>
                  <div class="layui-input-block">
                      <input type="text" name="power_station_name" class="layui-input" >
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">设备序列号：</label>
                  <div class="layui-input-block">
                      <input type="text" name="appliance_machine_code" class="layui-input" >
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">工单描述：</label>
                  <div class="layui-input-block">
                      <input type="text" name="remarks" class="layui-input" >
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">保修类型：</label>
                  <div class="layui-input-block" >
                      <select name="warranty_type" lay-filter="aihao">
                          <option value="">请选择</option>
                          <option value="1" >保内</option>
                          <option value="2" >保外</option>
                      </select>
                  </div>
              </div>
              <div class="layui-col-lg2 layui-col-sm3">
                  <label class="layui-form-label">标记类型：</label>
                  <div class="layui-input-block" >
                      <select name="flag" id="flag">
                          <option value="">请选择</option>
                          <c:forEach var="mark" items="${typeList}">
                              <option value="${mark.columns.id}">${mark.columns.name}</option>
                          </c:forEach>
                      </select>
                  </div>
              </div>

              <div class="layui-col-lg4 layui-col-sm6">
                  <label class="layui-form-label">报单时间：</label>
                  <div class="layui-input-block">
                      <div class="layui-col-xs5">
                          <input type="text" name="repairTimeSta" class="layui-input" id="repairTime" placeholder="开始日期">
                      </div>
                      <div class="layui-col-xs2 text-c lh-30">
                          —
                      </div>
                      <div class="layui-col-xs5">
                          <input type="text" name="repairTimeEnd" class="layui-input" id="endTime" placeholder="结束日期">
                      </div>
                  </div>
              </div>
              <div class="layui-col-lg4 layui-col-sm6">
                  <label class="layui-form-label">派单时间：</label>
                  <div class="layui-input-block">
                      <div class="layui-col-xs5">
                          <input type="text" name="dispatchTimeSta" class="layui-input" id="processStartTime" placeholder="开始日期">
                      </div>
                      <div class="layui-col-xs2 text-c lh-30">
                          —
                      </div>
                      <div class="layui-col-xs5">
                          <input type="text" name="dispatchTimeEnd" class="layui-input" id="processEndTime" placeholder="结束日期">
                      </div>
                  </div>
              </div>
              <div class="layui-col-lg4 layui-col-sm6">
                  <label class="layui-form-label">预约时间：</label>
                  <div class="layui-input-block">
                      <div class="layui-col-xs5">
                          <input type="text" name="promiseStratTime" class="layui-input" id="promiseStratTime" placeholder="开始日期">
                      </div>
                      <div class="layui-col-xs2 text-c lh-30">
                          —
                      </div>
                      <div class="layui-col-xs5">
                          <input type="text" name="promiseEndTime" class="layui-input" id="promiseEndTime" placeholder="结束日期">
                      </div>
                  </div>
              </div>

      </div>
          </form>
      </div>
    </div>
    <div class="layui-card">
        <div class="layui-card-body">
            <table class="layui-hide" lay-skin="row" id="test" lay-filter="test"></table>
            <script type="text/html" id="toolbarDemo">
                <div class="layui-btn-container">
                    <sfTags:pagePermission authFlag="FWZ_ZP_B" html=' <button class="layui-btn layui-btn-sm" lay-event="transfer"><i class="layui-icon layui-icon-cols"></i>转派</button>'/>
                    <sfTags:pagePermission authFlag="FWZ_WX_B" html=' <button class="layui-btn layui-btn-sm" lay-event="invalid"><i class="layui-icon layui-icon-export"></i>无效</button>'/>
                 <%--   <sfTags:pagePermission authFlag="FWZ_FK_B" html='<button class="layui-btn layui-btn-sm" lay-event="feedback"><i class="layui-icon layui-icon-export"></i>反馈</button>'/>--%>
                    <sfTags:pagePermission authFlag="FWZ_DC_B" html=' <button class="layui-btn layui-btn-sm" lay-event="export" id="exportBtn"><i class="layui-icon layui-icon-export"></i>导出</button>'/>

                </div>
            </script>
        </div>
    </div>
</div>
<%--查看图片--%>
<div id="lookImg" class="hide pos-r">
    <div style="position:relative;width:100%;height:100%;">
        <div class="w-500 h-500 lookImg">
            <img src="" width="80%" id="image">
        </div>
        <i class="layui-icon xuanZhuan" style="position:absolute;bottom:9px;left:50%;">&#xe9aa;</i>
    </div>
</div>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/factory.js"></script>
<script>
    var table;
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'tableExt', 'jquery', 'layer','laypage','laydate','form'], function(){
        $ = layui.$;
        tableExt = layui.tableExt;
        layer = layui.layer;
        laypage = layui.laypage;
        laydate = layui.laydate;
        form = layui.form;
        table = tableExt.getLayTable();

        //旋转
        var deg = 0;
         $(".xuanZhuan").click(function(){
             deg += 90;
             document.getElementById("image").style.transform = "rotate(" + deg + "deg)";
         })

        //开始日期
        var insStart = laydate.render({
            elem: '#repairTime'
            ,type: 'datetime'
            ,done: function(value, date){
                //更新结束日期的最小日期
                insEnd.config.min = lay.extend({}, date, {
                    month: date.month - 1
                });

                //自动弹出结束日期的选择器
                insEnd.config.elem[0].focus();
            }
        });

        //结束日期
        var insEnd = laydate.render({
            elem: '#endTime'
            ,type: 'datetime'
            ,done: function(value, date){
                //更新开始日期的最大日期
                insStart.config.max = lay.extend({}, date, {
                    month: date.month - 1
                });
            }
        });
        //开始日期
        var promiseStratTime = laydate.render({
            elem: '#promiseStratTime'
            ,type: 'datetime'
            ,done: function(value, date){
                //更新结束日期的最小日期
                promiseEndTime.config.min = lay.extend({}, date, {
                    month: date.month - 1
                });
                //自动弹出结束日期的选择器
                promiseEndTime.config.elem[0].focus();
            }
        });
        //结束日期
        var promiseEndTime = laydate.render({
            elem: '#promiseEndTime'
            ,type: 'datetime'
            ,done: function(value, date){
                //更新开始日期的最大日期
                promiseStratTime.config.max = lay.extend({}, date, {
                    month: date.month - 1
                });
            }
        });
        //开始日期
        var processStartTime = laydate.render({
            elem: '#processStartTime'
            ,type: 'datetime'
            ,done: function(value, date){
                //更新结束日期的最小日期
                processEndTime.config.min = lay.extend({}, date, {
                    month: date.month - 1
                });
                //自动弹出结束日期的选择器
                processEndTime.config.elem[0].focus();
            }
        });
        //结束日期
        var processEndTime = laydate.render({
            elem: '#processEndTime'
            ,type: 'datetime'
            ,done: function(value, date){
                //更新开始日期的最大日期
                processStartTime.config.max = lay.extend({}, date, {
                    month: date.month - 1
                });
            }
        });

        tableExt.render({
            elem: '#test'
            , height: 'full-260'
            , toolbar: '#toolbarDemo'
            , defaultToolbar: false
            , limits : [ 20, 50, 100 ]
            , limit:20
            , page : true //开启分页
            , url: '${ctx}/order/platform/getPlatformOrderStatus?status=2'
            , cols: [[
                {type: 'numbers',title: '序号',fixed:'left'}
                , {field: 'id', type: 'checkbox',fixed: 'left'}
                , {field: 'number', title: '工单编号', minWidth:'200',sort: false, align: 'center',fixed: 'left', exportable:true,templet:function(d){
                    var flag = d.flag;
                    var html;
                    if(isBlank(flag)){
                        html ="<i class=\"icon iconfont\" style=\"color: #8D8D8D\" onclick=\"orderFlag('"+d.id+"')\">&#xe6b0;</i>";
                    }else{
                        html ="<i class=\"icon iconfont \" style=\"color: "+d.flag_type+";\" onclick=\"orderFlag('"+d.id+"')\">&#xe6b0;</i>";
                    }
                    return html + "&nbsp;&nbsp;<a href=\"#\" class=\"layui-table-link\" onclick=\"orderDetail('"+d.id+"')\">"+d.number+"</a>";
                }}
                , {field: 'site_name', title: '服务商名称', sort: false, align: 'center', width:200,exportable:true}
                , {field: 'site_status', title: '派工单状态', sort: false, align: 'center', width:150,exportable:true,templet:function(d) {
                    var callback_result = d.callback_result;
                    if (d.site_status == 3) {
                        return "待服务商派工";
                    }else  if (d.site_status == 4) {
                        if(callback_result ==2){
                            return "<span data-pass = \"passed\">待工程师接单</span>";
                        }
                        return "待工程师接单";
                    }else  if (d.site_status == 5) {
                        return "待上门";
                    }else  if (d.site_status == 1) {
                        return "待服务商接单";
                    }else  if (d.site_status == 2) {
                        return "服务商已拒单";
                    }else  {
                        if(callback_result ==2){
                            return "<span data-pass = \"passed\">服务中</span>";
                        }
                        return "服务中";
                    }
                },expFormat:function(d){
                    var callback_result = d.callback_result;
                    if (d.site_status == 3) {
                        return "待服务商派工";
                    }else  if (d.site_status == 4) {
                        return "待工程师接单";
                    }else  if (d.site_status == 5) {
                        return "待上门";
                    }else  if (d.site_status == 1) {
                        return "待服务商接单";
                    }else  if (d.site_status == 2) {
                        return "服务商已拒单";
                    }else  {
                        if(callback_result ==2){
                            return "服务中";
                        }
                        return "服务中";
                    }
                }
                }
                , {field: 'power_station_name', title: '电站名称', sort: false, align: 'center',width:200,exportable:true}
           /*     , {field: 'dispatch_time', title: '派单时间',minWidth:'180', sort: false, align: 'center',width:200, exportable:true}*/
                , {field: 'customer_name', title: '用户姓名', sort: false, align: 'center',width:150, exportable:true}
                , {field: 'customer_mobile', title: '用户电话', sort: false, align: 'center', width:180,exportable:true}
                , {field: 'customer_address', title: '用户地址',minWidth:'200', sort: false, align: 'center', exportable:true,templet:function(d){
                            return d.province+d.city+d.area+d.customer_address;
                    }
                    , expFormat: function (d) {
                        return d.province+d.city+d.area+d.customer_address;
                    }
                    }

                , {field: 'promise_time', title: '预约时间',minWidth:'180', sort: false, align: 'center', exportable:true}
                , {field: 'promise_limit', title: '时间要求',minWidth:'180', sort: false, align: 'center', exportable:true}
                , {field: 'service_type', title: '服务类型', sort: false, align: 'center',width:180, exportable:true}
                , {field: 'service_measures', title: '服务措施', sort: false, align: 'center',width:180,exportable:true}
                , {field: 'appliance_capacity', title: '容量(KW)', sort: false, align: 'center',width:150,exportable:true}
                , {field: 'warranty_type', title: '保修类型', sort: false, align: 'center',width:150, exportable:true,templet:function(d){
                    if(d.warranty_type == 1){
                        return "保内";
                    } else if(d.warranty_type == 2){
                        return "保外";
                    } else{
                        return "";
                    }               },
                    expFormat: function (d) {  //格式导出的化字段
                        if(d.warranty_type == 1){
                            return "保内";
                        }else if(d.warranty_type == 2){
                            return "保外";
                        }else{
                            return "";
                        }
                    }
                    }
                , {field: 'appliance_model', title: '设备型号', minWidth:'150',sort: false, align: 'center',exportable:true}
                , {field: 'appliance_category', title: '设备类型', minWidth:'150',sort: false, align: 'center',exportable:true}
                , {field: 'appliance_machine_code', title: '设备序列号', minWidth:'150',sort: false, align: 'center',exportable:true}
                , {field: 'remarks', title: '工单描述', minWidth:'200',sort: false, align: 'center',exportable:true}
                , {field: 'order_type', title: '信息来源', sort: false, align: 'center',width:180,exportable:true,templet:function(d){
                    if(d.order_type == 1){
                        return "用户在线报修";
                    }else if(d.order_type == 2){
                        return "平台录入";
                    }else if (d.order_type == 4) {
                        return "电子商务";
                    } else{
                        return "其他";
                    }
                },expFormat:function(d){
                    if(d.order_type == 1){
                        return "用户在线报修";
                    }else if(d.order_type == 2){
                        return "平台录入";
                    }else if (d.order_type == 4) {
                        return "电子商务";
                    } else{
                        return "其他";
                    }
                }}
                , {field: 'createName', title: '报单人', minWidth:'150',sort: false, align: 'center',exportable:true}
                , {field: 'repair_time', title: '报单时间',minWidth:'200', sort: false, align: 'center',exportable:true}
                , {field: 'bd_imgs', title: '故障图片', minWidth:'150',sort: false, align: 'center',templet:function(d){
                    if(isBlank(d.bd_imgs)){
                        return '';
                    }else{
                     return ' <a style="color:#D9B589" href="javascript:showImages(\'' + d.bd_imgs + '\');"> 查看</a>';
                    }
                }}
                , {field: 'appliance_buy_time', title: '投运时间',minWidth:'200', sort: false, align: 'center',exportable:true}
                , {field: 'dispatch_time', title: '派单时间',minWidth:'200', sort: false, align: 'center',exportable:true}
                , {field: 'process_time', title: '接单时间',minWidth:'200', sort: false, align: 'center',exportable:true}
                , {field: 'drop_in_time', title: '上门时间',minWidth:'200', sort: false, align: 'center',exportable:true}
                , {field: 'end_time', title: '完工时间',minWidth:'200', sort: false, align: 'center',exportable:true}
                , {field: 'employe_name', title: '服务工程师', minWidth:'150',sort: false, align: 'center',exportable:true}
                , {field: 'level', title: '重要程度', minWidth:'150',sort: false, align: 'center',exportable:true ,templet:function(d){
                    if(d.level== 1){
                        return "紧急";
                    } if(d.level== 2){
                        return "一般";
                    }else{
                        return " ";
                    }
                },expFormat:function(d){
                    if(d.level== 1){
                        return "紧急";
                    } if(d.level== 2){
                        return "一般";
                    }else{
                        return " ";
                    }
                }}
            ]]
            ,done:function(res,cuss,count){
                $('span[data-pass="passed"]').parent().parent().parent().css('background-color','#ffeaf2');
                $('.layui-table-header .laytable-cell-checkbox input').attr('disabled','disabled');
             /*   $('.layui-table-header .laytable-cell-checkbox input').attr('disabled','disabled');
                $('.layui-table-header .laytable-cell-checkbox div').hide();*/
            }
            ,exportOpt: {                           //导出选项配置
                ele: '#exportBtn',                   //导出的Dom元素
                headerTitle: '工单管理-服务中',             //excel表格的标题
                pageData: false,                     //true:导出的数据为页面数据，false:最大导出maxAmount条数据
                maxAmount: 1000,                    //当pageData为false生效
                fileName: '工单管理-服务中',
                where: function () {
                   //当pageData为false时生效，过滤的条件
                    return _serializeJson($("#searchForm"));
                }
            }
        });

        //头工具栏事件
        table.on('toolbar(test)', function(obj){
            switch(obj.event){
                case 'invalid':
                    var checkStatus = table.checkStatus(obj.config.id);
                    var data = checkStatus.data;
                    if (data.length != 1) {
                        layer.msg("请选择一条数据",{icon:5,anim:6});
                        return;
                    }
                    var orderId = data[0].id;
                    var status = data[0].status;
                    if(status !=1 && status!=2 && status!=3 && status!=4){
                        layer.msg("当前状态不可操作无效",{icon:5,anim:6});
                        return;
                    }else{
                        var indexla = layer.confirm('您确定要操作无效工单吗？', {
                            icon:3,
                            btn: ['确定','取消'] //按钮
                        }, function(){
                            layer.close(indexla);
                            layer.open({
                                type: 2,
                                content: "${ctx}/order/lookNOUse?orderId="+orderId  //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
                                ,title: "无效工单"
                                ,area:["600px","220px"]
                            })
                        }, function(){
                            layer.close(indexla)
                        });
                    }
                    break;
                case 'transfer':
                    var checkStatus = table.checkStatus(obj.config.id);
                    var data = checkStatus.data;
                    if (data.length != 1) {
                        layer.msg("请选择一条数据",{icon:5,anim:6});
                        return;
                    }
                    var status = data[0].status;
                    if(status != 2){
                        layer.msg("该工单为不可转派工单",{icon:5,anim:6});
                        return;
                    }
                    var orderId = data[0].id;
                    layer.open({
                        type: 2,
                        content: "${ctx}/dispatch/getturnDisOrderSite?orderId="+data[0].id  //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
                        ,title: "转派"
                        ,area:["800px","480px"]
                    });
                    break;
               /* case 'feedback':
                    var checkStatus = table.checkStatus(obj.config.id);
                    var data = checkStatus.data;
                    var status = data[0].site_status;
                    if (data.length != 1) {
                        layer.msg("请选择一条数据",{icon:5,anim:6});
                        return;
                    }
                    if(status=='3'){
                        layer.msg("服务商未派工，不可操作反馈！",{icon:5,anim:6});
                        return;
                    }
                    var orderId = data[0].id;
                    var barcode = data[0].appliance_barcode;
                    var mark = false;
                    layer.open({
                        type: 2,
                        content: "${ctx}/order/platFormFeedback?orderId="+orderId  //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
                        ,title: "反馈封单"
                      //  ,btn:['反馈完成',"过程反馈","取消"]
                        ,area:["700px","420px"]

                        ,end:function(){
                            //刷新表格
                            table.reload('test', {
                                page:{
                                    curr:1
                                }
                            });
                        }
                    });
                    break;*/
            };
        });

        //监听行单击事件
        table.on('row(test)', function(obj){
            var data = obj.data;
            var oldData = table.cache["test"];
            var checkCell=obj.tr.find(".layui-form-checkbox");
            var CHECKED;
            if(obj.tr.hasClass("xuanzhong-special")){
                CHECKED = false;
                obj.tr.removeAttr("style");
                obj.tr.removeClass("xuanzhong-special");
                obj.tr.removeClass('layui-table-click');
                checkCell.removeClass('layui-form-checked');
            }else{
                CHECKED=true
                $(obj.tr).css('background-color','#CCEAEA');
                $(obj.tr).addClass("xuanzhong-special");
                obj.tr.addClass('layui-table-click');
                checkCell.addClass('layui-form-checked');
            }
            $.each(oldData,function(i,val){
                if(val.id == data.id){
                    oldData[i].LAY_CHECKED=CHECKED
                }
            })

        });


        //监听搜索
        form.on('submit(LAY-user-back-search)', function(data){
            var field = data.field;
            //执行重载
            table.reload('test', {
                where: field,
                page:{
                    curr:1
                }
            });
        });

        //重置
        form.on('submit(resetButton)', function(data){
            $("#searchForm")[0].reset();
            layui.form.render();

        });

    });

    function queryOrder(){
        window.location.reload();
    }

    function showImages(images){
        var arr=images.split(",");
        var number=0;
        $("#lookImg img").attr('src', "${commonStaticImgPath}" + arr[number]);
        layer.open({
            type: 1,
            title:'查看图片',
            area:['500px','543px'],
            btn:['上一张','下一张'],
            content: $('#lookImg'),
            yes:function(){
                if(number<=0){
                    number=0;
                }else{
                    number-=1;
                }
                $("#lookImg img").attr('src', "${commonStaticImgPath}" + arr[number]);
            },btn2:function(){
                if(number>=arr.length-2){
                    number=arr.length-2;
                }else{
                    number+=1;
                }
                console.log(number);
                $("#lookImg img").attr('src', "${commonStaticImgPath}" + arr[number]);
                return false;
            }
        });
    }

    //标记工单
    function orderFlag(id){
        layer.open({
            type: 2,
            content: "${ctx}/order/getFlagOrder?orderId="+id //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
            ,title: "标记工单"
            ,area:["300px","260px"]
            ,closeBtn: 0
            ,shadeClose:true

        });
    }

    /*工单详情*/
    function orderDetail(id) {
        layer.open({
            type: 2,
            title:" 工单信息",
            resize:false,
            area: ['1100px', '98%'],
            content: '${ctx}/order/getplatformOrderForm?orderId='+id
            ,cancel:function(){
              /*  table.reload('test');*/ //数据刷新
            }
        });
    }


    //备件详情
    function fittingDetail(id){
        layer.open({
            type: 2
            , title: '备件信息'
            , content: '${ctx}/platform/fitting/toFittingDetailNo?id=' + id
            , area: ['1000px', '50%']
            , yes: function(index, layero){

            }
        });
    }

    function reset(){
        $("#searchForm").find("select").val("");
        $("#searchForm").find("input").val("");
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }
</script>
</body>
</html>

