|
@@ -731,12 +731,25 @@ $(document).ready(function() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- $('#pos-search-hint').html(' ' + resultArr.length + '个匹配').show();
|
|
|
+ $('#pos-search-hint').html('结果:' + resultArr.length);
|
|
|
} else {
|
|
|
resultArr = [];
|
|
|
$('#pos-search-hint').hide();
|
|
|
}
|
|
|
};
|
|
|
+ const searchAndLocate = function (keyword) {
|
|
|
+ search(keyword);
|
|
|
+ if (resultArr.length > 0) {
|
|
|
+ const sheet = posSpread.getActiveSheet();
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ const curRow = sel ? sel.row : 0;
|
|
|
+ const pos = resultArr[0];
|
|
|
+ if (pos.index !== curRow) {
|
|
|
+ sheet.setSelection(pos.index, sel ? sel.col : 0, 1, 1);
|
|
|
+ sheet.showRow(pos.index, spreadNS.VerticalPosition.center);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
const locateNext = function () {
|
|
|
if (resultArr.length > 0) {
|
|
|
const sheet = posSpread.getActiveSheet();
|
|
@@ -767,7 +780,7 @@ $(document).ready(function() {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
- return {search, locateNext, locatePre};
|
|
|
+ return {search, searchAndLocate, locateNext, locatePre};
|
|
|
})();
|
|
|
// 台账模式加载部位明细数据
|
|
|
if (checkTzMeasureType()) {
|
|
@@ -786,8 +799,11 @@ $(document).ready(function() {
|
|
|
posOperationObj.loadCurPosData();
|
|
|
SpreadJsObj.resetTopAndSelect(posSpread.getActiveSheet());
|
|
|
});
|
|
|
- $('#pos-keyword').bind('input propertychange', function () {
|
|
|
- posSearch.search(this.value);
|
|
|
+ // $('#pos-keyword').bind('input propertychange', function () {
|
|
|
+ // posSearch.search(this.value);
|
|
|
+ // });
|
|
|
+ $('#pos-keyword').bind('keydown', function(e){
|
|
|
+ if (e.keyCode == 13) posSearch.searchAndLocate(this.value);
|
|
|
});
|
|
|
$('#search-pre-pos').click(function () {
|
|
|
posSearch.locatePre();
|