ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## 常用工具 依赖引入:` <c:import url="/admin/pages/common/headsource.jsp" />` 时间工具类:`/coderfun-boot-web/src/main/webapp/static/js/calutil.js` easyui的拓展:`/coderfun-boot-web/src/main/webapp/static/easyui/easyui-extend` ## easyui 使用规范 * datagrid 将options写在html中更方便 ``` <th data-options="field:'drugArticle.barcode',width:100,align:'left',formatter:complexCol">条码</th> ``` * $("#fromid").serializeJson();将表单序列化成json > 默认去除表单元素未填写的字段,$("#fromid").serializeJson(true)保留 * 查询:利用将查询表单序列化成json,`dataTable.datagrid("load",json);` ``` function drugstock_search(){ $("#drugStock-datagrid-table").datagrid("load",$("#drugStock-search-form").serializeJson()); } ``` * 将数据加载到表格:`$("#fromid").form("myLoad",json); `日期处理如下: ``` <input date-formatFn="calUtil.formatLong" name="dealtime" id="dealtime" class="easyui-datebox" > ``` ## 字典翻译: * datagrid 拓展字典支持 ``` <th data-options="field:'drugArticle.catelogid',width:80,align:'left',formatter:complexCol,codeClass:'58'">分类</th> ``` * combobox 拓展字典支持,详解[easyui combobox拓展](https://www.kancloud.cn/coderfun-boot/coderfun-boot-zh/868511) ``` <input name="catelogid" class="easyui-combobox" style="width:100px;" data-options="required:true,valueField:'code',textField:'name',enableNull:true,nullText:'请选择', codeClass:'58',editable:false,panelHeight:'auto'"> ``` > combobox 扩展,增加字典数据支持,增加三个字段: > codeClass:字典类型代码 > enableNull:是否允许空项 > nullText:空项显示的文本 * 从dictManager取得code信息: ``` $.dictManager.getCodeValue(codeClass, code);//codeClass为字典父类 ``` * 在artTemplate需要翻译字典: ``` {{isreceiveid | codeClass:"64"}} ``` > 参加模板渲染 * jstl 翻译code ``` <%--引入标签--%> <%@ taglib prefix="code" uri="jstl.coderfun.common" %> <%--jsp页面翻译code--%> ${code:getName('fieldmeta','module_code')} ``` ## 模板渲染 推荐使用artTemplate,简单便捷,详见[artTemplate](https://github.com/aui/artTemplate ),如何引入: ``` <script type="text/javascript" src="${root}/static/plugins/art-template-4.13.2.js"></script> <script type="text/javascript" src="${root}/static/js/template-helper.js"></script> ``` 使用template-helper进行字典翻译或者时间格式转化 ``` <div class="time">发布时间:{{posttime | formatDate}}</div> <td colspan="2">是否付款:{{isreceiveid | codeClass:"64"}}</td> ```