edit.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {extend name="common/base"/}
  2. {block name="style"}
  3. <style>
  4. .layui-layer-content {
  5. }
  6. .footer{
  7. display: none;
  8. }
  9. </style>
  10. {/block}
  11. {block name="body"}
  12. <form class="layui-form p-4">
  13. <h3 class="pb-3">新建文档</h3>
  14. <table class="layui-table layui-table-form">
  15. <tr>
  16. <td class="layui-td-gray">关联项目<font>*</font></td>
  17. <td>
  18. <input type="text" name="project_name" lay-verify="required" lay-reqText="" placeholder="请输入文档名称" class="layui-input" value="{$project.project_name}" readonly>
  19. <input type="hidden" name="project_id" lay-verify="required" lay-reqText="" placeholder="请输入文档名称" class="layui-input" value="{$project.id}" readonly>
  20. </td>
  21. </tr>
  22. <tr>
  23. <td class="layui-td-gray" style="vertical-align:top;">文档内容<font>*</font></td>
  24. <td colspan="5">
  25. <textarea name="content" placeholder="请输入内容" class="layui-textarea" id="container_content"
  26. style="border:0;padding:0">{$detail.content}</textarea>
  27. </td>
  28. </tr>
  29. </table>
  30. <div class="pt-3">
  31. <input type="hidden" name="id" value="{$detail.id}"/>
  32. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  33. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  34. </div>
  35. </form>
  36. {/block}
  37. <!-- /主体 -->
  38. <!-- 脚本 -->
  39. {block name="script"}
  40. <script>
  41. const moduleInit = ['tool', 'tagpicker', 'tinymce', 'oaTool'];
  42. function gouguInit() {
  43. var form = layui.form, tool = layui.tool, oaTool = layui.oaTool;
  44. //编辑器初始化
  45. var editor = layui.tinymce;
  46. var edit = editor.render({
  47. selector: "#container_content",
  48. height: 500
  49. });
  50. let a = 1;
  51. //监听提交
  52. form.on('submit(webform)', function (data) {
  53. data.field.content = tinyMCE.editors['container_content'].getContent();
  54. if (data.field.content == '') {
  55. layer.msg('请先完善文章内容');
  56. return false;
  57. }
  58. if(a){
  59. let callback = function (e) {
  60. parent.layui.recordTable.reload();
  61. layer.msg(e.msg);
  62. if (e.code == 0) {
  63. tool.tabRefresh(71);
  64. tool.sideClose(1000);
  65. a = 1
  66. }
  67. }
  68. tool.post("/admin/project.record/edit", data.field, callback);
  69. }
  70. a = 0
  71. return false;
  72. })
  73. }
  74. </script>
  75. {/block}