master
parent
0ebedac4f8
commit
bf1b566b06
|
@ -0,0 +1,84 @@
|
||||||
|
package com.jing.common.core.utils.file;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import org.apache.poi.util.IOUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片处理工具类
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class ImageUtils
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(ImageUtils.class);
|
||||||
|
|
||||||
|
public static byte[] getImage(String imagePath)
|
||||||
|
{
|
||||||
|
InputStream is = getFile(imagePath);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return IOUtils.toByteArray(is);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("图片加载异常 {}", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtils.closeQuietly(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InputStream getFile(String imagePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] result = readFile(imagePath);
|
||||||
|
result = Arrays.copyOf(result, result.length);
|
||||||
|
return new ByteArrayInputStream(result);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("获取图片异常 {}", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取文件为字节数据
|
||||||
|
*
|
||||||
|
* @param url 地址
|
||||||
|
* @return 字节数据
|
||||||
|
*/
|
||||||
|
public static byte[] readFile(String url)
|
||||||
|
{
|
||||||
|
InputStream in = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 网络地址
|
||||||
|
URL urlObj = new URL(url);
|
||||||
|
URLConnection urlConnection = urlObj.openConnection();
|
||||||
|
urlConnection.setConnectTimeout(30 * 1000);
|
||||||
|
urlConnection.setReadTimeout(60 * 1000);
|
||||||
|
urlConnection.setDoInput(true);
|
||||||
|
in = urlConnection.getInputStream();
|
||||||
|
return IOUtils.toByteArray(in);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("访问文件异常 {}", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtils.closeQuietly(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.jing.gen.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.jing.gen.domain.GenTableColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务字段 服务层
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public interface IGenTableColumnService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询业务字段列表
|
||||||
|
*
|
||||||
|
* @param tableId 业务字段编号
|
||||||
|
* @return 业务字段集合
|
||||||
|
*/
|
||||||
|
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增业务字段
|
||||||
|
*
|
||||||
|
* @param genTableColumn 业务字段信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertGenTableColumn(GenTableColumn genTableColumn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改业务字段
|
||||||
|
*
|
||||||
|
* @param genTableColumn 业务字段信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateGenTableColumn(GenTableColumn genTableColumn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除业务字段信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteGenTableColumnByIds(String ids);
|
||||||
|
}
|
|
@ -0,0 +1,121 @@
|
||||||
|
package com.jing.gen.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import com.jing.gen.domain.GenTable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务 服务层
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public interface IGenTableService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询业务列表
|
||||||
|
*
|
||||||
|
* @param genTable 业务信息
|
||||||
|
* @return 业务集合
|
||||||
|
*/
|
||||||
|
public List<GenTable> selectGenTableList(GenTable genTable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询据库列表
|
||||||
|
*
|
||||||
|
* @param genTable 业务信息
|
||||||
|
* @return 数据库表集合
|
||||||
|
*/
|
||||||
|
public List<GenTable> selectDbTableList(GenTable genTable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询据库列表
|
||||||
|
*
|
||||||
|
* @param tableNames 表名称组
|
||||||
|
* @return 数据库表集合
|
||||||
|
*/
|
||||||
|
public List<GenTable> selectDbTableListByNames(String[] tableNames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有表信息
|
||||||
|
*
|
||||||
|
* @return 表信息集合
|
||||||
|
*/
|
||||||
|
public List<GenTable> selectGenTableAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询业务信息
|
||||||
|
*
|
||||||
|
* @param id 业务ID
|
||||||
|
* @return 业务信息
|
||||||
|
*/
|
||||||
|
public GenTable selectGenTableById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改业务
|
||||||
|
*
|
||||||
|
* @param genTable 业务信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public void updateGenTable(GenTable genTable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除业务信息
|
||||||
|
*
|
||||||
|
* @param tableIds 需要删除的表数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public void deleteGenTableByIds(Long[] tableIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入表结构
|
||||||
|
*
|
||||||
|
* @param tableList 导入表列表
|
||||||
|
*/
|
||||||
|
public void importGenTable(List<GenTable> tableList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预览代码
|
||||||
|
*
|
||||||
|
* @param tableId 表编号
|
||||||
|
* @return 预览数据列表
|
||||||
|
*/
|
||||||
|
public Map<String, String> previewCode(Long tableId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成代码(下载方式)
|
||||||
|
*
|
||||||
|
* @param tableName 表名称
|
||||||
|
* @return 数据
|
||||||
|
*/
|
||||||
|
public byte[] downloadCode(String tableName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成代码(自定义路径)
|
||||||
|
*
|
||||||
|
* @param tableName 表名称
|
||||||
|
* @return 数据
|
||||||
|
*/
|
||||||
|
public void generatorCode(String tableName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步数据库
|
||||||
|
*
|
||||||
|
* @param tableName 表名称
|
||||||
|
*/
|
||||||
|
public void synchDb(String tableName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量生成代码(下载方式)
|
||||||
|
*
|
||||||
|
* @param tableNames 表数组
|
||||||
|
* @return 数据
|
||||||
|
*/
|
||||||
|
public byte[] downloadCode(String[] tableNames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存参数校验
|
||||||
|
*
|
||||||
|
* @param genTable 业务信息
|
||||||
|
*/
|
||||||
|
public void validateEdit(GenTable genTable);
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
const { run } = require('runjs')
|
||||||
|
const chalk = require('chalk')
|
||||||
|
const config = require('../vue.config.js')
|
||||||
|
const rawArgv = process.argv.slice(2)
|
||||||
|
const args = rawArgv.join(' ')
|
||||||
|
|
||||||
|
if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
|
||||||
|
const report = rawArgv.includes('--report')
|
||||||
|
|
||||||
|
run(`vue-cli-service build ${args}`)
|
||||||
|
|
||||||
|
const port = 9526
|
||||||
|
const publicPath = config.publicPath
|
||||||
|
|
||||||
|
var connect = require('connect')
|
||||||
|
var serveStatic = require('serve-static')
|
||||||
|
const app = connect()
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
publicPath,
|
||||||
|
serveStatic('./dist', {
|
||||||
|
index: ['index.html', '/']
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
app.listen(port, function () {
|
||||||
|
console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`))
|
||||||
|
if (report) {
|
||||||
|
console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
run(`vue-cli-service build ${args}`)
|
||||||
|
}
|
|
@ -0,0 +1,208 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<title><%= webpackConfig.name %></title>
|
||||||
|
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||||
|
<style>
|
||||||
|
html,
|
||||||
|
body,
|
||||||
|
#app {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
.chromeframe {
|
||||||
|
margin: 0.2em 0;
|
||||||
|
background: #ccc;
|
||||||
|
color: #000;
|
||||||
|
padding: 0.2em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loader-wrapper {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loader {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
width: 150px;
|
||||||
|
height: 150px;
|
||||||
|
margin: -75px 0 0 -75px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 3px solid transparent;
|
||||||
|
border-top-color: #FFF;
|
||||||
|
-webkit-animation: spin 2s linear infinite;
|
||||||
|
-ms-animation: spin 2s linear infinite;
|
||||||
|
-moz-animation: spin 2s linear infinite;
|
||||||
|
-o-animation: spin 2s linear infinite;
|
||||||
|
animation: spin 2s linear infinite;
|
||||||
|
z-index: 1001;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loader:before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
left: 5px;
|
||||||
|
right: 5px;
|
||||||
|
bottom: 5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 3px solid transparent;
|
||||||
|
border-top-color: #FFF;
|
||||||
|
-webkit-animation: spin 3s linear infinite;
|
||||||
|
-moz-animation: spin 3s linear infinite;
|
||||||
|
-o-animation: spin 3s linear infinite;
|
||||||
|
-ms-animation: spin 3s linear infinite;
|
||||||
|
animation: spin 3s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loader:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 15px;
|
||||||
|
left: 15px;
|
||||||
|
right: 15px;
|
||||||
|
bottom: 15px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 3px solid transparent;
|
||||||
|
border-top-color: #FFF;
|
||||||
|
-moz-animation: spin 1.5s linear infinite;
|
||||||
|
-o-animation: spin 1.5s linear infinite;
|
||||||
|
-ms-animation: spin 1.5s linear infinite;
|
||||||
|
-webkit-animation: spin 1.5s linear infinite;
|
||||||
|
animation: spin 1.5s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@-webkit-keyframes spin {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
-ms-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
-ms-transform: rotate(360deg);
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
-ms-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
-ms-transform: rotate(360deg);
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#loader-wrapper .loader-section {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
width: 51%;
|
||||||
|
height: 100%;
|
||||||
|
background: #7171C6;
|
||||||
|
z-index: 1000;
|
||||||
|
-webkit-transform: translateX(0);
|
||||||
|
-ms-transform: translateX(0);
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#loader-wrapper .loader-section.section-left {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loader-wrapper .loader-section.section-right {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.loaded #loader-wrapper .loader-section.section-left {
|
||||||
|
-webkit-transform: translateX(-100%);
|
||||||
|
-ms-transform: translateX(-100%);
|
||||||
|
transform: translateX(-100%);
|
||||||
|
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
|
||||||
|
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loaded #loader-wrapper .loader-section.section-right {
|
||||||
|
-webkit-transform: translateX(100%);
|
||||||
|
-ms-transform: translateX(100%);
|
||||||
|
transform: translateX(100%);
|
||||||
|
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
|
||||||
|
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loaded #loader {
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transition: all 0.3s ease-out;
|
||||||
|
transition: all 0.3s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loaded #loader-wrapper {
|
||||||
|
visibility: hidden;
|
||||||
|
-webkit-transform: translateY(-100%);
|
||||||
|
-ms-transform: translateY(-100%);
|
||||||
|
transform: translateY(-100%);
|
||||||
|
-webkit-transition: all 0.3s 1s ease-out;
|
||||||
|
transition: all 0.3s 1s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-js #loader-wrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-js h1 {
|
||||||
|
color: #222222;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loader-wrapper .load_title {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
color: #FFF;
|
||||||
|
font-size: 19px;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
z-index: 9999999999999;
|
||||||
|
position: absolute;
|
||||||
|
top: 60%;
|
||||||
|
opacity: 1;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loader-wrapper .load_title span {
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #FFF;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<div id="loader-wrapper">
|
||||||
|
<div id="loader"></div>
|
||||||
|
<div class="loader-section section-left"></div>
|
||||||
|
<div class="loader-section section-right"></div>
|
||||||
|
<div class="load_title">正在加载系统资源,请耐心等待</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,9 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import SvgIcon from '@/components/SvgIcon'// svg component
|
||||||
|
|
||||||
|
// register globally
|
||||||
|
Vue.component('svg-icon', SvgIcon)
|
||||||
|
|
||||||
|
const req = require.context('./svg', false, /\.svg$/)
|
||||||
|
const requireAll = requireContext => requireContext.keys().map(requireContext)
|
||||||
|
requireAll(req)
|
|
@ -0,0 +1,49 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import store from '@/store'
|
||||||
|
import DataDict from '@/utils/dict'
|
||||||
|
import { getDicts as getDicts } from '@/api/system/dict/data'
|
||||||
|
|
||||||
|
function searchDictByKey(dict, key) {
|
||||||
|
if (key == null && key == "") {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for (let i = 0; i < dict.length; i++) {
|
||||||
|
if (dict[i].key == key) {
|
||||||
|
return dict[i].value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function install() {
|
||||||
|
Vue.use(DataDict, {
|
||||||
|
metas: {
|
||||||
|
'*': {
|
||||||
|
labelField: 'dictLabel',
|
||||||
|
valueField: 'dictValue',
|
||||||
|
request(dictMeta) {
|
||||||
|
const storeDict = searchDictByKey(store.getters.dict, dictMeta.type)
|
||||||
|
if (storeDict) {
|
||||||
|
return new Promise(resolve => { resolve(storeDict) })
|
||||||
|
} else {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getDicts(dictMeta.type).then(res => {
|
||||||
|
store.dispatch('dict/setDict', { key: dictMeta.type, value: res.data })
|
||||||
|
resolve(res.data)
|
||||||
|
}).catch(error => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
install,
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
import hasRole from './permission/hasRole'
|
||||||
|
import hasPermi from './permission/hasPermi'
|
||||||
|
import dialogDrag from './dialog/drag'
|
||||||
|
import dialogDragWidth from './dialog/dragWidth'
|
||||||
|
import dialogDragHeight from './dialog/dragHeight'
|
||||||
|
import clipboard from './module/clipboard'
|
||||||
|
|
||||||
|
const install = function(Vue) {
|
||||||
|
Vue.directive('hasRole', hasRole)
|
||||||
|
Vue.directive('hasPermi', hasPermi)
|
||||||
|
Vue.directive('clipboard', clipboard)
|
||||||
|
Vue.directive('dialogDrag', dialogDrag)
|
||||||
|
Vue.directive('dialogDragWidth', dialogDragWidth)
|
||||||
|
Vue.directive('dialogDragHeight', dialogDragHeight)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.Vue) {
|
||||||
|
window['hasRole'] = hasRole
|
||||||
|
window['hasPermi'] = hasPermi
|
||||||
|
Vue.use(install); // eslint-disable-line
|
||||||
|
}
|
||||||
|
|
||||||
|
export default install
|
|
@ -0,0 +1,5 @@
|
||||||
|
export { default as AppMain } from './AppMain'
|
||||||
|
export { default as Navbar } from './Navbar'
|
||||||
|
export { default as Settings } from './Settings'
|
||||||
|
export { default as Sidebar } from './Sidebar/index.vue'
|
||||||
|
export { default as TagsView } from './TagsView/index.vue'
|
|
@ -0,0 +1,120 @@
|
||||||
|
<template>
|
||||||
|
<!-- 导入表 -->
|
||||||
|
<el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh" append-to-body>
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
|
||||||
|
<el-form-item label="表名称" prop="tableName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.tableName"
|
||||||
|
placeholder="请输入表名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="表描述" prop="tableComment">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.tableComment"
|
||||||
|
placeholder="请输入表描述"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-row>
|
||||||
|
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
|
||||||
|
<el-table-column type="selection" width="55"></el-table-column>
|
||||||
|
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
|
||||||
|
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
|
||||||
|
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
||||||
|
<el-table-column prop="updateTime" label="更新时间"></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-row>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleImportTable">确 定</el-button>
|
||||||
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listDbTable, importTable } from "@/api/tool/gen";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
visible: false,
|
||||||
|
// 选中数组值
|
||||||
|
tables: [],
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 表数据
|
||||||
|
dbTableList: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
tableName: undefined,
|
||||||
|
tableComment: undefined
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 显示弹框
|
||||||
|
show() {
|
||||||
|
this.getList();
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
clickRow(row) {
|
||||||
|
this.$refs.table.toggleRowSelection(row);
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.tables = selection.map(item => item.tableName);
|
||||||
|
},
|
||||||
|
// 查询表数据
|
||||||
|
getList() {
|
||||||
|
listDbTable(this.queryParams).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.dbTableList = res.rows;
|
||||||
|
this.total = res.total;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 导入按钮操作 */
|
||||||
|
handleImportTable() {
|
||||||
|
const tableNames = this.tables.join(",");
|
||||||
|
if (tableNames == "") {
|
||||||
|
this.$modal.msgError("请选择要导入的表");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
importTable({ tables: tableNames }).then(res => {
|
||||||
|
this.$modal.msgSuccess(res.msg);
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit("ok");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue