<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>平台客户分配规则</title>

    <style>
        .btn-primary2{
            width: 100px;
            float: right;
        }

    </style>
</head>
<body>

<!-- 面包屑 begin -->
<div class="row-fluid">
    <div class="span12">
        <ul class="breadcrumb">
            <li class="active"><span class="divider" style="color:#26a0da;font-weight:bold;">/</span>规则列表</li>
        </ul>
    </div>
    <span style="margin-rirght: 50px;">
                                <%--<button type="button" class="btn btn-primary btn-sm"--%>
                                        <%--onclick="addRule()">添加规则</button>--%>
        <button type="button" class="btn btn-primary2"
                onclick="window.open('${ctx}/platformmanagement/addRule','_blank')">添加规则
        </button>
     </span>
</div>
<!-- 面包屑 begin -->

<div class="page-container">
    <div class="row${fluid}">
        <div class="span12">
            <form id="filterForm"  name="filterForm" class="form-inline filterForm" action="ruleList" method="get">

            </form>
        </div>
    </div>
    <table class="table table-striped table-advance table-hover">
        <thead>
        <tr>
            <th class="span1" width="50" style="text-align:center">序号</th>
            <th class="span1" width="50">平台组</th>
            <th class="span2" width="100">直销对接组</th>
            <th class="span2" width="100">创建人</th>
            <th class="span2" width="100">创建时间</th>
            <th class="span2" width="100">操作</th>
        </tr>
        </thead>
        <c:forEach items="${prList}" var="rule">
            <tr>
                <td class="span1" style="text-align:center">
                    <c:out value="${rule.id}"/>
                </td>
                <td class="span1">
                    <c:out value="${rule.platGroupName}"/>
                </td>
                <td class="span2">
                    <c:out value="${rule.salesGroupName}"/>
                </td>
                <td class="span2">
                    <c:out value="${rule.createrName}"/>
                </td>
                <td class="span2">
                    <f:formatDate value='${rule.createTime}' pattern='yyyy-MM-dd HH:mm:ss'/>
                </td>
                <td class="span2">
                    <button type="button" class="btn btn-default"
                            onclick="window.open('${ctx}/platformmanagement/${rule.id}?action=edit','_blank')">编辑
                    </button>&nbsp;
                    <button type="button" class="btn btn-default" onclick="delRule(${rule.id})">删除
                    </button>
                </td>
            </tr>
        </c:forEach>
    </table>
    <div class="row${fluid}">
        <house365:pagination page="${page}"/>
    </div>
</div>
<script type="text/javascript">
    function delRule(selectedId) {

        <%--$.ajax({--%>
            <%--url: "${ctx}/platformmanagement/"+selectedId,--%>
            <%--type: "DELETE",--%>
            <%--success: function () {--%>
                <%--window.location.href="${ctx}/platformmanagement/ruleList"--%>
            <%--},--%>
            <%--error: function (XMLHttpRequest, textStatus, errorThrown) {--%>
                <%--alert("删除出现异常，请联系管理员。");--%>
            <%--}--%>
        <%--});--%>
        House365Util.createModal("删除", "确定要删除？", function () {
            $.ajax({
                url: '${ctx}/platformmanagement/' + selectedId,
                type: "DELETE",
                success: function () {
                    window.location.reload();
                }
            });
        });
    }







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