ソースを参照

附件收藏部分代码

user5 4 年 前
コミット
bb09fd379e

+ 38 - 0
src/main/java/com/jeeplus/modules/projectAccessory/entity/CollectAccessoryInfo.java

@@ -0,0 +1,38 @@
+package com.jeeplus.modules.projectAccessory.entity;
+
+import com.jeeplus.common.persistence.DataEntity;
+
+/**
+ * @author: 大猫
+ * @create: 2021-05-25 16:34
+ **/
+public class CollectAccessoryInfo extends DataEntity<CollectAccessoryInfo> {
+
+    private String url;
+    private String userId;
+    private String type;
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+}

+ 15 - 0
src/main/java/com/jeeplus/modules/projectAccessory/service/ProjectAccessoryService.java

@@ -8,6 +8,7 @@ import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.service.TreeService;
 import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.modules.projectAccessory.dao.ProjectAccessoryDao;
+import com.jeeplus.modules.projectAccessory.entity.CollectAccessoryInfo;
 import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryInfo;
 import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryTree;
 import com.jeeplus.modules.sys.entity.Office;
@@ -287,4 +288,18 @@ public class ProjectAccessoryService extends TreeService<ProjectAccessoryDao, Pr
         long t2 = System.currentTimeMillis();
         System.out.println("上传文件service层消耗时间:" + (t2-t1));
     }
+
+    /**
+     * 新增收藏信息接口
+     * @param collectAccessoryInfo
+     */
+    @Transactional(readOnly = false)
+    public Integer saveCollectAccessory(CollectAccessoryInfo collectAccessoryInfo){
+        //添加收藏人id
+        collectAccessoryInfo.setUserId(UserUtils.getUser().getId());
+        //判断收藏类型(1:个人收藏;2:部门收藏;3:公司收藏)
+        //部门收藏和公司收藏要给对应类型的所有人发送通知
+
+        return null;
+    }
 }

+ 33 - 0
src/main/java/com/jeeplus/modules/projectAccessory/web/ProjectAccessoryController.java

@@ -13,14 +13,17 @@ import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.projectAccessory.entity.CollectAccessoryInfo;
 import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryInfo;
 import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryTree;
 import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
 import com.jeeplus.modules.projectAccessory.service.ProjectAccessoryService;
 import com.jeeplus.modules.projectAccessory.service.ProjectTemplateService;
 import com.jeeplus.modules.projectEngineering.service.ProjectEngineeringService;
+import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
+import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -34,6 +37,8 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.ConstraintViolationException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -414,4 +419,32 @@ public class ProjectAccessoryController extends BaseController {
 		System.out.println("上传文件controller层消耗时间:" + (t2-t1));
 		return map;
 	}
+
+	/**
+	 * 选择报销项目
+	 */
+	@RequestMapping(value = "collectAccessory")
+	public String collectAccessory(String url, Model model) {
+		CollectAccessoryInfo info = new CollectAccessoryInfo();
+		model.addAttribute("collectAccessoryInfo",info);
+		model.addAttribute("url",url);
+		return "modules/projectAccessory/selectCollectingAccessory";
+	}
+
+	/**
+	 * 收藏附件信息
+	 */
+	@RequestMapping(value = "saveCollectAccessory")
+	@ResponseBody
+	public Object saveCollectAccessory(CollectAccessoryInfo collectAccessoryInfo, Model model) {
+		Map<String,Object> map = new HashMap<>();
+		//收藏附件信息
+		Integer result = projectAccessoryService.saveCollectAccessory(collectAccessoryInfo);
+		if(result == 1){
+			map.put("str","收藏附件信息成功!");
+		}else{
+			map.put("str","");
+		}
+		return map;
+	}
 }

+ 21 - 35
src/main/webapp/webpage/modules/projectAccessory/selectCollectingAccessory.jsp

@@ -3,32 +3,23 @@
 <html>
 <head>
 	<meta name="decorator" content="default"/>
+	<script type="text/javascript" src="${ctxStatic}/helloweba_editable-select/jquery.editable-select.min.js"></script>
+	<script type="text/javascript" src="${ctxStatic}/iCheck/icheck.min.js"></script>
+	<script type="text/javascript" src="${ctxStatic}/layui/layuidown.js"></script>
+	<script src="${ctxStatic}/common/html/js/script.js"></script>
+	<link rel='stylesheet' type="text/css" href="${ctxStatic}/layui/layuidown.css"/>
+	<link rel='stylesheet' type="text/css" href="${ctxStatic}/helloweba_editable-select/jquery.editable-select.min.css"/>
 	<script type="text/javascript">
 		$(document).ready(function() {
-			$('#contentTable thead tr th input.i-checks').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
-				$('#contentTable tbody tr td input.i-checks').iCheck('check');
-			});
-
-			$('#contentTable thead tr th input.i-checks').on('ifUnchecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
-				$('#contentTable tbody tr td input.i-checks').iCheck('uncheck');
-			});
-			$("#td4").addClass("hide");
 
