|
@@ -1157,58 +1157,12 @@ $(document).ready(() => {
|
|
|
};
|
|
|
this.spread = SpreadJsObj.createNewSpread($('#search-result', this.obj)[0]);
|
|
|
SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
|
-
|
|
|
- $('#searchLedger', this.obj).bind('click', function () {
|
|
|
- const keyword = $('#keyword', self.obj).val();
|
|
|
- if (keyword !== '') {
|
|
|
- $('#over', obj)[0].checked = false;
|
|
|
- $('#empty', obj)[0].checked = false;
|
|
|
- this.searchResult = [];
|
|
|
- const sortData = SpreadJsObj.getSortData(self.mainSpread.getActiveSheet());
|
|
|
- for (const node of sortData) {
|
|
|
- if ((node.code && node.code.indexOf(keyword) > -1) ||
|
|
|
- node.b_code && node.b_code.indexOf(keyword) > -1 ||
|
|
|
- node.name && node.name.indexOf(keyword) > -1) {
|
|
|
- this.searchResult.push(node);
|
|
|
- }
|
|
|
- }
|
|
|
- SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', this.searchResult);
|
|
|
- }
|
|
|
- });
|
|
|
- $('#over', this.obj).bind('change', function () {
|
|
|
- this.searchResult = [];
|
|
|
- const sortData = SpreadJsObj.getSortData(self.mainSpread.getActiveSheet());
|
|
|
- for (const node of sortData) {
|
|
|
- if (node.children && node.children.length > 0) continue;
|
|
|
- if (node.end_gather_qty) {
|
|
|
- if (!node.quantity || Math.abs(node.end_gather_qty) > Math.abs(node.quantity)) {
|
|
|
- this.searchResult.push(node);
|
|
|
- }
|
|
|
- } else if (node.end_gather_tp) {
|
|
|
- if (!node.total_price || Math.abs(node.end_gather_tp) > Math.abs(node.total_price)) {
|
|
|
- this.searchResult.push(node);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', this.searchResult);
|
|
|
- });
|
|
|
- $('#empty', this.obj).bind('change', function () {
|
|
|
- this.searchResult = [];
|
|
|
- const sortData = SpreadJsObj.getSortData(self.mainSpread.getActiveSheet());
|
|
|
- for (const node of sortData) {
|
|
|
- if (node.children && node.children.length > 0) continue;
|
|
|
- if (node.quantity) {
|
|
|
- if (!node.end_gather_qty || checkZero(node.end_gather_qty)) {
|
|
|
- this.searchResult.push(node);
|
|
|
- }
|
|
|
- } else if (node.total_price) {
|
|
|
- if (!node.end_gather_tp || checkZero(node.end_gather_tp)) {
|
|
|
- this.searchResult.push(node);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', this.searchResult);
|
|
|
+ $('#keyword', this.obj).bind('keydown', function(e) {
|
|
|
+ if (e.keyCode == 13) self.searchText();
|
|
|
});
|
|
|
+ $('#searchLedger', this.obj).bind('click', () => {self.searchText()});
|
|
|
+ $('#over', this.obj).bind('change', () => {self.searchOver()});
|
|
|
+ $('#empty', this.obj).bind('change', () => {self.searchEmpty()});
|
|
|
this.spread.getActiveSheet().bind(GC.Spread.Sheets.Events.CellDoubleClick, function (e, info) {
|
|
|
const sheet = info.sheet;
|
|
|
const data = sheet.zh_data;
|
|
@@ -1220,6 +1174,57 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.locateTreeNode(self.mainSpread.getActiveSheet(), curBills.ledger_id);
|
|
|
});
|
|
|
}
|
|
|
+ searchText() {
|
|
|
+ const keyword = $('#keyword', this.obj).val();
|
|
|
+ if (keyword !== '') {
|
|
|
+ $('#over', this.obj)[0].checked = false;
|
|
|
+ $('#empty', this.obj)[0].checked = false;
|
|
|
+ this.searchResult = [];
|
|
|
+ const sortData = SpreadJsObj.getSortData(this.mainSpread.getActiveSheet());
|
|
|
+ for (const node of sortData) {
|
|
|
+ if ((node.code && node.code.indexOf(keyword) > -1) ||
|
|
|
+ node.b_code && node.b_code.indexOf(keyword) > -1 ||
|
|
|
+ node.name && node.name.indexOf(keyword) > -1) {
|
|
|
+ this.searchResult.push(node);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'data', this.searchResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ searchOver() {
|
|
|
+ this.searchResult = [];
|
|
|
+ const sortData = SpreadJsObj.getSortData(this.mainSpread.getActiveSheet());
|
|
|
+ for (const node of sortData) {
|
|
|
+ if (node.children && node.children.length > 0) continue;
|
|
|
+ if (node.end_gather_qty) {
|
|
|
+ if (!node.quantity || Math.abs(node.end_gather_qty) > Math.abs(node.quantity)) {
|
|
|
+ this.searchResult.push(node);
|
|
|
+ }
|
|
|
+ } else if (node.end_gather_tp) {
|
|
|
+ if (!node.total_price || Math.abs(node.end_gather_tp) > Math.abs(node.total_price)) {
|
|
|
+ this.searchResult.push(node);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'data', this.searchResult);
|
|
|
+ }
|
|
|
+ searchEmpty() {
|
|
|
+ this.searchResult = [];
|
|
|
+ const sortData = SpreadJsObj.getSortData(this.mainSpread.getActiveSheet());
|
|
|
+ for (const node of sortData) {
|
|
|
+ if (node.children && node.children.length > 0) continue;
|
|
|
+ if (node.quantity) {
|
|
|
+ if (!node.end_gather_qty || checkZero(node.end_gather_qty)) {
|
|
|
+ this.searchResult.push(node);
|
|
|
+ }
|
|
|
+ } else if (node.total_price) {
|
|
|
+ if (!node.end_gather_tp || checkZero(node.end_gather_tp)) {
|
|
|
+ this.searchResult.push(node);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'data', this.searchResult);
|
|
|
+ }
|
|
|
}
|
|
|
let searchLedger;
|
|
|
$.divResizer({
|