Index: ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTemplateForm.js =================================================================== diff -u -r39071 -r39072 --- ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTemplateForm.js (.../satisfactionSurveyTemplateForm.js) (revision 39071) +++ ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTemplateForm.js (.../satisfactionSurveyTemplateForm.js) (revision 39072) @@ -1,623 +1,627 @@ -function addItem(satisfactionSurveyTree){ +function addItem(satisfactionSurveyTree) { var rootNode = satisfactionSurveyTree.getRootNode(); var isExist = false; var templateContent = top.Ext.getCmp("templateContent").getRawValue(); - if(templateContent.trim().length == 0) { + if (templateContent.trim().length == 0) { showResult("内容项不能为空!"); return false; } - rootNode.eachChild(function(pNode){ - if(!pNode.isLeaf()){ - if(pNode.attributes.content == templateContent) { + rootNode.eachChild(function (pNode) { + if (!pNode.isLeaf()) { + if (pNode.attributes.content == templateContent) { showResult("该内容项已经存在!"); isExist = true; } } }); - if(isExist) { + if (isExist) { return; } - var childNode = createNode(true,'',templateContent); + var childNode = createNode(true, '', templateContent); rootNode.appendChild(childNode); } var defaultSatisfactionOption = []; -function addSatisfactionSurveyTemplate(id,status,ishidden,isclear){ +function addSatisfactionSurveyTemplate(id, status, ishidden, isclear) { var showDefaultSatisfactionOption = false; - if(sstsConfig.satisfactionSurveyMode == 1){ + if (sstsConfig.satisfactionSurveyMode == 1) { defaultSatisfactionOption = [{ - id:'', - name:' ' + satisfactionOption: { + id: '', + satisfaction: ' ' + } }] Ext4.Ajax.request({ url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!loadSatisfactionSurveyTemplateSatisfactionOptionInstances.do', params: { templateId: id }, async: false, - success : function(response, options) { + success: function (response, options) { var result = Ext.decode(response.responseText); var success = result.success; - if(success && result.data){ - for(var i=0;i"; - for(var i=0;i"; + for (var i = 0; i < defaultSatisfactionOption.length; i++) { var selectHtml = ''; - if(record.defaultSatisfactionOptionInstance && record.defaultSatisfactionOptionInstance.id == defaultSatisfactionOption[i].id){ + if (record.defaultSatisfactionOptionInstance && record.defaultSatisfactionOptionInstance.satisfactionOption.id == defaultSatisfactionOption[i].satisfactionOption.id) { selectHtml = 'selected'; } - str += ""; + str += ""; } - str += ""; - return str; - } - },{ - header:'删除', - width:40, - hidden:!ishidden, - dataIndex:'del', - renderer:function(v,p,record){ - return "\"删除\""; - } - },{ - header:'添加', - width:40, - hidden:!ishidden, - dataIndex:'add', - renderer:function(v,p,record){ - var str = ""; - if(!record.leaf){ - str = "\"新增\""; - } - return str; - } - },{ - header:'上下移', - width:90, - hidden:!ishidden, - dataIndex:'remove', - renderer:function(v,p,record){ - return "\"上移\"  \"下移\""; - } - }], + str += ""; + return str; + } + }, { + header: '删除', + width: 40, + hidden: !ishidden, + dataIndex: 'del', + renderer: function (v, p, record) { + return "\"删除\""; + } + }, { + header: '添加', + width: 40, + hidden: !ishidden, + dataIndex: 'add', + renderer: function (v, p, record) { + var str = ""; + if (!record.leaf) { + str = "\"新增\""; + } + return str; + } + }, { + header: '上下移', + width: 90, + hidden: !ishidden, + dataIndex: 'remove', + renderer: function (v, p, record) { + return "\"上移\"  \"下移\""; + } + }], - loader: new top.Ext.tree.TreeLoader({ - url : WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!loadSatisfactionSurveyTemplateItem.do', - baseParams : {id:id,ishidden:ishidden}, - uiProviders:{ - 'col': top.Ext.tree.ColumnNodeUI - }, - listeners:{ - load:function(store,records){ - if(records && records.childNodes.length > 0){ + loader: new top.Ext.tree.TreeLoader({ + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!loadSatisfactionSurveyTemplateItem.do', + baseParams: { id: id, ishidden: ishidden }, + uiProviders: { + 'col': top.Ext.tree.ColumnNodeUI + }, + listeners: { + load: function (store, records) { + if (records && records.childNodes.length > 0) { var defaultSatisfaction = records.childNodes[0].attributes.defaultSatisfaction || '无'; top.Ext.getCmp('defaultSatisfaction').setValue(defaultSatisfaction); top.Ext.getCmp('defaultSatisfactionCombo').setValue(defaultSatisfaction); } } } - }), + }), - root: new top.Ext.tree.AsyncTreeNode({ - text:'满意度调查项' - }) - }); - - var treeEditer = new top.Ext.tree.ColumnTreeEditor(satisfactionSurveyTree, { - completeOnEnter : true, - autosize : true, + root: new top.Ext.tree.AsyncTreeNode({ + text: '满意度调查项' + }) + }); + + var treeEditer = new top.Ext.tree.ColumnTreeEditor(satisfactionSurveyTree, { + completeOnEnter: true, + autosize: true, allowBlank: false, -// cancelOnEsc : true, - revertInvalid:true, - ignoreNoChange : true + // cancelOnEsc : true, + revertInvalid: true, + ignoreNoChange: true }); - - treeEditer.on("beforestartedit", function(thiz,el,v){ - var tempNode = thiz.editNode;//将要编辑的节点 - if(tempNode.attributes.content==v ){ - return true; - }else { - return false; - } - }); - - var form = new top.Ext.FormPanel( { - id : 'statisfactionSurveyForm', - frame : true, - border : 0, - labelSeparator : ':', - bodyStyle : 'padding:5px 5px 0px 5px', - width : 680, - labelAlign:'right', - autoScroll:true, + + treeEditer.on("beforestartedit", function (thiz, el, v) { + var tempNode = thiz.editNode;//将要编辑的节点 + if (tempNode.attributes.content == v) { + return true; + } else { + return false; + } + }); + + var form = new top.Ext.FormPanel({ + id: 'statisfactionSurveyForm', + frame: true, + border: 0, + labelSeparator: ':', + bodyStyle: 'padding:5px 5px 0px 5px', + width: 680, + labelAlign: 'right', + autoScroll: true, // autoHeight : true, - items : [{ - xtype:"fieldset", - layout:'column', - title :'基础信息', - height:350, - items:[{ - layout : 'column', - items : [{ - xtype : 'hidden', - name : 'id', - id : 'id' - },{ - xtype : 'hidden', - name : 'readers', - id : 'readers' - },{ - xtype : 'hidden', - name : 'printData', - id : 'printData' - },{ - xtype : 'hidden', - name : 'treeItemData', - id : 'treeItemData' - },{ - xtype : 'hidden', - name : 'defaultSatisfaction', - id : 'defaultSatisfaction' - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textfield', - fieldLabel : '名称', - id : 'name', - name : 'name', - allowBlank : false, - anchor : '98%' + items: [{ + xtype: "fieldset", + layout: 'column', + title: '基础信息', + height: 350, + items: [{ + layout: 'column', + items: [{ + xtype: 'hidden', + name: 'id', + id: 'id' + }, { + xtype: 'hidden', + name: 'readers', + id: 'readers' + }, { + xtype: 'hidden', + name: 'printData', + id: 'printData' + }, { + xtype: 'hidden', + name: 'treeItemData', + id: 'treeItemData' + }, { + xtype: 'hidden', + name: 'defaultSatisfaction', + id: 'defaultSatisfaction' + }, { + columnWidth: 1, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'textfield', + fieldLabel: '名称', + id: 'name', + name: 'name', + allowBlank: false, + anchor: '98%' }] - },{ - columnWidth : .5, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '提醒开始日期', - id : 'remindStartDate', - name : 'remindStartDate', - readOnly : true, - allowBlank : false, - format : 'Y-m-d H:i', - anchor : '95%' + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'datefieldWithMin', + fieldLabel: '提醒开始日期', + id: 'remindStartDate', + name: 'remindStartDate', + readOnly: true, + allowBlank: false, + format: 'Y-m-d H:i', + anchor: '95%' }] - },{ - columnWidth : .5, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '提醒结束日期', - id : 'endDate', - name : 'endDate', - readOnly : true, - allowBlank : true, - format : 'Y-m-d H:i', - anchor : '95%' + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'datefieldWithMin', + fieldLabel: '提醒结束日期', + id: 'endDate', + name: 'endDate', + readOnly: true, + allowBlank: true, + format: 'Y-m-d H:i', + anchor: '95%' }] - },{ - columnWidth : .5, - layout : 'form', - labelWidth : 160, - items : [{ - xtype : 'hidden', + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 160, + items: [{ + xtype: 'hidden', id: "useSystemAfterFillOut", name: "useSystemAfterFillOut" - },{ + }, { xtype: "checkbox", - style:'margin-top: 4px;', + style: 'margin-top: 4px;', id: "useSystemAfterFillOutBox", fieldLabel: "填写后才允许使用系统", boxLabel: "" }] - },{ - columnWidth : .5, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'combo', - fieldLabel : '是否单独填写', - id : 'isfillOutAlone', - name : 'isfillOutAlone', - valueField : 'value', - displayField : 'value', - store : new Ext.data.SimpleStore({ - fields : [ 'value' ], - data : [ ['是' ], ['否' ]] + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'combo', + fieldLabel: '是否单独填写', + id: 'isfillOutAlone', + name: 'isfillOutAlone', + valueField: 'value', + displayField: 'value', + store: new Ext.data.SimpleStore({ + fields: ['value'], + data: [['是'], ['否']] }), - forceSelection : true, + forceSelection: true, allowBlank: false, - editable:false, - mode : 'local', - triggerAction : 'all', - anchor : '95%' + editable: false, + mode: 'local', + triggerAction: 'all', + anchor: '95%' }] - },{ - columnWidth : 0.85, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textfield', - fieldLabel : '科室', - id : 'readersForDisplay', - name : 'readersForDisplay', - allowBlank : false, - readOnly:true, - anchor : '98%' - }] - },{ - columnWidth : 0.15, - layout : 'form', - items : [{ - xtype : 'button', - text : '选择科室', - listeners:{ - click : function(){ - var departNames = top.Ext.getCmp('readersForDisplay').getValue(); - var departcodes = top.Ext.getCmp('readers').getValue(); - var codes = []; - for(var i=0;i 1){ - code = code.split('_')[1]; - } - codes.push(code); - } + }, { + columnWidth: 0.85, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'textfield', + fieldLabel: '科室', + id: 'readersForDisplay', + name: 'readersForDisplay', + allowBlank: false, + readOnly: true, + anchor: '98%' + }] + }, { + columnWidth: 0.15, + layout: 'form', + items: [{ + xtype: 'button', + text: '选择科室', + listeners: { + click: function () { + var departNames = top.Ext.getCmp('readersForDisplay').getValue(); + var departcodes = top.Ext.getCmp('readers').getValue(); + var codes = []; + for (var i = 0; i < departcodes.split(';').length; i++) { + if (departcodes.split(';')[i] !== '' && departcodes.split(';')[i] !== undefined) { + var code = departcodes.split(';')[i]; + if (code.split('_').length > 1) { + code = code.split('_')[1]; } - openSelectReceiverOrganization(departNames,codes.join(';'),'satisfactionSurveyTemplateForm'); + codes.push(code); } - } - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textarea', - fieldLabel : '调查表说明', - id : 'instructions', - name : 'instructions', - height :40, - allowBlank : true, - maxLength : 500, - anchor : '98%' + } + openSelectReceiverOrganization(departNames, codes.join(';'), 'satisfactionSurveyTemplateForm'); + } + } }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textarea', - fieldLabel : '反馈意见', - id : 'feedback', - name : 'feedback', - height :40, - allowBlank : true, - maxLength : 500, - anchor : '98%' + }, { + columnWidth: 1, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'textarea', + fieldLabel: '调查表说明', + id: 'instructions', + name: 'instructions', + height: 40, + allowBlank: true, + maxLength: 500, + anchor: '98%' }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textarea', - fieldLabel : '原因分析', - id : 'analysisCauses', - name : 'analysisCauses', - height :40, - allowBlank : true, - maxLength : 500, - anchor : '98%' + }, { + columnWidth: 1, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'textarea', + fieldLabel: '反馈意见', + id: 'feedback', + name: 'feedback', + height: 40, + allowBlank: true, + maxLength: 500, + anchor: '98%' }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textarea', - fieldLabel : '整改措施', - id : 'measures', - name : 'measures', - height :40, - allowBlank : true, - maxLength : 500, - anchor : '98%' + }, { + columnWidth: 1, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'textarea', + fieldLabel: '原因分析', + id: 'analysisCauses', + name: 'analysisCauses', + height: 40, + allowBlank: true, + maxLength: 500, + anchor: '98%' }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textarea', - fieldLabel : '效果评价', - id : 'evaluation', - height :40, - name : 'evaluation', - allowBlank : true, - maxLength : 500, - anchor : '98%' + }, { + columnWidth: 1, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'textarea', + fieldLabel: '整改措施', + id: 'measures', + name: 'measures', + height: 40, + allowBlank: true, + maxLength: 500, + anchor: '98%' }] + }, { + columnWidth: 1, + layout: 'form', + labelWidth: 80, + items: [{ + xtype: 'textarea', + fieldLabel: '效果评价', + id: 'evaluation', + height: 40, + name: 'evaluation', + allowBlank: true, + maxLength: 500, + anchor: '98%' + }] }] }] - },{ - xtype:"fieldset", - id: "fieldSet", - // autoScroll:true, - title :'满意度调查项', - // height:340, + }, { + xtype: "fieldset", + id: "fieldSet", + // autoScroll:true, + title: '满意度调查项', + // height:340, autoHeight: true, - tbar:[{text:'项目内容:'},{ - xtype : 'textfield', - id : 'templateContent', - name : 'templateContent', - width : 320, - anchor : '97%', - listeners:{ - specialkey : function(field, ee) { + tbar: [{ text: '项目内容:' }, { + xtype: 'textfield', + id: 'templateContent', + name: 'templateContent', + width: 320, + anchor: '97%', + listeners: { + specialkey: function (field, ee) { if (ee.getKey() == Ext.EventObject.ENTER) { addItem(satisfactionSurveyTree); } - } + } } - },{ - text : '添加', - hidden:!ishidden, - id:'addBtn', - iconCls : 'btn_ext_add', - handler : function() { + }, { + text: '添加', + hidden: !ishidden, + id: 'addBtn', + iconCls: 'btn_ext_add', + handler: function () { addItem(satisfactionSurveyTree); } - },'->',{ - text:'默认满意度:', - hidden:showDefaultSatisfactionOption ? true: !sstsConfig.enableDefaultSatisfactionOptionsFunction - },{ - xtype : 'combo', - id : 'defaultSatisfactionCombo', - hidden:showDefaultSatisfactionOption ? true: !sstsConfig.enableDefaultSatisfactionOptionsFunction, - valueField : 'id', - displayField : 'value', - width:100, - store : new Ext.data.SimpleStore({ - fields : [ 'value','id'], - data : [ - ['无','无'], - ['满意', SATISFACTION], - ['较满意',MORESATISFACTION], - ['基本满意',BASICSATISFACTION], - ['不太满意',NOTVERYSATISFACTION], - ['不满意',NOSATISFACTION] + }, '->', { + text: '默认满意度:', + hidden: showDefaultSatisfactionOption ? true : !sstsConfig.enableDefaultSatisfactionOptionsFunction + }, { + xtype: 'combo', + id: 'defaultSatisfactionCombo', + hidden: showDefaultSatisfactionOption ? true : !sstsConfig.enableDefaultSatisfactionOptionsFunction, + valueField: 'id', + displayField: 'value', + width: 100, + store: new Ext.data.SimpleStore({ + fields: ['value', 'id'], + data: [ + ['无', '无'], + ['满意', SATISFACTION], + ['较满意', MORESATISFACTION], + ['基本满意', BASICSATISFACTION], + ['不太满意', NOTVERYSATISFACTION], + ['不满意', NOSATISFACTION] ] }), - forceSelection : true, + forceSelection: true, allowBlank: false, - editable:false, - mode : 'local', - value:'无', - triggerAction : 'all', - anchor : '95%', - listeners:{ - select : function(combo,record,index ){ + editable: false, + mode: 'local', + value: '无', + triggerAction: 'all', + anchor: '95%', + listeners: { + select: function (combo, record, index) { var id = record.data.id; top.Ext.getCmp('defaultSatisfaction').setValue(id); } } }], - items:[ - satisfactionSurveyTree - ] + items: [ + satisfactionSurveyTree + ] }, { - xtype:"fieldset", - id: "fieldSet2", - title :'满意度自定义项', - width : 680, - autoHeight : true, - items:[ - customForm.getFormDefinitionItemConfigPanel({ - title : '自定义项列表' - }) - ] - } + xtype: "fieldset", + id: "fieldSet2", + title: '满意度自定义项', + width: 680, + autoHeight: true, + items: [ + customForm.getFormDefinitionItemConfigPanel({ + title: '自定义项列表' + }) + ] + } - ], - buttonAlign :'center', - buttons : [{ - text : '打印', - id :'printBtn', - handler : function(){ + ], + buttonAlign: 'center', + buttons: [{ + text: '打印', + id: 'printBtn', + handler: function () { var printData = top.Ext.getCmp('printData').getValue(); var instructions = top.Ext.getCmp('instructions').getValue(); var feedback = top.Ext.getCmp('feedback').getValue(); var analysisCauses = top.Ext.getCmp('analysisCauses').getValue(); var measures = top.Ext.getCmp('measures').getValue(); var evaluation = top.Ext.getCmp('evaluation').getValue(); var data = { - instructions:instructions, - feedback:feedback, - analysisCauses:analysisCauses, - measures:measures, - evaluation:evaluation, - printData:printData, - userName:userName + instructions: instructions, + feedback: feedback, + analysisCauses: analysisCauses, + measures: measures, + evaluation: evaluation, + printData: printData, + userName: userName } printSatisfaction(data); } - },{ - text : '保存', - id :'saveBtn', - handler : function(){ - if(!form.getForm().isValid()){ + }, { + text: '保存', + id: 'saveBtn', + handler: function () { + if (!form.getForm().isValid()) { showResult('请正确填写表单各值'); return false; } //获取columnTreePanel数据 var treeData = getItemTreeData(satisfactionSurveyTree); - if(treeData.length == 0){ + if (treeData.length == 0) { showResult('满意度调查项不能为空!'); return false; } - + var departcodes = top.Ext.getCmp('readers').getValue(); - if(!departcodes || departcodes.length == 0){ + if (!departcodes || departcodes.length == 0) { showResult('科室不能为空!'); return false; }/*else if(departcodes.length >= 3980){ showResult('所选科室太多,请重新选择!'); return false; }*/ - + top.Ext.getCmp("treeItemData").setValue(JSON.stringify(treeData)); var b = this; - top.Ext.MessageBox.confirm("请确认","是否提交满意调查模板信息?",function(btn) { - if(btn=='yes') { + top.Ext.MessageBox.confirm("请确认", "是否提交满意调查模板信息?", function (btn) { + if (btn == 'yes') { b.disable(); - if(submitForm(form,wwindow,b)==false){ + if (submitForm(form, wwindow, b) == false) { b.enable(); } } }); } - },{ - text : '结束', - id:"endBtn", - handler : function(button) { - top.Ext.MessageBox.confirm("请确认","是否结束满意调查模板信息?",function(btn) { - if(btn=='yes') { + }, { + text: '结束', + id: "endBtn", + handler: function (button) { + top.Ext.MessageBox.confirm("请确认", "是否结束满意调查模板信息?", function (btn) { + if (btn == 'yes') { form.form.submit({ - url : WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!endSatisfactionSurveyTemplate.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!endSatisfactionSurveyTemplate.do', + method: 'POST', + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', + success: function (form, action) { grid.dwrReload(); - if(action.result.success){ + if (action.result.success) { showResult("保存成功!"); wwindow.close(); - }else{ + } else { showResult("保存失败!"); } }, - failure : function(form, action) { + failure: function (form, action) { showResult(action.failureType); } }); button.disable(); - }else{ + } else { button.enable(); } }); } - },{ - text : '取消', - handler : function() { + }, { + text: '取消', + handler: function () { wwindow.close(); } }] }); - - var wwindow = new top.Ext.Window( { - id : 'satisfactionSurveyApplicationWin', - layout : 'border', - title : '满意度调查表定义', - width : 720, + + var wwindow = new top.Ext.Window({ + id: 'satisfactionSurveyApplicationWin', + layout: 'border', + title: '满意度调查表定义', + width: 720, // width : 650, // height : 600, - height : 615, - border : false, - plain : true, - modal :true, - items : [{ - region:'center', - width : 200, - layout :'fit', - items:[form] + height: 615, + border: false, + plain: true, + modal: true, + items: [{ + region: 'center', + width: 200, + layout: 'fit', + items: [form] }] }); - - satisfactionSurveyTree.on("beforeclick",function(clickNode,eObj,v){ - if(isClickDel()){//删除 + + satisfactionSurveyTree.on("beforeclick", function (clickNode, eObj, v) { + if (isClickDel()) {//删除 deleteGiveBackColumnTreeItem(clickNode); - }else if(isClickAdd()) {//添加 - var blankNode = createNode(false,'','双击编辑'); + } else if (isClickAdd()) {//添加 + var blankNode = createNode(false, '', '双击编辑'); clickNode.appendChild(blankNode); //clickNode.expandChildNodes(true); - }else if(isClickMoveUp()) {//上移 + } else if (isClickMoveUp()) {//上移 moveUp(clickNode); - }else if(isClickMoveDown()) {//下移 + } else if (isClickMoveDown()) {//下移 moveDown(clickNode); - }else if(isSelect()) {//下移 + } else if (isSelect()) {//下移 changeOption(clickNode); } setClickType(''); }); - satisfactionSurveyTree.loader.on('load',function(Thiz, node, response ){ + satisfactionSurveyTree.loader.on('load', function (Thiz, node, response) { top.Ext.getCmp('printData').setValue(response.responseText); }); satisfactionSurveyTree.expandAll(); if (id != '') {// 编辑 - form.form.load( { - url : WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!loadSatisfactionSurveyTemplate.do', - method : 'GET', - waitMsg : '正在加载数据,请稍候', - success : function(form, action) { - if(isclear){ + form.form.load({ + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!loadSatisfactionSurveyTemplate.do', + method: 'GET', + waitMsg: '正在加载数据,请稍候', + success: function (form, action) { + if (isclear) { top.Ext.getCmp('id').setValue(''); top.Ext.getCmp('treeItemData').setValue(''); top.Ext.getCmp('name').setValue(''); @@ -636,41 +640,41 @@ top.Ext.getCmp('evaluation').setValue(''); top.Ext.getCmp('evaluation').enable(); top.Ext.getCmp('saveBtn').enable(); - }else{ - top.Ext.getCmp('remindStartDate').setValue(Ext.util.Format.date(new Date(action.result.data.remindStartDate.time),'Y-m-d H:i')); - if(action.result.data.endDate){ - top.Ext.getCmp('endDate').setValue(Ext.util.Format.date(new Date(action.result.data.endDate.time),'Y-m-d H:i')); + } else { + top.Ext.getCmp('remindStartDate').setValue(Ext.util.Format.date(new Date(action.result.data.remindStartDate.time), 'Y-m-d H:i')); + if (action.result.data.endDate) { + top.Ext.getCmp('endDate').setValue(Ext.util.Format.date(new Date(action.result.data.endDate.time), 'Y-m-d H:i')); } var useSystemAfterFillOut = action.result.data.useSystemAfterFillOut || '否'; top.Ext.getCmp('useSystemAfterFillOut').setValue(useSystemAfterFillOut) - if(action.result.data.useSystemAfterFillOut == '是'){ + if (action.result.data.useSystemAfterFillOut == '是') { top.Ext.getCmp('useSystemAfterFillOutBox').setValue(true); - }else { + } else { top.Ext.getCmp('useSystemAfterFillOutBox').setValue(false); } } - var result = Ext.decode(action.response.responseText); - var formDefinition_id = result.data['formDefinition_id']; - customForm.getCustomFormData(formDefinition_id); - }, - failure : function(form, action) { + var result = Ext.decode(action.response.responseText); + var formDefinition_id = result.data['formDefinition_id']; + customForm.getCustomFormData(formDefinition_id); + }, + failure: function (form, action) { }, - params : { - id : id + params: { + id: id } }); - if(status==STAUTS_START){//已开始状态 + if (status == STAUTS_START) {//已开始状态 top.Ext.getCmp("endBtn").enable(); top.Ext.getCmp('saveBtn').enable(); top.Ext.getCmp('printBtn').disable(); - }else{//已结束状态 + } else {//已结束状态 top.Ext.getCmp("endBtn").disable(); top.Ext.getCmp('evaluation').enable(); top.Ext.getCmp('printBtn').enable(); top.Ext.getCmp('saveBtn').enable(); } - }else{//新建状态 + } else {//新建状态 top.Ext.getCmp("endBtn").disable(); top.Ext.getCmp('saveBtn').enable(); top.Ext.getCmp('printBtn').disable(); @@ -682,176 +686,175 @@ /** * 创建节点 */ -function createNode(isParentNode,attrId,content){ +function createNode(isParentNode, attrId, content) { var node; - if(isParentNode==true){ + if (isParentNode == true) { //创建父节点 node = new top.Ext.tree.TreeNode({ - id:Ext.id(), + id: Ext.id(), //text:content, - cls:'master-task', - iconCls:'task-folder', - uiProvider:top.Ext.tree.ColumnNodeUI, - leaf:false, - expanded:true + cls: 'master-task', + iconCls: 'task-folder', + uiProvider: top.Ext.tree.ColumnNodeUI, + leaf: false, + expanded: true }); - }else{ + } else { //创建子节点 node = new top.Ext.tree.TreeNode({ - id:Ext.id(), + id: Ext.id(), //text:'', - iconCls:'task', - uiProvider:top.Ext.tree.ColumnNodeUI, - leaf:true, - expanded:true + iconCls: 'task', + uiProvider: top.Ext.tree.ColumnNodeUI, + leaf: true, + expanded: true }); } //********************** 节点保存的属性值 ****************************// - node.attributes.id=attrId; - node.attributes.content=content; + node.attributes.id = attrId; + node.attributes.content = content; top.Ext.getCmp("templateContent").setRawValue(''); return node; } -function deleteGiveBackColumnTreeItem(clickNode){ - if(clickNode.leaf) { +function deleteGiveBackColumnTreeItem(clickNode) { + if (clickNode.leaf) { clickNode.remove(); } else { var pNode = clickNode.parentNode; clickNode.remove(); } } -function moveUp(clickNode){ - if(!clickNode.isFirst()) { +function moveUp(clickNode) { + if (!clickNode.isFirst()) { var pNode = clickNode.parentNode; var preNode = clickNode.previousSibling; - pNode.insertBefore (clickNode, preNode); + pNode.insertBefore(clickNode, preNode); } } -function moveDown(clickNode){ - if(!clickNode.isLast()) { +function moveDown(clickNode) { + if (!clickNode.isLast()) { var pNode = clickNode.parentNode; var nextNode = clickNode.nextSibling; - pNode.insertBefore (nextNode, clickNode); + pNode.insertBefore(nextNode, clickNode); } } -var changeItem = {}; +var changeItem; -function changeOption(clickNode){ - if(changeItem){ - clickNode.attributes.defaultSatisfactionOptionInstance = { - satisfactionOption:changeItem - }; +function changeOption(clickNode) { + if (changeItem) { + clickNode.attributes.defaultSatisfactionOptionInstance = changeItem; } } var currentClickType = '';//删除、添加、上下移动标识字符 -function setClickType(v){ - currentClickType=v; +function setClickType(v) { + currentClickType = v; } -function isClickDel(){ - return (currentClickType=='del'?true:false); +function isClickDel() { + return (currentClickType == 'del' ? true : false); } -function isClickAdd(){ - return (currentClickType=='add'?true:false); +function isClickAdd() { + return (currentClickType == 'add' ? true : false); } -function isClickMoveUp(){ - return (currentClickType=='up'?true:false); +function isClickMoveUp() { + return (currentClickType == 'up' ? true : false); } -function isClickMoveDown(){ - return (currentClickType=='down'?true:false); +function isClickMoveDown() { + return (currentClickType == 'down' ? true : false); } -function isSelect(){ - return (currentClickType=='select'?true:false); +function isSelect() { + return (currentClickType == 'select' ? true : false); } -function changeDefaultSatisfactionOption(selectedIndex){ +function changeDefaultSatisfactionOption(selectedIndex) { changeItem = defaultSatisfactionOption[selectedIndex]; } -function replaceStr(str){ +function replaceStr(str) { var replaceV = ""; - if(str){ - replaceV = str.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,"\""); + if (str) { + replaceV = str.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, "\""); } return replaceV; } /** */ -function getItemTreeData(satisfactionSurveyTree){ +function getItemTreeData(satisfactionSurveyTree) { var rootNode = satisfactionSurveyTree.getRootNode(); var valArr = new Array(); - rootNode.eachChild(function(pNode){ - if(!pNode.isLeaf()){//父节点 - var parentContent = pNode.attributes[0] ? pNode.attributes[0]:pNode.attributes.content; + rootNode.eachChild(function (pNode) { + if (!pNode.isLeaf()) {//父节点 + var parentContent = pNode.attributes[0] ? pNode.attributes[0] : pNode.attributes.content; + var id = pNode.attributes[0] ? '' : pNode.attributes.id; var children = []; - pNode.eachChild(function(cNode){ - var lastContent = cNode.attributes[0] ? cNode.attributes[0]:cNode.attributes.content; + pNode.eachChild(function (cNode) { + var lastContent = cNode.attributes[0] ? cNode.attributes[0] : cNode.attributes.content; + var id = cNode.attributes[0] ? '' : cNode.attributes.id; children.push({ - id:'', - content:replaceStr(lastContent), - defaultSatisfactionOptionInstance:cNode.attributes.defaultSatisfactionOptionInstance + id: id, + content: replaceStr(lastContent), + defaultSatisfactionOptionInstance: cNode.attributes.defaultSatisfactionOptionInstance }) }); - if(children.length == 0){ + if (children.length == 0) { valArr.push({ - id:'', - content:replaceStr(parentContent), - defaultSatisfactionOptionInstance:pNode.attributes.defaultSatisfactionOptionInstance + id: id, + content: replaceStr(parentContent), + defaultSatisfactionOptionInstance: pNode.attributes.defaultSatisfactionOptionInstance }) - }else { + } else { valArr.push({ - id:'', - content:replaceStr(parentContent), - children:children + id: id, + content: replaceStr(parentContent), + children: children }) } } }); - //console.log(valArr) return valArr; } -function submitForm(form,wwindow,btnSave){ - var jsonArray = customForm.beforeSubmit(); - if (!jsonArray){ - return false; - } +function submitForm(form, wwindow, btnSave) { + var jsonArray = customForm.beforeSubmit(); + if (!jsonArray) { + return false; + } var remindStartDate = top.Ext.getCmp('remindStartDate').getValue(); var endDate = top.Ext.getCmp('endDate').getValue(); - if(endDate !== ''){ + if (endDate !== '') { var startString = Date.parse(remindStartDate); var endString = Date.parse(endDate); - if(startString > endString){ + if (startString > endString) { showResult('提醒结束日期不能早于提醒开始日期'); return false; } } var useSystemAfterFillOutBox = top.Ext.getCmp('useSystemAfterFillOutBox').getValue(); - if(useSystemAfterFillOutBox == true){ + if (useSystemAfterFillOutBox == true) { top.Ext.getCmp('useSystemAfterFillOut').setValue('是'); - }else { + } else { top.Ext.getCmp('useSystemAfterFillOut').setValue('否'); } - var items = jsonArray.length > 0 ? Ext.encode(jsonArray) : ''; + var items = jsonArray.length > 0 ? Ext.encode(jsonArray) : ''; form.form.submit({ - url : WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!saveSatisfactionSurveyTemplate.do', - method : 'POST', - params : {"items" : items}, - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - grid.dwrReload(); + url: WWWROOT + '/disinfectSystem/satisfactionsurvey/satisfactionSurveyTemplateAction!saveSatisfactionSurveyTemplate.do', + method: 'POST', + params: { "items": items }, + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', + success: function (form, action) { + //grid.dwrReload(); wwindow.close(); - if(action.result.success){ + if (action.result.success) { showResult("保存成功!"); - }else{ + } else { showResult("保存失败!"); } }, - failure : function(form, action) { + failure: function (form, action) { showResult(action.result.message); btnSave.enable(); return false; Index: ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTableForm.js =================================================================== diff -u -r39071 -r39072 --- ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTableForm.js (.../satisfactionSurveyTableForm.js) (revision 39071) +++ ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionSurveyTableForm.js (.../satisfactionSurveyTableForm.js) (revision 39072) @@ -1,50 +1,37 @@ var satisfactionSurveyTableItemTreeStore; //意度调查表实例项的top.Ext4.data.TreeStore var formObj; //意度调查表的表单 var windowObj; //意度调查表的窗口 +var optionInstances = []; /** * 每次点击需要把每个节点的“satisfaction”属性更新. * @param nodeId 节点的id * @param thiz 被点击radio元素 */ -function setSatisfaction(nodeId, optionId, thiz) { - var node = satisfactionSurveyTableItemTreeStore.getNodeById(nodeId); - 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 setSatisfaction(nodeId, index, id) { + if (index !== undefined && index !== 'undefined') { + var node = satisfactionSurveyTableItemTreeStore.getNodeById(nodeId); + if (id) { + node.data.satisfactionDetail.satisfactionOptionInstance = optionInstances[index]; + } else { + node.data.defaultSatisfactionOptionInstance = optionInstances[index]; + } } } /** * 渲染每个选项调用的函数. */ -function createSatisfactionCheckBox(record, satisfactionVal, id, optionId) { +function createSatisfactionCheckBox(record, satisfactionVal, id, index) { var checked = ""; 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\""; - } + if (defaultSatisfactionOptionInstance && defaultSatisfactionOptionInstance !== '') { + if (defaultSatisfactionOptionInstance.satisfactionOption.satisfaction && defaultSatisfactionOptionInstance.satisfactionOption.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 (satisfactionDetail && satisfactionDetail !== '') { + if (satisfactionDetail.satisfactionOptionInstance.satisfaction && satisfactionDetail.satisfactionOptionInstance.satisfaction == satisfactionVal) { + checked = "checked=\"checked\""; } } } else { @@ -54,9 +41,9 @@ } } if (id) { - return '' + return '' } else { - return '' + return '' } } @@ -156,18 +143,18 @@ }, { header: '项目内容', dataIndex: 'content', width: 310, sortable: false, menuDisabled: true }] + optionInstances = result.data; for (var i = 0; i < result.data.length; i++) { (function (temp) { var satisfaction = result.data[temp].satisfaction; - var optionId = result.data[temp].id; columnsArr.push({ header: satisfaction, width: 80, sortable: false, menuDisabled: true, renderer: function (v, p, record) { if (record.get('leaf')) { - return createSatisfactionCheckBox(record, satisfaction, id, optionId); + return createSatisfactionCheckBox(record, satisfaction, id, temp); } } }) @@ -482,7 +469,7 @@ optionInstance = childNode2.get('satisfactionDetail').satisfactionOptionInstance; node2.satisfaction = optionInstance.satisfaction; } - if (optionInstance.reasonNotNull == '是' && recordReason == '') { + if (optionInstance.reasonNotNull == '是' && satifyResaon == '') { showResult(node2.content + '需要填写原因,请补充。'); return false; }