var TalentAllowanceInfoSupple = {};
TalentAllowanceInfoSupple.initColumn = function () {
    return TalentAllowanceInfoSupple.createColOneAndTwoIC();
};

TalentAllowanceInfoSupple.createColOneAndTwo = function (process) {
    return [
        {field: 'selectItem', radio: true},
        {title: '年度', field: 'year', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "60px"},
        {title: '审核单位', field: 'companyName', visible: (process == 1), align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
        {title: '单位名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
        {title: '泉州证书有效期', field: 'qzgccrcActiveTime', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
        {title: '人才标签', field: 'talentTypeName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
        {title: '所属镇街', field: 'addressName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px"},
        {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px"},
        {title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "60px",
            formatter(value, row, index) {
                if (value == 1) {
                    return "男";
                }
                if (value == 2) {
                    return "女";
                }
            }
        },
        {title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
        {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
        {title: '认定条件', field: 'identifyConditionText', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
        // {title: '认定条件证书取得时间', field: 'identifyGetTime', visible: true, align: 'center', valign: 'middle',width:"130px"},
        {title: '认定条件名称', field: 'identifyConditionName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
        {title: '公布入选月份', field: 'identifyMonth', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
        {title: '首次提交时间', field: 'firstSubmitTime', visible: true, align: 'center', valign: 'middle', width: "120px"},
        {title: '最新提交时间', field: 'newSubmitTime', visible: true, align: 'center', valign: 'middle', width: "120px"},
        {title: '审核状态', field: 'checkState', visible: (process == 2), align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px",
            formatter(value, row, index) {
                if (value == -1) {
                    return "<span class='label label-warning-light'>审核不通过</span>";
                }
                if (process == 1) {
                    if (value == 1) {
                        return "<span class='label'>待提交</span>"
                    }
                    if (value == 5) {
                        if (Feng.isNotEmptyStr(row.highProcess) && row.highProcess >= 1) {
                            return "<span class='label label-success'>重新提交</span>";
                        } else {
                            return "<span class='label label-success'>待审核</span>";
                        }
                    }
                    if (value == 13) {
                        return "<span class='label label-success'>上级驳回</span>";
                    }
                    if (value == 10) {
                        return "<span class='label label-danger'>已驳回</span>";
                    }
                    if (value == 15 || value == 20 || value == 25 || value == 30) {
                        return "<span class='label label-primary'>已通过</span>";
                    }
                } else if (process == 2) {
                    if (value == 1 || value == 5 || value == 10) {
                        return "<span class='label label-danger'>已驳回</span>";
                    }
                    if (value == 15) {
                        if (row.highProcess != null && row.highProcess != '' && row.highProcess >= 2) {
                            return "<span class='label label-success'>重新提交</span>"
                        } else {
                            return "<span class='label label-success'>待审核</span>"
                        }
                    }
                    if (value == 20 || value == 30) {
                        return "<span class='label label-primary'>已通过</span>"
                    }
                    if (value == 25) {
                        return "<span class='label label-success'>上级驳回</span>";
                    }
                }
            }
        },
        {title: '审核状态', field: 'depState', visible: (process == 1), align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px",
            formatter(value, row, index) {
                if (value == -2) {
                    return "<span class='label'>待提交</span>";
                }
                if (value == -1) {
                    return "<span class='label label-warning-light'>审核不通过</span>";
                }
                if (value == 1) {
                    return "<span class='label label-success'>待审核</span>";
                }
                if (value == 2) {
                    return "<span class='label label-danger'>已驳回</span>";
                }
                if (value == 3) {
                    return "<span class='label label-primary'>已通过</span>"
                }
                if (value == 4) {
                    return "<span class='label label-success'>上级驳回</span>";
                }
                if (value == 9) {
                    return "<span class='label label-success'>重新提交</span>";
                }
            }
        },
        {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
            formatter: function (value, row, index) {
                return "<span class='label label-success' onclick=\"TalentAllowanceInfoSupple.showLog('" + value + "')\" >" +
                        "<i class=\"fa fa-book\"></i>日志" +
                        "</span>";
            }
        }
    ];
}


TalentAllowanceInfoSupple.createColThree = function (process) {
    return [
        [
            {field: 'selectItem', radio: true, rowspan: 2, align: 'center', valign: 'middle'},
            {title: '年度', field: 'year', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "60px", rowspan: 2},
            {title: '单位名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px", rowspan: 2},
            {title: '泉州证书有效期', field: 'qzgccrcActiveTime', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "130px", rowspan: 2},
            {title: '人才标签', field: 'talentTypeName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px", rowspan: 2},
            {title: '所属镇街', field: 'addressName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px", rowspan: 2},
            {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px", rowspan: 2},
            {title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "60px", rowspan: 2,
                formatter(value, row, index) {
                    if (value == 1) {
                        return "男";
                    }
                    if (value == 2) {
                        return "女";
                    }
                }
            },
            {title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px", rowspan: 2},
            {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px", rowspan: 2},
            {title: '认定条件', field: 'identifyConditionText', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px", rowspan: 2},
            {title: '<span style="color: #682c90">推荐类型</span>', field: 'checkMsg', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', colspan: '4', rowspan: 1, width: "500px",
                cellStyle: function (value, row, index) {
                    return {
                        css: {
                            background: 'blue'
                        }
                    }
                }
            },
            {title: '<span style="color: #fe346e;">最终类型</span>', field: 'highProcess', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', colspan: '4', rowspan: 1, width: "500px",
                cellStyle: function (value, row, index) {
                    return {
                        css: {
                            background: '#fe346e'
                        }
                    }
                }
            },
            {title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px", rowspan: 2,
                formatter(value, row, index) {
                    if (value == -1) {
                        return "<span class='label label-warning-light'>审核不通过</span>";
                    }
                    if (value == 1 || value == 5 || value == 10 || value == 13 || value == 15 || value == 25) {
                        return "<span class='label label-danger'>已驳回</span>";
                    }
                    if (value == 20) {
                        if (row.highProcess != null && row.highProcess != '' && row.highProcess >= 3) {
                            return "<span class='label label-success'>重新提交</span>"
                        } else {
                            return "<span class='label label-success'>待审核</span>"
                        }
                    }
                    if (value == 30) {
                        return "<span class='label label-primary'>已通过</span>"
                    }
                    if (value == 35) {
                        return "<span class='label label-success'>公示驳回</span>";
                    }
                }
            },
            {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px", rowspan: 2,
                formatter: function (value, row, index) {
                    return "<span class='label label-success' onclick=\"TalentAllowanceInfoSupple.showLog('" + value + "')\" >" +
                            "<i class=\"fa fa-book\"></i>日志" +
                            "</span>";
                }
            }
        ], [
            // {title: '认定条件证书取得时间', field: 'identifyGetTime', visible: true, align: 'center', valign: 'middle',width:"150px"},
            // {title: '认定条件名称', field: 'identifyConditionName', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"100px"},
            // {title: '公布入选月份', field: 'identifyMonth', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"100px"},
            {title: '推荐津补贴类型', field: 'recommendAllowanceType', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px",
                formatter(value, row, index) {
                    if (value == null || value == "")
                        return "<span style='color: black'>未判定</span>";
                    if (value == 1)
                        return "<span style='color: green'>工作津贴</span>";
                    if (value == 2)
                        return "<span style='color: blue'>一次性交通补贴</span>";
                    if (value == 3)
                        return "<span style='color: red'>不予兑现</span>";
                }
            },
            {title: '推荐兑现月份', field: 'recommendMonths', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
            {title: '推荐兑现金额', field: 'recommendMoney', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
            {title: '推荐金额说明', field: 'recommendMoneyDesc', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
            {title: '津补贴类型', field: 'allowanceType', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px",
                formatter(value, row, index) {
                    if (value == null || value == "")
                        return "<span style='color: black'>未判定</span>";
                    if (value == 1)
                        return "<span style='color: green'>工作津贴</span>";
                    if (value == 2)
                        return "<span style='color: blue'>一次性交通补贴</span>";
                    if (value == 3)
                        return "<span style='color: red'>不予兑现</span>";
                }
            },
            {title: '兑现月份', field: 'months', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
            {title: '兑现金额', field: 'money', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px"},
            {title: '金额说明', field: 'moneyDesc', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px"},
        ]];
}

TalentAllowanceInfoSupple.createColOneAndTwoIC = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '年度', field: 'year', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "60px"},
        {title: '医院名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
        {title: '所属镇街', field: 'addressName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px"},
        {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
        {title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "60px",
            formatter(value, row, index) {
                if (value == 1) {
                    return "男";
                }
                if (value == 2) {
                    return "女";
                }
            }
        },
        {title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
        {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
        {title: '认定条件', field: 'identifyConditionText', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
        {title: '认定条件证书取得时间', field: 'identifyGetTime', visible: true, align: 'center', valign: 'middle', width: "130px"},
        {title: '认定条件名称', field: 'identifyConditionName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
        {title: '公布入选月份', field: 'identifyMonth', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
        {title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px",
            formatter(value, row, index) {
                if (value == -1) {
                    return "<span class='label label-warning-light'>审核不通过</span>";
                }
                if (value == 1) {
                    return "<span class='label'>待提交</span>"
                }
                if (value == 3) {
                    if (Feng.isNotEmptyStr(row.highProcess) && row.highProcess >= 1) {
                        return "<span class='label label-success'>重新提交</span>";
                    }
                    return "<span class='label'>待审核</span>"
                }
                if (value == 8) {
                    return "<span class='label label-danger'>已驳回</span>";
                }
                if (value == 9) {
                    return "<span class='label label-danger'>上级驳回至分院</span>";
                }
                if (value == 10) {
                    return "<span class='label label-success'>上级驳回，待重新审核</span>";
                }
                if (value == 30 && row.publicState == 5) {
                    return "<span class='label label-primary'>已通过</span>";
                }
                return "<span class='label label-success'>待上级审核</span>";
            }
        },
        {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
            formatter: function (value, row, index) {
                return "<span class='label label-success' onclick=\"TalentAllowanceInfoSupple.showLog('" + value + "')\" >" +
                        "<i class=\"fa fa-book\"></i>日志" +
                        "</span>";
            }
        }
    ];
}


/**
 * 显示审核日志
 */
TalentAllowanceInfoSupple.showLog = function (id) {
    layer.open({
        type: 1,
        title: "日志",
        fixed: false,
        content: '<table id="' + id + '"></table>',
        area: ['80%', '80%'],
        maxmin: true,
        success: function (layero, index) {
            Feng.getCheckLog(id, {"type": CONFIG.project_jbt, "mainId": id, "typeFileId": "", "active": 1})
        }
    });
}

//全选
TalentAllowanceInfoSupple.checkAll = function (id) {
    $("#" + id + " input").each(function () {
        $(this).iCheck("check");
    })
}
//反选
TalentAllowanceInfoSupple.unCheckAll = function (id) {
    $("#" + id + " input").each(function () {
        if (this.checked) {
            $(this).iCheck("uncheck");
        } else {
            $(this).iCheck("check");
        }
    })
}

TalentAllowanceInfoSupple.initICheck = function () {
    $('.icheckbox').iCheck({
        labelHover: false,
        cursor: true,
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-greene',
        increaseArea: '20%'
    });
}