esayui

阅读更多
$(function(){
$('#peopleGrid').datagrid({
        url : contextPath + '/report/findPageByreporDetails.pvt',
        //title : " ",
        pagination : true,
        pageSize : 10,
        rownumbers : true,
        striped : true,
        singleSelect : true,
        idField : 'id',
        nowrap : false,
        fitColumns : false,
        pagePosition : 'bottom',/*分页功能显示的位置*/
        totalProperty : "total",/*总条数*/
        rowsProperty : "repDetails",//后台传过来的json对象
        onSelect:function(rowIndex,rowData){
        //alert(rowData.id);//rowIndex:被双击行的索引,从 0 开始 rowData:被双击行对应的记录
        $("#bottonShow").show();
        $("#areaRange").val(rowData.areaRange);
        $("#id").val(rowData.id);
        $("#customer").val(rowData.customer);
        $("#shNum").val(rowData.shNum);
        $("#shThNum").val(rowData.shThNum);
        $("#shFwNum").val(rowData.shFwNum);
        $("#shHsNum").val(rowData.shHsNum);
        $("#shZlNum").val(rowData.shZlNum);
        $("#fhNum").val(rowData.fhNum);
        $("#fhThNum").val(rowData.fhThNum);
        $("#fhFwNum").val(rowData.fhFwNum);
        $("#fhHsNum").val(rowData.fhHsNum);
        $("#fhZlNum").val(rowData.fhZlNum);
        $("#fhFxNum").val(rowData.fhFxNum);
        $("#fhWfwxNum").val(rowData.fhWfwxNum);
        $("#fhBxthNum").val(rowData.fhBxthNum);
        $("#lcBcwxzNum").val(rowData.lcBcwxzNum);
        $("#lcBcdlNum").val(rowData.lcBcdlNum);
        $("#lcCjgtNum").val(rowData.lcCjgtNum);
        $("#lcDwfsNum").val(rowData.lcDwfsNum);
        $("#lcSzjNum").val(rowData.lcSzjNum);
        $("#lcDfhNum").val(rowData.lcDfhNum);
        $("#lcBfsbNum").val(rowData.lcBfsbNum);
        $("#lcDcxwhNum").val(rowData.lcDcxwhNum);
        $("#lcDkhfkNum").val(rowData.lcDkhfkNum);
        $("#lcDkfwhNum").val(rowData.lcDkfwhNum);
        $("#bwwxWxNum").val(rowData.bwwxWxNum);
        $("#bwwxSrNum").val(rowData.bwwxSrNum);
        $("#cqrsNum").val(rowData.cqrsNum);
       
        window.isEditing = false;
        $("#changeDate").dialog({
            title : "修改数据"
        }).dialog('open');
    },
  /*  onCheck :function(rowIndex,rowData){
   alert(rowIndex);//rowIndex:被双击行的索引,从 0 开始 rowData:被双击行对应的记录
},*/
        frozenColumns : [[{
            field : 'id',
            checkbox : true
        }]],
        columns : [[ {
            field : 'inputDate',//'(input_date)',
            align : 'center',
            width : 120,
            title : "入库时间"
        }, {
            field : 'areaRange',//'(area_range)',
            align : 'center',
            width : 120,
            title : "网点维修中心"
        }, {
            field : 'customer',
            align : 'center',
            width : 120,
            title : "订单来源"
        },{
            field : 'shNum',//'(sh_num)',
            align : 'center',
            width : 120,
            title : "收货票数"
        }, {
            field : 'shThNum',//'(sh_th_num)',
            align : 'center',
            width : 120,
            title : "退/换(收货)"
        }, {
            field : 'shFwNum',//'(sh_fw_num)',
            align : 'center',
            width : 120,
            title : "维修(收货)",
            /*formatter:function(value,row,index){
                return new Date(value).Fomat("yyyy/MM/dd");
                }*/
        }, {
            field : 'shHsNum',//'(sh_hs_num)',
            align : 'center',
            width : 120,
            title : "回收(收货)"
        }, {
            field : 'shZlNum',//'(sh_zl_num)',
            align : 'center',
            width : 120,
            title : "租赁(收货)"
        }, {
            field : 'shQt1Num',//'(sh_qt1_num)',
            align : 'center',
            width : 120,
            title : "其他1(收货)"
        }, {
            field : 'shQt2Num',//'(sh_qt2_num)',
            align : 'center',
            width : 120,
            title : "其他2(收货)"
        }, {
            field : 'fhNum',//'(fh_num)',
            align : 'center',
            width : 120,
            title : "发货票数"
        }, {
            field : 'fhThNum',//'(fh_th_num)',
            align : 'center',
            width : 120,
            title : "退/换(发货)"
        }, {
            field : 'fhFwNum',//'(fh_fw_num)',
            align : 'center',
            width : 120,
            title : "维修(发货)"
        }, {
            field : 'fhHsNum',//'(fh_hs_num)',
            align : 'center',
            width : 120,
            title : "回收(发货)"
        }, {
            field : 'fhZlNum',//'(fh_zl_num)',
            align : 'center',
            width : 120,
            title : "租赁(发货)"
        }, {
            field : 'fhFxNum',//'(fh_fx_num)',
            align : 'center',
            width : 120,
            title : "翻新(发货)"
        }, {
            field : 'fhWfwxNum',//'(fh_wfwx_num)',
            align : 'center',
            width : 120,
            title : "外发送修(发货)"
        }, {
            field : 'fhBxthNum',//'(fh_bxth_num)',
            align : 'center',
            width : 120,
            title : "回收(收货)"
        }, {
            field : 'fhQt1Num',//'(fh_qt1_num)',
            align : 'center',
            width : 120,
            title : "其他1(发货)"
        }, {
            field : 'fhQt2Num',//'(fh_qt2_num)',
            align : 'center',
            width : 120,
            title : "其他2(发货)"
        }, {
            field : 'lcBcwxzNum',//'(lc_bcwxz_num)',
            align : 'center',
            width : 120,
            title : "本厂维修中(留存)"
        }, {
            field : 'lcBcdlNum',//'(lc_bcdl_num)',
            align : 'center',
            width : 120,
            title : "本厂待料(留存)"
        }, {
            field : 'lcCjgtNum',//'(lc_cjgt_num)',
            align : 'center',
            width : 120,
            title : "待厂家沟通处理(留存)"
        }, {
            field : 'lcDwfsNum',//'(lc_dwfs_num)',
            align : 'center',
            width : 120,
            title : "待外发送修(留存)"
        }, {
            field : 'lcSzjNum',//'(lc_dzj_num)',
            align : 'center',
            width : 120,
            title : "待质检(留存)"
        }, {
            field : 'lcDfhNum',//'(lc_dfh_num)',
            align : 'center',
            width : 120,
            title : "待发货(留存)"
        }, {
            field : 'lcBfsbNum',//'(lc_bfsb_num)',
            align : 'center',
            width : 120,
            title : "不符三包退换条件(留存)"
        }, {
            field : 'lcDcxwhNum',//'(lc_dcxwh_num)',
            align : 'center',
            width : 120,
            title : "待产线外呼(留存)"
        }, {
            field : 'lcDkfwhNum',//'(lc_dkfwh_num)',
            align : 'center',
            width : 120,
            title : "待客服外呼(留存)"
        }, {
            field : 'lcDkhfkNum',//'(lc_dkhfk_num)',
            align : 'center',
            width : 120,
            title : "待客户付款(留存)"
        }, {
            field : 'lcQt1Num',//'(lc_qt1_num)',
            align : 'center',
            width : 120,
            title : "其他1(留存)"
        }, {
            field : 'lcQt2Num',//'(lc_qt2_num)',
            align : 'center',
            width : 120,
            title : "其他2(留存)"
        }, {
            field : 'bwwxWxNum',//'(bwwx_wx_num)',
            align : 'center',
            width : 120,
            title : "维修台数(保外维修)"
        }, {
            field : 'bwwxSrNum',//'(bwwx_sr_num)',
            align : 'center',
            width : 120,
            title : "收入(保外维修)"
        }, {
            field : 'cqrsNum',//'(cqrs_num)',
            align : 'center',
            width : 120,
            title : "出勤人数(总共)"
        }, {
            field :'insertname',
            align : 'center',
            width : 120,
            title : "更新者的名字"
        }, {
            field : 'shRejectNum',//'(sh_reject_num)',
            align : 'center',
            width : 120,
            title : "拒收"
        }, {
            field : 'inputYwsjDate',//'(input_ywsj_date)',
            align : 'center',
            width : 120,
            title : "业务时间"
        }]],
    });
});
function aa(){
//window.open("../excel.zip");
window.location.href = contextPath + "/pc-rs/novatar.sample/excel.zip";
}
/*弹出from表单*/
window.onAdd = function() {
    window.isEditing = false;
    $("#peopleDialog").dialog({
        title : $.i18n.get('add')
    }).dialog('open');
}
window.importExcel = function(){
window.isEditing = false;
    $("#importExcelBox").dialog({
        title : "批量文件导入"
    }).dialog('open');
//alert("123");
}
window.onimport = function(){
$("#importExcelForm").submit();
$("#importExcelBox").dialog('close');
}
window.exportExcel = function(){
//$("#exportExcelForm").attr('action',contextPath + download);
window.isEditing = false;
    $("#exportExcelForm").dialog({
        title : "批量文件导出"
    }).dialog('open');
//$("#exportExcelForm").submit();
/* $.ajax({
        url:contextPath + "/report/fileExport.pvt",
        type:"post",
        data:null,//form表单
        contentType:'application/x-www-form-urlencoded',
        dataType : 'json',
        success:function(data) {
           
        }
    });*/
}
/*添加并验证*/
window.onsave = function() {
   /* var name = $("#areaRange").val();
    var code = $("#plantName").val();
    var firmType = $('#firmType').combobox('getText');
    var process = $("#process").val();
    var num = $("#monthlynum").val();
    var workTime = $("#formdate").datebox('getValue');
    var updateName = $("#insertname").val();
    var regular = /^[0-9]*$/;//数字正则
    if(null == name || regular.test(name)|| name == ""){
    info("名称不能为空或者数字");
    return;
    }else if(null == code || code == "" ){
    info("工厂名称不能为空");
    return;
    }else
    if(null == process || process == ""){
    info("业务工序不能为空");
    return;
    }else
    if(null == firmType || firmType == ""){
    info("类型不能为空");
    return;
    }else
    if(null == num || !regular.test(num)|| num == ""){
    info("月度统计不能为空");
    return;
    }else
    if(null == workTime || workTime == "" ){
    info("时间不能为空");
    return;
    }*/
    var aa = $("#updateForm").serializeJson();
//var aa = $("#peopleForm").serializeJson();//获取from表单转换成json格式的序列化
    $.ajax({
        url:contextPath + "/report/updatereport.pvt",
        type:"post",
        data:aa,//form表单
        contentType:'application/x-www-form-urlencoded',
        dataType : 'json',
        success:function(data) {
            if(data.success == true) {
            $('#peopleGrid').datagrid('load', {});//刷新datagrid数据表格
            $('#updateForm').form('clear');//清空from表单的属于框
            info("保存成功");
            $('#changeDate').dialog('close');//关闭from表单
            }else{
            $('#changeDate').dialog('close');
            info("保存错误");
            }
        }
    });
}

//验证输入框值 并提交表单
function subExportFrom(){
var beginTime = $("input[name='startTime']").val();//$("#startTime").val();
var endTime =   $("input[name='endTime']").val();//$("#endTime").val();

if(null == beginTime || beginTime == ""){
    info("必须选择开始时间");
    return;
}else if(null == endTime || endTime == ""){
    info("必须选择结束时间");
    return;
}
var day = diffTime(beginTime,endTime);
if(day>31){
info("时间范围太大,不能超过一个月");
}else{
//进入提交表单导出数据代码块
//$("#exportExcelForm").attr("action","download");
$("#exportExcelForm").submit();
$("#exportExcelForm").dialog('close');
}
}

//计算时间差
function diffTime(startDate,endDate) {

var d1=new Date(startDate);

var d2=new Date(endDate);

var day = (d2-d1)/(24*60*60*1000);

return day;


/*esayui弹框*/
function info(alertinfo){  
jQuery.messager.alert('提示:',alertinfo,'info');  
}
/*时间转换格式*/
Date.prototype.Fomat = function (fmt) { 
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "h+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}

你可能感兴趣的:(esayui,echarts3,jquery,datagrid)