<!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="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="" shiro:hasPermission="goblin:extag:add">
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="goblin:extag:rmv">
                <i class="fa fa-remove"></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 editFlg = [[${@permission.hasPermi('goblin:tag:edit')}]];
    var rmvFlg = [[${@permission.hasPermi('goblin:extag:rmv')}]];
    var prefix = ctx + "goblin/tag";
    $(function () {
        var options = {
            url: prefix + "/list",
            removeUrl: prefix + "/rmv",
            sortName: "mid desc",
            modalName: "标签库",
            columns: [{
                checkbox: true
            },
                {
                    field: 'tagName',
                    title: '名称'
                },
                {
                    field: 'tagPic',
                    title: '图标',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'counts',
                    title: '关联商品数量'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlg + '" href="javascript:void(0)" onclick=""><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + rmvFlg + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.tagId + '\')"><i class="fa fa-trash"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>