The first project of a new company going back to work in its hometown: OA. I have never done OA before. Because I designed the workflow, I learned about it myself. So I had this blog (the following is just my personal understanding, and I have been a master of it ). Environment: MVC2 + SQL2008
A workflow can be divided into several steps: Form (design, resolution), process (design), and merge are a complete workflow. First, the previous graph:
Step 1: Form
Because the form is not designed in a graphical way, our idea is to define the form format and parse it in the background.
HTML is forcibly defined. For example, table> tbody> tr> td must be defined according to this format. Although not flexible, the function is also implemented. Thoughts: this form will be parsed into 11 nodes (applicant, application date, department, vacation type, leave time, salary deduction form, reason for leave, approver, approval date, approval result, approval comment)
As shown in, the parsing node is obtained through the id in [hobbies] and is parsed using HtmlAgilityPack. The specific code is as follows:
SelectNodes("//table/tbody/tr/td[@id='title']")
In this way, we can know all the nodes of the form, and the options corresponding to the title are corresponding to the class, which can also be seen (used to control whether the form node can fill in items, as described below ).
Special Control Processing: for example, the time is also defined by class = 'time' and then dynamically bound and loaded through jquery.
Step 2: process, which is also written
Define process and form Association
The operation permission is directly associated with the user to identify who owns the process.
The next step is to define the process.
Is a full step of the leave process, the following describes how to develop these steps.
Node serial number: indicates the first step of the current process. The node name is used to identify the name of the current step. Whether attachments and signatures are allowed is used to control the display and hiding of attachments and tabs. The next step identifies the steps to which the current step can be transferred, and the left side is already selected (multiple steps can be taken. Here we consider that the same process may occur in different positions, for example, the normal process requires four steps: [fill in employee information, approval by manager, approval by director, and personnel record filing]. however, when the director asks for leave, he does not need to perform so many steps [fill in the Form]). The right side is to pull all the steps in the current process. It cannot be a writing segment identifier. In the current step, which nodes of the form cannot be filled in? For example, when an employee fills out a leave application form and transfers it to the manager, the form displayed by the manager cannot contain employee names, departments, and other information, and can only contain node information such as approval comments. In this way, the process is associated with the form, and the next step is workflow flow.
Step 3: flow, flow simulation, and flow Creation
Define the workflow name
Click "OK" to go directly to the process page and save the information about the first step of the process to the database.
Then fill in the Form Content, select the next step and the operator to flow to the next step. Note: The Form Content stores all the HTML code of the entire form into the database, and then stores the filled form content in the next step when the process is transferred, the form is the latest. This is a very stupid method, because $ ("# form tableID") cannot obtain the value of the form, and all of them need to be processed, get the form content through jquery direct attr (value, text value), so that the form content can be saved to the database.
This also involves handling by many people. When the operator chooses to be a multi-person, the process is not allowed to flow to the next step unless it is the last person. However, you can enter the signing comments and modify the form, the modified form will overwrite the current step form and forward it to the next step. Repeat this step to transfer the process.
The language organization is not strong. All can only be said to be like this. The entire process is still flawed. form design and process design can only be in the form of text, and may be changed to a graphical form in the future, also, sub-processes are not supported. Today, I have written so much about custom workflows recently. I have also seen many very powerful workflows, so I will continue to complete, improve, and learn them later.