From 8867c7ba45df8209fd53c5b052644a2f283aeee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Thu, 30 Nov 2023 14:17:12 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/CodeGenTemplate/TplDto.txt | 2 +- .../wwwroot/CodeGenTemplate/v3/Vue.txt | 45 +++++++++++++------ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt index 57c2131..eb5dc9d 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt @@ -44,7 +44,7 @@ $else [ExcelIgnore] $end $end -$if(item.CsharpType == "long") +$if(item.CsharpType == "long" && replaceDto.useSnowflakeId == true && item.IsPk) [JsonConverter(typeof(ValueToStringConverter))] $end public $item.CsharpType$item.RequiredStr $item.CsharpField { get; set; } diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt index 38b0979..369e06a 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt @@ -677,6 +677,37 @@ $if(sub) $end proxy.resetForm("formRef") } + +$if(replaceDto.ShowBtnView) +/** + * 查看 + * @param {*} row + */ +function handlePreview(row) { + reset() + const id = row.${replaceDto.FistLowerPk} + get${genTable.BusinessName}(id).then((res) => { + const { code, data } = res + if (code == 200) { + open.value = true + title.value = '查看' + opertype.value = 3 + form.value = { + ...data, +$foreach(item in genTable.Columns) +$if(item.HtmlType == "checkbox" || item.HtmlType == "selectMulti") + ${item.CsharpFieldFl}Checked: data.${item.CsharpFieldFl} ? data.${item.CsharpFieldFl}.split(',') : [], +$end +$end + } +$if(sub) + ${tool.FirstLowerCase(genTable.SubTable.ClassName)}List.value = res.data.${tool.FirstLowerCase(genTable.SubTable.ClassName)}Nav +$end + } + }) +} +$end + $if(replaceDto.ShowBtnAdd) // 添加按钮操作 function handleAdd() { @@ -784,20 +815,6 @@ function handleClear() { } $end -$if(replaceDto.ShowBtnView) -/** - * 查看 - * @param {*} row - */ -function handlePreview(row) { - reset() - open.value = true - title.value = '查看' - opertype.value = 3 - form.value = { ...row } -} -$end - $if(replaceDto.ShowBtnImport) // 导入数据成功处理 const handleFileSuccess = (response) => {