jeecg framework daily development problem solving method

Abstract: Using this framework, I found a lot of problems, recorded them, and made projects in the future to reduce the time to find problems. This article will be updated from time to time. . .
  1. Startup error
    The argument does not represent an annotation type: ContextConfiguration

    org.jeecgframework.core.junit.AbstractUnitTest The dependent class of the class needs to import the local junit4 test package
  2. The image is saved as a relative path
    , and the image field of the form is set to the text type
  3. After the code is generated, the multi-select box reports an error.
    修改DictSelectTag类,在272行加入
    if(this.defaultVal==null){
       this.defaultVal="";
    }
    4.表格id转名称 属性
    dictionary="GCCJ_TASK_ASSIGNMENT,ID,TASK_NAME"
     

     

  4. jeecg framework adds three-level menu support
    org.jeecgframework.core.util.ListtoMenu 类 修改 如下方法
    private static String getHplusSubMenu(TSFunction parent, int level, Map<Integer, List<TSFunction>> map) {
    		StringBuffer menuString = new StringBuffer();
    		List<TSFunction> list = map.get(level);
    		for (TSFunction function : list) {
    			if (function.getTSFunction().getId().equals(parent.getId())){
    				if (!function.hasSubFunction(map)) {
    					menuString.append(getLeafOfHplusTree(function));
    				} else {
    					//增加多级菜单显示
    					menuString.append("<li>");
    					menuString.append("<a href=\"#\" >");
    					menuString.append(getMutiLang(function.getFunctionName()));
    					menuString.append("<span class=\"fa arrow\"></span>");
    					menuString.append("</a><ul class=\"nav nav-third-level\" >");
    					menuString.append(getHplusSubMenu(function,level+1,map));
    					menuString.append("</ul></li>");
    				}
    			}
    		}
    		return menuString.toString();
    	}
    只支持H+平面风格,其他的风格你可以参考上面的代码进行修改

     

  5. Implement multi-table association query in jeecg 
    http://www.jeecg.org/forum.php?mod=viewthread&tid=3063&fromuid=8256
  6. How to open a new tab page in the page 
    curdtool*.js There is a method addoneTab in the general js
  7. JEECG common file upload - pop-up (think file upload is not easy to use)
    http://www.jeecg.org/forum.php?mod=viewthread&tid=935&extra=page%3D38 
    The commonUpload function is in the corresponding page of the code generation .js file
  8. Get the field value of the selected record in the button
    function resetPassword() {
        var row = $('#tSBaseUserList').datagrid('getSelections')[0];
        if (row == undefined) {
            alertTip('请选择需要重置的记录', '提示');
            return;
        }
        var userName, password;
        userName = row.username;
        password = '123456';
        var url = 'userController.do?userUpdate4App&userName=' + userName + '&password=123456';
        $.dialog.confirm('是否重置密码为 123456 ?', function () {
            $.ajax({
                async: false,
                cache: false,
                type: 'POST',
                dataType: 'json',
                url: url,// 请求的action路径
                error: function () {// 请求失败处理函数
                },
                success: function (data) {
                    if (data.success) {
                        $.messager.show({
                            title: '提示信息',
                            msg: '密码重置成功,默认密码为123456',
                            timeout: 1000 * 5
                        });
                    } else {
                        $.messager.show({
                            title: '提示信息',
                            msg: data.msg,
                            timeout: 1000 * 3
                        });
                    }
                }
            });
        }, function () {
        });
    }



  9.  Find the maven home conf/settings.xml at the maven address ,
      and add the Alibaba Cloud maven image in the <mirrors> tag. The final result is as follows:

      <mirrors>
           <mirror>
                            <id>nexus-aliyun</id>
                            <mirrorOf>*,!jeecg ,!jeecg-snapshots</mirrorOf>
                            <name>Nexus aliyun</name>
                            <url> http://maven.aliyun.com/nexus/content/groups/public</url>
            </mirror> 
        </mirrors>

      Then execute the maven command to enjoy the feeling of flying when mvn;

      Note: After the mirror is configured, all dependencies will only be downloaded from the mirror by default, so if you have your own private server, you can refer to the jeecg method to exclude it, otherwise it will not Download private dependencies from your own private server.

    Source:  http://www.jeecg.org/forum.php?mod=viewthread&tid=3949&extra=page%3D1

  10. Popups are maximized by default
    <t:dgToolBar title="任务录入" icon="icon-add" url="gccjTaskAssignmentController.do?goAdd" funname="add" width="100%" height="100%"></t:dgToolBar>
    解决弹窗被菜单遮盖问题:
    1.修改 plug-in/tools/curdtools_zh-cn.js 里getzIndex()方法
    setCookie("ZINDEXNUMBER",2980);
    zindexNumber = 2980;
    2.修改 org.jeecgframework.web.system.controller.core.LoginController
    Cookie zIndexCookie = new Cookie("ZINDEXNUMBER", "2990");

     

  11. Add a button to the pop-up window to
    rewrite the createdetailwindow method (rename) in the plug-in/tools/curdtools_zh-cn.js file, copy the rewritten method to the corresponding *-list file, and modify the entry, modify, view or delete methods. Invoke the method named overridden method
    Popup window component API reference URL http://www.lhgdialog.com/
  12. Get currently logged in user information
    TSUser user = ResourceUtil.getSessionUserName();

     

  13. get current date
    String date  = DateUtils.date2Str(new Date(), DateUtils.date_sdf);
  14. Rest style request address calling method
    For example:
    query list: http://localhost:8080/system name/rest/tZzxtDictionaryController/
    query 1 piece of data: http://localhost:8080/system name/rest/tZzxtDictionaryController/{id}
    Others The method goes to the corresponding controller to find
  15. Modify the system title
    system management -> international language menu
    language key: jeect.platform 
  16. Modify the pop-up box to layer pop-up box
    BaseTag.java Add js library
    if (oConvertUtils.isIn("tools", types)) {
                .. .. .. .. .. .. .. .. .. .. omit
                sb.append("<script type=\"text/javascript\" src=\"plug-in/layer/layer.js\" ></script>");
    
             }
    Modify the createwindow method and add this code

    to the method
    //layer新增窗口
    function addLayer(title, addurl,width,height){
       layer.open({
          type: 2,
          maxmin:true,
          title: title,
          shadeClose: true,
          shade: 0.8,
          fixed:false,
          resize:true,
          scrollbar:false,
          parent:windowapi,
          area: [width,height],
          content: addurl, //iframe url
     btn :[ ' OK ' , ' Close ' ] ,
          yes:function(index, layero){
             // iframe = this.iframe.contentWindow;
             // iframe = layero.find('iframe')[0];
    iframe = window[layero.find('iframe')[0]['name']];
             console.log(iframe.document);
             saveObj();
             // $('#btn_sub', iframeWin.document).click();
             // console.log(form);
             // $('#btn_sub',document).click();
    layer.close(index);
             tip('操作成功');
             reloadTable();
          }
    
       });
    }
    Rendering:

    There is a bug on it, that is, there is some content in the box, there is no scroll bar, I don't know how to solve it for the time being, and the refresh experience is also a bit poor. If you know, please enlighten me!
     
  17.  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326428971&siteId=291194637
Recommended