<!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">
                <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: 75px">申请名称</label>
                            <div class="layui-input-inline" style="width: 855px">
                                <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: 75px">项目名称</label>
                            <div class="layui-input-inline" style="width: 855px">
                                <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">
                            <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">
                            <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="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" 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">
                            <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="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: 853px; 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: 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="right-bottom-btn">
                            <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>
</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 = [];//印刷费

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

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

        if ($("#fylbmc").val().indexOf("临时") > -1 && $("#fjmc").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 dataTj = [
            {
                "km": "此科目年度预算",
                "ysje": [[${kmFyInfo.ysje}]],
                "ysqje": [[${kmFyInfo.sqje}]],
                "ybzje": [[${kmFyInfo.bzje}]]
            },
            {
                "km": "项目年度经费",
                "ysje": [[${xmFyInfo.ysje}]],
                // "ysqje": [[${xmFyInfo.sqje}]],
                "ysqje": [[${xmFyInfo.ysje}]] * 10000 - [[${kmFyInfo.sqje}]],
                "ybzje": [[${xmFyInfo.bzje}]]
            }
        ];
        //统计信息
        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: '已报账(元)'}
                ]
            ]
        });

        // 用于存放表格数据
        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%'}
                ]
            ],
            autoSort: true,
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（差旅费）
        table.on('rowDouble(currentTableFilter1)', function (obj) {
            var data = obj.data;
            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/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataMember = new Array();
        $.ajax({
            url: AjaxUtil.ctx + 'staTempmember/list/' + 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'},
                    {field: 'xm', title: '姓名', width: '9%'},
                    {field: 'sfzh', title: '身份证号', width: '9%'},
                    {field: 'qsrq', title: '聘用起始时间', width: '9%'},
                    {field: 'jsrq', title: '聘用截止时间', width: '9%'},
                    {field: 'fysq', title: '费用申请', width: '9%'},
                    {field: 'bzfy', title: '报账费用', width: '9%'},
                    {field: 'byxx', title: '毕业学校', width: '9%'},
                    {field: 'zy', title: '专业', width: '9%'},
                    {field: 'xl', title: '学历', width: '9%'},
                    {field: 'gzdd', title: '工作地点', width: '9%'},
                    {field: 'kyfh', title: '科研费号', width: '9%'}
                ]
            ]
        });
        //双击（临时人员）
        table.on('rowDouble(currentTableFilter3)', function (obj) {
            var data = obj.data;
            tempMember = {
                "xm": data.xm,
                "xlmc": data.xlmc,
                "gznr": data.gznr,
                "qsrq": data.qsrq,
                "jsrq": data.jsrq
            };
            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: '20%'},
                    {field: 'sl', title: '数量(台件)', width: '13%'},
                    {field: 'zj', title: '总价(万元)', width: '13%'},
                    {field: 'gzsj', title: '购置时间', width: '13%'}
                ]
            ],
            autoSort: true,
            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: true,
            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 + 'staMaterialcost/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: [
                [
                    {field: 'xh', title: '序号', align: 'center', width: '7%'},
                    {field: 'clmc', title: '材料名称', width: '30%'},
                    {field: 'gghxh', title: '规格或型号', width: '20%'},
                    {field: 'jldw', title: '计量单位', width: '11%'},
                    {field: 'dj', title: '单价(万元)', width: '13%'},
                    {field: 'clfy', title: '材料费用', width: '15%'}
                ]
            ],
            autoSort: true,
            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,
                "gghxh": data.gghxh,
                "jldw": data.jldw,
                "dj": data.dj,
                "clfy": data.clfy,
                "jflz": data.jflz
            };
            layer.open({
                title: '浏览材料费',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'staMaterialcost/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: 'bzjehs', title: '报账金额（含税）', width: '14%'},
                    {field: 'bzjebhs', title: '报账金额（不含税）)', width: '14%'},
                    {field: 'bz', title: '备注', width: '11%'},
                ]
            ],
            autoSort: true,
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（间接费）
        table.on('rowDouble(currentTableFilter_Jjf)', function (obj) {
            var data = obj.data;
            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);
                }
            });
        });

        // 用于存放表格数据
        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: true,
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（专家费）
        table.on('rowDouble(currentTableFilter_Zjf)', function (obj) {
            var data = obj.data;
            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);
                }
            });
        });

        // 用于存放表格数据
        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: true,
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（会议费）
        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();
        $.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'},
                    {field: 'fysq', title: '费用申请', width: '15%'},
                    {field: 'kyfh', title: '科研费号', width: '15%'},
                    {field: 'bzfy', title: '报账费用', width: '15%'},
                    {field: 'tsmc', title: '图书名称', width: '15%'},
                    {field: 'cbs', title: '出版社', width: '20%'},
                    {field: 'sl', title: '数量', width: '10%'},
                    {field: 'zj', title: '总价', width: '10%'},
                ]
            ],
        });
        //双击（资料费）
        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();
        $.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%'},
                ]
            ],
        });
        //双击（知识产权费）
        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();
        $.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'},
                    {field: 'fysq', title: '申请金额', width: '25%'},
                    {field: 'bzjeh', title: '报账金额（含税）', width: '35%'},
                    {field: 'bzjebh', title: '报账金额（不含税）', width: '35%'},
                ]
            ],
        });
        //双击（印刷费）
        table.on('rowDouble(currentTableFilter_Dyf)', function (obj) {
            var data = obj.data;
            println = {
                "fysq": data[0].fysq,
                "bzjeh": data[0].bzjeh,
                "bzjebh": data[0].bzjebh
            };
            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: true,
            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: '外协测试化验与加工费用(万元)'}
                ]
            ],
            autoSort: true,
            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: '说明'},
                ]
            ]
        });
        //双击（附件）
        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='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/forNdysView/' + xmId,
                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 getMember() {
        return tempMember;
    }

    function getDevExpense() {
        return devExpense;
    }

    function getSoftExpense() {
        return softExpense;
    }

    function getMatCost() {
        return materialCost;
    }

    function getOutExpense() {
        return outExpense;
    }

    function getOutTesting() {
        return outTesting;
    }
</script>
</body>
</html>