edit.html 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {extend name="common/base"/}
  2. {block name="style"}
  3. <style>
  4. .layui-layer-content{color: #2d2d2d;}
  5. </style>
  6. {/block}
  7. {block name="body"}
  8. <form class="layui-form p-4">
  9. <h3 class="pb-3">新建文档</h3>
  10. <table class="layui-table layui-table-form">
  11. <tr>
  12. <td class="layui-td-gray">文档名称<font>*</font></td>
  13. <td>
  14. <input type="text" name="title" lay-verify="required" lay-reqText="请输入文档名称" placeholder="请输入文档名称" class="layui-input" value="{$detail.title}">
  15. </td>
  16. <td class="layui-td-gray">关联项目<font>*</font></td>
  17. <td>
  18. <select id="projectId" name="type" lay-verify="required">
  19. <option value="">请选择报告类型</option>
  20. <option value="0" {eq name="$detail.type" value="0"} selected {/eq}>初审报告</option>
  21. <option value="1" {eq name="$detail.type" value="1"} selected {/eq}>对数报告</option>
  22. <option value="2" {eq name="$detail.type" value="2"} selected {/eq}>审定报告</option>
  23. </select>
  24. </td>
  25. </tr>
  26. <tr>
  27. <td class="layui-td-gray" style="vertical-align:top;">文档内容<font>*</font></td>
  28. <td colspan="5">
  29. <textarea name="content" placeholder="请输入内容" class="layui-textarea" id="container_content" style="border:0;padding:0">{$detail.content}</textarea>
  30. </td>
  31. </tr>
  32. </table>
  33. <div class="pt-3">
  34. <input type="hidden" name="id" value="{$detail.id}" />
  35. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  36. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  37. </div>
  38. </form>
  39. {/block}
  40. <!-- /主体 -->
  41. <!-- 脚本 -->
  42. {block name="script"}
  43. <script>
  44. const moduleInit = ['tool', 'tagpicker', 'tinymce','oaTool'];
  45. function gouguInit() {
  46. var form = layui.form,tool=layui.tool,oaTool = layui.oaTool;
  47. //编辑器初始化
  48. var editor = layui.tinymce;
  49. var edit = editor.render({
  50. selector: "#container_content",
  51. height: 500
  52. });
  53. let a = 1;
  54. //监听提交
  55. form.on('submit(webform)', function (data) {
  56. layer.confirm('<div style="color:red">提交后内容将无法更改,请检查内容是否准确无误!<br>点击”确认“按钮,提交报告</div>', {
  57. icon: 3,
  58. title: '提交确认'
  59. },function () {
  60. data.field.content = tinyMCE.editors['container_content'].getContent();
  61. if (data.field.content == '') {
  62. layer.msg('请先完善文章内容');
  63. return false;
  64. }
  65. if(a){
  66. let callback = function (e) {
  67. parent.layui.reportTable.reload();
  68. layer.msg(e.msg);
  69. if (e.code == 0) {
  70. tool.tabRefresh(71);
  71. tool.sideClose(1000);
  72. a = 1
  73. }
  74. }
  75. tool.post("/admin/project.report/add", data.field, callback);
  76. }
  77. })
  78. a = 0
  79. return false;
  80. });
  81. }
  82. </script>
  83. {/block}