officeintroduceForm.jsp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <%@ page import="com.jeeplus.modules.sys.utils.UserUtils" %>
  2. <%@ page contentType="text/html;charset=UTF-8" %>
  3. <%@ include file="/webpage/include/taglib.jsp"%>
  4. <html>
  5. <head>
  6. <title>企业介绍管理</title>
  7. <meta name="decorator" content="default"/>
  8. <style type="text/css">
  9. img{width: 50px;height: 50px;}
  10. </style>
  11. <script type="text/javascript">
  12. var validateForm;
  13. function doSubmit(){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
  14. if(validateForm.form()){
  15. if($("#file_attachment tr").length==0){
  16. top.layer.alert('请上传企业介绍附件!', {icon: 0});
  17. return;
  18. }
  19. if($("#file_attachment tr").length>1){
  20. top.layer.alert('仅可以上传一个附件!', {icon: 0});
  21. return;
  22. }
  23. $("#inputForm").submit();
  24. return true;
  25. }
  26. return false;
  27. }
  28. $(document).ready(function() {
  29. validateForm = $("#inputForm").validate({
  30. submitHandler: function(form){
  31. loading('正在提交,请稍等...');
  32. form.submit();
  33. },
  34. errorContainer: "#messageBox",
  35. errorPlacement: function(error, element) {
  36. $("#messageBox").text("输入有误,请先更正。");
  37. if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
  38. error.appendTo(element.parent().parent());
  39. } else {
  40. error.insertAfter(element);
  41. }
  42. }
  43. });
  44. laydate.render({
  45. elem: '#uploadDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
  46. event: 'focus' //响应事件。如果没有传入event,则按照默认的click
  47. });
  48. $("#attachment_btn").click(function () {
  49. if($("#file_attachment tr").length>0){
  50. top.layer.alert('仅可以上传一个附件', {icon: 0});
  51. return;
  52. }
  53. $("#attachment_file").click();
  54. });
  55. });
  56. function insertTitle(tValue){
  57. var list = "${officeintroduce.workAttachments}";
  58. var size = (list.split('url')).length-1;
  59. var files = $("#attachment_file")[0].files; for(var i = 0;i<files.length;i++) { var file = files[i];
  60. console.log("文件大小"+file.size);
  61. if(file.size >200000){
  62. top.layer.alert('文件大小限制在200K以内!', {icon: 0});
  63. return;
  64. }
  65. var attachmentId = "";
  66. var attachmentFlag = "111";
  67. console.log(file);
  68. var timestamp=new Date().getTime();
  69. var storeAs = "attachment-file/officeintroduce/"+timestamp+"/"+file['name'];
  70. var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
  71. var divId = "_attachment";
  72. $("#addFile"+divId).show();
  73. multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);}
  74. }
  75. //------------------上传图片-暂弃----------------------
  76. /*function next_upload_image_button(index){
  77. $("#next_upload_file_"+index).click();
  78. }
  79. function next_upload_show_image(index){
  80. var obj =$("#next_upload_file_"+index)[0].files[0];
  81. var fileType = obj.type;
  82. var url ;
  83. if(fileType.endsWith("png")||fileType.endsWith("bmp")||fileType.endsWith("jpg")||fileType.endsWith("jpeg")||fileType.endsWith("gif")){
  84. url = window.URL.createObjectURL(obj);
  85. }else {
  86. $("#next_upload_msg").css({"color":"red"});
  87. next_close_img(index);
  88. return false ;
  89. }
  90. $("#next_upload_msg").removeAttr("style");
  91. $("#next_upload_image_"+index).attr("src",url);
  92. var length = $("#next_upload_image_div :file").length;
  93. if( index == length && length < 1 ){
  94. next_upload_image_append(index);
  95. next_add_x(index);
  96. }else if(index == length && length ==1){
  97. var span = '<span id="next_upload_close_'+index+'" class="close_ico" style="cursor:pointer; position: absolute;top:-1px;right: -1px; display:inline-block;z-index:1;color: red;" onclick="next_close_img('+index+');">x</span>';
  98. $("#next_upload_image_1").before(span);
  99. }
  100. }
  101. function next_upload_image_append(index){
  102. var div1 = "<div id='next_upload_div_"+(index+1)+"' style='float:left;position:relative;width: 57px;height: 57px;'>";
  103. var img = '<img id="next_upload_image_'+(index+1)+'" class="upload_ico" width="50px" height="50px" onclick="next_upload_image_button('+(index+1)+')" src = "${pageContext.request.contextPath}/static/uploadify/upload_ico.png" style="cursor:pointer;"/>';
  104. var input = '<input id="next_upload_file_'+(index+1)+'" type="file" style="display:none;" name="next_upload_files" onChange="next_upload_show_image('+(index+1)+')" /><br>';
  105. var div2 = "</div>";
  106. $("#next_upload_image_div").append(div1+img+input+div2);
  107. }
  108. function next_close_img(index) {
  109. $("#next_upload_div_"+index).remove();
  110. var length = $("#next_upload_image_div :file").length;
  111. if(length == 0){
  112. next_add_div();
  113. }else if(length == 1){
  114. var x = $("#next_upload_image_div").find("span").text();
  115. if("x" != x){
  116. next_add_div();
  117. }
  118. }
  119. }
  120. function next_add_x(index) {
  121. var span = '<span id="next_upload_close_'+index+'" class="close_ico" style="cursor:pointer; position: absolute;top:-1px;right: -1px; display:inline-block;z-index:1;color: red;" onclick="next_close_img('+index+');">x</span>';
  122. $("#next_upload_image_div").find("img:eq(-2)").before(span);
  123. }
  124. function next_add_div() {
  125. var next_upload_div_1 =
  126. '<div id="next_upload_div_1" style="float: left;position:relative;width: 57px;height: 57px;" >'+
  127. '<img id="next_upload_image_1" class="upload_ico" style="cursor:pointer;" src="${pageContext.request.contextPath}/static/uploadify/upload_ico.png" onclick="next_upload_image_button(1)"/>'+
  128. '<input id="next_upload_file_1" type="file" style="display:none" name="next_upload_files" onchange="next_upload_show_image(1)" /><br>'+
  129. '</div>';
  130. $("#next_upload_image_div").html("").append(next_upload_div_1);
  131. }*/
  132. /*-------------------------------*/
  133. </script>
  134. </head>
  135. <body>
  136. <div class="single-form">
  137. <div class="container">
  138. <form:form id="inputForm" modelAttribute="officeintroduce" action="${ctx}/officeintroduce/officeintroduce/save" method="post" class="form-horizontal"><%--enctype="multipart/form-data"--%>
  139. <form:hidden path="id"/>
  140. <form:hidden path="office.id" value="<%= UserUtils.getSelectOffice().getParent().getId()%>"/>
  141. <sys:message content="${message}"/>
  142. <div class="form-group layui-row first lw8">
  143. <div class="form-group-label"><h2>基础信息</h2></div>
  144. <div class="layui-item layui-col-sm6">
  145. <label class="layui-form-label">公司名称:</label>
  146. <div class="layui-input-block">
  147. <form:input path="companyName" htmlEscape="false" readonly="true" class="form-control layui-input"/>
  148. </div>
  149. </div>
  150. <div class="layui-item layui-col-sm6">
  151. <label class="layui-form-label">编号:</label>
  152. <div class="layui-input-block">
  153. <form:input path="num" htmlEscape="false" readonly="true" class="form-control layui-input"/>
  154. </div>
  155. </div>
  156. <div class="layui-item layui-col-sm6">
  157. <label class="layui-form-label lw8"><span class="require-item">*</span>介绍名称:</label>
  158. <div class="layui-input-block lw8">
  159. <form:input path="introduce" htmlEscape="false" class="form-control required layui-input"/>
  160. </div>
  161. </div>
  162. <div class="layui-item layui-col-sm6">
  163. <label class="layui-form-label">上传日期:</label>
  164. <div class="layui-input-block">
  165. <input class="laydate-icondate layui-input form-control layer-date laydate-icon" readonly="true" name="uploadDate"
  166. value="<fmt:formatDate value="${officeintroduce.uploadDate}" pattern="yyyy-MM-dd"/>">
  167. </div>
  168. </div>
  169. <div class="layui-item layui-col-sm12 with-textarea">
  170. <label class="layui-form-label">备注:</label>
  171. <div class="layui-input-block">
  172. <form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="form-control "/>
  173. </div>
  174. </div>
  175. </div>
  176. <div class="form-group layui-row">
  177. <div class="form-group-label"><h2>附件信息</h2></div>
  178. <div class="layui-item nav-btns">
  179. <a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
  180. </div>
  181. <div id="addFile_attachment" style="display: none" class="upload-progress">
  182. <span id="fileName_attachment" ></span>
  183. <b><span id="baifenbi_attachment" ></span></b>
  184. <div class="progress">
  185. <div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
  186. </div>
  187. </div>
  188. </div>
  189. <input id="attachment_file" type="file" name="attachment_file" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
  190. <span id="attachment_title"></span>
  191. <div class="layui-item layui-col-xs12" style="padding:0 16px;">
  192. <table id="upTable" class="table table-bordered table-condensed details">
  193. <thead>
  194. <tr>
  195. <%-- <th>序号</th>--%>
  196. <th>文件预览</th>
  197. <th>上传人</th>
  198. <th>上传时间</th>
  199. <th width="150px">操作</th>
  200. </tr>
  201. </thead>
  202. <tbody id="file_attachment">
  203. <c:forEach items="${officeintroduce.workAttachments}" var = "workClientAttachment" varStatus="status">
  204. <tr>
  205. <%-- <td>${status.index + 1}</td>--%>
  206. <c:choose>
  207. <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
  208. or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
  209. or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
  210. or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
  211. or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
  212. <td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
  213. </c:when>
  214. <c:otherwise>
  215. <c:choose>
  216. <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
  217. <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
  218. </c:when>
  219. <c:otherwise>
  220. <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
  221. </c:otherwise>
  222. </c:choose>
  223. </c:otherwise>
  224. </c:choose>
  225. <td>${workClientAttachment.createBy.name}</td>
  226. <td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
  227. <td class="op-td">
  228. <div class="op-btn-box" >
  229. <a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent(encodeURIComponent('${workClientAttachment.url}'));" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
  230. <c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
  231. <a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFile')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
  232. </c:if>
  233. </div>
  234. </td>
  235. </tr>
  236. </c:forEach>
  237. </tbody>
  238. </table>
  239. </div>
  240. </div>
  241. <div class="form-group layui-row page-end"></div>
  242. </form:form>
  243. </div>
  244. </div>
  245. </body>
  246. </html>