需求:
1、業務數據要保存在我們自己的數據庫里
2、CCFlow有保存草稿的功能,但是領導要求每個業務都要有草稿箱,流程從草稿箱發起,每個業務單獨查詢,而不要在CCFlow的統一界面查詢,所以每個業務的列表頁面以及增刪改查都要有的
3、工作流的消息和我們應用系統的消息要整合到一起,放在一起排序、提示
4、我們項目用的框架是第三方的我記錄MVC框架,框架根據Web.config配置的路徑按照MVC的模式解析路由,配置的路徑之外的,還是按照ASP.NET WebForm的方式處理,所以我把CCFlow的ClientBin、DataUser、WF文件夾直接放到Web下,然后引用所需的dll。VS就是強大,兩個不同的解決方案,打上斷點照樣可以調試,所以同時運行CCFlow的源碼后,可以從我們項目的代碼處運行到CCFlow的源碼的斷點處。
5、審核通過,則發送到下一步,審核不通過,則直接結束流程
6、支持分公司,同一個業務,各分公司的流程可能是不一樣的
實現:
一、CCFlow的數據庫與應用系統的數據庫耦合

部門: SELECT TOP (100) PERCENT dept.Id AS No, dept.Name + '(' + comp.Name + ')' AS Name, CAST(dept.Pid AS varchar(20)) AS ParentNo, '' AS NameOfPath, '' AS TreeNo, '' AS Leader, '' AS Tel, 0 AS Idx, 0 AS IsDir, '' AS FK_DeptType FROM CQSD_Dev.dbo.IMP_Dept AS dept INNER JOIN CQSD_Dev.dbo.IMP_Dept AS comp ON comp.Id = dept.Cid WHERE (dept.DelFlg = 0) ORDER BY comp.Pid, comp.Id 崗位: SELECT TOP (100) PERCENT job.Id AS No, job.Name + '(' + comp.Name + ')' AS Name, 3 AS StaGrade, '' AS DutyReq, '' AS Makings, '' AS FK_StationType FROM CQSD_Dev.dbo.IMP_Job AS job INNER JOIN CQSD_Dev.dbo.IMP_Dept AS dept ON dept.Id = job.DeptId INNER JOIN CQSD_Dev.dbo.IMP_Dept AS comp ON comp.Id = dept.Cid WHERE (job.DelFlg = 0) ORDER BY comp.Id 人員: SELECT u.Username AS No, e.Name, 'pub' AS Pass, e.DeptId AS FK_Dept, '' AS EmpNo, '' AS FK_Duty, '' AS Leader, '123' AS SID, '' AS Tel, '' AS Email, '' AS NumOfDept FROM CQSD_Dev.dbo.IMP_Employee AS e INNER JOIN CQSD_Dev.dbo.Sys_User AS u ON u.RelationId = e.Id WHERE (e.DelFlg = 0) 部門人員: SELECT u.Username AS FK_Emp, e.DeptId AS FK_Dept FROM CQSD_Dev.dbo.IMP_Employee AS e INNER JOIN CQSD_Dev.dbo.Sys_User AS u ON u.RelationId = e.Id WHERE (e.DelFlg = 0) AND (e.Code IS NOT NULL) AND (e.Code <> '') 崗位人員: SELECT u.Username AS FK_Emp, e.JobId AS FK_Station FROM CQSD_Dev.dbo.IMP_Employee AS e INNER JOIN CQSD_Dev.dbo.Sys_User AS u ON u.RelationId = e.Id WHERE (e.DelFlg = 0) AND (e.Code IS NOT NULL) AND (e.Code <> '')
二、菜單、待辦、抄送、查詢等列表界面
菜單:
待辦:
流程消息:
三、流程消息和應用系統的其他消息合並的View

SELECT MyPK, Sender, e2.Name AS SenderName, SendTo, e3.Name AS SendToName, Title, Doc, MsgType, RDT AS SendTime, IsRead FROM CQSD_Flow_Dev.dbo.Sys_SMS AS sms JOIN Sys_User u2 on u2.Username = Sender join IMP_Employee e2 ON e2.Id=u2.RelationId join Sys_User u3 on u3.Username = SendTo join IMP_Employee e3 ON e3.Id=u3.RelationId UNION SELECT cast(m.id AS varchar(20)) AS mypk, u.Username AS Sender, e.Name AS SenderName, u1.Username AS sendto, e1.Name AS SendToName, m.emailtheme AS title, emailcontent AS doc, 'CQSDMail' AS msgtype, m.createtime AS SendTime, readingstate AS isread FROM IMP_InternalMail m JOIN IMP_InternalMailRecv mr ON mr.EMailThemeId = m.id LEFT JOIN IMP_Employee e ON e.id = m.CreateUserId JOIN Sys_User u on u.RelationId=e.Id join IMP_Employee e1 ON e1.id = mr.UserId join Sys_User u1 on u1.RelationId=e1.Id WHERE m.delflg = 0 AND mr.delflg = 0 AND m.EMailStatus = 1
四、操作CCFlow數據庫的Service

