user_company_edit.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>编辑内容</title>
  7. </head>
  8. <body layout:fragment="content">
  9. <article class="page-container">
  10. <form class="form form-horizontal" id="form-content-edit">
  11. <input type="hidden" th:name="id" th:id="uid" th:value="${user.id}"/>
  12. <div class="row cl">
  13. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>账号:</label>
  14. <div class="formControls col-xs-8 col-sm-9">
  15. <input type="text" class="input-text" th:value="${user.nick_name}" placeholder="请输入用户名"
  16. th:id="nick_name"
  17. th:name="nick_name"/>
  18. </div>
  19. </div>
  20. <div class="row cl company_id">
  21. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>单位名称:</label>
  22. <div class="formControls col-xs-8 col-sm-9">
  23. <!-- <input type="hidden" name="company_name" id="company_name" th:value="${user.company_name}"/>
  24. <span class="select-box">
  25. <select th:id="company_id" class="select" required th:name="company_id" onchange="setAttr(this);">
  26. <option value="">--请选择--</option>
  27. <option th:unless="${item.is_start}" disabled th:attr="company_name=${item.company_name}"
  28. th:selected="*{item.id==user.company_id}" th:each="item : ${companyList}" th:value="${item.id}" th:text="${item.company_name}">
  29. </option>
  30. <option th:if="${item.is_start}" th:attr="company_name=${item.company_name}"
  31. th:selected="*{item.id==user.company_id}" th:each="item : ${companyList}" th:value="${item.id}" th:text="${item.company_name}">
  32. </option>
  33. </select>
  34. </span> -->
  35. <input type="text" readonly="readonly" required placeholder="点击查找按钮查找公司"
  36. maxlength="45" class="input-text readonly" id="company_name" th:name="company_name" th:value="${user.company_name}"/>
  37. <input type="hidden" th:name="company_id" id="companyId" th:value="${user.company_id}"/>
  38. <!--<a class="btn btn-primary" style="margin-top:0px;"-->
  39. <!--th:onclick="'javascript:open_dialog(\'查找公司\',\'/build/contract/selectCompany\',\'800\',\'500\');'">-->
  40. <!--<i class="Hui-iconfont">&#xe665;</i>查找</a>-->
  41. </div>
  42. </div>
  43. <div class="row cl">
  44. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系人:</label>
  45. <div class="formControls col-xs-8 col-sm-9">
  46. <input type="text" class="input-text" th:value="${user.user_name}" placeholder="请输入用户名"
  47. th:id="user_name"
  48. th:name="user_name"/>
  49. </div>
  50. </div>
  51. <div class="row cl">
  52. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系电话:</label>
  53. <div class="formControls col-xs-8 col-sm-9">
  54. <input type="text" class="input-text" th:value="${user.phone}" th:id="phone" placeholder="请输入手机号码"
  55. th:name="phone"/>
  56. </div>
  57. </div>
  58. <div th:if="${user_type == 3}">
  59. <div class="row cl">
  60. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>角色:</label>
  61. <div class="formControls col-xs-8 col-sm-9">
  62. <select id="role_select" th:name="roleIds" multiple>
  63. <!-- th:selected="${user.is_admin==false}" -->
  64. <option th:each="item : ${roles}" th:value="${item.id}" >
  65. [[*{item.name}]]
  66. </option>
  67. </select>
  68. </div>
  69. </div>
  70. <!-- <div class="row cl is_admin">
  71. <label class="form-label col-xs-4 col-sm-2"><span>是否管理员:</span></label>
  72. <div class="formControls col-xs-8 col-sm-9">
  73. <input type="radio" th:checked="${user.is_admin==false}" name="is_admin" checked value="false">否</input>
  74. <input type="radio" th:checked="${user.is_admin==true}" name="is_admin" value="true">是</input>
  75. </div>
  76. </div> -->
  77. </div>
  78. <div class="row cl">
  79. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  80. <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
  81. <button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
  82. </div>
  83. </div>
  84. </form>
  85. </article>
  86. <script type="text/javascript" th:src="@{/js/build/user/user_company_edit.js}"></script>
  87. <script th:inline="javascript">
  88. /**
  89. * 取消
  90. */
  91. function removeIframe() {
  92. var index = parent.layer.getFrameIndex(window.name);
  93. parent.layer.close(index);
  94. }
  95. function setAttr(obj) {
  96. $("#phone").val($(obj).find("option:selected").attr("phone"));
  97. $("#company_name").val($(obj).find("option:selected").attr("company_name"));
  98. $("#user_name").val($(obj).find("option:selected").attr("user_name"));
  99. }
  100. $(window).load(function () {
  101. $("#role_select").select2({
  102. multiple: true,
  103. width: '75%',
  104. language: {
  105. noResults: function (params) {
  106. return "暂无数据";
  107. }
  108. }
  109. });
  110. initRoleSelect();
  111. });
  112. function initRoleSelect() {
  113. $("#role_select").val([[${user.roleIds}]]).trigger("change");
  114. }
  115. </script>
  116. </body>
  117. </html>