Authored by weiqingting

批量导出

... ... @@ -6,7 +6,7 @@ var util={
return false;
}else{
$.ajax({
type: 'POST',
type: options.type||'POST',
url: options.url,
async: options.async,
dataType: 'json',
... ...
... ... @@ -72,7 +72,7 @@ $('#add-attri').click(function () {
$(document).on('click', '.edit-class-btn', function () {
var item = tableGird.rows[$(this).data('index')];
attributeOp("修改", '/product/attr/update', item);
$("#select2-shopsId-container").val(item.)
// $("#select2-shopsId-container").val(item.)
});
... ...
... ... @@ -218,16 +218,18 @@ $('#export-btn').on('click', function() {
queryConf += '|';
}
});
common.util.__ajax({
url: '/ajax/down',
data: {
queryConf: '2016022517335568',
type: 'limitProductReminder'
}
}, function(res) {
console.log(res);
})
queryConf="2016030711350185";
window.open("/ajax/down?queryConf="+queryConf+"&type=limitProductReminder");
// common.util.__ajax({
// url: '/ajax/down',
// type:'GET',
// data: {
// queryConf: '2016022517335568',
// type: 'limitProductReminder'
// }
// }, function(res) {
// console.log(res);
// })
});
//开启商品
... ...
... ... @@ -2,28 +2,15 @@ var request = require('request');
var _ = require('lodash');
var fs = require('fs');
var ipaddr = require('ipaddr.js');
var domain = "http://172.16.6.162:8088/platform";//require('../../config/common.js').domain;
var domain = require('../../config/common.js').domain;
exports.downFile = function(req, res) {
request
.post({
url:'http://172.16.6.240:8088/platform/batch/export',
var options = {
method: 'POST',
url: domain+'/batch/export',
headers: { 'content-type': 'application/json' },
json: true,
formData: { queryConf: '2016030711350185', type: 'limitProductReminder' },//req.body
})
.on('response', function(response) {
var status=response.statusCode;
if(status>=200&&status<300||status==304){
console.log("下载成功");
}else{
console.log("下载失败");
}
})
.on('error', function(err) {
var msg= typeof err==='object'?err.message:err;
console.log("error");
console.log(msg.error);
})
.pipe(res);
body: req.query,
json: true
};
request(options).pipe(res);
}
\ No newline at end of file
... ...