/**
 * 显示审核日志
 */
IntegralInfo.showLog = function (id) {
    layer.open({
        type: 1,
        title: "日志",
        fixed: false,
        content: '
',
        area: ['80%', '80%'],
        maxmin: true,
        success: function (layero, index) {
            Feng.getCheckLog(id, {"type": CONFIG.project_integral_apply, "mainId": id, "typeFileId": "", "active": 1})
        }
    });
}
/**
 * 查询表单提交参数对象
 * @returns {{}}
 */
IntegralInfo.formParams = function () {
    var queryData = {};
    queryData['name'] = $("#name").val();
    queryData['card_number'] = $("#card_number").val();
    queryData['phone'] = $("#phone").val();
    queryData['email'] = $("#email").val();
    queryData['checkState'] = $("#checkState").val();
    queryData['apply_year'] = $("#apply_year").val();
    queryData['enterprise_id'] = $("#enterprise_id").val();
    queryData['shareholder'] = $("#shareholder").val();
    queryData['veto'] = $("#veto").val();
    return queryData;
}
/**
 * 查询人才认定申报列表
 */
IntegralInfo.search = function () {
    IntegralInfo.table.refresh({query: IntegralInfo.formParams()});
};
/**
 * 重置
 */
IntegralInfo.reset = function () {
    $("#name").val("");
    $("#card_number").val("");
    $("#phone").val("");
    $("#email").val("");
    $("#checkState").val("");
    $("#apply_year").val("");
    $("#enterprise_id").val("").trigger("chosen:updated");
    $("#shareholder").val("");
    $("#veto").val("");
}
/**
 * 显示导出模态框
 */
IntegralInfo.showExportModal = function () {
    $("#exportForm")[0].reset();
    $("#commonExportModal").modal("show");
}
/**
 * 导出提交
 */
IntegralInfo.export = function (process) {
    var names = '';
    var values = '';
    var commonExport = "";
    $("#field_info li input").each(function (index) {
        if ($(this).is(":checked")) {
            values = values + $(this).val() + ",";
            names = names + $(this).next().text() + ",";
        }
    });
    var queryData = IntegralInfo.formParams();
    var process = parseInt($("#process").val());
    switch (process) {
        case 1:
            commonExport = "fstVerifyListExport";
            break;
        case 2:
            commonExport = "reVerifyListExport";
            break;
        case 3:
            commonExport = "preListExport";
            break;
    }
    $("#commonExportModal").modal('hide');
    var params = $("#exportForm").serialize();
    var url = "/admin/integralVerify/" + commonExport + "?" + params;
    window.location.href = url;
}
/**
 * 页面初始化
 */
IntegralInfo.init = function () {
    //批量加载字典表数据
    var arr = [
        {"name": "nation", "code": "nation"}];
    Feng.findChildDictBatch(JSON.stringify(arr));
    $("#enterprise_id").on('chosen:ready', function (e, params) {
        $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
    });
    $("#enterprise_id").val("");
    $("#enterprise_id").trigger('chosen:updated');
    $("#enterprise_id").chosen({
        search_contains: true,       //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
        disable_search: false,
        width: "100%",
        enable_split_word_search: true
    });
}
/**
 * 下载附件
 */
IntegralInfo.download = function () {
    if (this.check()) {
        window.location.href = encodeURI(encodeURI(Feng.ctxPath + "/common/api/downloadZip?type=20&id=" + IntegralInfo.seItem.id));
    }
}
/**
 * 批量下载头像
 */
IntegralInfo.downloadPhoto = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录!");
        return false;
    }
    var ids = "";
    for (let i = 0; i < selected.length; i++) {
        ids = ids + selected[i].id + ",";
    }
    window.location.href = encodeURI(encodeURI(Feng.ctxPath + "/api/commonDownload/downloadPhotos?type=20&ids=" + ids));
}
/**
 * 全选
 */
IntegralInfo.checkAll = function () {
    $("#field_info input").each(function () {
        this.checked = true;
    })
}
/**
 * 反选
 */
IntegralInfo.unCheckAll = function () {
    $("#field_info input").each(function () {
        if (this.checked) {
            this.checked = false;
        } else {
            this.checked = true;
        }
    })
}