using System; using System.Collections.Generic; using System.Linq; using System.Text; using CQSD.Service.Interface.Admin.CCFlow; using System.Data; using Simpo; using BP.WF; using CQSD.Const; using BP.En; using CQSD.Domain.DB; using CQSD.Service.Interface.Admin.HR; using CQSD.Service.Admin.HR; namespace CQSD.Service.Admin.CCFlow { /// <summary> /// 工作流數據庫服務 /// </summary> public class CCFlowService : Service, ICCFlowService { #region 根據WorkID獲取工作 /// <summary> /// 根據WorkID獲取工作 /// </summary> /// <param name="WorkID">WorkID</param> public DataTable GetWork(string WorkID) { StringBuilder sb = new StringBuilder(string.Format(@" select wk.* from dbo.WF_GenerWorkFlow wk where WorkID={0}", WorkID)); return BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); } #endregion #region 工作查詢 /// <summary> /// 工作查詢 /// </summary> /// <param name="flowSortNo">流程類別編號</param> public DataTable GetFlowList(string flowSortNo, IMP_Employee loginEmployee) { StringBuilder sb = new StringBuilder(string.Format(@" select fl.*,fs.Name as FK_FlowSortText,fs.No as FK_FlowSort from WF_Flow fl left join WF_FlowSort fs on fl.FK_FlowSort=fs.No where 1=1")); if (!strUtil.IsNullOrEmpty(flowSortNo)) { sb.Append(string.Format(" and fs.No='{0}'", strUtil.SqlClean(flowSortNo))); } string FK_Flows = GetCompFK_Flows(loginEmployee); if (!strUtil.IsNullOrEmpty(FK_Flows)) { sb.Append(string.Format(" and fl.No in ({0})", FK_Flows)); } else { sb.Append(" and 1=2 "); } sb.Append(" order by fs.No"); return BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); } #endregion #region 獲取有流程的流程類別 /// <summary> /// 獲取有流程的流程類別 /// </summary> public DataTable GetFlowTypeList() { StringBuilder sb = new StringBuilder(string.Format(@" select distinct fs.* from WF_Flow fl left join WF_FlowSort fs on fl.FK_FlowSort=fs.No where 1=1")); sb.Append(" order by fs.No"); return BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); } #endregion #region 根據WorkID、FK_Node、FK_Emp獲取工作記錄 /// <summary> /// 根據WorkID、FK_Node、FK_Emp獲取工作記錄 /// </summary> public DataTable GetGenerWorkerlist(string WorkID, string FK_Node, string FK_Emp) { StringBuilder sb = new StringBuilder(string.Format(@" select gwl.* from WF_GenerWorkerlist gwl where WorkID={0} and FK_Node={1} and FK_Emp='{2}'", WorkID, FK_Node, FK_Emp)); return BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); } #endregion #region 獲取流程退回信息 /// <summary> /// 獲取流程退回信息 /// </summary> public string GetReturnWorksInfo(string FK_Node, string WorkID) { if (!strUtil.IsNullOrEmpty(FK_Node) && !strUtil.IsNullOrEmpty(WorkID)) { //流程退回信息 ReturnWorks rws = new ReturnWorks(); rws.Retrieve(ReturnWorkAttr.ReturnToNode, FK_Node, ReturnWorkAttr.WorkID, WorkID, ReturnWorkAttr.RDT); StringBuilder sb = new StringBuilder(); if (rws.Count != 0) { BP.WF.ReturnWork rw = (BP.WF.ReturnWork)rws[rws.Count - 1]; //CCFlow源碼有BUG,所以這里進行特殊處理 string returnNodeName = rw.ReturnNodeName; DataTable dtNode = GetNode(rw.ReturnNode); if (dtNode.Rows.Count > 0) { returnNodeName = dtNode.Rows[0]["Name"].ToString(); } sb.Append(string.Format("<span>來自節點:{0} 退回人:{1} {2}</span><br />", returnNodeName, rw.ReturnerName, rw.RDT)); sb.Append(rw.NoteHtml); } return sb.ToString(); } else { return null; } } #endregion #region 獲取流程移交信息 /// <summary> /// 獲取流程移交信息 /// </summary> public string GetShiftWorksInfo(string FK_Node, string WorkID) { if (!strUtil.IsNullOrEmpty(FK_Node) && !strUtil.IsNullOrEmpty(WorkID)) { //流程退回信息 ShiftWorks sws = new ShiftWorks(); BP.En.QueryObject qo = new QueryObject(sws); qo.AddWhere(ShiftWorkAttr.WorkID, WorkID); qo.addAnd(); qo.AddWhere(ShiftWorkAttr.FK_Node, FK_Node); qo.addOrderBy(ShiftWorkAttr.RDT); qo.DoQuery(); StringBuilder sb = new StringBuilder(); if (sws.Count != 0) { BP.WF.ShiftWork sw = (BP.WF.ShiftWork)sws[sws.Count - 1]; sb.Append(string.Format("<span>移交人:{0} {1}</span><br />", sw.FK_EmpName, sw.RDT)); sb.Append(sw.Note); } return sb.ToString(); } else { return null; } } #endregion #region 獲取系統消息 /// <summary> /// 獲取系統消息 /// </summary> /// <param name="FK_Emp"></param> /// <param name="isRead">-1全部,0未讀,1已讀</param> public DataTable GetSMS(string FK_Emp, int isRead) { StringBuilder sb = new StringBuilder(string.Format(@" select sms.* from Sys_SMS sms where sms.SendTo='{0}'", FK_Emp)); if (isRead != Constants.OptionAllVal) { sb.Append(string.Format(" and sms.IsRead={0}", isRead)); } return BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); } #endregion #region 標記消息為已讀 /// <summary> /// 標記消息為已讀 /// </summary> public DataTable ReadSMS(string MyPK) { StringBuilder sb = new StringBuilder(string.Format(@" update Sys_SMS set IsRead=1 where MyPK='{0}'", MyPK)); return BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); } #endregion #region 獲取Node /// <summary> /// 獲取Node /// </summary> /// <returns></returns> public DataTable GetNode(int NodeID) { StringBuilder sb = new StringBuilder(string.Format(@" select nd.* from WF_Node nd where NodeID={0}", NodeID)); return BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); } #endregion #region 結束流程處理 /// <summary> /// 結束流程處理 /// </summary> /// <param name="employee">結束人</param> /// <param name="FK_Flow">流程編號</param> /// <param name="WorkID">工作ID</param> public DataTable EndFlowProcess(IMP_Employee employee, string FK_Flow, string WorkID) { //取流程數據表名 StringBuilder sb = new StringBuilder(string.Format(@" select flow.PTable from WF_Flow flow where NO='{0}'", FK_Flow)); DataTable dtFlow = BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); string pTable = dtFlow.Rows[0]["PTable"].ToString(); //更新流程數據表 sb = new StringBuilder(string.Format(@" update {0} set FlowEnder='{1}', FlowEmps=FlowEmps+'@{1},{2}' where OID={3}", pTable, employee.EmployeeUser.Username, employee.Name, WorkID)); return BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); } #endregion #region 獲取員工的待辦件數 /// <summary> /// 獲取員工的待辦件數 /// </summary> public DataTable GetDaiBanCount() { StringBuilder sb = new StringBuilder(string.Format(@" select ew.FK_Emp,count(ew.FK_Emp) as Cnt from WF_EmpWorks ew group by ew.FK_Emp")); return BP.DA.DBAccess.RunSQLReturnTable(sb.ToString()); } #endregion #region 根據員工獲取所屬分公司的流程編號集合 /// <summary> /// 根據員工獲取所屬分公司的流程編號集合 /// </summary> private string GetCompFK_Flows(IMP_Employee employee) { IEmployeeService employeeService = new EmployeeService(); IMP_Dept comp = employeeService.GetCompByEmployeeId(employee.Id); StringBuilder sb = new StringBuilder(string.Format("CompId={0}", comp.Id)); List<IMP_FlowConfig> flowConfigList = find<IMP_FlowConfig>(sb.ToString()).list(); if (flowConfigList.Count == 0) return null; return string.Join(",", flowConfigList.ConvertAll<string>(a => "'" + a.FK_Flow + "'").ToArray()); } #endregion } }
五、CCFlow控制器基類

using System; using System.Collections.Generic; using System.Linq; using System.Text; using Simpo.Web.Mvc; using CQSD.Service.Interface.Admin.CCFlow; using CQSD.Service.Interface; using CQSD.Service.Interface.Admin.Sys; using CQSD.Service; using CQSD.Service.Admin.Sys; using CQSD.Service.Admin.CCFlow; using CQSD.Domain.DB; using CQSD.Domain; using CQSD.Utils; using Simpo; using CQSD.Service.Interface.Admin.HR; using CQSD.Service.Admin.HR; using System.Threading; using CQSD.Const; using CQSD.Service.Interface.Sys; using Simpo.Web.Mvc.Attr; using Simpo.Web; using Simpo.Web.Utils; using System.Web; using System.IO; namespace CQSD.Controller.Admin.CCFlow { /// <summary> /// 流程控制器基類 /// </summary> public class FlowControllerBase : ControllerBase { #region 變量和構造函數 protected IEmployeeService employeeService; protected IUserService userService; protected IDeptService deptService; protected IDictService dictService; protected ICCFlowService ccFlowService; protected IFlow_AuditService flowAuditService; protected IDropListService dropListService; protected IJobService jobService; protected IUploadFileService uploadFileService; public FlowControllerBase() { employeeService = new EmployeeService(); userService = new UserService(); deptService = new DeptService(); dictService = new DictService(); ccFlowService = new CCFlowService(); flowAuditService = new Flow_AuditService(); dropListService = new DropListService(); jobService = new JobService(); uploadFileService = new UploadFileService(); } #endregion #region 屬性 /// <summary> /// 登錄用戶 /// </summary> protected Sys_User LoginUser { get { Sys_User loginUser = AdminUtil.GetLoginUser(ctx); loginUser.Employee = employeeService.findById<IMP_Employee>(loginUser.RelationId); return loginUser; } } /// <summary> /// 員工 /// </summary> protected IMP_Employee Employee { get { IMP_Employee employee = employeeService.findById<IMP_Employee>(LoginUser.RelationId); employee.EmployeeUser = AdminUtil.GetLoginUser(ctx); return employee; } } /// <summary> /// FK_Flow /// </summary> protected string FK_Flow { get { return ctx.Get("FK_Flow"); } } /// <summary> /// WorkID /// </summary> protected string WorkID { get { return ctx.Get("WorkID"); } } /// <summary> /// FK_Node /// </summary> protected string FK_Node { get { return ctx.Get("FK_Node"); } } /// <summary> /// FID /// </summary> protected string FID { get { return ctx.Get("FID"); } } /// <summary> /// SID /// </summary> protected string SID { get { return ctx.Get("SID"); } } #endregion #region 通用設置 /// <summary> /// 通用設置 /// </summary> protected void CommonSet(IMP_Employee employee) { //登錄CCFlow LoginCCFlow(); //回退、移交信息設置 SetInfo(); //設置SID,用於控制按鈕是否顯示 if (SID == null) { set("SID", "none"); } else { set("SID", SID); } //事件設置 FlowMenuController designController = new FlowMenuController(); set("SendResult", to(designController.SendResult) + "?FK_Flow=" + FK_Flow + "&WorkID=" + WorkID + "&FK_Node=" + FK_Node); set("ForwardLink", to(designController.Forward) + "?FK_Flow=" + FK_Flow + "&WorkID=" + WorkID + "&FK_Node=" + FK_Node); set("CCUrl", to(designController.CC) + "?FK_Flow=" + FK_Flow + "&FID=" + FID + "&WorkID=" + WorkID + "&FK_Node=" + FK_Flow + "01"); set("ReturnWorkLink", to(designController.ReturnWork) + "?FK_Flow=" + FK_Flow + "&WorkID=" + WorkID + "&FK_Node=" + FK_Node + "&FID=" + FID); } #endregion #region 回退、移交信息設置 /// <summary> /// 回退、移交信息設置 /// </summary> protected void SetInfo() { set("MsgInfo", ""); //流程退回信息,退回信息和移交信息不可能同時存在 string msgInfo = ccFlowService.GetReturnWorksInfo(FK_Node, WorkID); if (!strUtil.IsNullOrEmpty(msgInfo)) { set("MsgInfo", msgInfo); } //流程移交信息 msgInfo = ccFlowService.GetShiftWorksInfo(FK_Node, WorkID); if (!strUtil.IsNullOrEmpty(msgInfo)) { set("MsgInfo", msgInfo); } } #endregion #region 登錄CCFlow /// <summary> /// 登錄CCFlow /// </summary> protected void LoginCCFlow() { //登錄CCFlow BP.Port.Emp emp = new BP.Port.Emp(LoginUser.Username); BP.Web.WebUser.SignInOfGener(emp, true); } #endregion #region 獲得部門樹 /// <summary> /// 獲得部門樹 /// </summary> public void GetDeptTree() { echoJson(dropListService.GetDeptsTree(LoginUser)); } #endregion #region 獲取崗位 /// <summary> /// 獲取崗位 /// </summary> public void GetJobs() { int deptId = ctx.PostInt("deptId"); StringBuilder sb = new StringBuilder(); List<IMP_Job> jobList = jobService.GetList(deptId); sb.Append(string.Format("<option value='{1}'>{0}</option>", Constants.OptionPls[0], Constants.OptionPls[1])); foreach (IMP_Job job in jobList)//遍歷課程 { sb.Append(string.Format("<option value='{0}'>{1}</option>", job.Id, job.Name)); } echoText(sb.ToString()); } #endregion #region 獲取員工 /// <summary> /// 獲取員工 /// </summary> public void GetEmps_IdName() { int jobId = ctx.PostInt("jobId"); StringBuilder sb = new StringBuilder(); List<IMP_Employee> empList = employeeService.GetList(jobId); sb.Append(string.Format("<option value='{1}'>{0}</option>", Constants.OptionPls[0], Constants.OptionPls[1])); foreach (IMP_Employee emp in empList) { sb.Append(string.Format("<option value='{0}'>{1}</option>", emp.Id, emp.Name + "(" + emp.Code + ")")); } echoText(sb.ToString()); } /// <summary> /// 獲取用戶 /// </summary> public void GetUsers() { int jobId = ctx.PostInt("jobId"); StringBuilder sb = new StringBuilder(); List<Sys_User> userList = userService.GetList(jobId); sb.Append(string.Format("<option value='{1}'>{0}</option>", Constants.OptionPls[0], Constants.OptionPls[1])); foreach (Sys_User user in userList) { sb.Append(string.Format("<option value='{0}'>{1}</option>", user.Username, user.Employee.Name + "(" + user.Username + ")")); } echoText(sb.ToString()); } #endregion #region 獲取員工(部門樹和員工) /// <summary> /// 獲取員工(部門樹和員工) /// </summary> public void GetEmployees() { echoJson(GetDepts(Constants.OptionAllVal, dropListService.GetDepts(LoginUser))); } /// <summary> /// 獲取部門樹 /// </summary> private List<Dictionary<string, object>> GetDepts(int parentDeptId, List<IMP_Dept> allDeptList) { List<Dictionary<string, object>> dicList = new List<Dictionary<string, object>>(); List<IMP_Dept> deptList = parentDeptId == Constants.OptionAllVal ? allDeptList.FindAll(a => a.Type == DictCodeConst.CD01_FGS) : allDeptList.FindAll(a => a.PId == parentDeptId); if (deptList.Count == 0 && parentDeptId != Constants.OptionAllVal) return null; foreach (IMP_Dept dept in deptList) { Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("id", "dept" + dept.Id); dic.Add("text", dept.Name); dic.Add("checkbox", true); List<Dictionary<string, object>> childDicList = new List<Dictionary<string, object>>(); //當前部門下的子部門 List<Dictionary<string, object>> childDeptDicList = GetDepts(dept.Id, allDeptList); if (childDeptDicList != null) { childDicList.AddRange(childDeptDicList); } //當前部門下的員工 List<Dictionary<string, object>> childEmployeeDicList = GetEmployees(dept); if (childEmployeeDicList != null) { childDicList.AddRange(childEmployeeDicList); } if (childDicList != null && childDicList.Count > 0) { dic.Add("state", parentDeptId == Constants.OptionAllVal ? "open" : "closed"); dic.Add("children", childDicList); } dicList.Add(dic); } return dicList; } /// <summary> /// 獲取部門下的員工 /// </summary> private List<Dictionary<string, object>> GetEmployees(IMP_Dept dept) { List<Dictionary<string, object>> dicList = new List<Dictionary<string, object>>(); List<IMP_Employee> employeeList = employeeService.FindEmployeeDept(dept.Id); if (employeeList.Count == 0) return null; employeeList.Sort((a, b) => string.Compare(a.Name, b.Name)); foreach (IMP_Employee employee in employeeList) { Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("id", employee.Id); dic.Add("text", employee.Name); dic.Add("checkbox", true); string attributes = string.Format("'DeptName':'{0}','JobName':'{1}','EmpCode':'{2}','EntryTime':'{3}'", employee.Dept == null ? "" : employee.Dept.Name, employee.Job == null ? "" : employee.Job.Name, employee.Code == null ? "" : employee.Code, employee.EntryTime == DateTime.MinValue ? "" : employee.EntryTime.ToString(Constants.FormatDate)); dic.Add("attributes", attributes); dicList.Add(dic); } return dicList; } #endregion #region 上傳附件 /// <summary> /// 上傳附件 /// </summary> [DbTransaction] public void UploadFile() { StringBuilder sbUploadFileIds = new StringBuilder(); List<HttpFile> fileList = ctx.GetFiles(); foreach (HttpFile file in fileList) { if (file.ContentLength == 0) continue; Result resultFile = Uploader.SaveFile(file);//上傳附件 if (resultFile.HasErrors) { ctx.errors.Errors = resultFile.Errors; echoJsonMsg(ctx.errors.ErrorsText, false, ""); return; } //保存附件實體類 UploadFile uploadFile = new UploadFile(); String filePath = strUtil.Join(sys.Path.DiskPhoto, resultFile.Info.ToString()); // 獲取文件路徑 uploadFile.Name = file.FileName; uploadFile.FileType = (int)UploadFlieType.TrainingFile; uploadFile.Path = filePath; uploadFile.Created = DateTime.Now; Result resultUploadFile = uploadFileService.insert(uploadFile); if (resultUploadFile.HasErrors) { ctx.errors.Errors = resultUploadFile.Errors; echoText("<script>parent.finishUploadFile('error');</script>"); return; } sbUploadFileIds.Append("," + uploadFile.Id); } // 這里的內容返回給 iframe StringBuilder sb = new StringBuilder(); sb.Append("<script>"); // 這段內容在iframe中,所以通過 parent 來調用主頁面的方法 if (sbUploadFileIds.Length > 0) { sb.Append("parent.finishUploadFile('" + sbUploadFileIds.ToString().Substring(1) + "')"); } else { sb.Append("parent.finishUploadFile('')"); } sb.Append("</script>"); echoText(sb.ToString()); } #endregion #region 下載附件 /// <summary> /// 附件下載 /// </summary> public void DownloadFile(int uploadFileId) { UploadFile uploadFile = uploadFileService.findById<UploadFile>(uploadFileId); if (uploadFile != null) { HttpContext context = (HttpContext)ctx.web.Context; if (context != null) { string filePathName = PathHelper.Map(sys.Path.DiskPhoto) + uploadFile.Path.Replace("/static/upload/image", "").Replace("/", "\\"); int pos = filePathName.LastIndexOf("\\"); string fileName = filePathName.Substring(pos + 1); string UserAgent = context.Request.ServerVariables["http_user_agent"].ToLower(); if (UserAgent.IndexOf("firefox") == -1) { //非火狐瀏覽器 context.Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(uploadFile.Name)); } else { context.Response.AddHeader("content-disposition", "attachment;filename=" + uploadFile.Name); } FileStream fs = new FileStream(filePathName, FileMode.Open, FileAccess.Read); byte[] bArr = new byte[fs.Length]; fs.Read(bArr, 0, bArr.Length); fs.Close(); context.Response.ContentEncoding = Encoding.UTF8; context.Response.BinaryWrite(bArr); context.Response.Flush(); context.Response.End(); } } } #endregion } }
六、待辦、抄送、查詢等流程列表頁面的控制器代碼

using System; using System.Collections.Generic; using System.Text; using Simpo.Web.Mvc; using System.Collections; using BP.WF; using CQSD.Domain; using CQSD.Utils; using CQSD.Domain.DB; using System.Data; using Simpo.Web; using Simpo; using Simpo.Web.Mvc.Attr; using Simpo.Web.Utils; using CQSD.Const; using CQSD.Service.Interface; using CQSD.Service; using CQSD.Service.Interface.Admin.CCFlow; namespace CQSD.Controller.Admin.CCFlow { /// <summary> /// 工作流(設計器、新建工作、待辦工作等) /// </summary> public class FlowMenuController : FlowControllerBase { #region 工作流設計器 /// <summary> /// 工作流設計器 /// </summary> public void Design() { } #endregion #region 發起 /// <summary> /// 發起 /// </summary> public void FaQi() { //登錄 LoginCCFlow(); set("TimeKey", DateTime.Now.ToString("yyyyMMddHHmmss")); set("UserNo", LoginUser.Username); //初始化查詢條件 Flow_FlowInfo con = new Flow_FlowInfo(); BindFaQiCon(con); BindFaQiAction(); } /// <summary> /// 綁定事件 /// </summary> private void BindFaQiAction() { set("GetFaQiData", to(GetFaQiData)); } /// <summary> /// 綁定查詢條件 /// </summary> private void BindFaQiCon(Flow_FlowInfo con) { set("con.Type", con.Type); set("con.Name", con.Name); } /// <summary> /// 獲取可以發起的流程 /// </summary> public void GetFaQiData() { Flow_FlowInfo con = new Flow_FlowInfo(); con.Type = ctx.Get("con.Type"); con.Name = ctx.Get("con.Name"); //登錄 LoginCCFlow(); //獲取用戶可發起的流程 DataTable dt = BP.WF.Dev2Interface.DB_GenerCanStartFlowsOfDataTable(LoginUser.Username); //流程類別 List<Flow_FlowInfo> list = new List<Flow_FlowInfo>(); List<Flow_FlowInfo> flowTypeList = new List<Flow_FlowInfo>(); foreach (DataRow dr in dt.Rows) { if (!flowTypeList.Exists(a => a.FK_FlowSort == dr["FK_FlowSort"].ToString())) { Flow_FlowInfo flowType = new Flow_FlowInfo(); flowType.id = dr["FK_FlowSort"].ToString(); flowType.level = 0; flowType.parent = "-1"; flowType.isLeaf = false; flowType.expanded = true; flowType.FK_FlowSort = dr["FK_FlowSort"].ToString(); flowType.No = ""; flowType.Type = dr["FK_FlowSortText"].ToString(); flowType.Name = ""; flowTypeList.Add(flowType); } } foreach (Flow_FlowInfo flowType in flowTypeList)//遍歷流程類別 { list.Add(flowType); //流程 List<Flow_FlowInfo> flowList = new List<Flow_FlowInfo>(); foreach (DataRow dr in dt.Rows) { if (dr["FK_FlowSort"].ToString() == flowType.FK_FlowSort) { Flow_FlowInfo flow = new Flow_FlowInfo(); flow.id = "level1" + dr["No"].ToString(); flow.level = 1; flow.parent = dr["FK_FlowSort"].ToString(); flow.isLeaf = true; flow.expanded = true; flow.No = dr["No"].ToString(); flow.Type = dr["FK_FlowSortText"].ToString(); flow.Name = dr["Name"].ToString(); flowList.Add(flow); } } list.AddRange(flowList); } list = list.FindAll(a => a.Type.IndexOf(con.Type) != -1 && a.Name.IndexOf(con.Name) != -1); echoJson(list); } #endregion #region 待辦 /// <summary> /// 待辦 /// </summary> public void DaiBan() { //登錄 LoginCCFlow(); set("TimeKey", DateTime.Now.ToString("yyyyMMddHHmmss")); set("UserNo", LoginUser.Username); //初始化查詢條件 Flow_FlowInfo con = new Flow_FlowInfo(); BindDaiBanCon(con); BindDaiBanAction(); } /// <summary> /// 綁定事件 /// </summary> private void BindDaiBanAction() { set("GetDaiBanData", to(GetDaiBanData)); } /// <summary> /// 綁定查詢條件 /// </summary> private void BindDaiBanCon(Flow_FlowInfo con) { set("con.Type", con.Type); set("con.Name", con.Name); } /// <summary> /// 待辦 /// </summary> public void GetDaiBanData() { Flow_FlowInfo con = new Flow_FlowInfo(); con.Type = ctx.Get("con.Type"); con.Name = ctx.Get("con.Name"); //登錄 LoginCCFlow(); //數據 DataTable dt = BP.WF.Dev2Interface.DB_GenerEmpWorksOfDataTable(LoginUser.Username, null); //流程 List<Flow_WorkInfo> list = new List<Flow_WorkInfo>(); List<Flow_WorkInfo> flowList = new List<Flow_WorkInfo>(); foreach (DataRow dr in dt.Rows) { if (!flowList.Exists(a => a.FK_Flow == dr["FK_Flow"].ToString())) { Flow_WorkInfo flow = new Flow_WorkInfo(); flow.id = dr["FK_Flow"].ToString(); flow.level = 0; flow.parent = "-1"; flow.isLeaf = false; flow.expanded = true; flow.FK_Flow = dr["FK_Flow"].ToString(); flow.Title = dr["FlowName"].ToString(); flow.FlowName = ""; flowList.Add(flow); } } foreach (Flow_WorkInfo flow in flowList)//遍歷流程 { list.Add(flow); //工作 List<Flow_WorkInfo> workList = new List<Flow_WorkInfo>(); foreach (DataRow dr in dt.Rows) { if (dr["FK_Flow"].ToString() == flow.FK_Flow) { Flow_WorkInfo work = new Flow_WorkInfo(); work.id = "level1" + dr["WorkID"].ToString(); work.level = 1; work.parent = dr["FK_Flow"].ToString(); work.isLeaf = true; work.expanded = true; work.FK_Flow = dr["FK_Flow"].ToString(); work.FK_Node = dr["FK_Node"].ToString(); work.WorkID = dr["WorkID"].ToString(); work.FID = dr["FID"].ToString(); work.AtPara = dr["AtPara"].ToString(); work.Title = dr["Title"].ToString(); work.FlowName = dr["FlowName"].ToString(); work.NodeName = dr["NodeName"].ToString(); work.StarterName = dr["StarterName"].ToString(); work.RDT = dr["RDT"].ToString(); work.ADT = dr["ADT"].ToString(); work.SDT = dr["SDT"].ToString(); work.WFState = "逾期"; if (!strUtil.IsNullOrEmpty(dr["SDT"].ToString())) { var d1 = DateTime.Now; var d2 = DateTime.Parse(dr["SDT"].ToString()); if ((dr["PressTimes"].ToString() == "0") || (d1 <= d2)) { work.WFState = "正常"; } } workList.Add(work); } } list.AddRange(workList); } list = list.FindAll(a => a.FlowName.IndexOf(con.Name) != -1); echoJson(list); } #endregion #region 在途 /// <summary> /// 在途 /// </summary> public void ZaiTu() { //登錄 LoginCCFlow(); set("TimeKey", DateTime.Now.ToString("yyyyMMddHHmmss")); set("UserNo", LoginUser.Username); //初始化查詢條件 Flow_FlowInfo con = new Flow_FlowInfo(); BindZaiTuCon(con); BindZaiTuAction(); } /// <summary> /// 綁定事件 /// </summary> private void BindZaiTuAction() { set("GetZaiTuData", to(GetZaiTuData)); set("Flow_DoUnSendLink", to(Flow_DoUnSend)); set("CuiBanLink", to(CuiBan)); } /// <summary> /// 綁定查詢條件 /// </summary> private void BindZaiTuCon(Flow_FlowInfo con) { set("con.Type", con.Type); set("con.Name", con.Name); } /// <summary> /// 數據 /// </summary> public void GetZaiTuData() { Flow_FlowInfo con = new Flow_FlowInfo(); con.Type = ctx.Get("con.Type"); con.Name = ctx.Get("con.Name"); //登錄 LoginCCFlow(); //數據 DataTable dt = BP.WF.Dev2Interface.DB_GenerRuning(LoginUser.Username, null); //流程 List<Flow_WorkInfo> list = new List<Flow_WorkInfo>(); List<Flow_WorkInfo> flowList = new List<Flow_WorkInfo>(); foreach (DataRow dr in dt.Rows) { if (!flowList.Exists(a => a.FK_Flow == dr["FK_Flow"].ToString())) { Flow_WorkInfo flow = new Flow_WorkInfo(); flow.id = dr["FK_Flow"].ToString(); flow.level = 0; flow.parent = "-1"; flow.isLeaf = false; flow.expanded = true; flow.FK_Flow = dr["FK_Flow"].ToString(); flow.Title = dr["FlowName"].ToString(); flow.FlowName = ""; flowList.Add(flow); } } foreach (Flow_WorkInfo flow in flowList)//遍歷流程 { list.Add(flow); //工作 List<Flow_WorkInfo> workList = new List<Flow_WorkInfo>(); foreach (DataRow dr in dt.Rows) { if (dr["FK_Flow"].ToString() == flow.FK_Flow) { Flow_WorkInfo work = new Flow_WorkInfo(); work.id = "level1" + dr["WorkID"].ToString(); work.level = 1; work.parent = dr["FK_Flow"].ToString(); work.isLeaf = true; work.expanded = true; work.FK_Flow = dr["FK_Flow"].ToString(); work.FK_Node = dr["FK_Node"].ToString(); work.WorkID = dr["WorkID"].ToString(); work.FID = dr["FID"].ToString(); work.AtPara = dr["AtPara"].ToString(); work.Title = dr["Title"].ToString(); work.FlowName = dr["FlowName"].ToString(); work.NodeName = dr["NodeName"].ToString(); work.StarterName = dr["StarterName"].ToString(); work.RDT = dr["RDT"].ToString(); workList.Add(work); } } list.AddRange(workList); } list = list.FindAll(a => a.FlowName.IndexOf(con.Name) != -1); echoJson(list); } #endregion #region 查詢 /// <summary> /// 發起 /// </summary> public void ChaXun() { //登錄 LoginCCFlow(); set("TimeKey", DateTime.Now.ToString("yyyyMMddHHmmss")); set("UserNo", LoginUser.Username); //初始化查詢條件 Flow_FlowInfo con = new Flow_FlowInfo(); BindChaXunCon(con); BindChaXunAction(); } /// <summary> /// 綁定事件 /// </summary> private void BindChaXunAction() { set("GetChaXunData", to(GetChaXunData)); } /// <summary> /// 綁定查詢條件 /// </summary> private void BindChaXunCon(Flow_FlowInfo con) { set("con.Type", con.Type); set("con.Name", con.Name); } /// <summary> /// 獲取可以發起的流程 /// </summary> public void GetChaXunData() { Flow_FlowInfo con = new Flow_FlowInfo(); con.Type = ctx.Get("con.Type"); con.Name = ctx.Get("con.Name"); //登錄 LoginCCFlow(); //獲取有流程的流程類別 DataTable dtFlowType = ccFlowService.GetFlowTypeList(); List<Flow_FlowInfo> flowList = new List<Flow_FlowInfo>(); Flow_FlowInfo flow; foreach (DataRow drFlowType in dtFlowType.Rows)//遍歷流程類別 { flow = new Flow_FlowInfo(); flow.id = drFlowType["No"].ToString(); flow.level = 0; flow.parent = "-1"; flow.isLeaf = false; flow.expanded = true; flow.Type = drFlowType["Name"].ToString(); flow.No = ""; flow.Name = ""; flowList.Add(flow); //獲取類別下的流程 DataTable dt = ccFlowService.GetFlowList(drFlowType["No"].ToString(), Employee); foreach (DataRow dr in dt.Rows)//遍歷類別下的流程集合 { flow = new Flow_FlowInfo(); flow.id = "level1" + dr["No"].ToString(); flow.level = 1; flow.parent = dr["FK_FlowSort"].ToString(); flow.isLeaf = true; flow.expanded = true; flow.No = dr["No"].ToString(); flow.Type = dr["FK_FlowSortText"].ToString(); flow.Name = dr["Name"].ToString(); flowList.Add(flow); } } flowList = flowList.FindAll(a => a.Type.IndexOf(con.Type) != -1 && a.Name.IndexOf(con.Name) != -1); echoJson(flowList); } #endregion #region 抄送列表 /// <summary> /// 抄送列表 /// </summary> public void CCList() { //登錄 LoginCCFlow(); set("TimeKey", DateTime.Now.ToString("yyyyMMddHHmmss")); set("UserNo", LoginUser.Username); //初始化查詢條件 Flow_CCInfo con = new Flow_CCInfo(); BindCCListCon(con); BindCCListAction(); } /// <summary> /// 綁定事件 /// </summary> private void BindCCListAction() { set("GetCCListData", to(GetCCListData)); set("Flow_DoUnSendLink", to(Flow_DoUnSend)); set("CuiBanLink", to(CuiBan)); } /// <summary> /// 綁定查詢條件 /// </summary> private void BindCCListCon(Flow_CCInfo con) { } /// <summary> /// 數據 /// </summary> public void GetCCListData() { Flow_CCInfo con = new Flow_CCInfo(); int searchType = ctx.GetInt("SearchType"); //登錄 LoginCCFlow(); //數據 DataTable dt = new DataTable(); switch (searchType) { case 1: //全部 dt = BP.WF.Dev2Interface.DB_CCList(LoginUser.Username); break; case 2: //未讀 dt = BP.WF.Dev2Interface.DB_CCList_UnRead(LoginUser.Username); break; case 3: //已讀 dt = BP.WF.Dev2Interface.DB_CCList_Read(LoginUser.Username); break; case 4: //刪除 dt = BP.WF.Dev2Interface.DB_CCList_Delete(LoginUser.Username); break; default: break; } //流程 List<Flow_CCInfo> list = new List<Flow_CCInfo>(); List<Flow_CCInfo> flowList = new List<Flow_CCInfo>(); foreach (DataRow dr in dt.Rows) { if (!flowList.Exists(a => a.FK_Flow == dr["FK_Flow"].ToString())) { Flow_CCInfo flow = new Flow_CCInfo(); flow.id = dr["FK_Flow"].ToString(); flow.level = 0; flow.parent = "-1"; flow.isLeaf = false; flow.expanded = true; flow.FK_Flow = dr["FK_Flow"].ToString(); flow.Title = dr["FlowName"].ToString(); flowList.Add(flow); } } foreach (Flow_CCInfo flow in flowList)//遍歷流程 { list.Add(flow); //工作 List<Flow_CCInfo> workList = new List<Flow_CCInfo>(); foreach (DataRow dr in dt.Rows) { if (dr["FK_Flow"].ToString() == flow.FK_Flow) { Flow_CCInfo work = new Flow_CCInfo(); work.id = "level1" + dr["WorkID"].ToString(); work.level = 1; work.parent = dr["FK_Flow"].ToString(); work.isLeaf = true; work.expanded = true; work.FK_Flow = dr["FK_Flow"].ToString(); work.FK_Node = dr["FK_Node"].ToString(); work.WorkID = dr["WorkID"].ToString(); work.FID = dr["FID"].ToString(); work.Sta = dr["Sta"].ToString(); work.MyPK = dr["MyPK"].ToString(); work.Title = dr["Title"].ToString(); work.Doc = dr["Doc"].ToString(); work.NodeName = dr["NodeName"].ToString(); work.CCEmpName = dr["Rec"].ToString(); workList.Add(work); } } list.AddRange(workList); } echoJson(list); } #endregion #region 系統消息 /// <summary> /// 系統消息 /// </summary> public void MsgList() { //登錄 LoginCCFlow(); set("TimeKey", DateTime.Now.ToString("yyyyMMddHHmmss")); set("ReadSMSUrl", to(ReadSMS)); set("UserNo", LoginUser.Username); //初始化查詢條件 Flow_SMSInfo con = new Flow_SMSInfo(); BindMsgListCon(con); BindMsgListAction(); } /// <summary> /// 綁定事件 /// </summary> private void BindMsgListAction() { set("GetMsgListData", to(GetMsgListData)); set("Flow_DoUnSendLink", to(Flow_DoUnSend)); set("CuiBanLink", to(CuiBan)); } /// <summary> /// 綁定查詢條件 /// </summary> private void BindMsgListCon(Flow_SMSInfo con) { } /// <summary> /// 數據 /// </summary> public void GetMsgListData() { Flow_SMSInfo con = new Flow_SMSInfo(); int searchType = ctx.GetInt("SearchType"); //登錄 LoginCCFlow(); //數據 DataTable dt = new DataTable(); switch (searchType) { case 1: //全部 dt = ccFlowService.GetSMS(LoginUser.Username, Constants.OptionAllVal); break; case 2: //未讀 dt = ccFlowService.GetSMS(LoginUser.Username, 0); break; case 3: //已讀 dt = ccFlowService.GetSMS(LoginUser.Username, 1); break; default: break; } //流程 List<Flow_SMSInfo> list = new List<Flow_SMSInfo>(); List<Flow_SMSInfo> flowList = new List<Flow_SMSInfo>(); foreach (DataRow dr in dt.Rows) { if (!flowList.Exists(a => a.Title == dr["RDT"].ToString().Substring(0, 10))) { Flow_SMSInfo flow = new Flow_SMSInfo(); flow.id = dr["RDT"].ToString().Substring(0, 10); flow.level = 0; flow.parent = "-1"; flow.isLeaf = false; flow.expanded = true; flow.Title = dr["RDT"].ToString().Substring(0, 10); flowList.Add(flow); } } //按日期排序 flowList.Sort((a, b) => { return Convert.ToDateTime(b.Title).CompareTo(Convert.ToDateTime(a.Title)); }); foreach (Flow_SMSInfo flow in flowList)//遍歷流程 { list.Add(flow); //工作 List<Flow_SMSInfo> workList = new List<Flow_SMSInfo>(); foreach (DataRow dr in dt.Rows) { if (dr["RDT"].ToString().Substring(0, 10) == flow.Title) { Flow_SMSInfo work = new Flow_SMSInfo(); work.id = "level1" + dr["MyPK"].ToString(); work.level = 1; work.parent = dr["RDT"].ToString().Substring(0, 10); work.isLeaf = true; work.expanded = true; work.MyPK = dr["MyPK"].ToString(); work.Title = dr["Title"].ToString(); work.Doc = dr["Doc"].ToString(); work.Sender = dr["Sender"].ToString(); work.RDT = dr["RDT"].ToString(); //SID string doc = dr["Doc"].ToString(); int sidPos = doc.IndexOf("SID="); string subdoc = doc.Substring(sidPos + 4); int blankPos = subdoc.IndexOf(" "); if (blankPos != -1) { work.Para = subdoc.Substring(0, blankPos); } else { work.Para = subdoc.Substring(0); } if (dr["Doc"].ToString().Split(new string[] { "SID=" }, StringSplitOptions.None).Length > 2) { work.Para = "<a href='javascript:void(0);' onclick='openWork(\"" + work.MyPK + "\",\"" + "/WF/Do.aspx?DoType=OF&SID=" + work.Para + "\")'>" + work.Title + "</a>"; } else { work.Para = "<a href='" + "/WF/Do.aspx?SID=" + work.Para + "' target='_blank' onclick='read(\"" + work.MyPK + "\")'>" + work.Title + "}</a>"; } workList.Add(work); } } list.AddRange(workList); } if (list.Count > 0) { if (list[0].Title == DateTime.Now.ToString(Constants.FormatDate)) { list[0].Title = "今天"; } } echoJson(list); } #endregion #region 結果頁面 /// <summary> /// 結果頁面 /// </summary> public void SendResult() { DataTable dtGenerWorkerlist = ccFlowService.GetGenerWorkerlist(WorkID, FK_Node, LoginUser.Username); if (dtGenerWorkerlist.Rows.Count > 0) { set("msg1", "當前工作【<b>" + dtGenerWorkerlist.Rows[0]["FK_NodeText"] + "</b>】已經完成"); } else { set("msg1", "流程已經走到最后一個節點,流程成功結束"); } DataTable dtWork = ccFlowService.GetWork(WorkID); if (dtWork.Rows.Count > 0) { set("msg2", "任務自動發送給如下處理人:【<b>" + dtWork.Rows[0]["TodoEmps"] + "</b>】"); set("msg3", "下一步【<b>" + dtWork.Rows[0]["NodeName"] + "</b>】工作成功啟動"); } else { set("msg2", ""); set("msg3", "流程已經結束"); } } #endregion #region 撤銷發送 /// <summary> /// 撤銷發送 /// </summary> public void Flow_DoUnSend() { BP.WF.Dev2Interface.Flow_DoUnSend(FK_Flow, long.Parse(WorkID)); echoJsonOk(); } #endregion #region 催辦 /// <summary> /// 催辦 /// </summary> public void CuiBan() { DataTable dt = ccFlowService.GetWork(WorkID); if (dt.Rows.Count > 0) { set("Title", "催辦:" + dt.Rows[0]["Title"].ToString()); } else { set("Title", "獲取信息出錯"); } //綁定事件 target(to(DoCuiBan) + "?WorkID=" + WorkID); } /// <summary> /// 執行催辦 /// </summary> public void DoCuiBan() { string msg = ctx.Post("Content"); BP.WF.Dev2Interface.Flow_DoPress(long.Parse(WorkID), msg, true); echoJsonOk(); } #endregion #region 退回 /// <summary> /// 退回 /// </summary> public void ReturnWork() { set("NowTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm")); set("Msg", ""); DataTable dt = BP.WF.Dev2Interface.DB_GenerWillReturnNodes(int.Parse(FK_Node), long.Parse(WorkID), long.Parse(FID)); Dictionary<string, string> dict = new Dictionary<string, string>(); foreach (DataRow dr in dt.Rows) { dict.Add(dr["No"].ToString(), dr["RecName"] + "=>" + dr["Name"].ToString()); } dropList("Nodes", dict, null, Constants.OptionPls); //綁定事件 target(to(SaveReturnWork) + "?FK_Flow=" + FK_Flow + "&WorkID=" + WorkID + "&FK_Node=" + FK_Node + "&FID=" + FID); } /// <summary> /// 保存退回 /// </summary> public void SaveReturnWork() { int returnNodeId = ctx.PostInt("Nodes"); string msg = ctx.Post("Msg"); BP.WF.Dev2Interface.Node_ReturnWork(FK_Flow, long.Parse(WorkID), long.Parse(FID), int.Parse(FK_Node), returnNodeId, msg, false); echoJsonOk(); } #endregion #region 移交 /// <summary> /// 移交 /// </summary> public void Forward() { set("Msg", ""); //綁定事件 target(to(SaveForward) + "?WorkID=" + WorkID); set("GetDeptTree", to(GetDeptTree)); set("GetJobs", to(GetJobs)); set("GetEmps", to(GetUsers)); } /// <summary> /// 保存移交 /// </summary> public void SaveForward() { string emp = ctx.Post("emp"); string msg = ctx.Post("Msg"); try { BP.WF.Dev2Interface.Node_Shift(long.Parse(WorkID), emp, msg); } catch (Exception ex) { echoJsonMsg(ex.Message, false, ""); return; } echoJsonOk(); } #endregion #region 抄送 /// <summary> /// 抄送 /// </summary> public void CC() { set("Msg", ""); List<IMP_Employee> employeeList = employeeService.GetAllList(); checkboxList("Emp", employeeList, "Name=Id", null); DataTable dt = ccFlowService.GetWork(WorkID); // BP.WF.Dev2Interface.Flow_GetWorkerList(long.Parse(WorkID)); if (dt.Rows.Count > 0) { set("Title", dt.Rows[0]["Title"].ToString()); } else { set("Title", ""); } //綁定事件 target(to(SaveCC) + "?FK_Flow=" + FK_Flow + "&FID=" + FID + "&WorkID=" + WorkID + "&FK_Node=" + FK_Node); set("GetEmployees", to(GetEmployees)); } /// <summary> /// 保存抄送 /// </summary> public void SaveCC() { string employeeIds = ctx.Post("employeeIds"); string title = ctx.Post("Title"); string msg = ctx.Post("Msg"); //處理ID List<string> employeeIdList = new List<string>(); string[] employeeIdArray = employeeIds.Split(','); foreach (string employeeId in employeeIdArray) { if (employeeId.IndexOf("dept") == -1) { employeeIdList.Add(employeeId); } } List<IMP_Employee> employeeList = employeeService.GetList(string.Join(",", employeeIdList.ToArray())); foreach (IMP_Employee employee in employeeList) { Sys_User user = userService.GetByEmployeeId(employee.Id); BP.WF.Dev2Interface.Node_CC(FK_Flow, long.Parse(WorkID), user.Username, employee.Name, title, msg); } echoJsonOk(); } #endregion #region 標記消息為已讀 /// <summary> /// 標記消息為已讀 /// </summary> public void ReadSMS() { Sys_User loginUser = AdminUtil.GetLoginUser(ctx); string MyPK = ctx.Get("MyPK"); ccFlowService.ReadSMS(MyPK); RemindHelper.SubSysMsgCnt(loginUser.Id); echoJsonOk(); } #endregion } }
七、審核界面通用JS

$(function () { //退回、移交等信息 var msgInfo = $("input[name='MsgInfo']").val(); if (msgInfo != "") { var adminMainContent = $(".adminMainContent"); var html = ""; html += "<div class='box' style='margin-bottom:5px;'>"; html += " <div class='box-title'>"; html += " 提示信息"; html += " </div>"; html += " <div class='box-content'>"; html += " <table cellpadding='0' cellspacing='0' class='detail' width='100%'>"; html += " <tr>"; html += " <td>"; html += " " + msgInfo; html += " </td>"; html += " </tr>"; html += " </table>"; html += " </div>"; html += "</div>"; adminMainContent.prepend(html); } //控制按鈕顯示 var SID = $("input[name='SID']").val(); if (SID == "none") { $(".btnContainer").remove(); $(".tiao").remove(); } });
八、具體流程業務數據的增刪改查列表頁面
九、具體流程業務的審核頁面前台代碼

<link href="~css/admin/admin.css?v=#{jsVersion}" type="text/css" rel="stylesheet"> <link href="~js/easyui/easyui.css" rel="stylesheet" type="text/css" /> <script src="~js/easyui/jquery.easyui.min.js?v=#{jsVersion}" type="text/javascript"></script> <script src="~js/FlowCommon.js" type="text/javascript"></script> <input name="MsgInfo" type="hidden" value="#{MsgInfo}" /> <input name="SID" type="hidden" value="#{SID}" /> <form id="myForm" method="post" action="#{ActionLink}" enctype="multipart/form-data" class="ajaxPostForm" callback="callback"> <div class="btnContainer tiao"> <input type="button" value="提交審核" id="btnSave" onclick="save()" class="SIMPO_Text_Red2" /> <input type="button" value="移交" id="Button3" onclick="forward()" class="SIMPO_Text_Blue" /> <input type="button" value="抄送" id="Button4" onclick="cc()" class="SIMPO_Text_Blue" /> <input type="button" value="退回" id="Button5" onclick="returnWork()" class="SIMPO_Text_Blue" /> <input type="submit" value="保存提交" id="btnSaveSubmit" style="display: none;" /> <!-- <input type="button" class="SIMPO_Text_Gray btnCancel" value="取消" />--> </div> <div class="adminMainContent"> <iframe name="frmUpload" id="frmUpload" style="display: none"></iframe> <div class="box"> <div class="box-title"> 請假申請信息 </div> <div class="box-content"> <table cellpadding="0" cellspacing="0" class="detail" width="100%"> <tr> <td class="title"> 請假人: </td> <td> #{employee.Name} <input type="hidden" name="askLeave.Employee" value="#{employee.Id}" /> </td> <td class="title"> 請假人部門: </td> <td> #{employee.Dept.Name} </td> </tr> <tr> <td class="title"> 開始時間: </td> <td> #{askLeave.StartTime} </td> <td class="title"> 結束時間: </td> <td> #{askLeave.EndTime} </td> </tr> <tr> <td class="title"> 請假時長: </td> <td> #{askLeave.PlanLeaveDays} </td> <td class="title"> 請假日期: </td> <td> #{askLeave.ApplyDate} </td> </tr> <tr> <td class="title"> 請假調休類型: </td> <td colspan="3"> #{askLeave.DispLeaveType} <span id="spanLeaveType"></span> </td> </tr> <tr> <td class="title"> 請假事由: </td> <td colspan="3"> #{askLeave.LeaveReason} </td> </tr> </table> </div> </div> <div class="box" style="margin-top: 5px;"> <div class="box-title"> 審批意見 </div> <div class="box-content"> <table cellpadding="0" cellspacing="0" class="detail" width="100%"> <tr> <td class="title"> <span class="mst">*</span>審批意見: </td> <td colspan="3"> <textarea name="YiJian" class="tipInput" tip="長度不得超過500" style="width: 90%; height: 100px;">#{YiJian}</textarea> <span class="valid" msg="長度不得超過500" mode="border" rule="^(.|\n){0,500}$"></span> </td> </tr> <tr> <td class="title"> <span class="mst">*</span>是否通過: </td> <td colspan="3"> #{SFTG} </td> </tr> </table> </div> </div> <div class="box" style="margin-bottom: 50px; margin-top: 5px;"> <div class="box-title"> 審核列表 </div> <div class="box-content"> <table cellpadding='0' cellspacing='0' class='detail' width='100%' style='margin-bottom: 2px;'> <!-- BEGIN auditList --> <tr> <td rowspan='2' class='title' style='text-align: center;'> <b>#{audit.NodeName}</b> </td> <td class='title'> 審核人: </td> <td style='width: 15%;'> #{audit.Auditor} </td> <td class='title'> 審核時間: </td> <td> #{audit.AuditTime} </td> <td class='title'> 是否通過: </td> <td style='width: 10%;'> #{audit.SFTG} </td> </tr> <tr> <td class='title'> 審核意見: </td> <td colspan='5'> #{audit.YiJian} </td> </tr> <!-- END auditList --> </table> </div> </div> </div> </form> <script type="text/javascript" src="~js/My97DatePicker/WdatePicker.js?v=#{jsVersion}"></script> <script type="text/javascript"> _run(function () { //選擇請假類型 $.ajax({ type: "POST", url: "#{CalRemainingLeaveTimeLink}", data: "LeaveType=#{askLeave.LeaveType}", success: function (data) { if (data) { $("#spanLeaveType").html("(" + data + ")"); } } }); }); //保存 function save() { Simpo.ui.loading.show(); var SFTG = $("input[name='SFTG']:checked").val(); if (!SFTG) { Simpo.ui.msg.error("請選擇是否通過"); Simpo.ui.loading.hide(); return; } if (!Simpo.ui.doValid($("#btnSaveSubmit"))) { Simpo.ui.msg.error("頁面輸入校驗失敗,請檢查"); Simpo.ui.loading.hide(); return; } $('#btnSaveSubmit').click(); } //回調 function callback(thisForm, data) { Simpo.ui.loading.hide(); if (data.IsValid) { var frameId = top.getTabFrameId("待辦工作"); var frame = top.window.frames[frameId.replace("#", "")]; if (frame) frame.search(); setTimeout(function () { window.location = "#{SendResult}"; }, 500); } } //移交 function forward() { window.location.href = "#{ForwardLink}"; } //抄送 function cc() { top.addTabReplace('抄送', '#{CCUrl}'); } //退回 function returnWork() { window.location.href = "#{ReturnWorkLink}"; } </script>
十、具體流程業務的控制器代碼

using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Text; using System.Web; using BP.WF; using CQSD.Const; using CQSD.Controller.Admin.CCFlow; using CQSD.Domain; using CQSD.Domain.DB; using CQSD.Helper; using CQSD.Service; using CQSD.Service.Admin.HR; using CQSD.Service.Admin.Sys; using CQSD.Service.Interface; using CQSD.Service.Interface.Admin.HR; using CQSD.Service.Interface.Sys; using CQSD.Utils; using Demo.Domain.DB; using Simpo; using Simpo.Web; using Simpo.Web.Mvc; using Simpo.Web.Mvc.Attr; using Simpo.Web.Utils; namespace CQSD.Controller.Admin.HR.AskLeave { /// <summary> /// 請假 /// </summary> public class AskLeaveController : FlowControllerBase { #region 構造函數和字段 private IAskLeaveService askLeaveService; private FlowMenuController flowMenuController; private IUploadFileService uploadFileService; private ILeaveLongSerivce leaveLongSerivce; private IWorkingTimeService workingTimeService; public AskLeaveController() { askLeaveService = new AskLeaveService(); flowMenuController = new FlowMenuController(); uploadFileService = new UploadFileService(); leaveLongSerivce = new LeaveLongService(); workingTimeService = new WorkingTimeService(); } #endregion #region 請假列表 /// <summary> /// 請假列表 /// </summary> public void Index() { // 初始化檢索條件 IMP_AskLeave con = new IMP_AskLeave(); DateTime now = DateTime.Now; con.ApplyDateStart = new DateTime(now.Year, now.Month, 1).ToString(Constants.FormatDate); con.ApplyDateEnd = new DateTime(now.Year, now.Month + 1, 1).AddDays(-1).ToString(Constants.FormatDate); SetIndexVis(); BindIndexCon(con); BindIndexAction(); } /// <summary> /// 綁定查詢條件 /// </summary> private void BindIndexCon(IMP_AskLeave con) { set("con.ApplyDateStart", con.ApplyDateStart); set("con.ApplyDateEnd", con.ApplyDateEnd); set("con.EmpName", con.EmpName); List<Sys_Dict> dictStatus = dictService.GetListByType(DictType.CD80_FlowStatus); dropList("con.Status", dictStatus, "Name=Code", null, Constants.OptionPls); } /// <summary> /// 綁定事件 /// </summary> private void BindIndexAction() { set("GetIndexData", to(GetIndexData)); set("AddLink", to(Add)); set("EditLink", to(Edit)); set("ViewLink", to(View)); set("DeleteLink", to(Delete)); set("BatchDeleteLink", to(BatchDelete)); set("GetDeptTree", to(GetDeptTree)); set("GetJobs", to(GetJobs)); set("StartWorkLink", to(StartWork)); set("InvalidLink", to(Invalid)); set("TerminateLink", to(Terminate)); } /// <summary> /// 頁面權限 /// </summary> private void SetIndexVis() { } /// <summary> /// 查詢數據 /// </summary> public void GetIndexData() { CurrentRequest.setCurrentPage(ctx.GetInt("page")); int pageSize = ctx.GetInt("rows"); string sidx = ctx.Get("sidx"); string orderby = ctx.Get("sidx") + " " + ctx.Get("sord"); IMP_AskLeave con = new IMP_AskLeave(); con.EmpName = ctx.Get("con.EmpName"); con.ApplyDateStart = ctx.Get("con.ApplyDateStart"); con.ApplyDateEnd = ctx.Get("con.ApplyDateEnd"); con.Status = ctx.Get("con.Status"); con.Comp = employeeService.GetCompByEmployeeId(Employee.Id); DataPage<IMP_AskLeave> askLeaveList = askLeaveService.GetPage(con, pageSize, orderby); askLeaveList.Results.ForEach(a => { a.DispPlanLeaveDays = MinutesToDays(a.PlanLeaveDays); a.DispActualLeaveDays = MinutesToDays(a.ActualLeaveDays); }); string ret = askLeaveList.ToJqJson(); echoJson(ret); } #endregion #region 請假列表(個人列表) /// <summary> /// 請假列表(個人列表) /// </summary> public void PersonalIndex() { // 初始化檢索條件 IMP_AskLeave con = new IMP_AskLeave(); DateTime now = DateTime.Now; con.ApplyDateStart = new DateTime(now.Year, now.Month, 1).ToString(Constants.FormatDate); con.ApplyDateEnd = new DateTime(now.Year, now.Month + 1, 1).AddDays(-1).ToString(Constants.FormatDate); SetPersonalIndexVis(); BindPersonalIndexCon(con); BindPersonalIndexAction(); } /// <summary> /// 綁定查詢條件 /// </summary> private void BindPersonalIndexCon(IMP_AskLeave con) { set("con.ApplyDateStart", con.ApplyDateStart); set("con.ApplyDateEnd", con.ApplyDateEnd); set("con.EmpName", con.EmpName); List<Sys_Dict> dictStatus = dictService.GetListByType(DictType.CD80_FlowStatus); dropList("con.Status", dictStatus, "Name=Code", null, Constants.OptionPls); } /// <summary> /// 綁定事件 /// </summary> private void BindPersonalIndexAction() { set("GetPersonalIndexData", to(GetPersonalIndexData)); set("AddLink", to(Add)); set("EditLink", to(Edit)); set("ViewLink", to(View)); set("DeleteLink", to(Delete)); set("BatchDeleteLink", to(BatchDelete)); set("GetDeptTree", to(GetDeptTree)); set("GetJobs", to(GetJobs)); set("StartWorkLink", to(StartWork)); set("InvalidLink", to(Invalid)); } /// <summary> /// 頁面權限 /// </summary> private void SetPersonalIndexVis() { } /// <summary> /// 查詢數據 /// </summary> public void GetPersonalIndexData() { CurrentRequest.setCurrentPage(ctx.GetInt("page")); int pageSize = ctx.GetInt("rows"); string sidx = ctx.Get("sidx"); string orderby = ctx.Get("sidx") + " " + ctx.Get("sord"); IMP_AskLeave con = new IMP_AskLeave(); con.EmpName = ctx.Get("con.EmpName"); con.ApplyDateStart = ctx.Get("con.ApplyDateStart"); con.ApplyDateEnd = ctx.Get("con.ApplyDateEnd"); con.Status = ctx.Get("con.Status"); con.CreateUser = LoginUser; DataPage<IMP_AskLeave> askLeaveList = askLeaveService.GetPage(con, pageSize, orderby); askLeaveList.Results.ForEach(a => { a.DispPlanLeaveDays = MinutesToDays(a.PlanLeaveDays); a.DispActualLeaveDays = MinutesToDays(a.ActualLeaveDays); }); string ret = askLeaveList.ToJqJson(); echoJson(ret); } #endregion #region 添加 /// <summary> /// 添加 /// </summary> public void Add() { IMP_AskLeave askLeave = new IMP_AskLeave(); bind("askLeave", askLeave); set("askLeave.ApplyDate", DateTime.Now.ToString(Constants.FormatDate)); List<Sys_Dict> dictLeaveTypeList = dictService.GetListByType(DictType.CD49); dropList("askLeave.LeaveType", dictLeaveTypeList, "Name=Code", null, Constants.OptionBlank); //獲取當前登錄用戶關聯的員工信息 IMP_Employee employee = employeeService.findById<IMP_Employee>(LoginUser.RelationId); bind("employee", employee); //工作時長 IMP_WorkTimeSetting workTimeSetting = workingTimeService.Get(Employee.Dept); set("WorkLong", workTimeSetting.WorkLong); // 綁定事件 target(Create); set("GetDeptTree", to(GetDeptTree)); set("GetJobs", to(GetJobs)); set("GetEmps", to(GetEmps_IdName)); set("CalRemainingLeaveTimeLink", to(CalRemainingLeaveTime, employee.Id)); } /// <summary> /// 添加員工培訓保存 /// </summary> [HttpPost, DbTransaction] public void Create() { IMP_AskLeave askLeave = new IMP_AskLeave(); askLeave = ctx.PostValue<IMP_AskLeave>("askLeave"); askLeave.CreateUser = LoginUser; askLeave.CreateTime = DateTime.Now; askLeave.Status = DictCodeConst.CD80_FlowStatus_CG; askLeave.ActualLeaveDays = askLeave.PlanLeaveDays; Result result = askLeaveService.insert(askLeave); if (result.HasErrors) { ctx.errors.Errors = result.Errors; echoJsonMsg(ctx.errors.ErrorsText, false, ""); return; } // 日志 OperateLogHelper<Sys_OperateLog>.Add(LoginUser, OperateLogString.AskLeaveAddOk(), "{Id:" + askLeave.Id + "}", typeof(IMP_AskLeave).FullName, ctx.Ip); echoJsonOk(); } #endregion #region 修改 /// <summary> /// 修改 /// </summary> public void Edit() { int askLeaveId = ctx.GetInt("Id"); IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(askLeaveId); bind("askLeave", askLeave); set("askLeave.ApplyDate", askLeave.ApplyDate.ToString(Constants.FormatDate)); set("askLeave.StartTime", askLeave.StartTime.ToString("yyyy-MM-dd HH:mm")); set("askLeave.EndTime", askLeave.EndTime.ToString("yyyy-MM-dd HH:mm")); List<Sys_Dict> dictLeaveTypeList = dictService.GetListByType(DictType.CD49); dropList("askLeave.LeaveType", dictLeaveTypeList, "Name=Code", askLeave.LeaveType, Constants.OptionBlank); //獲取當前登錄用戶關聯的員工信息 IMP_Employee employee = employeeService.findById<IMP_Employee>(LoginUser.RelationId); bind("employee", employee); //工作時長 IMP_WorkTimeSetting workTimeSetting = workingTimeService.Get(Employee.Dept); set("WorkLong", workTimeSetting.WorkLong); // 綁定事件 target(Update, askLeaveId); set("GetDeptTree", to(GetDeptTree)); set("GetJobs", to(GetJobs)); set("GetEmps", to(GetEmps_IdName)); set("CalRemainingLeaveTimeLink", to(CalRemainingLeaveTime, employee.Id)); } /// <summary> /// 修改員工培訓保存 /// </summary> [HttpPost, DbTransaction] public void Update(int askLeaveId) { IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(askLeaveId); askLeave = (IMP_AskLeave)ctx.PostValue(askLeave, "askLeave"); askLeave.ActualLeaveDays = askLeave.PlanLeaveDays; askLeave.UpdateUser = LoginUser; askLeave.UpdateTime = DateTime.Now; Result result = askLeaveService.update(askLeave); if (result.HasErrors) { ctx.errors.Errors = result.Errors; echoJsonMsg(ctx.errors.ErrorsText, false, ""); return; } // 日志 OperateLogHelper<Sys_OperateLog>.Add(LoginUser, OperateLogString.AskLeaveEditOk(), "{Id:" + askLeave.Id + "}", typeof(IMP_AskLeave).FullName, ctx.Ip); echoJsonOk(); } #endregion #region 查看 /// <summary> /// 查看 /// </summary> public void View() { int askLeaveId = ctx.GetInt("Id"); IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(askLeaveId); bind("askLeave", askLeave); set("askLeave.ApplyDate", askLeave.ApplyDate.ToString(Constants.FormatDate)); set("askLeave.StartTime", askLeave.StartTime.ToString("yyyy-MM-dd HH:mm")); set("askLeave.EndTime", askLeave.EndTime.ToString("yyyy-MM-dd HH:mm")); Sys_Dict dictLeaveType = dictService.GetListByTypeAndCode(DictType.CD49, askLeave.LeaveType); set("askLeave.DispLeaveType", dictLeaveType == null ? "" : dictLeaveType.Name); set("askLeave.PlanLeaveDays", MinutesToDays(askLeave.PlanLeaveDays)); set("askLeave.ActualLeaveDays", MinutesToDays(askLeave.ActualLeaveDays)); //獲取當前登錄用戶關聯的員工信息 IMP_Employee employee = askLeave.Employee; bind("employee", employee); set("CalRemainingLeaveTimeLink", to(CalRemainingLeaveTime, employee.Id)); } #endregion #region 刪除 /// <summary> /// 刪除 /// </summary> [DbTransaction] public void Delete() { int askLeaveId = ctx.PostInt("Id"); IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(askLeaveId); askLeave.DelFlg = (int)Flag.Yes; Result result = askLeaveService.update(askLeave); if (result.HasErrors) { ctx.errors.Errors = result.Errors; echoJsonMsg(ctx.errors.ErrorsText, false, ""); return; } // 日志 OperateLogHelper<Sys_OperateLog>.Add(LoginUser, OperateLogString.AskLeaveDelOk(), "{Id:" + askLeave.Id + "}", typeof(IMP_AskLeave).FullName, ctx.Ip); echoJsonOk(); } /// <summary> /// 批量刪除 /// </summary> [DbTransaction] public void BatchDelete() { string choiceIds = ctx.PostIdList(FwCmdKey.choice.ToString());//獲取ID集合 string action = ctx.Post(FwCmdKey.action.ToString());//獲取命令標識 string[] idArray = choiceIds.Split(','); //檢查 foreach (string id in idArray) { IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(int.Parse(id)); if (askLeave.Status != DictCodeConst.CD80_FlowStatus_CG) { echoJsonMsg("刪除失敗!只能刪除草稿狀態的請假", false, ""); return; } } if (FwCmdKey.deletetrue.ToString().Equals(action)) //action 對應 頁面中 cmd="deletetrue" { //批量刪除 askLeaveService.updateBatch<IMP_AskLeave>(string.Format("DelFlg={0}", (int)Flag.Yes), string.Format("Id in ({0})", choiceIds)); } //日志 OperateLogHelper<Sys_OperateLog>.Add(LoginUser, OperateLogString.AskLeaveDelOk(), "{Ids:" + choiceIds + "}", typeof(IMP_AskLeave).FullName, ctx.Ip); echoJsonOk(); } #endregion #region 發起工作(從草稿箱發起) /// <summary> /// 發起工作(從草稿箱發起) /// </summary> [DbTransaction] public void StartWork() { //登錄CCFlow LoginCCFlow(); string ids = ctx.Post("ids"); string[] idArray = ids.Split(','); //檢查 foreach (string id in idArray) { IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(int.Parse(id)); if (askLeave.Status != DictCodeConst.CD80_FlowStatus_CG) { echoJsonMsg("提交失敗!請選擇草稿狀態的請假", false, ""); return; } } foreach (string id in idArray) { IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(int.Parse(id)); // 處理ccflow的業務邏輯,僅把關鍵字段傳遞給ccflow的節點表單中去,用戶判斷方向。 Hashtable ht = new Hashtable(); string fk_Flow = IMP_FlowConfig.GetFK_Flow(Employee, "AskLeaveAudit"); long workID = Dev2Interface.Node_CreateStartNodeWork(fk_Flow, ht, null, LoginUser.Username, "請假申請:" + askLeave.Employee.Name); SendReturnObjs sendObj = BP.WF.Dev2Interface.Node_SendWork(fk_Flow, workID, ht); //更新業務數據 askLeave.FK_Flow = fk_Flow; askLeave.WorkID = (int)workID; askLeave.Status = DictCodeConst.CD80_FlowStatus_SHZ; askLeaveService.update(askLeave, new string[] { "FK_Flow", "WorkID", "Status" }); } echoJsonOk(); } #endregion #region 結束流程 /// <summary> /// 結束流程 /// </summary> public void EndWork(string FK_Flow, string WorkID, string status) { IMP_AskLeave askLeave = askLeaveService.Get(int.Parse(WorkID)); askLeave.Status = status; askLeaveService.update(askLeave, "Status"); ccFlowService.EndFlowProcess(Employee, FK_Flow, WorkID); BP.WF.Dev2Interface.Flow_DoFlowOver(FK_Flow, long.Parse(WorkID), ""); } #endregion #region 審批 /// <summary> /// 審批 /// </summary> public void Audit() { //通用設置 CommonSet(Employee); //綁定請假 IMP_AskLeave askLeave = askLeaveService.Get(int.Parse(WorkID)); bind("askLeave", askLeave); set("askLeave.ApplyDate", askLeave.ApplyDate.ToString(Constants.FormatDate)); set("askLeave.StartTime", askLeave.StartTime.ToString("yyyy-MM-dd HH:mm")); set("askLeave.EndTime", askLeave.EndTime.ToString("yyyy-MM-dd HH:mm")); Sys_Dict dictLeaveType = dictService.GetListByTypeAndCode(DictType.CD49, askLeave.LeaveType); set("askLeave.DispLeaveType", dictLeaveType == null ? "" : dictLeaveType.Name); set("askLeave.PlanLeaveDays", MinutesToDays(askLeave.PlanLeaveDays)); radioList("SFTG", EnumHelper.GetValTextDic(typeof(Flag)), null); set("YiJian", ""); //獲取當前登錄用戶關聯的員工信息 IMP_Employee employee = askLeave.Employee; bind("employee", employee); //審核列表 List<Flow_Audit> auditList = flowAuditService.GetList(int.Parse(WorkID)); bindList("auditList", "audit", auditList, BindAudit); // 綁定事件 FlowMenuController flowMenuController = new FlowMenuController(); set("ActionLink", to(SaveAudit) + "?FK_Flow=" + FK_Flow + "&WorkID=" + WorkID + "&FK_Node=" + FK_Node + (strUtil.IsNullOrEmpty(ctx.Get("last")) ? "" : "&last=true")); set("CalRemainingLeaveTimeLink", to(CalRemainingLeaveTime, employee.Id)); } /// <summary> /// 保存審批 /// </summary> [DbTransaction] public void SaveAudit() { //登錄CCFlow LoginCCFlow(); //保存業務數據 IMP_AskLeave askLeave = askLeaveService.Get(int.Parse(WorkID)); //保存審核意見 Flow_Audit audit = new Flow_Audit(); audit.WorkID = int.Parse(WorkID); audit.FK_Node = FK_Node; audit.YiJian = ctx.Post("YiJian"); audit.SFTG = ctx.PostInt("SFTG"); audit.Auditor = Employee.Name; audit.AuditTime = DateTime.Now; DataTable dtNode = ccFlowService.GetNode(int.Parse(FK_Node)); if (dtNode.Rows.Count > 0) { audit.NodeName = dtNode.Rows[0]["Name"].ToString(); } Result result = flowAuditService.insert(audit); if (result.HasErrors) { ctx.errors.Errors = result.Errors; echoJsonMsg(ctx.errors.ErrorsText, false, ""); return; } //如果審核不通過,則結束流程 if (audit.SFTG == (int)Flag.No) { EndWork(FK_Flow, WorkID, DictCodeConst.CD80_FlowStatus_BTG); echoJsonOk(); return; } if (!strUtil.IsNullOrEmpty(ctx.Get("last")))//如果是最后一步審核 { askLeave.Status = DictCodeConst.CD80_FlowStatus_TG; askLeaveService.update(askLeave, "Status"); } // 處理ccflow的業務邏輯,僅把關鍵字段傳遞給ccflow的節點表單中去,用戶判斷方向。 Hashtable ht = new Hashtable(); SendReturnObjs sendObj = BP.WF.Dev2Interface.Node_SendWork(FK_Flow, long.Parse(WorkID), ht); echoJsonOk(); } #endregion #region 綁定審核列表 /// <summary> /// 綁定審核列表 /// </summary> private void BindAudit(IBlock block, string lbl, Object obj) { Flow_Audit audit = (Flow_Audit)obj; block.Set("audit.AuditTime", audit.AuditTime.ToString("yyyy-MM-dd HH:mm")); block.Set("audit.SFTG", audit.SFTG == 1 ? "是" : "否"); } #endregion #region 退回修改 /// <summary> /// 退回修改 /// </summary> public void ReEdit() { //通用設置 CommonSet(Employee); IMP_AskLeave askLeave = askLeaveService.Get(int.Parse(WorkID)); bind("askLeave", askLeave); set("askLeave.ApplyDate", askLeave.ApplyDate.ToString(Constants.FormatDate)); set("askLeave.StartTime", askLeave.StartTime.ToString("yyyy-MM-dd HH:mm")); set("askLeave.EndTime", askLeave.EndTime.ToString("yyyy-MM-dd HH:mm")); List<Sys_Dict> dictLeaveTypeList = dictService.GetListByType(DictType.CD49); dropList("askLeave.LeaveType", dictLeaveTypeList, "Name=Code", askLeave.LeaveType, Constants.OptionBlank); //獲取當前登錄用戶關聯的員工信息 IMP_Employee employee = askLeave.Employee; bind("employee", employee); //工作時長 IMP_WorkTimeSetting workTimeSetting = workingTimeService.Get(Employee.Dept); set("WorkLong", workTimeSetting.WorkLong); // 綁定事件 FlowMenuController flowMenuController = new FlowMenuController(); set("ActionLink", to(SaveReEdit) + "?FK_Flow=" + FK_Flow + "&WorkID=" + WorkID); set("GetDeptTree", to(GetDeptTree)); set("GetJobs", to(GetJobs)); set("CalRemainingLeaveTimeLink", to(CalRemainingLeaveTime, employee.Id)); } /// <summary> /// 提出需求保存 /// </summary> public void SaveReEdit() { //登錄CCFlow LoginCCFlow(); // 處理業務數據保存 IMP_AskLeave askLeave = askLeaveService.Get(int.Parse(WorkID)); askLeave = (IMP_AskLeave)ctx.PostValue(askLeave, "askLeave"); askLeave.ActualLeaveDays = askLeave.PlanLeaveDays; Result result = askLeaveService.update(askLeave); if (result.HasErrors) { ctx.errors.Errors = result.Errors; echoJsonMsg(ctx.errors.ErrorsText, false, ""); return; } // 處理ccflow的業務邏輯,僅把關鍵字段傳遞給ccflow的節點表單中去,用戶判斷方向。 Hashtable ht = new Hashtable(); SendReturnObjs sendObj = BP.WF.Dev2Interface.Node_SendWork(FK_Flow, long.Parse(WorkID), ht); echoJsonOk(); } #endregion #region 作廢 /// <summary> /// 作廢 /// </summary> [DbTransaction] public void Invalid() { int askLeaveId = ctx.PostInt("Id"); IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(askLeaveId); askLeave.Status = DictCodeConst.CD80_FlowStatus_ZF; askLeaveService.update(askLeave, "Status"); echoJsonOk(); } #endregion #region 銷假 /// <summary> /// 銷假 /// </summary> public void Terminate() { int askLeaveId = ctx.GetInt("Id"); IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(askLeaveId); bind("askLeave", askLeave); set("askLeave.ApplyDate", askLeave.ApplyDate.ToString(Constants.FormatDate)); set("askLeave.StartTime", askLeave.StartTime.ToString("yyyy-MM-dd HH:mm")); set("askLeave.EndTime", askLeave.EndTime.ToString("yyyy-MM-dd HH:mm")); Sys_Dict dictLeaveType = dictService.GetListByTypeAndCode(DictType.CD49, askLeave.LeaveType); set("askLeave.LeaveType", dictLeaveType == null ? "" : dictLeaveType.Name); set("askLeave.ActualLeaveDays", (int)DateTime.Now.Subtract(askLeave.StartTime).TotalMinutes); set("askLeave.PlanLeaveDays", MinutesToDays(askLeave.PlanLeaveDays)); set("askLeave.LeaveTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm")); //獲取當前登錄用戶關聯的員工信息 IMP_Employee employee = employeeService.findById<IMP_Employee>(LoginUser.RelationId); bind("employee", employee); //工作時長 IMP_WorkTimeSetting workTimeSetting = workingTimeService.Get(Employee.Dept); set("WorkLong", workTimeSetting.WorkLong); // 綁定事件 target(SaveTerminate, askLeaveId); } /// <summary> /// 銷假 /// </summary> [DbTransaction] public void SaveTerminate(int askLeaveId) { IMP_AskLeave askLeave = askLeaveService.findById<IMP_AskLeave>(askLeaveId); askLeave.LeaveTime = ctx.PostTime("askLeave.LeaveTime"); askLeave.ActualLeaveDays = ctx.PostInt("askLeave.ActualLeaveDays"); askLeaveService.update(askLeave, new string[] { "LeaveTime", "ActualLeaveDays" }); echoJsonOk(); } #endregion #region 計算剩余假期 /// <summary> /// 計算剩余假期 /// </summary> public void CalRemainingLeaveTime(int employeeId) { string leaveType = ctx.Post("LeaveType"); IMP_Employee employee = employeeService.findById<IMP_Employee>(employeeId); IMP_LeaveLong leaveLong = leaveLongSerivce.Get(employee.Dept); IMP_WorkTimeSetting workTimeSetting = workingTimeService.Get(employee.Dept); int alreadyLeaveTime = askLeaveService.GetAlreadyLeaveTime(employee, leaveType); string result = ""; string str = ""; decimal _alreadyLeaveTime = (decimal)Math.Round(alreadyLeaveTime / 60.0, 2); switch (leaveType) { case DictCodeConst.CD49_SHJ: str = (leaveLong.Sangjia * workTimeSetting.WorkLong - _alreadyLeaveTime).ToString(); result = "剩余喪假:" + str + "小時"; break; case DictCodeConst.CD49_CJ: str = (leaveLong.Chanjia * workTimeSetting.WorkLong - _alreadyLeaveTime).ToString(); result = "剩余產假:" + str + "小時"; break; case DictCodeConst.CD49_HJ: str = (leaveLong.Hunjia * workTimeSetting.WorkLong - _alreadyLeaveTime).ToString(); result = "剩余婚假:" + str + "小時"; break; case DictCodeConst.CD49_NXJ: int year = employeeService.CalWorkAge(employee); result = "沒有年休"; if (year >= 1 && year <= 9) { str = (leaveLong.Nianxiu1 * workTimeSetting.WorkLong - _alreadyLeaveTime).ToString(); result = "剩余年休:" + str + "小時"; } if (year >= 10 && year <= 19) { str = (leaveLong.Nianxiu2 * workTimeSetting.WorkLong - _alreadyLeaveTime).ToString(); result = "剩余年休:" + str + "小時"; } if (year >= 20) { str = (leaveLong.Nianxiu3 * workTimeSetting.WorkLong - _alreadyLeaveTime).ToString(); result = "剩余年休:" + str + "小時"; } break; } echoText(result); } #endregion #region 換算請假時長 /// <summary> /// 換算請假時長 /// </summary> private string MinutesToDays(int minutes) { //請假時長 IMP_WorkTimeSetting workTimeSetting = workingTimeService.Get(Employee.Dept); int days = (int)(minutes / workTimeSetting.WorkLong / 60); int hours = (int)((minutes - days * workTimeSetting.WorkLong * 60) / 60); int minu = (int)(minutes - days * workTimeSetting.WorkLong * 60 - hours * 60); return string.Format("{0}天{1}小時{2}分鍾", days, hours, minu); } #endregion } }
十一、具體流程業務列表頁面前台代碼

<link href="~js/jqGrid/css/ui.jqgrid.css?v=#{jsVersion}" type="text/css" rel="stylesheet"> <link href="~css/ui/jquery-ui-1.9.2.custom.css?v=#{jsVersion}" type="text/css" rel="stylesheet"> <link href="~js/easyui/easyui.css" rel="stylesheet" type="text/css" /> <script src="~js/jqGrid/js/i18n/grid.locale-cn.js" type="text/javascript"></script> <script src="~js/jqGrid/js/jquery.jqGrid.min.js?v=#{jsVersion}" type="text/javascript"></script> <script src="~js/easyui/jquery.easyui.min.js" type="text/javascript"></script> <style type="text/css"> #t_list { border-left: 0; border-right: 0; } a:hover { text-decoration: underline !important; } </style> <div class="tiao"> <input type="button" onclick="add()" value="添加" class="SIMPO_Text_Red2" /> </div> <div class="adminMainContent"> <div class="box"> <div class="box-title"> 查詢條件 </div> <div class="box-content"> <form id="myform" method="get" action="#{SearchLink}"> <table id="tableCon" cellpadding="0" cellspacing="0" width="100%" class="detail"> <tr> <td class="title"> 請假人: </td> <td> <input name="con.EmpName" value="#{con.EmpName}" type="text" class="SIMPO_Txt_150" /> </td> <td class="title"> 審批狀態: </td> <td> #{con.Status} </td> </tr> <tr> <td class="title"> 請假時間: </td> <td style="border-right: 0;"> <input name="con.ApplyDateStart" type="text" class="date SIMPO_Txt_100" value="#{con.ApplyDateStart}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly" /> 至 <input name="con.ApplyDateEnd" type="text" class="date SIMPO_Txt_100" value="#{con.ApplyDateEnd}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly" /> </td> <td colspan="2" align="right"> <input type="button" onclick="search()" class="SIMPO_Text_Blue" value="搜索" /> <input type="button" onclick="res();reset();" class="SIMPO_Text_Gray" value="重置" /> </td> </tr> </table> </form> </div> </div> <div> <div class="toolbar"> <input type="button" value="提交審批" onclick="startWork()" class="SIMPO_Text_Blue" /> <input type="button" class="btnCmd SIMPO_Text_Gray" cmd="deletetrue" data-action="#{BatchDeleteLink}" jqgridid="list" value="刪除" /> </div> <table id="list"> </table> <div id="pager"> </div> </div> </div> <script> _run(function () { //列表 $("#list").jqGrid({ url: '#{GetPersonalIndexData}', serializeGridData: function (postData) { return Simpo.ui.jqGrid.serializeGridData(postData); }, datatype: "json", colNames: ['Id', 'Status', 'WorkID', '請假人', '請假人部門', '開始時間', '結束時間', '銷假時間', '請假時長', '實際時長', '請假類型', '請假事由', '請假時間', '審批狀態', '操作'], colModel: [ { name: 'Id', hidden: true }, { name: 'Status', hidden: true }, { name: 'WorkID', hidden: true }, { name: 'EmpName', index: 'EmpName', width: 80, formatter: function (v, o, r) { return "<a href='javascript:void(0)' onclick='view(\"" + r["Id"] + "\")' >" + v + "</a>"; } }, { name: 'DeptName', index: 'DeptName', width: 80 }, { name: 'DispStartTime', index: 'StartTime', width: 80 }, { name: 'DispEndTime', index: 'EndTime', width: 80 }, { name: 'DispLeaveTime', index: 'LeaveTime', width: 80 }, { name: 'DispPlanLeaveDays', index: 'PlanLeaveDays', width: 80 }, { name: 'DispActualLeaveDays', index: 'ActualLeaveDays', width: 80 }, { name: 'DispLeaveType', index: 'DispLeaveType', width: 80 }, { name: 'LeaveReason', index: 'LeaveReason', width: 80 }, { name: 'DispApplyDate', index: 'ApplyDate', width: 80 }, { name: 'DispStatus', index: 'DispStatus', width: 80 }, { name: 'operate', index: 'operate', width: 80, sortable: false, align: 'center', formatter: function (v, o, r) { var html = ""; if (r["Status"] != "1") html += "<a href='javascript:void(0)' onclick='view(\"" + r["Id"] + "\")' > 查看</a>"; if (r["Status"] == "1") html += "<a href='javascript:void(0)' onclick='edit(\"" + r["Id"] + "\")' > 修改</a>"; if (r["Status"] == "1") html += "<a href='javascript:void(0)' onclick='del(\"" + r["Id"] + "\")' > | 刪除 </a>"; return html; } } ], rowNum: 10, rowList: [10, 20, 30], pager: '#pager', sortable: true, sortname: 'Id', sortorder: "desc", viewrecords: true, rownumbers: true, multiselect: true, height: 'auto', width: $(".adminMainContent").width(), //caption: "員工培訓", loadComplete: function (xhr) { Simpo.ui.jqGrid.loadComplete("list", xhr); }, onHeaderClick: function () { Simpo.ui.jqGrid.autoWidth("list"); // 自動寬度 }, loadError: function (xhr, status, error) { Simpo.ui.jqGrid.loadError("list", xhr, status, error); } //, //toolbar: [true, "top"] }); jQuery("#list").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false, search: false }).jqGrid('sortableRows'); // toolbar //$("#t_list").append($("#toolbar")); $(window).resize(function () { Simpo.ui.jqGrid.autoWidth("list"); }); }); // 查詢方法 function search() { var postData = Simpo.ui.jqGrid.serializeGridData("list"); jQuery("#list").jqGrid('setGridParam', { postData: postData, page: 1 }).trigger("reloadGrid"); } //重置 function res() { var dept = $("input[name='con.Dept']"); dept.val(""); $("#job").find("option[value!='-1']").remove(); } //添加 function add() { Simpo.ui.showFrmBox({ title: "添加請假申請", href: '#{AddLink}', "data-scrolling": 'auto', xwidth: 800, xheight: 500 }); } //編輯 function edit(id) { Simpo.ui.showFrmBox({ title: "編輯請假申請", href: '#{EditLink}?Id=' + id, "data-scrolling": 'auto', xwidth: 800, xheight: 500 }); } //查看 function view(id) { Simpo.ui.showFrmBox({ title: "查看請假申請", href: '#{ViewLink}?Id=' + id, "data-scrolling": 'auto', xwidth: 800, xheight: 500 }); } //刪除 function del(id) { if (confirm("確定刪除?")) { $.ajax({ type: "POST", url: "#{DeleteLink}", data: "Id=" + id, success: function (data) { if (data.IsValid) { Simpo.ui.msg.success("刪除成功"); search(); } else { Simpo.ui.msg.error(data.Msg); } }, error: function (data) { Simpo.ui.msg.error("刪除失敗"); } }); } } //提交審批 function startWork() { Simpo.ui.loading.show(); //獲取jqGrid選擇的ID集合 var indexArray = jQuery("#list").jqGrid('getGridParam', 'selarrrow'); var ids = ""; for (var i = 0; i < indexArray.length; i++) { var rowDatas = jQuery("#list").jqGrid('getRowData', indexArray[i]); ids += rowDatas["Id"] + ","; } if (indexArray.length == 0) { Simpo.ui.loading.hide(); Simpo.ui.msg.error("請選擇招聘需求"); return; } if (confirm("確定提交審批?")) { //提交審批 $.ajax({ type: "POST", url: "#{StartWorkLink}", data: "ids=" + ids.substr(0, ids.length - 1), success: function (data) { Simpo.ui.loading.hide(); if (data.IsValid) { Simpo.ui.msg.success("提交審批成功"); search(); } else { Simpo.ui.msg.error(data.Msg); } }, error: function (data) { Simpo.ui.loading.hide(); Simpo.ui.msg.error("提交審批失敗"); } }); } else { Simpo.ui.loading.hide(); } } //作廢 function invalid(id) { if (confirm("確定作廢?")) { $.ajax({ type: "POST", url: "#{InvalidLink}", data: "Id=" + id, success: function (data) { if (data.IsValid) { Simpo.ui.msg.success("作廢成功"); search(); } else { Simpo.ui.msg.error(data.Msg); } }, error: function (data) { Simpo.ui.msg.error("作廢失敗"); } }); } } </script>
十二、退回修改頁面前台代碼

<link href="~css/admin/admin.css?v=#{jsVersion}" type="text/css" rel="stylesheet"> <link href="~js/easyui/easyui.css" rel="stylesheet" type="text/css" /> <script src="~js/easyui/jquery.easyui.min.js?v=#{jsVersion}" type="text/javascript"></script> <script src="~js/FlowCommon.js" type="text/javascript"></script> <input name="MsgInfo" type="hidden" value="#{MsgInfo}" /> <input name="SID" type="hidden" value="#{SID}" /> <form id="myForm" method="post" action="#{ActionLink}" enctype="multipart/form-data" class="ajaxPostForm" callback="callback"> <div class="btnContainer tiao"> <input type="button" value="發送" id="btnSave" onclick="save()" class="SIMPO_Text_Red2" /> <!--<input type="button" value="移交" id="Button3" onclick="forward()" class="SIMPO_Text_Blue" /> <input type="button" value="抄送" id="Button4" onclick="cc()" class="SIMPO_Text_Blue" /> <input type="button" value="退回" id="Button5" onclick="returnWork()" class="SIMPO_Text_Blue" />--> <input type="submit" value="保存提交" id="btnSaveSubmit" style="display: none;" /> <!-- <input type="button" class="SIMPO_Text_Gray btnCancel" value="取消" />--> </div> <div class="adminMainContent"> <iframe name="frmUpload" id="frmUpload" style="display: none"></iframe> <div class="box" style="margin-bottom: 5px; margin-bottom: 50px;"> <div class="box-title"> 請假申請信息 </div> <div class="box-content"> <table cellpadding="0" cellspacing="0" class="detail" width="100%"> <tr> <td class="title"> 請假人: </td> <td> #{employee.Name} <input type="hidden" name="askLeave.Employee" value="#{employee.Id}" /> </td> <td class="title"> 請假人部門: </td> <td> #{employee.Dept.Name} </td> </tr> <tr> <td class="title"> <span class="mst">*</span>開始時間: </td> <td> <input name="askLeave.StartTime" value="#{askLeave.StartTime}" type="text" class="date SIMPO_Txt_150" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" readonly="readonly" onblur="calPlanLeaveDays()" /> <span class="valid" msg="必填" mode="border" rule=""></span> </td> <td class="title"> <span class="mst">*</span>結束時間: </td> <td> <input name="askLeave.EndTime" value="#{askLeave.EndTime}" type="text" class="date SIMPO_Txt_150" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" readonly="readonly" onblur="calPlanLeaveDays()" /> <span class="valid" msg="必填" mode="border" rule=""></span> </td> </tr> <tr> <td class="title"> <span class="mst">*</span>請假時長: </td> <td> <input id="days" type="text" onblur="calMinutes()" class="SIMPO_Txt_100" style="width: 40px;" /><span class="valid" msg="必填,整數" mode="border" rule="int"></span><span>天</span> <input id="hours" type="text" onblur="calMinutes()" class="SIMPO_Txt_100" style="width: 40px;" /><span class="valid" msg="必填,整數" mode="border" rule="int"></span><span>小時</span> <input id="minutes" type="text" onblur="calMinutes()" class="SIMPO_Txt_100" style="width: 40px;" /><span class="valid" msg="必填,整數" mode="border" rule="int"></span><span>分鍾</span> <input name="askLeave.PlanLeaveDays" value="#{askLeave.PlanLeaveDays}" type="hidden" class="SIMPO_Txt_100 tipInput" tip="必填,整數" /> <span class="valid" msg="必填,整數" mode="border" rule="int"></span> </td> <td class="title"> <span class="mst">*</span>請假日期: </td> <td> <input name="askLeave.ApplyDate" value="#{askLeave.ApplyDate}" type="text" class="date SIMPO_Txt_100" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly" /> <span class="valid" msg="必填" mode="border" rule=""></span> </td> </tr> <tr> <td class="title"> <span class="mst">*</span>請假調休類型: </td> <td colspan="3"> #{askLeave.LeaveType} <span class="valid" msg="必填" mode="border" rule="^(?!-1$).+$"> </span><span id="spanLeaveType"></span> </td> </tr> <tr> <td class="title"> <span class="mst">*</span>請假事由: </td> <td colspan="3"> <textarea name="askLeave.LeaveReason" class="tipInput" tip="長度不得超過1000" style="width: 99.5%; height: 100px;">#{askLeave.LeaveReason}</textarea> <span class="valid" msg="長度不得超過1000" mode="border" rule="^(.|\n){0,1000}$"></span> </td> </tr> </table> </div> </div> </div> </form> <script type="text/javascript" src="~js/My97DatePicker/WdatePicker.js?v=#{jsVersion}"></script> <script type="text/javascript"> _run(function () { //選擇請假類型 $("select[name='askLeave.LeaveType']").change(function () { var val = $(this).find("option:selected").val(); $.ajax({ type: "POST", url: "#{CalRemainingLeaveTimeLink}", data: "LeaveType=" + val, success: function (data) { $("#spanLeaveType").html(data); } }); }); $("select[name='askLeave.LeaveType']").change(); //計算請假時長 var WorkLong = parseInt("#{WorkLong}"); var minutes = parseInt($("input[name='askLeave.PlanLeaveDays']").val()); var days = parseInt(minutes / WorkLong / 60); var hours = parseInt((minutes - days * WorkLong * 60) / 60); minutes = minutes - days * WorkLong * 60 - hours * 60; $("#days").val(days); $("#hours").val(hours); $("#minutes").val(minutes); calMinutes(); }); //保存 function save() { Simpo.ui.loading.show(); if (!Simpo.ui.doValid($("#btnSaveSubmit"))) { Simpo.ui.msg.error("頁面輸入校驗失敗,請檢查"); Simpo.ui.loading.hide(); return; } $('#btnSaveSubmit').click(); } //回調 function callback(thisForm, data) { Simpo.ui.loading.hide(); if (data.IsValid) { setTimeout(function () { window.location = "#{SendResult}"; }, 500); } } //計算請假時長 function calPlanLeaveDays() { var str1 = $("input[name='askLeave.StartTime']").val().replace("-", "/"); var str2 = $("input[name='askLeave.EndTime']").val().replace("-", "/"); if ($.trim(str1) != "" && $.trim(str2) != "") { var d1 = new Date(str1); var d2 = new Date(str2); var minutes = (d2 - d1) / 60000; var days = parseInt(minutes / 24 / 60); var hours = parseInt((minutes - days * 24 * 60) / 60); minutes = minutes - days * 24 * 60 - hours * 60; $("#days").val(days); $("#hours").val(hours); $("#minutes").val(minutes); calMinutes(); } } //計算請假分鍾數 function calMinutes() { var WorkLong = parseInt("#{WorkLong}"); var days = parseInt($("#days").val()); var hours = parseInt($("#hours").val()); var minutes = parseInt($("#minutes").val()); minutes = days * WorkLong * 60 + hours * 60 + minutes; $("input[name='askLeave.PlanLeaveDays']").val(minutes); } //移交 function forward() { window.location.href = "#{ForwardLink}"; } //抄送 function cc() { top.addTabReplace('抄送', '#{CCUrl}'); } //退回 function returnWork() { window.location.href = "#{ReturnWorkLink}"; } </script>
十三、消息彈出提醒效果
十四、退回修改頁面效果
十五、審批界面效果
十六、流程查詢列表及流程表單查看頁面