<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>项目可研报告编辑</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
    <style>
        body {
            background-color: #ffffff;
        }

        .layui-body {
            overflow-y: scroll;
        }
    </style>
</head>
<body>
<div class="layui-tab layui-tab-card">
    <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>
        <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">
                    <div class="layui-form-item">
                        <label class="layui-form-label required" style="width: 90px">名称</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <input type="hidden" id="id" name="id" th:value="${report.id}">
                            <input type="text" id="mc" name="mc" lay-verify="required" lay-reqtext="项目名称不能为空" maxlength="30"
                                   placeholder="项目名称（中文）不能超过30字（含字符）" th:value="${report.mc}" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required" style="width: 90px">申请单位</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <input type="hidden" name="sqdw" id="sqdw" th:value="${report.sqdw}" class="layui-input">
                            <input type="text" id="sqdwName" name="sqdwName" lay-verify="required"
                                   th:value="${report.sqdwName}" lay-reqtext="申请单位不能为空" autocomplete="off"
                                   class="layui-input" readonly>
                        </div>
                    </div>
                    <div class="layui-form-item layui-inline" style="width: 100%">
                        <label class="layui-form-label required" style="width: 90px">项目起止时间</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <div class="layui-input-inline">
                                <input type="text" name="qs" id="qs" placeholder="开始日期" th:value="${report.qs}"
                                       autocomplete="off" class="layui-input">
                                <tip>日期格式：yyyy-MM-dd</tip>
                            </div>
                            <div class="layui-form-mid">-</div>
                            <div class="layui-input-inline">
                                <input type="text" name="wc" id="wc" placeholder="结束日期" th:value="${report.wc}"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">项目类型</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <input type="hidden" name="xmlx" id="xmlx" th:value="${report.xmlx}" class="layui-input"
                                   readonly>
                            <input type="text" name="xmlxmc" id="xmlxmc" th:value="${report.xmlxmc}" class="layui-input"
                                   readonly>
                            <!--                            <select name="xmlx" id="xmlx" lay-filter="status">-->
                            <!--                                <option value="">&#45;&#45; 请选择 &#45;&#45;</option>-->
                            <!--                                <option th:each="item:${xmlxList}" th:text="${item.name}" th:value="${item.code}"-->
                            <!--                                        th:selected="(${report.getXmlx()} eq ${item.code})"></option>></option>-->
                            <!--                            </select>-->
                        </div>
                    </div>

                    <div class="layui-form-item ">
                        <label class="layui-form-label required" style="width: 90px">项目负责人</label>
                        <div class="layui-input-inline" style="width: 84.8%;height: 30px;">
                            <div class="layui-btn-group" style="padding-bottom: 0px;margin-bottom: -8px">
                                <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm upload"
                                        lay-data="{fileType:'personFile'}"><i class="layui-icon"></i>导入
                                </button>
                                <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                        lay-filter="btnAdd1"><i class="layui-icon"></i>增加
                                </button>
