<!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>
                            <label>客户编号：</label>
                            <input type="text" name="customerId"/>
                        </li>
                        <li>
                            <label>客户名称：</label>
                            <input type="text" name="customerName"/>
                        </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-success" onclick="$.operate.add()" shiro:hasPermission="business:owner:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="business:owner:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="business:owner:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:owner:export">
                <i class="fa fa-download"></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" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('business:owner:edit')}]];
    var removeFlag = [[${@permission.hasPermi('business:owner:remove')}]];
    var prefix = ctx + "business/owner";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "货主管理（供应商）",
            queryParams: queryParams,
            columns: [{
                checkbox: true
            },
                {
                    field: 'customerId',
                    title: '客户编号'
                },
                {
                    field: 'customerName',
                    title: '客户名称'
                },
                {
                    field: 'customerShortName',
                    title: '客户简称'
                },
                {
                    field: 'pyName',
                    title: '拼音简称'
                },
                {
                    field: 'cusTypeId',
                    title: '客户分类编号'
                },
                {
                    field: 'linkman',
                    title: '联系人'
                },
                {
                    field: 'telephone',
                    title: '手机号'
                },
                {
                    field: 'phone',
                    title: '联系电话'
                },
                {
                    field: 'fax',
                    title: '联系传真'
                },
                {
                    field: 'email',
                    title: '联系地址'
                },
                {
                    field: 'province',
                    title: '省'
                },
                {
                    field: 'city',
                    title: '市'
                },
                {
                    field: 'postcode',
                    title: '邮编'
                },
                {
                    field: 'address',
                    title: '地址'
                },
                {
                    field: 'status',
                    title: '状态 0：正常 1：停用'
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    field: 'version',
                    title: '版本号'
                },
                {
                    field: 'operatorid',
                    title: '操作人'
                },
                {
                    field: 'operatedate',
                    title: '操作日期'
                },
                {
                    field: 'provinceId',
                    title: '省编号'
                },
                {
                    field: 'cityId',
                    title: '市编号'
                },
                {
                    field: 'townId',
                    title: '县/区编号'
                },
                {
                    field: 'guid',
                    title: 'GUID'
                },
                {
                    field: 'updateDate',
                    title: '更新日期'
                },
                {
                    field: 'updateBy',
                    title: '更新人'
                },
                {
                    field: 'port',
                    title: '端口'
                },
                {
                    field: 'sts',
                    title: '状态'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.customerId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.customerId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function queryParams(params) {
        var search = $.table.queryParams(params);
        // 当前选择供应商
        search.cusTypeId = "2";
        return search;
    }
</script>
</body>
</html>