Conflicts:
	ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
2.X
疯狂的狮子li 3 years ago
commit 189c00d794

@ -150,9 +150,10 @@ public class SysUserController extends BaseController {
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll()); ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) { if (StringUtils.isNotNull(userId)) {
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); SysUser sysUser = userService.selectUserById(userId);
ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
} }
return ajax; return ajax;
} }

@ -1,5 +1,10 @@
<template> <template>
<el-image :src="`${realSrc}`" fit="cover" :style="`width:${realWidth};height:${realHeight};`" :preview-src-list="[`${realSrc}`]"> <el-image
:src="`${realSrc}`"
fit="cover"
:style="`width:${realWidth};height:${realHeight};`"
:preview-src-list="realSrcList"
>
<div slot="error" class="image-slot"> <div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i> <i class="el-icon-picture-outline"></i>
</div> </div>
@ -7,10 +12,8 @@
</template> </template>
<script> <script>
import { isExternal } from '@/utils/validate'
export default { export default {
name: 'ImagePreview', name: "ImagePreview",
props: { props: {
src: { src: {
type: String, type: String,
@ -18,28 +21,34 @@ export default {
}, },
width: { width: {
type: [Number, String], type: [Number, String],
default: '' default: ""
}, },
height: { height: {
type: [Number, String], type: [Number, String],
default: '' default: ""
} }
}, },
computed: { computed: {
realSrc() { realSrc() {
if (isExternal(this.src)) { let real_src = this.src.split(",")[0];
return this.src return real_src;
} },
return process.env.VUE_APP_BASE_API + this.src realSrcList() {
let real_src_list = this.src.split(",");
let srcList = [];
real_src_list.forEach(item => {
return srcList.push(item);
});
return srcList;
}, },
realWidth() { realWidth() {
return typeof this.width == 'string' ? this.width : `${this.width}px` return typeof this.width == "string" ? this.width : `${this.width}px`;
}, },
realHeight() { realHeight() {
return typeof this.height == 'string' ? this.height : `${this.height}px` return typeof this.height == "string" ? this.height : `${this.height}px`;
} }
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -4,6 +4,7 @@ import store from '@/store'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode' import errorCode from '@/utils/errorCode'
import { tansParams, blobValidate } from "@/utils/ruoyi"; import { tansParams, blobValidate } from "@/utils/ruoyi";
import cache from '@/plugins/cache'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
let downloadLoadingInstance; let downloadLoadingInstance;
@ -23,6 +24,8 @@ const service = axios.create({
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
// 是否需要设置 token // 是否需要设置 token
const isToken = (config.headers || {}).isToken === false const isToken = (config.headers || {}).isToken === false
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) { if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
} }
@ -33,6 +36,29 @@ service.interceptors.request.use(config => {
config.params = {}; config.params = {};
config.url = url; config.url = url;
} }
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = {
url: config.url,
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
time: new Date().getTime()
}
const sessionObj = cache.session.getJSON('sessionObj')
if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
cache.session.setJSON('sessionObj', requestObj)
} else {
const s_url = sessionObj.url; // 请求地址
const s_data = sessionObj.data; // 请求数据
const s_time = sessionObj.time; // 请求时间
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请勿重复提交';
console.warn(`[${s_url}]: ` + message)
return Promise.reject(new Error(message))
} else {
cache.session.setJSON('sessionObj', requestObj)
}
}
}
return config return config
}, error => { }, error => {
console.log(error) console.log(error)

@ -1,4 +1,6 @@
/** 
/**
* 通用js方法封装处理 * 通用js方法封装处理
* Copyright (c) 2019 ruoyi * Copyright (c) 2019 ruoyi
*/ */
@ -16,7 +18,7 @@ export function parseTime(time, pattern) {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time) time = parseInt(time)
} else if (typeof time === 'string') { } else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm),''); time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '');
} }
if ((typeof time === 'number') && (time.toString().length === 10)) { if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000 time = time * 1000
@ -80,6 +82,9 @@ export function selectDictLabel(datas, value) {
// 回显数据字典(字符串数组) // 回显数据字典(字符串数组)
export function selectDictLabels(datas, value, separator) { export function selectDictLabels(datas, value, separator) {
if(value === undefined) {
return "";
}
var actions = []; var actions = [];
var currentSeparator = undefined === separator ? "," : separator; var currentSeparator = undefined === separator ? "," : separator;
var temp = value.split(currentSeparator); var temp = value.split(currentSeparator);
@ -124,7 +129,7 @@ export function mergeRecursive(source, target) {
} else { } else {
source[p] = target[p]; source[p] = target[p];
} }
} catch(e) { } catch (e) {
source[p] = target[p]; source[p] = target[p];
} }
} }

@ -33,6 +33,7 @@
<el-option label="Double" value="Double" /> <el-option label="Double" value="Double" />
<el-option label="BigDecimal" value="BigDecimal" /> <el-option label="BigDecimal" value="BigDecimal" />
<el-option label="Date" value="Date" /> <el-option label="Date" value="Date" />
<el-option label="Boolean" value="Boolean" />
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>

Loading…
Cancel
Save