Index: ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTemplateView.js =================================================================== diff -u -r26239 -r39071 --- ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTemplateView.js (.../satisfactionSurveyTemplateView.js) (revision 26239) +++ ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTemplateView.js (.../satisfactionSurveyTemplateView.js) (revision 39071) @@ -11,72 +11,72 @@ return false; } var ids = ""; - for ( var i = 0, len = records.length; i < len; i++) { + for (var i = 0, len = records.length; i < len; i++) { if (ids == "") { ids = records[i].data['id']; } else { ids = ids + ';' + records[i].data['id']; } } top.Ext.MessageBox - .confirm("请确认", - "是否确定要删除选中的"+entityName+"信息?", - function(button, text) { - if ("yes" == button){ - Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!deleteSatisfactionSurveyTemplate.do', - params : { - ids : ids - },success : function(response, options) { - var result = Ext.decode(response.responseText); - var success = result.success; - if (true != success) { - MsgTip.msg('提示', '删除失败',true,3); - return; - } else { - MsgTip.msg('提示','删除成功',true,3); - grid.dwrReload(); - } - }, - failure : function(response, options) { - var result = Ext.decode(response.responseText); - MsgTip.msg('提示', '删除失败',true,3); - } - }); + .confirm("请确认", + "是否确定要删除选中的" + entityName + "信息?", + function (button, text) { + if ("yes" == button) { + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!deleteSatisfactionSurveyTemplate.do', + params: { + ids: ids + }, success: function (response, options) { + var result = Ext.decode(response.responseText); + var success = result.success; + if (true != success) { + MsgTip.msg('提示', '删除失败', true, 3); + return; + } else { + MsgTip.msg('提示', '删除成功', true, 3); + grid.dwrReload(); + } + }, + failure: function (response, options) { + var result = Ext.decode(response.responseText); + MsgTip.msg('提示', '删除失败', true, 3); } + }); + } }); } -function renderCallModifyFunction(v, p, record){ +function renderCallModifyFunction(v, p, record) { var data = record.data; - if(!selOnly){ - if(data['status']==STAUTS_START){ - return "" + v + ""; - }else{ - return "" + v + ""; + if (!selOnly) { + if (data['status'] == STAUTS_START) { + return "" + v + ""; + } else { + return "" + v + ""; } - }else{ + } else { return "" + v + ""; } } -function getReadersName(v, p, record){ +function getReadersName(v, p, record) { DWREngine.setAsync(false); - SatisfactionSurveyTemplateTableManager.getReadersForDisplayName(record.data['readers'],function(tempName){ + SatisfactionSurveyTemplateTableManager.getReadersForDisplayName(record.data['readers'], function (tempName) { v = tempName; }); DWREngine.setAsync(true); return v; } -function confirmSelect(){ +function confirmSelect() { var records = grid.getSelectionModel().getSelections(); if (records.length == 0) { - showResult("请选择一个的"+entityName+"信息!"); + showResult("请选择一个的" + entityName + "信息!"); return false; } if (records.length > 1) { - showResult("最多只能选择一个"+entityName+"信息!"); + showResult("最多只能选择一个" + entityName + "信息!"); return false; } var arr = new Array(); @@ -87,188 +87,190 @@ window.returnValue = arr; window.close(); } -function renderStatus(v,p,record){ +function renderStatus(v, p, record) { var status = record.data.status; var color = ""; - if(status=="已结束"){ + if (status == "已结束") { color = "orange"; } - return "

" + v + "

"; + return "

" + v + "

"; } /** * 查看未填写满意度调查表的科室 * @param id 满意调查表定义id */ -function viewUnCreateDepart(id){ +function viewUnCreateDepart(id) { Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!viewUnCreateDepart.do', - params : { - id : id - },success : function(response, options) { + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!viewUnCreateDepart.do', + params: { + id: id + }, success: function (response, options) { var result = Ext.decode(response.responseText); var success = result.success; if (true != success) { - if(result.message){ - Ext.MessageBox.alert('提示', '' + result.message + '',true,3); - }else{ - Ext.MessageBox.alert('提示', '操作失败',true,3); + if (result.message) { + Ext.MessageBox.alert('提示', '' + result.message + '', true, 3); + } else { + Ext.MessageBox.alert('提示', '操作失败', true, 3); } } else { - if(result.data){ - Ext.MessageBox.alert('提示', '' + result.data + '',true,3); - }else{ - Ext.MessageBox.alert('提示', '没有未填写的科室',true,3); + if (result.data) { + Ext.MessageBox.alert('提示', '' + result.data + '', true, 3); + } else { + Ext.MessageBox.alert('提示', '没有未填写的科室', true, 3); } } }, - failure : function(response, options) { + failure: function (response, options) { var result = Ext.decode(response.responseText); - MsgTip.msg('提示', '删除失败',true,3); + MsgTip.msg('提示', '删除失败', true, 3); } }); } var selOnly;// -Ext.onReady(function() { +Ext.onReady(function () { selOnly = $Id("selOnly").value; Ext.QuickTips.init(); // 记录cookie(3步) var columns = [ - {header : "模板名称",width : 240,dataIndex : 'name', renderer : renderCallModifyFunction}, - {header : "录入时间",width : 80,dataIndex : 'entryDate',renderer : myDateFormat}, - {header : "科室",width : 280,dataIndex : 'readersForDisplay',renderer:getReadersName,sortable :false}, - {header : "状态",width : 80,dataIndex : 'status',renderer:renderStatus}, - {header : "未填写科室",width : 80,align:'center',renderer: function (v , p , record){ - return ""; - }}, - {header : "调查表定义描述说明",width : 300,dataIndex : 'instructions',id:'autoWidth'} + { header: "模板名称", width: 240, dataIndex: 'name', renderer: renderCallModifyFunction }, + { header: "录入时间", width: 80, dataIndex: 'entryDate', renderer: myDateFormat }, + { header: "科室", width: 280, dataIndex: 'readersForDisplay', renderer: getReadersName, sortable: false }, + { header: "状态", width: 80, dataIndex: 'status', renderer: renderStatus }, + { + header: "未填写科室", width: 80, align: 'center', renderer: function (v, p, record) { + return ""; + } + }, + { header: "调查表定义描述说明", width: 300, dataIndex: 'instructions', id: 'autoWidth' } ]; - + var filters = new Ext.grid.GridFilters({ - filters : [ - {type : 'string',dataIndex : 'name'}, - {type : 'date',dataIndex : 'entryDate'}, - {type : 'string',dataIndex : 'status'}, - {type : 'string',dataIndex : 'instructions'} + filters: [ + { type: 'string', dataIndex: 'name' }, + { type: 'date', dataIndex: 'entryDate' }, + { type: 'string', dataIndex: 'status' }, + { type: 'string', dataIndex: 'instructions' } ] }); - + var readerDetail = [ - {name : 'id'}, - {name : 'name'}, - {name : 'entryDate'}, - {name : 'status'}, - {name : 'instructions'}, - {name : 'readersForDisplay'}, - {name : 'readers'} + { name: 'id' }, + { name: 'name' }, + { name: 'entryDate' }, + { name: 'status' }, + { name: 'instructions' }, + { name: 'readersForDisplay' }, + { name: 'readers' } ]; - + var tbar; - if(!selOnly){ - tbar = [ { - text : '添加', - hidden : SSTS_SatisfactionSurveyTemplate_Create, - iconCls : 'btn_ext_application_add', - handler : function() { - addSatisfactionSurveyTemplate('',STAUTS_START,true,false); + if (!selOnly) { + tbar = [{ + text: '添加', + hidden: SSTS_SatisfactionSurveyTemplate_Create, + iconCls: 'btn_ext_application_add', + handler: function () { + addSatisfactionSurveyTemplate('', STAUTS_START, true, false); } }, '-', { - text : '修改', - hidden : SSTS_SatisfactionSurveyTemplate_Update, - iconCls : 'btn_ext_application_edit', - id : 'editTbar', - handler : function() { + text: '修改', + hidden: SSTS_SatisfactionSurveyTemplate_Update, + iconCls: 'btn_ext_application_edit', + id: 'editTbar', + handler: function () { var records = grid.getSelectionModel().getSelections(); if (records.length == 0) { - showResult("请选择需要修改的"+entityName+"信息!"); + showResult("请选择需要修改的" + entityName + "信息!"); return false; } if (records.length > 1) { - showResult("一次只能修改一个"+entityName+"信息!"); + showResult("一次只能修改一个" + entityName + "信息!"); return false; } var d = records[0]; - if(d.data['status']==STAUTS_START){ - addSatisfactionSurveyTemplate(d.data['id'],d.data['status'],true,false); - }else{ - addSatisfactionSurveyTemplate(d.data['id'],d.data['status'],false,false); + if (d.data['status'] == STAUTS_START) { + addSatisfactionSurveyTemplate(d.data['id'], d.data['status'], true, false); + } else { + addSatisfactionSurveyTemplate(d.data['id'], d.data['status'], false, false); } } }, '-', { - text : '复制并新建', - hidden : SSTS_SatisfactionSurveyTemplate_Delete, - iconCls : 'btn_ext_application_del', - handler : function() { + text: '复制并新建', + hidden: SSTS_SatisfactionSurveyTemplate_Delete, + iconCls: 'btn_ext_application_del', + handler: function () { var records = grid.getSelectionModel().getSelections(); if (records.length == 0) { - showResult("请选择需要复制并新建的"+entityName+"信息!"); + showResult("请选择需要复制并新建的" + entityName + "信息!"); return false; } if (records.length > 1) { - showResult("一次只能复制并新建一个"+entityName+"信息!"); + showResult("一次只能复制并新建一个" + entityName + "信息!"); return false; } var d = records[0]; - if(d.data['status']==STAUTS_START){ + if (d.data['status'] == STAUTS_START) { showResult("只能复制已结束的满意度调查表!"); return false; - }else{ - addSatisfactionSurveyTemplate(d.data['id'],d.data['status'],true,true); + } else { + addSatisfactionSurveyTemplate(d.data['id'], d.data['status'], true, true); } } }, '-', { - text : '删除', - hidden : SSTS_SatisfactionSurveyTemplate_Delete, - iconCls : 'btn_ext_application_del', - handler : function() { + text: '删除', + hidden: SSTS_SatisfactionSurveyTemplate_Delete, + iconCls: 'btn_ext_application_del', + handler: function () { deleteSatisfactionSurveyTemplate(grid); } }]; - }else{ - tbar = [ { - text : '确定', - hidden : false, - iconCls : 'btn_ext_application_add', - handler : function() { + } else { + tbar = [{ + text: '确定', + hidden: false, + iconCls: 'btn_ext_application_add', + handler: function () { confirmSelect(); } }]; } - + var dwrCallParams = null; - Ext.ux.ForgonPageGrid.prototype.getGridParameterMap = function() { + Ext.ux.ForgonPageGrid.prototype.getGridParameterMap = function () { }; - grid = new Ext.ux.ForgonPageGrid( { - tbar : tbar, - pageSize : 20, - defaultSortField : 'id', - title : entityName+'列表', - defaultSortDirection : 'DESC', - isCheckboxSelectionModel : true, - rememberSelected : false, - isShowSearchField : true, - columns : columns, - plugins : filters, - searchDisableIndexes:['readersForDisplay'], - autoExpandColumn : 'autoWidth', - renderTo : 'gridDiv', - frame : false + grid = new Ext.ux.ForgonPageGrid({ + tbar: tbar, + pageSize: 20, + defaultSortField: 'id', + title: entityName + '列表', + defaultSortDirection: 'DESC', + isCheckboxSelectionModel: true, + rememberSelected: false, + isShowSearchField: true, + columns: columns, + plugins: filters, + searchDisableIndexes: ['readersForDisplay'], + autoExpandColumn: 'autoWidth', + renderTo: 'gridDiv', + frame: false }, readerDetail, SatisfactionSurveyTemplateTableManager.findList, dwrCallParams // 这个参数只是占位作用 ); - + var viewport = new Ext.Viewport({ - layout : 'border', - items : [{ - region : 'center', - margins : '0 0 0 0', - layout : 'fit', - items : grid + layout: 'border', + items: [{ + region: 'center', + margins: '0 0 0 0', + layout: 'fit', + items: grid }] }); }); \ No newline at end of file