<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>新建</title>
    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.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>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<form class="layui-form" action="" lay-filter="formDemo">
    <div class="layui-tab layui-tab-card">
        <ul class="layui-tab-title">
            <li class="layui-this">常规</li>
            <li>其它信息</li>
        </ul>
        <div class="layui-tab-content">
            <!--常规开始-->
            <div class="layui-tab-item layui-show" style="min-height: 550px">
                <div class="layui-form" action="" lay-filter="formDemo">
                    <div class="layui-form layuimini-form" style="padding-bottom: 100px">
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label" style="width: 75px">申请名称</label>
                            <div class="layui-input-inline" style="width: 855px">
                                <input type="hidden" id="id" name="id" class="layui-input">
                                <input type="text" id="sqmc" name="sqmc" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label required" style="width: 75px">项目名称</label>
                            <div class="layui-input-inline" style="width: 855px">
                                <input type="hidden" id="ysid" name="ysid" class="layui-input"
                                       th:value="${annualbudget.id}">
                                <input type="hidden" id="xmid" name="xmid" class="layui-input"
                                       th:value="${annualbudget.rws}">
                                <input type="text" id="xmmc" name="xmmc" class="layui-input"
                                       th:value="${annualbudget.rwsmc}" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label" style="width: 75px">编号</label>
                            <div class="layui-input-inline" style="width: 380px">
                                <input type="text" id="bh" name="bh" class="layui-input" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label" style="width: 75px">年份</label>
                            <div class="layui-input-inline" style="width: 380px">
                                <input type="number" id="nf" name="nf" class="layui-input" th:value="${annualbudget.nf}"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline"
                             style="width: 453px; margin-left: 10px; position: absolute; z-index: 2">
                            <table class="layui-hide" id="currentTableId_tj" name="currentTableId_tj"
                                   lay-filter="currentTableFilter_tj" style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label required" style="width: 75px">费用类别</label>
                            <div class="layui-input-inline" style="width: 380px">
                                <input type="hidden" id="fjmc" name="fjmc" class="layui-input">
                                <input type="hidden" id="fylb" name="fylb" class="layui-input">
                                <input type="text" id="fylbmc" name="fylbmc" lay-verify="required"
                                       lay-reqtext="费用类别不能为空" class="layui-input" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="display: none" id="fyxxDiv">
                            <label class="layui-form-label" style="width: 75px">费用小项</label>
                            <input type="hidden" id="bz" name="bz" class="layui-input">
                            <div class="layui-input-inline" style="width: 380px; display: none" id="zlysDiv">
                                <select name="bz1" id="bz1" lay-filter="bz1">
                                    <option value="资料费">资料费</option>
                                    <option value="印刷费">印刷费</option>
                                    <option value="知识产权费">知识产权费</option>
                                </select>
                            </div>
                            <div class="layui-input-inline" style="width: 380px; display: none" id="hyclDiv">
                                <select name="bz2" id="bz2" lay-filter="bz2">
                                    <option value="会议费">会议费</option>
                                    <option value="差旅费">差旅费</option>
                                    <!--                                    <option value="国际合作交流费">国际合作交流费</option>-->
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label required"
                                   style="width: 80px; margin-left: -5px">申请金额(元)</label>
                            <div class="layui-input-inline" style="width: 380px">
                                <input type="number" id="sqje" name="sqje" class="layui-input" lay-verify="required"
                                       lay-reqtext="申请金额不能为空" autocomplete="off">
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="clfDiv">
                            <label class="layui-form-label  required" style="width: 75px">差旅费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAdd"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEdit"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subView"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDelete"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId1" name="currentTableId1"
                                       lay-filter="currentTableFilter1"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="hyfDiv">
                            <label class="layui-form-label  required" style="width: 75px">会议费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAddhyf"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEdithyf"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subViewhyf"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDeletehyf"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Hyf" name="currentTableId_Hyf"
                                       lay-filter="currentTableFilter_Hyf"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="zlfDiv">
                            <label class="layui-form-label  required" style="width: 75px">资料费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAddzlf"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEditzlf"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subViewzlf"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDeletezlf"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Zlf" name="currentTableId_Zlf"
                                       lay-filter="currentTableFilter_Zlf"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="zsccDiv">
                            <label class="layui-form-label  required" style="width: 75px">知识产权费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAddzscc"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEditzscc"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subViewzscc"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDeletezscc"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Zscc" name="currentTableId_Zscc"
                                       lay-filter="currentTableFilter_Zscc"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="dyfDiv">
                            <label class="layui-form-label  required" style="width: 75px">印刷费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAdddyf"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEditdyf"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subViewdyf"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDeletedyf"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Dyf" name="currentTableId_Dyf"
                                       lay-filter="currentTableFilter_Dyf"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="jjfDiv">
                            <label class="layui-form-label  required" style="width: 75px">间接费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAddjjf"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEditjjf"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subViewjjf"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDeletejjf"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Jjf" name="currentTableId_Jjf"
                                       lay-filter="currentTableFilter_Jjf"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="zjfDiv">
                            <label class="layui-form-label  required" style="width: 75px">专家费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAddzjf"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEditzjf"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subViewzjf"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDeletezjf"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Zjf" name="currentTableId_Zjf"
                                       lay-filter="currentTableFilter_Zjf"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="lsryDiv">
                            <label class="layui-form-label  required" style="width: 75px">临时人员</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAdd3"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEdit3"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subView3"><i class="layui-icon">&#xe63c;</i>查看s
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDelete3"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId3" name="currentTableId3"
                                       lay-filter="currentTableFilter3"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="sbsyfDiv">
                            <label class="layui-form-label  required" style="width: 75px">仪器设备<br>使用费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAdd_Dev"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEdit_Dev"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subView_Dev"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDelete_Dev"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Dev" name="currentTableId_Dev"
                                       lay-filter="currentTableFilter_Dev"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="rjsyfDiv">
                            <label class="layui-form-label  required" style="width: 75px">软件使用费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAdd_Sw"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEdit_Sw"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subView_Sw"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDelete_Sw"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Sw" name="currentTableId_Sw"
                                       lay-filter="currentTableFilter_Sw"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="clfyDiv">
                            <label class="layui-form-label  required" style="width: 75px">材料费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAdd_Clf"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEdit_Clf"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subView_Clf"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDelete_Clf"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Clf" name="currentTableId_Clf"
                                       lay-filter="currentTableFilter_Clf"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="wwyjzcDiv">
                            <label class="layui-form-label  required" style="width: 75px">外委研究<br>支出费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAdd_Ww"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEdit_Ww"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subView_Ww"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDelete_Ww"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Ww" name="currentTableId_Ww"
                                       lay-filter="currentTableFilter_Ww"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="syyjgfDiv">
                            <label class="layui-form-label  required" style="width: 75px">外协测试试<br>验与加工费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subAdd_Wx"><i class="layui-icon"></i>新建
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subEdit_Wx"><i class="layui-icon"></i>编辑
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subView_Wx"><i class="layui-icon">&#xe63c;</i>查看
                                    </button>
                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                            lay-filter="subDelete_Wx"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId_Wx" name="currentTableId_Wx"
                                       lay-filter="currentTableFilter_Wx"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <!--                        <div class="layui-form-item layui-inline" style="width: 100%">-->
                        <!--                            <label class="layui-form-label" style="width: 75px">附件</label>-->
                        <!--                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">-->
                        <!--                                <input type="hidden" id="fj" name="fj" class="layui-input">-->
                        <!--                                <div class="layui-btn-group" style="margin-bottom: -8px">-->
                        <!--                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm upload" lay-filter="upLoad" lay-data="{fileType:'budget'}"><i class="layui-icon"></i>上传</button>-->
                        <!--                                    <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm" lay-filter="deleteFile"><i class="layui-icon"></i>删除</button>-->
                        <!--                                </div>-->
                        <!--                                <table class="layui-hide" id="currentTableId2" name="currentTableId2" lay-filter="currentTableFilter2" style="padding-top: 0px;margin-top: 0px"></table>-->
                        <!--                            </div>-->
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 75px">附件</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <input type="hidden" id="fj" name="fj" class="layui-input">
                                <div class="layui-btn-group" style="margin-bottom: -8px">
                                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm upload"
                                            lay-filter="upLoad" lay-data="{fileType:'budget'}"><i
                                            class="layui-icon"></i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm"
                                            lay-filter="deleteFile"><i class="layui-icon"></i>删除
                                    </button>
                                </div>
                                <table class="layui-hide" id="currentTableId2" name="currentTableId2"
                                       lay-filter="currentTableFilter2"
                                       style="padding-top: 0px;margin-top: 0px"></table>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 75px">申请说明</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div class="layui-input-inline" style="width: 930px">
                                <textarea id="sqsm" name="sqsm" class="layui-textarea"
                                          style="width: 855px;height: 20%"  placeholder="请输入申请说明......"></textarea>
                                </div>
                                <!-- 添加备注部分 -->
                                <div style="margin-top: 8px; color: #666666; font-family: Arial, sans-serif; line-height: 1.5;">
                                    <h3 style="color: #333333;">申请说明</h3>
                                    <p>除写明费用支出与项目研究内容的相关性外，还需明确以下细节：</p>

                                    <div style="margin-left: 20px;">
                                        <h4 style="color: #555555;">1）临时性研究人员人工费：</h4>
                                        <p>一个项目同一段时期，临时性研究人员原则上不超过3人，且聘用时间不超过3个月。费用申请中请明确聘用人员，聘用时间，具体从事的工作内容，需要的技能或学历等，确保工作量与时间、费用、能力相匹配。</p>

                                        <h4 style="color: #555555;">2）会议费：</h4>
                                        <p>申请中请明确会议内容、时间、参会人员等信息，费用按350元/人·天的标准进行总额控制，其中餐费按80元/人·天标准控制。请尽量减少陪会人员，缩小会议规模。</p>

                                        <h4 style="color: #555555;">3）差旅费：</h4>
                                        <p>申请中请明确出差人，出差时间，出差地点，出差事由。</p>

                                        <h4 style="color: #555555;">4）外委研究支出费：</h4>
                                        <p>请在招标之前先完成费用申请流程，标题为项目名称-外委研究内容具体标题。费用申请中请明确：</p>
                                        <ol>
                                            <li>外委研究/合作研究的类型，其中外委研究费用不超过项目组自控经费的30%；</li>
                                            <li>外委研究/合作研究的必要性；</li>
                                            <li>具体的研究内容；</li>
                                            <li>技术指标和具体参数；</li>
                                            <li>对方需提交的最终成果形式，如包含硬件或软件的，需明确是否需要对方提供第三方检测报告或实验室自行检测，且检测内容应明确；（提交的成果形式中若有硬件或软件的，应提供第三方检测报告；确无法提供第三方检测报告的，需明确要提供专家见证试验或现场测试报告）</li>
                                            <li>验收的标准；</li>
                                            <li>费用预估等内容。</li>
                                        </ol>

                                        <h4 style="color: #555555;">5）外协测试试验与加工：</h4>
                                        <p>申请中请明确外协的必要性、测试的具体内容、测试频次、测试参数、测试设备、样本类型、样本数量等测试要素的具体要求；明确外协单位的测试能力、资质水平的相关要求。</p>
                                    </div>
                                </div>


                            </div>
                        </div>


                    </div>

                </div>
                <!-- 右侧悬浮按钮 -->
                <div class="right-bottom-btn" id="btnContainer">
                    <button type="button" class="layui-btn" lay-filter="viewRwsBtn">
                        <i class="layui-icon layui-icon-file"></i>查看任务书
                    </button>
                    <button type="button" class="layui-btn" lay-filter="viewNdysBtn">
                        <i class="layui-icon layui-icon-file-b"></i>查看年度预算
                    </button>
                    <button type="button" class="layui-btn" lay-submit lay-filter="saveBtn">
                        <i class="layui-icon layui-icon-ok"></i>保存
                    </button>
                    <button class="layui-btn" lay-filter="cancleBtn">
                        <i class="layui-icon layui-icon-close"></i>取消
                    </button>
                </div>
            </div>

