|
@@ -736,71 +736,7 @@ $(document).ready(function() {
|
|
|
|
|
|
treeOperationObj.refreshOperationValid(ledgerSpread.getActiveSheet());
|
|
treeOperationObj.refreshOperationValid(ledgerSpread.getActiveSheet());
|
|
|
|
|
|
- const posSearch = (function () {
|
|
|
|
- let resultArr = [];
|
|
|
|
- const search = function (keyword) {
|
|
|
|
- if (keyword && keyword !== '') {
|
|
|
|
- resultArr = [];
|
|
|
|
- const sortData = posSpread.getActiveSheet().zh_data;
|
|
|
|
- if (sortData) {
|
|
|
|
- for (let i = 0, iLength = sortData.length; i < iLength; i++) {
|
|
|
|
- const sd = sortData[i];
|
|
|
|
- if (sd.name && sd.name.indexOf(keyword) > -1) {
|
|
|
|
- resultArr.push({index: i, data: sd});
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- $('#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();
|
|
|
|
- const sel = sheet.getSelections()[0];
|
|
|
|
- const curRow = sel ? sel.row : 0;
|
|
|
|
- let next = _.find(resultArr, function (d) {
|
|
|
|
- return d.index > curRow;
|
|
|
|
- });
|
|
|
|
- if (!next) next = resultArr[0];
|
|
|
|
- if (next.index !== curRow) {
|
|
|
|
- sheet.setSelection(next.index, sel ? sel.col : 0, 1, 1);
|
|
|
|
- sheet.showRow(next.index, spreadNS.VerticalPosition.center);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- const locatePre = function () {
|
|
|
|
- if (resultArr.length > 0) {
|
|
|
|
- const sheet = posSpread.getActiveSheet();
|
|
|
|
- const sel = sheet.getSelections()[0];
|
|
|
|
- const curRow = sel ? sel.row : 0;
|
|
|
|
- let next = _.findLast(resultArr, function (d) {
|
|
|
|
- return d.index < curRow;
|
|
|
|
- });
|
|
|
|
- if (!next) next = resultArr[resultArr.length - 1];
|
|
|
|
- if (next.index !== curRow) {
|
|
|
|
- sheet.setSelection(next.index, sel ? sel.col : 0, 1, 1);
|
|
|
|
- sheet.showRow(next.index, spreadNS.VerticalPosition.center);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- return {search, searchAndLocate, locateNext, locatePre};
|
|
|
|
- })();
|
|
|
|
|
|
+ const posSearch = $.posSearch({selector: '#pos-search', searchSpread: posSpread});
|
|
// 台账模式加载部位明细数据
|
|
// 台账模式加载部位明细数据
|
|
if (checkTzMeasureType()) {
|
|
if (checkTzMeasureType()) {
|
|
$.divResizer({
|
|
$.divResizer({
|
|
@@ -818,18 +754,6 @@ $(document).ready(function() {
|
|
posOperationObj.loadCurPosData();
|
|
posOperationObj.loadCurPosData();
|
|
SpreadJsObj.resetTopAndSelect(posSpread.getActiveSheet());
|
|
SpreadJsObj.resetTopAndSelect(posSpread.getActiveSheet());
|
|
});
|
|
});
|
|
- // $('#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();
|
|
|
|
- });
|
|
|
|
- $('#search-next-pos').click(function () {
|
|
|
|
- posSearch.locateNext();
|
|
|
|
- });
|
|
|
|
}
|
|
}
|
|
// 绑定部位明细编辑事件
|
|
// 绑定部位明细编辑事件
|
|
const posOperationObj = {
|
|
const posOperationObj = {
|