Parcourir la source

工作内容-报告信息树形列表展示

user5 il y a 5 ans
Parent
commit
f85e06695c

+ 9 - 2
src/main/java/com/jeeplus/modules/projectcontentinfo/dao/ProjectReportDataDao.java

@@ -82,8 +82,15 @@ public interface ProjectReportDataDao extends CrudDao<ProjectReportData> {
 
     /**
      * 查询报告文件父级节点数据信息
-     * @param projectReportData
+     * @param projectId
+     * @return
+     */
+    List<ProjectReportTreeData> getParentReportDataList(String projectId);
+
+    /**
+     * 查询报告文件子级数据信息
+     * @param projectId
      * @return
      */
-    List<ProjectReportTreeData> getParentReportData(ProjectReportData projectReportData);
+    List<ProjectReportTreeData> getReportDataList(String projectId);
 }

+ 21 - 0
src/main/java/com/jeeplus/modules/projectcontentinfo/entity/ProjectReportTreeData.java

@@ -1,6 +1,7 @@
 package com.jeeplus.modules.projectcontentinfo.entity;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.modules.mongo.document.User;
 
 import java.util.Date;
 
@@ -21,6 +22,10 @@ public class ProjectReportTreeData {
 
     private String index;  //序号
 
+    private String loginUserId;
+
+    private String createBy;
+
     public String getId() {
         return id;
     }
@@ -109,4 +114,20 @@ public class ProjectReportTreeData {
     public void setFileStatus(String fileStatus) {
         this.fileStatus = fileStatus;
     }
+
+    public String getLoginUserId() {
+        return loginUserId;
+    }
+
+    public void setLoginUserId(String loginUserId) {
+        this.loginUserId = loginUserId;
+    }
+
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
 }

+ 9 - 0
src/main/java/com/jeeplus/modules/projectcontentinfo/service/ProjectReportDataService.java

@@ -17,6 +17,7 @@ import com.jeeplus.modules.projectcontentinfo.dao.ProjectBasedDataDao;
 import com.jeeplus.modules.projectcontentinfo.dao.ProjectContentDataDao;
 import com.jeeplus.modules.projectcontentinfo.dao.ProjectReportDataDao;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportTreeData;
 import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
 import com.jeeplus.modules.projectreportnum.service.ProjectReportNumService;
@@ -1493,6 +1494,14 @@ public class ProjectReportDataService extends CrudService<ProjectReportDataDao,
 		return  act;
 	}
 
+	public List<ProjectReportTreeData> getParentReportDataList(String projectId) {
+			List<ProjectReportTreeData> parentReportDataList = dao.getParentReportDataList(projectId);
+			return parentReportDataList;
+	}
 
+	public List<ProjectReportTreeData> getReportDataList(String projectId) {
+			List<ProjectReportTreeData> reportDataList = dao.getReportDataList(projectId);
+			return reportDataList;
+	}
 
 }

+ 33 - 0
src/main/java/com/jeeplus/modules/projectcontentinfo/web/ProjectcontentinfoController.java

@@ -1619,4 +1619,37 @@ public class ProjectcontentinfoController extends BaseController {
 		return map;
 	}
 
+	/**
+	 * 根据项目id查询工作内容信息Tree
+	 * @param projectId
+	 * @return
+	 */
+	@RequestMapping("getProjectReportTreeDataList")
+	@ResponseBody
+	public Map<String,List> getProjectReportTreeDataList(String projectId){
+		Map<String,List> map = new HashMap<>();
+
+		List<ProjectReportTreeData> projectReportDataList = new ArrayList<>();
+		//获取成果列表父节点
+		List<ProjectReportTreeData> parentReportDataList = projectReportDataService.getParentReportDataList(projectId);
+		//如果成果列表父节点存在则查询所有成果信息
+		if(0 != parentReportDataList.size()) {
+			List<ProjectReportTreeData> reportDataList = projectReportDataService.getReportDataList(projectId);
+			if(0 != reportDataList.size()){
+				for (ProjectReportTreeData reportData : reportDataList) {
+					//添加成果类型数据信息
+					reportData.setAchievementType(DictUtils.getMainDictLabel(reportData.getAchievementType(), "achievement_type", ""));
+					//添加复核标准数据信息
+					reportData.setReviewStandard(DictUtils.getMainDictLabel(reportData.getReviewStandard(), "reviewStandard", ""));
+					//添加登陆者id
+					reportData.setLoginUserId(UserUtils.getUser().getId());
+				}
+				projectReportDataList.addAll(parentReportDataList);
+				projectReportDataList.addAll(reportDataList);
+			}
+		}
+		map.put("data",projectReportDataList);
+		return map;
+	}
+
 }

