zoukankan      html  css  js  c++  java
  • 2、jeecg 笔记之 t:dictSelect 或 t:dgCol 自定义字典

    转载:https://www.cnblogs.com/niceyoo/p/9827668.html

     1、需求

    先说一下需求场景吧,我们知道 jeecg 中提供了下拉,其中包含两种使用场景;

    一种是直接通过 t:dictSelect 使用,再就是 t:dgCol  用于表头的列表工具条标签;

    总之就是这个样子

    需求来了,我们想要下拉的数据有个排序,比如原来没有排序的

    再来看一下数据字典表中的数据如下:

    然后,我们希望通过 类型编码做一个 倒序的排序,最终的效果如下:

    2、解决过程

    首先通过查找资料了解到,下拉中有个 dictionary 属性,可以通过自定义字典实现效果,格式:表名,编码,显示文本;

    但是想使用自定义字典需要结合 dictCondition(自定义字典表的显示文本-字典查询条件) 属性;

    在 DataGridTag 类 559 行找到了,找到了字典查询条件 dictCondition 的使用

    图片展示已经很明确了,就是一个 sql 的拼装,我们只需要能把 sql 写出来就完事了,如下图

    SELECT a.typecode,a.typename FROM t_s_type a 
    
    ,t_s_typegroup b WHERE a.typegroupid = b.id  
    
    AND b.typegroupcode = 'mwo_work_order_status' ORDER BY typecode DESC 

    因为界面要用到编码以及显示文本,所以只需要 typecode、typename作为显示项。

    我们再来看一下自定义字典的格式 【表名,编码,显示文本】

    <t:dgCol title="啦啦啦"  field="xxx"  queryMode="single" query="true" 
    dictionary="t_s_type,a.typecode,a.typename"
    dictCondition="a ,t_s_typegroup b WHERE a.typegroupid = b.id  
    AND b.typegroupcode = 'mwo_work_order_status' ORDER BY typecode DESC ">
    </t:dgCol>

    dictionary="t_s_type,a.typecode,a.typename"  >>> 表名,编码,显示文本

    dictCondition="a ,t_s_typegroup b WHERE a.typegroupid = b.id  AND b.typegroupcode = 'mwo_work_order_status' ORDER BY typecode DESC "

    最终拼接起来的 sql 如上边那段了。

    再给一个参考:

    复制代码
    <t:dictSelect field="mwoApplyDelayProcess" type="radio"
        dictTable="t_s_type a ,t_s_typegroup b"
        dictField="a.typecode,a.typename,a.typecode"
        dictCondition="WHERE a.typegroupid = b.id  AND  b.typegroupcode = 'mwo_apply_delay_process' AND  a.`typecode` IN (2,3)"
        dictText="typename"
        defaultVal="${myyWorkOrderPage.mwoApplyDelayProcess}"  hasLabel="false"  title="申请延期状态"  datatype="*">
    </t:dictSelect>
    复制代码

    3、最后

    这种实现方式是比较。。那啥的。。不喜勿喷,欢迎补充。

    博客地址:http://www.cnblogs.com/niceyoo

  • 相关阅读:
    Javascript中的this之我见
    Javascript中call、apply之我见
    IE 11中 onpropertychange失效
    解决在.NET 4.0下无法发送包含尖括号等请求的问题
    连续赋值与求值顺序var a = {n:1};a.x = a = {n:2}; alert(a.x);
    DBCC维护语句语法
    SqlServer数据库碎片整理——BCC SHOWCONTIG
    Change Jenkins time zone
    Jenkins中执行docker命令报错
    Redis 慢查询
  • 原文地址:https://www.cnblogs.com/Jeely/p/11309271.html
Copyright © 2011-2022 走看看