<!--                                <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                        lay-filter="btnEdit1"><i class="layui-icon">&#xe642;</i>编辑
                                </button>-->
                                <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                        lay-filter="btnDelete1"><i class="layui-icon"></i>删除
                                </button>
                                <!--                                <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm" lay-filter="btnBrowse1"><i class="layui-icon">&#xe63c;</i>查看</button>-->
                                <a class="layui-btn layui-btn-primary layui-btn-sm " th:href="${ProjectRYTemplate}">
                                    <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>人员模板
                                </a>
                            </div>
                        </div>
                        <div class="layui-input-inline"
                             style="width: 84.8%;height: 200px;margin: 0px;border: 1px solid;border-color: #dddddd;overflow-y: auto">
                            <table class="layui-hide" id="currentTableId1" lay-filter="currentTableFilter1"
                                   style="padding-top: 0px;margin-top: -5px;"></table>
                        </div>
                    </div>
                    <div class="layui-form-item layui-inline" style="width: 100%">
                        <label class="layui-form-label" style="width: 90px">通讯地址</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" name="txdd" id="txdd" th:value="${report.txdd}" autocomplete="off"
                                       class="layui-input">
                            </div>
                            <div class="layui-form-label">邮政编码</div>
                            <div class="layui-input-inline" style="width: 300px">
                                <input type="text" name="yzbm" id="yzbm" th:value="${report.yzbm}" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item layui-inline" style="width: 100%">
                        <label class="layui-form-label" style="width: 90px">电话</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" name="dh" id="dh" th:value="${report.dh}" autocomplete="off" maxlength="11"
                                       class="layui-input">
                            </div>
                            <div class="layui-form-label">传真</div>
                            <div class="layui-input-inline" style="width: 300px">
                                <input type="text" name="cz" id="cz" th:value="${report.cz}" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item layui-inline" style="width: 100%">
                        <label class="layui-form-label required" style="width: 90px">所属部门</label>
                        <div class="layui-input-inline" id="parent_div" style="width: 400px">
                            <input type="hidden" name="ssbm" id="ssbm" th:value="${report.ssbm}" class="layui-input">
                            <input type="text" id="ssbmName" name="ssbmName" lay-verify="required"
                                   th:value="${report.ssbmName}" lay-reqtext="申请单位不能为空" class="layui-input" readonly>
                        </div>
                        <div class="layui-form-label required">申请日期</div>
                        <div class="layui-input-inline" style="width: 300px">
                            <input type="text" name="sqrq" id="sqrq" th:value="${report.sqrq}" lay-verify="required"
                                   lay-reqtext="申请日期不能为空" class="layui-input">
                            <tip>日期格式：yyyy-MM-dd</tip>
                        </div>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveNormal" id="normalBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-submit lay-filter="saveNormal">
                            <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">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">目的和意义</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <textarea id="mdhyywb" name="mdhyywb" th:text="${report.mdhyywb}" class="layui-textarea"
                                      style="width: 100%;height: 339px"></textarea>
                            <label class="layui-form-label" style="color:grey;width: 100%;text-align: left">文本内容，如果包含图片，请下载模板编辑后上传，并清空当前编辑框</label>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">
                        </label>
                        <input type="hidden" id="mdhyy" name="mdhyy" class="layui-input"/>
                        <div class="layui-input-inline" style="width: 85%">
                            <table class="layui-hide" id="currentTableId_MDHYY" lay-filter="currentTableId_MDHYY"
                                   style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                    </div>
                    <div class="layui-btn-container">
                        <label class="layui-form-label" style="width: 90px"></label>
                        <button type="button" class="layui-btn layui-btn upload" lay-data="{fileType:'mdhyyFile'}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>上传附件
                        </button>
                        <a class="layui-btn layui-btn-primary" th:href="${mdhyyTemplate}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>下载模板
                        </a>
                        <button type="button" class="layui-btn layui-btn layui-btn-danger" lay-filter="delMdhyy">
                            <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>删除
                        </button>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveMdhyy" id="mdhyyBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveMdhyy">
                            <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">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">研究水平</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <textarea id="gnwyjspzswb" name="gnwyjspzswb" th:text="${report.gnwyjspzswb}"
                                      class="layui-textarea" style="width: 100%;height: 339px"></textarea>
                            <label class="layui-form-label" style="color:grey;width: 100%;text-align: left">文本内容，如果包含图片，请下载模板编辑后上传，并清空当前编辑框</label>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">
                        </label>
                        <input type="hidden" id="gnwyjspzs" name="gnwyjspzs" class="layui-input"/>
                        <div class="layui-input-inline" style="width: 85%">
                            <table class="layui-hide" id="currentTableId_YJSP" lay-filter="currentTableId_YJSP"
                                   style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                    </div>
                    <div class="layui-btn-container">
                        <label class="layui-form-label" style="width: 90px"></label>
                        <button type="button" class="layui-btn layui-btn upload" lay-data="{fileType:'yjspFile'}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>上传附件
                        </button>
                        <a class="layui-btn layui-btn-primary" th:href="${yjspTemplate}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>下载模板
                        </a>
                        <button type="button" class="layui-btn layui-btn layui-btn-danger" lay-filter="delYjsp">
                            <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>删除
                        </button>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveYjsp" id="yjspBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveYjsp">
                            <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">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">理论实践依据</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <textarea id="xmdllhsjyjwb" name="xmdllhsjyjwb" th:text="${report.xmdllhsjyjwb}"
                                      class="layui-textarea" style="width: 100%;height: 339px"></textarea>
                            <label class="layui-form-label" style="color:grey;width: 100%;text-align: left">文本内容，如果包含图片，请下载模板编辑后上传，并清空当前编辑框</label>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">
                        </label>
                        <input type="hidden" id="xmdllhsjyj" name="xmdllhsjyj" class="layui-input"/>
                        <div class="layui-input-inline" style="width: 85%">
                            <table class="layui-hide" id="currentTableId_LLSJYJ" lay-filter="currentTableId_LLSJYJ"
                                   style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                    </div>
                    <div class="layui-btn-container">
                        <label class="layui-form-label" style="width: 90px"></label>
                        <button type="button" class="layui-btn layui-btn upload" lay-data="{fileType:'llsjyjFile'}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>上传附件
                        </button>
                        <a class="layui-btn layui-btn-primary" th:href="${llsjyjTemplate}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>下载模板
                        </a>
                        <button type="button" class="layui-btn layui-btn layui-btn-danger" lay-filter="delLlsjyj">
                            <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>删除
                        </button>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveLlsjyj" id="llsjyjBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveLlsjyj">
                            <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">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">研究内容</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <textarea id="xmyjnrhssfawb" name="xmyjnrhssfawb" th:text="${report.xmyjnrhssfawb}"
                                      class="layui-textarea" style="width: 100%;height: 339px"></textarea>
                            <label class="layui-form-label" style="color:grey;width: 100%;text-align: left">文本内容，如果包含图片，请下载模板编辑后上传，并清空当前编辑框</label>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">
                        </label>
                        <input type="hidden" id="xmyjnrhssfa" name="xmyjnrhssfa" th:value="${report.xmyjnrhssfa}"
                               class="layui-input"/>
                        <div class="layui-input-inline" style="width: 85%">
                            <table class="layui-hide" id="currentTableId_YJNR" lay-filter="currentTableId_YJNR"
                                   style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                    </div>
                    <div class="layui-btn-container">
                        <label class="layui-form-label" style="width: 90px"></label>
                        <button type="button" class="layui-btn layui-btn upload" lay-data="{fileType:'yjnrFile'}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>上传附件
                        </button>
                        <a class="layui-btn layui-btn-primary" th:href="${yjnrTemplate}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>下载模板
                        </a>
                        <button type="button" class="layui-btn layui-btn layui-btn-danger" lay-filter="delYjnr">
                            <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>删除
                        </button>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveYjnr" id="yjnrBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveYjnr">
                            <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="min-height: 525px">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">经济性<br/>财务合规性</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <textarea id="jjxycwhgx" name="jjxycwhgx" th:text="${report.jjxycwhgx}"
                                      class="layui-textarea" style="width: 100%;height: 430px"></textarea>
                        </div>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveJjxcwhgx" id="jjxcwhgxBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveJjxycwhgx">
                            <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="min-height: 525px">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">预期目标<br/>和成果形式</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <textarea id="yqmbhcgxs" name="yqmbhcgxs" th:text="${report.yqmbhcgxs}"
                                      class="layui-textarea" style="width: 100%;height: 430px"></textarea>
                        </div>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveYqmb" id="yqmbBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveYqmb">
                            <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="min-height: 525px">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">合作单位或<br/>依托工程单位<br/>落实情况</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <textarea id="hzdwhytgcdwlsqk" name="hzdwhytgcdwlsqk" th:text="${report.hzdwhytgcdwlsqk}"
                                      class="layui-textarea" style="width: 100%;height: 430px"></textarea>
                        </div>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveHzdw" id="hzdwBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveHzdw">
                            <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="min-height: 525px; padding-left: 30px; padding-right: 30px">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <!--                        <label class="layui-form-label" style="width: 100px">-->
                        <!--                        </label>-->
                        <input type="hidden" id="xmcddwdtj" name="xmcddwdtj" th:value="${report.xmcddwdtj}"
                               class="layui-input"/>
                        <div class="layui-input-inline" style="width: 100%">
                            <table class="layui-hide" id="currentTableId_CDDWTJ" lay-filter="currentTableId_CDDWTJ"
                                   style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                    </div>
                    <div class="layui-btn-container">
                        <!--                        <label class="layui-form-label" style="width: 90px"></label>-->
                        <button type="button" class="layui-btn layui-btn upload" lay-data="{fileType:'cddwtjFile'}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>上传附件
                        </button>
                        <a class="layui-btn layui-btn-primary" th:href="${cddwtjTemplate}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>下载模板
                        </a>
                        <button type="button" class="layui-btn layui-btn layui-btn-danger" lay-filter="delCddwtj">
                            <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>删除
                        </button>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveCddw" id="cddwBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveCddw">
                            <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="min-height: 525px; padding-left: 30px; padding-right: 30px">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">

                    <div class="layui-form-item ">
                        <div class="layui-input-inline" style="width: 100%">
                            <div id="toolbarPlan" class="layui-btn-group"
                                 style="padding-bottom: 0px;margin-bottom: 0px">
                                <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                        lay-filter="btnPlanAdd" data-type="addRow"><i class="layui-icon"></i>增加一行
                                </button>
                            </div>
                            <table class="layui-hide" id="planTableId" lay-filter="planTableId"
                                   style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveJdap" id="jdapBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveJdap">
                            <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="min-height: 515px; padding-left: 30px; padding-right: 30px">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <input type="hidden" id="jfyszt" name="jfyszt">
                    <table class="layui-hide" id="currentTableId_Jfys" lay-filter="currentTableFilter5"></table>
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveJfys" id="jfysBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveJfys">
                            <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">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">审查意见</label>
                        <div class="layui-input-inline" style="width: 85%">
                            <textarea id="sqdwldscyj1" name="sqdwldscyj1" th:text = "${report.sqdwldscyj1}"class="layui-textarea"
                                      style="width: 100%;height: 339px"></textarea>
<!--                            <label class="layui-form-label" style="color:grey;width: 100%;text-align: left">文本内容，如果包含图片，请下载模板编辑后上传，并清空当前编辑框</label>-->
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 90px">
                        </label>
                        <input type="hidden" id="scyjfj" name="scyjfj" class="layui-input"/>
                        <div class="layui-input-inline" style="width: 85%">
                            <table class="layui-hide" id="currentTableId_SCYJ" lay-filter="currentTableId_SCYJ"
                                   style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                    </div>
                    <div class="layui-btn-container">
                        <label class="layui-form-label" style="width: 90px"></label>
                        <button type="button" class="layui-btn layui-btn upload" lay-data="{fileType:'scyjFile'}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>上传附件
                        </button>
