i<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <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" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css" media="all">
    <style>
        .left-tree dt {
            font-size: 14px;
            font-weight: 600;
            padding: 5px 0;
            cursor: pointer;
        }
        .left-tree dd:hover {
            background-color: #eee !important;
        }
        .left-tree dd {
            cursor: pointer;
        }
    </style>
</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="SXGL_XMSX_DSH_T"
                                       html='<li class=""><a href="${ctx}/itemManagement/proj/waitDealItemPage">待审核</a></li>'/>
                <sfTags:pagePermission authFlag="SXGL_XMSX_DFP_T"
                                       html='<li class=""><a href="${ctx}/itemManagement/proj/waitDispatchItemPage">待分配</a></li>'/>
                <sfTags:pagePermission authFlag="SXGL_XMSX_YSH_T"
                                       html='<li class=""><a href="${ctx}/itemManagement/proj/endAuditItemPage">已审核</a></li>'/>
                <sfTags:pagePermission authFlag="SXGL_XMSX_SDSZ_T"
                                       html='<li class="layui-this"><a href="${ctx}/itemManagement/proj/auditSettingPage">审单设置</a></li>'/>
                <sfTags:pagePermission authFlag="SXGL_XMSX_YXSDSZ_T"
                                       html='<li class=""><a href="${ctx}/itemManagement/proj/priorAuditSettingPage">优先审单设置</a></li>'/>
<%--                <ul class="layui-tab-title">--%>
<%--                    <li class="layui-this">待处理</li>--%>
<%--                    <li>已处理</li>--%>
<%--                </ul>--%>
<%--                <button class="layui-btn f-r mt-10 mr-15 pl-10 pr-10 " type="reset" onclick="reset()">--%>
<%--                    <i class="layui-icon fs-12">&#xe9aa;</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" id="searchForm">
        </div>
    </div>
    <div class="layui-card">
        <div class="layui-card-body" style="display:flex;">
            <div class="left-tree" id="table1" style="min-width: 250px;width: 15%;">
                <dl>
                    <dt>电站资方名称</dt>
                    <c:forEach items="${partners}" var="step" varStatus="st">
                        <dd style="width: 100%;${st.index == 0 ? 'background-color:#eee;' : ''}" onclick="searchList(this)"><a rel="${step.columns.id}">${step.columns.name}</a></dd>
                    </c:forEach>
                </dl>
            </div>
            <div style="flex-grow: 1;">
                <table class="layui-hide" lay-skin="row" id="test" lay-filter="test"></table>
            </div>
        </div>
    </div>
</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/data.js"></script>
<script type="text/javascript">
    var saveMark = false;
    //初始数据
    var $form;
    var form;
    var upload;
    var $;
    var table;
    var laydate;
    var currentPartner = '${partners[0].columns.id}';
    var tableUrl = '${ctx}/taskdispatch/crmReviewGroup/listData'
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'tableExt', 'jquery', 'layer','laypage','laydate','form','excel'], function(){
        $ = layui.$
            ,form = layui.form
            ,tableExt = layui.tableExt;
        laydate = layui.laydate;
        table = layui.table;

       /* var toExamine_sj = '${fns:checkPagePermission(request, "XMGL_XMGL_DSHXX_SH_B")}';
        var ptysBtn_az = '${fns:checkPagePermission(request, "XMGL_AZYS_AZYS_YS")}';
        var examine_bw= '${fns:checkPagePermission(request, "XMGL_BWYS_BWYS_YS")}';*/
        tableExt.render({
            elem: '#test'
            , height: 'full-160'
            , id: 'test'
            , defaultToolbar: false
            , url: '${ctx}/taskdispatch/crmReviewGroup/listData?partnerId=${partners[0].columns.id}'
            , layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            , page: true
            // , toolbar:"#toolbarDemo"
            , method:"post"
            , limits: [20, 50, 100]
            , limit: 20
            , cols: [[
                {field: 'number', minWidth: 50, title: '序号', align: 'center', type: 'numbers', fixed: 'left'}
                , {field: 'id', title: '操作', minWidth : 100, align: 'center', fixed: 'left', templet:function(d){
                        return '<a class="layui-table-opt-link" lay-event="lookDetail">编辑</a>';
                    }
                }
                , {field: 'name', title: '审单组', minWidth: 400, align: 'center',exportable:true ,
                   /* templet: function (d) {
                        return "<a href=\"#\" class=\"layui-table-link\" onclick=\"traderDetail('" + d.id + "')\">" + d.name + "</a>";
                    }*/
                }
                , {field: 'leader_name', title: '组长', minWidth: 150, align: 'center',exportable:true }
                , {field: 'members', title: '组员', minWidth: 150, align: 'center',exportable:true }
                , {field: 'st1', title: '工作时间', minWidth: 150, align: 'center',exportable:true,templet:function(d) {
                    let spans=[];
                    if (d.st1) {
                        spans.push(d.st1+"-"+d.end1);
                    }
                    if (d.st2) {
                        spans.push(d.st2+"-"+d.end2);
                    }
                    return spans.join("、")
                    } }
                , {field: 'stat', title: '统计',align: 'center',minWidth: 100,exportable:true,templet:function(d) {
                    return "";
                    }}
            ],
            ]
            ,exportOpt:{                           //导出选项配置
                ele:'#exportBtn',                   //导出的Dom元素
                headerTitle: '待处理',             //excel表格的标题
                pageData:false,                     //true:导出的数据为页面数据，false:最大导出maxAmount条数据
                maxAmount: 1000,                    //当pageData为false生效
                fileName: '待处理',
                where: function (){
                    //   console.log(_serializeJson($("#searchForm")));//当pageData为false时生效，过滤的条件
                    return _serializeJson($("#searchForm"));
                }
            }
        });

        table.on('tool(test)',function(obj) {
            if(obj.event === 'lookDetail'){
                layer.open({type: 2,
                    title: '编辑',
                    content: '${ctx}/taskdispatch/crmReviewGroup/editPage?groupId=' + obj.data['id']+'&partnerId='+obj.data['partner_id'],
                    area: ['90%', '90%'],
                    end: function(){
                    }
                });
            }
        });

    })

    // function reload(){
    //     table.reload('test', {
    //         where: {
    //             name: $('#name').val().trim(),
    //             province:$("#province").val().trim(),
    //             telephone:$("#telephone").val().trim()
    //         }
    //     });
    // }

    function searchOrder() {
        //执行重载
        table.reload('test', {
            page: {
                curr: 1
            }
        });
    }

    function searchList(target) {
        $('.left-tree dd').css('background-color', '#fff')
        $(target).css('background-color', '#eee');
        currentPartner = $(target).find('a[rel]').attr('rel');
        table.reload('test', {
            page: {
                curr: 1
            },
            url: tableUrl+"?partnerId=" + currentPartner
        })
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }

</script>
</body>
</html>
