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 1000 ? 650 : 500); windowObj = new top.Ext4.window.Window({ id: 'satisfactionSurveyTableWindow', autoShow: true, - layout : 'fit', - title : '满意度调查表', - width : 750, + layout: 'fit', + title: '满意度调查表', + width: 750, //height : 710,//高度为710会导致1024*768分辩下底部的提交按钮看不到,已改为下一行 - height : windowHeight, + height: windowHeight, constrain: true, //拖动范围限制 - resizable :false, - modal : true, - border : false, - closable:!hideCloseBtn, - plain : true, - items : formObj + resizable: false, + modal: true, + border: false, + closable: !hideCloseBtn, + plain: true, + items: formObj }); - if(id != ""){ + if (id != "") { top.Ext4.getCmp('printBtn').show(); } formObj.form.load({ - url : WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTableAction!loadSatisfactionSurveyTable.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - var data = action.result.data; - - //1、如果该调查表对应的模板已经结束,就没有修改调查表的必要,所以要把保存按钮置灰 - if(data.alreadyEnd){ + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTableAction!loadSatisfactionSurveyTable.do', + method: 'POST', + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', + success: function (form, action) { + var data = action.result.data; + + //1、如果该调查表对应的模板已经结束,就没有修改调查表的必要,所以要把保存按钮置灰 + if (data.alreadyEnd) { top.Ext4.getCmp('saveBtn').disable(); } - - //2、设置满意度调查项,并且展开所有 - satisfactionSurveyTableItemTreeStore.proxy.data = {children: data.answerItems}; - satisfactionSurveyTableItemTreeStore.load(); - top.Ext4.getCmp('satisfactionSurveyTableItemTreeGrid').expandAll(); - - //3、初始化自定义表单 - var formDefinitionId = data.formDefinitionId; - var formInstance_id = data.formInstance_id; - satisfactionSurveyCustomForm.setExtObj(top.Ext4); - satisfactionSurveyCustomForm.initCustomItems(formDefinitionId, 'satisfactionSurveyTableForm', formInstance_id); - }, - params : { + //2、设置满意度调查项,并且展开所有 + satisfactionSurveyTableItemTreeStore.proxy.data = { children: data.answerItems }; + satisfactionSurveyTableItemTreeStore.load(); + top.Ext4.getCmp('satisfactionSurveyTableItemTreeGrid').expandAll(); + + //3、初始化自定义表单 + var formDefinitionId = data.formDefinitionId; + var formInstance_id = data.formInstance_id; + satisfactionSurveyCustomForm.setExtObj(top.Ext4); + satisfactionSurveyCustomForm.initCustomItems(formDefinitionId, 'satisfactionSurveyTableForm', formInstance_id); + }, + params: { id: id, templateId: templateId } }); - + } /** * 设置满意项的数据. * return 如果设置成功返回true,否则返回false */ -function setSatisfactionSurveyTableItemData(){ +function setSatisfactionSurveyTableItemData() { var childNodes = satisfactionSurveyTableItemTreeStore.getRootNode().childNodes; var nodesData = []; var length = childNodes.length; - for (var i = 0; i < length; i ++) { + for (var i = 0; i < length; i++) { var childNode = childNodes[i]; var node = {}; node.id = childNode.get('id'); node.content = childNode.get('content'); - + var remark = top.Ext4.getCmp('remark').getValue(); if (childNode.get('leaf')) { var satisfaction = childNode.get('satisfaction'); - if(sstsConfig.satisfactionSurveyMode == 1){ - var defaultSatisfactionOption = childNode.get('defaultSatisfactionOption'); - if(defaultSatisfactionOption && defaultSatisfactionOption.recordReason == '是'){ - var recordReason = childNode.get('recordReason') || ''; - if(defaultSatisfactionOption.reasonNotNull == '是' && recordReason == ''){ - showResult(node.content +'需要填写原因,请补充。'); - return false; + if (sstsConfig.satisfactionSurveyMode == 1) { + var optionInstance; + var satifyResaon = childNode.get('satifyResaon') || ''; + if (childNode.get('defaultSatisfactionOptionInstance')) { + optionInstance = childNode.get('defaultSatisfactionOptionInstance'); + node.satisfaction = satisfaction; + } else { + optionInstance = childNode.get('satisfactionDetail').satisfactionOptionInstance; + node.satisfaction = optionInstance.satisfaction; + } + if (optionInstance.reasonNotNull == '是' && satifyResaon == '') { + showResult(node.content + '需要填写原因,请补充。'); + return false; + } + node.satisfactionDetail = { + satifyResaon: satifyResaon, + satisfactionOptionInstance: { + id: optionInstance.id } - node.satisfactionOptionDetails = [{ - satifyResaon:recordReason, - satisfactionOption:{ - id:defaultSatisfactionOption.id, - satisfaction:defaultSatisfactionOption.satisfaction - } - }] } - }else { + } else { if (!satisfaction || satisfaction == '无') { showResult("请为“" + node.content + "”内容项选择满意度!"); return false; @@ -439,35 +462,37 @@ return false; } } - - node.satisfaction = satisfaction; } else { var children = []; var childNodes2 = childNode.childNodes; var length2 = childNodes2.length; - for (var j = 0; j < length2; j ++) { + for (var j = 0; j < length2; j++) { var childNode2 = childNodes2[j]; var node2 = {}; node2.id = childNode2.get('id'); node2.content = childNode2.get('content'); var satisfaction = childNode2.get('satisfaction'); - if(sstsConfig.satisfactionSurveyMode == 1){ - var defaultSatisfactionOption = childNode2.get('defaultSatisfactionOption'); - if(defaultSatisfactionOption && defaultSatisfactionOption.recordReason == '是'){ - var recordReason = childNode2.get('recordReason') || ''; - if(defaultSatisfactionOption.reasonNotNull == '是' && recordReason == ''){ - showResult(node2.content +'需要填写原因,请补充。'); - return false; + if (sstsConfig.satisfactionSurveyMode == 1) { + var satifyResaon = childNode2.get('satifyResaon') || ''; + var optionInstance; + if (childNode2.get('defaultSatisfactionOptionInstance')) { + optionInstance = childNode2.get('defaultSatisfactionOptionInstance'); + node2.satisfaction = satisfaction; + } else { + optionInstance = childNode2.get('satisfactionDetail').satisfactionOptionInstance; + node2.satisfaction = optionInstance.satisfaction; + } + if (optionInstance.reasonNotNull == '是' && recordReason == '') { + showResult(node2.content + '需要填写原因,请补充。'); + return false; + } + node2.satisfactionDetail = { + satifyResaon: satifyResaon, + satisfactionOptionInstance: { + id: optionInstance.id } - node2.satisfactionOptionDetails = [{ - satifyResaon:recordReason, - satisfactionOption:{ - id:defaultSatisfactionOption.id, - satisfaction:defaultSatisfactionOption.satisfaction - } - }] } - }else { + } else { if (!satisfaction || satisfaction == '无') { showResult("请为“" + node2.content + "”内容项选择满意度!"); return false; @@ -479,7 +504,6 @@ return false; } } - node2.satisfaction = satisfaction; children.push(node2); } node.children = children; @@ -497,56 +521,56 @@ * @returns {Boolean} */ function submitSatisfactionSurveyTable(existGrid, callBack) { - if(!formObj.getForm().isValid()){ + if (!formObj.getForm().isValid()) { showResult('请正确填写表单各值'); return false; } - + var remark = top.Ext4.getCmp('remark').getValue(); var count = remark.length; - if (count > 50){ + if (count > 50) { alert("您输入的总字数为:" + count + ",不能超过50个字,请修改!"); return false; } - + //获取columnTreePanel数据 if (setSatisfactionSurveyTableItemData()) { var msgBox = new top.Ext4.window.MessageBox(); msgBox.confirm({ title: '温馨提示', padding: '0 10 10 10', msg: '确认提交吗?', - fn: function(btn){ - if (btn == 'yes'){ + fn: function (btn) { + if (btn == 'yes') { top.Ext4.getCmp('saveBtn').disable(); formObj.form.submit({ - url : WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTableAction!saveSatisfactionSurveyTable.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - if (existGrid) { - grid.dwrReload(); - } - windowObj.close(); - showResult(action.result.message); - if (!isUndefinedOrNullOrEmpty(callBack)) { - callBack(); - } - }, - failure : function(form, action) { - top.Ext4.getCmp('saveBtn').enable(); - showResult(action.result.message); - if (!isUndefinedOrNullOrEmpty(callBack)) { - callBack(); - } - } - }); - } + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTableAction!saveSatisfactionSurveyTable.do', + method: 'POST', + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', + success: function (form, action) { + if (existGrid) { + grid.dwrReload(); + } + windowObj.close(); + showResult(action.result.message); + if (!isUndefinedOrNullOrEmpty(callBack)) { + callBack(); + } + }, + failure: function (form, action) { + top.Ext4.getCmp('saveBtn').enable(); + showResult(action.result.message); + if (!isUndefinedOrNullOrEmpty(callBack)) { + callBack(); + } + } + }); + } }, buttons: top.Ext4.Msg.YESNO, icon: top.Ext4.Msg.QUESTION }); } - + } Index: ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTemplateForm.js =================================================================== diff -u -r38925 -r39071 --- ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTemplateForm.js (.../satisfactionSurveyTemplateForm.js) (revision 38925) +++ ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTemplateForm.js (.../satisfactionSurveyTemplateForm.js) (revision 39071) @@ -30,19 +30,20 @@ name:' ' }] Ext4.Ajax.request({ - url: WWWROOT + '/disinfectSystem/baseData/satisfactionOption/satisfactionOptionController/loadSatisfactionOption.mhtml', - async:false, + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!loadSatisfactionSurveyTemplateSatisfactionOptionInstances.do', + params: { + templateId: id + }, + async: false, success : function(response, options) { var result = Ext.decode(response.responseText); var success = result.success; - if(success){ + if(success && result.data){ for(var i=0;i"; for(var i=0;i"+ defaultSatisfactionOption[i].name +""; @@ -740,7 +741,9 @@ function changeOption(clickNode){ if(changeItem){ - clickNode.attributes.defaultSatisfactionOption = changeItem; + clickNode.attributes.defaultSatisfactionOptionInstance = { + satisfactionOption:changeItem + }; } } @@ -764,7 +767,6 @@ return (currentClickType=='select'?true:false); } function changeDefaultSatisfactionOption(selectedIndex){ - console.log(selectedIndex) changeItem = defaultSatisfactionOption[selectedIndex]; } @@ -790,14 +792,14 @@ children.push({ id:'', content:replaceStr(lastContent), - defaultSatisfactionOption:cNode.attributes.defaultSatisfactionOption + defaultSatisfactionOptionInstance:cNode.attributes.defaultSatisfactionOptionInstance }) }); if(children.length == 0){ valArr.push({ id:'', content:replaceStr(parentContent), - defaultSatisfactionOption:pNode.attributes.defaultSatisfactionOption + defaultSatisfactionOptionInstance:pNode.attributes.defaultSatisfactionOptionInstance }) }else { valArr.push({ @@ -808,6 +810,7 @@ } } }); + //console.log(valArr) return valArr; } Index: ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTableView.js =================================================================== diff -u -r22783 -r39071 --- ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTableView.js (.../satisfactionSurveyTableView.js) (revision 22783) +++ ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTableView.js (.../satisfactionSurveyTableView.js) (revision 39071) @@ -11,142 +11,143 @@ 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/satisfactionSurveyTableAction!deleteSatisfactionSurveyTable.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/satisfactionSurveyTableAction!deleteSatisfactionSurveyTable.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; - return "" + v + ""; + return "" + v + ""; } -Ext.onReady(function() { +Ext.onReady(function () { Ext.QuickTips.init(); // 记录cookie(3步) var columns = [ - {header : "满意度调查表名称",width : 240,dataIndex : 'satisfactionSurveyTemplateName', renderer : renderCallModifyFunction}, - {header : "员工号",width : 80,dataIndex : 'staffNum'}, - {header : "姓名",width : 80,dataIndex : 'userName'}, - {header : "填表时间",width : 120,dataIndex : 'surveyDate',renderer : myDateFormatByMinute}, - {header : "所属科室",width : 150,dataIndex : 'depart'}, - {header : "意见或建议",width : 120,dataIndex : 'remark',id:'autoWidth'} + { header: "满意度调查表名称", width: 240, dataIndex: 'satisfactionSurveyTemplateName', renderer: renderCallModifyFunction }, + { header: "员工号", width: 80, dataIndex: 'staffNum' }, + { header: "姓名", width: 80, dataIndex: 'userName' }, + { header: "填表时间", width: 120, dataIndex: 'surveyDate', renderer: myDateFormatByMinute }, + { header: "所属科室", width: 150, dataIndex: 'depart' }, + { header: "意见或建议", width: 120, dataIndex: 'remark', id: 'autoWidth' } ]; - + var filters = new Ext.grid.GridFilters({ - filters : [ - {type : 'string',dataIndex : 'satisfactionSurveyTemplateName'}, - {type : 'date',dataIndex : 'surveyDate'}, - {type : 'string',dataIndex : 'remark'}, - {type : 'string',dataIndex : 'staffNum'}, - {type : 'string',dataIndex : 'userName'}, - {type : 'string',dataIndex : 'instructions'}, - {type : 'string',dataIndex : 'depart'} + filters: [ + { type: 'string', dataIndex: 'satisfactionSurveyTemplateName' }, + { type: 'date', dataIndex: 'surveyDate' }, + { type: 'string', dataIndex: 'remark' }, + { type: 'string', dataIndex: 'staffNum' }, + { type: 'string', dataIndex: 'userName' }, + { type: 'string', dataIndex: 'instructions' }, + { type: 'string', dataIndex: 'depart' } ] }); - + var readerDetail = [ - {name : 'id'}, - {name : 'satisfactionSurveyTemplateName'}, - {name : 'surveyDate'}, - {name : 'remark'}, - {name : 'depart'}, - {name : 'userName'}, - {name : 'instructions'}, - {name : 'staffNum'} + { name: 'id' }, + { name: 'satisfactionSurveyTemplateName' }, + { name: 'surveyDate' }, + { name: 'remark' }, + { name: 'depart' }, + { name: 'userName' }, + { name: 'instructions' }, + { name: 'staffNum' } ]; var tbar = [{ - text : '修改', - hidden : SSTS_SatisfactionSurveyTable_Update, - iconCls : 'btn_ext_application_edit', - id : 'editTbar', - handler : function() { + text: '修改', + hidden: SSTS_SatisfactionSurveyTable_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]; - addSatisfactionSurveyTable(d.data['id'], true, null, null); + addSatisfactionSurveyTable(d.data['id'], true, d.json.satisfactionSurveyTemplateId, null); } }, '-', { - text : '删除', - hidden : SSTS_SatisfactionSurveyTable_Delete, - iconCls : 'btn_ext_application_del', - handler : function() { + text: '删除', + hidden: SSTS_SatisfactionSurveyTable_Delete, + iconCls: 'btn_ext_application_del', + handler: function () { deleteSatisfactionSurveyTable(grid); } }]; 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, - 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, + autoExpandColumn: 'autoWidth', + renderTo: 'gridDiv', + frame: false }, readerDetail, SatisfactionSurveyTableTableManager.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