cs_tools.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. 'use strict';
  2. /**
  3. * cs_errorList:错误列表
  4. * 使用范围:
  5. * 台账分解(原报)、台账修订(原报)、计量台账(所有角色)
  6. *
  7. * posSearch & billsSearch:台账搜索相关
  8. * 使用范围:
  9. * 0号台账:台账分解、台账审批、台账修订、部位台账;
  10. * 期计量:计量台账、部位台账
  11. *
  12. * 所有工具均基于spreadjs,请放在gc.spread.sheets.all.10.0.1.min.js/spreadjs_zh.js之后
  13. *
  14. * @author Mai
  15. * @date
  16. * @version
  17. */
  18. const showSideTools = function (show) {
  19. const left = $('#left-view'), right = $('#right-view'), parent = left.parent();
  20. if (show) {
  21. right.show();
  22. autoFlashHeight();
  23. /**
  24. * right.show()后, parent被撑开成2倍left.height, 导致parent.width减少了10px
  25. * 第一次left.width调整后,parent的缩回left.height, 此时parent.width又增加了10px
  26. * 故需要通过最终的parent.width再计算一次left.width
  27. *
  28. * Q: 为什么不通过先计算left.width的宽度,以避免计算两次left.width?
  29. * A: 右侧工具栏不一定显示,当右侧工具栏显示过一次后,就必须使用parent和right来计算left.width
  30. *
  31. */
  32. //left.css('width', parent.width() - right.outerWidth());
  33. //left.css('width', parent.width() - right.outerWidth());
  34. const percent = 100 - right.outerWidth() /parent.width() * 100;
  35. left.css('width', percent + '%');
  36. } else {
  37. left.width(parent.width());
  38. right.hide();
  39. }
  40. };
  41. (function($){
  42. /**
  43. * 错误列表
  44. * @param setting
  45. * {
  46. * tabSelector: 'a[content=#error-list]',
  47. * selector: '#error-list',
  48. * relaSpread: ledgerSpread,
  49. * storeKey: 'ledger-error-' + tenderId,
  50. * }
  51. * @returns {{spread: *}}
  52. */
  53. $.cs_errorList = function (setting) {
  54. if (!setting.spreadSetting) {
  55. setting.spreadSetting = {
  56. cols: [
  57. {title: '行号', field: 'serialNo', width: 50, formatter: '@'},
  58. {
  59. title: '错误类型', field: 'errorType', width: 60, formatter: '@',
  60. getValue: function (x) {
  61. switch (x.errorType) {
  62. case 'qty': return '数量';
  63. case 'tp': return '金额';
  64. default: return '';
  65. }
  66. }
  67. },
  68. {title: '清单编号', field: 'b_code', width: 135, formatter: '@'},
  69. {title: '清单名称', field: 'name', width: 215, formatter: '@'},
  70. ],
  71. emptyRows: 0,
  72. headRows: 1,
  73. headRowHeight: [32],
  74. defaultRowHeight: 21,
  75. headerFont: '12px 微软雅黑',
  76. font: '12px 微软雅黑',
  77. selectedBackColor: '#fffacd',
  78. readOnly: true,
  79. };
  80. }
  81. const clearErrorData = function () {
  82. if (setting.storeKey) removeLocalCache(setting.storeKey);
  83. };
  84. const autoShowHistory = function (show) {
  85. if (setting.storeKey) {
  86. setLocalCache(setting.storeKey + '-showHis', show.toString());
  87. }
  88. };
  89. if (setting.selector && setting.relaSpread) {
  90. const resultId = setting.id + '-spread';
  91. const obj = $(setting.selector);
  92. obj.html(
  93. ' <div id="' + resultId + '" class="sjs-sh">\n' +
  94. ' </div>'
  95. );
  96. autoFlashHeight();
  97. const spread = SpreadJsObj.createNewSpread($('#' + resultId)[0]);
  98. const sheet = spread.getActiveSheet();
  99. SpreadJsObj.initSheet(sheet, setting.spreadSetting);
  100. SpreadJsObj.forbiddenSpreadContextMenu('#' + resultId, spread);
  101. spread.getActiveSheet().bind(spreadNS.Events.CellDoubleClick, function (e, info) {
  102. const sheet = info.sheet;
  103. const data = sheet.zh_data;
  104. if (!data) { return }
  105. const curBills = data[info.row];
  106. if (!curBills) { return }
  107. SpreadJsObj.locateTreeNode(setting.relaSpread.getActiveSheet(), curBills.ledger_id, true);
  108. if (setting.afterLocated) {
  109. setting.afterLocated();
  110. }
  111. });
  112. const loadErrorData = function (data, his = false) {
  113. const sourceTree = setting.relaSpread.getActiveSheet().zh_tree;
  114. if (!sourceTree) return;
  115. for (const d of data) {
  116. d.serialNo = sourceTree.getNodeIndex(sourceTree.getItems(d.ledger_id)) + 1;
  117. }
  118. data.sort(function (a, b) {
  119. return a.serialNo - b.serialNo;
  120. });
  121. SpreadJsObj.loadSheetData(sheet, SpreadJsObj.DataType.Data, data);
  122. if (!his && setting.storeKey) {
  123. setLocalCache(setting.storeKey, JSON.stringify(data));
  124. }
  125. $(setting.tabSelector).show();
  126. };
  127. const showErrorList = function () {
  128. const tab = $(setting.tabSelector), tabPanel = $(tab.attr('content'));
  129. $('a', '#side-menu').removeClass('active');
  130. tab.addClass('active');
  131. $('.tab-content .tab-pane').removeClass('active');
  132. tabPanel.addClass('active');
  133. showSideTools(true);
  134. spread.refresh();
  135. if (setting.afterShow) setting.afterShow();
  136. };
  137. const loadHisErrorData = function () {
  138. if (setting.storeKey) {
  139. const storeStr = getLocalCache(setting.storeKey);
  140. const storeData = storeStr ? JSON.parse(storeStr) : [];
  141. if (storeData.length > 0) {
  142. loadErrorData(storeData, true);
  143. const showHis = getLocalCache(setting.storeKey + '-showHis');
  144. if (showHis === 'true') {
  145. showErrorList();
  146. removeLocalCache(setting.storeKey + '-showHis');
  147. }
  148. }
  149. }
  150. };
  151. return {
  152. spread: spread,
  153. loadErrorData: loadErrorData,
  154. clearErrorData: clearErrorData,
  155. loadHisErrorData: loadHisErrorData,
  156. show: showErrorList,
  157. autoShowHistory: autoShowHistory,
  158. };
  159. } else {
  160. const loadErrorData = function (data) {
  161. if (setting.storeKey) {
  162. setLocalCache(setting.storeKey, JSON.stringify(data));
  163. }
  164. };
  165. return {
  166. loadErrorData: loadErrorData,
  167. clearErrorData: clearErrorData,
  168. autoShowHistory: autoShowHistory,
  169. };
  170. }
  171. };
  172. $.ledger_checkList = function (setting) {
  173. const checkTypeText = [];
  174. for (const ct in setting.checkType) {
  175. checkTypeText[setting.checkType[ct].value] = setting.checkType[ct].text;
  176. }
  177. if (!setting.spreadSetting) {
  178. setting.spreadSetting = {
  179. cols: [
  180. {
  181. title: '类型', field: 'type', width: 150, formatter: '@',
  182. getValue: function (data){
  183. if (setting.checkType) {
  184. return checkTypeText[data.type] || '';
  185. } else {
  186. return '';
  187. }
  188. }
  189. },
  190. {title: '行号', field: 'serialNo', hAlign: 1, width: 40, formatter: '@'},
  191. {title: '项目节编号', field: 'code', width: 80, formatter: '@'},
  192. {title: '清单编号', field: 'b_code', width: 80, formatter: '@'},
  193. {title: '名称', field: 'name', width: 150, formatter: '@'},
  194. ],
  195. emptyRows: 0,
  196. headRows: 1,
  197. headRowHeight: [32],
  198. defaultRowHeight: 21,
  199. headerFont: '12px 微软雅黑',
  200. font: '12px 微软雅黑',
  201. selectedBackColor: '#fffacd',
  202. readOnly: true,
  203. };
  204. }
  205. const clearCheckData = function () {
  206. if (setting.storeKey) removeLocalCache(setting.storeKey);
  207. };
  208. const autoShowHistory = function (show) {
  209. if (setting.storeKey) {
  210. setLocalCache(setting.storeKey + '-showHis', show.toString());
  211. }
  212. };
  213. if (setting.selector && setting.relaSpread) {
  214. const resultId = setting.id + '-spread';
  215. const obj = $(setting.selector);
  216. const dropdown = [];
  217. if (setting.checkType) {
  218. dropdown.push('<div class="dropdown">');
  219. dropdown.push('<button class="btn btn-sm btn-outline-primary dropdown-toggle" type="button" id="'+ setting.id + 'drop" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">所有类型</button>');
  220. dropdown.push('<div class="dropdown-menu" aria-labelledby="'+ setting.id + 'drop">');
  221. dropdown.push('<a class="dropdown-item" href="javascript: void(0);" check-type="all">所有类型</a>');
  222. for (const ct in setting.checkType) {
  223. dropdown.push('<a class="dropdown-item" href="javascript: void(0);" check-type="' + setting.checkType[ct].value +'">' + setting.checkType[ct].text + '</a>');
  224. }
  225. dropdown.push('</div>');
  226. dropdown.push('</div>');
  227. }
  228. obj.html(
  229. '<div class="sjs-bar">\n' +
  230. ' <div class="pb-1 d-flex">\n' + dropdown.join('') +
  231. ' <span class="ml-auto pr-2" id="' + setting.id + '-time">检查时间:2020-08-01 13:20:25</span>\n' +
  232. ' </div>\n' +
  233. '</div>' +
  234. '<div id="' + resultId + '" class="sjs-sh">\n' +
  235. '</div>'
  236. );
  237. autoFlashHeight();
  238. const spread = SpreadJsObj.createNewSpread($('#' + resultId)[0]);
  239. const sheet = spread.getActiveSheet();
  240. SpreadJsObj.initSheet(sheet, setting.spreadSetting);
  241. SpreadJsObj.forbiddenSpreadContextMenu('#' + resultId, spread);
  242. spread.getActiveSheet().bind(spreadNS.Events.CellDoubleClick, function (e, info) {
  243. const sheet = info.sheet;
  244. const data = sheet.zh_data;
  245. if (!data) { return }
  246. const curBills = data[info.row];
  247. if (!curBills) { return }
  248. SpreadJsObj.locateTreeNode(setting.relaSpread.getActiveSheet(), curBills.ledger_id, true);
  249. if (setting.afterLocated) {
  250. setting.afterLocated();
  251. }
  252. });
  253. const filterCheckData = function () {
  254. const filter = $(this).attr('check-type');
  255. $('#' + setting.id + 'drop').html(this.innerHTML);
  256. for (const d of sheet.zh_data) {
  257. if (filter === 'all') {
  258. d.visible = true;
  259. } else {
  260. d.visible = d.type == filter;
  261. }
  262. }
  263. SpreadJsObj.refreshTreeRowVisible(sheet);
  264. };
  265. $('a[check-type]').bind('click', filterCheckData);
  266. const hideCheckData = function () {
  267. const tab = $(setting.tabSelector), tabPanel = $(tab.attr('content'));
  268. if (tab.hasClass('active')) {
  269. $('a', '#side-menu').removeClass('active');
  270. tab.addClass('active');
  271. $('.tab-content .tab-pane').removeClass('active');
  272. tabPanel.addClass('active');
  273. showSideTools(false);
  274. if (spread) spread.refresh();
  275. if (setting.afterShow) setting.afterShow();
  276. tab.hide();
  277. }
  278. };
  279. const loadCheckData = function (data, his = false) {
  280. const sourceTree = setting.relaSpread.getActiveSheet().zh_tree;
  281. if (!sourceTree) return;
  282. for (const d of data.warning_data) {
  283. d.serialNo = sourceTree.getNodeIndex(sourceTree.getItems(d.ledger_id)) + 1;
  284. }
  285. $('#' + setting.id + '-time').html('检查时间:' + moment(data.check_time).format('YYYY-MM-DD hh:mm:ss'));
  286. SpreadJsObj.loadSheetData(sheet, SpreadJsObj.DataType.Data, data.warning_data);
  287. if (!his && setting.storeKey) {
  288. setLocalCache(setting.storeKey, JSON.stringify(data));
  289. }
  290. $(setting.tabSelector).show();
  291. };
  292. const showCheckList = function () {
  293. const tab = $(setting.tabSelector), tabPanel = $(tab.attr('content'));
  294. $('a', '#side-menu').removeClass('active');
  295. tab.addClass('active');
  296. $('.tab-content .tab-pane').removeClass('active');
  297. tabPanel.addClass('active');
  298. showSideTools(true);
  299. spread.refresh();
  300. if (setting.afterShow) setting.afterShow();
  301. };
  302. const loadHisCheckData = function () {
  303. if (setting.storeKey) {
  304. const storeStr = getLocalCache(setting.storeKey);
  305. const storeData = storeStr ? JSON.parse(storeStr) : null;
  306. if (storeData) {
  307. loadCheckData(storeData, true);
  308. const showHis = getLocalCache(setting.storeKey + '-showHis');
  309. if (showHis === 'true') {
  310. showCheckList();
  311. removeLocalCache(setting.storeKey + '-showHis');
  312. }
  313. }
  314. }
  315. };
  316. return {
  317. spread: spread,
  318. loadCheckData: loadCheckData,
  319. clearCheckData: clearCheckData,
  320. loadHisCheckData: loadHisCheckData,
  321. show: showCheckList,
  322. hide: hideCheckData,
  323. autoShowHistory: autoShowHistory,
  324. };
  325. } else {
  326. const loadCheckData = function (data) {
  327. if (setting.storeKey) {
  328. setLocalCache(setting.storeKey, JSON.stringify(data));
  329. }
  330. };
  331. return {
  332. loadCheckData: loadCheckData,
  333. clearCheckData: clearCheckData,
  334. autoShowHistory: autoShowHistory,
  335. };
  336. }
  337. };
  338. $.posSearch = function (setting) {
  339. if (!setting.selector || !setting.searchSpread) return;
  340. const searchHtml =
  341. ' <div class="ml-2">\n' +
  342. ' <div class="input-group input-group-sm">\n' +
  343. ' <input type="text" class="form-control" placeholder="输入名称查找" id="pos-keyword">\n' +
  344. ' <div class="input-group-append">\n' +
  345. ' <span class="input-group-text" id="pos-search-hint">结果:0</span>\n' +
  346. ' </div>\n' +
  347. ' <div class="input-group-append" >\n' +
  348. ' <button class="btn btn-outline-secondary" type="button" title="上一个" id="search-pre-pos"><i class="fa fa-angle-double-left"></i></button>\n' +
  349. ' <button class="btn btn-outline-secondary" type="button" title="下一个" id="search-next-pos"><i class="fa fa-angle-double-right"></i></button>\n' +
  350. ' </div>\n' +
  351. ' </div>\n' +
  352. ' </div>\n';
  353. $(setting.selector).html(searchHtml);
  354. const sheet = setting.searchSpread.getActiveSheet();
  355. const searchObj = (function () {
  356. let resultArr = [];
  357. const search = function (keyword) {
  358. if (keyword && keyword !== '') {
  359. resultArr = [];
  360. const sortData = sheet.zh_data;
  361. if (sortData) {
  362. for (let i = 0, iLength = sortData.length; i < iLength; i++) {
  363. const sd = sortData[i];
  364. if (sd.name && sd.name.indexOf(keyword) > -1) {
  365. resultArr.push({index: i, data: sd});
  366. }
  367. }
  368. }
  369. } else {
  370. resultArr = [];
  371. }
  372. $('#pos-search-hint').html('结果:' + resultArr.length);
  373. };
  374. const searchAndLocate = function (keyword) {
  375. search(keyword);
  376. if (resultArr.length > 0) {
  377. const sel = sheet.getSelections()[0];
  378. const curRow = sel ? sel.row : 0;
  379. const pos = resultArr[0];
  380. if (pos.index !== curRow) {
  381. sheet.setSelection(pos.index, sel ? sel.col : 0, 1, 1);
  382. sheet.getParent().focus();
  383. sheet.showRow(pos.index, spreadNS.VerticalPosition.center);
  384. SpreadJsObj.reloadRowsBackColor(sheet, [pos.index, curRow]);
  385. }
  386. }
  387. };
  388. const locateNext = function () {
  389. if (resultArr.length > 0) {
  390. const sel = sheet.getSelections()[0];
  391. const curRow = sel ? sel.row : 0;
  392. let next = _.find(resultArr, function (d) {
  393. return d.index > curRow;
  394. });
  395. if (!next) next = resultArr[0];
  396. if (next.index !== curRow) {
  397. sheet.setSelection(next.index, sel ? sel.col : 0, 1, 1);
  398. sheet.getParent().focus();
  399. sheet.showRow(next.index, spreadNS.VerticalPosition.center);
  400. SpreadJsObj.reloadRowsBackColor(sheet, [next.index, curRow]);
  401. }
  402. }
  403. };
  404. const locatePre = function () {
  405. if (resultArr.length > 0) {
  406. const sel = sheet.getSelections()[0];
  407. const curRow = sel ? sel.row : 0;
  408. let next = _.findLast(resultArr, function (d) {
  409. return d.index < curRow;
  410. });
  411. if (!next) next = resultArr[resultArr.length - 1];
  412. if (next.index !== curRow) {
  413. sheet.setSelection(next.index, sel ? sel.col : 0, 1, 1);
  414. sheet.getParent().focus();
  415. sheet.showRow(next.index, spreadNS.VerticalPosition.center);
  416. SpreadJsObj.reloadRowsBackColor(sheet, [next.index, curRow]);
  417. }
  418. }
  419. };
  420. return {search, searchAndLocate, locateNext, locatePre};
  421. })();
  422. // $('#pos-keyword').bind('input propertychange', function () {
  423. // posSearch.search(this.value);
  424. // });
  425. $('#pos-keyword').bind('keydown', function(e){
  426. if (e.keyCode == 13) searchObj.searchAndLocate(this.value);
  427. });
  428. $('#search-pre-pos').click(function () {
  429. searchObj.locatePre();
  430. });
  431. $('#search-next-pos').click(function () {
  432. searchObj.locateNext();
  433. });
  434. return searchObj;
  435. };
  436. $.billsSearch = function (setting) {
  437. if (!setting.selector || !setting.searchSpread || !setting.resultSpreadSetting) return;
  438. if (!setting.searchRangeStr) setting.searchRangeStr = '项目节编号/清单编号/名称';
  439. const resultId = setting.id + '-search-result';
  440. const obj = $(setting.selector);
  441. let filter = [];
  442. if (setting.searchOver || setting.searchEmpty) {
  443. filter.push('<select class="form-control form-control-sm" id="search-filter">');
  444. filter.push('<option value="">台账</option>');
  445. if (setting.customSearch) {
  446. for (const cs of setting.customSearch) {
  447. if (cs.valid) filter.push('<option value="' + cs.key + '">' + cs.title + '</option>');
  448. }
  449. }
  450. filter.push('</select>');
  451. // filter.push('<div class="input-group-prepend">');
  452. // filter.push('<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">台账</button>');
  453. // filter.push('<div class="dropdown-menu">');
  454. // filter.push('<a class="dropdown-item" href="javascripty: void(0)" id="search-bills">台账</a>');
  455. // filter.push('<a class="dropdown-item" href="javascripty: void(0)" id="search-over">超计</a>');
  456. // filter.push('<a class="dropdown-item" href="javascripty: void(0)" id="search-less">漏计</a>');
  457. // filter.push('</div>');
  458. // filter.push('</div>');
  459. }
  460. obj.html(
  461. ' <div class="sjs-bar">\n' +
  462. ' <div class="input-group input-group-sm pb-1">\n' +
  463. ' <div class="input-group-prepend">\n' +
  464. filter.join('') +
  465. ' </div>' +
  466. ' <input id="searchKeyword" type="text" class="form-control" placeholder="可查找 ' + setting.searchRangeStr + '" aria-label="Recipient\'s username" aria-describedby="button-addon2">\n' +
  467. ' <div class="input-group-append">\n' +
  468. ' <button class="btn btn-outline-secondary" type="button"">搜索</button>\n' +
  469. ' </div>\n' +
  470. ' </div>\n' +
  471. ' </div>\n' +
  472. ' <div id="' + resultId + '" class="sjs-sh">\n' +
  473. ' </div>'
  474. );
  475. autoFlashHeight();
  476. const resultSpread = SpreadJsObj.createNewSpread($('#' + resultId)[0]);
  477. SpreadJsObj.initSheet(resultSpread.getActiveSheet(), setting.resultSpreadSetting);
  478. SpreadJsObj.forbiddenSpreadContextMenu('#' + resultId, resultSpread);
  479. const searchSheet = setting.searchSpread.getActiveSheet();
  480. let searchResult = [];
  481. const search = function () {
  482. const filter = $('#search-filter').val();
  483. if (filter) {
  484. searchCustom(filter);
  485. } else {
  486. searchBills();
  487. }
  488. };
  489. const searchBills = function () {
  490. const keyword = $('#searchKeyword', obj).val();
  491. searchResult = [];
  492. const sortData = SpreadJsObj.getSortData(searchSheet);
  493. for (const node of sortData) {
  494. if ((node.code && node.code.indexOf(keyword) > -1) ||
  495. node.b_code && node.b_code.indexOf(keyword) > -1 ||
  496. node.name && node.name.indexOf(keyword) > -1) {
  497. const data = JSON.parse(JSON.stringify(node));
  498. data.visible = true;
  499. searchResult.push(data);
  500. }
  501. }
  502. SpreadJsObj.loadSheetData(resultSpread.getActiveSheet(), 'data', searchResult);
  503. };
  504. const getCheckFun = function (key) {
  505. const cs = setting.customSearch.find(function (x) {return x.key === key});
  506. return cs ? cs.check : null;
  507. };
  508. const searchCustom = function (key) {
  509. const keyword = $('#searchKeyword', obj).val();
  510. const checkFun = getCheckFun(key);
  511. searchResult = [];
  512. const sortData = SpreadJsObj.getSortData(searchSheet);
  513. for (const node of sortData) {
  514. if (node.children && node.children.length > 0) continue;
  515. if (checkFun && checkFun(node)) {
  516. if (!keyword ||
  517. (node.code && node.code.indexOf(keyword) > -1) ||
  518. (node.b_code && node.b_code.indexOf(keyword) > -1) ||
  519. (node.name && node.name.indexOf(keyword) > -1)) {
  520. const data = JSON.parse(JSON.stringify(node));
  521. data.visible = true;
  522. searchResult.push(data);
  523. }
  524. }
  525. }
  526. calculateCompletePercent(searchResult);
  527. SpreadJsObj.loadSheetData(resultSpread.getActiveSheet(), 'data', searchResult);
  528. };
  529. const calculateCompletePercent = function (searchResult) {
  530. if (!searchResult) return;
  531. for (const sr of searchResult) {
  532. const base = ZhCalc.add(sr.total_price, sr.end_qc_tp);
  533. sr.complete_percent = base !== 0 ? ZhCalc.mul(ZhCalc.div(sr.end_gather_tp, base), 100, 2) : 0;
  534. }
  535. };
  536. $('input', obj).bind('keydown', function (e) {
  537. if (e.keyCode == 13) search();
  538. });
  539. $('button', obj).bind('click', () => {search()});
  540. resultSpread.getActiveSheet().bind(spreadNS.Events.CellDoubleClick, function (e, info) {
  541. const sheet = info.sheet;
  542. const data = sheet.zh_data;
  543. if (!data) { return }
  544. const curBills = data[info.row];
  545. if (!curBills) { return }
  546. SpreadJsObj.locateTreeNode(searchSheet, curBills.ledger_id, true);
  547. if (setting.afterLocated) {
  548. setting.afterLocated();
  549. }
  550. });
  551. return {spread: resultSpread};
  552. };
  553. })(jQuery);