Przeglądaj źródła

项目报告、归档附件上传功能

user5 4 lat temu
rodzic
commit
0238afed38
32 zmienionych plików z 7068 dodań i 1008 usunięć
  1. 5 4
      src/main/java/com/jeeplus/modules/projectAccessory/dao/ProjectTemplateDao.java
  2. 38 0
      src/main/java/com/jeeplus/modules/projectAccessory/entity/ProjectTemplateInfo.java
  3. 76 0
      src/main/java/com/jeeplus/modules/projectAccessory/service/ProjectTemplateService.java
  4. 8 5
      src/main/java/com/jeeplus/modules/projectAccessory/web/ProjectAccessoryController.java
  5. 19 0
      src/main/java/com/jeeplus/modules/projectAccessory/web/ProjectAccessoryRelationController.java
  6. 17 0
      src/main/java/com/jeeplus/modules/projectAccessory/web/ProjectTemplateController.java
  7. 29 0
      src/main/java/com/jeeplus/modules/projectcontentinfo/entity/ProjectReportRecord.java
  8. 29 0
      src/main/java/com/jeeplus/modules/projectcontentinfo/entity/Projectcontentinfo.java
  9. 29 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectcontentinfo.java
  10. 101 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralCostProjectMessageController.java
  11. 105 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageController.java
  12. 57 1
      src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java
  13. 10 1
      src/main/resources/mappings/modules/projectAccessory/ProjectTemplateDao.xml
  14. 2 1
      src/main/resources/mappings/modules/ruralprojectrecords/RuralProjectRecordsDao.xml
  15. 74 0
      src/main/webapp/webpage/modules/projectAccessory/projectAccessoryRelation/fileAttachForm.jsp
  16. 39 3
      src/main/webapp/webpage/modules/projectAccessory/workAttachmentForm.jsp
  17. 284 2
      src/main/webapp/webpage/modules/projectcontentinfo/projectReportRecordAudit.jsp
  18. 350 5
      src/main/webapp/webpage/modules/projectcontentinfo/projectReportRecordModifyApply.jsp
  19. 619 10
      src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectReportRecord/projectReportRecordForm.jsp
  20. 619 10
      src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectReportRecord/projectReportRecordModify.jsp
  21. 509 115
      src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectcontentinfo/reportForm.jsp
  22. 508 106
      src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectcontentinfo/reportModify.jsp
  23. 187 102
      src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectcontentinfo/reportView.jsp
  24. 620 10
      src/main/webapp/webpage/modules/ruralprojectrecords/projectReportRecord/projectReportRecordForm.jsp
  25. 620 10
      src/main/webapp/webpage/modules/ruralprojectrecords/projectReportRecord/projectReportRecordModify.jsp
  26. 276 2
      src/main/webapp/webpage/modules/ruralprojectrecords/projectReportRecord/projectReportRecordView.jsp
  27. 187 102
      src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/projectRecordsMessageAudit.jsp
  28. 255 100
      src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/projectRecordsMessageModify.jsp
  29. 187 102
      src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/projectRecordsMessageView.jsp
  30. 512 109
      src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/reportForm.jsp
  31. 510 106
      src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/reportModify.jsp
  32. 187 102
      src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/reportView.jsp

+ 5 - 4
src/main/java/com/jeeplus/modules/projectAccessory/dao/ProjectTemplateDao.java

@@ -6,10 +6,7 @@ package com.jeeplus.modules.projectAccessory.dao;
 import com.jeeplus.common.persistence.CrudDao;
 import com.jeeplus.common.persistence.TreeDao;
 import com.jeeplus.common.persistence.annotation.MyBatisDao;
-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.entity.TemplateTypeInfo;
+import com.jeeplus.modules.projectAccessory.entity.*;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientJobTypeInfo;
 import org.apache.ibatis.annotations.Param;
@@ -68,4 +65,8 @@ public interface ProjectTemplateDao extends CrudDao<ProjectTemplateInfo>,TreeDao
     List<MainDictDetail> getPostfixTypeById(String id);
 
 
+
+    List<ProjectTemplateInfo> getProjectTemplateList(ProjectAccessoryRelationInfo projectTemplateInfo);
+
+
 }

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

@@ -6,6 +6,8 @@ package com.jeeplus.modules.projectAccessory.entity;
 
 import com.jeeplus.common.persistence.TreeEntity;
 import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 
 import java.util.List;
 
