From 6611f513f3a361c645d44d9ca16938f7de5b3f4c 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: Mon, 5 Dec 2022 18:36:16 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9ATreeVue=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=A8=A1=E6=9D=BF=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/CodeGenTemplate/v3/TreeVue.txt | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/TreeVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/TreeVue.txt index d63099d..43950e5 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/TreeVue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/TreeVue.txt @@ -31,10 +31,13 @@ $if(column.HtmlType == "datetime") -$elseif(column.HtmlType == "select" || column.HtmlType == "radio") +$elseif(column.HtmlType == "select" || column.HtmlType == "radio" || column.HtmlType == "selectMulti") - - + + + {{ item.dictLabel }} + {{ item.dictValue }} + $else @@ -125,9 +128,9 @@ $elseif(column.HtmlType == "checkbox" || column.HtmlType == "select" || column.H @@ -233,7 +236,7 @@ $elseif(column.HtmlType == "radio") - {{item.dictLabel}} + {{item.dictLabel}} @@ -249,11 +252,11 @@ $elseif(column.HtmlType == "editor") -$elseif(column.HtmlType == "select") +$elseif(column.HtmlType == "select" || column.HtmlType == "selectMulti") - - + + @@ -261,7 +264,7 @@ $elseif(column.HtmlType == "checkbox") - {{item.dictLabel}} + {{item.dictLabel}} @@ -335,28 +338,31 @@ const open = ref(false) const state = reactive({ form: {}, rules: { - $foreach(column in genTable.Columns) +$foreach(column in genTable.Columns) $if(column.IsRequired && column.IsIncrement == false) - ${column.CsharpFieldFl}: [ - { required: true, message: "${column.ColumnComment}不能为空", trigger: $if(column.htmlType == "select")"change"$else"blur"$end -$if(column.CsharpType == "int" || column.CsharpType == "long"), type: "number"$end } - ], + ${column.CsharpFieldFl}: [{ required: true, message: "${column.ColumnComment}不能为空", trigger: $if(column.htmlType == "select")"change"$else"blur"$end +$if(column.CsharpType == "int" || column.CsharpType == "long"), type: "number"$end }], +$end +$end + }, + options: { +$foreach(column in genTable.Columns) +$if(column.HtmlType == "radio" || column.HtmlType == "select" || column.HtmlType == "checkbox" || column.HtmlType == "selectMulti") + //$if(column.ColumnComment != "") ${column.ColumnComment} $else ${column.CsharpFieldFl}$end选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'} + $if(column.DictType != "")${column.DictType}$else${column.CsharpFieldFl}Options$end: [], $end $end } }) -const { form, rules } = toRefs(state) +const { form, rules, options } = toRefs(state) // 总记录数 const total = ref(0) const dataList = ref([]) const queryRef = ref() const formRef = ref() $foreach(item in genTable.Columns) -$if((item.HtmlType == "radio" || item.HtmlType == "select" || item.HtmlType == "checkbox")) -// ${item.ColumnComment}选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'} -const $if(item.DictType != "") ${item.DictType} $else ${item.CsharpFieldFl}Options$end = ref([]) -$elseif(item.HtmlType == "datetime" && item.IsQuery == true) +$if(item.HtmlType == "datetime" && item.IsQuery == true) // ${item.ColumnComment}时间范围 const dateRange${item.CsharpField} = ref([]) @@ -402,7 +408,7 @@ $end $if(index > 0) proxy.getDicts(dictParams).then((response) => { response.data.forEach((element) => { - proxy[element.dictType] = element.list + state.options[element.dictType] = element.list }) }) $end @@ -532,11 +538,8 @@ function handleExport() { cancelButtonText: "取消", type: "warning", }) - .then(function () { - return export${genTable.BusinessName}(queryParams) - }) - .then((response) => { - proxy.download(response.data.path) + .then(async () => { + await export${genTable.BusinessName}(queryParams) }) } $end