|
|
layui.define([ 'form', 'laydate', 'table' ], function(exports) {
|
|
|
var form = layui.form;
|
|
|
var laydate = layui.laydate;
|
|
|
var table = layui.table;
|
|
|
var generalResourcesQuestionSnapshotTable = null;
|
|
|
var view ={
|
|
|
init:function(){
|
|
|
var that = this
|
|
|
this.initTable();
|
|
|
this.initSearchForm();
|
|
|
this.initToolBar();
|
|
|
window.dataReload = function(){
|
|
|
Lib.doSearchForm($("#searchForm"),generalResourcesQuestionSnapshotTable)
|
|
|
that.initToolBar();
|
|
|
}
|
|
|
},
|
|
|
initTable:function(){
|
|
|
var sx_ = localStorage.getItem("generalResourcesQuestionSnapshotTable_field_"+Common.userInfoId); //筛选值显示、隐藏缓存
|
|
|
if($.isEmpty(sx_)){sx_ = {};}else {sx_ = JSON.parse(sx_);}
|
|
|
generalResourcesQuestionSnapshotTable = table.render({
|
|
|
elem : '#generalResourcesQuestionSnapshotTable',
|
|
|
height : Lib.getTableHeight(1),
|
|
|
cellMinWidth: 100,
|
|
|
method : 'post',
|
|
|
url : Common.ctxPath + '/jlw/generalResourcesQuestionSnapshot/list.json' // 数据接口
|
|
|
,page : Lib.tablePage // 开启分页
|
|
|
,toolbar: '#toolbar_generalResourcesQuestionSnapshot' //自定义头部左侧工具栏
|
|
|
,defaultToolbar: ['filter', 'print', 'exports'] //头部右侧工具栏
|
|
|
,limit : 10,
|
|
|
cols : [ [ // 表头
|
|
|
{
|
|
|
type : 'checkbox',
|
|
|
|
|
|
},
|
|
|
{
|
|
|
field : 'generalResourcesQuestionSnapshotId',
|
|
|
title : '通用题目快照ID',
|
|
|
align:"center",
|
|
|
hideField :false,
|
|
|
hide:$.isEmpty(sx_['generalResourcesQuestionSnapshotId'])?false:sx_['generalResourcesQuestionSnapshotId'],
|
|
|
|
|
|
width : 60,
|
|
|
},
|
|
|
{
|
|
|
field : 'generalQuestionSettingId',
|
|
|
title : '通用题目配置ID',
|
|
|
align:"center",
|
|
|
hideField :false,
|
|
|
hide:$.isEmpty(sx_['generalQuestionSettingId'])?false:sx_['generalQuestionSettingId'],
|
|
|
},
|
|
|
{
|
|
|
field : 'businessCourseInfoId',
|
|
|
title : '业务课程ID',
|
|
|
align:"center",
|
|
|
hideField :false,
|
|
|
hide:$.isEmpty(sx_['businessCourseInfoId'])?false:sx_['businessCourseInfoId'],
|
|
|
},
|
|
|
{
|
|
|
field : 'businessCourseInfoType',
|
|
|
title : '业务课程类型',
|
|
|
align:"center",
|
|
|
hideField :false,
|
|
|
hide:$.isEmpty(sx_['businessCourseInfoType'])?false:sx_['businessCourseInfoType'],
|
|
|
},
|
|
|
{
|
|
|
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', //数据字典类型为 global_up_status
|
|
|
title : '题目状态 (1上架, 2下架)',
|
|
|
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(generalResourcesQuestionSnapshotTable)', function(obj){
|
|
|
var generalResourcesQuestionSnapshot = obj.data;
|
|
|
if(obj.checked){
|
|
|
//按钮逻辑Lib.buttonEnable()
|
|
|
}else{
|
|
|
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
initSearchForm:function(){
|
|
|
Lib.initSearchForm( $("#searchForm"),generalResourcesQuestionSnapshotTable,form);
|
|
|
},
|
|
|
|
|
|
initToolBar:function(){
|
|
|
toolbar = {
|
|
|
add: function () {
|
|
|
var url = "/jlw/generalResourcesQuestionSnapshot/add.do";
|
|
|
Common.openDlg(url,"通用题目快照管理>新增");
|
|
|
},
|
|
|
edit: function () {
|
|
|
var data = Common.getOneFromTable(table,"generalResourcesQuestionSnapshotTable");
|
|
|
if(data==null){
|
|
|
return ;
|
|
|
}
|
|
|
var url = "/jlw/generalResourcesQuestionSnapshot/add.do?generalResourcesQuestionSnapshotId="+data.generalResourcesQuestionSnapshotId;
|
|
|
Common.openDlg(url,"通用题目快照管理>"+data.generalResourcesQuestionSnapshotId+">编辑");
|
|
|
},
|
|
|
del: function () {
|
|
|
layui.use(['del'], function(){
|
|
|
var delView = layui.del
|
|
|
delView.delBatch();
|
|
|
});
|
|
|
},
|
|
|
search: function () {
|
|
|
Lib.doSearchForm($("#searchForm"), generalResourcesQuestionSnapshotTable, 1);
|
|
|
view.initToolBar()
|
|
|
},
|
|
|
refresh: function () {
|
|
|
searchForm.reset();
|
|
|
Lib.doSearchForm($("#searchForm"), generalResourcesQuestionSnapshotTable, 1);
|
|
|
// view.initToolBar()
|
|
|
},
|
|
|
exportDocument: function () {
|
|
|
layui.use([ 'generalResourcesQuestionSnapshotApi' ], function() {
|
|
|
var generalResourcesQuestionSnapshotApi = layui.generalResourcesQuestionSnapshotApi
|
|
|
Common.openConfirm("确认要导出这些通用题目快照数据?", function() {
|
|
|
generalResourcesQuestionSnapshotApi.exportExcel($("#searchForm"), function(fileId) {
|
|
|
Lib.download(fileId);
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
importDocument: function () {
|
|
|
var uploadUrl = Common.ctxPath+"/jlw/generalResourcesQuestionSnapshot/importTemplate.json";
|
|
|
//模板,
|
|
|
var templatePath= Common.ctxPath+"/jlw/generalResourcesQuestionSnapshot/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(generalResourcesQuestionSnapshotTable)', function (obj) {
|
|
|
var data = obj.data;
|
|
|
if (obj.event === 'edit') {
|
|
|
var url = "/jlw/generalResourcesQuestionSnapshot/add.do?generalResourcesQuestionSnapshotId="+data.generalResourcesQuestionSnapshotId;
|
|
|
Common.openDlg(url,"通用题目快照管理>"+data.generalResourcesQuestionSnapshotId+">编辑");
|
|
|
}else if(obj.event === "del"){
|
|
|
layer.confirm('是否确定删除该信息?', function (index) {
|
|
|
var ret = Common.postAjax("/jlw/generalResourcesQuestionSnapshot/delete.json",{ids:data.generalResourcesQuestionSnapshotId});
|
|
|
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);
|
|
|
|
|
|
});
|