44323
2023-11-06 3caee5ce51a218f4bc1f3757a4d09b0ed18aa6df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**
 * 系统管理--用户管理的单例对象
 */
let CoursePackageStudent = {
    id: "managerTable",//表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
 
/**
 * 初始化表格的列
 */
CoursePackageStudent.initColumn = function () {
    let columns = [
        {field: 'selectItem', radio: true},
        {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
        {title: '所属用户', field: 'userName', align: 'center', valign: 'middle'},
        {title: '姓名', field: 'studentName', align: 'center', valign: 'middle'},
        {title: '联系电话', field: 'phone', align: 'center', valign: 'middle'},
        {title: '年龄', field: 'age', align: 'center', valign: 'middle'},
        {title: '性别', field: 'sex', align: 'center', valign: 'middle',
            formatter: function (v) {
                if (v == 1) {
                    return '男';
                } else {
                    return '女';
                }
            }
        },
        {title: '到课状态', field: 'signInOrNot', align: 'center', valign: 'middle',
            formatter: function (v, row) {
                if (row.signInOrNot === 2) {
                    return '请假';
                } else {
                    switch (v) {
                        case 0:
                            return '旷课';
                        case 1:
                            return '已到';
                    }
                }
            }
        },
        {title: '预定状态', field: 'reservationStatus', align: 'center', valign: 'middle',hidden:true,
            formatter: function (v) {
                if (v == 0) {
                    return '已取消';
                } else {
                    return '正常';
                }
            }
        },
    ];
    return columns;
};
 
/**
 * 检查是否选中
 */
CoursePackageStudent.check = function () {
    let selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录!");
        return false;
    } else {
        CoursePackageStudent.seItem = selected[0];
        return true;
    }
};
 
 
 
 
/**
 * 取消预约
 * if(CoursePackageStudent.seItem.signInOrNot == 1){
            Feng.error("不能取消预约操作");
            return
        }
 */
CoursePackageStudent.cancelReservation = function () {
    if (this.check()) {
        if(CoursePackageStudent.seItem.reservationStatus == 0){
            Feng.error("不能重复操作");
            return
        }
 
        let operation = function(){
            let ajax = new $ax(Feng.ctxPath + "/coursePackage/cancelReservation", function (res) {
                if(res.code == 200){
                    Feng.success("取消成功!");
                    CoursePackageStudent.table.refresh();
                }else{
                    Feng.error(res.msg);
                }
            }, function (data) {
                Feng.error("取消失败!" + data.responseJSON.message + "!");
            });
            ajax.set("id", CoursePackageStudent.seItem.id);
            ajax.start();
        };
        Feng.confirm("是否请假",operation);
    }
};
 
 
CoursePackageStudent.absence = function () {
    if (this.check()) {
        if(CoursePackageStudent.seItem.signInOrNot == 0){
            Feng.error("不能重复操作");
            return
        }
        if(CoursePackageStudent.seItem.reservationStatus == 0){
            Feng.error("当前学员已请假");
            return
        }
        let operation = function(){
            let ajax = new $ax(Feng.ctxPath + "/coursePackage/setAbsenceStatus", function (res) {
                if(res.code == 200){
                    Feng.success("修改成功!");
                    CoursePackageStudent.table.refresh();
                }else{
                    Feng.error(res.msg);
                }
            }, function (data) {
                Feng.error("修改失败!" + data.responseJSON.message + "!");
            });
            ajax.set("id", CoursePackageStudent.seItem.id);
            ajax.start();
        };
        Feng.confirm("是否标注未到",operation);
    }
};
 
 
 
 
CoursePackageStudent.resetSearch = function () {
    $('#userName').val('');
    $('#studentName').val('');
    CoursePackageStudent.search();
}
 
CoursePackageStudent.search = function () {
    let queryData = {};
    queryData['id'] = $('#id').val();
    queryData['userName'] = $('#userName').val();
    queryData['studentName'] = $('#studentName').val();
    CoursePackageStudent.table.refresh({query: queryData});
}
 
 
$(function () {
    let defaultColunms = CoursePackageStudent.initColumn();
    let table = new BSTable(CoursePackageStudent.id, "/coursePackage/queryCoursePackageStudentList", defaultColunms);
    // 设置物理分页server(逻辑分页client)
    table.setPaginationType("server");
    table.setQueryParams({
        id: $('#id').val()
    })
    CoursePackageStudent.table = table.init();
});