add.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. {extend name="common/base"/}
  2. {block name="style"}
  3. <style>
  4. .footer{
  5. display: none;
  6. }
  7. </style>
  8. {/block}
  9. {block name="body"}
  10. <form class="layui-form p-4">
  11. <h3 class="pb-3">新建记录</h3>
  12. <table class="layui-table layui-table-form">
  13. <tr>
  14. <td class="layui-td-gray">关联项目<font>*</font></td>
  15. <td>
  16. <input type="text" name="project_name" lay-verify="required" lay-reqText="" placeholder="请输入文档名称"
  17. class="layui-input" value="{$project.project_name}" readonly>
  18. <input type="hidden" name="project_id" lay-verify="required" lay-reqText="" placeholder="请输入文档名称"
  19. 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"></textarea>
  27. </td>
  28. </tr>
  29. </table>
  30. <div class="pt-3">
  31. <input type="hidden" name="id" value=""/>
  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. var file_id;
  45. //编辑器初始化
  46. var editor = layui.tinymce;
  47. var edit = editor.render({
  48. selector: "#container_content",
  49. height: 500
  50. });
  51. let a = 1;
  52. //监听提交
  53. form.on('submit(webform)', function (data) {
  54. data.field.content = tinyMCE.editors['container_content'].getContent();
  55. if (data.field.content == '') {
  56. layer.msg('请先完善文章内容');
  57. return false;
  58. }
  59. if(a){
  60. let callback = function (e) {
  61. layer.msg(e.msg);
  62. parent.layui.recordTable.reload();
  63. if (e.code == 0) {
  64. tool.tabRefresh(71);
  65. tool.sideClose(1000);
  66. a = 1
  67. }
  68. }
  69. tool.post("/admin/project.record/add", data.field, callback);
  70. }
  71. a = 0
  72. return false;
  73. });
  74. }
  75. </script>
  76. {/block}