<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>科研管控平台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" th:href="@{/images/sf.ico}">
    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/css/layuimini.css}" media="all">
    <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
    <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
    <style id="layuimini-bg-color">
    </style>
    <style>
        .layui-card {
            border: 1px solid #f2f2f2;
            border-radius: 5px;
        }

        /* 滚动条样式 */
        .table-container {
            height: 550px; /* 设置高度 */
            width: 97%; /* 设置宽度 */
            overflow-x: auto; /* 显示水平滚动条 */
            overflow-y: hidden; /* 隐藏垂直滚动条 */
        }

        .icon {
            margin-right: 10px;
            color: #1aa094;
        }

        .icon-cray {
            color: #ffb800 !important;
        }

        .icon-blue {
            color: #1e9fff !important;
        }

        .icon-tip {
            color: #ff5722 !important;
        }

        .layuimini-qiuck-module {
            text-align: center;
            margin-top: 10px
        }

        .layuimini-qiuck-module a i {
            display: inline-block;
            width: 100%;
            height: 120px;
            line-height: 120px;
            text-align: center;
            border-radius: 2px;
            font-size: 30px;
            background-color: #F8F8F8;
            color: #333;
            transition: all .3s;
            -webkit-transition: all .3s;
        }

        .layuimini-qiuck-module a cite {
            position: relative;
            top: 2px;
            display: block;
            color: #666;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
            font-size: 14px;
        }

        .welcome-module {
            width: 100%;
            height:20%;
        }

        .panel {
            background-color: #fff;
            border: 1px solid transparent;
            border-radius: 3px;
            -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
            box-shadow: 0 1px 1px rgba(0, 0, 0, .05)
        }

        .panel-body {
            padding: 10px
        }

        .panel-title {
            margin-top: 0;
            margin-bottom: 0;
            font-size: 12px;
            color: inherit
        }

        .label {
            display: inline;
            padding: .2em .6em .3em;
            font-size: 75%;
            font-weight: 700;
            line-height: 1;
            color: #fff;
            text-align: center;
            white-space: nowrap;
            vertical-align: baseline;
            border-radius: .25em;
            margin-top: .3em;
        }

        .layui-red {
            color: red
        }

        .main_btn > p {
            height: 40px;
        }

        .layui-bg-number {
            background-color: #F8F8F8;
        }

        .layuimini-notice:hover {
            background: #f6f6f6;
        }

        .layuimini-notice {
            padding: 7px 16px;
            clear: both;
            font-size: 12px !important;
            cursor: pointer;
            position: relative;
            transition: background 0.2s ease-in-out;
        }

        .layuimini-notice-title, .layuimini-notice-label {
            padding-right: 70px !important;
            text-overflow: ellipsis !important;
            overflow: hidden !important;
            white-space: nowrap !important;
        }

        .layuimini-notice-title {
            line-height: 28px;
            font-size: 14px;
        }

        .layuimini-notice-extra {
            position: absolute;
            top: 50%;
            margin-top: -8px;
            right: 16px;
            display: inline-block;
            height: 16px;
            color: #999;
        }

        /*.lxfsImage {*/
        /*    background: url("[[@{/}]]images/lxfs.png") 0% 0% / cover no-repeat;*/
        /*    position: static;*/
        /*    width: 100%;*/
        /*    height: 126px;*/
        /*}*/
    </style>