+ 15 - 3
src/main/resources/mappings/modules/projectcontentinfo/ProjectReportDataDao.xml

@@ -698,11 +698,23 @@
 		</where>
 	</select>
 
-	<select id="getParentReportData" resultType="com.jeeplus.modules.projectcontentinfo.entity.ProjectReportTreeData">
-		select * from work_content_type a where type_id in(
+	<select id="getParentReportDataList" resultType="com.jeeplus.modules.projectcontentinfo.entity.ProjectReportTreeData">
+		select a.type_id as id,a.type_name as type,0 as pid
+		 from work_content_type a where type_id in(
 			select distinct prd.type
 			from project_report_data prd
-			where prd.del_flag = #{DEL_FLAG_NORMAL} and prd.project_id = #{project.id})
+			where prd.del_flag = 0 and prd.project_id = #{projectId})
+		order by a.type_id
+	</select>
+
+	<select id="getReportDataList" resultType="com.jeeplus.modules.projectcontentinfo.entity.ProjectReportTreeData">
+		select a.id,a.name,a.number,a.type as pid,a.report_type as reportType,wct.type_name as type,
+		a.review_standard as reviewStandard,a.achievement_type as achievementType,
+		a.create_date as createDate,a.status as fileStatus,a.create_by as createBy
+		from project_report_data a
+		left join work_content_type wct on a.type = wct.type_id
+		where a.del_flag = 0 AND a.project_id = #{projectId}
+		order by a.update_date desc,a.name
 	</select>
 
 </mapper>

+ 139 - 15
src/main/webapp/webpage/modules/projectcontentinfo/projectcontentinfoForm.jsp

@@ -439,8 +439,13 @@
 						<c:if test="${empty change}">
 							<a href="javascript:void(0)" onclick="openDialogres('新增成果文件', '${ctx}/projectcontentinfo/projectcontentinfo/form?view=report&dictType=${dictType}&id=${id}&parentIds=${parentIds}','95%','95%',false,'inputForm')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i>&nbsp; 新增成果文件</a>
 						</c:if>
-						</div>
+					</div>
+
 					<div class="layui-item layui-col-xs12 form-table-container">
+						<table id="achievementTable" class="layui-table" lay-filter="achievementTable"></table>
+					</div>
+
+					<%--<div class="layui-item layui-col-xs12 form-table-container">
 						<table id="upTable" class="table table-bordered table-condensed details">
 							<thead>
 							<tr>
@@ -486,18 +491,6 @@
 												<fmt:formatDate value="${projectReportData.reportDate}" pattern="yyyy-MM-dd"/>
 											</td>
 											<td class="op-td">
-												<%--<c:choose>--%>
-													<%--<c:when test="${empty projectReportData.status || projectReportData.status eq 1}">--%>
-														<%--<div style="text-align: center">--%>
-															<%--<a href="javascript:void(0)" class="op-btn op-btn-trace" >${fns:getDictLabel(projectReportData.status, 'audit_state', '')}</a>--%>
-														<%--</div>--%>
-													<%--</c:when>--%>
-													<%--<c:otherwise>--%>
-														<%--<div style="text-align: center">--%>
-															<%--<a href="javascript:void(0)" onclick="openDialogView('流程追踪', '${ctx}/projectcontentinfo/projectcontentinfo/getProcessOne?id=${id}&projectReportData.id=${projectReportData.id}&type=1','95%','95%')" class="op-btn op-btn-trace" >${fns:getDictLabel(projectReportData.status, 'audit_state', '')}</a>--%>
-														<%--</div>--%>
-													<%--</c:otherwise>--%>
-												<%--</c:choose>--%>
                                                 <div style="text-align: center" id="status_td_${index.index+1}">
                                                 </div>
 												<script>
@@ -523,7 +516,7 @@
 															<a href="${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId=${projectReportData.id}&id=${id}&type=8" onclick="return confirmxRefresh('确认要删除该工作内容报告吗?', this.href)"   class="op-btn op-btn-delete"><i class="fa fa-trash"></i> 删除</a>
 														</c:if>
 														<c:if test="${projectReportData.status eq '5'}">
-															<%--<a href="javascript:void(0)" onclick="openDialogres('报告变更', '${ctx}/projectcontentinfo/projectcontentinfo/form?view=reportChange&dictType=${dictType}&id=${id}&parentIds=${parentIds}&projectReportData.id=${projectReportData.id}','95%','95%',false,'inputForm')" class="op-btn op-btn-revert" ><i class="fa fa-edit"></i> 变更</a>--%>
+															&lt;%&ndash;<a href="javascript:void(0)" onclick="openDialogres('报告变更', '${ctx}/projectcontentinfo/projectcontentinfo/form?view=reportChange&dictType=${dictType}&id=${id}&parentIds=${parentIds}&projectReportData.id=${projectReportData.id}','95%','95%',false,'inputForm')" class="op-btn op-btn-revert" ><i class="fa fa-edit"></i> 变更</a>&ndash;%&gt;
 															<a href="javascript:void(0)" onclick="openDialogres('报告作废', '${ctx}/projectcontentinfo/projectcontentinfo/form?view=reportInvalid&dictType=${dictType}&id=${id}&parentIds=${parentIds}&projectReportData.id=${projectReportData.id}','95%','95%',false,'inputForm')" class="op-btn op-btn-invalid"><i class="fa fa-trash-o"></i> 作废</a>
 														</c:if>
 													</c:if>
@@ -542,7 +535,7 @@
 							</c:choose>
 							</tbody>
 						</table>
-					</div>
+					</div>--%>
 				</div>
 			</div>
 	</div>
@@ -635,5 +628,136 @@
     });
 
 </script>
