jeecgboot數據字典使用
input頁面下拉框使用
效果展示
實現
- 定義數據字典
- 引用並調用JDictSelectTag組件
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
export default {
....
components: {
JDate,
CustomerModal,
JDictSelectTag
},
...
}
<j-dict-select-tag :triggerChange="true" v-model="queryParam.type1Id" placeholder="請選擇類型" dictCode="customer_type"/>
dictCode為數據字典中定義的code。
list頁面顯示 數據字典
效果展示
處理前
處理后
實現
- 實體類添加注解
@Dict(dicCode = "customer_type")
private String type1Id;
dicCode為數據字典中定義的code。
2. 修改table column定義
{
title:'類型',
align:"center",
dataIndex: 'type1Id_dictText',
},
dataIndex值為字段名+"_dictText"
修改后也可以在vue中查看數據源。
list頁面顯示 表關聯
效果展示
處理前
處理后
實現
- 實體類添加注解
@Dict(dicCode = "id",dictTable = "sys_user",dicText = "realname")
private String managerId;
dicCode為關聯表的組件
dictTable為關聯表
dicText 為需要顯示的內容
- 修改table column定義
{
title:'負責人',
align:"center",
dataIndex: 'managerId_dictText'
},
dataIndex值為字段名+"_dictText",和數據字典的一致。
參考自:https://blog.csdn.net/zhangzhenisme/article/details/100155052