index.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title><?=$form->getTitle()?></title>
  6. <link href="{__FRAME_PATH}/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
  7. <link href="{__ADMIN_PATH}/css/layui-admin.css" rel="stylesheet">
  8. <link href="{__FRAME_PATH}/css/style.min.css?v=3.0.0" rel="stylesheet">
  9. <link href="{__FRAME_PATH}css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
  10. <script src="{__PLUG_PATH}vue/dist/vue.min.js"></script>
  11. <link href="{__PLUG_PATH}iview/dist/styles/iview.css" rel="stylesheet">
  12. <script src="{__PLUG_PATH}iview/dist/iview.min.js"></script>
  13. <script src="{__PLUG_PATH}jquery/jquery.min.js"></script>
  14. <script src="{__PLUG_PATH}form-create/province_city.js"></script>
  15. <script src="{__PLUG_PATH}form-create/form-create.min.js"></script>
  16. <link href="{__PLUG_PATH}layui/css/layui.css" rel="stylesheet">
  17. <script src="{__PLUG_PATH}layui/layui.all.js"></script>
  18. <style>
  19. /*弹框样式修改*/
  20. .ivu-modal{top: 20px;}
  21. .ivu-modal .ivu-modal-body{padding: 10px;}
  22. .ivu-modal .ivu-modal-body .ivu-modal-confirm-head{padding:0 0 10px 0;}
  23. .ivu-modal .ivu-modal-body .ivu-modal-confirm-footer{display: none;padding-bottom: 10px;}
  24. .ivu-date-picker {display: inline-block;line-height: normal;width: 280px;}
  25. .ivu-modal-footer{display: none;}
  26. .ivu-poptip-popper{text-align: left;}
  27. .ivu-icon{padding-left: 5px;}
  28. .ivu-btn-long{width: 10%;min-width:100px;margin-left: 18%;}
  29. </style>
  30. </head>
  31. <body class="gray-bg">
  32. <div class="wrapper wrapper-content">
  33. <div class="row">
  34. <div class="col-sm-12">
  35. <div class="ibox float-e-margins">
  36. {if condition="$config_tab eq null"}
  37. <div class="ibox-title">
  38. <h5>系统配置</h5>
  39. </div>
  40. {else/}
  41. <div class="tabs-container ibox-title gray-bg">
  42. <ul class="nav nav-tabs">
  43. {volist name="config_tab" id="vo"}
  44. <li {if condition="$vo['id'] eq $tab_id"} class="active" {/if}><a href="{:Url('index',array('tab_id'=>$vo['id'],'type'=>$vo['type'],'pid'=>0))}"><i class="fa fa-{$vo.icon}"></i>{$vo.label}</a></li>
  45. {/volist}
  46. </ul>
  47. {/if}
  48. <div class="ibox-content">
  49. {if condition="$children_config_tab neq null"}
  50. <div class="tabs-container">
  51. <ul class="nav nav-tabs">
  52. {volist name="children_config_tab" id="voo"}
  53. <li {if condition="$voo['id'] eq $children_tab_id"} class="active" {/if}><a href="{:Url('index',array('tab_id'=>$voo['pid'],'type'=>$voo['type'],'children_tab_id'=>$voo['id']))}"><i class="fa fa-{$voo.icon}"></i>{$voo.label}</a></li>
  54. {/volist}
  55. </ul>
  56. </div>
  57. {/if}
  58. <div class="p-m m-t-sm" id="configboay">
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </body>
  66. <script>
  67. formCreate.formSuccess = function(form,$r){
  68. <?=$form->getSuccessScript()?>
  69. $r.btn.loading(false);
  70. };
  71. (function () {
  72. var create = (function () {
  73. var getRule = function () {
  74. var rule = <?=json_encode($form->getRules())?>;
  75. rule.forEach(function (c) {
  76. if ((c.type == 'cascader' || c.type == 'tree') && Object.prototype.toString.call(c.props.data) == '[object String]') {
  77. if (c.props.data.indexOf('js.') === 0) {
  78. c.props.data = window[c.props.data.replace('js.', '')];
  79. }
  80. }
  81. });
  82. return rule;
  83. }, vm = new Vue,name = 'formBuilderExec<?= !$form->getId() ? '' : '_'.$form->getId() ?>';
  84. var _b = false;
  85. window[name] = function create(el, callback) {
  86. if(_b) return ;
  87. _b = true;
  88. if (!el) el = document.getElementById('configboay');
  89. var $f = formCreate.create(getRule(), {
  90. el: el,
  91. form:<?=json_encode($form->getConfig('form'))?>,
  92. row:<?=json_encode($form->getConfig('row'))?>,
  93. submitBtn:<?=$form->isSubmitBtn() ? '{}' : 'false'?>,
  94. resetBtn:<?=$form->isResetBtn() ? 'true' : '{}'?>,
  95. iframeHelper:true,
  96. global:{
  97. upload: {
  98. props:{
  99. onExceededSize: function (file) {
  100. vm.$Message.error(file.name + '超出指定大小限制');
  101. },
  102. onFormatError: function () {
  103. vm.$Message.error(file.name + '格式验证失败');
  104. },
  105. onError: function (error) {
  106. vm.$Message.error(file.name + '上传失败,(' + error + ')');
  107. },
  108. onSuccess: function (res, file) {
  109. if (res.code == 200) {
  110. file.url = res.data.filePath;
  111. } else {
  112. vm.$Message.error(res.msg);
  113. }
  114. },
  115. },
  116. },
  117. },
  118. //表单提交事件
  119. onSubmit: function (formData) {
  120. $f.btn.loading(true);
  121. $.ajax({
  122. url: '<?=$form->getAction()?>',
  123. type: '<?=$form->getMethod()?>',
  124. dataType: 'json',
  125. data: formData,
  126. success: function (res) {
  127. if (res.code == 200) {
  128. vm.$Message.success(res.msg);
  129. $f.btn.loading(false);
  130. formCreate.formSuccess && formCreate.formSuccess(res, $f, formData);
  131. callback && callback(0, res, $f, formData);
  132. //TODO 表单提交成功!
  133. } else {
  134. vm.$Message.error(res.msg || '表单提交失败');
  135. $f.btn.loading(false);
  136. callback && callback(1, res, $f, formData);
  137. //TODO 表单提交失败
  138. }
  139. },
  140. error: function () {
  141. vm.$Message.error('表单提交失败');
  142. $f.btn.loading(false);
  143. }
  144. });
  145. }
  146. });
  147. return $f;
  148. };
  149. return window[name];
  150. }());
  151. window.$f = create();
  152. })();
  153. </script>
  154. </html>