|
@@ -1143,19 +1143,26 @@ $(document).ready(function() {
|
|
|
dealBills.spread.refresh();
|
|
|
} else if (tab.attr('content') === '#search' && !searchLedger) {
|
|
|
if (!searchLedger) {
|
|
|
- searchLedger = new SearchLedger($('#search'), {
|
|
|
- cols: [
|
|
|
- {title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true},
|
|
|
- {title: '清单编号', field: 'b_code', hAlign: 0, width: 120, formatter: '@', readOnly: true},
|
|
|
- {title: '名称', field: 'name', width: 230, hAlign: 0, formatter: '@', readOnly: true},
|
|
|
- {title: '单位', field: 'unit', width: 50, hAlign: 1, formatter: '@', readOnly: true},
|
|
|
- {title: '单价', field: 'unit_price', hAlign: 2, width: 50, readOnly: true},
|
|
|
- {title: '数量', field: 'quantity', hAlign: 2, width: 50, readOnly: true},
|
|
|
- ],
|
|
|
- emptyRows: 0,
|
|
|
- headRows: 1,
|
|
|
- headRowHeight: [40],
|
|
|
- defaultRowHeight: 21,
|
|
|
+ searchLedger = $.billsSearch({
|
|
|
+ selector: '#search',
|
|
|
+ searchSpread: ledgerSpread,
|
|
|
+ resultSpreadSetting: {
|
|
|
+ cols: [
|
|
|
+ {title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true},
|
|
|
+ {title: '清单编号', field: 'b_code', hAlign: 0, width: 120, formatter: '@', readOnly: true},
|
|
|
+ {title: '名称', field: 'name', width: 230, hAlign: 0, formatter: '@', readOnly: true},
|
|
|
+ {title: '单位', field: 'unit', width: 50, hAlign: 1, formatter: '@', readOnly: true},
|
|
|
+ {title: '单价', field: 'unit_price', hAlign: 2, width: 50, readOnly: true},
|
|
|
+ {title: '数量', field: 'quantity', hAlign: 2, width: 50, readOnly: true},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [40],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ },
|
|
|
+ afterLocated: function () {
|
|
|
+ posOperationObj.loadCurPosData();
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
searchLedger.spread.refresh();
|
|
@@ -1495,48 +1502,6 @@ $(document).ready(function() {
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
- class SearchLedger {
|
|
|
- constructor(obj, spreadSetting) {
|
|
|
- const self = this;
|
|
|
- this.obj = obj;
|
|
|
- this.spreadSetting = spreadSetting;
|
|
|
- this.spread = SpreadJsObj.createNewSpread($('#search-result', this.obj)[0]);
|
|
|
- SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
|
- SpreadJsObj.forbiddenSpreadContextMenu('#search-result', this.spread);
|
|
|
- $('input', this.obj).bind('keydown', function (e) {
|
|
|
- if (e.keyCode == 13) {
|
|
|
- self.search();
|
|
|
- }
|
|
|
- });
|
|
|
- $('#searchLedger', this.obj).bind('click', () => {self.search()});
|
|
|
- this.spread.getActiveSheet().bind(GC.Spread.Sheets.Events.CellDoubleClick, function (e, info) {
|
|
|
- const sheet = info.sheet;
|
|
|
- const data = sheet.zh_data;
|
|
|
- if (!data) { return }
|
|
|
-
|
|
|
- const curBills = data[info.row];
|
|
|
- if (!curBills) { return }
|
|
|
-
|
|
|
- SpreadJsObj.locateTreeNode(ledgerSpread.getActiveSheet(), curBills.ledger_id, true);
|
|
|
- posOperationObj.loadCurPosData();
|
|
|
- });
|
|
|
- }
|
|
|
- search () {
|
|
|
- const keyword = $('input', this.obj).val();
|
|
|
- this.searchResult = [];
|
|
|
- const sortData = SpreadJsObj.getSortData(ledgerSpread.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) {
|
|
|
- const data = JSON.parse(JSON.stringify(node));
|
|
|
- data.visible = true;
|
|
|
- this.searchResult.push(data);
|
|
|
- }
|
|
|
- }
|
|
|
- SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'data', this.searchResult);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
$('#searchAccount').click(() => {
|
|
|
const data = {
|