|
@@ -1,8 +1,23 @@
|
|
let configs_count = {}
|
|
let configs_count = {}
|
|
let config_dialog = 0
|
|
let config_dialog = 0
|
|
|
|
|
|
-define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
-
|
|
|
|
|
|
+define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
+ //读取选中的条目
|
|
|
|
+ $.jstree.core.prototype.get_all_checked = function (full) {
|
|
|
|
+ var obj = this.get_selected(), i, j;
|
|
|
|
+ for (i = 0, j = obj.length; i < j; i++) {
|
|
|
|
+ obj = obj.concat(this.get_node(obj[i]).parents);
|
|
|
|
+ }
|
|
|
|
+ obj = $.grep(obj, function (v, i, a) {
|
|
|
|
+ return v != '#';
|
|
|
|
+ });
|
|
|
|
+ obj = obj.filter(function (itm, i, a) {
|
|
|
|
+ return i == a.indexOf(itm);
|
|
|
|
+ });
|
|
|
|
+ return full ? $.map(obj, $.proxy(function (i) {
|
|
|
|
+ return this.get_node(i);
|
|
|
|
+ }, this)) : obj;
|
|
|
|
+ };
|
|
var Controller = {
|
|
var Controller = {
|
|
index: function () {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
// 初始化表格参数配置
|
|
@@ -22,7 +37,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
//在普通搜索渲染后
|
|
//在普通搜索渲染后
|
|
table.on('post-common-search.bs.table', function (event, table) {
|
|
table.on('post-common-search.bs.table', function (event, table) {
|
|
let form = $("form", table.$commonsearch);
|
|
let form = $("form", table.$commonsearch);
|
|
- $("input[name='cate_id']", form).addClass("selectpage").data("source", "exam/cate/index").data("params", {"custom[kind]": "PAPER", "custom[isTree]": true,}).data("orderBy", "sort desc");
|
|
|
|
|
|
+ $("input[name='cate_id']", form).addClass("selectpage").data("source", "exam/cate/selectpage").data("params", {"custom[kind]": "QUESTION","isTree":true}).data("orderBy", "sort desc");
|
|
// $("input[name='exam_type_id']", form).addClass("selectpage").data("source", "exam_type/index").data("orderBy", "sort desc");
|
|
// $("input[name='exam_type_id']", form).addClass("selectpage").data("source", "exam_type/index").data("orderBy", "sort desc");
|
|
|
|
|
|
Form.events.cxselect(form);
|
|
Form.events.cxselect(form);
|
|
@@ -45,8 +60,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
showToggle: false,//隐藏浏览模式
|
|
showToggle: false,//隐藏浏览模式
|
|
showColumns: false,//隐藏显示隐藏模式
|
|
showColumns: false,//隐藏显示隐藏模式
|
|
searchFormVisible: true,//默认显示搜索表单
|
|
searchFormVisible: true,//默认显示搜索表单
|
|
- fixedColumns: true,
|
|
|
|
- fixedRightNumber: 1,
|
|
|
|
columns: [
|
|
columns: [
|
|
[
|
|
[
|
|
{checkbox: true},
|
|
{checkbox: true},
|
|
@@ -54,10 +67,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
{field: 'cate_id', title: __('Cate_id'), autocomplete: false, visible: false},
|
|
{field: 'cate_id', title: __('Cate_id'), autocomplete: false, visible: false},
|
|
{field: 'cate.name', title: __('Cate_id'), operate: false},
|
|
{field: 'cate.name', title: __('Cate_id'), operate: false},
|
|
{field: 'title', title: __('Title'), autocomplete: false, operate: 'LIKE'},
|
|
{field: 'title', title: __('Title'), autocomplete: false, operate: 'LIKE'},
|
|
|
|
+ {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
|
// {field: 'configs', title: __('Configs'), operate: 'LIKE'},
|
|
// {field: 'configs', title: __('Configs'), operate: 'LIKE'},
|
|
{field: 'quantity', title: __('Quantity'), operate: false},
|
|
{field: 'quantity', title: __('Quantity'), operate: false},
|
|
{field: 'total_score', title: __('Total_score'), operate: false},
|
|
{field: 'total_score', title: __('Total_score'), operate: false},
|
|
{field: 'pass_score', title: __('Pass_score'), operate: false},
|
|
{field: 'pass_score', title: __('Pass_score'), operate: false},
|
|
|
|
+ {field: 'limit_count', title: __('Limit_count'), operate: false},
|
|
{
|
|
{
|
|
field: 'mode',
|
|
field: 'mode',
|
|
title: __('Mode'),
|
|
title: __('Mode'),
|
|
@@ -89,7 +104,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
autocomplete: false,
|
|
autocomplete: false,
|
|
formatter: Table.api.formatter.datetime
|
|
formatter: Table.api.formatter.datetime
|
|
},
|
|
},
|
|
- {field: 'is_only_room', title: __('Is_only_room'), searchList: {"1":__('Yes'),"0":__('No')}, formatter: Table.api.formatter.toggle},
|
|
|
|
|
|
+// {field: 'is_only_room', title: __('Is_only_room'), searchList: {"1":__('Yes'),"0":__('No')}, formatter: Table.api.formatter.toggle},
|
|
{
|
|
{
|
|
field: 'status',
|
|
field: 'status',
|
|
title: __('Status'),
|
|
title: __('Status'),
|
|
@@ -110,11 +125,46 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
field: 'operate',
|
|
field: 'operate',
|
|
title: __('Operate'),
|
|
title: __('Operate'),
|
|
table: table,
|
|
table: table,
|
|
|
|
+ buttons:[
|
|
|
|
+ {
|
|
|
|
+ name:'selectuser',
|
|
|
|
+ text:'选择用户',
|
|
|
|
+ title:'选择用户',
|
|
|
|
+ icon:'fa fa-exclamation-circle',
|
|
|
|
+ classname:'btn btn-xs btn-info btn-dialog btn-selectuser',
|
|
|
|
+ url:'exam/paper/selectuser/id/{ids}?dialog=1',
|
|
|
|
+ target:'_self',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name:'grade',
|
|
|
|
+ text:'成绩',
|
|
|
|
+ title:'成绩',
|
|
|
|
+ icon:'fa fa-exclamation-circle',
|
|
|
|
+ classname:'btn btn-xs btn-info btn-dialog btn-grade',
|
|
|
|
+ url:'exam/grade/index/paper_id/{ids}?dialog=1',
|
|
|
|
+ target:'_self',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name:'nograde',
|
|
|
|
+ text:'缺考',
|
|
|
|
+ title:'缺考',
|
|
|
|
+ icon:'fa fa-exclamation-circle',
|
|
|
|
+ classname:'btn btn-xs btn-info btn-dialog btn-nograde',
|
|
|
|
+ url:'exam/paper/nograde/id/{ids}',
|
|
|
|
+ target:'_self',
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
events: Table.api.events.operate,
|
|
events: Table.api.events.operate,
|
|
formatter: Table.api.formatter.operate
|
|
formatter: Table.api.formatter.operate
|
|
}
|
|
}
|
|
]
|
|
]
|
|
- ]
|
|
|
|
|
|
+ ],
|
|
|
|
+ onLoadSuccess:function(){
|
|
|
|
+ // 这里就是数据渲染结束后的回调函数
|
|
|
|
+ $(".btn-selectuser").data("area", ['80%','80%']);
|
|
|
|
+ $(".btn-grade").data("area", ['90%','90%']);
|
|
|
|
+ $(".btn-nograde").data("area", ['90%','90%']);
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
// 为表格绑定事件
|
|
// 为表格绑定事件
|
|
@@ -162,14 +212,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
url: 'exam/paper/restore',
|
|
url: 'exam/paper/restore',
|
|
refresh: true
|
|
refresh: true
|
|
},
|
|
},
|
|
- {
|
|
|
|
|
|
+ /*{
|
|
name: 'Destroy',
|
|
name: 'Destroy',
|
|
text: __('Destroy'),
|
|
text: __('Destroy'),
|
|
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
|
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
|
icon: 'fa fa-times',
|
|
icon: 'fa fa-times',
|
|
url: 'exam/paper/destroy',
|
|
url: 'exam/paper/destroy',
|
|
refresh: true
|
|
refresh: true
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
],
|
|
],
|
|
formatter: Table.api.formatter.operate
|
|
formatter: Table.api.formatter.operate
|
|
}
|
|
}
|
|
@@ -185,6 +235,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
Controller.api.bindConfigs()
|
|
Controller.api.bindConfigs()
|
|
Controller.api.bindTime()
|
|
Controller.api.bindTime()
|
|
},
|
|
},
|
|
|
|
+ selectuser: function () {
|
|
|
|
+ Controller.apisu.bindevent();
|
|
|
|
+ },
|
|
|
|
+ nograde: function () {
|
|
|
|
+ Controller.api.bindevent()
|
|
|
|
+ },
|
|
edit: function () {
|
|
edit: function () {
|
|
Controller.api.bindevent()
|
|
Controller.api.bindevent()
|
|
Controller.api.bindConfigs()
|
|
Controller.api.bindConfigs()
|
|
@@ -192,6 +248,60 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
Controller.api.renderCountScore()
|
|
Controller.api.renderCountScore()
|
|
Controller.api.bindTime()
|
|
Controller.api.bindTime()
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ apisu: {
|
|
|
|
+ bindevent: function () {
|
|
|
|
+ Form.api.bindevent($("form[role=form]"), null, null, function () {
|
|
|
|
+ if ($("#treeview").length > 0) {
|
|
|
|
+ var r = $("#treeview").jstree("get_all_checked");
|
|
|
|
+ $("input[name='row[user_rule]']").val(r.join(','));
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ });
|
|
|
|
+ //渲染权限节点树
|
|
|
|
+ //销毁已有的节点树
|
|
|
|
+ $("#treeview").jstree("destroy");
|
|
|
|
+ Controller.apisu.rendertree(nodeData);
|
|
|
|
+ //全选和展开
|
|
|
|
+ $(document).on("click", "#checkall", function () {
|
|
|
|
+ $("#treeview").jstree($(this).prop("checked") ? "check_all" : "uncheck_all");
|
|
|
|
+ });
|
|
|
|
+ $(document).on("click", "#expandall", function () {
|
|
|
|
+ $("#treeview").jstree($(this).prop("checked") ? "open_all" : "close_all");
|
|
|
|
+ });
|
|
|
|
+ $("select[name='row[pid]']").trigger("change");
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ rendertree: function (content) {
|
|
|
|
+ $("#treeview")
|
|
|
|
+ .on('redraw.jstree', function (e) {
|
|
|
|
+ $(".layer-footer").attr("domrefresh", Math.random());
|
|
|
|
+ })
|
|
|
|
+ .jstree({
|
|
|
|
+ "themes": {"stripes": true},
|
|
|
|
+ "checkbox": {
|
|
|
|
+ "keep_selected_style": false,
|
|
|
|
+ },
|
|
|
|
+ "types": {
|
|
|
|
+ "root": {
|
|
|
|
+ "icon": "fa fa-folder-open",
|
|
|
|
+ },
|
|
|
|
+ "menu": {
|
|
|
|
+ "icon": "fa fa-folder-open",
|
|
|
|
+ },
|
|
|
|
+ "file": {
|
|
|
|
+ "icon": "fa fa-file-o",
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ "plugins": ["checkbox", "types"],
|
|
|
|
+ "core": {
|
|
|
|
+ 'check_callback': true,
|
|
|
|
+ "data": content
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+
|
|
api: {
|
|
api: {
|
|
bindevent: function () {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"), function () {
|
|
Form.api.bindevent($("form[role=form]"), function () {
|
|
@@ -232,6 +342,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
// 选题模式设置
|
|
// 选题模式设置
|
|
bindConfigs: function () {
|
|
bindConfigs: function () {
|
|
// 选题模式弹窗
|
|
// 选题模式弹窗
|