goods.netsale.Batch.js 1.27 KB
webpackJsonp([30],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	'use strict';
	var $ = __webpack_require__(1),
	    common = __webpack_require__(2);

	$('input[type="file"]').after('<div class="file-name btn btn-default">请选择文件</div>');

	function batchExport(el, type) {
	    var loadModal = null;

	    return {
	        params: {
	            type: type,
	            __type: "batch-import"
	        },
	        onStart: function() {
	            loadModal = common.dialog.load();

	            $(el).parents('td').find('.file-name').text($(el).val().replace("C:\\fakepath\\", ""));
	        },
	        onComplete: function(response) {
	            console.log(response);
	            if (loadModal) {
	                loadModal.close();
	            }
	            if (response.code == 200) {
	                common.util.__tip(response.message, 'success');
	            } else {
	                common.util.__tip(response.message, 'warning');
	            }
	        }
	    }
	}

	common.edit.ajaxfileupload('#sort-file', batchExport('#sort-file', 'searchSort'));
	common.edit.ajaxfileupload('#brand-file', batchExport('#brand-file', 'brandProperty'));
	common.edit.ajaxfileupload('#offShelve-file', batchExport('#offShelve-file', 'offShelveSkn'));

/***/ }
]);