|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<title>课程管理</title>
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
|
<meta name="renderer" content="webkit">
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
|
<meta name="viewport"
|
|
|
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
|
<link rel="stylesheet" href="../../static/css/font.css">
|
|
|
<link rel="stylesheet" href="../../static/css/weadmin.css">
|
|
|
<link rel="stylesheet" href="../../lib/layui/css/layui.css">
|
|
|
<script src="../../lib/jquery-1.12.4.min.js"></script>
|
|
|
<script src="../../lib/ztree/jquery.ztree.core-3.5.min.js"></script>
|
|
|
|
|
|
<!--引入tip组件 -->
|
|
|
<link rel="stylesheet" type="text/css" href="../../lib/poshytip/tip-darkgray/tip-darkgray.css"/>
|
|
|
<script type="text/javascript" src="../../lib/poshytip/jquery.poshytip.min.js"></script>
|
|
|
|
|
|
|
|
|
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
|
|
|
<!--[if lt IE 9]>
|
|
|
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
|
|
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
|
|
<![endif]-->
|
|
|
<style>
|
|
|
select {
|
|
|
width: 180px;
|
|
|
height: 38px;
|
|
|
line-height: 38px;
|
|
|
border: 1px solid #ccc;
|
|
|
border-radius: 3px;
|
|
|
font-size: 15px;
|
|
|
padding-left: 6px;
|
|
|
color: #666;
|
|
|
}
|
|
|
|
|
|
.searchTxt {
|
|
|
width: 220px;
|
|
|
border: 1px solid #dedede;
|
|
|
border-radius: 3px;
|
|
|
height: 37px;
|
|
|
padding-left: 13px;
|
|
|
vertical-align: top;
|
|
|
}
|
|
|
|
|
|
.inline {
|
|
|
display: inline-block;
|
|
|
vertical-align: top;
|
|
|
}
|
|
|
|
|
|
ul.log li {
|
|
|
color: #666666;
|
|
|
list-style: none;
|
|
|
padding-left: 10px;
|
|
|
}
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="weadmin-nav">
|
|
|
<span class="layui-breadcrumb">
|
|
|
<a href="">首页</a>
|
|
|
<a href="">教学基础数据支撑</a>
|
|
|
<a>
|
|
|
<cite>课程管理</cite></a>
|
|
|
</span>
|
|
|
<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right"
|
|
|
href="javascript:location.reload();" title="刷新">
|
|
|
<i class="layui-icon layui-icon-refresh-3" style="line-height:30px"></i></a>
|
|
|
</div>
|
|
|
<div class="weadmin-body">
|
|
|
<div class="layui-form-item inline " id="div3">
|
|
|
<label for="" class="layui-form-label" style="padding:9px 0;text-align: left;">
|
|
|
开课单位
|
|
|
</label>
|
|
|
<div class="layui-input-inline" id="select_3" style="width: 188px"></div>
|
|
|
<script type="text/html" id="test3">
|
|
|
<select name="service_type" id="sel3" onchange="changeUnit()">
|
|
|
<option value="">全部</option>
|
|
|
<% for (var i = 0; i < data.length; i ++) { %>
|
|
|
<option value="<%=data[i].org_id%>"><%=data[i].org_name%></option>
|
|
|
<% } %>
|
|
|
</select>
|
|
|
</script>
|
|
|
</div>
|
|
|
<div class="layui-form-item inline" id="div4">
|
|
|
<label for="" class="layui-form-label">
|
|
|
课程层次
|
|
|
</label>
|
|
|
<div class="layui-input-inline" id="select_4" style="width: 188px"></div>
|
|
|
<script type="text/html" id="test4">
|
|
|
<select name="service_type" id="sel4" onchange="changeCourseType()">
|
|
|
<option value="0">全部</option>
|
|
|
<% for (var i = 0; i < data.length; i ++) { %>
|
|
|
<option value="<%=data[i].course_type_id%>"><%=data[i].course_type_name%></option>
|
|
|
<% } %>
|
|
|
</select>
|
|
|
</script>
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item inline" id="div5">
|
|
|
<input type="text" id="keyword" value="" class="searchTxt" placeholder="请输入课程名称或课程代码关键字">
|
|
|
<div class="layui-btn" type="button" id="search" onclick="bindCourse();">
|
|
|
<span class="layui-icon layui-icon-shrink-right"></span>查找
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item inline" style="float:right">
|
|
|
<span id="importAcc">
|
|
|
<div class="layui-btn" type="button" id="addCourse" onclick="addCourse();">
|
|
|
<span class="layui-icon layui-icon-shrink-right"></span>增加课程
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-btn layui-btn-normal" type="button" id="importCourse"
|
|
|
onclick="importCourse();">
|
|
|
<span class="layui-icon layui-icon-shrink-right"></span>导入课程
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-btn layui-btn-primary" type="button" id="exportCourse"
|
|
|
onclick="exportCourse();">
|
|
|
<span class="layui-icon layui-icon-shrink-right"></span>导出课程
|
|
|
</div>
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="layui-form-item">
|
|
|
<table class="layui-table" lay-filter="idTest" id="idTest"></table>
|
|
|
<script type="text/html" id="barDemo">
|
|
|
{{#if(d.sub_course_count>0){ }}
|
|
|
<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="sub"
|
|
|
id="showSubCourse_{{d.course_id}}">子课程[{{d.sub_course_count}}]
|
|
|
</a>
|
|
|
{{# } else { }}
|
|
|
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="sub"
|
|
|
id="showSubCourse_{{d.course_id}}">子课程
|
|
|
</a>
|
|
|
{{#} }}
|
|
|
<a class="layui-btn layui-btn-xs" lay-event="update">修改</a>
|
|
|
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
|
|
|
|
|
{{#if(d.b_use==0){ }}
|
|
|
<a class="layui-btn layui-btn-xs" lay-event="enable"
|
|
|
id="kg_{{d.course_id}}">启用
|
|
|
</a>
|
|
|
{{# } else { }}
|
|
|
<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="disable"
|
|
|
id="kg_{{d.course_id}}">停用
|
|
|
</a>
|
|
|
{{#} }}
|
|
|
</script>
|
|
|
</div>
|
|
|
</div>
|
|
|
<script src="../../lib/layui/layui.js"></script>
|
|
|
<script src="../../lib/layuiExtend.js"></script>
|
|
|
<script src="../../lib/JqueryExtend.js"></script>
|
|
|
<script src="../../lib/template.js"></script>
|
|
|
<script src="../../lib/base64.js"></script>
|
|
|
|
|
|
<script>
|
|
|
var green_color = '#5fb878';
|
|
|
var yellow_color = '#ffb800';
|
|
|
|
|
|
layui.extend({
|
|
|
admin: '{/}../../static/js/admin'
|
|
|
});
|
|
|
layui.use(['form', 'jquery', 'laytpl', 'admin', 'layer', 'table'], function () {
|
|
|
var form = layui.form,
|
|
|
$ = layui.jquery,
|
|
|
admin = layui.admin,
|
|
|
layer = layui.layer,
|
|
|
table = layui.table,
|
|
|
laytpl = layui.laytpl;
|
|
|
|
|
|
|
|
|
//绑定授课单位
|
|
|
window.getUnit = function () {
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
async: false,
|
|
|
dataType: "json",
|
|
|
url: "/baseService/teachbase/getUnitList?page=1&limit=100",
|
|
|
success: function (data) {
|
|
|
var html = template.render('test3', data);
|
|
|
document.getElementById('select_3').innerHTML = html;
|
|
|
}
|
|
|
})
|
|
|
};
|
|
|
getUnit();
|
|
|
|
|
|
//绑定课程类型
|
|
|
window.getCourseType = function () {
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
async: false,
|
|
|
dataType: "json",
|
|
|
url: "/baseService/teachbase/getCourseType?page=1&limit=100",
|
|
|
success: function (data) {
|
|
|
var html = template.render('test4', data);
|
|
|
document.getElementById('select_4').innerHTML = html;
|
|
|
}
|
|
|
})
|
|
|
};
|
|
|
getCourseType();
|
|
|
//授课单位变更
|
|
|
window.changeUnit = function () {
|
|
|
bindCourse();
|
|
|
};
|
|
|
//课程类型变更
|
|
|
window.changeCourseType = function () {
|
|
|
bindCourse();
|
|
|
};
|
|
|
//增加课程
|
|
|
window.addCourse = function () {
|
|
|
WeAdminShow('增加课程', './courseUpdate.html', 700, 450);
|
|
|
};
|
|
|
//导入课程
|
|
|
window.importCourse = function () {
|
|
|
WeAdminShow('导入课程', './importExcel.html', 600, 300);
|
|
|
};
|
|
|
//课程导出
|
|
|
window.exportCourse = function () {
|
|
|
window.location.href = "/baseService/teachbase/exportCourse";
|
|
|
};
|
|
|
//显示五星
|
|
|
window.showFiveStar = function (course_id, sub_sum_credit_hours, sub_sum_credit_points, credit_hours, credit_points, sub_course_count, theory, practice, sub_sum_theory, sub_sum_practice) {
|
|
|
//五星的颜色
|
|
|
var color = green_color;
|
|
|
//如果子课数大于零
|
|
|
if (sub_course_count > 0) {
|
|
|
//如果总学时不符或总学分不符
|
|
|
if ((sub_sum_credit_hours != credit_hours) || (sub_sum_credit_points != credit_points)) {
|
|
|
color = yellow_color;
|
|
|
}
|
|
|
//如果总的实践课时不符或者总的理论课时不符
|
|
|
if (sub_sum_theory != theory || sub_sum_practice != practice) {
|
|
|
color = yellow_color;
|
|
|
}
|
|
|
}
|
|
|
var str = '<a href=#><i id="check_'
|
|
|
+ course_id +
|
|
|
'" class="layui-icon layui-icon-rate-solid" style="font-size: 18px; color: '
|
|
|
+ color
|
|
|
+ ';"></i></a>';
|
|
|
return str;
|
|
|
};
|
|
|
// 绑定课程
|
|
|
window.bindCourse = function () {
|
|
|
var unit_id = $("#sel3").val();
|
|
|
var course_type_id = $("#sel4").val();
|
|
|
var keyword = $("#keyword").val();
|
|
|
table.render({
|
|
|
elem: '#idTest',
|
|
|
url: '/baseService/teachbase/getCourseList?unit_id=' + unit_id + "&course_type_id=" + course_type_id + "&keyword=" + keyword,
|
|
|
cols: [[
|
|
|
{field: 'id', title: '序号', align: 'center', type: 'numbers', width: 40}
|
|
|
, {field: 'unit_name', title: '开课单位', align: 'center'}
|
|
|
, {field: 'course_type_name', title: '课程层次', align: 'center'}
|
|
|
, {field: 'course_name', title: '课程名称', align: 'center', width: 220}
|
|
|
, {field: 'course_code', title: '课程代码', align: 'center'}
|
|
|
|
|
|
, {field: 'course_alias', title: '简称', align: 'center'}
|
|
|
, {field: 'help_code', title: '助记码', align: 'center'}
|
|
|
|
|
|
, {field: 'is_netcourse_name', title: '网络课程', align: 'center'}
|
|
|
, {field: 'credit_points', title: '学分', align: 'center'}
|
|
|
, {field: 'theory', title: '理论', align: 'center'}
|
|
|
, {field: 'practice', title: '实践', align: 'center'}
|
|
|
, {field: 'credit_hours', title: '总学时', align: 'center'}
|
|
|
, {
|
|
|
field: 'sub_sum_credit_hours', title: '数据检查', align: 'center'
|
|
|
, templet: function (d) {
|
|
|
return showFiveStar(d.course_id, d.sub_sum_credit_hours, d.sub_sum_credit_points, d.credit_hours, d.credit_points, d.sub_course_count, d.theory, d.practice, d.sub_sum_theory, d.sub_sum_practice);
|
|
|
}
|
|
|
}
|
|
|
, {
|
|
|
field: 'b_use', title: '状态', align: 'center'
|
|
|
, templet: function (d) {
|
|
|
if (d.b_use == 0) {
|
|
|
return "停用";
|
|
|
} else {
|
|
|
return "启用";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
, {fixed: 'right', title: '操作', toolbar: '#barDemo', align: 'center', width: 250}
|
|
|
]]
|
|
|
, page: true
|
|
|
, height: 'full'
|
|
|
, done: function () {
|
|
|
//数据
|
|
|
var data = layui.table.cache["idTest"];
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
if (data[i]["sub_course_count"] == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
//提示
|
|
|
$("#showSubCourse_" + data[i]["course_id"]).poshytip(
|
|
|
{
|
|
|
className: 'tip-darkgray',
|
|
|
content: function (updateCallback) {
|
|
|
var course_id = $(this).attr("id").split("_")[1];
|
|
|
var content = "已配置子课:";
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
dataType: "json",
|
|
|
async: false,
|
|
|
url: "/baseService/teachbase/getSubCourseList?course_id=" + course_id,
|
|
|
success: function (data) {
|
|
|
$(data.data).each(function (i, n) {
|
|
|
content += n.sub_course_name + ",";
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
return content.substring(0, content.length - 1);
|
|
|
},
|
|
|
showOn: 'hover',
|
|
|
alignY: 'bottom',
|
|
|
showTimeout: 100,
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
//提示不同颜色的原因
|
|
|
var content = "";
|
|
|
if ($("#check_" + data[i]["course_id"]).css("color").colorHex() == green_color) {
|
|
|
content = "绿色代表总学时、总学分与各学期学时、学分相加的和相等,正确。";
|
|
|
} else {
|
|
|
content = "黄色代表总学时、总学分与各学期学时、学分相加的和不相等,需要进行检查。";
|
|
|
}
|
|
|
$("#check_" + data[i]["course_id"]).poshytip(
|
|
|
{
|
|
|
className: 'tip-darkgray',
|
|
|
content: content,
|
|
|
showOn: 'hover',
|
|
|
alignY: 'bottom',
|
|
|
showTimeout: 100,
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
//绑定课程
|
|
|
bindCourse();
|
|
|
|
|
|
//弹出页面关闭进行回调
|
|
|
window.callbackFunction = function (course_id) {
|
|
|
layui.table.reload('idTest', {
|
|
|
where: {}
|
|
|
, page: {}
|
|
|
});
|
|
|
return false;
|
|
|
};
|
|
|
//编辑与删除
|
|
|
table.on('tool(idTest)', function (obj) {
|
|
|
var data = obj.data;
|
|
|
if (obj.event === 'update') {
|
|
|
var course_id = data.course_id;
|
|
|
var course_name = data.course_name;
|
|
|
WeAdminShow("正在为" + course_name + '修改相关信息', './courseUpdate.html?course_id=' + course_id, 700, 450);
|
|
|
}
|
|
|
//配置子课程
|
|
|
if (obj.event === 'sub') {
|
|
|
var course_id = data.course_id;
|
|
|
var course_name = data.course_name;
|
|
|
WeAdminShowCallBack("正在为" + course_name + '配置子课程', './courseSubUpdate.html?course_id=' + course_id, window.innerWidth - 100, window.innerHeight - 50, course_id);
|
|
|
}
|
|
|
//启用
|
|
|
if (obj.event === "enable") {
|
|
|
//启用功能
|
|
|
var course_id = data.course_id;
|
|
|
var course_name = data.course_name;
|
|
|
var tip = '您确定要启用课程' + course_name + '吗?';
|
|
|
layer.confirm(tip, {
|
|
|
btn: ['确定', '取消']
|
|
|
}, function (index, layero) {
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
dataType: "json",
|
|
|
async: false,
|
|
|
data: {
|
|
|
"course_id": course_id
|
|
|
},
|
|
|
url: "/baseService/teachbase/enableCourse",
|
|
|
success: function (data) {
|
|
|
if (data.success) {
|
|
|
layer.msg("保存成功", {icon: 1, time: 1000, shade: [0.5, '#000', true]}, function () {
|
|
|
var index = layer.getFrameIndex(window.name);
|
|
|
layer.close(index);
|
|
|
layui.table.reload('idTest', {
|
|
|
where: {}
|
|
|
, page: {
|
|
|
curr: 1
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
|
|
|
//停用
|
|
|
if (obj.event === "disable") {
|
|
|
//删除功能
|
|
|
var course_id = data.course_id;
|
|
|
var course_name = data.course_name;
|
|
|
var tip = '您确定要停用课程' + course_name + '吗?';
|
|
|
layer.confirm(tip, {
|
|
|
btn: ['确定', '取消']
|
|
|
}, function (index, layero) {
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
dataType: "json",
|
|
|
async: false,
|
|
|
data: {
|
|
|
"course_id": course_id
|
|
|
},
|
|
|
url: "/baseService/teachbase/disableCourse",
|
|
|
success: function (data) {
|
|
|
if (data.success) {
|
|
|
layer.msg("保存成功", {icon: 1, time: 1000, shade: [0.5, '#000', true]}, function () {
|
|
|
var index = layer.getFrameIndex(window.name);
|
|
|
layer.close(index);
|
|
|
layui.table.reload('idTest', {
|
|
|
where: {}
|
|
|
, page: {
|
|
|
curr: 1
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
//删除
|
|
|
if (obj.event === "delete") {
|
|
|
//删除功能
|
|
|
var course_id = data.course_id;
|
|
|
var course_name = data.course_name;
|
|
|
var tip = '您确定要删除课程' + course_name + '吗?';
|
|
|
layer.confirm(tip, {
|
|
|
btn: ['确定', '取消']
|
|
|
}, function (index, layero) {
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
dataType: "json",
|
|
|
async: false,
|
|
|
data: {
|
|
|
"course_id": course_id
|
|
|
},
|
|
|
url: "/baseService/teachbase/deleteCourse",
|
|
|
success: function (data) {
|
|
|
if (data.success) {
|
|
|
layer.msg("保存成功", {icon: 1, time: 1000, shade: [0.5, '#000', true]}, function () {
|
|
|
var index = layer.getFrameIndex(window.name);
|
|
|
layer.close(index);
|
|
|
layui.table.reload('idTest', {
|
|
|
where: {}
|
|
|
, page: {
|
|
|
curr: 1
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
|
layer.msg(data.message, {
|
|
|
icon: 2,
|
|
|
time: 3000,
|
|
|
shade: [0.5, '#000', true]
|
|
|
}, function () {
|
|
|
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
})
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |