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 Index: ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTableForm.js =================================================================== diff -u -r38928 -r39071 --- ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTableForm.js (.../satisfactionSurveyTableForm.js) (revision 38928) +++ ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTableForm.js (.../satisfactionSurveyTableForm.js) (revision 39071) @@ -6,39 +6,58 @@ * @param nodeId 节点的id * @param thiz 被点击radio元素 */ -function setSatisfaction(nodeId, thiz){ +function setSatisfaction(nodeId, optionId, thiz) { var node = satisfactionSurveyTableItemTreeStore.getNodeById(nodeId); - node.set('satisfaction', thiz.value); + if (node.data.defaultSatisfactionOptionInstance && node.data.defaultSatisfactionOptionInstance !== '') { + node.data.defaultSatisfactionOptionInstance.satisfaction = thiz.value; + node.data.defaultSatisfactionOptionInstance.id = parseInt(optionId); + } else { + node.data.satisfactionDetail.satisfactionOptionInstance.satisfaction = thiz.value; + node.data.satisfactionDetail.satisfactionOptionInstance.id = parseInt(optionId); + } } /** * 渲染每个选项调用的函数. */ -function createSatisfactionCheckBox(record, satisfactionVal, id){ +function createSatisfactionCheckBox(record, satisfactionVal, id, optionId) { var checked = ""; - var satisfaction = record.get('satisfaction'); - var defaultSatisfactionOption = record.get('defaultSatisfactionOption'); - if(sstsConfig.satisfactionSurveyMode == 1){ - if(satisfaction == '无'){ - if(defaultSatisfactionOption && defaultSatisfactionOption.satisfaction == satisfactionVal){ - checked = "checked=\"checked\""; - record.set('satisfaction',satisfactionVal || '无') + var defaultSatisfactionOptionInstance = record.get('defaultSatisfactionOptionInstance'); + var satisfactionDetail = record.get('satisfactionDetail'); + if (sstsConfig.satisfactionSurveyMode == 1) { + if (defaultSatisfactionOptionInstance) { + if (defaultSatisfactionOptionInstance.satisfaction == '无') { + if (defaultSatisfactionOptionInstance.satisfactionOption && defaultSatisfactionOptionInstance.satisfactionOption.satisfaction == satisfactionVal) { + checked = "checked=\"checked\""; + record.set('satisfaction', satisfactionVal || '无') + } + } else { + if (defaultSatisfactionOptionInstance.satisfactionOption.satisfaction && defaultSatisfactionOptionInstance.satisfactionOption.satisfaction == satisfactionVal) { + checked = "checked=\"checked\""; + } } - }else { - if(satisfaction && satisfaction == satisfactionVal){ - checked = "checked=\"checked\""; + } else { + if (satisfactionDetail.satisfactionOptionInstance.satisfaction == '无') { + if (satisfactionDetail && satisfactionDetail.satisfactionOptionInstance && satisfactionDetail.satisfactionOptionInstance.satisfaction == satisfactionVal) { + checked = "checked=\"checked\""; + record.set('satisfaction', satisfactionVal || '无') + } + } else { + if (satisfactionDetail.satisfactionOptionInstance.satisfaction && satisfactionDetail.satisfactionOptionInstance.satisfaction == satisfactionVal) { + checked = "checked=\"checked\""; + } } } - }else { - if(satisfaction && satisfaction == satisfactionVal){ + } else { + var satisfaction = record.get('satisfaction'); + if (satisfaction && satisfaction == satisfactionVal) { checked = "checked=\"checked\""; } } if (id) { - return ""; + return '' } else { - return ""; + return '' } - } @@ -51,126 +70,125 @@ */ function addSatisfactionSurveyTable(id, existGrid, templateId, useSystemAfterFillOut, callBack) { var hideCloseBtn = false; - if(useSystemAfterFillOut == '是'){ + if (useSystemAfterFillOut == '是') { hideCloseBtn = true; } /** * 意度调查表实例项的数据模型 */ top.Ext4.define('SatisfactionSurveyTableItemModel', { - extend : 'top.Ext4.data.Model', + extend: 'top.Ext4.data.Model', idProperty: 'nodeId', //指定id属性 fields: [ - {name: 'nodeId'} //如果是新增则为“SatisfactionSurveyTemplateItem的id”,修改为“SatisfactionSurveyTableItem的id” - ,{name: 'id'} //满意度调查表实例的id - ,{name: 'seqNum'} //序号 - ,{name: 'content'} //项目内容 - ,{name: 'defaultSatisfactionOption'} - ,{name: 'satisfaction'} //满意度 - ]}); - + { name: 'nodeId' } //如果是新增则为“SatisfactionSurveyTemplateItem的id”,修改为“SatisfactionSurveyTableItem的id” + , { name: 'id' } //满意度调查表实例的id + , { name: 'seqNum' } //序号 + , { name: 'content' } //项目内容 + , { name: 'satifyResaon', mapping: 'satisfactionDetail.satifyResaon' } + , { name: 'defaultSatisfactionOptionInstance' } + , { name: 'satisfactionDetail' } + , { name: 'satisfaction' } //满意度 + ] + }); + satisfactionSurveyTableItemTreeStore = top.Ext4.create('top.Ext4.data.TreeStore', { - autoLoad : true, - clearOnLoad : true, - model : 'SatisfactionSurveyTableItemModel', - proxy : { - type : 'memory', - reader : { - type : 'json', - root : 'children' + autoLoad: true, + clearOnLoad: true, + model: 'SatisfactionSurveyTableItemModel', + proxy: { + type: 'memory', + reader: { + type: 'json', + root: 'children' } } }); var columnsArr = [{ - header: '序号',dataIndex: 'seqNum', width: 80, xtype:'treecolumn', sortable: false, menuDisabled: true - },{ - header: '项目内容',dataIndex: 'content', width: 310, sortable: false, menuDisabled: true - },{ - header: '满意',dataIndex: 'option_1', width: 50, sortable: false, menuDisabled: true, renderer: function(v,p,record){ - if(record.get('leaf')){ + header: '序号', dataIndex: 'seqNum', width: 80, xtype: 'treecolumn', sortable: false, menuDisabled: true + }, { + header: '项目内容', dataIndex: 'content', width: 310, sortable: false, menuDisabled: true + }, { + header: '满意', dataIndex: 'option_1', width: 50, sortable: false, menuDisabled: true, renderer: function (v, p, record) { + if (record.get('leaf')) { return createSatisfactionCheckBox(record, SATISFACTION, id); } } - },{ - header: '较满意',dataIndex: 'option_2', width: 60, sortable: false, menuDisabled: true, renderer: function(v,p,record){ - if(record.get('leaf')){ + }, { + header: '较满意', dataIndex: 'option_2', width: 60, sortable: false, menuDisabled: true, renderer: function (v, p, record) { + if (record.get('leaf')) { return createSatisfactionCheckBox(record, MORESATISFACTION, id); } } - },{ - header: '基本满意',dataIndex: 'option_3', width: 80, sortable: false, menuDisabled: true, renderer: function(v,p,record){ - if(record.get('leaf')){ + }, { + header: '基本满意', dataIndex: 'option_3', width: 80, sortable: false, menuDisabled: true, renderer: function (v, p, record) { + if (record.get('leaf')) { return createSatisfactionCheckBox(record, BASICSATISFACTION, id); } } - },{ - header: '不太满意',dataIndex: 'option_4', width: 80, sortable: false, menuDisabled: true, renderer: function(v,p,record){ - if(record.get('leaf')){ + }, { + header: '不太满意', dataIndex: 'option_4', width: 80, sortable: false, menuDisabled: true, renderer: function (v, p, record) { + if (record.get('leaf')) { return createSatisfactionCheckBox(record, NOTVERYSATISFACTION, id); } } - },{ - header: '不满意',dataIndex: 'option_5', width: 60, sortable: false, menuDisabled: true, renderer: function(v,p,record){ - if(record.get('leaf')){ + }, { + header: '不满意', dataIndex: 'option_5', width: 60, sortable: false, menuDisabled: true, renderer: function (v, p, record) { + if (record.get('leaf')) { return createSatisfactionCheckBox(record, NOSATISFACTION, id); } } }] - if(sstsConfig.satisfactionSurveyMode == 1){ + if (sstsConfig.satisfactionSurveyMode == 1) { Ext4.Ajax.request({ - url: WWWROOT + '/disinfectSystem/baseData/satisfactionOption/satisfactionOptionController/loadSatisfactionOption.mhtml', - async:false, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!loadSatisfactionSurveyTemplateSatisfactionOptionInstances.do', + params: { + templateId: templateId + }, + async: false, + success: function (response, options) { var result = Ext.decode(response.responseText); var success = result.success; - if(success){ + if (success) { columnsArr = [{ - header: '序号',dataIndex: 'seqNum', width: 80, xtype:'treecolumn', sortable: false, menuDisabled: true - },{ - header: '项目内容',dataIndex: 'content', width: 310, sortable: false, menuDisabled: true + header: '序号', dataIndex: 'seqNum', width: 80, xtype: 'treecolumn', sortable: false, menuDisabled: true + }, { + header: '项目内容', dataIndex: 'content', width: 310, sortable: false, menuDisabled: true }] - for(var i=0;i