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.

253 lines
12 KiB
JavaScript

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.

layui.define([ 'form', 'laydate', 'table' ], function(exports) {
var form = layui.form;
var laydate = layui.laydate;
var table = layui.table;
var teacherOpenCourseMergeResourcesQuestionTable = null;
var view ={
init:function(){
var that = this
this.initTable();
this.initSearchForm();
this.initToolBar();
window.dataReload = function(){
Lib.doSearchForm($("#searchForm"),teacherOpenCourseMergeResourcesQuestionTable)
that.initToolBar();
}
},
initTable:function(){
var sx_ = localStorage.getItem("teacherOpenCourseMergeResourcesQuestionTable_field_"+Common.userInfoId); //筛选值显示、隐藏缓存
if($.isEmpty(sx_)){sx_ = {};}else {sx_ = JSON.parse(sx_);}
teacherOpenCourseMergeResourcesQuestionTable = table.render({
elem : '#teacherOpenCourseMergeResourcesQuestionTable',
height : Lib.getTableHeight(1),
cellMinWidth: 100,
method : 'post',
url : Common.ctxPath + '/jlw/teacherOpenCourseMergeResourcesQuestion/list.json' // 数据接口
,page : Lib.tablePage // 开启分页
,toolbar: '#toolbar_teacherOpenCourseMergeResourcesQuestion' //自定义头部左侧工具栏
,defaultToolbar: ['filter', 'print', 'exports'] //头部右侧工具栏
,limit : 10,
cols : [ [ // 表头
{
type : 'checkbox',
},
{
field : 'teacherOpenCourseMergeResourcesQuestionId',
title : 'ID',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['teacherOpenCourseMergeResourcesQuestionId'])?false:sx_['teacherOpenCourseMergeResourcesQuestionId'],
width : 60,
},
{
field : 'teacherOpenCourseIdText', //数据字典类型为 teacher_open_course.teacher_open_course_title.teacher_open_course_status=1
title : '开课ID',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['teacherOpenCourseIdText'])?false:sx_['teacherOpenCourseIdText'],
},
{
field : 'teacherOpenCourseMergeCourseInfoIdText', //数据字典类型为 teacher_open_course_merge_course_info.course_info_name.course_info_status=1
title : '课程ID',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['teacherOpenCourseMergeCourseInfoIdText'])?false:sx_['teacherOpenCourseMergeCourseInfoIdText'],
},
{
field : 'questionType',
title : '题型(1单选 2多选 3判断 4填空 5分析)',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionType'])?false:sx_['questionType'],
},
{
field : 'questionScore',
title : '分值',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionScore'])?false:sx_['questionScore'],
},
{
field : 'questionStem',
title : '题干',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionStem'])?false:sx_['questionStem'],
},
{
field : 'questionOptionA',
title : '选项A',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionOptionA'])?false:sx_['questionOptionA'],
},
{
field : 'questionOptionB',
title : '选项B',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionOptionB'])?false:sx_['questionOptionB'],
},
{
field : 'questionOptionC',
title : '选项C',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionOptionC'])?false:sx_['questionOptionC'],
},
{
field : 'questionOptionD',
title : '选项D',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionOptionD'])?false:sx_['questionOptionD'],
},
{
field : 'questionOptionE',
title : '选项E',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionOptionE'])?false:sx_['questionOptionE'],
},
{
field : 'questionAnswer',
title : '答案(单选是一个 多选是多个 判断是对错)',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionAnswer'])?false:sx_['questionAnswer'],
},
{
field : 'questionAnalysis',
title : '解析',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionAnalysis'])?false:sx_['questionAnalysis'],
},
{
field : 'questionStatusText', //数据字典类型为 up_status
title : '题目状态 1上架 0下架',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['questionStatusText'])?false:sx_['questionStatusText'],
},
{
field : 'userId',
title : '后台用户ID',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['userId'])?false:sx_['userId'],
},
{
field : 'orgId',
title : '组织机构ID',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['orgId'])?false:sx_['orgId'],
}
,{
field : 'operation_',title : '操作',align:"center", templet: function (d) {
var htm = '<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button>';
htm += '<button type="button" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
return htm;
}
}
] ]
});
table.on('checkbox(teacherOpenCourseMergeResourcesQuestionTable)', function(obj){
var teacherOpenCourseMergeResourcesQuestion = obj.data;
if(obj.checked){
//按钮逻辑Lib.buttonEnable()
}else{
}
})
},
initSearchForm:function(){
Lib.initSearchForm( $("#searchForm"),teacherOpenCourseMergeResourcesQuestionTable,form);
},
initToolBar:function(){
toolbar = {
add: function () {
var url = "/jlw/teacherOpenCourseMergeResourcesQuestion/add.do";
Common.openDlg(url,"开课题目拉取管理>新增");
},
edit: function () {
var data = Common.getOneFromTable(table,"teacherOpenCourseMergeResourcesQuestionTable");
if(data==null){
return ;
}
var url = "/jlw/teacherOpenCourseMergeResourcesQuestion/add.do?teacherOpenCourseMergeResourcesQuestionId="+data.teacherOpenCourseMergeResourcesQuestionId;
Common.openDlg(url,"开课题目拉取管理>"+data.teacherOpenCourseMergeResourcesQuestionId+">编辑");
},
del: function () {
layui.use(['del'], function(){
var delView = layui.del
delView.delBatch();
});
},
search: function () {
Lib.doSearchForm($("#searchForm"), teacherOpenCourseMergeResourcesQuestionTable, 1);
view.initToolBar()
},
refresh: function () {
searchForm.reset();
Lib.doSearchForm($("#searchForm"), teacherOpenCourseMergeResourcesQuestionTable, 1);
view.initToolBar()
},
exportDocument: function () {
layui.use([ 'teacherOpenCourseMergeResourcesQuestionApi' ], function() {
var teacherOpenCourseMergeResourcesQuestionApi = layui.teacherOpenCourseMergeResourcesQuestionApi
Common.openConfirm("确认要导出这些开课题目拉取数据?", function() {
teacherOpenCourseMergeResourcesQuestionApi.exportExcel($("#searchForm"), function(fileId) {
Lib.download(fileId);
})
})
});
},
importDocument: function () {
var uploadUrl = Common.ctxPath+"/jlw/teacherOpenCourseMergeResourcesQuestion/importTemplate.json";
//模板,
var templatePath= Common.ctxPath+"/jlw/teacherOpenCourseMergeResourcesQuestion/downloadTemplate.json";
//公共的简单上传文件处理
var url = "/core/file/simpleUpload.do?uploadUrl="+uploadUrl+"&templatePath="+templatePath;
Common.openDlg(url, "开课题目拉取管理>上传");
}
}
//触发事件
$('.ext-toolbar').on('click', function() {
var type = $(this).data('type');
toolbar[type] ? toolbar[type].call(this) : '';
});
}, initTableTool: table.on('tool(teacherOpenCourseMergeResourcesQuestionTable)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
var url = "/jlw/teacherOpenCourseMergeResourcesQuestion/add.do?teacherOpenCourseMergeResourcesQuestionId="+data.teacherOpenCourseMergeResourcesQuestionId;
Common.openDlg(url,"开课题目拉取管理>"+data.teacherOpenCourseMergeResourcesQuestionId+">编辑");
}else if(obj.event === "del"){
layer.confirm('是否确定删除该信息?', function (index) {
var ret = Common.postAjax("/jlw/teacherOpenCourseMergeResourcesQuestion/delete.json",{ids:data.teacherOpenCourseMergeResourcesQuestionId});
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();
}
});
});
}
})
}
exports('index',view);
});