优化代码

This commit is contained in:
不做码农 2021-12-24 14:14:38 +08:00
parent 0334c1e1e8
commit a3d0a2b403
6 changed files with 17 additions and 26 deletions

View File

@ -160,6 +160,7 @@ ${end}
return ToResponse(response);
}
$if(replaceDto.ShowBtnExport)
/// <summary>
/// ${genTable.FunctionName}导出
/// </summary>
@ -174,5 +175,6 @@ ${end}
string sFileName = ExportExcel(list, "${replaceDto.ModelTypeName}", "${genTable.FunctionName}");
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
}
$end
}
}

View File

@ -69,7 +69,9 @@ import {
del${genTable.BusinessName},
update${genTable.BusinessName},
get${genTable.BusinessName},
$if(replaceDto.ShowBtnExport)
export${genTable.BusinessName},
$end
$if(genTable.SortField != "" && genTable.SortField != null)
changeSort
$end
@ -121,6 +123,9 @@ $if((item.HtmlType == "radio" || item.HtmlType == "select" || item.HtmlType == "
$elseif(item.HtmlType == "datetime" && item.IsQuery == true)
//${item.ColumnComment}时间范围
dateRange${item.CsharpField}: [],
$elseif(item.HtmlType == "customInput")
editIndex = -1; //不加editIndex,整个列都会一块变成可编辑
showEditSort = false;
$end
$end
$if(genTable.SortField != "" && genTable.SortField != null)
@ -268,22 +273,6 @@ $end
}
});
},
$if(genTable.SortField != "" && genTable.SortField != null)
// 显示编辑排序
handleShowSort() {
this.showEditSort = !this.showEditSort;
},
// 保存排序
handleChangeSort(item, orderNum) {
changeSort({ orderNum: orderNum, id: item.${replaceDto.FistLowerPk} }).then(
(response) => {
this.msgSuccess("修改成功");
this.getList();
this.showEditSort = false;
}
);
},
$end
$if(replaceDto.UploadFile == 1)
//图片上传成功方法
handleUploadSuccess(column, filelist) {
@ -333,6 +322,7 @@ $end
}
});
},
$if(replaceDto.ShowBtnExport)
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
@ -348,6 +338,7 @@ $end
this.download(response.data.path);
});
},
$end
},
};
</script>

View File

@ -231,9 +231,11 @@ namespace ZR.CodeGenerator
}
else if (dbFieldInfo.IsList && dbFieldInfo.HtmlType.Equals(GenConstants.HTML_IMAGE_UPLOAD))
{
sb.AppendLine($" <el-table-column prop=\"{columnName}\" label=\"{label}\">");
sb.AppendLine($" <el-table-column prop=\"{columnName}\" align=\"center\" label=\"{label}\">");
sb.AppendLine(" <template slot-scope=\"scope\">");
sb.AppendLine($" <el-image class=\"table-td-thumb\" :src=\"scope.row.{columnName}\" :preview-src-list=\"[scope.row.{columnName}]\"></el-image>");
sb.AppendLine($" <el-image class=\"table-td-thumb\" fit=\"contain\" :src=\"scope.row.{columnName}\" :preview-src-list=\"[scope.row.{columnName}]\">");
sb.AppendLine(" <div slot=\"error\"><i class=\"el-icon-document\" /></div>");
sb.AppendLine(" </el-image>");
sb.AppendLine(" </template>");
sb.AppendLine(" </el-table-column>");
}
@ -241,14 +243,12 @@ namespace ZR.CodeGenerator
{
sb.AppendLine($@" <el-table-column label=""{label}"" align=""center"" prop=""{columnName}"">");
sb.AppendLine(@" <template slot-scope=""scope"">");
string checkboxHtml = string.Empty;
if (dbFieldInfo.HtmlType == GenConstants.HTML_CHECKBOX)
{
sb.AppendLine($@" <dict-tag :options=""{columnName}Options"" :value=""scope.row.{columnName} ? scope.row.{columnName}.split(',') : []""/>");
}
else
{
sb.AppendLine($@" <dict-tag :options=""{columnName}Options"" :value=""scope.row.{columnName}""/>");
checkboxHtml = $" ? scope.row.{columnName}.split(',') : []";
}
sb.AppendLine($" <dict-tag :options=\"{columnName}Options\" :value=\"scope.row.{columnName}{checkboxHtml}\" />");
sb.AppendLine(@" </template>");
sb.AppendLine(@" </el-table-column>");
}

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" class="icon" p-id="2986" t="1546864403462" version="1.1" viewBox="0 0 1024 1024"><defs><style type="text/css"/></defs><path fill="#bfbfbf" d="M814.502 270.913l30.18-30.18 30.58 30.58 37.825-37.825-86.377-86.378-37.825 37.825 30.58 30.58-30.18 30.18c-66.856-61.301-154.087-100.642-250.374-106.858V66.548h-53.499v72.289c-214.046 13.792-383.407 191.652-383.407 409.199 0 226.533 183.624 410.157 410.157 410.157s410.157-183.624 410.157-410.157c-0.001-106.858-40.892-204.139-107.817-277.123zM529.994 598.26v74.606h-35.666V598.26c-20.724-7.385-35.666-26.958-35.666-50.225 0-23.267 14.942-42.842 35.666-50.225v-235.1h35.666v235.102c20.724 7.383 35.666 26.958 35.666 50.225 0 23.265-14.942 42.839-35.666 50.223z" p-id="2987"/></svg>

Before

Width:  |  Height:  |  Size: 832 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" class="icon" p-id="4263" t="1553934943780" version="1.1" viewBox="0 0 1024 1024"><defs><style type="text/css"/></defs><path fill="#8a8a8a" d="M512 256s-97.2-4.8-144-96c16.8 113.6 108 192 144 192s127.2-78.8 144-192c-46.8 91.2-144 96-144 96z" p-id="4264"/><path fill="#8a8a8a" d="M928 448C928 218.4 741.6 32 512 32S96 218.4 96 448c0 186.8 122.8 344.4 292.4 397.2-42 35.2-68.4 88-68.4 146.8h64c0-70.8 57.2-128 128-128s128 57.2 128 128h64c0-58.8-26.4-111.6-68.4-146.8 169.6-52.8 292.4-210.4 292.4-397.2z m-416 352c-194.4 0-352-157.6-352-352s157.6-352 352-352 352 157.6 352 352-157.6 352-352 352z" p-id="4265"/></svg>

Before

Width:  |  Height:  |  Size: 720 B

View File

@ -138,7 +138,7 @@
<el-form-item label="创建人">{{formView.create_by}}</el-form-item>
</el-col>
<el-col :lg="24">
<el-form-item label="存储地址">{{formView.fileUrl}}</el-form-item>
<el-form-item label="存储路径">{{formView.fileUrl}}</el-form-item>
</el-col>
<el-col :lg="24">
<el-form-item label="访问路径">{{formView.accessUrl}}</el-form-item>