Kaynağa Gözat

新增开票时可不选择项目直接填写详情(添加附件上传功能)

[user3] 4 yıl önce
ebeveyn
işleme
a484c54f55
22 değiştirilmiş dosya ile 1948 ekleme ve 257 silme
  1. 12 0
      src/main/java/com/jeeplus/modules/projectrecord/entity/ProjectRecords.java
  2. 10 0
      src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoice.java
  3. 18 0
      src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoiceProjectRelation.java
  4. 245 118
      src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceAllService.java
  5. 110 16
      src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceService.java
  6. 5 2
      src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceAllController.java
  7. 6 1
      src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceController.java
  8. 6 0
      src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java
  9. 4 2
      src/main/resources/mappings/modules/workinvoice/WorkInvoiceDao.xml
  10. 14 5
      src/main/webapp/WEB-INF/tags/sys/gridselectcallprojecttss.tag
  11. 76 40
      src/main/webapp/webpage/modules/sys/gridinvoiceproject.jsp
  12. 115 0
      src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceAllForm.jsp
  13. 115 0
      src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceAudit.jsp
  14. 115 0
      src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceForm.jsp
  15. 115 0
      src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceModify.jsp
  16. 222 22
      src/main/webapp/webpage/modules/workinvoice/workInvoiceAllForm.jsp
  17. 115 0
      src/main/webapp/webpage/modules/workinvoice/workInvoiceAllReceiptForm.jsp
  18. 116 0
      src/main/webapp/webpage/modules/workinvoice/workInvoiceAuditEnd.jsp
  19. 208 26
      src/main/webapp/webpage/modules/workinvoice/workInvoiceForm.jsp
  20. 1 1
      src/main/webapp/webpage/modules/workinvoice/workInvoiceList.jsp
  21. 205 24
      src/main/webapp/webpage/modules/workinvoice/workInvoiceModify.jsp
  22. 115 0
      src/main/webapp/webpage/modules/workinvoice/workInvoiceView.jsp

+ 12 - 0
src/main/java/com/jeeplus/modules/projectrecord/entity/ProjectRecords.java

