|
@@ -51,7 +51,7 @@ $(document).ready(function () {
|
|
cols.code = 0;
|
|
cols.code = 0;
|
|
this.sheet.getCell(0, cols.code).text('指标编号').hAlign(hCenter).vAlign(vCenter);
|
|
this.sheet.getCell(0, cols.code).text('指标编号').hAlign(hCenter).vAlign(vCenter);
|
|
this.sheet.addSpan(0, cols.code, 2, 1);
|
|
this.sheet.addSpan(0, cols.code, 2, 1);
|
|
- this.sheet.setColumnWidth(cols.code, 100);
|
|
|
|
|
|
+ this.sheet.setColumnWidth(cols.code, 80);
|
|
|
|
|
|
colsName.push('name');
|
|
colsName.push('name');
|
|
cols.name = 1;
|
|
cols.name = 1;
|
|
@@ -65,8 +65,8 @@ $(document).ready(function () {
|
|
cols.unit2 = 3;
|
|
cols.unit2 = 3;
|
|
this.sheet.getCell(0, cols.unit1).text('指标单位').hAlign(hCenter).vAlign(vCenter);
|
|
this.sheet.getCell(0, cols.unit1).text('指标单位').hAlign(hCenter).vAlign(vCenter);
|
|
this.sheet.addSpan(0, cols.unit1, 2, 2);
|
|
this.sheet.addSpan(0, cols.unit1, 2, 2);
|
|
- this.sheet.setColumnWidth(cols.unit1, 60);
|
|
|
|
- this.sheet.setColumnWidth(cols.unit2, 60);
|
|
|
|
|
|
+ this.sheet.setColumnWidth(cols.unit1, 65);
|
|
|
|
+ this.sheet.setColumnWidth(cols.unit2, 65);
|
|
|
|
|
|
if (this.tenders.length > 0) {
|
|
if (this.tenders.length > 0) {
|
|
this.sheet.getCell(0, cols.unit2+1).text('经济指标').hAlign(hCenter).vAlign(vCenter);
|
|
this.sheet.getCell(0, cols.unit2+1).text('经济指标').hAlign(hCenter).vAlign(vCenter);
|
|
@@ -102,12 +102,11 @@ $(document).ready(function () {
|
|
|
|
|
|
this.colsName = colsName;
|
|
this.colsName = colsName;
|
|
this.cols = cols;
|
|
this.cols = cols;
|
|
- //this.sheet.getRange(-1, -1, this.sheet.getRowCount(), this.sheet.getColumnCount()).setBorder(this.borderLine, {all: true});
|
|
|
|
|
|
+ this.sheet.getRange(0, 0, this.sheet.getRowCount(), this.sheet.getColumnCount()).setBorder(this.borderLine, {all: true});
|
|
|
|
|
|
SpreadJsObj.endMassOperationSheet(this.sheet);
|
|
SpreadJsObj.endMassOperationSheet(this.sheet);
|
|
}
|
|
}
|
|
sortData (data) {
|
|
sortData (data) {
|
|
- console.log(data);
|
|
|
|
function findTenderData (data, tenderId) {
|
|
function findTenderData (data, tenderId) {
|
|
for (const tender of data) {
|
|
for (const tender of data) {
|
|
if (tender.lib_id === tenderId) {
|
|
if (tender.lib_id === tenderId) {
|
|
@@ -166,28 +165,29 @@ $(document).ready(function () {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- console.log(result);
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
loadData (data) {
|
|
loadData (data) {
|
|
const self = this;
|
|
const self = this;
|
|
|
|
+ const colCount = compareObj.tenders.length > 0 ? 6+compareObj.tenders.length+1 : 6;
|
|
this.searchData = data;
|
|
this.searchData = data;
|
|
this.showData = this.sortData(this.searchData);
|
|
this.showData = this.sortData(this.searchData);
|
|
- console.log(new Date());
|
|
|
|
function loadNode (node, row) {
|
|
function loadNode (node, row) {
|
|
- self.sheet.getCell(row, self.cols.code).text(node.code);
|
|
|
|
- self.sheet.getCell(row, self.cols.name).text(node.name);
|
|
|
|
- self.sheet.getRange(row, -1, 1, -1).backColor('#dae5ee');
|
|
|
|
|
|
+ self.sheet.getCell(row, self.cols.code).text(node.code).wordWrap(true);
|
|
|
|
+ self.sheet.getCell(row, self.cols.name).text(node.name).wordWrap(true);
|
|
|
|
+ self.sheet.getRange(row, 0, 1, colCount).backColor('#dae5ee');
|
|
|
|
+ self.sheet.autoFitRow(row);
|
|
}
|
|
}
|
|
function loadIndex(index, row) {
|
|
function loadIndex(index, row) {
|
|
for (const colName of self.colsName) {
|
|
for (const colName of self.colsName) {
|
|
if (colName === 'averageIndex') {
|
|
if (colName === 'averageIndex') {
|
|
const aver = Number((index.sumValue / self.tenders.length).toFixed(2));
|
|
const aver = Number((index.sumValue / self.tenders.length).toFixed(2));
|
|
- self.sheet.getCell(row, self.cols[colName]).value(aver);
|
|
|
|
|
|
+ self.sheet.getCell(row, self.cols[colName]).value(aver).wordWrap(true);
|
|
} else if (index[colName]) {
|
|
} else if (index[colName]) {
|
|
- self.sheet.getCell(row, self.cols[colName]).value(index[colName]);
|
|
|
|
|
|
+ self.sheet.getCell(row, self.cols[colName]).value(index[colName]).wordWrap(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ self.sheet.autoFitRow(row);
|
|
}
|
|
}
|
|
let iRow = 2;
|
|
let iRow = 2;
|
|
SpreadJsObj.massOperationSheet(this.sheet, function () {
|
|
SpreadJsObj.massOperationSheet(this.sheet, function () {
|
|
@@ -202,9 +202,8 @@ $(document).ready(function () {
|
|
iRow += 1;
|
|
iRow += 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //self.sheet.getRange(-1, -1, self.sheet.getRowCount(), self.sheet.getColumnCount()).setBorder(self.borderLine, {all: true});
|
|
|
|
|
|
+ self.sheet.getRange(-1, -1, self.sheet.getRowCount(), self.sheet.getColumnCount()).setBorder(self.borderLine, {all: true});
|
|
});
|
|
});
|
|
- console.log(new Date());
|
|
|
|
}
|
|
}
|
|
searchIndex (keyword) {
|
|
searchIndex (keyword) {
|
|
const self = this;
|
|
const self = this;
|
|
@@ -212,9 +211,7 @@ $(document).ready(function () {
|
|
tenders: this.tenders,
|
|
tenders: this.tenders,
|
|
keyword: keyword,
|
|
keyword: keyword,
|
|
};
|
|
};
|
|
- console.log(new Date());
|
|
|
|
postData('/compare/search', data, function (datas) {
|
|
postData('/compare/search', data, function (datas) {
|
|
- console.log(new Date());
|
|
|
|
self.loadData(datas);
|
|
self.loadData(datas);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -237,6 +234,15 @@ $(document).ready(function () {
|
|
|
|
|
|
$('#search').click(function () {
|
|
$('#search').click(function () {
|
|
compareObj.searchIndex($('#keyword').val());
|
|
compareObj.searchIndex($('#keyword').val());
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $('#export-excel').click(function () {
|
|
|
|
+ const excelIo = new GC.Spread.Excel.IO();
|
|
|
|
+ const fileName = '指标对比.xlsx';
|
|
|
|
+ const sJson = JSON.stringify(compareObj.spread.toJSON());
|
|
|
|
+ excelIo.save(sJson, function(blob) {
|
|
|
|
+ saveAs(blob, fileName);
|
|
|
|
+ });
|
|
})
|
|
})
|
|
|
|
|
|
// $.contextMenu({
|
|
// $.contextMenu({
|
|
@@ -265,12 +271,18 @@ $(document).ready(function () {
|
|
// name: '导出excel',
|
|
// name: '导出excel',
|
|
// callback: function (key, opt) {
|
|
// callback: function (key, opt) {
|
|
// const excelIo = new GC.Spread.Excel.IO();
|
|
// const excelIo = new GC.Spread.Excel.IO();
|
|
- // const fileName = 'e:\\1.xlsx';
|
|
|
|
|
|
+ // const fileName = '1.xlsx';
|
|
// const sJson = JSON.stringify(compareObj.spread.toJSON());
|
|
// const sJson = JSON.stringify(compareObj.spread.toJSON());
|
|
// excelIo.save(sJson, function(blob) {
|
|
// excelIo.save(sJson, function(blob) {
|
|
// saveAs(blob, fileName);
|
|
// saveAs(blob, fileName);
|
|
// });
|
|
// });
|
|
// }
|
|
// }
|
|
|
|
+ // },
|
|
|
|
+ // 'exportPDF': {
|
|
|
|
+ // name: '导出PDF',
|
|
|
|
+ // callback: function (key, opt) {
|
|
|
|
+ // compareObj.spread.savePDF();
|
|
|
|
+ // }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// });
|
|
// });
|