index.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. {extend name="common/base"/}
  2. {block name="style"}
  3. <style>
  4. .footer{
  5. width: 100%;
  6. height: 25px;
  7. text-align: center;
  8. position: fixed;
  9. bottom: 0;
  10. }
  11. #imgdel {
  12. font-size: 30px;
  13. position: absolute;
  14. top: -30px;
  15. right: -12px;
  16. display: none;
  17. color: red;
  18. }
  19. </style>
  20. {/block}
  21. <!-- 主体 -->
  22. {block name="body"}
  23. <form class="layui-form p-4">
  24. <h3 class="pb-3">基础信息</h3>
  25. {if $unit_type==2}
  26. <table class="layui-table layui-table-form">
  27. <tr>
  28. <td class="layui-td-gray-2">公司名称</td>
  29. <td><input type="text" name="title" lay-verify="" lay-reqText="请完善名称" value="{$detail.title}" readonly
  30. autocomplete="off" placeholder="请输入名称" class="layui-input"></td>
  31. <td class="layui-td-gray-2">公司类型</td>
  32. <td><input type="text" name="company_type" lay-verify="" lay-reqText="请完善公司类型"
  33. value="{$detail.company_type}"
  34. autocomplete="off" placeholder="请输入公司类型" class="layui-input"></td>
  35. <td class="layui-td-gray-2">公司联系电话</td>
  36. <td>
  37. <input type="text" name="phone" value="{$detail.phone}" placeholder="请输入部门联系电话,可空"
  38. autocomplete="off" class="layui-input">
  39. </td>
  40. <td rowspan="3" class="layui-td-gray-2">公司logo</td>
  41. <td rowspan="3" valign="top" style="width: 160px;">
  42. <div class="layui-upload" style="width: 100px; margin:0 auto">
  43. <div class="layui-upload-list" id="demo1" style="width: 100%; height:100px;">
  44. <img src="{if empty($detail.thumb)}/static/home/images/upload.png{else}{$detail.thumb}{/if}"
  45. height="100" style="max-width: 100%; width: 100%;"/>
  46. <input type="hidden" name="thumb" value="">
  47. <i class="layui-icon layui-icon-clear" id="imgdel"></i>
  48. </div>
  49. <button type="button" class="layui-btn layui-btn-normal" style="width: 100%;" id="uploadBtn">
  50. 上传logo
  51. </button>
  52. </div>
  53. </td>
  54. </tr>
  55. <tr>
  56. <td class="layui-td-gray-2">公司联系座机</td>
  57. <td>
  58. <input type="text" name="landline" value="{$detail.landline}" placeholder="请输入公司联系座机,可空"
  59. autocomplete="off" class="layui-input">
  60. </td>
  61. <td class="layui-td-gray-2">公司联系邮箱</td>
  62. <td>
  63. <input type="text" name="email" value="{$detail.email}" placeholder="请输入公司联系邮箱,可空"
  64. autocomplete="off" class="layui-input">
  65. </td>
  66. <td class="layui-td-gray-4">公司地址</td>
  67. <td><input type="text" name="address" lay-verify="" lay-reqText="请完善公司地址" value="{$detail.address}"
  68. autocomplete="off" placeholder="请输入公司地址" 1 class="layui-input"></td>
  69. </tr>
  70. </table>
  71. <div class="pt-3">
  72. <input type="hidden" name="" value="0"/>
  73. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  74. </div>
  75. {elseif $unit_type==0 }
  76. <table class="layui-table layui-table-form">
  77. <tr>
  78. <td class="layui-td-gray-2">财政局名称</td>
  79. <td><input type="text" name="title" lay-verify="" lay-reqText="请完善名称" value="{$detail.title}" readonly
  80. autocomplete="off" placeholder="请输入名称" class="layui-input"></td>
  81. <td class="layui-td-gray-2">财政局联系电话</td>
  82. <td>
  83. <input type="text" name="phone" value="{$detail.phone}" placeholder="请输入部门联系电话,可空"
  84. autocomplete="off" class="layui-input">
  85. </td>
  86. <td class="layui-td-gray-2">财政局联系座机</td>
  87. <td>
  88. <input type="text" name="landline" value="{$detail.landline}" placeholder="请输入财政局联系座机,可空"
  89. autocomplete="off" class="layui-input">
  90. </td>
  91. <td rowspan="3" class="layui-td-gray-2">财政局logo</td>
  92. <td rowspan="3" valign="top" style="width: 160px;">
  93. <div class="layui-upload" style="width: 100px; margin:0 auto">
  94. <div class="layui-upload-list" id="demo1" style="width: 100%; height:100px;">
  95. <img src="{if empty($detail.thumb)}/static/home/images/upload.png{else}{$detail.thumb}{/if}"
  96. height="100" style="max-width: 100%; width: 100%;"/>
  97. <input type="hidden" name="thumb" value="">
  98. <i class="layui-icon layui-icon-clear" id="imgdel"></i>
  99. </div>
  100. <button type="button" class="layui-btn layui-btn-normal" style="width: 100%;" id="uploadBtn">
  101. 上传logo
  102. </button>
  103. </div>
  104. </td>
  105. </tr>
  106. <tr>
  107. <td class="layui-td-gray-2">财政局联系邮箱</td>
  108. <td>
  109. <input type="text" name="email" value="{$detail.email}" placeholder="请输入财政局联系邮箱,可空"
  110. autocomplete="off" class="layui-input">
  111. </td>
  112. <td class="layui-td-gray-4">财政局地址</td>
  113. <td><input type="text" name="address" lay-verify="" lay-reqText="请完善财政局地址" value="{$detail.address}"
  114. autocomplete="off" placeholder="请输入财政局地址" 1 class="layui-input"></td>
  115. </tr>
  116. </table>
  117. <div class="pt-3">
  118. <input type="hidden" name="" value="0"/>
  119. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  120. </div>
  121. {elseif $unit_type==1}
  122. <table class="layui-table layui-table-form">
  123. <tr>
  124. <td class="layui-td-gray-2">单位名称</td>
  125. <td><input type="text" name="title" lay-verify="" lay-reqText="请完善名称" value="{$detail.title}" readonly
  126. autocomplete="off" placeholder="请输入名称" class="layui-input"></td>
  127. <td class="layui-td-gray-2">单位联系电话</td>
  128. <td>
  129. <input type="text" name="phone" value="{$detail.phone}" placeholder="请输入单位联系电话,可空"
  130. autocomplete="off" class="layui-input">
  131. </td>
  132. <td class="layui-td-gray-2">单位联系座机</td>
  133. <td>
  134. <input type="text" name="landline" value="{$detail.landline}" placeholder="请输入单位联系座机,可空"
  135. autocomplete="off" class="layui-input">
  136. </td>
  137. <td rowspan="3" class="layui-td-gray-2">单位logo</td>
  138. <td rowspan="3" valign="top" style="width: 160px;">
  139. <div class="layui-upload" style="width: 100px; margin:0 auto">
  140. <div class="layui-upload-list" id="demo1" style="width: 100%; height:100px;">
  141. <img src="{if empty($detail.thumb)}/static/home/images/upload.png{else}{$detail.thumb}{/if}"
  142. height="100" style="max-width: 100%; width: 100%;"/>
  143. <input type="hidden" name="thumb" value="">
  144. <i class="layui-icon layui-icon-clear" id="imgdel"></i>
  145. </div>
  146. <button type="button" class="layui-btn layui-btn-normal" style="width: 100%;" id="uploadBtn">
  147. 上传logo
  148. </button>
  149. </div>
  150. </td>
  151. </tr>
  152. <tr>
  153. <td class="layui-td-gray-2">单位联系邮箱</td>
  154. <td>
  155. <input type="text" name="email" value="{$detail.email}" placeholder="请输入单位联系邮箱,可空"
  156. autocomplete="off" class="layui-input">
  157. </td>
  158. <td class="layui-td-gray-4">单位地址</td>
  159. <td><input type="text" name="address" lay-verify="" lay-reqText="请完善单位地址" value="{$detail.address}"
  160. autocomplete="off" placeholder="请输入单位地址" 1 class="layui-input"></td>
  161. </tr>
  162. </table>
  163. <div class="pt-3">
  164. <input type="hidden" name="" value="0"/>
  165. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  166. </div>
  167. {else}
  168. <div>无需设置</div>
  169. {/if}
  170. </form>
  171. {/block}
  172. <!-- /主体 -->
  173. <!-- 脚本 -->
  174. {block name="script"}
  175. <script>
  176. var moduleInit = ['tool', 'employeepicker'];
  177. function gouguInit() {
  178. var form = layui.form, tool = layui.tool, upload = layui.upload;
  179. var uploadInst = upload.render({
  180. elem: '#uploadBtn'
  181. , url: '/admin/api/upload'
  182. , done: function (e) {
  183. //如果上传失败
  184. if (e.code == 1) {
  185. return layer.msg('上传失败');
  186. }
  187. //上传成功
  188. $('#demo1 input').attr('value', e.data.filepath);
  189. $('#demo1 img').attr('src', e.data.filepath);
  190. $('#imgdel').show();
  191. }
  192. });
  193. $('#imgdel').click(() => {
  194. $('#demo1 input').attr('value', '');
  195. $('#demo1 img').attr('src', '/static/home/images/upload.png');
  196. $('#imgdel').hide();
  197. return false;
  198. })
  199. let a = 1;
  200. //监听提交
  201. form.on('submit(webform)', function (data) {
  202. console.log(data.field);
  203. delete data.field.file;
  204. let callback = function (e) {
  205. layer.msg(e.msg);
  206. if (e.code == 0) {
  207. setTimeout(function () {
  208. window.location.reload()
  209. a = 1
  210. }, 2000)
  211. }
  212. }
  213. tool.post('edit', data.field, callback)
  214. a = 0
  215. return false;
  216. });
  217. }
  218. </script>
  219. {/block}
  220. <!-- /脚本 -->