|
@@ -54,6 +54,39 @@ module.exports = {
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
- remove: function(req, res){
|
|
|
+ getDummyExcel: function(req, res) {
|
|
|
+ var nodeExcel = require('excel-export'); //关联excel-export模块
|
|
|
+ console.log("req.params.id:" + req.params.id);
|
|
|
+ console.log("req.params.pm:" + req.params.pm);
|
|
|
+ var conf = {};
|
|
|
+ conf.cols = [
|
|
|
+ {caption:'采购编号', type:'string'},
|
|
|
+ {caption:'合同名称', type:'string'},
|
|
|
+ {caption:'甲方', type:'string'},
|
|
|
+ {caption:'甲方部门', type:'string'},
|
|
|
+ {caption:'乙方', type:'string'},
|
|
|
+ {caption:'乙方部门', type:'string'},
|
|
|
+ {caption:'签订日期', type:'date'},
|
|
|
+ {caption:'中标日期', type:'date'},
|
|
|
+ {caption:'结束日期', type:'date'},
|
|
|
+ {caption:'销售负责人', type:'string'},
|
|
|
+ {caption:'商务负责人', type:'string'},
|
|
|
+ {caption:'业绩归属部门', type:'string'},
|
|
|
+ {caption:'金额', type:'number'},
|
|
|
+ {caption:'状态', type:'string'}
|
|
|
+ ];
|
|
|
+ var data = [{myId: 0, name: "dummyExcel", partyA: "", partyADept: "", partyB:"", partyBDept: "", signDate: "", beginDate:"", endDate:"", amount: 100, state:"dummy!"}]
|
|
|
+ var m_data = [];
|
|
|
+ var arry = [data[0].myId, data[0].name, data[0].partyA, data[0].partyADept, data[0].partyB, data[0].partyBDept, data[0].signDate, data[0].beginDate, data[0].endDate, "销售负责人", "商务负责人", "业绩归属部门", data[0].amount, data[0].state ];
|
|
|
+ m_data[0] = arry;
|
|
|
+ conf.rows = m_data;
|
|
|
+
|
|
|
+ var result = nodeExcel.execute(conf);
|
|
|
+ //console.log(result);
|
|
|
+ res.setHeader('Content-Type', 'application/vnd.openxmlformats');
|
|
|
+ res.setHeader("Content-Disposition", "attachment; filename=" +data[0].name+ ".xlsx");
|
|
|
+ res.end(result, 'binary');
|
|
|
+ },
|
|
|
+ dummyFunc: function(req, res){
|
|
|
}
|
|
|
};
|