</div>
<!--常规结束-->
<!--其它信息开始-->
<div class="layui-tab-item" style="height: 550px">
    <form class="layui-form" action="" lay-filter="formDemo">
        <div class="layui-form layuimini-form" style="padding-bottom: 100px">
            <div class="layui-form-item layui-inline" style="width: 100%">
                <label class="layui-form-label" style="width: 85px">ERP编号</label>
                <div class="layui-input-inline" style="width: 845px">
                    <input type="text" id="erpbh" name="erpbh" class="layui-input" th:value="${annualbudget.erpbh}"
                           readonly>
                </div>
            </div>
            <div class="layui-form-item layui-inline" style="width: 100%">
                <label class="layui-form-label" style="width: 85px">项目类型</label>
                <div class="layui-input-inline" style="width: 845px">
                    <input type="hidden" id="xmlx" name="xmlx" class="layui-input" th:value="${annualbudget.xmlx}">
                    <input type="text" id="xmlxmc" name="xmlxmc" class="layui-input" th:value="${annualbudget.xmlxmc}"
                           readonly>
                </div>
            </div>
            <div class="layui-form-item layui-inline" style="width: 100%">
                <label class="layui-form-label" style="width: 85px">项目负责人</label>
                <div class="layui-input-inline" style="width: 845px">
                    <input type="hidden" id="xmfzr" name="xmfzr" class="layui-input" th:value="${annualbudget.xmfzr}">
                    <input type="text" id="xmfzrxm" name="xmfzrxm" class="layui-input"
                           th:value="${annualbudget.xmfzrxm}" readonly>
                </div>
            </div>
            <div class="layui-form-item layui-inline" style="width: 100%">
                <label class="layui-form-label" style="width: 85px">电科院负责人</label>
                <div class="layui-input-inline" style="width: 845px">
                    <input type="hidden" id="dkyfzr" name="dkyfzr" class="layui-input"
                           th:value="${annualbudget.dkyfzr}">
                    <input type="text" id="dkyfzrxm" name="dkyfzrxm" class="layui-input"
                           th:value="${annualbudget.dkyfzrxm}" readonly>
                </div>
            </div>
            <div class="layui-form-item layui-inline" style="width: 100%">
                <label class="layui-form-label" style="width: 85px">所属部门</label>
                <div class="layui-input-inline" style="width: 845px">
                    <input type="hidden" id="ssbm" name="ssbm" class="layui-input" th:value="${annualbudget.ssbm}">
                    <input type="text" id="ssbmmc" name="ssbmmc" class="layui-input" th:value="${annualbudget.ssbmmc}"
                           readonly>
                </div>
            </div>

            <!-- 右侧悬浮按钮 -->
            <div class="right-bottom-btn">
                <button class="layui-btn" lay-filter="cancleBtn">
                    <i class="layui-icon layui-icon-close"></i>关闭
                </button>
            </div>
        </div>
    </form>
</div>
<!--其它信息结束-->
</div>
</div>
</form>

<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="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>

