Authored by weiqingting

批量导出

@@ -6,7 +6,7 @@ var util={ @@ -6,7 +6,7 @@ var util={
6 return false; 6 return false;
7 }else{ 7 }else{
8 $.ajax({ 8 $.ajax({
9 - type: 'POST', 9 + type: options.type||'POST',
10 url: options.url, 10 url: options.url,
11 async: options.async, 11 async: options.async,
12 dataType: 'json', 12 dataType: 'json',
@@ -72,7 +72,7 @@ $('#add-attri').click(function () { @@ -72,7 +72,7 @@ $('#add-attri').click(function () {
72 $(document).on('click', '.edit-class-btn', function () { 72 $(document).on('click', '.edit-class-btn', function () {
73 var item = tableGird.rows[$(this).data('index')]; 73 var item = tableGird.rows[$(this).data('index')];
74 attributeOp("修改", '/product/attr/update', item); 74 attributeOp("修改", '/product/attr/update', item);
75 - $("#select2-shopsId-container").val(item.) 75 + // $("#select2-shopsId-container").val(item.)
76 }); 76 });
77 77
78 78
@@ -218,16 +218,18 @@ $('#export-btn').on('click', function() { @@ -218,16 +218,18 @@ $('#export-btn').on('click', function() {
218 queryConf += '|'; 218 queryConf += '|';
219 } 219 }
220 }); 220 });
221 -  
222 - common.util.__ajax({  
223 - url: '/ajax/down',  
224 - data: {  
225 - queryConf: '2016022517335568',  
226 - type: 'limitProductReminder'  
227 - }  
228 - }, function(res) {  
229 - console.log(res);  
230 - }) 221 + queryConf="2016030711350185";
  222 + window.open("/ajax/down?queryConf="+queryConf+"&type=limitProductReminder");
  223 + // common.util.__ajax({
  224 + // url: '/ajax/down',
  225 + // type:'GET',
  226 + // data: {
  227 + // queryConf: '2016022517335568',
  228 + // type: 'limitProductReminder'
  229 + // }
  230 + // }, function(res) {
  231 + // console.log(res);
  232 + // })
231 }); 233 });
232 234
233 //开启商品 235 //开启商品
@@ -2,28 +2,15 @@ var request = require('request'); @@ -2,28 +2,15 @@ var request = require('request');
2 var _ = require('lodash'); 2 var _ = require('lodash');
3 var fs = require('fs'); 3 var fs = require('fs');
4 var ipaddr = require('ipaddr.js'); 4 var ipaddr = require('ipaddr.js');
5 -var domain = "http://172.16.6.162:8088/platform";//require('../../config/common.js').domain; 5 +var domain = require('../../config/common.js').domain;
6 6
7 exports.downFile = function(req, res) { 7 exports.downFile = function(req, res) {
8 - request  
9 - .post({  
10 - url:'http://172.16.6.240:8088/platform/batch/export', 8 + var options = {
  9 + method: 'POST',
  10 + url: domain+'/batch/export',
11 headers: { 'content-type': 'application/json' }, 11 headers: { 'content-type': 'application/json' },
12 - json: true,  
13 - formData: { queryConf: '2016030711350185', type: 'limitProductReminder' },//req.body  
14 - })  
15 - .on('response', function(response) {  
16 - var status=response.statusCode;  
17 - if(status>=200&&status<300||status==304){  
18 - console.log("下载成功");  
19 - }else{  
20 - console.log("下载失败");  
21 - }  
22 - })  
23 - .on('error', function(err) {  
24 - var msg= typeof err==='object'?err.message:err;  
25 - console.log("error");  
26 - console.log(msg.error);  
27 - })  
28 - .pipe(res); 12 + body: req.query,
  13 + json: true
  14 + };
  15 + request(options).pipe(res);
29 } 16 }