The form engine system is based on the implementation principle of relational database design and the key code structure of CCBPM implementation

Posted by FraggleRock on Tue, 25 Jan 2022 11:22:20 +0100

Based on the previous article, we only made a simple comparison between the two design ideas, without in-depth explanation of the implementation principle.

In this chapter, we focus on the implementation principle of form engine system based on relational database design and the key code structure of CCBPM implementation.

The form engine system is composed of form designer, form parser and form template.

The form designer is the form design portal. The form elements are stored in the data table through the form design of the form designer. In the process of form display, the form template data is parsed and spliced through the form parser to generate web page content for display.

form designer

Detailed explanation of implementation principle

Gallop workflow engine - fool form implementation principle

 

Code details,

In designer Htm in the initialization interface, toolbar buttons are displayed directly on the form.

When creating a new component, the fieldtypelist.field interface pops up Htm page. Realize the new functions of various types of components.

When creating a new field, execute the AddF method to pop up the page.

  
  1. function AddF() {
  2. var url = 'FieldTypeList.htm?DoType=AddF&FK_MapData=' + GetQueryString( 'FK_MapData');
  3. var h = 500;
  4. var w = 600;
  5. var l = (screen.width - w) / 2;
  6. var t = (screen.height - h) / 2;
  7. var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l;
  8. s += ', toolbar=no, scrollbars=no, menubar=no, location=no, resizable=no';
  9. var b = window.showModalDialog(url, 'ass', s);
  10. window.location.href = window.location.href;
  11. }

FieldTypeList.htm page details

This page will pop up when creating a new field, which will display the component control during initialization loading

When you click Save trigger, record the control information in the corresponding component data table.

Control in the database / / find the selected field type

  
  1. MapAttr attr = new MapAttr();
  2. attr.Name = newName;
  3. attr.KeyOfEn = newNo;
  4. attr.FK_MapData = this.FK_MapData;
  5. attr.LGType = FieldTypeS.Normal;
  6. attr.MyPK = this.FK_MapData + "_" + newNo;
  7. attr.GroupID = iGroupID;
  8. attr.MyDataType = fType;
  9. int colspan = attr.ColSpan;
  10. attr.Para_FontSize = 12;
  11. int rows = attr.UIRows;
  12. if (attr.MyDataType == DataType.AppString)
  13. {
  14. attr.UIWidth = 100;
  15. attr.UIHeight = 23;
  16. attr.UIVisible = true;
  17. attr.UIIsEnable = true;
  18. attr.ColSpan = 1;
  19. attr.MinLen = 0;
  20. attr.MaxLen = 50;
  21. attr.MyDataType = DataType.AppString;
  22. attr.UIContralType = UIContralType.TB;
  23. attr.Insert();
  24. return "url@../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrString&MyPK=" + attr.MyPK;
  25. }

Common text type, date type, numeric type, enumeration type and foreign key type are in sys_ Store in mapatrr. Attachment control, in Sys_FrmAttachment is stored in the attachment table. Common tag types in sys_ Stored in the frmlab table.

For more control type storage, please refer to the code implementation.

Form parser

The working principle of the form parser is to obtain the relationship between the storage data table and the component table from the data table of the storage component, and return to the display interface in JSON data format. After introducing JSON data in the display interface, different strings are spliced and displayed through JS script parsing for the parsing of various controls, such as text control, data control, date control, enumeration control, foreign key control, attachment control, schedule control, audit component control, etc. Finally, it is displayed in the form of htm web page.

Detailed explanation of form parser code

The design type of the form designer passed in from the same entry file determines whether the type of the loaded designer is a fool form designer or a free form designer.

Designer.htm page initialization functions are as follows:

General handler method implementation:

Designer.htm page load Designer

Use data to accept the returned json data.

For the three objects in json < sys_ Mapdata,Sys_MapAttr,Sysy_ Groupfield > make a splicing table.

The form implementation of common text type, date type, numeric type, enumeration type and foreign key type will be loaded according to the control properties, permissions < read-only, editable, invisible >, defau lt value filling, etc.

  
  1. html += "<td class='FDesc'>" + GenerLabel(mapAttr) + "</td>";
  2. html += "<td ColSpan=" + mapAttr.ColSpan + "><div id='DIV_" + mapAttr.KeyOfEn + "'><input class='form-control' style='width:99%;margin:3px;' maxlength=" + mapAttr.MaxLen + " name='TB_" + mapAttr.KeyOfEn + "' id='TB_" + mapAttr.KeyOfEn + "' type='text' " + (mapAttr.UIIsEnable == 1 ? '' : ' disabled="disabled"') + "/></div></td>";
  3. html += "</tr>";

Form implementation of attachment control

  
  1. var frameUrl = "<iframe ID='F" + athEn.MyPK + "' frameborder=0 style='padding:0px;border:0px;width:100%;height:" + athEn.H + "px;' leftMargin='0' topMargin='0' src='" + src + "' scrolling='auto' /></iframe>";
  2. return "<tr><td colspan=4 id='TD" + athEn.MyPK + "' style='width:" + athEn.H + "px;'>" + frameUrl + "</td></tr>";

Display of parts list and slave list control

  
  1. var src = "MapDtlDe.htm?DoType=Edit&FK_MapData=" + pageParam.fk_mapdata + "&FK_MapDtl=" + dtl[ 0].No;
  2. var frameUrl = "<iframe ID='F" + dtl[ 0].No + "' frameborder=0 style='padding:0px;border:0px;width:100%;height:" + dtl[ 0].H + "px;' leftMargin='0' topMargin='0' src='" + src + "' scrolling='auto' /></iframe>";
  3. return "<tr><td colspan=4 id='TD" + dtl[ 0].No + "'>" + frameUrl + "</td></tr>";

Audit component control display

  
  1. var src = "../../WorkOpt/WorkCheck.htm?WorkID=0&FK_Flow=" + fk_flow + "&FK_Node=" + nodeID + "&FK_MapData=" + pageParam.fk_mapdata;
  2. var frameUrl = "<iframe ID='FWC' frameborder=0 style='padding:0px;border:0px;width:100%;height:" + h + "px;' leftMargin='0' topMargin='0' src='" + src + "' scrolling='auto' /></iframe>";
  3. return "<tr><td colspan=4 style='width:100%;height:" + h + "px;' id='FWC' >" + frameUrl + "</td></tr>";

For more implementation procedures, please refer to the code.

Topics: Database JSON