pull/131/head
caohong 4 years ago
commit 9339a1d524

@ -21,7 +21,7 @@
<spring-cloud.version>Hoxton.SR9</spring-cloud.version> <spring-cloud.version>Hoxton.SR9</spring-cloud.version>
<spring-cloud-alibaba.version>2.2.5.RELEASE</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>2.2.5.RELEASE</spring-cloud-alibaba.version>
<spring-boot-admin.version>2.3.1</spring-boot-admin.version> <spring-boot-admin.version>2.3.1</spring-boot-admin.version>
<spring-boot.mybatis>2.1.3</spring-boot.mybatis> <spring-boot.mybatis>2.1.4</spring-boot.mybatis>
<swagger.fox.version>2.9.2</swagger.fox.version> <swagger.fox.version>2.9.2</swagger.fox.version>
<swagger.core.version>1.5.24</swagger.core.version> <swagger.core.version>1.5.24</swagger.core.version>
<tobato.version>1.26.5</tobato.version> <tobato.version>1.26.5</tobato.version>

@ -528,7 +528,10 @@ public class ExcelUtil<T>
} }
else if (ColumnType.NUMERIC == attr.cellType()) else if (ColumnType.NUMERIC == attr.cellType())
{ {
cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value)); if (StringUtils.isNotNull(value))
{
cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
}
} }
else if (ColumnType.IMAGE == attr.cellType()) else if (ColumnType.IMAGE == attr.cellType())
{ {

@ -18,6 +18,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.validation.BindingResult;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.ruoyi.common.core.utils.SecurityUtils; import com.ruoyi.common.core.utils.SecurityUtils;
@ -236,6 +237,7 @@ public class LogAspect
return entry.getValue() instanceof MultipartFile; return entry.getValue() instanceof MultipartFile;
} }
} }
return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse; return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse
|| o instanceof BindingResult;
} }
} }

@ -22,7 +22,7 @@ public class VelocityInitializer
// 加载classpath目录下的vm文件 // 加载classpath目录下的vm文件
p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
// 定义字符集 // 定义字符集
p.setProperty(Velocity.ENCODING_DEFAULT, Constants.UTF8); p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8);
p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8); p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8);
// 初始化Velocity引擎指定配置Properties // 初始化Velocity引擎指定配置Properties
Velocity.init(p); Velocity.init(p);