</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md6" style="width: 80%">
                <div class="layui-row layui-col-space15">
                    <!--<div class="layui-col-md12" style="padding-bottom: 10px">
                        <div class="layui-card">
                            <div class="layui-card-header">
                                <i class="fa fa-credit-card icon icon-blue">
                                </i>项目管理
                            </div>
                            <div class="layui-card-body">
                                <div class="welcome-module">
                                    <div class="layui-row layui-col-space10 layuimini-qiuck">
                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a onclick=""
                                               data-title="项目可研报告" data-icon="fa fa-window-maximize">
                                                <i class="fa fa-window-maximize"></i>
                                                <cite>项目可研报告</cite>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;" layuimini-content-href="/prjProject/init_myProject"
                                               data-title="项目任务书" data-icon="fa fa-gears">
                                                <i class="fa fa-gears"></i>
                                                <cite>任务书</cite>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;"
                                               layuimini-content-href="/staBudgetapproval/init_apply" data-title="年度预算"
                                               data-icon="fa fa-jpy">
                                                <i class="fa fa-jpy"></i>
                                                <cite>年度预算</cite>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;" layuimini-content-href="/prjApproverecord/inits"
                                               data-title="费用申请" data-icon="fa fa-check-square-o">
                                                <i class="fa fa-check-square-o"></i>
                                                <cite>费用申请</cite>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;" layuimini-content-href="/prjApproverecord/inits"
                                               data-title="备用金" data-icon="fa fa-check-square-o">
                                                <i class="fa fa-check-square-o"></i>
                                                <cite>备用金</cite>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;" layuimini-content-href="/prjApproverecord/inits"
                                               data-title="报账" data-icon="fa fa-check-square-o">
                                                <i class="fa fa-check-square-o"></i>
                                                <cite>报账</cite>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;" layuimini-content-href="/prjApproverecord/inits"
                                               data-title="付款申请" data-icon="fa fa-check-square-o">
                                                <i class="fa fa-check-square-o"></i>
                                                <cite>付款申请</cite>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;" layuimini-content-href="/prjApproverecord/inits"
                                               data-title="合同" data-icon="fa fa-check-square-o">
                                                <i class="fa fa-check-square-o"></i>
                                                <cite>合同</cite>
                                            </a>
                                        </div>
&lt;!&ndash;                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;" layuimini-content-href="/prjApproverecord/inits"
                                               data-title="待审批" data-icon="fa fa-check-square-o">
                                                <i class="fa fa-check-square-o"></i>
                                                <cite>待审批</cite>
                                            </a>
                                        </div>&ndash;&gt;
&lt;!&ndash;
                                        <div class="layui-col-xs3 layuimini-qiuck-module">
                                            <a href="javascript:;" layuimini-content-href="/prjApproverecord/init"
                                               data-title="待审批" data-icon="fa fa-check-square-o">
                                                <i class="fa fa-check-square-o"></i>
                                                <cite>待审批</cite>
                                            </a>
                                        </div>&ndash;&gt;
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>-->
                    <div class="layui-col-md12">
                        <div class="layui-card">
                            <div class="layui-card-header">
                                <div style="float: left">
                                    <i class="fa fa-bullhorn icon icon-tip"></i>待审核
                                </div>
                                <div style="float: right">
                                    <a href="#">更多...</a>
                                </div>
                            </div>
                            <div class="layui-card-body layui-text table-container" style="height: 90%;width: 95%">
                                <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-md6" style="width: 20%">
                <div class="layui-card">
                    <div class="layui-card-header">
                        <div style="float: left">
                            <i class="fa fa-bullhorn icon icon-tip"></i>系统公告
                        </div>
                        <div style="float: right;">
                            <a href="#">更多...</a>
                        </div>
                    </div>
                    <div class="layui-card-body layui-text" style="height: 500px">
                        <!--<div class="layuimini-notice">
                            <div class="layuimini-notice-title">修改选项卡样式</div>
                            <div class="layuimini-notice-extra">2023-03-11 23:06</div>
                            <div class="layuimini-notice-content layui-hide">
                                界面足够简洁清爽。<br>
                                一个接口几行代码而已直接初始化整个框架，无需复杂操作。<br>
                                支持多tab，可以打开多窗口。<br>
                                支持无限级菜单和对font-awesome图标库的完美支持。<br>
                                失效以及报错菜单无法直接打开，并给出弹出层提示完美的线上用户体验。<br>
                                url地址hash定位，可以清楚看到当前tab的地址信息。<br>
                                刷新页面会保留当前的窗口，并且会定位当前窗口对应左侧菜单栏。<br>
                                移动端的友好支持。<br>
                            </div>
                        </div>-->
                    </div>
                </div>

                <div class="layui-card">
                    <div class="layui-card-header"><i class="fa fa-fire icon"></i>联系方式</div>
                    <div class="layui-card-body layui-text" style="text-align: center; height: 138px">
                        <!--                        <div class="lxfsImage" />-->
                        <img style="width: 100%; height: auto; align-items: center" th:src="@{/images/lxfs.png}"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="view">
            <i class="layui-icon layui-icon-file" style="font-size: 10px;"></i>查看
        </button>
        <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="spOption">
            <i class="layui-icon layui-icon-edit" style="font-size: 10px;"></i>审核
        </button>
        <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="spList">
            <i class="layui-icon layui-icon-list" style="font-size: 10px;"></i>审批列表
        </button>
        <!--                <button class="layui-btn layui-btn-sm" lay-event="exportList">-->
        <!--                    <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>导出列表-->
        <!--                </button>-->
    </div>
