|
@@ -1981,6 +1981,7 @@ $(document).ready(() => {
|
|
|
this.url = '/tender/' + window.location.pathname.split('/')[2] + '/deal';
|
|
|
this.spreadSetting = spreadSetting;
|
|
|
this.spread = SpreadJsObj.createNewSpread(this.obj);
|
|
|
+ this.sheet = this.spread.getActiveSheet();
|
|
|
SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
|
if (!readOnly) {
|
|
|
this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
|
|
@@ -2023,6 +2024,52 @@ $(document).ready(() => {
|
|
|
});
|
|
|
}
|
|
|
SpreadJsObj.forbiddenSpreadContextMenu(selector, this.spread);
|
|
|
+ this.initDealBillsSearch();
|
|
|
+ }
|
|
|
+ search(keyword) {
|
|
|
+ this.searchResult = [];
|
|
|
+ this.searchCur = 0;
|
|
|
+ if (keyword) {
|
|
|
+ for (const [i, d] of this.data.entries()) {
|
|
|
+ if (d.code.indexOf(keyword) >= 0 || d.name.indexOf(keyword) >= 0) this.searchResult.push(d);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#dbs-count').html(`结果:${this.searchResult.length}`);
|
|
|
+ if (this.searchResult.length > 0) SpreadJsObj.locateData(this.sheet, this.searchResult[0]);
|
|
|
+ }
|
|
|
+ searchPre() {
|
|
|
+ if (this.searchResult.length <= 1) return;
|
|
|
+ this.searchCur = this.searchCur - 1;
|
|
|
+ if (this.searchCur < 0) this.searchCur = this.searchResult.length - 1;
|
|
|
+ SpreadJsObj.locateData(this.sheet, this.searchResult[this.searchCur]);
|
|
|
+ }
|
|
|
+ searchNext() {
|
|
|
+ if (this.searchResult.length <= 1) return;
|
|
|
+ this.searchCur = this.searchCur + 1;
|
|
|
+ if (this.searchCur >= this.searchResult.length) this.searchCur = 0;
|
|
|
+ SpreadJsObj.locateData(this.sheet, this.searchResult[this.searchCur]);
|
|
|
+ }
|
|
|
+ searchClear() {
|
|
|
+ $('#dbs-keyword').val('');
|
|
|
+ this.searchResult = [];
|
|
|
+ this.searchCur = 0;
|
|
|
+ $('#dbs-count').html(`结果:${this.searchResult.length}`);
|
|
|
+ }
|
|
|
+ initDealBillsSearch() {
|
|
|
+ const self = this;
|
|
|
+ $('#dbs-keyword').change(function () { self.search(this.value); });
|
|
|
+ $('#dbs-pre').click(function (e) {
|
|
|
+ self.searchPre();
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $('#dbs-next').click(function (e) {
|
|
|
+ self.searchNext();
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $('#dbs-clear').click(function (e) {
|
|
|
+ self.searchClear();
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
}
|
|
|
loadData (callback) {
|
|
|
if (this.loaded) {
|