Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedView.js =================================================================== diff -u -r12331 -r15201 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedView.js (.../invoicePlanExtractedView.js) (revision 12331) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedView.js (.../invoicePlanExtractedView.js) (revision 15201) @@ -1,17 +1,42 @@ var grid; -function refreshList(){ +/** + * 刷新列表 + * @param isSetDateValue 是否要设置开始时间和结束时间 + * @param isLoad 是否要重新加载 + */ +function refreshList(isSetDateValue,isLoad){ //对已选择的进行变量赋值 selectedApplyDate = Ext.getCmp('applyDate').getValue(); selectedTousseType = Ext.getCmp('tousseType').getValue(); - var store = grid.getStore(); - store.baseParams['departCode'] = Ext.getCmp('invoiceDepartGroup').getValue(); - store.baseParams['applyDate'] = selectedApplyDate; - store.baseParams['tousseType'] = selectedTousseType; - - store.load();//刷新列表界面 + var startDate = Ext.getCmp('startDate'); + var endDate = Ext.getCmp('endDate'); + if (!isUndefinedOrNullOrEmpty(isSetDateValue) && isSetDateValue == true){ + var dateArray = selectedApplyDate.split(';'); + startDate.setValue(dateArray[0]); + endDate.setValue(dateArray[1] ? dateArray[1] : ''); + } + if (!isUndefinedOrNullOrEmpty(isLoad) && isLoad == true){ + var startDateValue = startDate.value; + var endDateValue = endDate.value; + if (!isUndefinedOrNullOrEmpty(startDateValue) && !isUndefinedOrNullOrEmpty(endDateValue)){ + if (checkEtGreaterThanSt(endDateValue,startDateValue)){ + Ext.Msg.alert('警告','结束时间不能少于开始时间!'); + return; + } + selectedApplyDate = startDateValue.concat(';').concat(endDateValue); + } + var store = grid.getStore(); + store.baseParams['departCode'] = Ext.getCmp('invoiceDepartGroup').getValue(); + store.baseParams['applyDate'] = selectedApplyDate; + store.baseParams['tousseType'] = selectedTousseType; + //刷新列表界面 + store.load(); + } } + + /** * 修改记录 * modifyRecord函数 触发modify函数调用,并传入当前列的值以及record.data对象 @@ -105,6 +130,7 @@ allowBlank : false, editable : false, emptyText:'请选择科室分组', + width : 120, store : departGroupStore, forceSelection : true, triggerAction : 'all', @@ -124,6 +150,7 @@ displayField : 'key', allowBlank : true, editable : false, + width : 120, emptyText:'请选择申请单日期', mode:'local', store : new Ext.data.SimpleStore({ @@ -134,11 +161,35 @@ triggerAction : 'all', listeners : { select : function(combo, record, index){ - refreshList(); + refreshList(true); } }, anchor : '95%' },{ + text : '开始日期:' + },{ + xtype : 'datefield', + fieldLabel : '开始日期', + name : 'startDate', + id : 'startDate', + readOnly : false, + editable : false, + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + format : 'Y-m-d', + width:100 + },{ + text : '结束日期:' + },{ + xtype : 'datefield', + fieldLabel : '结束日期', + name : 'endDate', + id : 'endDate', + readOnly : false, + editable : false, + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + format : 'Y-m-d', + width:100 + }, { text : '物品类型:' },{ xtype : 'combo', @@ -149,6 +200,7 @@ allowBlank : true, editable : false, fieldLabel:'类型', + width : 120, emptyText:'请选择物品类型', mode:'local', store : new Ext.data.SimpleStore({ @@ -167,7 +219,7 @@ text : '刷新列表', iconCls : 'btn_ext_refresh1', handler : function() { - refreshList(); + refreshList(false,true); } }] }); Index: ssts-web/src/main/webapp/js/common.js =================================================================== diff -u -r15125 -r15201 --- ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 15125) +++ ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 15201) @@ -2350,3 +2350,18 @@ } return s; } + +/** + * 兼容ie和其他浏览器的时间比较,比较开始时间和结束时间大小 + * @param endTime 结束时间 + * @param startTime 开始时间 + * @returns {boolean} + */ +function checkEtGreaterThanSt(endTime,startTime) { + if (Ext.isIE){ + return Date.parse(endTime.replace(/-/g,'/')) < Date.parse(startTime.replace(/-/g,'/')); + } + else{ + return Date.parse(endTime) < Date.parse(startTime); + } +}