<!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;
        }
        .auto-height {
            overflow: hidden; /* 隐藏滚动条 */
        }
    </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">
                <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: 8%">申请名称</label>
                            <div class="layui-input-inline" style="width: 70%">
                                <input type="hidden" id="id" name="id" class="layui-input"
                                       th:value="${budgetapproval.id}">
                                <input type="text" id="sqmc" name="sqmc" lay-verify="required" lay-reqtext="申请名称不能为空"
                                       autocomplete="off" class="layui-input" th:value="${budgetapproval.sqmc}"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 8%">项目名称</label>
                            <div class="layui-input-inline" style="width: 70%">
                                <input type="hidden" id="xmid" name="xmid" class="layui-input"
                                       th:value="${budgetapproval.xmid}">
                                <input type="text" id="xmmc" name="xmmc" class="layui-input" lay-verify="required"
                                       lay-reqtext="申请名称不能为空" th:value="${budgetapproval.xmmc}" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="float: left; clear: left;">
                            <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" th:value="${budgetapproval.bh}"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="float: left; clear: left;">
                            <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="${budgetapproval.nf}" readonly>
                            </div>
                        </div>

                        <div class="layui-form-item layui-inline" style="float: left; clear: left;">
                            <label class="layui-form-label" style="width: 75px">项目周期</label>
                            <div class="layui-input-inline" style="width: 380px">
                                <input type="text" id="zq" name="zq" class="layui-input"
                                        th:value="${xmzq}" 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"
                             style="width: 45%; position: absolute; z-index: 2; left: 55%; transform: translateX(-5%);top: 28%">
                            <table class="layui-hide" id="currentTableId_tj" name="currentTableId_tj"
                                   lay-filter="currentTableFilter_tj" style="padding-top: 0px;margin-top: 0px"></table>
                            <table class="layui-hide" id="currentTableId_tj2" name="currentTableId_tj2"
                                   lay-filter="currentTableFilter_tj2" style="padding-top: 0px;margin-top: 0px"></table>
                        </div>

                        <div class="layui-form-item layui-inline" style="float: left; clear: left;">
                            <label class="layui-form-label" style="width: 75px">费用类别</label>
                            <div class="layui-input-inline" style="width: 380px">
                                <input type="hidden" id="fjmc" name="fjmc" class="layui-input"
                                       th:value="${budgetapproval.fjmc}">
                                <input type="hidden" id="fylb" name="fylb" class="layui-input"
                                       th:value="${budgetapproval.fylb}">
                                <input type="text" id="fylbmc" name="fylbmc" th:value="${budgetapproval.fylbmc}"
                                       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>
                            <div class="layui-input-inline" style="width: 380px">
                                <input type="text" id="bz" name="bz" class="layui-input" th:value="${budgetapproval.bz}"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="float: left; clear: left;">
                            <label class="layui-form-label" 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" th:value="${budgetapproval.sqje}"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="float: left; clear: left;">
                            <label class="layui-form-label" style="width: 80px; margin-left: -5px">不含税金额(元)</label>
                            <div class="layui-input-inline" style="width: 380px">
                                <input type="number" id="bhsje" name="bhsje" class="layui-input" lay-verify="required"
                                       lay-reqtext="不含税金额不能为空" autocomplete="off" th:value="${budgetapproval.bhsje}"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%; display: none" id="clfDiv">
                            <label class="layui-form-label" style="width: 75px">差旅费</label>
                            <div class="layuimini-container" style="width: 855px; margin-left: 103px">
                                <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="lsryDiv">
                            <label class="layui-form-label" style="width: 75px">临时人员</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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" style="width: 75px">仪器设备<br>使用费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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" style="width: 75px">软件使用费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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" style="width: 75px">材料费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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" style="width: 75px">外委研究<br>支出费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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" style="width: 75px">外协测试试<br>验与加工费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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%; display: none" id="hyfDiv">
                            <label class="layui-form-label" style="width: 75px">会议费</label>
                            <div class="layuimini-container" style="width: 80%; margin-left: 105px">
                                <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" style="width: 75px">资料费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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" style="width: 75px">知识产权费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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" style="width: 75px">印刷费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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" style="width: 75px">间接费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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" style="width: 75px">专家费</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <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%">
                            <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 auto-height" oninput="adjustHeight(this)"
                                          style="width: 855px;height: 20%"  placeholder="请输入申请说明......"  readonly></textarea>
                                </div>
                            </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: 855px; margin-left: 103px">
                                <input type="hidden" id="fj" name="fj" class="layui-input"
                                       th:value="${budgetapproval.fj}">
                                <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;color: red">填写规范</label>
                            <div class="layuimini-container" style="width: 853px; margin-left: 105px">
                                <div style="margin-top: 8px; color: #666666; font-family: Arial, sans-serif; line-height: 1.5;">
                                    <h3 style="color: red;">申请说明填写规范</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 class="right-bottom-btn">
