<!DOCTYPE html>
<html>

<head lang='zh'>
    <meta charset='utf-8'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="renderer" content="webkit" />
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=0" />
    <title>Luckysheet</title>
    <!-- <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/css/pluginsCss.css' />
    <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/plugins.css' />
    <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/css/luckysheet.css' />
    <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/assets/iconfont/iconfont.css' />
    <script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/js/plugin.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js"></script> -->
    <link rel='stylesheet' href='/static/js/luckysheet/plugins/css/pluginsCss.css' />
    <link rel='stylesheet' href='/static/js/luckysheet/plugins/plugins.css' />
    <link rel='stylesheet' href='/static/js/luckysheet/css/luckysheet.css' />
    <link rel='stylesheet' href='/static/js/luckysheet/assets/iconfont/iconfont.css' />
    <script src="/static/js/luckysheet/plugins/js/plugin.js"></script>
    <script src="/static/js/luckysheet/luckysheet.umd.js"></script>
    <script src="/static/js/api.config.js"></script>
    <script src="/static/js/util.js?v=1.0.0"></script>
    <script src="/static/js/url.js?v=1.0.0"></script>
    </script>
</head>
<style>
    * {
        padding: 0;
        margin: 0;
    }

    html,
    body {
        height: 100%;
        width: 100%;
        overflow-y: hidden;
    }

    /* .luckysheet-stat-area{
        display: none !important;
    } */
</style>

<body>
    <div id="luckysheet" style="width:99%;height:100%">
    </div>
    <script>
        var date = new Date();
        var month = date.getMonth()
        if (month >= 1 && month <= 9) {
            month = "0" + (month + 1);
        }
        var nowDate = date.getFullYear() + '-' + month
        $(function () {
            function receiveMessage(event) {
                if (event.data.module == 'aaa') {
                    getData(event.data.month)
                }
            }
            window.addEventListener("message", receiveMessage, false)
            getData(nowDate)
        })
        function getData(nowDate) {
            util.ajaxJson("", ctx + '/market/keywork/load', {
                "id": '',
                "opMonth": nowDate,
                "sts": '0'
            }, function (data) {
                if (data.result == 0) {
                    for (var i = 0; i < data.body[0].data.length; i++) {
                        for (var j = 0; j < data.body[0].data[i].length; j++) {
                            if (data.body[0].data[i][j] != null) {
                                if (data.body[0].data[i][j].hasOwnProperty('complete') && data.body[0].data[i][j].hasOwnProperty('revoke') && data.body[0].data[i][j].revoke != '1') {
                                    data.body[0].data[i][j].bg = null
                                } else if (data.body[0].data[i][j].hasOwnProperty('setup')) {
                                } else {
                                    data.body[0].data[i][j].bg = null
                                    data.body[0].data[i][j].v = ''
                                }
                            }
                        }
                    }
                    if (data.body[0].config.authority) {
                        data.body[0].config.authority.hintText = '仅供查看、禁止编辑'
                    }
                    initExcel(data.body)
                }
            });
        }
        function initExcel(data) {
            luckysheet.create({
                container: 'luckysheet',
                data: data,
                allowEdit: false, // 是否允许前台编辑
                showtoolbar: false, // 是否显示工具栏
                showConfigWindowResize: false,
                showtoolbarConfig: { paintFormat: false, italic: true, },// 工具栏配置
                showtoolbar: false,
                showinfobar: false,
                allowUpdate: false,
                column: 12,
                title: data[0].fileName || '默认模板',
                row: 10,
                lang: 'zh',
                showsheetbar: false, // 底部sheet显示/隐藏
                showstatisticBar: false, // 底部计数
                myFolderUrl: false,
                showinfobar: true,
                showstatisticBarConfig: {
                    count: false, // 计数栏
                    view: false, // 打印视图
                    zoom: false, // 缩放
                },
                cellRightClickConfig: {
                    copy: false, // 复制
                    copyAs: false, // 复制为
                    paste: true, // 粘贴
                    insertRow: true, // 插入行
                    insertColumn: true, // 插入列
                    deleteRow: true, // 删除选中行
                    deleteColumn: true, // 删除选中列
                    deleteCell: false, // 删除单元格
                    hideRow: false, // 隐藏选中行和显示选中行
                    hideColumn: false, // 隐藏选中列和显示选中列
                    rowHeight: false, // 行高
                    columnWidth: false, // 列宽
                    clear: false, // 清除内容
                    matrix: false, // 矩阵操作选区
                    sort: false, // 排序选区
                    filter: false, // 筛选选区
                    chart: false, // 图表生成
                    image: false, // 插入图片
                    link: false, // 插入链接
                    data: false, // 数据验证
                    cellFormat: false, // 设置单元格格式
                    isTrue: false
                },
                hook: {
                    cellMousedown: function () {
                        // window.top.$vm.$message({
                        //     message: '仅提供查看不可编辑',
                        //     type: 'info'
                        // })
                    },//绑定鼠标事件
                },
            })
        }
    </script>
</body>

</html>