Commit 9f6628305271ba8323dbf288c6985e8881e9ac1b
1 parent
5b29d5ff
reactor:【infra 基础设施】处理 vben + vben 代码模版(onRefresh => handleRefresh,toggleExpand => handleExpand)
Showing
7 changed files
with
32 additions
and
32 deletions
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm
| @@ -146,7 +146,7 @@ async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) { | @@ -146,7 +146,7 @@ async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) { | ||
| 146 | duration: 0, | 146 | duration: 0, |
| 147 | }); | 147 | }); |
| 148 | try { | 148 | try { |
| 149 | - await delete${simpleClassName}(row.id as number); | 149 | + await delete${simpleClassName}(row.id!); |
| 150 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); | 150 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); |
| 151 | await getList(); | 151 | await getList(); |
| 152 | } finally { | 152 | } finally { |
| @@ -195,7 +195,7 @@ try { | @@ -195,7 +195,7 @@ try { | ||
| 195 | #if (${table.templateType} == 2) | 195 | #if (${table.templateType} == 2) |
| 196 | /** 切换树形展开/收缩状态 */ | 196 | /** 切换树形展开/收缩状态 */ |
| 197 | const isExpanded = ref(true); | 197 | const isExpanded = ref(true); |
| 198 | -function toggleExpand() { | 198 | +function handleExpand() { |
| 199 | isExpanded.value = !isExpanded.value; | 199 | isExpanded.value = !isExpanded.value; |
| 200 | tableRef.value?.setAllTreeExpand(isExpanded.value); | 200 | tableRef.value?.setAllTreeExpand(isExpanded.value); |
| 201 | } | 201 | } |
| @@ -303,7 +303,7 @@ onMounted(() => { | @@ -303,7 +303,7 @@ onMounted(() => { | ||
| 303 | v-model:hidden-search="hiddenSearchBar" | 303 | v-model:hidden-search="hiddenSearchBar" |
| 304 | > | 304 | > |
| 305 | #if (${table.templateType} == 2) | 305 | #if (${table.templateType} == 2) |
| 306 | - <Button @click="toggleExpand" class="mr-2"> | 306 | + <Button @click="handleExpand" class="mr-2"> |
| 307 | {{ isExpanded ? '收缩' : '展开' }} | 307 | {{ isExpanded ? '收缩' : '展开' }} |
| 308 | </Button> | 308 | </Button> |
| 309 | #end | 309 | #end |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm
| @@ -70,7 +70,7 @@ async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { | @@ -70,7 +70,7 @@ async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { | ||
| 70 | duration: 0, | 70 | duration: 0, |
| 71 | }); | 71 | }); |
| 72 | try { | 72 | try { |
| 73 | - await delete${subSimpleClassName}(row.id as number); | 73 | + await delete${subSimpleClassName}(row.id!); |
| 74 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); | 74 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); |
| 75 | await getList(); | 75 | await getList(); |
| 76 | } finally { | 76 | } finally { |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm
| @@ -54,14 +54,14 @@ const [FormModal, formModalApi] = useVbenModal({ | @@ -54,14 +54,14 @@ const [FormModal, formModalApi] = useVbenModal({ | ||
| 54 | 54 | ||
| 55 | /** 切换树形展开/收缩状态 */ | 55 | /** 切换树形展开/收缩状态 */ |
| 56 | const isExpanded = ref(true); | 56 | const isExpanded = ref(true); |
| 57 | -function toggleExpand() { | 57 | +function handleExpand() { |
| 58 | isExpanded.value = !isExpanded.value; | 58 | isExpanded.value = !isExpanded.value; |
| 59 | gridApi.grid.setAllTreeExpand(isExpanded.value); | 59 | gridApi.grid.setAllTreeExpand(isExpanded.value); |
| 60 | } | 60 | } |
| 61 | #end | 61 | #end |
| 62 | 62 | ||
| 63 | /** 刷新表格 */ | 63 | /** 刷新表格 */ |
| 64 | -function onRefresh() { | 64 | +function handleRefresh() { |
| 65 | #if ($table.templateType == 12) ## 内嵌情况 | 65 | #if ($table.templateType == 12) ## 内嵌情况 |
| 66 | gridApi.reload(); | 66 | gridApi.reload(); |
| 67 | #else | 67 | #else |
| @@ -93,9 +93,9 @@ async function handleDelete(row: ${apiName}.${simpleClassName}) { | @@ -93,9 +93,9 @@ async function handleDelete(row: ${apiName}.${simpleClassName}) { | ||
| 93 | duration: 0, | 93 | duration: 0, |
| 94 | }); | 94 | }); |
| 95 | try { | 95 | try { |
| 96 | - await delete${simpleClassName}(row.id as number); | 96 | + await delete${simpleClassName}(row.id!); |
| 97 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); | 97 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); |
| 98 | - onRefresh(); | 98 | + handleRefresh(); |
| 99 | } finally { | 99 | } finally { |
| 100 | hideLoading(); | 100 | hideLoading(); |
| 101 | } | 101 | } |
| @@ -113,7 +113,7 @@ async function handleDeleteBatch() { | @@ -113,7 +113,7 @@ async function handleDeleteBatch() { | ||
| 113 | await delete${simpleClassName}List(checkedIds.value); | 113 | await delete${simpleClassName}List(checkedIds.value); |
| 114 | checkedIds.value = []; | 114 | checkedIds.value = []; |
| 115 | message.success($t('ui.actionMessage.deleteSuccess')); | 115 | message.success($t('ui.actionMessage.deleteSuccess')); |
| 116 | - onRefresh(); | 116 | + handleRefresh(); |
| 117 | } finally { | 117 | } finally { |
| 118 | hideLoading(); | 118 | hideLoading(); |
| 119 | } | 119 | } |
| @@ -209,7 +209,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | @@ -209,7 +209,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||
| 209 | 209 | ||
| 210 | <template> | 210 | <template> |
| 211 | <Page auto-content-height> | 211 | <Page auto-content-height> |
| 212 | - <FormModal @success="onRefresh" /> | 212 | + <FormModal @success="handleRefresh" /> |
| 213 | #if ($table.templateType == 11) ## erp情况 | 213 | #if ($table.templateType == 11) ## erp情况 |
| 214 | <div> | 214 | <div> |
| 215 | #end | 215 | #end |
| @@ -244,7 +244,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | @@ -244,7 +244,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||
| 244 | { | 244 | { |
| 245 | label: isExpanded ? '收缩' : '展开', | 245 | label: isExpanded ? '收缩' : '展开', |
| 246 | type: 'primary', | 246 | type: 'primary', |
| 247 | - onClick: toggleExpand, | 247 | + onClick: handleExpand, |
| 248 | }, | 248 | }, |
| 249 | #end | 249 | #end |
| 250 | { | 250 | { |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm
| @@ -63,9 +63,9 @@ async function handleDelete(row: ${apiName}.${subSimpleClassName}) { | @@ -63,9 +63,9 @@ async function handleDelete(row: ${apiName}.${subSimpleClassName}) { | ||
| 63 | duration: 0, | 63 | duration: 0, |
| 64 | }); | 64 | }); |
| 65 | try { | 65 | try { |
| 66 | - await delete${subSimpleClassName}(row.id as number); | 66 | + await delete${subSimpleClassName}(row.id!); |
| 67 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); | 67 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); |
| 68 | - onRefresh(); | 68 | + handleRefresh(); |
| 69 | } finally { | 69 | } finally { |
| 70 | hideLoading(); | 70 | hideLoading(); |
| 71 | } | 71 | } |
| @@ -82,7 +82,7 @@ async function handleDeleteBatch() { | @@ -82,7 +82,7 @@ async function handleDeleteBatch() { | ||
| 82 | await delete${subSimpleClassName}List(checkedIds.value); | 82 | await delete${subSimpleClassName}List(checkedIds.value); |
| 83 | checkedIds.value = []; | 83 | checkedIds.value = []; |
| 84 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); | 84 | message.success($t('ui.actionMessage.deleteSuccess', [row.id])); |
| 85 | - onRefresh(); | 85 | + handleRefresh(); |
| 86 | } finally { | 86 | } finally { |
| 87 | hideLoading(); | 87 | hideLoading(); |
| 88 | } | 88 | } |
| @@ -154,7 +154,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | @@ -154,7 +154,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||
| 154 | }); | 154 | }); |
| 155 | 155 | ||
| 156 | /** 刷新表格 */ | 156 | /** 刷新表格 */ |
| 157 | -async function onRefresh() { | 157 | +async function handleRefresh() { |
| 158 | #if ($table.templateType == 11) ## erp | 158 | #if ($table.templateType == 11) ## erp |
| 159 | await gridApi.query(); | 159 | await gridApi.query(); |
| 160 | #else | 160 | #else |
| @@ -174,7 +174,7 @@ watch( | @@ -174,7 +174,7 @@ watch( | ||
| 174 | return; | 174 | return; |
| 175 | } | 175 | } |
| 176 | await nextTick(); | 176 | await nextTick(); |
| 177 | - await onRefresh() | 177 | + await handleRefresh() |
| 178 | }, | 178 | }, |
| 179 | { immediate: true }, | 179 | { immediate: true }, |
| 180 | ); | 180 | ); |
| @@ -182,7 +182,7 @@ watch( | @@ -182,7 +182,7 @@ watch( | ||
| 182 | 182 | ||
| 183 | <template> | 183 | <template> |
| 184 | #if ($table.templateType == 11) ## erp | 184 | #if ($table.templateType == 11) ## erp |
| 185 | - <FormModal @success="onRefresh" /> | 185 | + <FormModal @success="handleRefresh" /> |
| 186 | <Grid table-title="${subTable.classComment}列表"> | 186 | <Grid table-title="${subTable.classComment}列表"> |
| 187 | <template #toolbar-tools> | 187 | <template #toolbar-tools> |
| 188 | <TableAction | 188 | <TableAction |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/index.vue.vm
| @@ -195,7 +195,7 @@ try { | @@ -195,7 +195,7 @@ try { | ||
| 195 | #if (${table.templateType} == 2) | 195 | #if (${table.templateType} == 2) |
| 196 | /** 切换树形展开/收缩状态 */ | 196 | /** 切换树形展开/收缩状态 */ |
| 197 | const isExpanded = ref(true); | 197 | const isExpanded = ref(true); |
| 198 | -function toggleExpand() { | 198 | +function handleExpand() { |
| 199 | isExpanded.value = !isExpanded.value; | 199 | isExpanded.value = !isExpanded.value; |
| 200 | tableRef.value?.setAllTreeExpand(isExpanded.value); | 200 | tableRef.value?.setAllTreeExpand(isExpanded.value); |
| 201 | } | 201 | } |
| @@ -306,7 +306,7 @@ onMounted(() => { | @@ -306,7 +306,7 @@ onMounted(() => { | ||
| 306 | v-model:hidden-search="hiddenSearchBar" | 306 | v-model:hidden-search="hiddenSearchBar" |
| 307 | > | 307 | > |
| 308 | #if (${table.templateType} == 2) | 308 | #if (${table.templateType} == 2) |
| 309 | - <el-button @click="toggleExpand" class="mr-2"> | 309 | + <el-button @click="handleExpand" class="mr-2"> |
| 310 | {{ isExpanded ? '收缩' : '展开' }} | 310 | {{ isExpanded ? '收缩' : '展开' }} |
| 311 | </el-button> | 311 | </el-button> |
| 312 | #end | 312 | #end |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/index.vue.vm
| @@ -54,14 +54,14 @@ const [FormModal, formModalApi] = useVbenModal({ | @@ -54,14 +54,14 @@ const [FormModal, formModalApi] = useVbenModal({ | ||
| 54 | 54 | ||
| 55 | /** 切换树形展开/收缩状态 */ | 55 | /** 切换树形展开/收缩状态 */ |
| 56 | const isExpanded = ref(true); | 56 | const isExpanded = ref(true); |
| 57 | -function toggleExpand() { | 57 | +function handleExpand() { |
| 58 | isExpanded.value = !isExpanded.value; | 58 | isExpanded.value = !isExpanded.value; |
| 59 | gridApi.grid.setAllTreeExpand(isExpanded.value); | 59 | gridApi.grid.setAllTreeExpand(isExpanded.value); |
| 60 | } | 60 | } |
| 61 | #end | 61 | #end |
| 62 | 62 | ||
| 63 | /** 刷新表格 */ | 63 | /** 刷新表格 */ |
| 64 | -function onRefresh() { | 64 | +function handleRefresh() { |
| 65 | #if ($table.templateType == 12) ## 内嵌情况 | 65 | #if ($table.templateType == 12) ## 内嵌情况 |
| 66 | gridApi.reload(); | 66 | gridApi.reload(); |
| 67 | #else | 67 | #else |
| @@ -92,9 +92,9 @@ async function handleDelete(row: ${apiName}.${simpleClassName}) { | @@ -92,9 +92,9 @@ async function handleDelete(row: ${apiName}.${simpleClassName}) { | ||
| 92 | text: $t('ui.actionMessage.deleting', [row.id]), | 92 | text: $t('ui.actionMessage.deleting', [row.id]), |
| 93 | }); | 93 | }); |
| 94 | try { | 94 | try { |
| 95 | - await delete${simpleClassName}(row.id as number); | 95 | + await delete${simpleClassName}(row.id!); |
| 96 | ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.id])); | 96 | ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.id])); |
| 97 | - onRefresh(); | 97 | + handleRefresh(); |
| 98 | } finally { | 98 | } finally { |
| 99 | loadingInstance.close(); | 99 | loadingInstance.close(); |
| 100 | } | 100 | } |
| @@ -111,7 +111,7 @@ async function handleDeleteBatch() { | @@ -111,7 +111,7 @@ async function handleDeleteBatch() { | ||
| 111 | await delete${simpleClassName}List(checkedIds.value); | 111 | await delete${simpleClassName}List(checkedIds.value); |
| 112 | checkedIds.value = []; | 112 | checkedIds.value = []; |
| 113 | ElMessage.success($t('ui.actionMessage.deleteSuccess')); | 113 | ElMessage.success($t('ui.actionMessage.deleteSuccess')); |
| 114 | - onRefresh(); | 114 | + handleRefresh(); |
| 115 | } finally { | 115 | } finally { |
| 116 | loadingInstance.close(); | 116 | loadingInstance.close(); |
| 117 | } | 117 | } |
| @@ -207,7 +207,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | @@ -207,7 +207,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||
| 207 | 207 | ||
| 208 | <template> | 208 | <template> |
| 209 | <Page auto-content-height> | 209 | <Page auto-content-height> |
| 210 | - <FormModal @success="onRefresh" /> | 210 | + <FormModal @success="handleRefresh" /> |
| 211 | #if ($table.templateType == 11) ## erp情况 | 211 | #if ($table.templateType == 11) ## erp情况 |
| 212 | <div> | 212 | <div> |
| 213 | #end | 213 | #end |
| @@ -242,7 +242,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | @@ -242,7 +242,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||
| 242 | { | 242 | { |
| 243 | label: isExpanded ? '收缩' : '展开', | 243 | label: isExpanded ? '收缩' : '展开', |
| 244 | type: 'primary', | 244 | type: 'primary', |
| 245 | - onClick: toggleExpand, | 245 | + onClick: handleExpand, |
| 246 | }, | 246 | }, |
| 247 | #end | 247 | #end |
| 248 | { | 248 | { |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/modules/list_sub_erp.vue.vm
| @@ -62,9 +62,9 @@ async function handleDelete(row: ${apiName}.${subSimpleClassName}) { | @@ -62,9 +62,9 @@ async function handleDelete(row: ${apiName}.${subSimpleClassName}) { | ||
| 62 | text: $t('ui.actionMessage.deleting', [row.id]), | 62 | text: $t('ui.actionMessage.deleting', [row.id]), |
| 63 | }); | 63 | }); |
| 64 | try { | 64 | try { |
| 65 | - await delete${subSimpleClassName}(row.id as number); | 65 | + await delete${subSimpleClassName}(row.id!); |
| 66 | ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.id])); | 66 | ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.id])); |
| 67 | - onRefresh(); | 67 | + handleRefresh(); |
| 68 | } finally { | 68 | } finally { |
| 69 | loadingInstance.close(); | 69 | loadingInstance.close(); |
| 70 | } | 70 | } |
| @@ -80,7 +80,7 @@ async function handleDeleteBatch() { | @@ -80,7 +80,7 @@ async function handleDeleteBatch() { | ||
| 80 | await delete${subSimpleClassName}List(checkedIds.value); | 80 | await delete${subSimpleClassName}List(checkedIds.value); |
| 81 | checkedIds.value = []; | 81 | checkedIds.value = []; |
| 82 | ElMessage.success($t('ui.actionMessage.deleteSuccess')); | 82 | ElMessage.success($t('ui.actionMessage.deleteSuccess')); |
| 83 | - onRefresh(); | 83 | + handleRefresh(); |
| 84 | } finally { | 84 | } finally { |
| 85 | loadingInstance.close(); | 85 | loadingInstance.close(); |
| 86 | } | 86 | } |
| @@ -152,7 +152,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | @@ -152,7 +152,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||
| 152 | }); | 152 | }); |
| 153 | 153 | ||
| 154 | /** 刷新表格 */ | 154 | /** 刷新表格 */ |
| 155 | -async function onRefresh() { | 155 | +async function handleRefresh() { |
| 156 | #if ($table.templateType == 11) ## erp | 156 | #if ($table.templateType == 11) ## erp |
| 157 | await gridApi.query(); | 157 | await gridApi.query(); |
| 158 | #else | 158 | #else |
| @@ -172,7 +172,7 @@ watch( | @@ -172,7 +172,7 @@ watch( | ||
| 172 | return; | 172 | return; |
| 173 | } | 173 | } |
| 174 | await nextTick(); | 174 | await nextTick(); |
| 175 | - await onRefresh() | 175 | + await handleRefresh() |
| 176 | }, | 176 | }, |
| 177 | { immediate: true }, | 177 | { immediate: true }, |
| 178 | ); | 178 | ); |
| @@ -180,7 +180,7 @@ watch( | @@ -180,7 +180,7 @@ watch( | ||
| 180 | 180 | ||
| 181 | <template> | 181 | <template> |
| 182 | #if ($table.templateType == 11) ## erp | 182 | #if ($table.templateType == 11) ## erp |
| 183 | - <FormModal @success="onRefresh" /> | 183 | + <FormModal @success="handleRefresh" /> |
| 184 | <Grid table-title="${subTable.classComment}列表"> | 184 | <Grid table-title="${subTable.classComment}列表"> |
| 185 | <template #toolbar-tools> | 185 | <template #toolbar-tools> |
| 186 | <TableAction | 186 | <TableAction |