product.productBundle.Import.js 1.47 KB
webpackJsonp([141],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	'use strict';

	var $ = __webpack_require__(1), common = __webpack_require__(2);
	var importConfig = { "bizType" : "productBundle" };
	$('input[type="file"]').after('<div class="file-name btn btn-default">请选择文件</div>');

	var loadModal = null;

	function batchImport(el, type) {

	    return {
	        params: {
	            type: type,            
	            __type: "batch-import"
	        },
	        onStart: function(params) {
	            console.log("params",params);
	            loadModal = common.dialog.load();
	        },
	        onComplete: function(response) {
	            if (loadModal) {
	                loadModal.close();
	            }
	            console.log("批量接口返回数据",response);
	            var msg = response.message;
	            if (response.code == 200) {
	                common.util.__tip(msg, 'success');
	                $("#message").css('color','red').html("");
	            } else if (msg) {
	                msg = msg.substring(6, msg.length - 2);


	                $("#message").html(msg.replace(/,/g, '<br/>').replace(/=/g, ' : '));

	                common.util.__tip("操作失败,详情见下方", 'warning');
	            } else {
	                common.util.__tip("导入失败", 'warning');
	            }
	        }
	    }
	}

	common.edit.ajaxfileupload('#importProductBundle', batchImport('#sort-file', importConfig.bizType));



/***/ }
]);