You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
7.0 KiB
JavaScript
165 lines
7.0 KiB
JavaScript
layui.define(['form', 'laydate', 'table'], function (exports) {
|
|
var form = layui.form;
|
|
var laydate = layui.laydate;
|
|
var table = layui.table;
|
|
var universitiesCollegesJurisdictionCurriculumResourcesTable = null;
|
|
var view = {
|
|
init: function () {
|
|
this.initTable();
|
|
this.initSearchForm();
|
|
this.initToolBar();
|
|
window.dataReload = function () {
|
|
Lib.doSearchForm($("#searchForm"), universitiesCollegesJurisdictionCurriculumResourcesTable)
|
|
}
|
|
},
|
|
initTable: function () {
|
|
universitiesCollegesJurisdictionCurriculumResourcesTable = table.render({
|
|
elem: '#universitiesCollegesJurisdictionCurriculumResourcesTable',
|
|
height: Lib.getTableHeight(1),
|
|
cellMinWidth: 100,
|
|
method: 'post',
|
|
size: "lg",
|
|
// url : Common.ctxPath + '/jlw/universitiesCollegesJurisdictionCurriculumResources/list.json' // 数据接口
|
|
url: Common.ctxPath + '/jlw/courseInfo/listWithCourseInfo.json?useTypePlural=1,2' // 数据接口
|
|
, page: Lib.tablePage // 开启分页
|
|
, limit: 10,
|
|
cols: [[ // 表头
|
|
{
|
|
type: 'checkbox',
|
|
align: "center",
|
|
fixed: 'left',
|
|
},
|
|
// {
|
|
// field : 'universitiesCollegesName',
|
|
//align: "center",
|
|
// title : '院校名称',
|
|
// },
|
|
{
|
|
field: 'courseInfoName',
|
|
align: "center",
|
|
title: '课程名称',
|
|
},
|
|
{
|
|
field: 'courseLabelType',
|
|
align: "center",
|
|
title: '课程类别',
|
|
},
|
|
{
|
|
field: 'courseLabelName',
|
|
align: "center",
|
|
title: '课程标签',
|
|
},
|
|
{
|
|
field: 'type',
|
|
align: "center",
|
|
title: '课程来源',
|
|
templet: function (d) {
|
|
if (d.type == 2) {
|
|
return '系统内置'
|
|
} else {
|
|
return '院校添加'
|
|
}
|
|
},
|
|
},
|
|
{
|
|
field: 'useType',
|
|
align: "center",
|
|
title: '使用级别',
|
|
templet: function (d) {
|
|
var typeMap = {
|
|
0: '不使用',
|
|
1: '购买',
|
|
2: '试用',
|
|
3: '-'
|
|
}
|
|
return typeMap[d.useType];
|
|
},
|
|
},
|
|
{
|
|
field: 'useStartTime',
|
|
align: "center",
|
|
title: '开始时间',
|
|
templet: function (d) {
|
|
return d.useStartTime ? d.useStartTime : '-'
|
|
},
|
|
},
|
|
{
|
|
field: 'useEndTime',
|
|
align: "center",
|
|
title: '结束时间',
|
|
templet: function (d) {
|
|
return d.useEndTime ? d.useEndTime : '-'
|
|
},
|
|
},
|
|
{
|
|
field: '_endStatus_',
|
|
align: "center",
|
|
title: '到期状态',
|
|
templet: function (d) {
|
|
// 默认在用,会有一些课程,在清单中,但不属于授权的
|
|
if (!d.useEndTime) {
|
|
return '<span class="layui-badge layui-bg-green">在用<span>';
|
|
}
|
|
return new Date(d.useEndTime).getTime() < new Date().getTime()
|
|
?
|
|
'<span class="layui-badge">到期<span>'
|
|
:
|
|
'<span class="layui-badge layui-bg-green">在用<span>'
|
|
;
|
|
},
|
|
},
|
|
{
|
|
field: 'addTime',
|
|
align: "center",
|
|
title: '添加时间',
|
|
}
|
|
]]
|
|
|
|
});
|
|
|
|
table.on('checkbox(universitiesCollegesJurisdictionCurriculumResourcesTable)', function (obj) {
|
|
var universitiesCollegesJurisdictionCurriculumResources = obj.data;
|
|
if (obj.checked) {
|
|
//按钮逻辑Lib.buttonEnable()
|
|
} else {
|
|
|
|
}
|
|
})
|
|
},
|
|
|
|
initSearchForm: function () {
|
|
Lib.initSearchForm($("#searchForm"), universitiesCollegesJurisdictionCurriculumResourcesTable, form);
|
|
},
|
|
initToolBar: function () {
|
|
toolbar = {
|
|
add: function () { // 获取选中数据
|
|
var url = "/jlw/universitiesCollegesJurisdictionCurriculumResources/add.do";
|
|
Common.openDlg(url, "UniversitiesCollegesJurisdictionCurriculumResources管理>新增");
|
|
},
|
|
edit: function () { // 获取选中数目
|
|
var data = Common.getOneFromTable(table, "universitiesCollegesJurisdictionCurriculumResourcesTable");
|
|
if (data == null) {
|
|
return;
|
|
}
|
|
var url = "/jlw/universitiesCollegesJurisdictionCurriculumResources/edit.do?universitiesCollegesJurisdictionCurriculumResourcesId=" + data.universitiesCollegesJurisdictionCurriculumResourcesId;
|
|
Common.openDlg(url, "UniversitiesCollegesJurisdictionCurriculumResources管理>" + data.universitiesCollegesJurisdictionCurriculumResourcesId + ">编辑");
|
|
},
|
|
del: function () {
|
|
layui.use(['del'], function () {
|
|
var delView = layui.del
|
|
delView.delBatch();
|
|
});
|
|
}, refresh: function () {
|
|
searchForm.reset();
|
|
Lib.doSearchForm($("#searchForm"), universitiesCollegesJurisdictionCurriculumResourcesTable, 1);
|
|
},
|
|
};
|
|
$('.ext-toolbar').on('click', function () {
|
|
var type = $(this).data('type');
|
|
toolbar[type] ? toolbar[type].call(this) : '';
|
|
});
|
|
}
|
|
}
|
|
exports('index', view);
|
|
|
|
}); |