incomingallstatistics.js 3.0 KB
Newer Older
Skyeye云's avatar
Skyeye云 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

var rowId = "";

//单据的时间
var operTime = "";

layui.config({
    base: basePath,
    version: skyeyeVersion
}).extend({
    window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form', 'laydate'], function (exports) {
    winui.renderColor();
    var $ = layui.$,
        form = layui.form,
        laydate = layui.laydate,
        table = layui.table;
        
    //初始化统计时间
	operTime = getOneYMFormatDate();
	
	//获取本月日期
	function getOneYMFormatDate(){
		 var date = new Date;
		 var year = date.getFullYear(); 
		 var month = date.getMonth() + 1;
		 month = (month < 10 ? "0" + month : month); 
		 return year.toString() + "-" + month.toString();
	}
	
W
weizhiqiang 已提交
31
    laydate.render({elem: '#operTime', type: 'month', value: operTime});
Skyeye云's avatar
Skyeye云 已提交
32 33 34 35 36 37 38 39
	
	initTable();
	function initTable(){
	    
	    table.render({
	        id: 'messageTable',
	        elem: '#messageTable',
	        method: 'post',
Skyeye云's avatar
Skyeye云 已提交
40
	        url: flowableBasePath + 'statistics007',
Skyeye云's avatar
Skyeye云 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
	        where: {materialName: $("#materialName").val(), operTime: operTime},
	        even: true,
	        page: true,
	        limits: [8, 16, 24, 32, 40, 48, 56],
	        limit: 8,
	        cols: [[
	            { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers'},
	            { field: 'materialName', title: '产品名称', align: 'left', width: 250},
			    { field: 'model', title: '型号', align: 'left', width: 100},
			    { field: 'typeName', title: '分类', align: 'left', width: 100},
	            { field: 'unitName', title: '单位', align: 'left', width: 80},
	            { field: 'currentTock', title: '入库数量', align: 'left', width: 100},
	            { field: 'currentTockMoney', title: '入库金额', align: 'left', width: 120}
	        ]],
		    done: function(){
		    	matchingLanguage();
		    }
	    });
	    form.render();
	}
	
    
    form.on('submit(formSearch)', function (data) {
        
        if (winui.verifyForm(data.elem)) {
            loadTable();
        }
        return false;
    });

    $("body").on("click", "#reloadTable", function() {
        loadTable();
    });

    $("body").on("click", "#formSearch", function () {
        refreshTable();
    })
    
    //刷新
W
weizhiqiang 已提交
80 81
    function loadTable() {
    	if(isNull($("#operTime").val())) {//一定要记得,当createTime为空时
Skyeye云's avatar
Skyeye云 已提交
82
    		winui.window.msg("请选择日期.", {icon: 2, time: 2000});
Skyeye云's avatar
Skyeye云 已提交
83 84
    	}else {
    		operTime = $("#operTime").val();
85
	        table.reloadData("messageTable", {where:{materialName: $("#materialName").val(), operTime: operTime}});
Skyeye云's avatar
Skyeye云 已提交
86 87 88 89 90
    	}
    }

    //搜索
    function refreshTable(){
W
weizhiqiang 已提交
91
    	if(isNull($("#operTime").val())) {//一定要记得,当createTime为空时
Skyeye云's avatar
Skyeye云 已提交
92
    		winui.window.msg("请选择日期.", {icon: 2, time: 2000});
Skyeye云's avatar
Skyeye云 已提交
93 94
    	}else {
    		operTime = $("#operTime").val();
95
	        table.reloadData("messageTable", {page: {curr: 1}, where:{materialName: $("#materialName").val(), operTime: operTime}})
Skyeye云's avatar
Skyeye云 已提交
96 97 98 99 100
    	}
    }

    exports('incomingallstatistics', {});
});