Merge pull request '修改部份BUG' (#174) from koy07555/Admin.NET.Pro:修改部份BUG into main

Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/174
This commit is contained in:
zuohuaijun 2024-11-12 22:36:28 +08:00
commit 9ef51338e6
5 changed files with 19 additions and 17 deletions

View File

@ -1,4 +1,4 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
@ -248,7 +248,7 @@ if(@column.EffectType == "Upload"){
@:public async Task<SysFile> Upload@(@column.PropertyName)([Required] IFormFile file)
@:{
@:var service = App.GetRequiredService<SysFileService>();
@:return await service.UploadFile(new FileUploadInput { File = file, Path = "upload/@(@column.PropertyName)" });
@:return await service.UploadFile(new UploadFileInput { File = file, Path = "upload/@(@column.PropertyName)" });
@:}
}
}

View File

@ -1,4 +1,4 @@
@{Dictionary<string, int> definedObjects = new Dictionary<string, int>();}
@{Dictionary<string, int> definedObjects = new Dictionary<string, int>();}
@{var pkField = Model.TableField.Where(c => c.ColumnKey == "True").FirstOrDefault();}
@{
string pkFieldName = LowerFirstLetter(pkField.PropertyName);
@ -91,7 +91,7 @@
@:<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
@:<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
@:<el-select clearable v-model="state.ruleForm.@(@column.LowerPropertyName)" placeholder="请选择@(@column.ColumnComment)">
@:<el-option v-for="(item,index) in dl('@(@column.DictTypeCode)')" :key="index" :value="@(@column.NetType.StartsWith("string") ? "item.code" : "Number(item.value)")" :label="`${item.name} [${item.code}] ${item.value}`"></el-option>
@:<el-option v-for="(item,index) in dl('@(@column.DictTypeCode)')" :key="index" :value="@(@column.NetType.StartsWith("string") ? "item.code" : "Number(item.value)")" :label="`${item.name||''} [${item.code}] ${item.value}`"></el-option>
</el-select>
</el-form-item>
</el-col>
@ -142,7 +142,7 @@
@:<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
@:<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
@:<el-select clearable v-model="state.ruleForm.@(@column.LowerPropertyName)" placeholder="请选择@(@column.ColumnComment)">
@:<el-option v-for="(item,index) in dl('@(@column.DictTypeCode)')" :key="index" :value="@(@column.NetType.StartsWith("string") ? "item.value" : "Number(item.value)")" :label="`${item.name} (${item.code}) [${item.value}]`"></el-option>
@:<el-option v-for="(item,index) in dl('@(@column.DictTypeCode)')" :key="index" :value="@(@column.NetType.StartsWith("string") ? "item.value" : "Number(item.value)")" :label="`${item.name||''} (${item.code}) [${item.value}]`"></el-option>
</el-select>
</el-form-item>
</el-col>

View File

@ -53,7 +53,7 @@
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb5" v-if="state.showAdvanceQueryUI">
<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
<el-select v-model="state.queryParams.@(@column.LowerPropertyName)" filterable placeholder="请选择@(@column.ColumnComment)" clearable @@keyup.enter.native="handleQuery(true)" >
<el-option v-for="(item,index) in dl('@(@column.DictTypeCode)')" :key="index" :value="item.value" :label="`${item.name} [${item.code}] ${item.value}`" />
<el-option v-for="(item,index) in dl('@(@column.DictTypeCode)')" :key="index" :value="item.value" :label="`${item.name||''} [${item.code}] ${item.value}`" />
</el-select>
</el-form-item>
</el-col>
@ -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 v-if="row.@(@column.LowerPropertyName)" :type="dc('@(@column.DictTypeCode)', row.@(@column.LowerPropertyName))?.tagType"> {{dc('@(@column.DictTypeCode)', 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();
getDictItemByCode(typePCode: string, code: string) {
if (code != undefined && code !== '') {
const _code = code.toString();
const ds = this.getDictDatasByCode(typePCode);
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 控件使用,用于获取字典列表,示例如下: