shootMeter.MeterSize.Index.js 3.51 KB
webpackJsonp([153],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	/**
	 * Created by ty on 2016/3/22.
	 * 测量尺码管理
	 */

	var $ = __webpack_require__(1);
	var common = __webpack_require__(2);

	new common.edit("#filter").init();

	new common.dropDown({el: "#hasMeasure-filter"});
	new common.dropDown({
	    el: "#brand-filter", ajax: "brand", params: function () {
	        return {status: 1};
	    }
	});

	var tabTree = new common.tabTree("#category-filter", {
	    columns: [{
	        state: "prov",
	        text: "一级分类",
	        hide: false,
	        addclass: ""
	    }],
	    datas: [{id: "", name: ""}]
	});
	tabTree.init();

	var g = new common.grid({
	    el: "#content-list",
	    hash: false,
	    parms: function () {
	        return {
	            productSkn: common.util.__input('skn-filter'),
	            brandId: common.util.__input('brand-filter'),
	            productSku: common.util.__input('sku-filter'),
	            arriveStartTime: new Date(common.util.__input('startTime')).getTime() / 1000,
	            arriveEndTime: new Date(common.util.__input('endTime')).getTime() / 1000,
	            isMeasure: common.util.__input('hasMeasure-filter'),
	            maxSortId: tabTree.getAddress()[0] ? tabTree.getAddress()[0].id : ""
	        };
	    },
	    columns: [
	        {display: "SKN", name: "productSkn"},
	        {display: "名称", name: "productName"},
	        {display: "品牌", name: "brandName"},
	        {display: "分类", name: "productType"},
	        {display: "性别", name: "genderName"},
	        {
	            display: "尺码",
	            name: "sizeRelationsList",
	            render: function (item1) {
	                return common.util.__template2($("#sizeinfo-template").html(), item1);
	            }
	        },
	        {
	            display: "到货时间",
	            name: "",
	            render: function (item1) {
	                if (item1.expectArrivalTime) {
	                    return Bll.getLocalTime(item1.expectArrivalTime);
	                }
	                else {
	                    return ""
	                }

	            }
	        },
	        {display: "操作人", name: "updateUserName"},
	        {
	            display: "操作", name: "", render: function (item1) {
	            var arr = [];
	            arr.push('<a class="btn btn-xs btn-info add2" data-index="' + item1.__index + '">编辑</a>');
	            return arr.join("");
	        }
	        }
	    ]

	});

	g.init("/meterManage/productSize/queryProdSizeList");
	//当点击“无需测量”,该列输入框不可编辑
	common.sizeInfo.check();
	var Bll = {
	    getLocalTime: function (nS) {
	        var date = new Date(parseInt(nS) * 1000);
	        var mm = date.getMonth() + 1;
	        var dd = date.getDate();
	        var h = date.getHours();
	        var min = date.getMinutes();
	        var second = date.getSeconds();
	        return date.getFullYear() + "-" + (mm < 10 ? "0" + mm : mm) + "-" + (dd < 10 ? "0" + dd : dd) + " " + (h < 10 ? "0" + h : h) + ":"
	            + (min < 10 ? "0" + min : min) + ":" + (second < 10 ? "0" + second : second);
	    }
	};

	$(document).on('click', '#filter-btn', function () {
	    g.reload(1);
	});

	$(document).on('click', '.add2', function () {
	    var item = g.rows[$(this).data("index")];
	    //拼接分类字符串
	    var a = item.productType.replace(/<br>/g, "/");
	    item.productType = a.substring(0, a.length - 1);
	    common.sizeInfo.toast("/meterManage/productSize/saveProdSizeInfo", item,false,g);
	});

/***/ }
]);