<!--                            <button type="button" class="layui-btn" lay-filter="spOption">-->
<!--                                <i class="layui-icon layui-icon-edit"></i>审核-->
<!--                            </button>-->
                            <button type="button" class="layui-btn" lay-filter="viewRwsBtn">
                                <i class="layui-icon layui-icon-ok"></i>查看任务书
                            </button>
                            <button type="button" class="layui-btn" lay-filter="viewNdysBtn">
                                <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>
                </form>
            </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="${budgetapproval.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="text" id="xmlxmc" name="xmlxmc" class="layui-input"
                                       th:value="${budgetapproval.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="text" id="xmfzrxm" name="xmfzrxm" class="layui-input"
                                       th:value="${budgetapproval.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="text" id="dkyfzrxm" name="dkyfzrxm" class="layui-input"
                                       th:value="${budgetapproval.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="text" id="ssbmmc" name="ssbmmc" class="layui-input"
                                       th:value="${budgetapproval.ssbmmc}" readonly>
                            </div>
                        </div>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">

                            <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 class="layui-btn" lay-filter="cancleBtn">
                                <i class="layui-icon layui-icon-close"></i>关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--其它信息结束-->
        </div>
    </div>
    <div style="display: none">
        <input type="hidden" th:value="${budgetapproval}" id="budgetapproval">
    </div>
</form>
<script>
    function adjustHeight(element) {
        // 重置高度，以便可以计算新的高度
        element.style.height = 'auto';
        // 设置新高度
        element.style.height = element.scrollHeight + 'px';
    }
</script>