@@ -25,6 +27,10 @@ public class ProjectTemplateInfo extends TreeEntity<ProjectTemplateInfo>{
 	private String parentId;		// 父ID
 	private String companyId;   //公司id
 	private String parentName;
+	private List<WorkClientAttachment> workAttachments;
+	private String projectId;
+	private String attachId;
+	private Integer mustFlag;   ////判断是否是必填项(1:必填,0:非必填)
 
 	public ProjectTemplateInfo() {
 		super();
@@ -122,4 +128,36 @@ public class ProjectTemplateInfo extends TreeEntity<ProjectTemplateInfo>{
 	public void setParentName(String parentName) {
 		this.parentName = parentName;
 	}
+
+	public List<WorkClientAttachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<WorkClientAttachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
+
+	public String getProjectId() {
+		return projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+
+	public String getAttachId() {
+		return attachId;
+	}
+
+	public void setAttachId(String attachId) {
+		this.attachId = attachId;
+	}
+
+	public Integer getMustFlag() {
+		return mustFlag;
+	}
+
+	public void setMustFlag(Integer mustFlag) {
+		this.mustFlag = mustFlag;
+	}
 }

+ 76 - 0
src/main/java/com/jeeplus/modules/projectAccessory/service/ProjectTemplateService.java

@@ -8,11 +8,15 @@ import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.service.TreeService;
 import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.modules.projectAccessory.dao.ProjectTemplateDao;
+import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryRelationInfo;
 import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -27,6 +31,8 @@ import java.util.*;
 @Transactional(readOnly = true)
 public class ProjectTemplateService extends TreeService<ProjectTemplateDao, ProjectTemplateInfo> {
 
+    @Autowired
+    private WorkClientAttachmentDao workClientAttachmentDao;
 
 	public ProjectTemplateInfo get(String id) {
 		return super.get(id);
@@ -37,6 +43,14 @@ public class ProjectTemplateService extends TreeService<ProjectTemplateDao, Proj
     }
 
     /**
+     * 获取项目附件模板类型
+     * @return
+     */
+    public static List<MainDictDetail> attachmentTemplateList(){
+        return  DictUtils.getMainDictList("attachment_template_type");
+    }
+
+    /**
      * 查询所有数据
      * @param projectTemplateInfo
      * @return
@@ -191,8 +205,70 @@ public class ProjectTemplateService extends TreeService<ProjectTemplateDao, Proj
      * @param projectType
      * @return
      */
+    public List<ProjectTemplateInfo> getProjectTemplateAndOtherList(String parentId,String projectType,String projectId){
+        List<ProjectTemplateInfo> templateInfoList = dao.projectAccessoryListByParentId(parentId, projectType);
+        Iterator<ProjectTemplateInfo> iterator = templateInfoList.iterator();
+        //查询是否已经含有附件信息,如果含有说明已经使用 无需再次展示(删除)
+        while(iterator.hasNext()){
+            ProjectTemplateInfo info = iterator.next();
+            WorkClientAttachment attchment = new WorkClientAttachment();
+            attchment.setProjectId(projectId);
+            attchment.setAttachmentId(info.getId());
+            List<WorkClientAttachment> attachments = workClientAttachmentDao.getList(attchment);
+            if(attachments.size()>0){
+                iterator.remove();
+            }
+        }
+        return templateInfoList ;
+    }
+
+    /**
+     * 根据parentId获取数据集
+     * @param parentId
+     * @param projectType
+     * @return
+     */
 	public List<ProjectTemplateInfo> getProjectTemplateListById(String parentId,String projectType,String id){
 	    return dao.getProjectTemplateListById(parentId,projectType, id);
     }
 
+
+    public List<ProjectTemplateInfo> getProjectTemplateList(ProjectAccessoryRelationInfo projectTemplateInfo){
+        //查询必填项展示列,并查询附件信息
+        List<ProjectTemplateInfo> projectTemplateList = dao.getProjectTemplateList(projectTemplateInfo);
+        for (ProjectTemplateInfo info: projectTemplateList) {
+            WorkClientAttachment attchment = new WorkClientAttachment();
+            attchment.setProjectId(projectTemplateInfo.getId());
+            attchment.setAttachmentId(info.getId());
+            List<WorkClientAttachment> attachments = workClientAttachmentDao.getList(attchment);
+            info.setWorkAttachments(attachments);
+            info.setMustFlag(1);
+        }
+        //查询没有被选择必填项的数据并查询是否已经上传附件,若有则添加到展示列中
+        List<ProjectTemplateInfo> otherProjectTemplateList = dao.projectAccessoryListByParentId(projectTemplateInfo.getAttachType(),projectTemplateInfo.getProjectType());
+        for (ProjectTemplateInfo otherInfo: otherProjectTemplateList) {
+            WorkClientAttachment attchment = new WorkClientAttachment();
+            attchment.setProjectId(projectTemplateInfo.getId());
+            attchment.setAttachmentId(otherInfo.getId());
+            List<WorkClientAttachment> attachments = workClientAttachmentDao.getList(attchment);
+            if(attachments.size()>0){
+                otherInfo.setWorkAttachments(attachments);
+
+                otherInfo.setMustFlag(0);
+                projectTemplateList.add(otherInfo);
+            }
+        }
+
+        return projectTemplateList;
+    }
+
+
+    public Integer getAttachmentCount(String attachmentId,String projectId){
+            WorkClientAttachment attchment = new WorkClientAttachment();
+            attchment.setProjectId(projectId);
+            attchment.setAttachmentId(attachmentId);
+            List<WorkClientAttachment> attachments = workClientAttachmentDao.getList(attchment);
+        return attachments.size();
+    }
+
 }

+ 8 - 5
src/main/java/com/jeeplus/modules/projectAccessory/web/ProjectAccessoryController.java

@@ -15,7 +15,9 @@ import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.common.web.BaseController;
 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.workclientinfo.entity.WorkClientAttachment;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -45,6 +47,8 @@ public class ProjectAccessoryController extends BaseController {
 
 	@Autowired
 	private ProjectAccessoryService projectAccessoryService;
+	@Autowired
+	private ProjectTemplateService projectTemplateService;
 	
 	@ModelAttribute
 	public ProjectAccessoryInfo get(@RequestParam(required=false) String id) {
@@ -339,12 +343,11 @@ public class ProjectAccessoryController extends BaseController {
 	 */
 	@RequestMapping("workAttachmentForm")
 	public String workAttachmentForm(String attachmentId, String projectId, Model model){
-		ProjectAccessoryTree projectAccessory = new ProjectAccessoryTree();
+		ProjectTemplateInfo projectTemplateInfo = projectTemplateService.get(attachmentId);
 		List<WorkClientAttachment> workAttachments = projectAccessoryService.getWorkAttachments(attachmentId,projectId);
-		projectAccessory.setWorkAttachments(workAttachments);
-		projectAccessory.setProjectId(projectId);
-		projectAccessory.setId(attachmentId);
-		model.addAttribute("projectAccessory", projectAccessory);
+		projectTemplateInfo.setWorkAttachments(workAttachments);
+		projectTemplateInfo.setProjectId(projectId);
+		model.addAttribute("projectTemplateInfo", projectTemplateInfo);
 		return "modules/projectAccessory/workAttachmentForm";
 	}
 

+ 19 - 0
src/main/java/com/jeeplus/modules/projectAccessory/web/ProjectAccessoryRelationController.java

@@ -200,4 +200,23 @@ public class ProjectAccessoryRelationController extends BaseController {
 		return "redirect:"+Global.getAdminPath()+"/projectAccessoryRelation/projectAccessoryRelation/?repage";
 	}
 
+	/**
+	 * 跳转报告附件选择页
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "formAttachment")
+	public String formAttachment(Model model,String parentId,String projectType,String projectId) {
+		ProjectAccessoryRelationInfo projectAccessoryRelationInfo = new ProjectAccessoryRelationInfo();
+		projectAccessoryRelationInfo.setProjectTemplateList(projectTemplateService.getProjectTemplateAndOtherList(parentId, projectType,projectId));
+		model.addAttribute("projectAccessoryRelationInfo", projectAccessoryRelationInfo);
+		return "modules/projectAccessory/projectAccessoryRelation/fileAttachForm";
+	}
+
+	@RequestMapping("getAttachmentCount")
+	@ResponseBody
+	public Integer getAttachmentCount(@RequestParam("attachmentId") String attachmentId,@RequestParam("projectId") String projectId){
+		return projectTemplateService.getAttachmentCount(attachmentId,projectId);
+	}
+
 }

+ 17 - 0
src/main/java/com/jeeplus/modules/projectAccessory/web/ProjectTemplateController.java

@@ -15,6 +15,8 @@ import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.common.web.BaseController;
 import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
 import com.jeeplus.modules.projectAccessory.service.ProjectTemplateService;
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectBasedData;
+import com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.utils.DictUtils;
 import org.apache.shiro.authz.annotation.Logical;
@@ -220,6 +222,21 @@ public class ProjectTemplateController extends BaseController {
 		return "redirect:"+Global.getAdminPath()+"/projectTemplate/projectTemplate/?repage";
 	}
 
+	@RequestMapping(value = "getProjectTemplateInfo")
+	@ResponseBody
+	public AjaxJson getProjectTemplateInfo(ProjectTemplateInfo projectAccessoryInfo) {
+		AjaxJson ajaxJson = new AjaxJson();
+		try{
+			ajaxJson.setMsg("添加成功!");
+			projectAccessoryInfo = projectTemplateService.get(projectAccessoryInfo.getAttachId());
+			ajaxJson.getBody().put("projectAccessoryInfo",projectAccessoryInfo);
+		}catch (Exception e){
+			logger.error("ProjectcontentinfoController save Exception e",e);
+			ajaxJson.setSuccess(false);
+		}
+		return ajaxJson;
+	}
+
 	/**
 	 * 导出excel文件
 	 * @param projectAccessoryInfo

+ 29 - 0
src/main/java/com/jeeplus/modules/projectcontentinfo/entity/ProjectReportRecord.java

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.google.common.collect.Lists;
 import com.jeeplus.common.persistence.ActEntity;
 import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
 import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.entity.Workattachment;
 import org.activiti.engine.history.HistoricProcessInstance;
@@ -53,6 +54,10 @@ public class ProjectReportRecord extends ActEntity<ProjectReportRecord> {
 	private String condition;    //判定条件
 	private String flag;    //判定条件
 
+	private List<ProjectTemplateInfo> fileAttachmentList;   //报告文件
+	private List<ProjectTemplateInfo> fileGistdataList;   //依据性文件
+	private List<ProjectTemplateInfo> fileOtherList;   //其他文件
+
 	private Integer type;//(1:ProjectReportRecord  2:RuralProjectReportRecord)
 
 	public Integer getType() {
@@ -348,4 +353,28 @@ public class ProjectReportRecord extends ActEntity<ProjectReportRecord> {
 	public void setFileNumTow(String fileNumTow) {
 		this.fileNumTow = fileNumTow;
 	}
+
+	public List<ProjectTemplateInfo> getFileAttachmentList() {
+		return fileAttachmentList;
+	}
+
+	public void setFileAttachmentList(List<ProjectTemplateInfo> fileAttachmentList) {
+		this.fileAttachmentList = fileAttachmentList;
+	}
+
+	public List<ProjectTemplateInfo> getFileGistdataList() {
+		return fileGistdataList;
+	}
+
+	public void setFileGistdataList(List<ProjectTemplateInfo> fileGistdataList) {
+		this.fileGistdataList = fileGistdataList;
+	}
+
+	public List<ProjectTemplateInfo> getFileOtherList() {
+		return fileOtherList;
+	}
+
+	public void setFileOtherList(List<ProjectTemplateInfo> fileOtherList) {
+		this.fileOtherList = fileOtherList;
+	}
 }

+ 29 - 0
src/main/java/com/jeeplus/modules/projectcontentinfo/entity/Projectcontentinfo.java

@@ -6,6 +6,7 @@ package com.jeeplus.modules.projectcontentinfo.entity;
 
 import com.jeeplus.common.persistence.TreeEntity;
 import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
 import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
 import com.jeeplus.modules.sys.entity.Workattachment;
@@ -52,6 +53,10 @@ public class Projectcontentinfo extends TreeEntity<Projectcontentinfo> {
 	private String monthlyContent;  //月报内容信息
 	private String monthlyNumber;   //月报编号
 
+	private List<ProjectTemplateInfo> fileAttachmentList;   //报告文件
+	private List<ProjectTemplateInfo> fileGistdataList;   //依据性文件
+	private List<ProjectTemplateInfo> fileOtherList;   //其他文件
+
 
 	public RuralProjectRecords getProjectOnRural() {
 		return projectOnRural;
@@ -290,4 +295,28 @@ public class Projectcontentinfo extends TreeEntity<Projectcontentinfo> {
 	public void setMonthlyNumber(String monthlyNumber) {
 		this.monthlyNumber = monthlyNumber;
 	}
+
+	public List<ProjectTemplateInfo> getFileAttachmentList() {
+		return fileAttachmentList;
+	}
+
+	public void setFileAttachmentList(List<ProjectTemplateInfo> fileAttachmentList) {
+		this.fileAttachmentList = fileAttachmentList;
+	}
+
+	public List<ProjectTemplateInfo> getFileGistdataList() {
+		return fileGistdataList;
+	}
+
+	public void setFileGistdataList(List<ProjectTemplateInfo> fileGistdataList) {
+		this.fileGistdataList = fileGistdataList;
+	}
+
+	public List<ProjectTemplateInfo> getFileOtherList() {
+		return fileOtherList;
+	}
+
+	public void setFileOtherList(List<ProjectTemplateInfo> fileOtherList) {
+		this.fileOtherList = fileOtherList;
+	}
 }

+ 29 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectcontentinfo.java

@@ -6,6 +6,7 @@ package com.jeeplus.modules.ruralprojectrecords.entity;
 
 import com.jeeplus.common.persistence.TreeEntity;
 import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectBasedData;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectContentData;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
@@ -40,6 +41,10 @@ public class RuralProjectcontentinfo extends TreeEntity<RuralProjectcontentinfo>
 	private String change;
 	private String projectId;   //项目id
 
+	private List<ProjectTemplateInfo> fileAttachmentList;   //报告文件
+	private List<ProjectTemplateInfo> fileGistdataList;   //依据性文件
+	private List<ProjectTemplateInfo> fileOtherList;   //其他文件
+
 	public String getProjectId() {
 		return projectId;
 	}
@@ -197,4 +202,28 @@ public class RuralProjectcontentinfo extends TreeEntity<RuralProjectcontentinfo>
 	public void setChange(String change) {
 		this.change = change;
 	}
+
+	public List<ProjectTemplateInfo> getFileAttachmentList() {
+		return fileAttachmentList;
+	}
+
+	public void setFileAttachmentList(List<ProjectTemplateInfo> fileAttachmentList) {
+		this.fileAttachmentList = fileAttachmentList;
+	}
+
+	public List<ProjectTemplateInfo> getFileGistdataList() {
+		return fileGistdataList;
+	}
+
+	public void setFileGistdataList(List<ProjectTemplateInfo> fileGistdataList) {
+		this.fileGistdataList = fileGistdataList;
+	}
+
+	public List<ProjectTemplateInfo> getFileOtherList() {
+		return fileOtherList;
+	}
+
+	public void setFileOtherList(List<ProjectTemplateInfo> fileOtherList) {
+		this.fileOtherList = fileOtherList;
+	}
 }

+ 101 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralCostProjectMessageController.java

@@ -7,6 +7,8 @@ import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.web.BaseController;
 import com.jeeplus.modules.act.entity.Act;
 import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryRelationInfo;
+import com.jeeplus.modules.projectAccessory.service.ProjectTemplateService;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportRecord;
 import com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo;
@@ -77,6 +79,8 @@ public class RuralCostProjectMessageController extends BaseController {
     private ProjectReportRecordService projectReportRecordService;
     @Autowired
     private ProjectPlanService projectPlanService;
+    @Autowired
+    private ProjectTemplateService projectTemplateService;
 
     @ModelAttribute
     public RuralProjectRecords get(@RequestParam(required=false) String id) {
@@ -161,6 +165,30 @@ public class RuralCostProjectMessageController extends BaseController {
         if (StringUtils.isBlank(projectReportData.getStatus())){
             projectReportData.setFileStatus("1");
         }
+
+        //查询报告文件、依据性文件、其他文件必填列表以及数据
+        List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+        for (MainDictDetail mainDict:mainDictDetails) {
+            ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+            //添加项目类型
+            relateInfo.setProjectType("2");
+            //添加报告类型
+            relateInfo.setRequiredStage(1);
+            relateInfo.setId(records.getId());
+            relateInfo.setAttachType(mainDict.getValue());
+            switch(mainDict.getValue()){
+                case "11" :
+                    projectcontentinfo.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "12" :
+                    projectcontentinfo.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "13" :
+                    projectcontentinfo.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+            }
+        }
+
         projectcontentinfo.setProjectReportData(projectReportData);
         model.addAttribute("projectcontentinfo", projectcontentinfo);
         if (projectReportData != null && projectReportData.getCreateBy() != null && StringUtils.isNotBlank(projectReportData.getCreateBy().getId()) && projectReportData.getCreateBy().getId().equals(UserUtils.getUser().getId())) {
@@ -183,8 +211,31 @@ public class RuralCostProjectMessageController extends BaseController {
         ProjectReportData projectReportData = projectReportDataService.getOnRural(projectcontentinfo1.getInfoId());
         Projectcontentinfo projectcontent = projectcontentinfoService.getByInfoId(projectReportData.getId());
         projectcontent.setProjectReportData(projectReportData);
+        //查询报告文件、依据性文件、其他文件必填列表以及数据
+        List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+        for (MainDictDetail mainDict:mainDictDetails) {
+            ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+            //添加项目类型
+            relateInfo.setProjectType("2");
+            //添加报告类型
+            relateInfo.setRequiredStage(1);
+            relateInfo.setId(projectcontent.getProject().getId());
+            relateInfo.setAttachType(mainDict.getValue());
+            switch(mainDict.getValue()){
+                case "11" :
+                    projectcontent.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "12" :
+                    projectcontent.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "13" :
+                    projectcontent.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+            }
+        }
         model.addAttribute("processInstanceId",projectReportData.getProcessInstanceId());
         model.addAttribute("projectId", projectcontentinfo1.getProject().getId());
+        model.addAttribute("projectRecords", projectcontentinfo1.getProject());
         model.addAttribute("id", projectcontentinfo.getId());
         model.addAttribute("projectcontentinfo", projectcontent);
         if (StringUtils.isNotBlank(projectcontentinfo.getView()) && projectcontentinfo.getView().contains("view")) {
@@ -478,6 +529,31 @@ public class RuralCostProjectMessageController extends BaseController {
         projectReportRecord.setReport(reportData);
         model.addAttribute("projectReportRecord", projectReportRecord);
         model.addAttribute("project", projectReportRecord.getReport().getProject());
+
+        //查询报告文件、依据性文件、其他文件必填列表以及数据
+        List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+        for (MainDictDetail mainDict:mainDictDetails) {
+            ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+            //添加项目类型
+            relateInfo.setProjectType("2");
+            //添加归档类型
+            relateInfo.setRequiredStage(2);
+            //添加项目id
+            relateInfo.setId(ruralProjectRecords.getId());
+            relateInfo.setAttachType(mainDict.getValue());
+            switch(mainDict.getValue()){
+                case "11" :
+                    projectReportRecord.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "12" :
+                    projectReportRecord.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "13" :
+                    projectReportRecord.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+            }
+        }
+
         if(null != projectContractInfo){
             if(projectContractInfo.getWorkClientInfoList().size()>0){
                 model.addAttribute("workClientInfoName", projectContractInfo.getWorkClientInfoList().get(0).getName());
@@ -513,6 +589,31 @@ public class RuralCostProjectMessageController extends BaseController {
             projectReportRecord.setCreateDate(new Date());
             projectReportRecord.setCreateBy(UserUtils.getUser());
         }
+
+        //查询报告文件、依据性文件、其他文件必填列表以及数据
+        List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+        for (MainDictDetail mainDict:mainDictDetails) {
+            ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+            //添加项目类型
+            relateInfo.setProjectType("2");
+            //添加归档类型
+            relateInfo.setRequiredStage(2);
+            //添加项目id
+            relateInfo.setId(projectReportRecord.getReport().getProject().getId());
+            relateInfo.setAttachType(mainDict.getValue());
+            switch(mainDict.getValue()){
+                case "11" :
+                    projectReportRecord.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "12" :
+                    projectReportRecord.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "13" :
+                    projectReportRecord.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+            }
+        }
+
         projectReportRecord.setView("modify");
         model.addAttribute("projectReportRecord", projectReportRecord);
         model.addAttribute("project", projectReportRecord.getReport().getProject());

+ 105 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageController.java

@@ -7,6 +7,9 @@ import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.web.BaseController;
 import com.jeeplus.modules.act.entity.Act;
 import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryRelationInfo;
+import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
+import com.jeeplus.modules.projectAccessory.service.ProjectTemplateService;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportRecord;
 import com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo;
@@ -26,6 +29,7 @@ import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
 import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
 import org.activiti.engine.HistoryService;
@@ -77,6 +81,8 @@ public class RuralProjectMessageController extends BaseController {
     private ProjectReportRecordService projectReportRecordService;
     @Autowired
     private ProjectPlanService projectPlanService;
+    @Autowired
+    private ProjectTemplateService projectTemplateService;
 
     @ModelAttribute
     public RuralProjectRecords get(@RequestParam(required=false) String id) {
@@ -162,6 +168,29 @@ public class RuralProjectMessageController extends BaseController {
             projectReportData.setFileStatus("1");
         }
         projectcontentinfo.setProjectReportData(projectReportData);
+        //查询报告文件、依据性文件、其他文件必填列表以及数据
+        List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+        for (MainDictDetail mainDict:mainDictDetails) {
+            ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+            //添加项目类型
+            relateInfo.setProjectType("1");
+            //添加报告类型
+            relateInfo.setRequiredStage(1);
+            relateInfo.setId(records.getId());
+            relateInfo.setAttachType(mainDict.getValue());
+            switch(mainDict.getValue()){
+                case "11" :
+                    projectcontentinfo.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "12" :
+                    projectcontentinfo.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "13" :
+                    projectcontentinfo.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+            }
+        }
+
         model.addAttribute("projectcontentinfo", projectcontentinfo);
         if (projectReportData != null && projectReportData.getCreateBy() != null && StringUtils.isNotBlank(projectReportData.getCreateBy().getId()) && projectReportData.getCreateBy().getId().equals(UserUtils.getUser().getId())) {
             return "modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/reportForm";
@@ -183,8 +212,31 @@ public class RuralProjectMessageController extends BaseController {
         ProjectReportData projectReportData = projectReportDataService.getOnRural(projectcontentinfo1.getInfoId());
         Projectcontentinfo projectcontent = projectcontentinfoService.getByInfoId(projectReportData.getId());
         projectcontent.setProjectReportData(projectReportData);
+        //查询报告文件、依据性文件、其他文件必填列表以及数据
+        List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+        for (MainDictDetail mainDict:mainDictDetails) {
+            ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+            //添加项目类型
+            relateInfo.setProjectType("1");
+            //添加报告类型
+            relateInfo.setRequiredStage(1);
+            relateInfo.setId(projectcontent.getProject().getId());
+            relateInfo.setAttachType(mainDict.getValue());
+            switch(mainDict.getValue()){
+                case "11" :
+                    projectcontent.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "12" :
+                    projectcontent.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "13" :
+                    projectcontent.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+            }
+        }
         model.addAttribute("processInstanceId",projectReportData.getProcessInstanceId());
         model.addAttribute("projectId", projectcontentinfo1.getProject().getId());
+        model.addAttribute("projectRecords", projectcontentinfo1.getProject());
         model.addAttribute("id", projectcontentinfo.getId());
         model.addAttribute("projectcontentinfo", projectcontent);
         if (StringUtils.isNotBlank(projectcontentinfo.getView()) && projectcontentinfo.getView().contains("view")) {
@@ -482,6 +534,33 @@ public class RuralProjectMessageController extends BaseController {
                 model.addAttribute("workClientInfoName", projectContractInfo.getWorkClientInfoList().get(0).getName());
             }
         }
+
+
+        //查询报告文件、依据性文件、其他文件必填列表以及数据
+        List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+        for (MainDictDetail mainDict:mainDictDetails) {
+            ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+            //添加项目类型
+            relateInfo.setProjectType("1");
+            //添加归档类型
+            relateInfo.setRequiredStage(2);
+            //添加项目id
+            relateInfo.setId(ruralProjectRecords.getId());
+            relateInfo.setAttachType(mainDict.getValue());
+            switch(mainDict.getValue()){
+                case "11" :
+                    projectReportRecord.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "12" :
+                    projectReportRecord.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "13" :
+                    projectReportRecord.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+            }
+        }
+
+
         if (StringUtils.isNotBlank(projectReportRecord.getView()) && projectReportRecord.getView().equals("view")){
             return "modules/ruralprojectrecords/projectReportRecord/projectReportRecordView";
         }else if (StringUtils.isNotBlank(projectReportRecord.getView()) && projectReportRecord.getView().equals("modiftApply")){
@@ -514,6 +593,32 @@ public class RuralProjectMessageController extends BaseController {
         }
         projectReportRecord.setView("modify");
 
+
+
+        //查询报告文件、依据性文件、其他文件必填列表以及数据
+        List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+        for (MainDictDetail mainDict:mainDictDetails) {
+            ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+            //添加项目类型
+            relateInfo.setProjectType("1");
+            //添加归档类型
+            relateInfo.setRequiredStage(2);
+            //添加项目id
+            relateInfo.setId(projectReportRecord.getReport().getProject().getId());
+            relateInfo.setAttachType(mainDict.getValue());
+            switch(mainDict.getValue()){
+                case "11" :
+                    projectReportRecord.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "12" :
+                    projectReportRecord.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+                case "13" :
+                    projectReportRecord.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+                    break;
+            }
+        }
+
         model.addAttribute("projectReportRecord", projectReportRecord);
         model.addAttribute("project", projectReportRecord.getReport().getProject());
         if (StringUtils.isNotBlank(projectReportRecord.getView()) && projectReportRecord.getView().equals("view")){

+ 57 - 1
src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java

@@ -36,6 +36,8 @@ import com.jeeplus.modules.oabuy.service.OaBuyService;
 import com.jeeplus.modules.oaperformance.entity.OaPerformance;
 import com.jeeplus.modules.oaperformance.service.OaPerformanceService;
 import com.jeeplus.modules.officeintroduce.dao.OfficeintroduceDao;
+import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryRelationInfo;
+import com.jeeplus.modules.projectAccessory.service.ProjectTemplateService;
 import com.jeeplus.modules.projectType.entity.ProjectType;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectContentData;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
@@ -426,6 +428,8 @@ public class WorkProjectNotifyController extends BaseController {
 	private ProjectPlanService projectPlanService;
 	@Autowired
 	private ProjectImplementEarlyService projectImplementEarlyService;
+	@Autowired
+	private ProjectTemplateService projectTemplateService;
 
 	@ModelAttribute
 	public WorkProjectNotify get(@RequestParam(required=false) String id) {
@@ -1456,6 +1460,7 @@ public class WorkProjectNotifyController extends BaseController {
 					}
 				} else if (workProjectNotify.getType().equals("92")) {    //工作内容报告
 					ProjectReportData projectReportData = projectReportDataService.getOnRural(workProjectNotify.getNotifyId());
+					RuralProjectRecords ruralProjectRecords = ruralProjectRecordsService.get(projectReportData.getProject().getId());
 					Act act = getByAct(projectReportData.getProcessInstanceId());
 					projectReportData.setAct(act);
 					Projectcontentinfo projectcontentinfo = projectcontentinfoService.getByInfoId(projectReportData.getId());
@@ -1469,6 +1474,30 @@ public class WorkProjectNotifyController extends BaseController {
                             }
                         }
                     }
+
+					//查询报告文件、依据性文件、其他文件必填列表以及数据
+					List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+					for (MainDictDetail mainDict:mainDictDetails) {
+						ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+						//添加项目类型
+						relateInfo.setProjectType(ruralProjectRecords.getProjectType());
+						//添加报告类型
+						relateInfo.setRequiredStage(1);
+						relateInfo.setId(projectReportData.getProject().getId());
+						relateInfo.setAttachType(mainDict.getValue());
+						switch(mainDict.getValue()){
+							case "11" :
+								projectcontentinfo.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+								break;
+							case "12" :
+								projectcontentinfo.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+								break;
+							case "13" :
+								projectcontentinfo.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+								break;
+						}
+					}
+
                     projectcontentinfo.setHome("home");
                     model.addAttribute("processInstanceId",projectReportData.getProcessInstanceId());
 					model.addAttribute("projectId", projectcontentinfo.getProject().getId());
@@ -1577,9 +1606,35 @@ public class WorkProjectNotifyController extends BaseController {
 
 				} else if (workProjectNotify.getType().equals("51")) {    //工作内容报告归档
 					ProjectReportRecord projectReportRecord = projectReportRecordService.get(workProjectNotify.getNotifyId());
+					RuralProjectRecords ruralProjectRecords = ruralProjectRecordsService.get(projectReportRecord.getReport().getProject().getId());
 					Act act = getByAct(projectReportRecord.getProcessInstanceId());
 					projectReportRecord.setAct(act);
 					projectReportRecord.setHome("home");
+
+					//查询报告文件、依据性文件、其他文件必填列表以及数据
+					List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
+					for (MainDictDetail mainDict:mainDictDetails) {
+						ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
+						//添加项目类型
+						relateInfo.setProjectType(ruralProjectRecords.getProjectType());
+						//添加归档类型
+						relateInfo.setRequiredStage(2);
+						//添加项目id
+						relateInfo.setId(projectReportRecord.getReport().getProject().getId());
+						relateInfo.setAttachType(mainDict.getValue());
+						switch(mainDict.getValue()){
+							case "11" :
+								projectReportRecord.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
+								break;
+							case "12" :
+								projectReportRecord.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
+								break;
+							case "13" :
+								projectReportRecord.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
+								break;
+						}
+					}
+
 					model.addAttribute("projectReportRecord", projectReportRecord);
 					model.addAttribute("project", projectReportRecord.getReport().getProject());
 					if (workProjectNotify.getRemarks().contains("待审批") && !"1".equals(workProjectNotify.getStatus())) {
@@ -1587,7 +1642,8 @@ public class WorkProjectNotifyController extends BaseController {
 					} else if (workProjectNotify.getRemarks().contains("重新申请") && !"1".equals(workProjectNotify.getStatus())) {
 						return "modules/projectcontentinfo/projectReportRecordModifyApply";
 					} else {
-						return "modules/projectcontentinfo/projectReportRecordView";
+						return "modules/ruralprojectrecords/projectReportRecord/projectReportRecordView";
+
 					}
 				} else if ("52".equals(workProjectNotify.getType())) {    //收入结算
 					WorkReceiptsSettle workReceiptsSettle = workReceiptsSettleService.get(workProjectNotify.getNotifyId());

+ 10 - 1
src/main/resources/mappings/modules/projectAccessory/ProjectTemplateDao.xml

@@ -69,7 +69,7 @@
 
 	<select id="projectAccessoryListByParentId" resultType="com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo" >
 		SELECT
-			a.id as "id", a.attach_name as "attachName",a.parent_id as "parentId"
+			<include refid="workReviewStandardColumns"/>
 		FROM project_template_structure_info a
 		where a.parent_id =#{parentId}
 		and a.id not in(select attach_id from project_accessory_relation_info where project_type = #{projectType} and attach_type = #{parentId} )
@@ -248,4 +248,13 @@
 		delete from template_type_info
 		where template_id = #{id}
 	</delete>
+
+	<select id="getProjectTemplateList" resultType="com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo">
+		SELECT
+		<include refid="workReviewStandardColumns"/>
+		from project_template_structure_info a
+		left join project_accessory_relation_info b on b.attach_id = a.id
+		WHERE b.project_type = #{projectType} and b.required_stage = #{requiredStage}
+		and b.attach_type = #{attachType}
+	</select>
 </mapper>

+ 2 - 1
src/main/resources/mappings/modules/ruralprojectrecords/RuralProjectRecordsDao.xml

@@ -46,7 +46,8 @@
 		a.ending_date AS "endingDate",
 		a.estimate_total_fees AS "estimateTotalFees",
 		a.construction_unit as "constructionUnit",
-		a.construction_linkman as "constructionLinkman"
+		a.construction_linkman as "constructionLinkman",
+		a.project_type as "projectType"
 	</sql>
 	
 	<sql id="projectRecordsJoins">

+ 74 - 0
src/main/webapp/webpage/modules/projectAccessory/projectAccessoryRelation/fileAttachForm.jsp

@@ -0,0 +1,74 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>复核标准管理</title>
+	<meta name="decorator" content="default"/>
+	<style>
+		label.error{
+			top:40px;
+			left:0;
+		}
+		#standardDetail-error{
+			top:82px;
+			left:0;
+		}
+	</style>
+	<script type="text/javascript">
+		var validateForm;
+		function doSubmit(){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+		  if(validateForm.form()){
+		  	$("#inputForm").submit();
+		  	return true;
+		  }
+	
+		  return false;
+		}
+		$(document).ready(function() {
+			validateForm = $("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+            var edit = "${workReviewStandard.id}";
+            if(edit!=null && edit!=''){
+                $("#reviewParentButton").attr("disabled","disabled");
+            }
+		});
+	</script>
+</head>
+<body>
+<div class="single-form-small">
+	<div class="container">
+		<form:form id="inputForm" modelAttribute="projectAccessoryRelationInfo" action="${ctx}/projectAccessoryRelation/projectAccessoryRelation/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<input type="hidden" id="attachType" name="attachType" value="${projectAccessoryRelationInfo.attachType}">
+		<input type="hidden" id="projectType" name="projectType" value="${projectAccessoryRelationInfo.projectType}">
+			<div class="form-group layui-row first">
+				<div class="layui-item layui-col-sm12 ">
+					<label class="layui-form-label"><span class="require-item">*</span>附件类型:</label>
+					<div class="layui-input-block">
+						<form:select path="attachId" cssClass="form-control required simple-select">
+							<form:option value="" label=""/>
+							<c:forEach items="${projectAccessoryRelationInfo.projectTemplateList}" var = "template" varStatus="status">
+								<option value="${template.id}" <c:if test="${projectAccessoryRelationInfo.attachId==template.id}">selected</c:if>>${template.attachName}</option>
+							</c:forEach>
+						</form:select>
+					</div>
+				</div>
+			</div>
+		</form:form>
+	</div>
+</div>
+</body>
+</html>

+ 39 - 3
src/main/webapp/webpage/modules/projectAccessory/workAttachmentForm.jsp

@@ -36,9 +36,43 @@
 		});
 
 		function insertTitle(tValue){
+			//文件后缀名
+			var attachTypes = $("#attachTypes").val();
+			//文件大小
+			var attachLength = $("#attachLength").val();
+			var suffixResult = 0;
+
+			var fileName = tValue.lastIndexOf(".");//获取到文件名开始到最后一个“.”的长度。
+			var fileNameLength = tValue.length;//获取到文件名长度
+
+			var suffix = tValue.substring(fileName + 1, fileNameLength);//截取后缀名
+			if(attachTypes!=undefined && attachTypes !=null & attachTypes !=''){
+				var attachTypeList = attachTypes.split(",");
+				for (var x in attachTypeList) {
+					if(attachTypeList[x] == suffix){
+						suffixResult = 1;
+						break;
+					}
+				}
+				if(suffixResult == 0 ){
+					top.layer.msg("上传附件只能为:"+attachTypes+" 类型文件", {icon: 0});
+					return false;
+				}
+			}
+
 			var list = "${workIncomingMessage.workAttachments}";
 			var size = (list.split('url')).length-1;
-			var files = $("#attachment_file")[0].files;            for(var i = 0;i<files.length;i++) {                var file = files[i];
+			var files = $("#attachment_file")[0].files;
+
+			for(var i = 0;i<files.length;i++) {
+				var file = files[i];
+				var fileSize = (file.size/(1024 * 1024)).toFixed(2);
+				if(attachLength !=undefined && attachLength != null && attachLength !='') {
+					if (fileSize > attachLength) {
+						top.layer.msg("上传附件只能上传:" + attachLength + "M以下的文件", {icon: 0});
+						return false;
+					}
+				}
 				var attachmentId = "";
 				var attachmentFlag = "100";
 				console.log(file);
@@ -55,9 +89,11 @@
 <body>
 <div class="single-form">
 	<div class="container">
-		<form:form id="inputForm" modelAttribute="projectAccessory" action="${ctx}/projectAccessory/projectAccessory/saveWorkAttachment" method="post" class="form-horizontal">
+		<form:form id="inputForm" modelAttribute="projectTemplateInfo" action="${ctx}/projectAccessory/projectAccessory/saveWorkAttachment" method="post" class="form-horizontal">
 			<form:hidden path="id"/>
 			<form:hidden path="projectId"/>
+			<form:hidden path="attachTypes"/>
+			<form:hidden path="attachLength"/>
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息</h2></div>
 				<div class="layui-item nav-btns">
@@ -85,7 +121,7 @@
 						</tr>
 						</thead>
 						<tbody id="file_attachment">
-						<c:forEach items="${projectAccessory.workAttachments}" var = "workClientAttachment" varStatus="status">
+						<c:forEach items="${projectTemplateInfo.workAttachments}" var = "workClientAttachment" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
 								<c:choose>

+ 284 - 2
src/main/webapp/webpage/modules/projectcontentinfo/projectReportRecordAudit.jsp

@@ -211,12 +211,170 @@
 			</div>
 
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>报告文件</h2></div>
+				<div class="layui-item nav-btns">
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<span id="_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${projectReportRecord.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+							<tr>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileAttachment.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>依据性资料</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+				</div>
+				<div id="addFile_gistdata" style="display: none" class="upload-progress">
+					<span id="fileName_gistdata" ></span>
+					<span id="_gistdata" ></span>
+					<b><span id="baifenbi_gistdata" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_gistdata" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="gistdata_file" type="file" name="gistdata_file" multiple="multiple" style="display: none;" onChange="if(this.value)gistdataInsertTitle(this.value);"/>
+				<span id="gistdata_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="gistdata_upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_gistdata">
+						<c:forEach items="${projectReportRecord.fileGistdataList}" var = "fileGistdata" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileGistdata.id}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileGistdata.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>其他文件</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+				</div>
+				<div id="addFile_other" style="display: none" class="upload-progress">
+					<span id="fileName_other" ></span>
+					<span id="_other" ></span>
+					<b><span id="baifenbi_other" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_other" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="other_file" type="file" name="other_file" multiple="multiple" style="display: none;" onChange="if(this.value)otherInsertTitle(this.value);"/>
+				<span id="other_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable_other" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_other">
+						<c:forEach items="${projectReportRecord.fileOtherList}" var = "fileOther" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileOther.id}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileOther.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+
+
+			<%--<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息列表</h2></div>
 
 				<div class="layui-item layui-col-xs12 form-table-container">
 					<table id="permissionTable" class="layui-table" lay-filter="permissionTable"></table>
 				</div>
-			</div>
+			</div>--%>
 
 			<%--<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息</h2></div>
@@ -293,6 +451,130 @@
 <script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
 <script src="${ctxStatic}/layer-v2.3/layui/tableTree/treetable.js" charset="utf-8"></script>
 <script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+	function formAttachment(title,url,width,height,target,formId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+				var item = iframeWin.getSelectedItem();
+				setValuee(item);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function setValuee(obj){
+		for(var i=0;i<obj.length;i++){
+			var idArr = $("#file_attachment tr:visible .clientId");
+			if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
+				addRowBaseData("#workBaseDataList",workBaseDataRowIdx,workBaseDataTpl,obj[i]);
+				$("#workBaseDataList"+workBaseDataRowIdx+"_nature").html("引用");
+				workBaseDataRowIdx=workBaseDataRowIdx+1;
+			}
+		}
+	}
+</script>
+<%--<script>
 	/*使用模块加载的方式 加载文件*/
 	layui.config({
 		base: '${ctx}/resoueces/css/layui/module/'
@@ -445,6 +727,6 @@
 			});
 		}
 	}
-</script>
+</script>--%>
 </body>
 </html>

+ 350 - 5
src/main/webapp/webpage/modules/projectcontentinfo/projectReportRecordModifyApply.jsp

@@ -8,8 +8,79 @@
         var validateForm;
         function doSubmit(){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                $("#inputForm").submit();
-                return true;
+				var projectId = '${project.id}';
+				var leng = $("#file_attachment tr").length;
+				var boolFlag = true;
+				for(var i=0; i<leng; i++) {
+					var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+					if(numberStr != undefined && numberStr !=null && numberStr !=''){
+						$.ajax({
+							type: 'post',
+							url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+							data: {"attachmentId":numberStr,"projectId":projectId},
+							dataType: "json",
+							async: false
+						}).success(function (result) {
+							if(result == 0){
+								boolFlag = false;
+								top.layer.msg("请上传报告文件!", {icon: 0});
+								return false;
+							}
+						}).error(function () {
+							top.layer.msg("文件载入失败!");
+						});
+					}
+				}
+				if(boolFlag){
+					var gistdata = $("#file_gistdata tr").length;
+					for(var i=0; i<gistdata; i++) {
+						var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传依据性文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+					}
+				}
+				if(boolFlag){
+					var other = $("#file_other tr").length;
+					for(var i=0; i<other; i++) {
+						var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传其他文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+					}
+				}
+				if(boolFlag) {
+					$("#inputForm").submit();
+					return true;
+				}
             }else {
                 parent.layer.msg("信息未填写完整!", {icon: 5});
             }
@@ -214,7 +285,157 @@
 					</div>
 				</div>
 			</div>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>报告文件</h2></div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<span id="_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${projectReportRecord.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+							<tr>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileAttachment.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>依据性资料</h2></div>
+				<div id="addFile_gistdata" style="display: none" class="upload-progress">
+					<span id="fileName_gistdata" ></span>
+					<span id="_gistdata" ></span>
+					<b><span id="baifenbi_gistdata" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_gistdata" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="gistdata_file" type="file" name="gistdata_file" multiple="multiple" style="display: none;" onChange="if(this.value)gistdataInsertTitle(this.value);"/>
+				<span id="gistdata_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="gistdata_upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_gistdata">
+						<c:forEach items="${projectReportRecord.fileGistdataList}" var = "fileGistdata" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileGistdata.id}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileGistdata.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>其他文件</h2></div>
+				<div id="addFile_other" style="display: none" class="upload-progress">
+					<span id="fileName_other" ></span>
+					<span id="_other" ></span>
+					<b><span id="baifenbi_other" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_other" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="other_file" type="file" name="other_file" multiple="multiple" style="display: none;" onChange="if(this.value)otherInsertTitle(this.value);"/>
+				<span id="other_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable_other" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_other">
+						<c:forEach items="${projectReportRecord.fileOtherList}" var = "fileOther" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileOther.id}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileOther.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+
+			<%--<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息</h2></div>
 				<div class="layui-item nav-btns">
 					<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
@@ -233,7 +454,7 @@
 					<table id="upTable" class="table table-bordered table-condensed details">
 						<thead>
 						<tr>
-								<%-- <th>序号</th>--%>
+								&lt;%&ndash; <th>序号</th>&ndash;%&gt;
 							<th>文件预览</th>
 							<th>上传人</th>
 							<th>上传时间</th>
@@ -243,7 +464,7 @@
 						<tbody id="file_attachment">
 						<c:forEach items="${projectReportRecord.workAttachments}" var = "workClientAttachment" varStatus="status">
 							<tr>
-									<%-- <td>${status.index + 1}</td>--%>
+									&lt;%&ndash; <td>${status.index + 1}</td>&ndash;%&gt;
 								<c:choose>
 									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
                                                            or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
@@ -279,10 +500,134 @@
 						</tbody>
 					</table>
 				</div>
-			</div>
+			</div>--%>
 			<div class="form-group layui-row page-end"></div>
 		</form:form>
 	</div>
 </div>
+<script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+	function formAttachment(title,url,width,height,target,formId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+				var item = iframeWin.getSelectedItem();
+				setValuee(item);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function setValuee(obj){
+		for(var i=0;i<obj.length;i++){
+			var idArr = $("#file_attachment tr:visible .clientId");
+			if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
+				addRowBaseData("#workBaseDataList",workBaseDataRowIdx,workBaseDataTpl,obj[i]);
+				$("#workBaseDataList"+workBaseDataRowIdx+"_nature").html("引用");
+				workBaseDataRowIdx=workBaseDataRowIdx+1;
+			}
+		}
+	}
+</script>
 </body>
 </html>

+ 619 - 10
src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectReportRecord/projectReportRecordForm.jsp

@@ -27,14 +27,94 @@
         var validateForm;
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if(obj == 2){
-                    //$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectReportRecord/store");
-					$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/holdSaveRecord");
-                }else{
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/saveRecord");
-                }
-                $("#inputForm").submit();
-                return true;
+				var projectId = '${project.id}';
+				var leng = $("#file_attachment tr").length;
+				var boolFlag = true;
+				for(var i=0; i<leng; i++) {
+					var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+					var second = $("#file_attachment tr").eq(i).find("td:eq(1)").html();
+					if(second == 1){
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传报告文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+					}
+				}
+				if(boolFlag){
+					var gistdata = $("#file_gistdata tr").length;
+					for(var i=0; i<gistdata; i++) {
+						var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+						var second = $("#file_gistdata tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传依据性文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					var other = $("#file_other tr").length;
+					for(var i=0; i<other; i++) {
+						var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+						var second = $("#file_other tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传其他文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					if(obj == 2){
+						//$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectReportRecord/store");
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/holdSaveRecord");
+					}else{
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/saveRecord");
+					}
+					$("#inputForm").submit();
+					return true;
+				}
             }else {
                 parent.layer.msg("信息未填写完整!", {icon: 5});
             }
@@ -207,14 +287,257 @@
 				</div>
 			</div>
 
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>报告文件</h2></div>
+				<div class="layui-item nav-btns">
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=11&projectType=2&projectId=${project.id}','500px','350px',false,'inputForm','file_attachment')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<span id="_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${projectReportRecord.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+							<tr>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td style="display:none">${fileAttachment.mustFlag}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileAttachment.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="fileAttachmentTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="fileAttachment{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>依据性资料</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=12&projectType=2&projectId=${project.id}','500px','350px',false,'inputForm','file_gistdata')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_gistdata" style="display: none" class="upload-progress">
+					<span id="fileName_gistdata" ></span>
+					<span id="_gistdata" ></span>
+					<b><span id="baifenbi_gistdata" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_gistdata" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="gistdata_file" type="file" name="gistdata_file" multiple="multiple" style="display: none;" onChange="if(this.value)gistdataInsertTitle(this.value);"/>
+				<span id="gistdata_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="gistdata_upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_gistdata">
+						<c:forEach items="${projectReportRecord.fileGistdataList}" var = "fileGistdata" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileGistdata.id}</td>
+										<td style="display:none">${fileGistdata.mustFlag}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileGistdata.id}&projectId=${project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="gistdataTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="gistdataTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>其他文件</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=13&projectType=2&projectId=${project.id}','500px','350px',false,'inputForm','file_other')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_other" style="display: none" class="upload-progress">
+					<span id="fileName_other" ></span>
+					<span id="_other" ></span>
+					<b><span id="baifenbi_other" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_other" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="other_file" type="file" name="other_file" multiple="multiple" style="display: none;" onChange="if(this.value)otherInsertTitle(this.value);"/>
+				<span id="other_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable_other" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_other">
+						<c:forEach items="${projectReportRecord.fileOtherList}" var = "fileOther" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileOther.id}</td>
+										<td style="display:none">${fileOther.mustFlag}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileOther.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="otherTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="otherTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
+			<%--<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息列表</h2></div>
 
 				<div class="layui-item layui-col-xs12 form-table-container">
 					<table id="permissionTable" class="layui-table" lay-filter="permissionTable"></table>
 				</div>
-			</div>
+			</div>--%>
 
 			<%--<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息</h2></div>
@@ -288,6 +611,292 @@
 </div><script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
 <script src="${ctxStatic}/layer-v2.3/layui/tableTree/treetable.js" charset="utf-8"></script>
 <script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	//新增行方法
+	var fileAttachmentTpl = $("#fileAttachmentTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var gistdataTpl = $("#gistdataTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var otherTpl = $("#otherTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+
+	function formAttachment(title,url,width,height,target,formId,divId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				inputForm.attr("action","${ctx}/projectTemplate/projectTemplate/getProjectTemplateInfo");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				formSubmitAjax($document,formId,index,divId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmitAjax($document,inputForm,index,divId){
+		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) {
+					if(!data.success){
+						top.layer.msg("保存依据资料信息异常!",{icon:2});
+						return false;
+					}
+					var idx = ''
+					if(divId == 'file_attachment'){
+						idx = $("#file_attachment tr").length;
+						addRowBaseData("#file_attachment",idx,fileAttachmentTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_gistdata'){
+						idx = $("#file_gistdata tr").length;
+						addRowBaseData("#file_gistdata",idx,gistdataTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_other'){
+						idx = $("#file_other tr").length;
+						addRowBaseData("#file_other",idx,otherTpl,data.body.projectAccessoryInfo);
+					}
+					parent.layer.msg(data.msg,{icon:1});
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	function hasInArr(id,idArr) {
+		for(var i=0;i<idArr.length;i++){
+			if(id==$(idArr[i]).val()){
+				return true;
+			}
+		}
+		return false;
+	}
+	function existBaseData(id,length) {
+		for (var i=0;i<length;i++) {
+			var val = $('#file_attachment'+i+'_id').val();
+			if(id==val){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	function addRowBaseData(list, idx, tpl, row){
+		bornTemplete(list, idx, tpl, row, idx);
+	}
+
+	function bornTemplete(list, idx, tpl, row, idx1){
+		var idx1 = '';
+		if(list == 'file_attachment'){
+			idx1 = $("#file_attachment tr").length +1;
+		}else if(list == 'file_gistdata'){
+			idx1 = $("#file_gistdata tr").length +1;
+		}else if(list == 'file_other'){
+			idx1 = $("#file_other tr").length +1;
+		}
+
+		$(list).append(Mustache.render(tpl, {
+			idx: idx, delBtn: true, row: row,
+			order:idx1 + 1, idx1:idx1
+		}));
+		$(list+idx).find("select").each(function(){
+			$(this).val($(this).attr("data-value"));
+		});
+		$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+			var ss = $(this).attr("data-value").split(',');
+			for (var i=0; i<ss.length; i++){
+				if($(this).val() == ss[i]){
+					$(this).attr("checked","checked");
+				}
+			}
+		});
+	}
+	function delRowBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function delBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function confirmDelete(mess, href){
+		top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){
+			//do something
+			if (typeof href == 'function') {
+				href();
+			}else{
+				$.ajax({
+					url:href,
+					type:"post",
+					success:function(data){
+						if(data.success){
+							top.layer.msg("删除依据资料成功!", {icon: 0});
+						}
+					}
+				});
+			}
+			top.layer.close(index);
+		});
+		return false;
+	}
+</script>
+<%--<script>
 	/*使用模块加载的方式 加载文件*/
 	layui.config({
 		base: '${ctx}/resoueces/css/layui/module/'
@@ -440,6 +1049,6 @@
 			});
 		}
 	}
-</script>
+</script>--%>
 </body>
 </html>

+ 619 - 10
src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectReportRecord/projectReportRecordModify.jsp

@@ -27,14 +27,94 @@
         var validateForm;
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if(obj == 2){
-					//$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectReportRecord/store");
-					$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/holdSaveRecord");
-                }else{
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/saveRecord");
-                }
-                $("#inputForm").submit();
-                return true;
+				var projectId = '${project.id}';
+				var leng = $("#file_attachment tr").length;
+				var boolFlag = true;
+				for(var i=0; i<leng; i++) {
+					var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+					var second = $("#file_attachment tr").eq(i).find("td:eq(1)").html();
+					if(second == 1){
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传报告文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+					}
+				}
+				if(boolFlag){
+					var gistdata = $("#file_gistdata tr").length;
+					for(var i=0; i<gistdata; i++) {
+						var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+						var second = $("#file_gistdata tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传依据性文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					var other = $("#file_other tr").length;
+					for(var i=0; i<other; i++) {
+						var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+						var second = $("#file_other tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传其他文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					if(obj == 2){
+						//$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectReportRecord/store");
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/holdSaveRecord");
+					}else{
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/saveRecord");
+					}
+					$("#inputForm").submit();
+					return true;
+				}
             }else {
                 parent.layer.msg("信息未填写完整!", {icon: 5});
             }
@@ -239,14 +319,257 @@
 				</div>
 			</div>
 
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>报告文件</h2></div>
+				<div class="layui-item nav-btns">
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=11&projectType=2&projectId=${project.id}','500px','350px',false,'inputForm','file_attachment')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<span id="_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${projectReportRecord.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+							<tr>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td style="display:none">${fileAttachment.mustFlag}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileAttachment.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="fileAttachmentTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="fileAttachment{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>依据性资料</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=12&projectType=2&projectId=${project.id}','500px','350px',false,'inputForm','file_gistdata')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_gistdata" style="display: none" class="upload-progress">
+					<span id="fileName_gistdata" ></span>
+					<span id="_gistdata" ></span>
+					<b><span id="baifenbi_gistdata" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_gistdata" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="gistdata_file" type="file" name="gistdata_file" multiple="multiple" style="display: none;" onChange="if(this.value)gistdataInsertTitle(this.value);"/>
+				<span id="gistdata_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="gistdata_upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_gistdata">
+						<c:forEach items="${projectReportRecord.fileGistdataList}" var = "fileGistdata" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileGistdata.id}</td>
+										<td style="display:none">${fileGistdata.mustFlag}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileGistdata.id}&projectId=${project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="gistdataTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="gistdataTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>其他文件</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=13&projectType=2&projectId=${project.id}','500px','350px',false,'inputForm','file_other')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_other" style="display: none" class="upload-progress">
+					<span id="fileName_other" ></span>
+					<span id="_other" ></span>
+					<b><span id="baifenbi_other" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_other" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="other_file" type="file" name="other_file" multiple="multiple" style="display: none;" onChange="if(this.value)otherInsertTitle(this.value);"/>
+				<span id="other_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable_other" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_other">
+						<c:forEach items="${projectReportRecord.fileOtherList}" var = "fileOther" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileOther.id}</td>
+										<td style="display:none">${fileOther.mustFlag}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileOther.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="otherTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="otherTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
+			<%--<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息列表</h2></div>
 
 				<div class="layui-item layui-col-xs12 form-table-container">
 					<table id="permissionTable" class="layui-table" lay-filter="permissionTable"></table>
 				</div>
-			</div>
+			</div>--%>
 
 
 			<%--<div class="form-group layui-row">
@@ -322,6 +645,292 @@
 <script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
 <script src="${ctxStatic}/layer-v2.3/layui/tableTree/treetable.js" charset="utf-8"></script>
 <script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	//新增行方法
+	var fileAttachmentTpl = $("#fileAttachmentTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var gistdataTpl = $("#gistdataTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var otherTpl = $("#otherTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+
+	function formAttachment(title,url,width,height,target,formId,divId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				inputForm.attr("action","${ctx}/projectTemplate/projectTemplate/getProjectTemplateInfo");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				formSubmitAjax($document,formId,index,divId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmitAjax($document,inputForm,index,divId){
+		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) {
+					if(!data.success){
+						top.layer.msg("保存依据资料信息异常!",{icon:2});
+						return false;
+					}
+					var idx = ''
+					if(divId == 'file_attachment'){
+						idx = $("#file_attachment tr").length;
+						addRowBaseData("#file_attachment",idx,fileAttachmentTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_gistdata'){
+						idx = $("#file_gistdata tr").length;
+						addRowBaseData("#file_gistdata",idx,gistdataTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_other'){
+						idx = $("#file_other tr").length;
+						addRowBaseData("#file_other",idx,otherTpl,data.body.projectAccessoryInfo);
+					}
+					parent.layer.msg(data.msg,{icon:1});
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	function hasInArr(id,idArr) {
+		for(var i=0;i<idArr.length;i++){
+			if(id==$(idArr[i]).val()){
+				return true;
+			}
+		}
+		return false;
+	}
+	function existBaseData(id,length) {
+		for (var i=0;i<length;i++) {
+			var val = $('#file_attachment'+i+'_id').val();
+			if(id==val){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	function addRowBaseData(list, idx, tpl, row){
+		bornTemplete(list, idx, tpl, row, idx);
+	}
+
+	function bornTemplete(list, idx, tpl, row, idx1){
+		var idx1 = '';
+		if(list == 'file_attachment'){
+			idx1 = $("#file_attachment tr").length +1;
+		}else if(list == 'file_gistdata'){
+			idx1 = $("#file_gistdata tr").length +1;
+		}else if(list == 'file_other'){
+			idx1 = $("#file_other tr").length +1;
+		}
+
+		$(list).append(Mustache.render(tpl, {
+			idx: idx, delBtn: true, row: row,
+			order:idx1 + 1, idx1:idx1
+		}));
+		$(list+idx).find("select").each(function(){
+			$(this).val($(this).attr("data-value"));
+		});
+		$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+			var ss = $(this).attr("data-value").split(',');
+			for (var i=0; i<ss.length; i++){
+				if($(this).val() == ss[i]){
+					$(this).attr("checked","checked");
+				}
+			}
+		});
+	}
+	function delRowBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function delBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function confirmDelete(mess, href){
+		top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){
+			//do something
+			if (typeof href == 'function') {
+				href();
+			}else{
+				$.ajax({
+					url:href,
+					type:"post",
+					success:function(data){
+						if(data.success){
+							top.layer.msg("删除依据资料成功!", {icon: 0});
+						}
+					}
+				});
+			}
+			top.layer.close(index);
+		});
+		return false;
+	}
+</script>
+<%--<script>
 	/*使用模块加载的方式 加载文件*/
 	layui.config({
 		base: '${ctx}/resoueces/css/layui/module/'
@@ -474,6 +1083,6 @@
 			});
 		}
 	}
-</script>
+</script>--%>
 </body>
 </html>

+ 509 - 115
src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectcontentinfo/reportForm.jsp

@@ -15,14 +15,94 @@
         var dataList;
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if(obj == 1){
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/saveReport");
-                }else{
-                    //$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectcontentinfo/save?view=report");
-					$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/holdSaveReport");
-                }
-                $("#inputForm").submit();
-                return true;
+				var projectId = '${projectRecords.id}';
+				var leng = $("#file_attachment tr").length;
+				var boolFlag = true;
+				for(var i=0; i<leng; i++) {
+					var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+					var second = $("#file_attachment tr").eq(i).find("td:eq(1)").html();
+					if(second == 1){
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传报告文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+					}
+				}
+				if(boolFlag){
+					var gistdata = $("#file_gistdata tr").length;
+					for(var i=0; i<gistdata; i++) {
+						var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+						var second = $("#file_gistdata tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传依据性文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					var other = $("#file_other tr").length;
+					for(var i=0; i<other; i++) {
+						var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+						var second = $("#file_other tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传其他文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					if(obj == 1){
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/saveReport");
+					}else{
+						//$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectcontentinfo/save?view=report");
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/holdSaveReport");
+					}
+					$("#inputForm").submit();
+					return true;
+				}
             }
 
             return false;
@@ -477,7 +557,8 @@
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>报告文件</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=11&projectType=2&projectId=${projectRecords.id}','500px','350px',false,'inputForm','file_attachment')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_attachment" style="display: none" class="upload-progress">
 					<span id="fileName_attachment" ></span>
@@ -495,59 +576,70 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+									<th>电子件名称</th>
+									<th>最大容量(M)</th>
+									<th>类型限制</th>
+									<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_attachment">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_attachment'}">
+						<c:forEach items="${projectcontentinfo.fileAttachmentList}" var = "fileAttachment" varStatus="status">
 							<tr>
-									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td style="display:none">${fileAttachment.mustFlag}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<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>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileAttachment.id}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="fileAttachmentTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="fileAttachment{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>依据性资料</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=12&projectType=2&projectId=${projectRecords.id}','500px','350px',false,'inputForm','file_gistdata')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_gistdata" style="display: none" class="upload-progress">
 					<span id="fileName_gistdata" ></span>
@@ -565,59 +657,71 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+									<th>电子件名称</th>
+									<th>最大容量(M)</th>
+									<th>类型限制</th>
+									<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_gistdata">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_gistdata'}">
+						<c:forEach items="${projectcontentinfo.fileGistdataList}" var = "fileGistdata" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileGistdata.id}</td>
+										<td style="display:none">${fileGistdata.mustFlag}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFileGistdata')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileGistdata.id}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="gistdataTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="gistdataTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>其他文件</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=13&projectType=2&projectId=${projectRecords.id}','500px','350px',false,'inputForm','file_other')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_other" style="display: none" class="upload-progress">
 					<span id="fileName_other" ></span>
@@ -635,65 +739,355 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+									<th>电子件名称</th>
+									<th>最大容量(M)</th>
+									<th>类型限制</th>
+									<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_other">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_other'}">
+						<c:forEach items="${projectcontentinfo.fileOtherList}" var = "fileOther" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileOther.id}</td>
+										<td style="display:none">${fileOther.mustFlag}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFileOther')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileOther.id}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="otherTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="otherTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
 
-
-
-			<c:if test="${not empty projectcontentinfo.infoId}">
-				<div class="pull-right">
-					<button id="btnSubmit" class="btn btn-primary btn-rounded btn-outline btn-sm" type="submit" onclick="$('#edit').val('edit')"><i class="fa fa-chevron-up"></i>暂 存</button>
-				</div>
-			</c:if>
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 		<div class="form-group layui-row page-end"></div>
 		</form:form>
 	</div>
 </div>
+<script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					//刷新当前模块
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	//新增行方法
+	var fileAttachmentTpl = $("#fileAttachmentTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var gistdataTpl = $("#gistdataTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var otherTpl = $("#otherTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+
+	function formAttachment(title,url,width,height,target,formId,divId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				inputForm.attr("action","${ctx}/projectTemplate/projectTemplate/getProjectTemplateInfo");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				formSubmitAjax($document,formId,index,divId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmitAjax($document,inputForm,index,divId){
+		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) {
+					if(!data.success){
+						top.layer.msg("保存依据资料信息异常!",{icon:2});
+						return false;
+					}
+					var idx = ''
+					if(divId == 'file_attachment'){
+						idx = $("#file_attachment tr").length;
+						addRowBaseData("#file_attachment",idx,fileAttachmentTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_gistdata'){
+						idx = $("#file_gistdata tr").length;
+						addRowBaseData("#file_gistdata",idx,gistdataTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_other'){
+						idx = $("#file_other tr").length;
+						addRowBaseData("#file_other",idx,otherTpl,data.body.projectAccessoryInfo);
+					}
+					parent.layer.msg(data.msg,{icon:1});
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	function hasInArr(id,idArr) {
+		for(var i=0;i<idArr.length;i++){
+			if(id==$(idArr[i]).val()){
+				return true;
+			}
+		}
+		return false;
+	}
+	function existBaseData(id,length) {
+		for (var i=0;i<length;i++) {
+			var val = $('#file_attachment'+i+'_id').val();
+			if(id==val){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	function addRowBaseData(list, idx, tpl, row){
+		bornTemplete(list, idx, tpl, row, idx);
+	}
+
+	function bornTemplete(list, idx, tpl, row, idx1){
+		var idx1 = '';
+		if(list == 'file_attachment'){
+			idx1 = $("#file_attachment tr").length +1;
+		}else if(list == 'file_gistdata'){
+			idx1 = $("#file_gistdata tr").length +1;
+		}else if(list == 'file_other'){
+			idx1 = $("#file_other tr").length +1;
+		}
+
+		$(list).append(Mustache.render(tpl, {
+			idx: idx, delBtn: true, row: row,
+			order:idx1 + 1, idx1:idx1
+		}));
+		$(list+idx).find("select").each(function(){
+			$(this).val($(this).attr("data-value"));
+		});
+		$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+			var ss = $(this).attr("data-value").split(',');
+			for (var i=0; i<ss.length; i++){
+				if($(this).val() == ss[i]){
+					$(this).attr("checked","checked");
+				}
+			}
+		});
+	}
+	function delRowBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function delBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function confirmDelete(mess, href){
+		top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){
+			//do something
+			if (typeof href == 'function') {
+				href();
+			}else{
+				$.ajax({
+					url:href,
+					type:"post",
+					success:function(data){
+						if(data.success){
+							top.layer.msg("删除依据资料成功!", {icon: 0});
+						}
+					}
+				});
+			}
+			top.layer.close(index);
+		});
+		return false;
+	}
+</script>
 </body>
 </html>

+ 508 - 106
src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectcontentinfo/reportModify.jsp

@@ -15,13 +15,93 @@
         var dataList;
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if(obj == 1){
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/reportAudit");
-                }else{
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/reportAudit");
-                }
-                $("#inputForm").submit();
-                return true;
+				var projectId = '${projectId}';
+				var leng = $("#file_attachment tr").length;
+				var boolFlag = true;
+				for(var i=0; i<leng; i++) {
+					var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+					var second = $("#file_attachment tr").eq(i).find("td:eq(1)").html();
+					if(second == 1){
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传报告文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+					}
+				}
+				if(boolFlag){
+					var gistdata = $("#file_gistdata tr").length;
+					for(var i=0; i<gistdata; i++) {
+						var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+						var second = $("#file_gistdata tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传依据性文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					var other = $("#file_other tr").length;
+					for(var i=0; i<other; i++) {
+						var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+						var second = $("#file_other tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传其他文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					if(obj == 1){
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/reportAudit");
+					}else{
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralCostProjectMessage/reportAudit");
+					}
+					$("#inputForm").submit();
+					return true;
+				}
             }
 
             return false;
@@ -461,7 +541,8 @@
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>报告文件</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+						<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=11&projectType=2&projectId=${projectId}','500px','350px',false,'inputForm','file_attachment')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_attachment" style="display: none" class="upload-progress">
 					<span id="fileName_attachment" ></span>
@@ -479,59 +560,71 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_attachment">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_attachment'}">
+						<c:forEach items="${projectcontentinfo.fileAttachmentList}" var = "fileAttachment" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td style="display:none">${fileAttachment.mustFlag}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<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>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileAttachment.id}&projectId=${projectId}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="fileAttachmentTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="fileAttachment{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectId}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>依据性资料</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+						<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=12&projectType=2&projectId=${projectId}','500px','350px',false,'inputForm','file_gistdata')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_gistdata" style="display: none" class="upload-progress">
 					<span id="fileName_gistdata" ></span>
@@ -549,59 +642,71 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_gistdata">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_gistdata'}">
+						<c:forEach items="${projectcontentinfo.fileGistdataList}" var = "fileGistdata" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileGistdata.id}</td>
+								<td style="display:none">${fileGistdata.mustFlag}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFileGistdata')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileGistdata.id}&projectId=${projectId}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="gistdataTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="gistdataTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectId}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>其他文件</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+						<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=13&projectType=2&projectId=${projectId}','500px','350px',false,'inputForm','file_other')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_other" style="display: none" class="upload-progress">
 					<span id="fileName_other" ></span>
@@ -619,57 +724,354 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_other">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_other'}">
+						<c:forEach items="${projectcontentinfo.fileOtherList}" var = "fileOther" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileOther.id}</td>
+										<td style="display:none">${fileOther.mustFlag}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFileOther')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileOther.id}&projectId=${projectId}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="otherTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="otherTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectId}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 		<div class="form-group layui-row page-end"></div>
 		</form:form>
 	</div>
 </div>
+<script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	//新增行方法
+	var fileAttachmentTpl = $("#fileAttachmentTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var gistdataTpl = $("#gistdataTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var otherTpl = $("#otherTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+
+	function formAttachment(title,url,width,height,target,formId,divId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				inputForm.attr("action","${ctx}/projectTemplate/projectTemplate/getProjectTemplateInfo");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				formSubmitAjax($document,formId,index,divId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmitAjax($document,inputForm,index,divId){
+		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) {
+					if(!data.success){
+						top.layer.msg("保存依据资料信息异常!",{icon:2});
+						return false;
+					}
+					var idx = ''
+					if(divId == 'file_attachment'){
+						idx = $("#file_attachment tr").length;
+						addRowBaseData("#file_attachment",idx,fileAttachmentTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_gistdata'){
+						idx = $("#file_gistdata tr").length;
+						addRowBaseData("#file_gistdata",idx,gistdataTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_other'){
+						idx = $("#file_other tr").length;
+						addRowBaseData("#file_other",idx,otherTpl,data.body.projectAccessoryInfo);
+					}
+					parent.layer.msg(data.msg,{icon:1});
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	function hasInArr(id,idArr) {
+		for(var i=0;i<idArr.length;i++){
+			if(id==$(idArr[i]).val()){
+				return true;
+			}
+		}
+		return false;
+	}
+	function existBaseData(id,length) {
+		for (var i=0;i<length;i++) {
+			var val = $('#file_attachment'+i+'_id').val();
+			if(id==val){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	function addRowBaseData(list, idx, tpl, row){
+		bornTemplete(list, idx, tpl, row, idx);
+	}
+
+	function bornTemplete(list, idx, tpl, row, idx1){
+		var idx1 = '';
+		if(list == 'file_attachment'){
+			idx1 = $("#file_attachment tr").length +1;
+		}else if(list == 'file_gistdata'){
+			idx1 = $("#file_gistdata tr").length +1;
+		}else if(list == 'file_other'){
+			idx1 = $("#file_other tr").length +1;
+		}
+
+		$(list).append(Mustache.render(tpl, {
+			idx: idx, delBtn: true, row: row,
+			order:idx1 + 1, idx1:idx1
+		}));
+		$(list+idx).find("select").each(function(){
+			$(this).val($(this).attr("data-value"));
+		});
+		$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+			var ss = $(this).attr("data-value").split(',');
+			for (var i=0; i<ss.length; i++){
+				if($(this).val() == ss[i]){
+					$(this).attr("checked","checked");
+				}
+			}
+		});
+	}
+	function delRowBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function delBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function confirmDelete(mess, href){
+		top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){
+			//do something
+			if (typeof href == 'function') {
+				href();
+			}else{
+				$.ajax({
+					url:href,
+					type:"post",
+					success:function(data){
+						if(data.success){
+							top.layer.msg("删除依据资料成功!", {icon: 0});
+						}
+					}
+				});
+			}
+			top.layer.close(index);
+		});
+		return false;
+	}
+</script>
 </body>
 </html>

+ 187 - 102
src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectcontentinfo/reportView.jsp

@@ -107,44 +107,31 @@
 				<table id="upTable" class="table table-bordered table-condensed details">
 					<thead>
 					<tr>
-						<th>文件预览</th>
-						<th>上传人</th>
-						<th>上传时间</th>
+						<th>电子件名称</th>
+						<th>最大容量(M)</th>
+						<th>类型限制</th>
+						<th>文件名</th>
 						<th width="150px">操作</th>
 					</tr>
 					</thead>
 					<tbody id="file_attachment">
-					<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-						<c:if test="${workClientAttachment.divIdType eq '_attachment'}">
-							<tr>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-								<td class="op-td">
-									<div class="op-btn-box" >
-										<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>
-									</div>
-								</td>
-							</tr>
-						</c:if>
+					<c:forEach items="${projectcontentinfo.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+						<tr>
+							<td style="display:none">${fileAttachment.id}</td>
+							<td>${fileAttachment.attachName}</td>
+							<td>${fileAttachment.attachLength}</td>
+							<td>${fileAttachment.attachTypes}</td>
+							<td>
+								<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+									<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+								</c:forEach>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileAttachment.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+								</div>
+							</td>
+						</tr>
 					</c:forEach>
 					</tbody>
 				</table>
@@ -167,44 +154,31 @@
 				<table id="gistdata_upTable" class="table table-bordered table-condensed details">
 					<thead>
 					<tr>
-						<th>文件预览</th>
-						<th>上传人</th>
-						<th>上传时间</th>
+						<th>电子件名称</th>
+						<th>最大容量(M)</th>
+						<th>类型限制</th>
+						<th>文件名</th>
 						<th width="150px">操作</th>
 					</tr>
 					</thead>
 					<tbody id="file_gistdata">
-					<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-						<c:if test="${workClientAttachment.divIdType eq '_gistdata'}">
-							<tr>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-								<td class="op-td">
-									<div class="op-btn-box" >
-										<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>
-									</div>
-								</td>
-							</tr>
-						</c:if>
+					<c:forEach items="${projectcontentinfo.fileGistdataList}" var = "fileGistdata" varStatus="status">
+						<tr>
+							<td style="display:none">${fileGistdata.id}</td>
+							<td>${fileGistdata.attachName}</td>
+							<td>${fileGistdata.attachLength}</td>
+							<td>${fileGistdata.attachTypes}</td>
+							<td>
+								<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+									<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+								</c:forEach>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileGistdata.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+								</div>
+							</td>
+						</tr>
 					</c:forEach>
 					</tbody>
 				</table>
@@ -227,44 +201,31 @@
 				<table id="upTable_other" class="table table-bordered table-condensed details">
 					<thead>
 					<tr>
-						<th>文件预览</th>
-						<th>上传人</th>
-						<th>上传时间</th>
+						<th>电子件名称</th>
+						<th>最大容量(M)</th>
+						<th>类型限制</th>
+						<th>文件名</th>
 						<th width="150px">操作</th>
 					</tr>
 					</thead>
 					<tbody id="file_other">
-					<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-						<c:if test="${workClientAttachment.divIdType eq '_other'}">
-							<tr>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-								<td class="op-td">
-									<div class="op-btn-box" >
-										<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>
-									</div>
-								</td>
-							</tr>
-						</c:if>
+					<c:forEach items="${projectcontentinfo.fileOtherList}" var = "fileOther" varStatus="status">
+						<tr>
+							<td style="display:none">${fileOther.id}</td>
+							<td>${fileOther.attachName}</td>
+							<td>${fileOther.attachLength}</td>
+							<td>${fileOther.attachTypes}</td>
+							<td>
+								<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+									<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+								</c:forEach>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileOther.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+								</div>
+							</td>
+						</tr>
 					</c:forEach>
 					</tbody>
 				</table>
@@ -285,5 +246,129 @@
 		</form:form>
 	</div>
 </div>
+<script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+	function formAttachment(title,url,width,height,target,formId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+				var item = iframeWin.getSelectedItem();
+				setValuee(item);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function setValuee(obj){
+		for(var i=0;i<obj.length;i++){
+			var idArr = $("#file_attachment tr:visible .clientId");
+			if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
+				addRowBaseData("#workBaseDataList",workBaseDataRowIdx,workBaseDataTpl,obj[i]);
+				$("#workBaseDataList"+workBaseDataRowIdx+"_nature").html("引用");
+				workBaseDataRowIdx=workBaseDataRowIdx+1;
+			}
+		}
+	}
+</script>
 </body>
 </html>

+ 620 - 10
src/main/webapp/webpage/modules/ruralprojectrecords/projectReportRecord/projectReportRecordForm.jsp

@@ -28,14 +28,94 @@
         var validateForm;
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if(obj == 2){
-                    //$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectReportRecord/store");
-					$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/holdSaveRecord");
-                }else{
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/saveRecord");
-                }
-                $("#inputForm").submit();
-                return true;
+				var projectId = '${project.id}';
+				var leng = $("#file_attachment tr").length;
+				var boolFlag = true;
+				for(var i=0; i<leng; i++) {
+					var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+					var second = $("#file_attachment tr").eq(i).find("td:eq(1)").html();
+					if(second == 1){
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传报告文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+					}
+				}
+				if(boolFlag){
+					var gistdata = $("#file_gistdata tr").length;
+					for(var i=0; i<gistdata; i++) {
+						var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+						var second = $("#file_gistdata tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传依据性文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					var other = $("#file_other tr").length;
+					for(var i=0; i<other; i++) {
+						var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+						var second = $("#file_other tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传其他文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					if(obj == 2){
+						//$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectReportRecord/store");
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/holdSaveRecord");
+					}else{
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/saveRecord");
+					}
+					$("#inputForm").submit();
+					return true;
+				}
             }else {
                 parent.layer.msg("信息未填写完整!", {icon: 5});
             }
@@ -208,14 +288,258 @@
 				</div>
 			</div>
 
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>报告文件</h2></div>
+				<div class="layui-item nav-btns">
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=11&projectType=1&projectId=${project.id}','500px','350px',false,'inputForm','file_attachment')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<span id="_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${projectReportRecord.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+							<tr>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td style="display:none">${fileAttachment.mustFlag}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileAttachment.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="fileAttachmentTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="fileAttachment{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>依据性资料</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=12&projectType=1&projectId=${project.id}','500px','350px',false,'inputForm','file_gistdata')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_gistdata" style="display: none" class="upload-progress">
+					<span id="fileName_gistdata" ></span>
+					<span id="_gistdata" ></span>
+					<b><span id="baifenbi_gistdata" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_gistdata" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="gistdata_file" type="file" name="gistdata_file" multiple="multiple" style="display: none;" onChange="if(this.value)gistdataInsertTitle(this.value);"/>
+				<span id="gistdata_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="gistdata_upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_gistdata">
+						<c:forEach items="${projectReportRecord.fileGistdataList}" var = "fileGistdata" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileGistdata.id}</td>
+										<td style="display:none">${fileGistdata.mustFlag}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileGistdata.id}&projectId=${project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="gistdataTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="gistdataTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>其他文件</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=13&projectType=1&projectId=${project.id}','500px','350px',false,'inputForm','file_other')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_other" style="display: none" class="upload-progress">
+					<span id="fileName_other" ></span>
+					<span id="_other" ></span>
+					<b><span id="baifenbi_other" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_other" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="other_file" type="file" name="other_file" multiple="multiple" style="display: none;" onChange="if(this.value)otherInsertTitle(this.value);"/>
+				<span id="other_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable_other" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_other">
+						<c:forEach items="${projectReportRecord.fileOtherList}" var = "fileOther" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileOther.id}</td>
+										<td style="display:none">${fileOther.mustFlag}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileOther.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="otherTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="otherTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
+
+			<%--<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息列表</h2></div>
 
 				<div class="layui-item layui-col-xs12 form-table-container">
 					<table id="permissionTable" class="layui-table" lay-filter="permissionTable"></table>
 				</div>
-			</div>
+			</div>--%>
 
 			<%--<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息</h2></div>
@@ -290,6 +614,292 @@
 <script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
 <script src="${ctxStatic}/layer-v2.3/layui/tableTree/treetable.js" charset="utf-8"></script>
 <script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	//新增行方法
+	var fileAttachmentTpl = $("#fileAttachmentTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var gistdataTpl = $("#gistdataTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var otherTpl = $("#otherTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+
+	function formAttachment(title,url,width,height,target,formId,divId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				inputForm.attr("action","${ctx}/projectTemplate/projectTemplate/getProjectTemplateInfo");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				formSubmitAjax($document,formId,index,divId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmitAjax($document,inputForm,index,divId){
+		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) {
+					if(!data.success){
+						top.layer.msg("保存依据资料信息异常!",{icon:2});
+						return false;
+					}
+					var idx = ''
+					if(divId == 'file_attachment'){
+						idx = $("#file_attachment tr").length;
+						addRowBaseData("#file_attachment",idx,fileAttachmentTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_gistdata'){
+						idx = $("#file_gistdata tr").length;
+						addRowBaseData("#file_gistdata",idx,gistdataTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_other'){
+						idx = $("#file_other tr").length;
+						addRowBaseData("#file_other",idx,otherTpl,data.body.projectAccessoryInfo);
+					}
+					parent.layer.msg(data.msg,{icon:1});
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	function hasInArr(id,idArr) {
+		for(var i=0;i<idArr.length;i++){
+			if(id==$(idArr[i]).val()){
+				return true;
+			}
+		}
+		return false;
+	}
+	function existBaseData(id,length) {
+		for (var i=0;i<length;i++) {
+			var val = $('#file_attachment'+i+'_id').val();
+			if(id==val){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	function addRowBaseData(list, idx, tpl, row){
+		bornTemplete(list, idx, tpl, row, idx);
+	}
+
+	function bornTemplete(list, idx, tpl, row, idx1){
+		var idx1 = '';
+		if(list == 'file_attachment'){
+			idx1 = $("#file_attachment tr").length +1;
+		}else if(list == 'file_gistdata'){
+			idx1 = $("#file_gistdata tr").length +1;
+		}else if(list == 'file_other'){
+			idx1 = $("#file_other tr").length +1;
+		}
+
+		$(list).append(Mustache.render(tpl, {
+			idx: idx, delBtn: true, row: row,
+			order:idx1 + 1, idx1:idx1
+		}));
+		$(list+idx).find("select").each(function(){
+			$(this).val($(this).attr("data-value"));
+		});
+		$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+			var ss = $(this).attr("data-value").split(',');
+			for (var i=0; i<ss.length; i++){
+				if($(this).val() == ss[i]){
+					$(this).attr("checked","checked");
+				}
+			}
+		});
+	}
+	function delRowBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function delBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function confirmDelete(mess, href){
+		top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){
+			//do something
+			if (typeof href == 'function') {
+				href();
+			}else{
+				$.ajax({
+					url:href,
+					type:"post",
+					success:function(data){
+						if(data.success){
+							top.layer.msg("删除依据资料成功!", {icon: 0});
+						}
+					}
+				});
+			}
+			top.layer.close(index);
+		});
+		return false;
+	}
+</script>
+<%--<script>
 	/*使用模块加载的方式 加载文件*/
 	layui.config({
 		base: '${ctx}/resoueces/css/layui/module/'
@@ -442,6 +1052,6 @@
 			});
 		}
 	}
-</script>
+</script>--%>
 </body>
 </html>

+ 620 - 10
src/main/webapp/webpage/modules/ruralprojectrecords/projectReportRecord/projectReportRecordModify.jsp

@@ -27,14 +27,94 @@
         var validateForm;
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if(obj == 2){
-                    //$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectReportRecord/store");
-					$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/holdSaveRecord");
-                }else{
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/saveRecord");
-                }
-                $("#inputForm").submit();
-                return true;
+				var projectId = '${project.id}';
+				var leng = $("#file_attachment tr").length;
+				var boolFlag = true;
+				for(var i=0; i<leng; i++) {
+					var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+					var second = $("#file_attachment tr").eq(i).find("td:eq(1)").html();
+					if(second == 1){
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传报告文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+					}
+				}
+				if(boolFlag){
+					var gistdata = $("#file_gistdata tr").length;
+					for(var i=0; i<gistdata; i++) {
+						var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+						var second = $("#file_gistdata tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传依据性文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					var other = $("#file_other tr").length;
+					for(var i=0; i<other; i++) {
+						var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+						var second = $("#file_other tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传其他文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					if(obj == 2){
+						//$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectReportRecord/store");
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/holdSaveRecord");
+					}else{
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/saveRecord");
+					}
+					$("#inputForm").submit();
+					return true;
+				}
             }else {
                 parent.layer.msg("信息未填写完整!", {icon: 5});
             }
@@ -239,14 +319,258 @@
 				</div>
 			</div>
 
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>报告文件</h2></div>
+				<div class="layui-item nav-btns">
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=11&projectType=1&projectId=${project.id}','500px','350px',false,'inputForm','file_attachment')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<span id="_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${projectReportRecord.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+							<tr>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td style="display:none">${fileAttachment.mustFlag}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileAttachment.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="fileAttachmentTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="fileAttachment{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>依据性资料</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=12&projectType=1&projectId=${project.id}','500px','350px',false,'inputForm','file_gistdata')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_gistdata" style="display: none" class="upload-progress">
+					<span id="fileName_gistdata" ></span>
+					<span id="_gistdata" ></span>
+					<b><span id="baifenbi_gistdata" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_gistdata" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="gistdata_file" type="file" name="gistdata_file" multiple="multiple" style="display: none;" onChange="if(this.value)gistdataInsertTitle(this.value);"/>
+				<span id="gistdata_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="gistdata_upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_gistdata">
+						<c:forEach items="${projectReportRecord.fileGistdataList}" var = "fileGistdata" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileGistdata.id}</td>
+										<td style="display:none">${fileGistdata.mustFlag}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileGistdata.id}&projectId=${project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="gistdataTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="gistdataTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>其他文件</h2></div>
+				<div class="layui-item nav-btns">
+						<%--<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=13&projectType=1&projectId=${project.id}','500px','350px',false,'inputForm','file_other')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
+				</div>
+				<div id="addFile_other" style="display: none" class="upload-progress">
+					<span id="fileName_other" ></span>
+					<span id="_other" ></span>
+					<b><span id="baifenbi_other" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_other" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="other_file" type="file" name="other_file" multiple="multiple" style="display: none;" onChange="if(this.value)otherInsertTitle(this.value);"/>
+				<span id="other_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable_other" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
+							<th width="150px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_other">
+						<c:forEach items="${projectReportRecord.fileOtherList}" var = "fileOther" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<td style="display:none">${fileOther.id}</td>
+										<td style="display:none">${fileOther.mustFlag}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileOther.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
+			</div>
+			<script type="text/template" id="otherTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="otherTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
+
+			<%--<div class="form-group layui-row">
 				<div class="form-group-label"><h2>附件信息列表</h2></div>
 
 				<div class="layui-item layui-col-xs12 form-table-container">
 					<table id="permissionTable" class="layui-table" lay-filter="permissionTable"></table>
 				</div>
-			</div>
+			</div>--%>
 
 
 			<%--<div class="form-group layui-row">
@@ -322,6 +646,292 @@
 <script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
 <script src="${ctxStatic}/layer-v2.3/layui/tableTree/treetable.js" charset="utf-8"></script>
 <script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	//新增行方法
+	var fileAttachmentTpl = $("#fileAttachmentTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var gistdataTpl = $("#gistdataTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var otherTpl = $("#otherTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+
+	function formAttachment(title,url,width,height,target,formId,divId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				inputForm.attr("action","${ctx}/projectTemplate/projectTemplate/getProjectTemplateInfo");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				formSubmitAjax($document,formId,index,divId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmitAjax($document,inputForm,index,divId){
+		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) {
+					if(!data.success){
+						top.layer.msg("保存依据资料信息异常!",{icon:2});
+						return false;
+					}
+					var idx = ''
+					if(divId == 'file_attachment'){
+						idx = $("#file_attachment tr").length;
+						addRowBaseData("#file_attachment",idx,fileAttachmentTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_gistdata'){
+						idx = $("#file_gistdata tr").length;
+						addRowBaseData("#file_gistdata",idx,gistdataTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_other'){
+						idx = $("#file_other tr").length;
+						addRowBaseData("#file_other",idx,otherTpl,data.body.projectAccessoryInfo);
+					}
+					parent.layer.msg(data.msg,{icon:1});
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	function hasInArr(id,idArr) {
+		for(var i=0;i<idArr.length;i++){
+			if(id==$(idArr[i]).val()){
+				return true;
+			}
+		}
+		return false;
+	}
+	function existBaseData(id,length) {
+		for (var i=0;i<length;i++) {
+			var val = $('#file_attachment'+i+'_id').val();
+			if(id==val){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	function addRowBaseData(list, idx, tpl, row){
+		bornTemplete(list, idx, tpl, row, idx);
+	}
+
+	function bornTemplete(list, idx, tpl, row, idx1){
+		var idx1 = '';
+		if(list == 'file_attachment'){
+			idx1 = $("#file_attachment tr").length +1;
+		}else if(list == 'file_gistdata'){
+			idx1 = $("#file_gistdata tr").length +1;
+		}else if(list == 'file_other'){
+			idx1 = $("#file_other tr").length +1;
+		}
+
+		$(list).append(Mustache.render(tpl, {
+			idx: idx, delBtn: true, row: row,
+			order:idx1 + 1, idx1:idx1
+		}));
+		$(list+idx).find("select").each(function(){
+			$(this).val($(this).attr("data-value"));
+		});
+		$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+			var ss = $(this).attr("data-value").split(',');
+			for (var i=0; i<ss.length; i++){
+				if($(this).val() == ss[i]){
+					$(this).attr("checked","checked");
+				}
+			}
+		});
+	}
+	function delRowBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function delBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function confirmDelete(mess, href){
+		top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){
+			//do something
+			if (typeof href == 'function') {
+				href();
+			}else{
+				$.ajax({
+					url:href,
+					type:"post",
+					success:function(data){
+						if(data.success){
+							top.layer.msg("删除依据资料成功!", {icon: 0});
+						}
+					}
+				});
+			}
+			top.layer.close(index);
+		});
+		return false;
+	}
+</script>
+<%--<script>
 	/*使用模块加载的方式 加载文件*/
 	layui.config({
 		base: '${ctx}/resoueces/css/layui/module/'
@@ -474,6 +1084,6 @@
 			});
 		}
 	}
-</script>
+</script>--%>
 </body>
 </html>

+ 276 - 2
src/main/webapp/webpage/modules/ruralprojectrecords/projectReportRecord/projectReportRecordView.jsp

@@ -159,12 +159,162 @@
 		</div>
 
 		<div class="form-group layui-row">
+			<div class="form-group-label"><h2>报告文件</h2></div>
+			<div id="addFile_attachment" style="display: none" class="upload-progress">
+				<span id="fileName_attachment" ></span>
+				<span id="_attachment" ></span>
+				<b><span id="baifenbi_attachment" ></span></b>
+				<div class="progress">
+					<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+					</div>
+				</div>
+			</div>
+			<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+			<span id="attachment_title"></span>
+			<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+				<table id="upTable" class="table table-bordered table-condensed details">
+					<thead>
+					<tr>
+						<%-- <th>序号</th>--%>
+						<th>电子件名称</th>
+						<th>最大容量(M)</th>
+						<th>类型限制</th>
+						<th>文件名</th>
+						<th width="150px">操作</th>
+					</tr>
+					</thead>
+					<tbody id="file_attachment">
+					<c:forEach items="${projectReportRecord.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+						<tr>
+							<td style="display:none">${fileAttachment.id}</td>
+							<td>${fileAttachment.attachName}</td>
+							<td>${fileAttachment.attachLength}</td>
+							<td>${fileAttachment.attachTypes}</td>
+							<td>
+								<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+									<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+								</c:forEach>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileAttachment.id}&projectId=${project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+								</div>
+							</td>
+						</tr>
+					</c:forEach>
+					</tbody>
+				</table>
+			</div>
+		</div>
+
+		<div class="form-group layui-row">
+			<div class="form-group-label"><h2>依据性资料</h2></div>
+			<div id="addFile_gistdata" style="display: none" class="upload-progress">
+				<span id="fileName_gistdata" ></span>
+				<span id="_gistdata" ></span>
+				<b><span id="baifenbi_gistdata" ></span></b>
+				<div class="progress">
+					<div id="jindutiao_gistdata" class="progress-bar" style="width: 0%" aria-valuenow="0">
+					</div>
+				</div>
+			</div>
+			<input id="gistdata_file" type="file" name="gistdata_file" multiple="multiple" style="display: none;" onChange="if(this.value)gistdataInsertTitle(this.value);"/>
+			<span id="gistdata_title"></span>
+			<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+				<table id="gistdata_upTable" class="table table-bordered table-condensed details">
+					<thead>
+					<tr>
+						<%-- <th>序号</th>--%>
+						<th>电子件名称</th>
+						<th>最大容量(M)</th>
+						<th>类型限制</th>
+						<th>文件名</th>
+						<th width="150px">操作</th>
+					</tr>
+					</thead>
+					<tbody id="file_gistdata">
+					<c:forEach items="${projectReportRecord.fileGistdataList}" var = "fileGistdata" varStatus="status">
+						<tr>
+								<%-- <td>${status.index + 1}</td>--%>
+							<td style="display:none">${fileGistdata.id}</td>
+							<td>${fileGistdata.attachName}</td>
+							<td>${fileGistdata.attachLength}</td>
+							<td>${fileGistdata.attachTypes}</td>
+							<td>
+								<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+									<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+								</c:forEach>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileGistdata.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+								</div>
+							</td>
+						</tr>
+					</c:forEach>
+					</tbody>
+				</table>
+			</div>
+		</div>
+
+		<div class="form-group layui-row">
+			<div class="form-group-label"><h2>其他文件</h2></div>
+			<div id="addFile_other" style="display: none" class="upload-progress">
+				<span id="fileName_other" ></span>
+				<span id="_other" ></span>
+				<b><span id="baifenbi_other" ></span></b>
+				<div class="progress">
+					<div id="jindutiao_other" class="progress-bar" style="width: 0%" aria-valuenow="0">
+					</div>
+				</div>
+			</div>
+			<input id="other_file" type="file" name="other_file" multiple="multiple" style="display: none;" onChange="if(this.value)otherInsertTitle(this.value);"/>
+			<span id="other_title"></span>
+			<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+				<table id="upTable_other" class="table table-bordered table-condensed details">
+					<thead>
+					<tr>
+						<%-- <th>序号</th>--%>
+						<th>电子件名称</th>
+						<th>最大容量(M)</th>
+						<th>类型限制</th>
+						<th>文件名</th>
+						<th width="150px">操作</th>
+					</tr>
+					</thead>
+					<tbody id="file_other">
+					<c:forEach items="${projectReportRecord.fileOtherList}" var = "fileOther" varStatus="status">
+						<tr>
+								<%-- <td>${status.index + 1}</td>--%>
+							<td style="display:none">${fileOther.id}</td>
+							<td>${fileOther.attachName}</td>
+							<td>${fileOther.attachLength}</td>
+							<td>${fileOther.attachTypes}</td>
+							<td>
+								<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+									<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+								</c:forEach>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileOther.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+								</div>
+							</td>
+						</tr>
+					</c:forEach>
+					</tbody>
+				</table>
+			</div>
+		</div>
+
+
+	<%--<div class="form-group layui-row">
 			<div class="form-group-label"><h2>附件信息列表</h2></div>
 
 			<div class="layui-item layui-col-xs12 form-table-container">
 				<table id="permissionTable" class="layui-table" lay-filter="permissionTable"></table>
 			</div>
-		</div>
+		</div>--%>
 
 		<%--<div class="form-group layui-row">
 			<div class="form-group-label"><h2>附件信息</h2></div>
@@ -222,6 +372,130 @@
 <script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
 <script src="${ctxStatic}/layer-v2.3/layui/tableTree/treetable.js" charset="utf-8"></script>
 <script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+	function formAttachment(title,url,width,height,target,formId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+				var item = iframeWin.getSelectedItem();
+				setValuee(item);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function setValuee(obj){
+		for(var i=0;i<obj.length;i++){
+			var idArr = $("#file_attachment tr:visible .clientId");
+			if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
+				addRowBaseData("#workBaseDataList",workBaseDataRowIdx,workBaseDataTpl,obj[i]);
+				$("#workBaseDataList"+workBaseDataRowIdx+"_nature").html("引用");
+				workBaseDataRowIdx=workBaseDataRowIdx+1;
+			}
+		}
+	}
+</script>
+<%--<script>
 	/*使用模块加载的方式 加载文件*/
 	layui.config({
 		base: '${ctx}/resoueces/css/layui/module/'
@@ -374,6 +648,6 @@
 			});
 		}
 	}
-</script>
+</script>--%>
 </body>
 </html>

+ 187 - 102
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/projectRecordsMessageAudit.jsp

@@ -211,44 +211,31 @@
 					<table id="upTable" class="table table-bordered table-condensed details">
 						<thead>
 						<tr>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_attachment">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_attachment'}">
-								<tr>
-									<c:choose>
-										<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-											<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-										</c:when>
-										<c:otherwise>
-											<c:choose>
-												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-												</c:when>
-												<c:otherwise>
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-												</c:otherwise>
-											</c:choose>
-										</c:otherwise>
-									</c:choose>
-									<td>${workClientAttachment.createBy.name}</td>
-									<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-									<td class="op-td">
-										<div class="op-btn-box" >
-											<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>
-										</div>
-									</td>
-								</tr>
-							</c:if>
+						<c:forEach items="${projectcontentinfo.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+							<tr>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileAttachment.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
 						</c:forEach>
 						</tbody>
 					</table>
@@ -271,44 +258,31 @@
 					<table id="gistdata_upTable" class="table table-bordered table-condensed details">
 						<thead>
 						<tr>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_gistdata">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_gistdata'}">
-								<tr>
-									<c:choose>
-										<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-											<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-										</c:when>
-										<c:otherwise>
-											<c:choose>
-												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-												</c:when>
-												<c:otherwise>
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-												</c:otherwise>
-											</c:choose>
-										</c:otherwise>
-									</c:choose>
-									<td>${workClientAttachment.createBy.name}</td>
-									<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-									<td class="op-td">
-										<div class="op-btn-box" >
-											<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>
-										</div>
-									</td>
-								</tr>
-							</c:if>
+						<c:forEach items="${projectcontentinfo.fileGistdataList}" var = "fileGistdata" varStatus="status">
+							<tr>
+								<td style="display:none">${fileGistdata.id}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileGistdata.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
 						</c:forEach>
 						</tbody>
 					</table>
@@ -331,44 +305,31 @@
 					<table id="upTable_other" class="table table-bordered table-condensed details">
 						<thead>
 						<tr>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_other">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_other'}">
-								<tr>
-									<c:choose>
-										<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-											<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-										</c:when>
-										<c:otherwise>
-											<c:choose>
-												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-												</c:when>
-												<c:otherwise>
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-												</c:otherwise>
-											</c:choose>
-										</c:otherwise>
-									</c:choose>
-									<td>${workClientAttachment.createBy.name}</td>
-									<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-									<td class="op-td">
-										<div class="op-btn-box" >
-											<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>
-										</div>
-									</td>
-								</tr>
-							</c:if>
+						<c:forEach items="${projectcontentinfo.fileOtherList}" var = "fileOther" varStatus="status">
+							<tr>
+								<td style="display:none">${fileOther.id}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileOther.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
 						</c:forEach>
 						</tbody>
 					</table>
@@ -398,5 +359,129 @@
 		</div>
 	</div>
 </div>
+<script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+	function formAttachment(title,url,width,height,target,formId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+				var item = iframeWin.getSelectedItem();
+				setValuee(item);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function setValuee(obj){
+		for(var i=0;i<obj.length;i++){
+			var idArr = $("#file_attachment tr:visible .clientId");
+			if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
+				addRowBaseData("#workBaseDataList",workBaseDataRowIdx,workBaseDataTpl,obj[i]);
+				$("#workBaseDataList"+workBaseDataRowIdx+"_nature").html("引用");
+				workBaseDataRowIdx=workBaseDataRowIdx+1;
+			}
+		}
+	}
+</script>
 </body>
 </html>

+ 255 - 100
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/projectRecordsMessageModify.jsp

@@ -9,21 +9,92 @@
         var validateForm;
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if(obj == 1) {
-                    $("#flag").val("yes");
-                    /*if($("#taskDefKey").val()== "projectplan" && $(".trIdAdds").length==0){
-                        top.layer.alert('请至少上传一个项目计划表或者实施方案文档!', {icon: 0});
-                        return;
-                    }*/
-                }else {
-                    if(obj == 2){
-                        $("#flag").val("no1");
-                    }else {
-                        $("#flag").val("no2");
+                var projectId = '${projectcontentinfo.project.id}';
+                var leng = $("#file_attachment tr").length;
+                var boolFlag = true;
+                for(var i=0; i<leng; i++) {
+                    var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+                    if(numberStr != undefined && numberStr !=null && numberStr !=''){
+                        $.ajax({
+                            type: 'post',
+                            url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+                            data: {"attachmentId":numberStr,"projectId":projectId},
+                            dataType: "json",
+                            async: false
+                        }).success(function (result) {
+                            if(result == 0){
+                                boolFlag = false;
+                                top.layer.msg("请上传报告文件!", {icon: 0});
+                                return false;
+                            }
+                        }).error(function () {
+                            top.layer.msg("文件载入失败!");
+                        });
                     }
                 }
-                $("#inputForm").submit();
-                return true;
+                if(boolFlag){
+                    var gistdata = $("#file_gistdata tr").length;
+                    for(var i=0; i<gistdata; i++) {
+                        var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+                        if(numberStr != undefined && numberStr !=null && numberStr !=''){
+                            $.ajax({
+                                type: 'post',
+                                url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+                                data: {"attachmentId":numberStr,"projectId":projectId},
+                                dataType: "json",
+                                async: false
+                            }).success(function (result) {
+                                if(result == 0){
+                                    boolFlag = false;
+                                    top.layer.msg("请上传依据性文件!", {icon: 0});
+                                    return false;
+                                }
+                            }).error(function () {
+                                top.layer.msg("文件载入失败!");
+                            });
+                        }
+                    }
+                }
+                if(boolFlag){
+                    var other = $("#file_other tr").length;
+                    for(var i=0; i<other; i++) {
+                        var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+                        if(numberStr != undefined && numberStr !=null && numberStr !=''){
+                            $.ajax({
+                                type: 'post',
+                                url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+                                data: {"attachmentId":numberStr,"projectId":projectId},
+                                dataType: "json",
+                                async: false
+                            }).success(function (result) {
+                                if(result == 0){
+                                    boolFlag = false;
+                                    top.layer.msg("请上传其他文件!", {icon: 0});
+                                    return false;
+                                }
+                            }).error(function () {
+                                top.layer.msg("文件载入失败!");
+                            });
+                        }
+                    }
+                }
+                if(boolFlag) {
+                    if (obj == 1) {
+                        $("#flag").val("yes");
+                        /*if($("#taskDefKey").val()== "projectplan" && $(".trIdAdds").length==0){
+                            top.layer.alert('请至少上传一个项目计划表或者实施方案文档!', {icon: 0});
+                            return;
+                        }*/
+                    } else {
+                        if (obj == 2) {
+                            $("#flag").val("no1");
+                        } else {
+                            $("#flag").val("no2");
+                        }
+                    }
+                    $("#inputForm").submit();
+                    return true;
+                }
             }
 
             return false;
@@ -282,44 +353,31 @@
                     <table id="upTable" class="table table-bordered table-condensed details">
                         <thead>
                         <tr>
-                            <th>文件预览</th>
-                            <th>上传人</th>
-                            <th>上传时间</th>
+                            <th>电子件名称</th>
+                            <th>最大容量(M)</th>
+                            <th>类型限制</th>
+                            <th>文件名</th>
                             <th width="150px">操作</th>
                         </tr>
                         </thead>
                         <tbody id="file_attachment">
-                        <c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-                            <c:if test="${workClientAttachment.divIdType eq '_attachment'}">
+                        <c:forEach items="${projectcontentinfo.fileAttachmentList}" var = "fileAttachment" varStatus="status">
                                 <tr>
-                                    <c:choose>
-                                        <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-                                            <td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-                                        </c:when>
-                                        <c:otherwise>
-                                            <c:choose>
-                                                <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-                                                </c:when>
-                                                <c:otherwise>
-                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-                                                </c:otherwise>
-                                            </c:choose>
-                                        </c:otherwise>
-                                    </c:choose>
-                                    <td>${workClientAttachment.createBy.name}</td>
-                                    <td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+                                    <td style="display:none">${fileAttachment.id}</td>
+                                    <td>${fileAttachment.attachName}</td>
+                                    <td>${fileAttachment.attachLength}</td>
+                                    <td>${fileAttachment.attachTypes}</td>
+                                    <td>
+                                        <c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+                                            <a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+                                        </c:forEach>
+                                    </td>
                                     <td class="op-td">
                                         <div class="op-btn-box" >
-                                            <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>
+                                            <a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileAttachment.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
                                         </div>
                                     </td>
                                 </tr>
-                            </c:if>
                         </c:forEach>
                         </tbody>
                     </table>
@@ -342,44 +400,31 @@
                     <table id="gistdata_upTable" class="table table-bordered table-condensed details">
                         <thead>
                         <tr>
-                            <th>文件预览</th>
-                            <th>上传人</th>
-                            <th>上传时间</th>
+                            <th>电子件名称</th>
+                            <th>最大容量(M)</th>
+                            <th>类型限制</th>
+                            <th>文件名</th>
                             <th width="150px">操作</th>
                         </tr>
                         </thead>
                         <tbody id="file_gistdata">
-                        <c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-                            <c:if test="${workClientAttachment.divIdType eq '_gistdata'}">
+                        <c:forEach items="${projectcontentinfo.fileGistdataList}" var = "fileGistdata" varStatus="status">
                                 <tr>
-                                    <c:choose>
-                                        <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-                                            <td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-                                        </c:when>
-                                        <c:otherwise>
-                                            <c:choose>
-                                                <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-                                                </c:when>
-                                                <c:otherwise>
-                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-                                                </c:otherwise>
-                                            </c:choose>
-                                        </c:otherwise>
-                                    </c:choose>
-                                    <td>${workClientAttachment.createBy.name}</td>
-                                    <td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+                                    <td style="display:none">${fileGistdata.id}</td>
+                                    <td>${fileGistdata.attachName}</td>
+                                    <td>${fileGistdata.attachLength}</td>
+                                    <td>${fileGistdata.attachTypes}</td>
+                                    <td>
+                                        <c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+                                            <a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+                                        </c:forEach>
+                                    </td>
                                     <td class="op-td">
                                         <div class="op-btn-box" >
-                                            <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>
+                                            <a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileGistdata.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
                                         </div>
                                     </td>
                                 </tr>
-                            </c:if>
                         </c:forEach>
                         </tbody>
                     </table>
@@ -402,44 +447,31 @@
                     <table id="upTable_other" class="table table-bordered table-condensed details">
                         <thead>
                         <tr>
-                            <th>文件预览</th>
-                            <th>上传人</th>
-                            <th>上传时间</th>
+                            <th>电子件名称</th>
+                            <th>最大容量(M)</th>
+                            <th>类型限制</th>
+                            <th>文件名</th>
                             <th width="150px">操作</th>
                         </tr>
                         </thead>
                         <tbody id="file_other">
-                        <c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-                            <c:if test="${workClientAttachment.divIdType eq '_other'}">
+                        <c:forEach items="${projectcontentinfo.fileOtherList}" var = "fileOther" varStatus="status">
                                 <tr>
-                                    <c:choose>
-                                        <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-                                            <td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-                                        </c:when>
-                                        <c:otherwise>
-                                            <c:choose>
-                                                <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-                                                </c:when>
-                                                <c:otherwise>
-                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-                                                </c:otherwise>
-                                            </c:choose>
-                                        </c:otherwise>
-                                    </c:choose>
-                                    <td>${workClientAttachment.createBy.name}</td>
-                                    <td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-                                    <td class="op-td">
-                                        <div class="op-btn-box" >
-                                            <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>
-                                        </div>
+                                    <td style="display:none">${fileOther.id}</td>
+                                    <td>${fileOther.attachName}</td>
+                                    <td>${fileOther.attachLength}</td>
+                                    <td>${fileOther.attachTypes}</td>
+                                    <td>
+                                        <c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+                                            <a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+                                        </c:forEach>
                                     </td>
+                                    <td class="op-td">
+                                    <div class="op-btn-box" >
+                                        <a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileOther.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+                                    </div>
+                                </td>
                                 </tr>
-                            </c:if>
                         </c:forEach>
                         </tbody>
                     </table>
@@ -469,5 +501,128 @@
         </div>
     </div>
 </div>
+<script>
+    function openBill2(title,url,width,height,target,formId){
+        var rows = $(this).parent().prevAll().length + 1;
+        var frameIndex = parent.layer.getFrameIndex(window.name);
+        var urls = url+"&index="+frameIndex;
+        if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+            width='auto';
+            height='auto';
+        }else{//如果是PC端,根据用户设置的width和height显示。
+
+        }
+        top.layer.open({
+            type: 2,
+            area: [width, height],
+            title: title,
+            skin:"two-btns",
+            maxmin: false, //开启最大化最小化按钮
+            content: urls ,
+            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;
+                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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+                var $document = iframeWin.contentWindow.document;
+
+                formSubmit2($document,formId,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});
+                    }
+                    //关闭当前页
+                    top.layer.close(index)
+                }
+            });
+        }
+    }
+
+    function formAttachment(title,url,width,height,target,formId){
+        var rows = $(this).parent().prevAll().length + 1;
+        var frameIndex = parent.layer.getFrameIndex(window.name);
+        var urls = url;
+        if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+            width='auto';
+            height='auto';
+        }else{//如果是PC端,根据用户设置的width和height显示。
+
+        }
+        top.layer.open({
+            type: 2,
+            area: [width, height],
+            title: title,
+            skin:"two-btns",
+            maxmin: false, //开启最大化最小化按钮
+            content: urls ,
+            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;
+                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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+                var $document = iframeWin.contentWindow.document;
+                var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+                var item = iframeWin.getSelectedItem();
+                setValuee(item);
+
+            },
+            cancel: function(index){
+            }
+        });
+    }
+    function setValuee(obj){
+        for(var i=0;i<obj.length;i++){
+            var idArr = $("#file_attachment tr:visible .clientId");
+            if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
+                addRowBaseData("#workBaseDataList",workBaseDataRowIdx,workBaseDataTpl,obj[i]);
+                $("#workBaseDataList"+workBaseDataRowIdx+"_nature").html("引用");
+                workBaseDataRowIdx=workBaseDataRowIdx+1;
+            }
+        }
+    }
+</script>
 </body>
 </html>

+ 187 - 102
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/projectRecordsMessageView.jsp

@@ -107,44 +107,31 @@
 					<table id="upTable" class="table table-bordered table-condensed details">
 						<thead>
 						<tr>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_attachment">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_attachment'}">
-								<tr>
-									<c:choose>
-										<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-											<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-										</c:when>
-										<c:otherwise>
-											<c:choose>
-												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-												</c:when>
-												<c:otherwise>
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-												</c:otherwise>
-											</c:choose>
-										</c:otherwise>
-									</c:choose>
-									<td>${workClientAttachment.createBy.name}</td>
-									<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-									<td class="op-td">
-										<div class="op-btn-box" >
-											<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>
-										</div>
-									</td>
-								</tr>
-							</c:if>
+						<c:forEach items="${projectcontentinfo.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+							<tr>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileAttachment.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
 						</c:forEach>
 						</tbody>
 					</table>
@@ -167,44 +154,31 @@
 					<table id="gistdata_upTable" class="table table-bordered table-condensed details">
 						<thead>
 						<tr>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_gistdata">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_gistdata'}">
-								<tr>
-									<c:choose>
-										<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-											<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-										</c:when>
-										<c:otherwise>
-											<c:choose>
-												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-												</c:when>
-												<c:otherwise>
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-												</c:otherwise>
-											</c:choose>
-										</c:otherwise>
-									</c:choose>
-									<td>${workClientAttachment.createBy.name}</td>
-									<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-									<td class="op-td">
-										<div class="op-btn-box" >
-											<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>
-										</div>
-									</td>
-								</tr>
-							</c:if>
+						<c:forEach items="${projectcontentinfo.fileGistdataList}" var = "fileGistdata" varStatus="status">
+							<tr>
+								<td style="display:none">${fileGistdata.id}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileGistdata.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
 						</c:forEach>
 						</tbody>
 					</table>
@@ -227,44 +201,31 @@
 					<table id="upTable_other" class="table table-bordered table-condensed details">
 						<thead>
 						<tr>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_other">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_other'}">
-								<tr>
-									<c:choose>
-										<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-											<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-										</c:when>
-										<c:otherwise>
-											<c:choose>
-												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-												</c:when>
-												<c:otherwise>
-													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-												</c:otherwise>
-											</c:choose>
-										</c:otherwise>
-									</c:choose>
-									<td>${workClientAttachment.createBy.name}</td>
-									<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-									<td class="op-td">
-										<div class="op-btn-box" >
-											<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>
-										</div>
-									</td>
-								</tr>
-							</c:if>
+						<c:forEach items="${projectcontentinfo.fileOtherList}" var = "fileOther" varStatus="status">
+							<tr>
+								<td style="display:none">${fileOther.id}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
+								<td class="op-td">
+									<div class="op-btn-box" >
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileOther.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+									</div>
+								</td>
+							</tr>
 						</c:forEach>
 						</tbody>
 					</table>
@@ -285,5 +246,129 @@
 		</form:form>
 	</div>
 </div>
+<script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+	function formAttachment(title,url,width,height,target,formId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+				var item = iframeWin.getSelectedItem();
+				setValuee(item);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function setValuee(obj){
+		for(var i=0;i<obj.length;i++){
+			var idArr = $("#file_attachment tr:visible .clientId");
+			if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
+				addRowBaseData("#workBaseDataList",workBaseDataRowIdx,workBaseDataTpl,obj[i]);
+				$("#workBaseDataList"+workBaseDataRowIdx+"_nature").html("引用");
+				workBaseDataRowIdx=workBaseDataRowIdx+1;
+			}
+		}
+	}
+</script>
 </body>
 </html>

+ 512 - 109
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/reportForm.jsp

@@ -15,15 +15,97 @@
         var dataList;
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if(obj == 1){
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/saveReport");
-                }else{
-                    //$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectcontentinfo/save?view=report");
-					$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/holdSaveReport");
-                }
-                $("#inputForm").submit();
-                return true;
-            }
+				var projectId = '${projectRecords.id}';
+				var leng = $("#file_attachment tr").length;
+				var boolFlag = true;
+				for(var i=0; i<leng; i++) {
+					var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+					var second = $("#file_attachment tr").eq(i).find("td:eq(1)").html();
+					if(second == 1){
+					if(numberStr != undefined && numberStr !=null && numberStr !=''){
+						$.ajax({
+							type: 'post',
+							url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+							data: {"attachmentId":numberStr,"projectId":projectId},
+							dataType: "json",
+							async: false
+						}).success(function (result) {
+							if(result == 0){
+								boolFlag = false;
+								top.layer.msg("请上传报告文件!", {icon: 0});
+								return false;
+							}
+						}).error(function () {
+							top.layer.msg("文件载入失败!");
+						});
+					}
+					}
+				}
+				if(boolFlag){
+					var gistdata = $("#file_gistdata tr").length;
+					for(var i=0; i<gistdata; i++) {
+						var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+						var second = $("#file_gistdata tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传依据性文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+						}
+					}
+				}
+				if(boolFlag){
+					var other = $("#file_other tr").length;
+					for(var i=0; i<other; i++) {
+						var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+						var second = $("#file_other tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传其他文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+						}
+					}
+				}
+				if(boolFlag){
+					if(obj == 1){
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/saveReport");
+					}else{
+						//$("#inputForm").attr("action","${ctx}/projectcontentinfo/projectcontentinfo/save?view=report");
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/holdSaveReport");
+					}
+					$("#inputForm").submit();
+					return true;
+				}
+            }else {
+				parent.layer.msg("信息未填写完整!", {icon: 5});
+			}
 
             return false;
         }
@@ -477,7 +559,7 @@
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>报告文件</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=11&projectType=1&projectId=${projectRecords.id}','500px','350px',false,'inputForm','file_attachment')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_attachment" style="display: none" class="upload-progress">
 					<span id="fileName_attachment" ></span>
@@ -495,59 +577,71 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_attachment">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_attachment'}">
+						<c:forEach items="${projectcontentinfo.fileAttachmentList}" var = "fileAttachment" varStatus="status">
 							<tr>
-									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td style="display:none">${fileAttachment.mustFlag}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<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>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileAttachment.id}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="fileAttachmentTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="fileAttachment{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
 
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>依据性资料</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=12&projectType=1&projectId=${projectRecords.id}','500px','350px',false,'inputForm','file_gistdata')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_gistdata" style="display: none" class="upload-progress">
 					<span id="fileName_gistdata" ></span>
@@ -565,59 +659,71 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_gistdata">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_gistdata'}">
+						<c:forEach items="${projectcontentinfo.fileGistdataList}" var = "fileGistdata" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileGistdata.id}</td>
+										<td style="display:none">${fileGistdata.mustFlag}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFileGistdata')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileGistdata.id}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="gistdataTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="gistdataTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>其他文件</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=13&projectType=1&projectId=${projectRecords.id}','500px','350px',false,'inputForm','file_other')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_other" style="display: none" class="upload-progress">
 					<span id="fileName_other" ></span>
@@ -635,57 +741,354 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_other">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_other'}">
+						<c:forEach items="${projectcontentinfo.fileOtherList}" var = "fileOther" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileOther.id}</td>
+										<td style="display:none">${fileOther.mustFlag}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFileOther')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileOther.id}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="otherTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="otherTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectRecords.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 		<div class="form-group layui-row page-end"></div>
 		</form:form>
 	</div>
 </div>
+<script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	//新增行方法
+	var fileAttachmentTpl = $("#fileAttachmentTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var gistdataTpl = $("#gistdataTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var otherTpl = $("#otherTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+
+	function formAttachment(title,url,width,height,target,formId,divId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				inputForm.attr("action","${ctx}/projectTemplate/projectTemplate/getProjectTemplateInfo");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				formSubmitAjax($document,formId,index,divId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmitAjax($document,inputForm,index,divId){
+		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) {
+					if(!data.success){
+						top.layer.msg("保存依据资料信息异常!",{icon:2});
+						return false;
+					}
+					var idx = ''
+					if(divId == 'file_attachment'){
+						idx = $("#file_attachment tr").length;
+						addRowBaseData("#file_attachment",idx,fileAttachmentTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_gistdata'){
+						idx = $("#file_gistdata tr").length;
+						addRowBaseData("#file_gistdata",idx,gistdataTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_other'){
+						idx = $("#file_other tr").length;
+						addRowBaseData("#file_other",idx,otherTpl,data.body.projectAccessoryInfo);
+					}
+					parent.layer.msg(data.msg,{icon:1});
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	function hasInArr(id,idArr) {
+		for(var i=0;i<idArr.length;i++){
+			if(id==$(idArr[i]).val()){
+				return true;
+			}
+		}
+		return false;
+	}
+	function existBaseData(id,length) {
+		for (var i=0;i<length;i++) {
+			var val = $('#file_attachment'+i+'_id').val();
+			if(id==val){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	function addRowBaseData(list, idx, tpl, row){
+		bornTemplete(list, idx, tpl, row, idx);
+	}
+
+	function bornTemplete(list, idx, tpl, row, idx1){
+		var idx1 = '';
+		if(list == 'file_attachment'){
+			idx1 = $("#file_attachment tr").length +1;
+		}else if(list == 'file_gistdata'){
+			idx1 = $("#file_gistdata tr").length +1;
+		}else if(list == 'file_other'){
+			idx1 = $("#file_other tr").length +1;
+		}
+
+		$(list).append(Mustache.render(tpl, {
+			idx: idx, delBtn: true, row: row,
+			order:idx1 + 1, idx1:idx1
+		}));
+		$(list+idx).find("select").each(function(){
+			$(this).val($(this).attr("data-value"));
+		});
+		$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+			var ss = $(this).attr("data-value").split(',');
+			for (var i=0; i<ss.length; i++){
+				if($(this).val() == ss[i]){
+					$(this).attr("checked","checked");
+				}
+			}
+		});
+	}
+	function delRowBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function delBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function confirmDelete(mess, href){
+		top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){
+			//do something
+			if (typeof href == 'function') {
+				href();
+			}else{
+				$.ajax({
+					url:href,
+					type:"post",
+					success:function(data){
+						if(data.success){
+							top.layer.msg("删除依据资料成功!", {icon: 0});
+						}
+					}
+				});
+			}
+			top.layer.close(index);
+		});
+		return false;
+	}
+</script>
 </body>
 </html>

+ 510 - 106
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/reportModify.jsp

@@ -13,15 +13,96 @@
 	<script type="text/javascript">
         var validateForm;
         var dataList;
+        var dataList;
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if(obj == 1){
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/reportAudit");
-                }else{
-                    $("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/reportAudit");
-                }
-                $("#inputForm").submit();
-                return true;
+				var projectId = '${projectId}';
+				var leng = $("#file_attachment tr").length;
+				var boolFlag = true;
+				for(var i=0; i<leng; i++) {
+					var numberStr = $("#file_attachment tr").eq(i).find("td:first").html();
+					var second = $("#file_attachment tr").eq(i).find("td:eq(1)").html();
+					if(second == 1){
+						if(numberStr != undefined && numberStr !=null && numberStr !=''){
+							$.ajax({
+								type: 'post',
+								url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+								data: {"attachmentId":numberStr,"projectId":projectId},
+								dataType: "json",
+								async: false
+							}).success(function (result) {
+								if(result == 0){
+									boolFlag = false;
+									top.layer.msg("请上传报告文件!", {icon: 0});
+									return false;
+								}
+							}).error(function () {
+								top.layer.msg("文件载入失败!");
+							});
+						}
+					}
+				}
+				if(boolFlag){
+					var gistdata = $("#file_gistdata tr").length;
+					for(var i=0; i<gistdata; i++) {
+						var numberStr = $("#file_gistdata tr").eq(i).find("td:first").html();
+						var second = $("#file_gistdata tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传依据性文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					var other = $("#file_other tr").length;
+					for(var i=0; i<other; i++) {
+						var numberStr = $("#file_other tr").eq(i).find("td:first").html();
+						var second = $("#file_other tr").eq(i).find("td:eq(1)").html();
+						if(second == 1){
+							if(numberStr != undefined && numberStr !=null && numberStr !=''){
+								$.ajax({
+									type: 'post',
+									url:'${ctx}/projectAccessoryRelation/projectAccessoryRelation/getAttachmentCount',
+									data: {"attachmentId":numberStr,"projectId":projectId},
+									dataType: "json",
+									async: false
+								}).success(function (result) {
+									if(result == 0){
+										boolFlag = false;
+										top.layer.msg("请上传其他文件!", {icon: 0});
+										return false;
+									}
+								}).error(function () {
+									top.layer.msg("文件载入失败!");
+								});
+							}
+						}
+					}
+				}
+				if(boolFlag){
+					if(obj == 1){
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/reportAudit");
+					}else{
+						$("#inputForm").attr("action","${ctx}/ruralProject/ruralProjectMessage/reportAudit");
+					}
+					$("#inputForm").submit();
+					return true;
+				}
             }
 
             return false;
@@ -460,7 +541,8 @@
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>报告文件</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=11&projectType=1&projectId=${projectId}','500px','350px',false,'inputForm','file_attachment')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_attachment" style="display: none" class="upload-progress">
 					<span id="fileName_attachment" ></span>
@@ -478,59 +560,71 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_attachment">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_attachment'}">
+						<c:forEach items="${projectcontentinfo.fileAttachmentList}" var = "fileAttachment" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileAttachment.id}</td>
+								<td style="display:none">${fileAttachment.mustFlag}</td>
+								<td>${fileAttachment.attachName}</td>
+								<td>${fileAttachment.attachLength}</td>
+								<td>${fileAttachment.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<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>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileAttachment.id}&projectId=${projectId}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="fileAttachmentTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="fileAttachment{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectId}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>依据性资料</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="gistdata_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=12&projectType=1&projectId=${projectId}','500px','350px',false,'inputForm','file_gistdata')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_gistdata" style="display: none" class="upload-progress">
 					<span id="fileName_gistdata" ></span>
@@ -548,59 +642,71 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_gistdata">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_gistdata'}">
+						<c:forEach items="${projectcontentinfo.fileGistdataList}" var = "fileGistdata" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileGistdata.id}</td>
+										<td style="display:none">${fileGistdata.mustFlag}</td>
+								<td>${fileGistdata.attachName}</td>
+								<td>${fileGistdata.attachLength}</td>
+								<td>${fileGistdata.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFileGistdata')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileGistdata.id}&projectId=${projectId}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="gistdataTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="gistdataTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectId}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
 
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>其他文件</h2></div>
 				<div class="layui-item nav-btns">
-					<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+					<%--<a id="other_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
+					<a href="javascript:void(0)"  onclick="formAttachment('添加类型', '${ctx}/projectAccessoryRelation/projectAccessoryRelation/formAttachment?parentId=13&projectType=1&projectId=${projectId}','500px','350px',false,'inputForm','file_other')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i> 添加类型</a>
 				</div>
 				<div id="addFile_other" style="display: none" class="upload-progress">
 					<span id="fileName_other" ></span>
@@ -618,57 +724,355 @@
 						<thead>
 						<tr>
 								<%-- <th>序号</th>--%>
-							<th>文件预览</th>
-							<th>上传人</th>
-							<th>上传时间</th>
+							<th>电子件名称</th>
+							<th>最大容量(M)</th>
+							<th>类型限制</th>
+							<th>文件名</th>
 							<th width="150px">操作</th>
 						</tr>
 						</thead>
 						<tbody id="file_other">
-						<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-							<c:if test="${workClientAttachment.divIdType eq '_other'}">
+						<c:forEach items="${projectcontentinfo.fileOtherList}" var = "fileOther" varStatus="status">
 							<tr>
 									<%-- <td>${status.index + 1}</td>--%>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+								<td style="display:none">${fileOther.id}</td>
+										<td style="display:none">${fileOther.mustFlag}</td>
+								<td>${fileOther.attachName}</td>
+								<td>${fileOther.attachLength}</td>
+								<td>${fileOther.attachTypes}</td>
+								<td>
+									<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+										<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+									</c:forEach>
+								</td>
 								<td class="op-td">
 									<div class="op-btn-box" >
-										<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>
-
-										<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
-											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFileOther')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
-										</c:if>
+										<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId=${fileOther.id}&projectId=${projectId}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
 									</div>
 								</td>
 							</tr>
-							</c:if>
 						</c:forEach>
 						</tbody>
 					</table>
 				</div>
 			</div>
+			<script type="text/template" id="otherTpl">//<!--
+                <tr id="budgetList{{idx}}">
+                    <td class="hide">
+                        <input id="otherTpl{{idx}}_id" type="hidden" value="{{row.id}}" class="clientId"/>
+                    </td>
+                    <td class="hide">
+                        0
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachName}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachLength}}
+                    </td>
+                    <td style="text-align:center;">
+                        {{row.attachTypes}}
+                    </td>
+                    <td style="text-align:center;">
+
+                    </td>
+					<td class="op-td">
+						<div class="op-btn-box" >
+							<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentForm?attachmentId={{row.id}}&projectId=${projectId}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+						</div>
+					</td>
+                </tr>//-->
+			</script>
+
 		<div class="form-group layui-row page-end"></div>
 		</form:form>
 	</div>
 </div>
+<script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	//新增行方法
+	var fileAttachmentTpl = $("#fileAttachmentTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var gistdataTpl = $("#gistdataTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+	var otherTpl = $("#otherTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+
+	function formAttachment(title,url,width,height,target,formId,divId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				inputForm.attr("action","${ctx}/projectTemplate/projectTemplate/getProjectTemplateInfo");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				formSubmitAjax($document,formId,index,divId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmitAjax($document,inputForm,index,divId){
+		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) {
+					if(!data.success){
+						top.layer.msg("保存依据资料信息异常!",{icon:2});
+						return false;
+					}
+					var idx = ''
+					if(divId == 'file_attachment'){
+						idx = $("#file_attachment tr").length;
+						addRowBaseData("#file_attachment",idx,fileAttachmentTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_gistdata'){
+						idx = $("#file_gistdata tr").length;
+						addRowBaseData("#file_gistdata",idx,gistdataTpl,data.body.projectAccessoryInfo);
+					}else if(divId == 'file_other'){
+						idx = $("#file_other tr").length;
+						addRowBaseData("#file_other",idx,otherTpl,data.body.projectAccessoryInfo);
+					}
+					parent.layer.msg(data.msg,{icon:1});
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+
+	function hasInArr(id,idArr) {
+		for(var i=0;i<idArr.length;i++){
+			if(id==$(idArr[i]).val()){
+				return true;
+			}
+		}
+		return false;
+	}
+	function existBaseData(id,length) {
+		for (var i=0;i<length;i++) {
+			var val = $('#file_attachment'+i+'_id').val();
+			if(id==val){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	function addRowBaseData(list, idx, tpl, row){
+		bornTemplete(list, idx, tpl, row, idx);
+	}
+
+	function bornTemplete(list, idx, tpl, row, idx1){
+		var idx1 = '';
+		if(list == 'file_attachment'){
+			idx1 = $("#file_attachment tr").length +1;
+		}else if(list == 'file_gistdata'){
+			idx1 = $("#file_gistdata tr").length +1;
+		}else if(list == 'file_other'){
+			idx1 = $("#file_other tr").length +1;
+		}
+
+		$(list).append(Mustache.render(tpl, {
+			idx: idx, delBtn: true, row: row,
+			order:idx1 + 1, idx1:idx1
+		}));
+		$(list+idx).find("select").each(function(){
+			$(this).val($(this).attr("data-value"));
+		});
+		$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+			var ss = $(this).attr("data-value").split(',');
+			for (var i=0; i<ss.length; i++){
+				if($(this).val() == ss[i]){
+					$(this).attr("checked","checked");
+				}
+			}
+		});
+	}
+	function delRowBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function delBaseData(obj, prefix,userId){
+		var id = $(prefix+"_id").val();
+		var currentUser = '${fns:getUser().id}';
+		var contentId = '${projectcontentinfo.projectContentData.id}';
+		console.log(contentId);
+		var condition = "${flag}";
+		$.ajax({
+			type:"post",
+			url:'${ctx}/projectcontentinfo/projectContentData/ajaxdelete',
+			data:{"contentId":contentId,"basedId":id,"condition":condition},
+			dataType:"json",
+			success:function(data){
+				if(data.success) {
+					if("according" == condition || "completion" == condition || "early" == condition || "claim" == condition || "design" == condition || "visa" == condition || "interim" == condition || "distribution" == condition || "material" == condition || "armor" == condition ){
+						$(obj).parent().parent().parent().remove();
+					}else{
+						$(obj).parent().parent().remove();
+					}
+					if(data.body.inuse){
+						return;
+					}
+					if (currentUser == userId) {
+						confirmDelete('是否同步删除资料库的文件?','${ctx}/projectcontentinfo/projectcontentinfo/delete?infoId='+id+'&id=${projectcontentinfo.id}&type=1');
+					}
+				}else {
+					top.layer.msg("删除依据资料失败!", {icon: 0});
+				}
+			}
+		})
+		return;
+	}
+
+	function confirmDelete(mess, href){
+		top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){
+			//do something
+			if (typeof href == 'function') {
+				href();
+			}else{
+				$.ajax({
+					url:href,
+					type:"post",
+					success:function(data){
+						if(data.success){
+							top.layer.msg("删除依据资料成功!", {icon: 0});
+						}
+					}
+				});
+			}
+			top.layer.close(index);
+		});
+		return false;
+	}
+</script>
 </body>
 </html>

+ 187 - 102
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/projectcontentinfo/reportView.jsp

@@ -107,44 +107,31 @@
 				<table id="upTable" class="table table-bordered table-condensed details">
 					<thead>
 					<tr>
-						<th>文件预览</th>
-						<th>上传人</th>
-						<th>上传时间</th>
+						<th>电子件名称</th>
+						<th>最大容量(M)</th>
+						<th>类型限制</th>
+						<th>文件名</th>
 						<th width="150px">操作</th>
 					</tr>
 					</thead>
 					<tbody id="file_attachment">
-					<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-						<c:if test="${workClientAttachment.divIdType eq '_attachment'}">
-							<tr>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-								<td class="op-td">
-									<div class="op-btn-box" >
-										<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>
-									</div>
-								</td>
-							</tr>
-						</c:if>
+					<c:forEach items="${projectcontentinfo.fileAttachmentList}" var = "fileAttachment" varStatus="status">
+						<tr>
+							<td style="display:none">${fileAttachment.id}</td>
+							<td>${fileAttachment.attachName}</td>
+							<td>${fileAttachment.attachLength}</td>
+							<td>${fileAttachment.attachTypes}</td>
+							<td>
+								<c:forEach items="${fileAttachment.workAttachments}" var = "workAttachment" varStatus="status">
+									<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+								</c:forEach>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileAttachment.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+								</div>
+							</td>
+						</tr>
 					</c:forEach>
 					</tbody>
 				</table>
@@ -167,44 +154,31 @@
 				<table id="gistdata_upTable" class="table table-bordered table-condensed details">
 					<thead>
 					<tr>
-						<th>文件预览</th>
-						<th>上传人</th>
-						<th>上传时间</th>
+						<th>电子件名称</th>
+						<th>最大容量(M)</th>
+						<th>类型限制</th>
+						<th>文件名</th>
 						<th width="150px">操作</th>
 					</tr>
 					</thead>
 					<tbody id="file_gistdata">
-					<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-						<c:if test="${workClientAttachment.divIdType eq '_gistdata'}">
-							<tr>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-								<td class="op-td">
-									<div class="op-btn-box" >
-										<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>
-									</div>
-								</td>
-							</tr>
-						</c:if>
+					<c:forEach items="${projectcontentinfo.fileGistdataList}" var = "fileGistdata" varStatus="status">
+						<tr>
+							<td style="display:none">${fileGistdata.id}</td>
+							<td>${fileGistdata.attachName}</td>
+							<td>${fileGistdata.attachLength}</td>
+							<td>${fileGistdata.attachTypes}</td>
+							<td>
+								<c:forEach items="${fileGistdata.workAttachments}" var = "workAttachment" varStatus="status">
+									<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+								</c:forEach>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileGistdata.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','gistdata_upTable')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+								</div>
+							</td>
+						</tr>
 					</c:forEach>
 					</tbody>
 				</table>
@@ -227,44 +201,31 @@
 				<table id="upTable_other" class="table table-bordered table-condensed details">
 					<thead>
 					<tr>
-						<th>文件预览</th>
-						<th>上传人</th>
-						<th>上传时间</th>
+						<th>电子件名称</th>
+						<th>最大容量(M)</th>
+						<th>类型限制</th>
+						<th>文件名</th>
 						<th width="150px">操作</th>
 					</tr>
 					</thead>
 					<tbody id="file_other">
-					<c:forEach items="${projectcontentinfo.projectReportData.workAttachments}" var = "workClientAttachment" varStatus="status">
-						<c:if test="${workClientAttachment.divIdType eq '_other'}">
-							<tr>
-								<c:choose>
-									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
-															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
-										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}"></td>
-									</c:when>
-									<c:otherwise>
-										<c:choose>
-											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
-											</c:when>
-											<c:otherwise>
-												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
-											</c:otherwise>
-										</c:choose>
-									</c:otherwise>
-								</c:choose>
-								<td>${workClientAttachment.createBy.name}</td>
-								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
-								<td class="op-td">
-									<div class="op-btn-box" >
-										<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>
-									</div>
-								</td>
-							</tr>
-						</c:if>
+					<c:forEach items="${projectcontentinfo.fileOtherList}" var = "fileOther" varStatus="status">
+						<tr>
+							<td style="display:none">${fileOther.id}</td>
+							<td>${fileOther.attachName}</td>
+							<td>${fileOther.attachLength}</td>
+							<td>${fileOther.attachTypes}</td>
+							<td>
+								<c:forEach items="${fileOther.workAttachments}" var = "workAttachment" varStatus="status">
+									<a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName} ; </a>
+								</c:forEach>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:void(0)"  onclick="openBill2('编辑附件', '${ctx}/projectAccessory/projectAccessory/workAttachmentView?attachmentId=${fileOther.id}&projectId=${projectcontentinfo.project.id}','70%','80%',false,'inputForm','upTable_other')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>
+								</div>
+							</td>
+						</tr>
 					</c:forEach>
 					</tbody>
 				</table>
@@ -285,5 +246,129 @@
 		</form:form>
 	</div>
 </div>
+<script>
+	function openBill2(title,url,width,height,target,formId,tableId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url+"&index="+frameIndex;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+
+				formSubmit2($document,formId,index,tableId);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function formSubmit2($document,inputForm,index,tableId){
+
+		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});
+					}
+					$("#"+tableId).load(location.href + " #"+tableId);
+					//关闭当前页
+					top.layer.close(index)
+				}
+			});
+		}
+	}
+
+	function formAttachment(title,url,width,height,target,formId){
+		var rows = $(this).parent().prevAll().length + 1;
+		var frameIndex = parent.layer.getFrameIndex(window.name);
+		var urls = url;
+		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+			width='auto';
+			height='auto';
+		}else{//如果是PC端,根据用户设置的width和height显示。
+
+		}
+		top.layer.open({
+			type: 2,
+			area: [width, height],
+			title: title,
+			skin:"two-btns",
+			maxmin: false, //开启最大化最小化按钮
+			content: urls ,
+			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;
+				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/saveWorkAttachment");//表单提交成功后,从服务器返回的url在当前tab中展示
+				var $document = iframeWin.contentWindow.document;
+				var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+				var item = iframeWin.getSelectedItem();
+				setValuee(item);
+
+			},
+			cancel: function(index){
+			}
+		});
+	}
+	function setValuee(obj){
+		for(var i=0;i<obj.length;i++){
+			var idArr = $("#file_attachment tr:visible .clientId");
+			if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
+				addRowBaseData("#workBaseDataList",workBaseDataRowIdx,workBaseDataTpl,obj[i]);
+				$("#workBaseDataList"+workBaseDataRowIdx+"_nature").html("引用");
+				workBaseDataRowIdx=workBaseDataRowIdx+1;
+			}
+		}
+	}
+</script>
 </body>
 </html>