<!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('正在现场App版本列表')"/>
</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>App类型：</label>
                            <select name="appType">
                                <option value="">全部</option>
                                <option value="1">正在现场</option>
                                <option value="2">验票</option>
                            </select>
                        </li>
                        <li>
                            <label>类型：</label>
                            <select name="type">
                                <option value="">全部</option>
                                <option value="1">IOS</option>
                                <option value="2">Android</option>
                            </select>
                        </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="kylin:zhengzaiAppVersion:create">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="kylin:zhengzaiAppVersion:delete">
                删除
            </a>
        </div>
        <div class="col-sm-12 select-table table-bordered">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var updateFlag = [[${@permission.hasPermi('kylin:zhengzaiAppVersion:update')}]];
    var removeFlag = [[${@permission.hasPermi('kylin:zhengzaiAppVersion:delete')}]];

    var prefix = ctx + "kylin/zhengzaiAppVersion";
    $(function () {
        var options = {
            url: prefix + "/list",
            updateUrl: prefix + "/update/{id}",
            createUrl: prefix + "/create",
            removeUrl: prefix + "/delete",
            modalName: "版本",
            columns: [{
                checkbox: true
            },
                {
                    field: 'zhengzaiAppVersionsId',
                    title: 'ID'
                },
                {
                    field: 'appType',
                    title: 'App类型',
                    formatter: function(value, row, index) {
                        if (row.appType == 1) {
                            return "正在现场";
                        } else {
                            return "验票";
                        }
                    }
                },
                {
                    field: 'name',
                    title: '名称'
                },
                {
                    field: 'version',
                    title: '版本号'
                },
                {
                    field: 'minVersion',
                    title: '最小版本号'
                },
                {
                    field: '',
                    title: '类型',
                    formatter: function(value, row, index) {
                        if (row.type == 1) {
                            return "IOS";
                        } else {
                            return "Android";
                        }
                    }
                },
                {
                    field: '',
                    title: '是否生产环境',
                    formatter: function(value, row, index) {
                        if (row.isProduction == 1) {
                            return "是";
                        } else {
                            return "否";
                        }
                    }
                },
                {
                    field: '',
                    title: '是否强制升级',
                    formatter: function(value, row, index) {
                        if (row.isForce == 1) {
                            return "是";
                        } else {
                            return "否";
                        }
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + updateFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.zhengzaiAppVersionsId + '\')"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.zhengzaiAppVersionsId + '\')"></i>删除</a> ');
                        return actions.join('');
                    }
                }]
        };

        $.table.init(options);

    });
</script>
</body>
</html>