+
+<script>
+	/*使用模块加载的方式 加载文件*/
+	layui.config({
+		base: '${ctx}/resoueces/css/layui/module/'
+	}).extend({
+		treetable: 'treetable-lay/treetable'
+	}).use(['layer', 'table', 'treetable'], function () {
+		var $ = layui.jquery;
+		var table = layui.table;
+		var layer = layui.layer;
+		var treetable = layui.treetable;
+
+		// 渲染表格
+		var renderTable = function () {
+			layer.load(2);
+			treetable.render({
+				treeColIndex: 1,//树形图标显示在第几列
+				treeSpid: 0,//最上级的父级id
+				treeIdName: 'permissionId',//id字段的名称
+				treePidName: 'pid',//pid字段的名称
+				treeDefaultClose: false,//是否默认折叠
+				treeLinkage: true,//父级展开时是否自动展开所有子级
+				elem: '#achievementTable',
+				url: '${ctx}/projectcontentinfo/projectcontentinfo/getProjectReportTreeDataList?projectId=${projectRecords.id}',
+				page: false,
+				cols: [[
+					{type: 'numbers', title: '序号' ,width:80},
+					{field: 'type', title: '工作内容类型'},
+					{field: 'name', title: '成果文件名称',templet:function(d){
+							if(null != d.name){
+								return "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openDialogView('查看成果文件名称', '${ctx}/projectcontentinfo/projectcontentinfo/form?view=reportView&dictType=${dictType}&id=${id}&parentIds=${parentIds}&infoId="+d.id+"','95%', '95%')\">" + d.name + "</a>";
+							}else{
+								return "";
+							}
+						}},
+					{field: 'number',title: '成果文件编号',templet:function(d){
+							if(null != d.number){
+								return "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openDialogView('查看成果文件编号', '${ctx}/projectcontentinfo/projectcontentinfo/form?view=reportView&dictType=${dictType}&id=${id}&parentIds=${parentIds}&infoId="+d.id+"','95%', '95%')\">" + d.number + "</a>";
+							}else{
+								return "";
+							}
+						}},
+					{field: 'achievementType', title: '成果类型'},
+					{field: 'reviewStandard', title: '复核标准'},
+					{field: 'reportType', title: '签章类型',width:55},
+					{field: 'createDate', title: '创建日期',width:80},
+					{field: 'fileStatus', title: '状态',width:70, templet:function(d){
+						if(d.pid !=0){
+							var st = getAuditState(d.fileStatus);
+							if(st.action)
+								var xml = "<span onclick=\"openDialogView('流程追踪', '${ctx}/projectcontentinfo/projectcontentinfo/getProcessOne?id=" + d.id + "&projectReportData.id="+ d.id + "&type="+d.fileStatus+"','95%','95%')\" class=\"status-label status-label-" + st.label + "\" >" + st.status + "</span>";
+							else
+								var xml = "<span style=\"cursor:default;\" class=\"status-label status-label-" + st.label + "\" >" + st.status + "</span>";
+							return xml;
+						}else{
+							return '';
+						}
+
+						}},
+					{templet: complain, title: '操作',width:130}
+				]],
+				done: function () {
+					layer.closeAll('loading');
+				}
+			});
+		};
+
+		renderTable();
+
+		//触发三个button按钮
+		$('#btn-expand').click(function () {
+			treetable.expandAll('#permissionTable');
+		});
+
+		$('#btn-fold').click(function () {
+			treetable.foldAll('#permissionTable');
+		});
+
+		$('#btn-refresh').click(function () {
+			renderTable();
+		});
+
+
+		function complain(d){//操作中显示的内容
+			if(d.loginUserId == d.createBy){
+				if(d.fileStatus == 1){
+					return [
+						'<a href="javascript:void(0)" onclick="openDialogres(\'修改报告\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=report&dictType=${dictType}&id=${id}&parentIds=${parentIds}&projectReportData.id='+d.id+'\',\'95%\',\'95%\')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 修改</a>',
+						'<a href="${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+d.id+'&id=${id}&type=8" onclick="return confirmxRefresh(\'确认要删除该工作内容报告吗?\', this.href)"   class="op-btn op-btn-delete"><i class="fa fa-trash"></i> 删除</a>',
+					].join('');
+				}else if(d.fileStatus == 2){
+					return [
+						'<a href="${ctx}/projectcontentinfo/projectcontentinfo/cancelInvalidate?infoId='+d.id+'&id=${id}&type=8" onclick="return confirmxRefresh(\'确认要撤回该工作内容报告吗?\', this.href)"   class="op-btn op-btn-cancel"><i class="glyphicon glyphicon-share-alt"></i> 撤回</a>',
+					].join('');
+				}else if(d.fileStatus == 3){
+					return [
+						'<a href="javascript:void(0)" onclick="openDialogreAudit(\'修改报告\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=report&dictType=${dictType}&id=${id}&parentIds=${parentIds}&projectReportData.id='+d.id+'\',\'95%\',\'95%\')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 修改</a>',
+						'<a href="${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+d.id+'&id=${id}&type=8" onclick="return confirmxRefresh(\'确认要删除该工作内容报告吗?\', this.href)"   class="op-btn op-btn-delete"><i class="fa fa-trash"></i> 删除</a>',
+					].join('');
+				}else if(d.fileStatus == 4){
+					return [
+						'<a href="javascript:void(0)" onclick="openDialogreAudit(\'修改报告\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=reportModify&dictType=${dictType}&id=${id}&parentIds=${parentIds}&projectReportData.id='+d.id+'\',\'95%\',\'95%\')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 修改</a>',
+						'<a href="${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+d.id+'&id=${id}&type=8" onclick="return confirmxRefresh(\'确认要删除该工作内容报告吗?\', this.href)"   class="op-btn op-btn-delete"><i class="fa fa-trash"></i> 删除</a>',
+					].join('');
+				}else if(d.fileStatus == 5){
+					return [
+						'<a href="javascript:void(0)" onclick="openDialogres(\'报告作废\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=reportInvalid&dictType=${dictType}&id=${id}&parentIds=${parentIds}&projectReportData.id='+d.id+'\',\'95%\',\'95%\')" class="op-btn op-btn-invalid" ><i class="fa fa-trash-o"></i> 作废</a>',
+					].join('');
+				}else{
+					return[''].join('');
+				}
+			}else{
+				return[''].join('');
+			}
+		}
+		//监听工具条
+		table.on('tool(permissionTable)', function (obj) {
+			var data = obj.data;
+			var layEvent = obj.event;
+			if(data.permissionName!=null){
+				if (layEvent === 'del') {
+					layer.msg('删除' + data.id);
+				} else if (layEvent === 'edit') {
+					layer.msg('修改' + data.id);
+				}
+			}
+		});
+	});
+
+</script>
 </body>
 </html>