<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<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="role-form">
                <div class="select-list">
                    <ul>
                        <li>
                            公司名称&nbsp;：&nbsp;&nbsp;&nbsp;<input type="text" name="org3name"/>
                        </li>
                        <li>
                            &nbsp;&nbsp;&nbsp;大区名称&nbsp;：&nbsp;&nbsp;&nbsp;<input type="text" name="org4name"/>
                        </li>
                        <li>
                            销售部名称：<input type="text" name="org5name"/>
                        </li>
                        <li>
                            销售分部名称：<input type="text" name="org6name"/>
                        </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="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var datas = [[${@dict.getType('sys_normal_disable')}]];
    var prefix = ctx + "order/salesorgStart";
    $(function() {
        var options = {
            url: prefix+'/salesOrgList',
            modalName: "销售组织架构启用",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            clickToSelect: true,
            rememberSelected: true,
            columns: [{
                field: 'state',
                checkbox: true
            },
                {
                    field: 'org3code',
                    title: '公司代码'
                },{
                    field: 'org3name',
                    title: '公司名称'
                },{
                    field: 'org4code',
                    title: '大区代码'
                },{
                    field: 'org4name',
                    title: '大区名称'
                },{
                    field: 'org5code',
                    title: '销售部代码'
                },{
                    field: 'org5name',
                    title: '销售部名称'
                },{
                    field: 'org6code',
                    title: '销售分部代码'
                },{
                    field: 'org6name',
                    title: '销售分部名称'
                }]
        };
        $.table.init(options);
    });

    /* 添加用户-选择用户-提交 */
    function submitHandler() {
        //var rows = $.table.selectFirstColumns();
        let org6code = $.table.selectColumns('org6code')
        let org6name = $.table.selectColumns('org6name')
        console.log("org6code = " + org6code);
        console.log("org6name = " + org6name);
        if (org6code.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        var data = {"org6codes":org6code.join(),"org6names":org6name.join()};
        console.log("data = " + data);
        $.operate.save(prefix + "/addSalesorgStart", data);
    }
</script>
</body>
</html>