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