BUG:原di函数在index.vue中已经无法获了到正确的值

This commit is contained in:
yzp 2024-11-12 18:48:39 +08:00
parent 96be81275a
commit 2368046a48
3 changed files with 14 additions and 12 deletions

View File

@ -148,7 +148,7 @@
@:</template>
} else if(@column.EffectType == "Select") {
@:<template #row_@(@column.LowerPropertyName)="{ row }">
@:<el-tag :type="di('@(@column.DictTypeCode)', row.@(@column.LowerPropertyName))?.tagType"> {{di('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name}}</el-tag>
@:<el-tag :type="dc('@(@column.DictTypeCode)', row.@(@column.LowerPropertyName))?.tagType"> {{dc('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name||row.@column.LowerPropertyName)?.value}}</el-tag>
@:</template>
} else if(@column.EffectType == "EnumSelector") {
@:<template #row_@(@column.LowerPropertyName)="{ row }">
@ -195,10 +195,7 @@ import { Local } from '/@@/utils/storage';
@:import { codeToName, getConstType } from "/@@/utils/constHelper";
}
@if(@Model.TableField.Any(x=>x.EffectType == "Select") || @Model.TableField.Any(x=>x.EffectType == "EnumSelector")){
@:import { getDictLabelByVal as di, getDictDataList as dl } from '/@@/utils/dict-utils';
}
@if(@Model.TableField.Any(x=>x.EffectType == "EnumSelector")){
@:import { getDictLabelByVal as dv } from '/@@/utils/dict-utils';
@:import { getDictLabelByCode as dc, getDictLabelByVal as dv, getDictDataList as dl } from '/@@/utils/dict-utils';
}
@if(@Model.TableField.Any(x=>x.EffectType == "DatePicker")){
@:import { formatDate } from '/@@/utils/formatTime';

View File

@ -132,12 +132,13 @@ export const useUserInfo = defineStore('userInfo', {
},
// 根据字典类型和代码取字典项
getDictItemByCode(typePCode: string, val: string) {
if (val != undefined && val !== '') {
const _val = val.toString();
const ds = this.getDictDatasByCode(typePCode);
getDictItemByCode(typePCode: string, code: string) {
if (code != undefined && code !== '') {
const _code = code.toString();
console.log(ds);
for (const element of ds) {
if (element.code === _val) {
if (element.code === _code) {
console.log(element);
return element;
}
}

View File

@ -21,8 +21,12 @@ export function getDictValByLabel(dicName: string, dicItemCode: any): any {
return stores.getDictValByLabel(dicName, dicItemCode);
}
export function getDictLabelByVal(dicName: string, dicItemCode: any): any {
return stores.getDictLabelByVal(dicName, dicItemCode);
export function getDictLabelByVal(dicName: string, dicItemValue: any): any {
return stores.getDictLabelByVal(dicName, dicItemValue);
}
export function getDictLabelByCode(dicName: string, dicItemCode: any): any {
return stores.getDictItemByCode(dicName, dicItemCode);
}
// select 控件使用,用于获取字典列表,示例如下: