Commit b7ab10305f050d82eaf352fe7944debc8c1366f7
1 parent
7c4859b5
fix: 代码生成批量删除相关 setCheckedIds -> handleRowCheckboxChange、deleteIds -> checkedIds 然后注释去掉
Showing
4 changed files
with
28 additions
and
28 deletions
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm
| @@ -167,7 +167,7 @@ async function onDeleteBatch() { | @@ -167,7 +167,7 @@ async function onDeleteBatch() { | ||
| 167 | key: 'action_process_msg', | 167 | key: 'action_process_msg', |
| 168 | }); | 168 | }); |
| 169 | try { | 169 | try { |
| 170 | - await delete${simpleClassName}ListByIds(deleteIds.value); | 170 | + await delete${simpleClassName}ListByIds(checkedIds.value); |
| 171 | message.success( $t('ui.actionMessage.deleteSuccess') ); | 171 | message.success( $t('ui.actionMessage.deleteSuccess') ); |
| 172 | await getList(); | 172 | await getList(); |
| 173 | } finally { | 173 | } finally { |
| @@ -175,13 +175,13 @@ async function onDeleteBatch() { | @@ -175,13 +175,13 @@ async function onDeleteBatch() { | ||
| 175 | } | 175 | } |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | -const deleteIds = ref<number[]>([]) // 待删除${table.classComment} ID | ||
| 179 | -function setDeleteIds({ | 178 | +const checkedIds = ref<number[]>([]) |
| 179 | +function handleRowCheckboxChange({ | ||
| 180 | records, | 180 | records, |
| 181 | }: { | 181 | }: { |
| 182 | records: ${simpleClassName}Api.${simpleClassName}[]; | 182 | records: ${simpleClassName}Api.${simpleClassName}[]; |
| 183 | }) { | 183 | }) { |
| 184 | - deleteIds.value = records.map((item) => item.id); | 184 | + checkedIds.value = records.map((item) => item.id); |
| 185 | } | 185 | } |
| 186 | #end | 186 | #end |
| 187 | 187 | ||
| @@ -336,7 +336,7 @@ onMounted(() => { | @@ -336,7 +336,7 @@ onMounted(() => { | ||
| 336 | type="primary" | 336 | type="primary" |
| 337 | danger | 337 | danger |
| 338 | class="ml-2" | 338 | class="ml-2" |
| 339 | - :disabled="isEmpty(deleteIds)" | 339 | + :disabled="isEmpty(checkedIds)" |
| 340 | @click="onDeleteBatch" | 340 | @click="onDeleteBatch" |
| 341 | v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']" | 341 | v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']" |
| 342 | > | 342 | > |
| @@ -368,8 +368,8 @@ onMounted(() => { | @@ -368,8 +368,8 @@ onMounted(() => { | ||
| 368 | show-overflow | 368 | show-overflow |
| 369 | :loading="loading" | 369 | :loading="loading" |
| 370 | #if ($table.templateType != 2 && $deleteBatchEnable) | 370 | #if ($table.templateType != 2 && $deleteBatchEnable) |
| 371 | - @checkboxAll="setDeleteIds" | ||
| 372 | - @checkboxChange="setDeleteIds" | 371 | + @checkboxAll="handleRowCheckboxChange" |
| 372 | + @checkboxChange="handleRowCheckboxChange" | ||
| 373 | #end | 373 | #end |
| 374 | > | 374 | > |
| 375 | #if ($table.templateType != 2 && $deleteBatchEnable) | 375 | #if ($table.templateType != 2 && $deleteBatchEnable) |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm
| @@ -91,7 +91,7 @@ async function onDeleteBatch() { | @@ -91,7 +91,7 @@ async function onDeleteBatch() { | ||
| 91 | key: 'action_process_msg', | 91 | key: 'action_process_msg', |
| 92 | }); | 92 | }); |
| 93 | try { | 93 | try { |
| 94 | - await delete${subSimpleClassName}ListByIds(deleteIds.value); | 94 | + await delete${subSimpleClassName}ListByIds(checkedIds.value); |
| 95 | message.success( $t('ui.actionMessage.deleteSuccess') ); | 95 | message.success( $t('ui.actionMessage.deleteSuccess') ); |
| 96 | await getList(); | 96 | await getList(); |
| 97 | } finally { | 97 | } finally { |
| @@ -99,13 +99,13 @@ async function onDeleteBatch() { | @@ -99,13 +99,13 @@ async function onDeleteBatch() { | ||
| 99 | } | 99 | } |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | -const deleteIds = ref<number[]>([]) // 待删除${subTable.classComment} ID | ||
| 103 | -function setDeleteIds({ | 102 | +const checkedIds = ref<number[]>([]) |
| 103 | +function handleRowCheckboxChange({ | ||
| 104 | records, | 104 | records, |
| 105 | }: { | 105 | }: { |
| 106 | records: ${simpleClassName}Api.${subSimpleClassName}[]; | 106 | records: ${simpleClassName}Api.${subSimpleClassName}[]; |
| 107 | }) { | 107 | }) { |
| 108 | - deleteIds.value = records.map((item) => item.id); | 108 | + checkedIds.value = records.map((item) => item.id); |
| 109 | } | 109 | } |
| 110 | #end | 110 | #end |
| 111 | #end | 111 | #end |
| @@ -310,7 +310,7 @@ onMounted(() => { | @@ -310,7 +310,7 @@ onMounted(() => { | ||
| 310 | type="primary" | 310 | type="primary" |
| 311 | danger | 311 | danger |
| 312 | class="ml-2" | 312 | class="ml-2" |
| 313 | - :disabled="isEmpty(deleteIds)" | 313 | + :disabled="isEmpty(checkedIds)" |
| 314 | @click="onDeleteBatch" | 314 | @click="onDeleteBatch" |
| 315 | v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']" | 315 | v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']" |
| 316 | > | 316 | > |
| @@ -325,8 +325,8 @@ onMounted(() => { | @@ -325,8 +325,8 @@ onMounted(() => { | ||
| 325 | show-overflow | 325 | show-overflow |
| 326 | :loading="loading" | 326 | :loading="loading" |
| 327 | #if ($deleteBatchEnable) | 327 | #if ($deleteBatchEnable) |
| 328 | - @checkboxAll="setDeleteIds" | ||
| 329 | - @checkboxChange="setDeleteIds" | 328 | + @checkboxAll="handleRowCheckboxChange" |
| 329 | + @checkboxChange="handleRowCheckboxChange" | ||
| 330 | #end | 330 | #end |
| 331 | > | 331 | > |
| 332 | #if ($deleteBatchEnable) | 332 | #if ($deleteBatchEnable) |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm
| @@ -101,7 +101,7 @@ async function handleDeleteBatch() { | @@ -101,7 +101,7 @@ async function handleDeleteBatch() { | ||
| 101 | key: 'action_key_msg', | 101 | key: 'action_key_msg', |
| 102 | }); | 102 | }); |
| 103 | try { | 103 | try { |
| 104 | - await delete${simpleClassName}ListByIds(deleteIds.value); | 104 | + await delete${simpleClassName}ListByIds(checkedIds.value); |
| 105 | message.success({ | 105 | message.success({ |
| 106 | content: $t('ui.actionMessage.deleteSuccess'), | 106 | content: $t('ui.actionMessage.deleteSuccess'), |
| 107 | key: 'action_key_msg', | 107 | key: 'action_key_msg', |
| @@ -112,13 +112,13 @@ async function handleDeleteBatch() { | @@ -112,13 +112,13 @@ async function handleDeleteBatch() { | ||
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | -const deleteIds = ref<number[]>([]) // 待删除${table.classComment} ID | ||
| 116 | -function setDeleteIds({ | 115 | +const checkedIds = ref<number[]>([]) |
| 116 | +function handleRowCheckboxChange({ | ||
| 117 | records, | 117 | records, |
| 118 | }: { | 118 | }: { |
| 119 | records: ${simpleClassName}Api.${simpleClassName}[]; | 119 | records: ${simpleClassName}Api.${simpleClassName}[]; |
| 120 | }) { | 120 | }) { |
| 121 | - deleteIds.value = records.map((item) => item.id); | 121 | + checkedIds.value = records.map((item) => item.id); |
| 122 | } | 122 | } |
| 123 | #end | 123 | #end |
| 124 | 124 | ||
| @@ -192,8 +192,8 @@ const [Grid, gridApi] = useVbenVxeGrid({ | @@ -192,8 +192,8 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||
| 192 | }, | 192 | }, |
| 193 | #end | 193 | #end |
| 194 | #if($deleteBatchEnable) | 194 | #if($deleteBatchEnable) |
| 195 | - checkboxAll: setDeleteIds, | ||
| 196 | - checkboxChange: setDeleteIds, | 195 | + checkboxAll: handleRowCheckboxChange, |
| 196 | + checkboxChange: handleRowCheckboxChange, | ||
| 197 | #end | 197 | #end |
| 198 | } | 198 | } |
| 199 | #end | 199 | #end |
| @@ -254,7 +254,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | @@ -254,7 +254,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||
| 254 | type: 'primary', | 254 | type: 'primary', |
| 255 | danger: true, | 255 | danger: true, |
| 256 | icon: ACTION_ICON.DELETE, | 256 | icon: ACTION_ICON.DELETE, |
| 257 | - disabled: isEmpty(deleteIds), | 257 | + disabled: isEmpty(checkedIds), |
| 258 | auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'], | 258 | auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'], |
| 259 | onClick: handleDeleteBatch, | 259 | onClick: handleDeleteBatch, |
| 260 | }, | 260 | }, |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm
| @@ -81,7 +81,7 @@ async function handleDeleteBatch() { | @@ -81,7 +81,7 @@ async function handleDeleteBatch() { | ||
| 81 | key: 'action_key_msg', | 81 | key: 'action_key_msg', |
| 82 | }); | 82 | }); |
| 83 | try { | 83 | try { |
| 84 | - await delete${subSimpleClassName}ListByIds(deleteIds.value); | 84 | + await delete${subSimpleClassName}ListByIds(checkedIds.value); |
| 85 | message.success({ | 85 | message.success({ |
| 86 | content: $t('ui.actionMessage.deleteSuccess', [row.id]), | 86 | content: $t('ui.actionMessage.deleteSuccess', [row.id]), |
| 87 | key: 'action_key_msg', | 87 | key: 'action_key_msg', |
| @@ -92,13 +92,13 @@ async function handleDeleteBatch() { | @@ -92,13 +92,13 @@ async function handleDeleteBatch() { | ||
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | -const deleteIds = ref<number[]>([]) // 待删除${subTable.classComment} ID | ||
| 96 | -function setDeleteIds({ | 95 | +const checkedIds = ref<number[]>([]) |
| 96 | +function handleRowCheckboxChange({ | ||
| 97 | records, | 97 | records, |
| 98 | }: { | 98 | }: { |
| 99 | records: ${simpleClassName}Api.${subSimpleClassName}[]; | 99 | records: ${simpleClassName}Api.${subSimpleClassName}[]; |
| 100 | }) { | 100 | }) { |
| 101 | - deleteIds.value = records.map((item) => item.id); | 101 | + checkedIds.value = records.map((item) => item.id); |
| 102 | } | 102 | } |
| 103 | #end | 103 | #end |
| 104 | 104 | ||
| @@ -151,8 +151,8 @@ const [Grid, gridApi] = useVbenVxeGrid({ | @@ -151,8 +151,8 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||
| 151 | } as VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>, | 151 | } as VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>, |
| 152 | #if (${table.templateType} == 11 && $deleteBatchEnable) | 152 | #if (${table.templateType} == 11 && $deleteBatchEnable) |
| 153 | gridEvents:{ | 153 | gridEvents:{ |
| 154 | - checkboxAll: setDeleteIds, | ||
| 155 | - checkboxChange: setDeleteIds, | 154 | + checkboxAll: handleRowCheckboxChange, |
| 155 | + checkboxChange: handleRowCheckboxChange, | ||
| 156 | } | 156 | } |
| 157 | #end | 157 | #end |
| 158 | }); | 158 | }); |
| @@ -204,7 +204,7 @@ watch( | @@ -204,7 +204,7 @@ watch( | ||
| 204 | type: 'primary', | 204 | type: 'primary', |
| 205 | danger: true, | 205 | danger: true, |
| 206 | icon: ACTION_ICON.DELETE, | 206 | icon: ACTION_ICON.DELETE, |
| 207 | - disabled: isEmpty(deleteIds), | 207 | + disabled: isEmpty(checkedIds), |
| 208 | auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'], | 208 | auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'], |
| 209 | onClick: handleDeleteBatch, | 209 | onClick: handleDeleteBatch, |
| 210 | }, | 210 | }, |