mirror of
https://github.com/chillzhuang/Saber.git
synced 2024-12-22 09:09:26 +08:00
🎉 2.4.1.RELEASE
This commit is contained in:
parent
1c3fcd7b7e
commit
f48498e89e
@ -1,7 +1,7 @@
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
|
||||
<img src="https://img.shields.io/badge/Spring%20Cloud-Greenwich.SR2-blue.svg" alt="Coverage Status">
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.1.6.RELEASE-blue.svg" alt="Downloads">
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.1.7.RELEASE-blue.svg" alt="Downloads">
|
||||
</p>
|
||||
|
||||
## SpringBlade微服务开发平台
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "saber-admin",
|
||||
"version": "2.4.0",
|
||||
"version": "2.4.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
@ -21,7 +21,7 @@ export default {
|
||||
'<p>若要商用强烈推荐高度定制的商业化框架,具体授权信息请访问如下地址。️</p>' +
|
||||
'</br>' +
|
||||
'<p>BladeX 授权地址:<a target="_blank" href="https://bladex.vip/#/vip">点击授权</a></p>' +
|
||||
'<p>AvueX 授权地址:<a target="_blank" href="https://avue.top/vip">点击授权</a></p>',
|
||||
'<p>AvueX 授权地址:<a target="_blank" href="https://avuejs.com/vip">点击授权</a></p>',
|
||||
duration: 20000,
|
||||
type: "success"
|
||||
});
|
||||
|
@ -1,10 +1,11 @@
|
||||
import request from '@/router/axios';
|
||||
|
||||
export const getList = (current, size) => {
|
||||
export const getList = (current, size, params) => {
|
||||
return request({
|
||||
url: '/api/blade-develop/code/list',
|
||||
method: 'get',
|
||||
params: {
|
||||
...params,
|
||||
current,
|
||||
size
|
||||
}
|
||||
@ -47,6 +48,16 @@ export const update = (row) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const copy = (id) => {
|
||||
return request({
|
||||
url: '/api/blade-develop/code/copy',
|
||||
method: 'post',
|
||||
params: {
|
||||
id,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getCode = (id) => {
|
||||
return request({
|
||||
url: '/api/blade-develop/code/detail',
|
||||
|
50
src/api/tool/datasource.js
Normal file
50
src/api/tool/datasource.js
Normal file
@ -0,0 +1,50 @@
|
||||
import request from '@/router/axios';
|
||||
|
||||
export const getList = (current, size, params) => {
|
||||
return request({
|
||||
url: '/api/blade-develop/datasource/list',
|
||||
method: 'get',
|
||||
params: {
|
||||
...params,
|
||||
current,
|
||||
size,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getDetail = (id) => {
|
||||
return request({
|
||||
url: '/api/blade-develop/datasource/detail',
|
||||
method: 'get',
|
||||
params: {
|
||||
id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const remove = (ids) => {
|
||||
return request({
|
||||
url: '/api/blade-develop/datasource/remove',
|
||||
method: 'post',
|
||||
params: {
|
||||
ids,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const add = (row) => {
|
||||
return request({
|
||||
url: '/api/blade-develop/datasource/submit',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
||||
export const update = (row) => {
|
||||
return request({
|
||||
url: '/api/blade-develop/datasource/submit',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud :option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
ref="crud"
|
||||
v-model="form"
|
||||
@ -31,12 +32,22 @@
|
||||
@click="handleBuild">代码生成
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot-scope="scope" slot="menu">
|
||||
<el-button type="text"
|
||||
size="small"
|
||||
icon="el-icon-document-copy"
|
||||
v-if="permission.code_edit"
|
||||
plain
|
||||
class="none-border"
|
||||
@click.stop="handleCopy(scope.row)">复制
|
||||
</el-button>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList, getCode, build, remove, add, update} from "@/api/tool/code";
|
||||
import {getList, getCode, build, remove, add, update, copy} from "@/api/tool/code";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
@ -44,6 +55,7 @@
|
||||
return {
|
||||
form: {},
|
||||
selectionList: [],
|
||||
loading: true,
|
||||
query: {},
|
||||
page: {
|
||||
pageSize: 10,
|
||||
@ -51,6 +63,8 @@
|
||||
total: 0
|
||||
},
|
||||
option: {
|
||||
dialogWidth: 400,
|
||||
dialogHeight: 500,
|
||||
tip: false,
|
||||
border: true,
|
||||
index: true,
|
||||
@ -58,6 +72,23 @@
|
||||
labelWidth: 120,
|
||||
viewBtn: true,
|
||||
column: [
|
||||
{
|
||||
label: "数据源",
|
||||
prop: "datasourceId",
|
||||
search: true,
|
||||
span: 24,
|
||||
type: "select",
|
||||
dicUrl: "/api/blade-develop/datasource/select",
|
||||
props: {
|
||||
label: "name",
|
||||
value: "id"
|
||||
},
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请选择数据源",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "模块名",
|
||||
prop: "codeName",
|
||||
@ -90,6 +121,7 @@
|
||||
{
|
||||
label: "表前缀",
|
||||
prop: "tablePrefix",
|
||||
hide: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入表前缀",
|
||||
@ -99,6 +131,7 @@
|
||||
{
|
||||
label: "主键名",
|
||||
prop: "pkName",
|
||||
hide: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入主键名",
|
||||
@ -115,6 +148,38 @@
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "基础业务",
|
||||
prop: "baseMode",
|
||||
type: 'radio',
|
||||
dicUrl: "/api/blade-system/dict/dictionary?code=yes_no",
|
||||
props: {
|
||||
label: "dictValue",
|
||||
value: "dictKey"
|
||||
},
|
||||
hide: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请选择基础业务",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "包装器",
|
||||
prop: "wrapMode",
|
||||
type: 'radio',
|
||||
dicUrl: "/api/blade-system/dict/dictionary?code=yes_no",
|
||||
props: {
|
||||
label: "dictValue",
|
||||
value: "dictKey"
|
||||
},
|
||||
hide: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请选择包装器",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "后端生成路径",
|
||||
prop: "apiPath",
|
||||
@ -216,6 +281,10 @@
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
@ -261,6 +330,15 @@
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
handleCopy(row) {
|
||||
copy(row.id).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "复制成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getCode(this.form.id).then(res => {
|
||||
@ -269,17 +347,20 @@
|
||||
}
|
||||
done();
|
||||
},
|
||||
currentChange(currentPage){
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize){
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -287,4 +368,8 @@
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.none-border {
|
||||
border: 0;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
|
262
src/views/tool/datasource.vue
Normal file
262
src/views/tool/datasource.vue
Normal file
@ -0,0 +1,262 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud :option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
:page="page"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
v-model="form"
|
||||
ref="crud"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@row-del="rowDel"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@on-load="onLoad">
|
||||
<template slot="menuLeft">
|
||||
<el-button type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
plain
|
||||
v-if="permission.datasource_delete"
|
||||
@click="handleDelete">删 除
|
||||
</el-button>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList, getDetail, add, update, remove} from "@/api/tool/datasource";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
query: {},
|
||||
loading: true,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
selectionList: [],
|
||||
option: {
|
||||
dialogWidth: 400,
|
||||
dialogHeight: 330,
|
||||
tip: false,
|
||||
border: true,
|
||||
index: true,
|
||||
viewBtn: true,
|
||||
selection: true,
|
||||
column: [
|
||||
{
|
||||
label: "名称",
|
||||
prop: "name",
|
||||
width: 120,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入数据源名称",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "驱动类",
|
||||
prop: "driverClass",
|
||||
type: 'select',
|
||||
dicData: [
|
||||
{
|
||||
label: 'com.mysql.cj.jdbc.Driver',
|
||||
value: 'com.mysql.cj.jdbc.Driver',
|
||||
}, {
|
||||
label: 'org.postgresql.Driver',
|
||||
value: 'org.postgresql.Driver',
|
||||
}, {
|
||||
label: 'oracle.jdbc.OracleDriver',
|
||||
value: 'oracle.jdbc.OracleDriver',
|
||||
}
|
||||
],
|
||||
width: 200,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入驱动类",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "用户名",
|
||||
prop: "username",
|
||||
width: 120,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入用户名",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "密码",
|
||||
prop: "password",
|
||||
hide: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入密码",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "连接地址",
|
||||
prop: "url",
|
||||
span: 24,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入连接地址",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
prop: "remark",
|
||||
span: 24,
|
||||
minRows: 3,
|
||||
hide: true,
|
||||
type: "textarea"
|
||||
},
|
||||
]
|
||||
},
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.datasource_add, false),
|
||||
viewBtn: this.vaildData(this.permission.datasource_view, false),
|
||||
delBtn: this.vaildData(this.permission.datasource_delete, false),
|
||||
editBtn: this.vaildData(this.permission.datasource_edit, false)
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rowSave(row, loading, done) {
|
||||
add(row).then(() => {
|
||||
loading();
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
}, error => {
|
||||
done();
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, loading, done) {
|
||||
update(row).then(() => {
|
||||
loading();
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
}, error => {
|
||||
done();
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params) {
|
||||
this.query = params;
|
||||
this.onLoad(this.page, params);
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user