diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_index.vue.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_index.vue.vm
index c066dde0..1477a3dd 100644
--- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_index.vue.vm
+++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_index.vue.vm
@@ -148,7 +148,7 @@
@:
} else if(@column.EffectType == "Select") {
@:
- @: {{di('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name}}
+ @: {{dc('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name||row.@column.LowerPropertyName)?.value}}
@:
} else if(@column.EffectType == "EnumSelector") {
@:
@@ -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';
diff --git a/Web/src/stores/userInfo.ts b/Web/src/stores/userInfo.ts
index eba5e3c2..0ba0ed59 100644
--- a/Web/src/stores/userInfo.ts
+++ b/Web/src/stores/userInfo.ts
@@ -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;
}
}
diff --git a/Web/src/utils/dict-utils.ts b/Web/src/utils/dict-utils.ts
index 9450542b..312d5a85 100644
--- a/Web/src/utils/dict-utils.ts
+++ b/Web/src/utils/dict-utils.ts
@@ -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 控件使用,用于获取字典列表,示例如下: