123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394 |
- /**
- * 功能:
- *
- *
- * @author HXB
- * @date 2015/09/18
- */
- questionBank = function() {
- /** 定义变量* */
- var _this = this;
- _this.listGrid = null;// 数据列表
- _this.searchPanel = null; // 查询面板
- $queryForm = null;// 查询区域表单
- $searchButt = null;// 查询按钮
- $more = null; // 更多
- _this.loadParams = null;// 列表加载参数
- //var curr_date = new Date();
- //部门id
- //var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- /** 私有方法* */
- /** *新增信息** */
- _this.addForm = function() {
- if(zTreeVersionId==""){
- top.Dialog.alert("请选择版本号!");
- hideRMenu();
- return;
- }
- $('#frmright', window.parent.document).attr('src',$.pathname() + "/page/business/exercise/examineManagement/questionBankAddEdit.jsp?versionId="+zTreeVersionId+"&fd_id=");
- };
- /** *修改信息** */
- _this.editForm = function() {
- var rows = _this.listGrid.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要修改的记录!");
- return;
- } else if (rowsLength > 1) {
- top.Dialog.alert("请选中一条要修改的记录!");
- return;
- } else {
- var fd_id = rows[0].FD_OBJECTID603;
- $.ajax({
- url : $.pathname() + '/ws/Examine/ExamineManagementService/getSumByquestionId/',
- type : 'post',
- data : {question_id:fd_id},
- dataType : 'json',
- timeout : 15000,
- async : false,
- success : function(data){
- if(data.SUM==0){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/exercise/examineManagement/questionBankAddEdit.jsp?fd_id='+fd_id);
- }else{
- top.Dialog.alert("当前题目正在使用中,不可修改!");
- return;
- }
-
- }
- });
-
- }
- };
- /** *删除信息** */
- _this.del = function() {
- var rows = _this.listGrid.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要删除的记录!");
- return;
- } else if (rowsLength > 1) {
- top.Dialog.alert("请选中一条要删除的记录!");
- return;
- }
-
- var url = $.pathname() + "/ws/crud/CRUDService/delete/";
- var params = {
- objectIDs : rows[0].FD_OBJECTID603,
- classid : 603
- };
- top.Dialog.confirm("确定要删除吗?|删除", function() {
-
- $.ajax({
- url : $.pathname() + '/ws/Examine/ExamineManagementService/getSumByquestionId/',
- type : 'post',
- data : {question_id:rows[0].FD_OBJECTID603},
- dataType : 'json',
- timeout : 15000,
- async : false,
- success : function(data){
- if(data.SUM==0){
- $.request.del(url, params, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("删除成功!");
- // 刷新表格数据
- _this.listGrid.setOptions({data:result});
- _this.listGrid.rend();
- } else {
- top.Dialog.alert("删除失败!");
- }
- });
- }else{
- top.Dialog.alert("当前题目正在使用中,不可删除!");
- return;
- }
-
- }
- });
- });
- };
-
- /********导入题目*********/
- _this.importForm = function(){
- if(zTreeVersionId==""){
- top.Dialog.alert("请选择版本号!");
- hideRMenu();
- return;
- }
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/exercise/examineManagement/question_import.jsp?versionId='+zTreeVersionId);
- };
-
- /*****绑定信息*****/
- _this.bind_Template = function(){
- var rows = _this.listGrid.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要绑定的记录!");
- return;
- }
- var ids='';
- for(var i =0;i<rowsLength;i++){
- ids += rows[i].FD_OBJECTID603+",";
- }
- ids = ids.substring(0,ids.length-1);
-
- var diag = new top.Dialog();
- diag.Title = '绑定模板';
- diag.URL = $.pathname() + '/page/business/exercise/examineManagement/questionTemplateBind.jsp';
- diag.OkButtonText = '确定';
- diag.OKEvent = function(){
-
- $form = diag.innerFrame.contentWindow.$("#editForm");
- var valid = $form.validationEngine({returnIsValid: true});
- if(!valid){
- return;
- }
- var template_id = diag.innerFrame.contentWindow.$("#TITLE_TEMPLATE").val();
-
- $.ajax({
- url : $.pathname() + '/ws/Examine/ExamineManagementService/getTaskByTemplate/',
- type : 'post',
- data : {template_id:template_id},
- dataType : 'json',
- timeout : 15000,
- async : false,
- success : function(data){
- if(data.length > 0){
- top.Dialog.alert("当前模板正在执行任务中,不可绑定");
- return;
- }
-
- var params = {
- template_id : template_id,
- ids : ids
- }
- var url = $.pathname() + '/ws/Examine/ExamineManagementService/bindTemplate/';
- $.ajax({
- url : url,
- type : 'post',
- data : params,
- dataType : 'json',
- timeout : 60000,
- success : function(data){
- if(data){
- top.Dialog.alert("绑定成功!");
- diag.close();
- //top.frmright.window.location.reload()
- }else{
- top.Dialog.alert("绑定失败!");
- return;
- }
-
- },
- error : function(){
- $.messager.alert('操作失败');
- }
- });
-
- }
- });
-
- };
- diag.CancelEvent = function(){
- diag.close();
- };
- diag.Width = 500; //宽度
- diag.Height = 250; //高度
- diag.ButtonAlign = 'center';//发送和取消按钮的位置
- diag.show();
- }
- /** **查看详细信息*** */
- _this.show = function(fdId) {
- if(fdId){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/exercise/examineManagement/questionBankDetail.jsp?fd_id='+fdId);
- }else{
- var rows = _this.listGrid.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要查看的记录!");
- return;
- } else if (rowsLength > 1) {
- top.Dialog.alert("请选中一条要查看的记录!");
- return;
- } else {
- var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID603;
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/exercise/examineManagement/questionBankDetail.jsp?fd_id='+fd_id);
- }
- }
- };
- // 查询
- function search(obj) {
- $queryForm = $("#queryForm");
- if($("#QUESTION_NAME_603").val()=="题目名称"){
- $("#QUESTION_NAME_603").val("");
- }
- $queryForm.serialize();
- //获取选中的值
- var searchCondition = getSelectCon(conditionData);
- var queryParams = getQueryFormParams($queryForm);
- var params=$.extend({},_this.loadParams,queryParams);
- //与之前参数条件拼接
- params.condition = searchCondition.condition + params.condition;
- _this.listGrid.setOptions({"params":params});
- //加载数据
- // _this.listGrid.setNewPage(1);
- _this.listGrid.rend();
- //$(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- }
-
- // 更多
- function more() {
- $('#moreTable').toggle();
- /*$('#moreDiv').toggle(200,function(){
- $("#emptyCondition").click();
- $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- });*/
- }
- return {
- init : function() {
- $queryForm = $("#queryForm");
- //绑定查询面板的按钮点击事件
- $searchButt = $("#searchButt");// 查询按钮
- $searchButt.bind('click', function() {
- search();
- });
- $('#QUESTION_NAME_603').keydown(function(e){
- if(e.keyCode==13){
- search();
- }
- });
- //绑定更多的按钮点击事件
- $more = $("#more"); // 更多按钮
- $more.bind('click', function() {
- more();
- });
- $("#searchOne").bind('click',function(){
- search();
- })
- $(".l-grid-body-table .isPrimaryKey").live("click",function(){
- var rowdata = $(this).find("a").attr("data-fdid");
- if(rowdata){
- var fdId = rowdata;
- show(fdId);
- }
- });
- // 获得面板对象
- _this.searchPanel = $("#searchPanel");
- /*************获取当前日期*******************************************************/
- /* var currDate = getNowFormatDate();*/
- /*************获取当前日期*******************************************************/
-
- // 列表加载参数
- _this.loadParams = {
- listId : '603',
- condition : "is_del=0 and QUESTION_VERSION_ID in (select FD_OBJECTID from ECM_TRAIN_EXAMINE_VERSION where is_del=0 order by UPDATEDATE DESC limit 1)",
- direction : 'desc', // 排序方式
- sort : 'UPDATEDATE'
- };
- /** grid载入数据* */
- var grid_option={
-
- columns : [{
- display : '题目名称',
- name : 'QUESTION_NAME_603',
- width : "28%",
- //showTitle:true,
- isPrimaryKey:true,
- render:function(rowdata, rowindex, value, column){
- var fd_id = rowdata.FD_OBJECTID603;
- value = "<a href='javascript:;' data-fdid='"+fd_id+"' title='"+value+"'>"+value+"</a>";
- return value;
- }
- }, {
- display : '出题人',
- name : 'INPUT_NAME_603',
- width : "24%",
- isSort : true
- }, /*{
- display : '分值',
- name : 'QUESTION_SCORE_603',
- width : "18%",
- showTitle:true,
- render:function(rowdata, rowindex, value, column){
- var question_type = rowdata.QUESTION_TYPE_603;
- if(question_type=="4"){
- value = value.split("|")[0];
- }
- value = value+"分";
- return value;
- }
- },*/ {
- display : '题目类型',
- name : 'QUESTION_TYPE_603_SHOW',
- width : "24%",
- showTitle:true
- }, {
- display : '出题时间',
- name : 'INPUT_TIME_603',
- width : "24%",
- showTitle:true
- }],
- rownumbers : true,
- checkbox : true,
- pageSize : 10,
- percentWidthMode : true
- };
-
- var roleCons = roleButtonArr();
- var toolBarOpt={
- items : [ {
- text : '添加',
- click : 'addForm',
- iconClass : 'add1_tem',
- id : '26tj'
- }, {
- text : '删除',
- click : 'del',
- iconClass : 'delete_tem',
- id : '26sc'
- }, {
- text : '修改',
- click : 'editForm',
- iconClass : 'update_tem',
- id : '26xg'
- }, {
- text : '导入',
- click : 'importForm',
- iconClass : 'import_tem',
- id : '26dr'
- }/*{
- text : '绑定模板',
- click : 'bind_Template',
- iconClass : 'binding_tem',
- id : '26bd'
- }*/
- ],
- roleCons:""
- };
- var options={
- url :'/nwyj/ws/crud/CRUDService/queryQui',
- params: _this.loadParams,
- width:960,
- gridOptions:grid_option,
- paperOpration:{showInput:"true"},
- toolBarOptions:toolBarOpt
- };
- /**grid载入数据(定义数据列表)**/
- _this.listGrid =gridAndSingleRecode=$("#dataGrid").quickgridAndSingleRecode(options);
-
- }
- };
- }();
- $(function() {
- questionBank.init();
- });
- //切换到单条记录时,点击主键查看的接口
- function showPrimaryKey(row,index){//row为整条数据,index为第几字段,index是从0开始的
- var fdId = row.FD_OBJECTID603;
- show(fdId);
- }
|