@ -68,7 +68,7 @@ public class ${ClassName}Controller extends BaseController
{ {
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
util.exportExcel(response, list, "${businessName}"); util.exportExcel(response, list, "${functionName}数据");
} }
/** /**

@ -108,8 +108,12 @@
#elseif($column.list && "" != $column.dictType) #elseif($column.list && "" != $column.dictType)
<el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" /> <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
#elseif($column.list && "" != $javaField) #elseif($column.list && "" != $javaField)
#if(${foreach.index} == 1)
<el-table-column label="${comment}" prop="${javaField}" />
#else
<el-table-column label="${comment}" align="center" prop="${javaField}" /> <el-table-column label="${comment}" align="center" prop="${javaField}" />
#end #end
#end
#end #end
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
@ -120,6 +124,13 @@
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['${moduleName}:${businessName}:edit']" v-hasPermi="['${moduleName}:${businessName}:edit']"
>修改</el-button> >修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['${moduleName}:${businessName}:add']"
>新增</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -394,7 +405,7 @@ export default {
children: node.children children: node.children
}; };
}, },
/** 查询部门下拉树结构 */ /** 查询${functionName}下拉树结构 */
getTreeselect() { getTreeselect() {
list${BusinessName}().then(response => { list${BusinessName}().then(response => {
this.${businessName}Options = []; this.${businessName}Options = [];
@ -456,16 +467,21 @@ export default {
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd(row) {
this.reset(); this.reset();
this.getTreeselect(); this.getTreeselect();
if (row != null && row.${treeCode}) {
this.form.${treeParentCode} = row.${treeCode};
} else {
this.form.${treeParentCode} = 0;
}
this.open = true; this.open = true;
this.title = "添加${functionName}"; this.title = "添加${functionName}";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.getTreeselect(); this.getTreeselect();
if (row != null) { if (row != null) {
this.form.${treeParentCode} = row.${treeCode}; this.form.${treeParentCode} = row.${treeCode};
} }

@ -12,12 +12,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#if($table.sub) #if($table.sub)
<resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result"> <resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result">
<collection property="${subclassName}List" notNullColumn="${subTable.pkColumn.columnName}" javaType="java.util.List" resultMap="${subClassName}Result" /> <collection property="${subclassName}List" notNullColumn="sub_${subTable.pkColumn.columnName}" javaType="java.util.List" resultMap="${subClassName}Result" />
</resultMap> </resultMap>
<resultMap type="${subClassName}" id="${subClassName}Result"> <resultMap type="${subClassName}" id="${subClassName}Result">
#foreach ($column in $subTable.columns) #foreach ($column in $subTable.columns)
<result property="${column.javaField}" column="${column.columnName}" /> <result property="${column.javaField}" column="sub_${column.columnName}" />
#end #end
</resultMap> </resultMap>
#end #end
@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where ${pkColumn.columnName} = #{${pkColumn.javaField}} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
#elseif($table.sub) #elseif($table.sub)
select#foreach($column in $columns) a.$column.columnName#if($velocityCount != $columns.size()),#end#end, select#foreach($column in $columns) a.$column.columnName#if($velocityCount != $columns.size()),#end#end,
#foreach($column in $subTable.columns) b.$column.columnName#if($velocityCount != $subTable.columns.size()),#end#end #foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($velocityCount != $subTable.columns.size()),#end#end
from ${tableName} a from ${tableName} a
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName} left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}

@ -176,12 +176,6 @@
color: #FFFFFF; color: #FFFFFF;
} }
/* submenu item */
.el-menu--horizontal > .el-submenu .el-submenu__title {
height: 50px !important;
line-height: 50px !important;
}
/* text color */ /* text color */
.text-navy { .text-navy {
color: #1ab394; color: #1ab394;

@ -1,5 +1,19 @@
<template> <template>
<div>
<el-upload
:action="uploadUrl"
:on-success="handleUploadSuccess"
:on-error="handleUploadError"
name="file"
:show-file-list="false"
:headers="headers"
style="display: none"
ref="upload"
v-if="this.uploadUrl"
>
</el-upload>
<div class="editor" ref="editor" :style="styles"></div> <div class="editor" ref="editor" :style="styles"></div>
</div>
</template> </template>
<script> <script>
@ -7,6 +21,7 @@ import Quill from "quill";
import "quill/dist/quill.core.css"; import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css"; import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css"; import "quill/dist/quill.bubble.css";
import { getToken } from "@/utils/auth";
export default { export default {
name: "Editor", name: "Editor",
@ -30,10 +45,18 @@ export default {
readOnly: { readOnly: {
type: Boolean, type: Boolean,
default: false, default: false,
},
/* 上传地址 */
uploadUrl: {
type: String,
default: "",
} }
}, },
data() { data() {
return { return {
headers: {
Authorization: "Bearer " + getToken()
},
Quill: null, Quill: null,
currentValue: "", currentValue: "",
options: { options: {
@ -52,7 +75,7 @@ export default {
[{ color: [] }, { background: [] }], // [{ color: [] }, { background: [] }], //
[{ align: [] }], // [{ align: [] }], //
["clean"], // ["clean"], //
["link", "image", "video"] // ["link", "image"] //
], ],
}, },
placeholder: "请输入内容", placeholder: "请输入内容",
@ -95,6 +118,26 @@ export default {
init() { init() {
const editor = this.$refs.editor; const editor = this.$refs.editor;
this.Quill = new Quill(editor, this.options); this.Quill = new Quill(editor, this.options);
//
if (this.uploadUrl) {
let toolbar = this.Quill.getModule("toolbar");
toolbar.addHandler("image", (value) => {
this.uploadType = "image";
if (value) {
this.$refs.upload.$children[0].$refs.input.click();
} else {
this.quill.format("image", false);
}
});
toolbar.addHandler("video", (value) => {
this.uploadType = "video";
if (value) {
this.$refs.upload.$children[0].$refs.input.click();
} else {
this.quill.format("video", false);
}
});
}
this.Quill.pasteHTML(this.currentValue); this.Quill.pasteHTML(this.currentValue);
this.Quill.on("text-change", (delta, oldDelta, source) => { this.Quill.on("text-change", (delta, oldDelta, source) => {
const html = this.$refs.editor.children[0].innerHTML; const html = this.$refs.editor.children[0].innerHTML;
@ -114,13 +157,31 @@ export default {
this.$emit("on-editor-change", eventName, ...args); this.$emit("on-editor-change", eventName, ...args);
}); });
}, },
handleUploadSuccess(res, file) {
//
let quill = this.Quill;
//
if (res.code == 200) {
//
let length = quill.getSelection().index;
// res.url
quill.insertEmbed(length, "image", res.data.url);
//
quill.setSelection(length + 1);
} else {
this.$message.error("图片插入失败");
}
},
handleUploadError() {
this.$message.error("图片插入失败");
},
}, },
}; };
</script> </script>
<style> <style>
.editor, .ql-toolbar { .editor, .ql-toolbar {
white-space: pre-wrap!important; white-space: pre-wrap !important;
line-height: normal !important; line-height: normal !important;
} }
.quill-img { .quill-img {

@ -35,7 +35,6 @@ export default {
if (typeof val !== 'string') return if (typeof val !== 'string') return
const themeCluster = this.getThemeCluster(val.replace('#', '')) const themeCluster = this.getThemeCluster(val.replace('#', ''))
const originalCluster = this.getThemeCluster(oldVal.replace('#', '')) const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
console.log(themeCluster, originalCluster)
const $message = this.$message({ const $message = this.$message({
message: ' Compiling the theme', message: ' Compiling the theme',

@ -5,7 +5,7 @@
@select="handleSelect" @select="handleSelect"
> >
<template v-for="(item, index) in topMenus"> <template v-for="(item, index) in topMenus">
<el-menu-item :index="item.path" :key="index" v-if="index < visibleNumber" <el-menu-item :style="{'--theme': theme}" :index="item.path" :key="index" v-if="index < visibleNumber"
><svg-icon :icon-class="item.meta.icon" /> ><svg-icon :icon-class="item.meta.icon" />
{{ item.meta.title }}</el-menu-item {{ item.meta.title }}</el-menu-item
> >
@ -37,15 +37,28 @@ export default {
visibleNumber: 5, visibleNumber: 5,
// //
isFrist: false, isFrist: false,
// index
currentIndex: undefined
}; };
}, },
computed: { computed: {
theme() {
return this.$store.state.settings.theme;
},
// //
topMenus() { topMenus() {
return this.routers.map((menu) => ({ let topMenus = [];
...menu, this.routers.map((menu) => {
children: undefined, if (menu.hidden !== true) {
})); //
if (menu.path === "/") {
topMenus.push(menu.children[0]);
} else {
topMenus.push(menu);
}
}
});
return topMenus;
}, },
// //
routers() { routers() {
@ -57,7 +70,11 @@ export default {
this.routers.map((router) => { this.routers.map((router) => {
for (var item in router.children) { for (var item in router.children) {
if (router.children[item].parentPath === undefined) { if (router.children[item].parentPath === undefined) {
router.children[item].path = router.path + "/" + router.children[item].path; if(router.path === "/") {
router.children[item].path = "/redirect/" + router.children[item].path;
} else {
router.children[item].path = router.path + "/" + router.children[item].path;
}
router.children[item].parentPath = router.path; router.children[item].parentPath = router.path;
} }
childrenMenus.push(router.children[item]); childrenMenus.push(router.children[item]);
@ -79,32 +96,40 @@ export default {
activePath = "index"; activePath = "index";
} }
} }
this.activeRoutes(activePath); var routes = this.activeRoutes(activePath);
if (routes.length === 0) {
activePath = this.currentIndex || this.routers[0].path
this.activeRoutes(activePath);
}
return activePath; return activePath;
}, },
}, },
beforeMount() {
window.addEventListener('resize', this.setVisibleNumber)
},
beforeDestroy() {
window.removeEventListener('resize', this.setVisibleNumber)
},
mounted() { mounted() {
this.setVisibleNumber(); this.setVisibleNumber();
}, },
methods: { methods: {
// //
setVisibleNumber() { setVisibleNumber() {
const width = document.body.getBoundingClientRect().width - 200; const width = document.body.getBoundingClientRect().width / 3;
const elWidth = this.$el.getBoundingClientRect().width; this.visibleNumber = parseInt(width / 85);
const menuItemNodes = this.$el.children;
const menuWidth = Array.from(menuItemNodes).map(
(i) => i.getBoundingClientRect().width
);
this.visibleNumber = (
parseInt(width - elWidth) / parseInt(menuWidth)
).toFixed(0);
}, },
// //
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
this.currentIndex = key;
if (key.indexOf("http://") !== -1 || key.indexOf("https://") !== -1) { if (key.indexOf("http://") !== -1 || key.indexOf("https://") !== -1) {
// http(s):// // http(s)://
window.open(key, "_blank"); window.open(key, "_blank");
} else if (key.indexOf("/redirect") !== -1) {
// /redirect
this.$router.push({ path: key.replace("/redirect", "") });
} else { } else {
//
this.activeRoutes(key); this.activeRoutes(key);
} }
}, },
@ -118,13 +143,16 @@ export default {
} }
}); });
} }
this.$store.commit("SET_SIDEBAR_ROUTERS", routes); if(routes.length > 0) {
}, this.$store.commit("SET_SIDEBAR_ROUTERS", routes);
}
return routes;
}
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.el-menu--horizontal > .el-menu-item { .el-menu--horizontal > .el-menu-item {
float: left; float: left;
height: 50px; height: 50px;
@ -137,7 +165,13 @@ export default {
} }
.el-menu--horizontal > .el-menu-item.is-active { .el-menu--horizontal > .el-menu-item.is-active {
border-bottom: 3px solid #409eff; border-bottom: 3px solid #{'var(--theme)'};
color: #303133; color: #303133;
} }
/* submenu item */
.el-menu--horizontal > .el-submenu .el-submenu__title {
height: 50px !important;
line-height: 50px !important;
}
</style> </style>

@ -3,7 +3,7 @@
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/> <breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
<top-nav id="topmenu-container" class="breadcrumb-container" v-if="topNav"/> <top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
<div class="right-menu"> <div class="right-menu">
<template v-if="device!=='mobile'"> <template v-if="device!=='mobile'">
@ -135,6 +135,11 @@ export default {
float: left; float: left;
} }
.topmenu-container {
position: absolute;
left: 50px;
}
.errLog-container { .errLog-container {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;

@ -62,6 +62,10 @@
<el-switch v-model="sidebarLogo" class="drawer-switch" /> <el-switch v-model="sidebarLogo" class="drawer-switch" />
</div> </div>
<el-divider/>
<el-button size="small" type="primary" plain icon="el-icon-document-add" @click="saveSetting"></el-button>
<el-button size="small" plain icon="el-icon-refresh" @click="resetSetting"></el-button>
</div> </div>
</div> </div>
</template> </template>
@ -72,15 +76,12 @@ import ThemePicker from '@/components/ThemePicker'
export default { export default {
components: { ThemePicker }, components: { ThemePicker },
data() { data() {
return {} return {
theme: this.$store.state.settings.theme,
sideTheme: this.$store.state.settings.sideTheme
};
}, },
computed: { computed: {
theme() {
return this.$store.state.settings.theme
},
sideTheme() {
return this.$store.state.settings.sideTheme
},
fixedHeader: { fixedHeader: {
get() { get() {
return this.$store.state.settings.fixedHeader return this.$store.state.settings.fixedHeader
@ -135,12 +136,46 @@ export default {
key: 'theme', key: 'theme',
value: val value: val
}) })
this.theme = val;
}, },
handleTheme(val) { handleTheme(val) {
this.$store.dispatch('settings/changeSetting', { this.$store.dispatch('settings/changeSetting', {
key: 'sideTheme', key: 'sideTheme',
value: val value: val
}) })
this.sideTheme = val;
},
saveSetting() {
const loading = this.$loading({
lock: true,
fullscreen: false,
text: "正在保存到本地,请稍后...",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
});
localStorage.setItem(
"layout-setting",
`{
"topNav":${this.topNav},
"tagsView":${this.tagsView},
"fixedHeader":${this.fixedHeader},
"sidebarLogo":${this.sidebarLogo},
"sideTheme":"${this.sideTheme}",
"theme":"${this.theme}"
}`
);
setTimeout(loading.close(), 1000)
},
resetSetting() {
this.$loading({
lock: true,
fullscreen: false,
text: "正在清除设置缓存并刷新,请稍后...",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
});
localStorage.removeItem("layout-setting")
setTimeout("window.location.reload()", 1000)
} }
} }
} }

@ -3,16 +3,16 @@ import defaultSettings from '@/settings'
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo } = defaultSettings const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo } = defaultSettings
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
const state = { const state = {
theme: variables.theme, theme: storageSetting.theme || variables.theme,
sideTheme: sideTheme, sideTheme: storageSetting.sideTheme || sideTheme,
showSettings: showSettings, showSettings: showSettings,
topNav: topNav, topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
tagsView: tagsView, tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
fixedHeader: fixedHeader, fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
sidebarLogo: sidebarLogo sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo
} }
const mutations = { const mutations = {
CHANGE_SETTING: (state, { key, value }) => { CHANGE_SETTING: (state, { key, value }) => {
if (state.hasOwnProperty(key)) { if (state.hasOwnProperty(key)) {

@ -58,7 +58,7 @@ export function addDateRange(params, dateRange, propName) {
var search = params; var search = params;
search.params = {}; search.params = {};
if (null != dateRange && '' != dateRange) { if (null != dateRange && '' != dateRange) {
if (typeof (propName) === "undefined") { if (typeof(propName) === "undefined") {
search.params["beginTime"] = dateRange[0]; search.params["beginTime"] = dateRange[0];
search.params["endTime"] = dateRange[1]; search.params["endTime"] = dateRange[1];
} else { } else {
@ -87,8 +87,8 @@ export function selectDictLabels(datas, value, separator) {
var currentSeparator = undefined === separator ? "," : separator; var currentSeparator = undefined === separator ? "," : separator;
var temp = value.split(currentSeparator); var temp = value.split(currentSeparator);
Object.keys(value.split(currentSeparator)).some((val) => { Object.keys(value.split(currentSeparator)).some((val) => {
Object.keys(datas).some((key) => { Object.keys(datas).some((key) => {
if (datas[key].dictValue == ('' + temp[val])) { if (datas[key].dictValue == ('' + temp[val])) {
actions.push(datas[key].dictLabel + currentSeparator); actions.push(datas[key].dictLabel + currentSeparator);
} }
}) })
@ -173,3 +173,17 @@ export function handleTree(data, id, parentId, children) {
} }
return tree; return tree;
} }
/**
* 参数处理
* @param {*} params 参数
*/
export function tansParams(params) {
let result = ''
Object.keys(params).forEach((key) => {
if (!Object.is(params[key], undefined) && !Object.is(params[key], null) && !Object.is(JSON.stringify(params[key]), '{}')) {
result += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + '&'
}
})
return result
}

@ -8,7 +8,7 @@ export default {
name: "Druid", name: "Druid",
data() { data() {
return { return {
src: process.env.VUE_APP_BASE_API + "/druid/index.html", src: process.env.VUE_APP_BASE_API + "/druid/login.html",
height: document.documentElement.clientHeight - 94.5 + "px;", height: document.documentElement.clientHeight - 94.5 + "px;",
loading: true loading: true
}; };

Loading…
Cancel
Save