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