add.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <form class="layui-form p-4">
  5. <h3 class="pb-3">部门架构</h3>
  6. {eq name="$id" value="0"}
  7. <table class="layui-table">
  8. <tr>
  9. <td class="layui-td-gray">部门名称<font>*</font></td>
  10. <td>
  11. <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入部门名称" lay-reqText="请输入部门名称" class="layui-input">
  12. </td>
  13. <td class="layui-td-gray">上级部门<font>*</font></td>
  14. <td>
  15. <select name="pid" lay-verify="required" lay-reqText="请选择上级部门">
  16. <option value="0">作为顶级部门</option>
  17. {volist name="department" id="v"}
  18. <option value="{$v.id}" {eq name="$pid" value="$v.id"} selected{/eq}>{$v.title}</option>
  19. {/volist}
  20. </select>
  21. </td>
  22. </tr>
  23. {if $permission == 1}
  24. <tr>
  25. <td class="layui-td-gray">单位类型:<font>*</font></td>
  26. <td>
  27. <input type="radio" name="type" value="-1" title="系统方" checked>
  28. <input type="radio" name="type" value="0" title="财政局">
  29. <input type="radio" name="type" value="1" title="业主">
  30. <input type="radio" name="type" value="2" title="公司">
  31. </td>
  32. </tr>
  33. {/if}
  34. <tr>
  35. <td class="layui-td-gray-2">部门联系电话</td>
  36. <td colspan="3">
  37. <input type="text" name="phone" placeholder="请输入部门联系电话,可空" autocomplete="off" class="layui-input">
  38. </td>
  39. </tr>
  40. </table>
  41. {else/}
  42. <table class="layui-table">
  43. <tr>
  44. <td class="layui-td-gray">部门名称<font>*</font></td>
  45. <td>
  46. <input type="text" name="title" value="{$detail.title}" lay-verify="required" autocomplete="off" placeholder="请输入部门名称" lay-reqText="请输入部门名称" class="layui-input">
  47. </td>
  48. <td class="layui-td-gray">上级部门<font>*</font></td>
  49. <td>
  50. <select name="pid" lay-verify="required" lay-reqText="请选择上级部门">
  51. <option value="0">作为顶级部门</option>
  52. {volist name="department" id="v"}
  53. <option value="{$v.id}" {eq name="$detail.pid" value="$v.id"} selected{/eq}>{$v.title}</option>
  54. {/volist}
  55. </select>
  56. </td>
  57. </tr>
  58. {if $permission == 1}
  59. <tr>
  60. <td class="layui-td-gray">单位类型:<font>*</font></td>
  61. <td>
  62. <input type="radio" name="type" value="-1" title="系统方" {eq name="$d_type" value="-1" }checked{/eq}>
  63. <input type="radio" name="type" value="0" title="财政局"{eq name="$d_type" value="0" }checked{/eq}>
  64. <input type="radio" name="type" value="1" title="业主"{eq name="$d_type" value="1" }checked{/eq}>
  65. <input type="radio" name="type" value="2" title="公司"{eq name="$d_type" value="2" }checked{/eq}>
  66. </td>
  67. </tr>
  68. {/if}
  69. <tr>
  70. <td class="layui-td-gray-2">部门负责人</td>
  71. <td>
  72. <select name="leader_id">
  73. <option value="0">请选择部门负责人</option>
  74. {volist name="users" id="v"}
  75. <option value="{$v.id}" {eq name="detail.leader_id" value="$v.id"} selected{/eq}>{$v.nickname}</option>
  76. {/volist}
  77. </select>
  78. </td>
  79. <td class="layui-td-gray-2">部门联系电话</td>
  80. <td>
  81. <input type="text" name="phone" value="{$detail.phone}" placeholder="请输入部门联系电话,可空" autocomplete="off" class="layui-input">
  82. </td>
  83. </tr>
  84. </table>
  85. {/eq}
  86. <div class="py-3">
  87. <input type="hidden" name="id" value="{$id}">
  88. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  89. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  90. </div>
  91. </form>
  92. {/block}
  93. <!-- /主体 -->
  94. <!-- 脚本 -->
  95. {block name="script"}
  96. <script>
  97. const moduleInit = ['tool'];
  98. function gouguInit() {
  99. var form = layui.form,tool=layui.tool;
  100. let a = 1;
  101. //监听提交
  102. form.on('submit(webform)', function(data){
  103. if(a){
  104. let callback = function (e) {
  105. layer.msg(e.msg);
  106. if (e.code == 0) {
  107. setTimeout(function () {
  108. parent.location.reload();
  109. a = 1
  110. }, 1000);
  111. }
  112. }
  113. tool.post("/admin/department/add", data.field, callback);
  114. }
  115. a = 0
  116. return false;
  117. });
  118. }
  119. </script>
  120. {/block}
  121. <!-- /脚本 -->