🎉 2.4.1.RELEASE

This commit is contained in:
smallchill 2019-08-19 22:32:04 +08:00
parent 1c3fcd7b7e
commit f48498e89e
7 changed files with 415 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<p align="center"> <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/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%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> </p>
## SpringBlade微服务开发平台 ## SpringBlade微服务开发平台

View File

@ -1,6 +1,6 @@
{ {
"name": "saber-admin", "name": "saber-admin",
"version": "2.4.0", "version": "2.4.1",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View File

@ -21,7 +21,7 @@ export default {
'<p>若要商用强烈推荐高度定制的商业化框架,具体授权信息请访问如下地址。️</p>' + '<p>若要商用强烈推荐高度定制的商业化框架,具体授权信息请访问如下地址。️</p>' +
'</br>' + '</br>' +
'<p>BladeX 授权地址:<a target="_blank" href="https://bladex.vip/#/vip">点击授权</a></p>' + '<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, duration: 20000,
type: "success" type: "success"
}); });

View File

@ -1,10 +1,11 @@
import request from '@/router/axios'; import request from '@/router/axios';
export const getList = (current, size) => { export const getList = (current, size, params) => {
return request({ return request({
url: '/api/blade-develop/code/list', url: '/api/blade-develop/code/list',
method: 'get', method: 'get',
params: { params: {
...params,
current, current,
size 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) => { export const getCode = (id) => {
return request({ return request({
url: '/api/blade-develop/code/detail', url: '/api/blade-develop/code/detail',

View 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
})
}

View File

@ -1,6 +1,7 @@
<template> <template>
<basic-container> <basic-container>
<avue-crud :option="option" <avue-crud :option="option"
:table-loading="loading"
:data="data" :data="data"
ref="crud" ref="crud"
v-model="form" v-model="form"
@ -31,12 +32,22 @@
@click="handleBuild">代码生成 @click="handleBuild">代码生成
</el-button> </el-button>
</template> </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> </avue-crud>
</basic-container> </basic-container>
</template> </template>
<script> <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"; import {mapGetters} from "vuex";
export default { export default {
@ -44,6 +55,7 @@
return { return {
form: {}, form: {},
selectionList: [], selectionList: [],
loading: true,
query: {}, query: {},
page: { page: {
pageSize: 10, pageSize: 10,
@ -51,6 +63,8 @@
total: 0 total: 0
}, },
option: { option: {
dialogWidth: 400,
dialogHeight: 500,
tip: false, tip: false,
border: true, border: true,
index: true, index: true,
@ -58,6 +72,23 @@
labelWidth: 120, labelWidth: 120,
viewBtn: true, viewBtn: true,
column: [ 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: "模块名", label: "模块名",
prop: "codeName", prop: "codeName",
@ -90,6 +121,7 @@
{ {
label: "表前缀", label: "表前缀",
prop: "tablePrefix", prop: "tablePrefix",
hide: true,
rules: [{ rules: [{
required: true, required: true,
message: "请输入表前缀", message: "请输入表前缀",
@ -99,6 +131,7 @@
{ {
label: "主键名", label: "主键名",
prop: "pkName", prop: "pkName",
hide: true,
rules: [{ rules: [{
required: true, required: true,
message: "请输入主键名", message: "请输入主键名",
@ -115,6 +148,38 @@
trigger: "blur" 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: "后端生成路径", label: "后端生成路径",
prop: "apiPath", prop: "apiPath",
@ -216,6 +281,10 @@
selectionChange(list) { selectionChange(list) {
this.selectionList = list; this.selectionList = list;
}, },
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
handleDelete() { handleDelete() {
if (this.selectionList.length === 0) { if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据"); this.$message.warning("请选择至少一条数据");
@ -261,6 +330,15 @@
this.$refs.crud.toggleSelection(); this.$refs.crud.toggleSelection();
}); });
}, },
handleCopy(row) {
copy(row.id).then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "复制成功!"
});
});
},
beforeOpen(done, type) { beforeOpen(done, type) {
if (["edit", "view"].includes(type)) { if (["edit", "view"].includes(type)) {
getCode(this.form.id).then(res => { getCode(this.form.id).then(res => {
@ -269,17 +347,20 @@
} }
done(); done();
}, },
currentChange(currentPage){ currentChange(currentPage) {
this.page.currentPage = currentPage; this.page.currentPage = currentPage;
}, },
sizeChange(pageSize){ sizeChange(pageSize) {
this.page.pageSize = pageSize; this.page.pageSize = pageSize;
}, },
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true;
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = res.data.data; const data = res.data.data;
this.page.total = data.total; this.page.total = data.total;
this.data = data.records; this.data = data.records;
this.loading = false;
this.selectionClear();
}); });
} }
} }
@ -287,4 +368,8 @@
</script> </script>
<style> <style>
.none-border {
border: 0;
background-color: transparent !important;
}
</style> </style>

View 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>