policy_form.html 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <div class="layui-fluid">
  2. <div class="layui-row layui-col-space15">
  3. <div class="layui-col-md12">
  4. <div class="layui-card">
  5. <div class="layui-card-header">政策</div>
  6. <div class="layui-card-body" pad15>
  7. <div class="layui-form layui-form-pane" lay-filter="{$lay_table}">
  8. <input type="hidden" name="id" value="{:array_get($info,'id')}">
  9. <div class="layui-form-item">
  10. <label class="layui-form-label"><span style="color:#f90c05;">*</span>标题</label>
  11. <div class="layui-input-block">
  12. <input type="text" name="title" value="{:array_get($info,'title')}" lay-verify="required"
  13. placeholder="请输入标题" autocomplete="off"
  14. class="layui-input">
  15. </div>
  16. </div>
  17. <div class="layui-form-item" id="form-content">
  18. <label class="layui-form-label"><span style="color:#f90c05;">*</span>内容</label>
  19. <div class="layui-input-block">
  20. <script id="editor" type="text/plain">{:array_get($info,'content')}</script>
  21. </div>
  22. </div>
  23. <div class="layui-form-item">
  24. <label class="layui-form-label"><span style="color:#f90c05;">*</span>排序</label>
  25. <div class="layui-input-block">
  26. <input type="text" name="priority" value="{:array_get($info,'priority',255)}"
  27. lay-verify="required|number" placeholder="请输入排序"
  28. autocomplete="off" class="layui-input">
  29. <div class="layui-form-mid layui-word-aux">倒序,值越大越靠前</div>
  30. </div>
  31. </div>
  32. <div class="layui-form-item" pane>
  33. <label class="layui-form-label"><span style="color:#f90c05;">*</span>状态</label>
  34. <div class="layui-input-block">
  35. {volist name="status_list" id="v"}
  36. <input type="radio" name="status" value="{$key}" title="{$v}" {eq name=":array_get($info,'status',1)" value="$key" }checked{/eq}>
  37. {/volist}
  38. </div>
  39. </div>
  40. <div class="layui-form-item">
  41. <div class="layui-input-block">
  42. <input type="button" lay-submit lay-filter="{$lay_btn}" value="确认提交" class="layui-btn">
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. {include file="public/ueditor" /}
  52. <script>
  53. layui.use(['index', 'form', 'layedit', 'upload'], function () {
  54. const admin = layui.admin;
  55. const layedit = layui.layedit;
  56. const form = layui.form;
  57. form.render();
  58. const content = layedit.build('content', {
  59. uploadImage: { url: "{:url('upload/image')}", type: 'post' }
  60. });
  61. form.verify({
  62. editcontent: function (value) {
  63. layedit.sync(content);
  64. }
  65. });
  66. form.on('submit({$lay_btn})', function (obj) {
  67. const index = parent.layer.getFrameIndex(window.name);
  68. obj.field.content = UE.getEditor('editor').getContent();
  69. admin.req({
  70. url: "{:url('jfm/editPolicy')}",
  71. type: 'post',
  72. data: obj.field,
  73. done: function (res) {
  74. layer.msg("提交成功", {
  75. icon: 1
  76. });
  77. parent.layui.table.reload('lay-jfm-policy-table'); //重载表格
  78. parent.layer.close(index);
  79. }
  80. });
  81. });
  82. //延迟再调用赋值方法
  83. window.setTimeout(setContent,50);
  84. function setContent(){
  85. UE.getEditor('editor');
  86. }
  87. });
  88. </script>