页面配置数据字典product_type

后端

@Dict(dicCode = "product_type")
private String type;

前端

<j-dict-select-tag v-decorator="['type', validatorRules.type]" placeholder="请选择商品类型" dictCode="product_type"
                   :trigger-change="true" @change="getType"/>

引入依赖

import {initDictOptions, filterDictText} from '@/components/dict/JDictSelectUtil'

 

在created()初始化方法执行字典配置方法

 this.initDictConfig();

 

//加载数据字典
initDictConfig() {
    //初始化字典 - 商品类型
    initDictOptions('product_type').then((res) => {
        if (res.success) {
            this.typeDictOptions = res.result;
        }
    });
},

表格字段

{
    title: '商品类型',
    align: "center",
    dataIndex: 'type',
    customRender: (text, record, index) => {
        //todo 字典值替换通用方法
        return filterDictText(this.typeDictOptions, text);
    }
},
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