|
@@ -3,7 +3,13 @@
|
|
<ProTable ref="proTable" :columns="columns" row-key="tableId" :request-api="listTableApi">
|
|
<ProTable ref="proTable" :columns="columns" row-key="tableId" :request-api="listTableApi">
|
|
<!-- 表格 header 按钮 -->
|
|
<!-- 表格 header 按钮 -->
|
|
<template #tableHeader="scope">
|
|
<template #tableHeader="scope">
|
|
- <el-button type="primary" v-auth="['tool:gen:code']" :disabled="!scope.isSelected" :icon="CirclePlus" @click="handleGenTable()">
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ v-auth="['tool:gen:code']"
|
|
|
|
+ :disabled="!scope.isSelected"
|
|
|
|
+ :icon="CirclePlus"
|
|
|
|
+ @click="handleGenTable()"
|
|
|
|
+ >
|
|
生成
|
|
生成
|
|
</el-button>
|
|
</el-button>
|
|
<el-button type="primary" v-auth="['tool:gen:import']" :icon="Upload" plain @click="batchAdd"> 导入表 </el-button>
|
|
<el-button type="primary" v-auth="['tool:gen:import']" :icon="Upload" plain @click="batchAdd"> 导入表 </el-button>
|
|
@@ -20,11 +26,19 @@
|
|
</template>
|
|
</template>
|
|
<!-- 表格操作 -->
|
|
<!-- 表格操作 -->
|
|
<template #operation="scope">
|
|
<template #operation="scope">
|
|
- <el-button type="primary" link :icon="View" v-auth="['tool:gen:query']" @click="openDialog(1, '代码预览', scope.row)"> 预览 </el-button>
|
|
|
|
|
|
+ <el-button type="primary" link :icon="View" v-auth="['tool:gen:query']" @click="openDialog(1, '代码预览', scope.row)">
|
|
|
|
+ 预览
|
|
|
|
+ </el-button>
|
|
<el-button type="primary" link :icon="EditPen" v-auth="['tool:gen:edit']" @click="toDetail(scope.row)"> 编辑 </el-button>
|
|
<el-button type="primary" link :icon="EditPen" v-auth="['tool:gen:edit']" @click="toDetail(scope.row)"> 编辑 </el-button>
|
|
- <el-button type="primary" link :icon="Delete" v-auth="['tool:gen:remove']" @click="deleteRole(scope.row)"> 删除 </el-button>
|
|
|
|
- <el-button type="primary" link :icon="Refresh" v-auth="['tool:gen:edit']" @click="handleSyncDb(scope.row)"> 同步 </el-button>
|
|
|
|
- <el-button type="primary" link :icon="Download" v-auth="['tool:gen:code']" @click="handleGenTable(scope.row)"> 生成代码 </el-button>
|
|
|
|
|
|
+ <el-button type="primary" link :icon="Delete" v-auth="['tool:gen:remove']" @click="deleteRole(scope.row)">
|
|
|
|
+ 删除
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="primary" link :icon="Refresh" v-auth="['tool:gen:edit']" @click="handleSyncDb(scope.row)">
|
|
|
|
+ 同步
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="primary" link :icon="Download" v-auth="['tool:gen:code']" @click="handleGenTable(scope.row)">
|
|
|
|
+ 生成代码
|
|
|
|
+ </el-button>
|
|
</template>
|
|
</template>
|
|
</ProTable>
|
|
</ProTable>
|
|
<FormDialog ref="formDialogRef">
|
|
<FormDialog ref="formDialogRef">
|
|
@@ -48,7 +62,8 @@
|
|
: key
|
|
: key
|
|
.toString()
|
|
.toString()
|
|
.substring(key.toString().lastIndexOf('/') + 1, key.toString().indexOf('.vm'))
|
|
.substring(key.toString().lastIndexOf('/') + 1, key.toString().indexOf('.vm'))
|
|
- .split('.')[1] || key.toString().substring(key.toString().lastIndexOf('/') + 1, key.toString().indexOf('.vm'))
|
|
|
|
|
|
+ .split('.')[1] ||
|
|
|
|
+ key.toString().substring(key.toString().lastIndexOf('/') + 1, key.toString().indexOf('.vm'))
|
|
"
|
|
"
|
|
>
|
|
>
|
|
</preview-code>
|
|
</preview-code>
|
|
@@ -86,6 +101,17 @@ let preview = ref({
|
|
activeName: 'domain.java'
|
|
activeName: 'domain.java'
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total && pageNum && pageSize 这些字段,可以在这里进行处理成这些字段
|
|
|
|
+const dataCallback = (data: any) => {
|
|
|
|
+ const page = proTable.value!.pageable
|
|
|
|
+ return {
|
|
|
|
+ list: data.data,
|
|
|
|
+ total: data.total,
|
|
|
|
+ pageNum: page.pageNum,
|
|
|
|
+ pageSize: page.pageSize
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
// 表格弹框提交
|
|
// 表格弹框提交
|
|
const submitForm = () => {
|
|
const submitForm = () => {
|
|
proTable.value?.getTableList()
|
|
proTable.value?.getTableList()
|
|
@@ -121,10 +147,11 @@ const batchAdd = () => {
|
|
}
|
|
}
|
|
|
|
|
|
// 生成代码
|
|
// 生成代码
|
|
|
|
+const handleGenTable = (_row?: { tableId: string }) => {
|
|
const handleGenTable = (_row?: { tableId: string }) => {
|
|
const handleGenTable = (_row?: { tableId: string }) => {
|
|
let tableIdArr: any[] | undefined = proTable.value?.selectedList.map(item => item.tableId)
|
|
let tableIdArr: any[] | undefined = proTable.value?.selectedList.map(item => item.tableId)
|
|
let tableIds = _row?.tableId || tableIdArr?.join(',')
|
|
let tableIds = _row?.tableId || tableIdArr?.join(',')
|
|
- useDownload(batchGenCodeApi, '生成代码', tableIds, false, 'zip', 'km.zip')
|
|
|
|
|
|
+ useDownload(batchGenCodeApi, '生成代码', tableIds, false, 'zip', 'phm.zip')
|
|
}
|
|
}
|
|
|
|
|
|
// 同步表数据
|
|
// 同步表数据
|