<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<%@ include file="/WEB-INF/jspf/common.jspf" %>
<%@ include file="/WEB-INF/jspf/ztreeCommom.jsp" %>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>自定义模板</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv=X-UA-Compatible IE=EmulateIE7>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="${path}/static/js/html5shiv.min.js"></script>
    <script type="text/javascript" src="${path}/static/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="${path}/static/js/respond.min.js"></script>
    <![endif]-->
    <script>
        var path = "${path}";
    </script>
    <style type="text/css">
        .leftDiv {
            border-right: 10px solid #c1d7e3;
            background-color: #fff
        }

        .rightDiv {
            background-color: #fff
        }

        .searchDiv {
            margin: 10px 20px;
        }

        .zTreeDemo {
            height: calc(100vh - 123px) !important;
            min-height: 394px !important;
        }

        .form-group {
            margin-bottom: 5px;
        }

        .treeBtn {
            margin-left: 13%;
        }

        .insertbtn {
            width: 80px;
        }

        .btns {
            width: 230px;
            margin: 0 auto;
        }

        .savebtn {
            width: 110px;
        }

        .delbtn {
            width: 110px;
        }

        .main-content {
            height: calc(100vh - 43px);
        }
    </style>
</head>
<body style="background-color: #c1d7e3">
<input type="hidden" id="level">
<div class="main">
    <div class="headDiv">
        <div class="headSpanDiv">
            <span class="headspan">自定义模板设计</span>
        </div>
    </div>
    <div class="row main-content">
        <!--树-->
        <div class="col-md-3 leftDiv">
            <div class="searchDiv">
                <input type="text" id="key" value="" class="form-control input-sm"
                       placeholder="名称" maxlength="15"/>
            </div>
            <div class="treeBtns">
                <button type="button" class="btn  btn-success btn-sm treeBtn" onclick="expandAll();">全部展开</button>
                <button type="button" class="btn  btn-success btn-sm treeBtn" onclick="collapseAll();">全部收缩</button>
            </div>
            <div class="zTreeDemo">
                <ul id="ztree" class="ztree"></ul>
            </div>
        </div>
        <!--内容-->
        <div class="col-md-9 rightDiv">
            <shiro:hasPermission name="/template/addTemplate">
                <div class="row" style="padding: 10px 0">
                    <div class="col-md-9"></div>
                    <div class="col-md-3" style="padding-left: 25px">
                        <button type="button" class="btn btn-sm btn-info insertbtn" onclick="add()">添加</button>
                    </div>
                </div>
            </shiro:hasPermission>
            <div class="row">
                <form class="form-horizontal" role="form" id="form" style="width: 60%;height: calc(100vh - 93px);min-height:423px;margin: 0 auto">
                    <input type="hidden" id="id" name="id">
                    <input type="hidden" name="formToken" id="formToken" value="${formToken}">
                    <input type="hidden" id="treeId">
                    <input type="hidden" id="parentId1" value="0">
                    <input type="hidden" id="childNode">
                    <div class="_content" id="contentDiv" style="display: none">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">字段值：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control input-sm input" name="columnValue"
                                       id="columnValue"
                                       maxlength="30">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">字段名/模板名：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control input-sm input" name="columnName" id="columnName"
                                       maxlength="15">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">字段类型：</label>
                            <div class="col-sm-8">
                                <select class="form-control input-sm input" id="columnType" name="columnType">
                                    <option value="">请选择</option>
                                    <option value="1">字符串</option>
                                    <option value="2">整型</option>
                                    <option value="3">时间</option>
                                    <option value="4">关联字典表</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group" id="block" style="display: none">
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">表值：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control input-sm input" name="tableValue" id="tableValue"
                                       maxlength="30">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">表名：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control input-sm input" name="tableName" id="tableName"
                                       maxlength="15">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">选项：</label>
                            <div class="col-sm-8">
                                <select class="form-control input-sm input" id="selectValue" name="selectValue">
                                    <option value="1">选中</option>
                                    <option value="0">未选中</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">父级：</label>
                            <div class="col-sm-8">
                                <select class="form-control input-sm input" id="parentId" name="parentId">
                                    <option value="0">模板列表</option>
                                    <c:forEach items="${parents}" var="parent">
                                        <option value="${parent.id}">${parent.columnName}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">排序：</label>
                            <div class="col-sm-8">
                                <input type="number" class="form-control input-sm input" id="customizeSort"
                                       name="customizeSort" oninput="if(value.length>9)value=value.slice(0,9)">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">有效否：</label>
                            <div class="col-sm-8">
                                <select class="form-control input-sm input" name="effective" id="effective">
                                    <option value="1">是</option>
                                    <option value="0">否</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">备注：</label>
                            <div class="col-sm-8">
                            <textarea class="form-control input-sm input" name="remark" id="remark"
                                      maxlength="50"></textarea>
                            </div>
                        </div>
                        <div class="form-group" style="margin:15px auto">
                            <div class="col-sm-4"></div>
                            <div class="col-sm-8">
                                <div class="btns">
                                    <shiro:hasPermission name="/template/addTemplate">
                                        <button type="button" class="btn btn-sm btn-info savebtn" onclick="save()">保存
                                        </button>
                                    </shiro:hasPermission>
                                    <shiro:hasPermission name="/template/deleteTemplate">
                                        <button type="button" class="btn btn-sm btn-danger delbtn" onclick="del()">删除
                                        </button>
                                    </shiro:hasPermission>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script src="${path}/static/js/recordManage/templateSearch/templateList1.js"></script>
</body>
</html>
