首页 > 代码库 > CCFlow SDK模式开发

CCFlow SDK模式开发

一、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_DeptTypeFROM         CQSD_Dev.dbo.IMP_Dept AS dept INNER JOIN                      CQSD_Dev.dbo.IMP_Dept AS comp ON comp.Id = dept.CidWHERE     (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_StationTypeFROM         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.CidWHERE     (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 NumOfDeptFROM         CQSD_Dev.dbo.IMP_Employee AS e INNER JOIN                      CQSD_Dev.dbo.Sys_User AS u ON u.RelationId = e.IdWHERE     (e.DelFlg = 0)部门人员:SELECT     u.Username AS FK_Emp, e.DeptId AS FK_DeptFROM         CQSD_Dev.dbo.IMP_Employee AS e INNER JOIN                      CQSD_Dev.dbo.Sys_User AS u ON u.RelationId = e.IdWHERE     (e.DelFlg = 0) AND (e.Code IS NOT NULL) AND (e.Code <> ‘‘)岗位人员:SELECT     u.Username AS FK_Emp, e.JobId AS FK_StationFROM         CQSD_Dev.dbo.IMP_Employee AS e INNER JOIN                      CQSD_Dev.dbo.Sys_User AS u ON u.RelationId = e.IdWHERE     (e.DelFlg = 0) AND (e.Code IS NOT NULL) AND (e.Code <> ‘‘)
View Code

 

二、菜单、待办、抄送、查询等列表界面

菜单:

待办:

 流程消息:

 三、流程消息和应用系统的其他消息合并的View

SELECT     MyPK, Sender, e2.Name AS SenderName, SendTo, e3.Name AS SendToName, Title, Doc, MsgType, RDT AS SendTime, IsReadFROM         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.RelationIdUNIONSELECT     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 isreadFROM         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.IdWHERE     m.delflg = 0 AND mr.delflg = 0 AND m.EMailStatus = 1
View Code

 四、操作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}&nbsp;&nbsp;退回人:{1}&nbsp;&nbsp;{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}&nbsp;&nbsp;{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    }}
View Code

 五、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=http://www.mamicode.com/‘{1}‘>{0}", Constants.OptionPls[0], Constants.OptionPls[1]));            foreach (IMP_Job job in jobList)//遍历课程            {                sb.Append(string.Format("<option value=http://www.mamicode.com/‘{0}‘>{1}", 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=http://www.mamicode.com/‘{1}‘>{0}", Constants.OptionPls[0], Constants.OptionPls[1]));            foreach (IMP_Employee emp in empList)            {                sb.Append(string.Format("<option value=http://www.mamicode.com/‘{0}‘>{1}", 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=http://www.mamicode.com/‘{1}‘>{0}", Constants.OptionPls[0], Constants.OptionPls[1]));            foreach (Sys_User user in userList)            {                sb.Append(string.Format("<option value=http://www.mamicode.com/‘{0}‘>{1}", 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    }}
View Code

 六、待办、抄送、查询等流程列表页面的控制器代码

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=http://www.mamicode.com/‘"                                + "/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    }}
View Code

 七、审核界面通用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();    }});
View Code

 八、具体流程业务数据的增删改查列表页面

 九、具体流程业务的审核页面前台代码

<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="http://www.mamicode.com/取消" />--></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>
View Code

 十、具体流程业务的控制器代码

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    }}
View Code

 十一、具体流程业务列表页面前台代码

<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>
View Code

 十二、退回修改页面前台代码

<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="http://www.mamicode.com/移交" id="Button3" onclick="forward()" class="SIMPO_Text_Blue" />        <input type="button" value="http://www.mamicode.com/抄送" id="Button4" onclick="cc()" class="SIMPO_Text_Blue" />        <input type="button" value="http://www.mamicode.com/退回" 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="http://www.mamicode.com/取消" />--></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>
View Code

 十三、消息弹出提醒效果

 十四、退回修改页面效果

 十五、审批界面效果

十六、流程查询列表及流程表单查看页面

 

CCFlow SDK模式开发