From 1ec10991791e941f2237819dc36d56fad915ede2 Mon Sep 17 00:00:00 2001 From: xlsea Date: Sat, 14 Jun 2025 13:40:15 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(other):=20=E4=BF=AE=E5=A4=8D=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/template/modules/operate-drawer.vue.vm | 43 ++++++-- docs/template/modules/search.vue.vm | 19 ++-- src/components/custom/file-upload.vue | 100 +++++++++--------- src/components/custom/oss-upload.vue | 2 +- src/components/custom/tinymce-editor.vue | 36 +++++++ src/constants/business.ts | 2 +- src/typings/components.d.ts | 2 + .../notice/modules/notice-operate-drawer.vue | 24 +---- 8 files changed, 134 insertions(+), 94 deletions(-) create mode 100644 src/components/custom/tinymce-editor.vue diff --git a/docs/template/modules/operate-drawer.vue.vm b/docs/template/modules/operate-drawer.vue.vm index ca9c071b..b5478c01 100644 --- a/docs/template/modules/operate-drawer.vue.vm +++ b/docs/template/modules/operate-drawer.vue.vm @@ -52,7 +52,7 @@ function createDefaultModel(): Model { return { #foreach($column in $columns) #if($column.insert) - ${column.javaField}:#if($column.javaType == 'String') ''#else null#end#if($foreach.hasNext),#end + ${column.javaField}:#if($column.javaType == 'String' && $!column.dictType && $column.dictType == '') ''#else undefined#end#if($foreach.hasNext),#end #end #end }; @@ -91,16 +91,22 @@ function closeDrawer() { async function handleSubmit() { await validate(); + #set($operateColumns = []) + #foreach($column in $columns)#if($column.insert || $column.edit)#set($dummy = $operateColumns.add($column))#end#end + const { #foreach($column in $operateColumns)$column.javaField#if($foreach.hasNext), #end#end } = model; + // request if (props.operateType === 'add') { - const { #foreach($column in $columns)#if($column.insert)$column.javaField#if($foreach.hasNext), #end#end#end } = model; - const { error } = await fetchCreate${BusinessName}({ #foreach($column in $columns)#if($column.insert)$column.javaField#if($foreach.hasNext), #end#end#end }); + #set($addFields = []) + #foreach($column in $columns)#if($column.insert)#set($dummy = $addFields.add($column.javaField))#end#end + const { error } = await fetchCreate${BusinessName}({ #foreach($field in $addFields)$field#if($foreach.hasNext), #end#end }); if (error) return; } if (props.operateType === 'edit') { - const { #foreach($column in $columns)#if($column.edit)$column.javaField#if($foreach.hasNext), #end#end#end } = model; - const { error } = await fetchUpdate${BusinessName}({ #foreach($column in $columns)#if($column.edit)$column.javaField#if($foreach.hasNext), #end#end#end }); + #set($editFields = []) + #foreach($column in $columns)#if($column.edit)#set($dummy = $editFields.add($column.javaField))#end#end + const { error } = await fetchUpdate${BusinessName}({ #foreach($field in $editFields)$field#if($foreach.hasNext), #end#end }); if (error) return; } @@ -170,13 +176,36 @@ watch(visible, () => { - #elseif($column.htmlType == "datetime") + #elseif($column.htmlType == "checkbox" && "" != $dictType) + + + + + + #elseif($column.htmlType == "checkbox" && $dictType) + + + + + + #elseif($column.htmlType == 'datetime') + #elseif($column.htmlType == "imageUpload") + + #elseif($column.htmlType == "fileUpload") + + #elseif($column.htmlType == "editor") + #else #end diff --git a/docs/template/modules/search.vue.vm b/docs/template/modules/search.vue.vm index 9f347973..21e56fd5 100644 --- a/docs/template/modules/search.vue.vm +++ b/docs/template/modules/search.vue.vm @@ -75,35 +75,28 @@ async function search() { #set($comment=$column.columnComment) #end - #if(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) + #if(($tool.in($column.htmlType, "select", "radio", "checkbox")) && $dictType && "" != $dictType) - #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) + #elseif($tool.in($column.htmlType, "select", "radio", "checkbox")) - #elseif($column.htmlType.equals('select') || $column.htmlType.equals('radio')) - - #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") + #elseif($column.htmlType == 'datetime' && $column.queryType != "BETWEEN") - #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") + #elseif($column.htmlType == 'datetime' && $column.queryType == "BETWEEN") diff --git a/src/components/custom/oss-upload.vue b/src/components/custom/oss-upload.vue index 953c7151..d4aa4f65 100644 --- a/src/components/custom/oss-upload.vue +++ b/src/components/custom/oss-upload.vue @@ -34,7 +34,7 @@ async function handleFetchOssList(ossIds: string[]) { watch( value, async val => { - const ossIds = val.split(',')?.filter(item => isNotNull(item)); + const ossIds = val?.split(',')?.filter(item => isNotNull(item)) || []; const fileIds = new Set(fileList.value.filter(item => item.status === 'finished').map(item => item.id)); if (ossIds.every(item => fileIds.has(item))) { return; diff --git a/src/components/custom/tinymce-editor.vue b/src/components/custom/tinymce-editor.vue new file mode 100644 index 00000000..d5bf7ca4 --- /dev/null +++ b/src/components/custom/tinymce-editor.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/constants/business.ts b/src/constants/business.ts index a9718f3a..c3cad440 100644 --- a/src/constants/business.ts +++ b/src/constants/business.ts @@ -76,7 +76,7 @@ export const genHtmlTypeRecord: Record = { select: '下拉框', radio: '单选框', checkbox: '复选框', - datetime: '日期控件', + datetime: '日期时间控件', imageUpload: '图片上传', fileUpload: '文件上传', editor: '富文本控件' diff --git a/src/typings/components.d.ts b/src/typings/components.d.ts index 6f73d735..ca6460e8 100644 --- a/src/typings/components.d.ts +++ b/src/typings/components.d.ts @@ -69,6 +69,7 @@ declare module 'vue' { NButton: typeof import('naive-ui')['NButton'] NCard: typeof import('naive-ui')['NCard'] NCheckbox: typeof import('naive-ui')['NCheckbox'] + NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup'] NCode: typeof import('naive-ui')['NCode'] NCollapse: typeof import('naive-ui')['NCollapse'] NCollapseItem: typeof import('naive-ui')['NCollapseItem'] @@ -146,6 +147,7 @@ declare module 'vue' { TableSiderLayout: typeof import('./../components/advanced/table-sider-layout.vue')['default'] TenantSelect: typeof import('./../components/custom/tenant-select.vue')['default'] ThemeSchemaSwitch: typeof import('./../components/common/theme-schema-switch.vue')['default'] + TinymceEditor: typeof import('./../components/custom/tinymce-editor.vue')['default'] UserSelect: typeof import('./../components/custom/user-select.vue')['default'] WaveBg: typeof import('./../components/custom/wave-bg.vue')['default'] } diff --git a/src/views/system/notice/modules/notice-operate-drawer.vue b/src/views/system/notice/modules/notice-operate-drawer.vue index cc05dff5..22e10ee8 100644 --- a/src/views/system/notice/modules/notice-operate-drawer.vue +++ b/src/views/system/notice/modules/notice-operate-drawer.vue @@ -1,12 +1,7 @@