user_group_create.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. {{include "com/inc.html"}}
  2. <!-- Main Header -->
  3. {{include "com/header.html"}}
  4. <!-- Left side column. 权限菜单 -->
  5. {{include "com/menu.html"}}
  6. <div class="content-wrapper">
  7. <section class="content-header">
  8. <h1>
  9. <small></small>
  10. </h1>
  11. <ol class="breadcrumb">
  12. <li><a href="#"><i class="fa fa-dashboard"></i> 用户组管理</a></li>
  13. <li><a href="/front/group"><i class="fa fa-dashboard"></i> 用户组管理</a></li>
  14. <li><a href="/front/group/new"><i class="fa fa-dashboard"></i> 用户组新增</a></li>
  15. </ol>
  16. </section>
  17. <!-- Main content -->
  18. <section class="content">
  19. <form class="form-horizontal" onsubmit="return false;">
  20. <div class="box box-primary">
  21. <div class="box-header with-border">
  22. <i class="fa fa-group"></i>
  23. <h4 class="box-title">用户组信息</h4>
  24. </div>
  25. <div class="box-body">
  26. <div class="form-group" style="text-align: right;margin-right: 20px" >
  27. <!-- <a class="btn btn-sm btn-success" onclick="addMember()"><i class="fa fa-fw fa-plus fa-lg"></i>添加成员信息</a>-->
  28. </div>
  29. <div class="form-group">
  30. <label class="col-sm-2 control-label"><span style="color:red;">* </span>用户组名称</label>
  31. <div class="col-sm-3">
  32. <input type="text" class="form-control" id="group-name" placeholder="用户组名称" required>
  33. </div>
  34. <label class="col-sm-2 control-label"><span style="color:red;">* </span>公司名称</label>
  35. <div class="col-sm-3">
  36. <input type="text" class="form-control" id="company-name" placeholder="公司名称" required>
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <label class="col-sm-2 control-label"><span style="color:red;">* </span>负责人</label>
  41. <div class="col-sm-3">
  42. <input type="text" class="form-control" id="leader" placeholder="负责人名称" required>
  43. </div>
  44. <label class="col-sm-2 control-label">联系方式</label>
  45. <div class="col-sm-3">
  46. <input type="text" class="form-control" id="contract" placeholder="联系方式:电话/邮箱">
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label class="col-sm-2 control-label">用户组权限</label>
  51. <div class="col-sm-5 radio">
  52. <label class="margin-r-5">
  53. <input type="radio" name="role" value=1 checked>系统管理员
  54. </label>
  55. <label class="margin-r-5">
  56. <input type="radio" name="role" value=2 checked>管理员
  57. </label>
  58. <label class="margin-r-5">
  59. <input type="radio" name="role" value=3>质检员
  60. </label>
  61. <label>
  62. <input type="radio" name="role" value="4">普通用户
  63. </label>
  64. </div>
  65. </div>
  66. <div class="form-group">
  67. <label class="col-sm-2 control-label">登陆密码</label>
  68. <div class="col-sm-2">
  69. <input type="password" id="group-pwd" readonly="readonly" class="form-control" placeholder="手动输入密码">
  70. </div>
  71. <div class="col-xs-3" style="width: auto">
  72. <label class="control-label" style="font-size: xx-small;width: auto">默认密码:</label>
  73. <input id="group-switch-pwd" name="switch-pwd" type="checkbox">
  74. </div>
  75. <label class="col-sm-1 control-label" style="width: auto">服务时间</label>
  76. <div class="col-sm-3">
  77. <input type="text" id="stratDate" class="col-sm-2 form-control" readonly="readonly" placeholder="开始日期 - 结束日期">
  78. </div>
  79. </div>
  80. <div class="box-body">
  81. <div class="box-header with-border">
  82. <i class="fa fa-user"></i>
  83. <h4 class="box-title">质检员信息</h4>
  84. </div>
  85. <h1></h1>
  86. <div class="form-group">
  87. <label class="col-sm-2 control-label">用户账号</label>
  88. <div class="col-sm-3">
  89. <input type="text" readonly="readonly" class="form-control" placeholder="默认用户组名称+zj+数字">
  90. </div>
  91. <label class="col-sm-2 control-label">用户个数(个)</label>
  92. <div class="col-sm-3">
  93. <input type="number" id="u1-size" class="form-control" value="1" oninput="if(value<0)value=0;if(value>10)value=10">
  94. </div>
  95. </div>
  96. <div class="form-group">
  97. <label class="col-sm-2 control-label">登陆密码</label>
  98. <div class="col-sm-2">
  99. <input type="password" id="u1-pwd" readonly="readonly" class="form-control" placeholder="手动输入密码">
  100. </div>
  101. <div class="col-xs-3" style="width: auto">
  102. <label class="control-label" style="font-size: xx-small;">默认密码:</label>
  103. <input id="u1-switch-pwd" name="switch-pwd" type="checkbox">
  104. </div>
  105. <label class="col-sm-1 control-label" style="width: auto">用户状态</label>
  106. <div class="col-sm-3">
  107. <input id="u1-switch-state" name="switch-state" type="checkbox">
  108. </div>
  109. </div>
  110. </div>
  111. <div class="box-body">
  112. <div class="box-header with-border">
  113. <i class="fa fa-user"></i>
  114. <h4 class="box-title">成员信息</h4>
  115. </div>
  116. <h1></h1>
  117. <div class="form-group">
  118. <label class="col-sm-2 control-label">用户账号</label>
  119. <div class="col-sm-3">
  120. <input type="text" readonly="readonly" class="form-control" placeholder="默认用户组名称+数字">
  121. </div>
  122. <label class="col-sm-2 control-label">用户个数(个)</label>
  123. <div class="col-sm-3">
  124. <input type="number" id="u2-size" class="form-control" value="1" oninput="if(value<0)value=0;if(value>30)value=30">
  125. </div>
  126. </div>
  127. <div class="form-group">
  128. <label class="col-sm-2 control-label">登陆密码</label>
  129. <div class="col-sm-2">
  130. <input type="password" readonly="readonly" id="u2-pwd" class="form-control" placeholder="手动输入密码">
  131. </div>
  132. <div class="col-xs-3" style="width: auto">
  133. <label class="control-label" style="font-size: xx-small;width: auto">默认密码:</label>
  134. <input name="switch-pwd" id="u2-switch-pwd" type="checkbox">
  135. </div>
  136. <label class="col-sm-1 control-label" style="width: auto">用户状态</label>
  137. <div class="col-sm-3">
  138. <input id="u2-switch-state" name="switch-state" type="checkbox">
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <div class="text-center">
  144. <button class="btn btn-lg btn-success" onclick="saveMethod()">保存</button>
  145. </div>
  146. <hr>
  147. </div>
  148. </form>
  149. </section>
  150. </div>
  151. {{include "com/footer.html"}}
  152. <script>
  153. menuActive("group");
  154. let group = {}
  155. let user = {}
  156. $(document).ready(function () {
  157. $("#group-pwd").val({{.T.pwd}})
  158. $("#u1-pwd").val({{.T.pwd}})
  159. $("#u2-pwd").val({{.T.pwd}})
  160. })
  161. $("[name='switch-state']").each(function () {
  162. $(this).bootstrapSwitch({
  163. onText : "开", // 设置ON文本
  164. offText : "关", // 设置OFF文本
  165. onColor : "success",// 设置ON文本颜色(info/success/warning/danger/primary)
  166. offColor : "primary", // 设置OFF文本颜色 (info/success/warning/danger/primary)
  167. }).bootstrapSwitch('size', 'small').bootstrapSwitch('state', true);
  168. })
  169. $("[name='switch-pwd']").each(function () {
  170. $(this).bootstrapSwitch({
  171. onText : "是",
  172. offText : "否",
  173. onColor : "success",
  174. offColor : "warning",
  175. }).bootstrapSwitch('size', 'small').bootstrapSwitch('state', true);
  176. })
  177. // 用户组状态
  178. $("#group-switch-state").bootstrapSwitch('onSwitchChange', function (event, state){group['state'] = state})
  179. // 用户组登陆密码
  180. $("#group-switch-pwd").bootstrapSwitch(
  181. 'onSwitchChange', function (event, state){
  182. group["default_pwd"] = state
  183. if (state===true) {
  184. $("#group-pwd").attr('readonly', 'readonly').val("xxx")
  185. }else {
  186. $("#group-pwd").removeAttr('readonly').val("")
  187. }
  188. }
  189. )
  190. // 用户登陆密码
  191. $("#u1-switch-pwd").bootstrapSwitch(
  192. 'onSwitchChange', function (event, state){
  193. user["u1_default_pwd"] = state
  194. if (state===true) {
  195. $("#u1-pwd").attr('readonly', 'readonly').val({{.T.pwd}})
  196. }else {
  197. $("#u1-pwd").removeAttr('readonly').val("")
  198. }
  199. }
  200. )
  201. $("#u2-switch-pwd").bootstrapSwitch(
  202. 'onSwitchChange', function (event, state){
  203. user["u2_default_pwd"] = state
  204. if (state===true) {
  205. $("#u2-pwd").attr('readonly', 'readonly').val({{.T.pwd}})
  206. }else {
  207. $("#u2-pwd").removeAttr('readonly').val("")
  208. }
  209. }
  210. )
  211. // 用户状态
  212. $("#u1-switch-state").bootstrapSwitch('onSwitchChange', function (event, state){user["u1_state"] = state})
  213. $("#u2-switch-state").bootstrapSwitch('onSwitchChange', function (event, state){user["u2_state"] = state})
  214. function saveMethod() {
  215. const gname = $("#group-name").val();
  216. const company = $("#company-name").val()
  217. const lender = $("#leader").val()
  218. if (gname === "" || company === "" || lender === "") {
  219. return
  220. }
  221. group["i_role"] = $("input[name='role']:checked").val()
  222. group["s_name"] = gname
  223. group["s_entname"] = company
  224. group["s_personname"] = lender
  225. group["s_personcontact"] = $("#contract").val()
  226. group["s_password"] = $("#group-pwd").val()
  227. user["u1_size"] = $("#u1-size").val()
  228. user["u1_pwd"] = $("#u1-pwd").val()
  229. user["u2_size"] = $("#u2-size").val()
  230. user["u2_pwd"] = $("#u2-pwd").val()
  231. console.log(group)
  232. console.log(user)
  233. $.ajax({
  234. url: "/front/group/new",
  235. type: 'POST',
  236. data: {"group": JSON.stringify(group), "user": JSON.stringify(user)},
  237. success: function (r) {
  238. if (r.rep) {
  239. window.location.href="/front/group"
  240. } else {
  241. showTip("保存失败");
  242. }
  243. }
  244. })
  245. }
  246. </script>