<!--                        <a class="layui-btn layui-btn-primary" th:href="${scyjTemplate}">-->
<!--                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>下载模板-->
<!--                        </a>-->
                        <button class="layui-btn layui-btn layui-btn-danger" lay-filter="delScyj">
                            <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>删除
                        </button>
                    </div>
                </div>
                <!-- 右侧悬浮按钮 -->
                <div class="layui-form layuimini-form">
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveScyj">
                            <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="min-height: 525px; padding-left: 30px; padding-right: 30px">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <input type="hidden" id="fj" name="fj" th:value="${report.fj}" class="layui-input"/>
                        <div class="layui-input-inline" style="width: 100%">
                            <table class="layui-hide" id="currentTableId_FJ" lay-filter="currentTableId_FJ"
                                   style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                    </div>
                    <div class="layui-btn-container">
                        <!--                        <label class="layui-form-label" style="width: 90px"></label>-->
                        <button type="button" class="layui-btn layui-btn upload" lay-data="{fileType:'fjFile'}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>上传附件
                        </button>
                        <a class="layui-btn layui-btn-primary" th:href="${fjTemplate}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>下载模板
                        </a>
                        <button type="button" class="layui-btn layui-btn layui-btn-danger" lay-filter="delFj">
                            <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>删除
                        </button>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveFj">
                            <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="min-height: 525px; padding-left: 30px; padding-right: 30px">
            <form class="layui-form" action="" lay-filter="formDemo">
                <div class="layui-form layuimini-form">
                    <div class="layui-form-item">
                        <input type="hidden" id="ygzmwj" name="ygzmwj" th:value="${report.ygzmwj}" class="layui-input"/>
                        <div class="layui-input-inline" style="width: 100%">
                            <table class="layui-hide" id="currentTableId_QMGZ" lay-filter="currentTableId_QMGZ"
                                   style="padding-top: 0px;margin-top: 0px"></table>
                        </div>
                    </div>
                    <div class="layui-btn-container">
                        <!--                        <label class="layui-form-label" style="width: 190px"></label>-->
                        <button type="button" class="layui-btn layui-btn upload" lay-data="{fileType:'qmgzFile'}">
                            <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>上传签名盖章文件
                        </button>
                        <button type="button" class="layui-btn layui-btn layui-btn-danger" lay-filter="delQmgz">
                            <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>删除
                        </button>
                    </div>
                </div>
                <div class="layui-form layuimini-form">
                    <!-- 右侧悬浮按钮 -->
                    <!--                    <div class="right-bottom-btn" style="padding-right: 1%">-->
                    <!--                        <button class="layui-hide" lay-submit lay-filter="saveQmgz" id="qmgzBtn"><i-->
                    <!--                                class="layui-icon layui-icon-ok"></i>校验-->
                    <!--                        </button>-->
                    <!--                    </div>-->
                    <div class="right-bottom-btn">
                        <button type="button" class="layui-btn" lay-filter="saveQmgz">
                            <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-form layuimini-form">-->
        <!--            <div class="right-bottom-btn" style="padding-right: 1%">-->
        <!--                <button class="layui-btn submit-btn"><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>-->
        <button type="button" id="fileupload" class="layui-hide">文件上传</button>
    </div>
