<!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" lay-filter="rws">
        <ul class="layui-tab-title">
            <li class="layui-this">基本信息</li>
            <li>填写说明</li>
            <li>子课题</li>
            <li>内容</li>
            <li>项目预算</li>
            <li>出资方案</li>
            <li>说明</li>
            <li>联系方式</li>
            <li>附件</li>
        </ul>
        <div class="layui-tab-content">
            <!--基本信息开始-->
            <div class="layui-tab-item layui-show">
                <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: 10%">中文名称</label>
                            <div class="layui-input-inline" style="width: 35%">
                                <input type="hidden" id="id" name="id" th:value="${project.id}">
                                <input type="text" id="zwmc" name="zwmc" th:value="${project.zwmc}" class="layui-input"
                                       readonly>
                            </div>
                            <label class="layui-form-label" style="width: 15%">学科分类1</label>
                            <div class="layui-input-inline" style="width: 25%">
                                <input type="text" id="xkflmc1" name="xkflmc1" th:value="${project.xkflmc1}"
                                       class="layui-input" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 10%">英文名称</label>
                            <div class="layui-input-inline" style="width: 35%">
                                <input type="text" id="ywmc" name="ywmc" th:value="${project.ywmc}" class="layui-input"
                                       readonly>
                            </div>
                            <label class="layui-form-label" style="width: 15%">学科分类2</label>
                            <div class="layui-input-inline" style="width: 25%">
                                <input type="text" id="xkflmc2" name="xkflmc2" th:value="${project.xkflmc2}"
                                       class="layui-input" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 10%">ERP编号</label>
                            <div class="layui-input-inline" style="width: 35%">
                                <input type="text" id="erpbh" name="erpbh" th:value="${project.erpbh}"
                                       autocomplete="off" class="layui-input" readonly>
                            </div>
                            <label class="layui-form-label" style="width: 15%">学科分类3</label>
                            <div class="layui-input-inline" style="width: 25%">
                                <input type="text" id="xkflmc3" name="xkflmc3" th:value="${project.xkflmc3}"
                                       class="layui-input" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 10%">项目类型</label>
                            <div class="layui-input-inline" style="width: 35%">
                                <input type="hidden" id="xmlx" name="xmlx" class="layui-input"
                                       th:value="${project.xmlx}">
                                <input type="text" id="xmlxmc" name="xmlxmc" class="layui-input"
                                       th:value="${project.xmlxmc}" readonly>
                            </div>
                            <label class="layui-form-label" style="width: 15%">所属国民经济行业</label>
                            <div class="layui-input-inline" style="width: 25%">
                                <input type="text" id="ssgmjjhymc" name="ssgmjjhymc" th:value="${project.ssgmjjhymc}"
                                       class="layui-input" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 10%">可研报告</label>
                            <div class="layui-input-inline" style="width: 35%">
                                <input type="hidden" id="bm" name="bm" th:value="${project.bm}" class="layui-input"
                                       readonly>
                                <input type="text" id="kybgmc" name="kybgmc" th:value="${project.kybgmc}"
                                       class="layui-input" readonly>
                            </div>
                            <label class="layui-form-label" style="width: 15%">是否国家秘密技术项目</label>
                            <div class="layui-input-inline" style="width: 280px">
                                <input type="checkbox" name="sfgjmmjsxm" lay-skin="primary"
                                       th:checked="${project.sfgjmmjsxm}" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 10%">费用来源</label>
                            <div class="layui-input-inline" style="width: 35%">
                                <input type="text" id="fyly" name="fyly" th:value="${project.fyly}" class="layui-input"
                                       readonly>
                            </div>
                            <label class="layui-form-label" style="width: 15%">项目起止时间</label>
                            <div class="layui-input-inline" style="width: 138px">
                                <input type="text" name="qs" id="qs" th:value="${project.qs}" class="layui-input"
                                       readonly>
                            </div>
                            <div class="layui-form-mid">-</div>
                            <div class="layui-input-inline" style="width: 138px">
                                <input type="text" name="wc" id="wc" th:value="${project.wc}" class="layui-input"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 10%;">项目总预算（万）</label>
                            <div class="layui-input-inline" style="width: 35%">
                                <input type="text" id="rwsys2" name="rwsys2"
                                       class="layui-input" th:value="${rwsys}" readonly>
                            </div>
                        </div>
                        <!--Tab列表-->
                        <div class="layui-tab layui-tab-brief" style="padding-left: 30px; padding-right: 30px">
                            <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">
                                    <div class="layuimini-container">
                                        <table class="layui-hide" id="currentTableId1" name="currentTableId1"
                                               lay-filter="currentTableFilter1"
                                               style="padding-top: 0px;margin-top: 0px"></table>
                                    </div>
                                </div>
                                <!--主要完成人结束-->
                                <!--主要完成单位开始-->
                                <div class="layui-tab-item">
                                    <div class="layuimini-container">
                                        <table class="layui-hide" id="currentTableId2" name="currentTableId2"
                                               lay-filter="currentTableFilter2"
                                               style="padding-bottom: 0px;margin-bottom: 0px"></table>
                                    </div>
                                </div>
                                <!--主要完成单位结束-->
                            </div>
                        </div>

                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 10%">总人数</label>
                            <div class="layui-input-inline" style="width: 18%">
                                <input type="text" id="zrs" name="zrs" class="layui-input" th:value="${project.zrs}"
                                       readonly>
                            </div>
                            <label class="layui-form-label" style="width: 10%;">高级职称</label>
                            <div class="layui-input-inline" style="width: 18%">
                                <input type="text" id="gjzc" name="gjzc" class="layui-input" th:value="${project.gjzc}"
                                       readonly>
                            </div>
                            <label class="layui-form-label" style="width: 10%">中级职称</label>
                            <div class="layui-input-inline" style="width: 18%">
                                <input type="text" id="zjzc" name="zjzc" class="layui-input" th:value="${project.zjzc}"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 10%">所属部门</label>
                            <div class="layui-input-inline" style="width: 18%">
                                <input type="hidden" id="ssbm" name="ssbm" th:value="${project.ssbm}"
                                       class="layui-input" readonly>
                                <input type="text" id="ssbmmc" name="ssbmmc" th:value="${project.ssbmmc}"
                                       class="layui-input" readonly>
                            </div>
                            <label class="layui-form-label" style="width: 10%">初级职称</label>
                            <div class="layui-input-inline" style="width: 18%">
                                <input type="text" id="cjzc" name="cjzc" class="layui-input" th:value="${project.cjzc}"
                                       readonly>
                            </div>
                            <label class="layui-form-label" style="width: 10%;">研究生</label>
                            <div class="layui-input-inline" style="width: 18%">
                                <input type="text" id="yjs" name="yjs" class="layui-input" th:value="${project.yjs}"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width: 10%">电科院负责人</label>
                            <div class="layui-input-inline" style="width: 18%">
                                <input type="hidden" id="dkyfzr" name="dkyfzr" th:value="${project.dkyfzr}"
                                       class="layui-input" readonly>
                                <input type="text" id="dkyfzrxm" name="dkyfzrxm" th:value="${project.dkyfzrxm}"
                                       class="layui-input" readonly>
                            </div>
                        </div>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">
                            <button class="layui-btn" lay-filter="cancleBtn">
                                <i class="layui-icon layui-icon-close"></i>关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--基本信息结束-->
            <!--填写说明开始-->
            <div class="layui-tab-item" style="min-height: 540px">
                <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: 10%">填写说明</label>
                            <div class="layui-input-inline" style="width: 70%">
                                <textarea id="txsm" name="txsm" class="layui-textarea" th:text="${project.txsm}"
                                          style="width: 100%;height: 510px" readonly></textarea>
                            </div>
                        </div>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">
                            <button class="layui-btn" lay-filter="cancleBtn">
                                <i class="layui-icon layui-icon-close"></i>关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--填写说明结束-->
            <!--子课题开始-->
            <div class="layui-tab-item" style="min-height: 555px; padding-left: 30px; padding-right: 30px">
                <form class="layui-form" action="" lay-filter="formDemo">
                    <div class="layuimini-form" style="padding-bottom: 100px">
                        <table class="layui-hide" id="currentTableId3" lay-filter="currentTableFilter3"></table>
                        <script type="text/html" id="currentTableBar3">
                            <a class="layui-btn layui-btn-xs layui-btn-warm data-count-view" lay-event="view">
                                <i class="layui-icon layui-icon-set" style="font-size: 10px;"></i>查看
                            </a>
                        </script>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">
                            <button class="layui-btn" lay-filter="cancleBtn">
                                <i class="layui-icon layui-icon-close"></i>关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--子课题结束-->
            <!--内容开始-->
            <div class="layui-tab-item" style="min-height: 540px">
                <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:10%">研究内容及<br>考核指标</label>
                            <div class="layui-input-inline" style="width: 70%">
                                <textarea id="yjnrjkhzb" name="yjnrjkhzb" class="layui-textarea"
                                          th:text="${project.yjnrjkhzb}" style="width: 100%;height: 510px"
                                          readonly></textarea>
                            </div>
                        </div>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">
                            <button class="layui-btn" lay-filter="cancleBtn">
                                <i class="layui-icon layui-icon-close"></i>关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--内容结束-->
            <!--项目预算开始-->
            <div class="layui-tab-item" style="min-height: 555px; padding-left: 30px; padding-right: 30px">
                <form class="layui-form" action="" lay-filter="formDemo">
                    <div class="layui-form layuimini-form" style="padding-bottom: 100px">
                        <div class="layui-form-item" style="margin-bottom: -10px">
                            <div class="layui-inline">
                                <label class="layui-form-label"
                                       style="width: fit-content; margin-bottom: -10px">单位：万元</label>
                                <label class="layui-form-label" style="width: 170px"></label>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 70px; margin-left: -10px">项目总预算</label>
                                <div id="mytb" class="layui-input-inline" style="width: 100px">
                                    <input type="text" id="rwsys" name="rwsys" class="layui-input" readonly>
                                </div>
                            </div>
                        </div>
                        <table class="layui-hide" id="currentTableId5" lay-filter="currentTableId5"></table>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">
                            <button class="layui-btn" lay-filter="cancleBtn">
                                <i class="layui-icon layui-icon-close"></i>关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--项目预算结束-->
            <!--出资方案开始-->
            <div class="layui-tab-item" style="min-height: 555px; padding-left: 30px; padding-right: 30px">
                <form class="layui-form" action="" lay-filter="formDemo">
                    <div class="layuimini-form" style="padding-bottom: 100px">
                        <table class="layui-hide" id="currentTableId6" lay-filter="currentTableFilter6"></table>
                        <script type="text/html" id="currentTableBar6">
                            <a class="layui-btn layui-btn-xs layui-btn-warm data-count-view" lay-event="view">
                                <i class="layui-icon layui-icon-set" style="font-size: 10px;"></i>查看
                            </a>
                        </script>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">
                            <button class="layui-btn" lay-filter="cancleBtn">
                                <i class="layui-icon layui-icon-close"></i>关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--出资方案结束-->
            <!--说明开始-->
            <div class="layui-tab-item" style="min-height: 540px">
                <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: 10%">有关问题说明</label>
                            <div class="layui-input-inline" style="width: 70%">
                                <textarea id="ygwtsm" name="ygwtsm" class="layui-textarea" th:text="${project.ygwtsm}"
                                          style="width: 100%;height: 510px" readonly></textarea>
                            </div>
                        </div>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">
                            <button class="layui-btn" lay-filter="cancleBtn">
                                <i class="layui-icon layui-icon-close"></i>关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--说明结束-->
            <!--联系方式开始-->
            <div class="layui-tab-item" style="min-height: 555px; padding-left: 30px; padding-right: 30px">
                <form class="layui-form" action="" lay-filter="formDemo">
                    <div class="layuimini-form" style="padding-bottom: 100px">
                        <table class="layui-hide" id="currentTableId8" lay-filter="currentTableFilter8"></table>
                        <script type="text/html" id="currentTableBar8">
                            <a class="layui-btn layui-btn-xs layui-btn-warm data-count-view" lay-event="view">
                                <i class="layui-icon layui-icon-set" style="font-size: 10px;"></i>查看
                            </a>
                        </script>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">
                            <button class="layui-btn" lay-filter="cancleBtn">
                                <i class="layui-icon layui-icon-close"></i>关闭
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--联系方式结束-->
            <!--附件开始-->
            <div class="layui-tab-item" style="min-height: 555px; padding-left: 30px; padding-right: 30px">
                <form class="layui-form" action="" lay-filter="formDemo">
                    <div class="layuimini-form" style="padding-bottom: 100px">
                        <input type="hidden" id="fj" name="fj" class="layui-input" th:value="${project.fj}">
                        <table class="layui-hide" id="currentTableId9" name="currentTableId9"
                               lay-filter="currentTableFilter9" style="padding-top: 0px;margin-top: 0px"></table>

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

