/**
 * 数据管理-税率数据管理首页JS
 *
 * Created by li.kui on 20203/17.
 */
'use strict';
var el = {
    searchForm: '#searchForm',
    pgCode: '#pgCode',
    pgName: '#pgName',
    poCode: '#poCode',
    orgCodeOrName: '#orgCodeOrName',
    tb: '#tb',
    addOrEditDialog: null,
    lookDialog: null,
    bodyHeight: document.documentElement.clientHeight
};


$(function () {
    loadGrid();
});


function loadGrid() {
    var searchHeight = $(el.searchForm).outerHeight();
    var pager = initGridPagerNew(el.bodyHeight - searchHeight, 40, 30);

    $(el.tb).datagrid({
        loadMsg: '数据加载中......',
        url: g.ctx + 'pc/finance/payment/change/rest/list',
        singleSelect: true,
        height: el.bodyHeight - searchHeight,
        pagination: true,
        pageSize: pager.pageSize,
        pageList: pager.pageList,
        rownumbers: true,
        queryParams: {"businessType":"3"},
        columns: [
            [
                {
                    field: 'ck',
                    checkbox: true
                },
                {
                    field: 'businessType',
                    title: '业务类型',
                    sortable: true,
                    width: 140,
                    formatter:function (value,row) {
                        if(value === 0){
                            return "对账付款"
                        }else{
                            return '预付款';
                        }
                    }
                },
                {
                    field: 'appNo',
                    title: '付款申请单号',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'shareNo',
                    title: '共享单号',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'changeNo',
                    title: '变更单号',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'paymentCompanyNameOld',
                    title: '收款单位(旧)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'paymentCompanyName',
                    title: '收款单位(新)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'supBankNameOld',
                    title: '收款银行(旧)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'supBankName',
                    title: '收款银行(新)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'supBankAccountOld',
                    title: '银行账号(旧)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'supBankAccount',
                    title: '银行账号(新)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'supBankCodeOld',
                    title: '银行行号(旧)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'supBankCode',
                    title: '银行行号(新)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'bankInterCodeOld',
                    title: '银行国际代码(旧)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'bankInterCode',
                    title: '银行国际代码(新)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'bankAddressOld',
                    title: '银行地址(旧)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'bankAddress',
                    title: '银行地址(新)',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'remark',
                    title: '变更原因',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'createUserName',
                    title: '创建人',
                    sortable: true,
                    width: 140
                },
                {
                    field: 'createTime',
                    title: '创建日期',
                    sortable: true,
                    width: 140,
                    formatter: function (value) {
                        return moment(value).format('YYYY-MM-DD HH:mm:ss');
                    }
                }
            ]
        ]
    });
}

function searchPcaData() {
    var queryParams = $(el.tb).datagrid('options').queryParams;

    queryParams.appNo = $('#appNo').val();
    queryParams.shareNo = $('#shareNo').val();
    queryParams.changeNo = $.trim($('#changeNo').val());
    queryParams.businessType = 3;

    $(el.tb).datagrid('load');
}


/**
 * 重置查询
 */
function resetPcaSearch() {
    $('#changeNo').val('');
    $('#shareNo').val('');
    $('#appNo').val('');
    searchPcaData();
}



