<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('销售目标达成列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>销售分部代码：</p>
                                <input type="text" name="subofficeCode"/>
                            </li>
                            <li>
                                <p>销售分部名称：</p>
                                <input type="text" name="subofficeName"/>
                            </li>
                            <li>
                                <p>销售员代码：</p>
                                <input type="text" name="empId"/>
                            </li>
                            <li>
                                <p>销售员姓名：</p>
                                <input type="text" name="empName"/>
                            </li>
                        </ul>
                        <ul>
                            <li>
                                <p>经销商代码：</p>
                                <input type="text" name="customerId"/>
                            </li>
                            <li>
                                <p>经销商名称：</p>
                                <input type="text" name="customerName" on/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-primary single disabled" onclick="$.operate.detail()" shiro:hasPermission="order:orderSalesDetail:info">
                    <i class="fa fa-edit"></i> 详情
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "order/orderSalesDetail";

        $(function() {
            var options = {
                url: prefix + "/list",
                detailUrl: prefix + "/info/{id}",
                modalName: "经销商目标达成",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id',
                    title : 'id',
                    visible: false
                },
                {
                    field : 'subofficeCode',
                    title : '销售分部/推广组代码',
                    visible: false
                },
                {
                    field : 'subofficeName',
                    title : '销售分部/推广组',
                    visible: false
                },
                {
                    field : 'empId',
                    title : '销售员代码'
                },
                {
                    field : 'empName',
                    title : '销售员姓名'
                },
                {
                    field : 'customerId',
                    title : '经销商代码'
                },
                {
                    field : 'customerName',
                    title : '经销商名称'
                },
                {
                    field : 'nowYearBud',
                    title : '预算(千元)'
                },
                {
                    field : 'nowYearAct',
                    title : '已复核(千元)'
                },
                {
                    field : 'reviewNo',
                    title : '未复核(千元)'
                },
                {
                    field : 'uncleared',
                    title : '未清(千元)'
                },
                {
                    field : 'freeze',
                    title : '冻结(千元)'
                },
                {
                    field : 'orderNum',
                    title : '销售凭证数量'
                },
                {
                    field : 'calMonth',
                    title : '日期'
                },
                {
                    field : 'runTime',
                    title : '数据更新时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);

            //失去焦点事件
                //去除前后空格
            $(".select-list input").blur(function (event){
                var val =  $(event.target).val();
                val = val.replace(/^\s+|\s+$/g,"")
                $(event.target).val(val);
            })
        });

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