add.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <form class="layui-form p-4">
  5. <h3 class="pb-3">岗位职称</h3>
  6. {if condition="$id eq 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-3">岗位工时单价(元)<font>*</font></td>
  14. <td>
  15. <input type="text" name="work_price" lay-verify="required|number" placeholder="请输入岗位工时单价" lay-reqText="请输入岗位工时单价" autocomplete="off" class="layui-input">
  16. </td>
  17. </tr>
  18. <tr>
  19. <td class="layui-td-gray">状态<font>*</font></td>
  20. <td colspan="3">
  21. <input type="radio" name="status" value="1" title="正常" checked>
  22. <input type="radio" name="status" value="0" title="禁用">
  23. </td>
  24. </tr>
  25. <tr>
  26. <td class="layui-td-gray">岗位备注</td>
  27. <td colspan="3">
  28. <textarea name="remark" placeholder="请输入岗位备注" class="layui-textarea"></textarea>
  29. </td>
  30. </tr>
  31. </table>
  32. {else/}
  33. <table class="layui-table layui-table-form">
  34. <tr>
  35. <td class="layui-td-gray">岗位名称<font>*</font></td>
  36. <td>
  37. <input type="text" name="title" value="{$detail.title}" lay-verify="required" autocomplete="off" placeholder="请输入岗位名称" lay-reqText="请输入岗位名称" class="layui-input">
  38. </td>
  39. <td class="layui-td-gray-3">岗位工时单价(元)<font>*</font></td>
  40. <td>
  41. <input type="text" name="work_price" value="{$detail.work_price}" lay-verify="required|number" placeholder="请输入岗位工时单价" lay-reqText="请输入岗位工时单价" autocomplete="off" class="layui-input">
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="layui-td-gray">状态<font>*</font></td>
  46. <td colspan="3">
  47. <input type="radio" name="status" value="1" title="正常" {eq name="$detail.status" value="1"}checked{/eq}>
  48. <input type="radio" name="status" value="0" title="禁止" {eq name="$detail.status" value="0"}checked{/eq}>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td class="layui-td-gray">岗位备注</td>
  53. <td colspan="3">
  54. <textarea name="remark" placeholder="请输入岗位备注" class="layui-textarea">{$detail.remark}</textarea>
  55. </td>
  56. </tr>
  57. </table>
  58. {/if}
  59. <div class="py-3">
  60. <input type="hidden" name="id" value="{$id}">
  61. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  62. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  63. </div>
  64. </form>
  65. {/block}
  66. <!-- /主体 -->
  67. <!-- 脚本 -->
  68. {block name="script"}
  69. <script>
  70. const moduleInit = ['tool'];
  71. function gouguInit() {
  72. var form = layui.form,tool=layui.tool;
  73. form.on('submit(webform)', function(data){
  74. let callback = function (e) {
  75. layer.msg(e.msg);
  76. if (e.code == 0) {
  77. setTimeout(function () {
  78. parent.location.reload();
  79. }, 1000);
  80. }
  81. }
  82. tool.post("/admin/position/add", data.field, callback);
  83. return false;
  84. });
  85. //监听提交
  86. form.on('submit(webform)', function(data){
  87. let callback = function (e) {
  88. layer.msg(e.msg);
  89. if (e.code == 0) {
  90. parent.layui.tool.close(1000);
  91. }
  92. }
  93. tool.post("/admin/position/add", data.field, callback);
  94. return false;
  95. });
  96. }
  97. </script>
  98. {/block}
  99. <!-- /脚本 -->