679 lines
29 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!--# layout("/common/layout.html",{"jsBase":"/js/jlw/universitiesCollegesJurisdictionExperimentalSystem/"}){ -->
<style>
.layui-form-label {
text-align: left;
padding: 9px 0px;
/*width: 150px;*/
}
.layui-input-inline {
width: 400px !important;
}
.bg {
background-color: #73a2f8
}
table th, table td {
text-align: center !important;
}
</style>
<form class="layui-form" id="addForm">
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
院校权限添加管理/新增权限
</div>
</div>
</div>
<div class="layui-row" ${universitiesCollegesId!=null?'style="display: none;"':''}>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">授权院校:${universitiesCollegesId}</label>
<div class="layui-input-inline">
<!--#if(universitiesCollegesId!=null){-->
<input name="universitiesCollegesId" value="${universitiesCollegesId}" type="hidden">
<!--#}else{-->
<layui:simpleDictSelect style='layui-input-inline' value="${universitiesCollegesId}"
type="universities_colleges.universities_colleges_name.universities_colleges_status=1,not find_in_set(universities_colleges_id,IFNULL((SELECT group_concat(universities_colleges_id) FROM universities_colleges_jurisdiction_experimental_system WHERE FIND_IN_SET(use_type,'1,2')),-1))"
id="universitiesCollegesId" name="universitiesCollegesId"
layFilter="select_universitiesColleges"/>
<!--#}-->
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
实验系统:
<button type="button" class="layui-btn bg plsz" index="1">批量设置</button>
</div>
</div>
</div>
<div class="layui-row">
<table class="layui-table">
<colgroup>
<col width="80">
<col width="300">
<col width="150">
<col width="200">
<col width="200">
<col>
</colgroup>
<thead>
<tr>
<th><input type="checkbox" name="allSelect_1" lay-skin="primary" lay-filter="allSelect_1"></th>
<th>应用名称</th>
<th>使用层次</th>
<th>开始时间</th>
<th>结束时间</th>
<!--<th>子系统<br/>登录页logo设计</th>
<th>子系统logo设计</th>-->
<th>子系统底栏名称</th>
</tr>
</thead>
<tbody id="uje_view"></tbody>
<script id="uje_demo" type="text/html">
{{# layui.each(d.list, function(index, item){ }}
<tr index="{{index}}">
<td><input type="checkbox" name="xt_id" {{item.useType !=null && item.useType !=0?'checked':''}}
lay-skin="primary" lay-filter="select_xt"></td>
<td>{{item.applicationName}}</td>
<td>
<select name="useType" lay-filter="select_useType_1">
<option value="0">请选择</option>
<option value="1" {{item.useType=='1'?'selected':''}}>购买</option>
<option value="2" {{item.useType=='2'?'selected':''}}>试用</option>
</select>
</td>
<td>
<input type="text" autocomplete="off" id="useStartTime_xt_{{index}}"
value="{{Common.getDate(item.useStartTime,'yyyy-MM-dd HH:mm')}}" name="useStartTime"
class="layui-input"/>
</td>
<td>
<input type="text" autocomplete="off" id="useEndTime_xt_{{index}}"
value="{{Common.getDate(item.useEndTime,'yyyy-MM-dd HH:mm')}}" name="useEndTime"
class="layui-input"/>
</td>
<!--<td>
{{#if(!$.isEmpty(item.subsystemIndexLogo)){}}
<img id="subsystemIndexLogo_xt_{{index}}" src="${ctxPath}{{item.subsystemIndexLogo}}"/>
{{#}else{}}
<i class="iconfont" id="subsystemIndexLogo_xt_{{index}}"
style="font-size: 30px;color: #73a2f8;">&#xebb8;</i>
{{#}}}
</td>
<td>
{{#if(!$.isEmpty(item.subsystemLogo)){}}
<img id="subsystemLogo_xt_{{index}}" src="${ctxPath}{{item.subsystemLogo}}"/>
{{#}else{}}
<i class="iconfont" id="subsystemLogo_xt_{{index}}" style="font-size: 30px;color: #73a2f8;">&#xebb8;</i>
{{#}}}
</td>-->
<td>
<textarea name="subsystemBottomBar" style="min-height: 30px;"
id="subsystemBottomBar_xt_{{index}}" placeholder="请输入内容" class="layui-textarea">
{{item.subsystemBottomBar || ''}}
</textarea>
</td>
</tr>
{{# }); }}
{{# if(d.list.length <= 0){ }}
<tr>
<td colspan="7">
<div class="layui-none">无数据</div>
</td>
</tr>
{{# } }}
</script>
</table>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
课程资源:
<button type="button" class="layui-btn bg plsz" index="2">批量设置</button>
</div>
</div>
</div>
<div class="layui-row">
<table class="layui-table">
<colgroup>
<col width="80">
<col width="300">
<col width="150">
<col width="200">
<col width="200">
<col>
</colgroup>
<thead>
<tr>
<th><input type="checkbox" name="allSelect_2" lay-skin="primary" lay-filter="allSelect_2"></th>
<th>课程名称</th>
<th>使用层次</th>
<th>开始时间</th>
<th>结束时间</th>
<th>二级课程名设置</th>
<th>二级课程logo设置</th>
</tr>
</thead>
<tbody id="ujr_view"></tbody>
<script id="ujr_demo" type="text/html">
{{# layui.each(d.list, function(index, item){ }}
<tr index="{{index}}">
<td><input type="checkbox" name="kc_id" {{item.useType !=null && item.useType !=0?'checked':''}}
lay-skin="primary" lay-filter="select_kc"></td>
<td>{{item.courseInfoName}}</td>
<td>
<select name="useType" lay-filter="select_useType_2">
<option value="0">请选择</option>
<option value="1" {{item.useType=='1'?'selected':''}}>购买</option>
<option value="2" {{item.useType=='2'?'selected':''}}>试用</option>
</select>
</td>
<td>
<input type="text" autocomplete="off" id="useStartTime_kc_{{index}}"
value="{{Common.getDate(item.useStartTime,'yyyy-MM-dd HH:mm')}}" name="useStartTime"
class="layui-input"/>
</td>
<td>
<input type="text" autocomplete="off" id="useEndTime_kc_{{index}}"
value="{{Common.getDate(item.useEndTime,'yyyy-MM-dd HH:mm')}}" name="useEndTime"
class="layui-input"/>
</td>
<td><input name="secondLevelName" type="text" id="secondLevelName_kc_{{index}}"
value="{{item.secondLevelName || ''}}" class="layui-input"/></td>
<td>
{{#if(!$.isEmpty(item.secondLevelLogo)){}}
<img id="secondLevelLogo_kc_{{index}}" src="${ctxPath}{{item.secondLevelLogo}}"/>
{{#}else{}}
<i class="iconfont" id="secondLevelLogo_kc_{{index}}" style="font-size: 30px;color: #73a2f8;">&#xebb8;</i>
{{#}}}
</td>
</tr>
{{# }); }}
{{# if(d.list.length <= 0){ }}
<tr>
<td colspan="7">
<div class="layui-none">无数据</div>
</td>
</tr>
{{# } }}
</script>
</table>
</div>
<div style="text-align: center;margin-top: 100px;"><layui:submitButtons id="addButton" buttonType=""/></div>
</form>
<!--批量设置-->
<div class="layui-form" id="batch_dialog" style="display: none;padding: 20px 50px;">
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">使用级别:</label>
<div class="layui-input-inline">
<select name="useType">
<option value="0">请选择</option>
<option value="1">购买</option>
<option value="2">试用</option>
</select>
</div>
</div>
</div>
</div>
<span id="test6">
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">开始时间:</label>
<div class="layui-input-inline">
<input type="text" autocomplete="off" id="useStartTime" name="useStartTime" class="layui-input"
placeholder="开始时间">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">结束时间:</label>
<div class="layui-input-inline">
<input type="text" autocomplete="off" id="useEndTime" name="useEndTime" class="layui-input"
placeholder="结束时间">
</div>
</div>
</div>
</div>
</span>
</div>
<!--#} -->
<script>
layui.define(['form', 'laydate', 'upload', 'laytpl', 'table'], function (exports) {
var laydate = layui.laydate,
form = layui.form,
upload = layui.upload,
table = layui.table,
laytpl = layui.laytpl,
onxtId = null,
xtList = [],//实验系统List
kcList = [];//当前编辑系统下的课程List
var onUniversitiesCollegesId = $("input[name='universitiesCollegesId']").val();
loadxtInfo(); //加载系统数据
loadkcInfo(); //加载课程数据
function loadxtInfo() {
var ret = Common.getAjax("/jlw/universitiesCollegesJurisdictionExperimentalSystem/getAllByQuery.json", {
universitiesCollegesId: $("select[name='universitiesCollegesId']").val() || onUniversitiesCollegesId
});//获取实训系统
xtList = ret.data;
loaduje(xtList);
// onxtId = xtList.length > 0?xtList[0].universitiesCollegesJurisdictionExperimentalSystemId:"";
// loadkcInfo(onxtId);
}
//加载课程数据
function loadkcInfo() {
var ret = Common.getAjax("/jlw/universitiesCollegesJurisdictionCurriculumResources/getAllByQuery.json", {
universitiesCollegesId: $("select[name='universitiesCollegesId']").val() || onUniversitiesCollegesId
});//获取课程系统
kcList = ret.data;
loadujr(kcList);
}
//显示实验系统
function loaduje(data) {
var getTpl = uje_demo.innerHTML
, view = document.getElementById('uje_view');
laytpl(getTpl).render({list: data}, function (html) {
view.innerHTML = html;
//$("xt_id").click(select_xt_id);
$.each(data, function (i, v) {
$("#subsystemBottomBar_xt_" + i).bind('input propertychange', function () {//子系统底栏名称
var i = $(this).parents("tr").attr("index");//当前编辑行号
xtList[i].subsystemBottomBar = $(this).val();
});
loadTime("useStartTime_xt_" + i);
loadTime("useEndTime_xt_" + i);
//子系统登录页logo设计
updateLogo("subsystemIndexLogo_xt_" + i);
//子系统logo设计
updateLogo("subsystemLogo_xt_" + i);
});
//系统单选
form.on('checkbox(select_xt)', function (obj) {
if ($("input[name='xt_id']:checked").length == xtList.length) {
$("input[name='allSelect_1']").prop("checked", true);
} else {
$("input[name='allSelect_1']").prop("checked", false);
}
form.render();
});
form.render();
});
}
//显示课程系统
function loadujr(data) {
var getTpl = ujr_demo.innerHTML
, view = document.getElementById('ujr_view');
laytpl(getTpl).render({list: data}, function (html) {
view.innerHTML = html;
$.each(data, function (i, v) {
$("#secondLevelName_kc_" + i).bind('input propertychange', function () {//二级课程名设置
var i = $(this).parents("tr").attr("index");//当前编辑行号
kcList[i].secondLevelName = $(this).val();
});
loadTime("useStartTime_kc_" + i);
loadTime("useEndTime_kc_" + i);
updateLogo("secondLevelLogo_kc_" + i);//二级课程logo设置
});
//课程单选
form.on('checkbox(select_kc)', function (obj) {
if ($("input[name='kc_id']:checked").length == kcList.length) {
$("input[name='allSelect_2']").prop("checked", true);
} else {
$("input[name='allSelect_2']").prop("checked", false);
}
form.render();
});
form.render();
});
}
//选择系统应用
function select_xt_id() {
var i = $(this).parents("tr").attr("index");//当前编辑行号
if (onxtId != xtList[i].universitiesCollegesJurisdictionExperimentalSystemId) { //判断是否是当前正在编辑的
onxtId = xtList[i].universitiesCollegesJurisdictionExperimentalSystemId;
loadkcInfo(onxtId);
}
// else {
// loadujr(kcList);
// }
}
//开始结束时间
function loadTime(id) {
laydate.render({
elem: '#' + id
, type: 'datetime'
, format: 'yyyy-MM-dd HH:mm'
, done: function (value, date, endDate) {
var i = $("#" + id).parents("tr").attr("index");//当前编辑行号
if (id.indexOf("useStartTime_xt") >= 0) {
xtList[i].useStartTime = value;
} else if (id.indexOf("useEndTime_xt") >= 0) {
xtList[i].useEndTime = value;
} else if (id.indexOf("useStartTime_kc") >= 0) {
kcList[i].useStartTime = value;
} else if (id.indexOf("useEndTime_kc") >= 0) {
kcList[i].useEndTime = value;
}
}
});
}
//上传logo
function updateLogo(id) {
upload.render({
elem: "#" + id
, size: 1024 * 5
, acceptMime: 'image/*'
, url: Common.ctxPath + "/jlw/file/update.do"
, before: function (obj) { //obj参数包含的信息跟 choose回调完全一致可参见上文。
layer.load(); //上传loading
}
, done: function (res) {
var i = $("#" + id).parents("tr").attr("index");//当前编辑行号
if (id.indexOf("secondLevelLogo_kc") >= 0) {//包含secondLevelLogo表示当前上传课程系统的二级课程logo设置
kcList[i].secondLevelLogo = res.data.src;
} else if (id.indexOf("subsystemIndexLogo_xt") >= 0) { //子系统登录页logo设计
xtList[i].subsystemIndexLogo = res.data.src;
} else if (id.indexOf("subsystemLogo_xt") >= 0) { //子系统logo设计
xtList[i].subsystemLogo = res.data.src;
}
$("#" + id).parent().html('<img src="' + Common.ctxPath + res.data.src + '" id="' + id + '" data-url="' + res.data.src + '" />'); //替换显示
layer.closeAll('loading'); //关闭loading
updateLogo(id);
}, error: function (index, upload) {
layer.closeAll('loading'); //关闭loading
}
});
}
//切换使用级别
form.on('select(select_useType_1)', function (obj) {
var i = $(this).parents("tr").attr("index");//当前编辑行号
xtList[i].useType = obj.value;
});
//切换使用级别
form.on('select(select_useType_2)', function (obj) {
var i = $(this).parents("tr").attr("index");//当前编辑行号
kcList[i].useType = obj.value;
});
//批量设置 index = 1实验系统 2课程系统
$(".plsz").click(function () {
var sign = $(this).attr("index");
if (sign == 1) {
if ($("input[name='xt_id']:checked").length <= 0) {
layer.msg("请选择需要配置的实验系统!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
return;
}
} else if (sign == 2) {
if ($("input[name='kc_id']:checked").length <= 0) {
layer.msg("请选择需要配置的课程系统!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
return;
}
}
$("#batch_dialog input,#batch_dialog select").val("");
layer.open({
type: 1,
title: "批量设置",
shadeClose: true,
btnAlign: 'c',
btn: ['确定', '关闭'],
area: ['720px', '330px'],
content: $("#batch_dialog"),
yes: function (index) {
var useType = $("#batch_dialog select[name='useType']").val();
var useStartTime = $("#batch_dialog input[name='useStartTime']").val();
var useEndTime = $("#batch_dialog input[name='useEndTime']").val();
if (sign == 1) {
$("input[name='xt_id']:checked").each(function () {
xtList[$(this).parents("tr").attr("index")].useType = useType;
xtList[$(this).parents("tr").attr("index")].useStartTime = useStartTime;
xtList[$(this).parents("tr").attr("index")].useEndTime = useEndTime;
});
loaduje(xtList);
} else if (sign == 2) {
$("input[name='kc_id']:checked").each(function () {
kcList[$(this).parents("tr").attr("index")].useType = useType;
kcList[$(this).parents("tr").attr("index")].useStartTime = useStartTime;
kcList[$(this).parents("tr").attr("index")].useEndTime = useEndTime;
});
loadujr(kcList);
}
layer.close(index);
}, btn2: function (index, layero) {
layer.close(index);
}
});
});
//常规用法
laydate.render({
elem: '#useStartTime',
type: 'datetime'
});
//常规用法
laydate.render({
elem: '#useEndTime',
type: 'datetime'
});
//系统全选
form.on('checkbox(allSelect_1)', function (obj) {
if (obj.elem.checked) {
$("input[name='xt_id']").prop("checked", true);
} else {
$("input[name='xt_id']").prop("checked", false);
}
form.render();
});
//课程全选
form.on('checkbox(allSelect_2)', function (obj) {
if (obj.elem.checked) {
$("input[name='kc_id']").prop("checked", true);
} else {
$("input[name='kc_id']").prop("checked", false);
}
form.render();
});
//确定保存授权
$("#addButton").click(function () {
var universitiesCollegesId = $("select[name='universitiesCollegesId']").val() || onUniversitiesCollegesId;
if ($.isEmpty(universitiesCollegesId)) {
universitiesCollegesId = onUniversitiesCollegesId;
}
if ($.isEmpty(universitiesCollegesId)) {
layer.msg("请选择需要授权的院校!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
return;
}
var t = true;
$("input[name='xt_id']").each(function (i) {
if (!$(this).prop("checked")) {
xtList[i] = {
type: xtList[i].type,
typeId: xtList[i].typeId,
useType: 0,
universitiesCollegesId: $("select[name='universitiesCollegesId']").val() || onUniversitiesCollegesId
}
} else {
/*if (xtList[i].useType == 0 || $.isEmpty(xtList[i].useType)) {
layer.msg("请选择实验系统【" + xtList[i].applicationName + "】使用级别!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
t = false;
return false;
}*/
if ($.isEmpty(xtList[i].useStartTime)) {
layer.msg("请选择实验系统【" + xtList[i].applicationName + "】开始时间!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
t = false;
return false;
}
if ($.isEmpty(xtList[i].useEndTime)) {
layer.msg("请选择实验系统【" + xtList[i].applicationName + "】结束时间!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
t = false;
return false;
}
/*if ($.isEmpty(xtList[i].subsystemBottomBar)) {
layer.msg("请填写实验系统【" + xtList[i].applicationName + "】子系统底栏名称!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
}, function () {
$("#subsystemBottomBar_xt_" + i).focus();
});
t = false;
return false;
}*/
}
});
if (t == false) {
return false;
}
$("input[name='kc_id']").each(function (i) {
if (!$(this).prop("checked")) {
kcList[i] = {
type: kcList[i].type,
typeId: kcList[i].typeId,
useType: 0,
courseInfoId: kcList[i].courseInfoId,
universitiesCollegesId: $("select[name='universitiesCollegesId']").val() || onUniversitiesCollegesId
}
} else {
/*if (kcList[i].useType == 0 || $.isEmpty(kcList[i].useType)) {
layer.msg("请选择课程系统【" + kcList[i].applicationName + "】使用级别!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
t = false;
return false;
}*/
if ($.isEmpty(kcList[i].useStartTime)) {
layer.msg("请选择课程系统【" + kcList[i].courseInfoName + "】开始时间!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
t = false;
return true;
}
if ($.isEmpty(kcList[i].useEndTime)) {
layer.msg("请选择课程系统【" + kcList[i].courseInfoName + "】结束时间!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
t = false;
return false;
}
/*if ($.isEmpty(kcList[i].secondLevelName)) {
layer.msg("请设置课程系统【" + kcList[i].courseInfoName + "】二级课程名!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
}, function () {
$("#secondLevelName_kc_" + i).focus();
});
t = false;
return false;
}
if ($.isEmpty(kcList[i].secondLevelLogo)) {
layer.msg("请设置课程系统【" + kcList[i].courseInfoName + "】二级课程logo", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
t = false;
return false;
}*/
}
});
if (t == false) {
return false;
}
var param = {
universitiesCollegesId: universitiesCollegesId,
UniversitiesCollegesJurisdictionExperimentalSystemListJson: JSON.stringify(xtList),
UniversitiesCollegesJurisdictionCurriculumResourcesListJson: JSON.stringify(kcList)
};
var ret = Common.postAjax("/jlw/universitiesCollegesJurisdictionExperimentalSystem/addAll.json", param);
layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, {
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
time: 1500 //2秒关闭如果不配置默认是3秒
}, function () {
if (ret.code == 0) {
parent.Lib.tableRefresh();
Lib.closeFrame();
}
});
});
//返回
$("#addButton-cancel").click(function () {
Lib.closeFrame();
});
});
</script>