Index: ssts-web/src/main/webapp/common/includeExtJsAndCss.jsp =================================================================== diff -u -r27236 -r27503 --- ssts-web/src/main/webapp/common/includeExtJsAndCss.jsp (.../includeExtJsAndCss.jsp) (revision 27236) +++ ssts-web/src/main/webapp/common/includeExtJsAndCss.jsp (.../includeExtJsAndCss.jsp) (revision 27503) @@ -53,4 +53,16 @@ width:192px !important; } } + .resultList table{ + background-color:yellow; + display: block; + } + + .resultShow { + display:block; + } + + .resultHide { + display:none; + } \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/departmentapptemplate/departmentAppTemplateForm.js =================================================================== diff -u -r24385 -r27503 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/departmentapptemplate/departmentAppTemplateForm.js (.../departmentAppTemplateForm.js) (revision 24385) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/departmentapptemplate/departmentAppTemplateForm.js (.../departmentAppTemplateForm.js) (revision 27503) @@ -75,6 +75,55 @@ return repeat; } + +/** + * 搜索科室名称 + * @param departmentStore 对应的数据源 + * @param keyWordId 搜索的关键字 + */ +function searchDepartmentStore(departmentStore, keyWordId) { + var keyWord = top.Ext.getCmp(keyWordId).getValue(); + var count = 0; + //先清除高亮标记 + departmentStore.each(function (item) { + item.set('isFind', false); + item.set('isDisabled', true); + }); + + //如果关键搜索为空,则不进行搜索 + if (top.Ext.isEmpty(keyWord)){ + return; + } + + departmentStore.findBy(function (item) { + var reg = new RegExp(keyWord, 'i'); + + if (item.data.departName.search(reg) != -1){ + //如果找到该记录,设计高亮标记 + item.set('isFind', true); + item.set('isDisabled', true); + count++; + } + + if (item.data.departName.search(reg) == -1){ + item.set('isDisabled', false); + } + }); +} + +/** + * 清空科室名称 + * @param departmentStore 对应的数据源 + * @param keyWordId 搜索的关键字 +*/ +function clearDepartmentStore(departmentStore, keyWordId){ + top.Ext.getCmp(keyWordId).setValue(''); + departmentStore.each(function (item) { + item.set('isFind', false); + item.set('isDisabled', true); + }); +} + function addAndEditSterilizer(id) { this.id = id; //排序号 @@ -384,7 +433,17 @@ height: 150, frame : false, viewConfig: { - forceFit:true + forceFit:true, + getRowClass: function(record, rowIndex){ + var isFind = record.get("isFind"); + var isDisabled = record.get("isDisabled"); + + if(isDisabled == true){ + return isFind ? "resultList resultShow" : "resultShow"; + }else { + return isFind ? "resultList resultHide" : "resultHide"; + } + } }, bodyStyle : 'border:1px solid #afd7af', autoExpandColumn : 'departName', @@ -447,7 +506,9 @@ if(departId !="" && departId != null){ var p = new departItem({ id : departId, - departName : departName + departName : departName, + isFind:false, + isDisabled:true }); top.Ext.getCmp('configGrid').stopEditing();// 停止编辑 departmentStore.add(p); @@ -486,7 +547,9 @@ if(f){ var p = new departItem({ id : departId, - departName : name + departName : name, + isFind:false, + isDisabled:true }); top.Ext.getCmp('configGrid').stopEditing();// 停止编辑 departmentStore.add(p); @@ -497,6 +560,35 @@ } }); } + },{ + text : '搜索科室名称 :' + },{ + xtype : 'textfield', + id : 'seachDepartName', + width : 150, + anchor : '100%', + allowBlank : true, + listeners : { + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + searchDepartmentStore(departmentStore, 'seachDepartName'); + } + } + } + },{ + xtype: 'button', + text: '查询', + iconCls: 'icon_search', + handler: function(){ + searchDepartmentStore(departmentStore, 'seachDepartName'); + } + },{ + xtype: 'button', + text: '清空', + iconCls: 'icon_set', + handler: function(){ + clearDepartmentStore(departmentStore, 'seachDepartName'); + } }] })] }, {