<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
<script th:src="@{/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 = [];//印刷费

    layui.use(['table'], function () {
        var table = layui.table,
            layer = layui.layer;

        $(document).ready(function() {
            let sqsm = [[${budgetapproval.sqsm}]]
            console.log(sqsm)
            let sqsm1 = stripHtmlTags(sqsm);
            let cleanString = sqsm1.replace(/&nbsp;/g, " ");
            $("#sqsm").val(cleanString)
            adjustHeight(document.getElementById('sqsm'));
        });

        $(document).ready(function () {
           setTimeout(function () {
               // 用于存放表格数据
               var dataTj = [
                   {
                       "km": "此科目年度预算",
                       "ysje":  [[${kmFyInfo.ysje}]],
                       "ysqje": [[${kmFyInfo.sqje}]],
                       "ybzje": [[${kmFyInfo.bzje}]]
                   },
                   // {
                   //     "km": "项目年度经费",
                   //     "ysje": [[${xmFyInfo.ysje}]],
                   //     "ysqje": [[${kmFyInfo.ysje}]] * 10000 - [[${kmFyInfo.sqje}]],
                   //     "ybzje": [[${kmFyInfo.ysje}]] * 10000 - [[${kmFyInfo.bzje}]]
                   // },
                   {
                       "km":"项目备用金",
                       "ysje":  [[${kmFyInfo.bzje2}]],
                       "ysqje": [[${kmFyInfo.byj}]],
                       "ybzje": [[${kmFyInfo.byjbzze}]]
                   }
               ];
               var dataTj2 = [
                   {
                       "km": "项目年度经费",
                       "ysje": [[${xmFyInfo.ysje}]],
                       "ysqje": [[${kmFyInfo.ysje}]] * 10000 - [[${kmFyInfo.xmndjfysq}]],
                       "ybzje": [[${kmFyInfo.ysje}]] * 10000 - [[${kmFyInfo.bzje}]],
                   }
               ]
               console.log(dataTj);
               //统计信息
               var currTable_tj = table.render({
                   elem: '#currentTableId_tj',
                   data: dataTj,
                   cols: [
                       [
                           {field: 'km', title: '科目名称', width: '28%'},
                           {field: 'ysje', title: '预算(万元)', width: '24%', align:'right'},
                           {field: 'ysqje', title: '已申请(元)', width: '24%',align:'right'},
                           {field: 'ybzje', title: '已报账(元)',width: '24%', align:'right'},
                       ]
                   ]
               });
               var currTable_tj = table.render({
                   elem: '#currentTableId_tj2',
                   data: dataTj2,
                   cols: [
                       [
                           {field: 'km', title: '科目名称', width: '28%',align:'left'},
                           {field: 'ysje', title: '预算(万元)', width: '24%', align:'right'},
                           {field: 'ysqje', title: '可申请(元)', width: '24%', align:'right'},
                           {field: 'ybzje', title: '可报账(元)',width: '24%', align:'right'}
                       ]
                   ]
               });
               layer.msg('渲染完成',{icon:1});
           },500);
        });

        var fyId = $("#id").val();
        var xmId = $("#xmid").val();
        var nf = $("#nf").val();

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

        if ($("#fylbmc").val().indexOf("设备使用费") > -1)
            document.getElementById('sbsyfDiv').style.display = 'block';
        else
            document.getElementById('sbsyfDiv').style.display = 'none';

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

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

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

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

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

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

        if ($("#fylbmc").val().indexOf("印刷及知识产权费") > -1 || $("#fylbmc").val().indexOf("差旅及国际合作交流费") > -1) {
            document.getElementById('fyxxDiv').style.display = 'block';
            if ($("#bz").val().indexOf("资料费") > -1) {
                document.getElementById('zlfDiv').style.display = 'block';
            } else {
                document.getElementById('zlfDiv').style.display = 'none';
            }
            if ($("#bz").val().indexOf("知识产权费") > -1) {
                document.getElementById('zsccDiv').style.display = 'block';
            } else {
                document.getElementById('zsccDiv').style.display = 'none';
            }
            if ($("#bz").val().indexOf("印刷费") > -1) {
                document.getElementById('dyfDiv').style.display = 'block';
            } else {
                document.getElementById('dyfDiv').style.display = 'none';
            }
            if ($("#bz").val().indexOf("会议费") > -1) {
                document.getElementById('hyfDiv').style.display = 'block';
            } else {
                document.getElementById('hyfDiv').style.display = 'none';
            }
            if ($("#bz").val().indexOf("差旅费") > -1)
                document.getElementById('clfDiv').style.display = 'block';
            else
                document.getElementById('clfDiv').style.display = 'none';

        } else {
            document.getElementById('fyxxDiv').style.display = 'none';
        }

        // 用于存放表格数据
        var dataExpense = new Array();
        $.ajax({
            url: AjaxUtil.ctx + 'staTravelexpenses/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataExpense = result.data.rows;
            }
        });
        //差旅费
        table.render({
            elem: '#currentTableId1',
            data: dataExpense,
            cols: [
                [
                    {field: 'xh', title: '序号', width: '8%'},
                    {field: 'ccrxm', title: '出差人', width: '10%'},
                    {field: 'ccdd', title: '出差地点', width: '18%'},
                    {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%'},
                    {field: 'ccsy', title: '出差事由', width: '25%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（差旅费）
        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.xmfzr,
                "fysq": data.fysq,
                "bzfyhs": data.bzjehs,
                "bzjebhs": data.bzjebhs,
                "ccsy": data.ccsy
            };
            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();
        $.ajax({
            url: AjaxUtil.ctx + 'staTempmember/lslist/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataMember = result.data.rows;
            }
        });
        //临时人员
        var currTable3 = table.render({
            elem: '#currentTableId3',
            data: dataMember,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center',title: '😊'},
                    {field: 'xm', title: '姓名', width: '9%'},
                    {field: 'sfzh', title: '身份证号', width: '15%'},
                    {field: 'xmqssj',title: '项目起始时间',width: '18%'},
                    {field: 'xmjsrq',title: '项目结束时间',width: '18%'},
                    {field: 'qsrq', title: '聘用起始时间', width: '15%'},
                    {field: 'jsrq', title: '聘用截止时间', width: '15%'},
                   /* {field: 'fysq', title: '费用申请', width: '15%'},
                    {field: 'bzfy', title: '报账费用', width: '15%'},*/
                    {field: 'byxx', title: '毕业学校', width: '15%'},
                    {field: 'zy', title: '专业', width: '15%'},
                    {field: 'xl', title: '学历', width: '15%'},
                    {field: 'gzdd', title: '工作地点', width: '20%'},
                    {field: 'gznr', title: '工作内容', width: '25%'},
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（临时人员）
        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();
        $.ajax({
            url: AjaxUtil.ctx + 'staDeviceexpenses/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataDevice = result.data.rows;
            }
        });

        //设备使用费
        var tabDevice = table.render({
            elem: '#currentTableId_Dev',
            data: dataDevice,
            cols: [
                [
                    {field: 'xh', title: '序号', width: '7%'},
                    {field: 'sbmc', title: '设备名称', width: '30%'},
                    {field: 'sbxh', title: '设备型号', width: '25%'},
                    {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,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（设备使用费）
        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();
        $.ajax({
            url: AjaxUtil.ctx + 'staSoftwareexpenses/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataSoftW = result.data.rows;
            }
        });
        //软件使用费
        var tabSoftW = table.render({
            elem: '#currentTableId_Sw',
            data: dataSoftW,
            cols: [
                [
                    {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,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（软件使用费）
        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();
        $.ajax({
            url: AjaxUtil.ctx + 'staMaterial/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataMaterial = result.data.rows;
            }
        });
        //材料费
        var tabMaterial = table.render({
            elem: '#currentTableId_Clf',
            data: dataMaterial,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {field: 'xh', title: '序号', align: 'center', width: '7%'},
                    {field: 'clmc', title: '材料名称', width: '30%'},
                    {field: 'wlbm', title: '物料编码', width: '20%'},
                    {field: 'cgdj', title: '采购单价(元)', width: '11%'},
                    {field: 'bhsje', title: '不含税金额（元）', width: '13%'},
                    {field: 'hsje', title: '含税金额（元）', width: '13%'},
                    {field: 'sqje', title: '申请金额', width: '15%'},
                    {field: 'sl',title: '税率',width: '10%'},
                    {field: 'bz', title: '备注', width: '30%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（材料费）
        table.on('rowDouble(currentTableFilter_Clf)', function (obj) {
            var data = obj.data;
            materialCost = {
                "xh": data.xh,
                "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();
        $.ajax({
            url: AjaxUtil.ctx + 'staIndirectCosts/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataIndirect = result.data.rows;
            }
        });
        //间接费
        var tabIndirect = table.render({
            elem: '#currentTableId_Jjf',
            data: dataIndirect,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center',field: 'xh', title: '序号', width: '10%'},
                    {field: 'sqje', title: '申请金额', width: '10%'},
                    {field: 'fyyt', title: '费用用途', width: '20%'},
                    {field: 'bzje', title: '报账金额（含税）', width: '14%'},
                    {field: 'sl', title: '税率', width: '10%'},
                    {field: 'bhsje', title: '报账金额（不含税）)', width: '14%'},
                    {field: 'bz', title: '备注', width: '30%'},
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（间接费）
        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();
        $.ajax({
            url: AjaxUtil.ctx + 'staExpertFee/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataExpert = result.data.rows;
            }
        });
        //专家费
        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: 'fysq', title: '费用申请', width: '20%'},
                    {field: 'bzfy', title: '报账费用', width: '14%'},
                    {field: 'zc', title: '职称', width: '14%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（专家费）
        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();
        $.ajax({
            url: AjaxUtil.ctx + 'staMeetingFee/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataMeeting = result.data.rows;
            }
        });
        //会议费
        var tabIndirect = table.render({
            elem: '#currentTableId_Hyf',
            data: dataMeeting,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'hydd', title: '会议地点', width: '20%'},/*
                    {field: 'fysq', title: '费用申请', width: '20%'},*/
                    {field: 'bzfyh', title: '报账费用（含税）', width: '20%'},
                    {field: 'bzfybh', title: '报账费用（不含税）', width: '20%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（会议费）
        table.on('rowDouble(currentTableFilter_Hyf)', function (obj) {
            var data = obj.data;
            meeting = {
                "hydd": data.hydd,
                "fysq": data.fysq,
                "bzfyh": data.bzfyh,
                "bzfybh": data.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();
        $.ajax({
            url: AjaxUtil.ctx + 'staSourceFee/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataInformation = result.data.rows;
            }
        });
        //资料费
        var tabIndirect = table.render({
            elem: '#currentTableId_Zlf',
            data: dataInformation,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center',title: '序号'},
                   /* {field: 'fysq', title: '费用申请', width: '15%'},
                    {field: 'kyfh', title: '科研费号', width: '15%'},
                    {field: 'bzfy', title: '报账费用', width: '15%'},
                   */ {field: 'tsmc', title: '图书名称', width: '35%'},
                    {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,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（资料费）
        table.on('rowDouble(currentTableFilter_Zlf)', function (obj) {
            var data = obj.data;
            information = {
                "fysq": data.fysq,
                "kyfh": data.kyfh,
                "bzfy": data.bzfy,
                "tsmc": data.tsmc,
                "cbs": data.cbs,
                "sl": data.sl,
                "zj": data.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();
        $.ajax({
            url: AjaxUtil.ctx + 'staIntellectualProperty/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataIntellectual = result.data.rows;
            }
        });
        //知识产权费
        var tabIndirect = table.render({
            elem: '#currentTableId_Zscc',
            data: dataIntellectual,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {field: 'fysq', title: '申请金额', width: '15%'},
                    {field: 'cqlb', title: '产权类别', width: '15%'},
                    {field: 'mc', title: '名称', width: '15%'},
                    {field: 'wtjg', title: '委托机构', width: '20%'},
                    {field: 'bzjehs', title: '报账金额（含税）', width: '10%'},
                    {field: 'bzjebhs', title: '报账金额（不含税）', width: '10%'},
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（知识产权费）
        table.on('rowDouble(currentTableFilter_Zscc)', function (obj) {
            var data = obj.data;
            intellectual = {
                "fysq": data.fysq,
                "cqlb": data.cqlb,
                "mc": data.mc,
                "cbs": data.cbs,
                "wtjg": data.wtjg,
                "bzjehs": data.bzjehs,
                "bzjebhs": data.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();
        $.ajax({
            url: AjaxUtil.ctx + 'staPrintingFee/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataPrint = result.data.rows;
            }
        });
        //印刷费
        var tabIndirect = table.render({
            elem: '#currentTableId_Dyf',
            data: dataPrint,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center'},
                    {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,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（印刷费）
        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();
        $.ajax({
            url: AjaxUtil.ctx + 'staOutexpense/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataOut = result.data.rows;
            }
        });
        //外委研究支出
        var tabOut = table.render({
            elem: '#currentTableId_Ww',
            data: dataOut,
            cols: [
                [
                    {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,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（外委研究支出）
        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();
        $.ajax({
            url: AjaxUtil.ctx + 'staOutttesting/list/' + fyId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataTest = result.data.rows;
            }
        });
        //外协测试试验
        var tabTest = table.render({
            elem: '#currentTableId_Wx',
            data: dataTest,
            cols: [
                [
                    {field: 'xh', title: '序号', align: 'center', width: '7%'},
                    {field: 'wxcssyyjgnr', title: '外协测试试验与加工的内容', width: '30%'},
                    {field: 'wxcshyyjgdw', title: '外协测试化验与加工单位', width: '28%'},
                    {field: 'wxcshyyjgfy', title: '外协测试化验与加工费用(万元)',width: '28%'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（外协测试试验）
        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();
        if ([[${budgetapproval.fj}]] != null && [[${budgetapproval.fj}]] != "") {
            dataFj = eval('(' + [[${budgetapproval.fj}]] + ')');
        }
        //附件
        table.render({
            elem: '#currentTableId2',
            data: dataFj,
            cols: [
                [
                    {type: 'numbers', align: 'center'},
                    {field: 'wjm', title: '文件名', width: '30%'},
                    {field: 'scrq', title: '上传日期', width: '20%'},
                    {field: 'sm', title: '说明',width: '25%'},
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            toolbar: '#toolbarDemo',
            defaultToolbar:['filter', 'exports'],
            page: true,
            skin: 'grid',
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（附件）
        table.on('rowDouble(currentTableFilter2)', function (obj) {
            window.open(obj.data.Url);
        });

        // 监听查看任务书按钮
        $("button[lay-filter='viewRwsBtn']").click(function () {
            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='spOption']").click(function () {
            var budgetApproval = document.getElementById('budgetapproval').value;
            var sqje = document.getElementById('sqje').value;

            const regex = /(\w+)=(?:([^,"]*?)|("[^"]*?"))(?:,|$)/g;
            let match;
            const parsedData = {};
            while ((match = regex.exec(budgetApproval)) !== null) {
                const key = match[1];
                const value = match[2] !== undefined ? match[2] : match[3];
                parsedData[key] = value;
            }

/*            var iframeIndex = parent.layer.getFrameIndex(window.name);
            parent.layer.close(iframeIndex); // 关闭当前弹框*/

            var content = AjaxUtil.ctx + 'staBudgetapproval/forApproveAdd';
            if(parsedData.spzt == "审批结束"){
                layer.msg("当前费用已审批结束",{icon:8})
            }else if(parsedData.spzt == "作废"){
                layer.msg("当前费用已审批结束",{icon:8})
            }else if (parsedData.spzt == "未提交" ) {
                layer.msg("当前费用未提交审批",{icon:8})
            }else {
                content = AjaxUtil.ctx + 'staBudgetapproval/forApproveUpdate/' + parsedData.id + '/' + sqje + '?spzt=' + parsedData.spzt;
                layer.open({
                    title: '审批意见',
                    type: 2,
                    shade: 0.3,
                    maxmin: true,
                    shadeClose: true,
                    area: ['1025px', layerheight + 'px'],
                    content: content,
                    end: function (index) {
                        if (updateflag == 1) {
                            currTable.reload();
                        }
                        updateflag = 0;
                    }
                });
            }

            console.log("打开新弹框的内容：" + content); // 调试信息，确保 content 的值正确

        });
        // 监听查看年度预算按钮
        $("button[lay-filter='viewNdysBtn']").click(function () {
            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);
                }
            });
        });

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

    function getTravelExpense() {
        return travelExpense;
    }
    function getIntellectual() {
        return intellectual;
    }

    function getMember() {
        return tempMember;
    }

    function getDevExpense() {
        return devExpense;
    }
    function getInformation() {
        return information;
    }
    function getPrintln() {
        return println;
    }

    function getSoftExpense() {
        return softExpense;
    }

    function getMatCost() {
        return materialCost;
    }

    function getOutExpense() {
        return outExpense;
    }

    function getOutTesting() {
        return outTesting;
    }
    function stripHtmlTags(str) {
        return str.replace(/<\/?[^>]+(>|$)/g, "");
    }
</script>
</body>
</html>