9ad67067080adbd051d2c412ba42881d.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php /*a:1:{s:73:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\setting\system_config\create.php";i:1595820902;}*/ ?>
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title><?=$form->getTitle()?></title>
  7. <script src="/static/plug/vue/dist/vue.min.js"></script>
  8. <link href="/static/plug/iview/dist/styles/iview.css" rel="stylesheet">
  9. <script src="/static/plug/iview/dist/iview.min.js"></script>
  10. <script src="/static/plug/jquery/jquery.min.js"></script>
  11. <script src="/static/plug/form-create/province_city.js"></script>
  12. <script src="/static/plug/form-create/form-create.min.js"></script>
  13. <link href="/static/plug/layui/css/layui.css" rel="stylesheet">
  14. <script src="/static/plug/layui/layui.all.js"></script>
  15. <style>
  16. /*弹框样式修改*/
  17. .ivu-modal{top: 20px;}
  18. .ivu-modal .ivu-modal-body{padding: 10px;}
  19. .ivu-modal .ivu-modal-body .ivu-modal-confirm-head{padding:0 0 10px 0;}
  20. .ivu-modal .ivu-modal-body .ivu-modal-confirm-footer{display: none;padding-bottom: 10px;}
  21. .ivu-date-picker {display: inline-block;line-height: normal;width: 280px;}
  22. .ivu-modal-footer{display: none;}
  23. </style>
  24. </head>
  25. <body>
  26. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  27. <ul class="layui-tab-title">
  28. <li <?php if($get['type'] == 0): ?>class="layui-this"<?php endif; ?>><a href="<?php echo Url('create',array('tab_id'=>app('request')->param('tab_id'),'type'=>0)); ?>">文本框</a> </li>
  29. <li <?php if($get['type'] == 1): ?>class="layui-this"<?php endif; ?>><a href="<?php echo Url('create',array('tab_id'=>app('request')->param('tab_id'),'type'=>1)); ?>">多行文本框</a> </li>
  30. <li <?php if($get['type'] == 2): ?>class="layui-this"<?php endif; ?>><a href="<?php echo Url('create',array('tab_id'=>app('request')->param('tab_id'),'type'=>2)); ?>">单选框</a></li>
  31. <li <?php if($get['type'] == 3): ?>class="layui-this"<?php endif; ?>><a href="<?php echo Url('create',array('tab_id'=>app('request')->param('tab_id'),'type'=>3)); ?>">文件上传</a></li>
  32. <li <?php if($get['type'] == 4): ?>class="layui-this"<?php endif; ?>><a href="<?php echo Url('create',array('tab_id'=>app('request')->param('tab_id'),'type'=>4)); ?>">多选框</a></li>
  33. <li <?php if($get['type'] == 5): ?>class="layui-this"<?php endif; ?>><a href="<?php echo Url('create',array('tab_id'=>app('request')->param('tab_id'),'type'=>5)); ?>">下拉框</a></li>
  34. </ul>
  35. <div class="layui-tab-content" style="height: 100px;">
  36. <div class="layui-tab-item layui-show" id="formdiv">
  37. </div>
  38. </div>
  39. </div>
  40. <script>
  41. // formCreate.formSuccess = function(form,$r){
  42. // <?php echo '<?'; ?>
  43. //=$form->getSuccessScript()?>
  44. // $f.btn.loading(false)();
  45. // };
  46. (function () {
  47. var create = (function () {
  48. var getRule = function () {
  49. var rule = <?=json_encode($form->getRules())?>;
  50. rule.forEach(function (c) {
  51. if ((c.type == 'cascader' || c.type == 'tree') && Object.prototype.toString.call(c.props.data) == '[object String]') {
  52. if (c.props.data.indexOf('js.') === 0) {
  53. c.props.data = window[c.props.data.replace('js.', '')];
  54. }
  55. }
  56. });
  57. return rule;
  58. }, vm = new Vue,name = 'formBuilderExec<?= !$form->getId() ? '' : '_'.$form->getId() ?>';
  59. var _b = false;
  60. window[name] = function create(el, callback) {
  61. if(_b) return ;
  62. _b = true;
  63. if (!el) el = document.getElementById('formdiv');
  64. var $f = formCreate.create(getRule(), {
  65. el: el,
  66. form:<?=json_encode($form->getConfig('form'))?>,
  67. row:<?=json_encode($form->getConfig('row'))?>,
  68. submitBtn:<?=$form->isSubmitBtn() ? '{}' : 'false'?>,
  69. resetBtn:<?=$form->isResetBtn() ? 'true' : '{}'?>,
  70. iframeHelper:true,
  71. global:{
  72. upload: {
  73. props:{
  74. onExceededSize: function (file) {
  75. vm.$Message.error(file.name + '超出指定大小限制');
  76. },
  77. onFormatError: function () {
  78. vm.$Message.error(file.name + '格式验证失败');
  79. },
  80. onError: function (error) {
  81. vm.$Message.error(file.name + '上传失败,(' + error + ')');
  82. },
  83. onSuccess: function (res, file) {
  84. if (res.code == 200) {
  85. file.url = res.data.filePath;
  86. } else {
  87. vm.$Message.error(res.msg);
  88. }
  89. },
  90. },
  91. },
  92. },
  93. //表单提交事件
  94. onSubmit: function (formData) {
  95. $f.btn.loading(true);
  96. $.ajax({
  97. url: '<?=$form->getAction()?>',
  98. type: '<?=$form->getMethod()?>',
  99. dataType: 'json',
  100. data: formData,
  101. success: function (res) {
  102. if (res.code == 200) {
  103. vm.$Message.success(res.msg);
  104. $f.btn.loading(false);
  105. formCreate.formSuccess && formCreate.formSuccess(res, $f, formData);
  106. callback && callback(0, res, $f, formData);
  107. //TODO 表单提交成功!
  108. } else {
  109. vm.$Message.error(res.msg || '表单提交失败');
  110. $f.btn.loading(false);
  111. callback && callback(1, res, $f, formData);
  112. //TODO 表单提交失败
  113. }
  114. },
  115. error: function () {
  116. vm.$Message.error('表单提交失败');
  117. $f.btn.loading(false);
  118. }
  119. });
  120. }
  121. });
  122. return $f;
  123. };
  124. return window[name];
  125. }());
  126. create();
  127. })();
  128. </script>
  129. </body>
  130. </html>