|
@@ -557,7 +557,7 @@ $(document).ready(function() {
|
|
|
|
|
|
treeOperationObj.refreshOperationValid(ledgerSpread.getActiveSheet(), ledgerSpread.getActiveSheet().getSelections());
|
|
|
|
|
|
- let stdChapter, stdBills, dealBills;
|
|
|
+ let stdChapter, stdBills, dealBills, searchLedger;
|
|
|
// 展开收起标准清单
|
|
|
$('a', '#side-menu').bind('click', function () {
|
|
|
const tab = $(this), tabPanel = $(tab.attr('content'));
|
|
@@ -633,6 +633,21 @@ $(document).ready(function() {
|
|
|
defaultRowHeight: 21,
|
|
|
});
|
|
|
dealBills.loadData();
|
|
|
+ } else if (tab.attr('content') === '#search' && !searchLedger) {
|
|
|
+ searchLedger = new SearchLedger($('#search'), {
|
|
|
+ cols: [
|
|
|
+ {title: '项目节编号', field: 'code', width: 120, formatter: '@', readOnly: true},
|
|
|
+ {title: '清单编号', field: 'b_code', width: 120, formatter: '@', readOnly: true},
|
|
|
+ {title: '名称', field: 'name', width: 230, formatter: '@', readOnly: true},
|
|
|
+ {title: '单位', field: 'unit', width: 50, formatter: '@', readOnly: true},
|
|
|
+ {title: '单价', field: 'unit_price', width: 50, readOnly: true},
|
|
|
+ {title: '数量', field: 'quantity', width: 50, readOnly: true},
|
|
|
+ ],
|
|
|
+ emptyRows: 3,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [40],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ })
|
|
|
}
|
|
|
} else {
|
|
|
tab.removeClass('active');
|
|
@@ -715,29 +730,33 @@ $(document).ready(function() {
|
|
|
const self = this;
|
|
|
this.obj = obj;
|
|
|
this.batchType = batchType;
|
|
|
+ this.billsCount = 6;
|
|
|
|
|
|
this.xmSpreadSetting = {
|
|
|
cols: [
|
|
|
- {title: '部位', field: 'bw', width: 80, formatter: '@', readOnly: true},
|
|
|
- {title: '图册号', field: 'drawingCode', formatter: '@', width: 60, readOnly: true},
|
|
|
- {title: '数量1', field: 'bills1', width: 50, readOnly: true},
|
|
|
- {title: '数量2', field: 'bills2', width: 50, readOnly: true},
|
|
|
+ {title: '部位', field: 'bw', width: 80, formatter: '@'},
|
|
|
+ {title: '图册号', field: 'drawingCode', formatter: '@', width: 60},
|
|
|
],
|
|
|
- emptyRows: 6,
|
|
|
+ emptyRows: 1000,
|
|
|
headRows: 1,
|
|
|
headRowHeight: [40],
|
|
|
};
|
|
|
+ for (let iNum = 1; iNum <= this.billsCount; iNum++) {
|
|
|
+ this.xmSpreadSetting.cols.push(
|
|
|
+ {title: '清单' + iNum, field: 'bills' + iNum, width: 50}
|
|
|
+ )
|
|
|
+ }
|
|
|
this.xmSpread = SpreadJsObj.createNewSpread($('.batch-l-t')[0]);
|
|
|
|
|
|
this.gclSpreadSetting = {
|
|
|
cols: [
|
|
|
- {title: '编号', field: 'code', width: 80, formatter: '@', readOnly: true},
|
|
|
- {title: '名称', field: 'name', width: 120, formatter: '@', readOnly: true},
|
|
|
- {title: '单位', field: 'unit', width: 50, formatter: '@', readOnly: true},
|
|
|
- {title: '单价', field: 'unit_price', width: 50, readOnly: true},
|
|
|
- {title: '图册号', field: 'name', width: 60, formatter: '@', readOnly: true},
|
|
|
+ {title: '编号', field: 'code', width: 80, formatter: '@'},
|
|
|
+ {title: '名称', field: 'name', width: 120, formatter: '@'},
|
|
|
+ {title: '单位', field: 'unit', width: 50, formatter: '@'},
|
|
|
+ {title: '单价', field: 'unit_price', width: 50},
|
|
|
+ {title: '图册号', field: 'name', width: 60, formatter: '@'},
|
|
|
],
|
|
|
- emptyRows: 2,
|
|
|
+ emptyRows: this.billsCount,
|
|
|
headRows: 1,
|
|
|
headRowHeight: [40],
|
|
|
};
|
|
@@ -797,16 +816,29 @@ $(document).ready(function() {
|
|
|
});
|
|
|
}
|
|
|
initView() {
|
|
|
+ let time = new Date();
|
|
|
const xmSheet = this.xmSpread.getActiveSheet();
|
|
|
SpreadJsObj.initSheet(xmSheet, this.xmSpreadSetting);
|
|
|
+ console.log(new Date() - time);
|
|
|
+ time = new Date();
|
|
|
+
|
|
|
+ SpreadJsObj.beginMassOperation(xmSheet);
|
|
|
xmSheet.clear(0, 0, xmSheet.getRowCount(), xmSheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
|
|
|
+ SpreadJsObj.endMassOperation(xmSheet);
|
|
|
+ console.log(new Date() - time);
|
|
|
+ time = new Date();
|
|
|
|
|
|
const gclSheet = this.gclSpread.getActiveSheet();
|
|
|
SpreadJsObj.initSheet(gclSheet, this.gclSpreadSetting);
|
|
|
+ SpreadJsObj.beginMassOperation(gclSheet);
|
|
|
gclSheet.setColumnWidth(0, 45, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
- gclSheet.getCell(0, 0, GC.Spread.Sheets.SheetArea.rowHeader).text('清单1');
|
|
|
- gclSheet.getCell(1, 0, GC.Spread.Sheets.SheetArea.rowHeader).text('清单2');
|
|
|
+ for (let iRow = 1; iRow <= this.billsCount; iRow ++) {
|
|
|
+ gclSheet.getCell(iRow - 1, 0, GC.Spread.Sheets.SheetArea.rowHeader).text('清单' + iRow);
|
|
|
+ }
|
|
|
gclSheet.clear(0, 0, gclSheet.getRowCount(), gclSheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
|
|
|
+ SpreadJsObj.endMassOperation(gclSheet);
|
|
|
+ console.log(new Date() - time);
|
|
|
+ time = new Date();
|
|
|
}
|
|
|
getBatchData () {
|
|
|
const result = [];
|
|
@@ -844,6 +876,39 @@ $(document).ready(function() {
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
+ class SearchLedger {
|
|
|
+ constructor(obj, spreadSetting) {
|
|
|
+ const self = this;
|
|
|
+ this.obj = obj;
|
|
|
+ this.url = '/ledger/search';
|
|
|
+ this.spreadSetting = spreadSetting;
|
|
|
+ this.spread = SpreadJsObj.createNewSpread($('div', this.obj)[0]);
|
|
|
+ SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
|
+
|
|
|
+ $('a', this.obj).bind('click', function () {
|
|
|
+ const data = { keyword: $('input', self.obj).val() };
|
|
|
+ postData('/ledger/search', data, function (result) {
|
|
|
+ SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', result);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ 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 }
|
|
|
+
|
|
|
+ const mainSheet = ledgerSpread.getActiveSheet();
|
|
|
+ const mainTree = mainSheet.zh_tree;
|
|
|
+ mainTree.postData('locate', null, {id: curBills.ledger_id}, function (result) {
|
|
|
+ treeOperationObj.refreshTree(mainSheet, result);
|
|
|
+ treeOperationObj.refreshOperationValid(mainSheet, mainSheet.getSelections());
|
|
|
+ SpreadJsObj.locateTreeNode(mainSheet, curBills.ledger_id);
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
$('#searchAccount').click(() => {
|
|
|
const data = {
|