</script>
<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
<script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
<script th:inline="javascript" type="text/javascript">
    AjaxUtil.ctx = /*[[@{/}]]*/'';
    var xmApproval = {};
    layui.use(['layer', 'table', 'miniTab'], function () {
        var $ = layui.jquery,
            table = layui.table,
            miniTab = layui.miniTab,
            layer = layui.layer;

        miniTab.listen();

        var currTable = table.render({
            elem: '#currentTableId',
            url: AjaxUtil.ctx + 'prjApproverecord/list?zt=未提交(返回)',
            method: 'post',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print'],
            cols: [
                [
                    {type: "radio", fixed: 'left',title: '😊'},
                    {type: 'numbers', align: 'center',title: '序号'},
                    {field: 'spzt', width: '15%', title: '审批状态'},
                    {field: 'xmlxmc', width: '10%', title: '类型'},
                    {field: 'xm', width: '35%', title: '项目/申请'},
                    {field: 'erpbh',width: '10%',title: 'ERP编号'},
                    // {field: 'zt', width: '12%',title: '状态', sort: true},
                    {field: 'tjrxm', width: '8%', title: '提交人', align: 'center'},
                    {field: 'tjsj', width: '20%', title: '提交时间', align: 'center'},
                ]
            ],
            sortName: 'xm',
            autoSort: false,
            limits: [15, 30, 45, 60, 100],
            limit: 15,
            page: true,
            skin: 'grid',
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.rows //解析数据列表
                };
            },
            done: function (res, curr, count) { // done为数据渲染完的回调
                // 测试打印出后端返回的权限列表
                // let permissionSet = [[${permissionSet}]];
                // console.log(JSON.stringify(permissionSet));
            }
        });
        //双击
        table.on('rowDouble(currentTableFilter)', function (obj) {
            var data = obj.data;
            xmApproval = {
                "xmid": data.xmid,
                "xm": data.xm
            };

            var content = AjaxUtil.ctx;
            if (data.tablename == 'sta_FeasibilityReport')//可研报告
                content += 'reportinfo';
            else if (data.tablename == 'prj_Project') //任务书
                content += 'prjProject';
            else if (data.tablename == 'prj_AnnualBudget') //年度预算
                content += 'prjAnnualbudget';
            else if (data.tablename == 'sta_BudgetApproval') //费用申请
                content += 'staBudgetapproval';
            else if (data.tablename == 'sta_Reimbursement') //报账列表
                content += 'staReimbursement';
            else if (data.tablename == 'sta_PayApproval') //付款申请
                content += 'staPayapproval';
            else if (data.tablename == 'prj_ProjectRecord')
                content += 'prjBudgetRecord';
            else if (data.tablename == 'prj_AnnualBudgetRecord')
                content += 'PrjAnnualBudgetRecord';
            else if (data.tablename == 'prj_Contract')
                content += 'prjContract';
            content += '/forApproveList?mc=' + data.xm;

            var index = layer.open({
                title: '审批列表',
                type: 2,
                shade: 0.3,
                maxmin: true,
                shadeClose: true,
                area: ['1300px', '750px'],
                content: content,
                end: function () {
                    layer.close(index);
                }
            });
        });
        // 监听行工具事件
        table.on('toolbar(currentTableFilter)', function (obj) {
            if (obj.event == 'view') {
                var projects = table.cache["currentTableId"];
                if (projects.length == 0)
                    return;

                var checkStatus = table.checkStatus('currentTableId')
                    , data = checkStatus.data;
                if (data == null || data.length === 0) {
                    Message.warning("请选择要查看的记录！", 1500);
                } else if (data.length > 1) {
                    Message.warning("请选择一条记录进行查看！", 1500);
                } else {
                    var height = 1090;
                    var title = '查看' + data[0].xmlxmc;
                    var content = AjaxUtil.ctx;
                    if (data[0].tablename == 'sta_FeasibilityReport')
                        content += 'reportinfo/forView/' + data[0].xmid;
                    else if (data[0].tablename == 'prj_Project')
                        content += 'prjProject/forView/' + data[0].xmid;
                    else if (data[0].tablename == 'prj_AnnualBudget') {
                        height = 1015;
                        content += 'prjAnnualbudget/forView/' + data[0].xmid
                    } else if (data[0].tablename == 'sta_BudgetApproval') {
                        height = 1020;
                        content += 'staBudgetapproval/forApplyView/' + data[0].xmid
                    } else if (data[0].tablename == 'sta_Reimbursement') {
                        width = 970;
                        height = 1020;
                        content += 'staReimbursement/forView/' + data[0].xmid
                    } else if (data[0].tablename == 'sta_PayApproval') {
                        width = 750;
                        height = 950;
                        content += 'staPayapproval/forView/' + data[0].xmid
                    }else if (data[0].tablename == 'prj_AnnualBudgetRecord') {
                        height = 1015;
                        content += 'PrjAnnualBudgetRecord/forView/' + data[0].xmid
                    }else if (data[0].tablename == 'prj_ProjectRecord'){
                        content += 'prjBudgetRecord/forView/' + data[0].xmid
                    }else if (data[0].tablename == 'prj_Contract'){
                        content += 'prjContractXg/forView/' + data[0].xmid
                    }
                    layer.open({
                        title: title,
                        type: 2,
                        shade: 0.3,
                        maxmin: true,
                        shadeClose: true,
                        area: [height + 'px', layerheight + 'px'],
                        content: content,
                        end: function (index) {
                            layer.close(index);
                        }
                    });
                }
            } else if (obj.event === 'spOption') {
                var projects = table.cache["currentTableId"];
                if (projects.length == 0)
                    return;

                var checkStatus = table.checkStatus('currentTableId')
                    , data = checkStatus.data;
                if (data == null || data.length === 0) {
                } else if (data.length > 1) {
                    for (var index in data) {
                        if(data[index].spzt=='主管院领导审批'||data[index].spzt == '院长审批'){
                            bathSP(data[index])
                                layer.alert('操作成功', {
                                    time: 5 * 1000,
                                    success: function (layero, index) {
                                        var timeNum = this.time / 1000, setText = function (start) {
                                            layer.title('<span class="layui-font-red">' + (start ? timeNum : --timeNum) + '</span> 秒后自动关闭', index);
                                        };
                                        setText(!0);
                                        this.timer = setInterval(setText, 1000);
                                        if (timeNum <= 0) clearInterval(this.timer);
                                    },
                                    end: function () {
                                        currTable.reload();
                                        clearInterval(this.timer);
                                    }
                                });
                        }else {
                            Message.warning("请选择一条记录进行审批！", 1500);

                        }
                    }

                } else {
                    var content = oneSP(data)
                    layer.open({
                        title: '审批意见',
                        type: 2,
                        shade: 0.3,
                        maxmin: true,
                        shadeClose: true,
                        area: ['1025px', layerheight + 'px'],
                        content: content,
                        end: function () {
                            if (updateflag == 1)
                                currTable.reload();
                            updateflag = 0;
                        }
                    });
                }
            } else if (obj.event === 'spList') {
                var projects = table.cache["currentTableId"];
                if (projects.length == 0)
                    return;

                var checkStatus = table.checkStatus('currentTableId')
                    , data = checkStatus.data;
                if (data == null || data.length === 0) {
                    Message.warning("请选择要查看的记录！", 1500);
                } else if (data.length > 1) {
                    Message.warning("请选择一条记录进行查看！", 1500);
                } else {
                    xmApproval = {
                        "xmid": data[0].xmid,
                        "xm": data[0].xm
                    };

                    var content = AjaxUtil.ctx;
                    if (data[0].tablename == 'sta_FeasibilityReport')
                        content += 'reportinfo';
                    else if (data[0].tablename == 'prj_Project')
                        content += 'prjProject';
                    else if (data[0].tablename == 'prj_ProjectRecord')
                        content += 'prjBudgetRecord';
                    else if (data[0].tablename == 'prj_AnnualBudget')
                        content += 'prjAnnualbudget';
                    else if (data[0].tablename == 'sta_BudgetApproval')
                        content += 'staBudgetapproval';
                    else if (data[0].tablename == 'sta_Reimbursement')
                        content += 'staReimbursement';
                    else if (data[0].tablename == 'prj_AnnualBudgetRecord')
                        content += 'PrjAnnualBudgetRecord';
                    else if (data[0].tablename == 'sta_PayApproval')
                        content += 'staPayapproval';
                    else if (data[0].tablename == 'prj_Contract')
                        content += 'prjContract';
                    content += '/forApproveList?mc=' + data[0].xm;

                    var index = layer.open({
                        title: '审批列表',
                        type: 2,
                        shade: 0.3,
                        maxmin: true,
                        shadeClose: true,
                        area: ['1300px', '750px'],
                        content: content,
                        end: function () {
                            layer.close(index);
                        }
                    });
                }
            }
        });

        /**
         * 查看公告信息
         **/
        $('body').on('click', '.layuimini-notice', function () {
            var title = $(this).children('.layuimini-notice-title').text(),
                noticeTime = $(this).children('.layuimini-notice-extra').text(),
                content = $(this).children('.layuimini-notice-content').html();
            var html = '<div style="padding:15px 20px; text-align:justify; line-height: 22px;border-bottom:1px solid #e2e2e2;background-color: #2f4056;color: #ffffff">\n' +
                '<div style="text-align: center;margin-bottom: 20px;font-weight: bold;border-bottom:1px solid #718fb5;padding-bottom: 5px"><h4 class="text-danger">' + title + '</h4></div>\n' +
                '<div style="font-size: 12px">' + content + '</div>\n' +
                '</div>\n';
            parent.layer.open({
                type: 1,
                title: '系统公告' + '<span style="float: right;right: 1px;font-size: 12px;color: #b1b3b9;margin-top: 1px">' + noticeTime + '</span>',
                area: '300px;',
                shade: 0.8,
                id: 'layuimini-notice',
                btn: ['查看', '取消'],
                btnAlign: 'c',
                moveType: 1,
                content: html,
                success: function (layero) {
                    var btn = layero.find('.layui-layer-btn');
                    // btn.find('.layui-layer-btn0').attr({
                    //     href: 'https://gitee.com/zhongshaofa/layuimini',
                    //     target: '_blank'
                    // });
                }
            });
        });
        // echarts 窗口缩放自适应
        // window.onresize = function(){
        //     echartsRecords.resize();
        // }
    });

    function getXmApproval() {
        return xmApproval;
    }
    function oneSP(data) {
        var content = AjaxUtil.ctx;
        if (data[0].tablename == 'sta_FeasibilityReport') {
            xmApproval = {
                "xmid": data[0].xmid,
                "xm": data[0].xm,
                "ysje": data[0].kysje
            };
            content += 'reportinfo/forApproveUpdate/' + data[0].xmid + '/' + data[0].kysje + '?spzt=' + data[0].spzt;
        } else if (data[0].tablename == 'prj_Project') {
            xmApproval = {
                "xmid": data[0].xmid,
                "xm": data[0].xm,
                "ysje": data[0].rysje
            };
            content += 'prjProject/forApproveUpdate/' + data[0].xmid + '/' + data[0].rysje + '?spzt=' + data[0].spzt;
        }else if (data[0].tablename == 'prj_ProjectRecord') {
            xmApproval = {
                "xmid": data[0].xmid,
                "xm": data[0].xm,
                "ysje": data[0].rysje
            };
            content += 'prjBudgetRecord/forApproveUpdate/' + data[0].xmid + '/' + data[0].rysje + '?spzt=' + data[0].spzt;
        }  else if (data[0].tablename == 'prj_AnnualBudget') {
            xmApproval = {
                "xmid": data[0].xmid,
                "xm": data[0].xm,
                "xmzys": data[0].xmzys
            };
            content += 'prjAnnualbudget/forApproveUpdate/' + data[0].xmid + '?spzt=' + data[0].spzt;
        }  else if (data[0].tablename == 'prj_AnnualBudgetRecord') {
            xmApproval = {
                "xmid": data[0].xmid,
                "xm": data[0].xm,
                "xmzys": data[0].xmzys
            };
            content += 'PrjAnnualBudgetRecord/forApproveUpdate/' + data[0].xmid + '?spzt=' + data[0].spzt;
        }  else if (data[0].tablename == 'sta_BudgetApproval') {
            xmApproval = {
                "xmid": data[0].xmid,
                "xm": data[0].xm,
                "zt": data[0].spzt,
                "sqje": data[0].sqje
            };
            content += 'staBudgetapproval/forApproveUpdate/' + data[0].xmid + '/' + data[0].sqje + '?spzt=' + data[0].spzt+'&fymc='+data[0].fylbmc;
        } else if (data[0].tablename == 'sta_Reimbursement') {
            xmApproval = {
                "xmid": data[0].xmid,
                "xm": data[0].xm,
                "zt": data[0].spzt,
                "bzje": data[0].bzje
            };
            content += 'staReimbursement/forApproveUpdate/' + data[0].xmid + '/' + data[0].bzje + '?spzt=' + data[0].spzt;
        } else if (data[0].tablename == 'sta_PayApproval') {
            xmApproval = {
                "xmid": data[0].xmid,
                "xm": data[0].xm,
                "zt": data[0].spzt,
                "htje": data[0].htje
            };
            content += 'staPayapproval/forApproveUpdate/' + data[0].xmid + '/' + data[0].htje + '?spzt=' + data[0].spzt;
        }else if (data[0].tablename == 'prj_Contract') {
            xmApproval = {
                "xmid": data[0].xmid,
                "xm": data[0].xm,
                "zt": data[0].spzt,
                "htje": data[0].htje
            };
            content += 'prjContract/forApproveUpdate/' + data[0].xmid + '?spzt=' + data[0].spzt;
        }
        return content;
    }
    function bathSP(data) {
        if (data.tablename == 'sta_FeasibilityReport') {
            var xmApprovalBath = {
                "xmid": data.xmid,
                "xm": data.xm,
                "ysje": data.kysje
            };
            AjaxUtil.get({
                url: AjaxUtil.ctx + 'reportinfo/forApproveUpdate/' + data.xmid + '/' + data.kysje + '?spzt=' + data.spzt,
                data: data.field,
                success: function (res) {
                    console.log(res);
                    AjaxUtil.post({
                        url: AjaxUtil.ctx + "prjApproverecord/doUpdateApprove",
                        data: res.data.field,
                        success: function (res) {
                            //更新审批状态
                            var project = {
                                "id": xmApprovalBath.xmid,
                                "spzt": '审批结束'
                            }
                            AjaxUtil.post({
                                url: AjaxUtil.ctx + "reportinfo/updateSpzt",
                                contentType: "application/json",
                                data: JSON.stringify(project),
                                success: function (res) {
                                    return true;
                                },
                                error: function (error) {
                                }
                            });
                        },
                        error: function (error) {
                        }
                    });
                },
                error: function (error) {
                }
            });


        } else if (data.tablename == 'prj_Project') {
            var xmApprovalBath = {
                "xmid": data.xmid,
                "xm": data.xm,
                "ysje": data.rysje
            };
            AjaxUtil.get({
                url: AjaxUtil.ctx + 'prjProject/bathUpdate/' + data.xmid + '/' + data.rysje + '?spzt=' + data.spzt,
                data: data.field,
                success: function (res) {
                    console.log(res);
                    AjaxUtil.post({
                        url: AjaxUtil.ctx + "prjApproverecord/doUpdateApprove",
                        data: res.approveInfo,
                        success: function (res) {
                            //更新审批状态
                            var project = {
                                "id": xmApprovalBath.xmid,
                                "spzt": '审批结束'
                            }
                            AjaxUtil.post({
                                url: AjaxUtil.ctx + "prjProject/updateSpzt",
                                contentType: "application/json",
                                data: JSON.stringify(project),
                                success: function (res) {
                                    return true;
                                },
                                error: function (error) {
                                }
                            });
                        },
                        error: function (error) {
                        }
                    });
                },
                error: function (error) {
                }
            });
        } else if (data.tablename == 'prj_ProjectRecord') {
            var xmApprovalBath = {
                "xmid": data.xmid,
                "xm": data.xm,
                "ysje": data.rysje
            };
            AjaxUtil.get({
                url: AjaxUtil.ctx + 'prjProject/bathUpdate/' + data.xmid + '/' + data.rysje + '?spzt=' + data.spzt,
                data: data.field,
                success: function (res) {
                    console.log(res);
                    AjaxUtil.post({
                        url: AjaxUtil.ctx + "prjApproverecord/doUpdateApprove",
                        data: res.approveInfo,
                        success: function (res) {
                            //更新审批状态
                            var project = {
                                "id": xmApprovalBath.xmid,
                                "spzt": '审批结束'
                            }
                        },
                        error: function (error) {
                        }
                    });
                },
                error: function (error) {
                }
            });
        } else if (data.tablename == 'prj_AnnualBudget') {
            var xmApprovalBath = {
                "xmid": data.xmid,
                "xm": data.xm,
                "xmzys": data.xmzys
            };
            AjaxUtil.get({
                url: AjaxUtil.ctx + 'prjAnnualbudget/bathUpdate/' + data.xmid + '?spzt=' + data.spzt,
                data: data.field,
                success: function (res) {
                    console.log(res);
                    AjaxUtil.post({
                        url: AjaxUtil.ctx + "prjApproverecord/doUpdateApprove",
                        data: res.approveInfo,
                        success: function (res) {
                            //更新审批状态
                            var project = {
                                "id": xmApprovalBath.xmid,
                                "spzt": '审批结束'
                            }
                            AjaxUtil.post({
                                url: AjaxUtil.ctx + "prjAnnualbudget/updateSpzt",
                                contentType: "application/json",
                                data: JSON.stringify(project),
                                success: function (res) {
                                    return true;
                                },
                                error: function (error) {
                                }
                            });
                        },
                        error: function (error) {
                        }
                    });
                },
                error: function (error) {
                }
            });
        }else if (data.tablename == 'prj_AnnualBudgetRecord') {
            var xmApprovalBath = {
                "xmid": data.xmid,
                "xm": data.xm,
                "xmzys": data.xmzys
            };
            //修改审批记录表
            AjaxUtil.post({
                url: AjaxUtil.ctx + "prjApproverecord/doUpdateApprove",
                data: res.approveInfo,
                success: function (res) {

                    var project = {
                        "id": xmApprovalBath.xmid,
                        "spzt": '审批结束'
                    }
                    //修改年度预算明细表
                },
                error: function (error) {
                }
            });
        } else if (data.tablename == 'sta_BudgetApproval') {
            var xmApprovalBath = {
                "xmid": data.xmid,
                "xm": data.xm,
                "zt": data.spzt,
                "sqje": data.sqje
            };
            AjaxUtil.get({
                url: AjaxUtil.ctx + 'staBudgetapproval/bathUpdate/' + data.xmid + '/' + data.rysje + '?spzt=' + data.spzt,
                data: data.field,
                success: function (bathUpdateRes) {
                    console.log(bathUpdateRes.approveInfo);
                    AjaxUtil.post({
                        url: AjaxUtil.ctx + "prjApproverecord/doUpdateApproveFysq",
                        data: bathUpdateRes.approveInfo,
                        success: function (res) {
                            console.log(res);
                            //更新审批状态
                            var project = {
                                "id": xmApprovalBath.xmid,
                                "spzt": '',
                                "sqje": xmApprovalBath.sqje,
                                "operations":"bathsp"
                            }
                            if (bathUpdateRes.approveInfo.spcz == '返回修改') {
                                project.spzt = '未提交(返回)';
                            } else if (bathUpdateRes.approveInfo.zt == '部门主任审批') {
                                project.spzt = '科技项目管理专责审批';
                            } else if (bathUpdateRes.approveInfo.zt == '科技项目管理专责审批') {
                                project.spzt = '科技部部门主任审批';
                            } else if (bathUpdateRes.approveInfo.zt == '科技部部门主任审批') {
                                project.spzt = '主管院领导审批';
                            } else if (bathUpdateRes.approveInfo.zt == '主管院领导审批') {
                                if (xmApprovalBath.sqje < 1000000) {
                                    project.spzt = '审批结束';
                                } else {
                                    project.spzt = '院长审批';
                                }
                            } else if (bathUpdateRes.approveInfo.zt === '院长审批') {
                                project.spzt = '审批结束';
                            }
                            AjaxUtil.post({
                                url: AjaxUtil.ctx + "staBudgetapproval/updateSpzt",
                                contentType: "application/json",
                                data: JSON.stringify(project),
                                success: function (res) {

                                },
                                error: function (error) {
                                }
                            });
                        },
                        error: function (error) {
                        }
                    });
                },
                error: function (error) {
                }
            });
        } else if (data.tablename == 'sta_Reimbursement') {
            var xmApprovalBath = {
                "xmid": data.xmid,
                "xm": data.xm,
                "zt": data.spzt,
                "bzje": data.bzje
            };
            AjaxUtil.get({
                url: AjaxUtil.ctx + 'staReimbursement/bathUpdate/' + data.xmid + '/' + data.bzje + '?spzt=' + data.spzt,
                data: data.field,
                success: function (bathUpdateRes) {
                    console.log(bathUpdateRes.approveInfo);
                    AjaxUtil.post({
                        url: AjaxUtil.ctx + "prjApproverecord/doUpdateApprove",
                        data: bathUpdateRes.approveInfo,
                        success: function (res) {
                            //更新审批状态
                            var project = {
                                "id": xmApprovalBath.xmid,
                                "spzt": '审批结束'
                            }
                            AjaxUtil.post({
                                url: AjaxUtil.ctx + "staReimbursement/updateSpzt",
                                contentType: "application/json",
                                data: JSON.stringify(project),
                                success: function (res) {
                                    return true;
                                },
                                error: function (error) {
                                }
                            });
                        },
                        error: function (error) {
                        }
                    });
                },
                error: function (error) {
                }
            });
        } else if (data.tablename == 'sta_PayApproval') {
            var xmApprovalBath = {
                "xmid": data.xmid,
                "xm": data.xm,
                "zt": data.spzt,
                "htje": data.htje
            };
            AjaxUtil.get({
                url: AjaxUtil.ctx + 'staPayapproval/bathUpdate/' + data.xmid + '/' + data.htje + '?spzt=' + data.spzt,
                data: data.field,
                success: function (bathUpdateRes) {
                    console.log(bathUpdateRes.approveInfo);
                    AjaxUtil.post({
                        url: AjaxUtil.ctx + "prjApproverecord/doUpdateApproveFksq",
                        data: bathUpdateRes.approveInfo,
                        success: function (res) {
                            if (res.code == 0) {
                                //更新审批状态
                                var project = {
                                    "id": xmApprovalBath.xmid,
                                    "spzt": ''
                                }
                                if (bathUpdateRes.approveInfo.spcz == '返回修改') {
                                    project.spzt = '未提交(返回)';
                                } else if (bathUpdateRes.approveInfo.zt == '科技项目管理专责2审批') {
                                    project.spzt = '科技部部门主任审批';
                                } else if (bathUpdateRes.approveInfo.zt === '科技部部门主任审批') {
                                    project.spzt = '审批结束';
                                }

                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staPayapproval/updateSpzt",
                                    contentType: "application/json",
                                    data: JSON.stringify(project),
                                    success: function (res) {
                                        return true;
                                    },
                                    error: function (error) {
                                    }
                                });
                            }
                        },
                        error: function (error) {
                        }
                    });
                },
                error: function (error) {
                }
            });
        }
    }

    function setUpdateFlag() {
        updateflag = 1;
    }

    function getXmApproval() {
        return xmApproval;
    }
</script>
</body>
</html>
