gcz vor 1 Jahr
Commit
b387eca968
100 geänderte Dateien mit 22184 neuen und 0 gelöschten Zeilen
  1. 24 0
      .gitignore
  2. 1 0
      .htaccess
  3. 1 0
      .user.ini
  4. 29 0
      404.html
  5. 11 0
      forstcss/animate.min.css
  6. 127 0
      forstcss/common.css
  7. 127 0
      forstcss/font_eolqem241z66flxr.css
  8. 21 0
      forstcss/images.css
  9. 82 0
      forstcss/inputTags.css
  10. 142 0
      forstcss/main.css
  11. 15 0
      forstcss/message.css
  12. 8 0
      forstcss/news.css
  13. 38 0
      forstcss/systemTree.css
  14. 28 0
      forstcss/user.css
  15. 193 0
      forstlogin/css/style.css
  16. BIN
      forstlogin/img/login-bg.png
  17. BIN
      forstlogin/img/login-logo-bg-icon.png
  18. BIN
      forstlogin/img/login-logo-bg-index.png
  19. BIN
      forstlogin/img/login-logo-bg.png
  20. BIN
      forstlogin/img/nq-bg.jpg
  21. BIN
      forstlogin/img/sw-bg.jpg
  22. BIN
      forstlogin/img/wl-bg.jpg
  23. 120 0
      forstlogin/index.html
  24. 21 0
      forstpages/analyze/echarts.simple.min.js
  25. 507 0
      forstpages/analyze/index.html
  26. 418 0
      forstpages/dealer/add_change.html
  27. 95 0
      forstpages/dealer/index.html
  28. 177 0
      forstpages/dealer/index.js
  29. 331 0
      forstpages/enterprise/addFirmUser.html
  30. 475 0
      forstpages/enterprise/add_change.html
  31. 151 0
      forstpages/enterprise/auth.html
  32. 102 0
      forstpages/enterprise/index.html
  33. 185 0
      forstpages/enterprise/index.js
  34. 134 0
      forstpages/index.html
  35. 219 0
      forstpages/js/bodyTab.js
  36. 116 0
      forstpages/js/index.js
  37. 1314 0
      forstpages/pdinfo/add_change.html
  38. 233 0
      forstpages/pdinfo/add_change2.html
  39. 203 0
      forstpages/pdinfo/add_change3.html
  40. 119 0
      forstpages/pdinfo/index.html
  41. 281 0
      forstpages/pdinfo/index.js
  42. 217 0
      forstpages/qrcode/add_change.html
  43. BIN
      forstpages/qrcode/bg.png
  44. BIN
      forstpages/qrcode/code.png
  45. 101 0
      forstpages/qrcode/index.html
  46. 281 0
      forstpages/qrcode/index.js
  47. 131 0
      forstpages/qrcode/preview-code.html
  48. 0 0
      forstpages/qrcode/share/css/share.min.css
  49. BIN
      forstpages/qrcode/share/fonts/iconfont.eot
  50. 88 0
      forstpages/qrcode/share/fonts/iconfont.svg
  51. BIN
      forstpages/qrcode/share/fonts/iconfont.ttf
  52. BIN
      forstpages/qrcode/share/fonts/iconfont.woff
  53. 0 0
      forstpages/qrcode/share/js/jquery.share.min.js
  54. 146 0
      forstpages/qrcode/share/js/qrcode.js
  55. 0 0
      forstpages/qrcode/share/js/social-share.min.js
  56. 629 0
      forstpages/region/add_change.html
  57. 84 0
      forstpages/region/index.html
  58. 155 0
      forstpages/region/index.js
  59. 278 0
      forstpages/role/add_change.html
  60. 149 0
      forstpages/role/auth.html
  61. 89 0
      forstpages/role/index.html
  62. 172 0
      forstpages/role/index.js
  63. 540 0
      forstpages/spread/index.html
  64. 332 0
      forstpages/user/add_change.html
  65. 99 0
      forstpages/user/index.html
  66. 231 0
      forstpages/user/index.js
  67. 4 0
      iconfont/iconfont.css
  68. BIN
      iconfont/iconfont.eot
  69. 0 0
      iconfont/iconfont.js
  70. 31 0
      iconfont/iconfont.svg
  71. BIN
      iconfont/iconfont.ttf
  72. BIN
      iconfont/iconfont.woff
  73. BIN
      images/face.jpg
  74. BIN
      images/favicon.ico
  75. BIN
      images/favicon_ab.ico
  76. 16 0
      index.html
  77. 153 0
      js/LodopFuncs.js
  78. 215 0
      js/a.js
  79. 1 0
      js/ajaxhook.min.js
  80. 436 0
      js/config.js
  81. 411 0
      js/layui-xtree.js
  82. 170 0
      js/layuiPlugins/cascade.js
  83. 141 0
      js/layuiPlugins/cascade_bak.js
  84. 2182 0
      js/layuiPlugins/dltable.js
  85. 1216 0
      js/layuiPlugins/eleTree.js
  86. 1733 0
      js/layuiPlugins/formSelects-v4.js
  87. 79 0
      js/layuiPlugins/inputTags.css
  88. 29 0
      js/layuiPlugins/inputTags.html
  89. 128 0
      js/layuiPlugins/inputTags.js
  90. 412 0
      js/layuiPlugins/layui-xtree.js
  91. 167 0
      js/layuiPlugins/md5.js
  92. 332 0
      js/layuiPlugins/step.js
  93. 3 0
      js/layuiPlugins/treeGrid.css
  94. 23 0
      js/layuiPlugins/treeGrid.js
  95. 4028 0
      js/layuiPlugins/treeSelect.js
  96. 18 0
      js/layuiPlugins/treetable-lay/treetable.css
  97. 206 0
      js/layuiPlugins/treetable-lay/treetable.js
  98. 18 0
      js/layuiPlugins/treetable.css
  99. 204 0
      js/layuiPlugins/treetable.js
  100. 58 0
      js/leftNav.js

+ 24 - 0
.gitignore

@@ -0,0 +1,24 @@
+.DS_Store
+node_modules/
+dist/
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+**/*.log
+.history/
+
+tests/**/coverage/
+tests/e2e/reports
+selenium-debug.log
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.local
+
+package-lock.json
+yarn.lock

+ 1 - 0
.htaccess

@@ -0,0 +1 @@
+ 

+ 1 - 0
.user.ini

@@ -0,0 +1 @@
+open_basedir=/www/wwwroot/forestsuyuan.hw.hongweisoft.com/:/tmp/

+ 29 - 0
404.html

@@ -0,0 +1,29 @@
+<!doctype html>
+<html>
+
+<head>
+	<meta charset="utf-8">
+	<meta http-equiv="X-UA-Compatible" content="IE=edge">
+	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+	<title>404</title>
+	<style>
+		body {
+			background-color: #444;
+			font-size: 14px;
+		}
+
+		h3 {
+			font-size: 60px;
+			color: #eee;
+			text-align: center;
+			padding-top: 30px;
+			font-weight: normal;
+		}
+	</style>
+</head>
+
+<body>
+	<h3>404,您请求的文件不存在!</h3>
+</body>
+
+</html>

Datei-Diff unterdrückt, da er zu groß ist
+ 11 - 0
forstcss/animate.min.css


+ 127 - 0
forstcss/common.css

@@ -0,0 +1,127 @@
+/* 公用的 */
+html {
+  color: #333;
+}
+.layui-fluid {
+  padding: 15px;
+}
+.layui-layout {
+  background-color: #fff;
+  padding: 15px;
+  border-radius: 2px;
+}
+.layui-card .layui-tab-brief .layui-tab-title li {
+  line-height: 42px;
+}
+.layui-card .layui-tab .layui-tab-content {
+  padding: 15px;
+}
+.layui-layer-btn {
+  padding: 20px 0 !important;
+  margin-bottom: 0;
+}
+.layui-layer-btn .layui-btn {
+  height: 32px;
+  line-height: 32px;
+  padding: 0 15px;
+}
+
+/* 二级tab */
+.type-tab-brief .layui-tab-title {
+  /* border: none; */
+}
+.type-tab-brief .layui-tab-title .layui-this {
+  color: #009688;
+}
+.type-tab-brief .layui-tab-title .layui-this:after {
+  /* border: none; */
+}
+.layui-card .type-tab-brief .layui-tab-content {
+  padding: 10px 0 0;
+  border: none;
+  border: 1px solid #e6e6e6;
+  border-top: none;
+}
+
+/* 搜索样式 */
+.searching {
+  display: flex;
+  align-items: center;
+}
+.searching .search-box {
+  position: relative;
+  padding-right: 5px;
+}
+.searching .search-box .layui-icon-search {
+  position: absolute;
+  left: 10px;
+  top: 7px;
+}
+.searching .search-box .search-input {
+  padding-left: 35px;
+}
+
+/* 滚动条 */
+::-webkit-scrollbar-thumb {
+  background-color: rgba(50, 50, 50, 0.6);
+}
+::-webkit-scrollbar-track {
+  -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
+  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
+  background-color: #f5f5f5;
+}
+::-webkit-scrollbar {
+  width: 6px;
+  height: 6px;
+  background-color: #f5f5f5;
+}
+
+.layui-btn-more {
+  position: absolute;
+  top: 5px;
+  right: 10px;
+  padding: 0 8px;
+  border-radius: 4px;
+  background-color: #fff;
+}
+.type-list {
+  border: 1px solid #e6e6e6;
+  border-radius: 5px 0 0 5px;
+  height: calc(100vh - 100px);
+  overflow-y: auto;
+}
+.type-list li {
+  border-bottom: 1px solid #ddd;
+  height: 40px;
+  line-height: 40px;
+  padding: 0 15px;
+  cursor: pointer;
+}
+.type-list li:last-child {
+  border: none;
+}
+.type-list li.active {
+  background-color: #f2f2f2;
+}
+.type-list li.active span {
+  color: #000;
+}
+.type-list li span {
+  font-size: 15px;
+}
+.l-border {
+  border: 1px solid #e6e6e6;
+}
+.r-border {
+  border: 1px solid #e6e6e6;
+}
+.layui-top {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+}
+
+.layui-top-header {
+  border-left: 4px solid #1e9fff;
+  padding-left: 10px;
+}

+ 127 - 0
forstcss/font_eolqem241z66flxr.css

@@ -0,0 +1,127 @@
+@font-face {
+  font-family: 'iconfont';
+  src: url('//at.alicdn.com/t/font_eolqem241z66flxr.eot?t=1494568861820'); /* IE9*/
+  src: url('//at.alicdn.com/t/font_eolqem241z66flxr.eot?t=1494568861820#iefix')
+      format('embedded-opentype'),
+    /* IE6-IE8 */
+      url('//at.alicdn.com/t/font_eolqem241z66flxr.woff?t=1494568861820')
+      format('woff'),
+    /* chrome, firefox */
+      url('//at.alicdn.com/t/font_eolqem241z66flxr.ttf?t=1494568861820')
+      format('truetype'),
+    /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
+      url('//at.alicdn.com/t/font_eolqem241z66flxr.svg?t=1494568861820#iconfont')
+      format('svg'); /* iOS 4.1- */
+}
+
+.iconfont {
+  font-family: 'iconfont' !important;
+  font-size: 16px;
+  font-style: normal;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+.icon-zhanghu:before {
+  content: '\e605';
+}
+
+.icon-lock1:before {
+  content: '\e622';
+}
+
+.icon-erweima:before {
+  content: '\e62d';
+}
+
+.icon-xinlangweibo:before {
+  content: '\e63d';
+}
+
+.icon-qq:before {
+  content: '\e63e';
+}
+
+.icon-icon:before {
+  content: '\e609';
+}
+
+.icon-edit:before {
+  content: '\e602';
+}
+
+.icon-computer:before {
+  content: '\e645';
+}
+
+.icon-text:before {
+  content: '\e64d';
+}
+
+.icon-loginout:before {
+  content: '\e608';
+}
+
+.icon-shuaxin1:before {
+  content: '\e648';
+}
+
+.icon-shezhi1:before {
+  content: '\e64a';
+}
+
+.icon-gonggao:before {
+  content: '\e614';
+}
+
+.icon-wenben:before {
+  content: '\e600';
+}
+
+.icon-dengji3:before {
+  content: '\e61e';
+}
+
+.icon-dengji1:before {
+  content: '\e628';
+}
+
+.icon-dengji2:before {
+  content: '\e629';
+}
+
+.icon-dengji4:before {
+  content: '\e62b';
+}
+
+.icon-dengji5:before {
+  content: '\e62c';
+}
+
+.icon-dengji6:before {
+  content: '\e62e';
+}
+
+.icon-new1:before {
+  content: '\e610';
+}
+
+.icon-link:before {
+  content: '\e657';
+}
+
+.icon-lingsheng:before {
+  content: '\e601';
+}
+
+.icon-star:before {
+  content: '\e783';
+}
+
+.icon-dongtaifensishu:before {
+  content: '\e603';
+}
+
+.icon-weather:before {
+  content: '\e89e';
+}

+ 21 - 0
forstcss/images.css

@@ -0,0 +1,21 @@
+.layui-flow-more{ clear: both; margin-top: 20px; }
+#Images li{ width:19%; margin:0.5% 0.5%; float: left; overflow:hidden;}
+#Images li img{ width:100%; }
+#Images li .operate{ display: block; height: 40px; width:100%; background:#f4f5f9; }
+#Images li .operate .check{ float:left; margin-left:11px; height:18px; padding:11px 0; }
+#Images li .operate .img_del{ float:right; margin:7px 11px 0 0; font-size: 22px; cursor:pointer; }
+#Images li .operate .img_del:hover{ color:#f00; }
+
+/*适配*/
+@media screen and (max-width:1050px){
+	/*用户信息*/
+	#Images li{ width:24%;}
+}
+@media screen and (max-width: 750px){
+	/*用户信息*/
+	#Images li{ width:49%;}
+}
+@media screen and (max-width:432px){
+	/*用户信息*/
+	#Images li{ width:99%;}
+}

+ 82 - 0
forstcss/inputTags.css

@@ -0,0 +1,82 @@
+/*
+* @Author: layui-2
+* @Date:   2018-08-31 11:40:53
+* @Last Modified by:   xuzhiwen
+* @Last Modified time: 2018-09-07 15:26:19
+*/
+em{
+  font-style: normal;
+}
+#tags
+{
+    width: 406px;
+    margin:10px 0;
+    padding: 9px;
+    color: #777;
+    border: 1px solid #d5d5d5;
+    background-color: #fff;
+}
+
+#tags span{
+    font-size: 12px;
+    font-weight: normal;
+    line-height: 16px;
+    position: relative;
+    display: inline-block;
+    height: 16px;
+    margin-right: 3px;
+    margin-bottom: 3px;
+    padding: 4px 22px 5px 9px;
+    cursor: pointer;
+    transition: all .2s ease 0s;
+    vertical-align: baseline;
+    white-space: nowrap;
+    color: #fff;
+    background-color: #009688;
+    text-shadow: 1px 1px 1px rgba(0, 0, 0, .15);
+}
+#tags .close{
+    font-size: 12px;
+    font-weight: bold;
+    line-height: 20px;
+    position: absolute;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    float: none;
+    width: 18px;
+    padding: 0;
+    cursor: pointer;
+    text-align: center;
+    opacity: 1;
+    color: #fff;
+    border: 0 none;
+    background: transparent none repeat scroll 0 0;
+    text-shadow: none;
+}
+#tags .close:hover{
+  background: #ffb800;
+}
+#inputTags[type='text'],
+#inputTags[type='text']:focus{
+    line-height: 25px;
+    display: inline;
+    width: 150px;
+    margin: 0;
+    padding: 0 6px;
+    border: 0 none;
+    outline: 0 none;
+    box-shadow: none;
+}
+
+.albtn{
+    line-height: 30px;
+    display: block;
+    width: 100px;
+    height: 30px;
+    margin: 0 auto;
+    cursor: pointer;
+    text-align: center;
+    color: #fff;
+    background: #ffb800;
+}

+ 142 - 0
forstcss/main.css

@@ -0,0 +1,142 @@
+/*公共样式*/
+.main_body{ min-width:320px; }
+.layui-elem-quote.title{ padding:10px 15px; margin-bottom:0; }
+.layui-tab-more{ position: relative; z-index: 99; background:#fff; }
+.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{ height:42px !important; }
+.layui-layer-tab .layui-layer-title span{ min-width:45px !important; }
+
+.layui-side-menu{background-color: #393D49;}
+.layui-side-menu .layui-nav .layui-nav-item>a, .layui-side-menu .layui-nav-tree .layui-nav-child a{padding-top: 4px; padding-bottom: 4px;}
+.layui-side-menu .layui-nav .layui-nav-item a {height: 40px;line-height: 40px;padding-left: 45px;padding-right: 30px;}
+.layui-side-menu .layui-nav .layui-nav-item .layui-icon {position: absolute; top: 50%; left: 20px; margin-top: -19px;}
+
+/*模拟加载层图标样式*/
+.layui-layer-dialog .layui-layer-content .layui-layer-ico16{ background-size:100% 100% !important; }
+
+/*样式改变的过渡*/
+.logo,.top_menu .layui-nav-item[pc],.component,.top_menu .layui-nav-item[mobile],.layui-nav,.layui-layout-admin .layui-main,.site-mobile .layui-side,.layui-layout-admin .layui-side,.site-mobile .site-tree-mobile,.layui-body,.layui-layout-admin .layui-footer,.layui-layout-admin .layui-side,.panel,.panel .panel_icon i{ transition: all 0.3s ease-in-out;-webkit-transition: all 0.3s ease-in-out;-o-transition: all 0.3s ease-in-out;-moz-transition: all 0.3s ease-in-out;-ms-transition: all 0.3s ease-in-out; }
+
+
+.logo{ color: #fff; float: left; line-height:60px; font-size:20px; padding:0 10px; text-align: center; margin-right: 15px; }
+.logo:hover{ color: #fff;}
+.weather{ color:#fff; float:left; margin:15px 0 0 50px;}
+.component{ float: left; width:200px; height:30px; margin-top: 15px; position: relative;}
+.component .layui-input{ height:30px; line-height: 30px; font-size:12px; border:none; transition: all 0.3s; }
+.component .layui-input:focus{ background:#fff; color:#000; }
+.component .layui-form-select dl{ top:33px; background:#fff; }
+.component .layui-form-select .layui-edge,.top_menu .layui-nav-item[mobile]{ display:none; }
+.component .layui-icon{ position: absolute; right:8px; top:8px; color:#000; }
+
+/*顶部右侧导航*/
+.top_menu{ position:absolute; right:0; background:none }
+.layui-tab-title li .layui-tab-close:hover{border-radius: 50%}
+.layadmin-pagetabs{box-shadow: 0 1px 2px 0 rgba(0,0,0,.05); background-color: #fff;}
+.layadmin-pagetabs .layui-tab-title{z-index: 1; }
+
+/*左侧用户头像*/
+.layui-layout-admin .layui-side{ left:0; }
+.user-photo{width: 200px; height: 120px; padding-top: 15px; padding-bottom: 5px;}
+.user-photo a.img{ display: block; width: 76px; height: 76px; margin: 0 auto; margin-bottom: 15px;}
+.user-photo a.img img{ display: block; border: none; width: 100%; height: 100%; border-radius: 50%; -webkit-border-radius: 50%; -moz-border-radius: 50%; border: 4px solid #44576b;}
+.user-photo p{ display: block; width: 100%; height: 25px; color: #ffffff; text-align: center; font-size: 12px; white-space: nowrap;line-height: 25px; overflow: hidden;}
+/*左侧导航重定义*/
+.layui-nav-item a cite{ padding:0 5px; }
+.layui-nav-tree .layui-nav-child a{ padding-left: 40px; }
+.layui-nav-tree .layui-nav-child a:hover{ background-color:#4E5465; }
+.layui-nav-tree .layui-nav-child dd.layui-this a:hover{ background-color:#009688; }
+
+/*右侧body*/
+#top_tabs_box{ padding-right:102px; height:40px;z-index: 1;}
+#top_tabs{ position: absolute; border-bottom:none;}
+/*多窗口页面操作下拉*/
+.closeBox{ position:absolute; right:0; padding: 0; background-color:#fff !important; color:#000; border-left:1px solid #e2e2e2;}
+.closeBox .layui-nav-item{ line-height:39px; }
+.closeBox .layui-nav-item a,.closeBox .layui-nav-item a:hover{ color:#666; padding: 0 12px;}
+.closeBox .layui-nav-child{ top: 40px; left: auto; right: 0;}
+.closeBox .layui-nav-bar{ display:none; }
+.closeBox .icon-caozuo{ font-size: 16px; color: #666; padding-right: 5px}
+.closeBox .layui-nav-child dd.layui-this a{background-color: #fff; color: #666;}
+
+.layui-body{overflow:hidden;}
+.layui-tab-content{ height:100%; padding:0; }
+.layui-tab-item{ position: absolute; top: 41px; bottom:0; left: 0; right: 0; padding: 0; margin: 0;-webkit-overflow-scrolling: touch;}
+.layui-body{ border-left: 2px solid #1AA094;}
+.marg0{ margin:0; }
+/* .layui-tab-title .layui-this{ border-top:#1AA094; color:#fff; } */
+.layui-tab-title .layui-this,.layui-tab-title li:hover{background-color: #f6f6f6;}
+.layui-tab-title .layui-this:after{content: ''; position: absolute; top: 0; z-index: 1; left: 0; width: 100%; height: 2px; border-radius: 0; background-color: #1AA094; transition: all .3s; -webkit-transition: all .3s; border: none;}
+.layui-tab-title li {min-width: 0; line-height: 39px; max-width: 160px; text-overflow: ellipsis; overflow: hidden; border-right: 1px solid #f6f6f6; vertical-align: top;}
+.layui-tab-title li cite{ font-style: normal; padding-left:5px; }
+.clildFrame.layui-tab-content{ padding-right: 0; }
+.clildFrame.layui-tab-content iframe{ width: 100%; height: 100%; border:none; min-width: 320px; }
+/*main.html*/
+.row,.col,.panel_word,.panel_icon{ box-sizing:border-box; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; -o-box-sizing:border-box;}
+.row{ margin-left:-10px; overflow:hidden;}
+.col{ padding-left:10px;}
+.panel{float: left; text-align: center; width:16.666%; min-width:210px; margin-bottom: 10px;}
+.panel_box a{display:block; background-color:#f2f2f2; border-radius:5px; overflow:hidden; }
+.panel_icon{ width:40%; display: inline-block; padding:22px 0; background-color:#54ade8;float:left;}
+.panel_icon i{ font-size:3em; color:#fff;}
+.panel a:hover .panel_icon i{ display:inline-block; transform:rotate(360deg); -webkit-transform:rotate(360deg); -moz-transform:rotate(360deg); -o-transform:rotate(360deg); -ms-transform:rotate(360deg);}
+.panel_word{ width:60%; display: inline-block; float:right; margin-top: 22px; }
+.panel_word span{ font-size:25px; display:block; height:30px; line-height:30px; }
+.allNews em{ font-style:normal; font-size:16px;display: block; }
+.panel_box a .allNews cite{ display:none; }
+.panel_box a cite{ font-size:16px; display: block; font-style:normal; }
+.sysNotice{ width:50%; float: left; }
+.sysNotice .layui-elem-quote{ line-height:26px; position: relative;}
+.sysNotice .layui-table{ margin-top:0; border-left:5px solid #e2e2e2; }
+.sysNotice .title .icon-new1{ position: absolute; top:8px; margin-left: 10px; color:#f00; font-size:25px; }
+
+/*锁屏*/
+.admin-header-lock{width: 320px; height: 170px; padding: 20px; position: relative; text-align: center;}
+.admin-header-lock-img{width: 60px; height: 60px; margin: 0 auto;}
+.admin-header-lock-img img{width: 60px; height: 60px; border-radius: 100%;}
+.admin-header-lock-name{color: #009688;margin: 8px 0 15px 0;}
+.input_btn{ overflow: hidden; margin-bottom: 10px; }
+.admin-header-lock-input{width: 170px; color: #fff;background-color: #009688; float: left; margin:0 10px 0 40px; border:none;}
+.admin-header-lock-input::-webkit-input-placeholder {color:#fff;}
+.admin-header-lock-input::-moz-placeholder {color:#fff;}
+.admin-header-lock-input::-ms-input-placeholder {color:#fff;}
+.admin-header-lock-input:-moz-placeholder {color:#fff;}
+#unlock{ float: left; }
+#lock-box p{ color:#e60000; }
+
+/*底部*/
+.footer{ text-align: center; font-size:12px; border-left: 2px solid #1AA094; background-color: #fff !important; box-shadow: 0 1px 2px 0 rgba(0,0,0,.1); border-top: 1px solid rgb(230, 230, 230); z-index: 1002;}
+.layui-layout-admin .layui-body{bottom: 0;}
+.layui-layout-admin .layui-footer{height: 30px; line-height: 30px}
+
+/*响应式*/
+@media screen and (max-width:1282px){
+	.panel{ width:33.3333%; }
+}
+@media screen and (max-width:1050px){
+	.layui-nav.top_menu .layui-nav-item a{ padding:0 10px; }
+	/*天气信息*/
+	.weather[pc]{ display: none !important; }
+	.sysNotice{ width:100%; }
+}
+@media screen and (max-width: 750px){
+	.logo{ padding:0;}
+	.top_menu .layui-nav-item[pc],.component,.site-mobile .site-tree-mobile{ display: none !important; }
+	.top_menu .layui-nav-item.showNotice[pc]{ display:inline-block !important; }
+	.top_menu .layui-nav-item[mobile]{ display:inline-block; }
+	.layui-nav.top_menu,.layui-nav.top_menu .layui-nav-item a{ padding:0 10px; }
+	.layui-layout-admin .layui-main{ margin-right: 0; }
+	
+	/*左侧导航*/
+	.layui-layout-admin .layui-side{ left:-260px; }
+	.site-mobile .layui-side{ left: 0; z-index:9999; }
+	.site-tree-mobile {display: block!important; position: fixed; z-index: 100000; bottom: 15px; left: 15px; width: 50px; height: 50px; line-height: 50px; border-radius: 2px; text-align: center; background-color: rgba(0,0,0,.7); color: #fff;}
+	.site-mobile .site-mobile-shade { content: ''; position: fixed; top: 0; bottom: 0; left: 0; right: 0; background-color: rgba(0,0,0,.8); z-index: 999;}
+
+	/*layui-body*/
+	.panel{ width:50%; }
+
+	.layui-body,.layui-layout-admin .layui-footer{ left:0; }
+}
+@media screen and (max-width:432px){
+	.top_menu .layui-nav-item.showNotice[pc]{ display:none !important; }
+	.panel{ width:100%; }
+}

+ 15 - 0
forstcss/message.css

@@ -0,0 +1,15 @@
+.selectMsg{ width:110px; margin-right: 15px; }
+
+.msg_info,.msg_time,.msg_reply,.msg_opr{min-height:50px; text-align:center;}
+.msg_info{text-align:left; position: relative; }
+.msg_info>img{ position: absolute; left:10px; top:10px; cursor:pointer; }
+.msg_info .user_info{ padding-left:55px; line-height:25px; }
+.msg_info .user_info h2{ color:#222; cursor:pointer; }
+.msg_info .user_info h2:hover{ color:#1AA094;}
+.msg_info .user_info p{ color:#8d8d8d; }
+.msg_reply{ color:#e15f63; }
+.msg_opr .layui-btn{ margin:2px 5px; }
+
+/*回复*/
+.replay_edit{ overflow: hidden; margin-bottom:20px; }
+.replay_edit a{margin-top: 10px; width:100px; float:right;}

+ 8 - 0
forstcss/news.css

@@ -0,0 +1,8 @@
+.news_search{ padding:10px 10px; }
+.news_search .layui-inline{ margin:5px 5px 5px 0; }
+.layui-table,.layui-table th{ text-align:center; }
+.news_list .layui-btn,.news_list .layui-btn+.layui-btn{ margin:2px 5px; }
+.news_list .layui-form-switch{ margin-top:0; }
+
+/*分页*/
+#page{ text-align:right; }

+ 38 - 0
forstcss/systemTree.css

@@ -0,0 +1,38 @@
+.region, .role, .system{
+    height: calc(100vh - 122px);
+    overflow-y: auto;
+}
+.layui-card-header{
+    padding: 10px 15px;
+    border-bottom: 1px solid #e6e6e6;
+    text-align: center
+}
+.layui-card-header .layui-btn{
+    width: 150px;
+    height: 32px
+}
+.layui-card-body{
+    padding: 0 15px;
+}
+.layui-bot-ul .li-item{
+    display: flex; 
+    padding: 12px 15px;
+    border-bottom: 1px solid #e6e6e6;
+    cursor: pointer;
+    align-items: center;
+}
+.layui-bot-ul .li-item.active{ background-color: #f5f5f5}
+.layui-bot-ul .li-item:hover{ background-color: #f5f5f5}
+.layui-bot-ul .li-item:hover .bot-btn-group{display: flex;}
+.layui-bot-ul .li-item.active .li-item-left h4{color: #1E9FFF}
+.layui-bot-ul .li-item-left h4{font-size: 15px; font-weight: normal; }
+.layui-bot-ul .li-item-left p{font-size: 14px; color: #999; margin-top: 6px}
+.bot-btn-group{
+    display: flex;
+    display: none;
+}
+.bot-btn-group li{cursor: pointer}
+.bot-btn-group li i{font-size: 16px; padding: 5px 3px; color: #000;}
+.layui-bot-ul .group{margin-bottom: 15px}
+.layui-bot-ul .group .li-group-top{padding: 15px; margin-bottom: 10px; border-bottom: 1px solid #e6e6e6; display: flex; align-items: center}
+.layui-bot-ul .group .li-group-top h4{font-size: 15px; margin-top: 8px; font-weight: normal; flex: 1; color: #000}

+ 28 - 0
forstcss/user.css

@@ -0,0 +1,28 @@
+form input.layui-input[disabled]{ background:#f2f2f2; color:#595963!important; }
+.user_left{ width:45%; float: left; margin:20px 0 0 5%; }
+.user_right{ width:25%; float: left; margin:20px 0 0 5%; text-align: center; }
+.user_right p{ margin:10px 0 25px; font-size: 12px; text-align: center; color: #FF5722;}
+.user_right img#userFace{ width:200px; height:200px; }
+.layui-table,.layui-table th{ text-align:center; }
+
+/*用户列表*/
+.news_list .layui-btn,.news_list .layui-btn+.layui-btn{ margin:2px 5px; }
+#page{ text-align:right; }
+
+
+/*适配*/
+@media screen and (max-width:1050px){
+	/*用户信息*/
+	.user_left,.user_right,.changePwd{ width:100%; float:none; margin-left: 0; }
+	.user_right{ margin-bottom: 20px; }
+}
+@media screen and (max-width: 750px){
+	/*用户信息*/
+	.user_left,.user_right,.changePwd{ width:100%; float:none; margin-left: 0; }
+	.user_right{ margin-bottom: 20px; }
+}
+@media screen and (max-width:432px){
+	/*用户信息*/
+	.user_left,.user_right,.changePwd{ width:100%; float:none; margin-left: 0; }
+	.user_right{ margin-bottom: 20px; }
+}

+ 193 - 0
forstlogin/css/style.css

@@ -0,0 +1,193 @@
+.main-nav {
+  height: 70px;
+  background-color: rgba(255, 255, 255, 0.1);
+  display: flex;
+  align-items: center;
+  padding: 0 30px;
+}
+.main-nav .return {
+}
+.main-nav .return a i {
+  margin-right: 5px;
+  font-size: 14px;
+  vertical-align: middle;
+}
+.main-nav .return a {
+  color: #fff;
+  font-size: 16px;
+}
+
+.blur {
+  filter: blur(15px);
+  position: fixed;
+  top: 0;
+}
+.main-login {
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  z-index: 1;
+  background: url("../img/login-bg.png") no-repeat center center !important;
+  background-size: 100% 100%;
+}
+
+.login-box {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: calc(100% - 70px);
+}
+.login-layout {
+  width: 800px;
+  padding: 0;
+  margin-top: -3%;
+  background: rgba(255, 255, 255, 1);
+  box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.3);
+  border-radius: 10px;
+  overflow: hidden;
+}
+.logo {
+  float: left;
+  width: 340px;
+  height: 300px;
+  background: url("../img/login-logo-bg-index.png") no-repeat left center,
+    url("../img//login-logo-bg.png") no-repeat center center;
+  background-size: 93% 89%, 102% 107%;
+  text-align: center;
+  margin-right: 20px;
+}
+.logo h2,
+.logo h3 {
+  font-family: PingFangSC-Medium, PingFang SC;
+  font-weight: 500;
+  color: #ffffff;
+  text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.74);
+}
+.formTitle {
+  /* display: flex; */
+  align-items: center;
+  font-size: 18px;
+  color: #336666;
+  font-weight: 700;
+  margin: 15px 0 18px 0;
+  letter-spacing: 4px;
+}
+.formTitle img {
+  width: 42px;
+  height: 38px;
+  margin-right: 10px;
+}
+.logo .title {
+  margin: 84px 0 5px 0;
+  font-size: 28px;
+}
+.logo .sub-title {
+  font-size: 18px;
+  letter-spacing: 3px;
+}
+.login-btn-submit {
+  width: 100% !important;
+  background: linear-gradient(180deg, #70ba7b 1%, #70ba7b 100%) !important;
+  border: none !important;
+  box-shadow: 0 0 5px 0 rgba(255, 255, 255, 0.1) !important;
+}
+.login-btn-submit:hover {
+  width: 100% !important;
+  background: linear-gradient(180deg, #70ba7b 1%, #70ba7b 100%) !important;
+  border: none !important;
+  box-shadow: 0 0 5px 0 rgba(255, 255, 255, 0.1) !important;
+  color: #fff !important;
+}
+.login-form {
+  overflow: hidden;
+  padding: 20px 36px 20px 22px;
+  text-align: center;
+}
+.login-form h4 {
+  font-size: 18px;
+  margin: 16px 0 18px 0;
+  letter-spacing: 2px;
+  color: #fff;
+  text-align: left;
+  text-shadow: 1px 1px 7px rgba(0, 0, 0, 0.6);
+}
+.layui-form-item {
+  height: 38px;
+  background-color: #fff;
+  border: 1px solid #f8f8f8;
+  border-radius: 5px;
+  display: flex;
+  align-items: center;
+  margin-bottom: 22px;
+  box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2);
+}
+.layui-form-item .layui-icon {
+  font-size: 20px;
+  padding: 0 10px;
+  color: #409eff;
+}
+.layui-form-item .layui-input {
+  border: none;
+  font-size: 16px;
+  height: 38px;
+  line-height: 45px;
+  padding-left: 5px;
+}
+.layui-submit {
+  margin-top: 10px;
+  width: 100%;
+  color: #fff;
+  background: #409eff;
+  display: inline-block;
+  line-height: 1;
+  white-space: nowrap;
+  cursor: pointer;
+  border: 1px solid #409eff;
+  color: #fff;
+  -webkit-appearance: none;
+  text-align: center;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+  outline: 0;
+  margin: 0;
+  -webkit-transition: 0.1s;
+  transition: 0.1s;
+  font-weight: 500;
+  -moz-user-select: none;
+  -webkit-user-select: none;
+  -ms-user-select: none;
+  padding: 12px 20px;
+  font-size: 14px;
+  border-radius: 4px;
+  letter-spacing: 9px;
+}
+.layui-submit:hover {
+  color: #333;
+}
+.layui-form-item .layui-input:focus {
+  border-color: #70ba7b !important;
+}
+.layui-form-item .layui-input:hover {
+  border-color: #70ba7b !important;
+}
+.layui-form-item .layui-icon {
+  color: #70ba7b;
+}
+.layui-form-item .layui-input::-webkit-input-placeholder {
+  /* 使用webkit内核的浏览器 */
+  color: #dcdfe6;
+}
+.layui-form-item .layui-input:-moz-placeholder {
+  /* Firefox版本4-18 */
+  color: #dcdfe6;
+}
+.layui-form-item .layui-input::-moz-placeholder {
+  /* Firefox版本19+ */
+  color: #dcdfe6;
+}
+.layui-form-item .layui-input:-ms-input-placeholder {
+  /* IE浏览器 */
+  color: #dcdfe6;
+}

BIN
forstlogin/img/login-bg.png


BIN
forstlogin/img/login-logo-bg-icon.png


BIN
forstlogin/img/login-logo-bg-index.png


BIN
forstlogin/img/login-logo-bg.png


BIN
forstlogin/img/nq-bg.jpg


BIN
forstlogin/img/sw-bg.jpg


BIN
forstlogin/img/wl-bg.jpg


+ 120 - 0
forstlogin/index.html

@@ -0,0 +1,120 @@
+<!DOCTYPE html>
+<html lang="en">
+
+	<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">
+		<meta name="apple-mobile-web-app-status-bar-style" content="black">
+		<meta name="apple-mobile-web-app-capable" content="yes">
+		<meta name="format-detection" content="telephone=no">
+		<link rel="stylesheet" type="text/css" href="../layui/css/layui.css" />
+		<link rel="stylesheet" type="text/css" href="css/style.css" />
+		<link rel="stylesheet" type="text/css" href="../iconfont/iconfont.css" />
+	</head>
+
+	<body>
+		<div class="login-wrap">
+			<div class="main-login">
+				<div class="login-box">
+					<div class="login-layout">
+						<div class="logo"></div>
+						<form class="layui-form login-form" action="">
+							<h3 class="formTitle">
+								<img src="./img/login-logo-bg-icon.png">贵州林产品溯源管理系统</h3>
+							<div class="layui-form-item">
+								<i class="layui-icon">&#xe66f;</i>
+								<input type="text" name="account" required lay-verify="userName" placeholder="请输入账号" autocomplete="off" class="login-box-input layui-input">
+							</div>
+							<div class="layui-form-item">
+								<i class="layui-icon">&#xe673;</i>
+								<input type="password" name="pwd" required lay-verify="pwd" placeholder="请输入密码" autocomplete="off" class="login-box-input layui-input">
+							</div>
+							<button class="layui-btn layui-submit login-btn-submit" lay-submit lay-filter="loginForm">登录</button>
+						</form>
+					</div>
+				</div>
+			</div>
+		</div>
+		<script src="../layui/layui.js" type="text/javascript" charset="utf-8"></script>
+		<script src="../js/ajaxhook.min.js" type="text/javascript" charset="utf-8"></script>
+		<script>
+			var SYS_VER = Math.random() * 100000;
+			function loadJS(url) {
+				document.write("<script src='" + url + "?ver=" + SYS_VER + "'><\/script>")
+			}
+			loadJS("../js/config.js");
+			layui.config({
+				base: "../js/layuiPlugins/"
+			}).use(['form', 'laytpl', 'jquery', 'md5'], function () {
+				//清除token
+				((window.hywa || {}).sessionTable || {}).tableName && layui.sessionData((window.hywa.sessionTable || {}).tableName, null);
+				var form = layui.form,
+					laytpl = layui.laytpl,
+					$ = layui.$,
+					md5 = layui.md5;
+
+				form.verify({
+					userName: [
+						/^[0-9\a-z\A-Z\u4e00-\u9fa5_]{2,16}$/,
+						"账号必须是2-16位,且不包含特殊字符"
+					],
+					pwd: [
+						/^[\S]{6,12}$/,
+						'密码必须6到12位,且不能出现空格'
+					]
+				});
+
+				function ajaxLogin(data) {
+					var time = 'b8d11ee289394be688ef3a4f6968efed';
+					var result = btoa(data.pwd);
+					time = time.substring(0, 8);
+					var pass = md5.calcMD5(time);
+					pass = pass.substring(0, 5);
+					data.passwd = pass + result;
+					$.ajax({
+						url: 'login',
+						type: 'post',
+						data: JSON.stringify(data),
+						contentType: 'application/json',
+						success: function (data) {
+							var code = data.code,
+								user = { userId: ((((data.data || [])[0] || {}).CurrentUser || {}).guid || ""), name: ((((data.data || [])[0] || {}).CurrentUser || {}).account || ""), realName: ((((data.data || [])[0] || {}).CurrentUser || {}).userName || ""), menus: (((data.data || [])[0] || {}).authMenuObj || {}) },
+								token = ((data.data || [])[0] || {}).accessToken || null,
+								systemLable = { systemName: (((data.data || [])[0] || {}).orgObject || {}).systemName || "贵州林产品溯源管理系统" };
+							if (!(code - 0)) {
+								//储存用户信息
+								layui.sessionData(window.hywa.sessionTable.tableName, {
+									key: window.hywa.sessionTable.userData,
+									value: user
+								});
+								//存储系统名称
+								layui.sessionData(window.hywa.sessionTable.tableName, {
+									key: 'sys',
+									value: systemLable
+								});
+								//存储token
+								layui.sessionData(window.hywa.sessionTable.tableName, {
+									key: 'token',
+									value: token
+								});
+								//存储数组
+								location.href = window.hywa.jumpPage.home;
+							}
+						}
+					})
+				}
+
+				form.on('submit(loginForm)', function (data) {
+					setTimeout(function () {
+						ajaxLogin(data.field);
+					}, 0);
+					return false;
+				});
+			});
+		</script>
+	</body>
+
+</html>

Datei-Diff unterdrückt, da er zu groß ist
+ 21 - 0
forstpages/analyze/echarts.simple.min.js


+ 507 - 0
forstpages/analyze/index.html

@@ -0,0 +1,507 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<script src="echarts.simple.min.js"></script>
+	<style type="text/css">
+		body {
+			font-family: 'Microsoft YaHei';
+		}
+
+		.my-head {
+			border: 1px solid #e9e9e9;
+			background-color: #fafafa;
+			color: #000000d8;
+		}
+
+		.mybox {
+			border-right: 1px solid #e9e9e9;
+			margin-right: 10px;
+			text-align: center;
+			font-size: 16px;
+			margin: 10px 0;
+		}
+
+		.mybox h2 {
+			margin-bottom: 15px;
+			font-weight: bold;
+		}
+
+		.no-border {
+			border: none;
+		}
+
+		.margin-top {
+			margin-top: 10px;
+		}
+
+		.text-right {
+			text-align: right;
+		}
+
+		.my-btn {
+			margin: 10px;
+		}
+
+		.my-head-1 {
+			border-bottom: 1px solid #e9e9e9;
+			padding-bottom: 10px;
+		}
+
+		.my-title {
+			line-height: 100%;
+			font-size: 16px;
+			padding-top: 10px;
+			color: #3398db;
+		}
+
+		.text-center {
+			text-align: center;
+		}
+
+		.article-title {
+			margin: 30px 0 5px 15px;
+		}
+
+		.article-content {
+			padding-top: 5px;
+			padding-left: 45px;
+		}
+	</style>
+</head>
+
+<body class="childrenBody">
+	<div class="layui-fluid">
+		<div class="layui-card">
+			<div class="layui-tab layui-tab-brief">
+				<ul class="layui-tab-title">
+					<li class="layui-this">用户统计</li>
+					<li>评价明细</li>
+					<!-- <li>用户属性</li> -->
+					<!-- <li>扫描分析</li> -->
+				</ul>
+				<div class="layui-tab-content">
+					<div class="layui-tab-item layui-show">
+						<div class="layui-card">
+							<div class="layui-card-header my-head">昨日关键指标:</div>
+							<div class="layui-card-body">
+								<div class="layui-row">
+									<div class="layui-col-md6">
+										<div class="mybox">
+											<h2>新扫码人数:</h2>
+											<div id="newScanNum">0</div>
+										</div>
+									</div>
+									<div class="layui-col-md6">
+										<div class="mybox no-border">
+											<h2>累计扫码人数:</h2>
+											<div id="sacanNumTotla">0</div>
+										</div>
+									</div>
+								</div>
+							</div>
+						</div>
+						<div class="layui-card-header my-head">趋势统计:</div>
+						<div class="layui-row margin-top my-head-1">
+							<div class="layui-col-md4">
+								<h2 class="my-title">扫描人数</h2>
+							</div>
+							<div class="layui-col-md8 text-right">
+								<!-- <a href="javascript:;" class="my-btn">今日</a>
+									<a href="javascript:;" class="my-btn">本周</a>
+									<a href="javascript:;" class="my-btn">本月</a>
+									<a href="javascript:;" class="my-btn">全年</a>
+									<div class="layui-inline">
+										<input type="text" class="layui-input " AUTOCOMPLETE="off" id="timeStart" />
+										<i class="layui-icon layui-icon-date" style="font-size: 22px; "></i>
+									</div>
+									~
+									<div class="layui-inline">
+										<input type="text" class="layui-input " AUTOCOMPLETE="off" id="timeEnd" />
+									</div> -->
+							</div>
+						</div>
+
+						<div id="mapContainer" style="width: 100%;height:400px;"></div>
+					</div>
+					<div class="layui-tab-item ">
+						<form class="layui-form" action="">
+							<div class="layui-input-inline">
+								<div class="layui-input-inline">
+									<input class="layui-input" placeholder="产品名称/用户名称/商品批次" style="margin-right: 15px;" type="text"
+										name="condStr" />
+								</div>
+							</div>
+							<div class="layui-input-inline">
+								<div class="layui-input-inline">
+									<select id="select2"></select>
+								</div>
+							</div>
+							<div class="layui-input-inline">
+								<div class="layui-input-inline">
+									<input class="layui-input" placeholder="评价时间" style="margin-right: 15px;" type="text" name="beginTime"
+										id="appraiseTime" />
+								</div>
+							</div>
+							<div class="layui-input-inline">
+								<div class="layui-input-inline">
+									<input class="layui-input" placeholder="评价内容" style="margin-right: 15px;" type="text"
+										name="commentVal" />
+								</div>
+							</div>
+							<button type="button" class="layui-btn" lay-submit lay-filter='commentInfoS'>搜索</button>
+						</form>
+						<table class="layui-hide" id="commentInfo" lay-filter="commentInfo"></table>
+					</div>
+
+					<div class="layui-tab-item ">
+						<div class="layui-card">
+							<div class="layui-card-header my-head">用户属性:</div>
+							<div class="layui-card-body">
+								<h3 class="article-title">
+									<i class="layui-icon layui-icon-rate-solid" style="font-size: 16px; color: #44b549;"></i>
+									申请条件
+								</h3>
+								<p class="article-content">
+									<span class="layui-badge-dot layui-bg-gray"></span>
+									测试3月21日14时许,江苏盐城市响水陈家港天嘉宜化工厂(生产农药)发生爆炸!此前中国地震台网通报称,14时48分44秒在江苏连云港市灌南县(疑爆)(北纬34.33度,东经119.73度)发生2.2级地震,震源深度0千米。
+								</p>
+
+								<h3 class="article-title">
+									<i class="layui-icon layui-icon-friends" style="font-size: 16px; color: #7cbae5;"></i>
+									申请条件
+								</h3>
+								<p class="article-content">
+									<span class="layui-badge-dot layui-bg-gray"></span>
+									封面新闻记者随后联系到现场的民众张先生。他说,当时他所在的位置位于连云港市灌南县堆沟港镇海中洲船厂,“爆炸时,都跟地震差不多了,声音很大。”他告诉记者,他当时坐在车上,车还跳动了一下。灌河北边的灌南居民区及学校窗玻璃被震碎无数。
+								</p>
+								<p class="article-content">
+									<span class="layui-badge-dot layui-bg-gray"></span>
+									3月21日14时许,江苏盐城市响水陈家港天嘉宜化工厂(生产农药)发生爆炸!此前中国地震台网通报称,14时48分44秒在江苏连云港市灌南县(疑爆)(北纬34.33度,东经119.73度)发生2.2级地震,震源深度0千米。
+								</p>
+
+								<h3 class="article-title">
+									<i class="layui-icon layui-icon-template-1" style="font-size: 16px; color: #f86161;"></i>
+									申请条件
+								</h3>
+								<p class="article-content">
+									<span class="layui-badge-dot layui-bg-gray"></span>
+									3月21日14时许,江苏盐城市响水陈家港天嘉宜化工厂(生产农药)发生爆炸!此前中国地震台网通报称,14时48分44秒在江苏连云港市灌南县(疑爆)(北纬34.33度,东经119.73度)发生2.2级地震,震源深度0千米。
+								</p>
+								<div class="text-center " style="margin: 50px 0 20px 0;">
+									<a href="http://www.layui.com" class="layui-btn layui-btn-normal">去开通</a>
+								</div>
+							</div>
+						</div>
+
+					</div>
+					<div class="layui-tab-item">
+						<div class="layui-card">
+							<div class="layui-card-header my-head">扫描明细:</div>
+							<div class="layui-card-body">
+								<h3 class="article-title">
+									<i class="layui-icon layui-icon-rate-solid" style="font-size: 16px; color: #44b549;"></i>
+									申请条件33
+								</h3>
+								<p class="article-content">
+									<span class="layui-badge-dot layui-bg-gray"></span>
+									测试3月21日14时许,江苏盐城市响水陈家港天嘉宜化工厂(生产农药)发生爆炸!此前中国地震台网通报称,14时48分44秒在江苏连云港市灌南县(疑爆)(北纬34.33度,东经119.73度)发生2.2级地震,震源深度0千米。
+								</p>
+
+								<h3 class="article-title">
+									<i class="layui-icon layui-icon-friends" style="font-size: 16px; color: #7cbae5;"></i>
+									申请条件
+								</h3>
+								<p class="article-content">
+									<span class="layui-badge-dot layui-bg-gray"></span>
+									3月21日14时许,江苏盐城市响水陈家港天嘉宜化工厂(生产农药)发生爆炸!此前中国地震台网通报称,14时48分44秒在江苏连云港市灌南县(疑爆)(北纬34.33度,东经119.73度)发生2.2级地震,震源深度0千米。
+								</p>
+
+								<h3 class="article-title">
+									<i class="layui-icon layui-icon-template-1" style="font-size: 16px; color: #f86161;"></i>
+									申请条件2
+								</h3>
+								<p class="article-content">
+									<span class="layui-badge-dot layui-bg-gray"></span>
+									3月21日14时许,江苏盐城市响水陈家港天嘉宜化工厂(生产农药)发生爆炸!此前中国地震台网通报称,14时48分44秒在江苏连云港市灌南县(疑爆)(北纬34.33度,东经119.73度)发生2.2级地震,震源深度0千米。
+								</p>
+								<div class="text-center " style="margin: 50px 0 20px 0;">
+									<a href="http://www.layui.com" class="layui-btn layui-btn-normal">去开通</a>
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+
+	</div>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script>
+
+
+		// 基于准备好的dom,初始化echarts实例
+		var myChart = echarts.init(document.getElementById('mapContainer'));
+
+		// 指定图表的配置项和数据
+		var option = {
+			color: ['#3398DB'],
+			tooltip: {
+				trigger: 'axis',
+				axisPointer: { // 坐标轴指示器,坐标轴触发有效
+					type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
+				}
+			},
+			grid: {
+				left: '3%',
+				right: '4%',
+				bottom: '3%',
+				containLabel: true
+			},
+			xAxis: [{
+				type: 'category',
+				data: [],
+				axisTick: {
+					alignWithLabel: true
+				}
+			}],
+			yAxis: [{
+				type: 'value'
+			}],
+			series: [{
+				name: '直接访问',
+				type: 'bar',
+				barWidth: '60%',
+				data: []
+			}]
+		};
+
+
+
+		//注意:选项卡 依赖 element 模块,否则无法进行功能性操作
+		layui.use(['element', 'laydate', 'form', 'table', 'laytpl', 'jquery', 'layer'], function () {
+			var element = layui.element;
+			var laydate = layui.laydate,
+				form = layui.form,
+				table = layui.table,
+				laytpl = layui.laytpl,
+				$ = layui.jquery;
+			//获取文字统计信息
+			$.ajax({
+				url: "query_listTotal",
+				method: 'post',
+				contentType: "application/json",
+				data: JSON.stringify({}),
+				success: function (res) {
+					$("#newScanNum").text(res.data[0].newScanNum === null ? 0 : res.data[0].newScanNum)
+					$("#sacanNumTotla").text(res.data[0].scanNum === null ? 0 : res.data[0].scanNum)
+				}
+			});
+
+			var echartLable = [];
+			var echartValue = [];
+			//获取图标统计数据
+			$.ajax({
+				url: "qurey_echartTotal",
+				method: 'post',
+				contentType: "application/json",
+				data: JSON.stringify({}),
+				success: function (res) {
+					let data = res.data;
+					for (let i = 0; i < data.length; i++) {
+						echartLable.push(data[i].date + '月')
+						echartValue.push(data[i].num)
+					}
+					option.xAxis[0].data = echartLable;
+					option.series[0].data = echartValue;
+					// 回显图表
+					myChart.setOption(option);
+				}
+			});
+
+			// console.log(option.xAxis[0].data)
+			// console.log(option.series[0].data)
+
+			laydate.render({
+				elem: '#timeStart',
+				value: '2019-03-1'
+			});
+			laydate.render({
+				elem: '#timeEnd',
+				value: '2019-03-21'
+			});
+
+
+			//下拉框模板
+			function selectTpl(obj) {
+				let fun = function () {
+					obj.data.unshift({
+						value: '',
+						name: obj.title
+					});
+					laytpl(
+						`
+							{{# layui.each(d,function(i,item){ }}
+								<option value="{{item.value}}">{{item.name}}</option>
+							{{# })}}
+						`
+					).render(obj.data, function (html) {
+						$(obj.elem).html(html);
+						$(obj.elem).attr('name', obj.name);
+						form.render('select');
+					});
+				}
+				if (obj.url) {
+					$.ajax({
+						url: obj.url,
+						success: function (res) {
+							obj.data = res.data;
+							fun();
+						}
+					});
+				} else if (obj.data) {
+					fun()
+				}
+			}
+			//星级下拉
+			selectTpl({
+				title: '选择星级',
+				elem: '#select2',
+				name: 'gradeStar',
+				data: [{
+					name: "1级",
+					value: 1
+				}, {
+					name: "2级",
+					value: 2
+				}, {
+					name: "3级",
+					value: 3
+				}, {
+					name: "4级",
+					value: 4
+				}, {
+					name: "5级",
+					value: 5
+				}]
+			});
+			//时间
+			laydate.render({
+				elem: '#appraiseTime',
+				type: 'datetime'
+			});
+			//列表
+			table.render({
+				id: 'commentInfo',
+				elem: '#commentInfo',
+				url: "select_searchByPage",
+				method: 'post',
+				contentType: 'application/json',
+				request: {
+					pageName: 'pageNum',
+					limitName: 'pageSize'
+				},
+				toolbar: `<div>
+						<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
+					</div>`,
+				cols: [
+					[{
+						type: 'checkbox',
+						fixed: 'left'
+					}, {
+						field: 'tracedUserName',
+						title: '评价用户',
+						align: 'center'
+					}, {
+						field: 'goodsName',
+						title: '评价产品',
+						align: 'center'
+					}, {
+						field: 'goodsBatchNo',
+						title: '产品批次',
+						align: 'center'
+					}, {
+						field: 'gradeLevel',
+						title: '满意度星级',
+						align: 'center'
+					}, {
+						field: 'commentVal',
+						title: '评论内容',
+						align: 'center'
+					}, {
+						field: 'createTime',
+						title: '评论时间',
+						align: 'center'
+					}]
+				],
+				page: true
+			});
+			//搜索
+			form.on('submit(commentInfoS)', function (data) {
+				console.log(data.elem) //被执行事件的元素DOM对象,一般为button对象
+				console.log(data.form) //被执行提交的form对象,一般在存在form标签时才会返回
+				console.log(data.field) //当前容器的全部表单字段,名值对形式:{name: value}
+				table.reload('commentInfo', {
+					where: data.field
+				});
+				return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
+			});
+			//监听事件
+			table.on('toolbar(commentInfo)', function (obj) {
+				var checkStatus = table.checkStatus(obj.config.id);
+				let data = checkStatus.data;
+				data = data.map(function (i) {
+					return i.guid
+				});
+				console.log(this);
+				if (data.length) {
+					layer.alert('确定要删除吗?', {
+						time: 0,
+						btn: ['确定', '取消'],
+						yes: function (index) {
+							layer.close(index);
+							switch (obj.event) {
+								case 'del':
+									$.ajax({
+										type: 'post',
+										url: "del_feedback",
+										data: JSON.stringify({
+											pkList: data
+										}),
+										contentType: 'application/json',
+										success: function (res) {
+											table.reload('commentInfo', {});
+										}
+									});
+									break;
+							};
+						}
+					});
+
+				} else {
+					layui.layer.tips('请勾选要删除的行', this);
+				}
+
+			});
+		});
+	</script>
+</body>
+
+</html>

+ 418 - 0
forstpages/dealer/add_change.html

@@ -0,0 +1,418 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<script type="text/javascript"
+		src="https://webapi.amap.com/maps?v=1.4.15&key=388e4a971a8fb8d616e4a85d7deff144"></script>
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: 100% !important;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+
+		.amap {
+			width: 658px;
+			height: 300px;
+			margin-left: 110px;
+		}
+	</style>
+	<script type="text/html" id="typeHtmlTpl">
+		<option value="">请选择</option>
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+		<option value="{{item.guid}}">{{item.roleName}}</option>
+		{{# }); }}
+	</script>
+</head>
+
+<body>
+	<form class="layui-form" action="" lay-filter="addForm" style="padding: 20px 20px 0 0">
+		<h3 style="font-size:16px;margin:10px 20px 10px 20px;padding:10px 6px;border-bottom:1px dashed #ddd;">经销商信息</h3>
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">经销商编码</label>
+			<div class="layui-input-block">
+				<input type="text" name="dealerCode" maxlength="32" lay-verify="required" placeholder="请输入经销商编码"
+					autocomplete="off" class="layui-input" readonly="readonly">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">经销商名称</label>
+			<div class="layui-input-block">
+				<input type="text" name="dealerName" maxlength="32" lay-verify="required" placeholder="请输入经销商名称"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">联系方式</label>
+			<div class="layui-input-block">
+				<input type="text" name="linkPhone" maxlength="11" lay-verify="required" placeholder="请输入联系电话"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label">备注说明</label>
+			<div class="layui-input-block">
+				<textarea type="text" name="remark" maxlength="200" autocomplete="off" class="layui-textarea"></textarea>
+			</div>
+		</div>
+		<h3 style="font-size:16px;margin:10px 20px 10px 20px;padding:10px 6px;border-bottom:1px dashed #ddd;">地理位置标记</h3>
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">产地地址</label>
+			<div id="address" class="layui-input-block">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<div class="amap" id="container"></div>
+		</div>
+		<div class="layui-form-item layui-layer-btn">
+			<div class="layui-input-block">
+				<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">取消</button>
+				<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+			</div>
+		</div>
+	</form>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(["form", 'layer', 'laytpl', 'jquery', 'cascade'], function () {
+			var form = layui.form,
+				layer = layui.layer,
+				laytpl = layui.laytpl,
+				cascade = layui.cascade,
+				$ = layui.jquery;
+			var funcName = "dealer";
+			var formData = {
+				guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
+				roleTableDataId: "roleDataList", //数据ID
+				current: {
+					latitudeLongitude: ''
+				}, //当前表单数据
+				select_data: "select_" + funcName, //查询用户
+				selectPId_dealer: "selectPId_" + funcName,
+				save_data: (location.searchObj().guid ? 'edit' : 'add') + '_' + funcName, //查询用户
+				formLayFilter: "addForm", //表单容器
+				closeModal: function () { //关闭当前窗口
+					parent.layer.close(parent.layer.getFrameIndex(window.name));
+				}
+			};
+
+			//高德地图初始化
+			var marker, map = new AMap.Map('container', {
+				zoom: 11,//级别
+				viewMode: '3D'//使用3D视图
+			});
+
+			AMap.plugin('AMap.ToolBar', function () {
+				var toolbar = new AMap.ToolBar();
+				map.addControl(toolbar)
+			})
+
+			//点击标记地图点
+			map.on('click', function (e) {
+				clearMarker();
+				let lnglat = [e.lnglat.getLng(), e.lnglat.getLat()]
+				marker = new AMap.Marker({
+					icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
+					position: lnglat,
+					offset: new AMap.Pixel(-13, -30)
+				});
+				marker.setMap(map);
+				formData.current.latitudeLongitude = lnglat.toString()
+			});
+
+			//设置标记点
+			function setMarker(lnglat) {
+				marker = new AMap.Marker({
+					icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
+					position: lnglat,
+					offset: new AMap.Pixel(-13, -30)
+				});
+				marker.setMap(map);
+			}
+
+			//清空坐标点
+			function clearMarker() {
+				if (marker) {
+					marker.setMap(null);
+					marker = null;
+				}
+			}
+
+			//类型下拉列表模板
+			function typeTpl(obj) {
+				laytpl(typeHtmlTpl.innerHTML).render(obj, function (html) {
+					$(obj.elem).html(html);
+					form.render();
+				});
+			}
+
+			//初始化
+			formData.main = function () {
+				var _this = this;
+				if (this.guid) {
+					_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+				} else {
+					_this.initialization();
+				}
+				if (location.searchObj().event == "view") {
+					var el = document.getElementsByTagName("INPUT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].readOnly = true;
+					}
+					el = document.getElementsByTagName("textarea");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("checkbox");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("button");
+					for (var i = 0; i < el.length; i++) {
+						if (el[i].innerText.replace(" ", "") == "保存") {
+							el[i].style.display = "none";
+						}
+					}
+				}
+				return this;
+			};
+
+
+			//初始化
+			formData.initialization = function () {
+				var _this = this;
+
+				//坐标设定
+				if (!(formData.current.latitudeLongitude === "")) {
+					let mapMark = formData.current.latitudeLongitude.split(",")
+					setMarker(mapMark);
+				}
+
+				//新增->初始化编码
+				if (!formData.current.dealerCode) {
+					formData.getProductId();
+				}
+
+				//初始化地区
+				cascade.render({
+					elem: "#address",
+					hostParm: {
+						idName: 'parentId'
+					},
+					url: {
+						provinceId: 'areaSearch',
+						cityId: 'areaSearch',
+						countyId: 'areaSearch'
+					},
+					listParamName: {
+						valueName: 'code',
+						name: 'name'
+					},
+					width: {
+						provinceId: '8em',
+						cityId: '8em',
+						countyId: '8em',
+						townId: '8em'
+					}
+				}).val({
+					provinceId: this.current.provinceId,
+					cityId: this.current.cityId,
+					countyId: this.current.countyId
+				});
+				//监听提交
+				form.on('submit(formDemo)', function (obj) {
+					//必须return false;
+					return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+				});
+				//关闭窗口
+				$("#closeWin").on("click", function () {
+					_this.closeModal();
+				});
+				return _this;
+			};
+
+			//创建新的编码
+			formData.getProductId = function () {
+				var _this = this;
+				$.ajax({
+					url: this.selectPId_dealer,
+					method: 'get',
+					success: function (res) {
+						_this.current.dealerCode = res.data[0].dealerCode;
+						form.val(_this.formLayFilter, _this.current);
+					}
+				});
+			}
+
+			//获取当前信息
+			formData.getCurrent = function (id) {
+				var _this = this;
+				$.ajax({
+					url: this.select_data,
+					method: 'get',
+					data: {
+						guid: id || this.guid //当前ID
+					},
+					success: function (res) {
+						_this.current = res.data[0];
+						_this.initialization().formVal();
+					}
+				});
+				return _this;
+			};
+
+			//表单赋值
+			formData.formVal = function () {
+				var _this = this;
+				form.val(this.formLayFilter, this.current);
+				return this;
+			};
+
+			//合并表单内容
+			formData.fusionData = function (obj) {
+				this.current = $.extend(this.current, obj);
+				if (this.current.guid) {
+					delete this.current.password;
+				}
+				return this;
+			};
+
+			//提交新增修改
+			formData.submitInfo = function () {
+				var _this = this;
+				if (!this.current.countyId || this.current.countyId == "") {
+					layer.msg("必须选择省市县地址");
+					return false;
+				}
+				this.current.fkPostionId = this.current.countyId;
+				$.ajax({
+					type: 'POST',
+					url: this.save_data,//+'?userId='+this.guid
+					data: JSON.stringify(this.current),
+					contentType: 'application/json',
+					success: function (res) {
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							_this.closeModal();
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+				return false;
+			};
+
+			formData.main();
+
+			//验证规则
+			form.verify({
+				nickname: function (value) {
+					if (!new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$").test(value)) {
+						return '账号必须以英文字母开头,只能包含英文字母、数字、下划线';
+					}
+					if (/(^\_)|(\__)|(\_+$)/.test(value)) {
+						return '账号首尾不能出现下划线\'_\'';
+					}
+				},
+				checkName: function (value) {
+				},
+				phoneNumber: function (value) {
+					if (value) {
+						if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+							return '请输入正确的手机号码';
+						}
+					}
+					return false;
+				},
+				password: function (value) {
+					if (location.searchObj().guid) {
+						if (value) {
+							if (!(/^[\S]{6,12}$/).test(value)) {
+								return '密码必须6到12位,且不能出现空格';
+							}
+						}
+						return false;
+					}
+					if (!(/^[\S]{6,12}$/).test(value)) {
+						return '密码必须6到12位,且不能出现空格';
+					}
+				},
+				resspaword: function (value) {
+					var pass = $('#L_pass').val();
+					if (value != pass) {
+						return '两次密码不一致';
+					}
+				},
+				ageLength: [
+					/^[0-9]{0,2}$/,
+					'年龄必须0到2位,且只能是数字'
+				],
+				jobLength: [
+					/^[a-z\A-Z\u4e00-\u9fa5_]{0,10}$/,
+					'职务必须是0-10位,且不包含特殊字符与数字'
+				],
+				workUnit: [
+					/^[0-9\a-z\A-Z\u4e00-\u9fa5_]{0,25}$/,
+					'工作单位必须是0-25位,且不包含特殊字符'
+				],
+				vcode: [
+					/^[\w]{4,5}$/,
+					'验证码不符合规则'
+				]
+			});
+		});
+	</script>
+</body>
+
+</html>

+ 95 - 0
forstpages/dealer/index.html

@@ -0,0 +1,95 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<!--类型下拉模板-->
+	<script type="text/html" id="typeHtmlTpl">
+        <option value="">请选择</option>
+        {{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+        <option value="{{item.guid}}">{{item.roleName}}</option>
+        {{# }); }}
+    </script>
+	<!--操作模板-->
+	<script type="text/html" id="operatingTool">
+        <a class="layui-btn layui-btn-xs view-btn-0" lay-event="view">查看</a>
+        <a class="layui-btn layui-btn-xs edit-btn-0" lay-event="edit">修改</a>
+        <a class="layui-btn layui-btn-danger layui-btn-xs del-btn-0" lay-event="del">删除</a>
+    </script>
+	<script type="text/html" id="checkboxTpl">
+        <!-- 这里的 checked 的状态只是演示 -->
+	<input type="checkbox" name="isForbid" id="{{d.guid}}" value="{{d.isForbid}}" title="可用" lay-filter="statusDemo"
+		{{ d.isForbid == 0 ? 'checked' : '' }}>
+	</script>
+</head>
+
+<body class="childrenBody">
+	<div class="layui-fluid">
+		<div class="layui-row layui-col-space15">
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">经销商管理</div>
+					<div class="layui-card-body">
+						<form class="layui-form" action="" novalidate>
+							<div class="searching">
+								<div style="flex: 7;" class="search-box">
+									<i class="layui-icon layui-icon-search"></i>
+
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="params" autocomplete="off" type="text"
+											placeholder="请输入经销商名称" />
+									</div>
+								</div>
+								<div style="padding-left: 5px;">
+									<button class="layui-btn layui-btn-normal" lay-submit lay-filter="DataSearch"
+										layId="DataTable">搜索</button>
+								</div>
+							</div>
+						</form>
+					</div>
+				</div>
+			</div>
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">
+						经销商列表
+						<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;"
+							id="addBtn" layId="addBtn">新增</div>
+					</div>
+					<div class="layui-card-body">
+						<div class="layui-form news_list">
+							<table id="DataTable" lay-filter="DataTable" class="layui-table" lay-even lay-skin="nob"></table>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		var SYS_VER = location.href.substring(location.href.indexOf("ver=") + 4, location.href.indexOf("ver=") + 7);
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + SYS_VER + "'><\/script>")
+		}
+		loadJS("../../js/config.js");
+		loadJS("index.js");
+	</script>
+</body>
+
+</html>

+ 177 - 0
forstpages/dealer/index.js

@@ -0,0 +1,177 @@
+;
+layui.config({
+	base: "../../js/layuiPlugins/"
+}).use(['form', 'layer', 'jquery', 'table', 'laytpl'], function () {
+	var form = layui.form,
+		layer = layui.layer,
+		laytpl = layui.laytpl,
+		$ = layui.jquery,
+		table = layui.table;
+	var funcName = "dealer";
+	form.verify({
+		namelength: [
+			/^.{0,12}$/,
+			"长度限制在0-12个字符噢"
+		]
+	});
+	//工具条处理
+	function toolOperating(obj) {
+		var data = obj.data;
+		if (obj.event === 'del') {
+			layer.confirm('真的删除吗?', function (index) {
+				layer.close(index);
+				var index1 = layer.msg('删除中,请稍候', {
+					icon: 16,
+					time: false,
+					shade: 0.8
+				});
+				$.ajax({
+					type: "get",
+					url: 'delete_' + funcName + '?guid=' + obj.data.guid,
+					success: function (res) {
+						layer.close(index1);
+						if (!(res.code - 0)) {
+							obj.del();
+							table.reload(funcName);
+						}
+					}
+				});
+			});
+		} else if (obj.event === 'edit') { //修改
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "修改",
+				area: ['800px', '470px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=edit&guid=' + data.guid,
+				end: function () {
+					table.reload(funcName); //重新载入表格
+				}
+			});
+		} else if (obj.event === 'view') { //查看
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "查看",
+				area: ['800px', '470px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=view&guid=' + data.guid,
+				end: function () {
+				}
+			});
+		}
+	}
+
+	console.log(funcName + 'List')
+	//列表
+	var DataList = {
+		id: funcName,
+		elem: '#DataTable',
+		url: funcName + 'List',
+		page: true,
+		method: "post",
+		contentType: 'application/json',
+		loading: true,
+		cellMinWidth: 80,
+		cols: [
+			[ //标题栏
+				{
+					field: 'dealerCode',
+					title: '经销商编码',
+					align: 'left',
+				},
+				{
+					field: 'dealerName',
+					title: '经销商名称',
+					align: 'left'
+				},
+				{
+					field: 'linkPhone',
+					title: '联系方式',
+					align: 'left'
+				},
+				{
+					field: 'dealerAddress',
+					title: '地址',
+					align: 'left'
+				},
+				{
+					field: 'remark',
+					title: '备注说明',
+					align: 'left'
+				},
+				{
+					field: 'operating',
+					title: '操作',
+					toolbar: '#operatingTool',
+					align: 'center',
+					fixed: 'right',
+					width: 240
+				}
+			]
+		] //设置表头
+		, done: function (res) {
+			resetButton(layui.sessionData(window.hywa.sessionTable.tableName).userData.menus.subMenuList, $);
+		}
+	};
+
+	//执行默认渲染表格
+	table.render(DataList);
+
+	//监听产品工具事件条
+	table.on('tool(DataTable)', function (obj) {
+		toolOperating(obj);
+	});
+	//搜索响应函数
+	var infoSearch = function (obj) {
+		table.reload(funcName, { //执行重载
+			where: obj.field
+		});
+		return false;
+	};
+	//监听搜索表单事件
+	form.on("submit(DataSearch)", infoSearch);
+
+	//监听可用操作
+	form.on('checkbox(statusDemo)', function (obj) {
+		$.ajax({
+			url: 'forbidUser?guid=' + obj.elem.id + '&isForbid=' + this.value,
+			type: 'get',
+			contentType: 'application/json',
+			success: function (res) {
+				if (!(res.code - 0)) {
+					parent.layer.msg(res.msg, {
+						icon: 1
+					});
+					table.reload(funcName);
+				} else {
+					layer.msg(res.msg, {
+						icon: 2
+					});
+					obj.elem.checked = !obj.elem.checked;
+					form.render();
+				}
+			}
+		});
+	});
+	$("#addBtn").on("click", function () {
+		layer.open({
+			type: 2,
+			anim: 0,
+			title: "新增",
+			area: ['800px', '670px'],
+			fixed: true,
+			scrollbar: true,
+			maxmin: true,
+			content: 'add_change.html',
+			end: function () {
+				table.reload(funcName);
+			}
+		});
+	});
+});

+ 331 - 0
forstpages/enterprise/addFirmUser.html

@@ -0,0 +1,331 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: 100% !important;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+	</style>
+	<script type="text/html" id="typeHtmlTpl">
+		<option value="">请选择</option>
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+		<option value="{{item.guid}}">{{item.roleName}}</option>
+		{{# }); }}
+	</script>
+</head>
+
+<body>
+	<form class="layui-form" action="" lay-filter="addForm" style="padding: 20px 20px 0 0">
+		<div class="layui-form-item">
+			<label class="layui-form-label">企业名称</label>
+			<div class="layui-input-block">
+				<input type="hidden" name="fkOrgGuid">
+				<input type="text" name="orgName" class="layui-input layui-disabled" disabled="disabled">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">账号</label>
+			<div class="layui-input-block">
+				<input type="text" name="account" maxlength="32" lay-verify="required|nickname" placeholder="请输入账号"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">角色</label>
+			<div class="layui-input-block">
+				<select name="roleId" lay-verify="required" lay-filter="roles" id="rolesView"></select>
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<div class="layui-inline" id="nameBox">
+				<label class="layui-form-label">姓名</label>
+				<div class="layui-input-inline" style="width: 300px;">
+					<input type="text" name="userName" maxlength="10" placeholder="请输入姓名" autocomplete="off" class="layui-input">
+				</div>
+			</div>
+			<div class="layui-inline">
+				<label class="layui-form-label">手机号码</label>
+				<div class="layui-input-block">
+					<input type="text" name="mobileNo" lay-verify="phoneNumber" placeholder="请输入手机号码" maxLength="11"
+						autocomplete="off" class="layui-input">
+				</div>
+			</div>
+		</div>
+		<div class="layui-form-item" id="whetherPassword">
+			<label class="layui-form-label ui-required">登录密码</label>
+			<div class="layui-input-block">
+				<input type="password" id="L_pass" name="passwd" maxlength="32" lay-verify="password" placeholder="请输入密码"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item" id="whetherPassword1">
+			<label class="layui-form-label ui-required">确认密码</label>
+			<div class="layui-input-block">
+				<input type="password" lay-verify="resspaword" maxlength="32" placeholder="请再次输入密码" autocomplete="off"
+					class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item layui-layer-btn">
+			<div class="layui-input-block">
+				<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">取消</button>
+				<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+			</div>
+		</div>
+	</form>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(["form", 'layer', 'laytpl', 'jquery'], function () {
+			var form = layui.form,
+				layer = layui.layer,
+				laytpl = layui.laytpl,
+				$ = layui.jquery;
+			var funcName = "user";
+			form.val('addForm', location.searchObj());
+			var formData = {
+				guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
+				roleTableDataId: "roleDataList", //数据ID
+				current: {}, //当前表单数据
+				roleListPort: "roleList", //角色数据接口
+				select_data: "select_" + funcName, //查询用户
+				save_data: 'add_org_user', //保存用户
+				roleSelectView: "#rolesView", //角色列表下拉容器
+				formLayFilter: "addForm", //表单容器
+				closeModal: function () { //关闭当前窗口
+					parent.layer.close(parent.layer.getFrameIndex(window.name));
+				}
+			};
+			//类型下拉列表模板
+			function typeTpl(obj) {
+				laytpl(typeHtmlTpl.innerHTML).render(obj, function (html) {
+					$(obj.elem).html(html);
+					form.render();
+				});
+			}
+
+			//初始化
+			formData.main = function () {
+				var _this = this;
+				if (this.guid) {
+					_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+				} else {
+					_this.initialization();
+
+				}
+				if (location.searchObj().event == "view") {
+					var el = document.getElementsByTagName("INPUT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].readOnly = true;
+					}
+					el = document.getElementsByTagName("SELECT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("checkbox");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("button");
+					for (var i = 0; i < el.length; i++) {
+						if (el[i].innerText.replace(" ", "") == "保存") {
+							el[i].style.display = "none";
+						}
+					}
+				}
+				return this;
+			};
+
+			//初始化
+			formData.initialization = function () {
+				var _this = this;
+				//初始化地区
+				//初始化角色权限下拉
+				$.ajax({
+					url: this.roleListPort,
+					method: 'post',
+					contentType: "application/json",
+					data: JSON.stringify({}),
+					success: function (res) {
+						typeTpl({
+							elem: "#rolesView",
+							list: res.data
+						});
+						form.val(_this.formLayFilter, _this.current);
+					}
+				});
+				//监听提交
+				form.on('submit(formDemo)', function (obj) {
+					//必须return false;
+					return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+				});
+				//关闭窗口
+				$("#closeWin").on("click", function () {
+					_this.closeModal();
+				});
+				return _this;
+			};
+			//获取当前信息
+			formData.getCurrent = function (id) {
+				var _this = this;
+				$.ajax({
+					url: this.select_data,
+					method: 'get',
+					data: {
+						guid: id || this.guid //当前ID
+					},
+					success: function (res) {
+						_this.current = res.data[0];
+						_this.initialization().formVal();
+					}
+				});
+				return _this;
+			};
+			//表单赋值
+			formData.formVal = function () {
+				var _this = this;
+				form.val(this.formLayFilter, this.current);
+				return this;
+			};
+			//合并表单内容
+			formData.fusionData = function (obj) {
+				this.current = $.extend(this.current, obj);
+				if (this.current.guid) {
+					delete this.current.password;
+				}
+				return this;
+			};
+			//提交新增修改
+			formData.submitInfo = function () {
+				var _this = this;
+				$.ajax({
+					type: 'POST',
+					url: this.save_data,
+					data: JSON.stringify(this.current),
+					contentType: 'application/json',
+					success: function (res) {
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							_this.closeModal();
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+				return false;
+			};
+			formData.main();
+			//验证规则
+			form.verify({
+				nickname: function (value) {
+					if (!new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$").test(value)) {
+						return '账号必须以英文字母开头,只能包含英文字母、数字、下划线';
+					}
+					if (/(^\_)|(\__)|(\_+$)/.test(value)) {
+						return '账号首尾不能出现下划线\'_\'';
+					}
+				},
+				checkName: function (value) {
+				},
+				phoneNumber: function (value) {
+					if (value) {
+						if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+							return '请输入正确的手机号码';
+						}
+					}
+					return false;
+				},
+				password: function (value) {
+					if (location.searchObj().guid) {
+						if (value) {
+							if (!(/^[\S]{6,12}$/).test(value)) {
+								return '密码必须6到12位,且不能出现空格';
+							}
+						}
+						return false;
+					}
+					if (!(/^[\S]{6,12}$/).test(value)) {
+						return '密码必须6到12位,且不能出现空格';
+					}
+				},
+				resspaword: function (value) {
+					var pass = $('#L_pass').val();
+					if (value != pass) {
+						return '两次密码不一致';
+					}
+				},
+				ageLength: [
+					/^[0-9]{0,2}$/,
+					'年龄必须0到2位,且只能是数字'
+				],
+				jobLength: [
+					/^[a-z\A-Z\u4e00-\u9fa5_]{0,10}$/,
+					'职务必须是0-10位,且不包含特殊字符与数字'
+				],
+				workUnit: [
+					/^[0-9\a-z\A-Z\u4e00-\u9fa5_]{0,25}$/,
+					'工作单位必须是0-25位,且不包含特殊字符'
+				],
+				vcode: [
+					/^[\w]{4,5}$/,
+					'验证码不符合规则'
+				]
+			});
+		});
+	</script>
+</body>
+
+</html>

+ 475 - 0
forstpages/enterprise/add_change.html

@@ -0,0 +1,475 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: 100% !important;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+
+		.my-middle {
+			line-height: 36px;
+
+		}
+
+		.my-button {
+			width: 60%;
+			margin-left: 20%;
+			height: 40px;
+			text-align: center;
+			line-height: 40px;
+			border: 1px dashed;
+			border-radius: 5px;
+		}
+
+		.my-inline {
+			display: inline-block;
+			float: left;
+			text-align: center;
+			height: 38px;
+			line-height: 38px;
+			width: 10%;
+		}
+
+		.my-images-inline {
+			display: inline-block;
+			width: 104px;
+			height: 104px;
+			border: 1px dashed;
+			border-radius: 5px;
+			padding: 4px;
+			vertical-align: top;
+			margin: 4px;
+		}
+
+		.my-img {
+			width: 100%;
+			height: 100%;
+		}
+
+		.my-images-add {
+			display: inline-block;
+			text-align: center;
+			line-height: 103px;
+			font-size: 32px;
+			cursor: pointer;
+			background-color: #fbfbfb;
+		}
+
+		.my-del {
+			background-color: black;
+			color: white;
+		}
+
+		.button-delImage.button-delAssayImage {
+			position: relative;
+			left: -2px;
+			top: -106px;
+		}
+	</style>
+	<script type="text/html" id="typeHtmlTpl">
+		<option value="">请选择</option>
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+		<option value="{{item.guid}}">{{item.roleName}}</option>
+		{{# }); }}
+	</script>
+</head>
+
+<body>
+	<form class="layui-form" action="" lay-filter="addForm" style="padding: 20px 20px 0 0">
+		<div class="layui-form-item">
+			<div class="layui-inline">
+				<label class="layui-form-label ui-required">企业代码</label>
+				<div class="layui-input-block">
+					<input type="text" id="ID_orgCode" name="orgCode" lay-verify="mustNumber6" placeholder="请输入企业代码"
+						autocomplete="off" class="layui-input">
+				</div>
+			</div>
+
+			<div class="layui-inline">
+				<label class="layui-form-label">企业简码</label>
+				<div class="layui-input-block">
+					<input type="text" id='ID_orgBrevity' name="orgBrevity" placeholder="请输入企业简码" lay-verify="mustNumber3"
+						autocomplete="off" class="layui-input">
+				</div>
+			</div>
+			<script type="text/javascript">
+				(function () {
+					let a = document.querySelector('#ID_orgCode');
+					let b = document.querySelector('#ID_orgBrevity');
+					a.onchange = function () {
+						b.value = (this.value + '').substr(-3);
+					}
+				})();
+			</script>
+		</div>
+
+		<!-- <div class="layui-form-item">
+			<label class="layui-form-label">企业公众号二维码</label>
+			<div class="layui-input-block">
+				<div id="imageListDiv" style="display: flex;"></div>
+				<div class="layui-form-mid layui-word-aux">图片视频上传完毕后请记得按保存哦</div>
+			</div>
+			<script type="text/html" id="imageHtmlTpl">
+				<div class="layui-form-item">
+					{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+					<div class="my-images-inline">
+						{{#if ("jpg|jpeg|png|gif|bmp".indexOf(item.substring(item.lastIndexOf(".")+1))==-1){}}
+						<video class="my-img" src="{{window.hywa.config.href}}/{{item}}" autoplay loop></video>
+						{{#}else{}}
+						<img class="my-img" src="{{window.hywa.config.href}}/{{item}}">
+						{{#} }}
+						<i class="layui-icon my-del button-delImage" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
+					</div>
+					{{# }); }}
+					<div class="my-images-inline my-images-add" id="imageUploadBtn">+</div>
+				</div>
+			</script>
+		</div> -->
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">企业名称</label>
+			<div class="layui-input-block">
+				<input type="text" name="orgName" maxlength="50" lay-verify="required|normal" placeholder="请输入企业名称"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<!-- <div class="layui-form-item">
+			<div class="layui-inline">
+				<label class="layui-form-label ui-required">联系人</label>
+				<div class="layui-input-block">
+					<input type="text" name="principals" lay-verify="required|normal" placeholder="请输入联系人姓名" maxLength="5" autocomplete="off" class="layui-input">
+				</div>
+			</div>
+			<div class="layui-inline">
+				<label class="layui-form-label ui-required">联系电话</label>
+				<div class="layui-input-block">
+					<input type="text" name="tel" lay-verify="required|normal" placeholder="请输入联系电话" maxLength="18" autocomplete="off" class="layui-input">
+				</div>
+			</div>
+			<div class="layui-inline">
+				<label class="layui-form-label">qq</label>
+				<div class="layui-input-block">
+					<input type="text" name="qqCode" lay-verify="" placeholder="请输入qq号" maxLength="18" autocomplete="off" class="layui-input">
+				</div>
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label">企业官网</label>
+			<div class="layui-input-block">
+				<input type="text" name="companyUrl" placeholder="请输入企业官网" maxLength="100" autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label">企业地址</label>
+			<div class="layui-input-block">
+				<input type="text" name="orgAddress" placeholder="请输入企业地址" maxLength="100" autocomplete="off"
+					   class="layui-input">
+			</div>
+		</div>-->
+		<div class="layui-form-item">
+			<label class="layui-form-label">二维码网址</label>
+			<div class="layui-input-block">
+				<input type="text" name="qrcodeUrlPrefixe" placeholder="请输入二维码网址" maxLength="100" autocomplete="off"
+					class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">系统名称</label>
+			<div class="layui-input-block">
+				<input type="text" name="systemName" maxlength="50" lay-verify="required|normal" placeholder="请输入系统名称"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">溯源模版</label>
+			<div class="layui-input-block">
+				<select name="templeType" lay-verify="required|normal">
+					<option value=""></option>
+					<option value="0">标准模板</option>
+					<option value="1">大米模板</option>
+					<option value="2">林产品模板</option>
+				</select>
+			</div>
+		</div>
+		<!-- <div class="layui-form-item">
+			<label class="layui-form-label">备注</label>
+			<div class="layui-input-block">
+				<input type="text" name="remark" placeholder="请输入备注" maxLength="500" autocomplete="off"
+					   class="layui-input">
+			</div>
+		</div> -->
+		<div class="layui-form-item layui-layer-btn">
+			<div class="layui-input-block">
+				<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">取消</button>
+				<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+			</div>
+		</div>
+	</form>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(["form", 'layer', 'jquery', 'laytpl', 'upload'], function () {
+			var form = layui.form,
+				layer = layui.layer,
+				$ = layui.jquery,
+				laytpl = layui.laytpl,
+				upload = layui.upload;
+			var funcName = "org";
+			var formData = {
+				guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
+				current: {}, //当前表单数据
+				select_data: "select_" + funcName, //查询企业
+				save_data: (location.searchObj().guid ? 'edit' : 'add') + '_' + funcName, //查询企业
+				formLayFilter: "addForm", //表单容器
+				closeModal: function () { //关闭当前窗口
+					parent.layer.close(parent.layer.getFrameIndex(window.name));
+				}
+			};
+			var option = {
+				elem: '#imageUploadBtn',
+				url: 'uploadImage',
+				accept: "file",
+				exts: "jpg|jpeg|png|gif|bmp|mp4|ogg|webm|avi|wma|rmvb|rm|flash|3gp|flv|mp3",
+				size: 10240,//kb
+				before: function () {
+					uploadMsg = layer.msg('正在上传中……', {
+						icon: 16,
+						fixed: false,
+						time: 0
+					});
+				},
+				done: function (res) {
+					layer.close(uploadMsg);
+					formData.current.wxQRImg = res.data[0];
+					imageTpl({
+						elem: "#imageListDiv",
+						list: [formData.current.wxQRImg]
+					});
+				},
+				error: function () {
+				}
+			};
+			//图片列表模板
+			function imageTpl(obj) {
+				laytpl(imageHtmlTpl.innerHTML).render(obj, function (html) {
+					$(obj.elem).html(html);
+					upload.render(option);
+					$(".button-delImage").on("click", function (e) {
+						formData.current.wxQRImg = "";
+						imageTpl({
+							elem: "#imageListDiv",
+							list: []
+						});
+					});
+				});
+			}
+			//初始化
+			formData.main = function () {
+				var _this = this;
+				if (this.guid) {
+					_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+				} else {
+					_this.initialization();
+
+				}
+				if (location.searchObj().event == "view") {
+					var el = document.getElementsByTagName("INPUT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].readOnly = true;
+					}
+					el = document.getElementsByTagName("SELECT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("checkbox");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("button");
+					for (var i = 0; i < el.length; i++) {
+						0
+						if (el[i].innerText.replace(" ", "") == "保存") {
+							el[i].style.display = "none";
+						}
+					}
+				}
+				return this;
+			};
+
+			//初始化
+			formData.initialization = function () {
+				var _this = this;
+				// 				imageTpl({
+				// 				    elem: "#imageListDiv",
+				// 				    list: _this.current.wxQRImg?[_this.current.wxQRImg]:[]
+				// 				});
+				//监听提交
+				form.on('submit(formDemo)', function (obj) {
+					//必须return false;
+					return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+				});
+				//关闭窗口
+				$("#closeWin").on("click", function () {
+					_this.closeModal();
+				});
+				return _this;
+			};
+			//获取当前信息
+			formData.getCurrent = function (id) {
+				var _this = this;
+				$.ajax({
+					url: this.select_data,
+					method: 'get',
+					data: {
+						guid: id || this.guid //当前ID
+					},
+					success: function (res) {
+						_this.current = res.data[0];
+						_this.initialization().formVal();
+					}
+				});
+				return _this;
+			};
+			//表单赋值
+			formData.formVal = function () {
+				var _this = this;
+				form.val(this.formLayFilter, this.current);
+				return this;
+			};
+			//合并表单内容
+			formData.fusionData = function (obj) {
+				this.current = $.extend(this.current, obj);
+				if (this.current.guid) {
+					delete this.current.password;
+				}
+				return this;
+			};
+			//提交新增修改
+			formData.submitInfo = function () {
+				var _this = this;
+				$.ajax({
+					type: 'POST',
+					url: this.save_data,//+'?userId='+this.guid
+					data: JSON.stringify(this.current),
+					contentType: 'application/json',
+					success: function (res) {
+
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							_this.closeModal();
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+				return false;
+			};
+			formData.main();
+			//验证规则
+			form.verify({
+				phoneNumber: function (value) {
+					if (value) {
+						if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+							return '请输入正确的手机号码';
+						}
+					}
+					return false;
+				},
+				mustNumber6: [
+					/^[0-9]{6}$/,
+					"必须是数字6位"
+				],
+				mustNumber3: [
+					/^[0-9]{3}$/,
+					"必须是数字3位"
+				],
+				normal: function () {
+					return false;
+				}
+			});
+		});
+	</script>
+</body>
+
+</html>

+ 151 - 0
forstpages/enterprise/auth.html

@@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html lang="en" style="background-color: #f2f2f2;">
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../layui/css/eleTree.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/systemTree.css" />
+	<link rel="stylesheet" type="text/css" href="../../iconfont/iconfont.css" />
+	<style>
+		.role-forbid {
+			margin-left: 15px;
+		}
+
+		.role-forbid i {
+			font-size: 16px;
+			color: red;
+			font-weight: bold
+		}
+	</style>
+
+</head>
+
+<body class="main-container">
+	<div class="layui-fluid">
+		<div class="layui-row layui-col-space1">
+			<div class="layui-col-xs12 layui-col-sm12 layui-col-md7">
+				<div class="system layui-card">
+					<div class="layui-card-body">
+						<div class="eleTree" id="menuTree" lay-filter="menuTree"></div>
+
+					</div>
+
+				</div>
+
+				<div class="layui-form-item layui-layer-btn">
+					<div class="layui-input-block">
+						<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">取消</button>
+						<button class="layui-btn" id="saveData">保存</button>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script>
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(['form', 'jquery', 'eleTree'], function () {
+			var form = layui.form,
+				$ = layui.jquery,
+				eleTree = layui.eleTree;
+			var treeObj, oData = [];
+			//保存权限
+			$('#saveData').on("click", function (obj) {
+				var checkedData = treeObj.getChecked(false, true);//获取已选节点(只取叶子节点,选取半选节点)
+				var postData = { guid: guid, menuList: [] };
+				for (var j = 0; j < oData.length; j++) {
+					oData[j].subMenuList = null;
+				}
+				for (var i = 0; i < checkedData.length; i++) {
+					for (var j = 0; j < oData.length; j++) {
+						if (checkedData[i].id == oData[j].id) {
+							postData.menuList.push(oData[j]);
+							break;
+						}
+					}
+				}
+				$.ajax({
+					type: 'POST',
+					url: "org_saveAuth",
+					data: JSON.stringify(postData),
+					contentType: 'application/json',
+					success: function (res) {
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							parent.layer.close(parent.layer.getFrameIndex(window.name));
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+			});
+			//关闭窗口
+			$("#closeWin").on("click", function () {
+				parent.layer.close(parent.layer.getFrameIndex(window.name));
+			});
+			var guid = location.searchObj().guid;
+			$.ajax({
+				type: "get",
+				url: 'org_getAuth?orgGuid=' + guid,
+				success: function (data) {
+					if (data.code === 0) {
+						var menuData = [];
+						(function setMenuData(submenu, obj) {//组装tree需要的数据
+							for (var i = 0; i < submenu.length; i++) {
+								oData.push(submenu[i]);
+								//判定是否是父节点 父节点没有checked属性
+								let pan = submenu[i].subMenuList && submenu[i].subMenuList.length > 0;
+								obj.push({
+									id: submenu[i].id,
+									label: submenu[i].funName,
+									spread: true,
+									checked: !pan && submenu[i].isChecked == 1
+								});
+								if (pan) {
+									obj[i].children = [];
+									setMenuData(submenu[i].subMenuList, obj[i].children);
+								}
+							}
+						})(data.data, menuData);
+						treeObj = eleTree.render({
+							elem: '#menuTree',
+							data: menuData,
+							showCheckbox: true,
+							defaultExpandAll: true,
+							expandOnClickNode: false
+						});
+					} else {
+						parent.layer.msg(res.msg, {
+							icon: 1
+						});
+					}
+				}
+			});
+			form.render();
+		});
+	</script>
+</body>
+
+</html>

+ 102 - 0
forstpages/enterprise/index.html

@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<!--类型下拉模板-->
+	<script type="text/html" id="typeHtmlTpl">
+			<option value="">请选择</option>
+        {{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+        <option value="{{item.guid}}">{{item.roleName}}</option>
+        {{# }); }}
+    </script>
+	<!--操作模板-->
+	<script type="text/html" id="operatingTool">
+			<a class="layui-btn layui-btn-xs disauth-btn-0" lay-event="disauth">授权</a>
+        <a class="layui-btn layui-btn-xs view-btn-0" lay-event="view">查看</a>
+        <a class="layui-btn layui-btn-xs edit-btn-0" lay-event="edit">修改</a>
+        <a class="layui-btn layui-btn-danger layui-btn-xs del-btn-0" lay-event="del">删除</a>
+    </script>
+	<script type="text/html" id="checkboxTpl">
+			<!-- 这里的 checked 的状态只是演示 -->
+	<input type="checkbox" name="isForbid" id="{{d.guid}}" value="{{d.isForbid}}" title="可用" lay-filter="statusDemo"
+		{{ d.isForbid == 0 ? 'checked' : '' }}>
+	</script>
+</head>
+
+<body class="childrenBody">
+	<div class="layui-fluid">
+		<div class="layui-row layui-col-space15">
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">企业管理</div>
+					<div class="layui-card-body">
+						<form class="layui-form" action="" novalidate>
+							<div class="searching">
+								<div style="flex: 7;" class="search-box">
+									<i class="layui-icon layui-icon-search"></i>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="orgCode" autocomplete="off" type="text"
+											placeholder="请输入企业代码" />
+									</div>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="orgName" autocomplete="off" type="text"
+											placeholder="请输入企业名称" />
+									</div>
+								</div>
+								<div style="padding-left: 5px;">
+									<button class="layui-btn layui-btn-normal" lay-submit lay-filter="DataSearch"
+										layId="DataTable">搜索</button>
+								</div>
+							</div>
+						</form>
+					</div>
+				</div>
+			</div>
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">
+						企业列表
+						<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;"
+							id="addBtn" layId="addBtn">新增企业</div>
+						<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;"
+							id="addBtnUser" layId="addBtnUser">新增管理用户</div>
+					</div>
+					<div class="layui-card-body">
+						<div class="layui-form news_list">
+							<table id="DataTable" lay-filter="DataTable" class="layui-table" lay-even lay-skin="nob"></table>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		var SYS_VER = location.href.substring(location.href.indexOf("ver=") + 4, location.href.indexOf("ver=") + 7);
+
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + SYS_VER + "'><\/script>")
+		}
+		loadJS("../../js/config.js");
+		loadJS("index.js");
+	</script>
+</body>
+
+</html>

+ 185 - 0
forstpages/enterprise/index.js

@@ -0,0 +1,185 @@
+;
+layui.config({
+	base: "../../js/layuiPlugins/"
+}).use(['form', 'layer', 'jquery', 'table', 'laytpl'], function () {
+	var form = layui.form,
+		layer = layui.layer,
+		$ = layui.jquery,
+		table = layui.table;
+	var funcName = "org";
+	form.verify({
+		namelength: [
+			/^.{0,12}$/,
+			"长度限制在0-12个字符噢"
+		]
+	});
+	//工具条处理
+	function toolOperating(obj) {
+		var data = obj.data;
+		if (obj.event === 'del') {
+			layer.confirm('真的删除吗?', function (index) {
+				layer.close(index);
+				var index1 = layer.msg('删除中,请稍候', {
+					icon: 16,
+					time: false,
+					shade: 0.8
+				});
+				$.ajax({
+					type: "get",
+					url: 'delete_' + funcName + '?guid=' + obj.data.guid,
+					success: function (res) {
+						layer.close(index1);
+						if (!(res.code - 0)) {
+							obj.del();
+							table.reload(funcName);
+						}
+					}
+				});
+			});
+		} else if (obj.event === 'edit') { //修改
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "修改",
+				area: ['800px', '470px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=edit&guid=' + data.guid,
+				end: function () {
+					table.reload(funcName); //重新载入表格
+				}
+			});
+		} else if (obj.event === 'view') { //查看
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "查看",
+				area: ['800px', '470px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=view&guid=' + data.guid,
+				end: function () { }
+			});
+		} else if (obj.event === 'disauth') { //授权
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "功能授权",
+				area: ['500px', '520px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'auth.html?guid=' + data.guid,
+				end: function () { }
+			});
+		}
+	}
+
+	//列表
+	var DataList = {
+		id: funcName,
+		elem: '#DataTable',
+		url: funcName + 'List',
+		page: true,
+		method: "post",
+		contentType: 'application/json',
+		loading: true,
+		cellMinWidth: 80,
+		cols: [
+			[{
+				title: '选择',
+				type: 'radio'
+			}, {
+				field: 'orgCode',
+				title: '企业代码',
+				align: 'left',
+			}, {
+				field: 'orgName',
+				title: '企业名称',
+				align: 'left',
+			}, {
+				field: 'principals',
+				title: '法人',
+				align: 'left',
+			}, {
+				field: 'tel',
+				title: '电话号码',
+				align: 'center'
+			}, {
+				field: 'orgAddress',
+				title: '地址',
+				align: 'center'
+			}, {
+				field: 'operating',
+				title: '操作',
+				toolbar: '#operatingTool',
+				align: 'center',
+				fixed: 'right',
+				width: 240
+			}]
+		] //设置表头
+		,
+		done: function (res) {
+			resetButton(layui.sessionData(window.hywa.sessionTable.tableName).userData.menus.subMenuList, $);
+		}
+	};
+
+	//执行默认渲染表格
+	table.render(DataList);
+
+	//监听产品工具事件条
+	table.on('tool(DataTable)', function (obj) {
+		toolOperating(obj);
+	});
+	//搜索响应函数
+	var infoSearch = function (obj) {
+		table.reload(funcName, { //执行重载
+			where: obj.field
+		});
+		return false;
+	};
+	//监听搜索表单事件
+	form.on("submit(DataSearch)", infoSearch);
+
+	$("#addBtn").on("click", function () {
+		layer.open({
+			type: 2,
+			anim: 0,
+			title: "新增",
+			area: ['800px', '470px'],
+			fixed: true,
+			scrollbar: true,
+			maxmin: true,
+			content: 'add_change.html',
+			end: function () {
+				table.reload(funcName);
+			}
+		});
+	});
+	//新增管理用户
+	$("#addBtnUser").on("click", function () {
+		var checkStatus = table.checkStatus(funcName); //idTest 即为基础参数 id 对应的值
+		if (checkStatus.data.length) {
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "新增",
+				area: ['800px', '470px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'addFirmUser.html?fkOrgGuid=' + checkStatus.data[0].guid + '&orgName=' + checkStatus.data[0].orgName,
+				end: function () {
+					table.reload(funcName);
+				}
+			});
+		} else {
+			layer.msg('必须选择一个企业进行新增操作', {
+				time: 4000,
+				icon: 2
+			});
+		}
+	});
+});

+ 134 - 0
forstpages/index.html

@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<html style="background-color: #f2f2f2;">
+
+<head>
+	<meta charset="utf-8">
+	<title>林产品溯源管理系统</title>
+	<meta name="renderer" content="webkit">
+	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+	<meta http-equiv="Access-Control-Allow-Origin" content="*">
+	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="icon" href="favicon.ico">
+	<link rel="stylesheet" href="../layui/css/layui.css" media="all" />
+	<link rel="stylesheet" href="../forstcss/font_eolqem241z66flxr.css" media="all" />
+	<link rel="stylesheet" href="../forstcss/main.css" media="all" />
+	<link rel="shortcut icon" type="image/x-icon" href="../images/favicon.ico">
+</head>
+
+<body class="main_body">
+	<div class="layui-layout layui-layout-admin">
+		<!-- 顶部 -->
+		<div class="layui-header header" id="header">
+			<div class="layui-main">
+				<a href="#" class="logo" id="sysLogo"></a>
+				<!-- 顶部右侧菜单 -->
+				<ul class="layui-nav top_menu">
+					<li class="layui-nav-item" mobile>
+						<a href="javascript:;" data-url="../user/changePwd.html">
+							<i class="iconfont icon-shezhi1" data-icon="icon-shezhi1"></i>
+							<cite>修改密码</cite>
+						</a>
+					</li>
+					<li class="layui-nav-item" mobile>
+						<a href="javascript:;" id="dropOut1">
+							<i class="iconfont icon-loginout"></i> 退出</a>
+					</li>
+					<li class="layui-nav-item" pc>
+						<a href="javascript:;">
+							<img src="../images/face.jpg" class="layui-circle" width="35" height="35">
+							<cite id="userName"></cite>
+						</a>
+						<dl class="layui-nav-child">
+							<dd>
+								<a href="javascript:;" data-url="../user/userInfo.html">
+									<i class="iconfont icon-zhanghu" data-icon="icon-zhanghu"></i>
+									<cite>个人资料</cite>
+								</a>
+							</dd>
+							<dd>
+								<a href="javascript:;" data-url="../user/changePwd.html">
+									<i class="iconfont icon-shezhi1" data-icon="icon-shezhi1"></i>
+									<cite>修改密码</cite>
+								</a>
+							</dd>
+							<dd>
+								<a href="javascript:;" id="dropOut">
+									<i class="iconfont icon-loginout"></i>
+									<cite>退出</cite>
+								</a>
+							</dd>
+						</dl>
+					</li>
+				</ul>
+			</div>
+		</div>
+		<!-- 左侧导航 -->
+		<div class="layui-side layui-side-menu" id="leftNav">
+			<div class="navBar layui-side-scroll"></div>
+		</div>
+		<div class="layui-body layui-form">
+			<div class="layui-tab marg0 layadmin-pagetabs" lay-filter="bodyTab">
+				<ul class="layui-tab-title top_tab">
+					<li class="layui-this" lay-id="">
+						<i class="layui-icon layui-icon-home"></i>
+						<cite>首页</cite>
+					</li>
+				</ul>
+				<div class="layui-tab-content clildFrame">
+					<div class="layui-tab-item layui-show">
+						<iframe id="homeIframe"></iframe>
+						<!-- <iframe src="http://192.168.1.35:8080" allowFullScreen></iframe> -->
+					</div>
+				</div>
+			</div>
+		</div>
+		<!-- 底部 -->
+		<div class="layui-footer footer">
+			<p>Copyright © 2020-present 技术支持
+				<a href="javascript:void(0);">www.gz-xtd.com 信通达智能科技有限公司</a>
+			</p>
+		</div>
+	</div>
+
+	<!-- 锁屏 -->
+	<div class="admin-header-lock" id="lock-box" style="display: none;">
+		<div class="admin-header-lock-img">
+			<img src="../images/face.jpg" />
+		</div>
+		<div class="admin-header-lock-name" id="lockUserName">匿名用户</div>
+		<div class="input_btn">
+			<input type="password" class="admin-header-lock-input layui-input" placeholder="请输入密码解锁.." name="lockPwd"
+				id="lockPwd" />
+			<button class="layui-btn" id="unlock">解锁</button>
+		</div>
+		<p>请输入“123456”,否则不会解锁成功哦!!!</p>
+	</div>
+	<!-- 移动导航 -->
+	<div class="site-tree-mobile layui-hide">
+		<i class="layui-icon">&#xe602;</i>
+	</div>
+	<div class="site-mobile-shade"></div>
+
+	<script type="text/javascript" src="../layui/layui.js"></script>
+	<script src="../js/ajaxhook.min.js" type="text/javascript" charset="utf-8"></script>
+	<script type="text/javascript">
+		document.getElementById("homeIframe").src = "analyze/index.html?v=" + new Date().getTime();
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../js/config.js");
+		loadJS("../js/leftNav.js");
+		loadJS("js/index.js");
+	</script>
+	<script>
+		if (JSON.stringify(layui.sessionData(window.hywa.sessionTable.tableName)) == '{}') {
+			layui.sessionData(window.hywa.sessionTable.tableName, null);
+			top.location.href = window.hywa.jumpPage.login;
+		}
+	</script>
+</body>
+
+</html>

+ 219 - 0
forstpages/js/bodyTab.js

@@ -0,0 +1,219 @@
+/*
+ @Author: 请叫我马哥
+ @Time: 2017-04
+ @Tittle: tab
+ @Description: 点击对应按钮添加新窗口
+ */
+var tabFilter, menu = [],
+	liIndex, curNav, delMenu;
+layui.define(["element", "jquery"], function (exports) {
+	var element = layui.element,
+		$ = layui.jquery,
+		layId,
+		Tab = function () {
+			this.tabConfig = {
+				closed: true,
+				openTabNum: 100,
+				tabFilter: "bodyTab"
+			}
+		};
+	var _this = this;
+	var navs = layui.sessionData(window.hywa.sessionTable.tableName).userData.menus.subMenuList;
+	//显示左侧菜单
+	if ($(".navBar").html() == '') {
+		$(".navBar").html(navBar(navs)).height($(window).height() - 60);
+		$('.navBar li').find('cite').each(function () {
+			if ($(this).text() == '系统维护') {
+				$(this).parents('li').addClass('layui-this')
+			}
+		});
+		element.init(); //初始化页面元素
+		$(window).resize(function () {
+			$(".navBar").height($(window).height() - 60);
+		})
+	}
+	// console.log('地址', location.href.replace(/[^\/]+$/, ''))
+	// let href = location.href.replace(/[^\/]+$/, '')
+	// $.ajax({
+	//     url: href+'js/json/menu.json',
+	//     data: {
+	//         requestMode: 0
+	//     },
+	//     async: false,
+	//     success: function (res) {
+	//
+	//         //layer.closeAll('loading'); //关闭加载层
+	//         if (!(res.retHead.errCode - 0)) {
+	//             navs = res.retBody.list;
+	//             if (!navs) {
+	//                 return;
+	//             }
+	//             //显示左侧菜单
+	//             if ($(".navBar").html() == '') {
+	//                 $(".navBar").html(navBar(navs)).height($(window).height() - 60);
+	//                 $('.layui-nav-tree li:first-child').addClass('layui-this')
+	//                 element.init(); //初始化页面元素
+	//                 $(window).resize(function () {
+	//                     $(".navBar").height($(window).height() - 60);
+	//                 })
+	//             }
+	//         } else if ((res.retHead.errCode - 0) == 1004) {
+	//             top.location.href = window.hywa.jumpPage.login;
+	//         }
+	//     }
+	// });
+
+	//显示左侧菜单
+	// 	if ($(".navBar").html() == '') {
+	// 		$(".navBar").html(navBar(navs)).height($(window).height() - 230);
+	// 		element.init(); //初始化页面元素
+	// 		$(window).resize(function () {
+	// 			$(".navBar").height($(window).height() - 230);
+	// 		})
+	// 	}
+
+	//参数设置
+	Tab.prototype.set = function (option) {
+		var _this = this;
+		$.extend(true, _this.tabConfig, option);
+		return _this;
+	};
+
+	//通过title获取lay-id
+	Tab.prototype.getLayId = function (title) {
+		$(".layui-tab-title.top_tab li").each(function () {
+			if ($(this).find("cite").text() == title) {
+				layId = $(this).attr("lay-id");
+			}
+		})
+		return layId;
+	}
+	//通过title判断tab是否存在
+	Tab.prototype.hasTab = function (title) {
+		var tabIndex = -1;
+		$(".layui-tab-title.top_tab li").each(function () {
+			if ($(this).find("cite").text() == title) {
+				tabIndex = 1;
+			}
+		})
+		return tabIndex;
+	}
+
+	//右侧内容tab操作
+	var tabIdIndex = 0;
+	Tab.prototype.tabAdd = function (_this) {
+		if (window.sessionStorage.getItem("menu")) {
+			menu = JSON.parse(window.sessionStorage.getItem("menu"));
+		}
+		var that = this;
+		var closed = that.tabConfig.closed,
+			openTabNum = that.tabConfig.openTabNum;
+		tabFilter = that.tabConfig.tabFilter;
+		// $(".layui-nav .layui-nav-item a").on("click",function(){
+		if (_this.find("i.iconfont,i.layui-icon").attr("data-icon") != undefined) {
+			var title = '';
+			if (that.hasTab(_this.find("cite").text()) == -1 && _this.siblings("dl.layui-nav-child").length ==
+				0) {
+				if ($(".layui-tab-title.top_tab li").length == openTabNum) {
+					layer.msg('只能同时打开' + openTabNum + '个选项卡哦。不然系统会卡的!');
+					return;
+				}
+				tabIdIndex++;
+				// if (_this.find("i.iconfont").attr("data-icon") != undefined) {
+				//     title += '<i class="iconfont ' + _this.find("i.iconfont").attr("data-icon") + '"></i>';
+				// } else {
+				//     title += '<i class="layui-icon">' + _this.find("i.layui-icon").attr("data-icon") +
+				//         '</i>';
+				// }
+				title += '<cite>' + _this.find("cite").text() + '</cite>';
+				title += '<i class="layui-icon layui-unselect layui-tab-close" data-id="' + tabIdIndex +
+					'">&#x1006;</i>';
+				element.tabAdd(tabFilter, {
+					title: title,
+					content: "<iframe src='" + _this.attr("data-url") + "' data-id='" + tabIdIndex +
+						"'></frame>",
+					id: new Date().getTime()
+				})
+
+				//当前窗口内容
+				var curmenu = {
+					"icon": _this.find("i.iconfont").attr("data-icon") != undefined ? _this.find(
+						"i.iconfont").attr("data-icon") : _this.find("i.layui-icon").attr(
+							"data-icon"),
+					"title": _this.find("cite").text(),
+					"href": _this.attr("data-url"),
+					"layId": new Date().getTime()
+				}
+				menu.push(curmenu);
+				window.sessionStorage.setItem("menu", JSON.stringify(menu)); //打开的窗口
+				window.sessionStorage.setItem("curmenu", JSON.stringify(curmenu)); //当前的窗口
+
+				element.tabChange(tabFilter, that.getLayId(_this.find("cite").text()));
+			} else {
+				//当前窗口内容
+				var curmenu = {
+					"icon": _this.find("i.iconfont").attr("data-icon") != undefined ? _this.find(
+						"i.iconfont").attr("data-icon") : _this.find("i.layui-icon").attr(
+							"data-icon"),
+					"title": _this.find("cite").text(),
+					"href": _this.attr("data-url"),
+					"layId": new Date().getTime()
+				}
+				window.sessionStorage.setItem("curmenu", JSON.stringify(curmenu)); //当前的窗口
+				element.tabChange(tabFilter, that.getLayId(_this.find("cite").text()));
+			}
+		}
+		// })
+	}
+	$("body").on("click", ".top_tab li", function () {
+		//切换后获取当前窗口的内容
+		var curmenu = '';
+		var menu = JSON.parse(window.sessionStorage.getItem("menu"));
+		curmenu = menu[$(this).index() - 1];
+		if ($(this).index() == 0) {
+			window.sessionStorage.setItem("curmenu", '');
+		} else {
+			window.sessionStorage.setItem("curmenu", JSON.stringify(curmenu));
+			if (window.sessionStorage.getItem("curmenu") == "undefined") {
+				//如果删除的不是当前选中的tab,则将curmenu设置成当前选中的tab
+				if (curNav != JSON.stringify(delMenu)) {
+					window.sessionStorage.setItem("curmenu", curNav);
+				} else {
+					window.sessionStorage.setItem("curmenu", JSON.stringify(menu[liIndex - 1]));
+				}
+			}
+		}
+		element.tabChange(tabFilter, $(this).attr("lay-id")).init();
+	})
+
+	//删除tab
+	$("body").on("click", ".top_tab li i.layui-tab-close", function () {
+		//删除tab后重置session中的menu和curmenu
+		liIndex = $(this).parent("li").index();
+		var menu = JSON.parse(window.sessionStorage.getItem("menu"));
+		//获取被删除元素
+		delMenu = menu[liIndex - 1];
+		var curmenu = window.sessionStorage.getItem("curmenu") == "undefined" ? "undefined" : window.sessionStorage
+			.getItem("curmenu") == "" ? '' : JSON.parse(window.sessionStorage.getItem("curmenu"));
+		if (JSON.stringify(curmenu) != JSON.stringify(menu[liIndex - 1])) { //如果删除的不是当前选中的tab
+			// window.sessionStorage.setItem("curmenu",JSON.stringify(curmenu));
+			curNav = JSON.stringify(curmenu);
+		} else {
+			if ($(this).parent("li").length > liIndex) {
+				window.sessionStorage.setItem("curmenu", curmenu);
+				curNav = curmenu;
+			} else {
+				window.sessionStorage.setItem("curmenu", JSON.stringify(menu[liIndex - 1]));
+				curNav = JSON.stringify(menu[liIndex - 1]);
+			}
+		}
+		menu.splice((liIndex - 1), 1);
+		window.sessionStorage.setItem("menu", JSON.stringify(menu));
+		element.tabDelete("bodyTab", $(this).parent("li").attr("lay-id")).init();
+	});
+
+	var bodyTab = new Tab();
+	exports("bodyTab", function (option) {
+		return bodyTab.set(option);
+	});
+});

+ 116 - 0
forstpages/js/index.js

@@ -0,0 +1,116 @@
+var $, tab, skyconsWeather;
+
+layui.config({
+	base: "js/"
+}).use(['bodyTab', 'form', 'element', 'layer', 'jquery'], function () {
+	var form = layui.form,
+		layer = layui.layer,
+		element = layui.element;
+	$ = layui.jquery;
+	tab = layui.bodyTab();
+	//用户昵称
+	var userInfo = layui.sessionData(window.hywa.sessionTable.tableName);
+	$('#userName').html(JSON.stringify(userInfo) != '{}' ? userInfo[window.hywa.sessionTable.userData].name :
+		'游客用户');
+
+	//系统名称
+	var sysname = layui.sessionData(window.hywa.sessionTable.tableName);
+	$('#sysLogo').html(sysname.sys != '{}' ? sysname.sys.systemName : '防伪溯源系统');
+	$('title').html(sysname.sys != '{}' ? sysname.sys.systemName : '防伪溯源系统');
+
+	//退出
+	$('#dropOut,#dropOut1').on("click", function () {
+		layer.msg('注销中……', {
+			icon: 6,
+			time: 5000
+		});
+		$.ajax({
+			type: "GET",
+			url: 'loginOut',
+			success: function (res) {
+				debugger;
+				if (0 === res.code) {
+					layui.sessionData(window.hywa.sessionTable.tableName, null);
+					window.sessionStorage.removeItem("menu");
+					var url = location.href;
+					location.href = url.substring(0, url.substring(0, url.lastIndexOf("/")).lastIndexOf("/") + 1);
+				} else {
+
+				}
+			}
+		});
+	});
+	//锁屏
+	function lockPage() {
+		layer.open({
+			title: false,
+			type: 1,
+			content: $("#lock-box"),
+			closeBtn: 0,
+			shade: 0.9
+		})
+	}
+	//     $(".lockcms").on("click", function () {
+	//         window.sessionStorage.setItem("lockcms", true);
+	//         lockPage();
+	//     })
+	// 判断是否显示锁屏
+	//if (window.sessionStorage.getItem("lockcms") == "true") {
+	//    lockPage();
+	//}
+	// 解锁
+	//     $("#unlock").on("click", function () {
+	//         if ($(this).siblings(".admin-header-lock-input").val() == '') {
+	//             layer.msg("请输入解锁密码!");
+	//         } else {
+	//             if ($(this).siblings(".admin-header-lock-input").val() == "123456") {
+	//                 window.sessionStorage.setItem("lockcms", false);
+	//                 $(this).siblings(".admin-header-lock-input").val('');
+	//                 layer.closeAll("page");
+	//             } else {
+	//                 layer.msg("密码错误,请重新输入!");
+	//             }
+	//         }
+	//     });
+	//     $(document).on('keydown', function (event) {
+	//         if (event.keyCode == 13) {
+	//             $("#unlock").click();
+	//         }
+	//     });
+
+	//手机设备的简单适配
+	var treeMobile = $('.site-tree-mobile'),
+		shadeMobile = $('.site-mobile-shade');
+
+	treeMobile.on('click', function () {
+		$('body').addClass('site-mobile');
+	});
+
+	shadeMobile.on('click', function () {
+		$('body').removeClass('site-mobile');
+	});
+
+	// 添加新窗口
+	$(".layui-nav .layui-nav-item a").on("click", function () {
+		addTab($(this));
+		$(this).parent("li").siblings().removeClass("layui-nav-itemed");
+	});
+	//判断是否处于锁屏状态(如果关闭以后则未关闭浏览器之前不再显示)
+	if (window.sessionStorage.getItem("lockcms") != "true" && window.sessionStorage.getItem("showNotice") !=
+		"true") {
+		if (typeof showNotice !== 'undefined') showNotice();
+	}
+	$(".showNotice").on("click", function () {
+		showNotice();
+	})
+
+	//刷新后还原打开的窗口
+	if (window.sessionStorage.getItem("menu") != null) {
+		window.sessionStorage.removeItem("menu");
+	}
+})
+
+//打开新窗口
+function addTab(_this) {
+	tab.tabAdd(_this);
+}

+ 1314 - 0
forstpages/pdinfo/add_change.html

@@ -0,0 +1,1314 @@
+<!DOCTYPE html>
+<html>
+
+	<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">
+		<meta name="apple-mobile-web-app-status-bar-style" content="black">
+		<meta name="apple-mobile-web-app-capable" content="yes">
+		<meta name="format-detection" content="telephone=no">
+		<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+		<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+		<link rel="stylesheet" type="text/css" href="../../forstcss/inputTags.css" />
+		<style type="text/css">
+			.ui-required:before {
+				content: "*";
+				color: red;
+				vertical-align: middle;
+			}
+
+			#roleSelectViwe .layui-form-item {
+				margin-bottom: 0
+			}
+
+			#roleSelectViwe .layui-input-inline {
+				width: calc(100% - 110px);
+				margin-right: 0;
+			}
+
+			.region {
+				padding-left: 10px;
+				height: 38px;
+				line-height: 38px;
+				background-color: #fff;
+				border-radius: 2px;
+				border: 1px solid #e6e6e6;
+				width: calc(100% - 132px) !important;
+			}
+
+			.userTip {
+				color: #666;
+				font-size: 12px;
+			}
+
+			.userTip b {
+				color: #333;
+			}
+
+			.my-middle {
+				line-height: 36px;
+
+			}
+
+			.my-button {
+				width: 60%;
+				margin-left: 20%;
+				height: 40px;
+				text-align: center;
+				line-height: 40px;
+				border: 1px dashed;
+				border-radius: 5px;
+			}
+
+			.my-inline {
+				display: inline-block;
+				float: left;
+				text-align: center;
+				height: 38px;
+				line-height: 38px;
+				width: 10%;
+			}
+
+			.my-images-inline {
+				display: inline-block;
+				width: 104px;
+				height: 104px;
+				border: 1px dashed;
+				border-radius: 5px;
+				padding: 4px;
+				vertical-align: top;
+				margin: 4px;
+			}
+
+			.my-img {
+				width: 100%;
+				height: 100%;
+			}
+
+			.my-images-add {
+				display: inline-block;
+				text-align: center;
+				line-height: 103px;
+				font-size: 32px;
+				cursor: pointer;
+				background-color: #fbfbfb;
+			}
+
+			.my-del {
+				background-color: black;
+				color: white;
+			}
+
+			.button-delImage.button-delAssayImage {
+				position: relative;
+				left: -2px;
+				top: -106px;
+			}
+		</style>
+	</head>
+
+	<body>
+		<form class="layui-form" action="" lay-filter="addForm">
+			<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
+				<ul class="layui-tab-title">
+					<li class="layui-this" lay-id="1">基础信息</li>
+					<li lay-id="2">原料生产</li>
+					<li lay-id="3">加工流通</li>
+					<li lay-id="4">检疫检验</li>
+				</ul>
+				<div class="layui-tab-content">
+					<div class="layui-tab-item layui-show">
+						<div class="layui-form-item">
+							<label class="layui-form-label ui-required">产品分类</label>
+							<div class="layui-input-block my-middle" id="goodsName">
+
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label ui-required">批次编码</label>
+							<div class="layui-input-block">
+								<input type="text" name="goodsBatchNo" lay-verify="required" maxlength="20" placeholder="请输入批次编码" autocomplete="off" class="layui-input">
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label ui-required">产品规格</label>
+							<div class="layui-input-block">
+								<input type="text" name="goodsUnit" lay-verify="required" maxlength="20" placeholder="请输入产品规格" autocomplete="off" class="layui-input">
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label ui-required">生产地</label>
+							<div class="layui-input-block">
+								<select name="fkFieldGuid" lay-verify="required" lay-filter="roles" id="rolesView"></select>
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label ui-required">生产日期</label>
+							<div class="layui-input-block">
+								<input type="text" name="productDateStr" id="goodsProductDate" lay-verify="required" maxlength="20" placeholder="请输入生产日期" autocomplete="off" class="layui-input">
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label ui-required">保质期</label>
+							<div class="layui-input-block">
+								<input type="text" name="goodsExpired" lay-verify="" maxlength="10" placeholder="请输入保质期" autocomplete="off" class="layui-input">
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label ui-required">产品标签</label>
+							<div class="layui-input-block">
+								<div class="tags" id="tags">
+									<input type="text" id="inputTags" placeholder="回车生成标签" autocomplete="off">
+								</div>
+							</div>
+						</div>
+						<!-- <div class="layui-form-item">
+							<label class="layui-form-label">销售网址</label>
+							<div class="layui-input-block">
+								<input type="text" name="goodsSaleUrl" lay-verify="" maxlength="300" placeholder="请输入在线销售网址" autocomplete="off"
+								 class="layui-input">
+							</div>
+						</div> -->
+						<div class="layui-card">
+							<div class="layui-card-header">自定义信息</div>
+							<div class="layui-card-body">
+								<div id="auxListDiv"></div>
+								<div class="layui-form-item">
+									<div class="my-button my-button-product">+添加</div>
+								</div>
+							</div>
+						</div>
+						<div class="layui-card">
+							<div class="layui-card-header">产品图片视频</div>
+							<div class="layui-card-body">
+								<div id="imageListDiv"></div>
+								图片视频上传完毕后请记得按保存哦
+							</div>
+						</div>
+					</div>
+
+					<div class="layui-tab-item">
+						<div class="layui-card">
+							<div class="layui-card-header">原料信息</div>
+							<div class="layui-card-body">
+								<div style="display: flex;">
+									<input class="layui-input" style="margin-right: 15px;" type="text" name="rawMaterial" />
+									<button type="button" class="layui-btn" id="rawMaterialInfoAdd">新增</button>
+								</div>
+								<style type="text/css">
+									#rawMaterialInfo li {
+										display: inline-block;
+										border: 1px solid rgba(0, 0, 0, .2);
+										background: rgba(0, 0, 0, .1);
+										border-radius: .2em;
+										padding: .3em .6em;
+										margin: 8px;
+									}
+
+									#rawMaterialInfo li i:hover {
+										cursor: pointer;
+									}
+								</style>
+								<script type="text/html" id='rawMaterialInfoTpl'>
+								{{# layui.each(d,function(i,item){ }}
+									<li>
+										<div style="display: flex;align-items: center;">
+											<span>{{item.inputsProcessName}}</span>
+											{{#if ("view" !== location.searchObj().event){}}
+											<i data-bind="{{i||0}}" class="layui-icon layui-icon-close" style="margin-left: 5px;"></i>
+											{{#} }}
+										</div>
+									</li>
+									{{# });}}
+								</script>
+								<ol id="rawMaterialInfo"></ol>
+							</div>
+						</div>
+						<div class="layui-card">
+							<div class="layui-card-header">生产过程信息</div>
+							<div class="layui-card-body">
+								<div id="produceProcessInfoForm">
+									<div class="layui-input-inline">
+										<label class="layui-form-label">执行项</label>
+										<div class="layui-input-inline">
+											<input class="layui-input" style="margin-right: 15px;" type="text" name="processItem" />
+										</div>
+									</div>
+									<div class="layui-input-inline">
+										<label class="layui-form-label">执行人</label>
+										<div class="layui-input-inline">
+											<input class="layui-input" style="margin-right: 15px;" type="text" name="processUser" />
+										</div>
+									</div>
+									<div class="layui-input-inline">
+										<label class="layui-form-label">开始日期</label>
+										<div class="layui-input-inline">
+											<input class="layui-input" style="margin-right: 15px;" type="text" name="processTime" id="produceProcessInfoForm_processTime" />
+										</div>
+									</div>
+									<div class="layui-input-inline">
+										<label class="layui-form-label">执行描述</label>
+										<div class="layui-input-inline">
+											<input class="layui-input" style="margin-right: 15px;" type="text" name="processDesc" />
+										</div>
+									</div>
+									<input type="hidden" name="processType" value="1" />
+									<button type="button" class="layui-btn" id='produceProcessInfoAdd'>新增</button>
+									<table class="layui-hide" id="produceProcessInfo" lay-filter="produceProcessInfo"></table>
+								</div>
+							</div>
+						</div>
+					</div>
+
+					<div class="layui-tab-item" id="processingCirculationInfoForm">
+						<div class="layui-input-inline">
+							<label class="layui-form-label">执行项</label>
+							<div class="layui-input-inline">
+								<input class="layui-input" style="margin-right: 15px;" type="text" name="processItem" />
+							</div>
+						</div>
+						<div class="layui-input-inline">
+							<label class="layui-form-label">执行人</label>
+							<div class="layui-input-inline">
+								<input class="layui-input" style="margin-right: 15px;" type="text" name="processUser" />
+							</div>
+						</div>
+						<div class="layui-input-inline">
+							<label class="layui-form-label">开始日期</label>
+							<div class="layui-input-inline">
+								<input class="layui-input" style="margin-right: 15px;" type="text" name="processTime" id="processingCirculationInfoForm_processTime" />
+							</div>
+						</div>
+						<div class="layui-input-inline">
+							<label class="layui-form-label">执行描述</label>
+							<div class="layui-input-inline">
+								<input class="layui-input" style="margin-right: 15px;" type="text" name="processDesc" />
+							</div>
+						</div>
+						<input type="hidden" name="processType" value="2" />
+						<button type="button" class="layui-btn" id='processingCirculationInfoAdd'>新增</button>
+						<table class="layui-hide" id="processingCirculationInfo" lay-filter="processingCirculationInfo"></table>
+					</div>
+					<div class="layui-tab-item">
+						<div class="layui-card">
+							<div class="layui-card-header">检验信息</div>
+							<div class="layui-card-body">
+								<div class="layui-form-item">
+									<label class="layui-form-label">检验单位:</label>
+									<div class="layui-input-block">
+										<input type="text" name="assayDepartment" lay-verify="" maxlength="10" placeholder="请输入检验单位" autocomplete="off" class="layui-input">
+									</div>
+								</div>
+								<div id="assayAuxListDiv"></div>
+								<div class="layui-form-item">
+									<div class="my-button my-button-assay">+添加</div>
+								</div>
+							</div>
+						</div>
+						<div class="layui-card">
+							<div class="layui-card-header">检验报告</div>
+							<div class="layui-card-body">
+								<div id="assayImageListDiv"></div>
+								图片视频上传完毕后请记得按保存哦
+							</div>
+						</div>
+					</div>
+				</div>
+				<div class="layui-form-item" style="text-align: center;padding: 25px;">
+					<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+					<button type="reset" class="layui-btn layui-btn-primary close-win">取消</button>
+				</div>
+			</div>
+		</form>
+
+		<script type="text/html" id="typeHtmlTpl">
+			<option value="">请选择</option>
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+		<option value="{{item.guid}}" oneMap="{{item.oneMap}}">{{item.fieldName}}</option>
+		{{# }); }}
+	</script>
+		<script type="text/html" id="auxHtmlTpl">
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+			<div class="layui-form-item">
+				<label class="layui-form-label">自定义项{{index+1}}:</label>
+				<div class="my-inline" style="width: 20%">
+					<input type="text" name="auxItme" maxlength="20" lay-verify="required" placeholder="标题" autocomplete="off" class="layui-input" value="{{item.auxItme}}">
+				</div>
+				<div class="my-inline">--</div>
+				<div class="my-inline" style="width: 40%">
+					<input type="text" name="auxItmeVal" maxlength="100" lay-verify="required" placeholder="项" autocomplete="off" class="layui-input" value="{{item.auxItmeVal}}">
+				</div>
+				<div class="my-inline">
+					<i class="layui-icon my-del button-delAux" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
+				</div>
+			</div>
+			{{# }); }}
+		</script>
+		<script type="text/html" id="imageHtmlTpl">
+			<div class="layui-form-item">
+			{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+			<div class="my-images-inline">
+				{{#if ("jpg|jpeg|png|gif|bmp".indexOf(item.substring(item.lastIndexOf(".")+1))==-1){}}
+				<video class="my-img" src="{{window.hywa.config.href}}/{{item}}" autoplay loop></video>
+				{{#}else{}}
+				<img class="my-img" src="{{window.hywa.config.href}}/{{item}}">
+				{{#} }}
+				<i class="layui-icon my-del button-delImage" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
+			</div>
+			{{# }); }}
+			<div class="my-images-inline my-images-add" id="imageUploadBtn">+</div>
+		</div>
+	</script>
+		<script type="text/html" id="assayAuxHtmlTpl">
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+			<div class="layui-form-item">
+				<label class="layui-form-label">{{#if(index==0){}}检验数据:{{#} }}</label>
+				<div class="my-inline" style="width: 20%">
+					<input type="text" name="auxItme2" maxlength="20" placeholder="检验项名" autocomplete="off" class="layui-input" value="{{item.auxItme}}">
+				</div>
+				<div class="my-inline">--</div>
+				<div class="my-inline" style="width: 40%">
+					<input type="text" name="auxItmeVal2" maxlength="100" placeholder="数值和单位" autocomplete="off" class="layui-input" value="{{item.auxItmeVal}}">
+				</div>
+				<div class="my-inline">
+					<i class="layui-icon my-del button-delAssay" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
+				</div>
+			</div>
+			{{# }); }}
+		</script>
+		<script type="text/html" id="assayImageHtmlTpl">
+			<div class="layui-form-item">
+			{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+			<div class="my-images-inline">
+				{{#if ("jpg|jpeg|png|gif|bmp".indexOf(item.substring(item.lastIndexOf(".")+1))==-1){}}
+				<video class="my-img" src="{{window.hywa.config.href}}/{{item}}" autoplay loop></video>
+				{{#}else{}}
+				<img class="my-img" src="{{window.hywa.config.href}}/{{item}}">
+				{{#} }}
+				<i class="layui-icon my-del button-delAssayImage" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
+			</div>
+			{{# }); }}
+			<div class="my-images-inline my-images-add" id="assayImageUploadBtn">+</div>
+		</div>
+	</script>
+		<script type="text/javascript">
+			function loadJS(url) {
+				document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+			}
+			loadJS("../../layui/layui.js");
+			loadJS("../../js/ajaxhook.min.js");
+			loadJS("../../js/config.js");
+		</script>
+		<script type="text/javascript">
+			layui.config({
+				base: "../../js/layuiPlugins/"
+			}).use(["form", 'layer', 'laytpl', 'jquery', 'laydate', 'element', 'upload', 'table', 'inputTags'], function () {				
+				var form = layui.form,
+					layer = layui.layer,
+					laytpl = layui.laytpl,
+					$ = layui.jquery,
+					laydate = layui.laydate,
+					element = layui.element,
+					upload = layui.upload,
+					inputTags = layui.inputTags
+				table = layui.table;
+				laydate.render({
+					elem: '#goodsProductDate' //指定元素
+				});
+				laydate.render({
+					type: 'datetime',
+					elem: '#produceProcessInfoForm_processTime' //指定元素
+				});
+				laydate.render({
+					type: 'datetime',
+					elem: '#processingCirculationInfoForm_processTime' //指定元素
+				});
+				var funcName = "pdinfo";
+				var rolesViewOnemapParam = "";
+				var formData = {
+					guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
+					current: {
+						auxList: [],
+						imagesList: [],
+						assayInfoForm: {
+							imagesList: [],
+							auxList: []
+						}
+					}, //当前表单数据
+					select_data: "select_" + funcName, //查询用户
+					save_data: (location.searchObj().guid ? 'edit' : 'add') + '_' + funcName, //查询用户
+					formLayFilter: "addForm", //表单容器
+					closeModal: function () { //关闭当前窗口
+						parent.layer.close(parent.layer.getFrameIndex(window.name));
+					}
+				};
+
+				var option = {
+					elem: '#imageUploadBtn',
+					url: 'uploadImage',
+					accept: "file",
+					exts: "jpg|jpeg|png|gif|bmp|mp4|ogg|webm|avi|wma|rmvb|rm|flash|3gp|flv",
+					size: 10240, //kb
+					before: function () {
+						uploadMsg = layer.msg('正在上传中……', {
+							icon: 16,
+							fixed: false,
+							time: 0
+						});
+					},
+					done: function (res) {
+						layer.close(uploadMsg);
+						formData.current.imagesList.push(res.data[0]);
+						imageTpl({
+							elem: "#imageListDiv",
+							list: formData.current.imagesList
+						});
+					},
+					error: function () { }
+				};
+				var assayOption = {
+					elem: '#assayImageUploadBtn',
+					url: 'uploadImage',
+					accept: "file",
+					exts: "jpg|jpeg|png|gif|bmp|mp4|ogg|webm|avi|wma|rmvb|rm|flash|3gp|flv",
+					size: 10240, //kb
+					before: function () {
+						uploadMsg = layer.msg('正在上传中……', {
+							icon: 16,
+							fixed: false,
+							time: 0
+						});
+					},
+					done: function (res) {
+						layer.close(uploadMsg);
+						formData.current.assayInfoForm.imagesList.push(res.data[0]);
+						assayImageTpl({
+							elem: "#assayImageListDiv",
+							list: formData.current.assayInfoForm.imagesList
+						});
+					},
+					error: function () { }
+				};
+				//自定义项列表模板
+				function auxTpl(obj) {
+					laytpl(auxHtmlTpl.innerHTML).render(obj, function (html) {
+						$(obj.elem).html(html);
+						$(".button-delAux").on("click", function (e) {
+							var sortno = e.target.getAttribute("data-bind");
+							for (var i = formData.current.auxList.length - 1; i >= 0; i--) {
+								if ($("input[name='auxItme']")[i]) {
+									formData.current.auxList[i].auxItme = $("input[name='auxItme']")[i].value;
+									formData.current.auxList[i].auxItmeVal = $("input[name='auxItmeVal']")[i].value;
+								}
+							}
+							formData.current.auxList.splice(sortno, 1);
+							auxTpl({
+								elem: "#auxListDiv",
+								list: formData.current.auxList
+							});
+						});
+					});
+				}
+				//检验数据列表模板
+				function assayTpl(obj) {
+					laytpl(assayAuxHtmlTpl.innerHTML).render(obj, function (html) {
+						$(obj.elem).html(html);
+						$(".button-delAssay").on("click", function (e) {
+							var sortno = e.target.getAttribute("data-bind");
+							var index = formData.current.assayInfoForm.auxList.length;
+							for (var i = index - 1; i >= 0; i--) {
+								if ($("input[name='auxItme2']")[i]) {
+									formData.current.assayInfoForm.auxList[i].auxItme = $("input[name='auxItme2']")[i].value;
+									formData.current.assayInfoForm.auxList[i].auxItmeVal = $("input[name='auxItmeVal2']")[i].value;
+								}
+							}
+							formData.current.assayInfoForm.auxList.splice(sortno, 1);
+							assayTpl({
+								elem: "#assayAuxListDiv",
+								list: formData.current.assayInfoForm.auxList
+							});
+						});
+					});
+				}
+				//下拉列表模板
+				function typeTpl(obj) {
+					laytpl(typeHtmlTpl.innerHTML).render(obj, function (html) {
+						$(obj.elem).html(html);
+						form.render();
+					});
+				}
+				//图片列表模板
+				function imageTpl(obj) {
+					laytpl(imageHtmlTpl.innerHTML).render(obj, function (html) {
+						$(obj.elem).html(html);
+						upload.render(option);
+						$(".button-delImage").on("click", function (e) {
+							formData.current.imagesList.splice(e.target.getAttribute("data-bind"), 1);
+							imageTpl({
+								elem: "#imageListDiv",
+								list: formData.current.imagesList
+							});
+						});
+					});
+				}
+				//检验图片列表模板
+				function assayImageTpl(obj) {
+					laytpl(assayImageHtmlTpl.innerHTML).render(obj, function (html) {
+						$(obj.elem).html(html);
+						upload.render(assayOption);
+						$(".button-delAssayImage").on("click", function (e) {
+							formData.current.assayInfoForm.imagesList.splice(e.target.getAttribute("data-bind"), 1);
+							assayImageTpl({
+								elem: "#assayImageListDiv",
+								list: formData.current.assayInfoForm.imagesList
+							});
+						});
+					});
+				}
+				//原料信息模板
+				function rawMaterial(data) {
+					laytpl(rawMaterialInfoTpl.innerHTML).render(data, function (html) {
+						$('#rawMaterialInfo').html(html);
+					});
+				}
+				$('#rawMaterialInfo').on("click", 'li i', function (e) { //删除
+					if (formData.guid) {
+						$.ajax({
+							url: 'del_rawMaterialInfo',
+							data: {
+								guid: formData.current.inputsFormList[e.target.getAttribute("data-bind")].guid
+							},
+							success: function (res) {
+
+							}
+						});
+					}
+					formData.current.inputsFormList.splice(e.target.getAttribute("data-bind"), 1);
+					rawMaterial(formData.current.inputsFormList);
+				});
+				$("#rawMaterialInfoAdd").on('click', function () {
+					let val = $('input[name="rawMaterial"]').val();
+					if (val) {
+						formData.current.inputsFormList = formData.current.inputsFormList || [];
+						formData.current.inputsFormList.push({
+							inputsProcessName: val
+						});
+						rawMaterial(formData.current.inputsFormList);
+						if (formData.guid) {
+							formData.submitInfo('add_rawMaterialInfo', {
+								fkGoodsBatchGuid: formData.guid,
+								inputsProcessName: val
+							}, function () {
+								formData.getCurrent();
+							});
+						}
+					}
+				});
+
+				//生产过程信息
+				formData.current.materialList = formData.current.materialList || [];
+				//编号
+				for (let i in formData.current.materialList) {
+					formData.current.materialList[i].index = i;
+				}
+				let produceProcessInfoOptions = {
+					id: "produceProcessInfo",
+					elem: '#produceProcessInfo',
+					data: formData.current.materialList,
+					cols: [
+						[{
+							field: 'processItem',
+							title: '执行项',
+							edit: 'text',
+							event: 'edit',
+							align: 'center'
+						}, {
+							field: 'processTime',
+							title: '开始时间',
+							edit: 'time',
+							align: 'center',
+							event: 'edit'
+						}, {
+							field: 'processUser',
+							title: '执行人',
+							edit: 'text',
+							align: 'center',
+							event: 'edit'
+						}, {
+							field: 'processDesc',
+							title: '执行描述',
+							edit: 'text',
+							align: 'center',
+							event: 'edit'
+						}, {
+							field: 'processImgs',
+							title: '上传过程照片',
+							// toolbar: `<div><a href="javascript:void(0);" lay-event="processImgsPreview">{{d.processImgs || ''}}</a></div>`,
+							toolbar: ("view" !== location.searchObj().event) ? `<div>
+								<a class="layui-btn layui-btn-xs" lay-event="upload">上传</a>
+								<a target="_blank" href="{{window.hywa.config.href}}/{{d.processImgs || ''}}" lay-event="aHref">{{d.processImgs || ''}}</a>
+							</div>` : `<div>
+								<a target="_blank" href="{{window.hywa.config.href}}/{{d.processImgs || ''}}" lay-event="aHref">{{d.processImgs || ''}}</a>
+							</div>`,
+							align: 'center'
+						}, {
+							title: '操作',
+							toolbar: ("view" !== location.searchObj().event) ? `<div>
+								<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" id="produceProcessInfoDeeBtn">删除</a>
+							</div>` : `<div>&nbsp;</div>`,
+							align: 'center'
+						}]
+					],
+					page: true
+				};
+				let produceProcessInfoTable = table.render(produceProcessInfoOptions);
+				//监听工具条
+				table.on('tool(produceProcessInfo)', function (obj) {
+					var data = obj.data;
+					if (obj.event === 'detail') {
+						layer.msg('ID:' + data.id + ' 的查看操作');
+					} else if (obj.event === 'del') {
+						layer.confirm('真的删除行么', function (index) {
+							obj.del();
+							formData.current.materialList.map(function (item, index) {
+								item.index == obj.data.index && formData.current.materialList.splice(index, 1);
+							});
+							produceProcessInfoOptions.data = formData.current.materialList;
+							// 刷新表格数据
+							produceProcessInfoTable.reload(produceProcessInfoOptions);
+
+							if (formData.guid) {
+								$.ajax({
+									url: 'del_produceProcessInfo',
+									data: {
+										guid: data.guid
+									},
+									success: function (res) {
+									}
+								});
+							}
+							layer.close(index);
+						});
+					} else if (obj.event === 'upload') {
+						let upelem = document.createElement('input'),
+							uploadMsg = 0;
+						upload.render({
+							elem: upelem, //绑定元素
+							url: 'uploadImage',
+							accept: "file",
+							exts: "jpg|jpeg|png|gif|bmp|mp4|ogg|webm|avi|wma|rmvb|rm|flash|3gp|flv|mp3",
+							size: 10240,
+							before: function () {
+								uploadMsg = layer.msg('正在上传中……', {
+									icon: 16,
+									fixed: false,
+									time: 0
+								});
+							},
+							done: function (res) {
+								layer.close(uploadMsg);
+								if (!(res.code - 0)) {
+									let a = obj.tr[0].querySelector('a[lay-event="aHref"]');
+									a.href = window.hywa.config.href + '/' + res.data[0];
+									a.innerHTML = res.data[0];
+									let ggObj = {};
+									formData.current.materialList.map(function (item, index) {
+										if (item.index == obj.data.index) {
+											formData.current.materialList[index].processImgs = res.data[0];
+											ggObj = formData.current.materialList[index];
+										}
+									});
+									if (formData.guid) {
+										formData.submitInfo('edit_produceProcessInfo', ggObj, function () {
+											formData.getCurrent();
+										});
+									}
+								}
+							},
+							error: function () {
+
+							}
+						});
+						upelem.click();
+					} else if (obj.event === 'processImgsPreview') {
+						let imageSrc = ((obj.data || {}).processImgs || '');
+						if (imageSrc.indexOf("downloadDocument") != -1) {
+							imageSrc = imageSrc;
+						} else {
+							imageSrc = window.hywa.config.href + imageSrc;
+						}
+						let processImgsPreviewDialog = '<div class="dialog-role f-dsn" id="processImgsPreviewDialog"><div style="text-align: center"><img id="processImgsPreviewDialogimg" src="' + imageSrc + '" style="width: 550px; height: 520px; margin: 10px;" /></div></div>';
+						layer.open({
+							type: 1,
+							title: "图片预览",
+							fixed: true,
+							area: ['600px', '600px'],
+							shadeClose: true,
+							scrollbar: false,
+							content: processImgsPreviewDialog
+						});
+					} else {
+						return;
+					}
+				});
+				table.on('edit(produceProcessInfo)', function (obj) {
+					//修改后响应
+					let ggObj = {};
+					formData.current.materialList.map(function (item, index) {
+						if (item.index == obj.data.index) {
+							formData.current.materialList[index] = obj.data;
+							ggObj = formData.current.materialList[index];
+						}
+					});
+					if (formData.guid) {
+						formData.submitInfo('edit_produceProcessInfo', ggObj, function () {
+							formData.getCurrent();
+						});
+					}
+				});
+				//监听新增
+				$('#produceProcessInfoAdd').on('click', function () {
+					let input = $("#produceProcessInfoForm")[0].querySelectorAll('input');
+					let obj = {};
+					let ver = [];
+					layui.each(input, function (i, item) {
+						if (item.name) {
+							obj[item.name] = item.value;
+							ver.push(item.value);
+						}
+					});
+					for (let i = 0; i < ver.length; i++) {
+						if (!ver[i]) {
+							layer.msg("全部都需要填写噢", {
+								icon: 2
+							});
+							return false;
+						}
+					}
+					if (formData.guid) {
+						obj.fkGoodsBatchGuid = formData.guid;
+						formData.submitInfo('add_produceProcessInfo', obj, function () {
+							formData.getCurrent();
+						});
+					}
+					formData.current.materialList.push(obj);
+					//编号
+					for (let i in formData.current.materialList) {
+						formData.current.materialList[i].index = i;
+					}
+					table.reload("produceProcessInfo", {
+						data: formData.current.materialList
+					});
+				});
+				//加工流通
+				formData.current.productList = formData.current.productList || [];
+				//编号
+				for (let i in formData.current.productList) {
+					formData.current.productList[i].index = i;
+				}
+				table.render({
+					id: "processingCirculationInfo",
+					elem: '#processingCirculationInfo',
+					data: formData.current.productList,
+					cols: [
+						[{
+							field: 'processItem',
+							title: '执行项',
+							edit: 'text',
+							event: 'edit',
+							align: 'center'
+						}, {
+							field: 'processTime',
+							title: '开始时间',
+							edit: 'time',
+							align: 'center',
+							event: 'edit'
+						}, {
+							field: 'processUser',
+							title: '执行人',
+							edit: 'text',
+							align: 'center',
+							event: 'edit'
+						}, {
+							field: 'processDesc',
+							title: '执行描述',
+							edit: 'text',
+							align: 'center',
+							event: 'edit'
+						}, {
+							field: 'processImgs',
+							title: '上传过程照片',
+							toolbar: ("view" !== location.searchObj().event) ? `<div>
+								<a class="layui-btn layui-btn-xs" lay-event="upload">上传</a>
+								<a target="_blank" href="{{window.hywa.config.href}}/{{d.processImgs || ''}}" lay-event="aHref">{{d.processImgs || ''}}</a>
+							</div>` : `<div>
+								<a target="_blank" href="{{window.hywa.config.href}}/{{d.processImgs || ''}}" lay-event="aHref">{{d.processImgs || ''}}</a>
+							</div>`,
+							align: 'center'
+						}, {
+							title: '操作',
+							toolbar: ("view" !== location.searchObj().event) ? `<div>
+								<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
+							</div>` : `<div>&nbsp;</div>`,
+							align: 'center'
+						}]
+					],
+					page: true
+				});
+				//监听工具条
+				table.on('tool(processingCirculationInfo)', function (obj) {
+					var data = obj.data;
+					if (obj.event === 'detail') {
+						layer.msg('ID:' + data.id + ' 的查看操作');
+					} else if (obj.event === 'del') {
+						layer.confirm('真的删除行么', function (index) {
+							obj.del();
+							formData.current.productList.map(function (item, index) {
+								item.index == obj.data.index && formData.current.productList.splice(index, 1);
+							});
+							if (formData.guid) {
+								$.ajax({
+									url: 'del_processingCirculationInfo',
+									data: {
+										guid: data.guid
+									},
+									success: function (res) {
+
+									}
+								});
+							}
+							layer.close(index);
+						});
+					} else if (obj.event === 'upload') {
+						let upelem = document.createElement('input'),
+							uploadMsg = 0;
+						upload.render({
+							elem: upelem, //绑定元素
+							url: 'uploadImage',
+							accept: "file",
+							exts: "jpg|jpeg|png|gif|bmp|mp4|ogg|webm|avi|wma|rmvb|rm|flash|3gp|flv|mp3",
+							size: 10240,
+							before: function () {
+								uploadMsg = layer.msg('正在上传中……', {
+									icon: 16,
+									fixed: false,
+									time: 0
+								});
+							},
+							done: function (res) {
+								layer.close(uploadMsg);
+								if (!(res.code - 0)) {
+									let a = obj.tr[0].querySelector('a[lay-event="aHref"]');
+									a.href = window.hywa.config.href + '/' + res.data[0];
+									a.innerHTML = res.data[0];
+									let ggObj = {};
+									formData.current.productList.map(function (item, index) {
+										if (item.index == obj.data.index) {
+											formData.current.productList[index].processImgs = res.data[0];
+											ggObj = formData.current.productList[index];
+										}
+									});
+									if (formData.guid) {
+										formData.submitInfo('edit_processingCirculationInfo', ggObj, function () {
+											formData.getCurrent();
+										});
+									}
+								}
+							},
+							error: function () {
+
+							}
+						});
+						upelem.click();
+					}
+				});
+				table.on('edit(processingCirculationInfo)', function (obj) {
+					//修改后响应
+					let ggObj = {};
+					formData.current.productList.map(function (item, index) {
+						if (item.index == obj.data.index) {
+							formData.current.productList[index] = obj.data;
+							ggObj = formData.current.productList[index];
+						}
+					});
+					if (formData.guid) {
+						formData.submitInfo('edit_processingCirculationInfo', ggObj, function () {
+							formData.getCurrent();
+						});
+					}
+				});
+				//监听新增
+				$('#processingCirculationInfoAdd').on('click', function () {
+					let input = $("#processingCirculationInfoForm")[0].querySelectorAll('input');
+					let obj = {};
+					let ver = [];
+					layui.each(input, function (i, item) {
+						if (item.name) {
+							obj[item.name] = item.value;
+							ver.push(item.value);
+						}
+					});
+					for (let i = 0; i < ver.length; i++) {
+						if (!ver[i]) {
+							layer.msg("全部都需要填写噢", {
+								icon: 2
+							});
+							return false;
+						}
+					}
+					if (formData.guid) {
+						obj.fkGoodsBatchGuid = formData.guid;
+						formData.submitInfo('add_processingCirculationInfo', obj, function () {
+							formData.getCurrent();
+						});
+					}
+					formData.current.productList.push(obj);
+					//编号
+					for (let i in formData.current.productList) {
+						formData.current.productList[i].index = i;
+					}
+					table.reload("processingCirculationInfo", {
+						data: formData.current.productList
+					});
+				});
+				//初始化
+				formData.main = function () {
+					var _this = this;
+					$("#goodsName").html(location.searchObj().pdName);
+					this.current.fkGoodsGuid = location.searchObj().pid;
+					this.current.goodsName = location.searchObj().pdName;
+					$.ajax({
+						url: "regionList",
+						method: 'post',
+						contentType: "application/json",
+						data: JSON.stringify({
+							page: 1,
+							limit: 100
+						}),
+						success: function (res) {
+							typeTpl({
+								elem: "#rolesView",
+								list: res.data
+							});
+							form.val(_this.formLayFilter, _this.current);
+						}
+					});
+					if (this.guid) {
+						_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+					} else {
+						_this.initialization();
+						imageTpl({
+							elem: "#imageListDiv",
+							list: _this.current.imagesList
+						});
+						assayImageTpl({
+							elem: "#assayImageListDiv",
+							list: _this.current.assayInfoForm.imagesList
+						});
+					}
+					if (location.searchObj().event == "view") {
+						var el = document.getElementsByTagName("INPUT");
+						for (var i = 0; i < el.length; i++) {
+							el[i].readOnly = true;
+						}
+						el = document.getElementsByTagName("SELECT");
+						for (var i = 0; i < el.length; i++) {
+							el[i].disabled = true;
+						}
+						el = document.getElementsByTagName("checkbox");
+						for (var i = 0; i < el.length; i++) {
+							el[i].disabled = true;
+						}
+						el = document.getElementsByTagName("button");
+						for (var i = 0; i < el.length; i++) {
+							if (el[i].innerText.replace(" ", "") == "保存") {
+								el[i].style.display = "none";
+							}
+						}
+					}
+					return this;
+				};
+
+				//初始化
+				formData.initialization = function () {
+					//标签初始化
+					let labelList = formData.current.labelList;
+					let productTags = []
+					if (labelList) {
+						for (let i = 0; i < labelList.length; i++) {
+							productTags.push(labelList[i].labelName)
+						}
+					}
+					var _this = this;
+					//监听提交
+					form.on('submit(formDemo)', function (obj) {
+						//必须return false;
+						return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+					});
+					//关闭窗口
+					$(".close-win").on("click", function () {
+						_this.closeModal();
+					});
+					$(".my-button-product").on("click", function () {
+						_this.current.auxList.push({
+							i: _this.current.auxList.length + 1,
+							auxItme: "",
+							auxItmeVal: ""
+						}); //数据库里把item写成itme
+						for (var i = _this.current.auxList.length - 1; i >= 0; i--) {
+							if ($("input[name='auxItme']")[i]) {
+								_this.current.auxList[i].auxItme = $("input[name='auxItme']")[i].value;
+								_this.current.auxList[i].auxItmeVal = $("input[name='auxItmeVal']")[i].value;
+							}
+						}
+						auxTpl({
+							elem: "#auxListDiv",
+							list: _this.current.auxList
+						});
+					});
+					$(".my-button-assay").on("click", function () {
+						_this.current.assayInfoForm.auxList.push({
+							i: _this.current.assayInfoForm.auxList.length + 1,
+							auxItme: "",
+							auxItmeVal: ""
+						}); //数据库里把item写成itme
+						for (var i = _this.current.assayInfoForm.auxList.length - 1; i >= 0; i--) {
+							if ($("input[name='auxItme2']")[i]) {
+								_this.current.assayInfoForm.auxList[i].auxItme = $("input[name='auxItme2']")[i].value;
+								_this.current.assayInfoForm.auxList[i].auxItmeVal = $("input[name='auxItmeVal2']")[i].value;
+							}
+						}
+						assayTpl({
+							elem: "#assayAuxListDiv",
+							list: _this.current.assayInfoForm.auxList
+						});
+					});
+					inputTags.render({
+						elem: '#inputTags',//定义输入框input对象
+						content: productTags,//默认标签
+						aldaBtn: true,//是否开启获取所有数据的按钮
+						done: function (value) { //回车后的回调
+							formData.current.labelNames = value.toString();
+						},
+						del: function (value) {
+							formData.current.labelNames = value.toString();
+						}
+					})
+					return _this;
+				};
+				//获取当前信息
+				formData.getCurrent = function (id) {
+					var _this = this;
+					$.ajax({
+						url: this.select_data,
+						method: 'get',
+						data: {
+							guid: id || this.guid //当前ID
+						},
+						success: function (res) {
+							try {
+								res.data[0].productDateStr = res.data[0].goodsProductDate.substring(0, 10);
+								if (!res.data[0].auxList)
+									res.data[0].auxList = [];
+								if (!res.data[0].imagesList)
+									res.data[0].imagesList = [];
+								if (!res.data[0].assayInfoForm)
+									res.data[0].assayInfoForm = {};
+								if (!res.data[0].assayInfoForm.auxList)
+									res.data[0].assayInfoForm.auxList = [];
+								if (!res.data[0].assayInfoForm.imagesList)
+									res.data[0].assayInfoForm.imagesList = [];
+								res.data[0].assayDepartment = res.data[0].assayInfoForm.assayDepartment;
+							} catch (e) {
+								//TODO handle the exception
+							}
+
+							$("#goodsName").html(res.data[0].goodsName);
+							_this.current = res.data[0];
+							auxTpl({
+								elem: "#auxListDiv",
+								list: res.data[0].auxList
+							});
+							imageTpl({
+								elem: "#imageListDiv",
+								list: res.data[0].imagesList
+							});
+							assayTpl({
+								elem: "#assayAuxListDiv",
+								list: res.data[0].assayInfoForm.auxList
+							});
+							assayImageTpl({
+								elem: "#assayImageListDiv",
+								list: res.data[0].assayInfoForm.imagesList
+							});
+							_this.current.inputsFormList = _this.current.inputsFormList || [];
+							rawMaterial(_this.current.inputsFormList);
+							//生产过程信息
+							_this.current.materialList = formData.current.materialList || [];
+							//编号
+							for (let i in _this.current.materialList) {
+								_this.current.materialList[i].index = i;
+							}
+							table.reload("produceProcessInfo", {
+								data: _this.current.materialList
+							});
+							//加工流通信息
+							_this.current.productList = formData.current.productList || [];
+							//编号
+							for (let i in _this.current.productList) {
+								_this.current.productList[i].index = i;
+							}
+							table.reload("processingCirculationInfo", {
+								data: _this.current.productList
+							});
+							_this.initialization().formVal();
+						}
+					});
+					return _this;
+				};
+				//表单赋值
+				formData.formVal = function () {
+					var _this = this;
+					form.val(this.formLayFilter, this.current);
+					return this;
+				};
+				//合并表单内容
+				formData.fusionData = function (obj) {
+					for (var i = this.current.auxList.length - 1; i >= 0; i--) {
+						this.current.auxList[i].auxItme = $("input[name='auxItme']")[i].value;
+						this.current.auxList[i].auxItmeVal = $("input[name='auxItmeVal']")[i].value;
+						if (this.current.auxList[i].auxItme == "" && this.current.auxList[i].auxItmeVal == "")
+							this.current.auxList.splice(i, 1);
+					}
+					for (var i = this.current.assayInfoForm.auxList.length - 1; i >= 0; i--) {
+						this.current.assayInfoForm.auxList[i].auxItme = $("input[name='auxItme2']")[i].value;
+						this.current.assayInfoForm.auxList[i].auxItmeVal = $("input[name='auxItmeVal2']")[i].value;
+						if (this.current.assayInfoForm.auxList[i].auxItme == "" && this.current.assayInfoForm.auxList[i].auxItmeVal ==
+							"")
+							this.current.assayInfoForm.auxList.splice(i, 1);
+					}
+					this.current = $.extend(this.current, obj);
+					this.current.goodsBatchImages = this.current.imagesList.join(",");
+					this.current.assayInfoForm.assayImgs = this.current.assayInfoForm.imagesList.join(",");
+					this.current.assayInfoForm.assayDepartment = this.current.assayDepartment;
+					return this;
+				};
+				//提交新增修改
+				formData.submitInfo = function (url, data, fun) {
+					var _this = this;
+					$.ajax({
+						type: 'POST',
+						url: url || this.save_data, //+'?userId='+this.guid
+						data: JSON.stringify(data || this.current),
+						contentType: 'application/json',
+						success: function (res) {
+
+							if (!(res.code - 0)) {
+								parent.layer.msg(res.msg, {
+									icon: 1
+								});
+								typeof fun === 'function' && fun();
+								url || _this.closeModal();
+							} else {
+								layer.msg(res.msg, {
+									icon: 2
+								});
+							}
+						}
+					});
+					return false;
+				};
+				formData.main();
+				//验证规则
+				form.verify({
+					nickname: function (value) {
+						if (!new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$").test(value)) {
+							return '账号必须以英文字母开头,只能包含英文字母、数字、下划线';
+						}
+						if (/(^\_)|(\__)|(\_+$)/.test(value)) {
+							return '账号首尾不能出现下划线\'_\'';
+						}
+					},
+					checkName: function (value) { },
+					phoneNumber: function (value) {
+						if (value) {
+							if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+								return '请输入正确的手机号码';
+							}
+						}
+						return false;
+					},
+					password: function (value) {
+						if (location.searchObj().guid) {
+							if (value) {
+								if (!(/^[\S]{6,12}$/).test(value)) {
+									return '密码必须6到12位,且不能出现空格';
+								}
+							}
+							return false;
+						}
+						if (!(/^[\S]{6,12}$/).test(value)) {
+							return '密码必须6到12位,且不能出现空格';
+						}
+					},
+					resspaword: function (value) {
+						var pass = $('#L_pass').val();
+						if (value != pass) {
+							return '两次密码不一致';
+						}
+					},
+					ageLength: [
+						/^[0-9]{0,2}$/,
+						'年龄必须0到2位,且只能是数字'
+					],
+					jobLength: [
+						/^[a-z\A-Z\u4e00-\u9fa5_]{0,10}$/,
+						'职务必须是0-10位,且不包含特殊字符与数字'
+					],
+					workUnit: [
+						/^[0-9\a-z\A-Z\u4e00-\u9fa5_]{0,25}$/,
+						'工作单位必须是0-25位,且不包含特殊字符'
+					],
+					vcode: [
+						/^[\w]{4,5}$/,
+						'验证码不符合规则'
+					]
+				});
+
+				form.on('select(roles)', function (data) {
+					rolesViewOnemapParam = $("#rolesView option[value='" + data.value + "']").attr('oneMap');
+				});
+
+				/*element.on('tab(docDemoTabBrief)', function (data) {
+					if ('2' == this.getAttribute('lay-id')) {
+						if (rolesViewOnemapParam && null != rolesViewOnemapParam) {
+							let req = {
+								orchardId: rolesViewOnemapParam,
+								pageNo: 1,
+								pageSize: 10
+							};
+							$.ajax({
+								type: 'get',
+								url: 'getOrchardList' + '?orchardId=' + rolesViewOnemapParam + '&pageNo=1&pageSize=10',
+								success: function (res) {
+									formData.current.materialList = res.data;
+									formData.current.materialList.forEach(value => {
+										value.processType = 1;
+									});
+									table.reload("produceProcessInfo", {
+										data: formData.current.materialList
+									});
+								}
+							});
+						}
+					}
+				});*/
+
+			});
+		</script>
+	</body>
+
+</html>

+ 233 - 0
forstpages/pdinfo/add_change2.html

@@ -0,0 +1,233 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: 100% !important;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+	</style>
+</head>
+
+<body>
+	<form class="layui-form" action="" lay-filter="addForm" style="padding: 20px 20px 0 0">
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">产品名称</label>
+			<div class="layui-input-block">
+				<input type="text" name="goodsName" maxlength="32" lay-verify="required" placeholder="请输入产品名称"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item layui-layer-btn">
+			<div class="layui-input-block">
+				<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">取消</button>
+				<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+			</div>
+		</div>
+	</form>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(["form", 'layer', 'laytpl', 'jquery'], function () {
+			var form = layui.form,
+				layer = layui.layer,
+				laytpl = layui.laytpl,
+				$ = layui.jquery;
+			var funcName = "pdinfo2";
+			var formData = {
+				guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
+				current: {}, //当前表单数据
+				select_data: "select_" + funcName, //查询
+				save_data: (location.searchObj().guid ? 'edit' : 'add') + '_' + funcName, //保存
+				closeModal: function () { //关闭当前窗口
+					parent.layer.close(parent.layer.getFrameIndex(window.name));
+				}
+			};
+			//初始化
+			formData.main = function () {
+				var _this = this;
+				if (this.guid) {
+					_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+				} else {
+					_this.initialization();
+
+				}
+				return this;
+			};
+
+			//初始化
+			formData.initialization = function () {
+				var _this = this;
+				//监听提交
+				form.on('submit(formDemo)', function (obj) {
+					//必须return false;
+					return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+				});
+				//关闭窗口
+				$("#closeWin").on("click", function () {
+					_this.closeModal();
+				});
+				return _this;
+			};
+			//获取当前信息
+			formData.getCurrent = function (id) {
+				var _this = this;
+				$.ajax({
+					url: this.select_data,
+					method: 'get',
+					data: {
+						guid: id || this.guid //当前ID
+					},
+					success: function (res) {
+						_this.current = res.data[0];
+						_this.initialization().formVal();
+					}
+				});
+				return _this;
+			};
+			//表单赋值
+			formData.formVal = function () {
+				var _this = this;
+				form.val(this.formLayFilter, this.current);
+				return this;
+			};
+			//合并表单内容
+			formData.fusionData = function (obj) {
+				this.current = $.extend(this.current, obj);
+				return this;
+			};
+			//提交新增修改
+			formData.submitInfo = function () {
+				var _this = this;
+				$.ajax({
+					type: 'POST',
+					url: this.save_data,//+'?userId='+this.guid
+					data: JSON.stringify(this.current),
+					contentType: 'application/json',
+					success: function (res) {
+
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							_this.closeModal();
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+				return false;
+			};
+			formData.main();
+			//验证规则
+			form.verify({
+				nickname: function (value) {
+					if (!new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$").test(value)) {
+						return '账号必须以英文字母开头,只能包含英文字母、数字、下划线';
+					}
+					if (/(^\_)|(\__)|(\_+$)/.test(value)) {
+						return '账号首尾不能出现下划线\'_\'';
+					}
+				},
+				checkName: function (value) {
+				},
+				phoneNumber: function (value) {
+					if (value) {
+						if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+							return '请输入正确的手机号码';
+						}
+					}
+					return false;
+				},
+				password: function (value) {
+					if (location.searchObj().guid) {
+						if (value) {
+							if (!(/^[\S]{6,12}$/).test(value)) {
+								return '密码必须6到12位,且不能出现空格';
+							}
+						}
+						return false;
+					}
+					if (!(/^[\S]{6,12}$/).test(value)) {
+						return '密码必须6到12位,且不能出现空格';
+					}
+				},
+				resspaword: function (value) {
+					var pass = $('#L_pass').val();
+					if (value != pass) {
+						return '两次密码不一致';
+					}
+				},
+				ageLength: [
+					/^[0-9]{0,2}$/,
+					'年龄必须0到2位,且只能是数字'
+				],
+				jobLength: [
+					/^[a-z\A-Z\u4e00-\u9fa5_]{0,10}$/,
+					'职务必须是0-10位,且不包含特殊字符与数字'
+				],
+				workUnit: [
+					/^[0-9\a-z\A-Z\u4e00-\u9fa5_]{0,25}$/,
+					'工作单位必须是0-25位,且不包含特殊字符'
+				],
+				vcode: [
+					/^[\w]{4,5}$/,
+					'验证码不符合规则'
+				]
+			});
+		});
+	</script>
+</body>
+
+</html>

+ 203 - 0
forstpages/pdinfo/add_change3.html

@@ -0,0 +1,203 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: 100% !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+	</style>
+</head>
+
+<body>
+	<form class="layui-form" action="" lay-filter="addForm" style="padding: 20px 20px 0 0">
+		<div class="layui-form-item" style="padding-left: 20px;">
+			<div class="ui-required">请输入本次要生成的溯源码数量</div>
+			<div class="">
+				<input type="text" name="qrcodeCount" maxlength="32" lay-verify="required|number" placeholder="溯源码数量"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item layui-layer-btn">
+			<div class="layui-input-block">
+				<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">取消</button>
+				<button class="layui-btn" lay-submit lay-filter="formDemo">确定</button>
+			</div>
+		</div>
+	</form>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(["form", 'layer', 'laytpl', 'jquery'], function () {
+			var form = layui.form,
+				layer = layui.layer,
+				laytpl = layui.laytpl,
+				$ = layui.jquery;
+			var funcName = "pdinfo2";
+			var formData = {
+				current: { guid: location.searchObj().guid }, //当前表单数据
+				save_data: "pdinfo_qrcode", //保存
+				closeModal: function () { //关闭当前窗口
+					parent.layer.close(parent.layer.getFrameIndex(window.name));
+				}
+			};
+			//初始化
+			formData.main = function () {
+				var _this = this;
+				if (this.guid) {
+					_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+				}
+				//监听提交
+				form.on('submit(formDemo)', function (obj) {
+					//必须return false;
+					return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+				});
+				//关闭窗口
+				$("#closeWin").on("click", function () {
+					_this.closeModal();
+				});
+				return _this;
+			};
+			//合并表单内容
+			formData.fusionData = function (obj) {
+				this.current = $.extend(this.current, obj);
+				return this;
+			};
+			//提交新增修改
+			formData.submitInfo = function () {
+				var _this = this;
+				var layerIndex = parent.layer.msg('生成中', {
+					time: 0,
+					shade: [0.8, '#000']
+				});
+				$.ajax({
+					type: 'POST',
+					url: _this.save_data,//+'?userId='+this.guid
+					data: JSON.stringify(_this.current),
+					contentType: 'application/json',
+					success: function (res) {
+						parent.layer.close(layerIndex);
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							_this.closeModal();
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+				return false;
+			};
+			formData.main();
+			//验证规则
+			form.verify({
+				nickname: function (value) {
+					if (!new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$").test(value)) {
+						return '账号必须以英文字母开头,只能包含英文字母、数字、下划线';
+					}
+					if (/(^\_)|(\__)|(\_+$)/.test(value)) {
+						return '账号首尾不能出现下划线\'_\'';
+					}
+				},
+				checkName: function (value) {
+				},
+				phoneNumber: function (value) {
+					if (value) {
+						if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+							return '请输入正确的手机号码';
+						}
+					}
+					return false;
+				},
+				password: function (value) {
+					if (location.searchObj().guid) {
+						if (value) {
+							if (!(/^[\S]{6,12}$/).test(value)) {
+								return '密码必须6到12位,且不能出现空格';
+							}
+						}
+						return false;
+					}
+					if (!(/^[\S]{6,12}$/).test(value)) {
+						return '密码必须6到12位,且不能出现空格';
+					}
+				},
+				resspaword: function (value) {
+					var pass = $('#L_pass').val();
+					if (value != pass) {
+						return '两次密码不一致';
+					}
+				},
+				ageLength: [
+					/^[0-9]{0,2}$/,
+					'年龄必须0到2位,且只能是数字'
+				],
+				jobLength: [
+					/^[a-z\A-Z\u4e00-\u9fa5_]{0,10}$/,
+					'职务必须是0-10位,且不包含特殊字符与数字'
+				],
+				workUnit: [
+					/^[0-9\a-z\A-Z\u4e00-\u9fa5_]{0,25}$/,
+					'工作单位必须是0-25位,且不包含特殊字符'
+				],
+				vcode: [
+					/^[\w]{4,5}$/,
+					'验证码不符合规则'
+				]
+			});
+		});
+	</script>
+</body>
+
+</html>

+ 119 - 0
forstpages/pdinfo/index.html

@@ -0,0 +1,119 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<!--操作模板-->
+	<script type="text/html" id="operatingTool">
+        <a class="layui-btn layui-btn-xs code-btn-0" lay-event="code">生成</a>
+        <a class="layui-btn layui-btn-xs view-btn-0" lay-event="view">查看</a>
+        <a class="layui-btn layui-btn-xs edit-btn-0" lay-event="edit">修改</a>
+        <a class="layui-btn layui-btn-danger layui-btn-xs del-btn-0" lay-event="del">删除</a>
+    </script>
+	<script type="text/html" id="operatingTool2">
+        <a class="layui-btn layui-btn-xs edit-btn-0" lay-event="edit">修改</a>
+        <a class="layui-btn layui-btn-danger layui-btn-xs del-btn-0" lay-event="del">删除</a>
+    </script>
+	<script type="text/html" id="checkboxTpl">
+        <!-- 这里的 checked 的状态只是演示 -->
+	<input type="checkbox" name="isForbid" id="{{d.guid}}" value="{{d.isForbid}}" title="可用" lay-filter="statusDemo"
+		{{ d.isForbid == 0 ? 'checked' : '' }}>
+	</script>
+</head>
+
+<body class="childrenBody">
+	<div class="layui-fluid">
+		<div class="layui-row layui-col-space15">
+			<div class="layui-inline layui-col-md3">
+				<div class="layui-card">
+					<div class="layui-card-body">
+						<form class="layui-form" action="" novalidate>
+							<div class="searching">
+								<div style="flex: 7;" class="search-box">
+									<i class="layui-icon layui-icon-search"></i>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="goodsName" autocomplete="off" type="text"
+											placeholder="请输入产品分类" />
+									</div>
+								</div>
+								<div style="padding-left: 5px;">
+									<button class="layui-btn layui-btn-normal" lay-submit lay-filter="DataSearch2"
+										layId="DataTable2">搜索</button>
+								</div>
+							</div>
+						</form>
+					</div>
+				</div>
+				<div class="layui-card">
+					<div class="layui-card-header">
+						<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;"
+							id="addBtn2" layId="addBtn2">新增产品分类</div>
+					</div>
+					<div class="layui-card-body">
+						<div class="layui-form news_list">
+							<table id="DataTable2" lay-filter="DataTable2" class="layui-table" lay-even lay-skin="nob"></table>
+						</div>
+					</div>
+				</div>
+			</div>
+			<div class="layui-inline layui-col-md9">
+				<div class="layui-card">
+					<div class="layui-card-body">
+						<form class="layui-form" action="" novalidate>
+							<div class="searching">
+								<div style="flex: 7;" class="search-box">
+									<i class="layui-icon layui-icon-search"></i>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input my-search" name="goodsName" autocomplete="off" type="text"
+											placeholder="请输入产品分类" />
+									</div>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input my-search" name="goodsBatchNo" autocomplete="off" type="text"
+											placeholder="请输入批次编码" />
+									</div>
+								</div>
+								<div style="padding-left: 5px;">
+									<button class="layui-btn layui-btn-normal" lay-submit lay-filter="DataSearch"
+										layId="DataTable">搜索</button>
+								</div>
+							</div>
+						</form>
+					</div>
+				</div>
+			</div>
+			<div class="layui-col-md9">
+				<div class="layui-card">
+					<div class="layui-card-header">
+						<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;"
+							id="addBtn" layId="addBtn">新增批次</div>
+					</div>
+					<div class="layui-card-body">
+						<div class="layui-form news_list">
+							<table id="DataTable" lay-filter="DataTable" class="layui-table" lay-even lay-skin="nob"></table>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+		loadJS("index.js");
+	</script>
+</body>
+
+</html>

+ 281 - 0
forstpages/pdinfo/index.js

@@ -0,0 +1,281 @@
+;
+layui.config({
+	base: "../../js/layuiPlugins/"
+}).use(['form', 'layer', 'jquery', 'table', 'laytpl'], function () {
+	var form = layui.form,
+		layer = layui.layer,
+		laytpl = layui.laytpl,
+		$ = layui.jquery,
+		table = layui.table;
+	var funcName = "pdinfo";
+	var funcName2 = "pdinfo2";
+	form.verify({
+		namelength: [
+			/^.{0,12}$/,
+			"长度限制在0-12个字符噢"
+		]
+	});
+	//批次的处理
+	//工具条处理
+	function toolOperating(obj) {
+		var data = obj.data;
+		if (obj.event === 'del') {
+			layer.confirm('真的删除吗?', function (index) {
+				layer.close(index);
+				var index1 = layer.msg('删除中,请稍候', {
+					icon: 16,
+					time: false,
+					shade: 0.8
+				});
+				$.ajax({
+					type: "get",
+					url: 'delete_' + funcName + '?guid=' + obj.data.guid,
+					success: function (res) {
+						layer.close(index1);
+						if (!(res.code - 0)) {
+							obj.del();
+							table.reload(funcName);
+						}
+					}
+				});
+			});
+		} else if (obj.event === 'edit') { //修改
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "修改",
+				area: ['80%', '80%'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=edit&guid=' + data.guid,
+				end: function () {
+					table.reload(funcName); //重新载入表格
+				}
+			});
+		} else if (obj.event === 'view') { //查看
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "查看",
+				area: ['80%', '80%'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=view&guid=' + data.guid,
+				end: function () {
+				}
+			});
+		} else if (obj.event === 'code') { //生成溯源码
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "生成溯源码",
+				area: ['300px', '240px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change3.html?event=code&guid=' + data.guid,
+				end: function () {
+				}
+			});
+		}
+	}
+
+	//列表
+	var DataList = {
+		id: funcName,
+		elem: '#DataTable',
+		url: funcName + 'List',
+		page: true,
+		method: "post",
+		contentType: 'application/json',
+		loading: true,
+		cellMinWidth: 80,
+		cols: [
+			[ //标题栏
+				{
+					field: 'goodsBatchNo',
+					title: '批次编码',
+					align: 'left',
+				}, {
+					field: 'goodsName',
+					title: '产品分类',
+					align: 'left',
+				}, {
+					field: 'goodsUnit',
+					title: '产品规格',
+					align: 'left',
+				}, {
+					field: 'goodsProductDate',
+					title: '生产日期',
+					align: 'center'
+				}, {
+					field: 'goodsExpired',
+					title: '保质期',
+					align: 'center'
+				}, {
+					field: 'operating',
+					title: '操作',
+					toolbar: '#operatingTool',
+					align: 'center',
+					fixed: 'right',
+					width: 240
+				}
+			]
+		] //设置表头
+		, done: function (res) {
+			resetButton(layui.sessionData(window.hywa.sessionTable.tableName).userData.menus.subMenuList, $);
+			//res.button.add ? $('.add-btn-0').show() : $('.add-btn-0').hide();
+		}
+	};
+
+	//执行默认渲染表格
+	table.render(DataList);
+
+	//监听产品工具事件条
+	table.on('tool(DataTable)', function (obj) {
+		toolOperating(obj);
+	});
+	//搜索响应函数
+	var infoSearch = function (obj) {
+
+		table.reload(funcName, { //执行重载
+			where: obj.field
+		});
+		return false;
+	};
+	//监听搜索表单事件
+	form.on("submit(DataSearch)", infoSearch);
+	var pdName = "", pid = "";
+	$("#addBtn").on("click", function () {
+		if (pdName == "") {
+			layer.msg("请先选择一个产品");
+			return;
+		}
+		layer.open({
+			type: 2,
+			anim: 0,
+			title: "新增",
+			area: ['90%', '90%'],
+			fixed: true,
+			scrollbar: true,
+			maxmin: true,
+			content: 'add_change.html?pdName=' + pdName + '&pid=' + pid,
+			end: function () {
+				table.reload(funcName);
+			}
+		});
+	});
+	//产品的处理
+	//工具条处理
+	function toolOperating2(obj) {
+		var data = obj.data;
+		if (obj.event === 'del') {
+			layer.confirm('真的删除吗?', function (index) {
+				layer.close(index);
+				var index1 = layer.msg('删除中,请稍候', {
+					icon: 16,
+					time: false,
+					shade: 0.8
+				});
+				$.ajax({
+					type: "get",
+					url: 'delete_' + funcName2 + '?guid=' + obj.data.guid,
+					success: function (res) {
+						layer.close(index1);
+						if (!(res.code - 0)) {
+							obj.del();
+							table.reload(funcName2);
+						}
+					}
+				});
+			});
+		} else if (obj.event === 'edit') { //修改
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "修改",
+				area: ['300px', '200px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change2.html?event=edit&guid=' + data.guid,
+				end: function () {
+					table.reload(funcName2); //重新载入表格
+				}
+			});
+		}
+	}
+
+	//列表
+	var DataList2 = {
+		id: funcName2,
+		elem: '#DataTable2',
+		url: funcName2 + 'List',
+		page: true,
+		method: "post",
+		contentType: 'application/json',
+		loading: true,
+		cellMinWidth: 80,
+		cols: [
+			[ //标题栏
+				{
+					field: 'goodsName',
+					title: '产品分类',
+					align: 'left',
+				}, {
+					field: 'operating',
+					title: '操作',
+					toolbar: '#operatingTool2',
+					align: 'center',
+					fixed: 'right',
+					width: 120
+				}
+			]
+		] //设置表头
+		, done: function (res) {
+			resetButton(layui.sessionData(window.hywa.sessionTable.tableName).userData.menus.subMenuList, $);
+			//res.button.add ? $('.add-btn-0').show() : $('.add-btn-0').hide();
+		}
+	};
+
+	//执行默认渲染表格
+	table.render(DataList2);
+
+	//监听产品工具事件条
+	table.on('tool(DataTable2)', function (obj) {
+		toolOperating2(obj);
+	});
+	table.on('row(DataTable2)', function (obj) {
+		$(".my-search")[0].value = obj.data.goodsName;
+		$(".my-search")[1].value = "";
+		pdName = obj.data.goodsName;
+		pid = obj.data.guid;
+		infoSearch({ field: { goodsName: obj.data.goodsName, goodsBatchNo: obj.data.goodsBatchNo, } })
+	});
+	//搜索响应函数
+	var infoSearch2 = function (obj) {
+		table.reload(funcName2, { //执行重载
+			where: obj.field
+		});
+		return false;
+	};
+	//监听搜索表单事件
+	form.on("submit(DataSearch2)", infoSearch2);
+	$("#addBtn2").on("click", function () {
+		layer.open({
+			type: 2,
+			anim: 0,
+			title: "新增",
+			area: ['300px', '200px'],
+			fixed: true,
+			scrollbar: true,
+			maxmin: true,
+			content: 'add_change2.html',
+			end: function () {
+				table.reload(funcName2);
+			}
+		});
+	});
+});

+ 217 - 0
forstpages/qrcode/add_change.html

@@ -0,0 +1,217 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+
+		.my-card {
+			position: relative;
+			display: inline-block;
+			width: 280px;
+			height: 135px;
+			border-radius: 5px;
+			box-shadow: 3px 3px 10px #cccccc;
+			margin: 5px;
+		}
+
+		img {
+			vertical-align: top;
+			width: 105px;
+			height: 105px;
+		}
+
+		.my-text {
+			position: relative;
+			display: inline-block;
+			width: 170px;
+			height: 30px;
+			text-align: left;
+			font-size: 14px;
+			margin-top: 5px;
+		}
+
+		.my-gray {
+			color: #8d8d8d;
+			font-size: 12px;
+		}
+
+		.my-button-div {
+			width: 100%;
+			height: 30px;
+			line-height: 30px;
+			border-top: 1px solid #e7e7e7;
+			background-color: #f7f9fa;
+			position: relative;
+			text-align: center;
+			cursor: pointer;
+		}
+
+		#codeListDiv {
+			height: 440px;
+			overflow: auto;
+		}
+	</style>
+</head>
+
+<body>
+	<div class="layui-form" id="codeListDiv">
+	</div>
+	<div class="layui-form-item layui-layer-btn">
+		<div style="text-align: center">
+			<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">关闭</button>
+		</div>
+	</div>
+	<script type="text/html" id="auxHtmlTpl">
+			{{# if(!d){d.list = []}; layui.each(d.list, function(index, item){ }}
+			<div class="my-card">
+				<img src="{{window.hywa.config.href}}/{{'images/'+item.qrcodeParentCode+'/'+item.qrcodeImg}}">
+				<div style="position:relative;display: inline-block;width:170px;">
+				<div class="my-text">溯源码:{{item.qrcode}}</div>
+				<div class="my-text my-gray">扫码数:{{item.scanCount}} 评论数:{{item.scanCount}}</div>
+				</div>
+				<div class="my-button-div" data-bind="{{item.guid}}">
+					废弃
+				</div>
+			</div>
+		{{# }); }}
+	</script>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(['layer', 'laytpl', 'jquery', 'flow'], function () {
+			var layer = layui.layer,
+				laytpl = layui.laytpl,
+				$ = layui.jquery,
+				flow = layui.flow;
+			var funcName = "qrcode";
+			var formData = {
+				guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
+				current: {
+					auxList: [],
+					imagesList: []
+				}, //当前表单数据
+				select_data: "view_qrcode", //查询
+				closeModal: function () { //关闭当前窗口
+					parent.layer.close(parent.layer.getFrameIndex(window.name));
+				}
+			};
+			//关闭窗口
+			$("#closeWin").on("click", function () {
+				formData.closeModal();
+			});
+			//获取当前信息
+			function onload(page, next) {
+				$.ajax({
+					url: formData.select_data,
+					method: 'post',
+					data: JSON.stringify({
+						guid: formData.guid, //当前ID
+						pageNum: page,
+						pageSize: 18
+					}),
+					contentType: 'application/json',
+					success: function (res) {
+						formData.current.dataList = res.data;
+						laytpl(auxHtmlTpl.innerHTML).render({
+							list: res.data
+						}, function (html) {
+							next(html, page < res.count / 18);
+							$(".button-delAux").on("click", function (e) {
+								var sortno = e.target.getAttribute("data-bind");
+							});
+						});
+						$(".my-button-div").on("click", function (e) {
+							var guid = e.target.getAttribute("data-bind");
+							var _this = this;
+							layer.confirm('确定废弃吗?', function (index) {
+								layer.close(index);
+								var index1 = layer.msg('处理中,请稍候', {
+									icon: 16,
+									time: false,
+									shade: 0.8
+								});
+								$.ajax({
+									url: "drop_single",
+									method: 'get',
+									data: {
+										guid: guid //当前ID
+									},
+									success: function (res) {
+										layer.close(index1);
+										//ggggg();
+										$(_this).parents('.my-card')[0].remove();
+									}
+								});
+							});
+						});
+					}
+				});
+			}
+			function ggggg() {
+				codeListDiv.innerHTML = '';
+				flow.load({
+					elem: "#codeListDiv",
+					isAuto: true,
+					scrollElem: "#codeListDiv",
+					done: function (page, next) {
+						onload(page, next);
+					}
+				});
+			}
+			ggggg();
+		});
+	</script>
+</body>
+
+</html>

BIN
forstpages/qrcode/bg.png


BIN
forstpages/qrcode/code.png


+ 101 - 0
forstpages/qrcode/index.html

@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<!--操作模板-->
+	<script type="text/html" id="operatingTool">
+		<a class="layui-btn layui-btn-xs view-btn-0" lay-event="print">打印</a>
+        <a class="layui-btn layui-btn-xs view-btn-0" lay-event="view">溯源预览</a>
+        <a class="layui-btn layui-btn-xs view-btn-0" lay-event="viewdetail">查看明细</a>
+        {{#if(d.originNum*1>d.cancelNum*1+d.usedNum*1){}}
+        <a class="layui-btn layui-btn-normal layui-btn-xs edit-btn-0" lay-event="export">导出</a>
+        {{#} }}
+        {{#if(d.originNum*1>d.cancelNum*1+d.usedNum*1){}}
+        <a class="layui-btn layui-btn-normal layui-btn-xs edit-btn-0" lay-event="drop">废弃</a>
+        {{#} }}
+        {{#if(d.originNum==d.cancelNum){}}
+        <a class="layui-btn layui-btn-danger layui-btn-xs del-btn-0" lay-event="del">删除</a>
+        {{#} }}
+    </script>
+	<script type="text/html" id="checkboxTpl">
+        <!-- 这里的 checked 的状态只是演示 -->
+	<input type="checkbox" name="isForbid" id="{{d.guid}}" value="{{d.isForbid}}" title="可用" lay-filter="statusDemo"
+		{{ d.isForbid == 0 ? 'checked' : '' }}>
+	</script>
+</head>
+
+<body class="childrenBody">
+	<div class="layui-fluid">
+		<div class="layui-row layui-col-space15">
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">溯源码管理</div>
+					<div class="layui-card-body">
+						<form class="layui-form" action="" novalidate>
+							<div class="searching">
+								<div style="flex: 7;" class="search-box">
+									<!--<div class="layui-input-inline">-->
+									<!--<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;" id="batchExportBtn" layId="batchExportBtn">导出</div>-->
+									<!--</div>-->
+									<!--<div class="layui-input-inline">-->
+									<!--<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;" id="batchDropBtn" layId="batchDropBtn">废弃</div>-->
+									<!--</div>-->
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="goodsName" autocomplete="off" type="text"
+											placeholder="请输入产品名称" />
+									</div>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="goodsBatchNo" autocomplete="off" type="text"
+											placeholder="请输入批次编码" />
+									</div>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="goodsParentQrcode" autocomplete="off" type="text"
+											placeholder="溯源码父码" />
+									</div>
+								</div>
+								<div style="padding-left: 5px;">
+									<button class="layui-btn layui-btn-normal" lay-submit lay-filter="DataSearch"
+										layId="DataTable">搜索</button>
+								</div>
+							</div>
+						</form>
+					</div>
+				</div>
+			</div>
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-body">
+						<div class="layui-form news_list">
+							<table id="DataTable" lay-filter="DataTable" class="layui-table" lay-even lay-skin="nob"></table>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
+		<embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="install_lodop.exe"></embed>
+	</object>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+		loadJS("../../js/LodopFuncs.js");
+		loadJS("index.js");
+	</script>
+</body>
+
+</html>

+ 281 - 0
forstpages/qrcode/index.js

@@ -0,0 +1,281 @@
+;
+layui.config({
+	base: "../../js/layuiPlugins/"
+}).use(['form', 'layer', 'jquery', 'table', 'laytpl'], function () {
+	var form = layui.form,
+		layer = layui.layer,
+		laytpl = layui.laytpl,
+		$ = layui.jquery,
+		table = layui.table;
+	var funcName = "qrcode";
+	form.verify({
+		namelength: [
+			/^.{0,12}$/,
+			"长度限制在0-12个字符噢"
+		]
+	});
+	//工具条处理
+	function toolOperating(obj) {
+		var data = obj.data;
+		if (obj.event === 'del') {
+			layer.confirm('真的删除吗?', function (index) {
+				layer.close(index);
+				var index1 = layer.msg('删除中,请稍候', {
+					icon: 16,
+					time: false,
+					shade: 0.8
+				});
+				$.ajax({
+					type: "get",
+					url: 'delete_' + funcName + '?guid=' + obj.data.guid,
+					success: function (res) {
+						layer.close(index1);
+						if (!(res.code - 0)) {
+							table.reload(funcName);
+						}
+					}
+				});
+			});
+		} else if (obj.event === 'viewdetail') { //查看
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "溯源码预览",
+				area: ['900px', '560px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=view&guid=' + data.guid,
+				end: function () {
+				}
+			});
+		} else if (obj.event === 'drop') { //废弃
+			layer.confirm('确定废弃吗?', function (index) {
+				layer.close(index);
+				var index1 = layer.msg('处理中,请稍候', {
+					icon: 16,
+					time: false,
+					shade: 0.8
+				});
+				$.ajax({
+					type: "get",
+					url: 'drop_' + funcName + '?guid=' + data.guid,
+					success: function (res) {
+						layer.close(index1);
+						if (!(res.code - 0)) {
+							table.reload(funcName);
+						}
+					}
+				});
+			});
+		} else if (obj.event === 'export') { //导出
+			var userInfo = layui.sessionData(window.hywa.sessionTable.tableName)
+			window.open(window.hywa.config.href + window.hywa.config.port.export_qrcode + "?guid=" + data.guid + "&accessToken=" + userInfo.token)
+		} else if (obj.event === 'view') { //预览
+			top.layer.open({
+				type: 2,
+				anim: 0,
+				title: "溯源码预览",
+				area: ['900px', '812px'],
+				fixed: true,
+				scrollbar: false,
+				maxmin: false,
+				shadeClose: true,
+				content: '../forstpages/qrcode/preview-code.html?guid=' + data.guid,
+				end: function () {
+				}
+			});
+		} else if (obj.event === 'print') {//打印
+			layer.prompt({
+				formType: 2,
+				value: '',
+				title: '请输入打印份数',
+				area: ['180px', '25px']
+			}, function (value, index, elem) {
+				if (/^[0-9]*[1-9][0-9]*$/.test(value)) {
+					let params = {
+						"fkBatchRecordGuid": data.guid,
+						"pageSize": value
+					}
+					$.ajax({
+						url: 'print_qrcode',
+						type: 'POST',
+						data: JSON.stringify(params),
+						contentType: 'application/json',
+						success: function (res) {
+							for (let i = 0; i < res.data.length; i++) {
+								console.log(res.data[i])
+								print(res.data[i])
+							}
+						}
+					});
+					layer.close(index);
+				} else {
+					layer.msg('请输入纯数字!');
+					return false;
+				}
+
+			});
+		}
+	}
+	//打印组件
+	function print(data) {
+		console.log(data)
+		let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM')),
+			hPos = 10, // 小票上边距
+			pageWidth = 620, // 小票宽度
+			rowHeight = 18 // 小票行距
+		// 初始化
+		LODOP.PRINT_INIT('打印初始化中')
+		LODOP.SET_PRINT_STYLEA(0, 'FontName', '黑体')
+		LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
+		LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
+		LODOP.ADD_PRINT_TEXT(hPos, 80, pageWidth, rowHeight, '企业名称:')
+		LODOP.ADD_PRINT_TEXT(hPos, 140, pageWidth, rowHeight, data.orgName)
+		hPos += rowHeight
+		LODOP.ADD_PRINT_TEXT(hPos, 80, pageWidth, rowHeight, '企业电话:')
+		LODOP.ADD_PRINT_TEXT(hPos, 140, pageWidth, rowHeight, data.companyTel)
+		hPos += rowHeight
+		LODOP.ADD_PRINT_TEXT(hPos, 80, pageWidth, rowHeight, '地址:')
+		LODOP.ADD_PRINT_TEXT(hPos, 110, pageWidth, rowHeight, data.orgAddress)
+		hPos += rowHeight
+		LODOP.ADD_PRINT_IMAGE(hPos, 110, 150, 150, '<img width="150" height="150" src="' + window.hywa.config.href + "/" + data.qrImgUrl + '">'); hPos += rowHeight
+		hPos += 135
+		LODOP.ADD_PRINT_TEXT(hPos, 80, pageWidth, rowHeight, '防伪码:')
+		LODOP.ADD_PRINT_TEXT(hPos, 130, pageWidth, rowHeight, data.qrcodeToken)
+		// LODOP.PREVIEW()
+		LODOP.PRINT()
+		var printArred = [];
+		printArred.push(data.guid)
+		setPrintDone(printArred)
+	}
+	//像服务器发送已启用打印的二维码
+	function setPrintDone(data) {
+		$.ajax({
+			url: 'setPrint_done',
+			type: 'POST',
+			data: JSON.stringify(data),
+			contentType: 'application/json',
+			success: function (res) {
+				console.log(res)
+			}
+		});
+	}
+	//列表
+	var DataList = {
+		id: funcName,
+		elem: '#DataTable',
+		url: funcName + 'List',
+		page: true,
+		method: "post",
+		contentType: 'application/json',
+		loading: true,
+		cellMinWidth: 80,
+		cols: [
+			[ //标题栏
+				{
+					field: 'goodsBatchNo',
+					title: '批次编码',
+					align: 'left',
+					width: 130
+				}, {
+					field: 'goodsName',
+					title: '产品名称',
+					align: 'left',
+					width: 180
+				}, {
+					field: 'goodsParentQrcode',
+					title: '溯源码父码',
+					align: 'left',
+					width: 120
+				}, {
+					field: 'qrcodeRecordTime',
+					title: '生成时间',
+					align: 'center',
+					width: 140
+				}, {
+					field: 'originNum',
+					title: '溯源码数量',
+					align: 'left',
+					width: 100
+				}, {
+					field: 'cancelNum',
+					title: '废弃数',
+					align: 'left',
+					width: 100
+				}, {
+					field: 'usedNum',
+					title: '已使用数',
+					align: 'left',
+					width: 100
+				}, {
+					field: 'scanNum',
+					title: '累计扫码数',
+					align: 'left',
+					width: 100
+				}, {
+					field: 'scanNum',
+					title: '累计评论数',
+					align: 'left',
+					width: 100
+				}, {
+					field: 'notPrintNum',
+					title: '未打印数量',
+					align: 'left',
+					width: 100
+				}, {
+					field: 'printNum',
+					title: '打印数量',
+					align: 'left',
+					width: 100
+				}, {
+					field: 'operating',
+					title: '操作',
+					toolbar: '#operatingTool',
+					align: 'center',
+					fixed: 'right',
+					width: 330
+				}
+			]
+		] //设置表头
+		, done: function (res) {
+			resetButton(layui.sessionData(window.hywa.sessionTable.tableName).userData.menus.subMenuList, $);
+			//res.button.add ? $('.add-btn-0').show() : $('.add-btn-0').hide();
+		}
+	};
+
+	//执行默认渲染表格
+	table.render(DataList);
+
+	//监听产品工具事件条
+	table.on('tool(DataTable)', function (obj) {
+		toolOperating(obj);
+	});
+	//搜索响应函数
+	var infoSearch = function (obj) {
+
+		table.reload(funcName, { //执行重载
+			where: obj.field
+		});
+		return false;
+	};
+	//监听搜索表单事件
+	form.on("submit(DataSearch)", infoSearch);
+
+	$("#addBtn").on("click", function () {
+		layer.open({
+			type: 2,
+			anim: 0,
+			title: "新增",
+			area: ['800px', '560px'],
+			fixed: true,
+			scrollbar: true,
+			maxmin: true,
+			content: 'add_change.html',
+			end: function () {
+				table.reload(funcName);
+			}
+		});
+	});
+
+});

+ 131 - 0
forstpages/qrcode/preview-code.html

@@ -0,0 +1,131 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<link rel="stylesheet" type="text/css" href="share/css/share.min.css" />
+	<style type="text/css">
+		.ui-center>* {
+			display: inline-block;
+			vertical-align: middle;
+			margin: 0;
+			padding: 0;
+		}
+
+		.ui-center:before {
+			content: "";
+			display: inline-block;
+			height: 100%;
+			width: 0;
+			vertical-align: middle;
+			visibility: hidden;
+		}
+
+		.box {
+			position: fixed;
+			top: 0;
+			bottom: 0;
+			left: 0;
+			right: 0;
+			overflow: hidden;
+			display: flex;
+		}
+
+		.iphone-box {
+			width: 375px;
+			height: 712px;
+			overflow: hidden;
+			background: url(bg.png) no-repeat center center;
+			background-size: 100% 100%;
+			position: relative;
+			margin: 20px;
+		}
+
+		.iphone-box iframe {
+			position: absolute;
+			margin: auto;
+			top: 0;
+			bottom: 0;
+			left: 0;
+			right: 0;
+			width: 328px;
+			height: 541px;
+			padding: 0;
+			border: 0;
+		}
+
+		.Q-code {
+			flex: 1;
+			text-align: center;
+		}
+	</style>
+</head>
+
+<body>
+	<div class="box">
+		<div class="iphone-box">
+			<iframe src="../../H5/index.html?pc=1"></iframe>
+		</div>
+		<div class="Q-code ui-center">
+			<div>
+				<p style="font-size: 38px;">扫一扫分享给朋友</p>
+				<img id="qrcodeImg" style="width: 300px;height: 300px;" src="">
+				<div id='share'></div>
+			</div>
+		</div>
+	</div>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script src="share/js/social-share.min.js" type="text/javascript" charset="utf-8"></script>
+	<script src="share/js/qrcode.js" type="text/javascript" charset="utf-8"></script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(['jquery'], function () {
+			var $ = layui.$;
+			//获取连接
+			$.ajax({
+				url: 'show_codeDetail',
+				data: location.searchObj(),
+				success: function (res) {
+					var elem = document.getElementById('qrcodeImg');
+					var iframe = document.querySelector('iframe');
+					try {
+						//配置二维码显示
+						elem.src = hywa.config.href + (res.data[0].imagesPath || '');
+
+						//配置pc端手机框显示,pc参数为真是pc展示,为假手机展示
+
+						iframe.src = res.data[0].qrcodeUrl + '&pc=1&vis=' + Math.random();
+
+						//配置分享
+						socialShare('#share', {
+							url: res.data[0].qrcodeUrl,
+							//sites:['qzone', 'qq', 'weibo','wechat'],
+							title: "朔源码预览",
+						});
+					} catch (e) {
+
+					}
+				}
+			});
+		});
+	</script>
+</body>
+
+</html>

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
forstpages/qrcode/share/css/share.min.css


BIN
forstpages/qrcode/share/fonts/iconfont.eot


+ 88 - 0
forstpages/qrcode/share/fonts/iconfont.svg

@@ -0,0 +1,88 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata>
+Created by FontForge 20120731 at Sat Nov 28 22:48:50 2015
+ By Ads
+</metadata>
+<defs>
+<font id="iconfont" horiz-adv-x="1024" >
+  <font-face 
+    font-family="iconfont"
+    font-weight="500"
+    font-stretch="normal"
+    units-per-em="1024"
+    panose-1="2 0 6 3 0 0 0 0 0 0"
+    ascent="896"
+    descent="-128"
+    x-height="792"
+    bbox="-0.097561 -77 1024.92 839"
+    underline-thickness="50"
+    underline-position="-100"
+    unicode-range="U+0078-F20A"
+  />
+<missing-glyph horiz-adv-x="374" 
+d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
+    <glyph glyph-name=".notdef" horiz-adv-x="374" 
+d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
+    <glyph glyph-name=".null" horiz-adv-x="0" 
+ />
+    <glyph glyph-name="nonmarkingreturn" horiz-adv-x="341" 
+ />
+    <glyph glyph-name="x" unicode="x" horiz-adv-x="1001" 
+d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
+t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
+t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
+    <glyph glyph-name="uniF00A" unicode="&#xf00a;" 
+d="M911 512l-334 1q19 79 23 116q4 45 -3 76q-11 47 -34 90q-6 12 -17 18.5t-24 6.5h-65q-13 0 -23.5 -6.5t-17 -17t-6.5 -23.5v-35v-32v-26q0 -10 -1 -11q-12 -26 -26.5 -52t-29.5 -51.5t-32 -49.5q-6 -9 -11.5 -17t-11.5 -16t-12.5 -16t-13.5 -15q-13 -14 -13 -32v-411
+q0 -19 13 -33q28 -28 73 -28q323 1 440 1q13 0 24 6t17 17l119 203q6 11 9 22.5t3 23.5l1 244q0 13 -6.5 24t-17 17t-23.5 6zM155 445h-42q-13 0 -24 -6t-17 -17t-6 -24v-403q0 -19 13.5 -33t33.5 -14h42q13 0 23.5 6.5t17 17t6.5 23.5v403q0 20 -14 33.5t-33 13.5z" />
+    <glyph glyph-name="uniF01A" unicode="&#xf01a;" 
+d="M260 740q0 -41 -29.5 -69.5t-76.5 -28.5q-45 0 -74 28.5t-29 69.5q0 43 29 71t76 28t74.5 -28t29.5 -71zM57 -69v633h197v-633h-197zM371 361q0 89 -4 203h170l10 -88h4q61 103 194 103q103 0 165.5 -69t62.5 -204v-375h-197v351q0 137 -100 137q-72 0 -101 -74
+q-6 -12 -6 -49v-365h-198v430z" />
+    <glyph glyph-name="uniF03A" unicode="&#xf03a;" 
+d="M751 815v-142h-84q-46 0 -62 -19t-16 -58v-101h157l-21 -158h-136v-407h-164v407h-136v158h136v117q0 100 56 154.5t148 54.5q79 0 122 -6z" />
+    <glyph glyph-name="uniF04A" unicode="&#xf04a;" 
+d="M629 830h-245q-37 0 -69 -4t-71.5 -19t-71.5 -41q-37 -31 -56.5 -72.5t-19.5 -82.5q0 -46 22.5 -87t68.5 -68t106 -27h7h8q2 0 7.5 0.5t7.5 1t8 0.5q-1 -1 -2 -4t-1.5 -4t-1.5 -4l-2 -5q0 -1 -1 -3.5t-1.5 -4.5t-1 -4.5t-0.5 -5t-0.5 -5t-0.5 -5.5q0 -17 6.5 -33
+t11.5 -23t18 -23q-18 -1 -26.5 -1.5t-29 -2.5t-33.5 -4.5t-34 -6.5t-36.5 -9t-34 -12.5t-33.5 -16.5q-48 -28 -69.5 -66.5t-21.5 -75.5q0 -69 66.5 -117.5t188.5 -48.5q74 0 134.5 19t98.5 50.5t58.5 70t20.5 80.5q0 19 -3.5 36t-11.5 32t-15 26.5t-21 24.5t-23 21t-26 22
+l-43 32q-9 8 -14 12.5t-10.5 15.5t-5.5 22.5t6 23t11 17t16 16.5q24 18 37.5 30.5t30 33t24 45.5t7.5 56t-8.5 57.5t-24 46.5t-25.5 30t-26 22h74zM524 120q0 -36 -19.5 -64t-59.5 -44.5t-95 -16.5q-94 0 -151.5 39.5t-57.5 102.5q0 83 102 119q57 19 125 19h6h4
+q3 0 4.5 -0.5t3.5 -0.5h5q2 0 4 -1q75 -51 102 -81t27 -72zM429 494q-33 -33 -80 -33q-36 0 -66 21t-47 53.5t-26 67t-9 65.5q0 54 26 86q14 17 36.5 27.5t46.5 10.5q46 0 81.5 -37t51.5 -84.5t16 -92.5v-10q0 -4 -1 -10.5t-2 -12.5t-3.5 -13t-5.5 -13.5t-7.5 -13
+t-10.5 -11.5zM865 653v118h-59v-118h-119v-58h119v-118h59v118h118v58h-118z" />
+    <glyph glyph-name="uniF05A" unicode="&#xf05a;" 
+d="M540 185h370v370h-369l-1 85h285v114h-285v85h-142v-284h-256v-370h199v-258zM284 279v175h484v-175h-484zM853 100q-17 0 -33 -6.5t-27.5 -18t-18 -27.5t-6.5 -33.5t6.5 -33.5t18 -27.5t27.5 -18.5t33 -7q35 0 60 25.5t25 61t-25 60.5t-60 25zM597.5 100
+q-35.5 0 -60.5 -25t-25 -60.5t25 -61t60.5 -25.5t60 25.5t24.5 61t-24.5 60.5t-60 25zM171 100q-14 0 -27 -4t-23.5 -12t-18.5 -18.5t-12 -24t-4 -27.5q0 -35 24.5 -60.5t60 -25.5t60.5 25.5t25 60.5q0 18 -7 34t-18 27.5t-27 18t-33 6.5z" />
+    <glyph glyph-name="uniF06A" unicode="&#xf06a;" horiz-adv-x="1025" 
+d="M1024 702q-58 -26 -121 -34q33 20 57 50t36 67q-63 -37 -134 -51q-62 66 -153 66q-57 0 -105.5 -28t-76.5 -76.5t-28 -105.5q0 -8 0.5 -16t2 -16t2.5 -16q-129 7 -241.5 65t-191.5 155q-13 -24 -20.5 -51t-7.5 -55q0 -36 11.5 -69t32.5 -60t49 -46q-50 2 -95 26v-2
+q0 -76 48 -134t121 -72q-27 -8 -56 -8q-5 0 -10 1h-10q-5 1 -9.5 1.5t-9.5 1.5q20 -63 74 -103.5t122 -42.5q-36 -28 -77.5 -48t-88 -31t-95.5 -11q-25 0 -50 3q147 -94 322 -94q112 0 210 35.5t168 95t120.5 136.5t75 161.5t24.5 169.5q0 14 -1 27q8 5 15.5 11t14.5 12
+l14 14q7 6 13.5 12.5t13 14t12 14.5t11.5 15t11 16z" />
+    <glyph glyph-name="uniF07A" unicode="&#xf07a;" 
+d="M435 826q-94 -21 -163.5 -85.5t-98.5 -155.5t-8 -186q7 -34 21 -66q4 -9 12.5 -15t18 -7t18.5 3q15 6 20.5 20.5t-0.5 28.5q-11 25 -17 53q-17 74 6 146t78 123t129.5 67.5t145.5 -6.5t121.5 -78.5t67 -130t-6 -146.5t-77.5 -123t-130 -67q-44 -10 -89 -5q-15 1 -27 -9
+t-13.5 -25t8.5 -27.5t25 -13.5q56 -6 112 7q94 20 164 85t98.5 155.5t8 185t-84.5 164.5t-154.5 99t-184.5 9zM542 339q57 13 88 62t18 106q-8 37 -33 64.5t-60.5 39t-72.5 3.5q-57 -13 -88 -62t-19 -106q5 -21 16 -41q-70 -81 -105 -197t-16 -239q2 -16 14.5 -25t28.5 -7
+q1 1 2 1q14 3 22.5 15.5t6.5 26.5q-17 105 12.5 204.5t88.5 168.5q46 -25 97 -14z" />
+    <glyph glyph-name="uniF08A" unicode="&#xf08a;" 
+d="M767 277q-9 -8 -11 -13.5t0 -16.5l4 -24q-183 2 -297 18q-6 2 0 5l289 201q11 7 -1 9q-7 1 -19 3t-21 3l-9 1q-90 11 -190 11q-170 0 -303 -30h8q225 0 374 -23q7 -2 0 -6l-289 -206l-5 -4q-2 -4 5 -5q45 -6 94 -9q59 -4 116 -4q176 0 312 32l5 1q-19 -15 -63 -30
+l42 -226q2 -12 -1.5 -19t-11 -7.5t-18.5 4.5l-241 140q-24 15 -49 -1l-240 -139q-16 -9 -25 -2.5t-5 24.5l53 284q3 9 1.5 14t-8.5 12l-210 193q-9 8 -10.5 16t4.5 13t18 6l268 30q15 2 21 5.5t12 14.5l126 262q9 17 20.5 17t19.5 -17l118 -262q5 -13 11 -17t21 -6l277 -27
+q18 -2 21.5 -12t-9.5 -23z" />
+    <glyph glyph-name="uniF09A" unicode="&#xf09a;" 
+d="M704 547q-87 0 -163 -38t-120 -103q-22 -32 -33.5 -67t-11.5 -73q0 -41 14 -78h-18q-64 0 -124 18l-124 -56l30 102q-64 43 -101 105t-37 134q0 124 104.5 213t251.5 89q128 0 227 -70t122 -176h-17zM218 557q8 -7 17 -10.5t19 -3.5q22 0 36.5 14.5t14.5 35.5q0 11 -4 20
+t-11 16q-2 2 -4 3l-4 4l-4 2l-4 2l-4 2h-6l-4 2h-6q-21 0 -36 -15q-7 -7 -10.5 -16t-3.5 -20q0 -7 1.5 -13.5t5 -12t7.5 -10.5zM1008 266q0 -126 -116 -204l23 -87l-105 49q-50 -16 -106 -16q-124 0 -213 75.5t-89 182.5q0 70 40.5 129t110.5 93q23 11 47.5 18.5t50.5 11.5
+t53 4q126 0 215 -75t89 -181zM526.5 629.5q-14.5 14.5 -35 14.5t-34.5 -15q-7 -7 -11 -16t-4 -19q0 -20 14.5 -34.5t35 -14.5t35.5 14q7 8 10.5 16.5t3.5 18.5q0 21 -14.5 35.5zM603 312q9 0 16.5 3.5t13.5 9.5q13 13 13 29q0 8 -3.5 15.5t-9.5 13.5q-12 13 -30 13
+q-6 0 -11 -1.5t-10 -4.5t-9 -7q-13 -13 -13 -28q0 -12 6 -21.5t16 -15.5q5 -3 10 -4.5t11 -1.5zM775 323q12 -13 30.5 -13t31.5 13q3 3 5 6.5t4 7.5t2.5 8t0.5 8q0 6 -1.5 11t-4 10t-6.5 9q-13 13 -31.5 13t-30.5 -13q-5 -4 -7.5 -9t-4 -10t-1.5 -11q0 -9 3 -16.5t10 -13.5z
+" />
+    <glyph glyph-name="uniF10A" unicode="&#xf10a;" 
+d="M138 773h746v-84h-746v84zM820 273v328h-617v-328h617zM292 517h439v-160h-439v160zM686 83q41 63 76 143l-90 33q-35 -97 -81 -176h-156q-39 103 -88 176l-83 -33q51 -77 83 -143h-230v-83h789v83h-220z" />
+    <glyph glyph-name="uniF11A" unicode="&#xf11a;" 
+d="M911 223q-5 31 -17 61t-25.5 50.5t-26.5 37t-21 24.5l-8 9q5 44 -2.5 73t-17.5 36l-10 8q-2 62 -18.5 112.5t-39.5 81.5t-54 53.5t-57 32.5t-54 15.5t-38.5 6t-17.5 0.5q-6 0 -16.5 -0.5t-39 -6t-54 -15.5t-57 -32.5t-54.5 -53.5t-39.5 -81.5t-17.5 -112.5q-2 -1 -4.5 -3
+t-9.5 -10t-10.5 -20.5t-7 -34t0.5 -49.5l-9 -9q-5 -5 -19.5 -23.5t-26.5 -38t-24.5 -50t-17.5 -61.5q-1 -4 -1 -10t1 -22t3.5 -28t9 -21t15.5 -8t25 17t37 50q23 -62 64 -117q-3 -1 -8 -3.5t-17.5 -10t-21.5 -17t-16 -26t-5 -34.5q0 -2 0.5 -4.5t3 -10t8 -14t17.5 -14.5
+t28 -13.5t42.5 -9t58.5 -2.5q13 1 32.5 4t59.5 17t55 36h30q31 -44 141 -56l6 -1q45 -1 78 5.5t47.5 15.5t23 21.5t9 17.5t0.5 8q2 18 -4.5 34t-16.5 26t-20.5 17.5t-18.5 10.5l-8 3q9 11 17 23.5t14 23.5l12 22q6 11 9.5 19.5t6.5 15t4 9.5l1 4q21 -34 37 -50t25.5 -17
+t15.5 8t8.5 21t3.5 28t1 23v9v0z" />
+    <glyph glyph-name="uniF12A" unicode="&#xf12a;" horiz-adv-x="1026" 
+d="M0 242q0 65 40 140t113 147q96 97 195.5 134.5t140.5 -3.5q36 -36 11 -119q-2 -9 0 -12t5 -4t8 0t8 2l3 1q80 34 141.5 34t87.5 -35q25 -35 0 -101q-1 -8 -3 -11t3 -7.5t7 -5.5t9 -3q33 -10 59.5 -26.5t45 -47t19.5 -66.5q0 -39 -20.5 -79t-62.5 -79t-96 -66.5t-129 -48
+t-155 -17.5t-157.5 19.5t-137 52.5t-98.5 87t-37 114zM104 201q5 -55 51 -97t118.5 -62t156.5 -12q128 13 211 80.5t76 151.5q-5 54 -50 96t-120 62.5t-157 12.5q-127 -13 -211 -80.5t-75 -151.5zM237 151q-24 52 3 106q27 53 86.5 80t120.5 10q63 -16 90.5 -67.5
+t1.5 -109.5t-90.5 -85t-127.5 -7q-62 19 -84 73zM283 166q5 -21 24.5 -30t43 -1t35.5 28q11 18 6 38.5t-25 28.5q-20 9 -42.5 0.5t-33.5 -25.5q-13 -20 -8 -39zM403 247q-10 -19 8 -27q8 -2 16 1t12 10q6 8 2.5 16t-10.5 10q-7 3 -16 0t-12 -10zM666 746q-3 16 5 30.5
+t25 16.5q70 14 139.5 -6.5t118.5 -76.5q50 -56 65 -128.5t-8 -137.5q-5 -16 -19.5 -23t-30 -2t-22.5 19.5t-3 29.5q16 47 6 98t-46 90q-36 40 -85 54.5t-98 5.5q-17 -3 -30 6t-17 24zM699 616q-3 15 5.5 26t20.5 14q35 8 68.5 -2.5t57.5 -37t31 -62.5t-3 -68
+q-5 -12 -17.5 -19t-25.5 -2t-20 17.5t-2 25.5q11 36 -13.5 62.5t-61.5 20.5q-13 -3 -25 4t-15 21z" />
+    <glyph glyph-name="uniF20A" unicode="&#xf20a;" 
+d="M945 677q-23 37 -54.5 64t-68.5 42.5t-79 18.5q-148 7 -228 -101l-1 2q-1 1 -2 1q0 -3 -3 -3q-80 108 -228 101q-60 -3 -113 -36t-89 -89q-26 -41 -36 -89.5t-5 -99t25 -102.5t54 -98q53 -69 89 -110q122 -134 282 -240l21 -15h6l21 15q78 52 150 113t132 127
+q11 13 24 28.5t22.5 28t22 28t20.5 25.5q69 94 79.5 200.5t-41.5 188.5z" />
+  </font>
+</defs></svg>

BIN
forstpages/qrcode/share/fonts/iconfont.ttf


BIN
forstpages/qrcode/share/fonts/iconfont.woff


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
forstpages/qrcode/share/js/jquery.share.min.js


Datei-Diff unterdrückt, da er zu groß ist
+ 146 - 0
forstpages/qrcode/share/js/qrcode.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
forstpages/qrcode/share/js/social-share.min.js


+ 629 - 0
forstpages/region/add_change.html

@@ -0,0 +1,629 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+
+		.my-button {
+			width: 60%;
+			margin-left: 20%;
+			height: 40px;
+			text-align: center;
+			line-height: 40px;
+			border: 1px dashed;
+			border-radius: 5px;
+		}
+
+		.my-inline {
+			display: inline-block;
+			float: left;
+			text-align: center;
+			height: 38px;
+			line-height: 38px;
+			width: 10%;
+		}
+
+		.my-images-inline {
+			display: inline-block;
+			width: 104px;
+			height: 104px;
+			border: 1px dashed;
+			border-radius: 5px;
+			padding: 4px;
+			vertical-align: top;
+			margin: 4px;
+		}
+
+		.my-img {
+			width: 100%;
+			height: 100%;
+		}
+
+		.my-images-add {
+			display: inline-block;
+			text-align: center;
+			line-height: 103px;
+			font-size: 32px;
+			cursor: pointer;
+			background-color: #fbfbfb;
+		}
+
+		.my-del {
+			background-color: black;
+			color: white;
+		}
+
+		.button-delImage {
+			position: relative;
+			left: -2px;
+			top: -106px;
+		}
+	</style>
+	<script type="text/html" id="typeHtmlTpl">
+		<option value="">请选择</option>
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+		<option value="{{item.guid}}">{{item.fieldName}}</option>
+		{{# }); }}
+	</script>
+</head>
+
+<body>
+	<form class="layui-form" action="" lay-filter="addForm">
+		<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
+			<ul class="layui-tab-title">
+				<li class="layui-this">基础信息</li>
+				<li>自定义信息</li>
+				<li>图片视频</li>
+			</ul>
+			<div class="layui-tab-content">
+				<input type="hidden" id="oneMap" value="">
+				<div class="layui-tab-item layui-show">
+					<div class="layui-form-item" style="display:none;">
+						<label class="layui-form-label ui-required">产地名称</label>
+						<div class="layui-input-block">
+							<select name="guid" class="layui-input search-input" lay-filter="roles" id="rolesView"></select>
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label ui-required">产地名称</label>
+						<div class="layui-input-block">
+							<input type="text" name="fieldName" maxlength="32" lay-verify="required" placeholder="请输入产地名称"
+								autocomplete="off" class="layui-input">
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label ui-required">经营产品</label>
+						<div class="layui-input-block">
+							<input type="text" name="saleGoodsRange" maxlength="32" lay-verify="required" placeholder="请输入经营产品"
+								autocomplete="off" class="layui-input">
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label ui-required">产地面积</label>
+						<div class="layui-input-block">
+							<input type="text" name="fieldArea" maxlength="50" lay-verify="required|length50" placeholder="请输入产地面积"
+								autocomplete="off" class="layui-input">
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label ui-required">产地地址</label>
+						<div id="address" class="layui-input-block">
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label">详细地址</label>
+						<div class="layui-input-block">
+							<input type="text" name="fieldAddress" maxlength="100" placeholder="请输入详细地址" autocomplete="off"
+								class="layui-input">
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label ui-required">产地简介</label>
+						<div class="layui-input-block">
+							<textarea name="remark" maxlength="1000" placeholder="请输入产地简介" autocomplete="off"
+								class="layui-textarea" rows="4"></textarea>
+						</div>
+					</div>
+					<div class="layui-form-item layui-layer-btn">
+						<div class="layui-input-block">
+							<button type="reset" class="layui-btn layui-btn-primary close-win">取消</button>
+							<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+						</div>
+					</div>
+				</div>
+				<div class="layui-tab-item">
+					<div id="auxListDiv"></div>
+					<div class="layui-form-item">
+						<div class="my-button">+添加</div>
+					</div>
+					<div class="layui-form-item layui-layer-btn">
+						<div class="layui-input-block">
+							<button type="reset" class="layui-btn layui-btn-primary close-win">取消</button>
+							<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+						</div>
+					</div>
+				</div>
+				<div class="layui-tab-item">
+					<div id="imageListDiv"></div>
+					图片视频上传完毕后请记得按保存哦
+					<div class="layui-form-item layui-layer-btn">
+						<div class="layui-input-block">
+							<button type="reset" class="layui-btn layui-btn-primary close-win">取消</button>
+							<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</form>
+	<script type="text/html" id="auxHtmlTpl">
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+			<div class="layui-form-item">
+				<label class="layui-form-label">自定义项{{index+1}}:</label>
+				<div class="my-inline" style="width: 20%">
+					<input type="text" name="auxItme" maxlength="20" lay-verify="required" placeholder="标题" autocomplete="off" class="layui-input" value="{{item.auxItme}}">
+				</div>
+				<div class="my-inline">--</div>
+				<div class="my-inline" style="width: 40%">
+					<input type="text" name="auxItmeVal" maxlength="100" lay-verify="required" placeholder="项" autocomplete="off" class="layui-input" value="{{item.auxItmeVal}}">
+				</div>
+				<div class="my-inline">
+					<i class="layui-icon my-del button-delAux" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
+				</div>
+			</div>
+		{{# }); }}
+	</script>
+	<script type="text/html" id="imageHtmlTpl">
+		<div class="layui-form-item">
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+			<div class="my-images-inline">
+				{{#if ("jpg|jpeg|png|gif|bmp".indexOf(item.substring(item.lastIndexOf(".")+1))==-1){}}
+				<video class="my-img" src="{{window.hywa.config.href}}/{{item}}" autoplay loop></video>
+				{{#}else{}}
+				<img class="my-img" src="{{window.hywa.config.href}}/{{item}}">
+				{{#} }}
+				<i class="layui-icon my-del button-delImage" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
+			</div>
+		{{# }); }}
+			<div class="my-images-inline my-images-add" id="imageUploadBtn">+</div>
+		</div>
+	</script>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(["form", 'layer', 'laytpl', 'jquery', 'cascade', 'element', 'upload'], function () {
+			var form = layui.form,
+				layer = layui.layer,
+				laytpl = layui.laytpl,
+				cascade = layui.cascade,
+				$ = layui.jquery,
+				element = layui.element,
+				upload = layui.upload;
+			var funcName = "region";
+			var formData = {
+				originList: [],
+				guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
+				current: { auxList: [], imagesList: [] }, //当前表单数据
+				select_data: "select_" + funcName, //查询
+				select_regionNameList: 'rnlist_' + funcName,
+				save_data: (location.searchObj().guid ? 'edit' : 'add') + '_' + funcName, //保存
+				formLayFilter: "addForm", //表单容器
+				closeModal: function () { //关闭当前窗口
+					parent.layer.close(parent.layer.getFrameIndex(window.name));
+				}
+			};
+			var option = {
+				elem: '#imageUploadBtn',
+				url: 'uploadImage',
+				accept: "file",
+				exts: "jpg|jpeg|png|gif|bmp|mp4|ogg|webm|avi|wma|rmvb|rm|flash|3gp|flv|mp3",
+				size: 10240,//kb
+				before: function () {
+					uploadMsg = layer.msg('正在上传中……', {
+						icon: 16,
+						fixed: false,
+						time: 0
+					});
+				},
+				done: function (res) {
+					layer.close(uploadMsg);
+					formData.current.imagesList.push(res.data[0]);
+					imageTpl({
+						elem: "#imageListDiv",
+						list: formData.current.imagesList
+					});
+				},
+				error: function () {
+				}
+			};
+			//初始化
+			formData.main = function () {
+				var _this = this;
+				if (this.guid) {
+					_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+				} else {
+					_this.initialization();
+					imageTpl({
+						elem: "#imageListDiv",
+						list: _this.current.imagesList
+					});
+				}
+				if (location.searchObj().event == "view") {
+					var el = document.getElementsByTagName("INPUT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].readOnly = true;
+					}
+					el = document.getElementsByTagName("SELECT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("checkbox");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("button");
+					for (var i = 0; i < el.length; i++) {
+						if (el[i].innerText.replace(" ", "") == "保存") {
+							el[i].style.display = "none";
+						}
+					}
+				}
+				return this;
+			};
+
+			//产地名称选择
+			form.on('select(roles)', function (data) {
+				var _this = this;
+				var guid = data.value;
+				if (guid !== "") {
+					let arr = formData.originList;
+					if (arr.length != 0) {
+						let result = arr.filter(item => {
+							return item['guid'] == data.value
+						})
+						formData.current['fieldName'] = result[0]['fieldName'];
+						formData.current['saleGoodsRange'] = result[0]['saleGoodsRange'];
+						formData.current['fieldArea'] = result[0]['fieldArea'];
+						formData.current['fieldAddress'] = result[0]['fieldAddress'];
+						formData.current['remark'] = result[0]['remark'];
+						formData.current['guid'] = result[0]['guid'];
+						formData.current['oneMap'] = result[0]['oneMap'];
+						console.info(result[0]['oneMap']);
+						form.val(formData.formLayFilter, formData.current);
+					}
+				} else {
+					formData.current['fieldName'] = '';
+					formData.current['saleGoodsRange'] = '';
+					formData.current['fieldArea'] = '';
+					formData.current['fieldAddress'] = '';
+					formData.current['remark'] = '';
+					formData.current['guid'] = '';
+					formData.current['oneMap'] = '';
+					form.val(formData.formLayFilter, formData.current);
+				}
+			})
+
+			//类型下拉列表模板
+			function SelectTpl(obj) {
+				laytpl(typeHtmlTpl.innerHTML).render(obj, function (html) {
+					$(obj.elem).html(html);
+					form.render();
+				});
+			}
+
+			//初始化
+			formData.initialization = function () {
+				var _this = this;
+
+				//获取产地名称列表
+				$.ajax({
+					url: this.select_regionNameList,
+					method: 'get',
+					data: {
+						customerId: '229'
+					},
+					success: function (res) {
+						formData.originList = res.data
+						SelectTpl({
+							elem: "#rolesView",
+							list: res.data
+						});
+						form.val(_this.formLayFilter, _this.current);
+					}
+				});
+
+				//初始化地区
+				cascade.render({
+					elem: "#address",
+					hostParm: {
+						idName: 'parentId'
+					},
+					url: {
+						provinceId: 'areaSearch',
+						cityId: 'areaSearch',
+						countyId: 'areaSearch'
+					},
+					listParamName: {
+						valueName: 'code',
+						name: 'name'
+					},
+					width: {
+						provinceId: '8em',
+						cityId: '8em',
+						countyId: '8em',
+						townId: '8em'
+					}
+				}).val({
+					provinceId: this.current.provinceId,
+					cityId: this.current.cityId,
+					countyId: this.current.countyId
+				});
+
+				//监听提交
+				form.on('submit(formDemo)', function (obj) {
+					//必须return false;
+					return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+				});
+
+				//关闭窗口
+				$(".close-win").on("click", function () {
+					_this.closeModal();
+				});
+
+				$(".my-button").on("click", function () {
+					_this.current.auxList.push({ i: _this.current.auxList.length + 1, auxItme: "", auxItmeVal: "" });//数据库里把item写成itme
+					for (var i = _this.current.auxList.length - 1; i >= 0; i--) {
+						if ($("input[name='auxItme']")[i]) {
+							_this.current.auxList[i].auxItme = $("input[name='auxItme']")[i].value;
+							_this.current.auxList[i].auxItmeVal = $("input[name='auxItmeVal']")[i].value;
+						}
+					}
+					typeTpl({
+						elem: "#auxListDiv",
+						list: _this.current.auxList
+					});
+				});
+				return _this;
+			};
+			//获取当前信息
+			formData.getCurrent = function (id) {
+				var _this = this;
+				$.ajax({
+					url: this.select_data,
+					method: 'get',
+					data: {
+						guid: id || this.guid //当前ID
+					},
+					success: function (res) {
+						if (!res.data[0].auxList)
+							res.data[0].auxList = [];
+						if (!res.data[0].imagesList)
+							res.data[0].imagesList = [];
+						_this.current = res.data[0];
+
+						typeTpl({
+							elem: "#auxListDiv",
+							list: res.data[0].auxList
+						});
+						imageTpl({
+							elem: "#imageListDiv",
+							list: res.data[0].imagesList
+						});
+
+						//禁止编辑基础信息
+						if (formData.save_data === 'edit_region') {
+							$("#rolesView").attr("disabled", 'disabled')
+						}
+						_this.initialization().formVal();
+					}
+				});
+				return _this;
+			};
+			//表单赋值
+			formData.formVal = function () {
+				var _this = this;
+				form.val(this.formLayFilter, this.current);
+				return this;
+			};
+			//合并表单内容
+			formData.fusionData = function (obj) {
+				var _this = this;
+				try {
+					for (var i = this.current.auxList.length - 1; i >= 0; i--) {
+						this.current.auxList[i].auxItme = $("input[name='auxItme']")[i].value;
+						this.current.auxList[i].auxItmeVal = $("input[name='auxItmeVal']")[i].value;
+						if (this.current.auxList[i].auxItme == "" && this.current.auxList[i].auxItmeVal == "")
+							this.current.auxList.splice(i, 1);
+					}
+					_this.current.fieldImages = _this.current.imagesList.join(",");
+					this.current = $.extend(this.current, obj);
+				} catch (e) {
+					console.log(e)
+				}
+
+				return this;
+			};
+			//提交新增修改
+			formData.submitInfo = function () {
+				var _this = this;
+				if (!this.current.countyId || this.current.countyId == "") {
+					layer.msg("必须选择省市县地址");
+					return false;
+				}
+				this.current.fkPostionId = this.current.countyId;
+				if ("edit_region" === this.save_data) {
+					this.current.guid = _this.guid;
+				}
+				$.ajax({
+					type: 'POST',
+					url: this.save_data,//+'?userId='+this.guid
+					data: JSON.stringify(this.current),
+					contentType: 'application/json',
+					success: function (res) {
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							_this.closeModal();
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+				return false;
+			};
+			//自定义项列表模板
+			function typeTpl(obj) {
+				laytpl(auxHtmlTpl.innerHTML).render(obj, function (html) {
+					$(obj.elem).html(html);
+					$(".button-delAux").on("click", function (e) {
+						var sortno = e.target.getAttribute("data-bind");
+						for (var i = formData.current.auxList.length - 1; i >= 0; i--) {
+							if ($("input[name='auxItme']")[i]) {
+								formData.current.auxList[i].auxItme = $("input[name='auxItme']")[i].value;
+								formData.current.auxList[i].auxItmeVal = $("input[name='auxItmeVal']")[i].value;
+							}
+						}
+						formData.current.auxList.splice(sortno, 1);
+						typeTpl({
+							elem: "#auxListDiv",
+							list: formData.current.auxList
+						});
+					});
+				});
+			}
+
+			//图片列表模板
+			function imageTpl(obj) {
+				laytpl(imageHtmlTpl.innerHTML).render(obj, function (html) {
+					$(obj.elem).html(html);
+					upload.render(option);
+					$(".button-delImage").on("click", function (e) {
+						formData.current.imagesList.splice(e.target.getAttribute("data-bind"), 1);
+						imageTpl({
+							elem: "#imageListDiv",
+							list: formData.current.imagesList
+						});
+					});
+				});
+			}
+
+			formData.main();
+			//验证规则
+			form.verify({
+				nickname: function (value) {
+					if (!new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$").test(value)) {
+						return '账号必须以英文字母开头,只能包含英文字母、数字、下划线';
+					}
+					if (/(^\_)|(\__)|(\_+$)/.test(value)) {
+						return '账号首尾不能出现下划线\'_\'';
+					}
+				},
+				checkName: function (value) {
+				},
+				phoneNumber: function (value) {
+					if (value) {
+						if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+							return '请输入正确的手机号码';
+						}
+					}
+					return false;
+				},
+				password: function (value) {
+					if (location.searchObj().guid) {
+						if (value) {
+							if (!(/^[\S]{6,12}$/).test(value)) {
+								return '密码必须6到12位,且不能出现空格';
+							}
+						}
+						return false;
+					}
+					if (!(/^[\S]{6,12}$/).test(value)) {
+						return '密码必须6到12位,且不能出现空格';
+					}
+				},
+				resspaword: function (value) {
+					var pass = $('#L_pass').val();
+					if (value != pass) {
+						return '两次密码不一致';
+					}
+				},
+				ageLength: [
+					/^[0-9]{0,2}$/,
+					'年龄必须0到2位,且只能是数字'
+				],
+				jobLength: [
+					/^[a-z\A-Z\u4e00-\u9fa5_]{0,10}$/,
+					'职务必须是0-10位,且不包含特殊字符与数字'
+				],
+				workUnit: [
+					/^[0-9\a-z\A-Z\u4e00-\u9fa5_]{0,25}$/,
+					'工作单位必须是0-25位,且不包含特殊字符'
+				],
+				vcode: [
+					/^[\w]{4,5}$/,
+					'验证码不符合规则'
+				],
+				length50: [
+					/^.{0,50}$/,
+					"长度必须0-50个字符"
+				]
+			});
+		});
+	</script>
+</body>
+
+</html>

+ 84 - 0
forstpages/region/index.html

@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<!--操作模板-->
+	<script type="text/html" id="operatingTool">
+        <a class="layui-btn layui-btn-xs view-btn-0" lay-event="view">查看</a>
+        <a class="layui-btn layui-btn-xs edit-btn-0" lay-event="edit">修改</a>
+        <a class="layui-btn layui-btn-danger layui-btn-xs del-btn-0" lay-event="del">删除</a>
+    </script>
+	<script type="text/html" id="checkboxTpl">
+        <!-- 这里的 checked 的状态只是演示 -->
+	<input type="checkbox" name="isForbid" id="{{d.guid}}" value="{{d.isForbid}}" title="可用" lay-filter="statusDemo"
+		{{ d.isForbid == 0 ? 'checked' : '' }}>
+	</script>
+</head>
+
+<body class="childrenBody">
+	<div class="layui-fluid">
+		<div class="layui-row layui-col-space15">
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">产地信息管理</div>
+					<div class="layui-card-body">
+						<form class="layui-form" action="" novalidate>
+							<div class="searching">
+								<div style="flex: 7;" class="search-box">
+									<i class="layui-icon layui-icon-search"></i>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="fieldName" autocomplete="off" type="text"
+											placeholder="请输入产地名称" />
+									</div>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="saleGoodsRange" autocomplete="off" type="text"
+											placeholder="请输入经营产品名称" />
+									</div>
+								</div>
+								<div style="padding-left: 5px;">
+									<button class="layui-btn layui-btn-normal" lay-submit lay-filter="DataSearch"
+										layId="DataTable">搜索</button>
+								</div>
+							</div>
+						</form>
+					</div>
+				</div>
+			</div>
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">
+						产地列表
+						<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;"
+							id="addBtn" layId="addBtn">新增</div>
+					</div>
+					<div class="layui-card-body">
+						<div class="layui-form news_list">
+							<table id="DataTable" lay-filter="DataTable" class="layui-table" lay-even lay-skin="nob"></table>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+		loadJS("index.js");
+	</script>
+</body>
+
+</html>

+ 155 - 0
forstpages/region/index.js

@@ -0,0 +1,155 @@
+;
+layui.config({
+	base: "../../js/layuiPlugins/"
+}).use(['form', 'layer', 'jquery', 'table', 'laytpl'], function () {
+	var form = layui.form,
+		layer = layui.layer,
+		laytpl = layui.laytpl,
+		$ = layui.jquery,
+		table = layui.table;
+	var funcName = "region";
+	form.verify({
+		namelength: [
+			/^.{0,12}$/,
+			"长度限制在0-12个字符噢"
+		]
+	});
+	//工具条处理
+	function toolOperating(obj) {
+		var data = obj.data;
+		if (obj.event === 'del') {
+			layer.confirm('真的删除吗?', function (index) {
+				layer.close(index);
+				var index1 = layer.msg('删除中,请稍候', {
+					icon: 16,
+					time: false,
+					shade: 0.8
+				});
+				$.ajax({
+					type: "get",
+					url: 'delete_' + funcName + '?guid=' + obj.data.guid,
+					success: function (res) {
+						layer.close(index1);
+						if (!(res.code - 0)) {
+							obj.del();
+							table.reload(funcName);
+						}
+					}
+				});
+			});
+		} else if (obj.event === 'edit') { //修改
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "修改",
+				area: ['800px', '560px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=edit&guid=' + data.guid,
+				end: function () {
+					table.reload(funcName); //重新载入表格
+				}
+			});
+		} else if (obj.event === 'view') { //查看
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "查看",
+				area: ['800px', '560px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=view&guid=' + data.guid,
+				end: function () {
+				}
+			});
+		}
+	}
+
+	//列表
+	var DataList = {
+		id: funcName,
+		elem: '#DataTable',
+		url: funcName + 'List',
+		page: true,
+		method: "post",
+		contentType: 'application/json',
+		loading: true,
+		cellMinWidth: 80,
+		cols: [
+			[ //标题栏
+				{
+					field: 'fieldName',
+					title: '产地名称',
+					align: 'left',
+					width: 300
+				}, {
+					field: 'saleGoodsRange',
+					title: '经营产品',
+					align: 'left',
+				}, {
+					field: 'fieldArea',
+					title: '产地面积',
+					align: 'left',
+					width: 140
+				}, {
+					field: 'fieldAddress',
+					title: '产地地址',
+					align: 'center'
+				}, {
+					field: 'remark',
+					title: '产地简介',
+					align: 'left',
+					templet: '<div>{{d.remark.substring(0,30)}}</div>'
+				}, {
+					field: 'operating',
+					title: '操作',
+					toolbar: '#operatingTool',
+					align: 'center',
+					fixed: 'right',
+					width: 180
+				}
+			]
+		] //设置表头
+		, done: function (res) {
+			resetButton(layui.sessionData(window.hywa.sessionTable.tableName).userData.menus.subMenuList, $);
+			//res.button.add ? $('.add-btn-0').show() : $('.add-btn-0').hide();
+		}
+	};
+
+	//执行默认渲染表格
+	table.render(DataList);
+
+	//监听产品工具事件条
+	table.on('tool(DataTable)', function (obj) {
+		toolOperating(obj);
+	});
+	//搜索响应函数
+	var infoSearch = function (obj) {
+
+		table.reload(funcName, { //执行重载
+			where: obj.field
+		});
+		return false;
+	};
+	//监听搜索表单事件
+	form.on("submit(DataSearch)", infoSearch);
+
+	$("#addBtn").on("click", function () {
+		layer.open({
+			type: 2,
+			anim: 0,
+			title: "新增",
+			area: ['800px', '600px'],
+			fixed: true,
+			scrollbar: true,
+			maxmin: true,
+			content: 'add_change.html',
+			end: function () {
+				table.reload(funcName);
+			}
+		});
+	});
+
+});

+ 278 - 0
forstpages/role/add_change.html

@@ -0,0 +1,278 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: 100% !important;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+	</style>
+	<script type="text/html" id="typeHtmlTpl">
+		<option value="">请选择</option>
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+		<option value="{{item.guid}}">{{item.roleName}}</option>
+		{{# }); }}
+	</script>
+</head>
+
+<body>
+	<form class="layui-form" action="" lay-filter="addForm" style="padding: 20px 20px 0 0">
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">角色名称</label>
+			<div class="layui-input-block">
+				<input type="text" name="roleName" maxlength="32" lay-verify="required" placeholder="请输入角色名称" autocomplete="off"
+					class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label">备注</label>
+			<div class="layui-input-block">
+				<textarea type="text" name="remark" maxlength="200" autocomplete="off" class="layui-textarea"></textarea>
+			</div>
+		</div>
+		<div class="layui-form-item layui-layer-btn">
+			<div class="layui-input-block">
+				<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">取消</button>
+				<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+			</div>
+		</div>
+	</form>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(["form", 'layer', 'laytpl', 'jquery'], function () {
+			var form = layui.form,
+				layer = layui.layer,
+				laytpl = layui.laytpl,
+				$ = layui.jquery;
+			var funcName = "role";
+			var formData = {
+				guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
+				roleTableDataId: "roleDataList", //数据ID
+				current: {}, //当前表单数据
+				select_data: "select_" + funcName, //查询用户
+				save_data: (location.searchObj().guid ? 'edit' : 'add') + '_' + funcName, //查询用户
+				formLayFilter: "addForm", //表单容器
+				closeModal: function () { //关闭当前窗口
+					parent.layer.close(parent.layer.getFrameIndex(window.name));
+				}
+			};
+			//类型下拉列表模板
+			function typeTpl(obj) {
+				laytpl(typeHtmlTpl.innerHTML).render(obj, function (html) {
+					$(obj.elem).html(html);
+					form.render();
+				});
+			}
+
+			//初始化
+			formData.main = function () {
+				var _this = this;
+				if (this.guid) {
+					_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+				} else {
+					_this.initialization();
+
+				}
+				if (location.searchObj().event == "view") {
+					var el = document.getElementsByTagName("INPUT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].readOnly = true;
+					}
+					el = document.getElementsByTagName("textarea");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("checkbox");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("button");
+					for (var i = 0; i < el.length; i++) {
+						if (el[i].innerText.replace(" ", "") == "保存") {
+							el[i].style.display = "none";
+						}
+					}
+				}
+				return this;
+			};
+
+			//初始化
+			formData.initialization = function () {
+				var _this = this;
+				//监听提交
+				form.on('submit(formDemo)', function (obj) {
+					//必须return false;
+					return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+				});
+				//关闭窗口
+				$("#closeWin").on("click", function () {
+					_this.closeModal();
+				});
+				return _this;
+			};
+			//获取当前信息
+			formData.getCurrent = function (id) {
+				var _this = this;
+				$.ajax({
+					url: this.select_data,
+					method: 'get',
+					data: {
+						guid: id || this.guid //当前ID
+					},
+					success: function (res) {
+						_this.current = res.data[0];
+						_this.initialization().formVal();
+					}
+				});
+				return _this;
+			};
+			//表单赋值
+			formData.formVal = function () {
+				var _this = this;
+				form.val(this.formLayFilter, this.current);
+				return this;
+			};
+			//合并表单内容
+			formData.fusionData = function (obj) {
+				this.current = $.extend(this.current, obj);
+				if (this.current.guid) {
+					delete this.current.password;
+				}
+				return this;
+			};
+			//提交新增修改
+			formData.submitInfo = function () {
+				var _this = this;
+				$.ajax({
+					type: 'POST',
+					url: this.save_data,//+'?userId='+this.guid
+					data: JSON.stringify(this.current),
+					contentType: 'application/json',
+					success: function (res) {
+
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							_this.closeModal();
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+				return false;
+			};
+			formData.main();
+			//验证规则
+			form.verify({
+				nickname: function (value) {
+					if (!new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$").test(value)) {
+						return '账号必须以英文字母开头,只能包含英文字母、数字、下划线';
+					}
+					if (/(^\_)|(\__)|(\_+$)/.test(value)) {
+						return '账号首尾不能出现下划线\'_\'';
+					}
+				},
+				checkName: function (value) {
+				},
+				phoneNumber: function (value) {
+					if (value) {
+						if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+							return '请输入正确的手机号码';
+						}
+					}
+					return false;
+				},
+				password: function (value) {
+					if (location.searchObj().guid) {
+						if (value) {
+							if (!(/^[\S]{6,12}$/).test(value)) {
+								return '密码必须6到12位,且不能出现空格';
+							}
+						}
+						return false;
+					}
+					if (!(/^[\S]{6,12}$/).test(value)) {
+						return '密码必须6到12位,且不能出现空格';
+					}
+				},
+				resspaword: function (value) {
+					var pass = $('#L_pass').val();
+					if (value != pass) {
+						return '两次密码不一致';
+					}
+				},
+				ageLength: [
+					/^[0-9]{0,2}$/,
+					'年龄必须0到2位,且只能是数字'
+				],
+				jobLength: [
+					/^[a-z\A-Z\u4e00-\u9fa5_]{0,10}$/,
+					'职务必须是0-10位,且不包含特殊字符与数字'
+				],
+				workUnit: [
+					/^[0-9\a-z\A-Z\u4e00-\u9fa5_]{0,25}$/,
+					'工作单位必须是0-25位,且不包含特殊字符'
+				],
+				vcode: [
+					/^[\w]{4,5}$/,
+					'验证码不符合规则'
+				]
+			});
+		});
+	</script>
+</body>
+
+</html>

+ 149 - 0
forstpages/role/auth.html

@@ -0,0 +1,149 @@
+<!DOCTYPE html>
+<html lang="en" style="background-color: #f2f2f2;">
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../layui/css/eleTree.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/systemTree.css" />
+	<link rel="stylesheet" type="text/css" href="../../iconfont/iconfont.css" />
+	<style>
+		.role-forbid {
+			margin-left: 15px;
+		}
+
+		.role-forbid i {
+			font-size: 16px;
+			color: red;
+			font-weight: bold
+		}
+	</style>
+</head>
+
+<body class="main-container">
+	<div class="layui-fluid">
+		<div class="layui-row layui-col-space1">
+			<div class="layui-col-xs12 layui-col-sm12 layui-col-md7">
+				<div class="system layui-card">
+					<div class="layui-card-body">
+						<div class="eleTree" id="menuTree" lay-filter="menuTree"></div>
+
+					</div>
+
+				</div>
+
+				<div class="layui-form-item layui-layer-btn">
+					<div class="layui-input-block">
+						<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">取消</button>
+						<button class="layui-btn" id="saveData">保存</button>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script>
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(['form', 'jquery', 'eleTree'], function () {
+			var form = layui.form,
+				$ = layui.jquery,
+				eleTree = layui.eleTree;
+			var treeObj, oData = [];
+			//保存权限
+			$('#saveData').on("click", function (obj) {
+				var checkedData = treeObj.getChecked(false, true);//获取已选节点(只取叶子节点,选取半选节点)
+				var postData = { guid: guid, menuList: [] };
+				for (var j = 0; j < oData.length; j++) {
+					oData[j].subMenuList = null;
+				}
+				for (var i = 0; i < checkedData.length; i++) {
+					for (var j = 0; j < oData.length; j++) {
+						if (checkedData[i].id == oData[j].id) {
+							postData.menuList.push(oData[j]);
+							break;
+						}
+					}
+				}
+				$.ajax({
+					type: 'POST',
+					url: "role_saveAuth",
+					data: JSON.stringify(postData),
+					contentType: 'application/json',
+					success: function (res) {
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							parent.layer.close(parent.layer.getFrameIndex(window.name));
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+			});
+			//关闭窗口
+			$("#closeWin").on("click", function () {
+				parent.layer.close(parent.layer.getFrameIndex(window.name));
+			});
+			var guid = location.searchObj().guid;
+			$.ajax({
+				type: "get",
+				url: 'role_getAuth?roleId=' + guid,
+				success: function (data) {
+					if (data.code === 0) {
+						var menuData = [];
+						var setMenuData = function (submenu, obj, lev) {//组装tree需要的数据
+							for (var i = 0; i < submenu.length; i++) {
+								oData.push(submenu[i]);
+								obj.push({
+									id: submenu[i].id,
+									label: submenu[i].funName,
+									spread: true,
+									checked: submenu[i].isChecked == 1 && lev > 2
+								});
+								if (submenu[i].subMenuList && submenu[i].subMenuList.length > 0) {
+									obj[i].children = [];
+									setMenuData(submenu[i].subMenuList, obj[i].children, lev + 1);
+								}
+							}
+						};
+						setMenuData(data.data, menuData, 0);
+						treeObj = eleTree.render({
+							elem: '#menuTree',
+							data: menuData,
+							showCheckbox: true,
+							defaultExpandAll: true,
+							expandOnClickNode: false
+						});
+					} else {
+						parent.layer.msg(res.msg, {
+							icon: 1
+						});
+					}
+				}
+			});
+			form.render();
+		});
+	</script>
+</body>
+
+</html>

+ 89 - 0
forstpages/role/index.html

@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<!--类型下拉模板-->
+	<script type="text/html" id="typeHtmlTpl">
+        <option value="">请选择</option>
+        {{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+        <option value="{{item.guid}}">{{item.roleName}}</option>
+        {{# }); }}
+    </script>
+	<!--操作模板-->
+	<script type="text/html" id="operatingTool">
+        <a class="layui-btn layui-btn-xs distrib-btn-0" lay-event="distrib">授权</a>
+        <a class="layui-btn layui-btn-xs view-btn-0" lay-event="view">查看</a>
+        <a class="layui-btn layui-btn-xs edit-btn-0" lay-event="edit">修改</a>
+        <a class="layui-btn layui-btn-danger layui-btn-xs del-btn-0" lay-event="del">删除</a>
+    </script>
+	<script type="text/html" id="checkboxTpl">
+        <!-- 这里的 checked 的状态只是演示 -->
+	<input type="checkbox" name="isForbid" id="{{d.guid}}" value="{{d.isForbid}}" title="可用" lay-filter="statusDemo"
+		{{ d.isForbid == 0 ? 'checked' : '' }}>
+	</script>
+</head>
+
+<body class="childrenBody">
+	<div class="layui-fluid">
+		<div class="layui-row layui-col-space15">
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">角色管理</div>
+					<div class="layui-card-body">
+						<form class="layui-form" action="" novalidate>
+							<div class="searching">
+								<div style="flex: 7;" class="search-box">
+									<i class="layui-icon layui-icon-search"></i>
+
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="userName" autocomplete="off" type="text"
+											placeholder="请输入角色名称" />
+									</div>
+								</div>
+								<div style="padding-left: 5px;">
+									<button class="layui-btn layui-btn-normal" lay-submit lay-filter="DataSearch"
+										layId="DataTable">搜索</button>
+								</div>
+							</div>
+						</form>
+					</div>
+				</div>
+			</div>
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">
+						角色列表
+						<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;"
+							id="addBtn" layId="addBtn">新增</div>
+					</div>
+					<div class="layui-card-body">
+						<div class="layui-form news_list">
+							<table id="DataTable" lay-filter="DataTable" class="layui-table" lay-even lay-skin="nob"></table>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+		loadJS("index.js");
+	</script>
+</body>
+
+</html>

+ 172 - 0
forstpages/role/index.js

@@ -0,0 +1,172 @@
+;
+layui.config({
+	base: "../../js/layuiPlugins/"
+}).use(['form', 'layer', 'jquery', 'table','laytpl'], function () {
+    var form = layui.form,
+        layer = layui.layer,
+        laytpl = layui.laytpl,
+        $ = layui.jquery,
+        table = layui.table;
+    var funcName = "role";
+    form.verify({
+        namelength: [
+            /^.{0,12}$/,
+            "长度限制在0-12个字符噢"
+        ]
+    });
+    //工具条处理
+    function toolOperating(obj) {
+        var data = obj.data;
+        if (obj.event === 'del') {
+            layer.confirm('真的删除吗?', function (index) {
+                layer.close(index);
+                var index1 = layer.msg('删除中,请稍候', {
+                    icon: 16,
+                    time: false,
+                    shade: 0.8
+                });
+                $.ajax({
+                    type: "get",
+                    url: 'delete_' + funcName + '?guid=' + obj.data.guid,
+                    success: function (res) {
+                        layer.close(index1);
+                        if (!(res.code - 0)) {
+                            obj.del();
+                            table.reload(funcName);
+                        }
+                    }
+                });
+            });
+        } else if (obj.event === 'edit') { //修改
+            layer.open({
+                type: 2,
+                anim: 0,
+                title: "修改",
+                area: ['800px', '470px'],
+                fixed: true,
+                scrollbar: true,
+                maxmin: true,
+                content: 'add_change.html?event=edit&guid=' + data.guid,
+                end: function () {
+                    table.reload(funcName); //重新载入表格
+                }
+            });
+        } else if (obj.event === 'view') { //查看
+            layer.open({
+                type: 2,
+                anim: 0,
+                title: "查看",
+                area: ['800px', '470px'],
+                fixed: true,
+                scrollbar: true,
+                maxmin: true,
+                content: 'add_change.html?event=view&guid=' + data.guid,
+                end: function () {
+                }
+            });
+        } else if (obj.event === 'distrib') { //授权
+            layer.open({
+                type: 2,
+                anim: 0,
+                title: "授权",
+                area: ['800px', '470px'],
+                fixed: true,
+                scrollbar: true,
+                maxmin: true,
+                content: 'auth.html?event=distrib&guid=' + data.guid,
+                end: function () {
+                }
+            });
+        }
+    }
+
+    //列表
+    var DataList = {
+        id: funcName,
+        elem: '#DataTable',
+        url: funcName + 'List',
+        page: true,
+        method: "post",
+        contentType: 'application/json',
+        loading: true,
+        cellMinWidth: 80,
+        cols: [
+            [ //标题栏
+                {
+                    field: 'roleName',
+                    title: '角色名称',
+                    align: 'left',
+                }, {
+                field: 'remark',
+                title: '备注',
+                align: 'left'
+            }, {
+                field: 'operating',
+                title: '操作',
+                toolbar: '#operatingTool',
+                align: 'center',
+                fixed: 'right',
+                width: 240
+            }
+            ]
+        ] //设置表头
+        , done: function (res) {
+            resetButton(layui.sessionData(window.hywa.sessionTable.tableName).userData.menus.subMenuList, $);
+        }
+    };
+
+    //执行默认渲染表格
+    table.render(DataList);
+
+    //监听产品工具事件条
+    table.on('tool(DataTable)', function (obj) {
+        toolOperating(obj);
+    });
+    //搜索响应函数
+    var infoSearch = function (obj) {
+        table.reload(funcName, { //执行重载
+            where: obj.field
+        });
+        return false;
+    };
+    //监听搜索表单事件
+    form.on("submit(DataSearch)", infoSearch);
+
+    //监听可用操作
+    form.on('checkbox(statusDemo)', function (obj) {
+        $.ajax({
+            url: 'forbidUser?guid=' + obj.elem.id + '&isForbid=' + this.value,
+            type: 'get',
+            contentType: 'application/json',
+            success: function (res) {
+                if (!(res.code - 0)) {
+                    parent.layer.msg(res.msg, {
+                        icon: 1
+                    });
+                    table.reload(funcName);
+                } else {
+                    layer.msg(res.msg, {
+                        icon: 2
+                    });
+                    obj.elem.checked = !obj.elem.checked;
+                    form.render();
+                }
+            }
+        });
+    });
+    $("#addBtn").on("click", function () {
+        layer.open({
+            type: 2,
+            anim: 0,
+            title: "新增",
+            area: ['800px', '470px'],
+            fixed: true,
+            scrollbar: true,
+            maxmin: true,
+            content: 'add_change.html',
+            end: function () {
+                table.reload(funcName);
+            }
+        });
+    });
+});

+ 540 - 0
forstpages/spread/index.html

@@ -0,0 +1,540 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		body {
+			font-family: 'Microsoft YaHei';
+		}
+
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		.my-head {
+			border: 1px solid #e9e9e9;
+			background-color: #fafafa;
+			color: #000000d8;
+		}
+
+		.mybox {
+			border-right: 1px solid #e9e9e9;
+			margin-right: 10px;
+			text-align: center;
+			font-size: 16px;
+			margin: 10px 0;
+		}
+
+		.mybox h2 {
+			margin-bottom: 15px;
+			font-weight: bold;
+		}
+
+		.no-border {
+			border: none;
+		}
+
+		.margin-top {
+			margin-top: 10px;
+		}
+
+		.text-right {
+			text-align: right;
+		}
+
+		.my-btn {
+			margin: 10px;
+		}
+
+		.my-head-1 {
+			border-bottom: 1px solid #e9e9e9;
+			padding-bottom: 10px;
+		}
+
+		.my-title {
+			line-height: 100%;
+			font-size: 16px;
+			padding-top: 10px;
+			color: #3398db;
+		}
+
+		.text-center {
+			text-align: center;
+		}
+
+		.article-title {
+			margin: 30px 0 5px 15px;
+		}
+
+		.article-content {
+			padding-top: 5px;
+			padding-left: 45px;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: 100% !important;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+
+		.my-middle {
+			line-height: 36px;
+
+		}
+
+		.my-button {
+			width: 60%;
+			margin-left: 20%;
+			height: 40px;
+			text-align: center;
+			line-height: 40px;
+			border: 1px dashed;
+			border-radius: 5px;
+		}
+
+		.my-inline {
+			display: inline-block;
+			float: left;
+			text-align: center;
+			height: 38px;
+			line-height: 38px;
+			width: 10%;
+		}
+
+		.my-images-inline {
+			display: inline-block;
+			width: 104px;
+			height: 104px;
+			border: 1px dashed;
+			border-radius: 5px;
+			padding: 4px;
+			vertical-align: top;
+			margin: 4px;
+			position: relative;
+		}
+
+		.my-images-inline .layui-icon {
+			position: absolute;
+			top: -10px;
+			right: -4px;
+			width: 17px;
+			height: 16px;
+			line-height: 16px;
+			z-index: 9999;
+		}
+
+		.my-img {
+			width: 100%;
+			height: 100%;
+		}
+
+		.my-images-add {
+			display: inline-block;
+			text-align: center;
+			line-height: 103px;
+			font-size: 32px;
+			cursor: pointer;
+			background-color: #fbfbfb;
+		}
+
+		.my-del {
+			background-color: black;
+			color: white;
+		}
+
+		.button-delImage.button-delAssayImage {
+			position: relative;
+			left: -2px;
+			top: -106px;
+		}
+	</style>
+	<script type="text/html" id="imageHtmlTpl">
+			<div class="layui-form-item">
+				{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+					<div class="my-images-inline">
+						{{#if ("jpg|jpeg|png|gif|bmp".indexOf(item.substring(item.lastIndexOf(".")+1))==-1){}}
+						<video class="my-img" src="{{window.hywa.config.href}}/{{item}}" autoplay loop></video>
+						{{#}else{}}
+						<img class="my-img" src="{{window.hywa.config.href}}/{{item}}">
+						{{#} }}
+						<i class="layui-icon my-del button-delImage" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
+					</div>
+				{{# }); }}
+				<div class="my-images-inline my-images-add" id="{{d.elem}}BTN">+</div>
+			</div>
+		</script>
+</head>
+
+<body class="childrenBody" style="padding: 15px 15px 65px 15px;">
+	<div class="layui-fluid">
+		<form class="layui-form" action="" lay-filter="addForm" style="background: #fff;">
+			<div class="layui-card">
+				<div class="layui-card-header my-head">企业信息:</div>
+				<div class="layui-card-body">
+					<div class="layui-form-item">
+						<label class="layui-form-label ui-required">企业名称:</label>
+						<div class="layui-input-block">
+							<input type="text" disabled="disabled" name="orgName" maxlength="50" lay-verify="required|normal"
+								placeholder="请输入企业名称" autocomplete="off" class="layui-input layui-disabled">
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label">企业地址:</label>
+						<div class="layui-input-block">
+							<input type="text" name="orgAddress" placeholder="请输入企业地址" maxLength="100" autocomplete="off"
+								class="layui-input">
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<div class="layui-inline">
+							<label class="layui-form-label ui-required">联系人:</label>
+							<div class="layui-input-block">
+								<input type="text" name="principals" lay-verify="required|normal" placeholder="请输入联系人姓名" maxLength="5"
+									autocomplete="off" class="layui-input">
+							</div>
+						</div>
+						<div class="layui-inline">
+							<label class="layui-form-label ui-required">联系电话:</label>
+							<div class="layui-input-block">
+								<input type="text" name="tel" lay-verify="required|normal" placeholder="请输入联系电话" maxLength="18"
+									autocomplete="off" class="layui-input">
+							</div>
+						</div>
+						<!-- <div class="layui-inline">
+								<label class="layui-form-label">企业电话:</label>
+								<div class="layui-input-block">
+									<input type="text" name="companyTel" lay-verify="" placeholder="请输入联系电话" maxLength="18" autocomplete="off"
+									 class="layui-input">
+								</div>
+							</div> -->
+						<div class="layui-inline">
+							<label class="layui-form-label">对外企业qq:</label>
+							<div class="layui-input-block">
+								<input type="text" name="qqCode" lay-verify="" placeholder="请输入qq号" maxLength="12" autocomplete="off"
+									class="layui-input">
+							</div>
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label">企业及品牌介绍:</label>
+						<div class="layui-input-block">
+							<textarea name="remark" placeholder="请输入企业及品牌介绍" class="layui-textarea"></textarea>
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label">企业LOGO</label>
+						<div class="layui-input-block">
+							<div id="imageListDivLOGO" style="display: flex;"></div>
+							<div class="layui-form-mid layui-word-aux">图片上传完毕后请记得按保存哦</div>
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label">企业相关资质</label>
+						<div class="layui-input-block">
+							<div id="imageListxgzz" style="display: flex;"></div>
+							<div class="layui-form-mid layui-word-aux">图片上传完毕后请记得按保存哦</div>
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label">企业公众号二维码</label>
+						<div class="layui-input-block">
+							<div id="imageListDiv" style="display: flex;"></div>
+							<div class="layui-form-mid layui-word-aux">图片上传完毕后请记得按保存哦</div>
+						</div>
+					</div>
+					<h2 style="font-size:18px;margin-bottom:18px;border-bottom: 1px solid #ddd;padding-bottom: 11px;">购买渠道</h2>
+					<div class="layui-form-item">
+						<label class="layui-form-label">天猫商城地址:</label>
+						<div class="layui-input-block">
+							<input type="text" name="tmallUrl" placeholder="天猫商城地址" maxLength="100" autocomplete="off"
+								class="layui-input">
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label">京东商城地址:</label>
+						<div class="layui-input-block">
+							<input type="text" name="jdUrl" placeholder="京东商城地址" maxLength="100" autocomplete="off"
+								class="layui-input">
+						</div>
+					</div>
+					<div class="layui-form-item">
+						<label class="layui-form-label">企业官网地址:</label>
+						<div class="layui-input-block">
+							<input type="text" name="companyUrl" placeholder="请输入企业官网" maxLength="100" autocomplete="off"
+								class="layui-input">
+						</div>
+					</div>
+					<div class="layui-form-item layui-layer-btn">
+						<div class="layui-input-block" style="padding-right: 20px;">
+							<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+						</div>
+					</div>
+				</div>
+			</div>
+		</form>
+	</div>
+</body>
+<script type="text/javascript">
+	function loadJS(url) {
+		document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+	}
+	loadJS("../../layui/layui.js");
+	loadJS("../../js/ajaxhook.min.js");
+	loadJS("../../js/config.js");
+</script>
+<script>
+	layui.use(["form", 'layer', 'jquery', 'laytpl', 'upload'], function () {
+		var form = layui.form,
+			layer = layui.layer,
+			$ = layui.jquery,
+			laytpl = layui.laytpl,
+			upload = layui.upload;
+		var formData = {
+			guid: true, //带参传入ID
+			current: {}, //当前表单数据
+			select_data: "select_Info_org", //查询企业
+			save_data: 'edit_Info_org', //查询企业
+			formLayFilter: "addForm", //表单容器
+			closeModal: function () { //关闭当前窗口
+				parent.layer.close(parent.layer.getFrameIndex(window.name));
+			}
+		};
+		//图片列表模板
+		function imageTpl(obj, name, model) {
+			laytpl(imageHtmlTpl.innerHTML).render(obj, function (html) {
+				let delelem = $("#" + obj.elem).html(html);
+				upload.render({
+					elem: "#" + obj.elem + "BTN",
+					url: 'uploadImage',
+					accept: "file",
+					exts: "jpg|jpeg|png|bmp|gif",
+					size: 10240, //kb
+					before: function () {
+						uploadMsg = layer.msg('正在上传中……', {
+							icon: 16,
+							fixed: false,
+							time: 0
+						});
+					},
+					done: function (res) {
+						layer.close(uploadMsg);
+						if (model === 'single') {
+							formData.current[name] = res.data[0];
+						} else {
+							let list;
+							if (formData.current[name] === "" || !formData.current[name]) {
+								list = []
+							} else {
+								list = formData.current[name].split(';')
+							}
+							list.push(res.data[0])
+							formData.current[name] = list.join(";");
+						}
+						imageTpl({
+							elem: obj.elem,
+							list: model === 'single' ? [formData.current[name]] : formData.current[name].split(";")
+						}, name, model);
+
+					},
+					error: function () { }
+				});
+				$(delelem[0].querySelectorAll('.button-delImage')).on("click", function (e) {
+					let showList;
+					if (model === 'single') {
+						formData.current[name] = ""
+						showList = []
+					} else {
+						let index = $(this).attr("data-bind");
+						let list = formData.current[name].split(";")
+						list.splice(index, 1)
+						formData.current[name] = list.join(";");
+						showList = formData.current[name].split(';')
+						if (list.length == 0) {
+							showList = [];
+							formData.current[name] = ""
+						}
+					}
+					imageTpl({
+						elem: obj.elem,
+						list: showList
+					}, name, model);
+				});
+			});
+		}
+		//初始化
+		formData.main = function () {
+			var _this = this;
+			if (this.guid) {
+				_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+			} else {
+				_this.initialization();
+			}
+			return this;
+		};
+
+		//初始化
+		formData.initialization = function () {
+			var _this = this;
+			// console.log(_this.current.qualificaImgs)
+			imageTpl({
+				elem: "imageListDiv",
+				list: _this.current.wxQRImg ? [_this.current.wxQRImg] : [],
+			}, 'wxQRImg', 'single');
+			imageTpl({
+				elem: "imageListDivLOGO",
+				list: _this.current.ico ? [_this.current.ico] : [],
+			}, 'ico', 'single');
+			imageTpl({
+				elem: "imageListxgzz",
+				list: _this.current.qualificaImgs ? _this.current.qualificaImgs.split(';') : [],
+			}, 'qualificaImgs', 'Multi');
+			//监听提交
+			form.on('submit(formDemo)', function (obj) {
+				//必须return false;
+				return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+			});
+			//关闭窗口
+			$("#closeWin").on("click", function () {
+				_this.closeModal();
+			});
+			return _this;
+		};
+		//获取当前信息
+		formData.getCurrent = function (id) {
+			var _this = this;
+			$.ajax({
+				url: this.select_data,
+				method: 'get',
+				data: {
+					guid: id || this.guid //当前ID
+				},
+				success: function (res) {
+					try {
+						_this.current = res.data[0] || {};
+
+					} catch (e) { }
+					_this.initialization().formVal();
+				}
+			});
+			return _this;
+		};
+		//表单赋值
+		formData.formVal = function () {
+			var _this = this;
+			form.val(this.formLayFilter, this.current);
+			return this;
+		};
+		//合并表单内容
+		formData.fusionData = function (obj) {
+			this.current = $.extend(this.current, obj);
+			if (this.current.guid) {
+				delete this.current.password;
+			}
+			return this;
+		};
+		//提交新增修改
+		formData.submitInfo = function () {
+			var _this = this;
+			// console.log(_this.current)
+			$.ajax({
+				type: 'POST',
+				url: this.save_data, //+'?userId='+this.guid
+				data: JSON.stringify(this.current),
+				contentType: 'application/json',
+				success: function (res) {
+					if (!(res.code - 0)) {
+						parent.layer.msg(res.msg, {
+							icon: 1
+						});
+						_this.closeModal();
+					} else {
+						layer.msg(res.msg, {
+							icon: 2
+						});
+					}
+				}
+			});
+			return false;
+		};
+		formData.main();
+		//验证规则
+		form.verify({
+			phoneNumber: function (value) {
+				if (value) {
+					if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+						return '请输入正确的手机号码';
+					}
+				}
+				return false;
+			},
+			normal: function () {
+				return false;
+			}
+		});
+	});
+</script>
+
+</html>

+ 332 - 0
forstpages/user/add_change.html

@@ -0,0 +1,332 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<style type="text/css">
+		.ui-required:before {
+			content: "*";
+			color: red;
+			vertical-align: middle;
+		}
+
+		#roleSelectViwe .layui-form-item {
+			margin-bottom: 0
+		}
+
+		#roleSelectViwe .layui-input-inline {
+			width: calc(100% - 110px);
+			margin-right: 0;
+		}
+
+		.region {
+			padding-left: 10px;
+			height: 38px;
+			line-height: 38px;
+			background-color: #fff;
+			border-radius: 2px;
+			border: 1px solid #e6e6e6;
+			width: 100% !important;
+			width: calc(100% - 132px) !important;
+		}
+
+		.userTip {
+			color: #666;
+			font-size: 12px;
+		}
+
+		.userTip b {
+			color: #333;
+		}
+	</style>
+	<script type="text/html" id="typeHtmlTpl">
+		<option value="">请选择</option>
+		{{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+		<option value="{{item.guid}}">{{item.roleName}}</option>
+		{{# }); }}
+	</script>
+</head>
+
+<body>
+	<form class="layui-form" action="" lay-filter="addForm" style="padding: 20px 20px 0 0">
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">账号</label>
+			<div class="layui-input-block">
+				<input type="text" name="account" maxlength="32" lay-verify="required|nickname" placeholder="请输入账号"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<label class="layui-form-label ui-required">角色</label>
+			<div class="layui-input-block">
+				<select name="roleId" lay-verify="required" lay-filter="roles" id="rolesView"></select>
+			</div>
+		</div>
+		<div class="layui-form-item">
+			<div class="layui-inline" id="nameBox">
+				<label class="layui-form-label">姓名</label>
+				<div class="layui-input-inline" style="width: 300px;">
+					<input type="text" name="userName" maxlength="10" placeholder="请输入姓名" autocomplete="off" class="layui-input">
+				</div>
+			</div>
+			<div class="layui-inline">
+				<label class="layui-form-label">手机号码</label>
+				<div class="layui-input-block">
+					<input type="text" name="mobileNo" lay-verify="phoneNumber" placeholder="请输入手机号码" maxLength="11"
+						autocomplete="off" class="layui-input">
+				</div>
+			</div>
+		</div>
+		<div class="layui-form-item" id="whetherPassword">
+			<label class="layui-form-label ui-required">登录密码</label>
+			<div class="layui-input-block">
+				<input type="password" id="L_pass" name="passwd" maxlength="32" lay-verify="password" placeholder="请输入密码"
+					autocomplete="off" class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item" id="whetherPassword1">
+			<label class="layui-form-label ui-required">确认密码</label>
+			<div class="layui-input-block">
+				<input type="password" lay-verify="resspaword" maxlength="32" placeholder="请再次输入密码" autocomplete="off"
+					class="layui-input">
+			</div>
+		</div>
+		<div class="layui-form-item layui-layer-btn">
+			<div class="layui-input-block">
+				<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">取消</button>
+				<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
+			</div>
+		</div>
+	</form>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+	</script>
+	<script type="text/javascript">
+		layui.config({
+			base: "../../js/layuiPlugins/"
+		}).use(["form", 'layer', 'laytpl', 'jquery'], function () {
+			var form = layui.form,
+				layer = layui.layer,
+				laytpl = layui.laytpl,
+				$ = layui.jquery;
+			var funcName = "user";
+			/**
+			 * 存在guid就是修改
+			 */
+			if (location.searchObj().guid) {
+				whetherPassword.remove();
+				whetherPassword1.remove();
+			}
+			var formData = {
+				guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
+				roleTableDataId: "roleDataList", //数据ID
+				current: {}, //当前表单数据
+				roleListPort: "roleList", //角色数据接口
+				select_data: "select_" + funcName, //查询用户
+				save_data: (location.searchObj().guid ? 'edit' : 'add') + '_' + funcName, //查询用户
+				roleSelectView: "#rolesView", //角色列表下拉容器
+				formLayFilter: "addForm", //表单容器
+				closeModal: function () { //关闭当前窗口
+					parent.layer.close(parent.layer.getFrameIndex(window.name));
+				}
+			};
+			//类型下拉列表模板
+			function typeTpl(obj) {
+				laytpl(typeHtmlTpl.innerHTML).render(obj, function (html) {
+					$(obj.elem).html(html);
+					form.render();
+				});
+			}
+
+			//初始化
+			formData.main = function () {
+				var _this = this;
+				if (this.guid) {
+					_this.getCurrent(_this.guid); //获取并初始化表单角色信息
+				} else {
+					_this.initialization();
+
+				}
+				if (location.searchObj().event == "view") {
+					var el = document.getElementsByTagName("INPUT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].readOnly = true;
+					}
+					el = document.getElementsByTagName("SELECT");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("checkbox");
+					for (var i = 0; i < el.length; i++) {
+						el[i].disabled = true;
+					}
+					el = document.getElementsByTagName("button");
+					for (var i = 0; i < el.length; i++) {
+						if (el[i].innerText.replace(" ", "") == "保存") {
+							el[i].style.display = "none";
+						}
+					}
+				}
+				return this;
+			};
+
+			//初始化
+			formData.initialization = function () {
+				var _this = this;
+				//初始化地区
+				//初始化角色权限下拉
+				$.ajax({
+					url: this.roleListPort,
+					method: 'post',
+					contentType: "application/json",
+					data: JSON.stringify({}),
+					success: function (res) {
+						typeTpl({
+							elem: "#rolesView",
+							list: res.data
+						});
+						form.val(_this.formLayFilter, _this.current);
+					}
+				});
+				//监听提交
+				form.on('submit(formDemo)', function (obj) {
+					//必须return false;
+					return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
+				});
+				//关闭窗口
+				$("#closeWin").on("click", function () {
+					_this.closeModal();
+				});
+				return _this;
+			};
+			//获取当前信息
+			formData.getCurrent = function (id) {
+				var _this = this;
+				$.ajax({
+					url: this.select_data,
+					method: 'get',
+					data: {
+						guid: id || this.guid //当前ID
+					},
+					success: function (res) {
+						_this.current = res.data[0];
+						delete _this.current.passwd;
+						_this.initialization().formVal();
+					}
+				});
+				return _this;
+			};
+			//表单赋值
+			formData.formVal = function () {
+				var _this = this;
+				form.val(this.formLayFilter, this.current);
+				return this;
+			};
+			//合并表单内容
+			formData.fusionData = function (obj) {
+				this.current = $.extend(this.current, obj);
+				if (this.current.guid) {
+					delete this.current.password;
+				}
+				return this;
+			};
+			//提交新增修改
+			formData.submitInfo = function () {
+				var _this = this;
+				$.ajax({
+					type: 'POST',
+					url: this.save_data,//+'?userId='+this.guid
+					data: JSON.stringify(this.current),
+					contentType: 'application/json',
+					success: function (res) {
+
+						if (!(res.code - 0)) {
+							parent.layer.msg(res.msg, {
+								icon: 1
+							});
+							_this.closeModal();
+						} else {
+							layer.msg(res.msg, {
+								icon: 2
+							});
+						}
+					}
+				});
+				return false;
+			};
+			formData.main();
+			//验证规则
+			form.verify({
+				nickname: function (value) {
+					if (!new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$").test(value)) {
+						return '账号必须以英文字母开头,只能包含英文字母、数字、下划线';
+					}
+					if (/(^\_)|(\__)|(\_+$)/.test(value)) {
+						return '账号首尾不能出现下划线\'_\'';
+					}
+				},
+				checkName: function (value) {
+				},
+				phoneNumber: function (value) {
+					if (value) {
+						if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
+							return '请输入正确的手机号码';
+						}
+					}
+					return false;
+				},
+				password: function (value) {
+					if (location.searchObj().guid) {
+						if (value) {
+							if (!(/^[\S]{6,12}$/).test(value)) {
+								return '密码必须6到12位,且不能出现空格';
+							}
+						}
+						return false;
+					}
+					if (!(/^[\S]{6,12}$/).test(value)) {
+						return '密码必须6到12位,且不能出现空格';
+					}
+				},
+				resspaword: function (value) {
+					var pass = $('#L_pass').val();
+					if (value != pass) {
+						return '两次密码不一致';
+					}
+				},
+				ageLength: [
+					/^[0-9]{0,2}$/,
+					'年龄必须0到2位,且只能是数字'
+				],
+				jobLength: [
+					/^[a-z\A-Z\u4e00-\u9fa5_]{0,10}$/,
+					'职务必须是0-10位,且不包含特殊字符与数字'
+				],
+				workUnit: [
+					/^[0-9\a-z\A-Z\u4e00-\u9fa5_]{0,25}$/,
+					'工作单位必须是0-25位,且不包含特殊字符'
+				],
+				vcode: [
+					/^[\w]{4,5}$/,
+					'验证码不符合规则'
+				]
+			});
+		});
+	</script>
+</body>
+
+</html>

+ 99 - 0
forstpages/user/index.html

@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html>
+
+<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">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="format-detection" content="telephone=no">
+	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
+	<link rel="stylesheet" type="text/css" href="../../forstcss/common.css" />
+	<!--类型下拉模板-->
+	<script type="text/html" id="typeHtmlTpl">
+        <option value="">请选择</option>
+        {{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
+        <option value="{{item.guid}}">{{item.roleName}}</option>
+        {{# }); }}
+    </script>
+	<!--操作模板-->
+	<script type="text/html" id="operatingTool">
+        <a class="layui-btn layui-btn-xs view-btn-0" lay-event="view">查看</a>
+        <a class="layui-btn layui-btn-xs edit-btn-0" lay-event="edit">修改</a>
+        <a class="layui-btn layui-btn-danger layui-btn-xs del-btn-0" lay-event="del">删除</a>
+        <a class="layui-btn layui-btn-danger layui-btn-xs del-btn-0" lay-event="reset">重置密码</a>
+    </script>
+	<script type="text/html" id="checkboxTpl">
+        <!-- 这里的 checked 的状态只是演示 -->
+	<input type="checkbox" name="isForbid" id="{{d.guid}}" value="{{d.isForbid}}" title="可用" lay-filter="statusDemo"
+		{{ d.isForbid == 0 ? 'checked' : '' }}>
+	</script>
+</head>
+
+<body class="childrenBody">
+	<div class="layui-fluid">
+		<div class="layui-row layui-col-space15">
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">用户管理</div>
+					<div class="layui-card-body">
+						<form class="layui-form" action="" novalidate>
+							<div class="searching">
+								<div style="flex: 7;" class="search-box">
+									<i class="layui-icon layui-icon-search"></i>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="account" autocomplete="off" type="text"
+											placeholder="请输入账号" />
+									</div>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="userName" autocomplete="off" type="text"
+											placeholder="请输入姓名" />
+									</div>
+									<div class="layui-input-inline">
+										<input class="layui-input search-input" name="mobileNo" autocomplete="off" type="text"
+											placeholder="请输入手机号码" />
+									</div>
+									<div class="layui-input-inline">
+										<select name="roleId" class="layui-input search-input" lay-filter="roles" id="rolesView"></select>
+									</div>
+								</div>
+								<div style="padding-left: 5px;">
+									<button class="layui-btn layui-btn-normal" lay-submit lay-filter="DataSearch"
+										layId="DataTable">搜索</button>
+								</div>
+							</div>
+						</form>
+					</div>
+				</div>
+			</div>
+			<div class="layui-col-md12">
+				<div class="layui-card">
+					<div class="layui-card-header">
+						用户列表
+						<div class="layui-btn layui-btn-normal layui-btn-sm add-btn-0" style="width: 8em;margin-left: 1em;"
+							id="addBtn" layId="addBtn">新增</div>
+					</div>
+					<div class="layui-card-body">
+						<div class="layui-form news_list">
+							<table id="DataTable" lay-filter="DataTable" class="layui-table" lay-even lay-skin="nob"></table>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<script type="text/javascript">
+		function loadJS(url) {
+			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
+		}
+		loadJS("../../layui/layui.js");
+		loadJS("../../js/ajaxhook.min.js");
+		loadJS("../../js/config.js");
+		loadJS("index.js");
+	</script>
+</body>
+
+</html>

+ 231 - 0
forstpages/user/index.js

@@ -0,0 +1,231 @@
+;
+layui.config({
+	base: "../../js/layuiPlugins/"
+}).use(['form', 'layer', 'jquery', 'table', 'laytpl'], function () {
+	var form = layui.form,
+		layer = layui.layer,
+		laytpl = layui.laytpl,
+		$ = layui.jquery,
+		table = layui.table;
+	var funcName = "user";
+	form.verify({
+		namelength: [
+			/^.{0,12}$/,
+			"长度限制在0-12个字符噢"
+		]
+	});
+	//工具条处理
+	function toolOperating(obj) {
+		var data = obj.data;
+		var userName = (obj.data.userName == '' || obj.data.userName == null) ? '匿名用户' : obj.data.userName;
+		if (obj.event === 'del') {
+			layer.confirm('真的删除用户“' + userName + '”吗?', function (index) {
+				layer.close(index);
+				var index1 = layer.msg('删除中,请稍候', {
+					icon: 16,
+					time: false,
+					shade: 0.8
+				});
+				$.ajax({
+					type: "get",
+					url: 'delete_user?guid=' + obj.data.guid,
+					success: function (res) {
+						layer.close(index1);
+						if (!(res.code - 0)) {
+							obj.del();
+							table.reload(funcName);
+						}
+					}
+				});
+			});
+		} else if (obj.event === 'edit') { //修改
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "修改",
+				area: ['800px', '470px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=edit&guid=' + data.guid,
+				end: function () {
+					table.reload(funcName); //重新载入表格
+				}
+			});
+		} else if (obj.event === 'view') { //查看
+			layer.open({
+				type: 2,
+				anim: 0,
+				title: "查看",
+				area: ['800px', '470px'],
+				fixed: true,
+				scrollbar: true,
+				maxmin: true,
+				content: 'add_change.html?event=view&guid=' + data.guid,
+				end: function () { }
+			});
+		} else if (obj.event === 'reset') {
+			layer.confirm('真的重置“' + (obj.data.userName || '') + '”用户密码吗?', function (index) {
+				layer.close(index);
+				var index1 = layer.msg('重置中,请稍候', {
+					icon: 16,
+					time: false,
+					shade: 0.8
+				});
+				$.ajax({
+					type: "get",
+					url: 'restPwd?guid=' + obj.data.guid,
+					success: function (res) {
+						layer.close(index1);
+						layer.alert('密码已经重置为123123');
+					}
+				});
+			});
+		}
+	}
+
+	//列表
+	var DataList = {
+		id: funcName,
+		elem: '#DataTable',
+		url: funcName + 'List',
+		page: true,
+		method: "post",
+		contentType: 'application/json',
+		loading: true,
+		cellMinWidth: 80,
+		cols: [
+			[ //标题栏
+				{
+					field: 'account',
+					title: '账号',
+					align: 'left',
+					minWidth: 90
+				}, {
+					field: 'userName',
+					title: '姓名',
+					align: 'left',
+					minWidth: 160
+				}, {
+					field: 'roleName',
+					title: '角色',
+					align: 'left',
+					minWidth: 160
+				}, {
+					field: 'mobileNo',
+					title: '电话号码',
+					align: 'center',
+					minWidth: 140
+				}, {
+					field: 'lastLoginTime',
+					title: '最后登录时间',
+					align: 'center',
+					minWidth: 200
+				}, {
+					field: 'isForbid',
+					title: '是否锁定',
+					width: 110,
+					templet: '#checkboxTpl',
+					unresize: true,
+					align: 'center',
+					minWidth: 160
+				}, {
+					field: 'operating',
+					title: '操作',
+					toolbar: '#operatingTool',
+					align: 'center',
+					fixed: 'right',
+					minWidth: 240
+				}
+			]
+		] //设置表头
+		,
+		done: function (res) {
+			resetButton(layui.sessionData(window.hywa.sessionTable.tableName).userData.menus.subMenuList, $);
+			//res.button.add ? $('.add-btn-0').show() : $('.add-btn-0').hide();
+		}
+	};
+
+	//执行默认渲染表格
+	table.render(DataList);
+
+	//监听产品工具事件条
+	table.on('tool(DataTable)', function (obj) {
+		toolOperating(obj);
+	});
+	//搜索响应函数
+	var infoSearch = function (obj) {
+
+		table.reload(funcName, { //执行重载
+			where: obj.field
+		});
+		return false;
+	};
+	//监听搜索表单事件
+	form.on("submit(DataSearch)", infoSearch);
+
+	//监听可用操作
+	form.on('checkbox(statusDemo)', function (obj) {
+		$.ajax({
+			url: 'forbidUser?guid=' + obj.elem.id + '&isForbid=' + this.value,
+			type: 'get',
+			contentType: 'application/json',
+			success: function (res) {
+				if (!(res.code - 0)) {
+					parent.layer.msg(res.msg, {
+						icon: 1
+					});
+					table.reload(funcName);
+				} else {
+					layer.msg(res.msg, {
+						icon: 2
+					});
+					obj.elem.checked = !obj.elem.checked;
+					form.render();
+				}
+			}
+		});
+	});
+	$("#addBtn").on("click", function () {
+		layer.open({
+			type: 2,
+			anim: 0,
+			title: "新增",
+			area: ['800px', '470px'],
+			fixed: true,
+			scrollbar: true,
+			maxmin: true,
+			content: 'add_change.html',
+			end: function () {
+				table.reload(funcName);
+			}
+		});
+	});
+
+	//类型下拉列表模板
+	function typeTpl(obj) {
+		laytpl(typeHtmlTpl.innerHTML).render(obj, function (html) {
+			$(obj.elem).html(html);
+			form.render();
+		});
+	}
+
+
+	$("#rolesView").next().click(function (e) {
+		if ($(this).hasClass('layui-form-selected')) {
+			$.ajax({
+				url: 'roleList',
+				method: 'post',
+				contentType: "application/json",
+				data: JSON.stringify({}),
+				success: function (res) {
+					typeTpl({
+						elem: "#rolesView",
+						list: res.data
+					});
+					form.render('select');
+				}
+			});
+		}
+	});
+});

Datei-Diff unterdrückt, da er zu groß ist
+ 4 - 0
iconfont/iconfont.css


BIN
iconfont/iconfont.eot


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
iconfont/iconfont.js


Datei-Diff unterdrückt, da er zu groß ist
+ 31 - 0
iconfont/iconfont.svg


BIN
iconfont/iconfont.ttf


BIN
iconfont/iconfont.woff


BIN
images/face.jpg


BIN
images/favicon.ico


BIN
images/favicon_ab.ico


+ 16 - 0
index.html

@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+	<meta charset="utf-8" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<title>林产品溯源管理系统</title>
+</head>
+
+<body>
+	<script type="text/javascript">
+		window.location.href = "forstlogin/index.html?ver=" + new Date().getTime();
+	</script>
+</body>
+
+</html>

+ 153 - 0
js/LodopFuncs.js

@@ -0,0 +1,153 @@
+//==本JS是加载Lodop插件及CLodop服务的综合示例,可直接使用,建议看懂后融进自己页面程序==
+
+var CreatedOKLodopObject, CLodopIsLocal, CLodopJsState;
+
+
+//==判断是否需要CLodop(那些不支持插件的浏览器):==
+function needCLodop() {
+    try {
+        var ua = navigator.userAgent;
+        if (ua.match(/Windows\sPhone/i))
+            return true;
+        if (ua.match(/iPhone|iPod|iPad/i))
+            return true;
+        if (ua.match(/Android/i))
+            return true;
+        if (ua.match(/Edge\D?\d+/i))
+            return true;
+
+        var verTrident = ua.match(/Trident\D?\d+/i);
+        var verIE = ua.match(/MSIE\D?\d+/i);
+        var verOPR = ua.match(/OPR\D?\d+/i);
+        var verFF = ua.match(/Firefox\D?\d+/i);
+        var x64 = ua.match(/x64/i);
+        if ((!verTrident) && (!verIE) && (x64))
+            return true;
+        else if (verFF) {
+            verFF = verFF[0].match(/\d+/);
+            if ((verFF[0] >= 41) || (x64))
+                return true;
+        } else if (verOPR) {
+            verOPR = verOPR[0].match(/\d+/);
+            if (verOPR[0] >= 32)
+                return true;
+        } else if ((!verTrident) && (!verIE)) {
+            var verChrome = ua.match(/Chrome\D?\d+/i);
+            if (verChrome) {
+                verChrome = verChrome[0].match(/\d+/);
+                if (verChrome[0] >= 41)
+                    return true;
+            }
+        }
+        return false;
+    } catch (err) {
+        return true;
+    }
+}
+
+//==引用CLodop的主JS,用双端口8000和18000(以防其中一个被占):==
+if (needCLodop()) {
+    var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
+    
+    var JS1 = document.createElement("script");
+    JS1.src = "http://localhost:8000/CLodopfuncs.js?priority=1";
+    head.insertBefore(JS1, head.firstChild);
+
+    var JS2 = document.createElement("script");
+    JS2.src = "http://localhost:18000/CLodopfuncs.js?priority=0";
+    head.insertBefore(JS2, head.firstChild);
+
+    CLodopIsLocal = !!((JS1.src + JS2.src).match(/\/\/localho|\/\/127.0.0./i));
+
+    if (JS1.attachEvent) {
+    	CLodopJsState = "loading";
+        var onChange = function(){ 
+	     if (window.event.srcElement.readyState == 'loaded')               
+	     CLodopJsState = "complete";
+	};
+	JS1.attachEvent('onreadystatechange',onChange);
+	JS2.attachEvent('onreadystatechange',onChange);
+    }
+}
+
+//==获取LODOP对象主过程,判断是否安装、需否升级:==
+function getLodop(oOBJECT, oEMBED) {
+    var strHtmInstall = "<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='install_lodop32.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
+    var strHtmUpdate = "<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='install_lodop32.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
+    var strHtm64_Install = "<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='install_lodop64.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
+    var strHtm64_Update = "<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='install_lodop64.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
+    var strHtmFireFox = "<br><br><font color='#FF00FF'>(注意:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】->【附加组件】->【扩展】中先卸它)</font>";
+    var strHtmChrome = "<br><br><font color='#FF00FF'>(如果此前正常,仅因浏览器升级或重安装而出问题,需重新执行以上安装)</font>";
+    var strCLodopInstall_1 = "<br><font color='#FF00FF'>Web打印服务未安装启动,点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>下载执行安装</a>";
+    var strCLodopInstall_2 = "<br>(若此前已安装过,可<a href='CLodop.protocol:setup' target='_self'>点这里直接再次启动</a>)";
+    var strCLodopInstall_3 = ",成功后请刷新本页面。</font>";
+    var strCLodopUpdate = "<br><font color='#FF00FF'>Web打印服务CLodop需升级!点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>,升级后请刷新页面。</font>";
+    var LODOP;
+    try {
+        var ua = navigator.userAgent;
+        var isIE = !!(ua.match(/MSIE/i)) || !!(ua.match(/Trident/i));
+        if (needCLodop()) {
+            try {
+                LODOP = getCLodop();
+            } catch (err) {}
+            if (!LODOP && (document.readyState !== "complete" || (isIE  && CLodopJsState == "loading")) ) {
+                alert("网页还没下载完毕,请稍等一下再操作.");
+                return;
+            }
+            if (!LODOP) {
+                document.body.innerHTML = strCLodopInstall_1 + (CLodopIsLocal ? strCLodopInstall_2 : "") + strCLodopInstall_3 + document.body.innerHTML;                
+                return;
+            } else {
+                if (CLODOP.CVERSION < "3.0.9.3") {
+                    document.body.innerHTML = strCLodopUpdate + document.body.innerHTML;
+                }
+                if (oEMBED && oEMBED.parentNode)
+                    oEMBED.parentNode.removeChild(oEMBED);
+                if (oOBJECT && oOBJECT.parentNode)
+                    oOBJECT.parentNode.removeChild(oOBJECT);
+            }
+        } else {
+            var is64IE = isIE && !!(ua.match(/x64/i));
+            //==如果页面有Lodop就直接使用,否则新建:==
+            if (oOBJECT || oEMBED) {
+                if (isIE)
+                    LODOP = oOBJECT;
+                else
+                    LODOP = oEMBED;
+            } else if (!CreatedOKLodopObject) {
+                LODOP = document.createElement("object");
+                LODOP.setAttribute("width", 0);
+                LODOP.setAttribute("height", 0);
+                LODOP.setAttribute("style", "position:absolute;left:0px;top:-100px;width:0px;height:0px;");
+                if (isIE)
+                    LODOP.setAttribute("classid", "clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
+                else
+                    LODOP.setAttribute("type", "application/x-print-lodop");
+                document.documentElement.appendChild(LODOP);
+                CreatedOKLodopObject = LODOP;
+            } else
+                LODOP = CreatedOKLodopObject;
+            //==Lodop插件未安装时提示下载地址:==
+            if ((!LODOP) || (!LODOP.VERSION)) {
+                if (ua.indexOf('Chrome') >= 0)
+                    document.body.innerHTML = strHtmChrome + document.body.innerHTML;
+                if (ua.indexOf('Firefox') >= 0)
+                    document.body.innerHTML = strHtmFireFox + document.body.innerHTML;
+                document.body.innerHTML = (is64IE ? strHtm64_Install : strHtmInstall) + document.body.innerHTML;
+                return LODOP;
+            }
+        }
+        if (LODOP.VERSION < "6.2.2.6") {
+            if (!needCLodop())
+                document.body.innerHTML = (is64IE ? strHtm64_Update : strHtmUpdate) + document.body.innerHTML;
+        }
+        //===如下空白位置适合调用统一功能(如注册语句、语言选择等):==
+
+
+
+        //=======================================================
+        return LODOP;
+    } catch (err) {
+        alert("getLodop出错:" + err);
+    }
+}

+ 215 - 0
js/a.js

@@ -0,0 +1,215 @@
+define(['jquery', 'foxui', 'tpl'], function ($, FoxUI, tpl) {
+    window.FoxUI = FoxUI;
+    var defaults = {baseUrl: '', siteUrl: '', staticUrl: '../addons/ewei_shopv2/static/'};
+    var core = {options: {}};
+    core.init = function (options) {
+        this.options = $.extend({}, defaults, options || {})
+    };
+    core.toQueryPair = function (key, value) {
+        if (typeof value == 'undefined') {
+            return key
+        }
+        return key + '=' + encodeURIComponent(value === null ? '' : String(value))
+    };
+    core.number_format = function (number, fix) {
+        var fix = arguments[1] ? arguments[1] : 2;
+        var fh = ',';
+        var jg = 3;
+        var str = '';
+        number = number.toFixed(fix);
+        zsw = number.split('.')[0];
+        xsw = number.split('.')[1];
+        zswarr = zsw.split('');
+        for (var i = 1; i <= zswarr.length; i++) {
+            str = zswarr[zswarr.length - i] + str;
+            if (i % jg == 0) {
+                str = fh + str;
+            }
+        }
+        str = (zsw.length % jg == 0) ? str.substr(1) : str;
+        zsw = str + '.' + xsw;
+        return zsw
+    };
+    core.toQueryString = function (obj) {
+        var ret = [];
+        for (var key in obj) {
+            key = encodeURIComponent(key);
+            var values = obj[key];
+            if (values && values.constructor == Array) {
+                var queryValues = [];
+                for (var i = 0, len = values.length, value; i < len; i++) {
+                    value = values[i];
+                    queryValues.push(this.toQueryPair(key, value))
+                }
+                ret = ret.concat(queryValues)
+            } else {
+                ret.push(this.toQueryPair(key, values))
+            }
+        }
+        return ret.join('&')
+    };
+    core.getUrl = function (routes, params, full) {
+        routes = routes.replace(/\//ig, ".");
+        var url = this.options.baseUrl.replace('ROUTES', routes);
+        if (params) {
+            if (typeof(params) == 'object') {
+                url += "&" + this.toQueryString(params)
+            } else if (typeof(params) == 'string') {
+                url += "&" + params
+            }
+        }
+        return full ? this.options.siteUrl + 'app/' + url : url
+    };
+    core.json = function (routes, args, callback, hasloading, ispost) {
+        var url = ispost ? this.getUrl(routes) : this.getUrl(routes, args);
+        var op = {
+            url: url, type: ispost ? 'post' : 'get', dataType: 'json', cache: false, beforeSend: function () {
+                if (hasloading) {
+                    FoxUI.loader.show('mini')
+                }
+            }, error: function (a) {
+                /*alert(JSON.stringify(a));*/
+                if (hasloading) {
+                    FoxUI.loader.hide()
+                }
+            }
+        };
+        if (args && ispost) {
+            op.data = args
+        }
+        if (callback) {
+            op.success = function (data) {
+                if (hasloading) {
+                    FoxUI.loader.hide()
+                }
+                callback(data)
+            }
+        }
+        $.ajax(op)
+    };
+    core.post = function (routes, args, callback, hasloading) {
+        this.json(routes, args, callback, hasloading, true)
+    };
+    core.html = function (routes, args, callback, hasloading, async) {
+        if (typeof async === undefined) {
+            async = true
+        }
+        var op = {
+            url: this.getUrl(routes, args),
+            type: 'get',
+            cache: false,
+            dataType: 'html',
+            async: async,
+            beforeSend: function () {
+                if (hasloading) {
+                    FoxUI.loader.show('mini')
+                }
+            },
+            error: function () {
+                core.removeLoading();
+                if (hasloading) {
+                    FoxUI.loader.hide()
+                }
+            }
+        };
+        if (callback) {
+            op.success = function (html) {
+                if (hasloading) {
+                    FoxUI.loader.hide()
+                }
+                callback(html)
+            }
+        }
+        $.ajax(op)
+    };
+    core.tpl = function (containerid, templateid, data, append) {
+        if (typeof append === undefined) {
+            append = false
+        }
+        var html = tpl(templateid, data);
+        if (append) {
+            $(containerid).append(html)
+        } else {
+            $(containerid).html(html)
+        }
+        setTimeout(function () {
+            $(containerid).closest('.fui-content').lazyload('render')
+        }, 10)
+    };
+    core.getNumber = function (str) {
+        str = $.trim(str);
+        if (str == '') {
+            return 0
+        }
+        return parseFloat(str.replace(',', ''))
+    };
+    core.showIframe = function (url) {
+        var if_w = "100%";
+        var if_h = $(document.body).height();
+        $("<iframe width='" + if_w + "' height='" + if_h + "' id='mainFrame' name='mainFrame' style='position:absolute;z-index:4;'  frameborder='no' marginheight='0' marginwidth='0' ></iframe>").prependTo('body');
+        var st = document.documentElement.scrollTop || document.body.scrollTop;
+        var sl = document.documentElement.scrollLeft || document.body.scrollLeft;
+        var ch = document.documentElement.clientHeight;
+        var cw = document.documentElement.clientWidth;
+        var objH = $("#mainFrame").height();
+        var objW = $("#mainFrame").width();
+        var objT = Number(st) + (Number(ch) - Number(objH)) / 2;
+        var objL = Number(sl) + (Number(cw) - Number(objW)) / 2;
+        $("#mainFrame").css('left', objL);
+        $("#mainFrame").css('top', objT);
+        $("#mainFrame").attr("src", url)
+    };
+    core.getDistanceByLnglat = function (lng1, lat1, lng2, lat2) {
+        function rad(d) {
+            return d * Math.PI / 180.0
+        }
+
+        var rad1 = rad(lat1), rad2 = rad(lat2);
+        var a = rad1 - rad2, b = rad(lng1) - rad(lng2);
+        var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(rad1) * Math.cos(rad2) * Math.pow(Math.sin(b / 2), 2)));
+        s = s * 6378137.0;
+        s = Math.round(s * 10000) / 10000000;
+        return s
+    };
+    core.showImages = function(imgClass){
+        var ua = navigator.userAgent.toLowerCase();
+        var isWX = ua.match(/MicroMessenger/i) == "micromessenger";
+        var z = [];
+        $(imgClass).each(function() {
+            var img = $(this).attr("data-lazy");
+            z.push(img?img:$(this).attr("src"));
+        });
+        var current;
+        if (isWX) {
+            $(imgClass).unbind('click').click(function(e) {
+                e.preventDefault();
+                var startingIndex = $(imgClass).index($(e.currentTarget));
+                var current = null;
+                $(imgClass).each(function(B, A) {
+                    if (B === startingIndex) {
+                        current = $(A).attr("data-lazy")?$(A).attr("data-lazy"):$(A).attr("src");
+                    }
+                });
+                WeixinJSBridge.invoke("imagePreview", {
+                    current: current,
+                    urls: z
+                });
+            });
+        }
+    };
+    core.ish5app = function () {
+        var userAgent = navigator.userAgent;
+        if (userAgent.indexOf('CK 2.0') > -1){
+            return true;
+        }
+        return false;
+    };
+    core.isWeixin = function () {
+        var ua = navigator.userAgent.toLowerCase();
+        var isWX = ua.match(/MicroMessenger/i) == "micromessenger";
+        return isWX;
+    };
+
+    window.core = core;
+    return core
+});

+ 1 - 0
js/ajaxhook.min.js

@@ -0,0 +1 @@
+!function(t){function r(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var n={};return r.m=t,r.c=n,r.p="",r(0)}([function(t,r,n){n(1)(window)},function(t,r){t.exports=function(t){t.hookAjax=function(t){function r(t){return function(){return this.hasOwnProperty(t+"_")?this[t+"_"]:this.xhr[t]}}function n(r){return function(n){var i=this.xhr,o=this;return 0!=r.indexOf("on")?void(this[r+"_"]=n):void(t[r]?i[r]=function(){t[r](o)||n.apply(i,arguments)}:i[r]=n)}}function i(r){return function(){var n=[].slice.call(arguments);if(!t[r]||!t[r].call(this,n,this.xhr))return this.xhr[r].apply(this.xhr,n)}}return window._ahrealxhr=window._ahrealxhr||XMLHttpRequest,XMLHttpRequest=function(){this.xhr=new window._ahrealxhr;for(var t in this.xhr){var o="";try{o=typeof this.xhr[t]}catch(t){}"function"===o?this[t]=i(t):Object.defineProperty(this,t,{get:r(t),set:n(t)})}},window._ahrealxhr},t.unHookAjax=function(){window._ahrealxhr&&(XMLHttpRequest=window._ahrealxhr),window._ahrealxhr=void 0},t.default=t}}]);

+ 436 - 0
js/config.js

@@ -0,0 +1,436 @@
+var SYS_VER = parseInt(Math.random() * 10000000000);
+function resetButton(menus, $) {
+	var menuId = location.href.substring(location.href.indexOf("id=") + 3, location.href.indexOf("id=") + 35);
+	for (var i = 0; i < menus.length; i++) {
+		for (var j = 0; j < menus[i].subMenuList.length; j++) {
+			if (menuId == menus[i].subMenuList[j].id) {
+				var rights = menus[i].subMenuList[j].subMenuList;
+				for (var k = 0; k < rights.length; k++) {
+					if (rights[k].isChecked == 0) {
+						$(rights[k].authStr.substring(rights[k].authStr.lastIndexOf(":") + 1) + "-btn-0").hide();
+					}
+					else {
+						$(rights[k].authStr.substring(rights[k].authStr.lastIndexOf(":") + 1) + "-btn-0").show();
+					}
+				}
+				break;
+			}
+		}
+	}
+}
+function loadJS(url) {
+	document.write("<scirpt src='" + url + "?ver=" + SYS_VER + "'></scirpt>")
+}
+!(function (win) {
+	"use strict";
+	window.hywa = {
+		config: {
+// 			href: 'http://172.16.90.64:8103/',
+			// href: 'http://172.16.90.77:21008/',
+			href: 'http://forestsuyuan.hw.hongweisoft.com/bak/',
+			port: {
+				login: '/web/user/login', //登录
+				loginOut: "/web/user/logout", //退出
+				changePassword: "/web/user/edit", //修改密码
+
+				userList: "/web/user/searchByPage", //列表
+				add_user: "/web/user/add", //添加
+				edit_user: "/web/user/edit", //修改
+				delete_user: "/web/user/del", //删除
+				select_user: "/web/user/searchById", //查询单个
+				forbidUser: '/web/user/forbidden', //禁止用户
+				restPwd: "/web/user/restPwd",//重置密码
+				//首页
+				select_searchByPage: "/web/feedback/searchByPage",//评价明细列表
+				del_feedback: "/web/feedback/batchDel",//删除评价
+				qurey_echartTotal: "/web/code/record/statOneYear", //扫码图标统计
+				query_listTotal: "/web/code/record/statYesterdayAndAllTime", //获取文字数统计
+				//角色设置
+				roleList: "/web/role/searchByPage", //获取角色列表
+				add_role: "/web/role/add", //新增角色
+				edit_role: "/web/role/edit", //修改角色
+				delete_role: "/web/role/del", //修改角色
+				select_role: "/web/role/searchById", //通过ID获取角色详细信息
+				role_getAuth: "/web/role/searchRoleAuthInfo",//查询角色权限
+				role_saveAuth: "/web/role/distrRoleAuthInfo",//保存企业授权信息
+				//经销商管理
+				dealerList: "/web/goods/dealer/searchByPage",
+				add_dealer: "/web/goods/dealer/add",
+				select_dealer: "/web/goods/dealer/findById",
+				edit_dealer: "/web/goods/dealer/edit",
+				delete_dealer: "/web/goods/dealer/delete",
+				selectPId_dealer: "/web/goods/dealer/getCode",
+				//企业
+				orgList: "/web/org/searchByPage", //列表
+				add_org: "/web/org/add", //添加
+				edit_org: "/web/org/edit", //修改
+				delete_org: "/web/org/del", //删除
+				select_org: "/web/org/searchById", //查询单个
+				select_Info_org: "/web/org/searchOrgInfo",//查询推广企业信息
+				edit_Info_org: "/web/org/editExtendInfo",//企业推广保存
+				org_getAuth: "/web/org/searchAuthInfo",//拉取企业授权信息
+				org_saveAuth: "/web/org/distrOrgAuthInfo",//保存企业授权信息
+				add_org_user: '/web/org/addOrgUser',//添加企业管理用户
+
+				//产地
+				regionList: "/web/goods/field/searchByPage", //列表
+				add_region: "/web/goods/field/add", //添加
+				edit_region: "/web/goods/field/edit", //修改
+				delete_region: "/web/goods/field/del", //删除
+				select_region: "/web/goods/field/searchById", //查询单个
+				rnlist_region: "/web/goods/field/getBaseList",
+				areaSearch: "/web/goods/field/getAreaInfo",//地址查询
+				getOrchardList: "/web/goods/field/getOrchardList", // 获取原料生产数据
+
+				//产品信息
+				pdinfoList: "/web/goods/batch/searchByPage", //列表
+				add_pdinfo: "/web/goods/batch/add", //添加
+				add_rawMaterialInfo: "/web/inputs/save",//修改模式 - 添加原料项
+				del_rawMaterialInfo: "/web/inputs/del",//修改模式 - 删除原料项
+				add_produceProcessInfo: "/web/normal/save",//修改模式 - 添加生成过程项
+				edit_produceProcessInfo: "/web/normal/edit",//修改模式 - 修改生成过程项
+				del_produceProcessInfo: "/web/normal/del",//修改模式 - 删除生成过程项
+				add_processingCirculationInfo: "/web/normal/save",//修改模式 - 添加加工流通过程项
+				edit_processingCirculationInfo: "/web/normal/edit",//修改模式 - 修改加工流通过程项
+				del_processingCirculationInfo: "/web/normal/del",//修改模式 - 删除加工流通过程项
+				edit_pdinfo: "/web/goods/batch/edit", //修改
+				delete_pdinfo: "/web/goods/batch/del", //删除
+				select_pdinfo: "/web/goods/batch/searchById", //查询单个
+				pdinfo2List: "/web/goods/searchByPage", //列表
+				add_pdinfo2: "/web/goods/add", //添加
+				edit_pdinfo2: "/web/goods/edit", //修改
+				delete_pdinfo2: "/web/goods/del", //删除
+				select_pdinfo2: "/web/goods/searchById", //查询单个
+				pdinfo_qrcode: "/web/goods/batch/batchGoodsQRCode",//产品批次生成溯源码
+
+				//溯源码管理
+				qrcodeList: "/web/code/record/searchByPage", //列表
+				view_qrcode: "/web/code/record/searchDetailById", //查看
+				drop_qrcode: "/web/code/record/forbiddenCodeInfo", //废弃
+				export_qrcode: "/web/code/record/exportDetailRecord", //导出
+				delete_qrcode: "/web/code/record/delByPhysical", //删除
+				drop_single: "/web/code/info/forbidden",//废弃单个溯源码
+				show_codeDetail: "/web/code/record/showDetail",//溯源码预览
+				print_qrcode: "/web/code/info/getPrintDetail", //溯源码打印
+				setPrint_done: "/web/code/info/updateQRIsPrint",//标记已打印二维码
+				//系统日志
+				menuList: "/log/queryFuncName",//获取菜单列表
+				logList: "/log/queryAll",//获取日志列表
+				show_menu: "/menu/search", //查看权限菜单树
+				get_menuList: "/menu/menuAllTree", //查看菜单列表
+				select_menu: "/menu/search", //查看菜单详细,ID条件
+				update_menu: "/menu", //菜单新增修改
+
+				// 权限
+				roleListUrl: '/role/getAll',
+				roleFormUrl: '/role',
+				roleByid: '/role/findById',
+				menuListUrl: '/menu/getMenuByRole',
+				menuFormUrl: '/menu/saveRoleMenu',
+				systemListUrl: '/system/find',//系统维护查询
+				systemFormUrl: '/system',//系统维护保存
+				uploadImage: "/web/normal/uploadPics",
+			}
+		},
+		sessionTable: {
+			tableName: 'system',
+			userData: 'userData'
+		},
+		jumpPage: {
+			home: "../forstpages/?ver=" + SYS_VER,
+			login: "../../?ver=" + SYS_VER
+		},
+		codeVerify: {
+			405: function () {
+				console.log('logout')
+				//top.location.href = window.hywa.jumpPage.login;
+				return true;
+			},
+			404: function () {
+				// top.location.href = window.hywa.jumpPage.login;
+				return true;
+			},
+			500: function () {
+				//top.location.href = window.hywa.jumpPage.login;
+				return true;
+			},
+			1004: function () {//认证失败
+				top.location.href = window.hywa.jumpPage.login;
+				return true;
+			},
+			2010: function () {//不能修改删除自己
+				return false;
+			},
+			2011: function () {//不能对超级管理员进行操作
+				return false;
+			},
+			1002: function () {//密码错误
+				return false;
+			},
+			3003: function () {//修改前后密码不能相同
+				return false;
+			},
+			3004: function () {//修改前后密码不能相同
+				return false;
+			},
+			2006: function () {//文件上传失败
+				return false;
+			},
+			2002: function () {//参数不能为空
+				return false;
+			},
+			2003: function () {//类型被引用,请先删除引用
+				return false;
+			},
+			2004: function () {
+				return false;
+			},
+			2005: function () {//文件不能为空
+				return false;
+			},
+			3009: function () {
+				return false;
+			},
+			3008: function () {
+				return false;
+			},
+			3011: function () {
+				return false;
+			},
+			3017: function () {
+				return true;
+			},
+			3013: function () {
+				return false;
+			},
+			3019: function () {
+				return false;
+			},
+			3036: function () {
+				return false;
+			},
+			3037: function () {
+				return false;
+			},
+			3038: function () {
+				return false;
+			},
+			3039: function () {
+				return false;
+			},
+			3070: function () {
+				return false;
+			},
+			default: function () {
+				return false;
+			}
+		}
+	};
+
+	win.hijack = function () {
+		var _this = this;
+		layui.use(['layer'], function () {
+			_this.layer = layui.layer;
+		});
+		_this.json = {
+			code: -404,
+			msg: "返回数据格式错误",
+			count: 0,
+			data: []
+		};
+	};
+	win.hijack.prototype.onload = function (xhr) {
+		var _this = this;
+		if (xhr.readyState === 4) { // 成功完成
+			// 判断响应结果:
+			if (xhr.status === 200) {
+				//layer.close(xhr.xhr.lay_loading);
+				xhr.responseText = JSON.stringify(_this.changeJSON(xhr.responseText).json);
+				switch (_this.json.code) {
+					case 0:
+						// return _this.okMsg(_this.json.msg);
+						return false;
+					default:
+						return _this.errorMsg(_this.json.code, _this.json.msg);
+				};
+			} else {
+				return _this.errorMsg(xhr.status);
+			}
+		} else if (xhr.readyState === 1) {
+			xhr.setRequestHeader('x-requested-with', "XMLHttpRequest");
+		} else {
+
+		}
+	};
+	win.hijack.prototype.open = function (arg, xhr) {
+		var _this = this;
+		_this.url = location.searchObj(arg[1]);
+		_this.url.pageNum = _this.url.page - 0;
+		_this.url.pageSize = _this.url.limit - 0;
+		_this.url.pageNum || (delete _this.url.pageNum);
+		_this.url.pageSize || (delete _this.url.pageSize);
+
+		_this.url.pageNum && (delete _this.url.page);
+		_this.url.pageSize && (delete _this.url.limit);
+		arg[1] = _this.changeUrl(_this.url, arg[1].split('?')[0]).url;
+	};
+	win.hijack.prototype.changeUrl = function (obj, url) {
+		var _this = this;
+		_this.url = (_this.httpVerify(url) ? (function () {
+			return _this.httpVerify(hywa.config.port[url]) ? hywa.config.href + hywa.config.port[url] : hywa.config.port[url];
+		})() : url);
+		_this.url += "?";
+		for (var i in obj) {
+			_this.url += i + "=" + obj[i] + "&";
+		}
+		_this.url = _this.url.substr(0, _this.url.length - 1);
+		return this;
+	};
+	win.hijack.prototype.httpVerify = function (url) {
+		return (url.substr(0, 5) != 'http:' && url.substr(0, 6) != 'https:' && url.substr(0, 2) != '//');
+	};
+	win.hijack.prototype.changeJSON = function (json) {
+		var _this = this;
+		try {
+			json = JSON.parse(json);
+			if (json.retHead) {
+				_this.json.code = json.retHead.errCode;
+				_this.json.msg = json.retHead.errMsg || "不知道怎么了!!!";
+				_this.json.count = json.retHead.total || 0;
+			} else {
+
+			}
+			if (JSON.stringify(json.retBody) == '{}') {
+				json.retBody = []
+			}
+			if (json.retBody && !!json.retBody.list && !!json.retBody.list.length) {
+				_this.json.count = _this.json.count || json.retBody.total || 0;
+				_this.json.data = json.retBody.list || [];
+				_this.json.button = json.buttonRep || {};
+				if (JSON.stringify(_this.json.button) != '{}') {
+					(function addRgt(data, rgt) {
+						for (let i = 0; i < data.length; i++) {
+							data[i] = Object.assign(data[i], rgt);
+							if (data[i].children)
+								addRgt(data[i].children, rgt);
+						}
+					})(_this.json.data, _this.json.button);
+					for (let i = 0; i < _this.json.data.length; i++) {
+						_this.json.data[i] = Object.assign(_this.json.data[i], _this.json.button);
+					}
+				}
+			} else if (json.retBody != "null" && !!json.retBody && Array.isArray(json.retBody.list) && !json.retBody.total) {
+				_this.json.data = [];
+				_this.json.button = json.buttonRep || {};
+				if (JSON.stringify(_this.json.button) != '{}') {
+					(function addRgt(data, rgt) {
+						for (let i = 0; i < data.length; i++) {
+							data[i] = Object.assign(data[i], rgt);
+							if (data[i].children)
+								addRgt(data[i].children, rgt);
+						}
+					})(_this.json.data, _this.json.button);
+					for (let i = 0; i < _this.json.data.length; i++) {
+						_this.json.data[i] = Object.assign(_this.json.data[i], _this.json.button);
+					}
+				}
+			} else {
+				_this.json.data = Array.isArray(json.retBody) ? (function () {
+					_this.json.count = _this.json.count || json.retBody.length;
+					return json.retBody;
+				})() : (json.retBody != 'null' ? [json.retBody] : []);
+			}
+		} catch (e) {
+			_this.json = {
+				code: -404,
+				msg: "返回数据格式错误",
+				count: 0,
+				data: []
+			};
+		}
+		return this;
+	};
+	win.hijack.prototype.errorMsg = function (code, msg) {
+		var _this = this;
+		_this.layer.msg("(" + code + ") " + (msg || "服务器通讯不畅!"), {
+			icon: 2,
+			time: 3000
+		});
+		return (window.hywa.codeVerify[(code - 0 || 'default')] || window.hywa.codeVerify['default'])();
+	};
+	win.hijack.prototype.okMsg = function (msg) {
+		var _this = this;
+		_this.layer.msg(msg, {
+			icon: 1,
+			time: 800
+		});
+		return false;
+	};
+	win.hijack.prototype.setRequestHeader = function (xhr) {
+		var _this = this;
+		if (typeof xhr.RequestHeader == 'undefined') {
+			xhr.RequestHeader = true;
+			var token = layui.sessionData(window.hywa.sessionTable.tableName);
+			JSON.stringify(token) != '{}' && xhr.setRequestHeader('accessToken', token.token);
+		}
+	};
+	var hook = new hijack();
+	hookAjax({
+		//拦截函数
+		open: function (arg) {
+			return hook.open(arg, this.xhr);
+		},
+		//拦截回调
+		onreadystatechange: function (xhr) {
+			// console.log(xhr.readyState)
+			return hook.onload(xhr);
+		},
+		onload: function (xhr) {
+			return hook.onload(xhr);
+		},
+		setRequestHeader: function (h, xhr) {
+			// console.log("加头",JSON.stringify(xhr));
+			hook.setRequestHeader(xhr);
+		}
+	});
+})(window);
+/**
+ * 时间格式化
+ */
+Date.prototype.format = function (format) {
+
+	var date = {
+		"M+": this.getMonth() + 1,
+		"d+": this.getDate(),
+		"h+": this.getHours(),
+		"m+": this.getMinutes(),
+		"s+": this.getSeconds(),
+		"q+": Math.floor((this.getMonth() + 3) / 3),
+		"S+": this.getMilliseconds()
+	};
+	if (/(y+)/i.test(format)) {
+		format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
+	}
+	for (var k in date) {
+		if (new RegExp("(" + k + ")").test(format)) {
+			format = format.replace(RegExp.$1, RegExp.$1.length == 1 ?
+				date[k] : ("00" + date[k]).substr(("" + date[k]).length));
+		}
+	}
+	return format;
+}
+/**
+ * URL参数转换为对象
+ */
+Location.prototype.searchObj = function (url) {
+	var obj = {};
+	var arr = (url || this.search).match(/[?&][^?&]+=[^?&]+/g);
+	if (arr) {
+		arr.forEach(function (item) {
+			var tempArr = item.substring(1).split('=');
+			obj[decodeURIComponent(tempArr[0])] = decodeURIComponent(tempArr[1]);
+			length++;
+		});
+	}
+	return obj;
+}

+ 411 - 0
js/layui-xtree.js

@@ -0,0 +1,411 @@
+//**********************************
+//**   本插件依赖 贤心 layui form模块   
+//**   由 小巷 制作 QQ:151446298    
+//**   版本3.0 时间 2018-01-10 20:48 
+//**********************************
+
+//构造
+function layuiXtree(options) {
+    var _this = this;
+    _this._containerid = options.elem;
+    _this.tool = options.tool;
+	_this.checkbox = options.checkbox;
+    typeof options.toolbar == 'function' && (_this.toolbar = options.toolbar);
+    _this._container = document.getElementById(options.elem); //容器
+    _this._container.style.minHeight = "100px";
+    _this._options = options;
+    _this.Loading(options);
+}
+
+//封装IE8 Class选择
+layuiXtree.prototype.getByClassName = function (cn) {
+    if (document.getElementsByClassName) return this._container.getElementsByClassName(cn);
+    var _xlist = this._container.childNodes;
+    var _xtemp = new Array();
+    for (var i = 0; i < _xlist.length; i++) {
+        var _xchild = _xlist[i];
+        var _xclassNames = _xchild.getAttribute('class').split(' ');
+        for (var j = 0; j < _xclassNames.length; j++) {
+            if (_xclassNames[j] == cn) {
+                _xtemp.push(_xchild);
+                break;
+            }
+        }
+    }
+    return _xtemp;
+}
+
+//在一个对象下面找子级
+layuiXtree.prototype.getChildByClassName = function (obj, cn) {
+    var _xlist = obj.childNodes;
+    var _xtemp = new Array();
+    for (var i = 0; i < _xlist.length; i++) {
+        var _xchild = _xlist[i];
+        var _xclassNames = _xchild.getAttribute('class').split(' ');
+        for (var j = 0; j < _xclassNames.length; j++) {
+            if (_xclassNames[j] == cn) {
+                _xtemp.push(_xchild);
+                break;
+            }
+        }
+    }
+    return _xtemp;
+}
+
+//加载特效,且获取数据
+layuiXtree.prototype.Loading = function (options) {
+    var _this = this;
+    _this.xloading = document.createElement("span"); //创建加载对象
+    _this.xloading.setAttribute('class', 'layui-icon layui-anim layui-anim-rotate layui-anim-loop');
+    _this.xloading.innerHTML = '&#xe63e;';
+    _this.xloading.style.fontSize = "50px";
+    _this.xloading.style.color = "#009688";
+    _this.xloading.style.fontWeight = "bold";
+    _this.xloading.style.marginLeft = _this._container.offsetWidth / 2 - 25 + 'px';
+    _this.xloading.style.marginTop = _this._container.offsetHeight / 2 - 50 + 'px';
+    _this._container.innerHTML = '';
+    _this._container.appendChild(_this.xloading); //加载显示
+    if (typeof (options.data) == 'object') {
+        _this._dataJson = options.data;
+        _this.Initial(options);
+        return;
+    }
+
+    //如果是字符串url,进行异步加载
+    var obj = new XMLHttpRequest();
+    obj.open('get', options.data, true);
+    obj.onreadystatechange = function () {
+        if (obj.readyState == 4 && obj.status == 200 || obj.status == 304) { //回调成功
+            if (JSON.parse(obj.responseText).menu) {
+                _this._dataJson = eval('(' + obj.responseText + ')').menu;
+                //_this._dataJson = eval('(' + JSON.parse(obj.responseText).menu + ')'); //将返回的数据转为json
+            }
+            _this.Initial(options);
+        }
+    };
+    obj.send();
+}
+
+//data验证后的数据初始化
+layuiXtree.prototype.Initial = function (o) {
+    var _this = this;
+    _this._form = o.form; //layui from对象
+    _this._domStr = ""; //结构字符串
+    _this._isopen = o.isopen != null ? o.isopen : true;
+    if (o.color == null) o.color = {
+        open: '#2F4056',
+        close: '#2F4056',
+        end: '#2F4056'
+    }; //图标颜色
+    _this._iconOpenColor = o.color.open != null ? o.color.open : "#2F4056";
+    _this._iconCloseColor = o.color.close != null ? o.color.close : "#2F4056";
+    _this._iconEndColor = o.color.end != null ? o.color.end : "#2F4056";
+    if (o.icon == null) o.icon = {
+        open: '&#xe625;',
+        close: '&#xe623;',
+        end: '&#xe621;'
+    }; //图标样式
+    _this._iconOpen = o.icon.open != null ? o.icon.open : '&#xe625;';
+    _this._iconClose = o.icon.close != null ? o.icon.close : '&#xe623;';
+    _this._iconEnd = o.icon.end != null ? o.icon.end : '&#xe621;';
+    _this._click = o.click != null ? o.click : function () {};
+    _this._ckall = o.ckall != null ? o.ckall : false; //全选是否启用
+    _this._ckallSuccess = o.ckallback != null ? o.ckallback : function () {}; //全选回调
+    _this.CreateCkAll();
+    _this.dataBind(_this._dataJson);
+    _this.Rendering();
+}
+
+//全选框
+layuiXtree.prototype.CreateCkAll = function () {
+    var _this = this;
+    if (_this._ckall) {
+        _this._domStr += '<div class="layui-xtree-item">';
+        _this._domStr +=
+            '<input type="checkbox" class="layui-xtree-checkbox layui-xtree-ckall" title="全选" lay-skin="primary" lay-filter="xtreeckall' +
+            _this._containerid + '">';
+        _this._domStr += '</div>';
+    }
+}
+
+//生产结构
+layuiXtree.prototype.dataBind = function (d) {
+    var _this = this;
+    if (d.length > 0) {
+        for (i in d) {
+            var xtree_isend = '';
+            var xtree_ischecked = '';
+            var xtree_isdisabled = d[i].disabled ? ' disabled="disabled" ' : '';
+            _this._domStr += '<div class="layui-xtree-item">';
+            if (!d[i].childrenMenu) {
+                d[i].childrenMenu = [];
+            }
+            if (d[i].childrenMenu.length > 0)
+                _this._domStr += '<i class="layui-icon layui-xtree-icon" data-xtree="' + (_this._isopen ? '1' : '0') +
+                '">' + (_this._isopen ? _this._iconOpen : _this._iconClose) + '</i>';
+            else {
+                _this._domStr += '<i class="layui-icon layui-xtree-icon-null">' + (d[i].icon || _this._iconEnd) +
+                    '</i>';
+                xtree_isend = 'data-xend="1"';
+                xtree_ischecked = !!d[i].roleId ? ' checked ' : '';
+                xtree_isdisabled = d[i].disabled ? ' disabled="disabled" ' : '';
+            }
+            if (!!_this.checkbox) {
+                _this._domStr += '<input type="checkbox" class="layui-xtree-checkbox" ' + xtree_isend +
+                    xtree_ischecked +
+                    xtree_isdisabled + ' value="' + d[i].id + '" title="' + d[i].name +
+                    '" lay-skin="primary" lay-filter="xtreeck' + _this._containerid + '">';
+            }else{
+				_this._domStr += '<div class="layui-inline" style="margin-top: 10px;margin-bottom:0;"><span>'+d[i].name+'</span></div>';
+			}
+            if (!!_this.tool) {
+                _this._domStr +=
+                    '<div class="layui-inline" style="margin-top: 10px;margin-bottom:0;"><a class="layui-btn layui-btn-xs" name="tree_event" event="edit"id="' +
+                    d[i].id +
+                    '">修改</a><a class="layui-btn layui-btn-danger layui-btn-xs" name="tree_event" event="del" id="' +
+                    d[i].id + '">删除</a></div>';
+            }
+            _this.dataBind(d[i].childrenMenu);
+            _this._domStr += '</div>';
+        }
+    }
+}
+//工具栏监听回调
+layuiXtree.prototype.toolbar = function (obj) {
+    
+}
+//通过ID获取
+layuiXtree.prototype.idGetObj = function (id) {
+    var _this = this;
+    var obj = {};
+    (function get(d) {
+        if (d.length > 0) {
+            for (i in d) {
+                if (!d[i].childrenMenu) {
+                    d[i].childrenMenu = [];
+                }
+                if (d[i].id == id) {
+                    obj = d[i];
+                }
+                get(d[i].childrenMenu);
+            }
+        }
+    })(_this._dataJson);
+    return obj;
+}
+//渲染呈现
+layuiXtree.prototype.Rendering = function () {
+    var _this = this;
+    _this._container.innerHTML = _this._domStr;
+    _this._domStr = "";
+
+    //检查选中状态
+    var xtree_ckitems = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < xtree_ckitems.length; i++) {
+        if (xtree_ckitems[i].getAttribute('data-xend') == '1' && xtree_ckitems[i].checked) {
+            _this.ParentCheckboxChecked(xtree_ckitems[i]);
+        }
+    }
+
+    _this._form.render('checkbox'); //layui渲染
+    //绑定工具条事件
+    var tree_event = document.getElementsByName('tree_event');
+    for (var tr_i in tree_event) {
+        tree_event[tr_i].onclick = function (e) {
+            _this.toolbar({
+                event: this.getAttribute('event'),
+                data: _this.idGetObj(this.id)
+            });
+        };
+    }
+
+    var xtree_items = _this.getByClassName('layui-xtree-item');
+    var xtree_icons = _this.getByClassName('layui-xtree-icon');
+    var xtree_nullicons = _this.getByClassName('layui-xtree-icon-null');
+
+    for (var i = 0; i < xtree_items.length; i++) {
+        if (xtree_items[i].parentNode == _this._container)
+            xtree_items[i].style.margin = '5px 0 0 10px';
+        else {
+            xtree_items[i].style.margin = '5px 0 0 45px';
+            if (!_this._isopen) xtree_items[i].style.display = 'none';
+        }
+    }
+
+    for (var i = 0; i < xtree_icons.length; i++) {
+        xtree_icons[i].style.position = "relative";
+        xtree_icons[i].style.top = "3px";
+        xtree_icons[i].style.margin = "0 5px 0 0";
+        xtree_icons[i].style.fontSize = "18px";
+        xtree_icons[i].style.color = _this._isopen ? _this._iconOpenColor : _this._iconCloseColor;
+        xtree_icons[i].style.cursor = "pointer";
+
+        xtree_icons[i].onclick = function () {
+            var xtree_chi = this.parentNode.childNodes;
+            if (this.getAttribute('data-xtree') == 1) {
+                for (var j = 0; j < xtree_chi.length; j++) {
+                    if (xtree_chi[j].getAttribute('class') == 'layui-xtree-item')
+                        xtree_chi[j].style.display = 'none';
+                }
+                this.setAttribute('data-xtree', '0')
+                this.innerHTML = _this._iconClose;
+                this.style.color = _this._iconCloseColor;
+            } else {
+                for (var j = 0; j < xtree_chi.length; j++) {
+                    if (xtree_chi[j].getAttribute('class') == 'layui-xtree-item')
+                        xtree_chi[j].style.display = 'block';
+                }
+                this.setAttribute('data-xtree', '1')
+                this.innerHTML = _this._iconOpen;
+                this.style.color = _this._iconOpenColor;
+            }
+        }
+    }
+
+    for (var i = 0; i < xtree_nullicons.length; i++) {
+        xtree_nullicons[i].style.position = "relative";
+        xtree_nullicons[i].style.top = "3px";
+        xtree_nullicons[i].style.margin = "0 5px 0 0";
+        xtree_nullicons[i].style.fontSize = "18px";
+        xtree_nullicons[i].style.color = _this._iconEndColor;
+    }
+
+    _this._form.on('checkbox(xtreeck' + _this._containerid + ')', function (da) {
+        //获取当前点击复选框的容器下面的所有子级容器 
+        var xtree_chis = da.elem.parentNode.getElementsByClassName('layui-xtree-item');
+        //遍历它们,选中状态与它们的父级一致(类似全选功能)
+        for (var i = 0; i < xtree_chis.length; i++) {
+            if (!_this.getChildByClassName(xtree_chis[i], 'layui-xtree-checkbox')[0].disabled) {
+                _this.getChildByClassName(xtree_chis[i], 'layui-xtree-checkbox')[0].checked = da.elem.checked;
+                if (da.elem.checked) _this.getChildByClassName(xtree_chis[i], 'layui-xtree-checkbox')[0].nextSibling
+                    .classList.add('layui-form-checked');
+                else _this.getChildByClassName(xtree_chis[i], 'layui-xtree-checkbox')[0].nextSibling.classList
+                    .remove('layui-form-checked');
+            }
+        }
+        _this.ParendCheck(da.elem);
+        _this._click(da);
+    });
+
+    var _xtree_disableds = _this.getByClassName('layui-disabled');
+    for (var i = 0; i < _xtree_disableds.length; i++) {
+        _xtree_disableds[i].getElementsByTagName('span')[0].style.color = "#B5B5B5";
+    }
+
+    //全选按钮
+    if (_this._ckall) {
+        _this._form.on('checkbox(xtreeckall' + _this._containerid + ')', function (data) {
+            var xtree_allck = data.elem.parentNode.parentNode.getElementsByClassName('layui-form-checkbox');
+            for (var i = 0; i < xtree_allck.length; i++) {
+                if (xtree_allck[i].getAttribute('class').indexOf('layui-checkbox-disbaled') == -1) {
+                    if (data.elem.checked) {
+                        xtree_allck[i].classList.add('layui-form-checked');
+                    } else {
+                        xtree_allck[i].classList.remove('layui-form-checked');
+                    }
+                    xtree_allck[i].parentNode.getElementsByClassName('layui-xtree-checkbox')[0].checked =
+                        data.elem.checked;
+                }
+            }
+            _this._ckallSuccess();
+        });
+    }
+}
+
+//更新渲染
+layuiXtree.prototype.render = function () {
+    var _this = this;
+    _this.Loading(_this._options);
+}
+
+//子节点选中改变,父节点更改自身状态
+layuiXtree.prototype.ParendCheck = function (ckelem) {
+    var _this = this;
+    var xtree_p = ckelem.parentNode.parentNode;
+    if (xtree_p.getAttribute('class') == 'layui-xtree-item') {
+        var xtree_all = _this.getChildByClassName(xtree_p, 'layui-xtree-item');
+        var xtree_count = 0;
+
+        for (var i = 0; i < xtree_all.length; i++) {
+            if (_this.getChildByClassName(xtree_all[i], 'layui-xtree-checkbox')[0].checked) {
+                xtree_count++;
+            }
+        }
+
+        if (xtree_count <= 0) {
+            _this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0].checked = false;
+            _this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0].nextSibling.classList.remove(
+                'layui-form-checked');
+        } else {
+            _this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0].checked = true;
+            _this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0].nextSibling.classList.add(
+                'layui-form-checked');
+        }
+        this.ParendCheck(_this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0]);
+    }
+}
+
+//渲染之前按照选中的末级去改变父级选中状态
+layuiXtree.prototype.ParentCheckboxChecked = function (e) {
+    var _this = this;
+    if (e.parentNode.parentNode.getAttribute('class') == 'layui-xtree-item') {
+        var _pe = _this.getChildByClassName(e.parentNode.parentNode, 'layui-xtree-checkbox')[0];
+        _pe.checked = true;
+        _this.ParentCheckboxChecked(_pe);
+    }
+}
+
+//获取全部选中的末级checkbox对象
+layuiXtree.prototype.GetChecked = function () {
+    var _this = this;
+    var arr = new Array();
+    var arrIndex = 0;
+    var cks = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < cks.length; i++) {
+        if (cks[i].checked && cks[i].getAttribute('data-xend') == '1') {
+            arr[arrIndex] = cks[i];
+            arrIndex++;
+        }
+    }
+    return arr;
+}
+//获取全部选中的checkbox对象value
+layuiXtree.prototype.GetCheckedVal = function () {
+    var _this = this;
+    var arr = new Array();
+    var arrIndex = 0;
+    var cks = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < cks.length; i++) {
+        if (cks[i].checked) {
+            arr[arrIndex] = cks[i].value;
+            arrIndex++;
+        }
+    }
+    return arr;
+}
+
+//获取全部的原始checkbox对象
+layuiXtree.prototype.GetAllCheckBox = function () {
+    var _this = this;
+    var arr = new Array();
+    var arrIndex = 0;
+    var cks = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < cks.length; i++) {
+        arr[arrIndex] = cks[i];
+        arrIndex++;
+    }
+    return arr;
+}
+
+//根据值来获取其父级的checkbox原dom对象
+layuiXtree.prototype.GetParent = function (a) {
+    var _this = this;
+    var cks = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < cks.length; i++) {
+        if (cks[i].value == a) {
+            if (cks[i].parentNode.parentNode.getAttribute('id') == _this._container.getAttribute('id')) return null;
+            return _this.getChildByClassName(cks[i].parentNode.parentNode, 'layui-xtree-checkbox')[0];
+        }
+    }
+    return null;
+}

+ 170 - 0
js/layuiPlugins/cascade.js

@@ -0,0 +1,170 @@
+/**
+ * 请求接口格式
+ * {
+ }
+ */
+layui.define(['jquery', 'form', 'layer'], function (exports) {
+	var $ = layui.jquery,
+		form = layui.form,
+		layer = layui.layer;
+	var Class = function (obj) {
+		var _this = this;
+		_this.elem = obj.elem || 'body'; //级联容器
+		_this.url = obj.url || {}; //级联接口
+		_this.formParm = []; //表单参数名
+		typeof obj.url == 'object' && ($.each(obj.url, function (key, value) {
+			_this.formParm.push(key);
+		}));
+		_this.listParamName = obj.listParamName || {
+			valueName: 'id',
+			name: 'name'
+		};
+		_this.width = {};
+		_this.placeholder = {};
+		_this.box = $('body'); //子集容器
+		_this.boxs = []; //所有子集
+		_this.title = obj.title || null; //标题
+		_this.hostParm = { //默认请求参数名
+			idName: 'id',
+			rowsName: 'limit'
+		};
+		_this.valObj = {}; //初始值对象
+		_this[_this.hostParm['rowsName']] = obj[_this.hostParm['rowsName']] || 10000; //请求条数
+		for (var i in obj.hostParm) { //自定义请求参数名
+			_this.hostParm[i] = obj.hostParm[i];
+		}
+		_this.data = {}; //默认请求参数
+		_this.data[_this.hostParm['rowsName']] = _this[_this.hostParm['rowsName']]; //赋值参数
+		_this.verify = obj.verify || {};
+
+		$.extend(this, obj);
+		_this.init(); //初始化
+	};
+	/**
+	 *返回当前元素在数组中的下标 
+	 * @param {Object} val
+	 */
+	Class.prototype.indexOf = function (arr, val) {
+		for (var i = 0; i < arr.length; i++) {
+			if (arr[i] == val) return i;
+		}
+		return -1;
+	};
+	/**
+	 * 初始化父下拉列表
+	 */
+	Class.prototype.init = function () {
+		var _this = this;
+		//select 容器
+		_this.box = $('<div class="layui-input-inline"></div>');
+		//初始化值
+		if(JSON.stringify(_this.valObj) != '{}'){
+			_this.val();
+		}
+		//渲染首下拉框
+		_this.element(_this.formParm[0]);
+	};
+	Class.prototype.element = function (name, code, callback) {
+		var _this = this;
+		//验证子接口配置
+		if (!_this.url[name]) {
+			// layer.msg("没有配置下级接口",{icon:2,time:600});
+			return _this;
+		}
+		//获取设置默认子集请求参数(子集合父id)
+		_this.data[_this.hostParm['idName']] = code || null;
+		//设置默认请求页码
+		_this.data['page'] = _this.data['page'] || 1;
+		$.ajax({
+			url: _this.url[name],
+			data: _this.data,
+			success: function (res) {
+				//指定select唯一ID
+				let select_id = "select_"+_this.___id;
+				//获取当前级联字段下标
+				let subscript = _this.indexOf(_this.formParm, name);
+				// _this.thanName(name);
+				//保存当前select对象
+				_this.boxs[subscript] = $(_this.selectHtml(select_id, name, res));
+				//往select容器添加包装好的select对象
+				$(_this.elem).append(_this.boxs[subscript]);
+				//绑定select点击事件
+				_this.event(name,select_id);
+				//执行赋值回调函数
+				!!callback && callback(name, select_id);
+				typeof _this.valObj[name] != 'undefined' && ($("#" + select_id+name).val(_this.valObj[name]));
+				form.render();
+			}
+		});
+	};
+	/**
+	 * 包装Html
+	 */
+	Class.prototype.selectHtml = function (select_id, name, res) {
+		var _this = this;
+		var html = '<div class="layui-input-inline" style="width:'+(this.width[name] || "auto")+';"><select name="' + name + '" lay-verify="' + this.verify[name] +
+			'" lay-filter="' + select_id+name + '" id="' +
+			select_id+name + '"><option value="">'+(this.placeholder[name] || '请选择')+'</option>';
+		for (let xyz = 0; xyz < res.data.length; xyz++) {
+			html += '<option value="' + res.data[xyz][_this.listParamName['valueName']] + '">' + res.data[xyz][_this.listParamName[
+				'name']] + '</option>';
+		}
+		return (html + '</select></div>');
+	};
+	Class.prototype.event = function (name,select_id) {
+		var _this = this;
+		var x = _this.indexOf(_this.formParm, name);
+		form.on("select(" + select_id+name + ")", function (obj) {
+			_this.removeBox(x);
+			if(!obj.value){
+				return false;
+			};
+			_this.element(_this.formParm[x - 0 + 1], obj.value);
+			_this.click(obj);
+			return false;
+		});
+	};
+	Class.prototype.click = function (obj) {
+
+	};
+	Class.prototype.removeBox = function (i) {
+		var _this = this;
+		for (var x = i + 1; x < _this.boxs.length; x++) {
+			_this.boxs[x].remove();
+		}
+	};
+	Class.prototype.thanName = function (name) {
+		for (let i = 0; i < this.boxs.length; i++) {
+			if (this.boxs[i][0].firstChild && this.boxs[i][0].firstChild.name == name) {
+				this.boxs[i].remove();
+			}
+		}
+	};
+	/**
+	 * 初始值
+	 */
+	Class.prototype.val = function (obj) {
+		var _this = this;
+		$.extend(_this.valObj, obj);
+		(function temp(i) {
+			if (_this.valObj[_this.formParm[i + 1]]) {
+				_this.element(_this.formParm[i - 0 + 1], _this.valObj[_this.formParm[i]], function (name, select_id) {
+					if (i == -1) {
+						_this.removeBox(i);
+					}
+					temp(++i);
+				});
+			}
+		})(-1);
+		return _this;
+	};
+	var cascade = {};
+	cascade.render = function (e) {
+		e.___id = this.id = (this.id || 0) - 0 + 1;
+		var i = new Class(e = e || {});
+		t = $(e.elem);
+
+		return t[0] ? i : layui.hint().error("layui.cascade 没有找到" + e.elem + "元素");
+	};
+	exports('cascade', cascade);
+});

+ 141 - 0
js/layuiPlugins/cascade_bak.js

@@ -0,0 +1,141 @@
+/**
+ * 请求接口格式
+ * {
+	
+ }
+ */
+layui.define(['jquery', 'form', 'layer'], function (exports) {
+	/**
+	 *返回当前元素在数组中的下标 
+	 * @param {Object} val
+	 */
+	Array.prototype.indexOf = function (val) {
+		for (var i = 0; i < this.length; i++) {
+			if (this[i] == val) return i;
+		}
+		return -1;
+	};
+	var $ = layui.jquery,
+		form = layui.form,
+		layer = layui.layer;
+	var Class = function (obj) {
+		var _this = this;
+		_this.elem = obj.elem || 'body';//级联容器
+		_this.url = obj.url || {};//级联接口
+		_this.formParm = [];//表单参数名
+		typeof obj.url == 'object' && ($.each(obj.url, function (key, value) {
+			_this.formParm.push(key);
+		}));
+		_this.box = $('body');//子集容器
+		_this.boxs = [];//所有子集
+		_this.title = obj.title || null;//标题
+		_this.hostParm = {//默认请求参数名
+			idName: 'id',
+			rowsName: 'rows'
+		};
+		_this.valObj = {};//初始值对象
+		_this[_this.hostParm['rowsName']] = obj[_this.hostParm['rowsName']] || 10000;//请求条数
+		for (var i in obj.hostParm) {//自定义请求参数名
+			_this.hostParm[i] = obj.hostParm[i];
+		}
+		_this.data = {};//默认请求参数
+		_this.data[_this.hostParm['rowsName']] = _this[_this.hostParm['rowsName']];//赋值参数
+		_this.verify = obj.verify || {};
+
+		$.extend(this, obj);
+		_this.init();//初始化
+	};
+	/**
+	 * 初始化父下拉列表
+	 */
+	Class.prototype.init = function () {
+		var _this = this;
+		_this.box = $('<div class="layui-form-item"></div>');//select 容器
+		_this.title && (_this.box.append('<label class="layui-form-label">' + _this.title + '</label>'));//是否显示标题
+		//初始化值
+		if(JSON.stringify(_this.valObj) != '{}'){
+			_this.val();
+		}
+		_this.element(_this.formParm[0]);
+	};
+	Class.prototype.element = function (name, code,callback) {
+		var _this = this;
+		if (!_this.url[name]) {
+			// layer.msg("没有配置下级接口",{icon:2,time:600});
+			return _this;
+		}
+		_this.data[_this.hostParm['idName']] = code || null;
+		$.ajax({
+			url: _this.url[name],
+			data: _this.data,
+			async: 'false',
+			success: function (res) {
+				var select_id = "select_" + new Date().getTime();
+				_this.boxs[_this.formParm.indexOf(name)] = $(_this.selectHtml(select_id, name, res));
+				_this.box.append(_this.boxs[_this.formParm.indexOf(name)]);//往select容器添加包装好的select对象
+				$(_this.elem).append(_this.box);//追加到表单容器
+				_this.event(name);//绑定事件
+				//执行赋值回调函数
+				!!callback && callback(name, select_id);
+				typeof _this.valObj[name] != 'undefined' && ($("#" + select_id).val(_this.valObj[name]));
+				form.render();
+			}
+		});
+	};
+	/**
+	 * 包装Html
+	 */
+	Class.prototype.selectHtml = function (select_id, name, res) {
+		this.tempSelectId = new Date().getTime();
+		var html = '<div class="layui-input-inline"><select lay-search name="' + name + '" lay-verify="' + this.verify[name] + '" lay-filter="' + name + this.tempSelectId + '" id="' +
+			select_id + '"><option value="">请选择……</option>';
+		for (var xyz in res.data) {
+			html += '<option value="' + res.data[xyz].id + '">' + res.data[xyz].name + '</option>';
+		}
+		return (html + '</select></div>');
+	};
+	Class.prototype.event = function (name) {
+		var _this = this;
+		var x = _this.formParm.indexOf(name);
+		form.on("select(" + name + this.tempSelectId + ")", function (obj) {
+			_this.removeBox(x);
+			_this.element(_this.formParm[x - 0 + 1], obj.value);
+			_this.click(obj);
+			return false;
+		});
+	};
+	Class.prototype.click = function (obj) {
+
+	};
+	Class.prototype.removeBox = function (i) {
+		var _this = this;
+		for (var x = i + 1; x < _this.boxs.length; x++) {
+			_this.boxs[x].remove();
+		}
+	};
+	/**
+	 * 初始值
+	 */
+	Class.prototype.val = function (obj) {
+		var _this = this;
+		$.extend(_this.valObj, obj);
+		(function temp(i) {
+			if (_this.valObj[_this.formParm[i + 1]]) {
+				_this.element(_this.formParm[i - 0 + 1], _this.valObj[_this.formParm[i]], function (name, select_id) {
+					if (i == -1) {
+						_this.removeBox(i);
+					}
+					temp(++i);
+				});
+			}
+		})(-1);
+		return _this;
+	};
+	var cascade = {};
+	cascade.render = function (e) {
+		var i = new Class(e = e || {});
+		t = $(e.elem);
+		return t[0] ? i : layui.hint().error("layui.cascade 没有找到" + e.elem + "元素");
+	};
+	exports('cascade', cascade);
+});

+ 2182 - 0
js/layuiPlugins/dltable.js

@@ -0,0 +1,2182 @@
+/**
+ @Name:dl table 操作
+ @Author:lrd
+ */
+
+layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
+    "use strict";
+    var $ = layui.$
+        ,laytpl = layui.laytpl
+        ,laypage = layui.laypage
+        ,layer = layui.layer
+        ,form = layui.form
+        ,hint = layui.hint()
+        ,device = layui.device()
+
+        //外部接口
+        ,table = {
+            claObj:{}//全部的class对象map
+            ,obj:{}//额外保存的数据
+            ,config: {//全局配置项
+                checkName: 'LAY_CHECKED' //是否选中状态的字段名
+                ,indexName: 'LAY_TABLE_INDEX' //下标索引名
+            }
+            /**
+             * 缓存数据
+             *
+             * 结构图示
+             * cache{}                  缓存(对象)
+             *      key['data']{}       全部数据缓存(对象)
+             *          key[list][]     列表数据对象(数组)
+             *          key[map]{}      列表数据Map对象(Map)
+             *          key[treeList][] 树状结构的对象(数组)
+             *      key['cla']{}        全部已初始化过的Calss对象类(注意渲染是异步执行)
+             *          key['claIds'][] 全部已经吊用过初始化方法的表格类
+             *          key[claObjs]{key[tableId]}  全部已经初始化好的cla对象
+             *
+             */
+            ,cache: {
+                tableId:{
+                    data:{
+                        list:[]//列表数据
+                        ,map:{}//列表数据以idField或唯一值作为key的Map数据
+                        ,treeList:[]//树状数据
+                    }
+                }
+                ,cla:{
+                    claIds:{
+                        tableId:true
+                    }
+                    ,claObjs:{
+                        tableId:{}
+                    }
+                }
+                ,selectcode:{//数据字典缓存
+                    demokey:[
+                        {
+                            key:{value:''}
+                        }
+                        ]
+                }
+            }
+            ,index: layui.table ? (layui.table.index + 10000) : 0
+            /**
+             * 设置全局项
+             * @param options
+             * @return {table}
+             */
+            ,set: function(options){
+                var that = this;
+                that.config = $.extend({}, that.config, options);
+                return that;
+            }
+            /**
+             * 事件监听
+             * @param events
+             * @param callback
+             * @return {*}
+             */
+            ,on: function(events, callback){
+                return layui.onevent.call(this, MOD_NAME, events, callback);
+            }
+            ,getClass:function (tableId) {
+                return table.cache.cla.claObjs[tableId];;
+            }
+            ,pushClass:function (tableId,that) {
+                table.cache.cla.claObjs[tableId]=that;
+            }
+            ,isCalss:function (tableId) {
+                var ids=this.cache.cla.claIds||{};
+                return  ids.hasOwnProperty(tableId)||false;
+            }
+            ,isClassYes:function (tableId) {
+                var ids=this.cache.cla.claIds||{};
+                return ids[tableId]||false;
+            }
+            ,pushClassIds:function (tableId,is) {
+                this.cache.cla.claIds[tableId]=is;
+            }
+            ,setObj:function (tableId,key,o) {
+                if(!this.obj[tableId])this.obj[tableId]={};
+                this.obj[tableId][key]=o;
+            }
+            ,getObj:function (tableId, key) {
+                return this.obj[tableId]?this.obj[tableId][key]:null;
+            }
+            /**
+             * 获取列表数据
+             */
+            ,getDataList:function (tableId) {
+                if(table.cache[tableId]){
+                    return table.cache[tableId].data.list;
+                }
+                return [];
+            }
+            /**
+             * 设置列表数据
+             */
+            ,setDataList:function (tableId, list) {
+                if(!table.cache[tableId])table.cache[tableId]={};
+                if(!table.cache[tableId].data)table.cache[tableId].data={};
+                if(!table.cache[tableId].data.list)table.cache[tableId].data.list=[];
+                table.cache[tableId].data.list=list;
+            }
+            /**
+             * 获取列表数据
+             */
+            ,getDataMap:function (tableId) {
+                if(table.cache[tableId]){
+                    return table.cache[tableId].data.map;
+                }
+                return {};
+            }
+            /**
+             * 设置列表数据
+             */
+            ,setDataMap:function (tableId, map) {
+                if(!table.cache[tableId])table.cache[tableId]={};
+                if(!table.cache[tableId].data)table.cache[tableId].data={};
+                if(!table.cache[tableId].data.map)table.cache[tableId].data.map={};
+                table.cache[tableId].data.map=map;
+            }
+            /**
+             * 获取树状数据
+             */
+            ,getDataTreeList:function (tableId) {
+                if(table.cache[tableId]){
+                    return table.cache[tableId].data.treeList;
+                }
+                return [];
+            }
+            /**
+             * 设置树状数据
+             */
+            ,setDataTreeList:function (tableId, treeList) {
+                if(!table.cache[tableId])table.cache[tableId]={};
+                if(!table.cache[tableId].data)table.cache[tableId].data={};
+                if(!table.cache[tableId].data.treeList)table.cache[tableId].data.treeList={};
+                table.cache[tableId].data.treeList=treeList;
+            }
+            /**
+             * 初始化
+             * @param filter
+             * @param settings
+             * @return {table}
+             */
+            ,init:function (filter, settings) {
+                settings = settings || {};
+                var that = this
+                    ,elemTable = filter ? $('table[lay-filter="'+ filter +'"]') : $(ELEM + '[lay-data]')
+                    ,errorTips = 'Table element property lay-data configuration item has a syntax error: ';
+                //遍历数据表格
+                elemTable.each(function(){
+                    var othis = $(this), tableData = othis.attr('lay-data');
+                    try{
+                        tableData = new Function('return '+ tableData)();
+                    } catch(e){
+                        hint.error(errorTips + tableData)
+                    }
+                    var cols = [], options = $.extend({
+                        elem: this
+                        ,cols: []
+                        ,data: []
+                        ,skin: othis.attr('lay-skin') //风格
+                        ,size: othis.attr('lay-size') //尺寸
+                        ,even: typeof othis.attr('lay-even') === 'string' //偶数行背景
+                    }, table.config, settings, tableData);
+
+                    filter && othis.hide();
+
+                    //获取表头数据
+                    othis.find('thead>tr').each(function(i){
+                        options.cols[i] = [];
+                        $(this).children().each(function(ii){
+                            var th = $(this), itemData = th.attr('lay-data');
+
+                            try{
+                                itemData = new Function('return '+ itemData)();
+                            } catch(e){
+                                return hint.error(errorTips + itemData)
+                            }
+
+                            var row = $.extend({
+                                title: th.text()
+                                ,colspan: th.attr('colspan') || 0 //列单元格
+                                ,rowspan: th.attr('rowspan') || 0 //行单元格
+                            }, itemData);
+
+                            if(row.colspan < 2) cols.push(row);
+                            options.cols[i].push(row);
+                        });
+                    });
+
+                    //获取表体数据
+                    othis.find('tbody>tr').each(function(i1){
+                        var tr = $(this), row = {};
+                        //如果定义了字段名
+                        tr.children('td').each(function(i2, item2){
+                            var td = $(this)
+                                ,field = td.data('field');
+                            if(field){
+                                return row[field] = td.html();
+                            }
+                        });
+                        //如果未定义字段名
+                        layui.each(cols, function(i3, item3){
+                            var td = tr.children('td').eq(i3);
+                            row[item3.field] = td.html();
+                        });
+                        options.data[i1] = row;
+                    });
+                    table.render(options);
+                });
+
+                return that;
+            }
+            /**
+             * 渲染入口方法(核心入口)
+             */
+            ,render:function (options) {
+                table.pushClassIds(options.id);
+                var inst = new Class(options);
+                return thisTable.call(inst);
+            }
+            /**
+             * 对应的表格加载完成后执行
+             * @param tableId
+             * @param fn
+             */
+            ,ready:function (tableId,fn) {
+                var is=false;
+                var myDate=new Date();
+                function isReady() {
+                    if(tableId){
+                        var that=table.getClass(tableId);
+                        if(that&&that.hasOwnProperty('layBody')){
+                            fn(that);
+                            is=true;
+                        }else{
+                            var myDate2=new Date();
+                            var i=myDate2.getTime()-myDate.getTime();
+                            if(i<=(1000*10)&&!is){//大于10秒退出
+                                setTimeout(isReady,50);
+                            }
+                        }
+                    }
+                }
+                if(tableId&&fn){
+                    setTimeout(isReady,50);
+                }
+            }
+            /**
+             * 获取表格选中记录
+             * @param tableId
+             * @return {{data: Array, isAll: boolean}}
+             */
+            ,checkStatus:function (tableId) {
+                var nums = 0
+                    ,invalidNum = 0
+                    ,arr = []
+                    ,data = table.getDataList(tableId) || [];
+                //计算全选个数
+                layui.each(data, function(i, item){
+                    if(item.constructor === Array){
+                        invalidNum++; //无效数据,或已删除的
+                        return;
+                    }
+                    if(item[table.config.checkName]){
+                        nums++;
+                        arr.push(table.clearCacheKey(item));
+                    }
+                });
+                return {
+                    data: arr //选中的数据
+                    ,isAll: data.length ? (nums === (data.length - invalidNum)) : false //是否全选
+                };
+            }
+            /**
+             * 设置表格复选状态
+             * @param tableId
+             * @param value     此值存在时为设置操作
+             * @returns {*}
+             */
+            ,setCheckStatus:function(tableId, fildName, ids){
+                var retObj=null;
+                var that=table.getClass(tableId)
+                    ,invalidNum = 0
+                    ,arr = []
+                    ,data = table.getDataList(tableId) || []
+                    ,childs = that.layBody.find('input[name="layTableCheckbox"]')//复选框
+                ;
+                if(fildName&&ids){//设置选中
+                    var idsarr=ids.split(',');
+                    idsarr.forEach(function (o) {
+                        // console.log(o);
+                        var temo=null;
+                        data.forEach(function (e) {
+                            var b1=e[fildName]+"";
+                            var b2=o+"";
+                            if(b1==b2){
+                                temo=e;
+                                return;
+                            };
+                        });
+                        if(temo){
+                            var v=temo[table.config.indexName];
+                            that.layBody.find('input[name="layTableCheckbox"][value="'+v+'"]').prop("checked",true);
+                            that.setCheckData(v, true);
+                        }
+                    });
+                    that.syncCheckAll();
+                    that.renderForm('checkbox');
+                }
+                return retObj;
+            }
+            /**
+             * 表格单选状态
+             * @param tableId
+             * @param value     此值存在时为设置操作
+             * @returns {*}
+             */
+            ,radioStatus:function (tableId) {
+                var retObj=null;
+                var nums = 0
+                    ,invalidNum = 0
+                    ,arr = []
+                    ,data = table.getDataList(tableId) || [];
+                var v=$("input[name='"+TABLE_RADIO_ID+tableId+"']:checked").val();
+                v=parseInt(v);
+                data.forEach(function (e) {
+                    if(e[table.config.indexName]==v){
+                        retObj=e;
+                        return;
+                    };
+                });
+                return retObj;
+            }
+            /**
+             * 设置表格单选状态
+             * @param tableId
+             * @param value     此值存在时为设置操作
+             * @returns {*}
+             */
+            ,setRadioStatus:function (tableId,fildName,value) {
+                var retObj=null;
+                var nums = 0
+                    ,invalidNum = 0
+                    ,arr = []
+                    ,data = table.getDataList(tableId) || [];
+
+                if(fildName&&value){//设置选中
+                    data.forEach(function (e) {
+                        var b1=e[fildName]+"";
+                        var b2=value+"";
+                        if(b1==b2){
+                            retObj=e;
+                            return;
+                        };
+                    });
+
+                    if(retObj){
+                        var v=retObj[table.config.indexName];
+                        $("input:radio[name='"+TABLE_RADIO_ID+tableId+"'][value='"+v+"']").prop("checked",true);
+                        form.render('radio');
+                    }
+                }
+                return retObj;
+            }
+            /**
+             * 清除临时Key
+             * @param data
+             * @return {*}
+             */
+            ,clearCacheKey:function (data) {
+                data = $.extend({}, data);
+                delete data[table.config.checkName];
+                delete data[table.config.indexName];
+                return data;
+            }
+            /**
+             * 刷新数据
+             * @param id
+             * @param options
+             * @return {*}
+             */
+            ,query:function (tableId, options) {
+                var that= table.getClass(tableId);
+                that.renderTdCss();
+                that.pullData(that.page, that.loading());
+            }
+            /**
+             * 此方法为整体重新渲染(重量级刷新方法)
+             * @param id
+             * @param options
+             */
+            ,reload:function (tableId, options) {
+                var config = thisTable.config[tableId];
+                options = options || {};
+                if(!config) return hint.error('The ID option was not found in the table instance');
+                if(options.data && options.data.constructor === Array) delete config.data;
+                return table.render($.extend(true, {}, config, options));
+            }
+            /**
+             * 添加一行或多行数据
+             * @param tableId   表格id
+             * @param index     在第几个位置插入(从0开始)
+             * @param data      数据
+             * @returns {*}
+             */
+            ,addRow:function (tableId, index, data) {
+                var that=table.getClass(tableId)
+                    ,options=that.config
+                    ,invalidNum = 0
+                    ,arr = []
+                    ,list = table.getDataList(tableId) || [];
+                //插入到父节点后面
+                list.splice(index,0,data);//更新缓存
+                table.restNumbers(list);//重置下标
+                that.resetData(list);
+                //如果是树状则处理数据
+                if(options.isTree) {
+                    //处理父级
+                    var uo=that.treeFindUpData(data);
+                    if(uo) {
+                        that.treeNodeOpen(uo, true);//展开节点
+                        that.renderTreeConvertShowName(uo);
+                    }
+                }
+                //生成html
+                var tds=that.renderTr(data,data[table.config.indexName]);
+                var trs='<tr data-index="'+ data[table.config.indexName] +'"'+that.renderTrUpids(data)+'>'+ tds.join('') + '</tr>';
+                if(index==0){//在第一个位置插入
+                    var  tbody=that.layBody.find('table tbody');
+                    $(tbody).prepend(trs);
+                    that.layBody.find(".layui-none").remove();
+                }else{
+                    var o=that.layBody.find('[data-index='+(index-1)+']');//父节点dom树
+                    $(o).after(trs);
+                }
+                that.renderPage(that.config.page.count+1);//分页渲染
+                that.restNumbers();
+            }
+            /**
+             * 删除一行或多行数据
+             * (如果是树状则删除自己和子节点)
+             * @param tableId
+             * @param data(1、数组;2、对象)
+             */
+            ,delRow:function (tableId, data) {
+                //1、页面清除 2、缓存清除
+                var that=table.getClass(tableId)
+                    ,options=that.config
+                    ,list=table.getDataList(tableId);
+                var sonList=[];//需要删除的数据
+                var delIds={};//需要删除的数据map
+                var delDatas=[];
+                if(!that||!data)return;
+                if(table.kit.isArray(data)){//是数组,删除多个
+                    delDatas=data;
+                }else{
+                    delDatas[0]=data;
+                }
+                sonList=options.isTree?table.treeFindSonList(that.config.id,delDatas):delDatas;
+                //页面元素处理
+                sonList.forEach(function (temo) {
+                    var index=temo[table.config.indexName];
+                    delIds[index]=index;//设置代删除的id集合
+                    var tr = that.layBody.find('tr[data-index="'+ index +'"]');
+                    tr.remove();
+                });
+                //数据处理
+                that.restNumbers();
+                var newList=[];//重构一个新的数组
+                for (var i=0,len=list.length;i<len;i++) {
+                    var isP=true;
+                    var temo1=null;
+                    sonList.forEach(function (temo) {
+                        if (temo[table.config.indexName] === list[i][table.config.indexName]) {
+                            isP = false;
+                        }
+                    });
+                    if(isP){
+                        newList.push(list[i]);
+                    }
+                }
+                table.restNumbers(newList);
+                that.resetData(newList);//更新缓存数据
+                if(options.page)that.renderPage(that.config.page.count-Object.keys(delIds).length);//分页渲染
+            }
+            ,restNumbers:function (list) {
+                if(!list)return;
+                var i=0;
+                list.forEach(function (o) {
+                    o[table.config.indexName]=i;
+                    i++;
+                });
+            }
+            /**
+             * 获取全部需要子节点对象集合
+             * @param data(数组或对象)
+             */
+            ,treeFindSonList:function (tableId,data) {
+                var that=table.getClass(tableId);
+                if(!that||!data)return [];
+                var delDatas=[];
+                var sonList=[];//需要删除的数据
+                var delIds={};//需要删除的数据map
+                if(table.kit.isArray(data)){//是数组,删除多个
+                    delDatas=data;
+                }else{
+                    delDatas[0]=data;
+                }
+                delDatas.forEach(function (temo) {
+                    if(temo.children.length>0){
+                        var temSonList=that.treeFindSonData(temo);
+                        temSonList.forEach(function (temii) {
+                            if(!delIds[temii[table.config.indexName]]){
+                                sonList.push(temii);
+                                delIds[temii[table.config.indexName]]=temii[table.config.indexName];
+                            }
+                        });
+                    }
+                    sonList.push(temo);
+                    delIds[temo[table.config.indexName]]=temo[table.config.indexName];
+                });
+                return sonList;
+            }
+            /**
+             * 获取全部需要子节点id集合
+             * @param data(数组或对象)
+             */
+            ,treeFindSonIds:function (tableId,data) {
+                var delIds=[];
+                var sonList=table.treeFindSonList(tableId,data);
+                sonList.forEach(function (temo) {
+                    delIds.push([table.config.indexName]);
+                });
+                return delIds;
+            }
+            /**
+             * 获取全部的id字段集合
+              * @param tableId
+             * @param data
+             * @returns {Array}
+             */
+            ,treeFindSonIdFields:function (tableId,data) {
+                var idField=[];
+                var that=table.getClass(tableId);
+                var sonList=table.treeFindSonList(tableId,data);
+                sonList.forEach(function (temo) {
+                    idField.push(temo[that.config.idField]);
+                });
+                return idField;
+            }
+            /**
+             * 工具方法对象
+             */
+            ,kit:{
+                isArray:function (o) {
+                    return Object.prototype.toString.call(o) === '[object Array]';
+                }
+            }
+        }
+        //操作当前实例
+        ,thisTable = function(){
+            var that = this
+                ,options = that.config
+                ,id = options.id;
+            id && (thisTable.config[id] = options);
+            return {
+                reload: function(options){
+                    that.reload.call(that, options);
+                }
+                ,config: options
+            }
+        }
+        //字符常量
+        ,MOD_NAME = 'dltable', ELEM = '.layui-table', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'layui-disabled', NONE = 'layui-none'
+        ,ELEM_VIEW = 'layui-table-view', ELEM_HEADER = '.layui-table-header', ELEM_BODY = '.layui-table-body', ELEM_MAIN = '.layui-table-main', ELEM_FIXED = '.layui-table-fixed', ELEM_FIXL = '.layui-table-fixed-l', ELEM_FIXR = '.layui-table-fixed-r', ELEM_TOOL = '.layui-table-tool', ELEM_PAGE = '.layui-table-page', ELEM_SORT = '.layui-table-sort', ELEM_EDIT = 'layui-table-edit', ELEM_HOVER = 'layui-table-hover'
+        ,TABLE_RADIO_ID='table_radio_'
+        ,ELEM_FILTER='.layui-table-filter'
+        ,TREE_ID='treeId',TREE_UPID='treeUpId',TREE_SHOW_NAME='treeShowName',TREE_KEY_MAP='tree_key_map'
+        //thead区域模板
+        ,TPL_HEADER = function(options){
+            var rowCols = '{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';
+            options = options || {};
+            return ['<table cellspacing="0" cellpadding="0" border="0" class="layui-table" '
+                ,'{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>'
+                ,'<thead>'
+                ,'{{# layui.each(d.data.cols, function(i1, item1){ }}'
+                ,'<tr>'
+                    ,'{{# layui.each(item1, function(i2, item2){ }}'
+                        ,'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}'
+                        ,'{{# if(item2.fixed === "right"){ right = true; } }}'
+                        ,function(){
+                            if(options.fixed && options.fixed !== 'right'){
+                                return '{{# if(item2.fixed && item2.fixed !== "right"){ }}';
+                            }
+                            if(options.fixed === 'right'){
+                                return '{{# if(item2.fixed === "right"){ }}';
+                            }
+                            return '';
+                        }()
+                        ,'<th data-field="{{ item2.field||i2 }}" {{# if(item2.minWidth){ }}data-minwidth="{{item2.minWidth}}"{{# } }} '+ rowCols +' {{# if(item2.unresize){ }}data-unresize="true"{{# } }}>'
+                        ,'<div class="layui-table-cell laytable-cell-'
+                        ,'{{# if(item2.colspan > 1){ }}'
+                        ,'group'
+                        ,'{{# } else { }}'
+                        ,'{{d.index}}-{{item2.field || i2}}'
+                        ,'{{# if(item2.type !== "normal"){ }}'
+                        ,' laytable-cell-{{ item2.type }}'
+                        ,'{{# } }}'
+                        ,'{{# } }}'
+                        ,'" {{#if(item2.align){}}align="{{item2.align}}"{{#}}}>'
+                        ,'{{# if(item2.type === "checkbox"){ }}' //复选框
+                        ,'<input type="checkbox" name="layTableCheckbox" lay-skin="primary" lay-filter="layTableAllChoose" {{# if(item2[d.data.checkName]){ }}checked{{# }; }}>'
+                        ,'{{# } else { }}'
+                        ,'<span>{{item2.title||""}}</span>'
+                        ,'{{# if(!(item2.colspan > 1) && item2.sort){ }}'
+                        ,'<span class="layui-table-sort layui-inline"><i class="layui-edge layui-table-sort-asc"></i><i class="layui-edge layui-table-sort-desc"></i></span>'
+                        ,'{{# } }}'
+                        ,'{{# } }}'
+                        ,'</div>'
+                        ,'</th>'
+                        ,(options.fixed ? '{{# }; }}' : '')
+                    ,'{{# }); }}'
+                ,'</tr>'
+                ,'{{# }); }}'
+                ,'</thead>'
+                ,'</table>'].join('');
+        }
+        /**
+         * 行内过滤区域
+         */
+        ,TPL_FILTER = function(options){
+        }
+        //tbody区域模板
+        ,TPL_BODY = ['<table cellspacing="0" cellpadding="0" border="0" class="layui-table" '
+            ,'{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>'
+            ,'<tbody></tbody>'
+            ,'</table>'].join('')
+        //主模板
+        ,TPL_MAIN = ['<div class="layui-form layui-border-box {{d.VIEW_CLASS}}" lay-filter="LAY-table-{{d.index}}" style="{{# if(d.data.width){ }}width:{{d.data.width}}px;{{# } }} {{# if(d.data.height){ }}height:{{d.data.height}}px;{{# } }}">'
+
+            ,'{{# if(d.data.toolbar){ }}'
+            ,'<div class="layui-table-tool"></div>'
+            ,'{{# } }}'
+
+            ,'<div class="layui-table-box">'
+            ,'{{# var left, right; }}'
+            ,'<div class="layui-table-header">'
+            ,TPL_HEADER()
+            ,'</div>'
+            ,'<div class="layui-table-filter">'
+            ,TPL_FILTER()
+            ,'</div>'
+            ,'<div class="layui-table-body layui-table-main">'
+            ,TPL_BODY
+            ,'</div>'
+
+            ,'{{# if(left){ }}'
+            ,'<div class="layui-table-fixed layui-table-fixed-l">'
+            ,'<div class="layui-table-header">'
+            ,TPL_HEADER({fixed: true})
+            ,'</div>'
+            ,'<div class="layui-table-body">'
+            ,TPL_BODY
+            ,'</div>'
+            ,'</div>'
+            ,'{{# }; }}'
+
+            ,'{{# if(right){ }}'
+            ,'<div class="layui-table-fixed layui-table-fixed-r">'
+            ,'<div class="layui-table-header">'
+            ,TPL_HEADER({fixed: 'right'})
+            ,'<div class="layui-table-mend"></div>'
+            ,'</div>'
+            ,'<div class="layui-table-body">'
+            ,TPL_BODY
+            ,'</div>'
+            ,'</div>'
+            ,'{{# }; }}'
+            ,'</div>'
+
+            ,'{{# if(d.data.page){ }}'
+            ,'<div class="layui-table-page">'
+            ,'<div id="layui-table-page{{d.index}}"></div>'
+            ,'</div>'
+            ,'{{# } }}'
+
+            /*,'<style>'
+            ,'{{# layui.each(d.data.cols, function(i1, item1){'
+            ,'layui.each(item1, function(i2, item2){ }}'
+            ,'.laytable-cell-{{d.index}}-{{item2.field||i2}}{ '
+            ,'{{# if(item2.width){ }}'
+            ,'width: {{item2.width}}px;'
+            ,'{{# } }}'
+            ,' }'
+            ,'{{# });'
+            ,'}); }}'
+            ,'</style>'*/
+            ,'</div>'].join('')
+        ,_WIN = $(window)
+        ,_DOC = $(document)
+
+        //构造器
+        ,Class = function(options){
+            var that = this;
+            that.index = ++table.index;
+            that.config = $.extend({}, that.config, table.config, options);
+            that.render();
+            table.pushClass(options.id,that);
+        };
+
+    //默认配置
+    Class.prototype.config = {
+        limit: 10 //每页显示的数量
+        ,loading: true //请求数据时,是否显示loading
+        ,cellMinWidth: 60 //所有单元格默认最小宽度
+        ,text: {
+            none: '无数据'
+        }
+        ,isFilter:false//是否开启行内过滤
+        ,method:'post'//默认以post方式请求后台
+    };
+    //表格渲染
+    Class.prototype.render = function(){
+        var that = this
+            ,options = that.config;
+        options.elem = $(options.elem);
+        options.where = options.where || {};
+        options.id = options.id || options.elem.attr('id');
+        //请求参数的自定义格式
+        options.request = $.extend({
+            pageName: 'page'
+            ,limitName: 'limit'
+        }, options.request)
+        //响应数据的自定义格式
+        options.response = $.extend({
+            statusName: 'code'
+            ,statusCode: 0
+            ,msgName: 'msg'
+            ,dataName: 'data'
+            ,countName: 'count'
+        }, options.response);
+        //如果 page 传入 laypage 对象
+        if(typeof options.page === 'object'){
+            options.limit = options.page.limit || options.limit;
+            options.limits = options.page.limits || options.limits;
+            that.page = options.page.curr = options.page.curr || 1;
+            delete options.page.elem;
+            delete options.page.jump;
+        }
+        if(!options.elem[0]) return that;
+        that.setArea(); //动态分配列宽高
+        //开始插入替代元素
+        var othis = options.elem
+            ,hasRender = othis.next('.' + ELEM_VIEW)
+
+            //主容器
+            ,reElem = that.elem = $(laytpl(TPL_MAIN).render({
+                VIEW_CLASS: ELEM_VIEW
+                ,data: options
+                ,index: that.index //索引
+            }));
+        options.index = that.index;
+        //生成替代元素
+        hasRender[0] && hasRender.remove(); //如果已经渲染,则Rerender
+        othis.after(reElem);
+        that.renderTdCss();
+        //各级容器
+        that.layHeader = reElem.find(ELEM_HEADER);  //表头
+        that.layMain = reElem.find(ELEM_MAIN);//内容区域
+        that.layBody = reElem.find(ELEM_BODY);//内容区域
+        that.layFixed = reElem.find(ELEM_FIXED);//浮动区域
+        that.layFixLeft = reElem.find(ELEM_FIXL);//左浮动
+        that.layFixRight = reElem.find(ELEM_FIXR);//有浮动
+        that.layTool = reElem.find(ELEM_TOOL);//工具栏区域
+        that.layPage = reElem.find(ELEM_PAGE);//分页区域
+        that.layFilter=reElem.find(ELEM_FILTER);//行内过滤条件区域
+        that.layTool.html(
+            laytpl($(options.toolbar).html()||'').render(options)
+        );
+        if(options.height) that.fullSize(); //设置body区域高度
+        //如果多级表头,则填补表头高度
+        if(options.cols.length > 1){
+            var th = that.layFixed.find(ELEM_HEADER).find('th');
+            th.height(that.layHeader.height() - 1 - parseFloat(th.css('padding-top')) - parseFloat(th.css('padding-bottom')));
+        }
+        //渲染过滤区域
+        if(options.isFilter){
+            that.layFilter.html(
+                that.renderFilter()
+            );
+        }
+        //请求数据
+        that.pullData(that.page);
+        that.events();
+    };
+    //根据列类型,定制化参数
+    Class.prototype.initOpts = function(item){
+        var that = this,
+            options = that.config
+            ,initWidth = {
+                checkbox: 48
+                ,space: 15
+                ,numbers: 40
+            };
+
+        //让 type 参数兼容旧版本
+        if(item.checkbox) item.type = "checkbox";
+        if(item.space) item.type = "space";
+        if(!item.type) item.type = "normal";
+
+        if(item.type !== "normal"){
+            item.unresize = true;
+            item.width = item.width || initWidth[item.type];
+        }
+
+        if(options.isFilter){//开启行内过滤
+            if(item.isFilter!=false){
+                item.isFilter=true;
+            }
+        }
+    };
+    //动态分配列宽高
+    Class.prototype.setArea = function(){
+        var that = this,
+            options = that.config
+            ,colNums = 0 //列个数
+            ,autoColNums = 0 //自动列宽的列个数
+            ,autoWidth = 0 //自动列分配的宽度
+            ,countWidth = 0 //所有列总宽度和
+            ,cntrWidth = options.width ||function(){ //获取容器宽度
+                //如果父元素宽度为0(一般为隐藏元素),则继续查找上层元素,直到找到真实宽度为止
+                var getWidth = function(parent){
+                    var width, isNone;
+                    parent = parent || options.elem.parent()
+                    width = parent.width();
+                    try {
+                        isNone = parent.css('display') === 'none';
+                    } catch(e){}
+                    if(parent[0] && (!width || isNone)) return getWidth(parent.parent());
+                    return width;
+                };
+                return getWidth();
+            }();
+        //统计列个数
+        that.eachCols(function(){
+            colNums++;
+        });
+        //减去边框差
+        cntrWidth = cntrWidth - function(){
+            return (options.skin === 'line' || options.skin === 'nob') ? 2 : colNums + 1;
+        }();
+        //遍历所有列
+        layui.each(options.cols, function(i1, item1){
+            layui.each(item1, function(i2, item2){
+                var width;
+                if(!item2){
+                    item1.splice(i2, 1);
+                    return;
+                }
+                that.initOpts(item2);
+                width = item2.width || 0;
+                if(item2.colspan > 1) return;
+                if(/\d+%$/.test(width)){
+                    item2.width = width = Math.floor((parseFloat(width) / 100) * cntrWidth);
+                } else if(item2._is_width_dev||!width){ //列宽未填写
+                    item2._is_width_dev=true;//采用默认宽度的列
+                    item2.width = width = 0;
+                    autoColNums++;
+                }
+                countWidth = countWidth + width;
+            });
+        });
+        that.autoColNums = autoColNums; //记录自动列数
+        //如果未填充满,则将剩余宽度平分。否则,给未设定宽度的列赋值一个默认宽
+        (cntrWidth > countWidth && autoColNums) && (
+            autoWidth = (cntrWidth - countWidth) / autoColNums
+        );
+        layui.each(options.cols, function(i1, item1){
+            layui.each(item1, function(i2, item2){
+                var minWidth = item2.minWidth || options.cellMinWidth;
+                if(item2.colspan > 1) return;
+                if(item2.width === 0){
+                    item2.width = Math.floor(autoWidth >= minWidth ? autoWidth : minWidth); //不能低于设定的最小宽度
+                }
+            });
+        });
+
+        //高度铺满:full-差距值
+        var th=that.getParentDivHeight(options.id);
+        that.fullHeightGap=0;
+        if(options.height){
+            if(/^full-\d+$/.test(options.height)){
+                that.fullHeightGap = options.height.split('-')[1];
+            }
+        }
+        options.height = th - that.fullHeightGap;
+
+        layui.each(options.cols, function(i1, item1){
+            layui.each(item1, function(i2, item2){
+            })
+        });
+    };
+    /**
+     * 表格获取父容器高度
+     * @param tableId
+     */
+    Class.prototype.getParentDivHeight = function(tableId){
+        var th=$("#"+tableId).parent().height();
+        return th;
+    };
+    //表格重载
+    Class.prototype.reload = function(options){
+        var that = this;
+        if(that.config.data && that.config.data.constructor === Array) delete that.config.data;
+        that.config = $.extend({}, that.config, options);
+        //获取行内过滤的值
+        that.render();
+    };
+    //页码
+    Class.prototype.page = 1;
+    /**
+     * 重置下标(插入删除等操作)
+     * 1、data-index中的下标
+     * 2、tr中data的值
+     * 3、下标字段的值
+     * @param list
+     */
+    Class.prototype.restNumbers=function(){
+        var that = this
+            ,options = that.config;
+        var  trs=that.layBody.find('table tbody tr');
+        var i=0;
+        trs.each(function (o) {
+            $(this).attr("data-index",i);
+            $(this).find(".laytable-cell-numbers p").text(i+1);
+            $(this).data('index',i);
+            i++;
+        });
+    }
+    /**
+     * 重置当前表格的数据(1、普通列表;2树状表格)
+     * 将列表数据转成树形结构和符合table展示的列表
+     * @param list          列表数据
+     * @param field_Id      树形结构主键字段
+     * @param field_upId    树形结构上级字段
+     * @returns {Array}     [0]表格列表  [1]树形结构
+     */
+    Class.prototype.resetData=function(list) {
+        var that = this
+            ,options = that.config;
+        var datas=[];
+        var treeList=[];
+        var tableList=[];
+        var map={};//列表map,fieldId为key
+        datas.push(tableList);//table结构
+        datas.push(treeList)//tree树结构
+        datas.push(map)//data数据 map结构
+        if(list==null||list.length<=0)return datas;
+        //设置默认参数
+        for (var i = 0; i < list.length; i++) {
+            var n = list[i];
+            if(options.isTree){
+                if(!n.hasOwnProperty("is_open")){//如果不存在该属性则默认为true
+                    n.is_open=true;
+                }
+                if(!n.hasOwnProperty("is_show")){//如果不存在该属性则默认为true
+                    n.is_show=true;
+                }
+            }
+        }
+        if(options.isTree){//树状
+            var field_Id=options[TREE_ID];
+            var field_upId=options[TREE_UPID];
+            //处理树结构
+            var fa = function(upId) {
+                var _array = [];
+                for (var i = 0; i < list.length; i++) {
+                    var n = list[i];
+                    if (n[field_upId] === upId) {
+                        n.children = fa(n[field_Id]);
+                        _array.push(n);
+                    }
+                }
+                return _array;
+            }
+            treeList=fa(list[0][field_upId],"");//递归
+            //处理表格结构
+            var fa2=function (l,level,upids) {
+                for (var i = 0; i < l.length; i++) {
+                    var n = l[i];
+                    n.level=level;//设置当前层级
+                    n.upIds=upids;
+                    tableList.push(n);
+                    if (n.children&&n.children.length>0) {
+                        fa2(n.children,1+level,upids+"_"+n[field_Id]+"_");
+                    }
+                }
+                return;
+            }
+            fa2(treeList,1,"");
+        }
+        else{
+            tableList=list;
+        }
+        //设置map数据集合
+        tableList.forEach(function (o) {
+            map[o[field_Id]]=o;
+        });
+        //设置到内存中去
+        table.setDataList(that.config.id,tableList);
+        table.setDataTreeList(that.config.id,treeList);
+        table.setDataMap(that.config.id,map);
+        return datas;
+    }
+    /**
+     * 根据id从表格数据中获取对象
+     * @param data
+     * @param field_Id
+     * @param field_upId
+     * @returns {Array}
+     */
+    Class.prototype.treeFindDataById=function(u_Id) {
+        var that = this
+            ,options = that.config;
+        var e=null;
+        var list=table.getDataList(that.key);
+        var key=options[TREE_ID];
+        list.forEach(function (o) {
+             if(o[key]==u_Id){
+                 e=o;
+                 return;
+             }
+        });
+        return e;
+    }
+    /**
+     * 获取父节点
+     * @param u_Id
+     */
+    Class.prototype.treeFindUpData=function(o){
+        var uOjb=null;
+        var that = this
+            ,options = that.config;
+        //处理父级
+        var key=options[TREE_UPID];//父节点key名称
+        var mapData=table.getDataMap(that.config.id);//获取map形式对象集合
+        uOjb=mapData[o[key]];
+        return uOjb;
+    }
+    /**
+     * 根据父id获取全部的叶子节点(递归)
+     * @param o 数据对象
+     * @return {string}
+     */
+    Class.prototype.treeFindSonData=function (data) {
+        var objs=[];
+        function f(o) {
+            if(o.children.length>0){
+                o.children.forEach(function (i) {
+                    objs.push(i);
+                    if(i.children.length>0){
+                        f(i);
+                    }
+                });
+            }
+        }f(data);
+        return objs;
+    };
+    /**
+     * 叶子节点显示转换
+     * @param o             数据
+     * @param fieldName     树显示列名
+     * @returns {string}
+     */
+    Class.prototype.treeConvertShowName=function (o) {
+        var that = this
+            ,options = that.config;
+        var isTreeNode=(o.children&&o.children.length>0);
+        var temhtml='<div style="float: left;height: 28px;line-height: 28px;padding-left: '+
+            function () {
+                if(isTreeNode){
+                    return '5px'
+                }else{
+                    return '21px'
+                }
+            }()
+            +'">'
+            +function () {//位移量
+                var nbspHtml="<i>"//一次位移
+                for(var i=1;i<o.level;i++) {
+                    nbspHtml = nbspHtml + "&nbsp;&nbsp;&nbsp;&nbsp;";
+                }
+                nbspHtml=nbspHtml+"</i>";
+                return nbspHtml;
+            }()
+            +function () {//图标或占位符
+                var temTreeHtml='';
+                if(isTreeNode)temTreeHtml='<i class="layui-icon layui-tree-head">&#xe625;</i> ';
+                return temTreeHtml;
+            }()
+            +'</div>';
+        return temhtml;
+    };
+    /**
+     * 节点的展开或折叠
+     * @param o         节点数据(树状表格)
+     * @param is_open    展开(true)或折叠(false)
+     *
+     * 每个节点有两种状态,
+     * 1、打开状态(is_open)   打开状态只需在点击瞬间控制,其他时候不需要变动
+     * 2、显示状态(显示或隐藏) 显示状态根据父级节点控制,父级节点是显示并且打开状态的则显示,否则不显示,但不影响其打开状态
+     */
+    Class.prototype.treeNodeOpen=function (o,is_open) {
+        var that = this
+            ,options = that.config
+            ,tr = that.layBody.find('tr[data-index="'+ o[table.config.indexName] +'"]');
+        o.is_open=is_open;
+        //处理树结构
+        var fa = function(e) {
+            if(e.children&&e.children.length>0){
+                var temList=e.children;
+                for (var i = 0; i < temList.length; i++) {
+                    var n = temList[i];
+                    if(o.is_open){//打开状态的,关闭
+                        if(e.is_open&&e.is_show){//该节点显示
+                            var temo=that.layBody.find('tr[data-index="'+ n[table.config.indexName] +'"]');
+                            temo.show();
+                            n.is_show=true;
+                        }
+                    }else{
+                        var temo=that.layBody.find('tr[data-index="'+ n[table.config.indexName] +'"]');
+                        temo.hide();
+                        n.is_show=false;
+                    }
+                    fa(n);
+                }
+            }
+        }
+        fa(o);
+        //处理图标
+        var dbClickI=tr.find('.layui-tree-head');
+        if(o.is_open){//打开状态
+            dbClickI.html('&#xe625;');
+        }else{
+            dbClickI.html('&#xe623;');
+        }
+    };
+    //获得数据
+    Class.prototype.pullData = function(curr, loadIndex){
+        var that = this
+            ,options = that.config
+            ,request = options.request
+            ,response = options.response
+            ,sort = function(){
+            if(typeof options.initSort === 'object'){
+                that.sort(options.initSort.field, options.initSort.type);
+            }
+        };
+        that.startTime = new Date().getTime(); //渲染开始时间
+        if(options.url){ //Ajax请求
+            var params = {};
+            params[request.pageName] = curr;
+            params[request.limitName] = options.limit;
+            //行内过滤条件
+            var list=that.layFilter.find("[name^='filter_']");
+            layui.each(list,function (i, o) {
+               params[o.name]=$(o).val();
+            });
+            $.ajax({
+                type: options.method || 'get'
+                ,url: options.url
+                ,data: $.extend(params, options.where)
+                ,dataType: 'json'
+                ,success: function(res){
+                    if(res.data.length){
+                        let arr = [],obj = res.data;
+                        (function objArr(obj,id) {
+                            for (let i in obj) {
+                                obj[i].myid = id+i;
+                                obj[i].myPid = id;
+                                if (obj[i].childMenus != null) {
+                                    objArr(obj[i].childMenus,id+i);
+                                    obj[i].childMenus = null;
+                                    arr.push(obj[i]);
+                                } else {
+                                    arr.push(obj[i]);
+                                }
+                            }
+                        })(obj,'#');
+    
+                        res.data = arr.reverse();
+                        console.log(res.data);
+                        res.is = true;
+                        res.count = res.data.length;
+                    }else{
+                        res.data[0] = {name:"无数据",myid:'0',myPid:'0',id:'0'};
+                    }
+                    that.resetData(res.data);
+                    res.data=table.getDataList(options.id);
+                    if(res[response.statusName] != response.statusCode){
+                        that.renderForm();
+                        that.layMain.html('<div class="'+ NONE +'">'+ (res[response.msgName] || '返回的数据状态异常') +'</div>');
+                    } else {
+                        that.renderData(res, curr, res[response.countName]), sort();
+                        options.time = (new Date().getTime() - that.startTime) + ' ms'; //耗时(接口请求+视图渲染)
+                    }
+                    loadIndex && layer.close(loadIndex);
+                    typeof options.done === 'function' && options.done(res, curr, res[response.countName]);
+
+                }
+                ,error: function(e, m){
+                    that.layMain.html('<div class="'+ NONE +'">数据接口请求异常</div>');
+                    that.renderForm();
+                    loadIndex && layer.close(loadIndex);
+                }
+            });
+        } else if(options.data && options.data.constructor === Array){ //已知数据
+            var res = {},startLimit = curr*options.limit - options.limit
+            res[response.dataName] = options.data.concat().splice(startLimit, options.limit);
+            res[response.countName] = options.data.length;
+            that.renderData(res, curr, options.data.length), sort();
+            typeof options.done === 'function' && options.done(res, curr, res[response.countName]);
+        }
+    };
+    //遍历表头
+    Class.prototype.eachCols = function(callback){
+        var cols = $.extend(true, [], this.config.cols)
+            ,arrs = [], index = 0;
+
+        //重新整理表头结构
+        layui.each(cols, function(i1, item1){
+            layui.each(item1, function(i2, item2){
+                //如果是组合列,则捕获对应的子列
+                if(item2.colspan > 1){
+                    var childIndex = 0;
+                    index++
+                    item2.CHILD_COLS = [];
+                    layui.each(cols[i1 + 1], function(i22, item22){
+                        if(item22.PARENT_COL || childIndex == item2.colspan) return;
+                        item22.PARENT_COL = index;
+                        item2.CHILD_COLS.push(item22);
+                        childIndex = childIndex + (item22.colspan > 1 ? item22.colspan : 1);
+                    });
+                }
+                if(item2.PARENT_COL) return; //如果是子列,则不进行追加,因为已经存储在父列中
+                arrs.push(item2)
+            });
+        });
+
+        //重新遍历列,如果有子列,则进入递归
+        var eachArrs = function(obj){
+            layui.each(obj || arrs, function(i, item){
+                if(item.CHILD_COLS) return eachArrs(item.CHILD_COLS);
+                callback(i, item);
+            });
+        };
+
+        eachArrs();
+    };
+
+    /**
+     * 渲染节点显示
+     * @param callback
+     */
+    Class.prototype.renderTreeConvertShowName = function(o){
+        var that = this
+            ,options = that.config
+            ,m=options.elem
+            ,hasRender = m.next('.' + ELEM_VIEW);
+        var temhtml=that.treeConvertShowName(o);
+        var temdiv=that.layBody.find('tr[data-index="'+ o[table.config.indexName] +'"]').find('td[data-field='+options[TREE_SHOW_NAME]+']').find('.layui-table-cell');
+        $(temdiv).find('div').remove();
+        $(temdiv).prepend(temhtml);
+    }
+    /**
+     * 渲染表格单元格样式(宽度样式设置)
+     * @param callback
+     */
+    Class.prototype.renderTdCss = function(){
+        var that = this
+            ,options = that.config
+            ,m=options.elem
+            ,hasRender = m.next('.' + ELEM_VIEW);
+        var id=that.index+'_dltable_td_style';
+        hasRender.find("#"+id).remove();
+        var styel='<style id="'+id+'">'
+            +function () {
+                var ret="";
+                layui.each(that.config.cols,function (i1, item1) {
+                    layui.each(item1, function(i2, item2){
+                        ret+='.laytable-cell-'+that.index+'-'+(item2.field||i2)+'{' +
+                            'width:'+(item2.width?item2.width+"px":"0px")
+                            +'}';
+                    });
+                });
+                return ret;
+            }()+'</style>';
+        hasRender.append(styel);
+    }
+    /**
+     * 生成单元格
+     * @param obj       行数据
+     * @param numbers   下标
+     * @param cols      列定义数据
+     * @param i3        第几列
+     */
+    Class.prototype.renderTrUpids=function (obj) {
+        var that = this
+            ,options = that.config;
+        var tree_upid_key=options[TREE_UPID];
+        var upids=' upids="'+obj["upIds"]+'" ';
+        var u_id=' u_id="'+obj[tree_upid_key]+'" '
+        var ret=options.isTree?u_id:'';
+        return ret;
+    }
+    /**
+     * 生成单元格
+     * @param obj       行数据
+     * @param numbers   下标
+     * @param cols      列定义数据
+     * @param i3        第几列
+     */
+    Class.prototype.renderTd=function (param) {
+        var that = this
+            ,options = that.config;
+        var cols=param.cols;
+        var obj=param.obj;
+        var numbers=param.numbers;
+        var i3=param.i3;
+
+        var field = cols.field || i3, content = obj[field]||''
+            ,cell = that.getColElem(that.layHeader, field);
+
+        var treeImgHtml='';
+        if(options.isTree){
+            if(options.treeShowName==cols.field){
+                treeImgHtml=that.treeConvertShowName(obj);
+            }
+        }
+        //td内容
+        var td = ['<td data-field="'+ field +'" '+ function(){
+            var attr = [];
+            if(cols.edit) attr.push('data-edit="'+ cols.edit +'"'); //是否允许单元格编辑
+            if(cols.align) attr.push('align="'+ cols.align +'"'); //对齐方式
+            if(cols.templet) attr.push('data-content="'+ content +'"'); //自定义模板
+            if(cols.toolbar) attr.push('data-off="true"'); //自定义模板
+            if(cols.event) attr.push('lay-event="'+ cols.event +'"'); //自定义事件
+            if(cols.style) attr.push('style="'+ cols.style +'"'); //自定义样式
+            if(cols.minWidth) attr.push('data-minwidth="'+ cols.minWidth +'"'); //单元格最小宽度
+            return attr.join(' ');
+        }() +'>'
+            ,'<div class="layui-table-cell laytable-cell-'+ function(){ //返回对应的CSS类标识
+                var str = (options.index + '-' + field);
+                return cols.type === 'normal' ? str
+                    : (str + ' laytable-cell-' + cols.type);
+            }() +'">'+treeImgHtml+'<p style="width: auto;height: 100%;">'+ function(){
+                var tplData = $.extend(true, {
+                    LAY_INDEX: numbers
+                }, obj);
+                //渲染复选框列视图
+                if(cols.type === 'checkbox'){
+                    return '<input type="checkbox" name="layTableCheckbox" value="'+tplData[table.config.indexName]+'" lay-skin="primary" '+ function(){
+                            var checkName = table.config.checkName;
+                            //如果是全选
+                            if(cols[checkName]){
+                                obj[checkName] = cols[checkName];
+                                return cols[checkName] ? 'checked' : '';
+                            }
+                            return tplData[checkName] ? 'checked' : '';
+                        }() +'>';
+                } else if(cols.type === 'numbers'){ //渲染序号
+                    return numbers;
+                }else if(cols.type === 'drop'){//下拉框
+                    var rowsField=dl.ui.table.drop.findFieldObj(options.cols[0],field);
+                    if(rowsField&&rowsField['drop']){
+                        var o=dl.cache.code.get(rowsField.drop);
+                        return dl.ui.table.drop.findDropLable(rowsField.drop,content);
+                    }
+                }else if(cols.type === 'radio'){//单选
+                    return '<input type="radio" name="'+TABLE_RADIO_ID+options.id+'" value="'+tplData[table.config.indexName]+'" checked="">';
+                }
+
+                //解析工具列模板
+                if(cols.toolbar){
+                    return laytpl($(cols.toolbar).html()||'').render(tplData);
+                }
+
+                return cols.templet ? function(){
+                    return typeof cols.templet === 'function'
+                        ? cols.templet(tplData)
+                        : laytpl($(cols.templet).html() || String(content)).render(tplData)
+                }() : content;
+            }()
+            ,'</p></div></td>'].join('');
+
+        return td;
+    }
+    /**
+     * 生成tr中的一行
+     * @param obj            行数据
+     * @param numbers          行号
+     * @returns {*}
+     */
+    Class.prototype.renderTr=function (obj,numbers) {
+        var that = this
+            ,options = that.config;
+        var tds= [];
+        that.eachCols(function(i3, cols){//cols列定义
+            var field = cols.field || i3, content = obj[field]
+                ,cell = that.getColElem(that.layHeader, field);
+            if(content === undefined || content === null) content = '';
+            if(cols.colspan > 1) return;
+            //td内容
+            var td = that.renderTd({
+                'obj':obj,'numbers':numbers,'cols':cols,'i3':i3
+            });
+            tds.push(td);
+            // if(item3.fixed && item3.fixed !== 'right') tds_fixed.push(td);
+            // if(item3.fixed === 'right') tds_fixed_r.push(td);
+        });
+        return tds;
+    };
+    /**
+     * 表格数据部分渲染入口
+     * @param res
+     * @param curr
+     * @param count
+     * @param sort
+     */
+    Class.prototype.renderData = function(res, curr, count, sort){
+        var that = this
+            ,options = that.config
+            ,data = res[options.response.dataName] || []
+            ,trs = []
+            ,trs_fixed = []
+            ,trs_fixed_r = []
+            //渲染视图
+            ,render = function(){ //后续性能提升的重点
+                if(!sort && that.sortKey){
+                    return that.sort(that.sortKey.field, that.sortKey.sort, true);
+                }
+                layui.each(data, function(i1, obj){
+                    var tds = [], tds_fixed = [], tds_fixed_r = []
+                        ,numbers = i1 + options.limit*(curr - 1) + 1; //序号
+                    if(obj.length === 0) return;
+                    if(!sort){
+                        obj[table.config.indexName] = i1;
+                    }
+                    tds=that.renderTr(obj,numbers);
+                    trs.push('<tr data-index="'+ i1 +'" '+that.renderTrUpids(obj)+'>'+ tds.join('') + '</tr>');
+
+                    trs_fixed.push('<tr data-index="'+ i1 +'">'+ tds_fixed.join('') + '</tr>');
+                    trs_fixed_r.push('<tr data-index="'+ i1 +'">'+ tds_fixed_r.join('') + '</tr>');
+                });
+
+                //if(data.length === 0) return;
+
+                that.layBody.scrollTop(0);
+                that.layMain.find('.'+ NONE).remove();
+                that.layMain.find('tbody').html(trs.join(''));
+                that.layFixLeft.find('tbody').html(trs_fixed.join(''));
+                that.layFixRight.find('tbody').html(trs_fixed_r.join(''));
+
+                that.renderForm();
+                that.syncCheckAll();
+                that.haveInit ? that.scrollPatch() : setTimeout(function(){
+                    that.scrollPatch();
+                }, 50);
+                that.haveInit = true;
+                layer.close(that.tipsIndex);
+            };
+        that.key = options.id || options.index;
+        // table.cache[that.key] = data; //记录数据
+        table.setDataList(that.key,data);
+        //显示隐藏分页栏
+        that.layPage[data.length === 0 && curr == 1 ? 'addClass' : 'removeClass'](HIDE);
+        //排序
+        if(sort){
+            return render();
+        }
+        if(data.length === 0){
+            that.renderForm();
+            that.layFixed.remove();
+            that.layMain.find('tbody').html('');
+            that.layMain.find('.'+ NONE).remove();
+            return that.layMain.append('<div class="'+ NONE +'">'+ options.text.none +'</div>');
+        }
+        render();
+        that.renderPage(count);//分页渲染
+        //calss加载完成
+        table.pushClassIds(options.id,true);
+
+        layui.each(options.cols, function(i1, item1){
+            layui.each(item1, function(i2, item2){
+            })
+        });
+    };
+    /**
+     * 渲染分页
+     */
+    Class.prototype.renderPage=function (count) {
+        var that = this
+            ,options = that.config;
+        //同步分页状态
+        if(options.page){
+            options.page = $.extend({
+                elem: 'layui-table-page' + options.index
+                ,count: count
+                ,limit: options.limit
+                ,limits: options.limits || [10,15,20,30,40,50,60,70,80,90]
+                ,groups: 3
+                ,layout: ['prev', 'page', 'next', 'skip', 'count', 'limit']
+                ,prev: '<i class="layui-icon">&#xe603;</i>'
+                ,next: '<i class="layui-icon">&#xe602;</i>'
+                ,jump: function(obj, first){
+                    if(!first){
+                        //分页本身并非需要做以下更新,下面参数的同步,主要是因为其它处理统一用到了它们
+                        //而并非用的是 options.page 中的参数(以确保分页未开启的情况仍能正常使用)
+                        that.page = obj.curr; //更新页码
+                        options.limit = obj.limit; //更新每页条数
+                        that.pullData(obj.curr, that.loading());
+                    }
+                }
+            }, options.page);
+            options.page.count = count; //更新总条数
+            laypage.render(options.page);
+        }
+    };
+    /**
+     * 过滤区域的渲染
+     */
+    Class.prototype.renderFilter = function(){
+        var that = this
+            ,options = that.config
+            ,VIEW_CLASS=ELEM_VIEW
+            ,index=that.index; //索引
+        var v = [];
+        v.push('<form method="post"  id="'+options.id+'_filter_form">');
+        v.push('<table cellspacing="0" cellpadding="0" border="0" class="layui-table"><thead><tr>');
+        layui.each(options.cols,function (i, o) {
+            layui.each(o, function(i2, item2){
+                var field=item2.field||i2;
+                var minW=item2.minWidth?"data-minwidth='"+item2.minWidth+"'":"";
+                var rowCols=item2.colspan?'colspan="'+item2.colspan+'"':'';
+                var rowspan=item2.rowspan?'rowspan="'+item2.rowspan+'"':'';
+                var unresize=item2.unresize?'data-unresize="true"':'';
+                v.push('<th data-field="'+field+'"'+minW+rowCols+rowspan +unresize+'>');
+                v.push('<div class="layui-table-cell laytable-cell-'+function () {
+                    var tem="";
+                    if (item2.colspan > 1) {
+                        tem='group';
+                    }else{
+                        tem=index+"-"+field;
+                        if(item2.type !== "normal"){
+                            tem+=" laytable-cell-"+item2.type;
+                        }
+                    }
+                    return tem;
+                }()+'">');
+                if(!item2.isFilter||!item2.field){//不开启行内过滤或没有列名
+                    v.push('');
+                }else{
+                    v.push('<input class="layui-input '+ ELEM_EDIT +'" id="filter_'+item2.field+'" name="filter_'+item2.field+'">');
+                }
+                v.push('</div></th>');
+
+            });
+        });
+        v.push('</tr></thead></table>');
+        v.push('</form>');
+        return v.join('');
+    };
+    //找到对应的列元素
+    Class.prototype.getColElem = function(parent, field){
+        var that = this
+            ,options = that.config;
+        return parent.eq(0).find('.laytable-cell-'+ (options.index + '-' + field) + ':eq(0)');
+    };
+    //渲染表单
+    Class.prototype.renderForm = function(type){
+        form.render(type, 'LAY-table-'+ this.index);
+    }
+    //数据排序
+    Class.prototype.sort = function(th, type, pull, formEvent){
+        var that = this
+            ,field
+            ,res = {}
+            ,options = that.config
+            ,filter = options.elem.attr('lay-filter')
+            ,data = table.getDataList(that.key), thisData;
+
+        //字段匹配
+        if(typeof th === 'string'){
+            that.layHeader.find('th').each(function(i, item){
+                var othis = $(this)
+                    ,_field = othis.data('field');
+                if(_field === th){
+                    th = othis;
+                    field = _field;
+                    return false;
+                }
+            });
+        }
+
+        try {
+            var field = field || th.data('field');
+
+            //如果欲执行的排序已在状态中,则不执行渲染
+            if(that.sortKey && !pull){
+                if(field === that.sortKey.field && type === that.sortKey.sort){
+                    return;
+                }
+            }
+
+            var elemSort = that.layHeader.find('th .laytable-cell-'+ options.index +'-'+ field).find(ELEM_SORT);
+            that.layHeader.find('th').find(ELEM_SORT).removeAttr('lay-sort'); //清除其它标题排序状态
+            elemSort.attr('lay-sort', type || null);
+            that.layFixed.find('th')
+        } catch(e){
+            return hint.error('Table modules: Did not match to field');
+        }
+
+        //记录排序索引和类型
+        that.sortKey = {
+            field: field
+            ,sort: type
+        };
+
+        if(type === 'asc'){ //升序
+            thisData = layui.sort(data, field);
+        } else if(type === 'desc'){ //降序
+            thisData = layui.sort(data, field, true);
+        } else { //清除排序
+            thisData = layui.sort(data, table.config.indexName);
+            delete that.sortKey;
+        }
+
+        res[options.response.dataName] = thisData;
+        that.renderData(res, that.page, that.count, true);
+
+        if(formEvent){
+            layui.event.call(th, MOD_NAME, 'sort('+ filter +')', {
+                field: field
+                ,type: type
+            });
+        }
+    };
+    //请求loading
+    Class.prototype.loading = function(){
+        var that = this
+            ,options = that.config;
+        if(options.loading && options.url){
+            return layer.msg('数据请求中', {
+                icon: 16
+                ,offset: [
+                    that.elem.offset().top + that.elem.height()/2 - 35 - _WIN.scrollTop() + 'px'
+                    ,that.elem.offset().left + that.elem.width()/2 - 90 - _WIN.scrollLeft() + 'px'
+                ]
+                ,time: -1
+                ,anim: -1
+                ,fixed: false
+            });
+        }
+    };
+    //同步选中值状态
+    Class.prototype.setCheckData = function(index, checked){
+        var that = this
+            ,options = that.config
+            ,thisData = table.getDataList(that.key);
+        if(!thisData[index]) return;
+        if(thisData[index].constructor === Array) return;
+        thisData[index][options.checkName] = checked;
+    };
+    //同步全选按钮状态
+    Class.prototype.syncCheckAll = function(){
+        var that = this
+            ,options = that.config
+            ,checkAllElem = that.layHeader.find('input[name="layTableCheckbox"]')
+            ,syncColsCheck = function(checked){
+            that.eachCols(function(i, item){
+                if(item.type === 'checkbox'){
+                    item[options.checkName] = checked;
+                }
+            });
+            return checked;
+        };
+
+        if(!checkAllElem[0]) return;
+
+        if(table.checkStatus(that.key).isAll){
+            if(!checkAllElem[0].checked){
+                checkAllElem.prop('checked', true);
+                that.renderForm('checkbox');
+            }
+            syncColsCheck(true);
+        } else {
+            if(checkAllElem[0].checked){
+                checkAllElem.prop('checked', false);
+                that.renderForm('checkbox');
+            }
+            syncColsCheck(false);
+        }
+    };
+    //获取cssRule
+    Class.prototype.getCssRule = function(field, callback){
+        var that = this
+            ,style = that.elem.find('style')[0]
+            ,sheet = style.sheet || style.styleSheet || {}
+            ,rules = sheet.cssRules || sheet.rules;
+        layui.each(rules, function(i, item){
+            if(item.selectorText === ('.laytable-cell-'+ that.index +'-'+ field)){
+                return callback(item), true;
+            }
+        });
+    };
+    /**
+     * 窗体变化自适应
+     */
+    Class.prototype.resize = function(){
+        var that = this;
+        //根据父窗体高度设置table的高度
+        // 1、table自身顶级容器高度(layui-table-view)
+        // 2、内容区域高度(layui-table-main)
+        that.setArea();
+        that.fullSize();//高度控制
+        //宽度控制(最后一行)
+        that.resizeWidth();
+        that.scrollPatch();
+    };
+    /**
+     * 重新渲染宽度
+     */
+    Class.prototype.resizeWidth = function(){
+        var that = this;
+        that.renderTdCss();
+    };
+    //铺满表格主体高度
+    Class.prototype.fullSize = function(){
+        var that = this
+            ,options = that.config
+            ,height = options.height, bodyHeight;
+
+        height = that.getParentDivHeight(options.id) - that.fullHeightGap;
+        height = '100%';
+        that.elem.css('height', height);
+
+        //tbody区域高度
+        // bodyHeight = parseFloat(height) - parseFloat(that.layHeader.height()) - 1;//原本代码
+        var theader=options.isFilter?76:38;//没有行内过滤区域
+        bodyHeight = parseFloat(height) - theader - 1;//###注意:现在写死表头固定高度为38px,即不支持多表头方式(在tab方式下无法获取正确的高度,待处理)
+        if(options.toolbar){
+            bodyHeight = bodyHeight - that.layTool.outerHeight();
+        }
+        if(options.page){
+            bodyHeight = bodyHeight - that.layPage.outerHeight() - 1;
+        }
+        // that.layMain.css('height', bodyHeight);
+        // console.log(bodyHeight,that.layHeader.height());
+    };
+    //获取滚动条宽度
+    Class.prototype.getScrollWidth = function(elem){
+        var width = 0;
+        if(elem){
+            width = elem.offsetWidth - elem.clientWidth;
+        } else {
+            elem = document.createElement('div');
+            elem.style.width = '100px';
+            elem.style.height = '100px';
+            elem.style.overflowY = 'scroll';
+
+            document.body.appendChild(elem);
+            width = elem.offsetWidth - elem.clientWidth;
+            document.body.removeChild(elem);
+        }
+        return width;
+    };
+    //滚动条补丁
+    Class.prototype.scrollPatch = function(){
+        var that = this
+            ,layMainTable = that.layMain.children('table')
+            ,scollWidth = that.layMain.width() - that.layMain.prop('clientWidth') //纵向滚动条宽度
+            ,scollHeight = that.layMain.height() - that.layMain.prop('clientHeight') //横向滚动条高度
+            ,getScrollWidth = that.getScrollWidth(that.layMain[0]) //获取主容器滚动条宽度,如果有的话
+            ,outWidth = layMainTable.outerWidth() - that.layMain.width(); //表格内容器的超出宽度
+
+        //如果存在自动列宽,则要保证绝对填充满,并且不能出现横向滚动条
+        if(that.autoColNums && outWidth < 5 && !that.scrollPatchWStatus){
+            var th = that.layHeader.eq(0).find('thead th:last-child')
+                ,field = th.data('field');
+            that.getCssRule(field, function(item){
+                var width = item.style.width || th.outerWidth();
+                item.style.width = (parseFloat(width) - getScrollWidth - outWidth) + 'px';
+                //二次校验,如果仍然出现横向滚动条
+                if(that.layMain.height() - that.layMain.prop('clientHeight') > 0){
+                    item.style.width = parseFloat(item.style.width) - 1 + 'px';
+                }
+                that.scrollPatchWStatus = true;
+            });
+        }
+        if(scollWidth && scollHeight){
+            if(that.elem.find('.layui-table-patch').length<=0){
+                var patchElem = $('<th class="layui-table-patch"><div class="layui-table-cell"></div></th>'); //补丁元素
+                patchElem.find('div').css({
+                    width: scollWidth
+                });
+                that.layHeader.eq(0).find('thead tr').append(patchElem);
+                //that.layFilter.find('table thead tr').append(patchElem);
+            }
+        } else {
+            that.layFilter.eq(0).find('.layui-table-patch').remove();
+            that.layHeader.eq(0).find('.layui-table-patch').remove();
+        }
+        //固定列区域高度
+        var mainHeight = that.layMain.height()
+            ,fixHeight = mainHeight - scollHeight;
+        that.layFixed.find(ELEM_BODY).css('height', layMainTable.height() > fixHeight ? fixHeight : 'auto');
+        //表格宽度小于容器宽度时,隐藏固定列
+        that.layFixRight[outWidth > 0 ? 'removeClass' : 'addClass'](HIDE);
+        //操作栏
+        that.layFixRight.css('right', scollWidth - 1);
+    };
+    //事件处理
+    Class.prototype.events = function(){
+        var that = this
+            ,options = that.config
+            ,_BODY = $('body')
+            ,dict = {}
+            ,th = that.layHeader.find('th')
+            ,resizing
+            ,ELEM_CELL = '.layui-table-cell'
+            ,filter = options.elem.attr('lay-filter')
+            ,layFilter=that.layFilter.find("[name^='filter_']")//行内过滤元素
+            ;
+
+        //行内过滤
+        layFilter.on('keyup',function () {
+            that.page=1;
+            that.pullData(that.page, that.loading());
+        });
+
+
+        //拖拽调整宽度
+        th.on('mousemove', function(e){
+            var othis = $(this)
+                ,oLeft = othis.offset().left
+                ,pLeft = e.clientX - oLeft;
+            if(othis.attr('colspan') > 1 || othis.data('unresize') || dict.resizeStart){
+                return;
+            }
+            dict.allowResize = othis.width() - pLeft <= 10; //是否处于拖拽允许区域
+            _BODY.css('cursor', (dict.allowResize ? 'col-resize' : ''));
+        }).on('mouseleave', function(){
+            var othis = $(this);
+            if(dict.resizeStart) return;
+            _BODY.css('cursor', '');
+        }).on('mousedown', function(e){
+            var othis = $(this);
+            if(dict.allowResize){
+                var field = othis.data('field');
+                e.preventDefault();
+                dict.resizeStart = true; //开始拖拽
+                dict.offset = [e.clientX, e.clientY]; //记录初始坐标
+
+                that.getCssRule(field, function(item){
+                    var width = item.style.width || othis.outerWidth();
+                    dict.rule = item;
+                    dict.ruleWidth = parseFloat(width);
+                    dict.minWidth = othis.data('minwidth') || options.cellMinWidth;
+                });
+            }
+        });
+        //拖拽中
+        _DOC.on('mousemove', function(e){
+            if(dict.resizeStart){
+                e.preventDefault();
+                if(dict.rule){
+                    var setWidth = dict.ruleWidth + e.clientX - dict.offset[0];
+                    if(setWidth < dict.minWidth) setWidth = dict.minWidth;
+                    dict.rule.style.width = setWidth + 'px';
+                    layer.close(that.tipsIndex);
+                }
+                resizing = 1
+            }
+        }).on('mouseup', function(e){
+            if(dict.resizeStart){
+                dict = {};
+                _BODY.css('cursor', '');
+                that.scrollPatch();
+            }
+            if(resizing === 2){
+                resizing = null;
+            }
+        });
+
+        //排序
+        th.on('click', function(){
+            var othis = $(this)
+                ,elemSort = othis.find(ELEM_SORT)
+                ,nowType = elemSort.attr('lay-sort')
+                ,type;
+
+            if(!elemSort[0] || resizing === 1) return resizing = 2;
+
+            if(nowType === 'asc'){
+                type = 'desc';
+            } else if(nowType === 'desc'){
+                type = null;
+            } else {
+                type = 'asc';
+            }
+            that.sort(othis, type, null, true);
+        }).find(ELEM_SORT+' .layui-edge ').on('click', function(e){
+            var othis = $(this)
+                ,index = othis.index()
+                ,field = othis.parents('th').eq(0).data('field')
+            layui.stope(e);
+            if(index === 0){
+                that.sort(field, 'asc', null, true);
+            } else {
+                that.sort(field, 'desc', null, true);
+            }
+        });
+
+        /**
+         * 树形节点点击事件(隐藏展开下级节点)
+         */
+        that.elem.on('click', 'i.layui-tree-head', function(){
+            var othis = $(this)
+                ,index = othis.parents('tr').eq(0).data('index')
+                ,tr = that.layBody.find('tr[data-index="'+ index +'"]')
+                ,options=that.config
+                ,tree_id=options[TREE_ID]
+                ,datas=table.getDataList(that.key);//数据
+            var o=datas[index];
+            that.treeNodeOpen(o,!o.is_open);
+        });
+
+        //复选框选择
+        that.elem.on('click', 'input[name="layTableCheckbox"]+', function(){
+            var checkbox = $(this).prev()
+                ,childs = that.layBody.find('input[name="layTableCheckbox"]')
+                ,index = checkbox.parents('tr').eq(0).data('index')
+                ,checked = checkbox[0].checked
+                ,isAll = checkbox.attr('lay-filter') === 'layTableAllChoose';
+
+            //全选
+            if(isAll){
+                childs.each(function(i, item){
+                    item.checked = checked;
+                    that.setCheckData(i, checked);
+                });
+                that.syncCheckAll();
+                that.renderForm('checkbox');
+            } else {
+                that.setCheckData(index, checked);
+                that.syncCheckAll();
+            }
+            layui.event.call(this, MOD_NAME, 'checkbox('+ filter +')', {
+                checked: checked
+                ,data: table.getDataList(that.key) ? (table.getDataList(that.key)[index] || {}) : {}
+                ,type: isAll ? 'all' : 'one'
+            });
+        });
+
+        //行事件
+        that.layBody.on('mouseenter', 'tr', function(){
+            var othis = $(this)
+                ,index = othis.index();
+            that.layBody.find('tr:eq('+ index +')').addClass(ELEM_HOVER)
+        })
+        that.layBody.on('mouseleave', 'tr', function(){
+            var othis = $(this)
+                ,index = othis.index();
+            that.layBody.find('tr:eq('+ index +')').removeClass(ELEM_HOVER)
+        });
+
+
+//单元格编辑
+        that.layBody.on('change', '.'+ELEM_EDIT, function(){
+            var othis = $(this)
+                ,value = this.value
+                ,field = othis.parent().data('field')
+                ,index = othis.parents('tr').eq(0).data('index')
+                ,data = table.getDataList(that.key)[index];
+            data[field] = value; //更新缓存中的值
+            layui.event.call(this, MOD_NAME, 'edit('+ filter +')', {
+                value: value
+                ,data: data
+                ,field: field
+            });
+        });
+
+        that.layBody.on('blur', '.'+ELEM_EDIT, function(){//单元格失去焦点
+            var templet
+                ,othis = $(this)
+                ,field = othis.parent().data('field')
+                ,index = othis.parents('tr').eq(0).data('index')
+                ,editType = othis.parent().data('edit')
+                ,data = table.getDataList(that.key)[index];
+            var  options = that.config;
+            that.eachCols(function(i, item){
+                if(item.field == field && item.templet){
+                    templet = item.templet;
+                }
+            });
+            var value="";
+            if(editType === 'select') { //选择框
+                var rowsField=dl.ui.table.drop.findFieldObj(options.cols[0],field);
+                if(rowsField&&rowsField['drop']){
+                    var o=dl.cache.code.get(rowsField.drop);
+                    value=dl.ui.table.drop.findDropLable(rowsField.drop,this.value);
+                }
+                othis.parent().find(ELEM_CELL+' p').html(
+                    templet ? laytpl($(templet).html() || value).render(data) : value
+                );
+            } else {//输入框
+                othis.parent().find(ELEM_CELL+' p').html(
+                    templet ? laytpl($(templet).html() || this.value).render(data) : this.value
+                );
+            }
+            othis.parent().data('content', this.value);
+            othis.remove();
+        });
+
+        //单元格事件
+        that.layBody.on('click', 'td div.layui-table-cell p', function(){
+            var othis = $(this).parent().parent()
+                ,field = othis.data('field')
+                ,editType = othis.data('edit')
+                ,index = othis.parents('tr').eq(0).data('index')
+                ,data = table.getDataList(that.key)[index]
+                ,elemCell = othis.children(ELEM_CELL);
+            var  options = that.config;
+            layer.close(that.tipsIndex);
+            if(othis.data('off')) return;
+
+            //显示编辑表单
+            if(editType){
+                if(editType === 'select') { //选择框
+                    var dropName=othis.data('drop');
+                    var rowsField=dl.ui.table.drop.findFieldObj(options.cols[0],field);
+                    var o=dl.cache.code.get(rowsField.drop);
+                    var html='';
+                    var scv=o.syscodevaluecache;
+                    for(var i in scv){
+                        var isSelected="";
+                        if(scv[i].scv_value==data[field]){
+                            isSelected="selected='selected'";
+                        }
+                        //选中
+                        html+='<option '+isSelected+'  value="'+scv[i].scv_value+'">'+scv[i].scv_show_name+'</option>'
+                    }
+                    var select = $('<select class="'+ ELEM_EDIT +'" lay-ignore>' +
+                        html+
+                        '</select>');
+                    othis.find('.'+ELEM_EDIT)[0] || othis.append(select);
+                } else { //输入框
+                    var input = $('<input class="layui-input '+ ELEM_EDIT +'">');
+                    input[0].value = $.trim($(this).text());//  othis.data('content') || elemCell.text();
+                    othis.find('.'+ELEM_EDIT)[0] || othis.append(input);
+                    input.focus();
+                }
+                return;
+            }
+
+            //如果出现省略,则可查看更多
+            if(elemCell.find('.layui-form-switch,.layui-form-checkbox')[0]) return; //限制不出现更多(暂时)
+            if(Math.round(elemCell.prop('scrollWidth')) > Math.round(elemCell.outerWidth())){
+                that.tipsIndex = layer.tips([
+                    '<div class="layui-table-tips-main" style="margin-top: -'+ (elemCell.height() + 16) +'px;'+ function(){
+                        if(options.size === 'sm'){
+                            return 'padding: 4px 15px; font-size: 12px;';
+                        }
+                        if(options.size === 'lg'){
+                            return 'padding: 14px 15px;';
+                        }
+                        return '';
+                    }() +'">'
+                    ,elemCell.html()
+                    ,'</div>'
+                    ,'<i class="layui-icon layui-table-tips-c">&#x1006;</i>'
+                ].join(''), elemCell[0], {
+                    tips: [3, '']
+                    ,time: -1
+                    ,anim: -1
+                    ,maxWidth: (device.ios || device.android) ? 300 : 600
+                    ,isOutAnim: false
+                    ,skin: 'layui-table-tips'
+                    ,success: function(layero, index){
+                        layero.find('.layui-table-tips-c').on('click', function(){
+                            layer.close(index);
+                        });
+                    }
+                });
+            }
+        });
+
+        //工具条操作事件
+        that.layBody.on('click', '*[lay-event]', function(){
+            var othis = $(this)
+                ,index = othis.parents('tr').eq(0).data('index')
+                ,tr = that.layBody.find('tr[data-index="'+ index +'"]')
+                ,ELEM_CLICK = 'layui-table-click'
+                ,list = table.getDataList(that.key)
+                ,data = table.getDataList(that.key)[index];
+            layui.event.call(this, MOD_NAME, 'tool('+ filter +')', {
+                data: data//table.clearCacheKey(data)
+                ,event: othis.attr('lay-event')
+                ,tr: tr
+                ,del: function(){
+                    table.delRow(options.id,data);
+                }
+                ,update: function(fields){
+                    fields = fields || {};
+                    layui.each(fields, function(key, value){
+                        if(key in data){
+                            var templet, td = tr.children('td[data-field="'+ key +'"]');
+                            data[key] = value;
+                            that.eachCols(function(i, item2){
+                                if(item2.field == key && item2.templet){
+                                    templet = item2.templet;
+                                }
+                            });
+                            td.children(ELEM_CELL).html(
+                                templet ? laytpl($(templet).html() || value).render(data) : value
+                            );
+                            td.data('content', value);
+                        }
+                    });
+                }
+            });
+            tr.addClass(ELEM_CLICK).siblings('tr').removeClass(ELEM_CLICK);
+        });
+
+        //同步滚动条
+        that.layMain.on('scroll', function(){
+            var othis = $(this)
+                ,scrollLeft = othis.scrollLeft()
+                ,scrollTop = othis.scrollTop();
+
+            that.layHeader.scrollLeft(scrollLeft);
+            that.layFixed.find(ELEM_BODY).scrollTop(scrollTop);
+
+            layer.close(that.tipsIndex);
+        });
+
+        _WIN.on('resize', function(){ //自适应
+            that.resize();
+        });
+    };
+
+
+    //表格重载
+    thisTable.config = {};
+    //自动完成渲染
+    table.init();
+   // layui.link("//" + location.host + '/js/layuiPlugins/treeGrid.css');//引入css
+    exports(MOD_NAME, table);
+});

+ 1216 - 0
js/layuiPlugins/eleTree.js

@@ -0,0 +1,1216 @@
+/**
+ * 基于layui的tree重写
+ * author: hsianglee
+ * 最近修改时间: 2019/01/07
+ */
+
+layui.define(["jquery","laytpl"], function (exports) {
+    var $ = layui.jquery;
+    var laytpl = layui.laytpl;
+    var hint = layui.hint();
+
+    var MOD_NAME="eleTree";
+
+    //外部接口
+    var eleTree={
+        //事件监听
+        on: function(events, callback){
+            return layui.onevent.call(this, MOD_NAME, events, callback);
+        },
+        render: function(options) {
+            var inst = new Class(options);
+            return thisTree.call(inst);
+        }
+    }
+
+    var thisTree=function() {
+        var _self=this;
+        var options = _self.config;
+
+        // 暴漏外面的方法
+        return {
+            // 接收两个参数,1. 节点 key 2. 节点数据的数组
+            updateKeyChildren: function(key,data) {
+                if(options.data.length===0) return;
+                return _self.updateKeyChildren.call(_self,key,data);
+            },
+            updateKeySelf: function(key,data) {
+                if(options.data.length===0) return;
+                return _self.updateKeySelf.call(_self,key,data);
+            },
+            remove: function(key) {
+                if(options.data.length===0) return;
+                return _self.remove.call(_self,key);
+            },
+            append: function(key,data) {
+                if(options.data.length===0) return;
+                return _self.append.call(_self,key,data);
+            },
+            insertBefore: function(key,data) {
+                if(options.data.length===0) return;
+                return _self.insertBefore.call(_self,key,data);
+            },
+            insertAfter: function(key,data) {
+                if(options.data.length===0) return;
+                return _self.insertAfter.call(_self,key,data);
+            },
+            // 接收两个 boolean 类型的参数,1. 是否只是叶子节点,默认值为 false 2. 是否包含半选节点,默认值为 false
+            getChecked: function(leafOnly, includeHalfChecked) {
+                if(options.data.length===0) return;
+                return _self.getChecked.call(_self,leafOnly, includeHalfChecked);
+            },
+            // 接收勾选节点数据的数组
+            setChecked: function(data) {
+                if(options.data.length===0) return;
+                return _self.setChecked.call(_self,data);
+            },
+            // 取消选中
+            unCheckNodes: function() {
+                if(options.data.length===0) return;
+                return _self.unCheckNodes.call(_self);
+            },
+            expandAll: function() {
+                options.elem.children(".eleTree-node").children(".eleTree-node-group").empty();
+                _self.expandAll.call(_self,options.data,[],1,true);
+                _self.unCheckNodes();
+                _self.defaultChecked();
+            },
+            unExpandAll: function() {
+                return _self.unExpandAll.call(_self);
+            },
+            reload: function(options) {
+                return _self.reload.call(_self,options);
+            },
+            search: function(value) {
+                return _self.search.call(_self,value);
+            }
+        }
+    }
+
+    // 模板渲染
+    var TPL_ELEM=function(options,floor,parentStatus) {
+        return [
+            '{{# for(var i=0;i<d.length;i++){ }}',
+            '<div class="eleTree-node" data-'+options.request.key+'="{{d[i]["'+options.request.key+'"]}}" eletree-floor="'+floor+'" style="display: none;">',
+            '<div class="eleTree-node-content" style="padding-left: '+(options.indent*floor)+'px;">',
+            '<span class="eleTree-node-content-icon">',
+            '<i class="layui-icon layui-icon-triangle-r ',
+            function() {
+                if(options.lazy){
+                    var str=[
+                        '{{# if(!d[i]["'+options.request.isLeaf+'"]){ }}',
+                        'lazy-icon" ></i>',
+                        '{{# }else{ }}',
+                        'leaf-icon" style="color: transparent;" ></i>',
+                        '{{# } }}'
+                    ].join("");
+                    return str;
+                }
+                return ['{{# if(!d[i]["'+options.request.children+'"] || d[i]["'+options.request.children+'"].length===0){ }}',
+                    'leaf-icon" style="color: transparent;"',
+                    '{{# } }}',
+                    '"></i>'
+                ].join("");
+            }(),
+            '</span>',
+            function() {
+                if(options.showCheckbox){
+                    var status="";
+                    if(parentStatus==="1"){
+                        status='"1" checked';
+                    }else if(parentStatus==="2"){
+                        status='"2"';
+                    }else{
+                        status='"0"';
+                    }
+                    return [
+                        '{{# if(d[i]["'+options.request.checked+'"]) { }}',
+                        '<input type="checkbox" name="eleTree-node" eleTree-status="1" checked class="eleTree-hideen ',
+                        '{{# }else{ }}',
+                        '<input type="checkbox" name="eleTree-node" eleTree-status='+status+' class="eleTree-hideen ',
+                        '{{# } }}',
+
+                        '{{# if(d[i]["'+options.request.disabled+'"]) { }}',
+                        'eleTree-disabled',
+                        '{{# } }}',
+                        '" />'
+                    ].join("");
+                }
+                return ''
+            }(),
+            '<span class="eleTree-node-content-label">{{d[i]["'+options.request.name+'"]}}</span>',
+            '</div>',
+            '<div class="eleTree-node-group">',
+            '</div>',
+            '</div>',
+            '{{# } }}'
+        ].join("");
+    }
+
+    var TPL_NoText=function() {
+        return '<h3 class="eleTree-noText" style="text-align: center;height: 30px;line-height: 30px;color: #888;">{{d.emptText}}</h3>';
+    }
+
+    var Class=function(options) {
+        options.response=$.extend({}, this.config.response, options.response);
+        options.request=$.extend({}, this.config.request, options.request);
+        this.config = $.extend({}, this.config, options);
+        this.prevClickEle=null;
+        this.addKeyIndex=20181201;
+        this.nameIndex=1;
+        this.render();
+    };
+
+    Class.prototype={
+        constructor: Class,
+        config: {
+            elem: "",
+            data: [],
+            emptText: "暂无数据",        // 内容为空的时候展示的文本
+            renderAfterExpand: true,    // 是否在第一次展开某个树节点后才渲染其子节点
+            highlightCurrent: false,    // 是否高亮当前选中节点,默认值是 false。
+            defaultExpandAll: false,    // 是否默认展开所有节点
+            expandOnClickNode: true,    // 是否在点击节点的时候展开或者收缩节点, 默认值为 true,如果为 false,则只有点箭头图标的时候才会展开或者收缩节点。
+            checkOnClickNode: false,    // 是否在点击节点的时候选中节点,默认值为 false,即只有在点击复选框时才会选中节点。
+            defaultExpandedKeys: [],    // 默认展开的节点的 key 的数组
+            autoExpandParent: true,     // 展开子节点的时候是否自动展开父节点
+            showCheckbox: false,        // 节点是否可被选择
+            checkStrictly: false,       // 在显示复选框的情况下,是否严格的遵循父子不互相关联的做法,默认为 false
+            defaultCheckedKeys: [],     // 默认勾选的节点的 key 的数组
+            accordion: false,           // 是否每次只打开一个同级树节点展开(手风琴效果)
+            indent: 16,                 // 相邻级节点间的水平缩进,单位为像素
+            lazy: false,                // 是否懒加载子节点,需与 load 方法结合使用
+            load: function() {},        // 加载子树数据的方法,仅当 lazy 属性为true 时生效
+            draggable: false,           // 是否开启拖拽节点功能
+            contextmenuList: [],        // 启用右键菜单,支持的操作有:"copy","add","edit","remove"
+            searchNodeMethod: null,     // 对树节点进行筛选时执行的方法,返回 true 表示这个节点可以显示,返回 false 则表示这个节点会被隐藏
+
+            method: "get",
+            url: "",
+            contentType: "",
+            headers: {},
+            done: null,
+
+            response: {
+                statusName: "code",
+                statusCode: 0,
+                dataName: "data"
+            },
+            request: {
+                name: "label",
+                key: "id",
+                children: "children",
+                disabled: "disabled",
+                checked: "checked",
+                isLeaf: "isLeaf"
+            }
+        },
+        render: function() {
+            if(this.config.indent>30){
+                this.config.indent=30;
+            }else if(this.config.indent<10){
+                this.config.indent=10;
+            }
+            var options=this.config;
+            options.where=options.where || {};
+            if(!options.elem) return hint.error("缺少elem参数");
+            options.elem=typeof options.elem === "string" ? $(options.elem) : options.elem;
+            this.filter=options.elem.attr("lay-filter");
+            // load加载框
+            options.elem.append('<div class="eleTree-loadData"><i class="layui-icon layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop"></i></div>')
+
+            // 判断加载方式
+            if(options.data.length===0){
+                this.ajaxGetData();
+            }else{
+                this.renderData();
+            }
+        },
+        renderData: function() {
+            var options=this.config;
+            // 渲染第一层
+            laytpl(TPL_ELEM(options,0)).render(options.data, function(string){
+                options.elem.html(string).children().show();
+            });
+            // 懒加载 > 展开所有 > 初始展开项 > 初始渲染所有子节点 > 初始选中项 > 每次点击只渲染当前层(默认)
+            // 判断所有dom是否全部加载
+            if(!options.lazy){
+                if(!options.renderAfterExpand || options.defaultExpandAll || options.defaultExpandedKeys.length>0 || options.defaultCheckedKeys.length>0){
+                    this.expandAll(options.data,[],1);
+                }
+            }
+
+            this.eleTreeEvent();
+            this.checkboxRender();
+            this.checkboxEvent();
+            this.defaultChecked();
+            this.nodeEvent();
+            this.rightClickMenu();
+            if(!options.checkStrictly){
+                this.checkboxInit();
+            }
+        },
+        ajaxGetData: function() {
+            var options=this.config;
+            var _self=this;
+            if(!options.url) {
+                laytpl(TPL_NoText()).render(options, function(string){
+                    options.elem.html(string);
+                });
+                return;
+            }
+            var data = $.extend({}, options.where);
+            if(options.contentType && options.contentType.indexOf("application/json") == 0){ //提交 json 格式
+                data = JSON.stringify(data);
+            }
+
+            $.ajax({
+                type: options.method || 'get'
+                ,url: options.url
+                ,contentType: options.contentType
+                ,data: data
+                ,dataType: 'json'
+                ,headers: options.headers || {}
+                ,success: function(res){
+                    if(res[options.response.statusName] != options.response.statusCode || !res[options.response.dataName]){
+                        hint.error("请检查数据格式是否符合规范");
+                        typeof options.done === 'function' && options.done(res);
+                        return;
+                    }
+                    options.data=res[options.response.dataName];
+                    _self.renderData();
+                    typeof options.done === 'function' && options.done(res);
+                }
+            });
+        },
+        reload: function(options) {
+            var _self=this;
+            if(this.config.data && this.config.data.constructor === Array) this.config.data=[];
+            this.config = $.extend({}, this.config, options);
+            $(this.config.elem).off();  // 取消事件绑定,防止多次绑定事件
+            // reload记录选中的数据
+            // this.getChecked().forEach(function(val) {
+            //     if($.inArray(val.key,this.config.defaultCheckedKeys)===-1){
+            //         this.config.defaultCheckedKeys.push(val.key);
+            //     }
+            // },this);
+            return eleTree.render(this.config)
+        },
+        // 下拉
+        eleTreeEvent: function() {
+            var _self=this;
+            var options=this.config;
+            // 下拉
+            var expandOnClickNode=options.expandOnClickNode?".eleTree-node-content":".eleTree-node-content>.eleTree-node-content-icon";
+            options.elem.on("click",expandOnClickNode,function(e) {
+                e.stopPropagation();
+                var eleTreeNodeContent=$(this).parent(".eleTree-node").length===0?$(this).parent(".eleTree-node-content"):$(this);
+                var eleNode=eleTreeNodeContent.parent(".eleTree-node");
+                var sibNode=eleTreeNodeContent.siblings(".eleTree-node-group");
+                var el=eleTreeNodeContent.children(".eleTree-node-content-icon").children(".layui-icon");
+
+                // 添加active背景
+                if(_self.prevClickEle) _self.prevClickEle.removeClass("eleTree-node-content-active");
+                if(options.highlightCurrent) eleTreeNodeContent.addClass("eleTree-node-content-active");
+                _self.prevClickEle=eleTreeNodeContent;
+
+
+
+                if(el.hasClass("icon-rotate")){
+                    // 合并
+                    sibNode.children(".eleTree-node:not(.eleTree-search-hide)").hide("fast");
+                    el.removeClass("icon-rotate");
+                    return;
+                }
+
+                if(sibNode.children(".eleTree-node").length===0){
+                    var floor=Number(eleNode.attr("eletree-floor"))+1;
+
+                    var data=_self.reInitData(eleNode);
+                    var d=data.currentData;
+                    // 是否懒加载
+                    if(options.lazy && el.hasClass("lazy-icon")){
+                        el.removeClass("layui-icon-triangle-r").addClass("layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop");
+                        options.load(d,function(getData) {
+                            d[options.request.children]=getData;
+                            var eletreeStatus=eleTreeNodeContent.children("input.eleTree-hideen").attr("eletree-status");
+                            if(d[options.request.children] && d[options.request.children].length>0){
+                                laytpl(TPL_ELEM(options,floor,eletreeStatus)).render(d[options.request.children], function(string){
+                                    sibNode.append(string).children().show("fast");
+                                });
+                            }else{
+                                el.css("color","transparent").addClass("leaf-icon");
+                            }
+                            el.removeClass("lazy-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop").addClass("layui-icon-triangle-r icon-rotate");
+                            _self.checkboxRender();
+
+                            // 懒加载子元素选择祖父(待写)
+                        })
+                    }else{
+                        var eletreeStatus=eleTreeNodeContent.children("input.eleTree-hideen").attr("eletree-status");
+                        d[options.request.children] && d[options.request.children].length>0 && laytpl(TPL_ELEM(options,floor,eletreeStatus)).render(d[options.request.children], function(string){
+                            sibNode.append(string);
+                        });
+
+                        // 选择祖父
+                        var eleNode1=sibNode.children(".eleTree-node").eq(0);
+                        if(eleNode1.length===0){
+                            _self.checkboxRender();
+                            return;
+                        }
+                        var siblingNode1=eleNode1.siblings(".eleTree-node");
+                        var item1=eleNode1.children(".eleTree-node-content").children(".eleTree-hideen").get(0);
+                        _self.selectParents(item1,eleNode1,siblingNode1);
+                        _self.checkboxRender();
+                    }
+                }
+                // 显示隐藏没有搜索类的
+                sibNode.children(".eleTree-node:not(.eleTree-search-hide)").show("fast");
+                el.addClass("icon-rotate");
+                // 手风琴效果
+                if(options.accordion){
+                    var node=eleTreeNodeContent.parent(".eleTree-node").siblings(".eleTree-node");
+                    node.children(".eleTree-node-group").children(".eleTree-node:not(.eleTree-search-hide)").hide("fast");
+                    node.children(".eleTree-node-content").children(".eleTree-node-content-icon").children(".layui-icon").removeClass("icon-rotate");
+                }
+            })
+        },
+        // checkbox选中
+        checkboxEvent: function() {
+            var options=this.config;
+            var _self=this;
+            var checkOnClickNode=options.checkOnClickNode?".eleTree-node-content":".eleTree-checkbox";
+            // input添加属性eleTree-status:即input的三种状态,"0":未选中,"1":选中,"2":子孙部分选中
+            options.elem.on("click",checkOnClickNode,function(e,type) {
+                e.stopPropagation();
+                var eleTreeNodeContent=$(this).parent(".eleTree-node").length===0?$(this).parent(".eleTree-node-content"):$(this);
+                var checkbox=eleTreeNodeContent.children(".eleTree-checkbox");
+                if(checkbox.hasClass("eleTree-checkbox-disabled")) return;
+                // 获取点击所在数据
+                var node=eleTreeNodeContent.parent(".eleTree-node");
+                // var d=_self.reInitData(node).currentData;
+                // 实际的input
+                var inp=checkbox.siblings(".eleTree-hideen").get(0);
+                var childNode=eleTreeNodeContent.siblings(".eleTree-node-group").find("input[name='eleTree-node']");
+
+                // 添加active背景
+                if(_self.prevClickEle) _self.prevClickEle.removeClass("eleTree-node-content-active");
+                if(options.highlightCurrent) eleTreeNodeContent.addClass("eleTree-node-content-active");
+                _self.prevClickEle=eleTreeNodeContent;
+
+                if(!inp){
+                    return;
+                }
+
+                if(inp.checked){
+                    // 反选自身
+                    $(inp).prop("checked",false).attr("eleTree-status","0");
+                    // 点击祖父层选中子孙层
+                    if(!options.checkStrictly){
+                        childNode.prop("checked",false);
+                        childNode.attr("eleTree-status","0");
+                    }
+
+                }else{
+                    // 反选自身
+                    $(inp).prop("checked",true).attr("eleTree-status","1");
+                    // 点击祖父层选中子孙层
+                    if(!options.checkStrictly){
+                        childNode.prop("checked",true).attr("eleTree-status","1");
+                    }
+                }
+
+                var eleNode=eleTreeNodeContent.parent(".eleTree-node");
+                // 点击子孙层选中祖父层(递归)
+                if(!options.checkStrictly){
+                    var siblingNode=eleNode.siblings(".eleTree-node");
+                    // 点击子孙层选中祖父层(递归)
+                    _self.selectParents(inp,eleNode,siblingNode);
+                }
+
+                _self.checkboxRender();
+
+                if(type==="default") return;
+                layui.event.call(inp, MOD_NAME, 'nodeChecked('+ _self.filter +')', {
+                    node: eleNode,
+                    data: _self.reInitData(eleNode),
+                    isChecked: inp.checked
+                });
+            })
+        },
+        // 对后台数据有 checked:true 的默认选中项渲染父子层
+        checkboxInit: function() {
+            var options=this.config;
+            var _self=this;
+            options.elem.find("input[eleTree-status='1']").each(function(index,item) {
+                var checkboxEl=$(item).siblings(".eleTree-checkbox");
+                var childNode=checkboxEl.parent(".eleTree-node-content").siblings(".eleTree-node-group").find("input[name='eleTree-node']");
+                // 选择当前
+                checkboxEl.addClass("eleTree-checkbox-checked");
+                checkboxEl.children("i").addClass("layui-icon-ok").removeClass("eleTree-checkbox-line");
+                // 选择子孙
+                childNode.prop("checked","checked").attr("eleTree-status","1");
+                childNode.siblings(".eleTree-checkbox").addClass("eleTree-checkbox-checked");
+                childNode.siblings(".eleTree-checkbox").children("i").addClass("layui-icon-ok").removeClass("eleTree-checkbox-line");
+
+                // 选择祖父
+                var eleNode=checkboxEl.parent(".eleTree-node-content").parent(".eleTree-node");
+                var siblingNode=eleNode.siblings(".eleTree-node");
+                _self.selectParents(item,eleNode,siblingNode);
+            })
+            _self.checkboxRender();
+        },
+        // 通过子元素选中祖父元素
+        selectParents: function(inp,eleNode,siblingNode) {
+            // inp: 实际input(dom元素)
+            // eleNode: input父层类(.eleTree-node)
+            // siblingNode: 父层同级兄弟
+            while (Number(eleNode.attr("eletree-floor"))!==0) {
+                // 同级input状态存入数组
+                var arr=[];
+                arr.push($(inp).attr("eleTree-status"));
+                siblingNode.each(function(index,item) {
+                    var siblingIsChecked=$(item).children(".eleTree-node-content").children("input[name='eleTree-node']").attr("eleTree-status");
+                    arr.push(siblingIsChecked);
+                })
+                // 父元素的实际input
+                var parentInput=eleNode.parent(".eleTree-node-group").siblings(".eleTree-node-content").children("input[name='eleTree-node']");
+                // 父元素的checkbox替代
+                var parentCheckbox=parentInput.siblings(".eleTree-checkbox");
+                // 子都选中则选中父
+                if(arr.every(function(val) {
+                        return val==="1";
+                    })){
+                    parentInput.prop("checked",true).attr("eleTree-status","1");
+                }
+                // 子有一个未选中则checkbox第三种状态
+                if(arr.some(function(val) {
+                        return val==="0" || val==="2";
+                    })){
+                    parentInput.attr("eleTree-status","2");
+                }
+                // 子全部未选中则取消父选中(并且取消第三种状态)
+                if(arr.every(function(val) {
+                        return val==="0";
+                    })){
+                    parentInput.prop("checked",false);
+                    parentInput.attr("eleTree-status","0");
+                }
+
+                var parentNode=eleNode.parents("[eletree-floor='"+(Number(eleNode.attr("eletree-floor"))-1)+"']");
+                var parentCheckbox=parentNode.children(".eleTree-node-content").children("input[name='eleTree-node']").get(0);
+                var parentSiblingNode=parentNode.siblings(".eleTree-node");
+                eleNode=parentNode;
+                inp=parentCheckbox;
+                siblingNode=parentSiblingNode;
+            }
+        },
+        // 初始展开所有
+        expandAll: function(data,arr,floor,isMethodsExpandAll) {
+            var options=this.config;
+            var _self=this;
+            data.forEach(function(val,index) {
+                arr.push(index);
+                if(val[options.request.children] && val[options.request.children].length>0){
+                    var el=options.elem.children(".eleTree-node").eq(arr[0]).children(".eleTree-node-group");
+                    for(var i=1;i<arr.length;i++){
+                        el=el.children(".eleTree-node").eq(arr[i]).children(".eleTree-node-group");
+                    }
+                    laytpl(TPL_ELEM(options,floor)).render(val[options.request.children], function(string){
+                        el.append(string);
+                        // 判断是否展开所有
+                        if(options.defaultExpandAll || isMethodsExpandAll){
+                            el.siblings(".eleTree-node-content").children(".eleTree-node-content-icon").children(".layui-icon").addClass("icon-rotate");
+                            el.children().show();
+                        }else if(options.defaultExpandedKeys.length>0) {
+                            // 展开指定id项
+                            var id=el.parent(".eleTree-node").attr("data-"+options.request.key);
+                            id=isNaN(id) ? id : Number(id);
+                            if($.inArray(id,options.defaultExpandedKeys)!==-1){
+                                el.siblings(".eleTree-node-content").children(".eleTree-node-content-icon").children(".layui-icon").addClass("icon-rotate");
+                                el.children().show();
+                                // 展开子项是否继续展开祖父项
+                                if(options.autoExpandParent){
+                                    var eleP=el.parent(".eleTree-node[data-"+options.request.key+"]").parents(".eleTree-node");
+                                    eleP.each(function(i,item) {
+                                        if($(item).attr("data-"+options.request.key)){
+                                            $(item).children(".eleTree-node-group").siblings(".eleTree-node-content").children(".eleTree-node-content-icon").children(".layui-icon").addClass("icon-rotate");
+                                            $(item).children(".eleTree-node-group").children().show();
+                                        }
+                                    })
+                                }
+                            }
+                        }
+                    });
+                    floor++;
+                    _self.expandAll(val[options.request.children],arr,floor,isMethodsExpandAll);
+                    floor--;
+                }
+                // 重置数组索引
+                arr.pop();
+            })
+
+
+        },
+        // 初始默认选中
+        defaultChecked: function() {
+            var options=this.config;
+            if(options.defaultCheckedKeys.length===0){
+                return false;
+            }
+            // 判断是否父子无关
+            if(options.checkStrictly){
+                options.defaultCheckedKeys.forEach(function(val,index) {
+                    var nodeContent=options.elem.find("[data-"+options.request.key+"='"+val+"']").children(".eleTree-node-content");
+                    // 如果当前没选中则选中
+                    if(nodeContent.children(".eleTree-hideen").prop("checked")===false){
+                        nodeContent.children(".eleTree-checkbox").trigger("click",["default"]);
+                    }
+                })
+                return false;
+            }
+            // 父元素优先
+            var arr=$.extend([],options.defaultCheckedKeys);
+            options.defaultCheckedKeys.forEach(function(val,index) {
+                options.elem.find("[data-"+options.request.key+"='"+val+"']").find("[data-"+options.request.key+"]").each(function(i,item) {
+                    var id=$(item).attr("data-"+options.request.key);
+                    id=isNaN(id) ? id : Number(id);
+                    var isInArrayIndex=$.inArray(id,arr);
+                    if(isInArrayIndex!==-1){
+                        arr.splice(isInArrayIndex,1);
+                    }
+                })
+            })
+            arr.forEach(function(val,index) {
+                var nodeContent=options.elem.find("[data-"+options.request.key+"='"+val+"']").children(".eleTree-node-content");
+                // 如果当前没选中则选中
+                if(nodeContent.children(".eleTree-hideen").prop("checked")===false){
+                    nodeContent.children(".eleTree-checkbox").trigger("click",["default"]);
+                }
+            })
+        },
+        // 自定义checkbox解析
+        checkboxRender: function() {
+            var options=this.config;
+            options.elem.find(".eleTree-checkbox").remove();
+            options.elem.find("input.eleTree-hideen[type=checkbox]").each(function(index,item){
+                if($(item).hasClass("eleTree-disabled")){
+                    $(item).after('<div class="eleTree-checkbox eleTree-checkbox-disabled"><i class="layui-icon"></i></div>');
+                }else{
+                    $(item).after('<div class="eleTree-checkbox"><i class="layui-icon"></i></div>');
+                }
+
+                var checkbox=$(item).siblings(".eleTree-checkbox");
+                if($(item).attr("eletree-status")==="1"){
+                    checkbox.addClass("eleTree-checkbox-checked");
+                    checkbox.children("i").addClass("layui-icon-ok").removeClass("eleTree-checkbox-line");
+                }else if($(item).attr("eletree-status")==="0"){
+                    checkbox.removeClass("eleTree-checkbox-checked");
+                    checkbox.children("i").removeClass("layui-icon-ok eleTree-checkbox-line");
+                }else if($(item).attr("eletree-status")==="2"){
+                    checkbox.addClass("eleTree-checkbox-checked");
+                    checkbox.children("i").removeClass("layui-icon-ok").addClass("eleTree-checkbox-line");
+                }
+
+            })
+        },
+        // 通过dom节点找对应数据
+        reInitData: function(node) {
+            var options=this.config;
+            var i=node.index();
+            var floor=Number(node.attr("eletree-floor"));
+            var arr=[];     // 节点对应的index
+            while (floor>=0) {
+                arr.push(i);
+                floor=floor-1;
+                node=node.parents("[eletree-floor='"+floor+"']");
+                i=node.index();
+            }
+            arr=arr.reverse();
+            var oData=this.config.data;
+            // 当前节点的父节点数据
+            var parentData=oData[arr[0]];
+            // 当前节点的data数据
+            var d = oData[arr[0]];
+            for(var i = 1; i<arr.length; i++){
+                d = d[options.request.children]?d[options.request.children][arr[i]]:d;
+            }
+            for(var i = 1; i<arr.length-1; i++){
+                parentData = parentData[options.request.children]?parentData[options.request.children][arr[i]]:parentData;
+            }
+
+            return {
+                currentData: d,
+                parentData: {
+                    data: parentData,
+                    childIndex: arr[arr.length-1]
+                },
+                index: arr
+            }
+        },
+        // 通过key查找数据
+        keySearchToOpera: function(key,callback) {
+            var options=this.config;
+            var _self=this;
+            // 查找数据
+            var fn=function(data) {
+                var obj={
+                    i: 0,
+                    len: data.length
+                }
+                for(;obj.i<obj.len;obj.i++){
+                    if(data[obj.i][options.request.key]!==key){
+                        if(data[obj.i][options.request.children] && data[obj.i][options.request.children].length>0){
+                            fn(data[obj.i][options.request.children]);
+                        }
+                    }else{
+                        callback(data,obj);
+                    }
+                }
+            }
+            fn(options.data);
+        },
+        updateKeyChildren: function(key,data) {
+            var options=this.config;
+            var node=options.elem.find("[data-"+options.request.key+"='"+key+"']");
+            var floor=Number(node.attr("eletree-floor"))+1;
+            var _self=this;
+
+            this.keySearchToOpera(key,function(d,obj) {
+                // 数据更新
+                d[obj.i][options.request.children]=data;
+                // dom更新
+                node.length!==0 && laytpl(TPL_ELEM(options,floor)).render(data, function(string){
+                    $(node).children(".eleTree-node-group").empty().append(string);
+                    options.defaultExpandAll && $(node).children(".eleTree-node-group").children().show();
+                });
+                _self.unCheckNodes();
+                _self.defaultChecked();
+            });
+        },
+        updateKeySelf: function(key,data) {
+            var options=this.config;
+            var node=options.elem.find("[data-"+options.request.key+"='"+key+"']").children(".eleTree-node-content");
+            var floor=Number(node.attr("eletree-floor"))+1;
+            data[options.request.name] && node.children(".eleTree-node-content-label").text(data[options.request.name]);
+            data[options.request.disabled] && node.children(".eleTree-hideen").addClass("eleTree-disabled")
+                .siblings(".eleTree-checkbox").addClass("eleTree-checkbox-disabled");
+            // 数据更新
+            var getData=this.keySearchToOpera(key,function(d,obj) {
+                data[options.request.key]=d[obj.i][options.request.key];
+                data[options.request.children]=d[obj.i][options.request.children];
+                d[obj.i]=$.extend({},d[obj.i],data);
+                console.log(options.data);
+            });
+        },
+        remove: function(key) {
+            var options=this.config;
+            var node=options.elem.find("[data-"+options.request.key+"='"+key+"']");
+            var pElem=node.parent(".eleTree-node-group");
+            // 数据删除
+            this.keySearchToOpera(key,function(data,obj) {
+                data.splice(obj.i,1);
+                obj.i--;
+                obj.len--;
+
+                node.length!==0 && options.elem.find("[data-"+options.request.key+"='"+key+"']").remove();
+                if(pElem.children(".eleTree-node").length===0){
+                    pElem.siblings(".eleTree-node-content").children(".eleTree-node-content-icon").children(".layui-icon").css("color", "transparent");
+                }
+            });
+            this.unCheckNodes();
+            this.defaultChecked();
+        },
+        append: function(key,data) {
+            var options=this.config;
+            var node=options.elem.find("[data-"+options.request.key+"='"+key+"']");
+            var floor=Number(node.attr("eletree-floor"))+1;
+            // 数据更新
+            this.keySearchToOpera(key,function(d,obj) {
+                if(d[obj.i][options.request.children]){
+                    d[obj.i][options.request.children].push(data);
+                }else{
+                    d[obj.i][options.request.children]=[data];
+                }
+                var arr=d[obj.i][options.request.children];
+                // 添加之后长度为1,则原来没有三角,添加三角
+                if(arr.length===1){
+                    node.children(".eleTree-node-content").find(".eleTree-node-content-icon .layui-icon").removeAttr("style").addClass("icon-rotate");
+                }
+                var len=arr.length;
+                var eletreeStatus=node.children(".eleTree-node-content").children("input.eleTree-hideen").attr("eletree-status");
+                eletreeStatus=eletreeStatus==="2" ? "0" : eletreeStatus;
+                node.length!==0 && laytpl(TPL_ELEM(options,floor,eletreeStatus)).render([arr[len-1]], function(string){
+                    node.children(".eleTree-node-group").append(string).children().show();
+                });
+            });
+            this.checkboxRender();
+        },
+        insertBefore: function(key,data) {
+            var options=this.config;
+            var node=options.elem.find("[data-"+options.request.key+"='"+key+"']");
+            var floor=Number(node.attr("eletree-floor"));
+            // 数据更新
+            this.keySearchToOpera(key,function(d,obj) {
+                d.splice(obj.i,0,data);
+                obj.i++;
+                obj.len++;
+                var eletreeStatus=node.parent(".eleTree-node-group").length===0 ? "0" : node.parent(".eleTree-node-group").parent(".eleTree-node")
+                        .children(".eleTree-node-content").children("input.eleTree-hideen").attr("eletree-status");
+                eletreeStatus=eletreeStatus==="2" ? "0" : eletreeStatus;
+                node.length!==0 && laytpl(TPL_ELEM(options,floor,eletreeStatus)).render([data], function(string){
+                    node.before(string).prev(".eleTree-node").show();
+                });
+            });
+            this.checkboxRender();
+        },
+        insertAfter: function(key,data) {
+            var options=this.config;
+            var node=options.elem.find("[data-"+options.request.key+"='"+key+"']");
+            var floor=Number(node.attr("eletree-floor"));
+            // 数据更新
+            this.keySearchToOpera(key,function(d,obj) {
+                d.splice(obj.i+1,0,data);
+                obj.i++;
+                obj.len++;
+                var eletreeStatus=node.parent(".eleTree-node-group").length===0 ? "0" : node.parent(".eleTree-node-group").parent(".eleTree-node")
+                        .children(".eleTree-node-content").children("input.eleTree-hideen").attr("eletree-status");
+                eletreeStatus=eletreeStatus==="2" ? "0" : eletreeStatus;
+                node.length!==0 && laytpl(TPL_ELEM(options,floor,eletreeStatus)).render([data], function(string){
+                    $(node).after(string).next(".eleTree-node").show();
+                });
+            });
+            this.checkboxRender();
+            // if(!options.lazy){
+            //     if(!options.renderAfterExpand || options.defaultExpandAll || options.defaultExpandedKeys.length>0){
+            //         this.expandAll(options.data,[],1);
+            //     }
+            // }
+        },
+        getChecked: function(leafOnly, includeHalfChecked) {
+            var options=this.config
+                ,el
+                ,arr=[];
+            leafOnly=leafOnly || false;
+            includeHalfChecked=includeHalfChecked || false;
+            if(leafOnly){
+                el=options.elem.find(".layui-icon.leaf-icon").parent(".eleTree-node-content-icon")
+                    .siblings("input.eleTree-hideen[eletree-status='1']");
+            }else if(includeHalfChecked){
+                el=options.elem.find("input.eleTree-hideen[eletree-status='1'],input.eleTree-hideen[eletree-status='2']");
+            }else{
+                el=options.elem.find("input.eleTree-hideen[eletree-status='1']");
+            }
+            el.each(function(index,item) {
+                var obj={};
+                var id=$(item).parent(".eleTree-node-content").parent(".eleTree-node").attr("data-"+options.request.key);
+                id=isNaN(id) ? id : Number(id);
+                obj[options.request.key]=id;
+                obj.elem=item;
+                obj.othis=$(item).siblings(".eleTree-checkbox").get(0)
+                arr.push(obj);
+            })
+            return arr;
+        },
+        setChecked: function(arr) {
+            var options=this.config;
+            this.unCheckNodes();
+            arr.forEach(function(val) {
+                if($.inArray(val,options.defaultCheckedKeys)===-1){
+                    options.defaultCheckedKeys.push(val);
+                }
+            })
+            this.defaultChecked();
+        },
+        unCheckNodes: function() {
+            var options=this.config;
+            options.elem.find("input.eleTree-hideen[eletree-status='1'],input.eleTree-hideen[eletree-status='2']").each(function(index,item) {
+                $(item).attr("eletree-status","0").prop("checked",false);
+            });
+            this.checkboxRender();
+        },
+        unExpandAll: function() {
+            var options=this.config;
+            options.elem.find(".layui-icon.icon-rotate").removeClass("icon-rotate")
+                .parent(".eleTree-node-content-icon").parent(".eleTree-node-content")
+                .siblings(".eleTree-node-group").children(".eleTree-node").hide();
+        },
+        // 节点事件
+        nodeEvent: function() {
+            var _self=this;
+            var options=this.config;
+            // 节点被点击的回调事件
+            options.elem.on("click",".eleTree-node-content",function(e) {
+                var eleNode=$(this).parent(".eleTree-node");
+                $("#tree-menu").hide().remove();
+                layui.event.call(eleNode, MOD_NAME, 'nodeClick('+ _self.filter +')', {
+                    node: eleNode,
+                    data: _self.reInitData(eleNode),
+                    event: e
+                });
+            })
+            // 节点右键的回调事件
+            options.elem.on("contextmenu",".eleTree-node-content",function(e) {
+                var eleNode=$(this).parent(".eleTree-node");
+                layui.event.call(eleNode, MOD_NAME, 'nodeContextmenu('+ _self.filter +')', {
+                    node: eleNode,
+                    data: _self.reInitData(eleNode),
+                    event: e
+                });
+            })
+            // 节点被拖拽的回调事件
+            options.draggable && options.elem.on("mousedown",".eleTree-node-content",function(e) {
+                var time=0;
+                var eleNode=$(this).parent(".eleTree-node");
+                var eleFloor=Number(eleNode.attr("eletree-floor"));
+                var groupNode=eleNode.parent(".eleTree-node-group");
+
+                e.stopPropagation();
+                options.elem.css("user-select","none");
+                var cloneNode=eleNode.clone(true);
+                var temNode=eleNode.clone(true);
+
+                var x=e.clientX-options.elem.offset().left;
+                var y=e.clientY-options.elem.offset().top;
+                options.elem.append(cloneNode);
+                cloneNode.css({
+                    "display": "none",
+                    "opacity": 0.7,
+                    "position": "absolute",
+                    "background-color": "#f5f5f5",
+                    "width": "100%"
+                })
+
+                var currentData=_self.reInitData(eleNode);
+
+                var isStop=false;
+
+                $(document).on("mousemove",function(e) {
+                    // t为了区别click事件
+                    time++;
+                    if(time>2){
+                        var xx=e.clientX-options.elem.offset().left+10;
+                        var yy=e.clientY-options.elem.offset().top+$(document).scrollTop()-5;   // 加上浏览器滚动高度
+
+                        cloneNode.css({
+                            display: "block",
+                            left: xx+"px",
+                            top: yy+"px"
+                        })
+                    }
+                }).on("mouseup",function(e) {
+                    $(document).off("mousemove").off("mouseup");
+                    var target=$(e.target).parents(".eleTree-node").eq(0);
+                    cloneNode.remove();
+                    options.elem.css("user-select","auto");
+
+
+                    // 当前点击的是否时最外层
+                    var isCurrentOuterMost=eleNode.parent().get(0).isEqualNode(options.elem.get(0))
+                    // 目标是否时最外层
+                    var isTargetOuterMost=$(e.target).get(0).isEqualNode(options.elem.get(0))
+                    if(isTargetOuterMost){
+                        target=options.elem;
+                    }
+                    // 判断是否超出边界
+                    if(target.parents(options.elem).length===0 && !isTargetOuterMost){
+                        return;
+                    }
+                    // 判断初始与结束是否是同一个节点
+                    if(target.get(0).isEqualNode(eleNode.get(0))){
+                        return;
+                    }
+                    // 判断是否是父节点放到子节点
+                    var tFloor=target.attr("eletree-floor");
+                    var isInChild=false;
+                    eleNode.find("[eletree-floor='"+tFloor+"']").each(function() {
+                        if(this.isEqualNode(target.get(0))){
+                            isInChild=true;
+                        }
+                    })
+                    if(isInChild){
+                        return;
+                    }
+
+                    var targetData=_self.reInitData(target);
+                    layui.event.call(target, MOD_NAME, 'nodeDrag('+ _self.filter +')', {
+                        current: {
+                            node: eleNode,
+                            data: currentData
+                        },
+                        target: {
+                            node: target,
+                            data: targetData
+                        },
+                        stop: function() {
+                            isStop=true;
+                        }
+                    });
+                    // 拖拽是否取消
+                    if(isStop){
+                        return false;
+                    }
+
+                    // 数据更改
+                    var currList=currentData.parentData.data[options.request.children]
+                    var currIndex=currentData.parentData.childIndex
+                    var currData=currentData.currentData;
+                    var tarData=targetData.currentData;
+                    // 当前是否是最外层
+                    isCurrentOuterMost ? options.data.splice(currIndex,1) : currList.splice(currIndex,1)
+                    // 目标是否是最外层
+                    isTargetOuterMost ? options.data.push(currData) : (function() {
+                            !tarData[options.request.children] ? tarData[options.request.children]=[] : "";
+                            tarData[options.request.children].push(currData);
+                        })()
+
+                    // dom互换
+                    eleNode.remove();
+                    // 最外层判断
+                    if(isTargetOuterMost){
+                        target.append(temNode);
+                        var floor=0;
+                    }else{
+                        target.children(".eleTree-node-group").append(temNode);
+                        var floor=Number(target.attr("eletree-floor"))+1;
+                    }
+                    // 加floor和padding
+                    temNode.attr("eletree-floor",String(floor));
+                    temNode.children(".eleTree-node-content").css("padding-left",floor*options.indent+"px");
+                    // 通过floor差值计算子元素的floor
+                    var countFloor=eleFloor-floor;
+                    temNode.find(".eleTree-node").each(function(index,item) {
+                        var f=Number($(item).attr("eletree-floor"))-countFloor;
+                        $(item).attr("eletree-floor",String(f));
+                        $(item).children(".eleTree-node-content").css("padding-left",f*options.indent+"px");
+                    })
+                    // 原dom去三角
+                    var leaf=groupNode.children(".eleTree-node").length===0;
+                    leaf && groupNode.siblings(".eleTree-node-content")
+                        .children(".eleTree-node-content-icon").children(".layui-icon")
+                        .removeClass("icon-rotate").css("color","transparent");
+                    // 当前的增加三角
+                    var cLeaf=target.children(".eleTree-node-group").children(".eleTree-node").length===0;
+                    !cLeaf && target.children(".eleTree-node-content")
+                        .children(".eleTree-node-content-icon").children(".layui-icon")
+                        .addClass("icon-rotate").removeAttr("style");
+
+                    _self.unCheckNodes();
+                    _self.defaultChecked();
+
+                })
+            })
+        },
+        rightClickMenu: function() {
+            var _self=this;
+            var options=this.config;
+            if(options.contextmenuList.length<=0){
+                return;
+            }
+            $(document).on("click",function() {
+                $("#tree-menu").hide().remove();
+            });
+            var menuStr=['<ul id="tree-menu">'
+                ,$.inArray("copy",options.contextmenuList)!==-1?'<li class="copy"><a href="javascript:;">复制</a></li>':''
+                ,$.inArray("add",options.contextmenuList)!==-1?'<li class="add"><a href="javascript:;">新增</a></li>'+
+                    '<li class="insertBefore"><a href="javascript:;">插入节点前</a></li>'+
+                    '<li class="insertAfter"><a href="javascript:;">插入节点后</a></li>'+
+                    '<li class="append"><a href="javascript:;">插入子节点</a></li>' : ""
+                ,$.inArray("edit",options.contextmenuList)!==-1?'<li class="edit"><a href="javascript:;">修改</a></li>':''
+                ,$.inArray("remove",options.contextmenuList)!==-1?'<li class="remove"><a href="javascript:;">删除</a></li>':''
+                ,'</ul>'].join("");
+            this.treeMenu=$(menuStr);
+            options.elem.off("contextmenu").on("contextmenu",".eleTree-node-content",function(e) {
+                var that=this;
+                e.stopPropagation();
+                e.preventDefault();
+                // 添加active背景
+                if(_self.prevClickEle) _self.prevClickEle.removeClass("eleTree-node-content-active");
+                $(this).addClass("eleTree-node-content-active");
+                var eleNode=$(this).parent(".eleTree-node");
+                var nodeData=_self.reInitData(eleNode);
+
+                // 菜单位置
+                $(document.body).after(_self.treeMenu);
+                $("#tree-menu li.insertBefore,#tree-menu li.insertAfter,#tree-menu li.append").hide();
+                $("#tree-menu li.copy,#tree-menu li.add,#tree-menu li.edit,#tree-menu li.remove").show();
+                $("#tree-menu").css({
+                    left: e.pageX,
+                    top: e.pageY
+                }).show();
+                // 复制
+                $("#tree-menu li.copy").off().on("click",function() {
+                    var el = $(that).children(".eleTree-node-content-label").get(0);
+                    var selection = window.getSelection();
+                    var range = document.createRange();
+                    range.selectNodeContents(el);
+                    selection.removeAllRanges();
+                    selection.addRange(range);
+                    document.execCommand('Copy', 'false', null);
+                    selection.removeAllRanges();
+                });
+                // 新增
+                $("#tree-menu li.add").off().on("click",function(e) {
+                    e.stopPropagation();
+                    $(this).hide().siblings("li.copy,li.edit,li.remove").hide();
+                    $(this).siblings(".append,li.insertAfter,li.insertBefore").show();
+                })
+                // 添加的默认数据
+                var obj={};
+                obj[options.request.key]=_self.addKeyIndex;
+                obj[options.request.name]="未命名"+_self.nameIndex;
+
+                var arr=["Append","InsertBefore","InsertAfter"];
+                arr.forEach(function(val) {
+                    var s=val[0].toLocaleLowerCase()+val.slice(1,val.length);
+                    $("#tree-menu li."+s).off().on("click",function(e) {
+                        var node=$(that).parent(".eleTree-node");
+                        var key=node.attr("data-"+options.request.key);
+                        key=isNaN(key) ? key : Number(key);
+                        var isStop=false;
+                        var s=val[0].toLocaleLowerCase()+val.slice(1,val.length);
+                        layui.event.call(node, MOD_NAME, 'node'+val+'('+ _self.filter +')', {
+                            node: node,
+                            data: nodeData.currentData,
+                            // 重新设置数据
+                            setData: function(o) {
+                                _self[s](key,$.extend({},obj,o));
+                                isStop=true;
+                            },
+                            // 停止添加
+                            stop: function() {
+                                isStop=true;
+                            }
+                        });
+                        if(isStop) return;
+                        _self[s](key,obj)
+                        _self.nameIndex++;
+                        _self.addKeyIndex++;
+                    })
+                })
+
+                // 编辑
+                $("#tree-menu li.edit").off().on("click",function(e) {
+                    e.stopPropagation();
+                    $("#tree-menu").hide().remove();
+                    var node=$(that).parent(".eleTree-node");
+                    var key=node.attr("data-"+options.request.key);
+                    key=isNaN(key) ? key : Number(key);
+                    var label=$(that).children(".eleTree-node-content-label").hide();
+                    var text=label.text();
+                    var inp="<input type='text' value='"+text+"' class='eleTree-node-content-input' />";
+                    label.after(inp);
+                    label.siblings(".eleTree-node-content-input").focus().select().off().on("blur",function() {
+                        var val=$(this).val();
+                        var isStop=false;
+                        var inpThis=this;
+                        layui.event.call(node, MOD_NAME, 'nodeEdit('+ _self.filter +')', {
+                            node: node,
+                            value: val,
+                            data: nodeData.currentData,
+                            // 停止添加
+                            stop: function() {
+                                isStop=true;
+                                $(inpThis).siblings(".eleTree-node-content-label").show();
+                                $(inpThis).remove();
+                            }
+                        });
+                        if(isStop) return;
+                        // 修改数据
+                        _self.reInitData(eleNode).currentData[options.request.name]=val;
+                        // 修改dom
+                        $(this).siblings(".eleTree-node-content-label").text(val).show();
+                        $(this).remove();
+                    }).on("mousedown",function(e) {
+                        // 防止input拖拽
+                        e.stopPropagation();
+                    })
+                })
+                // 删除
+                $("#tree-menu li.remove").off().on("click",function(e) {
+                    var node=$(that).parent(".eleTree-node");
+                    var key=node.attr("data-"+options.request.key);
+                    key=isNaN(key) ? key : Number(key);
+                    var isStop=false;
+                    layui.event.call(node, MOD_NAME, 'nodeRemove('+ _self.filter +')', {
+                        node: node,
+                        data: nodeData.currentData,
+                        // 停止添加
+                        stop: function() {
+                            isStop=true;
+                        }
+                    });
+                    if(isStop) return;
+                    _self.remove(key);
+                })
+
+                _self.prevClickEle=$(this);
+            })
+        },
+        search: function(value) {
+            var options=this.config;
+            if(!options.searchNodeMethod || typeof options.searchNodeMethod !== "function"){
+                return;
+            }
+            var data=options.data;
+            // 数据递归
+            var traverse=function(data) {
+                data.forEach(function(val,index) {
+                    // 所有查找到的节点增加属性
+                    val.visible=options.searchNodeMethod(value,val);
+                    if(val[options.request.children] && val[options.request.children].length>0){
+                        traverse(val[options.request.children]);
+                    }
+                    //如果当前节点属性为隐藏,判断其子节点是否有显示的,如果有,则当前节点改为显示
+                    if(!val.visible){
+                        let childSomeShow = false;
+                        if(val[options.request.children] && val[options.request.children].length>0){
+                            childSomeShow=val[options.request.children].some(function(v,i) {
+                                return v.visible;
+                            })
+                        }
+                        val.visible = childSomeShow;
+                    }
+                    // 通过节点的属性,显示隐藏各个节点,并添加删除搜索类
+                    var el=options.elem.find("[data-"+options.request.key+"='"+val[options.request.key]+"']");
+                    if(val.visible){
+                        el.removeClass("eleTree-search-hide");
+                        // 判断父节点是否展开,如果父节点没有展开,则子节点也不要显示
+                        var parentEl=el.parent(".eleTree-node-group").parent(".eleTree-node");
+                        var isParentOpen=parentEl.children(".eleTree-node-content").children(".eleTree-node-content-icon").children(".layui-icon.layui-icon-triangle-r").hasClass("icon-rotate")
+                        if((parentEl.length>0 && isParentOpen) || parentEl.length===0){
+                            el.show();
+                        }
+                    }else{
+                        el.hide().addClass("eleTree-search-hide");
+                    }
+                    // 删除子层属性
+                    if(val[options.request.children] && val[options.request.children].length>0){
+                        val[options.request.children].forEach(function(v,i) {
+                            delete v.visible;
+                        })
+                    }
+                })
+            }
+            traverse(data);
+            // 删除最外层属性
+            var arr=[];
+            data.forEach(function(val) {
+                arr.push(val.visible);
+                delete val.visible;
+            })
+            // 如果第一层的所有的都隐藏,则显示文本
+            if(arr.every(function(v) {
+                    return v===false;
+                })){
+                laytpl(TPL_NoText()).render(options, function(string){
+                    options.elem.append(string);
+                });
+            }else{
+                options.elem.children(".eleTree-noText").remove();
+            }
+        }
+    }
+
+    exports(MOD_NAME,eleTree);
+})

+ 1733 - 0
js/layuiPlugins/formSelects-v4.js

@@ -0,0 +1,1733 @@
+/**
+ * name: formSelects
+ * 基于Layui Select多选
+ * version: 4.0.0.0817
+ * http://sun.faysunshine.com/layui/formSelects-v4/dist/formSelects-v4.js
+ */
+(function(layui, window, factory) {
+	if(typeof exports === 'object') { // 支持 CommonJS
+		module.exports = factory();
+	} else if(typeof define === 'function' && define.amd) { // 支持 AMD
+		define(factory);
+	} else if(window.layui && layui.define) { //layui加载
+		layui.define(['jquery'], function(exports) {
+			exports('formSelects', factory());
+		});
+	} else {
+		window.formSelects = factory();
+	}
+})(typeof layui == 'undefined' ? null : layui, window, function() {
+	let v = '4.0.0.0817',
+		NAME = 'xm-select',
+		PNAME = 'xm-select-parent',
+		INPUT = 'xm-select-input',
+		TDIV = 'xm-select--suffix',
+		THIS = 'xm-select-this',
+		LABEL = 'xm-select-label',
+		SEARCH = 'xm-select-search',
+		SEARCH_TYPE = 'xm-select-search-type',
+		SHOW_COUNT = 'xm-select-show-count',
+		CREATE = 'xm-select-create',
+		CREATE_LONG = 'xm-select-create-long',
+		MAX = 'xm-select-max',
+		SKIN = 'xm-select-skin',
+		DIRECTION = "xm-select-direction",
+		HEIGHT = 'xm-select-height',
+		DISABLED = 'xm-dis-disabled',
+		DIS = 'xm-select-dis',
+		TEMP = 'xm-select-temp',
+		RADIO = 'xm-select-radio',
+		LINKAGE= 'xm-select-linkage',
+		DL = 'xm-select-dl',
+		DD_HIDE = 'xm-select-hide',
+		HIDE_INPUT = 'xm-hide-input',
+		SANJIAO = 'xm-select-sj',
+		ICON_CLOSE = 'xm-icon-close',
+		FORM_TITLE = 'xm-select-title',
+		FORM_SELECT = 'xm-form-select',
+		FORM_SELECTED = 'xm-form-selected',
+		FORM_NONE = 'xm-select-none',
+		FORM_EMPTY = 'xm-select-empty',
+		FORM_INPUT = 'xm-input',
+		FORM_DL_INPUT = 'xm-dl-input',
+		FORM_SELECT_TIPS = 'xm-select-tips',
+		CHECKBOX_YES = 'xm-iconfont',
+		FORM_TEAM_PID = 'XM_PID_VALUE',
+		CZ = 'xm-cz',
+		CZ_GROUP = 'xm-cz-group',
+		TIPS = '请选择',
+		data = {},
+		events = {
+			on: {},
+			endOn: {},
+			filter: {},
+			maxTips: {},
+			opened: {},
+			closed: {}
+		},
+		ajax = {
+			type: 'get',
+			header: {
+
+			},
+			first: true,
+			data: {},
+			searchUrl: '',
+			searchName: 'keyword',
+			searchVal: null,
+			keyName: 'name',
+			keyVal: 'value',
+			keySel: 'selected',
+			keyDis: 'disabled',
+			keyChildren: 'children',
+			dataType: '',
+			delay: 500,
+			beforeSuccess: null,
+			success: null,
+			error: null,
+			beforeSearch: null,
+			response: {
+				statusCode: 0,
+				statusName: 'code',
+				msgName: 'msg',
+				dataName: 'data'
+			},
+			tree: {
+				nextClick: function(id, item, callback){
+					callback([]);
+				},
+				folderChoose: true,
+				lazy: true
+			}
+		},
+		quickBtns = [
+			{icon: 'xm-iconfont icon-quanxuan', name: '全选', click: function(id, cm){
+				cm.selectAll(id, true, true);
+			}},
+			{icon: 'xm-iconfont icon-qingkong', name: '清空', click: function(id, cm){
+				cm.removeAll(id, true, true);
+			}},
+			{icon: 'xm-iconfont icon-fanxuan', name: '反选', click: function(id, cm){
+				cm.reverse(id, true, true);
+			}},
+			{icon: 'xm-iconfont icon-pifu', name: '换肤', click: function(id, cm){
+				cm.skin(id);
+			}}
+		],
+		$ = window.$ || (window.layui && window.layui.jquery),
+		$win = $(window),
+		ajaxs = {},
+		fsConfig = {},
+		fsConfigs = {},
+		FormSelects = function(options) {
+			this.config = {
+				name: null, //xm-select="xxx"
+				max: null,
+				maxTips: (id, vals, val, max) => {
+					let ipt = $(`[xid="${this.config.name}"]`).prev().find(`.${NAME}`);
+					if(ipt.parents('.layui-form-item[pane]').length) {
+						ipt = ipt.parents('.layui-form-item[pane]');
+					}
+					ipt.attr('style', 'border-color: red !important');
+					setTimeout(() => {
+						ipt.removeAttr('style');
+					}, 300);
+				},
+				init: null, //初始化的选择值,
+				on: null, //select值发生变化
+				opened: null,
+				closed: null,
+				filter: (id, inputVal, val, isDisabled) => {
+					return val.name.indexOf(inputVal) == -1;
+				},
+				clearid: -1,
+				direction: 'auto',
+				height: null,
+				isEmpty: false,
+				btns: [quickBtns[0], quickBtns[1], quickBtns[2]],
+				searchType: 0,
+				create: (id, name) => {
+					return Date.now();
+				},
+				template: (name, value, selected, disabled) => {
+					return name;
+				},
+				showCount: 0,
+				isCreate: false,
+				placeholder: TIPS,
+				clearInput: false,
+			};
+			this.select = null;
+			this.values = [];
+			$.extend(this.config, options, {
+				searchUrl: options.isSearch ? options.searchUrl : null,
+				placeholder: options.optionsFirst ? (
+					options.optionsFirst.value ? TIPS : (options.optionsFirst.innerHTML || TIPS)
+				) : TIPS,
+				btns: options.radio ? [quickBtns[1]] : [quickBtns[0], quickBtns[1], quickBtns[2]],
+			}, fsConfigs[options.name] || fsConfig);
+			if(isNaN(this.config.showCount) || this.config.showCount <= 0) {
+ 				this.config.showCount = 19921012;
+ 			}
+		};
+	
+	//一些简单的处理方法
+	let Common = function(){
+		this.appender();
+		this.on();
+		this.onreset();
+	};
+	
+	Common.prototype.appender = function(){//针对IE做的一些拓展
+		//拓展Array map方法
+		if(!Array.prototype.map){Array.prototype.map=function(i,h){var b,a,c,e=Object(this),f=e.length>>>0;if(h){b=h}a=new Array(f);c=0;while(c<f){var d,g;if(c in e){d=e[c];g=i.call(b,d,c,e);a[c]=g}c++}return a}};
+		
+		//拓展Array foreach方法
+		if(!Array.prototype.forEach){Array.prototype.forEach=function forEach(g,b){var d,c;if(this==null){throw new TypeError("this is null or not defined")}var f=Object(this);var a=f.length>>>0;if(typeof g!=="function"){throw new TypeError(g+" is not a function")}if(arguments.length>1){d=b}c=0;while(c<a){var e;if(c in f){e=f[c];g.call(d,e,c,f)}c++}}};
+	
+		//拓展Array filter方法
+ 		if(!Array.prototype.filter){Array.prototype.filter=function(b){if(this===void 0||this===null){throw new TypeError()}var f=Object(this);var a=f.length>>>0;if(typeof b!=="function"){throw new TypeError()}var e=[];var d=arguments[1];for(var c=0;c<a;c++){if(c in f){var g=f[c];if(b.call(d,g,c,f)){e.push(g)}}}return e}};
+	}
+	
+	Common.prototype.init = function(target){
+		//初始化页面上已有的select
+		$((target ? target : `select[${NAME}]`)).each((index, select) => {
+			let othis = $(select),
+				id = othis.attr(NAME),
+				hasLayuiRender = othis.next(`.layui-form-select`),
+ 				hasRender = othis.next(`.${PNAME}`),
+ 				options = {
+ 					name: id,
+ 					disabled: select.disabled,
+ 					max: othis.attr(MAX) - 0,
+ 					isSearch: othis.attr(SEARCH) != undefined,
+ 					searchUrl: othis.attr(SEARCH),
+ 					isCreate: othis.attr(CREATE) != undefined,
+ 					radio: othis.attr(RADIO) != undefined,
+ 					skin: othis.attr(SKIN),
+ 					direction: othis.attr(DIRECTION),
+ 					optionsFirst: select.options[0],
+ 					height: othis.attr(HEIGHT),
+ 					formname: othis.attr('name') || othis.attr('_name'),
+ 					layverify: othis.attr('lay-verify') || othis.attr('_lay-verify'),
+ 					layverType: othis.attr('lay-verType'),
+ 					searchType: othis.attr(SEARCH_TYPE) == 'dl' ? 1 : 0,
+ 					showCount: othis.attr(SHOW_COUNT) - 0,
+ 				},
+				value = othis.find('option[selected]').toArray().map((option) => {//获取已选中的数据
+					return {
+						name: option.innerHTML,
+						value: option.value,
+					}
+				}),
+				fs = new FormSelects(options);
+			
+			fs.values = value;
+			
+			if(fs.config.init) {
+				fs.values = fs.config.init.map(item => {
+					if(typeof item == 'object') {
+						return item;
+					}
+					return {
+						name: othis.find(`option[value="${item}"]`).text(),
+						value: item
+					}
+				}).filter(item => {
+					return item.name;
+				});
+				fs.config.init = fs.values.concat([]);
+			}else{
+				fs.config.init = value.concat([]);
+			}
+			
+			!fs.values && (fs.values = []);
+
+			data[id] = fs;
+
+			//先取消layui对select的渲染
+			hasLayuiRender[0] && hasLayuiRender.remove();
+			hasRender[0] && hasRender.remove();
+
+			//构造渲染div
+			let dinfo = this.renderSelect(id, fs.config.placeholder, select); 
+			let heightStyle = !fs.config.height || fs.config.height == 'auto' ? '' : `xm-hg style="height: 34px;"`;
+			let inputHtml = [
+				`<div class="${LABEL}">`,
+					`<input type="text" fsw class="${FORM_INPUT} ${INPUT}" ${fs.config.isSearch ? '' : 'style="display: none;"'} autocomplete="off" debounce="0" />`,
+				`</div>`
+			];
+			let reElem =
+				$(`<div class="${FORM_SELECT}" ${SKIN}="${fs.config.skin}">
+					<input class="${HIDE_INPUT}" value="" name="${fs.config.formname}" lay-verify="${fs.config.layverify}" lay-verType="${fs.config.layverType}" type="text" style="position: absolute;bottom: 0; z-index: -1;width: 100%; height: 100%; border: none; opacity: 0;"/>
+					<div class="${FORM_TITLE} ${fs.config.disabled ? DIS : ''}">
+						<div class="${FORM_INPUT} ${NAME}" ${heightStyle}>
+							${inputHtml.join('')}
+							<i class="${SANJIAO}"></i>
+						</div>
+						<div class="${TDIV}">
+							<input type="text" autocomplete="off" placeholder="${fs.config.placeholder}" readonly="readonly" unselectable="on" class="${FORM_INPUT}">
+						</div>
+						<div></div>
+					</div>
+					<dl xid="${id}" class="${DL} ${fs.config.radio ? RADIO:''}">${dinfo}</dl>
+				</div>`);
+				
+			var $parent = $(`<div class="${PNAME}" FS_ID="${id}"></div>`);
+ 			$parent.append(reElem)
+ 			othis.after($parent);
+ 			othis.attr('lay-ignore', '');
+ 			othis.removeAttr('name') && othis.attr('_name', fs.config.formname);
+ 			othis.removeAttr('lay-verify') && othis.attr('_lay-verify', fs.config.layverify);
+			
+			//如果可搜索, 加上事件
+			if(fs.config.isSearch){
+				ajaxs[id] = $.extend({}, ajax, {searchUrl: fs.config.searchUrl}, ajaxs[id]);
+				$(document).on('input', `div.${PNAME}[FS_ID="${id}"] .${INPUT}`, (e) => {
+					this.search(id, e, fs.config.searchUrl);
+				});
+				if(fs.config.searchUrl){//触发第一次请求事件
+					this.triggerSearch(reElem, true);
+				}
+			}else{//隐藏第二个dl
+				reElem.find(`dl dd.${FORM_DL_INPUT}`).css('display', 'none');
+			}
+		});
+	}
+	
+	Common.prototype.search = function(id, e, searchUrl, call){
+		let input;
+		if(call){
+			input = call;
+		}else{
+			input = e.target;
+			let keyCode = e.keyCode;
+			if(keyCode === 9 || keyCode === 13 || keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) {
+				return false;
+			}
+		}
+		let inputValue = $.trim(input.value);
+		//过滤一下tips
+		this.changePlaceHolder($(input));
+		
+		let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax;
+		searchUrl = ajaxConfig.searchUrl || searchUrl;
+		let fs = data[id],
+			isCreate = fs.config.isCreate,
+			reElem = $(`dl[xid="${id}"]`).parents(`.${FORM_SELECT}`);
+		//如果开启了远程搜索
+		if(searchUrl){
+			if(ajaxConfig.searchVal){
+				inputValue = ajaxConfig.searchVal;
+				ajaxConfig.searchVal = '';
+			}
+			if(!ajaxConfig.beforeSearch || (ajaxConfig.beforeSearch && ajaxConfig.beforeSearch instanceof Function && ajaxConfig.beforeSearch(id, searchUrl, inputValue))){
+				let delay = ajaxConfig.delay;
+				if(ajaxConfig.first){
+					ajaxConfig.first = false;
+					delay = 10;
+				}
+				clearTimeout(fs.clearid);
+				fs.clearid = setTimeout(() => {
+					reElem.find(`dl > *:not(.${FORM_SELECT_TIPS})`).remove();
+					reElem.find(`dd.${FORM_NONE}`).addClass(FORM_EMPTY).text('请求中');
+					this.ajax(id, searchUrl, inputValue, false, null, true);
+				}, delay);
+			}
+		}else{
+			reElem.find(`dl .${DD_HIDE}`).removeClass(DD_HIDE);
+			//遍历选项, 选择可以显示的值
+			reElem.find(`dl dd:not(.${FORM_SELECT_TIPS})`).each((idx, item) => {
+				let _item = $(item);
+				let searchFun = events.filter[id] || data[id].config.filter;
+				if(searchFun && searchFun(id, inputValue, this.getItem(id, _item), _item.hasClass(DISABLED)) == true){
+					_item.addClass(DD_HIDE);
+				}
+			});
+			//控制分组名称
+			reElem.find('dl dt').each((index, item) => {
+				if(!$(item).nextUntil('dt', `:not(.${DD_HIDE})`).length) {
+					$(item).addClass(DD_HIDE);
+				}
+			});
+			//动态创建
+			this.create(id, isCreate, inputValue);
+			let shows = reElem.find(`dl dd:not(.${FORM_SELECT_TIPS}):not(.${DD_HIDE})`);
+			if(!shows.length){
+				reElem.find(`dd.${FORM_NONE}`).addClass(FORM_EMPTY).text('无匹配项');
+			}else{
+				reElem.find(`dd.${FORM_NONE}`).removeClass(FORM_EMPTY);
+			}
+		}
+	}
+	
+	Common.prototype.isArray = function(obj){
+		return Object.prototype.toString.call(obj) == "[object Array]";
+	}
+	
+	Common.prototype.triggerSearch = function(div, isCall){
+		(div ? [div] : $(`.${FORM_SELECT}`).toArray()).forEach((reElem, index) => {
+			reElem = $(reElem);
+			let id = reElem.find('dl').attr('xid')
+			if((id && data[id] && data[id].config.isEmpty) || isCall){
+				this.search(id, null, null, data[id].config.searchType == 0 ? reElem.find(`.${LABEL} .${INPUT}`) : reElem.find(`dl .${FORM_DL_INPUT} .${INPUT}`));
+			}
+		});
+	}
+	
+	Common.prototype.clearInput = function(id){
+		let div = $(`.${PNAME}[fs_id="${id}"]`);
+		let input = data[id].config.searchType == 0 ? div.find(`.${LABEL} .${INPUT}`) : div.find(`dl .${FORM_DL_INPUT} .${INPUT}`);
+		input.val('');
+	}
+	
+	Common.prototype.ajax = function(id, searchUrl, inputValue, isLinkage, linkageWidth, isSearch, successCallback, isReplace){
+		let reElem = $(`.${PNAME} dl[xid="${id}"]`).parents(`.${FORM_SELECT}`);
+		if(!reElem[0] || !searchUrl){
+			return ;
+		}
+		let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax;
+		let ajaxData = $.extend(true, {}, ajaxConfig.data);
+		ajaxData[ajaxConfig.searchName] = inputValue;
+		//是否需要对ajax添加随机时间
+		//ajaxData['_'] = Date.now();
+		$.ajax({
+			type: ajaxConfig.type,
+			headers: ajaxConfig.header,
+			url: searchUrl,
+			data: ajaxConfig.dataType == 'json' ? JSON.stringify(ajaxData) : ajaxData,
+			success: (res) => {
+				if(typeof res == 'string'){
+					res = JSON.parse(res);
+				}
+				ajaxConfig.beforeSuccess && ajaxConfig.beforeSuccess instanceof Function && (res = ajaxConfig.beforeSuccess(id, searchUrl, inputValue, res));
+				if(this.isArray(res)){
+					let newRes = {};
+ 					newRes[ajaxConfig.response.statusName] = ajaxConfig.response.statusCode;
+ 					newRes[ajaxConfig.response.msgName] = "";
+ 					newRes[ajaxConfig.response.dataName] = res;
+ 					res = newRes;
+				}
+				if(res[ajaxConfig.response.statusName] != ajaxConfig.response.statusCode) {
+ 					reElem.find(`dd.${FORM_NONE}`).addClass(FORM_EMPTY).text(res[ajaxConfig.response.msgName]);
+ 				}else{
+					reElem.find(`dd.${FORM_NONE}`).removeClass(FORM_EMPTY);
+					this.renderData(id, res[ajaxConfig.response.dataName], isLinkage, linkageWidth, isSearch, isReplace);
+ 					data[id].config.isEmpty = res[ajaxConfig.response.dataName].length == 0;
+				}
+ 				successCallback && successCallback(id);
+				ajaxConfig.success && ajaxConfig.success instanceof Function && ajaxConfig.success(id, searchUrl, inputValue, res);
+			},
+			error: (err) => {
+				reElem.find(`dd[lay-value]:not(.${FORM_SELECT_TIPS})`).remove();
+				reElem.find(`dd.${FORM_NONE}`).addClass(FORM_EMPTY).text('服务异常');
+				ajaxConfig.error && ajaxConfig.error instanceof Function && ajaxConfig.error(id, searchUrl, inputValue, err);
+			}
+		});
+	}
+	
+	Common.prototype.renderData = function(id, dataArr, linkage, linkageWidth, isSearch, isReplace){
+		if(linkage){//渲染多级联动
+			this.renderLinkage(id, dataArr, linkageWidth);
+			return;
+		}
+		if(isReplace){
+			this.renderReplace(id, dataArr);
+			return;
+		}
+		
+		let reElem = $(`.${PNAME} dl[xid="${id}"]`).parents(`.${FORM_SELECT}`);
+		let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax;
+		let pcInput = reElem.find(`.${TDIV} input`);
+
+		dataArr = this.exchangeData(id, dataArr);
+		let values = [];
+		reElem.find('dl').html(this.renderSelect(id, pcInput.attr('placeholder') || pcInput.attr('back'), dataArr.map((item) => {
+			let itemVal = $.extend({}, item, {
+				innerHTML: item[ajaxConfig.keyName],
+				value: item[ajaxConfig.keyVal],
+				sel: item[ajaxConfig.keySel],
+				disabled: item[ajaxConfig.keyDis],
+				type: item.type,
+				name: item[ajaxConfig.keyName]
+			});
+			if(itemVal.sel){
+				values.push(itemVal);
+			}
+			return itemVal;
+		})));
+
+		let label = reElem.find(`.${LABEL}`);
+		let dl = reElem.find('dl[xid]');
+		if(isSearch){//如果是远程搜索, 这里需要判重
+			let oldVal = data[id].values;
+			oldVal.forEach((item, index) => {
+				dl.find(`dd[lay-value="${item.value}"]`).addClass(THIS);
+			});
+			values.forEach((item, index) => {
+				if(this.indexOf(oldVal, item) == -1){
+					this.addLabel(id, label, item);
+					dl.find(`dd[lay-value="${item.value}"]`).addClass(THIS);
+					oldVal.push(item);
+				}
+			});
+		}else{
+			values.forEach((item, index) => {
+				this.addLabel(id, label, item);
+				dl.find(`dd[lay-value="${item.value}"]`).addClass(THIS);
+			});
+			data[id].values = values;
+		}
+		this.commonHandler(id, label);
+	}
+	
+	Common.prototype.renderLinkage = function(id, dataArr, linkageWidth){
+		let result = [],
+			index = 0,
+			temp = {"0": dataArr},
+			ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax;
+		db[id] = {};
+		do{
+			let group = result[index ++] = [],
+				_temp = temp;
+			temp = {};
+			$.each(_temp, (pid, arr) => {
+				$.each(arr, (idx, item) => {
+					let val = {
+						pid: pid,
+						name: item[ajaxConfig.keyName],
+						value: item[ajaxConfig.keyVal],
+					};
+					db[id][val.value] = $.extend(item, val);
+					group.push(val);
+					let children = item[ajaxConfig.keyChildren];
+					if(children && children.length){
+						temp[val.value] = children;
+					}
+				});
+			});
+		}while(Object.getOwnPropertyNames(temp).length);
+		
+		let reElem = $(`.${PNAME} dl[xid="${id}"]`).parents(`.${FORM_SELECT}`);
+		let html = ['<div class="xm-select-linkage">'];
+		
+		$.each(result, (idx, arr) => {
+			let groupDiv = [`<div style="left: ${(linkageWidth-0) * idx}px;" class="xm-select-linkage-group xm-select-linkage-group${idx + 1} ${idx != 0 ? 'xm-select-linkage-hide':''}">`];
+			$.each(arr, (idx2, item) => {
+				let span = `<li title="${item.name}" pid="${item.pid}" xm-value="${item.value}"><span>${item.name}</span></li>`;
+				groupDiv.push(span);
+			});
+			groupDiv.push(`</div>`);
+			html = html.concat(groupDiv);
+		});
+		html.push('<div style="clear: both; height: 288px;"></div>');
+		html.push('</div>');
+		reElem.find('dl').html(html.join(''));
+		reElem.find(`.${INPUT}`).css('display', 'none');//联动暂时不支持搜索
+	}
+	
+	Common.prototype.renderReplace = function(id, dataArr){
+		let dl = $(`.${PNAME} dl[xid="${id}"]`);
+		let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax;
+
+		dataArr = this.exchangeData(id, dataArr);
+		db[id] = dataArr;
+		
+		let html = dataArr.map((item) => {
+			let itemVal = $.extend({}, item, {
+				innerHTML: item[ajaxConfig.keyName],
+				value: item[ajaxConfig.keyVal],
+				sel: item[ajaxConfig.keySel],
+				disabled: item[ajaxConfig.keyDis],
+				type: item.type,
+				name: item[ajaxConfig.keyName]
+			});
+			return this.createDD(id, itemVal);
+		}).join('');
+		
+		dl.find(`dd:not(.${FORM_SELECT_TIPS}),dt:not([style])`).remove();
+		dl.find(`dt[style]`).after($(html));
+	}
+
+	Common.prototype.exchangeData = function(id, arr){//这里处理树形结构
+	    let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax;
+	    let childrenName = ajaxConfig['keyChildren'];
+	    let disabledName = ajaxConfig['keyDis'];
+		db[id] = {};
+	    let result = this.getChildrenList(arr, childrenName, disabledName, [], false);
+        return result;
+	}
+
+	Common.prototype.getChildrenList = function(arr, childrenName, disabledName, pid, disabled){
+	    let result = [], offset = 0;
+	    for(let a = 0; a < arr.length; a ++){
+            let item = arr[a];
+            if(item.type && item.type == 'optgroup'){
+            	result.push(item);
+            	continue;
+            }else{
+            	offset ++;
+            }
+            let parentIds = pid.concat([]);
+            parentIds.push(`${offset - 1}_E`);
+            item[FORM_TEAM_PID] = JSON.stringify(parentIds);
+            item[disabledName] = item[disabledName] || disabled;
+            result.push(item);
+            let child = item[childrenName];
+            if(child && common.isArray(child) && child.length){
+            	item['XM_TREE_FOLDER'] = true;
+                let pidArr = parentIds.concat([]);
+                let childResult = this.getChildrenList(child, childrenName, disabledName, pidArr, item[disabledName]);
+                result = result.concat(childResult);
+            }
+        }
+        return result;
+	}
+
+	Common.prototype.create = function(id, isCreate, inputValue){
+		if(isCreate && inputValue){
+			let fs = data[id],
+				dl = $(`[xid="${id}"]`),
+				tips=  dl.find(`dd.${FORM_SELECT_TIPS}.${FORM_DL_INPUT}`),
+				tdd = null,
+				temp = dl.find(`dd.${TEMP}`);
+			dl.find(`dd:not(.${FORM_SELECT_TIPS}):not(.${TEMP})`).each((index, item) => {
+				if(inputValue == $(item).find('span').attr('name')){
+					tdd = item;
+				}
+			});
+			if(!tdd){//如果不存在, 则创建
+				let val = fs.config.create(id, inputValue);
+				if(temp[0]){
+					temp.attr('lay-value', val);
+					temp.find('span').text(inputValue);
+					temp.find('span').attr("name", inputValue);
+					temp.removeClass(DD_HIDE);
+				}else{
+					tips.after($(this.createDD(id, {
+						name: inputValue,
+						innerHTML: inputValue,
+						value: val
+					}, `${TEMP} ${CREATE_LONG}`)));
+				}
+			}
+		}else{
+			$(`[xid=${id}] dd.${TEMP}`).remove();
+		}
+	}
+	
+	Common.prototype.createDD = function(id, item, clz){
+		let name = $.trim(item.innerHTML);
+		db[id][item.value] = $(item).is('option') ? {name: name, value: item.value} : item;
+		let template = data[id].config.template(name);
+		let pid = item[FORM_TEAM_PID];
+		pid ? (pid = JSON.parse(pid)) : (pid = [-1]);
+		let attr = pid[0] == -1 ? '' : `tree-id="${pid.join('-')}" tree-folder="${!!item['XM_TREE_FOLDER']}"`;
+		return `<dd lay-value="${item.value}" class="${item.disabled ? DISABLED : ''} ${clz ? clz : ''}" ${attr}>
+					<div class="xm-unselect xm-form-checkbox ${item.disabled ? DISABLED : ''}"  style="margin-left: ${(pid.length - 1) * 30}px">
+						<i class="${CHECKBOX_YES}"></i>
+						<span name="${name}">${template}</span>
+					</div>
+				</dd>`;
+	}
+	
+	Common.prototype.createQuickBtn = function(obj, right){
+		return `<div class="${CZ}" method="${obj.name}" title="${obj.name}" ${right ? 'style="margin-right: ' + right + '"': ''}><i class="${obj.icon}"></i><span>${obj.name}</span></div>`
+	}
+	
+	Common.prototype.renderBtns = function(id, show, right){
+		let quickBtn = [];
+		let dl = $(`dl[xid="${id}"]`);
+		quickBtn.push(`<div class="${CZ_GROUP}" show="${show}" style="max-width: ${dl.prev().width() - 54}px;">`);
+		$.each(data[id].config.btns, (index, item) => {
+			quickBtn.push(this.createQuickBtn(item, right));
+		});
+		quickBtn.push(`</div>`);
+		quickBtn.push(this.createQuickBtn({icon: 'xm-iconfont icon-caidan', name: ''}));
+		return quickBtn.join('');
+	}
+	
+	Common.prototype.renderSelect = function(id, tips, select){
+		db[id] = {};
+		let arr = [];
+		if(data[id].config.btns.length){
+			setTimeout(() => {
+				let dl = $(`dl[xid="${id}"]`);
+				dl.parents(`.${FORM_SELECT}`).attr(SEARCH_TYPE, data[id].config.searchType);
+				dl.find(`.${CZ_GROUP}`).css('max-width', `${dl.prev().width() - 54}px`);
+			}, 10)
+			arr.push([
+				`<dd lay-value="" class="${FORM_SELECT_TIPS}" style="background-color: #FFF!important;">`,
+					this.renderBtns(id, null, '30px'),
+				`</dd>`,
+				`<dd lay-value="" class="${FORM_SELECT_TIPS} ${FORM_DL_INPUT}" style="background-color: #FFF!important;">`,
+					`<i class="xm-iconfont icon-sousuo"></i>`,
+					`<input type="text" class="${FORM_INPUT} ${INPUT}" placeholder="请搜索"/>`,
+				`</dd>`
+			].join(''));
+		}else{
+			arr.push(`<dd lay-value="" class="${FORM_SELECT_TIPS}">${tips}</dd>`);
+		}
+		if(this.isArray(select)){
+			$(select).each((index, item) => {
+				if(item){
+					if(item.type && item.type === 'optgroup') {
+						arr.push(`<dt>${item.name}</dt>`);
+					} else {
+						arr.push(this.createDD(id, item));
+					}
+				}
+			});
+		}else{
+			$(select).find('*').each((index, item) => {
+				if(item.tagName.toLowerCase() == 'option' && index == 0 && !item.value){
+					return ;
+				}
+				if(item.tagName.toLowerCase() === 'optgroup') {
+					arr.push(`<dt>${item.label}</dt>`);
+				} else {
+					arr.push(this.createDD(id, item));
+				}
+			});
+		}
+		arr.push('<dt style="display:none;"> </dt>');
+		arr.push(`<dd class="${FORM_SELECT_TIPS} ${FORM_NONE} ${arr.length === 2 ? FORM_EMPTY:''}">没有选项</dd>`);
+		return arr.join('');
+	}
+	
+	Common.prototype.on = function(){//事件绑定
+		this.one();
+		
+		$(document).on('click', (e) => {
+			if(!$(e.target).parents(`.${FORM_TITLE}`)[0]){//清空input中的值
+				$(`.${PNAME} dl .${DD_HIDE}`).removeClass(DD_HIDE);
+				$(`.${PNAME} dl dd.${FORM_EMPTY}`).removeClass(FORM_EMPTY);
+				$(`.${PNAME} dl dd.${TEMP}`).remove();
+				$.each(data, (key, fs) => {
+					this.clearInput(key);
+					if(!fs.values.length){
+						this.changePlaceHolder($(`div[FS_ID="${key}"] .${LABEL}`));
+					}
+				});
+			}
+			$(`.${PNAME} .${FORM_SELECTED}`).each((index, item) => {
+				this.changeShow($(item).find(`.${FORM_TITLE}`), false);
+			}) ;
+		});
+	}
+	
+	Common.prototype.calcLabelLeft = function(label, w, call){
+		let pos = this.getPosition(label[0]);
+    	pos.y = pos.x + label[0].clientWidth;
+    	let left = label[0].offsetLeft;
+    	if(!label.find('span').length){
+    		left = 0;
+    	}else if(call){//校正归位
+    		let span = label.find('span:last');
+    		span.css('display') == 'none' ? (span = span.prev()[0]) : (span = span[0]);
+			let spos = this.getPosition(span);
+			spos.y = spos.x + span.clientWidth;
+			
+			if(spos.y > pos.y){
+				left = left - (spos.y - pos.y) - 5;
+			}else{
+				left = 0;
+			}
+    	}else{
+	    	if(w < 0){
+				let span = label.find(':last');
+				span.css('display') == 'none' ? (span = span.prev()[0]) : (span = span[0]);
+				let spos = this.getPosition(span);
+				spos.y = spos.x + span.clientWidth;
+				if(spos.y > pos.y){
+					left -= 10;
+				}
+	    	}else{
+				if(left < 0){
+					left += 10;
+				}
+				if(left > 0){
+					left = 0;
+				}
+	    	}
+    	}
+    	label.css('left', left + 'px');
+	}
+	
+	Common.prototype.one = function(target){//一次性事件绑定
+		$(target ? target : document).off('click', `.${FORM_TITLE}`).on('click', `.${FORM_TITLE}`, (e) => {
+			let othis = $(e.target),
+				title = othis.is(FORM_TITLE) ? othis : othis.parents(`.${FORM_TITLE}`),
+				dl = title.next(),
+				id = dl.attr('xid');
+			
+			//清空非本select的input val
+			$(`dl[xid]`).not(dl).each((index, item) => {
+				this.clearInput($(item).attr('xid'));
+			});
+			$(`dl[xid]`).not(dl).find(`dd.${DD_HIDE}`).removeClass(DD_HIDE);
+			
+			//如果是disabled select
+			if(title.hasClass(DIS)){
+				return false;
+			}
+			//如果点击的是右边的三角或者只读的input
+			if(othis.is(`.${SANJIAO}`) || othis.is(`.${INPUT}[readonly]`)){
+				this.changeShow(title, !title.parents(`.${FORM_SELECT}`).hasClass(FORM_SELECTED));
+				return false;
+			}
+			//如果点击的是input的右边, focus一下
+			if(title.find(`.${INPUT}:not(readonly)`)[0]){
+				let input = title.find(`.${INPUT}`),
+					epos = {x: e.pageX, y: e.pageY},
+					pos = this.getPosition(title[0]),
+					width = title.width();
+				while(epos.x > pos.x){
+					if($(document.elementFromPoint(epos.x, epos.y)).is(input)){
+						input.focus();
+						this.changeShow(title, true);
+						return false;
+					}
+					epos.x -= 50;
+				}
+			}
+			
+			//如果点击的是可搜索的input
+			if(othis.is(`.${INPUT}`)){
+				this.changeShow(title, true);
+				return false;
+			}
+			//如果点击的是x按钮
+			if(othis.is(`i[fsw="${NAME}"]`)){
+				let val = this.getItem(id, othis),
+				dd = dl.find(`dd[lay-value='${val.value}']`);
+				if(dd.hasClass(DISABLED)){//如果是disabled状态, 不可选, 不可删
+					return false;
+				}
+				this.handlerLabel(id, dd, false, val);
+				return false;
+			}
+			
+			this.changeShow(title, !title.parents(`.${FORM_SELECT}`).hasClass(FORM_SELECTED));
+			return false;
+		});
+		$(target ? target : document).off('click', `dl.${DL}`).on('click', `dl.${DL}`, (e) => {
+			let othis = $(e.target);
+			if(othis.is(`.${LINKAGE}`) || othis.parents(`.${LINKAGE}`)[0]){//linkage的处理
+				othis = othis.is('li') ? othis : othis.parents('li');
+				let group = othis.parents('.xm-select-linkage-group'),
+					id = othis.parents('dl').attr('xid');
+				if(!id){
+					return false;
+				}
+				//激活li
+				group.find('.xm-select-active').removeClass('xm-select-active');
+				othis.addClass('xm-select-active');
+				//激活下一个group, 激活前显示对应数据
+				group.nextAll('.xm-select-linkage-group').addClass('xm-select-linkage-hide');
+				let nextGroup = group.next('.xm-select-linkage-group');
+				nextGroup.find('li').addClass('xm-select-linkage-hide');
+				nextGroup.find(`li[pid="${othis.attr('xm-value')}"]`).removeClass('xm-select-linkage-hide');
+				//如果没有下一个group, 或没有对应的值
+				if(!nextGroup[0] || nextGroup.find(`li:not(.xm-select-linkage-hide)`).length == 0){
+					let vals = [],
+						index = 0,
+						isAdd = !othis.hasClass('xm-select-this');
+					if(data[id].config.radio){
+						othis.parents('.xm-select-linkage').find('.xm-select-this').removeClass('xm-select-this');
+					}
+					do{
+						vals[index ++] = {
+							name: othis.find('span').text(),
+							value: othis.attr('xm-value')
+						}
+						othis = othis.parents('.xm-select-linkage-group').prev().find(`li[xm-value="${othis.attr('pid')}"]`);			
+					}while(othis.length);
+					vals.reverse();
+					let val = {
+						name: vals.map((item) => {
+								return item.name;
+							}).join('/'),
+						value: vals.map((item) => {
+								return item.value;
+							}).join('/'),
+					}
+					this.handlerLabel(id, null, isAdd, val);
+				}else{
+					nextGroup.removeClass('xm-select-linkage-hide');
+				}
+				return false;
+			}
+			
+			if(othis.is('dl')){
+				return false;
+			}
+			
+			if(othis.is('dt')){
+				othis.nextUntil(`dt`).each((index, item) => {
+					item = $(item);
+					if(item.hasClass(DISABLED) || item.hasClass(THIS)){
+												
+					}else{
+						item.find('i:not(.icon-expand)').click();
+					}
+				});
+				return false;
+			}
+			let dd = othis.is('dd') ? othis : othis.parents('dd');
+			let id = dd.parent('dl').attr('xid');
+			
+			if(dd.hasClass(DISABLED)){//被禁用选项的处理
+				return false;
+			}
+			
+			//菜单功效
+			if(othis.is('i.icon-caidan')){
+				let opens = [], closes = [];
+				othis.parents('dl').find('dd[tree-folder="true"]').each((index, item) => {
+					$(item).attr('xm-tree-hidn') == undefined ? opens.push(item) : closes.push(item); 
+				});
+				let arr = closes.length ? closes : opens;
+				arr.forEach(item => item.click());
+				return false;
+			}
+			//树状结构的选择
+			let treeId = dd.attr('tree-id');
+			if(treeId){
+				//忽略右边的图标
+				if(othis.is('i:not(.icon-expand)')){
+					this.handlerLabel(id, dd, !dd.hasClass(THIS));
+					return false;
+				}
+				let ajaxConfig = ajaxs[id] || ajax;
+				let treeConfig = ajaxConfig.tree;
+				let childrens = dd.nextAll(`dd[tree-id^="${treeId}"]`);
+				if(childrens && childrens.length){
+					let len = childrens[0].clientHeight;
+					len ? (
+						this.addTreeHeight(dd, len),
+						len = 0
+					) : (
+						len = dd.attr('xm-tree-hidn') || 36, 
+						dd.removeAttr('xm-tree-hidn'),
+						dd.find('>i').remove(),
+						(childrens = childrens.filter((index, item) => $(item).attr('tree-id').split('-').length - 1 == treeId.split('-').length))
+					);
+					childrens.animate({
+						height: len
+					}, 150)
+					return false;
+				}else{
+					if(treeConfig.nextClick && treeConfig.nextClick instanceof Function){
+						treeConfig.nextClick(id, this.getItem(id, dd), (res) => {
+							if(!res || !res.length){
+								this.handlerLabel(id, dd, !dd.hasClass(THIS));
+							}else{
+								dd.attr('tree-folder', 'true');
+								let ddChilds = [];
+								res.forEach((item, idx) => {
+									item.innerHTML = item[ajaxConfig.keyName];
+									item[FORM_TEAM_PID] = JSON.stringify(treeId.split('-').concat([idx]));
+									ddChilds.push(this.createDD(id, item));
+									db[id][item[ajaxConfig.keyVal]] = item;
+								});
+								dd.after(ddChilds.join(''));
+							}
+						});
+						return false;
+					}
+				}
+			}
+			
+			if(dd.hasClass(FORM_SELECT_TIPS)){//tips的处理
+				let btn = othis.is(`.${CZ}`) ? othis : othis.parents(`.${CZ}`);
+				if(!btn[0]){
+					return false;
+				}
+				let method = btn.attr('method');
+				let obj = data[id].config.btns.filter(bean => bean.name == method)[0];
+				obj && obj.click && obj.click instanceof Function && obj.click(id, this);
+				return false;
+			}
+			this.handlerLabel(id, dd, !dd.hasClass(THIS));
+			return false;
+		});
+	}
+	
+	Common.prototype.addTreeHeight = function(dd, len){
+		let treeId = dd.attr('tree-id');
+		let childrens = dd.nextAll(`dd[tree-id^="${treeId}"]`);
+		if(childrens.length){
+			dd.append('<i class="xm-iconfont icon-expand"></i>');		
+			dd.attr('xm-tree-hidn', len);
+			childrens.each((index, item) => {
+				let that = $(item);
+				this.addTreeHeight(that, len);
+			})
+		}
+	}
+	
+	let db = {};
+	Common.prototype.getItem = function(id, value){
+		if(value instanceof $){
+			if(value.is(`i[fsw="${NAME}"]`)){
+				let span = value.parent();
+				return db[id][value] || {
+					name: span.find('font').text(),
+					value: span.attr('value')
+				}
+			}
+			let val = value.attr('lay-value');
+			return !db[id][val] ? (db[id][val] = {
+				name: value.find('span[name]').attr('name'),
+				value: val
+			}) : db[id][val];
+		}else if(typeof(value) == 'string' && value.indexOf('/') != -1){
+			return db[id][value] || {
+				name: this.valToName(id, value),
+				value: value
+			}
+		}
+		return db[id][value];
+	}
+	
+	Common.prototype.linkageAdd = function(id, val){
+		let dl = $(`dl[xid="${id}"]`);
+		dl.find('.xm-select-active').removeClass('xm-select-active');
+		let vs = val.value.split('/');
+		let pid, li, index = 0;
+		let lis = [];
+		do{
+			pid = vs[index];
+			li = dl.find(`.xm-select-linkage-group${index + 1} li[xm-value="${pid}"]`);
+			li[0] && lis.push(li);
+			index ++;
+		}while(li.length && pid != undefined);
+		if(lis.length == vs.length){
+			$.each(lis, (idx, item) => {
+				item.addClass('xm-select-this');
+			});
+		}
+	}
+	
+	Common.prototype.linkageDel = function(id, val){
+		let dl = $(`dl[xid="${id}"]`);
+		let vs = val.value.split('/');
+		let pid, li, index = vs.length - 1;
+		do{
+			pid = vs[index];
+			li = dl.find(`.xm-select-linkage-group${index + 1} li[xm-value="${pid}"]`);
+			if(!li.parent().next().find(`li[pid=${pid}].xm-select-this`).length){
+				li.removeClass('xm-select-this');
+			}
+			index --;
+		}while(li.length && pid != undefined);
+	}
+	
+	Common.prototype.valToName = function(id, val){
+		let dl = $(`dl[xid="${id}"]`);
+		let vs = (val + "").split('/');
+		if(!vs.length){
+			return null;
+		}
+		let names = [];
+		$.each(vs, (idx, item) => {
+			let name = dl.find(`.xm-select-linkage-group${idx + 1} li[xm-value="${item}"] span`).text();
+			names.push(name);
+		});
+		return names.length == vs.length ? names.join('/') : null;
+	}
+	
+	Common.prototype.commonHandler = function(key, label){
+		if(!label || !label[0]){
+			return ;
+		}
+		this.checkHideSpan(key, label);
+		//计算input的提示语
+		this.changePlaceHolder(label);
+		//计算高度
+		this.retop(label.parents(`.${FORM_SELECT}`));
+		this.calcLabelLeft(label, 0, true);
+		//表单默认值
+		this.setHidnVal(key, label);
+		//title值
+		label.parents(`.${FORM_TITLE} .${NAME}`).attr('title', data[key].values.map((val) => {
+			return val.name;
+		}).join(','));
+	}
+	
+	Common.prototype.initVal = function(id){
+		let target = {};
+		if(id){
+			target[id] = data[id];
+		}else{
+			target = data;
+		}
+		$.each(target, (key, val) => {
+			let values = val.values,		
+				div = $(`dl[xid="${key}"]`).parent(),
+				label = div.find(`.${LABEL}`),
+				dl = div.find('dl');
+			dl.find(`dd.${THIS}`).removeClass(THIS);
+			
+			let _vals = values.concat([]);
+			_vals.concat([]).forEach((item, index) => {
+				this.addLabel(key, label, item);
+				dl.find(`dd[lay-value="${item.value}"]`).addClass(THIS);
+			});
+			if(val.config.radio){
+				_vals.length && values.push(_vals[_vals.length - 1]);
+			}
+			this.commonHandler(key, label);
+		});
+	}
+	
+	Common.prototype.setHidnVal = function(key, label) {
+ 		if(!label || !label[0]) {
+ 			return;
+ 		}
+ 		label.parents(`.${PNAME}`).find(`.${HIDE_INPUT}`).val(data[key].values.map((val) => {
+ 			return val.value;
+ 		}).join(','));
+ 	}
+	
+	Common.prototype.handlerLabel = function(id, dd, isAdd, oval, notOn){
+		let div = $(`[xid="${id}"]`).prev().find(`.${LABEL}`),
+			val = dd && this.getItem(id, dd),
+			vals = data[id].values,
+			on = data[id].config.on || events.on[id],
+			endOn = data[id].config.endOn || events.endOn[id];
+		if(oval){
+			val = oval;
+		}
+		let fs = data[id];
+		if(isAdd && fs.config.max && fs.values.length >= fs.config.max){
+			let maxTipsFun = events.maxTips[id] || data[id].config.maxTips;
+ 			maxTipsFun && maxTipsFun(id, vals.concat([]), val, fs.config.max);
+			return ;
+		}
+		if(!notOn){
+			if(on && on instanceof Function && on(id, vals.concat([]), val, isAdd, dd && dd.hasClass(DISABLED)) == false) {
+				return ;
+			}
+		}
+		let dl = $(`dl[xid="${id}"]`);
+		isAdd ? (
+			(dd && dd[0] ? (
+				dd.addClass(THIS), 
+				dd.removeClass(TEMP)
+			) : (
+				dl.find('.xm-select-linkage')[0] && this.linkageAdd(id, val)
+			)),
+			this.addLabel(id, div, val),
+			vals.push(val)
+		) : (
+			(dd && dd[0] ? (
+				dd.removeClass(THIS)
+			) : (
+				dl.find('.xm-select-linkage')[0] && this.linkageDel(id, val)
+			)),
+			this.delLabel(id, div, val),
+			this.remove(vals, val)
+		);
+		if(!div[0]) return ;
+		//单选选完后直接关闭选择域
+		if(fs.config.radio){
+			this.changeShow(div, false);
+		}
+		//移除表单验证的红色边框
+		div.parents(`.${FORM_TITLE}`).prev().removeClass('layui-form-danger');
+		
+		//清空搜索值
+		fs.config.clearInput && this.clearInput(id);
+		
+		this.commonHandler(id, div);
+		
+		!notOn && endOn && endOn instanceof Function && endOn(id, vals.concat([]), val, isAdd, dd && dd.hasClass(DISABLED));
+	}
+	
+	Common.prototype.addLabel = function(id, div, val){
+		if(!val) return ;
+		let tips = `fsw="${NAME}"`;
+		let [$label, $close] = [
+			$(`<span ${tips} value="${val.value}"><font ${tips}>${val.name}</font></span>`), 
+			$(`<i ${tips} class="xm-iconfont icon-close"></i>`)
+		];
+		$label.append($close);
+		//如果是radio模式
+		let fs = data[id];
+		if(fs.config.radio){
+			fs.values.length = 0;
+			$(`dl[xid="${id}"]`).find(`dd.${THIS}:not([lay-value="${val.value}"])`).removeClass(THIS);
+			div.find('span').remove();
+		}
+		//如果是固定高度
+		div.find('input').css('width', '50px');
+		div.find('input').before($label);
+	}
+	
+	Common.prototype.delLabel = function(id, div, val){
+		if(!val) return ;
+		div.find(`span[value="${val.value}"]:first`).remove();
+	}
+	
+	Common.prototype.checkHideSpan = function(id, div){
+		let parentHeight = div.parents(`.${NAME}`)[0].offsetHeight + 5;
+		div.find('span.xm-span-hide').removeClass('xm-span-hide');
+		div.find('span[style]').remove();
+		
+		let count = data[id].config.showCount;
+		div.find('span').each((index, item) => {
+			if(index >= count){
+				$(item).addClass('xm-span-hide');
+			}
+		});
+		
+		let prefix = div.find(`span:eq(${count})`);
+		prefix[0] && prefix.before($(`<span style="padding-right: 6px;" fsw="${NAME}"> + ${div.find('span').length - count}</span>`))
+	}
+	
+	Common.prototype.retop = function(div){//计算dl显示的位置
+		let dl = div.find('dl'),
+			top = div.offset().top + div.outerHeight() + 5 - $win.scrollTop(),
+            dlHeight = dl.outerHeight();
+		let up = div.hasClass('layui-form-selectup') || dl.css('top').indexOf('-') != -1 || (top + dlHeight > $win.height() && top >= dlHeight);
+		div = div.find(`.${NAME}`);
+		
+		let fs = data[dl.attr('xid')];
+		let base = dl.parents('.layui-form-pane')[0] && dl.prev()[0].clientHeight > 38 ? 14 : 10;
+		if((fs && fs.config.direction == 'up') || up){
+			up = true;
+			if((fs && fs.config.direction == 'down')){
+				up = false;
+			}
+		}
+		let reHeight = div[0].offsetTop + div.height() + base;
+		if(up) {
+			dl.css({
+				top: 'auto',
+				bottom: reHeight + 3 + 'px',
+			});
+		} else {
+			dl.css({
+				top: reHeight + 'px',
+				bottom: 'auto'
+			});
+		}
+	}
+	
+	Common.prototype.changeShow = function(children, isShow){//显示于隐藏
+		$('.layui-form-selected').removeClass('layui-form-selected');
+		let top = children.parents(`.${FORM_SELECT}`),
+			realShow = top.hasClass(FORM_SELECTED),
+			id = top.find('dl').attr('xid');
+		$(`.${PNAME} .${FORM_SELECT}`).not(top).removeClass(FORM_SELECTED);
+		if(isShow){
+			this.retop(top);
+			top.addClass(FORM_SELECTED);
+			top.find(`.${INPUT}`).focus();
+			if(!top.find(`dl dd[lay-value]:not(.${FORM_SELECT_TIPS})`).length){
+				top.find(`dl .${FORM_NONE}`).addClass(FORM_EMPTY);
+			}
+		}else{
+			top.removeClass(FORM_SELECTED);
+			this.clearInput(id);
+			top.find(`dl .${FORM_EMPTY}`).removeClass(FORM_EMPTY);
+			top.find(`dl dd.${DD_HIDE}`).removeClass(DD_HIDE);
+			top.find(`dl dd.${TEMP}`).remove();
+			//计算ajax数据是否为空, 然后重新请求数据
+			if(id && data[id] && data[id].config.isEmpty){
+				this.triggerSearch(top);
+			}
+			this.changePlaceHolder(top.find(`.${LABEL}`));
+		}
+		if(isShow != realShow){
+			let openFun = data[id].config.opened || events.opened[id];
+			isShow && openFun && openFun instanceof Function && openFun(id);
+			let closeFun = data[id].config.closed || events.closed[id];
+			!isShow && closeFun && closeFun instanceof Function && closeFun(id);
+		}
+	}
+	
+	Common.prototype.changePlaceHolder = function(div){//显示于隐藏提示语
+		//调整pane模式下的高度
+		let title = div.parents(`.${FORM_TITLE}`);
+		title[0] || (title = div.parents(`dl`).prev());
+		if(!title[0]){
+			return ;
+		}
+		
+		let id = div.parents(`.${PNAME}`).find(`dl[xid]`).attr('xid');
+		if(data[id] && data[id].config.height){//既然固定高度了, 那就看着办吧
+						
+		}else{
+			let height = title.find(`.${NAME}`)[0].clientHeight;
+			title.css('height' , (height > 36 ? height + 4 : height) + 'px');
+			//如果是layui pane模式, 处理label的高度
+			let label = title.parents(`.${PNAME}`).parent().prev();
+			if(label.is('.layui-form-label') && title.parents('.layui-form-pane')[0]){
+				height = height > 36 ? height + 4 : height;
+				title.css('height' , height + 'px');
+				label.css({
+					height: height + 2 + 'px',
+					lineHeight: (height - 18) + 'px'
+				})
+			}
+		}
+		
+		let input = title.find(`.${TDIV} input`),
+			isShow = !div.find('span:last')[0] && !title.find(`.${INPUT}`).val();
+		if(isShow){
+			let ph = input.attr('back');
+			input.removeAttr('back');
+			input.attr('placeholder', ph);
+		}else{
+			let ph = input.attr('placeholder');
+			input.removeAttr('placeholder');
+			input.attr('back', ph)
+		}
+	}
+	
+	Common.prototype.indexOf = function(arr, val){
+		for(let i = 0; i < arr.length; i++) {
+			if(arr[i].value == val || arr[i].value == (val ? val.value : val) || arr[i] == val || JSON.stringify(arr[i]) == JSON.stringify(val)) {
+				return i;
+			}
+		}
+		return -1;
+	}
+	
+	Common.prototype.remove = function(arr, val){
+		let idx = this.indexOf(arr, val ? val.value : val);
+		if(idx > -1) {
+			arr.splice(idx, 1);
+			return true;
+		}
+		return false;
+	}
+	
+	Common.prototype.selectAll = function(id, isOn, skipDis){
+		let dl = $(`[xid="${id}"]`);
+		if(!dl[0]){
+			return ;
+		}
+		if(dl.find('.xm-select-linkage')[0]){
+			return ;
+		}
+		dl.find(`dd[lay-value]:not(.${FORM_SELECT_TIPS}):not(.${THIS})${skipDis ? ':not(.'+DISABLED+')' :''}`).each((index, item) => {
+			item = $(item);
+			let val = this.getItem(id, item);
+			this.handlerLabel(id, dl.find(`dd[lay-value="${val.value}"]`), true, val, !isOn);
+		});
+	}
+	
+	Common.prototype.removeAll = function(id, isOn, skipDis){
+		let dl = $(`[xid="${id}"]`);
+		if(!dl[0]){
+			return ;
+		}
+		if(dl.find('.xm-select-linkage')[0]){//针对多级联动的处理
+			data[id].values.concat([]).forEach((item, idx) => {
+				let vs = item.value.split('/');
+				let pid, li, index = 0;
+				do{
+					pid = vs[index ++];
+					li = dl.find(`.xm-select-linkage-group${index}:not(.xm-select-linkage-hide) li[value="${pid}"]`);
+					li.click();
+				}while(li.length && pid != undefined);
+			});
+			return ;
+		}
+		data[id].values.concat([]).forEach((item, index) => {
+			if(skipDis && dl.find(`dd[lay-value="${item.value}"]`).hasClass(DISABLED)){
+				
+			}else{
+				this.handlerLabel(id, dl.find(`dd[lay-value="${item.value}"]`), false, item, !isOn);
+			}
+		});
+	}
+	
+	Common.prototype.reverse = function(id, isOn, skipDis){
+		let dl = $(`[xid="${id}"]`);
+		if(!dl[0]){
+			return ;
+		}
+		if(dl.find('.xm-select-linkage')[0]){
+			return ;
+		}
+		dl.find(`dd[lay-value]:not(.${FORM_SELECT_TIPS})${skipDis ? ':not(.'+DISABLED+')' :''}`).each((index, item) => {
+			item = $(item);
+			let val = this.getItem(id, item);
+			this.handlerLabel(id, dl.find(`dd[lay-value="${val.value}"]`), !item.hasClass(THIS), val, !isOn);
+		});
+	}
+	
+	Common.prototype.skin = function(id){
+		let skins = ['default' ,'primary', 'normal', 'warm', 'danger'];
+		let skin = skins[Math.floor(Math.random() * skins.length)];
+		$(`dl[xid="${id}"]`).parents(`.${PNAME}`).find(`.${FORM_SELECT}`).attr('xm-select-skin', skin);
+		this.check(id) && this.commonHandler(id, $(`dl[xid="${id}"]`).parents(`.${PNAME}`).find(`.${LABEL}`));
+	}
+	
+	Common.prototype.getPosition = function(e){
+		let x = 0, y = 0;
+        while (e != null) {
+            x += e.offsetLeft;
+            y += e.offsetTop;
+            e = e.offsetParent;
+        }
+        return { x: x, y: y };
+	};
+	
+	Common.prototype.onreset = function(){//监听reset按钮, 然后重置多选
+		$(document).on('click', '[type=reset]', (e) => {
+			$(e.target).parents('form').find(`.${PNAME} dl[xid]`).each((index, item) => {
+				let id = item.getAttribute('xid'),
+					dl = $(item),
+					dd,
+					temp = {};
+				common.removeAll(id);
+				data[id].config.init.forEach((val, idx) => {
+					if(val && (!temp[val] || data[id].config.repeat) && (dd = dl.find(`dd[lay-value="${val.value}"]`))[0]){
+						common.handlerLabel(id, dd, true);
+						temp[val] = 1;
+					}
+				});
+			})
+		});
+	}
+	
+	Common.prototype.bindEvent = function(name, id, fun){
+		if(id && id instanceof Function){
+			fun = id;
+			id = null;
+		}
+		if(fun && fun instanceof Function){
+			if(!id){
+				$.each(data, (id, val) => {
+					data[id] ? (data[id].config[name] = fun) : (events[name][id] = fun)				
+				})
+			}else{
+				data[id] ? (data[id].config[name] = fun, delete events[name][id]) : (events[name][id] = fun)
+			}
+		}
+	}
+	
+	Common.prototype.check = function(id, notAutoRender){
+		if($(`dl[xid="${id}"]`).length) {
+			return true;
+		}else if($(`select[xm-select="${id}"]`).length){
+			if(!notAutoRender){
+				this.render(id, $(`select[xm-select="${id}"]`));
+				return true;
+			}
+		}else{
+			delete data[id];
+			return false;
+		}
+	}
+	
+	Common.prototype.render = function(id, select){
+		common.init(select);
+		common.one($(`dl[xid="${id}"]`).parents(`.${PNAME}`));
+		common.initVal(id);
+	}
+	
+	Common.prototype.log = function(obj){
+		
+	}
+	
+	let Select4 = function(){
+		this.v = v;
+		this.render();
+	};
+	let common = new Common();
+	
+	Select4.prototype.value = function(id, type, isAppend){
+		if(typeof id != 'string'){
+			return [];
+		}
+		let fs = data[id];
+		if(!common.check(id)){
+			return [];
+		}
+		if(typeof type == 'string' || type == undefined){
+			let arr = fs.values.concat([]) || [];
+			if(type == 'val') {
+				return arr.map((val) => {
+					return val.value;
+				});
+			}
+			if(type == 'valStr') {
+				return arr.map((val) => {
+					return val.value;
+				}).join(',');
+			}
+			if(type == 'name') {
+				return arr.map((val) => {
+					return val.name;
+				});
+			}
+			if(type == 'nameStr') {
+				return arr.map((val) => {
+					return val.name;
+				}).join(',');
+			}
+			return arr;
+		}
+		if(common.isArray(type)) {
+			let dl = $(`[xid="${id}"]`),
+				temp = {},
+				dd,
+				isAdd = true;
+			if(isAppend == false){//删除传入的数组
+				isAdd = false;
+			}else if(isAppend == true){//追加模式
+				isAdd = true;
+			}else{//删除原有的数据
+				common.removeAll(id);
+			}
+			if(isAdd){
+				fs.values.forEach((val, index) => {
+					temp[val.value] = 1;
+				});
+			}
+			type.forEach((val, index) => {
+				if(val && (!temp[val] || fs.config.repeat)){
+					if((dd = dl.find(`dd[lay-value="${val}"]`))[0]){
+						common.handlerLabel(id, dd, isAdd, null, true);
+						temp[val] = 1;
+					}else{
+						let name = common.valToName(id, val);						
+						if(name){
+							common.handlerLabel(id, dd, isAdd, common.getItem(id, val), true);
+							temp[val] = 1;
+						}
+					}
+				}
+			});
+		}
+	}
+	
+	Select4.prototype.on = function(id, fun, isEnd) {
+		common.bindEvent(isEnd ? 'endOn' : 'on', id, fun);
+		return this;
+	}
+	
+	Select4.prototype.filter = function(id, fun){
+		common.bindEvent('filter', id, fun);
+		return this;
+	}
+	
+	Select4.prototype.maxTips = function(id, fun){
+		common.bindEvent('maxTips', id, fun);
+		return this;
+	}
+	
+	Select4.prototype.opened = function(id, fun){
+		common.bindEvent('opened', id, fun);
+		return this;
+	}
+	
+	Select4.prototype.closed = function(id, fun){
+		common.bindEvent('closed', id, fun);
+		return this;
+	}
+	
+	Select4.prototype.config = function(id, config, isJson){
+		if(id && typeof id == 'object'){
+			isJson = config == true;
+			config = id;
+			id = null;
+		}
+		if(config && typeof config== 'object'){
+			if(isJson){
+				config.header || (config.header = {});
+				config.header['Content-Type'] = 'application/json; charset=UTF-8';
+				config.dataType = 'json';
+			}
+			id ? (
+				ajaxs[id] = $.extend(true, {}, ajaxs[id] || ajax, config), !common.check(id) && this.render(id),
+				data[id] && config.direction && (data[id].config.direction = config.direction),
+				data[id] && config.clearInput && (data[id].config.clearInput = true),
+				config.searchUrl && data[id] && common.triggerSearch($(`.${PNAME} dl[xid="${id}"]`).parents(`.${FORM_SELECT}`), true)
+			) : (
+				$.extend(true, ajax, config),
+				$.each(ajaxs, (key, item) => {
+					$.extend(true, item, config)
+				})
+			);
+		}
+		return this;
+	}
+	
+	Select4.prototype.render = function(id, options){
+		if(id && typeof id == 'object'){
+			options = id;
+			id = null;
+		}
+		let config = options ? {
+			init: options.init,
+			disabled: options.disabled,
+			max: options.max,
+			isSearch: options.isSearch,
+			searchUrl: options.searchUrl,
+			isCreate: options.isCreate,
+			radio: options.radio,
+			skin: options.skin,
+			direction: options.direction,
+			height: options.height,
+			formname: options.formname,
+			layverify: options.layverify,
+			layverType: options.layverType,
+			showCount: options.showCount,
+			placeholder: options.placeholder,
+			create: options.create,
+			filter: options.filter,
+			maxTips: options.maxTips,
+			on: options.on,
+			on: options.on,
+			opened: options.opened,
+			closed: options.closed,
+			template: options.template,
+			clearInput: options.clearInput,
+		} : {};
+		
+		options && options.searchType != undefined && (config.searchType = options.searchType == 'dl' ? 1 : 0);
+		
+		if(id){
+			fsConfigs[id] = {};
+			$.extend(fsConfigs[id], data[id] ? data[id].config : {}, config);
+		}else{
+			$.extend(fsConfig, config);
+		}
+
+		($(`select[${NAME}="${id}"]`)[0] ? $(`select[${NAME}="${id}"]`) : $(`select[${NAME}]`)).each((index, select) => {
+			let sid = select.getAttribute(NAME);
+			common.render(sid, select);
+			setTimeout(() => common.setHidnVal(sid, $(`select[xm-select="${sid}"] + div.${PNAME} .${LABEL}`)), 10);
+		});
+		return this;
+	}
+	
+	Select4.prototype.disabled = function(id){
+		let target = {};
+		id ? (common.check(id) && (target[id] = data[id])) : (target = data);
+		
+		$.each(target, (key, val) => {
+			$(`dl[xid="${key}"]`).prev().addClass(DIS);
+		});
+		return this;
+	}
+	
+	Select4.prototype.undisabled = function(id){
+		let target = {};
+		id ? (common.check(id) && (target[id] = data[id])) : (target = data);
+		
+		$.each(target, (key, val) => {
+			$(`dl[xid="${key}"]`).prev().removeClass(DIS);
+		});
+		return this;
+	}
+	
+	Select4.prototype.data = function(id, type, config){
+		if(!id || !type || !config){
+			common.log(`id: ${id} param error !!!`)
+			return this;
+		}
+		if(!common.check(id)){
+			common.log(`id: ${id} not render !!!`)
+			return this;
+		}
+		this.value(id, []);
+		this.config(id, config);
+		if(type == 'local'){
+			common.renderData(id, config.arr, config.linkage == true, config.linkageWidth ? config.linkageWidth : '100');
+		}else if(type == 'server'){
+			common.ajax(id, config.url, config.keyword, config.linkage == true, config.linkageWidth ? config.linkageWidth : '100');
+		}
+		return this;
+	}
+	
+	Select4.prototype.btns = function(id, btns, config){
+		if(id && common.isArray(id)){
+			btns = id;
+			id = null;
+		}
+		if(!btns || !common.isArray(btns)) {
+			return this;
+		};
+		let target = {};
+		id ? (common.check(id) && (target[id] = data[id])) : (target = data);
+		
+		btns = btns.map((obj) => {
+			if(typeof obj == 'string'){
+				if(obj == 'select'){
+					return quickBtns[0];
+				}
+				if(obj == 'remove'){
+					return quickBtns[1];
+				}
+				if(obj == 'reverse'){
+					return quickBtns[2];
+				}
+				if(obj == 'skin'){
+					return quickBtns[3];
+				}
+			}
+			return obj;
+		});
+		
+		$.each(target, (key, val) => {
+			val.config.btns = btns;
+			let dd = $(`dl[xid="${key}"]`).find(`.${FORM_SELECT_TIPS}:first`);
+			if(btns.length){
+				let show = config && config.show && (config.show == 'name' || config.show == 'icon') ? config.show : '';
+				let html = common.renderBtns(key, show, config && config.space ? config.space : '30px');
+				dd.html(html);
+			}else{
+				let pcInput = dd.parents(`.${FORM_SELECT}`).find(`.${TDIV} input`);
+				let html = pcInput.attr('placeholder') || pcInput.attr('back');
+				dd.html(html);
+				dd.removeAttr('style');
+			}
+		});
+		
+		return this;
+	}
+	
+	Select4.prototype.search = function(id, val){
+		if(id && common.check(id)){
+			ajaxs[id] = $.extend(true, {}, ajaxs[id] || ajax, {
+				first: true,
+				searchVal: val
+			});
+			common.triggerSearch($(`dl[xid="${id}"]`).parents(`.${FORM_SELECT}`), true);
+		}
+		return this;
+	}
+	
+	Select4.prototype.replace = function(id, type, config){
+		if(!id || !type || !config){
+			common.log(`id: ${id} param error !!!`)
+			return this;
+		}
+		if(!common.check(id, true)){
+			common.log(`id: ${id} not render !!!`)
+			return this;
+		}
+		let oldVals = this.value(id, 'val');
+		this.value(id, []);
+		this.config(id, config);
+		if(type == 'local'){
+			common.renderData(id, config.arr, config.linkage == true, config.linkageWidth ? config.linkageWidth : '100', false, true);
+			this.value(id, oldVals, true);
+		}else if(type == 'server'){
+			common.ajax(id, config.url, config.keyword, config.linkage == true, config.linkageWidth ? config.linkageWidth : '100', false, (id) => {
+				this.value(id, oldVals, true);
+			}, true);
+		}
+	}
+	
+	return new Select4();
+});

+ 79 - 0
js/layuiPlugins/inputTags.css

@@ -0,0 +1,79 @@
+/*
+* @Author: layui-2
+* @Date:   2018-08-31 11:40:53
+* @Last Modified by:   xuzhiwen
+* @Last Modified time: 2018-09-07 15:26:19
+*/
+em{
+  font-style: normal;
+}
+#tags
+{
+    padding-top: 10px;
+    color: #777;
+    border: 1px solid #d5d5d5;
+    background-color: #fff;
+}
+
+#tags span{
+    font-size: 12px;
+    font-weight: normal;
+    line-height: 16px;
+    position: relative;
+    display: inline-block;
+    height: 16px;
+    margin: 3px;
+    padding: 4px 22px 5px 9px;
+    cursor: pointer;
+    transition: all .2s ease 0s;
+    vertical-align: baseline;
+    white-space: nowrap;
+    color: #fff;
+    background-color: #009688;
+    text-shadow: 1px 1px 1px rgba(0, 0, 0, .15);
+}
+#tags .close{
+    font-size: 12px;
+    font-weight: bold;
+    line-height: 20px;
+    position: absolute;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    float: none;
+    width: 18px;
+    padding: 0;
+    cursor: pointer;
+    text-align: center;
+    opacity: 1;
+    color: #fff;
+    border: 0 none;
+    background: transparent none repeat scroll 0 0;
+    text-shadow: none;
+}
+#tags .close:hover{
+  background: #ffb800;
+}
+#inputTags[type='text'],
+#inputTags[type='text']:focus{
+    line-height: 25px;
+    display: inline;
+    width: 150px;
+    margin: 0;
+    padding: 0 6px;
+    border: 0 none;
+    outline: 0 none;
+    box-shadow: none;
+}
+
+.albtn{
+    line-height: 30px;
+    display: block;
+    width: 100px;
+    height: 30px;
+    margin: 0 auto;
+    cursor: pointer;
+    text-align: center;
+    color: #fff;
+    background: #ffb800;
+}

+ 29 - 0
js/layuiPlugins/inputTags.html

@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Document</title>
+  <meta charset="utf-8">
+  <link rel="stylesheet" type="text/css" href="../../layui/css/layui.css">
+</head>
+<body>
+  <div class="tags" id="tags">
+    <input type="text" name="" id="inputTags" placeholder="回车生成标签" autocomplete="off">
+  </div>
+  <script type="text/javascript" src="../../layui/layui.js"></script>
+  <script type="text/javascript">
+    layui.use(['inputTags'],function(){
+      var inputTags = layui.inputTags;
+      inputTags.render({
+        elem:'#inputTags',
+        content: ['标题一','标题二'],
+        aldaBtn: true,
+        done: function(value){
+          console.log(value)
+        }
+      })      
+      
+    })
+  </script>
+</body>
+</html>

+ 128 - 0
js/layuiPlugins/inputTags.js

@@ -0,0 +1,128 @@
+/*
+* @Author: layui-2
+* @Date:   2018-08-31 11:40:42
+* @Last Modified by:   layui-2
+* @Last Modified time: 2018-09-04 14:44:38
+*/
+layui.define(['jquery','layer'],function(exports){
+  "use strict";
+  var $ = layui.jquery,layer = layui.layer
+  
+
+  //外部接口
+  ,inputTags = {
+    config: {}
+
+    //设置全局项
+    ,set: function(options){
+      var that = this;
+      that.config = $.extend({}, that.config, options);
+      return that;
+    }
+
+    // 事件监听
+    ,on: function(events, callback){
+      return layui.onevent.call(this, MOD_NAME, events, callback)
+    }
+    
+  }
+
+   //操作当前实例
+  ,thisinputTags = function(){
+    var that = this
+    ,options = that.config;
+
+    return {
+      config: options
+    }
+  }
+
+  //字符常量
+  ,MOD_NAME = 'inputTags'
+
+
+  // 构造器
+  ,Class = function(options){
+    var that = this;
+    that.config = $.extend({}, that.config, inputTags.config, options);
+    that.render();
+  };
+
+   //默认配置
+  Class.prototype.config = {
+    close: false  //默认:不开启关闭按钮
+    ,theme: ''   //背景:颜色
+    ,content: [] //默认标签
+    ,aldaBtn: false //默认配置
+  };
+
+  // 初始化
+  Class.prototype.init = function(){
+    var that = this
+    ,spans = ''
+    ,options = that.config
+    ,span = document.createElement("span"),
+    spantext = $(span).text("获取全部数据").addClass('albtn');
+    if(options.aldaBtn){
+      //$('body').append(spantext)
+    }
+    
+    $.each(options.content,function(index,item){
+      spans +='<span><em>'+item+'</em><button type="button" class="close">×</button></span>';
+      // $('<div class="layui-flow-more"><a href="javascript:;">'+ ELEM_TEXT +'</a></div>');
+    })
+    options.elem.before(spans)
+    that.events()
+  }
+
+  Class.prototype.render = function(){
+    var that = this
+    ,options = that.config
+    options.elem = $(options.elem);
+    that.enter()
+  };
+
+  // 回车生成标签
+  Class.prototype.enter = function() {
+      var that = this
+          , spans = ''
+          , options = that.config;
+      options.elem.focus();
+      options.elem.keypress(function (event) {
+          var keynum = (event.keyCode ? event.keyCode : event.which);
+          if (keynum == 32 || keynum==13) {
+              var $val = options.elem.val().trim();
+              if (!$val) return false;
+              if (options.content.indexOf($val) == -1) {
+                  options.content.push($val);
+                  that.render()
+                  spans = '<span><em>' + $val + '</em><button type="button" class="close">×</button></span>';
+                  options.elem.before(spans)
+              }
+              options.done && typeof options.done === 'function' && options.done(options.content);
+              options.elem.val('');
+              return false;
+          }
+      })
+  };
+  
+  //事件处理
+  Class.prototype.events = function(){
+     var that = this
+    ,options = that.config;
+    $('#tags').on('click','.close',function(){
+      var Thisremov = $(this).parent('span').remove(),
+      ThisText = $(Thisremov).find('em').text();
+      options.content.splice($.inArray(ThisText,options.content),1)
+	  options.del && typeof options.del === 'function' && options.del(options.content);
+    })
+  };
+
+  //核心入口
+  inputTags.render = function(options){
+    var inst = new Class(options);
+    inst.init();
+    return thisinputTags.call(inst);
+  };
+  exports('inputTags',inputTags);
+}).link('../../js/layuiPlugins/inputTags.css')

+ 412 - 0
js/layuiPlugins/layui-xtree.js

@@ -0,0 +1,412 @@
+//**********************************
+//**   本插件依赖 贤心 layui form模块   
+//**   由 小巷 制作 QQ:151446298    
+//**   版本3.0 时间 2018-01-10 20:48 
+//**********************************
+
+//构造
+function layuiXtree(options) {
+    var _this = this;
+    _this._containerid = options.elem;
+    _this.tool = options.tool;
+	_this.checkbox = options.checkbox;
+    typeof options.toolbar == 'function' && (_this.toolbar = options.toolbar);
+    _this._container = document.getElementById(options.elem); //容器
+    _this._container.style.minHeight = "100px";
+    _this._options = options;
+    _this.Loading(options);
+}
+
+//封装IE8 Class选择
+layuiXtree.prototype.getByClassName = function (cn) {
+    if (document.getElementsByClassName) return this._container.getElementsByClassName(cn);
+    var _xlist = this._container.childNodes;
+    var _xtemp = new Array();
+    for (var i = 0; i < _xlist.length; i++) {
+        var _xchild = _xlist[i];
+        var _xclassNames = _xchild.getAttribute('class').split(' ');
+        for (var j = 0; j < _xclassNames.length; j++) {
+            if (_xclassNames[j] == cn) {
+                _xtemp.push(_xchild);
+                break;
+            }
+        }
+    }
+    return _xtemp;
+}
+
+//在一个对象下面找子级
+layuiXtree.prototype.getChildByClassName = function (obj, cn) {
+    var _xlist = obj.childNodes;
+    var _xtemp = new Array();
+    for (var i = 0; i < _xlist.length; i++) {
+        var _xchild = _xlist[i];
+        var _xclassNames = _xchild.getAttribute('class').split(' ');
+        for (var j = 0; j < _xclassNames.length; j++) {
+            if (_xclassNames[j] == cn) {
+                _xtemp.push(_xchild);
+                break;
+            }
+        }
+    }
+    return _xtemp;
+}
+
+//加载特效,且获取数据
+layuiXtree.prototype.Loading = function (options) {
+    var _this = this;
+    _this.xloading = document.createElement("span"); //创建加载对象
+    _this.xloading.setAttribute('class', 'layui-icon layui-anim layui-anim-rotate layui-anim-loop');
+    _this.xloading.innerHTML = '&#xe63e;';
+    _this.xloading.style.fontSize = "50px";
+    _this.xloading.style.color = "#009688";
+    _this.xloading.style.fontWeight = "bold";
+    _this.xloading.style.marginLeft = _this._container.offsetWidth / 2 - 25 + 'px';
+    _this.xloading.style.marginTop = _this._container.offsetHeight / 2 - 50 + 'px';
+    _this._container.innerHTML = '';
+    _this._container.appendChild(_this.xloading); //加载显示
+    if (typeof (options.data) == 'object') {
+        _this._dataJson = options.data;
+        _this.Initial(options);
+        return;
+    }
+
+    //如果是字符串url,进行异步加载
+    var obj = new XMLHttpRequest();
+    obj.onreadystatechange = function () {
+        if (obj.readyState == 4 && obj.status == 200 || obj.status == 304) { //回调成功
+            if (JSON.parse(obj.responseText).data) {
+                _this._dataJson = eval('(' + obj.responseText + ')').data;
+                //_this._dataJson = eval('(' + JSON.parse(obj.responseText).menu + ')'); //将返回的数据转为json
+            }
+            _this.Initial(options);
+        }
+    };
+	obj.open('get', options.data, true);
+    obj.send();
+}
+
+//data验证后的数据初始化
+layuiXtree.prototype.Initial = function (o) {
+    var _this = this;
+    _this._form = o.form; //layui from对象
+    _this.checkedName = o.checkedName || 'roleId';
+    _this._domStr = ""; //结构字符串
+    _this._isopen = o.isopen != null ? o.isopen : true;
+    if (o.color == null) o.color = {
+        open: '#2F4056',
+        close: '#2F4056',
+        end: '#2F4056'
+    }; //图标颜色
+    _this._iconOpenColor = o.color.open != null ? o.color.open : "#2F4056";
+    _this._iconCloseColor = o.color.close != null ? o.color.close : "#2F4056";
+    _this._iconEndColor = o.color.end != null ? o.color.end : "#2F4056";
+    if (o.icon == null) o.icon = {
+        open: '&#xe625;',
+        close: '&#xe623;',
+        end: '&#xe621;'
+    }; //图标样式
+    _this._iconOpen = o.icon.open != null ? o.icon.open : '&#xe625;';
+    _this._iconClose = o.icon.close != null ? o.icon.close : '&#xe623;';
+    _this._iconEnd = o.icon.end != null ? o.icon.end : '&#xe621;';
+    _this._click = o.click != null ? o.click : function () {};
+    _this._ckall = o.ckall != null ? o.ckall : false; //全选是否启用
+    _this._ckallSuccess = o.ckallback != null ? o.ckallback : function () {}; //全选回调
+    _this.CreateCkAll();
+    _this.dataBind(_this._dataJson);
+    _this.Rendering();
+}
+
+//全选框
+layuiXtree.prototype.CreateCkAll = function () {
+    var _this = this;
+    if (_this._ckall) {
+        _this._domStr += '<div class="layui-xtree-item">';
+        _this._domStr +=
+            '<input type="checkbox" class="layui-xtree-checkbox layui-xtree-ckall" title="全选" lay-skin="primary" lay-filter="xtreeckall' +
+            _this._containerid + '">';
+        _this._domStr += '</div>';
+    }
+}
+
+//生产结构
+layuiXtree.prototype.dataBind = function (d) {
+    var _this = this;
+    if (d.length > 0) {
+        for (i in d) {
+            var xtree_isend = '';
+            var xtree_ischecked = '';
+            var xtree_isdisabled = d[i].disabled ? ' disabled="disabled" ' : '';
+            _this._domStr += '<div class="layui-xtree-item">';
+            if (!d[i].childMenus) {
+                d[i].childMenus = [];
+            }
+            if (d[i].childMenus.length > 0)
+                _this._domStr += '<i class="layui-icon layui-xtree-icon" data-xtree="' + (_this._isopen ? '1' : '0') +
+                '">' + (_this._isopen ? _this._iconOpen : _this._iconClose) + '</i>';
+            else {
+                _this._domStr += '<i class="layui-icon layui-xtree-icon-null">' + (d[i].icon || _this._iconEnd) +
+                    '</i>';
+                xtree_isend = 'data-xend="1"';
+                xtree_ischecked = !!d[i][_this.checkedName] ? ' checked ' : '';
+                xtree_isdisabled = d[i].disabled ? ' disabled="disabled" ' : '';
+            }
+            if (!!_this.checkbox) {
+                _this._domStr += '<input type="checkbox" class="layui-xtree-checkbox" ' + xtree_isend +
+                    xtree_ischecked +
+                    xtree_isdisabled + ' value="' + d[i].id + '" title="' + d[i].name +
+                    '" lay-skin="primary" lay-filter="xtreeck' + _this._containerid + '">';
+            }else{
+				_this._domStr += '<div class="layui-inline" style="margin-top: 10px;margin-bottom:0;"><span>'+d[i].name+'</span></div>';
+			}
+            if (!!_this.tool) {
+                _this._domStr +=
+                    '<div class="layui-inline" style="margin-top: 10px;margin-bottom:0;"><a class="layui-btn layui-btn-xs" name="tree_event" event="edit"id="' +
+                    d[i].id +
+                    '">修改</a><a class="layui-btn layui-btn-danger layui-btn-xs" name="tree_event" event="del" id="' +
+                    d[i].id + '">删除</a></div>';
+            }
+            _this.dataBind(d[i].childMenus);
+            _this._domStr += '</div>';
+        }
+    }
+}
+//工具栏监听回调
+layuiXtree.prototype.toolbar = function (obj) {
+    
+}
+//通过ID获取
+layuiXtree.prototype.idGetObj = function (id) {
+    var _this = this;
+    var obj = {};
+    (function get(d) {
+        if (d.length > 0) {
+            for (i in d) {
+                if (!d[i].childMenus) {
+                    d[i].childMenus = [];
+                }
+                if (d[i].id == id) {
+                    obj = d[i];
+                }
+                get(d[i].childMenus);
+            }
+        }
+    })(_this._dataJson);
+    return obj;
+}
+//渲染呈现
+layuiXtree.prototype.Rendering = function () {
+    var _this = this;
+    _this._container.innerHTML = _this._domStr;
+    _this._domStr = "";
+
+    //检查选中状态
+    var xtree_ckitems = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < xtree_ckitems.length; i++) {
+        if (xtree_ckitems[i].getAttribute('data-xend') == '1' && xtree_ckitems[i].checked) {
+            _this.ParentCheckboxChecked(xtree_ckitems[i]);
+        }
+    }
+
+    _this._form.render('checkbox'); //layui渲染
+    //绑定工具条事件
+    var tree_event = document.getElementsByName('tree_event');
+    for (var tr_i in tree_event) {
+        tree_event[tr_i].onclick = function (e) {
+            _this.toolbar({
+                event: this.getAttribute('event'),
+                data: _this.idGetObj(this.id)
+            });
+        };
+    }
+
+    var xtree_items = _this.getByClassName('layui-xtree-item');
+    var xtree_icons = _this.getByClassName('layui-xtree-icon');
+    var xtree_nullicons = _this.getByClassName('layui-xtree-icon-null');
+
+    for (var i = 0; i < xtree_items.length; i++) {
+        if (xtree_items[i].parentNode == _this._container)
+            xtree_items[i].style.margin = '5px 0 0 10px';
+        else {
+            xtree_items[i].style.margin = '5px 0 0 45px';
+            if (!_this._isopen) xtree_items[i].style.display = 'none';
+        }
+    }
+
+    for (var i = 0; i < xtree_icons.length; i++) {
+        xtree_icons[i].style.position = "relative";
+        xtree_icons[i].style.top = "3px";
+        xtree_icons[i].style.margin = "0 5px 0 0";
+        xtree_icons[i].style.fontSize = "18px";
+        xtree_icons[i].style.color = _this._isopen ? _this._iconOpenColor : _this._iconCloseColor;
+        xtree_icons[i].style.cursor = "pointer";
+
+        xtree_icons[i].onclick = function () {
+            var xtree_chi = this.parentNode.childNodes;
+            if (this.getAttribute('data-xtree') == 1) {
+                for (var j = 0; j < xtree_chi.length; j++) {
+                    if (xtree_chi[j].getAttribute('class') == 'layui-xtree-item')
+                        xtree_chi[j].style.display = 'none';
+                }
+                this.setAttribute('data-xtree', '0')
+                this.innerHTML = _this._iconClose;
+                this.style.color = _this._iconCloseColor;
+            } else {
+                for (var j = 0; j < xtree_chi.length; j++) {
+                    if (xtree_chi[j].getAttribute('class') == 'layui-xtree-item')
+                        xtree_chi[j].style.display = 'block';
+                }
+                this.setAttribute('data-xtree', '1')
+                this.innerHTML = _this._iconOpen;
+                this.style.color = _this._iconOpenColor;
+            }
+        }
+    }
+
+    for (var i = 0; i < xtree_nullicons.length; i++) {
+        xtree_nullicons[i].style.position = "relative";
+        xtree_nullicons[i].style.top = "6px";
+        xtree_nullicons[i].style.margin = "0 5px 0 0";
+        xtree_nullicons[i].style.fontSize = "18px";
+        xtree_nullicons[i].style.color = _this._iconEndColor;
+    }
+
+    _this._form.on('checkbox(xtreeck' + _this._containerid + ')', function (da) {
+        //获取当前点击复选框的容器下面的所有子级容器 
+        var xtree_chis = da.elem.parentNode.getElementsByClassName('layui-xtree-item');
+        //遍历它们,选中状态与它们的父级一致(类似全选功能)
+        for (var i = 0; i < xtree_chis.length; i++) {
+            if (!_this.getChildByClassName(xtree_chis[i], 'layui-xtree-checkbox')[0].disabled) {
+                _this.getChildByClassName(xtree_chis[i], 'layui-xtree-checkbox')[0].checked = da.elem.checked;
+                if (da.elem.checked) _this.getChildByClassName(xtree_chis[i], 'layui-xtree-checkbox')[0].nextSibling
+                    .classList.add('layui-form-checked');
+                else _this.getChildByClassName(xtree_chis[i], 'layui-xtree-checkbox')[0].nextSibling.classList
+                    .remove('layui-form-checked');
+            }
+        }
+        _this.ParendCheck(da.elem);
+        _this._click(da);
+    });
+
+    var _xtree_disableds = _this.getByClassName('layui-disabled');
+    for (var i = 0; i < _xtree_disableds.length; i++) {
+        _xtree_disableds[i].getElementsByTagName('span')[0].style.color = "#B5B5B5";
+    }
+
+    //全选按钮
+    if (_this._ckall) {
+        _this._form.on('checkbox(xtreeckall' + _this._containerid + ')', function (data) {
+            var xtree_allck = data.elem.parentNode.parentNode.getElementsByClassName('layui-form-checkbox');
+            for (var i = 0; i < xtree_allck.length; i++) {
+                if (xtree_allck[i].getAttribute('class').indexOf('layui-checkbox-disbaled') == -1) {
+                    if (data.elem.checked) {
+                        xtree_allck[i].classList.add('layui-form-checked');
+                    } else {
+                        xtree_allck[i].classList.remove('layui-form-checked');
+                    }
+                    xtree_allck[i].parentNode.getElementsByClassName('layui-xtree-checkbox')[0].checked =
+                        data.elem.checked;
+                }
+            }
+            _this._ckallSuccess();
+        });
+    }
+}
+
+//更新渲染
+layuiXtree.prototype.render = function () {
+    var _this = this;
+    _this.Loading(_this._options);
+}
+
+//子节点选中改变,父节点更改自身状态
+layuiXtree.prototype.ParendCheck = function (ckelem) {
+    var _this = this;
+    var xtree_p = ckelem.parentNode.parentNode;
+    if (xtree_p.getAttribute('class') == 'layui-xtree-item') {
+        var xtree_all = _this.getChildByClassName(xtree_p, 'layui-xtree-item');
+        var xtree_count = 0;
+
+        for (var i = 0; i < xtree_all.length; i++) {
+            if (_this.getChildByClassName(xtree_all[i], 'layui-xtree-checkbox')[0].checked) {
+                xtree_count++;
+            }
+        }
+
+        if (xtree_count <= 0) {
+            _this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0].checked = false;
+            _this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0].nextSibling.classList.remove(
+                'layui-form-checked');
+        } else {
+            _this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0].checked = true;
+            _this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0].nextSibling.classList.add(
+                'layui-form-checked');
+        }
+        this.ParendCheck(_this.getChildByClassName(xtree_p, 'layui-xtree-checkbox')[0]);
+    }
+}
+
+//渲染之前按照选中的末级去改变父级选中状态
+layuiXtree.prototype.ParentCheckboxChecked = function (e) {
+    var _this = this;
+    if (e.parentNode.parentNode.getAttribute('class') == 'layui-xtree-item') {
+        var _pe = _this.getChildByClassName(e.parentNode.parentNode, 'layui-xtree-checkbox')[0];
+        _pe.checked = true;
+        _this.ParentCheckboxChecked(_pe);
+    }
+}
+
+//获取全部选中的末级checkbox对象
+layuiXtree.prototype.GetChecked = function () {
+    var _this = this;
+    var arr = new Array();
+    var arrIndex = 0;
+    var cks = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < cks.length; i++) {
+        if (cks[i].checked && cks[i].getAttribute('data-xend') == '1') {
+            arr[arrIndex] = cks[i];
+            arrIndex++;
+        }
+    }
+    return arr;
+}
+//获取全部选中的checkbox对象value
+layuiXtree.prototype.GetCheckedVal = function () {
+    var _this = this;
+    var arr = new Array();
+    var arrIndex = 0;
+    var cks = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < cks.length; i++) {
+        if (cks[i].checked) {
+            arr[arrIndex] = cks[i].value;
+            arrIndex++;
+        }
+    }
+    return arr;
+}
+
+//获取全部的原始checkbox对象
+layuiXtree.prototype.GetAllCheckBox = function () {
+    var _this = this;
+    var arr = new Array();
+    var arrIndex = 0;
+    var cks = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < cks.length; i++) {
+        arr[arrIndex] = cks[i];
+        arrIndex++;
+    }
+    return arr;
+}
+
+//根据值来获取其父级的checkbox原dom对象
+layuiXtree.prototype.GetParent = function (a) {
+    var _this = this;
+    var cks = _this.getByClassName('layui-xtree-checkbox');
+    for (var i = 0; i < cks.length; i++) {
+        if (cks[i].value == a) {
+            if (cks[i].parentNode.parentNode.getAttribute('id') == _this._container.getAttribute('id')) return null;
+            return _this.getChildByClassName(cks[i].parentNode.parentNode, 'layui-xtree-checkbox')[0];
+        }
+    }
+    return null;
+}

+ 167 - 0
js/layuiPlugins/md5.js

@@ -0,0 +1,167 @@
+/**
+ * Des: MD5加密
+ * User: Yanbo
+ * Date: 2017-09-01
+ * Time: 10:50
+ * Mail: <a href="yanbo@hyphoneit.com">Yanbo</a>.
+ */
+;!function (win) {
+    'use strict';
+    layui.define(function (exports) {
+        var md5 = {
+            config: {
+                MOD_NAME: 'md5'
+            }
+            /**
+             * 对字符串进行MD5加密
+             * @param str 要加密的字符串
+             */
+            , calcMD5: function (str) {
+                var self = this
+                    , x = self.str2blksMD5(str)
+                    , a = 0x67452301
+                    , b = 0xEFCDAB89
+                    , c = 0x98BADCFE
+                    , d = 0x10325476;
+                for (var i = 0; i < x.length; i += 16) {
+                    var olda = a
+                        , oldb = b
+                        , oldd = d
+                        , oldc = c;
+                    a = self.ff(a, b, c, d, x[i + 0], 7, 0xD76AA478);
+                    d = self.ff(d, a, b, c, x[i + 1], 12, 0xE8C7B756);
+                    c = self.ff(c, d, a, b, x[i + 2], 17, 0x242070DB);
+                    b = self.ff(b, c, d, a, x[i + 3], 22, 0xC1BDCEEE);
+                    a = self.ff(a, b, c, d, x[i + 4], 7, 0xF57C0FAF);
+                    d = self.ff(d, a, b, c, x[i + 5], 12, 0x4787C62A);
+                    c = self.ff(c, d, a, b, x[i + 6], 17, 0xA8304613);
+                    b = self.ff(b, c, d, a, x[i + 7], 22, 0xFD469501);
+                    a = self.ff(a, b, c, d, x[i + 8], 7, 0x698098D8);
+                    d = self.ff(d, a, b, c, x[i + 9], 12, 0x8B44F7AF);
+                    c = self.ff(c, d, a, b, x[i + 10], 17, 0xFFFF5BB1);
+                    b = self.ff(b, c, d, a, x[i + 11], 22, 0x895CD7BE);
+                    a = self.ff(a, b, c, d, x[i + 12], 7, 0x6B901122);
+                    d = self.ff(d, a, b, c, x[i + 13], 12, 0xFD987193);
+                    c = self.ff(c, d, a, b, x[i + 14], 17, 0xA679438E);
+                    b = self.ff(b, c, d, a, x[i + 15], 22, 0x49B40821);
+
+                    a = self.gg(a, b, c, d, x[i + 1], 5, 0xF61E2562);
+                    d = self.gg(d, a, b, c, x[i + 6], 9, 0xC040B340);
+                    c = self.gg(c, d, a, b, x[i + 11], 14, 0x265E5A51);
+                    b = self.gg(b, c, d, a, x[i + 0], 20, 0xE9B6C7AA);
+                    a = self.gg(a, b, c, d, x[i + 5], 5, 0xD62F105D);
+                    d = self.gg(d, a, b, c, x[i + 10], 9, 0x02441453);
+                    c = self.gg(c, d, a, b, x[i + 15], 14, 0xD8A1E681);
+                    b = self.gg(b, c, d, a, x[i + 4], 20, 0xE7D3FBC8);
+                    a = self.gg(a, b, c, d, x[i + 9], 5, 0x21E1CDE6);
+                    d = self.gg(d, a, b, c, x[i + 14], 9, 0xC33707D6);
+                    c = self.gg(c, d, a, b, x[i + 3], 14, 0xF4D50D87);
+                    b = self.gg(b, c, d, a, x[i + 8], 20, 0x455A14ED);
+                    a = self.gg(a, b, c, d, x[i + 13], 5, 0xA9E3E905);
+                    d = self.gg(d, a, b, c, x[i + 2], 9, 0xFCEFA3F8);
+                    c = self.gg(c, d, a, b, x[i + 7], 14, 0x676F02D9);
+                    b = self.gg(b, c, d, a, x[i + 12], 20, 0x8D2A4C8A);
+
+                    a = self.hh(a, b, c, d, x[i + 5], 4, 0xFFFA3942);
+                    d = self.hh(d, a, b, c, x[i + 8], 11, 0x8771F681);
+                    c = self.hh(c, d, a, b, x[i + 11], 16, 0x6D9D6122);
+                    b = self.hh(b, c, d, a, x[i + 14], 23, 0xFDE5380C);
+                    a = self.hh(a, b, c, d, x[i + 1], 4, 0xA4BEEA44);
+                    d = self.hh(d, a, b, c, x[i + 4], 11, 0x4BDECFA9);
+                    c = self.hh(c, d, a, b, x[i + 7], 16, 0xF6BB4B60);
+                    b = self.hh(b, c, d, a, x[i + 10], 23, 0xBEBFBC70);
+                    a = self.hh(a, b, c, d, x[i + 13], 4, 0x289B7EC6);
+                    d = self.hh(d, a, b, c, x[i + 0], 11, 0xEAA127FA);
+                    c = self.hh(c, d, a, b, x[i + 3], 16, 0xD4EF3085);
+                    b = self.hh(b, c, d, a, x[i + 6], 23, 0x04881D05);
+                    a = self.hh(a, b, c, d, x[i + 9], 4, 0xD9D4D039);
+                    d = self.hh(d, a, b, c, x[i + 12], 11, 0xE6DB99E5);
+                    c = self.hh(c, d, a, b, x[i + 15], 16, 0x1FA27CF8);
+                    b = self.hh(b, c, d, a, x[i + 2], 23, 0xC4AC5665);
+
+                    a = self.ii(a, b, c, d, x[i + 0], 6, 0xF4292244);
+                    d = self.ii(d, a, b, c, x[i + 7], 10, 0x432AFF97);
+                    c = self.ii(c, d, a, b, x[i + 14], 15, 0xAB9423A7);
+                    b = self.ii(b, c, d, a, x[i + 5], 21, 0xFC93A039);
+                    a = self.ii(a, b, c, d, x[i + 12], 6, 0x655B59C3);
+                    d = self.ii(d, a, b, c, x[i + 3], 10, 0x8F0CCC92);
+                    c = self.ii(c, d, a, b, x[i + 10], 15, 0xFFEFF47D);
+                    b = self.ii(b, c, d, a, x[i + 1], 21, 0x85845DD1);
+                    a = self.ii(a, b, c, d, x[i + 8], 6, 0x6FA87E4F);
+                    d = self.ii(d, a, b, c, x[i + 15], 10, 0xFE2CE6E0);
+                    c = self.ii(c, d, a, b, x[i + 6], 15, 0xA3014314);
+                    b = self.ii(b, c, d, a, x[i + 13], 21, 0x4E0811A1);
+                    a = self.ii(a, b, c, d, x[i + 4], 6, 0xF7537E82);
+                    d = self.ii(d, a, b, c, x[i + 11], 10, 0xBD3AF235);
+                    c = self.ii(c, d, a, b, x[i + 2], 15, 0x2AD7D2BB);
+                    b = self.ii(b, c, d, a, x[i + 9], 21, 0xEB86D391);
+
+                    a = self.add(a, olda);
+                    b = self.add(b, oldb);
+                    c = self.add(c, oldc);
+                    d = self.add(d, oldd);
+                }
+                return self.rhex(a) + self.rhex(b) + self.rhex(c) + self.rhex(d);
+            }
+            /*
+             * Convert a string to a sequence of 16-word blocks, stored as an array.
+             * Append padding bits and the length, as described in the MD5 standard.
+             */
+            , str2blksMD5: function (str) {
+                var nblk = ((str.length + 8) >> 6) + 1
+                    , blks = new Array(nblk * 16);
+                for (var i = 0; i < nblk * 16; i++) blks[i] = 0;
+                for (var i = 0; i < str.length; i++)
+                    blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8);
+                blks[i >> 2] |= 0x80 << ((i % 4) * 8);
+                blks[nblk * 16 - 2] = str.length * 8;
+                return blks;
+            }
+            /*
+             * Add integers, wrapping at 2^32
+             */
+            , add: function (x, y) {
+                return ((x & 0x7FFFFFFF) + (y & 0x7FFFFFFF)) ^ (x & 0x80000000) ^ (y & 0x80000000);
+            }
+            /*
+             * Bitwise rotate a 32-bit number to the left
+             */
+            , rol: function (num, cnt) {
+                return (num << cnt) | (num >>> (32 - cnt));
+            }
+            /*
+             * These functions implement the basic operation for each round of the
+             * algorithm.
+             */
+            , cmn: function (q, a, b, x, s, t) {
+                var self = this;
+                return self.add(self.rol(self.add(self.add(a, q), self.add(x, t)), s), b);
+            }
+            , ff: function (a, b, c, d, x, s, t) {
+                var self = this;
+                return self.cmn((b & c) | ((~b) & d), a, b, x, s, t);
+            }
+            , gg: function (a, b, c, d, x, s, t) {
+                var self = this;
+                return self.cmn((b & d) | (c & (~d)), a, b, x, s, t);
+            }
+            , hh: function (a, b, c, d, x, s, t) {
+                var self = this;
+                return self.cmn(b ^ c ^ d, a, b, x, s, t);
+            }
+            , ii: function (a, b, c, d, x, s, t) {
+                var self = this;
+                return self.cmn(c ^ (b | (~d)), a, b, x, s, t);
+            }
+            , rhex: function (num) {
+                var hex_chr = '0123456789abcdef'
+                    , str = '';
+                for (var j = 0; j <= 3; j++)
+                    str += hex_chr.charAt((num >> (j * 8 + 4)) & 0x0F) + hex_chr.charAt((num >> (j * 8)) & 0x0F);
+                return str;
+            }
+        }
+            , _config = md5.config;
+        exports(_config.MOD_NAME, md5);
+    });
+}(window);

+ 332 - 0
js/layuiPlugins/step.js

@@ -0,0 +1,332 @@
+ /**
+ 
+ @Name : layui.step 基于layui的步骤条面板
+ @Author:hsianglee
+ @License:MIT
+ 
+ */
+
+layui.define(["jquery"], function (exports) {
+    var $ = layui.jquery;
+    
+    function Step(option) {
+        this.option=option;     // 获取传入的数据
+        this.elem=option.elem;
+        // this.methods=option.methods?option.methods:"";
+        this.title=option.title?option.title:[];
+        this.description=option.description?option.description:[];
+        this.canIconClick=option.canIconClick?option.canIconClick:false;
+        this.isOpenStepLevel=option.isOpenStepLevel?option.isOpenStepLevel:false;
+        this.len=0;   // 页面个数
+        this.currentStep=(option.currentStep && option.currentStep>=1)?option.currentStep:1;    // 当前走到第几步
+
+        this.disabledStep=[];
+
+        this.finalStep=1;       // 当前走到最远的步骤
+
+        this.parameterInit();
+        this.domRender();
+        this.init();
+        this.openStepLevel();
+        this.changeStep();
+    }
+
+    Step.prototype={
+        constructor: Step,
+        // 初始化参数数据
+        parameterInit: function() {
+            var self=this;
+            this.len=$(this.elem).find(".layui-step-content-item").length;   // 页面个数
+            // 不传title参数
+            if(this.title.length<=0){
+                $(this.elem).find(".layui-step-content-item").each(function(index,val) {
+                    self.title.push("第"+(index+1)+"步");
+                })
+            }
+            if(this.len!==this.title.length){
+                throw "title参数长度与页面长度不匹配";
+            }
+            // 不传description参数
+            if(this.description.length<=0){
+                $(this.elem).find(".layui-step-content-item").each(function(index,val) {
+                    self.description.push("");
+                })
+            }
+            if(this.len!==this.description.length){
+                throw "description参数长度与页面长度不匹配";
+            }
+            // 若当前步超过最大步,则默认为最后一步
+            this.currentStep=this.currentStep>=this.len?this.len:this.currentStep;
+        },
+        domRender: function() {
+            var self=this;
+            var titleStr='<div class="layui-step-title layui-clear">'+
+            '<div class="layui-step-title-item step-first" style="width: '+(100/this.len)+'%;">'+
+                '<div class="step-icon">'+
+                    '<i>1</i>'+
+                '</div>'+
+                '<div class="step-text">'+
+                    this.title[0]+
+                '</div>'+
+                '<div class="step-description">'+
+                    this.description[0]+
+                '</div>'+
+            '</div>';
+            for(var i=1;i<this.title.length-1;i++){
+                titleStr+='<div class="layui-step-title-item" style="width: '+(100/this.len)+'%;">'+
+                    '<div class="step-icon">'+
+                        '<i>'+(i+1)+'</i>'+
+                    '</div>'+
+                    '<div class="step-text">'+
+                        this.title[i]+
+                    '</div>'+
+                    '<div class="step-description">'+
+                        this.description[i]+
+                    '</div>'+
+                '</div>';
+            };
+            titleStr+='<div class="layui-step-title-item step-last" style="width: '+(100/this.len)+'%;">'+
+                    '<div class="step-icon">'+
+                        '<i>'+this.len+'</i>'+
+                    '</div>'+
+                    '<div class="step-text">'+
+                        this.title[this.title.length-1]+
+                    '</div>'+
+                    '<div class="step-description">'+
+                        this.description[this.title.length-1]+
+                    '</div>'+
+                '</div>'+
+            '</div>'
+            $(this.elem).prepend(titleStr);
+
+            // 生成三角
+            $(this.elem).find(".layui-step-content-item").each(function(index,val) {
+                $(this).append("<span class='content-item-before' style='left: calc("+((100/(self.len*2))+((100*index)/self.len))+"% - 10px);'></span>");
+            })
+        },
+        // 添加样式
+        init: function() {
+            var self=this;
+            this.disabledStep.forEach(function(val){
+                $(self.elem).find(".layui-step-title-item").eq(val-1).addClass("step-disabled");
+            })
+            
+            $(this.elem).find(".layui-step-title-item").eq(this.currentStep-1).addClass("step-current");
+            $(this.elem).find(".layui-step-content-item").eq(this.currentStep-1).show();
+            if(this.currentStep<2) return;
+            for(var i=this.currentStep-2;i>=0;i--){
+                $(this.elem).find(".layui-step-title-item").eq(i).addClass("step-finish");
+            }
+        },
+        // 恢复默认样式
+        reInit: function() {
+            $(this.elem).find(".layui-step-title-item").each(function(index,val) {
+                $(val).removeClass("step-disabled");
+            })
+            
+            $(this.elem).find(".layui-step-title-item").eq(this.currentStep-1).removeClass("step-current");
+            $(this.elem).find(".layui-step-content-item").eq(this.currentStep-1).hide();
+            if(this.currentStep<2) return;
+            for(var i=this.currentStep-2;i>=0;i--){
+                $(this.elem).find(".layui-step-title-item").eq(i).removeClass("step-finish");
+            }
+        },
+        // 给上面的icon添加事件
+        changeStep: function() {
+            var self=this;
+            this.canIconClick?(function() {
+                $(self.elem).on("click",".layui-step-title-item .step-icon",function() {
+                    var index=$(this).parent(".layui-step-title-item").index()+1;
+                    // 判断点击的是否为disabled
+                    if($.inArray(index, self.disabledStep) === -1){
+                        self.goStep(index);
+                    }
+                })
+            })():"";
+        },
+        // 是否严格按照步骤条顺序执行步骤
+        openStepLevel: function() {
+            var self=this;
+            this.isOpenStepLevel?(function() {
+                // 如果开启这一项,则默认关闭icon点击事件
+                self.canIconClick=false;
+                $(self.elem).off().on("click",".layui-step-title-item .step-icon",function() {
+                    var index=$(this).parent(".layui-step-title-item").index()+1;
+                    // 判断如果当前点击的步骤超过已走过的最大步,则不跳转
+                    if(index>self.finalStep){
+                        return;
+                    }
+                    // 判断点击的是否为disabled
+                    if($.inArray(index, self.disabledStep) === -1){
+                        self.goStep(index);
+                    }
+                })
+            })():"";
+        },
+        // 跳转第几步
+        goStep: function(i) {
+            if((i<1 || i>this.len)){
+                throw "goStep函数参数不在范围内";
+            }
+            // 判断当前页是否禁用,即i是否在数组中
+            if($.inArray(i, this.disabledStep) === -1){
+                this.reInit();
+                this.currentStep=i;
+                this.init();
+            }else{
+                throw "该页已禁用";
+            }
+        },
+        // 跳到第一步
+        goFirst: function() {
+            this.goStep(1);
+        },
+        // 跳到最后一步
+        goLast: function() {
+            this.goStep(this.len);
+            this.finalStep=this.len;
+            this.openStepLevel();
+        },
+        // 跳到上一步
+        prev: function () {
+            if(this.currentStep<=1){
+                return;
+            }
+            this.reInit();
+            // 先保存当前位置,若前面的全都已经禁用,则可以回到当前位置
+            var origin=this.currentStep;
+            this.PrevGo(origin);
+        },
+        PrevGo: function(origin) {
+            this.currentStep--;
+            // 判断前面的是否全都已经禁用
+            if(this.currentStep<1){
+                this.currentStep=origin;
+                this.init();
+                return;
+            }
+            // 判断当前页是否禁用
+            if($.inArray(this.currentStep, this.disabledStep) === -1){
+                this.init();
+            }else{
+                this.PrevGo(origin);
+            }
+        },
+        // 跳到下一部
+        next: function () {
+            if(this.currentStep>=this.len){
+                return;
+            }
+            this.reInit();
+            // 先保存当前位置,若后面的全都已经禁用,则可以回到当前位置
+            var origin=this.currentStep;
+            this.nextGo(origin);
+        },
+        nextGo: function(origin) {
+            if(this.currentStep===this.finalStep){
+                // 更新最远步
+                this.finalStep++;
+                this.openStepLevel();
+            }
+
+            this.currentStep++;
+            // 判断后面的是否全都已经禁用
+            if(this.currentStep>this.len){
+                this.currentStep=origin;
+                this.init();
+                return;
+            }
+            // 判断当前步是否禁用
+            if($.inArray(this.currentStep, this.disabledStep) === -1){
+                this.init();
+            }else{
+                this.nextGo(origin);
+            }
+        },
+        // 禁用某一步
+        disabled: function (j) {
+            if(j<=this.currentStep){
+                throw "已经走过的步骤不能禁用";
+            }
+            // 当前步不存在则加入数组,否存重复添加
+            if($.inArray(j,this.disabledStep)===-1){
+                this.disabledStep.push(j);
+            }
+            //默认为起始从第一步开始,若第一步为disabled,则从前往后找到第一个不是disabled的作为第一步
+            for(var i=this.currentStep;i<this.len;i++){
+                if($.inArray(i, this.disabledStep) === -1){
+                    this.reInit();
+                    this.currentStep=i;
+                    this.init();
+                    i=this.len+1;
+                }
+            }
+            
+        },
+        // 解除禁用
+        abled: function (j) {
+            if(j<=this.currentStep){
+                throw "已经走过的步骤不能解除禁用";
+            }
+            // 删除数组数据
+            var tem=this.disabledStep.concat();
+            if($.inArray(j, tem) !== -1){
+                this.disabledStep.splice($.inArray(j, tem),1);
+            }
+            this.reInit();
+            this.init();
+        }
+    }
+
+    var stepObj;    // new的对象,作为内部变量
+    var step={
+        option: "",
+        currentStep: 1,
+        render: function(option) {
+            var self=this;
+            this.option=option || {};
+
+            this.option.elem?"":(function() {
+                throw '缺少参数,需要传入elem元素';
+            })();
+
+            !$(this.option.elem)[0]?(function() {
+                throw '没有找到'+ self.option.elem +'元素';
+            })():"";
+
+            stepObj=new Step(this.option);
+            this.currentStep=stepObj.currentStep;
+        },
+        goStep: function(i) {
+            if(typeof i !== "number"){
+                throw 'goStep参数不合法';
+            }
+            stepObj.goStep(i);
+            this.currentStep=stepObj.currentStep;
+        },
+        goFirst: function() {
+            stepObj.goFirst();
+            this.currentStep=stepObj.currentStep;
+        },
+        goLast: function() {
+            stepObj.goLast();
+            this.currentStep=stepObj.currentStep;
+        },
+        prev: function() {
+            stepObj.prev();
+            this.currentStep=stepObj.currentStep;
+        },
+        next: function() {
+            stepObj.next();
+            this.currentStep=stepObj.currentStep;
+        },
+        disabled: function(i) {
+            stepObj.disabled(i);
+        },
+        abled: function(i) {
+            stepObj.abled(i);
+        }
+    }
+    
+    exports('step', step);
+})

+ 3 - 0
js/layuiPlugins/treeGrid.css

@@ -0,0 +1,3 @@
+.layui-tree-head{
+    cursor: pointer;
+}

+ 23 - 0
js/layuiPlugins/treeGrid.js

@@ -0,0 +1,23 @@
+/**
+
+ @Name:treeGrid树状表格
+ @Author:lrd
+ */
+layui.config({
+    base: "//" + location.host + '/js/layuiPlugins/'
+}).extend({
+    dltable:'dltable'
+}).define(['laytpl', 'laypage','dltable', 'layer', 'form'], function(exports){
+    "use strict";
+    var $ = layui.jquery;
+    var layer = layui.layer;
+    var dltable = layui.dltable;
+    var MOD_NAME='treeGrid';
+    var treeGrid=$.extend({},dltable);
+    treeGrid._render=treeGrid.render;
+    treeGrid.render=function(param){//重写渲染方法
+        param.isTree=true;//是树表格
+        treeGrid._render(param);
+    };
+    exports(MOD_NAME, treeGrid);
+});

Datei-Diff unterdrückt, da er zu groß ist
+ 4028 - 0
js/layuiPlugins/treeSelect.js


+ 18 - 0
js/layuiPlugins/treetable-lay/treetable.css

@@ -0,0 +1,18 @@
+.treeTable-empty {
+    width: 20px;
+    display: inline-block;
+}
+
+.treeTable-icon {
+    cursor: pointer;
+}
+
+.treeTable-icon .layui-icon-triangle-d:before {
+    content: "\e623";
+}
+
+.treeTable-icon.open .layui-icon-triangle-d:before {
+    content: "\e625";
+    background-color: transparent;
+}
+

+ 206 - 0
js/layuiPlugins/treetable-lay/treetable.js

@@ -0,0 +1,206 @@
+layui.define(['layer', 'table'], function (exports) {
+    var $ = layui.jquery;
+    var layer = layui.layer;
+    var table = layui.table;
+
+    var treetable = {
+        // 渲染树形表格
+        render: function (param) {
+            // 检查参数
+            if (!treetable.checkParam(param)) {
+                return;
+            }
+            // 获取数据
+            if (param.data) {
+                treetable.init(param, param.data);
+            } else {
+                $.getJSON(param.url, param.where, function (res) {
+                    treetable.init(param, res.data);
+                });
+            }
+        },
+        // 渲染表格
+        init: function (param, data) {
+            var mData = [];
+            var doneCallback = param.done;
+            var tNodes = data;
+            // 补上id和pid字段
+            for (var i = 0; i < tNodes.length; i++) {
+                var tt = tNodes[i];
+                if (!tt.id) {
+                    if (!param.treeIdName) {
+                        layer.msg('参数treeIdName不能为空', {icon: 5});
+                        return;
+                    }
+                    tt.id = tt[param.treeIdName];
+                }
+                if (!tt.pid) {
+                    if (!param.treePidName) {
+                        layer.msg('参数treePidName不能为空', {icon: 5});
+                        return;
+                    }
+                    tt.pid = tt[param.treePidName];
+                }
+            }
+
+            // 对数据进行排序
+            var sort = function (s_pid, data) {
+                for (var i = 0; i < data.length; i++) {
+                    if (data[i].pid == s_pid) {
+                        var len = mData.length;
+                        if (len > 0 && mData[len - 1].id == s_pid) {
+                            mData[len - 1].isParent = true;
+                        }
+                        mData.push(data[i]);
+                        sort(data[i].id, data);
+                    }
+                }
+            };
+            sort(param.treeSpid, tNodes);
+
+            // 重写参数
+            param.url = undefined;
+            param.data = mData;
+            param.page = {
+                count: param.data.length,
+                limit: param.data.length
+            };
+            param.cols[0][param.treeColIndex].templet = function (d) {
+                var mId = d.id;
+                var mPid = d.pid;
+                var isDir = d.isParent;
+                var emptyNum = treetable.getEmptyNum(mPid, mData);
+                var iconHtml = '';
+                for (var i = 0; i < emptyNum; i++) {
+                    iconHtml += '<span class="treeTable-empty"></span>';
+                }
+                if (isDir) {
+                    iconHtml += '<i class="layui-icon layui-icon-triangle-d"></i> <i class="layui-icon layui-icon-layer"></i>';
+                } else {
+                    iconHtml += '<i class="layui-icon layui-icon-file"></i>';
+                }
+                iconHtml += '&nbsp;&nbsp;';
+                var ttype = isDir ? 'dir' : 'file';
+                var vg = '<span class="treeTable-icon open" lay-tid="' + mId + '" lay-tpid="' + mPid + '" lay-ttype="' + ttype + '">';
+                return vg + iconHtml + d[param.cols[0][param.treeColIndex].field] + '</span>'
+            };
+
+            param.done = function (res, curr, count) {
+                $(param.elem).next().addClass('treeTable');
+                $('.treeTable .layui-table-page').css('display', 'none');
+                $(param.elem).next().attr('treeLinkage', param.treeLinkage);
+                // 绑定事件换成对body绑定
+                /*$('.treeTable .treeTable-icon').click(function () {
+                    treetable.toggleRows($(this), param.treeLinkage);
+                });*/
+                if (param.treeDefaultClose) {
+                    treetable.foldAll(param.elem);
+                }
+                if (doneCallback) {
+                    doneCallback(res, curr, count);
+                }
+            };
+
+            // 渲染表格
+            table.render(param);
+        },
+        // 计算缩进的数量
+        getEmptyNum: function (pid, data) {
+            var num = 0;
+            if (!pid) {
+                return num;
+            }
+            var tPid;
+            for (var i = 0; i < data.length; i++) {
+                if (pid == data[i].id) {
+                    num += 1;
+                    tPid = data[i].pid;
+                    break;
+                }
+            }
+            return num + treetable.getEmptyNum(tPid, data);
+        },
+        // 展开/折叠行
+        toggleRows: function ($dom, linkage) {
+            var type = $dom.attr('lay-ttype');
+            if ('file' == type) {
+                return;
+            }
+            var mId = $dom.attr('lay-tid');
+            var isOpen = $dom.hasClass('open');
+            if (isOpen) {
+                $dom.removeClass('open');
+            } else {
+                $dom.addClass('open');
+            }
+            $dom.closest('tbody').find('tr').each(function () {
+                var $ti = $(this).find('.treeTable-icon');
+                var pid = $ti.attr('lay-tpid');
+                var ttype = $ti.attr('lay-ttype');
+                var tOpen = $ti.hasClass('open');
+                if (mId == pid) {
+                    if (isOpen) {
+                        $(this).hide();
+                        if ('dir' == ttype && tOpen == isOpen) {
+                            $ti.trigger('click');
+                        }
+                    } else {
+                        $(this).show();
+                        if (linkage && 'dir' == ttype && tOpen == isOpen) {
+                            $ti.trigger('click');
+                        }
+                    }
+                }
+            });
+        },
+        // 检查参数
+        checkParam: function (param) {
+            if (!param.treeSpid && param.treeSpid != 0) {
+                layer.msg('参数treeSpid不能为空', {icon: 5});
+                return false;
+            }
+
+            if (!param.treeColIndex && param.treeColIndex != 0) {
+                layer.msg('参数treeColIndex不能为空', {icon: 5});
+                return false;
+            }
+            return true;
+        },
+        // 展开所有
+        expandAll: function (dom) {
+            $(dom).next('.treeTable').find('.layui-table-body tbody tr').each(function () {
+                var $ti = $(this).find('.treeTable-icon');
+                var ttype = $ti.attr('lay-ttype');
+                var tOpen = $ti.hasClass('open');
+                if ('dir' == ttype && !tOpen) {
+                    $ti.trigger('click');
+                }
+            });
+        },
+        // 折叠所有
+        foldAll: function (dom) {
+            $(dom).next('.treeTable').find('.layui-table-body tbody tr').each(function () {
+                var $ti = $(this).find('.treeTable-icon');
+                var ttype = $ti.attr('lay-ttype');
+                var tOpen = $ti.hasClass('open');
+                if ('dir' == ttype && tOpen) {
+                    $ti.trigger('click');
+                }
+            });
+        }
+    };
+
+    layui.link(layui.cache.base + 'treetable-lay/treetable.css');
+
+    // 给图标列绑定事件
+    $('body').on('click', '.treeTable .treeTable-icon', function () {
+        var treeLinkage = $(this).parents('.treeTable').attr('treeLinkage');
+        if ('true' == treeLinkage) {
+            treetable.toggleRows($(this), true);
+        } else {
+            treetable.toggleRows($(this), false);
+        }
+    });
+
+    exports('treetable', treetable);
+});

+ 18 - 0
js/layuiPlugins/treetable.css

@@ -0,0 +1,18 @@
+.treeTable-empty {
+    width: 20px;
+    display: inline-block;
+}
+
+.treeTable-icon {
+    cursor: pointer;
+}
+
+.treeTable-icon .layui-icon-triangle-d:before {
+    content: "\e623";
+}
+
+.treeTable-icon.open .layui-icon-triangle-d:before {
+    content: "\e625";
+    background-color: transparent;
+}
+

+ 204 - 0
js/layuiPlugins/treetable.js

@@ -0,0 +1,204 @@
+layui.define(['layer', 'table'], function (exports) {
+    var $ = layui.jquery;
+    var layer = layui.layer;
+    var table = layui.table;
+
+    var treetable = {
+        // 渲染树形表格
+        render: function (param) {
+            // 检查参数
+            if (!treetable.checkParam(param)) {
+                return;
+            }
+            // 获取数据
+            if (param.data) {
+                treetable.init(param, param.data);
+            } else {
+                $.getJSON(param.url, param.where, function (res) {
+                    treetable.init(param, res.data);
+                });
+            }
+        },
+        // 渲染表格
+        init: function (param, data) {
+            var mData = [];
+            var doneCallback = param.done;
+            var tNodes = data;
+            // 补上id和pid字段
+            for (var i = 0; i < tNodes.length; i++) {
+                var tt = tNodes[i];
+                if (!tt.id) {
+                    if (!param.treeIdName) {
+                        layer.msg('参数treeIdName不能为空', {icon: 5});
+                        return;
+                    }
+                    tt.id = tt[param.treeIdName];
+                }
+                if (!tt.pid) {
+                    if (!param.treePidName) {
+                        layer.msg('参数treePidName不能为空', {icon: 5});
+                        return;
+                    }
+                    tt.pid = tt[param.treePidName];
+                }
+            }
+
+            // 对数据进行排序
+            var sort = function (s_pid, data) {
+                for (var i = 0; i < data.length; i++) {
+                    if (data[i].pid == s_pid) {
+                        var len = mData.length;
+                        if (len > 0 && mData[len - 1].id == s_pid) {
+                            mData[len - 1].isParent = true;
+                        }
+                        mData.push(data[i]);
+                        sort(data[i].id, data);
+                    }
+                }
+            };
+            sort(param.treeSpid, tNodes);
+
+            // 重写参数
+            param.url = undefined;
+            param.data = mData;
+            param.page = {
+                count: param.data.length,
+                limit: param.data.length
+            };
+            param.cols[0][param.treeColIndex].templet = function (d) {
+                var mId = d.id;
+                var mPid = d.pid;
+                var isDir = d.isParent;
+                var emptyNum = treetable.getEmptyNum(mPid, mData);
+                var iconHtml = '';
+                for (var i = 0; i < emptyNum; i++) {
+                    iconHtml += '<span class="treeTable-empty"></span>';
+                }
+                if (isDir) {
+                    iconHtml += '<i class="layui-icon layui-icon-triangle-d"></i>';
+                }
+                iconHtml += '&nbsp;&nbsp;';
+                var ttype = isDir ? 'dir' : 'file';
+                var vg = '<span class="treeTable-icon open" lay-tid="' + mId + '" lay-tpid="' + mPid + '" lay-ttype="' + ttype + '">';
+                return vg + iconHtml + d[param.cols[0][param.treeColIndex].field] + '</span>'
+            };
+
+            param.done = function (res, curr, count) {
+                $(param.elem).next().addClass('treeTable');
+                $('.treeTable .layui-table-page').css('display', 'none');
+                $(param.elem).next().attr('treeLinkage', param.treeLinkage);
+                // 绑定事件换成对body绑定
+                /*$('.treeTable .treeTable-icon').click(function () {
+                    treetable.toggleRows($(this), param.treeLinkage);
+                });*/
+                if (param.treeDefaultClose) {
+                    treetable.foldAll(param.elem);
+                }
+                if (doneCallback) {
+                    doneCallback(res, curr, count);
+                }
+            };
+
+            // 渲染表格
+            table.render(param);
+        },
+        // 计算缩进的数量
+        getEmptyNum: function (pid, data) {
+            var num = 0;
+            if (!pid) {
+                return num;
+            }
+            var tPid;
+            for (var i = 0; i < data.length; i++) {
+                if (pid == data[i].id) {
+                    num += 1;
+                    tPid = data[i].pid;
+                    break;
+                }
+            }
+            return num + treetable.getEmptyNum(tPid, data);
+        },
+        // 展开/折叠行
+        toggleRows: function ($dom, linkage) {
+            var type = $dom.attr('lay-ttype');
+            if ('file' == type) {
+                return;
+            }
+            var mId = $dom.attr('lay-tid');
+            var isOpen = $dom.hasClass('open');
+            if (isOpen) {
+                $dom.removeClass('open');
+            } else {
+                $dom.addClass('open');
+            }
+            $dom.closest('tbody').find('tr').each(function () {
+                var $ti = $(this).find('.treeTable-icon');
+                var pid = $ti.attr('lay-tpid');
+                var ttype = $ti.attr('lay-ttype');
+                var tOpen = $ti.hasClass('open');
+                if (mId == pid) {
+                    if (isOpen) {
+                        $(this).hide();
+                        if ('dir' == ttype && tOpen == isOpen) {
+                            $ti.trigger('click');
+                        }
+                    } else {
+                        $(this).show();
+                        if (linkage && 'dir' == ttype && tOpen == isOpen) {
+                            $ti.trigger('click');
+                        }
+                    }
+                }
+            });
+        },
+        // 检查参数
+        checkParam: function (param) {
+            if (!param.treeSpid && param.treeSpid != 0) {
+                layer.msg('参数treeSpid不能为空', {icon: 5});
+                return false;
+            }
+
+            if (!param.treeColIndex && param.treeColIndex != 0) {
+                layer.msg('参数treeColIndex不能为空', {icon: 5});
+                return false;
+            }
+            return true;
+        },
+        // 展开所有
+        expandAll: function (dom) {
+            $(dom).next('.treeTable').find('.layui-table-body tbody tr').each(function () {
+                var $ti = $(this).find('.treeTable-icon');
+                var ttype = $ti.attr('lay-ttype');
+                var tOpen = $ti.hasClass('open');
+                if ('dir' == ttype && !tOpen) {
+                    $ti.trigger('click');
+                }
+            });
+        },
+        // 折叠所有
+        foldAll: function (dom) {
+            $(dom).next('.treeTable').find('.layui-table-body tbody tr').each(function () {
+                var $ti = $(this).find('.treeTable-icon');
+                var ttype = $ti.attr('lay-ttype');
+                var tOpen = $ti.hasClass('open');
+                if ('dir' == ttype && tOpen) {
+                    $ti.trigger('click');
+                }
+            });
+        }
+    };
+
+    layui.link(layui.cache.base + 'treetable-lay/treetable.css');
+
+    // 给图标列绑定事件
+    $('body').on('click', '.treeTable .treeTable-icon', function () {
+        var treeLinkage = $(this).parents('.treeTable').attr('treeLinkage');
+        if ('true' == treeLinkage) {
+            treetable.toggleRows($(this), true);
+        } else {
+            treetable.toggleRows($(this), false);
+        }
+    });
+
+    exports('treetable', treetable);
+});

+ 58 - 0
js/leftNav.js

@@ -0,0 +1,58 @@
+function navBar(data) {
+    var ulHtml = '<ul class="layui-nav layui-nav-tree">';
+    for (var i = 0; i < data.length; i++) {
+        if (data[i].spread) {
+            ulHtml += '<li class="layui-nav-item layui-nav-itemed">';
+        } else {
+            ulHtml += '<li class="layui-nav-item">';
+        }
+        if (data[i].subMenuList != undefined && data[i].subMenuList.length > 0) {
+            ulHtml += '<a href="javascript:;">';
+            if (data[i].ico != undefined && data[i].ico != '') {
+                if (data[i].ico - 0 == 0) {
+                    data[i].ico = "&nbsp;";
+                }
+                if (data[i].ico.indexOf("icon-") != -1) {
+                    ulHtml += '<i class="iconfont ' + data[i].ico + '" data-icon="' + data[i].ico + '"></i>';
+                } else {
+                    ulHtml += '<i class="layui-icon" data-icon="' + data[i].ico + '">' + data[i].ico + '</i>';
+                }
+            }
+            ulHtml += '<cite>' + data[i].funName + '</cite>';
+            ulHtml += '<span class="layui-nav-more"></span>';
+            ulHtml += '</a>'
+            ulHtml += '<dl class="layui-nav-child">';
+            for (var j = 0; j < data[i].subMenuList.length; j++) {
+                ulHtml += '<dd><a href="javascript:;" data-url="' + data[i].subMenuList[j].fileUrl + '?id=' + data[i].subMenuList[j].id + '&ver=' + SYS_VER + '">';
+                if (data[i].subMenuList[j].ico != undefined && data[i].subMenuList[j].ico != '') {
+                    if (data[i].subMenuList[j].ico - 0 == 0) {
+                        data[i].subMenuList[j].ico = "&nbsp;";
+                    }
+                    if (data[i].subMenuList[j].ico.indexOf("icon-") != -1) {
+                        ulHtml += '<i class="iconfont ' + data[i].subMenuList[j].ico + '" data-icon="' + data[i].subMenuList[j].ico + '"></i>';
+                    } else {
+                        ulHtml += '<i class="layui-icon" data-icon="' + data[i].subMenuList[j].ico + '">' + data[i].subMenuList[j].ico + '</i>';
+                    }
+                }
+                ulHtml += '<cite>' + data[i].subMenuList[j].funName + '</cite></a></dd>';
+            }
+            ulHtml += "</dl>"
+        } else {
+            ulHtml += '<a href="javascript:;" data-url="' + data[i].fileUrl + '?id=' + data[i].id + '&ver=' + SYS_VER + '">';
+            if (data[i].ico != undefined && data[i].ico != '') {
+                if (data[i].ico - 0 == 0) {
+                    data[i].ico = "&nbsp;";
+                }
+                if (data[i].ico.indexOf("icon-") != -1) {
+                    ulHtml += '<i class="iconfont ' + data[i].ico + '" data-icon="' + data[i].ico + '"></i>';
+                } else {
+                    ulHtml += '<i class="layui-icon" data-icon="' + data[i].ico + '">' + data[i].ico + '</i>';
+                }
+            }
+            ulHtml += '<cite>' + data[i].funName + '</cite></a>';
+        }
+        ulHtml += '</li>'
+    }
+    ulHtml += '</ul>';
+    return ulHtml;
+}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.