Commit 8ffb627c82177066a8c5d7e0c009b0fd9ea92145

Authored by YunaiV
1 parent 6ff31742

refactor(infra):uniapp 生成器使用 delay 处理返回延迟

- form/detail 模板用 delay(handleBack) 替代内联 setTimeout

- 更新 uniapp 代码生成 golden 快照

验证:CodegenEngineUniappTest 通过
yudao-module-infra/src/main/resources/codegen/vue3_admin_uniapp/views/detail/index.vue.vm
@@ -67,7 +67,7 @@ import { onMounted, ref } from 'vue' @@ -67,7 +67,7 @@ import { onMounted, ref } from 'vue'
67 import { useToast } from '@wot-ui/ui/components/wd-toast' 67 import { useToast } from '@wot-ui/ui/components/wd-toast'
68 import { delete${simpleClassName}, get${simpleClassName} } from '@/api/${table.moduleName}/${table.businessName}' 68 import { delete${simpleClassName}, get${simpleClassName} } from '@/api/${table.moduleName}/${table.businessName}'
69 import { useAccess } from '@/hooks/useAccess' 69 import { useAccess } from '@/hooks/useAccess'
70 -import { navigateBackPlus } from '@/utils' 70 +import { delay, navigateBackPlus } from '@/utils'
71 #if ($hasDict == 1) 71 #if ($hasDict == 1)
72 import { DICT_TYPE } from '@/utils/constants' 72 import { DICT_TYPE } from '@/utils/constants'
73 #end 73 #end
@@ -133,9 +133,7 @@ function handleDelete() { @@ -133,9 +133,7 @@ function handleDelete() {
133 await delete${simpleClassName}(props.id) 133 await delete${simpleClassName}(props.id)
134 toast.success('删除成功') 134 toast.success('删除成功')
135 uni.$emit('${table.moduleName}:${table.businessName}:reload') 135 uni.$emit('${table.moduleName}:${table.businessName}:reload')
136 - setTimeout(() => {  
137 - handleBack()  
138 - }, 500) 136 + delay(handleBack)
139 } finally { 137 } finally {
140 deleting.value = false 138 deleting.value = false
141 } 139 }
yudao-module-infra/src/main/resources/codegen/vue3_admin_uniapp/views/form/index.vue.vm
@@ -204,7 +204,7 @@ import { create${simpleClassName}, get${simpleClassName}, update${simpleClassNam @@ -204,7 +204,7 @@ import { create${simpleClassName}, get${simpleClassName}, update${simpleClassNam
204 #set ($dictImportNames = $dictImportNames.substring(0, $dictImportNames.length() - 1)) 204 #set ($dictImportNames = $dictImportNames.substring(0, $dictImportNames.length() - 1))
205 import { $dictImportNames } from '@/hooks/useDict' 205 import { $dictImportNames } from '@/hooks/useDict'
206 #end 206 #end
207 -import { navigateBackPlus } from '@/utils' 207 +import { delay, navigateBackPlus } from '@/utils'
208 #if ($hasDict == 1) 208 #if ($hasDict == 1)
209 import { DICT_TYPE } from '@/utils/constants' 209 import { DICT_TYPE } from '@/utils/constants'
210 #end 210 #end
@@ -302,9 +302,7 @@ async function handleSubmit() { @@ -302,9 +302,7 @@ async function handleSubmit() {
302 toast.success('新增成功') 302 toast.success('新增成功')
303 } 303 }
304 uni.$emit('${table.moduleName}:${table.businessName}:reload') 304 uni.$emit('${table.moduleName}:${table.businessName}:reload')
305 - setTimeout(() => {  
306 - handleBack()  
307 - }, 500) 305 + delay(handleBack)
308 } finally { 306 } finally {
309 formLoading.value = false 307 formLoading.value = false
310 } 308 }
yudao-module-infra/src/test/resources/codegen/vue3_admin_uniapp_one/vue/detail/index
@@ -54,7 +54,7 @@ import { onMounted, ref } from 'vue' @@ -54,7 +54,7 @@ import { onMounted, ref } from 'vue'
54 import { useToast } from '@wot-ui/ui/components/wd-toast' 54 import { useToast } from '@wot-ui/ui/components/wd-toast'
55 import { deleteStudent, getStudent } from '@/api/infra/demo' 55 import { deleteStudent, getStudent } from '@/api/infra/demo'
56 import { useAccess } from '@/hooks/useAccess' 56 import { useAccess } from '@/hooks/useAccess'
57 -import { navigateBackPlus } from '@/utils' 57 +import { delay, navigateBackPlus } from '@/utils'
58 import { DICT_TYPE } from '@/utils/constants' 58 import { DICT_TYPE } from '@/utils/constants'
59 import { formatDateTime } from '@/utils/date' 59 import { formatDateTime } from '@/utils/date'
60 60
@@ -116,9 +116,7 @@ function handleDelete() { @@ -116,9 +116,7 @@ function handleDelete() {
116 await deleteStudent(props.id) 116 await deleteStudent(props.id)
117 toast.success('删除成功') 117 toast.success('删除成功')
118 uni.$emit('infra:demo:reload') 118 uni.$emit('infra:demo:reload')
119 - setTimeout(() => {  
120 - handleBack()  
121 - }, 500) 119 + delay(handleBack)
122 } finally { 120 } finally {
123 deleting.value = false 121 deleting.value = false
124 } 122 }
yudao-module-infra/src/test/resources/codegen/vue3_admin_uniapp_one/vue/form/index
@@ -98,7 +98,7 @@ import { computed, onMounted, ref } from 'vue' @@ -98,7 +98,7 @@ import { computed, onMounted, ref } from 'vue'
98 import { useToast } from '@wot-ui/ui/components/wd-toast' 98 import { useToast } from '@wot-ui/ui/components/wd-toast'
99 import { createStudent, getStudent, updateStudent } from '@/api/infra/demo' 99 import { createStudent, getStudent, updateStudent } from '@/api/infra/demo'
100 import { getBoolDictOptions } from '@/hooks/useDict' 100 import { getBoolDictOptions } from '@/hooks/useDict'
101 -import { navigateBackPlus } from '@/utils' 101 +import { delay, navigateBackPlus } from '@/utils'
102 import { DICT_TYPE } from '@/utils/constants' 102 import { DICT_TYPE } from '@/utils/constants'
103 import { formatDateTime } from '@/utils/date' 103 import { formatDateTime } from '@/utils/date'
104 import { createFormSchema } from '@/utils/wot' 104 import { createFormSchema } from '@/utils/wot'
@@ -171,9 +171,7 @@ async function handleSubmit() { @@ -171,9 +171,7 @@ async function handleSubmit() {
171 toast.success('新增成功') 171 toast.success('新增成功')
172 } 172 }
173 uni.$emit('infra:demo:reload') 173 uni.$emit('infra:demo:reload')
174 - setTimeout(() => {  
175 - handleBack()  
176 - }, 500) 174 + delay(handleBack)
177 } finally { 175 } finally {
178 formLoading.value = false 176 formLoading.value = false
179 } 177 }