@@ -135,6 +135,10 @@ public class ProjectRecords extends ActEntity<ProjectRecords> {
 
 	private List<ProjectPlanInfo> projectPlanList= Lists.newArrayList();;//项目计划信息
 
+
+	private String details;   //开票-非项目开票详情
+
+
 	public ProjectRecords() {
 		super();
 	}
@@ -792,4 +796,12 @@ public class ProjectRecords extends ActEntity<ProjectRecords> {
 	public void setInvoiceStatus(String invoiceStatus) {
 		this.invoiceStatus = invoiceStatus;
 	}
+
+	public String getDetails() {
+		return details;
+	}
+
+	public void setDetails(String details) {
+		this.details = details;
+	}
 }

+ 10 - 0
src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoice.java

@@ -11,6 +11,7 @@ import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.sys.entity.Area;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
 import com.jeeplus.modules.workinvoicedetail.entity.WorkInvoiceDetail;
 import com.jeeplus.modules.workproject.entity.WorkProject;
@@ -89,6 +90,7 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 
 	private String accountCheckingUserId; //对账人id
 	private String accountCheckingUserName; //对账人名称
+	private List<Workattachment> workAttachments;//附件
 
 	public String getOfficeId() {
 		return officeId;
@@ -595,4 +597,12 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 	public void setArea(Area area) {
 		this.area = area;
 	}
+
+	public List<Workattachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<Workattachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
 }

+ 18 - 0
src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoiceProjectRelation.java

@@ -15,6 +15,8 @@ public class WorkInvoiceProjectRelation extends DataEntity<WorkInvoice> {
     private String projectNum;     //项目编号
     private String clientName;  //委托方
     private String reportDataNum;   //报告号
+    private Integer isProject;  //是否是项目开票
+    private String details;     //非项目-开票详情
 
     public String getInvoiceId() {
         return invoiceId;
@@ -71,4 +73,20 @@ public class WorkInvoiceProjectRelation extends DataEntity<WorkInvoice> {
     public void setReportDataNum(String reportDataNum) {
         this.reportDataNum = reportDataNum;
     }
+
+    public Integer getIsProject() {
+        return isProject;
+    }
+
+    public void setIsProject(Integer isProject) {
+        this.isProject = isProject;
+    }
+
+    public String getDetails() {
+        return details;
+    }
+
+    public void setDetails(String details) {
+        this.details = details;
+    }
 }

+ 245 - 118
src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceAllService.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.modules.workinvoice.service;
 
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.service.CrudService;
@@ -19,7 +20,9 @@ import com.jeeplus.modules.serialnum.service.SerialNumTplService;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.entity.Role;
 import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
 import com.jeeplus.modules.workactivity.entity.Activity;
@@ -29,6 +32,7 @@ import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
 import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
 import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
 import com.jeeplus.modules.workbidproject.entity.WorkBidProject;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
 import com.jeeplus.modules.workinvoice.dao.WorkInvoiceDao;
@@ -107,6 +111,8 @@ public class WorkInvoiceAllService extends CrudService<WorkInvoiceDao, WorkInvoi
 	protected WorkProjectNotifyService workProjectNotifyService;
 	@Autowired
 	private RuralProjectRecordsService ruralProjectRecordsService;
+	@Autowired
+	private WorkattachmentService workattachmentService;
 
 	private static byte[] SYN_BYTE = new byte[0];
 
@@ -141,20 +147,34 @@ public class WorkInvoiceAllService extends CrudService<WorkInvoiceDao, WorkInvoi
 			//根据开票id查询关联项目
 			List<WorkInvoiceProjectRelation> projectRelationList = dao.getProjectRelation(workInvoice.getId());
 			for (WorkInvoiceProjectRelation projectRelation: projectRelationList) {
-				if(StringUtils.isBlank(projectRelation.getClientName())){
-					//无合同查找委托方信息
-					RuralProjectRecords records1 = ruralProjectRecordsService.get(projectRelation.getProjectId());
-					//无合同状态下,获取委托方的名称
-					if (records1.getWorkContractInfo() == null || null == records1.getWorkContractInfo().getClient() ||StringUtils.isBlank(records1.getWorkContractInfo().getClient().getName())){
-						ruralProjectRecordsService.queryLinkmanInfos(records1);
-						if (records1.getWorkClientLinkmanList() != null && records1.getWorkClientLinkmanList().size() > 0) {
-							WorkClientLinkman linkman = records1.getWorkClientLinkmanList().get(0);
-							projectRelation.setClientName(linkman.getClientId().getName());
+				if (null==projectRelation.getIsProject() || projectRelation.getIsProject()==1){
+					if(StringUtils.isBlank(projectRelation.getClientName())){
+						//无合同查找委托方信息
+						RuralProjectRecords records1 = ruralProjectRecordsService.get(projectRelation.getProjectId());
+						//无合同状态下,获取委托方的名称
+						if (records1.getWorkContractInfo() == null || null == records1.getWorkContractInfo().getClient() ||StringUtils.isBlank(records1.getWorkContractInfo().getClient().getName())){
+							ruralProjectRecordsService.queryLinkmanInfos(records1);
+							if (records1.getWorkClientLinkmanList() != null && records1.getWorkClientLinkmanList().size() > 0) {
+								WorkClientLinkman linkman = records1.getWorkClientLinkmanList().get(0);
+								projectRelation.setClientName(linkman.getClientId().getName());
+							}
 						}
 					}
+				}else if(projectRelation.getIsProject()==2){
+					projectRelation.setProjectName("内容");
+					projectRelation.setWorkContractName(projectRelation.getDetails());
 				}
 			}
 			workInvoice.setWorkInvoiceProjectRelationList(projectRelationList);
+			//查找发票的附件信息
+			if(null != workInvoice){
+				List<Workattachment> attachmentList = workattachmentService.getListByAttachmentIdAndFlag(id, "115");
+				workInvoice.setWorkAttachments(attachmentList);
+				//添加当前文件服务器类型
+				workInvoice.setUploadMode(uploadMode);
+				//数据处理(如果为阿里云文件服务器,则对查看的路径进行处理)
+				workattachmentService.attachmentManageOnUrl(workInvoice.getWorkAttachments());
+			}
 		}
 		return workInvoice;
 	}
@@ -442,148 +462,156 @@ public class WorkInvoiceAllService extends CrudService<WorkInvoiceDao, WorkInvoi
 		Office office = officeService.get(officeId);
 		workInvoice.setOffice(office);
 		long s2=System.currentTimeMillis();
-			super.save(workInvoice);
+		super.save(workInvoice);
+		//保存附件
+		this.saveAttachments(workInvoice);
 		long s3=System.currentTimeMillis();
 		String str = "";
 		//所属部门
 
 		String userName = UserUtils.get(workInvoice.getCreateBy().getId()).getName();
-		ProjectRecords projectRecords = projectRecordsService.getRuralMasters(workInvoice.getProject().getId());
-		String title = "项目【"+ projectRecords.getProjectName() +"】发票申请待审批";
-		str = "项目【"+ projectRecords.getProjectName() +"】发票申请待审批,发票申请编号:"+workInvoice.getNumber();
+		//项目名称获取
+		List<String> projectNameList = getProjectNameList(workInvoice);
+		String projectNameStr = String.join(",", projectNameList);
+		//ProjectRecords projectRecords = projectRecordsService.getRuralMasters(workInvoice.getProject().getId());
+		String title = "项目【"+ projectNameStr +"】发票申请待审批";
+		str = "项目【"+ projectNameStr +"】发票申请待审批,发票申请编号:"+workInvoice.getNumber();
 
 		long s4=System.currentTimeMillis();
-			updateWorkInvoiceInfo(workInvoice);
+		//开票明细处理
+		updateWorkInvoiceInfo(workInvoice);
+		//开票与项目关系处理
+		updateWorkInvoiceProjectRelationInfo(workInvoice);
 		long s5=System.currentTimeMillis();
-			// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
-			identityService.setAuthenticatedUserId(UserUtils.getUser().getId());
-			// 启动流程
-			String businessKey = workInvoice.getId().toString();
-			WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("ggh3125f1f194c82bdea00005c750905",officeService.get(workInvoice.getOfficeId()));
-			// 启动流程
-			String processType = workActivityMenu.getProcessType();
-			StringBuffer buffer = new StringBuffer();
-			Activity activity = new Activity();
-			WorkProjectNotify workProjectNotify = UtilNotify
-					.saveNotify(workInvoice.getId(),
-							null,
-							workInvoice.getCompanyId(),
-							title,
-							str,
-							"21",
-							"0",
-							"待审批",
-							""
-					);
+		// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+		identityService.setAuthenticatedUserId(UserUtils.getUser().getId());
+		// 启动流程
+		String businessKey = workInvoice.getId().toString();
+		WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("ggh3125f1f194c82bdea00005c750905",officeService.get(workInvoice.getOfficeId()));
+		// 启动流程
+		String processType = workActivityMenu.getProcessType();
+		StringBuffer buffer = new StringBuffer();
+		Activity activity = new Activity();
+		WorkProjectNotify workProjectNotify = UtilNotify
+				.saveNotify(workInvoice.getId(),
+						null,
+						workInvoice.getCompanyId(),
+						title,
+						str,
+						"21",
+						"0",
+						"待审批",
+						""
+				);
 		long s6=System.currentTimeMillis();
-			List<User> users = new ArrayList<>();
-			//List<User> bmzrs = UserUtils.getByRoleActivityEnname("bmzr",2,office.getId(),"5",workInvoice.getCreateBy());
-			//List<User> fpglys = UserUtils.getByRoleActivityEnname("fpgly",3,office.getId(),"5",workInvoice.getCreateBy());
+		List<User> users = new ArrayList<>();
+		//List<User> bmzrs = UserUtils.getByRoleActivityEnname("bmzr",2,office.getId(),"5",workInvoice.getCreateBy());
+		//List<User> fpglys = UserUtils.getByRoleActivityEnname("fpgly",3,office.getId(),"5",workInvoice.getCreateBy());
 		//财务员工
 		List<User> fpglys = UserUtils.getByRoleActivityEnname("cwygevod",3,office.getId(),"5",workInvoice.getCreateBy());
 		long s7=System.currentTimeMillis();
-			if (StringUtils.isNotBlank(workActivityMenu.getId())) {
-				workProjectNotify.setNotifyRole("");
-				workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
-				List<Activity> activities = workActivityMenu.getActivities();
-				for (Activity a : activities) {
-					String encount = a.getEncount();
-					String enlist = a.getEnlist();
-					if (a.getRole()!=null && StringUtils.isNotBlank(a.getRole().getEnname())){
-						List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(),office.getId(),"5",workInvoice.getCreateBy());
-						if (enusers.size()==0){
-							workInvoice.setInvoiceState("1");//暂存
-							this.save(workInvoice);
-							return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
-						}
-						variables.put(enlist, enusers);
-						variables.put(encount, enusers.size());
-					}
-					if (a.getDelFlag().equals("0") && a.getCount() == 1) {
-						activity = a;
+		if (StringUtils.isNotBlank(workActivityMenu.getId())) {
+			workProjectNotify.setNotifyRole("");
+			workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+			List<Activity> activities = workActivityMenu.getActivities();
+			for (Activity a : activities) {
+				String encount = a.getEncount();
+				String enlist = a.getEnlist();
+				if (a.getRole()!=null && StringUtils.isNotBlank(a.getRole().getEnname())){
+					List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(),office.getId(),"5",workInvoice.getCreateBy());
+					if (enusers.size()==0){
+						workInvoice.setInvoiceState("1");//暂存
+						this.save(workInvoice);
+						return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
 					}
+					variables.put(enlist, enusers);
+					variables.put(encount, enusers.size());
 				}
-				buffer.append(activity.getRole().getEnname());
-				if (activity != null && StringUtils.isNotBlank(activity.getId())) {
-					//角色审批
-					if (StringUtils.isNotBlank(activity.getRole().getEnname())) {
-						users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),office.getId(),"5",workInvoice.getCreateBy());
-					}
-					//人员审批
-					if (StringUtils.isNotBlank(activity.getUser().getId())) {
-						users.add(activity.getUser());
-					}
+				if (a.getDelFlag().equals("0") && a.getCount() == 1) {
+					activity = a;
 				}
-				workProjectNotify.setId("");
-			} else {
-				//variables.put("fpglyList", fpglys);
-				if (fpglys.size()==0 ){
-					workInvoice.setInvoiceState("1");//暂存
-					this.save(workInvoice);
+			}
+			buffer.append(activity.getRole().getEnname());
+			if (activity != null && StringUtils.isNotBlank(activity.getId())) {
+				//角色审批
+				if (StringUtils.isNotBlank(activity.getRole().getEnname())) {
+					users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),office.getId(),"5",workInvoice.getCreateBy());
 				}
-				if (fpglys.size()==0){
-					return "流程审批人不能为空,财务部门下无用户,请联系管理员!";
+				//人员审批
+				if (StringUtils.isNotBlank(activity.getUser().getId())) {
+					users.add(activity.getUser());
 				}
-				//variables.put("fpglycount",fpglys.size());
-				variables.put("fpglycount",fpglys.size());
-				variables.put("fpglyList",fpglys);
-				processType = "newWorkInvoiceBranch";
-				users.addAll(fpglys);
 			}
-			for (User user : users){
-				workProjectNotify.setUser(user);
-				workProjectNotify.setId("");
-				workProjectNotifyService
-						.save(workProjectNotify);
-				Map<String,Object> extras = new HashMap<>();
-				extras.put("type","7002");
-				extras.put("id",workProjectNotify.getId());
-				extras.put("procDefKey","21");
-				UserUtils.pushInfoToApp(title,str,extras,user.getId());
-				UserUtils.pushIm(user.getId(),str);
+			workProjectNotify.setId("");
+		} else {
+			//variables.put("fpglyList", fpglys);
+			if (fpglys.size()==0 ){
+				workInvoice.setInvoiceState("1");//暂存
+				this.save(workInvoice);
 			}
-			variables.put("type", processType);
-			variables.put("busId", businessKey);
-			variables.put("title", "发票申请编号:" + workInvoice.getNumber());//设置标题;
+			if (fpglys.size()==0){
+				return "流程审批人不能为空,财务部门下无用户,请联系管理员!";
+			}
+			//variables.put("fpglycount",fpglys.size());
+			variables.put("fpglycount",fpglys.size());
+			variables.put("fpglyList",fpglys);
+			processType = "newWorkInvoiceBranch";
+			users.addAll(fpglys);
+		}
+		for (User user : users){
+			workProjectNotify.setUser(user);
+			workProjectNotify.setId("");
+			workProjectNotifyService
+					.save(workProjectNotify);
+			Map<String,Object> extras = new HashMap<>();
+			extras.put("type","7002");
+			extras.put("id",workProjectNotify.getId());
+			extras.put("procDefKey","21");
+			UserUtils.pushInfoToApp(title,str,extras,user.getId());
+			UserUtils.pushIm(user.getId(),str);
+		}
+		variables.put("type", processType);
+		variables.put("busId", businessKey);
+		variables.put("title", "发票申请编号:" + workInvoice.getNumber());//设置标题;
 		long s8=System.currentTimeMillis();
-			ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
-			workInvoice.setProcessInstance(processInstance);
+		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
+		workInvoice.setProcessInstance(processInstance);
 		long s9=System.currentTimeMillis();
-			if (StringUtils.isNotBlank(processInstanceId)) {
-				workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
-				workActivityProcessService.deleteProcessInstanceId(processInstanceId);
-				workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
-			}
+		if (StringUtils.isNotBlank(processInstanceId)) {
+			workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
+			workActivityProcessService.deleteProcessInstanceId(processInstanceId);
+			workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
+		}
 		long s10=System.currentTimeMillis();
-			// 更新流程实例ID
-			workInvoice.setProcessInstanceId(processInstance.getId());
-			workInvoiceDao.updateProcessInstanceId(workInvoice);
+		// 更新流程实例ID
+		workInvoice.setProcessInstanceId(processInstance.getId());
+		workInvoiceDao.updateProcessInstanceId(workInvoice);
 		//通知添加流程实例ID
 		workProjectNotify.setProcessInstanceId(processInstance.getId());
 		workProjectNotifyService.save(workProjectNotify);
-			List<Activity> list = workActivityMenu.getActivities();
+		List<Activity> list = workActivityMenu.getActivities();
 		long s11=System.currentTimeMillis();
-			if (list != null && list.size() != 0) {
-				workActivityProcessService.saveList(list, processInstance.getId());
-			} else {
-				WorkActivityProcess workActivityProcess = new WorkActivityProcess();
-				workActivityProcess.setProcessKey("newWorkInvoiceBranch");
-				workActivityProcess.setCount(1);
-				workActivityProcess.setProcessInstanceId(processInstance.getId());
-				workActivityProcess.setIsApproval("0");
-				workActivityProcessService.save(workActivityProcess);
+		if (list != null && list.size() != 0) {
+			workActivityProcessService.saveList(list, processInstance.getId());
+		} else {
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessKey("newWorkInvoiceBranch");
+			workActivityProcess.setCount(1);
+			workActivityProcess.setProcessInstanceId(processInstance.getId());
+			workActivityProcess.setIsApproval("0");
+			workActivityProcessService.save(workActivityProcess);
 				/*workActivityProcess.setCount(2);
 				workActivityProcess.setId("");
 				workActivityProcessService.save(workActivityProcess);*/
-				workActivityProcessService.insertAuditsByType(fpglys,processInstance.getId(),1,1);
-				//workActivityProcessService.insertAuditsByType(fpglys,processInstance.getId(),2,0);
-			}
+			workActivityProcessService.insertAuditsByType(fpglys,processInstance.getId(),1,1);
+			//workActivityProcessService.insertAuditsByType(fpglys,processInstance.getId(),2,0);
+		}
 		long s12=System.currentTimeMillis();
 		logger.info("发票送审-------生成发票编号:"+(s2-s1)+"  保存发票信息:"+(s3-s2)+"  保存发票明细数据:"+(s5-s4)
 				+"  查询角色人员:"+(s7-s6)+"  流程启动:"+(s9-s8)+"  workActivityProcessService.updateProcessInstanceId:"+(s10-s9)
 				+"  查询角色人员:"+(s12-s11)+"  总时间:"+(s12-s1));
-			logger.debug("start process of {key={}, bkey={}, pid={}, variables={}}", new Object[]{
-					ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
+		logger.debug("start process of {key={}, bkey={}, pid={}, variables={}}", new Object[]{
+				ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
 		return "";
 	}
 	@Transactional(readOnly = false)
@@ -611,7 +639,65 @@ public class WorkInvoiceAllService extends CrudService<WorkInvoiceDao, WorkInvoi
 			workInvoiceDetailDao.delete(workAccount);
 		}*/
 	}
+	/**
+	 * 获取关联项目名称list
+	 * @param workInvoice
+	 * @return
+	 */
+	public List<String> getProjectNameList(WorkInvoice workInvoice){
+		//项目名称获取
+		List<String> projectNameList = Lists.newArrayList();
+		if(null != workInvoice.getWorkInvoiceProjectRelationList()){
+			for (WorkInvoiceProjectRelation projectRelation : workInvoice.getWorkInvoiceProjectRelationList()) {
+				//处理开票是非项目还是项目开票
+				if(null==projectRelation.getIsProject() || 1==projectRelation.getIsProject()){
+					if (WorkInvoiceReceipt.DEL_FLAG_NORMAL.equals(projectRelation.getDelFlag())) {
+						if (StringUtils.isNotBlank(projectRelation.getProjectId())) {
+							ProjectRecords projectRecords = projectRecordsService.getRuralMasters(projectRelation.getProjectId());
+							if (null != projectRecords) {
+								projectNameList.add(projectRecords.getProjectName());
+							}
+						}
+					}
+				}else if(projectRelation.getIsProject()==2){
+					if(projectNameList.contains("非项目发票")){
+						continue;
+					}
+					projectNameList.add("非项目发票");
+
+				}
 
+			}
+		}
+		return projectNameList;
+	}
+	/**
+	 * 处理项目和开票信息数据
+	 * @param workInvoice
+	 */
+	@Transactional(readOnly = false)
+	public void updateWorkInvoiceProjectRelationInfo(WorkInvoice workInvoice) {
+		//根据开票id删除所有开票项目 关联信息
+		dao.deleteProjectRelation(workInvoice.getId());
+		if (null!=workInvoice.getWorkInvoiceProjectRelationList()){
+			for (WorkInvoiceProjectRelation projectRelation : workInvoice.getWorkInvoiceProjectRelationList()){
+				if (StringUtils.isBlank(projectRelation.getProjectId())){
+					if(projectRelation.getProjectName().equals("内容")){
+						projectRelation.setIsProject(2);
+					}else{
+						continue;
+					}
+				}else{
+					projectRelation.setIsProject(1);
+				}
+				projectRelation.setInvoiceId(workInvoice.getId());
+				//新增开票和项目关联信息
+				if (WorkInvoiceReceipt.DEL_FLAG_NORMAL.equals(projectRelation.getDelFlag())) {
+					dao.insertProjectRelation(projectRelation);
+				}
+			}
+		}
+	}
 	public Page<WorkClientInfo> findPageByclient(Page<WorkClientInfo> page, WorkClientInfo client) {
 		client.setPage(page);
 		page.setList(dao.findListByclient(client));
@@ -2010,4 +2096,45 @@ public class WorkInvoiceAllService extends CrudService<WorkInvoiceDao, WorkInvoi
 	public void cancellationDelete(WorkInvoice workInvoice) {
 		dao.cancellationDelete(workInvoice);
 	}
+
+	@Transactional(readOnly = false)
+	public void saveAttachments(WorkInvoice workInvoice) {
+		List<Workattachment> workattachments = workInvoice.getWorkAttachments();
+		if (workattachments!=null && workattachments.size()!=0) {
+			for (Workattachment workattachment : workattachments) {
+				if (workattachment.getId() == null) {
+					continue;
+				}
+				if (workattachment.DEL_FLAG_NORMAL.equals(workattachment.getDelFlag())) {
+					workattachment.setAttachmentId(workInvoice.getId());
+					workattachment.setAttachmentFlag("115");
+					workattachment.setAttachmentUser(UserUtils.getUser().getId());
+					if (StringUtils.isBlank(workattachment.getId()) || "null".equals(workattachment.getId())) {
+						workattachmentService.insertOnWorkAttachment(workattachment);
+					} else {
+						workattachmentService.updateOnWorkAttachment(workattachment);
+					}
+				} else {
+					workattachmentService.delete(workattachment);
+				}
+			}
+		}
+	}
+	public void queryDetails(WorkInvoice workInvoice) {
+		if(workInvoice==null)return;
+		WorkClientAttachment attchment = new WorkClientAttachment();
+		attchment.setAttachmentId(workInvoice.getId());
+		attchment.setAttachmentFlag("115");
+		List<WorkClientAttachment> attachments = workattachmentService.getAttachmentList(attchment);
+		for (WorkClientAttachment clientAttachment:attachments){
+			if (clientAttachment.getCollectFlag().equals("1")){
+				for (Workattachment workattachment:workInvoice.getWorkAttachments()){
+					if (clientAttachment.getId().equals(workattachment.getId())){
+						workattachment.setCollectFlag("1");
+						break;
+					}
+				}
+			}
+		}
+	}
 }

+ 110 - 16
src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceService.java

@@ -13,6 +13,7 @@ import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.websocket.onchat.ChatServerPool;
 import com.jeeplus.modules.act.service.ActTaskService;
 import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.oa.entity.OaNotify;
 import com.jeeplus.modules.projectrecord.entity.ProjectPlanInfo;
 import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
@@ -22,8 +23,10 @@ import com.jeeplus.modules.serialnum.service.SerialNumTplService;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.entity.Role;
 import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.sys.service.AreaService;
 import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
 import com.jeeplus.modules.sys.utils.RoleActivityEnname;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
@@ -34,6 +37,7 @@ import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
 import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
 import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
 import com.jeeplus.modules.workbidproject.entity.WorkBidProject;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
 import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
@@ -102,6 +106,8 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 	@Autowired
 	protected WorkActivityProcessService workActivityProcessService;
 	@Autowired
+	protected WorkattachmentService workattachmentService;
+	@Autowired
 	protected ProjectRecordsService projectRecordsService;
 	@Autowired
 	@Lazy
@@ -148,29 +154,45 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 			//根据开票id查询关联项目
 			List<WorkInvoiceProjectRelation> projectRelationList = dao.getProjectRelation(workInvoice.getId());
 			for (WorkInvoiceProjectRelation projectRelation: projectRelationList) {
-				if(StringUtils.isBlank(projectRelation.getClientName())){
-					//无合同查找委托方信息
-					RuralProjectRecords records1 = ruralProjectRecordsService.get(projectRelation.getProjectId());
-					//无合同状态下,获取委托方的名称
-					if (records1.getWorkContractInfo() == null || null == records1.getWorkContractInfo().getClient() ||StringUtils.isBlank(records1.getWorkContractInfo().getClient().getName())){
-						ruralProjectRecordsService.queryLinkmanInfos(records1);
-						if (records1.getWorkClientLinkmanList() != null && records1.getWorkClientLinkmanList().size() > 0) {
-							WorkClientLinkman linkman = records1.getWorkClientLinkmanList().get(0);
-							projectRelation.setClientName(linkman.getClientId().getName());
+				if (null==projectRelation.getIsProject() || projectRelation.getIsProject()==1){
+					if(StringUtils.isBlank(projectRelation.getClientName())){
+						//无合同查找委托方信息
+						RuralProjectRecords records1 = ruralProjectRecordsService.get(projectRelation.getProjectId());
+						//无合同状态下,获取委托方的名称
+						if (records1.getWorkContractInfo() == null || null == records1.getWorkContractInfo().getClient() ||StringUtils.isBlank(records1.getWorkContractInfo().getClient().getName())){
+							ruralProjectRecordsService.queryLinkmanInfos(records1);
+							if (records1.getWorkClientLinkmanList() != null && records1.getWorkClientLinkmanList().size() > 0) {
+								WorkClientLinkman linkman = records1.getWorkClientLinkmanList().get(0);
+								projectRelation.setClientName(linkman.getClientId().getName());
+							}
 						}
 					}
+				}else if(projectRelation.getIsProject()==2){
+					projectRelation.setProjectName("内容");
+					projectRelation.setWorkContractName(projectRelation.getDetails());
 				}
 			}
 			//如果发票对账地区为空,则将第一个项目信息的所在地添加到对账地区
 			if(StringUtils.isBlank(workInvoice.getArea().getId())){
 				//判定项目是否存在
 				if(0 < projectRelationList.size()){
-					workInvoice.setArea(areaService.get(ruralProjectRecordsService.get(projectRelationList.get(0).getProjectId()).getArea()));
+					if(projectRelationList.get(0).getIsProject()==1){
+						workInvoice.setArea(areaService.get(ruralProjectRecordsService.get(projectRelationList.get(0).getProjectId()).getArea()));
+					}
 				}
 			}else{
 				workInvoice.setArea(areaService.get(workInvoice.getArea().getId()));
 			}
 			workInvoice.setWorkInvoiceProjectRelationList(projectRelationList);
+			//查找发票的附件信息
+			if(null != workInvoice){
+				List<Workattachment> attachmentList = workattachmentService.getListByAttachmentIdAndFlag(id, "115");
+				workInvoice.setWorkAttachments(attachmentList);
+				//添加当前文件服务器类型
+				workInvoice.setUploadMode(uploadMode);
+				//数据处理(如果为阿里云文件服务器,则对查看的路径进行处理)
+				workattachmentService.attachmentManageOnUrl(workInvoice.getWorkAttachments());
+			}
 		}
 		return workInvoice;
 	}
@@ -182,6 +204,14 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 	 */
 	public List<WorkInvoiceProjectRelation> getProjectRelation(WorkInvoice workInvoice) {
 		List<WorkInvoiceProjectRelation> projectRelationList = dao.getProjectRelation(workInvoice.getId());
+		for (WorkInvoiceProjectRelation projectRelation:projectRelationList) {
+			if(null!=projectRelation.getIsProject()){
+				if ( projectRelation.getIsProject() == 2) {
+					projectRelation.setProjectName("非项目发票");
+					projectRelation.setWorkContractName(projectRelation.getDetails());
+				}
+			}
+		}
 		return projectRelationList;
 	}
 
@@ -225,6 +255,8 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		updateWorkInvoiceInfo(workInvoice);
 		//处理项目和开票信息数据
 		updateWorkInvoiceProjectRelationInfo(workInvoice);
+		//保存附件
+		this.saveAttachments(workInvoice);
 	}
 
 	@Transactional(readOnly = false)
@@ -266,7 +298,13 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		if (null!=workInvoice.getWorkInvoiceProjectRelationList()){
 			for (WorkInvoiceProjectRelation projectRelation : workInvoice.getWorkInvoiceProjectRelationList()){
 				if (StringUtils.isBlank(projectRelation.getProjectId())){
-					continue;
+					if(projectRelation.getProjectName().equals("内容")){
+						projectRelation.setIsProject(2);
+					}else{
+						continue;
+					}
+				}else{
+					projectRelation.setIsProject(1);
 				}
 				projectRelation.setInvoiceId(workInvoice.getId());
 				//新增开票和项目关联信息
@@ -287,14 +325,24 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		List<String> projectNameList = Lists.newArrayList();
 		if(null != workInvoice.getWorkInvoiceProjectRelationList()){
 			for (WorkInvoiceProjectRelation projectRelation : workInvoice.getWorkInvoiceProjectRelationList()) {
-				if (WorkInvoiceReceipt.DEL_FLAG_NORMAL.equals(projectRelation.getDelFlag())) {
-					if (StringUtils.isNotBlank(projectRelation.getProjectId())) {
-						ProjectRecords projectRecords = projectRecordsService.getRuralMasters(projectRelation.getProjectId());
-						if (null != projectRecords) {
-							projectNameList.add(projectRecords.getProjectName());
+				//处理开票是非项目还是项目开票
+				if(null==projectRelation.getIsProject() || 1==projectRelation.getIsProject()){
+					if (WorkInvoiceReceipt.DEL_FLAG_NORMAL.equals(projectRelation.getDelFlag())) {
+						if (StringUtils.isNotBlank(projectRelation.getProjectId())) {
+							ProjectRecords projectRecords = projectRecordsService.getRuralMasters(projectRelation.getProjectId());
+							if (null != projectRecords) {
+								projectNameList.add(projectRecords.getProjectName());
+							}
 						}
 					}
+				}else if(projectRelation.getIsProject()==2){
+					if(projectNameList.contains("非项目发票")){
+						continue;
+					}
+					projectNameList.add("非项目发票");
+
 				}
+
 			}
 		}
 		return projectNameList;
@@ -517,6 +565,8 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		workInvoice.setOffice(office);
 		long s2=System.currentTimeMillis();
 			super.save(workInvoice);
+		//保存附件
+		this.saveAttachments(workInvoice);
 		long s3=System.currentTimeMillis();
 		String str = "";
 		//所属部门
@@ -1042,6 +1092,7 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 			}
 		}
 		workInvoiceDao.update(workInvoice);
+		this.saveAttachments(workInvoice);
 		return "保存审核意见成功!";
 	}
 
@@ -1384,6 +1435,8 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 			workInvoiceDao.update(workInvoice);
 			//开票与项目关系处理
 			updateWorkInvoiceProjectRelationInfo(workInvoice);
+			//附件处理
+			this.saveAttachments(workInvoice);
 			return "保存审核意见成功!";
 	}
 
@@ -2097,4 +2150,45 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 	public void cancellationDelete(WorkInvoice workInvoice) {
 		dao.cancellationDelete(workInvoice);
 	}
+	@Transactional(readOnly = false)
+	public void saveAttachments(WorkInvoice workInvoice) {
+		List<Workattachment> workattachments = workInvoice.getWorkAttachments();
+		if (workattachments!=null && workattachments.size()!=0) {
+			for (Workattachment workattachment : workattachments) {
+				if (workattachment.getId() == null) {
+					continue;
+				}
+				if (workattachment.DEL_FLAG_NORMAL.equals(workattachment.getDelFlag())) {
+					workattachment.setAttachmentId(workInvoice.getId());
+					workattachment.setAttachmentFlag("115");
+					workattachment.setAttachmentUser(UserUtils.getUser().getId());
+					if (StringUtils.isBlank(workattachment.getId()) || "null".equals(workattachment.getId())) {
+						workattachmentService.insertOnWorkAttachment(workattachment);
+					} else {
+						workattachmentService.updateOnWorkAttachment(workattachment);
+					}
+				} else {
+					workattachmentService.delete(workattachment);
+				}
+			}
+		}
+	}
+	public void queryDetails(WorkInvoice workInvoice) {
+		if(workInvoice==null)return;
+		WorkClientAttachment attchment = new WorkClientAttachment();
+		attchment.setAttachmentId(workInvoice.getId());
+		attchment.setAttachmentFlag("115");
+		List<WorkClientAttachment> attachments = workattachmentService.getAttachmentList(attchment);
+		for (WorkClientAttachment clientAttachment:attachments){
+			if (clientAttachment.getCollectFlag().equals("1")){
+				for (Workattachment workattachment:workInvoice.getWorkAttachments()){
+					if (clientAttachment.getId().equals(workattachment.getId())){
+						workattachment.setCollectFlag("1");
+						break;
+					}
+				}
+			}
+		}
+	}
+
 }

+ 5 - 2
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceAllController.java

@@ -236,6 +236,9 @@ public class WorkInvoiceAllController extends BaseController {
 	@RequestMapping(value = "form")
 	public String form(WorkInvoice workInvoice, Model model) {
 		String view = "workInvoiceAllForm";
+		if(StringUtils.isNotBlank(workInvoice.getId())){
+			workInvoiceService.queryDetails(workInvoice);
+		}
 		String tabId = request.getParameter("tabId");
 		if("1".equals(tabId)){
 			view = "workInvoiceView";
@@ -328,10 +331,10 @@ public class WorkInvoiceAllController extends BaseController {
 		}
 		try {
 			Map<String, Object> variables = Maps.newHashMap();
-			WorkClientInfo workClientInfo =workClientInfoService.get(workInvoice.getClient().getId());
+			/*WorkClientInfo workClientInfo =workClientInfoService.get(workInvoice.getClient().getId());
 			ProjectRecords workProject =projectRecordsService.getRuralProjectRecodes(workInvoice.getProject().getId());
 			workInvoice.setClient(workClientInfo);
-			workInvoice.setProject(workProject);
+			workInvoice.setProject(workProject);*/
 			workInvoice.setCompanyId(UserUtils.getSelectCompany().getId());
 			workInvoice.setOfficeId(UserUtils.getSelectOffice().getId());
 			String str = "";

+ 6 - 1
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceController.java

@@ -265,6 +265,9 @@ public class WorkInvoiceController extends BaseController {
 	@RequestMapping(value = "form")
 	public String form(WorkInvoice workInvoice, Model model) {
 		String view = "workInvoiceForm";
+		if(StringUtils.isNotBlank(workInvoice.getId())){
+			workInvoiceService.queryDetails(workInvoice);
+		}
 		String tabId = request.getParameter("tabId");
 		if("1".equals(tabId)){
 			List<MainDictDetail> billingContentList = DictUtils.getMainDictList("billing_content");
@@ -764,7 +767,7 @@ public class WorkInvoiceController extends BaseController {
 	 * 选择开票项目
 	 */
 	@RequestMapping(value = "selectproject")
-	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids, HttpServletRequest request, HttpServletResponse response, Model model) {
+	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids,Integer isProject,String details, HttpServletRequest request, HttpServletResponse response, Model model) {
 		project.setCompany(UserUtils.getSelectCompany());
 		project.setProjectStatus(ProjectStatusEnum.SIGNED.getValue());//已签状态
 		project.setLeaderNameStr(UserUtils.getUser().getName());
@@ -803,7 +806,9 @@ public class WorkInvoiceController extends BaseController {
 		model.addAttribute("url", url);
 		model.addAttribute("searchLabel", searchLabel);
 		model.addAttribute("searchKey", searchKey);
+		project.setDetails(details);
 		model.addAttribute("obj", project);
+		model.addAttribute("isProject", isProject);
 		model.addAttribute("page",page);
 		return "modules/sys/gridinvoiceproject";
 	}

+ 6 - 0
src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java

@@ -1174,6 +1174,9 @@ public class WorkProjectNotifyController extends BaseController {
 					return "modules/sys/companyForm";
 				} else if (workProjectNotify.getType().equals("21")) {    //开票管理
 					WorkInvoice workInvoice = workInvoiceService.get(workProjectNotify.getNotifyId());
+					if (StringUtils.isNotBlank(workInvoice.getId())) {
+						workInvoiceService.queryDetails(workInvoice);
+					}
 					if(StringUtils.isNotBlank(workProjectNotify.getHome())){
 						workInvoice.setHome(workProjectNotify.getHome());
 					}else{
@@ -1231,6 +1234,9 @@ public class WorkProjectNotifyController extends BaseController {
 					}
 				} else if (workProjectNotify.getType().equals("211")) {    //开票管理
 					WorkInvoice workInvoice = workInvoiceService.get(workProjectNotify.getNotifyId());
+					if (StringUtils.isNotBlank(workInvoice.getId())) {
+						workInvoiceService.queryDetails(workInvoice);
+					}
 					workInvoice.setHome("home");
 					workInvoice.setAct(getByAct(workInvoice.getProcessInstanceId()));
 					String taskDefKey = workInvoice.getAct().getTaskDefKey();

+ 4 - 2
src/main/resources/mappings/modules/workinvoice/WorkInvoiceDao.xml

@@ -789,14 +789,16 @@
 
 	<insert id="insertProjectRelation">
 		insert into work_invoice_project_relation
-		(invoice_id, project_id)
+		(invoice_id, project_id,is_project,details)
 		values
-		  (#{invoiceId}, #{projectId})
+		  (#{invoiceId}, #{projectId}, #{isProject}, #{details})
 	</insert>
 	<select id="getProjectRelation" resultType="com.jeeplus.modules.workinvoice.entity.WorkInvoiceProjectRelation">
 		select
 		  a.invoice_id as 'invoiceId',
 		  a.project_id as 'projectId',
+		  a.is_project as 'isProject',
+		  a.details as 'details',
 		  rpr.project_name as 'projectName',
 		  rpr.project_id as 'projectNum',
 		  wci.name as 'workContractName',

+ 14 - 5
src/main/webapp/WEB-INF/tags/sys/gridselectcallprojecttss.tag

@@ -14,6 +14,9 @@
 <%@ attribute name="cssClass" type="java.lang.String" required="false" description="css样式"%>
 <%@ attribute name="cssStyle" type="java.lang.String" required="false" description="css样式"%>
 <%@ attribute name="disabled" type="java.lang.String" required="false" description="是否限制选择,如果限制,设置为disabled"%>
+<%@ attribute name="isProject" type="java.lang.String" required="false" description="是否是项目开票"%>
+<%@ attribute name="details" type="java.lang.String" required="false" description="非项目开票详情"%>
+
 <script type="text/javascript">
 function searchGrid${id}(){
 	var ids =  $("#ids").val();
@@ -25,19 +28,25 @@ function searchGrid${id}(){
 	    title:"${title}",
 	    name:'friend',
 		skin:"two-btns",
-	    content: encodeURI("${url}?fieldLabels=${fieldLabels}&fieldKeys=${fieldKeys}&url=${url}&searchLabel=${searchLabel}&searchKey=${searchKey}&ids="+ids) ,
+	    content: encodeURI("${url}?fieldLabels=${fieldLabels}&fieldKeys=${fieldKeys}&url=${url}&searchLabel=${searchLabel}&searchKey=${searchKey}&isProject=${isProject}&details=${details}&ids="+ids) ,
 	    btn: ['确定', '关闭'],
 	    yes: function(index, layero){
 	    	 var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
 	    	 var item = iframeWin.getSelectedItem();
-
 	    	 if(item == "-1"){
 		    	 return;
 	    	 }
-	    	 $("#${id}Id").val(item.split('_item_')[0]);
-	    	 $("#${id}Name").val(item.split('_item_')[1]);
+	    	 var isProject=item.split('_item_')[3];
+	    	 var details=item.split('_item_')[4];
+	    	 if (isProject==1){
+				 $("#${id}Id").val(item.split('_item_')[0]);
+				 $("#${id}Name").val(item.split('_item_')[1]);
+			 }else{
+				 $("#${id}Name").val("内容");
+			 }
+
 			 top.layer.close(index);//关闭对话框。
-			setPNumber(item.split('_item_')[0],'${id}');
+			setPNumber(item.split('_item_')[0],'${id}',isProject,details);
 		  },
 		  cancel: function(index){ 
 	       }

+ 76 - 40
src/main/webapp/webpage/modules/sys/gridinvoiceproject.jsp

@@ -3,9 +3,32 @@
 <html>
 <head>
 	<meta name="decorator" content="default"/>
+	<script type="text/javascript" src="${ctxStatic}/layui/layui.js"></script>
+	<link rel='stylesheet' type="text/css" href="${ctxStatic}/layui/css/layui.css"/>
 	<script type="text/javascript">
 		$(document).ready(function() {
-
+			layui.use(['form', 'layer'], function () {
+				var form = layui.form;
+				form.on("radio(isproject)", function(event){
+					var isproject = $(this).val();
+					//专票必填
+					if(isproject == 1){
+						$(".project").show();
+						$("#noProject").hide();
+					}else if(isproject == 2){
+						$(".project").hide();
+						$("#noProject").show();
+					}
+				});
+			})
+			var isProject='${isProject}';
+			if(isProject=="1" || isProject==""){
+				$(".project").show();
+				$("#noProject").hide();
+			}else if(isProject=="2"){
+				$(".project").hide();
+				$("#noProject").show();
+			}
             <%--var val = "<%=request.getAttribute("state")%>";--%>
             <%--if(val!=null){--%>
                 <%--alert("++++++++++");--%>
@@ -33,22 +56,23 @@
 		});
 
 		function getSelectedItem(){
-
-			var size = $("#contentTable tbody tr td input.i-checks:checked").size();
-			  if(size == 0 ){
+			var isProject=$('input:radio[name="isProject"]:checked').val();
+			if (isProject==1){
+				var size = $("#contentTable tbody tr td input.i-checks:checked").size();
+				if(size == 0 ){
 					top.layer.alert('请至少选择一条数据!', {icon: 0, title:'警告'});
 					return "-1";
-				  }
-
-			  if(size > 1 ){
+				}
+				if(size > 1 ){
 					top.layer.alert('只能选择一条数据!', {icon: 0, title:'警告'});
 					return "-1";
-				  }
-			    var id =  $("#contentTable tbody tr td input.i-checks:checkbox:checked").attr("id");
-
-				var label = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel").html();
-				var number = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codenumber").html();
-				return id+"_item_"+label+"_item_"+number;
+				}
+			}
+			var id =  $("#contentTable tbody tr td input.i-checks:checkbox:checked").attr("id");
+			var label = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel").html();
+			var number = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codenumber").html();
+			var details = $("#details").val();
+			return id+"_item_"+label+"_item_"+number+"_item_"+isProject+"_item_"+details;
 		}
 		function page(n,s){
 			if(n) $("#pageNo").val(n);
@@ -64,7 +88,7 @@
 	<div class="layui-row">
 		<div class="full-width fl">
 			<div class="layui-row" id="queryDiv">
-				<form:form id="searchForm" modelAttribute="obj" action="${url}" method="post" class="form-inline">
+				<form:form id="searchForm" modelAttribute="obj" action="${url}" method="post" class="form-inline layui-form">
 					<input type="hidden" name="url" value="${url}"/>
 					<input type="hidden" name="isTotal" value="${isTotal}"/>
 					<input type="hidden" name="fieldLabels" value="${fieldLabels}"/>
@@ -74,44 +98,55 @@
 					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
 					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
 					<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->
-
-					<div class="commonQuery">
-						<div class="layui-item query athird">
-							<span class="layui-form-label">项目名称:</span>
-							<div class="layui-input-block">
-								<form:input path="${searchKey}" htmlEscape="false" maxlength="50" class=" form-control layui-input"/>
+					<div class="layui-input-block">
+						<input type="radio" name="isProject" class="isProject" lay-filter="isproject" title="项目" <c:if test="${isProject ==null || isProject==1  }">checked</c:if>  id="isproject" value="1">
+						<input type="radio" name="isProject" class="isProject" lay-filter="isproject" title="非项目" <c:if test="${isProject==2}">checked</c:if> id="isNoproject" value="2">
+					</div>
+					<div class="project">
+						<div class="commonQuery">
+							<div class="layui-item query athird">
+								<span class="layui-form-label">项目名称:</span>
+								<div class="layui-input-block">
+									<form:input path="${searchKey}" htmlEscape="false" maxlength="50" class=" form-control layui-input"/>
+								</div>
 							</div>
-						</div>
-						<div class="layui-item query athird">
-							<span class="layui-form-label">项目编号:</span>
-							<div class="layui-input-block">
-								<form:input path="projectId" htmlEscape="false" maxlength="50" class=" form-control layui-input"/>
+							<div class="layui-item query athird">
+								<span class="layui-form-label">项目编号:</span>
+								<div class="layui-input-block">
+									<form:input path="projectId" htmlEscape="false" maxlength="50" class=" form-control layui-input"/>
+								</div>
 							</div>
+							<div class="layui-item athird fr">
+								<div class="input-group">
+									<a href="#" id="moresee"><i class="glyphicon glyphicon-menu-down"></i></a>
+									<div class="layui-btn-group search-spacing">
+										<button id="searchQuery" class="layui-btn layui-btn-sm layui-bg-blue" onclick="search()">查询</button>
+										<button id="searchReset" class="layui-btn layui-btn-sm " onclick="resetSearch()">重置</button>
+									</div>
+								</div>
+							</div>
+							<div style="    clear:both;"></div>
 						</div>
-						<div class="layui-item athird fr">
-							<div class="input-group">
-								<a href="#" id="moresee"><i class="glyphicon glyphicon-menu-down"></i></a>
-								<div class="layui-btn-group search-spacing">
-									<button id="searchQuery" class="layui-btn layui-btn-sm layui-bg-blue" onclick="search()">查询</button>
-									<button id="searchReset" class="layui-btn layui-btn-sm " onclick="resetSearch()">重置</button>
+						<div id="moresees" style="clear:both;display:none;">
+							<div class="layui-item query athird">
+								<span class="layui-form-label">报告号:</span>
+								<div class="layui-input-block">
+									<form:input path="reportData.number" htmlEscape="false" maxlength="50" class=" form-control layui-input"/>
 								</div>
 							</div>
+							<div style="clear:both;"></div>
 						</div>
-						<div style="    clear:both;"></div>
 					</div>
-					<div id="moresees" style="clear:both;display:none;">
-						<div class="layui-item query athird">
-							<span class="layui-form-label">报告号:</span>
-							<div class="layui-input-block">
-								<form:input path="reportData.number" htmlEscape="false" maxlength="50" class=" form-control layui-input"/>
-							</div>
+					<div id="noProject" style="margin: 20px;display: none;">
+						<span class="layui-form-label">开票详情:</span>
+						<div class="layui-input-block">
+							<form:textarea path="details" htmlEscape="false"  colspan="4" rows="6" cssStyle="width: 90%"  maxlength="250" class="form-control "/>
 						</div>
-						<div style="clear:both;"></div>
 					</div>
 				</form:form>
 			</div>
 		</div>
-		<div class="full-width fl form-group first">
+		<div class="full-width fl form-group first  project">
 			<div class="layui-item layui-col-xs12 form-table-container">
 				<table id="contentTable" class="table details table-bordered table-condensed">
 					<thead>
@@ -184,6 +219,7 @@
 				<table:page page="${page}"></table:page>
 	</div>
 </div>
+
 	</div>
 </div>
 </body>

+ 115 - 0
src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceAllForm.jsp

@@ -490,6 +490,121 @@
 				</div>
 			</div>
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<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>上传人</th>
+							<th>上传时间</th>
+							<th width="200px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<c:choose>
+									<c:when test="${workInvoice.uploadMode == 2}">
+										<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:when>
+									<c:otherwise>
+										<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</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" >
+											<%--附件下载删除--%>
+										<c:choose>
+											<c:when test="${workInvoice.uploadMode == 2}">
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:when>
+													<c:otherwise>
+														<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:otherwise>
+												</c:choose>
+											</c:when>
+											<c:otherwise>
+												<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+											</c:otherwise>
+										</c:choose>
+										<c:if test="${workClientAttachment.collectFlag != 1}">
+											<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+										</c:if>
+
+
+									</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="contentTable" class="table table-bordered table-condensed details">

+ 115 - 0
src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceAudit.jsp

@@ -249,6 +249,121 @@
 			</div>
 		</div>
 		<div class="form-group layui-row">
+			<div class="form-group-label"><h2>附件信息</h2></div>
+			<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>上传人</th>
+						<th>上传时间</th>
+						<th width="200px">操作</th>
+					</tr>
+					</thead>
+					<tbody id="file_attachment">
+					<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+						<tr>
+								<%-- <td>${status.index + 1}</td>--%>
+							<c:choose>
+								<c:when test="${workInvoice.uploadMode == 2}">
+									<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+										</c:when>
+										<c:otherwise>
+											<c:choose>
+												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+													<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+												</c:when>
+												<c:otherwise>
+													<c:choose>
+														<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+															<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+														</c:when>
+														<c:otherwise>
+															<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+														</c:otherwise>
+													</c:choose>
+												</c:otherwise>
+											</c:choose>
+										</c:otherwise>
+									</c:choose>
+								</c:when>
+								<c:otherwise>
+									<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+												</c:when>
+												<c:otherwise>
+													<c:choose>
+														<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+															<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+														</c:when>
+														<c:otherwise>
+															<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+														</c:otherwise>
+													</c:choose>
+												</c:otherwise>
+											</c:choose>
+										</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" >
+										<%--附件下载删除--%>
+									<c:choose>
+										<c:when test="${workInvoice.uploadMode == 2}">
+											<c:choose>
+												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+													<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+												</c:when>
+												<c:otherwise>
+													<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+												</c:otherwise>
+											</c:choose>
+										</c:when>
+										<c:otherwise>
+											<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+										</c:otherwise>
+									</c:choose>
+									<c:if test="${workClientAttachment.collectFlag != 1}">
+										<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+									</c:if>
+
+
+								</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="contentTable" class="table table-bordered table-condensed details">

+ 115 - 0
src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceForm.jsp

@@ -478,6 +478,121 @@
 				</div>
 			</div>
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<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>上传人</th>
+							<th>上传时间</th>
+							<th width="200px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<c:choose>
+									<c:when test="${workInvoice.uploadMode == 2}">
+										<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:when>
+									<c:otherwise>
+										<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</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" >
+											<%--附件下载删除--%>
+										<c:choose>
+											<c:when test="${workInvoice.uploadMode == 2}">
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:when>
+													<c:otherwise>
+														<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:otherwise>
+												</c:choose>
+											</c:when>
+											<c:otherwise>
+												<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+											</c:otherwise>
+										</c:choose>
+										<c:if test="${workClientAttachment.collectFlag != 1}">
+											<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+										</c:if>
+
+
+									</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="contentTable" class="table table-bordered table-condensed details">

+ 115 - 0
src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceModify.jsp

@@ -485,6 +485,121 @@
 				</div>
 			</div>
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<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>上传人</th>
+							<th>上传时间</th>
+							<th width="200px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<c:choose>
+									<c:when test="${workInvoice.uploadMode == 2}">
+										<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:when>
+									<c:otherwise>
+										<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</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" >
+											<%--附件下载删除--%>
+										<c:choose>
+											<c:when test="${workInvoice.uploadMode == 2}">
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:when>
+													<c:otherwise>
+														<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:otherwise>
+												</c:choose>
+											</c:when>
+											<c:otherwise>
+												<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+											</c:otherwise>
+										</c:choose>
+										<c:if test="${workClientAttachment.collectFlag != 1}">
+											<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+										</c:if>
+
+
+									</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="contentTable" class="table table-bordered table-condensed details">

+ 222 - 22
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllForm.jsp

@@ -31,7 +31,7 @@
 			//debugger
 			if(validateForm.form()){
 				if(obj == 2){
-					$("#inputForm").attr("action","${ctx}/workinvoice/workInvoice/store");
+					$("#inputForm").attr("action","${ctx}/workinvoiceAll/workInvoiceAll/store");
 				}else{
 					var flag=judgment();
 					var leng=$("#workInvoiceProjectRelationList tr").length;
@@ -43,7 +43,7 @@
 						return false;
 					}
 					if (flag){
-						$("#inputForm").attr("action","${ctx}/workinvoice/workInvoice/save");
+						$("#inputForm").attr("action","${ctx}/workinvoiceAll/workInvoiceAll/save");
 					}else if (!flags){
 						return flag;
 					}
@@ -78,6 +78,9 @@
 						$("#telephone").attr("class","form-control isTel layui-input");
 					}
 				});
+				$("#attachment_btn").click(function () {
+					$("#attachment_file").click();
+				});
 			});
 			/*$('#money').keyup(function(){
                 var c=$(this);
@@ -172,26 +175,39 @@
 				}
 			})
 		}
-		function setPNumber(obj,ids){
+		function setPNumber(obj,ids,isProject,details){
 			var idx=ids.split("_")[0]
-			$.ajax({
-				type:'post',
-				url:'${ctx}/workinvoice/workInvoice/getPNumber',
-				data:{
-					"obj":obj
-				},
-				success:function(data){
-					var d = JSON.parse(data);
-					var workContractName="#"+idx+"_workContractName";
-					var projectNum="#"+idx+"_projectNum";
-					var clientName="#"+idx+"_clientName";
-					var reportDataNum="#"+idx+"_reportDataNum";
-					$(workContractName).val(d.workContractName);
-					$(projectNum).val(d.projectNum);
-					$(clientName).val(d.clientName);
-					$(reportDataNum).val(d.reportDataNum);
-				}
-			})
+			if (isProject==1){
+				$.ajax({
+					type:'post',
+					url:'${ctx}/workinvoice/workInvoice/getPNumber',
+					data:{
+						"obj":obj
+					},
+					success:function(data){
+						var d = JSON.parse(data);
+						var workContractName="#"+idx+"_workContractName";
+						var projectNum="#"+idx+"_projectNum";
+						var clientName="#"+idx+"_clientName";
+						var reportDataNum="#"+idx+"_reportDataNum";
+						$(workContractName).val(d.workContractName);
+						$(projectNum).val(d.projectNum);
+						$(clientName).val(d.clientName);
+						$(reportDataNum).val(d.reportDataNum);
+						var areaId = $("#areaId").val();
+						if(undefined ==areaId || null == areaId || '' == areaId){
+							$("#areaId").val(d.areaId);
+							$("#areaName").val(d.areaName);
+						}
+					}
+				})
+			}else if (isProject==2){
+				var workContractName="#"+idx+"_workContractName";
+				var detailsName="#"+idx+"_details";
+				$(workContractName).val(details);
+				$(detailsName).val(details);
+			}
+
 		}
 
 		function addRow(list, idx, tpl, row){
@@ -400,6 +416,43 @@
 			var number = c+timestamp;
 			$("#" +  a ).val(number);
 		}
+		function insertTitle(tValue){
+			var list = "${workInvoice.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 attachmentId = "";
+				var attachmentFlag = "115";
+				console.log(file);
+				var timestamp = new Date().getTime();
+
+				var storeAs = "workInvoice";
+				var uploadPath = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/" + storeAs;
+				/*将这段字符串存到数据库即可*/
+				var divId = "_attachment";
+				$("#addFile" + divId).show();
+				multipartUploadWithSts(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
+			}
+		}
+		function insertTitleCollection(tValue){
+			var list = "${workInvoice.workAttachments}";
+			var size = (list.split('url')).length-1;
+			var files = tValue;
+			for(var i = 0;i<files.length;i++) {
+				var file = files[i];
+				var attachmentId = "";
+				var attachmentFlag = "115";
+				var timestamp = new Date().getTime();
+
+				var storeAs = "workInvoice";
+				var uploadPath = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/" + storeAs;
+				/*将这段字符串存到数据库即可*/
+				var divId = "_attachment";
+				$("#addFile" + divId).show();
+				multipartUploadWithStsCollection(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
+			}
+		}
 	</script>
 </head>
 <body>
@@ -435,10 +488,11 @@
                         <td class="hide">
                             <input id="workInvoiceProjectRelationList{{idx}}_invoiceId" name="workInvoiceProjectRelationList[{{idx}}].invoiceId" type="hidden" value="{{row.invoiceId}}"/>
 							<input id="workInvoiceProjectRelationList{{idx}}_delFlag" name="workInvoiceProjectRelationList[{{idx}}].delFlag" type="hidden" value="0"/>
+							<input id="workInvoiceProjectRelationList{{idx}}_details" name="workInvoiceProjectRelationList[{{idx}}].details" type="hidden" value="{{row.workContractName}}"/>
                         </td>
                         <td>
                             <sys:gridselectcallprojecttss url="${ctx}/workinvoice/workInvoice/selectproject" id="workInvoiceProjectRelationList{{idx}}_projectId" name="workInvoiceProjectRelationList[{{idx}}].projectId"  value="{{row.projectId}}"  title="选择所属项目" labelName="workInvoiceProjectRelationList[{{idx}}].projectName" cssStyle="background-color: #fff"
-													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName" ></sys:gridselectcallprojecttss>
+													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
                         </td>
                         <td>
 							<input id="workInvoiceProjectRelationList{{idx}}_workContractName"   type="text" value="{{row.workContractName}}" readonly="readonly"  class="form-control"/>
@@ -611,6 +665,152 @@
 										cssStyle="background-color: #fff" title="用户" url="/sys/office/treeDataAll?type=3" cssClass="form-control judgment layui-input" allowClear="true" notAllowSelectParent="true"/>
 					</div>
 				</div>
+				<div class="layui-item layui-col-sm6 lw6">
+					<label class="layui-form-label"><span class="require-item">*</span>对账地区:</label>
+					<div class="layui-input-block  with-icon">
+						<sys:treeselectArae id="area" name="area.id" value="${workInvoice.area.id}" labelName="area.name" labelValue="${workInvoice.area.name}"
+											cssStyle="background-color:#fff" title="区域" url="/sys/area/treeData" cssClass="form-control judgment layui-input" allowClear="true" notAllowSelectParent="false" isAll="true"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm12 with-textarea">
+					<label class="layui-form-label double-line">备注:</label>
+					<div class="layui-input-block">
+						<form:textarea path="remarks" placeholder="" htmlEscape="false" rows="4" class="form-control"/>
+					</div>
+				</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>
+					<sys:collectSelect  id="linkman" url="${ctx}/workclientinfo/workClientInfo/linkmanList"
+										name="linkman.id"  title="选择资料库"
+										cssClass="form-control judgment" fieldLabels="资料库" fieldKeys="name"
+										searchLabel="资料库" searchKey="fileName"></sys:collectSelect>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_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>上传人</th>
+							<th>上传时间</th>
+							<th width="200px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<c:choose>
+									<c:when test="${workInvoice.uploadMode == 2}">
+										<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:when>
+									<c:otherwise>
+										<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</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" >
+											<%--附件下载删除--%>
+										<c:choose>
+											<c:when test="${workInvoice.uploadMode == 2}">
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:when>
+													<c:otherwise>
+														<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:otherwise>
+												</c:choose>
+											</c:when>
+											<c:otherwise>
+												<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+											</c:otherwise>
+										</c:choose>
+										<c:if test="${workClientAttachment.collectFlag != 1}">
+											<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+										</c:if>
+										<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>
+
+									</div>
+								</td>
+							</tr>
+						</c:forEach>
+						</tbody>
+					</table>
+				</div>
 			</div>
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>发票明细</h2></div>

+ 115 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllReceiptForm.jsp

@@ -348,6 +348,121 @@
 				</div>
 			</div>
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<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>上传人</th>
+							<th>上传时间</th>
+							<th width="200px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<c:choose>
+									<c:when test="${workInvoice.uploadMode == 2}">
+										<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:when>
+									<c:otherwise>
+										<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</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" >
+											<%--附件下载删除--%>
+										<c:choose>
+											<c:when test="${workInvoice.uploadMode == 2}">
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:when>
+													<c:otherwise>
+														<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:otherwise>
+												</c:choose>
+											</c:when>
+											<c:otherwise>
+												<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+											</c:otherwise>
+										</c:choose>
+										<c:if test="${workClientAttachment.collectFlag != 1}">
+											<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+										</c:if>
+
+
+									</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="contentTable" class="table table-bordered table-condensed details">

+ 116 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceAuditEnd.jsp

@@ -651,6 +651,122 @@
 <%--			</div>--%>
 		</div>
 		<div class="form-group layui-row">
+			<div class="form-group-label"><h2>附件信息</h2></div>
+			<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>上传人</th>
+						<th>上传时间</th>
+						<th width="200px">操作</th>
+					</tr>
+					</thead>
+					<tbody id="file_attachment">
+					<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+						<tr>
+								<%-- <td>${status.index + 1}</td>--%>
+							<c:choose>
+								<c:when test="${workInvoice.uploadMode == 2}">
+									<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+										</c:when>
+										<c:otherwise>
+											<c:choose>
+												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+													<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+												</c:when>
+												<c:otherwise>
+													<c:choose>
+														<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+															<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+														</c:when>
+														<c:otherwise>
+															<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+														</c:otherwise>
+													</c:choose>
+												</c:otherwise>
+											</c:choose>
+										</c:otherwise>
+									</c:choose>
+								</c:when>
+								<c:otherwise>
+									<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+												</c:when>
+												<c:otherwise>
+													<c:choose>
+														<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+															<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+														</c:when>
+														<c:otherwise>
+															<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+														</c:otherwise>
+													</c:choose>
+												</c:otherwise>
+											</c:choose>
+										</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" >
+										<%--附件下载删除--%>
+									<c:choose>
+										<c:when test="${workInvoice.uploadMode == 2}">
+											<c:choose>
+												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+													<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+												</c:when>
+												<c:otherwise>
+													<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+												</c:otherwise>
+											</c:choose>
+										</c:when>
+										<c:otherwise>
+											<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+										</c:otherwise>
+									</c:choose>
+									<c:if test="${workClientAttachment.collectFlag != 1}">
+										<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+									</c:if>
+
+
+								</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 class="nav-btn nav-btn-add" onclick="addRow('#workAccountList', workAccountListRowIdx, workAccountListTpl);workAccountListRowIdx = workAccountListRowIdx + 1;" title="新增"><i class="fa fa-plus"></i>&nbsp;新增</a>

+ 208 - 26
src/main/webapp/webpage/modules/workinvoice/workInvoiceForm.jsp

@@ -138,7 +138,9 @@
 
 
             /*--------------*/
-
+			$("#attachment_btn").click(function () {
+				$("#attachment_file").click();
+			});
         });
 
         function setValuee(obj){
@@ -172,31 +174,39 @@
                 }
             })
         }
-        function setPNumber(obj,ids){
-        	var idx=ids.split("_")[0]
-            $.ajax({
-                type:'post',
-                url:'${ctx}/workinvoice/workInvoice/getPNumber',
-                data:{
-                    "obj":obj
-                },
-                success:function(data){
-                    var d = JSON.parse(data);
-                    var workContractName="#"+idx+"_workContractName";
-                    var projectNum="#"+idx+"_projectNum";
-                    var clientName="#"+idx+"_clientName";
-                    var reportDataNum="#"+idx+"_reportDataNum";
-                    $(workContractName).val(d.workContractName);
-                    $(projectNum).val(d.projectNum);
-                    $(clientName).val(d.clientName);
-                    $(reportDataNum).val(d.reportDataNum);
-                    var areaId = $("#areaId").val();
-                    if(undefined ==areaId || null == areaId || '' == areaId){
-						$("#areaId").val(d.areaId);
-						$("#areaName").val(d.areaName);
+        function setPNumber(obj,ids,isProject,details){
+			var idx=ids.split("_")[0]
+			if (isProject==1){
+				$.ajax({
+					type:'post',
+					url:'${ctx}/workinvoice/workInvoice/getPNumber',
+					data:{
+						"obj":obj
+					},
+					success:function(data){
+						var d = JSON.parse(data);
+						var workContractName="#"+idx+"_workContractName";
+						var projectNum="#"+idx+"_projectNum";
+						var clientName="#"+idx+"_clientName";
+						var reportDataNum="#"+idx+"_reportDataNum";
+						$(workContractName).val(d.workContractName);
+						$(projectNum).val(d.projectNum);
+						$(clientName).val(d.clientName);
+						$(reportDataNum).val(d.reportDataNum);
+						var areaId = $("#areaId").val();
+						if(undefined ==areaId || null == areaId || '' == areaId){
+							$("#areaId").val(d.areaId);
+							$("#areaName").val(d.areaName);
+						}
 					}
-				}
-                })
+				})
+			}else if (isProject==2){
+				var workContractName="#"+idx+"_workContractName";
+				var detailsName="#"+idx+"_details";
+				$(workContractName).val(details);
+				$(detailsName).val(details);
+			}
+
         }
 
         function addRow(list, idx, tpl, row){
@@ -405,6 +415,43 @@
             var number = c+timestamp;
             $("#" +  a ).val(number);
         }
+		function insertTitle(tValue){
+			var list = "${workInvoice.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 attachmentId = "";
+				var attachmentFlag = "115";
+				console.log(file);
+				var timestamp = new Date().getTime();
+
+				var storeAs = "workInvoice";
+				var uploadPath = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/" + storeAs;
+				/*将这段字符串存到数据库即可*/
+				var divId = "_attachment";
+				$("#addFile" + divId).show();
+				multipartUploadWithSts(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
+			}
+		}
+		function insertTitleCollection(tValue){
+			var list = "${workInvoice.workAttachments}";
+			var size = (list.split('url')).length-1;
+			var files = tValue;
+			for(var i = 0;i<files.length;i++) {
+				var file = files[i];
+				var attachmentId = "";
+				var attachmentFlag = "115";
+				var timestamp = new Date().getTime();
+
+				var storeAs = "workInvoice";
+				var uploadPath = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/" + storeAs;
+				/*将这段字符串存到数据库即可*/
+				var divId = "_attachment";
+				$("#addFile" + divId).show();
+				multipartUploadWithStsCollection(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
+			}
+		}
 	</script>
 </head>
 <body>
@@ -440,10 +487,11 @@
                         <td class="hide">
                             <input id="workInvoiceProjectRelationList{{idx}}_invoiceId" name="workInvoiceProjectRelationList[{{idx}}].invoiceId" type="hidden" value="{{row.invoiceId}}"/>
 							<input id="workInvoiceProjectRelationList{{idx}}_delFlag" name="workInvoiceProjectRelationList[{{idx}}].delFlag" type="hidden" value="0"/>
+							<input id="workInvoiceProjectRelationList{{idx}}_details" name="workInvoiceProjectRelationList[{{idx}}].details" type="hidden" value="{{row.workContractName}}"/>
                         </td>
                         <td>
                             <sys:gridselectcallprojecttss url="${ctx}/workinvoice/workInvoice/selectproject" id="workInvoiceProjectRelationList{{idx}}_projectId" name="workInvoiceProjectRelationList[{{idx}}].projectId"  value="{{row.projectId}}"  title="选择所属项目" labelName="workInvoiceProjectRelationList[{{idx}}].projectName" cssStyle="background-color: #fff"
-													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName" ></sys:gridselectcallprojecttss>
+													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
                         </td>
                         <td>
 							<input id="workInvoiceProjectRelationList{{idx}}_workContractName"   type="text" value="{{row.workContractName}}" readonly="readonly"  class="form-control"/>
@@ -631,6 +679,140 @@
 				</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>
+					<sys:collectSelect  id="linkman" url="${ctx}/workclientinfo/workClientInfo/linkmanList"
+										name="linkman.id"  title="选择资料库"
+										cssClass="form-control judgment" fieldLabels="资料库" fieldKeys="name"
+										searchLabel="资料库" searchKey="fileName"></sys:collectSelect>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_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>上传人</th>
+							<th>上传时间</th>
+							<th width="200px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<c:choose>
+									<c:when test="${workInvoice.uploadMode == 2}">
+										<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:when>
+									<c:otherwise>
+										<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</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" >
+											<%--附件下载删除--%>
+										<c:choose>
+											<c:when test="${workInvoice.uploadMode == 2}">
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:when>
+													<c:otherwise>
+														<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:otherwise>
+												</c:choose>
+											</c:when>
+											<c:otherwise>
+												<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+											</c:otherwise>
+										</c:choose>
+										<c:if test="${workClientAttachment.collectFlag != 1}">
+											<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+										</c:if>
+										<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>
+
+									</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="contentTable" class="table table-bordered table-condensed can-edit">

+ 1 - 1
src/main/webapp/webpage/modules/workinvoice/workInvoiceList.jsp

@@ -651,7 +651,7 @@
             ,cols: [[
 				//{checkbox: true, fixed: true},
                 {field:'index',align:'center', title: '序号',width:40}
-				,{field:'projName',align:'center', title: '项目名称', minWidth:160,templet:function(d){
+				,{field:'projName',align:'center', title: '项目名称11', minWidth:160,templet:function(d){
 						if(1 == d.showView && d.showView != undefined){
 							return "<a class=\"attention-info\" title=\"" + d.projName + "\" href=\"javascript:void(0);\" onclick=\"openDialogView('查看项目', '${ctx}/workinvoiceAll/workInvoiceAll/projectview?id=" + d.id +"','95%', '95%')\">" + d.projName + "</a>";
 						}else{

+ 205 - 24
src/main/webapp/webpage/modules/workinvoice/workInvoiceModify.jsp

@@ -140,7 +140,9 @@
             //         $("#telephone").attr("class","form-control isTel layui-input");
             //     }
             // });
-
+			$("#attachment_btn").click(function () {
+				$("#attachment_file").click();
+			});
         });
         function setValuee(obj){
             $.ajax({
@@ -173,30 +175,38 @@
                 }
             })
         }
-		function setPNumber(obj,ids){
+		function setPNumber(obj,ids,isProject,details){
 			var idx=ids.split("_")[0]
-			$.ajax({
-				type:'post',
-				url:'${ctx}/workinvoice/workInvoice/getPNumber',
-				data:{
-					"obj":obj
-				},
-				success:function(data){
-					var d = JSON.parse(data);
-					var workContractName="#"+idx+"_workContractName";
-					var projectNum="#"+idx+"_projectNum";
-					var clientName="#"+idx+"_clientName";
-					var reportDataNum="#"+idx+"_reportDataNum";
-					$(workContractName).val(d.workContractName);
-					$(projectNum).val(d.projectNum);
-					$(clientName).val(d.clientName);
-					$(reportDataNum).val(d.reportDataNum);
-					if(undefined ==areaId || null == areaId || '' == areaId){
-						$("#areaId").val(d.areaId);
-						$("#areaName").val(d.areaName);
+			if (isProject==1){
+				$.ajax({
+					type:'post',
+					url:'${ctx}/workinvoice/workInvoice/getPNumber',
+					data:{
+						"obj":obj
+					},
+					success:function(data){
+						var d = JSON.parse(data);
+						var workContractName="#"+idx+"_workContractName";
+						var projectNum="#"+idx+"_projectNum";
+						var clientName="#"+idx+"_clientName";
+						var reportDataNum="#"+idx+"_reportDataNum";
+						$(workContractName).val(d.workContractName);
+						$(projectNum).val(d.projectNum);
+						$(clientName).val(d.clientName);
+						$(reportDataNum).val(d.reportDataNum);
+						var areaId = $("#areaId").val();
+						if(undefined ==areaId || null == areaId || '' == areaId){
+							$("#areaId").val(d.areaId);
+							$("#areaName").val(d.areaName);
+						}
 					}
-				}
-			})
+				})
+			}else if (isProject==2){
+				var workContractName="#"+idx+"_workContractName";
+				var detailsName="#"+idx+"_details";
+				$(workContractName).val(details);
+				$(detailsName).val(details);
+			}
 		}
 
         function addRow(list, idx, tpl, row){
@@ -437,6 +447,43 @@
             var number = c+timestamp;
             $("#" +  a ).val(number);
         }
+		function insertTitle(tValue){
+			var list = "${workInvoice.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 attachmentId = "";
+				var attachmentFlag = "115";
+				console.log(file);
+				var timestamp = new Date().getTime();
+
+				var storeAs = "workInvoice";
+				var uploadPath = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/" + storeAs;
+				/*将这段字符串存到数据库即可*/
+				var divId = "_attachment";
+				$("#addFile" + divId).show();
+				multipartUploadWithSts(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
+			}
+		}
+		function insertTitleCollection(tValue){
+			var list = "${workInvoice.workAttachments}";
+			var size = (list.split('url')).length-1;
+			var files = tValue;
+			for(var i = 0;i<files.length;i++) {
+				var file = files[i];
+				var attachmentId = "";
+				var attachmentFlag = "115";
+				var timestamp = new Date().getTime();
+
+				var storeAs = "workInvoice";
+				var uploadPath = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/" + storeAs;
+				/*将这段字符串存到数据库即可*/
+				var divId = "_attachment";
+				$("#addFile" + divId).show();
+				multipartUploadWithStsCollection(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
+			}
+		}
 	</script>
 </head>
 <body>
@@ -480,10 +527,11 @@
                         <td class="hide">
                             <input id="workInvoiceProjectRelationList{{idx}}_invoiceId" name="workInvoiceProjectRelationList[{{idx}}].invoiceId" type="hidden" value="{{row.invoiceId}}"/>
 							<input id="workInvoiceProjectRelationList{{idx}}_delFlag" name="workInvoiceProjectRelationList[{{idx}}].delFlag" type="hidden" value="0"/>
+							<input id="workInvoiceProjectRelationList{{idx}}_details" name="workInvoiceProjectRelationList[{{idx}}].details" type="hidden" value="{{row.workContractName}}"/>
                         </td>
                         <td>
                             <sys:gridselectcallprojecttss url="${ctx}/workinvoice/workInvoice/selectproject" id="workInvoiceProjectRelationList{{idx}}_projectId" name="workInvoiceProjectRelationList[{{idx}}].projectId"  value="{{row.projectId}}"  title="选择所属项目" labelName="workInvoiceProjectRelationList[{{idx}}].projectName" cssStyle="background-color: #fff"
-													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName" ></sys:gridselectcallprojecttss>
+													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName" isProject="{{row.isProject}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
                         </td>
                         <td>
 							<input id="workInvoiceProjectRelationList{{idx}}_workContractName"   type="text" value="{{row.workContractName}}" readonly="readonly"  class="form-control"/>
@@ -654,6 +702,139 @@
 				</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>
+					<sys:collectSelect  id="linkman" url="${ctx}/workclientinfo/workClientInfo/linkmanList"
+										name="linkman.id"  title="选择资料库"
+										cssClass="form-control judgment" fieldLabels="资料库" fieldKeys="name"
+										searchLabel="资料库" searchKey="fileName"></sys:collectSelect>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_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>上传人</th>
+							<th>上传时间</th>
+							<th width="200px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<c:choose>
+									<c:when test="${workInvoice.uploadMode == 2}">
+										<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:when>
+									<c:otherwise>
+										<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</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" >
+											<%--附件下载删除--%>
+										<c:choose>
+											<c:when test="${workInvoice.uploadMode == 2}">
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:when>
+													<c:otherwise>
+														<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:otherwise>
+												</c:choose>
+											</c:when>
+											<c:otherwise>
+												<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+											</c:otherwise>
+										</c:choose>
+										<c:if test="${workClientAttachment.collectFlag != 1}">
+											<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+										</c:if>
+										<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>
+
+									</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="contentTable" class="table table-bordered table-condensed can-edit">

+ 115 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceView.jsp

@@ -206,6 +206,121 @@
 
 			</div>
 			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<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>上传人</th>
+							<th>上传时间</th>
+							<th width="200px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						<c:forEach items="${workInvoice.workAttachments}" var = "workClientAttachment" varStatus="status">
+							<tr>
+									<%-- <td>${status.index + 1}</td>--%>
+								<c:choose>
+									<c:when test="${workInvoice.uploadMode == 2}">
+										<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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:when>
+									<c:otherwise>
+										<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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<c:choose>
+															<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+															</c:when>
+															<c:otherwise>
+																<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+															</c:otherwise>
+														</c:choose>
+													</c:otherwise>
+												</c:choose>
+											</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" >
+											<%--附件下载删除--%>
+										<c:choose>
+											<c:when test="${workInvoice.uploadMode == 2}">
+												<c:choose>
+													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+														<a href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',1)" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:when>
+													<c:otherwise>
+														<a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+													</c:otherwise>
+												</c:choose>
+											</c:when>
+											<c:otherwise>
+												<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+											</c:otherwise>
+										</c:choose>
+										<c:if test="${workClientAttachment.collectFlag != 1}">
+											<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
+										</c:if>
+
+
+									</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="contentTable" class="table table-bordered table-condensed details">