<script type="text/javascript" th:inline="javascript">
    AjaxUtil.ctx = /*[[@{/}]]*/'';
    var travelExpense = [];//差旅费
    var updateflag = 0;//更新标志
    var tempMember = [];//临时人员
    var devExpense = [];//仪器、设备使用费
    var softExpense = [];//软件使用费
    var materialCost = [];//材料费
    var outExpense = [];//外委研究支出
    var outTesting = [];//外协测试试验与加工费
    var indirect = [];//间接费
    var expert = [];//专家费
    var meeting = [];//会议费
    var information = [];//资料费
    var intellectual = [];//知识产权费
    var println = [];//印刷费
    var flag = '未选';

    layui.use(['form', 'table', 'treeTable', 'layCascader', 'tableSelect', 'upload', 'element'], function () {
        var form = layui.form,
            table = layui.table,
            layer = layui.layer,
            tableSelect = layui.tableSelect,
            upload = layui.upload,
            element = layui.element;

        var fyId = -1;
        var xmId = $("#xmid").val();
        var ysId = $("#ysid").val();
        var nf   =$("#nf").val();
        var ysqjeOne = -1;
        var ybzjeOne = -1;

        var xmFyInfo = [[#{xmFyInfo}]];
        // 用于存放表格数据
        var dataTj = [
            {
                "km": "此科目年度预算",
                "ysje": '',
                "ysqje": '',
                "ybzje": ''
            },
            {
                "km": "项目年度经费",
                "ysje": [[${xmFyInfo.ysje}]],
                "ysqje": '',
                "ybzje": ''
            }
        ];
        //统计信息
        var currTable_tj = table.render({
            elem: '#currentTableId_tj',
            data: dataTj,
            cols: [
                [
                    {field: 'km', title: '', width: '30%'},
                    {field: 'ysje', title: '预算(万元)', width: '23%'},
                    {field: 'ysqje', title: '已申请(元)', width: '23%'},
                    {field: 'ybzje', title: '已报账(元)'}
                ]
            ]
        });

        //申请金额
        $("#sqje").blur(function (e) {
            //获取input输入的值
            var sqje = parseFloat(e.delegateTarget.value);
            if (!isNaN(sqje)) {
                var ysje = parseFloat(dataTj[0].ysje) * 10000;
                if ($("#fylbmc").val() != '' && isNaN(ysje)) {
                    Message.error("该费用类别没有预算!", 1500);
                    return false;
                } else {
                    var nysje = parseFloat(dataTj[1].ysje) * 10000;//年度预算金额
                    var ysqje = parseFloat(dataTj[0].ysqje);
                    var nysqje = parseFloat(dataTj[1].ysqje);
                    // if (sqje+nysqje > nysje) {
                    if (sqje > nysje) {
                        Message.error("费用申请的总金额，不能超过年度总预算!", 2000);
                        return false;
                    } else if (sqje > ysje) {
                        Message.error("该科目申请的费用金额，不能超过预算金额!", 2000);
                        return false;
                    }
                    // var sqls=parseFloat($("#sqje").val());//输入的值
                    if (ysqjeOne != -1) {
                        console.log(ysqjeOne);
                        dataTj[0].ysqje = parseFloat($("#sqje").val()) + ysqjeOne;//此科目已申请
                        if (ybzjeOne != -1) {
                            // dataTj[1].ysqje = dataTj[1].ysqje - parseFloat($("#sqje").val());//此科目已报账
                            dataTj[1].ysqje = dataTj[0].ysje * 10000- dataTj[0].ysqje
                        }
                    }
                    // dataTj[1].ysqje=nysje-sqls;//项目年度经费中的已申请
                    if (dataTj[0].ysqje > parseFloat(ysje).toFixed(6)) {
                        Message.error("该科目申请的费用总金额，不能超过预算金额!", 2000);
                        return false;
                    }
                }
            } else {
                dataTj[0].ysqje = xgqysq0;
                dataTj[0].ybzje = xgqybz0;
                dataTj[1].ysqje = xgqysq1;
                dataTj[1].ybzje = xgqybz1;
            }
            loadTreetable();
        });

        //刷新表格数据
        function loadTreetable() {
            currTable_tj = table.render({
                elem: '#currentTableId_tj',
                data: dataTj,
                cols: [
                    [
                        {field: 'km', title: '', width: '30%'},
                        {field: 'ysje', title: '预算(万元)', width: '23%'},
                        {field: 'ysqje', title: '已申请(元)', width: '23%'},
                        {field: 'ybzje', title: '已报账(元)'}
                    ]
                ]
            });
        }

        var xgqysq0;
        var xgqybz0;
        var xgqysq1;
        var xgqybz1;
        //费用类别
        element.render('checkbox');
        tableSelect.render({
            elem: '#fylbmc',
            checkedKey: 'id',
            searchKey: 'mc',
            searchPlaceholder: '搜索费用名称',
            table: {
                url: AjaxUtil.ctx + 'staBudgetapproval/getSubNode/' + ysId+'/?searchKey='+tableSelect.searchKey,
                method: 'get',
                cols: [
                    [
                        {type: "radio", fixed: 'left'},
                        {type: 'numbers', align: 'center',title: '序号'},
                        {field: 'fymc', width: '50%', title: '费用名称'},
                        {field: 'ysje', title: '预算金额(万元)',align: 'center'}
                    ]

                ]

            },
            done: function (elem, data) {
                var NEWJSON = [];
                var NEWJSON1 = [];
                var NEWJSON2 = [];
                var NEWJSON3 = [];
                layui.each(data.data, function (index, item) {
                    NEWJSON.push(item.fymc);
                    NEWJSON1.push(item.id);
                    NEWJSON2.push(item.fjmc);
                    NEWJSON3.push(item.ysje);
                })
                elem.val(NEWJSON.join(","));
                $("#fylb").val(NEWJSON1.join(","));
                $("#fjmc").val(NEWJSON2.join(","));
                dataTj[0].ysje = NEWJSON3.join(",");

                // if($("#fylbmc").val().indexOf("差旅") > -1)
                //     document.getElementById('clfDiv').style.display = 'block';
                // else
                //     document.getElementById('clfDiv').style.display = 'none';

                if ($("#fylbmc").val().indexOf("设备使用费") > -1) {
                    flag = '_Dev';
                    document.getElementById('sbsyfDiv').style.display = 'block';
                    // document.getElementById('currentTableId_Dev').lay-verify='required';
                } else {
                    document.getElementById('sbsyfDiv').style.display = 'none';
                }

                if ($("#fylbmc").val().indexOf("软件使用费") > -1) {
                    flag = '_Sw';
                    document.getElementById('rjsyfDiv').style.display = 'block';
                } else {
                    document.getElementById('rjsyfDiv').style.display = 'none';
                }

                if ($("#fylbmc").val().indexOf("材料费") > -1) {
                    flag = '_Clf';
                    document.getElementById('clfyDiv').style.display = 'block';
                } else {
                    document.getElementById('clfyDiv').style.display = 'none';
                }

                if ($("#fylbmc").val().indexOf("外委研究支出费") > -1) {
                    flag = '_Ww';
                    document.getElementById('wwyjzcDiv').style.display = 'block';
                } else {
                    document.getElementById('wwyjzcDiv').style.display = 'none';
                }

                if ($("#fylbmc").val().indexOf("外协测试试验与加工费") > -1) {
                    flag = '_Wx';
                    document.getElementById('syyjgfDiv').style.display = 'block';
                } else {
                    document.getElementById('syyjgfDiv').style.display = 'none';
                }

                if ($("#fylbmc").val().indexOf("间接") > -1) {
                    flag = '_Jjf';
                    document.getElementById('jjfDiv').style.display = 'block';
                } else {
                    document.getElementById('jjfDiv').style.display = 'none';
                }

                if ($("#fylbmc").val().indexOf("专家") > -1) {
                    flag = '_Zjf';
                    document.getElementById('zjfDiv').style.display = 'block';
                } else {
                    document.getElementById('zjfDiv').style.display = 'none';
                }

                if ($("#fylbmc").val().indexOf("临时") > -1 && $("#fjmc").val().indexOf("人工费") > -1) {
                    flag = '3';
                    document.getElementById('lsryDiv').style.display = 'block';
                } else {
                    document.getElementById('lsryDiv').style.display = 'none';
                }

                if ($("#fylbmc").val().indexOf("印刷及知识产权费") > -1 || $("#fylbmc").val().indexOf("差旅及国际合作交流费") > -1) {
                    flag = '选';
                    document.getElementById('fyxxDiv').style.display = 'block';
                } else {
                    document.getElementById('fyxxDiv').style.display = 'none';
                }
                if ($("#fylbmc").val().indexOf("印刷及知识产权费") > -1) {
                    $("#bz").val($("#bz1").val());
                    document.getElementById('zlysDiv').style.display = 'block';
                    document.getElementById('hyclDiv').style.display = 'none';
                } else {
                    $("#bz").val($("#bz2").val());
                    document.getElementById('zlysDiv').style.display = 'none';
                    document.getElementById('hyclDiv').style.display = 'block';
                }

                $.ajax({
                    url: AjaxUtil.ctx + 'staBudgetapproval/getKmFyInfo/' + ysId + '/' + $("#fylb").val(),
                    type: "post",
                    async: false,
                    dataType: "json",
                    success: function (result) {
                        dataTj[0].ysqje = result.sqje;
                        dataTj[0].ybzje = result.bzje;
                        dataTj[1].ysqje = dataTj[0].ysje * 10000 - result.xmndjfysq;
                        dataTj[1].ybzje = dataTj[0].ysje * 10000 - dataTj[0].ybzje;
                        xgqysq0 = result.sqje;
                        xgqybz0 = result.bzje;
                        xgqysq1 = dataTj[0].ysje * 10000 - result.xmndjfysq;
                        xgqybz1 = dataTj[0].ysje * 10000 - dataTj[0].ybzje;
                        if (null === result.xmndjfysq) {
                            ysqjeOne = parseFloat(0);
                        } else {
                            ysqjeOne = parseFloat(result.xmndjfysq);
                        }
                        ybzjeOne = parseFloat(dataTj[0].ybzje);
                        currTable_tj.reload();
                        $("#sqmc").val('费用申请-'+$("#xmmc").val()+"-"+$("#fylbmc").val());
                    }
                });
            }
        });

        form.on('select(bz1)', function (data) {
            $("#bz").val($("#bz1").val());
            if ($("#bz1").val().indexOf("资料费") > -1) {
                flag = '_Zlf';
                document.getElementById('zlfDiv').style.display = 'block';
            } else {
                document.getElementById('zlfDiv').style.display = 'none'
            }
            if ($("#bz1").val().indexOf("知识产权费") > -1) {
                flag = '_Zscc';
                document.getElementById('zsccDiv').style.display = 'block';
            } else {
                document.getElementById('zsccDiv').style.display = 'none';
            }
            if ($("#bz1").val().indexOf("印刷费") > -1) {
                flag = '_Dyf';
                document.getElementById('dyfDiv').style.display = 'block';
            } else {
                document.getElementById('dyfDiv').style.display = 'none';
            }
            if ($("#bz1").val().indexOf("会议费") > -1) {
                flag = '_Hyf';
                document.getElementById('hyfDiv').style.display = 'block';
            } else {
                document.getElementById('hyfDiv').style.display = 'none';
            }
            if ($("#bz1").val().indexOf("差旅") > -1) {
                flag = '1';
                document.getElementById('clfDiv').style.display = 'block';
            } else {
                document.getElementById('clfDiv').style.display = 'none';
            }
        });
        form.on('select(bz2)', function (data) {
            $("#bz").val($("#bz2").val());
            if ($("#bz2").val().indexOf("资料费") > -1) {
                flag = '_Zlf';
                document.getElementById('zlfDiv').style.display = 'block';
            } else {
                document.getElementById('zlfDiv').style.display = 'none';
            }
            if ($("#bz2").val().indexOf("知识产权费") > -1) {
                flag = 'Zscc';
                document.getElementById('zsccDiv').style.display = 'block';
            } else {
                document.getElementById('zsccDiv').style.display = 'none';
            }
            if ($("#bz2").val().indexOf("印刷费") > -1) {
                flag = '_Dyf';
                document.getElementById('dyfDiv').style.display = 'block';
            } else {
                document.getElementById('dyfDiv').style.display = 'none';
            }
            if ($("#bz2").val().indexOf("会议费") > -1) {
                flag = '_Hyf';
                document.getElementById('hyfDiv').style.display = 'block';
            } else {
                document.getElementById('hyfDiv').style.display = 'none';
            }
            if ($("#bz2").val().indexOf("差旅") > -1) {
                flag = '1';
                document.getElementById('clfDiv').style.display = 'block';
            } else {
                document.getElementById('clfDiv').style.display = 'none';
            }
        });

        // 用于存放表格数据
        var dataExpense = new Array();
        //差旅费
        var currTable1 = table.render({
            elem: '#currentTableId1',
            data: dataExpense,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {field: 'xh', title: '序号', width: '8%'},
                    {field: 'ccrxm', title: '出差人', width: '10%'},
                    {field: 'ccdd', title: '出差地点', width: '20%'},
                    {field: 'qsrq', title: '起始日期', width: '13%'},
                    {field: 'jsrq', title: '结束日期(含)', width: '14%'},
                    {field: 'ccts', title: '出差天数', width: '11%'},
                    {field: 'zj', title: '总计(元)', width: '10%'},
                    {field: 'rpj', title: '日平均(元)', width: '12%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（差旅费）
        $("button[lay-filter='subAdd']").click(function () {
            layer.open({
                title: '新建差旅费',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staTravelexpenses/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;

                        //刷新表格
                        // dataExpense.push(travelExpense);
                        // currTable1.reload();
                        //刷新表格
                        var oldData = table.cache["currentTableId1"];
                        oldData.push(travelExpense);
                        table.reload('currentTableId1', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（差旅费）
        $("button[lay-filter='subEdit']").click(function () {
            // if(dataExpense.length == 0)
            //     return;
            var oldData = table.cache["currentTableId1"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId1')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的差旅费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                travelExpense = {
                    "xh": data[0].xh,
                    "ccr": data[0].ccr,
                    "ccrxm": data[0].ccrxm,
                    "ccdd": data[0].ccdd,
                    "ccts": data[0].ccts,
                    "qsrq": data[0].qsrq,
                    "jsrq": data[0].jsrq,
                    "jtf": data[0].jtf,
                    "zsf": data[0].zsf,
                    "cb": data[0].cb,
                    "zj": data[0].zj,
                    "rpj": data[0].rpj,
                    "xmfzr": data[0].xmfzr,
                    "fysq": data[0].fysq,
                    "bzfyhs": data[0].bzjehs,
                    "bzjebhs": data[0].bzjebhs
                };
                layer.open({
                    title: '编辑差旅费',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staTravelexpenses/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            // for (var i = 0; i < dataExpense.length; i++) {
                            //     var item = dataExpense[i];
                            //     if (item.LAY_CHECKED) {//条件：选中
                            //         dataExpense[i] = travelExpense;
                            //         break;
                            //     }
                            // }
                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = travelExpense;
                                    break;
                                }
                            }
                            //刷新表格
                            // currTable1.reload();
                            var currData = oldData;
                            table.reload('currentTableId1', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（差旅费）
        $("button[lay-filter='subView']").click(function () {
            // if(dataExpense.length == 0)
            //     return;
            var oldData = table.cache["currentTableId1"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId1')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的差旅费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                travelExpense = {
                    "xh": data[0].xh,
                    "ccr": data[0].ccr,
                    "ccrxm": data[0].ccrxm,
                    "ccdd": data[0].ccdd,
                    "ccts": data[0].ccts,
                    "qsrq": data[0].qsrq,
                    "jsrq": data[0].jsrq,
                    "jtf": data[0].jtf,
                    "zsf": data[0].zsf,
                    "cb": data[0].cb,
                    "zj": data[0].zj,
                    "rpj": data[0].rpj,
                    "xmfzr": data[0].xmfzr,
                    "fysq": data[0].fysq,
                    "bzfyhs": data[0].bzfyhs,
                    "bzfybhs": data[0].bzfybhs
                };
                layer.open({
                    title: '浏览差旅费',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staTravelexpenses/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（差旅费）
        $("button[lay-filter='subDelete']").click(function () {
            // if(dataExpense.length == 0)
            //     return;
            var oldData = table.cache["currentTableId1"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId1')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的差旅费！", 1000);
                return;
            }
            // for (var i = 0; i < dataExpense.length; i++) {
            //     var item = dataExpense[i];
            //     if (item.LAY_CHECKED) {//条件：选中
            //         dataExpense.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
            //         i--;
            //     }
            // }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            // currTable1.reload();
            var currData = oldData;
            table.reload('currentTableId1', {
                data: currData
            });
        });
        //双击（差旅费）
        table.on('rowDouble(currentTableFilter1)', function (obj) {
            var data = obj.data;
            travelExpense = {
                "xh": data.xh,
                "ccr": data.ccr,
                "ccrxm": data.ccrxm,
                "ccdd": data.ccdd,
                "ccts": data.ccts,
                "qsrq": data.qsrq,
                "jsrq": data.jsrq,
                "jtf": data.jtf,
                "zsf": data.zsf,
                "cb": data.cb,
                "zj": data.zj,
                "rpj": data.rpj,
                "xmfzr": data[0].xmfzr,
                "fysq": data[0].fysq,
                "bzfyhs": data[0].bzfyhs,
                "bzfybhs": data[0].bzjebhs
            };
            layer.open({
                title: '浏览差旅费',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staTravelexpenses/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataMember = new Array();
        //临时人员
        var currTable3 = table.render({
            elem: '#currentTableId3',
            data: dataMember,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'xm', title: '姓名', width: '9%'},
                    {field: 'sfzh', title: '身份证号', width: '9%'},
                    {field: 'qsrq', title: '聘用起始时间', width: '9%'},
                    {field: 'jsrq', title: '聘用截止时间', width: '9%'},
                    {field: 'byxx', title: '毕业学校', width: '9%'},
                    {field: 'zy', title: '专业', width: '9%'},
                    {field: 'xl', title: '学历', width: '9%'},
                    {field: 'gzdd', title: '工作地点', width: '9%'}
                ]
            ]
        });
        // 监听新建按钮（临时人员）
        $("button[lay-filter='subAdd3']").click(function () {
            layer.open({
                title: '新建临时人员',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staTempmember/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;

                        for (let item of dataMember) {
                            if (item.xm === tempMember.xm) {
                                Message.error("该人员已在列表中！", 1000);
                                return false;
                            }
                        }
                        $.ajax({
                            url: AjaxUtil.ctx + 'staTempmember/memberExist?xm=' + tempMember.xm + '&qsrq=' + tempMember.qsrq + '&jsrq=' + tempMember.jsrq,
                            type: "post",
                            async: false,
                            dataType: "json",
                            success: function (result) {
                                if (result) {
                                    Message.error("该人员已在其它项目！", 2000);
                                    return false;
                                } else {
                                    //刷新表格
                                    var oldData = table.cache["currentTableId3"];
                                    oldData.push(tempMember);
                                    table.reload('currentTableId3', {
                                        data: oldData
                                    });
                                }
                            }
                        });
                    }
                    layer.close(index);
                }
            });
        });
        // 监听编辑按钮（临时人员）
        $("button[lay-filter='subEdit3']").click(function () {
            var oldData = table.cache["currentTableId3"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId3')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的临时人员！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                tempMember = {
                    "xm": data[0].xm,
                    "sfzh": data[0].sfzh,
                    "qsrq": data[0].qsrq,
                    "jsrq": data[0].jsrq,
                    "fysq": data[0].fysq,
                    "bzfy": data[0].bzfy,
                    "byxx": data[0].byxx,
                    "zy": data[0].zy,
                    "xl": data[0].xl,
                    "gzdd": data[0].gzdd
                };
                layer.open({
                    title: '编辑临时人员',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staTempmember/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = tempMember;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId3', {
                                data: currData
                            });
                        }
                        layer.close(index);
                    }
                });
            }
        });
        // 监听查看按钮（临时人员）
        $("button[lay-filter='subView3']").click(function () {
            var oldData = table.cache["currentTableId3"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId3')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的临时人员！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                tempMember = {
                    "xm": data[0].xm,
                    "sfzh": data[0].sfzh,
                    "qsrq": data[0].qsrq,
                    "jsrq": data[0].jsrq,
                    "fysq": data[0].fysq,
                    "bzfy": data[0].bzfy,
                    "byxx": data[0].byxx,
                    "zy": data[0].zy,
                    "xl": data[0].xl,
                    "gzdd": data[0].gzdd
                };
                layer.open({
                    title: '浏览临时人员',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staTempmember/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（临时人员）
        $("button[lay-filter='subDelete3']").click(function () {
            var oldData = table.cache["currentTableId3"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId3')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的临时人员！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId3', {
                data: currData
            });
        });
        //双击（临时人员）
        table.on('rowDouble(currentTableFilter3)', function (obj) {
            var data = obj.data;
            tempMember = {
                "xm": data.xm,
                "sfzh": data.sfzh,
                "qsrq": data.qsrq,
                "jsrq": data.jsrq,
                "fysq": data.fysq,
                "bzfy": data.bzfy,
                "byxx": data.byxx,
                "zy": data.zy,
                "xl": data.xl,
                "gzdd": data.gzdd
            };
            layer.open({
                title: '浏览临时人员',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staTempmember/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataDevice = new Array();
        //设备使用费
        var tabDevice = table.render({
            elem: '#currentTableId_Dev',
            data: dataDevice,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {field: 'xh', title: '序号', width: '7%'},
                    {field: 'sbmc', title: '设备名称', width: '30%'},
                    {field: 'sbxh', title: '设备型号', width: '20%'},
                    {field: 'sl', title: '数量(台件)', width: '13%'},
                    {field: 'zj', title: '总价(万元)', width: '13%'},
                    {field: 'gzsj', title: '购置时间', width: '13%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（设备使用费）
        $("button[lay-filter='subAdd_Dev']").click(function () {
            layer.open({
                title: '新建仪器设备使用费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staDeviceexpenses/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;

                        //刷新表格
                        var oldData = table.cache["currentTableId_Dev"];
                        oldData.push(devExpense);
                        table.reload('currentTableId_Dev', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（设备使用费）
        $("button[lay-filter='subEdit_Dev']").click(function () {
            var oldData = table.cache["currentTableId_Dev"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Dev')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的仪器设备使用费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                devExpense = {
                    "xh": data[0].xh,
                    "sbmc": data[0].sbmc,
                    "sbxh": data[0].sbxh,
                    "dj": data[0].dj,
                    "sl": data[0].sl,
                    "zj": data[0].zj,
                    "gzsj": data[0].gzsj,
                    "syfjqdj": data[0].syfjqdj,
                    "scgbydq": data[0].scgbydq,
                    "lsdw": data[0].lsdw,
                    "sbzkjzyxnzb": data[0].sbzkjzyxnzb
                };
                layer.open({
                    title: '编辑仪器设备使用费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staDeviceexpenses/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = devExpense;
                                    break;
                                }
                            }

                            var currData = oldData;
                            table.reload('currentTableId_Dev', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（设备使用费）
        $("button[lay-filter='subView_Dev']").click(function () {
            var oldData = table.cache["currentTableId_Dev"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Dev')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的仪器设备使用费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                devExpense = {
                    "xh": data[0].xh,
                    "sbmc": data[0].sbmc,
                    "sbxh": data[0].sbxh,
                    "dj": data[0].dj,
                    "sl": data[0].sl,
                    "zj": data[0].zj,
                    "gzsj": data[0].gzsj,
                    "syfjqdj": data[0].syfjqdj,
                    "scgbydq": data[0].scgbydq,
                    "lsdw": data[0].lsdw,
                    "sbzkjzyxnzb": data[0].sbzkjzyxnzb
                };
                layer.open({
                    title: '浏览仪器设备使用费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staDeviceexpenses/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（设备使用费）
        $("button[lay-filter='subDelete_Dev']").click(function () {
            var oldData = table.cache["currentTableId_Dev"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Dev')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的仪器设备使用费！", 1500);
                return;
            }

            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Dev', {
                data: currData
            });
        });
        //双击（设备使用费）
        table.on('rowDouble(currentTableFilter_Dev)', function (obj) {
            var data = obj.data;
            devExpense = {
                "xh": data.xh,
                "sbmc": data.sbmc,
                "sbxh": data.sbxh,
                "dj": data.dj,
                "sl": data.sl,
                "zj": data.zj,
                "gzsj": data.gzsj,
                "syfjqdj": data.syfjqdj,
                "scgbydq": data.scgbydq,
                "lsdw": data.lsdw,
                "sbzkjzyxnzb": data.sbzkjzyxnzb
            };
            layer.open({
                title: '浏览仪器设备使用费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staDeviceexpenses/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataSoftW = new Array();
        //软件使用费
        var tabSoftW = table.render({
            elem: '#currentTableId_Sw',
            data: dataSoftW,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {field: 'xh', title: '序号', align: 'center', width: '7%'},
                    {field: 'rjmc', title: '软件名称', width: '30%'},
                    {field: 'rjxh', title: '软件型号', width: '20%'},
                    {field: 'sl', title: '数量(套)', width: '13%'},
                    {field: 'zj', title: '总价(万元)', width: '13%'},
                    {field: 'gzsj', title: '购置时间', width: '13%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（软件使用费）
        $("button[lay-filter='subAdd_Sw']").click(function () {
            layer.open({
                title: '新建软件使用费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staSoftwareexpenses/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;

                        //刷新表格
                        var oldData = table.cache["currentTableId_Sw"];
                        oldData.push(softExpense);
                        table.reload('currentTableId_Sw', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（软件使用费）
        $("button[lay-filter='subEdit_Sw']").click(function () {
            var oldData = table.cache["currentTableId_Sw"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Sw')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的软件使用费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                softExpense = {
                    "xh": data[0].xh,
                    "rjmc": data[0].rjmc,
                    "rjxh": data[0].rjxh,
                    "dj": data[0].dj,
                    "sl": data[0].sl,
                    "zj": data[0].zj,
                    "gzsj": data[0].gzsj,
                    "syfjqdj": data[0].syfjqdj,
                    "scgbydq": data[0].scgbydq,
                    "lsdw": data[0].lsdw,
                    "rjzyjsxnzb": data[0].rjzyjsxnzb
                };
                layer.open({
                    title: '编辑软件使用费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staSoftwareexpenses/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = softExpense;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId_Sw', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（软件使用费）
        $("button[lay-filter='subView_Sw']").click(function () {
            var oldData = table.cache["currentTableId_Sw"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Sw')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的软件使用费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                softExpense = {
                    "xh": data[0].xh,
                    "rjmc": data[0].rjmc,
                    "rjxh": data[0].rjxh,
                    "dj": data[0].dj,
                    "sl": data[0].sl,
                    "zj": data[0].zj,
                    "gzsj": data[0].gzsj,
                    "syfjqdj": data[0].syfjqdj,
                    "scgbydq": data[0].scgbydq,
                    "lsdw": data[0].lsdw,
                    "rjzyjsxnzb": data[0].rjzyjsxnzb
                };
                layer.open({
                    title: '浏览软件使用费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staSoftwareexpenses/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（软件使用费）
        $("button[lay-filter='subDelete_Sw']").click(function () {
            var oldData = table.cache["currentTableId_Sw"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Sw')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的软件使用费！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Sw', {
                data: currData
            });
        });
        //双击（软件使用费）
        table.on('rowDouble(currentTableFilter_Sw)', function (obj) {
            var data = obj.data;
            softExpense = {
                "xh": data.xh,
                "rjmc": data.rjmc,
                "rjxh": data.rjxh,
                "dj": data.dj,
                "sl": data.sl,
                "zj": data.zj,
                "gzsj": data.gzsj,
                "syfjqdj": data.syfjqdj,
                "scgbydq": data.scgbydq,
                "lsdw": data.lsdw,
                "rjzyjsxnzb": data.rjzyjsxnzb
            };
            layer.open({
                title: '浏览软件使用费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staSoftwareexpenses/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataMaterial = new Array();
        //材料费
        var tabMaterial = table.render({
            elem: '#currentTableId_Clf',
            data: dataMaterial,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'clmc', title: '材料名称', width: '11%'},
                    {field: 'wlbm', title: '物料编码', width: '11%'},
                    {field: 'cgdj', title: '单价(万元)', width: '13%'},
                    {field: 'bz', title: '备注', width: '19%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（材料费）
        $("button[lay-filter='subAdd_Clf']").click(function () {
            layer.open({
                title: '新建材料费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staMaterial/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;

                        //刷新表格
                        var oldData = table.cache["currentTableId_Clf"];
                        oldData.push(materialCost);
                        table.reload('currentTableId_Clf', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（材料费）
        $("button[lay-filter='subEdit_Clf']").click(function () {
            var oldData = table.cache["currentTableId_Clf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Clf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的材料费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                materialCost = {
                    "clmc": data[0].clmc,
                    "wlbm": data[0].wlbm,
                    "cgdj": data[0].cgdj,
                    "bz": data[0].bz
                };
                layer.open({
                    title: '编辑材料费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staMaterial/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = materialCost;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId_Clf', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（材料费）
        $("button[lay-filter='subView_Clf']").click(function () {
            var oldData = table.cache["currentTableId_Clf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Clf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的材料费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                materialCost = {
                    "clmc": data[0].clmc,
                    "wlbm": data[0].wlbm,
                    "cgdj": data[0].cgdj,
                    "bz": data[0].bz
                };
                layer.open({
                    title: '浏览材料费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staMaterial/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（材料费）
        $("button[lay-filter='subDelete_Clf']").click(function () {
            var oldData = table.cache["currentTableId_Clf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Clf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的材料费！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Clf', {
                data: currData
            });
        });
        //双击（材料费）
        table.on('rowDouble(currentTableFilter_Clf)', function (obj) {
            var data = obj.data;
            materialCost = {
                "clmc": data.clmc,
                "wlbm": data.wlbm,
                "cgdj": data.cgdj,
                "bz": data.bz
            };
            layer.open({
                title: '浏览材料费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staMaterial/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataIndirect = new Array();
        //间接费
        var tabIndirect = table.render({
            elem: '#currentTableId_Jjf',
            data: dataIndirect,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'xh', title: '序号', width: '10%'},
                    {field: 'fyyt', title: '费用用途', width: '20%'},
                    {field: 'bz', title: '备注', width: '11%'},
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（间接费）
        $("button[lay-filter='subAddjjf']").click(function () {
            layer.open({
                title: '新建间接费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staIndirectCosts/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;
                        //刷新表格
                        var oldData = table.cache["currentTableId_Jjf"];
                        oldData.push(indirect);
                        table.reload('currentTableId_Jjf', {
                            data: oldData
                        });
                        //刷新表格
                        // dataIndirect.push(indirect);
                        // tabIndirect.reload();
                    }
                }
            });
        });
        // 监听编辑按钮（间接费）
        $("button[lay-filter='subEditjjf']").click(function () {
            var oldData = table.cache["currentTableId_Jjf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Jjf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的间接费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                indirect = {
                    "xh": data[0].xh,
                    "sqje": data[0].sqje,
                    "fyyt": data[0].fyyt,
                    "bzjehs": data[0].bzjehs,
                    "bzjebhs": data[0].bzjebhs,
                    "bz": data[0].bz
                };
                layer.open({
                    title: '编辑间接费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staIndirectCosts/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = indirect;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId_Jjf', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });

        // 监听查看按钮（间接费）
        $("button[lay-filter='subViewjjf']").click(function () {
            var oldData = table.cache["currentTableId_Jjf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Jjf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的间接费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                indirect = {
                    "xh": data[0].xh,
                    "sqje": data[0].sqje,
                    "fyyt": data[0].fyyt,
                    "bzjehs": data[0].bzjehs,
                    "bzjebhs": data[0].bzjebhs,
                    "bz": data[0].bz
                };
                layer.open({
                    title: '浏览间接费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staIndirectCosts/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });

        // 监听删除按钮（间接费）
        $("button[lay-filter='subDeletejjf']").click(function () {
            var oldData = table.cache["currentTableId_Jjf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Jjf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的间接费！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Jjf', {
                data: currData
            });
        });

        //双击（间接费）
        table.on('rowDouble(currentTableFilter_Jjf)', function (obj) {
            var data = obj.data;
            indirect = {
                "xh": data.xh,
                "sqje": data.sqje,
                "fyyt": data.fyyt,
                "bzjehs": data.bzjehs,
                "bzjebhs": data.bzjebhs,
                "bz": data.bz
            };
            layer.open({
                title: '浏览间接费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staIndirectCosts/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataExpert = new Array();
        //专家费
        var tabIndirect = table.render({
            elem: '#currentTableId_Zjf',
            data: dataExpert,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'zjxm', title: '专家姓名', width: '15%'},
                    {field: 'sfzh', title: '身份证号', width: '15%'},
                    {field: 'zc', title: '职称', width: '14%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（专家费）
        $("button[lay-filter='subAddzjf']").click(function () {
            layer.open({
                title: '新建专家费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staExpertFee/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;
                        //刷新表格
                        // dataExpert.push(expert);
                        // tabIndirect.reload();
                        var oldData = table.cache["currentTableId_Zjf"];
                        oldData.push(expert);
                        table.reload('currentTableId_Zjf', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（专家费）
        $("button[lay-filter='subEditzjf']").click(function () {
            var oldData = table.cache["currentTableId_Zjf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Zjf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的间接费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                expert = {
                    "zjxm": data[0].zjxm,
                    "sfzh": data[0].sfzh,
                    "fysq": data[0].fysq,
                    "bzfy": data[0].bzfy,
                    "zc": data[0].zc
                };
                layer.open({
                    title: '编辑专家费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staExpertFee/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = expert;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId_Zjf', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（专家费）
        $("button[lay-filter='subViewzjf']").click(function () {
            var oldData = table.cache["currentTableId_Zjf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Zjf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的间接费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                expert = {
                    "zjxm": data[0].zjxm,
                    "sfzh": data[0].sfzh,
                    "fysq": data[0].fysq,
                    "bzfy": data[0].bzfy,
                    "zc": data[0].zc
                };
                layer.open({
                    title: '浏览专家费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staExpertFee/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（专家费）
        $("button[lay-filter='subDeletezjf']").click(function () {
            var oldData = table.cache["currentTableId_Zjf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Zjf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的间接费！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Zjf', {
                data: currData
            });
        });

//双击（专家费）
        table.on('rowDouble(currentTableFilter_Zjf)', function (obj) {
            var data = obj.data;
            expert = {
                "zjxm": data.zjxm,
                "sfzh": data.sfzh,
                "fysq": data.fysq,
                "bzfy": data.bzfy,
                "zc": data.zc
            };
            layer.open({
                title: '浏览专家费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staExpertFee/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataMeeting = new Array();
        //会议费
        var tabIndirect = table.render({
            elem: '#currentTableId_Hyf',
            data: dataMeeting,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'hydd', title: '会议地点', width: '20%'},
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（会议费）
        $("button[lay-filter='subAddhyf']").click(function () {
            layer.open({
                title: '新建会议费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staMeetingFee/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;
                        //刷新表格
                        // dataMeeting.push(meeting);
                        // tabIndirect.reload();
                        var oldData = table.cache["currentTableId_Hyf"];
                        oldData.push(meeting);
                        table.reload('currentTableId_Hyf', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（会议费）
        $("button[lay-filter='subEdithyf']").click(function () {
            var oldData = table.cache["currentTableId_Hyf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Hyf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的会议费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                meeting = {
                    "hydd": data[0].hydd,
                    "fysq": data[0].fysq,
                    "bzfyh": data[0].bzfyh,
                    "bzfybh": data[0].bzfybh
                };
                layer.open({
                    title: '编辑会议费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staMeetingFee/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = meeting;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId_Hyf', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（会议费）
        $("button[lay-filter='subViewhyf']").click(function () {
            var oldData = table.cache["currentTableId_Hyf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Hyf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的会议费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                meeting = {
                    "hydd": data[0].hydd,
                    "fysq": data[0].fysq,
                    "bzfyh": data[0].bzfyh,
                    "bzfybh": data[0].bzfybh
                };
                layer.open({
                    title: '浏览会议费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staMeetingFee/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（会议费）
        $("button[lay-filter='subDeletehyf']").click(function () {
            var oldData = table.cache["currentTableId_Hyf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Hyf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的会议费！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Hyf', {
                data: currData
            });
        });

        //双击（会议费）
        table.on('rowDouble(currentTableFilter_Hyf)', function (obj) {
            var data = obj.data;
            meeting = {
                "hydd": data[0].hydd,
                "fysq": data[0].fysq,
                "bzfyh": data[0].bzfyh,
                "bzfybh": data[0].bzfybh
            };
            layer.open({
                title: '浏览会议费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staMeetingFee/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataInformation = new Array();
        //资料费
        var tabIndirect = table.render({
            elem: '#currentTableId_Zlf',
            data: dataInformation,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'kyfh', title: '科研费号', width: '15%'},
                    {field: 'tsmc', title: '图书名称', width: '15%'},
                    {field: 'cbs', title: '出版社', width: '20%'},
                    {field: 'sl', title: '数量', width: '10%'},
                    {field: 'zj', title: '总价', width: '10%'},
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });

        // 监听新建按钮（资料费）
        $("button[lay-filter='subAddzlf']").click(function () {
            layer.open({
                title: '新建资料费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staSourceFee/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;
                        //刷新表格
                        // dataInformation.push(information);
                        // tabIndirect.reload();
                        var oldData = table.cache["currentTableId_Zlf"];
                        oldData.push(information);
                        table.reload('currentTableId_Zlf', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（资料费）
        $("button[lay-filter='subEditzlf']").click(function () {
            var oldData = table.cache["currentTableId_Zlf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Zlf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的资料费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                information = {
                    "fysq": data[0].fysq,
                    "kyfh": data[0].kyfh,
                    "bzfy": data[0].bzfy,
                    "tsmc": data[0].tsmc,
                    "cbs": data[0].cbs,
                    "sl": data[0].sl,
                    "zj": data[0].zj
                };
                layer.open({
                    title: '编辑资料费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staSourceFee/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = information;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId_Zlf', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（资料费）
        $("button[lay-filter='subViewzlf']").click(function () {
            var oldData = table.cache["currentTableId_Zlf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Zlf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的资料费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                information = {
                    "fysq": data[0].fysq,
                    "kyfh": data[0].kyfh,
                    "bzfy": data[0].bzfy,
                    "tsmc": data[0].tsmc,
                    "cbs": data[0].cbs,
                    "sl": data[0].sl,
                    "zj": data[0].zj
                };
                layer.open({
                    title: '浏览资料费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staSourceFee/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（资料费）
        $("button[lay-filter='subDeletezlf']").click(function () {
            var oldData = table.cache["currentTableId_Zlf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Zlf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的资料费！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Zlf', {
                data: currData
            });
        });

        //双击（资料费）
        table.on('rowDouble(currentTableFilter_Zlf)', function (obj) {
            var data = obj.data;
            information = {
                "fysq": data[0].fysq,
                "kyfh": data[0].kyfh,
                "bzfy": data[0].bzfy,
                "tsmc": data[0].tsmc,
                "cbs": data[0].cbs,
                "sl": data[0].sl,
                "zj": data[0].zj
            };
            layer.open({
                title: '浏览资料费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staSourceFee/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataIntellectual = new Array();
        //知识产权费
        var tabIndirect = table.render({
            elem: '#currentTableId_Zscc',
            data: dataIntellectual,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'cqlb', title: '产权类别', width: '15%'},
                    {field: 'mc', title: '名称', width: '15%'},
                    {field: 'wtjg', title: '委托机构', width: '20%'},
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });

        // 监听新建按钮（知识产权费）
        $("button[lay-filter='subAddzscc']").click(function () {
            layer.open({
                title: '新建产权费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staIntellectualProperty/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;
                        //刷新表格
                        // dataIntellectual.push(intellectual);
                        // tabIndirect.reload();
                        var oldData = table.cache["currentTableId_Zscc"];
                        oldData.push(intellectual);
                        table.reload('currentTableId_Zscc', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（知识产权费）
        $("button[lay-filter='subEditzscc']").click(function () {
            var oldData = table.cache["currentTableId_Zscc"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Zscc')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的产权费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                intellectual = {
                    "fysq": data[0].fysq,
                    "cqlb": data[0].cqlb,
                    "mc": data[0].mc,
                    "cbs": data[0].cbs,
                    "wtjg": data[0].wtjg,
                    "bzjehs": data[0].bzjehs,
                    "bzjebhs": data[0].bzjebhs
                };
                layer.open({
                    title: '编辑产权费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staIntellectualProperty/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = intellectual;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId_Zscc', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（知识产权费）
        $("button[lay-filter='subViewzscc']").click(function () {
            var oldData = table.cache["currentTableId_Zscc"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Zscc')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的产权费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                intellectual = {
                    "fysq": data[0].fysq,
                    "cqlb": data[0].cqlb,
                    "mc": data[0].mc,
                    "cbs": data[0].cbs,
                    "wtjg": data[0].wtjg,
                    "bzjehs": data[0].bzjehs,
                    "bzjebhs": data[0].bzjebhs
                };
                layer.open({
                    title: '浏览知识产权费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staIntellectualProperty/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（知识产权费）
        $("button[lay-filter='subDeletezscc']").click(function () {
            var oldData = table.cache["currentTableId_Zscc"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Zscc')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的知识产权费！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Zscc', {
                data: currData
            });
        });

        //双击（知识产权费）
        table.on('rowDouble(currentTableFilter_Zscc)', function (obj) {
            var data = obj.data;
            intellectual = {
                "fysq": data[0].fysq,
                "cqlb": data[0].cqlb,
                "mc": data[0].mc,
                "cbs": data[0].cbs,
                "wtjg": data[0].wtjg,
                "bzjehs": data[0].bzjehs,
                "bzjebhs": data[0].bzjebhs
            };
            layer.open({
                title: '浏览知识产权费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staIntellectualProperty/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataPrint = new Array();
        //印刷费
        var tabIndirect = table.render({
            elem: '#currentTableId_Dyf',
            data: dataPrint,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'xh', title: '序号', width: '3%'},
                    {field: 'zlmc', title: '资料名称', width: '15%'},
                    {field: 'dcys', title: '单册页数', width: '15%'},
                    {field: 'dycs', title: '打印册数', width: '20%'},
                    {field: 'dcfy', title: '单页费用', width: '20%'},
                    {field: 'hj', title: '合计', width: '20%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（印刷费）
        $("button[lay-filter='subAdddyf']").click(function () {
            layer.open({
                title: '新建印刷费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staPrintingFee/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;
                        //刷新表格
                        dataPrint.push(println);
                        tabIndirect.reload();
                    }
                }
            });
        });


        // 监听编辑按钮（印刷费）
        $("button[lay-filter='subEditdyf']").click(function () {
            var oldData = table.cache["currentTableId_Dyf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Dyf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的印刷费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                println = {
                    "zlmc": data[0].zlmc,
                    "dcys": data[0].dcys,
                    "dycs": data[0].dycs,
                    "dcfy": data[0].dcfy,
                    "hj": data[0].hj
                };
                layer.open({
                    title: '编辑印刷费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staPrintingFee/forUpdate',
                    end: function (index) {
                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = println;
                                    break;
                                }
                            }
                            //刷新表格
                            table.reload('currentTableId_Dyf', {
                                data: oldData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（印刷费）
        $("button[lay-filter='subViewdyf']").click(function () {
            var oldData = table.cache["currentTableId_Dyf"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Dyf')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的印刷费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                println = {
                    "zlmc": data[0].zlmc,
                    "dcys": data[0].dcys,
                    "dycs": data[0].dycs,
                    "dcfy": data[0].dcfy,
                    "hj": data[0].hj
                };
                layer.open({
                    title: '浏览印刷费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staPrintingFee/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（印刷费）
        /*        $("button[lay-filter='subDeletedyf']").click(function(){
                    var oldData = table.cache["currentTableId_Dyf"];
                    if(oldData.length == 0)
                        return;

                    var checkStatus = table.checkStatus('currentTableId_Dyf')
                        ,data = checkStatus.data;
                    if (data == null || data.length === 0) {
                        Message.warning("请选择要删除的印刷费！", 1500);
                        return;
                    }
                    for (var i = 0; i < oldData.length; i++) {
                        var item = oldData[i];
                        if (item.LAY_CHECKED) {//条件：选中
                            oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                            i--;
                        }
                    }
                    //刷新表格
                    var currData = oldData;
                    console.log(currData);
                    table.reload('currentTableId_Dyf', {
                        data: currData
                    });
                });*/
        $("button[lay-filter='subDeletedyf']").click(function () {
            var oldData = table.cache["currentTableId_Dyf"];
            if (oldData.length === 0) {
                return;
            }

            var newData = oldData.filter(function (item) {
                return !item.LAY_CHECKED;
            });

            if (newData.length === oldData.length) {
                Message.warning("请选择要删除的印刷费！", 1500);
                return;
            }

            table.reload('currentTableId_Dyf', {
                data: newData
            });
            console.log(newData);
            console.log(data)
        });

//双击（印刷费）
        table.on('rowDouble(currentTableFilter_Dyf)', function (obj) {
            var data = obj.data;
            println = {
                "zlmc": data.zlmc,
                "dcys": data.dcys,
                "dycs": data.dycs,
                "dcfy": data.dcfy,
                "hj": data.hj
            };
            layer.open({
                title: '浏览印刷费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staPrintingFee/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataOut = new Array();
        //外委研究支出
        var tabOut = table.render({
            elem: '#currentTableId_Ww',
            data: dataOut,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {field: 'xh', title: '序号', align: 'center', width: '7%'},
                    {field: 'xzyjrwmc', title: '协作研究任务名称', width: '25%'},
                    {field: 'xzyjrwnr', title: '协作研究任务内容', width: '25%'},
                    {field: 'xzyjrwcddw', title: '协作研究任务承担单位', width: '25%'},
                    {field: 'jflz', title: '经费列支', width: '15%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（外委研究支出）
        $("button[lay-filter='subAdd_Ww']").click(function () {
            layer.open({
                title: '新建外委研究支出',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staOutexpense/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;

                        //刷新表格
                        var oldData = table.cache["currentTableId_Ww"];
                        oldData.push(outExpense);
                        table.reload('currentTableId_Ww', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（外委研究支出）
        $("button[lay-filter='subEdit_Ww']").click(function () {
            var oldData = table.cache["currentTableId_Ww"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Ww')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的外委研究支出！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                outExpense = {
                    "xh": data[0].xh,
                    "xzyjrwmc": data[0].xzyjrwmc,
                    "xzyjrwnr": data[0].xzyjrwnr,
                    "xzyjrwcddw": data[0].xzyjrwcddw,
                    "jflz": data[0].jflz
                };
                layer.open({
                    title: '编辑外委研究支出',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staOutexpense/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = outExpense;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId_Ww', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（外委研究支出）
        $("button[lay-filter='subView_Ww']").click(function () {
            var oldData = table.cache["currentTableId_Ww"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Ww')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的外委研究支出！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                outExpense = {
                    "xh": data[0].xh,
                    "xzyjrwmc": data[0].xzyjrwmc,
                    "xzyjrwnr": data[0].xzyjrwnr,
                    "xzyjrwcddw": data[0].xzyjrwcddw,
                    "jflz": data[0].jflz
                };
                layer.open({
                    title: '浏览外委研究支出',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staOutexpense/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（外委研究支出）
        $("button[lay-filter='subDelete_Ww']").click(function () {
            var oldData = table.cache["currentTableId_Ww"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Ww')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的外委研究支出！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Ww', {
                data: currData
            });
        });
        //双击（外委研究支出）
        table.on('rowDouble(currentTableFilter_Ww)', function (obj) {
            var data = obj.data;
            outExpense = {
                "xh": data.xh,
                "xzyjrwmc": data.xzyjrwmc,
                "xzyjrwnr": data.xzyjrwnr,
                "xzyjrwcddw": data.xzyjrwcddw,
                "jflz": data.jflz
            };
            layer.open({
                title: '浏览外委研究支出',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staOutexpense/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataTest = new Array();
        //外协测试试验
        var tabTest = table.render({
            elem: '#currentTableId_Wx',
            data: dataTest,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {field: 'xh', title: '序号', align: 'center', width: '7%'},
                    {field: 'wxcssyyjgnr', title: '外协测试试验与加工的内容', width: '30%'},
                    {field: 'wxcshyyjgdw', title: '外协测试化验与加工单位', width: '28%'},
                    {field: 'wxcshyyjgfy', title: '外协测试化验与加工费用(万元)'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        // 监听新建按钮（外协测试试验）
        $("button[lay-filter='subAdd_Wx']").click(function () {
            layer.open({
                title: '新建外协测试试验与加工费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staOutttesting/forAdd',
                end: function (index) {
                    if (updateflag == 1) {
                        updateflag = 0;

                        //刷新表格
                        var oldData = table.cache["currentTableId_Wx"];
                        oldData.push(outTesting);
                        table.reload('currentTableId_Wx', {
                            data: oldData
                        });
                    }
                }
            });
        });
        // 监听编辑按钮（外协测试试验）
        $("button[lay-filter='subEdit_Wx']").click(function () {
            var oldData = table.cache["currentTableId_Wx"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Wx')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的外协测试试验与加工费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                outTesting = {
                    "xh": data[0].xh,
                    "wxcssyyjgnr": data[0].wxcssyyjgnr,
                    "wxcshyyjgdw": data[0].wxcshyyjgdw,
                    "jldw": data[0].jldw,
                    "dj": data[0].dj,
                    "wxcshyyjgfy": data[0].wxcshyyjgfy,
                    "jflz": data[0].jflz
                };
                layer.open({
                    title: '编辑外协测试试验与加工费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staOutttesting/forUpdate',
                    end: function (index) {

                        if (updateflag == 1) {
                            updateflag = 0;

                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    oldData[i] = outTesting;
                                    break;
                                }
                            }
                            //刷新表格
                            var currData = oldData;
                            table.reload('currentTableId_Wx', {
                                data: currData
                            });
                        }
                    }
                });
            }
        });
        // 监听查看按钮（外协测试试验）
        $("button[lay-filter='subView_Wx']").click(function () {
            var oldData = table.cache["currentTableId_Wx"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Wx')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的外协测试试验与加工费！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                outTesting = {
                    "xh": data[0].xh,
                    "wxcssyyjgnr": data[0].wxcssyyjgnr,
                    "wxcshyyjgdw": data[0].wxcshyyjgdw,
                    "jldw": data[0].jldw,
                    "dj": data[0].dj,
                    "wxcshyyjgfy": data[0].wxcshyyjgfy,
                    "jflz": data[0].jflz
                };
                layer.open({
                    title: '浏览外协测试试验与加工费',
                    type: 2,
                    // maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'staOutttesting/forView',
                    end: function (index) {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听删除按钮（外协测试试验）
        $("button[lay-filter='subDelete_Wx']").click(function () {
            var oldData = table.cache["currentTableId_Wx"];
            if (oldData.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_Wx')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的外协测试试验与加工费！", 1500);
                return;
            }
            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.LAY_CHECKED) {//条件：选中
                    oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            var currData = oldData;
            table.reload('currentTableId_Wx', {
                data: currData
            });
        });
        //双击（外协测试试验）
        table.on('rowDouble(currentTableFilter_Wx)', function (obj) {
            var data = obj.data;
            outTesting = {
                "xh": data.xh,
                "wxcssyyjgnr": data.wxcssyyjgnr,
                "wxcshyyjgdw": data.wxcshyyjgdw,
                "jldw": data.jldw,
                "dj": data.dj,
                "wxcshyyjgfy": data.wxcshyyjgfy,
                "jflz": data.jflz
            };
            layer.open({
                title: '浏览外协测试试验与加工费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staOutttesting/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataFj = new Array();
        //附件
        var currTable2 = table.render({
            elem: '#currentTableId2',
            data: dataFj,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'wjm', title: '文件名', width: '30%'},
                    {field: 'scrq', title: '上传日期', width: '20%'},
                    {field: 'sm', title: '说明', edit: 'text'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            done: function (res, curr, count) { // done为数据渲染完的回调
            }
        });

        //文件上传
        upload.render({
            elem: '.upload' //绑定元素
            , url: AjaxUtil.ctx + 'fileupload/upload'
            , methd: 'post'
            , accept: 'file'
            , data: {}
            , done: function (res) {
                if (0 === res.code) {
                    var curData = {
                        "wjm": res.data.fileName,
                        "scrq": res.data.fileDate,
                        "Url": res.data.fileUrl,
                        "sm": res.data.sm
                    };
                    dataFj.push(curData);
                    currTable2.reload();
                } else
                    layer.alert("上传文件出现错误！");

            }
            , error: function () {
                layer.alert("上传文件出现错误！");
            }
            , before: function (res) {
                let fileType = this.fileType;
                this.data.fileType = fileType;
            }
        });
        $("button[lay-filter='deleteFile']").click(function () {
            if (dataFj.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId2')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的附件！", 1000);
                return;
            }
            for (var i = 0; i < dataFj.length; i++) {
                var item = dataFj[i];
                if (item.LAY_CHECKED) {//条件：选中
                    dataFj.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            // var oldData = table.cache["currentTableId2"];
            // for (var i = 0; i < oldData.length; i++) {
            //     var item = oldData[i];
            //     if (item.LAY_CHECKED) {//条件：选中
            //         oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
            //         i--;
            //     }
            // }
            //刷新表格
            // currTable2.reload();
            var currData = dataFj;
            table.reload('currentTableId2', {
                data: currData
            });
        });
        //双击（附件）
        table.on('rowDouble(currentTableFilter2)', function (obj) {
            window.open(obj.data.Url);
        });

        // 监听查看任务书按钮
        $("button[lay-filter='viewRwsBtn']").click(function () {
            if (xmId == -1)
                Message.error("请选择费用申请的项目，然后再查看任务书", 2000);
            else {
                var index = parent.layer.open({
                    title: '查看项目任务书',
                    type: 2,
                    shade: 0.3,
                    // maxmin: true,
                    shadeClose: true,
                    area: ['1100px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjProject/forView/' + xmId,
                    end: function () {
                        layer.close(index);
                    }
                });
            }
        });

        // 监听查看年度预算按钮
        $("button[lay-filter='viewNdysBtn']").click(function () {
            if (xmId == -1)
                Message.error("请选择费用申请的项目，然后再查看任务书", 2000);
            else {
                var index = parent.layer.open({
                    title: '查看年度预算',
                    type: 2,
                    shade: 0.3,
                    // maxmin: true,
                    shadeClose: true,
                    area: ['1010px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjAnnualbudget/forNdysView1/' + xmId+'/'+nf,
                    end: function () {
                        layer.close(index);
                    }
                });
            }
        });

        // 监听确认按钮
        form.on('submit(saveBtn)', function (data) {
            var ysje = dataTj[0].ysje * 10000;
            var sqje = parseFloat($("#sqje").val());
            var nysje = parseFloat(dataTj[1].ysje) * 10000;//年度预算金额
            var ysqje = parseFloat(dataTj[0].ysqje);
            var nysqje = parseFloat(dataTj[1].ysqje);
            if (ysqje > nysje || sqje>nysje) {
                Message.error("费用申请的总金额，不能超过年度总预算!", 2000);
                return false;
            }
            // else if ($("#fjmc").val().indexOf("业务费") > -1) {
            //     if (ysqje > ysje * 1.2) {
            //         Message.error("业务费申请的总金额，不能超过预算金额的20%!", 2000);
            //         return false;
            //     }
            // }
           if (ysqje > ysje || sqje >ysje) {
                Message.error("该科目申请的费用总金额，不能超过预算金额!，无法保存", 2000);
                return false;
            }

            //附件
            var dataWB = [];
            for (const item of dataFj) {
                var dfWb = {
                    "id": item.id,
                    "wjm": item.wjm,
                    "Url": item.Url,
                    "scrq": item.scrq,
                    "sm": item.sm
                };
                dataWB.push(dfWb);
            }
            $("#fj").val(JSON.stringify(dataWB));
            data.field.fj = JSON.stringify(dataWB);
            data.field.nys = ysId;

            //判空则不能保存
            if (flag.indexOf('未选') < 0) {
                if (flag.indexOf('选') > -1) {
                    Message.error("请选择费用小项，注意必填项不能为空!", 2000);
                    return false;
                } else {
                    var fyData = table.cache["currentTableId" + flag];
                    if (fyData.length == 0) {
                        Message.error("必填项不能为空!", 2000);
                        return false;
                    }
                }
            }
            //基本信息
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "staBudgetapproval/doAddApply",
                data: data.field,
                success: function (res) {
                    layer.close(index);

                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            if (fyId == -1) {
                                fyId = res.data.id;
                                $("#id").val(fyId);
                            }
                            parent.setUpdateFlag();

                            //差旅费
                            if ($("#fylbmc").val().indexOf("差旅及国际合作交流费") > -1 && $("#bz2").val().indexOf("差旅费") > -1) {
                                var travleExpenses = [];
                                var curData = table.cache["currentTableId1"];
                                for (const item of curData) {
                                    var expense = {
                                        "zb": fyId,
                                        "xh": item.xh,
                                        "ccr": item.ccr,
                                        "ccsy":item.ccsy,
                                        "ccdd": item.ccdd,
                                        "qsrq": item.qsrq,
                                        "jtf": item.jtf,
                                        "zsf": item.zsf,
                                        "cb": item.cb,
                                        "jsrq": item.jsrq,
                                        "ccts": item.ccts,
                                        "zj": item.zj,
                                        "rpj": item.rpj,
                                        "xmfzr": item.xmfzr,
                                        "fysq": item.fysq,
                                        "bzfyhs": item.bzfyhs,
                                        "bzfybhs": item.bzfybhs
                                    };
                                    travleExpenses.push(expense);
                                }
                                //保存差旅费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staTravelexpenses/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(travleExpenses),
                                    success: function (res) {
                                        if (res.code === 0) {
                                            // Message.success(1000, res.message, function () {
                                            //
                                            // });
                                        } else {
                                            // Message.error(res.message, 1000);
                                        }
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//会议费
                            else if ($("#fylbmc").val().indexOf("差旅及国际合作交流费") > -1 && $("#bz2").val().indexOf("会议费") > -1) {
                                var meetingCost = [];
                                var curData = table.cache["currentTableId_Hyf"];
                                for (const item of curData) {
                                    var meeting = {
                                        "zb": fyId,
                                        "hydd": item.hydd,
                                        "fysq": item.fysq,
                                        "bzfyh": item.bzfyh,
                                        "bzfybh": item.bzfybh
                                    };
                                    meetingCost.push(meeting);
                                }
                                //保存会议费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staMeetingFee/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(meetingCost),
                                    success: function (res) {
                                        if (res.code === 0) {
                                            // Message.success(1000, res.message, function () {
                                            //
                                            // });
                                        } else {
                                            // Message.error(res.message, 1000);
                                        }
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//资料费
                            else if ($("#fylbmc").val().indexOf("印刷及知识产权费") > -1 && $("#bz1").val().indexOf("资料费") > -1) {
                                var zlf = [];
                                var curData = table.cache["currentTableId_Zlf"];
                                for (const item of curData) {
                                    var expense = {
                                        "zb": fyId,
                                        /*                                        "fysq": item.fysq,
                                                                                "kyfh": item.kyfh,
                                                                                "bzfy": item.bzfy,*/
                                        "tsmc": item.tsmc,
                                        "cbs": item.cbs,
                                        "sl": item.sl,
                                        "zj": item.zj
                                    };
                                    zlf.push(expense);
                                }
                                //保存资料费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staSourceFee/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(zlf),
                                    success: function (res) {
                                        if (res.code === 0) {
                                            // Message.success(1000, res.message, function () {
                                            //
                                            // });
                                        } else {
                                            // Message.error(res.message, 1000);
                                        }
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//知识产权费
                            else if ($("#fylbmc").val().indexOf("印刷及知识产权费") > -1 && $("#bz1").val().indexOf("知识产权费") > -1) {
                                var zscc = [];
                                var curData = table.cache["currentTableId_Zscc"];
                                for (const item of curData) {
                                    var expense = {
                                        "zb": fyId,
                                        "fysq": item.fysq,
                                        "cqlb": item.cqlb,
                                        "mc": item.mc,
                                        "wtjg": item.wtjg,
                                        "bzjehs": item.bzjehs,
                                        "bzjebhs": item.bzjebhs
                                    };
                                    zscc.push(expense);
                                }
                                //保存知识产权费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staIntellectualProperty/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(zscc),
                                    success: function (res) {
                                        if (res.code === 0) {
                                            // Message.success(1000, res.message, function () {
                                            //
                                            // });
                                        } else {
                                            // Message.error(res.message, 1000);
                                        }
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//印刷费
                            else if ($("#fylbmc").val().indexOf("印刷及知识产权费") > -1 && $("#bz1").val().indexOf("印刷费") > -1) {
                                var dyf = [];
                                var curData = table.cache["currentTableId_Dyf"];
                                for (const item of curData) {
                                    var expense = {
                                        "zb": fyId,
                                        "zlmc": item.zlmc,
                                        "dcys": item.dcys,
                                        "dycs": item.dycs,
                                        "dcfy": item.dcfy,
                                        "hj": item.hj
                                    };
                                    dyf.push(expense);
                                }
                                //保存印刷费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staPrintingFee/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(dyf),
                                    success: function (res) {
                                        if (res.code === 0) {
                                            // Message.success(1000, res.message, function () {
                                            //
                                            // });
                                        } else {
                                            // Message.error(res.message, 1000);
                                        }
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//临时人员
                            else if ($("#fylbmc").val().indexOf("临时") > -1 && $("#fjmc").val().indexOf("人工费") > -1) {
                                var tempMembers = [];
                                var curData = table.cache["currentTableId3"];
                                for (const item of curData) {
                                    var member = {
                                        "zb": fyId,
                                        "xm": item.xm,
                                        "sfzh": item.xl,
                                        "qsrq": item.qsrq,
                                        "jsrq": item.jsrq,
                                        "fysq": item.fysq,
                                        "bzfy": item.bzfy,
                                        "byxx": item.byxx,
                                        "zy": item.zy,
                                        "xl": item.xl,
                                        "gzdd": item.gzdd
                                    };
                                    tempMembers.push(member);
                                }
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staTempmember/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(tempMembers),
                                    success: function (res) {
                                        if (res.code === 0) {
                                            // Message.success(1000, res.message, function () {
                                            //
                                            // });
                                        } else {
                                            // Message.error(res.message, 1000);
                                        }
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//设备使用费
                            else if ($("#fylbmc").val().indexOf("设备使用费") > -1) {
                                var devExpenses = [];
                                var curData = table.cache["currentTableId_Dev"];
                                for (const item of curData) {
                                    var expense = {
                                        "zb": fyId,
                                        "xh": item.xh,
                                        "sbmc": item.sbmc,
                                        "sbxh": item.sbxh,
                                        "dj": item.dj,
                                        "sl": item.sl,
                                        "zj": item.zj,
                                        "gzsj": item.gzsj,
                                        "syfjqdj": item.syfjqdj,
                                        "scgbydq": item.scgbydq,
                                        "lsdw": item.lsdw,
                                        "sbzkjzyxnzb": item.sbzkjzyxnzb
                                    };
                                    devExpenses.push(expense);
                                }
                                //保存设备使用费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staDeviceexpenses/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(devExpenses),
                                    success: function (res) {
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//软件使用费
                            else if ($("#fylbmc").val().indexOf("软件使用费") > -1) {
                                var softwExpenses = [];
                                var curData = table.cache["currentTableId_Sw"];
                                for (const item of curData) {
                                    var expense = {
                                        "zb": fyId,
                                        "xh": item.xh,
                                        "rjmc": item.rjmc,
                                        "rjxh": item.rjxh,
                                        "dj": item.dj,
                                        "sl": item.sl,
                                        "zj": item.zj,
                                        "gzsj": item.gzsj,
                                        "syfjqdj": item.syfjqdj,
                                        "scgbydq": item.scgbydq,
                                        "lsdw": item.lsdw,
                                        "rjzyjsxnzb": item.rjzyjsxnzb
                                    };
                                    softwExpenses.push(expense);
                                }
                                //保存软件使用费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staSoftwareexpenses/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(softwExpenses),
                                    success: function (res) {
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//材料费
                            else if ($("#fylbmc").val().indexOf("材料费") > -1) {
                                var matCosts = [];
                                var curData = table.cache["currentTableId_Clf"];
                                for (const item of curData) {
                                    var cost = {
                                        "zb": fyId,
                                        "clmc": item.clmc,
                                        "wlbm": item.wlbm,
                                        "fysq": item.fysq,
                                        "cgdj": item.cgdj,
                                        "bhsje": item.bhsje,
                                        "hsje": item.hsje,
                                        "bz": item.bz
                                    };
                                    matCosts.push(cost);
                                }
                                //保存材料费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staMaterial/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(matCosts),
                                    success: function (res) {
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//间接费
                            else if ($("#fylbmc").val().indexOf("间接") > -1) {
                                var indirectCosts = [];
                                var curData = table.cache["currentTableId_Jjf"];
                                for (const item of curData) {
                                    var cost = {
                                        "zb": fyId,
                                        "sqje": item.sqje,
                                        "fyyt": item.fyyt,
                                        "bzjehs": item.bzjehs,
                                        "bzjebhs": item.bzjebhs,
                                        "bz": item.bz
                                    };
                                    indirectCosts.push(cost);
                                }
                                //保存间接费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staIndirectCosts/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(indirectCosts),
                                    success: function (res) {
                                    },
                                    error: function (error) {
                                    }
                                });
                            }
                            //专家费
                            else if ($("#fylbmc").val().indexOf("专家") > -1) {
                                var expertCosts = [];
                                var curData = table.cache["currentTableId_Zjf"];
                                for (const item of curData) {
                                    var zjf = {
                                        "zb": fyId,
                                        "zjxm": item.zjxm,
                                        "sfzh": item.sfzh,
                                        "fysq": item.fysq,
                                        "bzfy": item.bzfy,
                                        "zc": item.zc
                                    };
                                    expertCosts.push(zjf);
                                }
                                //保存专家费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staExpertFee/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(expertCosts),
                                    success: function (res) {
                                    },
                                    error: function (error) {
                                    }
                                });
                            }//外委研究支出费
                            else if ($("#fylbmc").val().indexOf("外委研究支出费") > -1) {
                                var outExpenses = [];
                                var curData = table.cache["currentTableId_Ww"];
                                for (const item of curData) {
                                    var expense = {
                                        "zb": fyId,
                                        "xh": item.xh,
                                        "xzyjrwmc": item.xzyjrwmc,
                                        "xzyjrwnr": item.xzyjrwnr,
                                        "xzyjrwcddw": item.xzyjrwcddw,
                                        "jflz": item.jflz
                                    };
                                    outExpenses.push(expense);
                                }
                                //保存外委研究支出费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staOutexpense/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(outExpenses),
                                    success: function (res) {
                                    },
                                    error: function (error) {
                                    }
                                });
                            } //外协测试试验与加工费
                            else if ($("#fylbmc").val().indexOf("外协测试试验与加工费") > -1) {
                                var testExpenses = [];
                                var curData = table.cache["currentTableId_Wx"];
                                for (const item of curData) {
                                    var expense = {
                                        "zb": fyId,
                                        "xh": item.xh,
                                        "wxcssyyjgnr": item.wxcssyyjgnr,
                                        "wxcshyyjgdw": item.wxcshyyjgdw,
                                        "jldw": item.jldw,
                                        "dj": item.dj,
                                        "wxcshyyjgfy": item.wxcshyyjgfy,
                                        "jflz": item.jflz
                                    };
                                    testExpenses.push(expense);
                                }
                                //保存外协测试试验与加工费
                                AjaxUtil.post({
                                    url: AjaxUtil.ctx + "staOutttesting/batchInsert/" + fyId,
                                    contentType: "application/json",
                                    data: JSON.stringify(testExpenses),
                                    success: function (res) {
                                    },
                                    error: function (error) {
                                    }
                                });
                            }

                            var iframeIndex = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(iframeIndex);
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                },
                error: function (error) {
                    layer.close(index);
                }
            });
            return false;
        });

        // 监听取消按钮
        $("button[lay-filter='cancleBtn']").click(function () {
            var iframeIndex = parent.layer.getFrameIndex(window.name);
            parent.layer.close(iframeIndex);
        });
    });

    /**
     *  扁平数据转树结构
     * @returns {[]}
     * @param data
     * @param firstPid
     */
    function arrayToTree(data, firstPid) {
        const result = [];
        getChildren(data, result, firstPid);
        return result;
    }

    function getChildren(data, result, parentId) {
        for (const item of data) {
            if (item.parentId === parentId) {
                const newItem = {...item, children: []};
                result.push(newItem);
                getChildren(data, newItem.children, item.deptId);
            }
        }
    }

    function setTravelExpense(expense) {
        travelExpense = expense;
    }

    function getTravelExpense() {
        return travelExpense;
    }

    function setUpdateFlag() {
        updateflag = 1;
    }

    function setMember(member) {
        tempMember = member;
    }

    function getMember() {
        return tempMember;
    }

    function setDevExpense(expense) {
        devExpense = expense;
    }

    function getDevExpense() {
        return devExpense;
    }

    function setSoftExpense(expense) {
        softExpense = expense;
    }

    function getSoftExpense() {
        return softExpense;
    }

    function setMatCost(cost) {
        materialCost = cost;
    }

    function getMatCost() {
        return materialCost;
    }

    function setOutExpense(expense) {
        outExpense = expense;
    }

    function getOutExpense() {
        return outExpense;
    }

    function setOutTesting(expense) {
        outTesting = expense;
    }

    function getOutTesting() {
        return outTesting;
    }

    function setIndirect(cost) {
        indirect = cost;
    }

    function getIndirect() {
        return indirect;
    }

    function setExpert(zjf) {
        expert = zjf;
    }

    function getExpert() {
        return expert;
    }

    function setMeeting(meetingCost) {
        meeting = meetingCost;
    }

    function getMeeting() {
        return meeting;
    }

    function setInformation(expense) {
        information = expense;
    }

    function getInformation() {
        return information;
    }

    function setIntellectual(expense) {
        intellectual = expense;
    }

    function getIntellectual() {
        return intellectual;
    }

    function setPrintln(expense) {
        println = expense;
    }

    function getPrintln() {
        return println;
    }
</script>
</body>
</html>