layui.define([ 'form', 'laydate', 'table' ], function(exports) {
var form = layui.form;
var laydate = layui.laydate;
var table = layui.table;
var handsOnTable = null;
var view ={
init:function(){
var that = this
this.initTable();
this.initSearchForm();
this.initToolBar();
window.dataReload = function(){
Lib.doSearchForm($("#searchForm"),handsOnTable)
that.initToolBar();
}
},
initTable:function(){
var sx_ = localStorage.getItem("handsOnTable_field_"+Common.userInfoId); //筛选值显示、隐藏缓存
if($.isEmpty(sx_)){sx_ = {};}else {sx_ = JSON.parse(sx_);}
handsOnTable = table.render({
elem : '#handsOnTable',
height : Lib.getTableHeight(1),
cellMinWidth: 120,
method : 'post',
url : Common.ctxPath + '/jlw/handsOn/list.json' // 数据接口
,page : Lib.tablePage // 开启分页
,toolbar: '#toolbar_handsOn' //自定义头部左侧工具栏
,defaultToolbar: ['filter', 'print', 'exports'] //头部右侧工具栏
,limit : 10,
cols : [ [ // 表头
{
type : 'checkbox',
},
{
field : 'handsOnName',
title : '项目名称',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['handsOnName'])?false:sx_['handsOnName'],
},
{
field : 'courseInfoId',
title : '观看视频平均得分',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['courseInfoId'])?false:sx_['courseInfoId'],
},
{
field : 'courseChildNode',
title : '观看PPT平均得分',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['courseChildNode'])?false:sx_['courseChildNode'],
},
{
field : 'handsOnName',
title : '理论测评平均得分',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['handsOnName'])?false:sx_['handsOnName'],
},
{
field : 'handsOnRecommend',
title : '实训操作步骤平均得分',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['handsOnRecommend'])?false:sx_['handsOnRecommend'],
},
{
field : 'handsOnRecommend',
title : '报告撰写平均得分',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['handsOnRecommend'])?false:sx_['handsOnRecommend'],
}
,{
field : 'operation_',title : '操作',align:"center",fixed: 'right',width: '500', templet: function (d) {
var htm = '';
htm += ''
htm += ''
htm += ''
htm += ''
htm += ''
;
return htm;
}
}
] ]
});
table.on('checkbox(handsOnTable)', function(obj){
var handsOn = obj.data;
if(obj.checked){
//按钮逻辑Lib.buttonEnable()
}else{
}
})
},
initSearchForm:function(){
Lib.initSearchForm( $("#searchForm"),handsOnTable,form);
},
initToolBar:function(){
toolbar = {
add: function () {
var url = "/jlw/handsOn/add.do";
Common.openDlg(url,"实操管理>添加实操管理");
},
search: function () {
Lib.doSearchForm($("#searchForm"), handsOnTable, 1);
view.initToolBar()
},
refresh: function () {
searchForm.reset();
Lib.doSearchForm($("#searchForm"), handsOnTable, 1);
// view.initToolBar()
},
}
//触发事件
$('.ext-toolbar').on('click', function() {
var type = $(this).data('type');
toolbar[type] ? toolbar[type].call(this) : '';
});
}, initTableTool: table.on('tool(handsOnTable)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
var url = "/jlw/handsOn/add.do?handsOnId="+data.handsOnId;
Common.openDlg(url,"实操管理>"+data.handsOnName+">编辑");
}else if(obj.event === "result"){
var url = "/jlw/handsOnAchievement/index2.do?handsOnId="+data.handsOnId;
Common.openDlg(url,"实操成绩管理>编辑");
}else if(obj.event === "del"){
layer.confirm('是否确定删除该信息?', function (index) {
var ret = Common.postAjax("/jlw/handsOn/delete.json",{ids:data.handsOnId});
layer.msg(ret.code == 0?"删除成功!":ret.msg, {
offset: ['50%'],
icon: ret.code == 0?1:2,
time: 1500 //2秒关闭(如果不配置,默认是3秒)
},function (){
if(ret.code == 0){
Lib.tableRefresh();
}
});
});
}else if(obj.event === "bindPoints"){
var url = "/jlw/teacherOpenCourseKnowledgePointRelation/bindPoints.do?bussiness_id="+data.handsOnId;
return layer.open({
type: 2,
area: ['800px', '600px'],
fix: false,
maxmin: true,
shade: 0.3,
title: "知识点绑定",
content: Common.ctxPath + $.getUrlAddTag(url),
btn: ['确定', '关闭'],
yes: function(index, layero) {
var iframeWin = layero.find('iframe')[0];
iframeWin.contentWindow.submitHandler(index, layero);
},
cancel: function(index) {
return true;
}
});
}
})
}
exports('index',view);
});