更新
This commit is contained in:
parent
c062295238
commit
1268cf2df2
@ -14,7 +14,7 @@
|
||||
:row-key="(row) => row.tableName"
|
||||
ref="tableRef"
|
||||
scroll-x="1200"
|
||||
:row-selection="{ onChange: onSelectionChange, selectedRowKeys: selectionData }"
|
||||
:row-selection="{ onChange: onSelectionChange, selectedRowKeys: selectedRowKeys, selectedRows: selectedRows}"
|
||||
virtual-scroll
|
||||
>
|
||||
<template #tableTitle>
|
||||
@ -23,7 +23,7 @@
|
||||
type="primary"
|
||||
@click="handleBatchGenerator"
|
||||
v-perm="['sys:generator:batchGenerator']"
|
||||
:disabled="!selectionData.length"
|
||||
:disabled="!selectedRowKeys.length"
|
||||
>
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
@ -37,7 +37,7 @@
|
||||
<a-space>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="handleGenerator(record.tableName)"
|
||||
@click="handleGenerator(record.tableName, record.tableComment)"
|
||||
v-perm="['sys:generator:generator']"
|
||||
>
|
||||
<template #icon><EditOutlined /></template>
|
||||
@ -64,7 +64,8 @@
|
||||
* 定义参数变量
|
||||
*/
|
||||
const tableRef = ref();
|
||||
const selectionData = ref([]);
|
||||
const selectedRowKeys = ref([]);
|
||||
const selectedRows = ref([]);
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
@ -88,7 +89,8 @@
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
selectionData.value = [];
|
||||
selectedRowKeys.value = [];
|
||||
selectedRows.value = [];
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
@ -100,9 +102,14 @@
|
||||
title: '提示',
|
||||
content: '确定要批量一键生成吗?',
|
||||
onOk: async () => {
|
||||
await batchGenerator({ tableNames: selectionData.value });
|
||||
await batchGenerator({
|
||||
tableNames: selectedRows.value.map(
|
||||
({ tableName, tableComment }) => tableName + '|' + tableComment,
|
||||
),
|
||||
});
|
||||
message.success('生成成功');
|
||||
selectionData.value = [];
|
||||
selectedRowKeys.value = [];
|
||||
selectedRows.value = [];
|
||||
reloadTable();
|
||||
},
|
||||
});
|
||||
@ -111,8 +118,8 @@
|
||||
/**
|
||||
* 执行单个生成
|
||||
*/
|
||||
async function handleGenerator(name) {
|
||||
await generator({ tableNames: [name] });
|
||||
async function handleGenerator(tableName, tableComment) {
|
||||
await generator({ tableNames: [tableName + '|' + tableComment] });
|
||||
message('一键生成成功');
|
||||
}
|
||||
|
||||
@ -144,8 +151,9 @@
|
||||
* 选项发生变化
|
||||
* @param value 参数
|
||||
*/
|
||||
function onSelectionChange(value) {
|
||||
selectionData.value = value;
|
||||
function onSelectionChange(value, rows) {
|
||||
selectedRowKeys.value = value;
|
||||
selectedRows.value = rows;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user