<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
<script th:src="@{/lib/layui-v2.6.3/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 updateflag = 0;
    var prjMember = [];
    var prjCompany = [];
    var subTopic = [];
    var budgetCols = [];
    layui.use(['form', 'table', 'treeTable', 'layCascader', 'tableSelect'], function () {
        var table = layui.table,
            layer = layui.layer,
            treeTable = layui.treeTable;
        var xmId = parseInt($("#id").val());


        // 用于存放表格数据
        var dataMember = new Array();
        $.ajax({
            url: AjaxUtil.ctx + 'prjMember/list/' + xmId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataMember = result.data.rows;
            }
        });
        //主要完成人
        var currTable1 = table.render({
            elem: '#currentTableId1',
            data: dataMember,
            cols: [
                [
                    {type: 'numbers', align: 'center',title: '序号',width: '7%'},
                    {field: 'ryxm', width: '10%', title: '人员', align: 'left'},
                    {field: 'xmjsmc', width: '15%', title: '项目角色', align: 'left'},
                    {field: 'bxmfg', width: '20%', title: '本项目分工', align: 'left'},
                    {field: 'trgzzys', width: '15%', title: '投入工作总月数', align: 'left'},
                 /*   {field: 'sxbh', width: '10%', title: '顺序编号', align: 'left'},*/
                    {field: 'dwmc', title: '单位', align: 'left'}
                ]
            ],
            autoSort: true,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true
        });
        // 监听查看按钮(主要完成人）
        $("button[lay-filter='subView1']").click(function () {
            var checkStatus = table.checkStatus('currentTableId1')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的项目人员！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                prjMember = {
                    "ry": data[0].ry,
                    "ryxm": data[0].ryxm,
                    "dw": data[0].dw,
                    "dwmc": data[0].dwmc,
                    "dwlx": data[0].dwlx,
                    "dwlxmc": data[0].dwlxmc,
                    "zc": data[0].zc,
                    "zcmc": data[0].zcmc,
                    "xl": data[0].xl,
                    "xlmc": data[0].xlmc,
                    "xmjs": data[0].xmjs,
                    "xmjsmc": data[0].xmjsmc,
                    "bxmfg": data[0].bxmfg,
                    "sxbh": data[0].sxbh,
                    "trgzzys": data[0].trgzzys
                };

                layer.open({
                    title: '浏览项目人员',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: ['820px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjMember/forView',
                    end: function (index) {

                    }
                });
            }
        });
        //双击（主要完成人）
        table.on('rowDouble(currentTableFilter1)', function (obj) {
            var data = obj.data;
            prjMember = {
                "ry": data.ry,
                "ryxm": data.ryxm,
                "dw": data.dw,
                "dwmc": data.dwmc,
                "dwlx": data.dwlx,
                "dwlxmc": data.dwlxmc,
                "zc": data.zc,
                "zcmc": data.zcmc,
                "xl": data.xl,
                "xlmc": data.xlmc,
                "xmjs": data.xmjs,
                "xmjsmc": data.xmjsmc,
                "bxmfg": data.bxmfg,
                "sxbh": data.sxbh,
                "trgzzys": data.trgzzys
            };
            layer.open({
                title: '浏览项目人员',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: ['820px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'prjMember/forView',
                end: function (index) {
                    layer.close(index);
                }
            });
        });

        var dataCompany = new Array();
        $.ajax({
            url: AjaxUtil.ctx + 'prjCompletecompany/list/' + xmId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataCompany = result.data.rows;
            }
        });
        //主要完成单位
        var currTable2 = table.render({
            elem: '#currentTableId2',
            data: dataCompany,
            cols: [
                [
                    {type: 'numbers', align: 'center',width: '7%',title: '序号'},
                    {field: 'dwmc', width: '30%', title: '单位', align: 'left'},
                    {field: 'dwqc', width: '30%', title: '单位全称', align: 'left'},
                    {field: 'lxrxm', width: '15%', title: '联系人', align: 'left'},
                    {field: 'sfzyzfmc', title: '是否转移支付', align: 'center'}
                ]
            ]
        });
        // 监听查看按钮(主要完成单位）
        $("button[lay-filter='subView2']").click(function () {
            var checkStatus = table.checkStatus('currentTableId2')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的单位！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                prjCompany = {
                    "dw": data[0].dw,
                    "dwmc": data[0].dwmc,
                    "dwqc": data[0].dwqc,
                    "lxr": data[0].lxr,
                    "lxrxm": data[0].lxrxm,
                    "sfzyzf": data[0].sfzyzf
                };

                layer.open({
                    title: '浏览完成单位',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: ['820px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjCompletecompany/forView'
                });
            }
        });
        //双击（主要完成单位）
        table.on('rowDouble(currentTableFilter2)', function (obj) {
            var data = obj.data;
            prjCompany = {
                "dw": data.dw,
                "dwmc": data.dwmc,
                "dwqc": data.dwqc,
                "lxr": data.lxr,
                "lxrxm": data.lxrxm,
                "sfzyzf": data.sfzyzf
            };

            layer.open({
                title: '浏览完成单位',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: ['820px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'prjCompletecompany/forView',
                end: function () {
                    layer.close(index);
                }
            });
        });

        //子课题
        var currTable3 = table.render({
            elem: '#currentTableId3',
            url: AjaxUtil.ctx + 'prjSubtopic/list/' + xmId,
            method: 'post',
            cols: [
                [
// {type: 'numbers', align: 'center'},
                    {type: 'numbers', title: '序号', width: '8%'},
                    {field: 'ktmc', title: '课题名称', width: '30%'},
                    {field: 'fzrxm', title: '负责人', width: '10%'},
                    {field: 'fzrszdwmc', title: '负责人所在单位', width: '25%'},
                    {field: 'qssj', title: '起始时间', width: '10%', align: 'center'},
                    {field: 'jssj', title: '结束时间', width: '10%', align: 'center'}
// {title: '操作', toolbar: '#currentTableBar3', width: '10%', align: 'center', fixed: 'right'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            parseData: function (res) { //res 即为原始返回的数据
//年度预算总和
                document.getElementById('rwsys').value = res.data.sum;
                document.getElementById('rwsys2').value = res.data.sum;
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.rows //解析数据列表
                };
            }
        });
        // 监听查看按钮(子课题)
        $("button[lay-filter='btnView3']").click(function () {
            var subTopics = table.cache["currentTableId3"];
            if (subTopics.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId3')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的子课题！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                layer.open({
                    title: '浏览子课题',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: ['1030px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjSubtopic/forView/' + data[0].id,
                    end: function () {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听行工具事件（子课题）
        table.on('tool(currentTableFilter3)', function (obj) {
            var data = obj.data;
            if (obj.event === 'view') {
                layer.open({
                    title: '浏览子课题',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: ['1030px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjSubtopic/forView/' + data.id,
                    end: function () {
                        layer.close(index);
                    }
                });
            }
            return false;
        });
        //双击（子课题）
        table.on('rowDouble(currentTableFilter3)', function (obj) {
            var data = obj.data;
            layer.open({
                title: '浏览子课题',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: ['1030px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'prjSubtopic/forView/' + data.id,
                end: function () {
                    layer.close(index);
                }
            });
        });

        //项目预算列标题
        function getBudgetCols() {

            budgetCols = [];
            budgetCols.push({type: 'numbers', width: '3%'});
            budgetCols.push({field: 'mc', width: '22%', title: '名称'});
            // budgetCols.push({field: 'px', width: '8%', title: '排序'});
            //budgetCols.push({field: 'nf', width: '8%', title: '年份' });
            budgetCols.push({field: 'ysje', width: '10%', title: '预算金额(万元)'});
            for (var i = 0; i < dataCompany.length; i++) {
                budgetCols.push({field: "dw" + (i + 1), width: '10%', title: dataCompany[i].dwmc + '(万元)'})
                if (i >= 9)
                    break;
            }
            ;
            //budgetCols.push({field: 'hjbm', width: '10%', title: '合计编码'});
            //budgetCols.push({field: 'bz', width: '10%', title: '备注'});
        }

        //项目预算
        var insTb5;
        var dataBudget = new Array();
        $.ajax({
            url: AjaxUtil.ctx + 'prjBudget/list/' + xmId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataBudget = result;
            }
        });

        function loadTreetable() {
            insTb5 = treeTable.render({
                elem: '#currentTableId5',
                data: dataBudget,
                skin: 'grid',
                tree: {
                    treeColIndex: 1,
                    treeSpid: "",   //最上级的父级id
                    iconIndex: 1,   // 折叠图标显示在第几列
                    isPidData: true,// 是否是id、pid形式数据
                    idName: 'bm',  // id字段名称
                    pidName: 'fj', // pid字段名称
                    arrowType: 'arrow2',
                    getIcon: 'ew-tree-icon-style2',
                    openName: 'bm'
                },
                treeDefaultClose: false,
                page: false,
                // toolbar: '#toolbarDemo',
                cols: [budgetCols]
            });
        }

        function setPrjBudge() {
            getBudgetCols();
            loadTreetable();
        }

        setPrjBudge();
// 用于存放出资方案数据
        var czfa = new Array();
        $.ajax({
            url: AjaxUtil.ctx + 'prjFeescheme/list/' + xmId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                czfa = result.data.rows;
            }
        });

        //出资方案
        var currTable6 = table.render({
            elem: '#currentTableId6',
            data: czfa,
            cols: [
                [
                    // {type: 'numbers', align: 'center'},
                    {type: 'numbers', title: '序号', width: '8%'},
                    {field: 'nf', title: '年份', width: '12%', align: 'center'},
                    {field: 'dwmc', title: '出资单位', width: '45%'},
                    {field: 'czje', title: '出资金额(万元)', width: '15%', align: 'center'}
                    // {title: '操作', toolbar: '#currentTableBar6', width: '10%', align: 'center', fixed: 'right'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.rows //解析数据列表
                };
            }
        });
        // 监听查看按钮(出资方案)
        $("button[lay-filter='btnView6']").click(function () {
            var czfas = table.cache["currentTableId6"];
            if (czfas.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId6')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的出资方案！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                layer.open({
                    title: '浏览出资方案',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: ['1010px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjFeescheme/forView/' + data[0].id,
                });
            }
        });
        // 监听行工具事件（出资方案）
        table.on('tool(currentTableFilter6)', function (obj) {
            var data = obj.data;
            if (obj.event === 'view') {
                layer.open({
                    title: '浏览出资方案',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: ['1010px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjFeescheme/forView/' + data.id,
                });
            }
            return false;
        });
        //双击（出资方案）
        table.on('rowDouble(currentTableFilter6)', function (obj) {
            var data = obj.data;
            layer.open({
                title: '浏览出资方案',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: ['1010px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'prjFeescheme/forView/' + data.id,
            });
        });

        //联系方式
        var currTable8 = table.render({
            elem: '#currentTableId8',
            url: AjaxUtil.ctx + 'prjContacts/list/' + xmId,
            method: 'post',
            cols: [
                [
                    {type: 'numbers', align: 'center',title: '序号',width: '7%'},
                    {field: 'dwmc', title: '单位', width: '30%'},
                    {field: 'lxrxm', title: '联系人', width: '10%'},
                    {field: 'gddh', title: '固定电话', width: '12%'},
                    {field: 'dzyj', title: '电子邮件', width: '18%'},
                    {field: 'lxmc', title: '类型', width: '10%'}
                    // {title: '操作', toolbar: '#currentTableBar8', width: '10%', align: 'center', fixed: 'right'}
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.rows //解析数据列表
                };
            }
        });
        // 监听查看按钮(联系方式)
        $("button[lay-filter='btnView8']").click(function () {
            var contacts = table.cache["currentTableId8"];
            if (contacts.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId8')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要浏览的联系方式！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行浏览！", 1500);
            } else {
                layer.open({
                    title: '浏览联系方式',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: ['900px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjContacts/forView/' + data[0].id,
                    end: function () {
                        layer.close(index);
                    }
                });
            }
        });
        // 监听行工具事件（联系方式）
        table.on('tool(currentTableFilter8)', function (obj) {
            var data = obj.data;
            if (obj.event === 'view') {
                layer.open({
                    title: '浏览联系方式',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: ['900px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'prjContacts/forView/' + data.id,
                    end: function () {
                        layer.close(index);
                    }
                });
            }
            return false;
        });
        //双击（联系方式）
        table.on('rowDouble(currentTableFilter8)', function (obj) {
            var data = obj.data;
            layer.open({
                title: '浏览联系方式',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: ['900px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'prjContacts/forView/' + data.id,
                end: function () {
                    layer.close(index);
                }
            });
        });

        // 用于存放表格数据
        var dataFj = new Array();
        if ([[${project.fj}]] != null && [[${project.fj}]] != "") {
            dataFj = eval('(' + [[${project.fj}]] + ')');
        }
        //附件
        table.render({
            elem: '#currentTableId9',
            data: dataFj,
            cols: [
                [
                    {type: 'numbers', align: 'center',title: '序号',width: '7%'},
                    {field: 'wjm', title: '文件名', width: '40%'},
                    {field: 'scrq', title: '上传日期', width: '20%'},
                   /* {field: 'sm', title: '说明'},*/
                ]
            ]
        });
        //双击（附件）
        table.on('rowDouble(currentTableFilter9)', function (obj) {
            window.open(obj.data.Url);
        });

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

    //设置项目完成人员信息
    function setMember(member) {
        prjMember = member;
    }

    //获取当前的项目人员
    function getMember() {
        return prjMember;
    }

    //获取当前的项目完成单位信息
    function getCompany() {
        return prjCompany;
    }

    //设置项目完成单位信息
    function setCompany(company) {
        prjCompany = company;
    }

    //获取子课题信息
    function getZktInfo() {
        return subTopic;
    }
</script>
</body>
</html>