<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>编辑</title>
    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
    <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<form class="layui-form" action="" lay-filter="formDemo">
    <div class="layui-tab layui-tab-card" style="height: 620px">
        <ul class="layui-tab-title">
            <li class="layui-this">基本信息</li>
            <li>项目预算</li>
        </ul>
        <div class="layui-tab-content">
            <!--基本信息开始-->
            <div class="layui-tab-item layui-show">
                <form class="layui-form" action="" lay-filter="formDemo">
                    <div class="layui-form layuimini-form" style="padding-bottom: 100px">
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 90px">中文名称</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="hidden" id="id" name="id" th:value="${template.id}">
                                <input type="text" name="zwmc" th:value="${template.zwmc}" class="layui-input" readonly>
                            </div>
                            <label class="layui-form-label" style="width: 90px">学科分类1</label>
                            <div class="layui-input-inline" style="width: 300px">
                                <input type="text" name="xkflmc1" th:value="${template.xkflmc1}" class="layui-input"
                                       readonly>
                            </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: 400px">
                                <input type="text" id="ywmc" name="ywmc" th:value="${template.ywmc}" class="layui-input"
                                       readonly>
                            </div>
                            <label class="layui-form-label" style="width: 90px">学科分类2</label>
                            <div class="layui-input-inline" style="width: 300px">
                                <input type="text" name="xkflmc2" th:value="${template.xkflmc2}" class="layui-input"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 90px">ERP编号</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" id="erpbh" name="erpbh" th:value="${template.erpbh}"
                                       class="layui-input" readonly>
                            </div>
                            <label class="layui-form-label" style="width: 90px">学科分类3</label>
                            <div class="layui-input-inline" style="width: 300px">
                                <input type="text" name="xkflmc3" th:value="${template.xkflmc3}" class="layui-input"
                                       readonly>
                            </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: 400px">
                                <input type="hidden" id="xmlx" name="xmlx" th:value="${template.xmlx}">
                                <input type="text" name="xmlxmc" class="layui-input" th:value="${template.xmlxmc}"
                                       readonly>
                            </div>
                            <label class="layui-form-label" style="width: 90px">费用来源</label>
                            <div class="layui-input-inline" style="width: 300px">
                                <input type="text" id="fyly" name="fyly" th:value="${template.fyly}" class="layui-input"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" style="width: 100%">
                            <label class="layui-form-label" style="width: 175px">是否国家秘密技术项目</label>
                            <div class="layui-input-inline" style="width: 280px">
                                <input type="checkbox" name="sfgjmmjsxm" lay-skin="primary"
                                       th:checked="${template.sfgjmmjsxm}" disabled>
                            </div>
                            <label class="layui-form-label" style="width: 125px">所属国民经济行业</label>
                            <div class="layui-input-inline" style="width: 300px">
                                <input type="text" name="ssgmjjhy" th:value="${template.ssgmjjhymc}" class="layui-input"
                                       readonly>
                            </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">
                                <input type="text" name="qs" id="qs" th:value="${template.qs}" class="layui-input"
                                       readonly>
                            </div>
                            <div class="layui-form-mid">-</div>
                            <div class="layui-input-inline">
                                <input type="text" name="wc" id="wc" th:value="${template.wc}" class="layui-input"
                                       readonly>
                            </div>
                        </div>

                        <!-- 右侧悬浮按钮 -->
                        <div class="right-bottom-btn">
                            <button class="layui-btn" lay-submit lay-filter="saveBtn"><i
                                    class="layui-icon layui-icon-ok"></i>保存
                            </button>
                            <button class="layui-btn" lay-filter="cancleBtn"><i
                                    class="layui-icon layui-icon-close"></i>取消
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <!--基本信息结束-->
            <!--项目预算开始-->
            <div class="layui-tab-item" style="padding-left: 30px; padding-right: 30px">
                <form class="layui-form" action="" lay-filter="formDemo">
                    <div class="layui-form layuimini-form" style="padding-bottom: 100px">
                        <div class="layui-btn-group" style="padding: 0px">
                            <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm" lay-filter="btnAdd">
                                <i class="layui-icon"></i>新建
                            </button>
                            <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                    lay-filter="btnEdit"><i class="layui-icon"></i>编辑
                            </button>
                            <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                    lay-filter="btnView"><i class="layui-icon">&#xe63c;</i>查看
                            </button>
                            <button type="button" class="layui-btn  layui-btn-primary layui-btn-sm"
                                    lay-filter="btnDelete"><i class="layui-icon"></i>删除
                            </button>
                        </div>
                        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

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

<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
<script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>

<script type="text/javascript" th:inline="javascript">
    AjaxUtil.ctx = /*[[@{/}]]*/'';
    var ysId = -1;
    layui.use(['form', 'table', 'treeTable'], function () {
        var layer = layui.layer,
            treeTable = layui.treeTable;
        var isShow = true;

        //项目预算
        var insTb = treeTable.render({
            elem: '#currentTableId',
            url: AjaxUtil.ctx + 'baseProjectbudget/list/' + $("#id").val(),
            skin: 'grid',
            tree: {
                treeColIndex: 1,
                treeSpid: "0",
                iconIndex: 1,           // 折叠图标显示在第几列
                isPidData: true,        // 是否是id、pid形式数据
                idName: 'bm',  // id字段名称
                pidName: 'fj', // pid字段名称
                arrowType: 'arrow2',
                getIcon: 'ew-tree-icon-style2'
            },
            treeDefaultClose: isShow,
            method: 'GET',
            page: false,
            // toolbar: '#toolbarDemo',
            cols: [
                [
                    {type: 'numbers'},
                    {field: 'mc', width: '50%', title: '名称'},
                    {field: 'bm', width: '20%', title: '编码'},
                    {field: 'bz', width: '23%', title: '备注'}
                ]
            ],
            done: function () {
                insTb.expandAll();// 展开全部
                if (insTb.options.data.length > 0)
                    ysId = 0;
            }
        });

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

        //监听行选中
        treeTable.on('row(currentTableId)', function (obj) {
            ysId = obj.data.id;
            obj.tr.addClass('layui-bg-blue').siblings().removeClass('layui-bg-blue');
        });

        //双击
        treeTable.on('rowDouble(currentTableId)', function (obj) {
            ysId = obj.data.id;
            obj.tr.addClass('layui-bg-blue').siblings().removeClass('layui-bg-blue');

            var index = layer.open({
                title: '浏览项目预算',
                type: 2,
                shade: 0.3,
                maxmin: true,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'baseProjectbudget/forView/' + ysId,
                success: function (index) {
                },
                end: function (index) {
                }
            });
        });
    });
</script>
</body>
</html>