123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <!DOCTYPE html>
- <html xmlns:th="http://www.thymeleaf.org"
- xmlns:sec="http://www.pollix.at/thymeleaf/shiro">
- <head th:replace="admin/common/html/tableHead :: tableHead(~{::title},~{::link},~{::style})">
- <title th:text=${title}></title>
- <!-- 这儿引用单独的css link -->
- <!-- Ladda for Bootstrap 3按钮加载进度插件 -->
- <link rel="stylesheet" th:href="@{/static/admin/assets/js/button/ladda/ladda.min.css}">
- <!-- bootstrap-table表单样式 -->
- <link th:href="@{/static/admin/assets/js/bootstrap/css/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
- <!-- treeview -->
- <link th:href="@{/static/admin/assets/js/bootstrap/bootstrap-treeview/css/bootstrap-treeview.css}" rel="stylesheet"/>
- <style type="text/css">
- .content-wrap {
- padding: 0px;
- }
- body {
- color: #9ea7b3;
- font-family: "Open Sans", Arial, sans-serif!important;
- font-size: 13px!important;
- line-height: 20px;
- overflow-x: hidden!important;
- min-height: 100%;
- z-index: -2;
- margin: 0px !important;
- background: url() no-repeat top center fixed;
- -moz-background-size: cover;
- -webkit-background-size: cover;
- -o-background-size: cover;
- background-size: cover;
- }
- label.error {
- position: absolute;
- right: 18px;
- top: 5px;
- color: #ef392b;
- font-size: 12px;
- }
- .ico-list .fa{
- margin: 5px;
- padding: 5px;
- cursor:pointer;
- font-size: 18px;
- width: 28px;
- border-radius: 3px;
- }
- .ico-list .fa:hover {
- background-color: #1d9d74;
- color: #ffffff;
- }
- </style>
- </head>
- <body>
- <div id="fcapp" class="content-wrap">
- <div class="row">
- <div class="col-sm-12">
- <div class="nest" id="elementClose">
- <div class="">
- </div>
- <div class="body-nest" id="element">
- <div class="panel-body">
- <form class="form-horizontal m" id="form-add">
- <div class="form-group">
- <label class="col-sm-3 control-label">类型:</label>
- <div class="col-sm-8">
- <label class="radio-inline"><input type="radio" name="type" value="0" v-model="menu.type"> 目录</label>
- <label class="radio-inline"><input type="radio" name="type" value="1" v-model="menu.type"> 菜单</label>
- <label class="radio-inline"><input type="radio" name="type" value="2" v-model="menu.type"> 按钮</label>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label ">权限名称:</label>
- <div class="col-sm-8">
- <input class="form-control" type="text" id="name" name="name"/>
- </div>
- </div>
- <div v-if="menu.type == 1 || menu.type == 2" class="form-group">
- <label class="col-sm-3 control-label ">上级菜单:</label>
- <div class="col-sm-8">
- <input class="form-control" type="hidden" id="pid" name="pid"/>
- <input class="form-control" readonly="true" type="text" id="pidName" onclick="selectMenuTree()" />
- </div>
- </div>
-
-
- <div v-if="menu.type == 1 || menu.type == 2" class="form-group">
- <label class="col-sm-3 control-label ">权限URL:</label>
- <div class="col-sm-8">
- <input class="form-control" type="text" id="url" name="url"/>
- </div>
- </div>
- <div v-if="menu.type == 1" class="form-group">
- <label class="col-sm-3 control-label ">打开方式:</label>
- <div class="col-sm-8">
- <select class="form-control" id="isBlank" name="isBlank" >
- <option value="0">签页</option>
- <option value="1">新窗口</option>
- </select>
- </div>
- </div>
- <div v-if="menu.type == 1 || menu.type == 2" class="form-group">
- <label class="col-sm-3 control-label ">权限关键字:</label>
- <div class="col-sm-8">
- <input class="form-control" type="text" id="perms" name="perms" placeholder="多个用逗号分隔,如:user:list,user:create"/>
- </div>
- </div>
- <div v-if="menu.type != 2" class="form-group">
- <label class="col-sm-3 control-label ">排序:</label>
- <div class="col-sm-8">
- <input class="form-control" type="number" id="orderNum" name="orderNum"/>
- </div>
- </div>
- <div v-if="menu.type != 2" class="form-group">
- <label class="col-sm-3 control-label ">图标:</label>
- <div class="col-sm-8">
- <input class="form-control" onfocus="showdrop();" type="text" id="icon" name="icon"/>
- <!--
- <code style="margin-top: 4px; display: block;">获取图标:https://fontawesome.com/v4.7.0/icons/</code>
- -->
- <div class="ms-parent" style="width: 100%;">
- <div class="icon-drop animated flipInX" style="display: none;max-height:200px;overflow-y:auto">
- <div data-th-include="admin/permission/icon"></div>
- </div>
- </div>
-
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label ">权限描述:</label>
- <div class="col-sm-8">
- <input class="form-control" type="text" id="descripion" name="descripion"/>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label ">菜单状态:</label>
- <div class="col-sm-8">
- <select class="form-control" id="visible" name="visible" >
- <option value="0">显示</option>
- <option value="1">隐藏</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <div class="form-control-static col-sm-offset-9">
- <button type="submit" class="btn btn-primary">提交</button>
- <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 通用js -->
- <div th:include="admin/common/html/js :: onload_js">
-
- </div>
- <!-- bootstarp 表格 -->
- <script th:src="@{/static/admin/assets/js/bootstrap/js/bootstrap-table/bootstrap-table.min.js}" type="text/javascript"></script>
- <script th:src="@{/static/admin/assets/js/bootstrap/js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}" type="text/javascript"></script>
- <script th:src="@{/static/admin/assets/js/bootstrap/js/base_list.js}" type="text/javascript"></script>
- <!-- 弹窗 -->
- <script th:src="@{/static/admin/assets/js/layer/layer.js}" type="text/javascript"></script>
- <!-- 遮罩层 -->
- <script th:src="@{/static/admin/assets/js/blockUI/jquery.blockUI.js}" type="text/javascript"></script>
- <!--bootstarp threeView -->
- <script th:src="@{/static/admin/assets/js/bootstrap/bootstrap-treeview/js/bootstrap-treeview.js}" type="text/javascript"></script>
- <script type="text/javascript">
- $(function(){
- //初始化vue
- var vm = new Vue({
- el:"#fcapp",
- data: {
- "menu":{
- type:0
- }
- }
-
- });
- //验证方法
- $("#form-add").validate({
- rules:{
- name:{
- required:true,
- minlength: 2,
- maxlength: 20,
- remote: {
- url: rootPath + "/PermissionVueController/checkNameUnique",
- type: "post",
- dataType: "json",
- dataFilter: function(data, type) {
- if (data == "0")
- return true;
- else
- return false;
- }
- }
- },
- url:{
- required:true,
- minlength: 1,
- maxlength: 100,
- remote: {
- url: rootPath + "/PermissionVueController/checkURLUnique",
- type: "post",
- dataType: "json",
- dataFilter: function(data, type) {
- var u=$("#url").val();
- if (data == "0" || u== "#")
- return true;
- else
- return false;
- }
- }
- },perms:{
- required:true,
- minlength: 1,
- maxlength: 100,
- remote: {
- url: rootPath + "/PermissionVueController/checkPermsUnique",
- type: "post",
- dataType: "json",
- dataFilter: function(data, type) {
- var u=$("#perms").val();
- if (data == "0" || u== "#")
- return true;
- else
- return false;
- }
- }
- }
-
- },
- messages: {
- "name": {
- remote: "权限名字已经存在"
- },
- "url": {
- remote: "权限地址已经存在"
- },
- "perms": {
- remote: "权限关键字已经存在"
- }
- },
- submitHandler:function(form){
- add();
- }
- });
-
- })
- //添加方法
- function add() {
- var dataFormJson=$("#form-add").serialize();
- $.ajax({
- cache : true,
- type : "POST",
- url : rootPath + "/PermissionVueController/add",
- data :dataFormJson,
- async : false,
- error : function(request) {
- $.modal.alertError("系统错误");
- },
- success : function(data) {
- $.operate.saveSuccess(data);
- }
- });
- }
- /*菜单管理-修改-选择菜单树*/
- function selectMenuTree() {
- var url = rootPath+ "/PermissionVueController/tree";
- $.modal.open("选择菜单", url, '380', '380');
- }
- //显示图标
- function showdrop(){
- $(".icon-drop").show();
- }
- $(function() {
-
- $("#form-add").click(function(event) {
- var obj = event.srcElement || event.target;
- if (!$(obj).is("input[name='icon']")) {
- $(".icon-drop").hide();
- }
- });
- $(".icon-drop").find(".ico-list i").on("click", function() {
- $('#icon').val($(this).attr('class'));
- });
-
- });
- </script>
- </body>
- </html>
|