当前位置:网站首页>Jeecgboot learning_ Online form first experience

Jeecgboot learning_ Online form first experience

2022-06-11 03:21:00 The bright moon is always fresh

JeecgBoot Study Online Form initial experience

Change it in these places
 Insert picture description here
Select the type in the page properties
 Insert picture description here

Create another item table
 Insert picture description here

In order to make the selection have a tree structure We modify these two places

 Insert picture description here
 Insert picture description here

remarks :
1、 Dictionaries table Fill in the table name corresponding to the tree control { for example :sys_category }
2、 Dictionaries code Fill in the parent of the root node of the tree control ID Value , Blank if not filled
3、 Dictionaries text Fill in 4 Names of table fields , Separated by commas , In turn, is :ID Column , Father ID Column , Show Columns , Whether there are child node Columns { for example :id,pid,name,has_child}

 Explanation of field order :
a. ID Column sum PID Columns are used to record the parent-child relationship of data , And ID The column is the value that the tree control finally saves to the database 
b.  Display the data displayed by the list tree control ,
c.  Whether any child node column is a special case column required by the tree table , See in detail  online Form tree form development  , This column is the string type system default 1 be for the purpose of  0 Why not , Other data formats are not supported .

One to many form configuration

 Insert picture description here
This is a single table A schedule is under construction

 Insert picture description here Uncheck not to display on the page
 Insert picture description here
 Insert picture description here

 Insert picture description here
An order customer table is under construction
 Insert picture description here
The operation is basically the same

The form default values and value filling rules use

Add the control default value expression in the main table
 Insert picture description here Then configure in the system coding rules
 Insert picture description here
org.jeecg.modules.online.cgform.rule.OrderNumberRule

The corresponding is

 Insert picture description here

/** *  Rules for filling in values Demo: Generate order number  * 【 Test examples 】 */
public class OrderNumberRule implements IFillRuleHandler {
    

    @Override
    public Object execute(JSONObject params, JSONObject formData) {
    
        String prefix = "CN";
        // The order prefix defaults to CN  If the rule parameter is not empty , Then take the custom prefix 
        if (params != null) {
    
            Object obj = params.get("prefix");
            if (obj != null) prefix = obj.toString();
        }
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
        int random = RandomUtils.nextInt(90) + 10;
        String value = prefix + format.format(new Date()) + random;
        //  according to formData Different values of , Generate different order numbers 
        String name = formData.getString("name");
        if (!StringUtils.isEmpty(name)) {
    
            value += name;
        }
        return value;
    }

}

online Table list sub table js Enhanced writing

Dynamic enhanced summation
 Insert picture description here
According to rules Write

onlChange(){
    
   return {
    
     
     ruz_date(){
    
        let value = event.value
        //alert(' Trigger control ',value)
        
// According to the date of entry , Automatically calculate the number of years of employment 
        if(value!=null && value!=""){
    
          let currDate = new Date(value.replace(/-/g, "\/")); 
          let d = new Date(); 
          let ru_year_num = d.getFullYear()-currDate.getFullYear()    
          let values = {
    'ru_year_num':ru_year_num + 1}
          that.triggleChangeValues(values)
        }
      }
     
    }
 }


Section 5 JeecgBoot # Online Form customization buttons and JS enhance &Popup Control &Online report form

For other applications, just look at the documentation

原网站

版权声明
本文为[The bright moon is always fresh]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020554363093.html