(function () {
    var multipleData = null;
    var page = {
        grid: null,
        init: function ($page) {
            page.grid = $page.find('#lr_EvaluationTeach_list').lrpagination({
                lclass: page.lclass,
                rows: 10,                            // 每页行数 
                getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调 
                    param.multipleData = multipleData;
                    page.loadData(param, callback, $page);
                },
                renderData: function (_index, _item, _$item) {// 渲染数据模板 
                    return page.rowRender(_index, _item, _$item, $page);
                },
                click: function (item, $item, $et) {// 列表行点击事件 
                    if ($et.hasClass('lr-btn-success')) {
                        page.btnClick(item, $item, $page);
                    }
                    else {
                        page.rowClick(item, $item, $page);
                    }
                }
                //btns: page.rowBtns
            });
        },
        lclass: 'lr-list',
        loadData: function (param, callback, $page) {// 列表加载后台数据 
            var _postParam = {
                pagination: {
                    rows: param.rows,
                    page: param.page
                },
                queryJson: '{}'
            };
            if (param.multipleData) {
                _postParam.queryJson = JSON.stringify(multipleData);
            }
            learun.httpget(config.webapi + '/learun/eval/studentlist', _postParam, (data) => {
                $page.find('.lr-badge').text('0');
                if (data) {
                    $page.find('.lr-badge').text(data.records);
                    callback(data.rows, parseInt(data.records));
                }
                else {
                    callback([], 0);
                }
            });
        },
        rowRender: function (_index, _item, _$item, $page) {// 渲染列表行数据 
            _$item.addClass('lr-list-item lr-list-item-multi');
            _$item.append($('<p class="lr-ellipsis"><span>学年:</span></p>').dataFormatter({ value: _item.AcademicYearNo }));
            _$item.append($('<p class="lr-ellipsis"><span>学期:</span></p>').dataFormatter({ value: _item.Semester }));
            _$item.append($('<p class="lr-ellipsis"><span>教师姓名:</span></p>').dataFormatter({ value: _item.EmpName }));
            _$item.append($('<p class="lr-ellipsis"><span>课程名称:</span></p>').dataFormatter({ value: _item.LessonName }));
            _$item.append($('<p class="lr-ellipsis"><span>评教状态:</span></p>').dataFormatter({ value: (_item.UID != undefined && _item.UID !== '') ? "已评" : "未评" }));
            return '';
        },
        rowClick: function (item, $item, $page) {// 列表行点击触发方法 
            if (item.UID != undefined && item.UID !== '') {
                learun.layer.warning("当前项目已评教！");
                return;
            }
            learun.nav.go({ path: 'EvaluationTeach/EvaluationTeahcers', title: '评价教师', type: 'right', param: { VID: item.VID, EmpNo: item.EmpNo, LessonNo: item.LessonNo } });
        },
        btnClick: function (item, $item, $page) {// 左滑按钮点击事件 
            if (item.UID == undefined || item.UID === '') {
                learun.layer.warning("当前项目未评教！");
                return;
            }
            learun.nav.go({ path: 'EvaluationTeach/EvaluationTeahcers', title: '评价教师', type: 'right', param: { VID: item.VID, StuNo: item.StuNo } });
        },
        rowBtns: ['<a class="lr-btn-success">查看</a>'] // 列表行左滑按钮 
    };
    return page;
})(); 