<!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">
                    <a class="btn btn-warning" onclick="$.table.importExcel()">
                        <i class="fa fa-upload"></i>导入
                    </a>
                </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 prefix = ctx + "kylin/performances";
    var importfix = ctx + "import/";
    var importStatusDic = [[${@dict.getType('zhengzai_import_status')}]];
    var options = {
        url: prefix + "/orderImport/list/" + '[[${performancesId}]]'.replaceAll("\"", ""),
        importUrl: importfix +  "OrderOutLine/"+ '[[${performancesId}]]'.replaceAll("\"", ""),//导入
        importTemplateUrl: importfix + "template/OrderOutLine",//导出
        detailUrl: importfix + "OrderOutLine/detailsList/{id}",
        modalName: "订单",
        orderSc: "desc",
        orderItem: "created_at",
        columns: [{
            checkbox: true
        },
            {
                field: 'importId',
                title: 'id'
            },
            {
                field: 'title',
                title: '文件名称'
            },
            {
                field: 'status',
                title: '订单状态',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(importStatusDic, value);
                }
            },
            {
                field: 'allCount',
                title: '总条数'
            },
            {
                field: 'errorCount',
                title: '失败条数'
            },
            {
                field: 'successCount',
                title: '成功条数'
            },
            {
                field: 'createdAt',
                title: '导入时间'
            },
            {
                field: 'updatedAt',
                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.importId + '\')"><i class="fa fa-edit"></i>错误详情</a> ');
                    return actions.join('');
                }
            }]
    };
    $.table.init(options);

</script>
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据
                &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
                    class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</body>
</html>