</div>
<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="@{/js/lay-config.js}" charset="utf-8"></script>
<script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
<script type="text/javascript" th:inline="javascript">
    AjaxUtil.ctx = /*[[@{/}]]*/'';
    var updateflag = 0;
    var prjMember = [];
    var userList1 = [];

    layui.use(['form', 'layer', 'table', 'tableSelect', 'treeTable', 'laydate', 'upload'], function () {
        var form = layui.form,
            table = layui.table,
            tableSelect = layui.tableSelect,
            treeTable = layui.treeTable,
            laydate = layui.laydate,
            layer = layui.layer,
            upload = layui.upload;
        var xmId = $("#id").val();
        var dataBudget = new Array();

        //日期
        laydate.render({
            elem: '#qs',
            done: function (value,date,endDate) {
                const qs = $("#qs").val();
                const wc = $("#wc").val();
                const qs1 = new Date(qs).getTime();
                const wc1 = new Date(wc).getTime();
                // 计算三个月的毫秒数，一个月按 30 天估算
                const threeMonthsInMs = 3 * 30 * 24 * 60 * 60 * 1000;
                // 计算时间差
                const timeDiff = Math.abs(wc1 - qs1);
                if (qs1 > wc1){
                    layer.msg('项目完成时间不能早于项目开始时间',{icon: 2},function () {
                        $('#qs').val('');
                        return;
                    })

                }else if (qs1 == wc1){
                    layer.msg('项目时间早于三个月',{icon:2},function () {
                        $('#wc').val('');
                        return;
                    })

                }else if (timeDiff > 0){

                }

            }
        });
        laydate.render({
            elem: '#wc',
            done: function (value, date, endDate) {
                var qs = $("#qs").val();
                var wc = $("#wc").val();
                if (qs != "" && wc != "") {
                    if (qs > wc) {
                        Message.warning("结束日期不能早于起始日期！", 1500);
                        $("#wc").val("");
                    }
                }
            }
        });
        laydate.render({
            elem: '#sqrq'
        });

        //申请单位
        tableSelect.render({
            elem: '#sqdwName',
            checkedKey: 'id',
            searchKey: 'mc',
            searchPlaceholder: '搜索单位',
            table: {
                url: AjaxUtil.ctx + 'baseCompany/dwlist',
                cols: [
                    [
                        {type: 'radio'},
                        {type: 'numbers', align: 'center'},
                        {field: 'mc', width: '50%', title: '名称'},
                        {field: 'dwqc', width: '50%', title: '单位全称'}
                    ]
                ]
            },
            done: function (elem, data) {
                var NEWJSON = [];
                var NEWJSON1 = [];
                var NEWJSONADDR = [];
                var NEWJSONPOSTCODE = [];
                var NEWJSONTEL = [];
                var NEWJSONFAX = [];
                layui.each(data.data, function (index, item) {
                    NEWJSON.push(item.mc);
                    NEWJSON1.push(item.id);
                    NEWJSONADDR.push(item.txdz);
                    NEWJSONPOSTCODE.push(item.yzbm);
                    NEWJSONTEL.push(item.gddh);
                    NEWJSONFAX.push(item.cz);
                });
                elem.val(NEWJSON.join(","));
                $("#sqdw").val(NEWJSON1.join(","));
                $("#txdz").val(NEWJSONADDR.join(","));
                $("#yzbm").val(NEWJSONPOSTCODE.join(","));
                $("#dh").val(NEWJSONTEL.join(","));
                $("#cz").val(NEWJSONFAX.join(","));
            }
        });

        // //所属部门
        // tableSelect.render({
        //     elem: '#ssbmName',
        //     checkedKey: 'id',
        //     searchKey: 'mc',
        //     searchPlaceholder: '搜索部门',
        //     table: {
        //         url: AjaxUtil.ctx + 'baseCompany/dwlist',
        //         cols: [
        //             [
        //                 {type: 'radio'},
        //                 {type: 'numbers', align: 'center'},
        //                 {field: 'mc', width: '50%',title: '名称'},
        //                 {field: 'dwqc', width: '50%', title: '全称'}
        //             ]
        //         ]
        //     },
        //     done: function (elem, data) {
        //         var NEWJSON = [];
        //         var NEWJSON1 = [];
        //         layui.each(data.data, function (index, item) {
        //             NEWJSON.push(item.mc);
        //             NEWJSON1.push(item.id);
        //         });
        //         elem.val(NEWJSON.join(","));
        //         $("#ssbm").val(NEWJSON1.join(","));
        //     }
        // });

        var tableData = new Array(); // 用于存放表格数据

        //项目负责人
        var directorData = eval('(' + [[${report.staDirectorList}]] + ')');

        var currTable1 = table.render({
            elem: '#currentTableId1',
            data: directorData,
            cols: [
                [
                    {type: "checkbox", width: '60', fixed: 'left'},
                    {type: 'numbers', width: '100', title: '序号', align: 'center'},
                    {field: 'xm', width: '120', title: '姓名'},
                    {field: 'dwmc', width: '300', title: '单位'},
                    {field: 'gddh', width: '150', title: '联系电话'}
                ]
            ],
            autoSort: true,
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });

        // 添加项目负责人
        $("button[lay-filter='btnAdd1']").click(function () {
            var index = layer.open({
                title: '添加项目负责人',
                type: 2,
                maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'reportinfo/addfzr',
                end: function () {
                    if (updateflag == 1) {
                        var oldData = table.cache["currentTableId1"];
                        var data1 = {
                            "xh": prjMember.xh,
                            "xm": prjMember.ryxm,
                            "fzr": prjMember.ry,
                            "gddh": prjMember.gddh,
                            "dw": prjMember.dw,
                            "dwmc": prjMember.dwmc
                        };
                        oldData.push(data1);
                        table.reload('currentTableId1', {
                            data: oldData
                        });
                    }
                    updateflag = 0;
                    layer.close(index);
                }
            });
        });
        // 编辑项目负责人
        $("button[lay-filter='btnEdit1']").click(function () {
            var members = table.cache["currentTableId1"];
            if (members.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId1')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要编辑的项目人员！", 1500);
            } else if (data.length > 1) {
                Message.warning("请选择一条记录进行编辑操作！", 1500);
            } else {
                prjMember = {
                    "xh": data[0].xh,
                    "ryxm": data[0].xm,
                    "ry": data[0].fzr,
                    "gddh": data[0].gddh,
                    "dw": data[0].dw,
                    "dwmc": data[0].dwmc
                }

                var index = layer.open({
                    title: '编辑项目负责人',
                    type: 2,
                    maxmin: true,
                    shade: 0.2,
                    area: [layerwidth + 'px', layerheight + 'px'],
                    content: AjaxUtil.ctx + 'reportinfo/updatefzr',
                    end: function () {
                        if (updateflag == 1) {
                            var data1 = {
                                "xh": prjMember.xh,
                                "xm": prjMember.ryxm,
                                "fzr": prjMember.ry,
                                "gddh": prjMember.gddh,
                                "dw": prjMember.dw,
                                "dwmc": prjMember.dwmc
                            };

                            var oldData = table.cache["currentTableId1"];
                            for (var i = 0; i < oldData.length; i++) {
                                var item = oldData[i];
                                if (item.LAY_CHECKED) {//条件：选中
                                    // oldData.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                                    oldData[i] = data1;
                                    break;
                                }
                            }
                            var currData = oldData;
                            table.reload('currentTableId1', {
                                data: currData
                            });
                        }
                        updateflag = 0;
                        layer.close(index);
                    }

                });
            }
        });
        // 删除项目负责人
        $("button[lay-filter='btnDelete1']").click(function () {
            var checkStatus = table.checkStatus('currentTableId1')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的项目负责人！", 1000);
                return;
            }

            var userIds = [];
            for (var i = 0, len = data.length; i < len; i++) {
                userIds.push(data[i].fzr);
            }
            layer.confirm('确定批量删除项目负责人吗？', function (index) {
                layer.close(index);
                var oldData = table.cache['currentTableId1'];
                for (var i = 0; i < oldData.length; i++) {
                    var item = oldData[i];
                    if ($.inArray(item.fzr, userIds) != -1) {
                        oldData.splice(i, 1);
                        i--;
                    }
                }
                var currData = oldData;
                table.reload('currentTableId1', {
                    data: currData
                });
            });
        });
        var dataMdhyy = eval('(' + [[${report.mdhyy}]] + ')');
        var currTable_mdhyy = fileTableInit(table, '#currentTableId_MDHYY', dataMdhyy, 'mdhyyFile');

        var dataGnwyjspzs = eval('(' + [[${report.gnwyjspzs}]] + ')');
        var currTable_yjsp = fileTableInit(table, '#currentTableId_YJSP', dataGnwyjspzs, 'yjspFile');

        var dataXmdllhsjyj = eval('(' + [[${report.xmdllhsjyj}]] + ')');
        var currTable_llsjyj = fileTableInit(table, '#currentTableId_LLSJYJ', dataXmdllhsjyj, 'llsjyjFile');

        var dataXmyjnrhssfa = eval('(' + [[${report.xmyjnrhssfa}]] + ')');
        var currTable_yjnr = fileTableInit(table, '#currentTableId_YJNR', dataXmyjnrhssfa, 'yjnrFile');

        var dataXmscyjhssfa = eval('(' + [[${report.scyjfj}]] + ')');
        var currTable_scyj = fileTableInit(table, '#currentTableId_SCYJ', dataXmscyjhssfa, 'scyjFile');


        var dataXmcddwdtj = eval('(' + [[${report.xmcddwdtj}]] + ')');
        var currTable_cddwtj = fileTableInit(table, '#currentTableId_CDDWTJ', dataXmcddwdtj, 'cddwtjFile');

        var dataFj = eval('(' + [[${report.fj}]] + ')');
        var currTable_fj = fileTableInit(table, '#currentTableId_FJ', dataFj, 'fjFile');

        var dataYgzmwj = eval('(' + [[${report.ygzmwj}]] + ')');
        var currTable_qmgz = fileTableInit(table, '#currentTableId_QMGZ', dataYgzmwj, 'qmgzFile');


        //文件上传
        var uploadInst = upload.render({
            elem: '.upload' //绑定元素
            , url: AjaxUtil.ctx + 'fileupload/upload'
            , methd: 'post'
            , accept: 'file'
            , data: {}
            , done: function (res) {
                if (0 === res.code) {
                    if (res.data.fileType == "personFile") {
                        if (0 === res.data.code) {
                            var currData = [];
                            for (var i = 0; i < res.data.list.length; i++) {
                                var currMember = {
                                    "xm": res.data.list[i].xm,
                                    "fzr": res.data.list[i].id,
                                    "gddh": res.data.list[i].gddh,
                                    "dwmc": res.data.list[i].dwmc,
                                    "xh": res.data.list[i].xh
                                };
                                currData.push(currMember);
                            }
                            ;
                            table.reload('currentTableId1', {
                                data: currData
                            });
                        } else if (10 === res.data.code) {
                            layer.alert("文件中部分人员未录入到系统！" + res.data.tipList.toString());
                        } else if (20 === res.data.code) {
                            layer.alert("文件中不存在可识别的记录！");
                        } else {
                            layer.alert("上传格式错误！");
                        }
                        table.reload('currentTableId1', {
                            data: currData
                        });
                    } else {
                        var tableID = "";
                        var wbID = "";
                        var oldData = [];
                        switch (res.data.fileType) {
                            case "mdhyyFile":
                                tableID = "currentTableId_MDHYY";
                                wbID = "mdhyy";
                                oldData = dataMdhyy;
                                break;
                            case "yjspFile":
                                tableID = "currentTableId_YJSP";
                                wbID = "gnwyjspzs";
                                oldData = dataGnwyjspzs;
                                break;
                            case "llsjyjFile":
                                tableID = "currentTableId_LLSJYJ";
                                wbID = "xmdllhsjyj";
                                oldData = dataXmdllhsjyj;
                                break;
                            case "yjnrFile":
                                tableID = "currentTableId_YJNR";
                                wbID = "xmyjnrhssfa";
                                oldData = dataXmyjnrhssfa;
                                break;
                            case "cddwtjFile":
                                tableID = "currentTableId_CDDWTJ";
                                wbID = "xmcddwdtj";
                                oldData = dataXmcddwdtj;
                                break;
                            case "fjFile":
                                tableID = "currentTableId_FJ";
                                wbID = "fj";
                                oldData = dataFj;
                                break;
                            case "qmgzFile":
                                tableID = "currentTableId_QMGZ";
                                wbID = "qmgz";
                                oldData = dataYgzmwj;
                                break;
                            case "scyjFile":
                                tableID = "currentTableId_SCYJ";
                                wbID = "scyjfj";
                                oldData = dataXmscyjhssfa;
                                break;
                            default:
                                tableID = "currentTableId_MDHYY";
                                wbID = "mdhyy";
                                oldData = dataMdhyy;
                                break
                        }

                        var curData = {
                            "wjm": res.data.fileName,
                            "scrq": res.data.fileDate,
                            "Url": res.data.fileUrl,
                            "sm": res.data.sm
                        };
                        oldData.push(curData);
                        table.reload(tableID, {
                            data: oldData
                        });
                    }
                } else
                    layer.alert("上传文件出现错误！");

            }
            , error: function () {
                layer.alert("上传文件出现错误！");
            }
            , before: function (res) {
                let fileType = this.fileType;
                this.data.fileType = fileType;
            }
        });

        //删除文件（目的和意义）
        $("button[lay-filter='delMdhyy']").click(function () {
            if (dataMdhyy.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_MDHYY')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的文件！", 1000);
                return;
            }
            for (var i = 0; i < dataMdhyy.length; i++) {
                var item = dataMdhyy[i];
                if (item.LAY_CHECKED) {//条件：选中
                    dataMdhyy.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            currTable_mdhyy.reload();
        });
        //删除文件（研究水平）
        $("button[lay-filter='delYjsp']").click(function () {
            if (dataGnwyjspzs.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_YJSP')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的文件！", 1000);
                return;
            }
            for (var i = 0; i < dataGnwyjspzs.length; i++) {
                var item = dataGnwyjspzs[i];
                if (item.LAY_CHECKED) {//条件：选中
                    dataGnwyjspzs.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            currTable_yjsp.reload();
        });
        //删除文件（审查意见）
        $("button[lay-filter='delscyj']").click(function () {
            if (dataXmscyjhssfa.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_scyj')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的文件！", 1000);
                return;
            }
            for (var i = 0; i < dataXmscyjhssfa.length; i++) {
                var item = dataXmyjnrhssfa[i];
                if (item.LAY_CHECKED) {//条件：选中
                    dataXmscyjhssfa.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            currTable_scyj.reload();
        });
        //删除文件（理论实践依据）
        $("button[lay-filter='delLlsjyj']").click(function () {
            if (dataXmdllhsjyj.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_LLSJYJ')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的文件！", 1000);
                return;
            }
            for (var i = 0; i < dataXmdllhsjyj.length; i++) {
                var item = dataXmdllhsjyj[i];
                if (item.LAY_CHECKED) {//条件：选中
                    dataXmdllhsjyj.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            currTable_llsjyj.reload();
        });
        //删除文件（研究内容）
        $("button[lay-filter='delYjnr']").click(function () {
            if (dataXmyjnrhssfa.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_YJNR')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的文件！", 1000);
                return;
            }
            for (var i = 0; i < dataXmyjnrhssfa.length; i++) {
                var item = dataXmyjnrhssfa[i];
                if (item.LAY_CHECKED) {//条件：选中
                    dataXmyjnrhssfa.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            currTable_yjnr.reload();
        });
        //删除文件（承担单位条件）
        $("button[lay-filter='delCddwtj']").click(function () {
            if (dataXmcddwdtj.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_CDDWTJ')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的文件！", 1000);
                return;
            }
            for (var i = 0; i < dataXmcddwdtj.length; i++) {
                var item = dataXmcddwdtj[i];
                if (item.LAY_CHECKED) {//条件：选中
                    dataXmcddwdtj.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            currTable_cddwtj.reload();
        });
        //删除文件（附件）
        $("button[lay-filter='delFj']").click(function () {
            if (dataFj.length == 0)
                return;

            var checkStatus = table.checkStatus('currentTableId_FJ')
                , data = checkStatus.data;
            if (data == null || data.length === 0) {
                Message.warning("请选择要删除的文件！", 1000);
                return;
            }
            for (var i = 0; i < dataFj.length; i++) {
                var item = dataFj[i];
                if (item.LAY_CHECKED) {//条件：选中
                    dataFj.splice(i, 1);//移除后后造成数组下标索引发生变化，所以下面需要i--
                    i--;
                }
            }
            //刷新表格
            currTable_fj.reload();
        });
        //删除文件（签名盖章）
        $("button[lay-filter='delQmgz']").click(function () {
            if (dataYgzmwj.length == 0)
                return;

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

        //进度安排
        var planTableData = new Array(); // 用于存放表格数据
        var layPlanTableId = "layTable";
        var planData = eval('(' + [[${report.staScheduleList}]] + ')');
        var planTable = table.render({
            elem: '#planTableId',
            id: layPlanTableId,
            data: planData,
            cols: [
                [
                    {type: 'numbers', width: '60', align: 'center'},
                    {field: 'yjnr', width: '60%', title: '研究内容', edit: 'text', align: 'left'},
                    {
                        field: 'qssj',
                        width: '120',
                        title: '起始日期',
                        event: 'planStartDate',
                        data_field: 'qsrq',
                        align: 'center'
                    },
                    {
                        field: 'jssj',
                        width: '120',
                        title: '结束日期',
                        event: 'planEndDate',
                        data_field: 'jsrq',
                        align: 'center'
                    },
                    {
                        field: 'tempId', title: '操作', width: '100', templet: function (d) {
                            return '<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del" lay-id="' + d.tempId + '"><i class="layui-icon layui-icon-delete"></i>移除</a>';
                        }
                    }
                ]
            ],
            autoSort: false,
            // limits: [10, 15, 20, 25, 50, 100],
            limit: 20,
            page: false,
            skin: 'grid',
            done: function (res, curr, count) { // done为数据渲染完的回调
                planTableData = res.data;

            }
        });
        var active = {
            addRow: function () {	//添加一行
                var oldData = table.cache[layPlanTableId];
                console.log(oldData);
                var newRow = {tempId: new Date().valueOf(), yjnr: '', qssj: '', jssj: ''};
                oldData.push(newRow);
                planTable.reload({
                    data: oldData
                });
            },
            updateRow: function (obj) {
                var oldData = table.cache[layPlanTableId];
                console.log(oldData);
                for (var i = 0, row; i < oldData.length; i++) {
                    row = oldData[i];
                    if (row.tempId == obj.tempId) {
                        $.extend(oldData[i], obj);
                        return;
                    }
                }
                planTable.reload({
                    data: oldData
                });
            },
            removeEmptyTableCache: function () {
                var oldData = table.cache[layPlanTableId];
                for (var i = 0, row; i < oldData.length; i++) {
                    row = oldData[i];
                    if (!row || !row.tempId) {
                        oldData.splice(i, 1);    //删除一项
                    }
                    continue;
                }
                planTable.reload({
                    data: oldData
                });
            }
        }
        //激活事件
        var activeByType = function (type, arg) {
            if (arguments.length === 2) {
                active[type] ? active[type].call(this, arg) : '';
            } else {
                active[type] ? active[type].call(this) : '';
            }
        }

        //注册按钮事件
        $('.layui-btn[data-type]').on('click', function () {
            var type = $(this).data('type');
            activeByType(type);
        });

        //监听工具条
        table.on('tool(planTableId)', function (obj) {
            var data = obj.data, event = obj.event, tr = obj.tr; //获得当前行 tr 的DOM对象;
            console.log(data);
            switch (event) {
                case "planStartDate":
                    var field = $(this).data('field');
                    laydate.render({
                        elem: this.firstChild
                        , show: true //直接显示
                        , closeStop: this
                        , done: function (value, date) {
                            data[field] = value;
                            obj.update(data);
                        }
                    });
                    break;
                case "planEndDate":
                    var field = $(this).data('field');
                    laydate.render({
                        elem: this.firstChild
                        , show: true //直接显示
                        , closeStop: this
                        , done: function (value, date) {
                            data[field] = value;
                            obj.update(data);
                        }
                    });
                    break;
                case "del":
                    layer.confirm('真的删除行么？', function (index) {
                        obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                        layer.close(index);
                        activeByType('removeEmptyTableCache');
                    });
                    break;
            }
        });

        //经费预算
        $.ajax({
            url: AjaxUtil.ctx + 'staBudget/list/' + xmId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataBudget = result;
            }
        });
        var insTb_Jfys;

        function loadTreetable() {
            insTb_Jfys = treeTable.render({
                elem: '#currentTableId_Jfys',
                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: [
                    [
                        {type: 'numbers'},
                        {field: 'mc', width: '26%', title: '名称'},
                        // {field: 'px', width: '6%', title: '排序'},
                        // {field: 'nf', width: '6%', title: '年份'},
                        {field: 'ysje', width: '12%', title: '预算金额(万元)'},
                        {field: "dw1", width: '15%', title: '陕西电科院(万元)', edit: 'number'},
                        {field: "dw2", width: '15%', title: '拟合作单位1(万元)', edit: 'number'},
                        {field: "dw3", width: '15%', title: '拟合作单位2(万元)', edit: 'number'},
                        {field: "dw4", width: '15%', title: '拟合作单位3(万元)', edit: 'number'},
                        {field: "dw5", width: '15%', title: '拟合作单位4(万元)', edit: 'number'},
                        {field: "dw6", width: '15%', title: '拟合作单位5(万元)', edit: 'number'}
                        // {field: 'hjbm', width: '8%', title: '合计编码'},
                        // {field: 'bz', width: '15%', title: '备注'}
                    ]
                ]
            });
        }

        //加载预算项
        loadTreetable();
        // 监听单元格编辑
        treeTable.on('edit(currentTableId_Jfys)', function (obj) {
            var value = obj.value,
                item = obj.data,
                dw = obj.field;
            if (item.children == undefined) {
                //当前行预算
                setCurBudget(item.bm, dw, value);
                //父级预算
                setFjBudget(item.fj);
            }
            loadTreetable();
        });

        //当前行预算
        function setCurBudget(bm, dw, value) {
            for (var i = 0; i < dataBudget.length; i++) {
                if (bm == dataBudget[i].bm) {
                    value = parseFloat(value);
                    if (isNaN(value))
                        value = null;
                    //当前单元格
                    if (dw == "dw1") {
                        dataBudget[i].dw1 = value;
                    } else if (dw == "dw2") {
                        dataBudget[i].dw2 = value;
                    } else if (dw == "dw3") {
                        dataBudget[i].dw3 = value;
                    } else if (dw == "dw4") {
                        dataBudget[i].dw4 = value;
                    } else if (dw == "dw5") {
                        dataBudget[i].dw5 = value;
                    } else if (dw == "dw6") {
                        dataBudget[i].dw6 = value;
                    }

                    //正在编辑的预算
                    var dw1 = 0, dw2 = 0, dw3 = 0, dw4 = 0, dw5 = 0, dw6 = 0;
                    if (dataBudget[i].dw1 != null) {
                        dw1 = parseFloat(dataBudget[i].dw1);
                        if (isNaN(dw1))
                            dw1 = 0;
                    }
                    if (dataBudget[i].dw2 != null) {
                        dw2 = parseFloat(dataBudget[i].dw2);
                        if (isNaN(dw2))
                            dw2 = 0;
                    }
                    if (dataBudget[i].dw3 != null) {
                        dw3 = parseFloat(dataBudget[i].dw3);
                        if (isNaN(dw3))
                            dw3 = 0;
                    }
                    if (dataBudget[i].dw4 != null) {
                        dw4 = parseFloat(dataBudget[i].dw4);
                        if (isNaN(dw4))
                            dw4 = 0;
                    }
                    if (dataBudget[i].dw5 != null) {
                        dw5 = parseFloat(dataBudget[i].dw5);
                        if (isNaN(dw5))
                            dw5 = 0;
                    }
                    if (dataBudget[i].dw6 != null) {
                        dw6 = parseFloat(dataBudget[i].dw6);
                        if (isNaN(dw6))
                            dw6 = 0;
                    }
                    var ysje = dw1 + dw2 + dw3 + dw4 + dw5 + dw6;
                    if (ysje == 0)
                        dataBudget[i].ysje = "";
                    else
                        dataBudget[i].ysje = ysje;

                    break;
                }
            }
        }

        //父级预算
        function setFjBudget(fj) {
            if (fj != null && fj != '') {
                var dw1 = 0, dw2 = 0, dw3 = 0, dw4 = 0, dw5 = 0, dw6 = 0;
                var flag = 0;

                //子节点的值相加
                for (var j = 0; j < dataBudget.length; j++) {
                    if (fj == dataBudget[j].fj) {
                        var t1 = parseFloat(dataBudget[j].dw1);
                        if (!isNaN(t1))
                            dw1 += t1;
                        var t2 = parseFloat(dataBudget[j].dw2);
                        if (!isNaN(t2))
                            dw2 += t2;
                        var t3 = parseFloat(dataBudget[j].dw3);
                        if (!isNaN(t3))
                            dw3 += t3;
                        var t4 = parseFloat(dataBudget[j].dw4);
                        if (!isNaN(t4))
                            dw4 += t4;
                        var t5 = parseFloat(dataBudget[j].dw5);
                        if (!isNaN(t5))
                            dw5 += t5;
                        var t6 = parseFloat(dataBudget[j].dw6);
                        if (!isNaN(t6))
                            dw6 += t6;
                    }
                }

                //更新父节点的值
                for (var j = 0; j < dataBudget.length; j++) {
                    if (fj == dataBudget[j].bm) {
                        if (dw1 == 0)
                            dataBudget[j].dw1 = '';
                        else
                            dataBudget[j].dw1 = dw1.toFixed(2);
                        if (dw2 == 0)
                            dataBudget[j].dw2 = '';
                        else
                            dataBudget[j].dw2 = dw2.toFixed(2);
                        if (dw3 == 0)
                            dataBudget[j].dw3 = '';
                        else
                            dataBudget[j].dw3 = dw3.toFixed(2);
                        if (dw4 == 0)
                            dataBudget[j].dw4 = '';
                        else
                            dataBudget[j].dw4 = dw4.toFixed(2);
                        if (dw5 == 0)
                            dataBudget[j].dw5 = '';
                        else
                            dataBudget[j].dw5 = dw5.toFixed(2);
                        if (dw6 == 0)
                            dataBudget[j].dw6 = '';
                        else
                            dataBudget[j].dw6 = dw6.toFixed(2);

                        var ysje = dw1 + dw2 + dw3 + dw4 + dw5 + dw6;
                        if (ysje == 0) {
                            dataBudget[j].ysje = "";
                        } else
                            dataBudget[j].ysje = ysje.toFixed(2);

                        setFjBudget(dataBudget[j].fj);
                        break;
                    }
                }
            }
        }

        //组织要保存的数据
        function getBudget(budgets, data) {
            var budget = {
                "id": data.id,
                "fj": data.fj,
                "ysje": data.ysje,
                "dw1": data.dw1,
                "dw2": data.dw2,
                "dw3": data.dw3,
                "dw4": data.dw4,
                "dw5": data.dw5,
                "dw6": data.dw6
            };
            budgets.push(budget);
            if (data.children != undefined) {
                getChildNode(budgets, data);
            }
        }

        function getChildNode(budgets, data) {
            for (let item of data.children) {
                getBudget(budgets, item);
            }
        }

        // 监听确认按钮（基本信息）
        form.on('submit(saveNormal)', function (data) {
            //基本信息
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateNormal",
                data: data.field,
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            parent.setUpdateFlag();

                            //项目负责人
                            var members = [];
                            var oldMembers = table.cache["currentTableId1"];
                            for (const item of oldMembers) {
                                var member = {
                                    "zb": xmId,
                                    "xh": item.xh,
                                    "fzr": item.fzr,
                                    "xm": item.xm
                                };
                                members.push(member);
                            }
                            AjaxUtil.post({
                                url: AjaxUtil.ctx + "staDirector/batchInsert/" + xmId,
                                contentType: "application/json",
                                data: JSON.stringify(members),
                                success: function (res) {
                                },
                                error: function (error) {
                                }
                            });
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                },
                fail: function (res) {
                    layer.close(index);
                    Message.error(res.message, 1500);
                },
                error: function (error) {

                }
            });
            return false;
        });

        // 监听确认按钮（目的和意义）
        $("button[lay-filter='saveMdhyy']").click(function () {
            var dataWB = [];
            for (const item of dataMdhyy) {
                var dfWb = {
                    "wjm": item.wjm,
                    "Url": item.Url,
                    "scrq": item.scrq,
                    "sm": item.sm
                };
                dataWB.push(dfWb);
            }
            $("#mdhyy").val(JSON.stringify(dataWB));

            var project = {
                "id": xmId,
                "mdhyy": $("#mdhyy").val(),
                "mdhyywb": $("#mdhyywb").val()
            }
            console.log(project);
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateMdhyy",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });

        // 监听确认按钮（研究水平）
        $("button[lay-filter='saveYjsp']").click(function () {
            var dataWB = [];
            for (const item of dataGnwyjspzs) {
                var dfWb = {
                    "wjm": item.wjm,
                    "Url": item.Url,
                    "scrq": item.scrq,
                    "sm": item.sm
                };
                dataWB.push(dfWb);
            }
            $("#gnwyjspzs").val(JSON.stringify(dataWB));

            var project = {
                "id": xmId,
                "gnwyjspzs": $("#gnwyjspzs").val(),
                "gnwyjspzswb": $("#gnwyjspzswb").val()
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateYjsp",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });

        // 监听确认按钮（理论实践依据）
        $("button[lay-filter='saveLlsjyj']").click(function () {
            var dataWB = [];
            for (const item of dataXmdllhsjyj) {
                var dfWb = {
                    "wjm": item.wjm,
                    "Url": item.Url,
                    "scrq": item.scrq,
                    "sm": item.sm
                };
                dataWB.push(dfWb);
            }
            $("#xmdllhsjyj").val(JSON.stringify(dataWB));

            var project = {
                "id": xmId,
                "xmdllhsjyj": $("#xmdllhsjyj").val(),
                "xmdllhsjyjwb": $("#xmdllhsjyjwb").val()
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateLlsjyj",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });

        // 监听确认按钮（研究内容）
        $("button[lay-filter='saveYjnr']").click(function () {
            var dataWB = [];
            for (const item of dataXmyjnrhssfa) {
                var dfWb = {
                    "wjm": item.wjm,
                    "Url": item.Url,
                    "scrq": item.scrq,
                    "sm": item.sm
                };
                dataWB.push(dfWb);
            }
            $("#xmyjnrhssfa").val(JSON.stringify(dataWB));

            var project = {
                "id": xmId,
                "xmyjnrhssfa": $("#xmyjnrhssfa").val(),
                "xmyjnrhssfawb": $("#xmyjnrhssfawb").val()
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateYjnr",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });

        // 监听确认按钮（经济性财务合规性）
        $("button[lay-filter='saveJjxycwhgx']").click(function () {
            var project = {
                "id": xmId,
                "jjxycwhgx": $("#jjxycwhgx").val()
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateJjxycwhgx",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function () {
                    layer.close(index);
                }
            });
        });

        // 监听确认按钮（预期目标）
        $("button[lay-filter='saveYqmb']").click(function () {
            var project = {
                "id": xmId,
                "yqmbhcgxs": $("#yqmbhcgxs").val()
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateYqmb",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });

        // 监听确认按钮（合作单位）
        $("button[lay-filter='saveHzdw']").click(function () {
            var project = {
                "id": xmId,
                "hzdwhytgcdwlsqk": $("#hzdwhytgcdwlsqk").val()
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateHzdw",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });

        // 监听确认按钮（承担单位条件）
        $("button[lay-filter='saveCddw']").click(function () {
            var dataWB = [];
            for (const item of dataXmcddwdtj) {
                var dfWb = {
                    "wjm": item.wjm,
                    "Url": item.Url,
                    "scrq": item.scrq,
                    "sm": item.sm
                };
                dataWB.push(dfWb);
            }
            $("#xmcddwdtj").val(JSON.stringify(dataWB));

            var project = {
                "id": xmId,
                "xmcddwdtj": $("#xmcddwdtj").val()
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateCddw",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1000, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });

        // 监听确认按钮（进度安排）
        $("button[lay-filter='saveJdap']").click(function () {
            var curData = [];
            var oldData = table.cache[layPlanTableId];

            for (var i = 0; i < oldData.length; i++) {
                var item = oldData[i];
                if (item.yjnr == "" || item.qssj == "" || item.jssj == "") {
                    Message.error("请将进度安排填写完整！", 1500);
                    return false;
                } else if (item.qssj > item.jssj) {
                    Message.warning("起始日期必须小于结束日期", 1500);
                    return;
                }
                var plan = {
                    "zb": xmId,
                    "xh": item.LAY_TABLE_INDEX + 1,
                    "yjnr": item.yjnr,
                    "qssj": item.qssj,
                    "jssj": item.jssj
                };
                curData.push(plan);
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "staSchedule/batchInsert/" + xmId,
                contentType: "application/json",
                data: JSON.stringify(curData),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(res.message, 1000);
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                fail: function (res) {
                    layer.close(index);
                    Message.error(res.message, 1500);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
            return false;
        });
        // 监听确认按钮（经费预算）
        $("button[lay-filter='saveJfys']").click(function jfys() {
            var data = insTb_Jfys.options.data;
            var budgets = new Array();
            for (var i = 0; i < data.length; i++) {
                getBudget(budgets, data[i]);
            }

            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "staBudget/doUpdateJfys",
                contentType: "application/json",
                data: JSON.stringify(budgets),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1500, res.message, function () {
                            $("#jfyszt").val('已保存');
                            loadTreetable();
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });
        // // 监听确认按钮（审查意见）
        // $("button[lay-filter='saveScyj']").click(function() {
        //     var project = {
        //         "id": xmId,
        //         "sqdwldscyj1": $("#sqdwldscyj1").val()
        //     }
        //     var index = layer.load(0, {shade: 0.1});
        //     AjaxUtil.post({
        //         url: AjaxUtil.ctx + "reportinfo/doUpdateScyj",
        //         contentType: "application/json",
        //         data: JSON.stringify(project),
        //         success: function (res) {
        //             if (res.code === 0) {
        //                 Message.success(1500, res.message, function () {
        //                     parent.setUpdateFlag();
        //                 });
        //             } else {
        //                 Message.error(res.message, 1000);
        //             }
        //             layer.close(index);
        //         },
        //         error: function (error) {
        //             layer.close(index);
        //         }
        //     });
        // });
        // 监听确认按钮（审查意见）
        $("button[lay-filter='saveScyj']").click(function () {
            if (xmId == -1) {
                Message.error("请先创建可研报告，然后再保存审查意见", 2000);
            } else {
                var dataWB = [];
                var oldData = table.cache["currentTableId_SCYJ"];
                for (const item of oldData) {
                    var dfWb = {
                        "wjm": item.wjm,
                        "Url": item.Url,
                        "scrq": item.scrq,
                        "sm": item.sm
                    };
                    dataWB.push(dfWb);
                }
                $("#scyjfj").val(JSON.stringify(dataWB));

                var project = {
                    "id": xmId,
                    "sqdwldscyj1": $("#sqdwldscyj1").val(),
                    "scyjfj": $("#scyjfj").val()

                }
                var index = layer.load(0, {shade: 0.1});
                AjaxUtil.post({
                    url: AjaxUtil.ctx + "reportinfo/doUpdateScyj",
                    contentType: "application/json",
                    data: JSON.stringify(project),
                    success: function (res) {
                        if (res.code === 0) {
                            Message.success(1500, res.message, function () {
                                parent.setUpdateFlag();
                            });
                        } else {
                            Message.error(res.message, 1000);
                        }
                        layer.close(index);
                    },
                    error: function (error) {
                        layer.close(index);
                    }
                });
            }
        });

        // 监听确认按钮（附件）
        $("button[lay-filter='saveFj']").click(function () {
            var dataWB = [];
            for (const item of dataFj) {
                var dfWb = {
                    "wjm": item.wjm,
                    "Url": item.Url,
                    "scrq": item.scrq,
                    "sm": item.sm
                };
                dataWB.push(dfWb);
            }
            $("#fj").val(JSON.stringify(dataWB));

            var project = {
                "id": xmId,
                "fj": $("#fj").val()
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateFj",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1500, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });

        // 监听确认按钮（签名盖章）
        $("button[lay-filter='saveQmgz']").click(function () {
            var dataWB = [];
            for (const item of dataYgzmwj) {
                var dfWb = {
                    "wjm": item.wjm,
                    "Url": item.Url,
                    "scrq": item.scrq,
                    "sm": item.sm
                };
                dataWB.push(dfWb);
            }
            $("#ygzmwj").val(JSON.stringify(dataWB));

            var project = {
                "id": xmId,
                "ygzmwj": $("#ygzmwj").val()
            }
            var index = layer.load(0, {shade: 0.1});
            AjaxUtil.post({
                url: AjaxUtil.ctx + "reportinfo/doUpdateQmgz",
                contentType: "application/json",
                data: JSON.stringify(project),
                success: function (res) {
                    if (res.code === 0) {
                        Message.success(1500, res.message, function () {
                            parent.setUpdateFlag();
                        });
                    } else {
                        Message.error(res.message, 1000);
                    }
                    layer.close(index);
                },
                error: function (error) {
                    layer.close(index);
                }
            });
        });

        //双击（目的和意义）
        table.on('rowDouble(currentTableId_MDHYY)', function (obj) {
            window.open(obj.data.Url);
        });
        //双击（研究水平）
        table.on('rowDouble(currentTableId_YJSP)', function (obj) {
            window.open(obj.data.Url);
        });
        //双击（理论实践依据）
        table.on('rowDouble(currentTableId_LLSJYJ)', function (obj) {
            window.open(obj.data.Url);
        });
        //双击（研究内容）
        table.on('rowDouble(currentTableId_YJNR)', function (obj) {
            window.open(obj.data.Url);
        });
        //双击（承担单位条件）
        table.on('rowDouble(currentTableId_CDDWTJ)', function (obj) {
            window.open(obj.data.Url);
        });
        //双击（附件）
        table.on('rowDouble(currentTableId_FJ)', function (obj) {
            window.open(obj.data.Url);
        });
        //双击（签名盖章）
        table.on('rowDouble(currentTableId_QMGZ)', function (obj) {
            window.open(obj.data.Url);
        });

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

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

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

    function setUpdateFlag() {
        updateflag = 1;
    }

    //从子页面设置父页面的值
    function setData(id, name) {
        ObjId = id;
        ObjName = name;
    }

    function setMember(member) {
        prjMember = member;
        userList1.push(member);
    }

    function getMember() {
        return prjMember;
    }

    function setCompany(company) {
        prjCompany = company;
    }

    function fileTableInit(table, tableID, tableData) {
        return table.render({
            elem: tableID,
            data: tableData,
            cols: [
                [
                    {type: "checkbox", align: 'center'},
                    {type: 'numbers', align: 'center',title: '序号'},
                    {field: 'wjm', title: '文件名', width: '40%'},
                    {field: 'scrq', title: '上传日期', width: '20%'},
                    /*{field: 'sm', title: '说明', edit: 'text', width: '25%'}*/
                ]
            ],
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: false,
            skin: 'grid',
            done: function (res, curr, count) { // done为数据渲染完的回调
            }
        });
    }
</script>
</body>
</html>