This commit is contained in:
xingyu4j
2025-05-20 16:48:43 +08:00
21 changed files with 94 additions and 121 deletions

View File

@@ -10,7 +10,6 @@ import { h } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { handleTree } from '@vben/utils';
import { z } from '#/adapter/form';
import { getDataSourceConfigList } from '#/api/infra/data-source-config';
import { getMenuList } from '#/api/system/menu';
import { $t } from '#/locales';
@@ -155,18 +154,6 @@ export function useGenerationInfoBaseFormSchema(): VbenFormSchema[] {
},
rules: 'selectRequired',
},
{
// TODO @puhui999使用后端统一配置。因为一般需要批量的团队会一直需要。不需要的一般一直不需要哈。
component: 'RadioGroup',
fieldName: 'deleteBatch',
label: '批量删除?',
help: '是否生成批量删除接口',
componentProps: {
options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING, 'boolean'),
class: 'w-full',
},
rules: z.boolean().default(false),
},
{
fieldName: 'parentMenuId',
label: '上级菜单',

View File

@@ -2,7 +2,7 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { Demo01ContactApi } from '#/api/infra/demo/demo01';
import { computed, ref } from 'vue';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
@@ -66,17 +66,6 @@ async function handleDelete(row: Demo01ContactApi.Demo01Contact) {
}
}
// TODO @puhui999:1/** 批量删除示例联系人 */ 是不是放在 deleteIds 上面2showDeleteBatchBtn 是不是直接 disabled 哪里判断哈;
const deleteIds = ref<number[]>([]); // 待删除示例联系人 ID
const showDeleteBatchBtn = computed(() => isEmpty(deleteIds.value));
function setDeleteIds({
records,
}: {
records: Demo01ContactApi.Demo01Contact[];
}) {
deleteIds.value = records.map((item) => item.id);
}
/** 批量删除示例联系人 */
async function handleDeleteBatch() {
const hideLoading = message.loading({
@@ -95,6 +84,15 @@ async function handleDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // 待删除示例联系人 ID
function setDeleteIds({
records,
}: {
records: Demo01ContactApi.Demo01Contact[];
}) {
deleteIds.value = records.map((item) => item.id);
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
@@ -159,7 +157,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type: 'primary',
icon: ACTION_ICON.DELETE,
auth: ['infra:demo01-contact:delete'],
disabled: showDeleteBatchBtn,
disabled: isEmpty(deleteIds),
onClick: handleDeleteBatch,
},
]"

View File

@@ -112,7 +112,7 @@ export function useGridColumns(): VxeTableGridOptions<Demo02CategoryApi.Demo02Ca
},
{
title: '操作',
width: 180,
width: 220,
fixed: 'right',
slots: { default: 'actions' },
},

View File

@@ -150,7 +150,6 @@ export function useGridColumns(
minWidth: 200,
align: 'center',
fixed: 'right',
headerAlign: 'center',
showOverflow: false,
cellRender: {
attrs: {
@@ -288,7 +287,7 @@ export function useDemo03CourseGridColumns(
minWidth: 200,
align: 'center',
fixed: 'right',
headerAlign: 'center',
showOverflow: false,
cellRender: {
attrs: {
@@ -426,7 +425,7 @@ export function useDemo03GradeGridColumns(
minWidth: 200,
align: 'center',
fixed: 'right',
headerAlign: 'center',
showOverflow: false,
cellRender: {
attrs: {

View File

@@ -5,7 +5,7 @@ import type {
} from '#/adapter/vxe-table';
import type { Demo03StudentApi } from '#/api/infra/demo/demo03/erp';
import { computed, h, ref } from 'vue';
import { h, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus, Trash2 } from '@vben/icons';
@@ -67,8 +67,6 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
}
}
const deleteIds = ref<number[]>([]); // 待删除学生 ID
const showDeleteBatchBtn = computed(() => isEmpty(deleteIds.value));
/** 批量删除学生 */
async function onDeleteBatch() {
const hideLoading = message.loading({
@@ -85,6 +83,15 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // 待删除学生 ID
function setDeleteIds({
records,
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
deleteIds.value = records.map((item) => item.id);
}
/** 导出表格 */
async function onExport() {
const data = await exportDemo03Student(await gridApi.formApi.getValues());
@@ -143,20 +150,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
cellClick: ({ row }: { row: Demo03StudentApi.Demo03Student }) => {
selectDemo03Student.value = row;
},
checkboxAll: ({
records,
}: {
records: Demo03StudentApi.Demo03Student[];
}) => {
deleteIds.value = records.map((item) => item.id);
},
checkboxChange: ({
records,
}: {
records: Demo03StudentApi.Demo03Student[];
}) => {
deleteIds.value = records.map((item) => item.id);
},
checkboxAll: setDeleteIds,
checkboxChange: setDeleteIds,
},
});
</script>
@@ -190,7 +185,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type="primary"
danger
class="ml-2"
:disabled="showDeleteBatchBtn"
:disabled="isEmpty(deleteIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@@ -5,7 +5,7 @@ import type {
} from '#/adapter/vxe-table';
import type { Demo03StudentApi } from '#/api/infra/demo/demo03/erp';
import { computed, h, nextTick, ref, watch } from 'vue';
import { h, nextTick, ref, watch } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { Plus, Trash2 } from '@vben/icons';
@@ -66,15 +66,6 @@ async function onDelete(row: Demo03StudentApi.Demo03Course) {
}
}
const deleteIds = ref<number[]>([]); // 待删除学生课程 ID
const showDeleteBatchBtn = computed(() => isEmpty(deleteIds.value));
function setDeleteIds({
records,
}: {
records: Demo03StudentApi.Demo03Course[];
}) {
deleteIds.value = records.map((item) => item.id);
}
/** 批量删除学生课程 */
async function onDeleteBatch() {
const hideLoading = message.loading({
@@ -91,6 +82,15 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // 待删除学生课程 ID
function setDeleteIds({
records,
}: {
records: Demo03StudentApi.Demo03Course[];
}) {
deleteIds.value = records.map((item) => item.id);
}
/** 表格操作按钮的回调函数 */
function onActionClick({
code,
@@ -184,7 +184,7 @@ watch(
type="primary"
danger
class="ml-2"
:disabled="showDeleteBatchBtn"
:disabled="isEmpty(deleteIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@@ -5,7 +5,7 @@ import type {
} from '#/adapter/vxe-table';
import type { Demo03StudentApi } from '#/api/infra/demo/demo03/erp';
import { computed, h, nextTick, ref, watch } from 'vue';
import { h, nextTick, ref, watch } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { Plus, Trash2 } from '@vben/icons';
@@ -66,15 +66,6 @@ async function onDelete(row: Demo03StudentApi.Demo03Grade) {
}
}
const deleteIds = ref<number[]>([]); // 待删除学生班级 ID
const showDeleteBatchBtn = computed(() => isEmpty(deleteIds.value));
function setDeleteIds({
records,
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
deleteIds.value = records.map((item) => item.id);
}
/** 批量删除学生班级 */
async function onDeleteBatch() {
const hideLoading = message.loading({
@@ -91,6 +82,15 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // 待删除学生班级 ID
function setDeleteIds({
records,
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
deleteIds.value = records.map((item) => item.id);
}
/** 表格操作按钮的回调函数 */
function onActionClick({
code,
@@ -184,7 +184,7 @@ watch(
type="primary"
danger
class="ml-2"
:disabled="showDeleteBatchBtn"
:disabled="isEmpty(deleteIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@@ -151,7 +151,6 @@ export function useGridColumns(
minWidth: 200,
align: 'center',
fixed: 'right',
headerAlign: 'center',
showOverflow: false,
cellRender: {
attrs: {
@@ -200,7 +199,7 @@ export function useDemo03CourseGridEditColumns(
minWidth: 60,
align: 'center',
fixed: 'right',
headerAlign: 'center',
showOverflow: false,
cellRender: {
attrs: {

View File

@@ -5,7 +5,7 @@ import type {
} from '#/adapter/vxe-table';
import type { Demo03StudentApi } from '#/api/infra/demo/demo03/inner';
import { computed, h, ref } from 'vue';
import { h, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus, Trash2 } from '@vben/icons';
@@ -66,15 +66,6 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
}
}
const deleteIds = ref<number[]>([]); // 待删除学生 ID
const showDeleteBatchBtn = computed(() => isEmpty(deleteIds.value));
function setDeleteIds({
records,
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
deleteIds.value = records.map((item) => item.id);
}
/** 批量删除学生 */
async function onDeleteBatch() {
const hideLoading = message.loading({
@@ -91,6 +82,15 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // 待删除学生 ID
function setDeleteIds({
records,
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
deleteIds.value = records.map((item) => item.id);
}
/** 导出表格 */
async function onExport() {
const data = await exportDemo03Student(await gridApi.formApi.getValues());
@@ -190,7 +190,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type="primary"
danger
class="ml-2"
:disabled="showDeleteBatchBtn"
:disabled="isEmpty(deleteIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@@ -150,7 +150,6 @@ export function useGridColumns(
minWidth: 200,
align: 'center',
fixed: 'right',
headerAlign: 'center',
showOverflow: false,
cellRender: {
attrs: {
@@ -199,7 +198,7 @@ export function useDemo03CourseGridEditColumns(
minWidth: 60,
align: 'center',
fixed: 'right',
headerAlign: 'center',
showOverflow: false,
cellRender: {
attrs: {

View File

@@ -5,7 +5,7 @@ import type {
} from '#/adapter/vxe-table';
import type { Demo03StudentApi } from '#/api/infra/demo/demo03/normal';
import { computed, h, ref } from 'vue';
import { h, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus, Trash2 } from '@vben/icons';
@@ -62,7 +62,6 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
}
const deleteIds = ref<number[]>([]); // 待删除学生 ID
const showDeleteBatchBtn = computed(() => isEmpty(deleteIds.value));
function setDeleteIds({
records,
}: {
@@ -174,7 +173,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type="primary"
danger
class="ml-2"
:disabled="showDeleteBatchBtn"
:disabled="isEmpty(deleteIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@@ -3,6 +3,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemSocialUserApi } from '#/api/system/social/user';
import { Page, useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getSocialUserPage } from '#/api/system/social/user';