Avue中使用字典
- 后台接口引入,直接通过dicUrl引入api接口,可以参考dict.js中对于字典类型的配置,直接调用pig后端字典的接口即可。
column: [{label: '字典类型',prop: 'systemFlag',type: 'radio',dicUrl: '/admin/dict/type/dict_type',dataType: 'number/string' // 注意配置后台返回value 的类型,特别注意类型不对无法渲染rules: [{required: true,message: '请选择字典类型',trigger: 'blur'}],search: true}]
- 前端直接引入
- 在当前的页面列中直接填写,适用数量较少的选项,例如user.js中账号的锁定
column: [{label: '状态',prop: 'lockFlag',type: 'radio',dicData: [{label: '有效',value: '0'}, {label: '锁定',value: '9'}]}]
- 在当前的页面列中直接填写,适用数量较少的选项,例如user.js中账号的锁定
Elemenet中使用字典
- 加载数据字典
export default {dictTypes: ['字典类型']}
- 读取数据字典
<el-select v-model="form.dict"><el-optionv-for="dict in dict.type.字典类型":key="dict.value":label="dict.label":value="dict.value"></el-option></el-select>
- 翻译数据字典 dictTag
```html
// 字典标签组件翻译
// 自定义方法翻译 {{ xxxxFormat(form) }}
xxxxFormat(row, column) { return this.selectDictLabel(this.dict.type.字典类型, row.name); },
<a name="86a0c3a4"></a>## pig中使用公共参数、字典工具类```xml<dependency><groupId>com.pig4cloud</groupId><artifactId>pig-upms-api</artifactId></dependency>
pig中系统参数配置解析器ParamResolver的使用
- getLong方法,形参为参数key值,以及默认值,会通过checkAndGet方法调用remoteParamService.getByKey方法,查询参数值,返回值不为空则将返回值转为Long类型返回,返回值为空则返回Long类型默认值。
- getStr方法也是通过checkAndGet方法调用remoteParamService.getByKey方法最终返回String类型的参数值。