-				var radioVal = ${extId};
-				if(radioVal == 1){
-					$("#td1").removeClass("hide");
-					$("#td2").removeClass("hide");
-					$("#td3").removeClass("hide");
-					$("#td4").addClass("hide");
-					$("#tr1").show()
-				}else{
-					$("#td1").addClass("hide");
-					$("#td2").addClass("hide");
-					$("#td3").addClass("hide");
-					$("#td4").removeClass("hide");
-					$("#tr1").hide()
-				}
+			layui.use(['dropdown', 'util','form', 'layer'], function () {
+				var form = layui.form;
+				var dropdown = layui.dropdown
+						,util = layui.util
+						,layer = layui.layer
+						,$ = layui.jquery;
 			});
+		});
 
 		function getSelectedItem() {
 			radio=0;
@@ -42,23 +33,18 @@
 </head>
 <body>
 <div class="wrapper wrapper-content">
+	<br/>
 	<div class="layui-row">
 		<div class="full-width fl">
 			<div class="layui-row" id="queryDiv">
-				<form:form id="searchForm" modelAttribute="obj" action="${url}" method="post" class="form-inline">
-					<input type="hidden" name="url" value="${url}"/>
-					<input type="hidden" name="isTotal" value="${isTotal}"/>
-					<input type="hidden" name="fieldLabels" value="${fieldLabels}"/>
-					<input type="hidden" name="fieldKeys" value="${fieldKeys}"/>
-					<input type="hidden" name="searchLabel" value="${searchLabel}"/>
-					<input type="hidden" name="searchKey" value="${searchKey}"/>
-					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
-					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
-					<input id="extId" name="extid" type="hidden" value="${extId}"/>
-					<div class="layui-item layui-col-sm12 with-textarea">
-						<label class="layui-form-label"><span class="require-item">*</span>报销详情:</label>
+				<form:form id="inputForm" modelAttribute="collectAccessoryInfo" action="${ctx}/projectAccessory/projectAccessory/saveCollectAccessory" method="post" class="form-horizontal layui-form">
+					<input type="hidden" id="url" name="url" value="${url}">
+					<div class="layui-item layui-col-sm8">
+						<label class="layui-form-label"><span class="require-item">*</span>收藏类型:</label>
 						<div class="layui-input-block">
-							<textarea  id="reimburseRemarks" name="reimburseRemarks" style="width: 100%" rows="7" class="form-control required" maxlength="255"></textarea>
+							<form:select path="type" class="form-control judgment editable-select layui-input" id="type" value="${type}">
+								<form:options items="${fns:getMainDictList('collect_accessory_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
+							</form:select>
 						</div>
 					</div>
 				</form:form>

+ 66 - 0
src/main/webapp/webpage/modules/projectAccessory/workAttachmentForm.jsp

@@ -196,6 +196,7 @@
 										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
 											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?id=${workClientAttachment.id}&type=2&url=${workClientAttachment.url}','addFile')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
 										</c:if>
+										<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/collectAccessory?url=${workClientAttachment.url}')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;收藏</a>
 									</div>
 								</td>
 							</tr>
@@ -207,5 +208,70 @@
 		</form:form>
 	</div>
 </div>
+<script>
+	function collectingAccessory(obj,url,addFile,divId){
+		top.layer.open({
+			type: 2,
+			area: ['500px','350px'],
+			title:"文件收藏",
+			name:'friend',
+			skin:"two-btns",
+			content: encodeURI(url),
+			btn: ['确定', '关闭'],
+			yes: function(index, layero){
+				var body = top.layer.getChildFrame('body', index);
+				var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+				var inputForm = body.find('#inputForm');
+				var top_iframe;
+				var target = false;
+				if(target){
+					top_iframe = target;//如果指定了iframe,则在改frame中跳转
+				}else{
+					top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+				}
+				inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+				inputForm.attr("action","${ctx}/projectAccessory/projectAccessory/saveCollectAccessory");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,"inputForm",index);
+			},
+			cancel: function(index){
+			}
+		});
+	}
+
+	function formSubmit2($document,inputForm,index){
+		var validateForm = $($document.getElementById(inputForm)).validate({
+			submitHandler: function(form){
+				loading('正在提交,请稍等...');
+				form.submit();
+			},
+			errorContainer: "#messageBox",
+			errorPlacement: function(error, element) {
+				$($document.getElementById("#messageBox")).text("输入有误,请先更正。");
+				if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+					error.appendTo(element.parent().parent());
+				} else {
+					error.insertAfter(element);
+				}
+			}
+		});
+		if(validateForm.form()){
+			$($document.getElementById(inputForm)).ajaxSubmit({
+				success:function(data) {
+					var d = data;
+					//输出提示信息
+					if(d.str.length>0){
+						parent.layer.msg(d.str,{icon:1});
+					}
+					location.reload();
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+</script>
 </body>
 </html>