Merge remote-tracking branch 'gitee/master' into gitee-master

Raod 3 years ago
commit 8441e895dc

@ -66,7 +66,7 @@
## 近期计划
- 完善地图插件
- 完善表格插件
- 丰富自定义框图、装饰
- 丰富自定义框图、挂件
- 丰富更多图表组件
## 技术支持

@ -55,6 +55,7 @@ public class UserServiceImpl implements UserService {
//将登录信息缓存,默认一小时
if (cacheHelper.exist(username)) {
map.put("token", cacheHelper.stringGet(username));
map.put("username", username);
} else {
String uuid = GaeaUtils.UUID();
String token = jwtBean.createToken(username, uuid);

@ -10,6 +10,10 @@ server:
spring:
application:
name: aj-report
#上传图片大小限制为10MB
servlet:
multipart:
max-file-size: 10MB
# cloud:
# nacos:
# server-addr: 10.108.26.121:8848,10.108.26.145:8848

@ -1,7 +1,7 @@
/*
* @Author: zyk
* @Author: qianlishi
* @Date: 2020-07-13 15:13:34
* @Last Modified by: zyk
* @Last Modified by: qianlishi
* @Last Modified time: 2021-03-15 13:28:28
*/

@ -1,7 +1,7 @@
/*
* @Author: zyk
* @Author: qianlishi
* @Date: 2020-07-13 15:13:17
* @Last Modified by: zyk
* @Last Modified by: qianlishi
* @Last Modified time: 2020-12-15 15:34:34
*/
import request from '@/utils/request'

@ -1,7 +1,7 @@
/*
* @Author: zyk
* @Author: qianlishi
* @Date: 2020-07-13 15:13:37
* @Last Modified by: zyk
* @Last Modified by: qianlishi
* @Last Modified time: 2021-03-04 10:46:26
*/
import request from '@/utils/request'

@ -6,6 +6,10 @@ export default {
}
},
computed: {
username: function(){
var username = getItem('username')
return username
},
getUser: function(){
// var user = getItem('user');
var user =JSON.parse(localStorage.getItem('user'))

@ -1,16 +1,12 @@
<template>
<div>
<el-menu class="navbar" mode="horizontal">
<hamburger
:toggle-click="toggleSideBar"
:is-active="sidebar.opened"
class="hamburger-container"
/>
<hamburger :toggle-click="toggleSideBar" :is-active="sidebar.opened" class="hamburger-container" />
<breadcrumb />
<el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper">
<i class="icon iconfont iconyonghu user" />
<span class="user-name">{{ userName }}</span>
<span class="user-name">{{ username }}</span>
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown" class="user-dropdown">
@ -24,25 +20,25 @@
</template>
<script>
import { mapGetters } from "vuex";
import Breadcrumb from "@/components/Breadcrumb";
import Hamburger from "@/components/Hamburger";
import { getItem, delItem, getStorageItem } from "@/utils/storage";
import { aesEncrypt } from "@/utils/aes";
import { reqUpdatePassword } from "@/api/login";
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger'
import { getItem, delItem, getStorageItem } from '@/utils/storage'
import { aesEncrypt } from '@/utils/aes'
import { reqUpdatePassword } from '@/api/login'
export default {
data() {
//
var validatePass3 = (rule, value, callback) => {
if (value === "") {
callback(new Error("请再次输入密码"));
if (value === '') {
callback(new Error('请再次输入密码'))
} else if (value !== this.form.password) {
callback(new Error("两次输入密码不一致!"));
callback(new Error('两次输入密码不一致!'))
} else {
callback();
callback()
}
}
};
// const validatePass = (rule, value, callback) => {
// if (!/^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_]+$)(?![a-z0-9]+$)(?![a-z\W_]+$)(?![0-9\W_]+$)[a-zA-Z0-9\W_]{6,}$/.test(value)) {
// callback(new Error(''))
@ -52,103 +48,100 @@ export default {
// };
const validateOldPass = (rule, value, callback) => {
if (value.length < 6 || value.length > 30) {
callback(new Error("请输入原密码"));
callback(new Error('请输入原密码'))
} else {
callback();
callback()
}
}
};
return {
userName: "",
wordVisible: false, //
form: {
oldPassword: "",
password: "",
confirmPassword: ""
oldPassword: '',
password: '',
confirmPassword: '',
},
rules: {
oldPassword: [
{ required: true, validator: validateOldPass, trigger: "blur" }
{ required: true, validator: validateOldPass, trigger: 'blur' },
],
password: [
{ required: true, message: "请选择新密码", trigger: "blur" }
{ required: true, message: '请选择新密码', trigger: 'blur' },
],
confirmPassword: [
{ required: true, validator: validatePass3, trigger: "blur" }
]
{ required: true, validator: validatePass3, trigger: 'blur' },
],
},
}
};
},
components: {
Breadcrumb,
Hamburger
Hamburger,
},
computed: {
...mapGetters(["sidebar"])
},
created() {
this.userName = getItem("username");
...mapGetters(['sidebar']),
},
created() {},
methods: {
toggleSideBar() {
this.$store.dispatch("ToggleSideBar");
this.$store.dispatch('ToggleSideBar')
},
logout() {
this.$confirm("确定要退出吗", "温馨提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
this.$confirm('确定要退出吗', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
delItem("token");
sessionStorage.clear();
localStorage.clear();
this.$router.push("/login");
});
delItem('token')
sessionStorage.clear()
localStorage.clear()
this.$router.push('/login')
})
},
//
updatePassword() {
this.wordVisible = true;
this.wordVisible = true
this.$nextTick(() => {
this.$refs.form && this.$refs.form.resetFields();
});
this.$refs.form && this.$refs.form.resetFields()
})
},
//
confrimUpdate() {
this.$refs.form.validate(valid => {
this.$refs.form.validate((valid) => {
if (valid) {
const { oldPassword, password, confirmPassword } = this.form;
const { oldPassword, password, confirmPassword } = this.form
let data = {
oldPassword: aesEncrypt(oldPassword),
password: aesEncrypt(password),
confirmPassword: aesEncrypt(confirmPassword)
};
reqUpdatePassword(data).then(res => {
if (res.repCode == "0000") {
this.wordVisible = false;
this.$message.success("修改密码成功,请重新登录");
sessionStorage.clear();
localStorage.clear();
delItem("token");
this.$router.push("/login");
}
});
confirmPassword: aesEncrypt(confirmPassword),
}
reqUpdatePassword(data).then((res) => {
if (res.repCode == '0000') {
this.wordVisible = false
this.$message.success('修改密码成功,请重新登录')
sessionStorage.clear()
localStorage.clear()
delItem('token')
this.$router.push('/login')
}
})
} else {
return false;
return false
}
});
})
},
helpCenter() {
let helpCategory = JSON.parse(localStorage.getItem("helpCategory"));
let helpCategory = JSON.parse(localStorage.getItem('helpCategory'))
this.$router.push({
path: "/helpCenList/list",
path: '/helpCenList/list',
query: {
id: 0,
val: helpCategory[0].value,
title: helpCategory[0].label
}
});
}
}
};
title: helpCategory[0].label,
},
})
},
},
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

@ -1,7 +1,7 @@
<!--
* @Author: zyk
* @Author: qianlishi
* @Date: 2020-07-13 11:04:24
* @Last Modified by: zyk
* @Last Modified by: qianlishi
* @Last Modified time: 2020-07-13 11:04:24
!-->
<template>
@ -12,15 +12,7 @@
</div>
<div class="login_contant">
<img src="@/assets/images/login.png" alt="image" class="login_img" />
<el-form
ref="loginForm"
:model="loginForm"
:rules="loginRules"
class="login_form"
autocomplete="on"
label-position="left"
@keyup.enter.native="handleLogin"
>
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login_form" autocomplete="on" label-position="left" @keyup.enter.native="handleLogin">
<div class="title_container">
<h3 class="title">
HELLO,
@ -36,47 +28,15 @@
<div>
<p>用户名</p>
<el-form-item prop="username">
<el-input
ref="username"
v-model="loginForm.username"
placeholder="用户名"
name="username"
type="text"
tabindex="1"
autocomplete="on"
@focus="setTop('0')"
@change="getPsw"
/>
<el-input ref="username" v-model="loginForm.username" placeholder="用户名" name="username" type="text" tabindex="1" autocomplete="on" @focus="setTop('0')" @change="getPsw" />
</el-form-item>
</div>
<div>
<p>密码</p>
<input
name="password"
type="password"
autocomplete="off"
class="take"
/>
<el-tooltip
v-model="capsTooltip"
content="Caps lock is On"
placement="right"
manual
>
<input name="password" type="password" autocomplete="off" class="take" />
<el-tooltip v-model="capsTooltip" content="Caps lock is On" placement="right" manual>
<el-form-item prop="password">
<el-input
:key="passwordType"
ref="password"
v-model="loginForm.password"
:type="passwordType"
placeholder="用户密码"
name="password"
tabindex="2"
autocomplete="on"
@blur="capsTooltip = false"
@focus="setTop('50')"
@keyup.native="checkCapslock"
/>
<el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType" placeholder="用户密码" name="password" tabindex="2" autocomplete="on" @blur="capsTooltip = false" @focus="setTop('50')" @keyup.native="checkCapslock" />
<span class="show_pwd" @click="showPwd">
<i class="el-icon-view" />
</span>
@ -90,178 +50,168 @@
<p>记住密码</p>
</div>
</div>
<el-button
:loading="loading"
type="primary"
class="login_btn"
@click.native.prevent="handleLogin"
>登录</el-button
>
<el-button :loading="loading" type="primary" class="login_btn" @click.native.prevent="handleLogin">登录</el-button>
</el-form>
</div>
<!-- 验证码 -->
<Verify
v-if="needCaptcha"
ref="verify"
:captcha-type="'blockPuzzle'"
:img-size="{ width: '400px', height: '200px' }"
@success="verifylogin"
/>
<Verify v-if="needCaptcha" ref="verify" :captcha-type="'blockPuzzle'" :img-size="{ width: '400px', height: '200px' }" @success="verifylogin" />
</div>
</template>
<script>
import Verify from "@/components/verifition/Verify";
import cookies from "js-cookie";
import { Decrypt, Encrypt } from "@/utils/index";
import { login } from "@/api/login";
import { transPsw } from "@/utils/encrypted";
import { setItem, getItem } from "@/utils/storage";
import Verify from '@/components/verifition/Verify'
import cookies from 'js-cookie'
import { Decrypt, Encrypt } from '@/utils/index'
import { login } from '@/api/login'
import { transPsw } from '@/utils/encrypted'
import { setItem, getItem } from '@/utils/storage'
export default {
name: "Login",
name: 'Login',
components: {
Verify
Verify,
},
data() {
return {
activeTop: "-50%", //
activeTop: '-50%', //
rememberPsw: false, //
loginForm: {
username: "admin",
password: "123456",
verifyCode: ""
username: 'admin',
password: '123456',
verifyCode: '',
}, //
loginRules: {
username: [{ required: true, message: "用户名必填", trigger: "blur" }],
password: [{ required: true, message: "用户密码必填", trigger: "blur" }]
username: [{ required: true, message: '用户名必填', trigger: 'blur' }],
password: [
{ required: true, message: '用户密码必填', trigger: 'blur' },
],
}, //
passwordType: "password", //
passwordType: 'password', //
capsTooltip: false, //
loading: false, // loding
redirect: undefined, //
otherQuery: {}, //
needCaptcha: false
};
needCaptcha: false,
}
},
watch: {
$route: {
// from
handler: function(route) {
const query = route.query;
handler: function (route) {
const query = route.query
if (query) {
this.redirect = query.redirect;
this.otherQuery = this.getOtherQuery(query);
this.redirect = query.redirect
this.otherQuery = this.getOtherQuery(query)
}
},
immediate: true
}
immediate: true,
},
},
mounted() {
//
if (this.loginForm.username === "") {
this.$refs.username.focus();
} else if (this.loginForm.password === "") {
this.$refs.password.focus();
if (this.loginForm.username === '') {
this.$refs.username.focus()
} else if (this.loginForm.password === '') {
this.$refs.password.focus()
}
},
methods: {
//
getPsw() {
const cookVal = cookies.get(`u_${this.loginForm.username}`);
this.loginForm.password = cookVal && Decrypt(cookVal);
const cookVal = cookies.get(`u_${this.loginForm.username}`)
this.loginForm.password = cookVal && Decrypt(cookVal)
},
// top
setTop(val) {
this.activeTop = val;
this.activeTop = val
},
//
checkCapslock(e) {
const { key } = e;
this.capsTooltip = key && key.length === 1 && key >= "A" && key <= "Z";
const { key } = e
this.capsTooltip = key && key.length === 1 && key >= 'A' && key <= 'Z'
},
//
showPwd() {
if (this.passwordType === "password") {
this.passwordType = "";
if (this.passwordType === 'password') {
this.passwordType = ''
} else {
this.passwordType = "password";
this.passwordType = 'password'
}
this.$nextTick(() => {
this.$refs.password.focus();
});
this.$refs.password.focus()
})
},
//
useVerify() {
this.$refs.loginForm.validate(valid => {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.$refs.verify.show();
this.$refs.verify.show()
} else {
return false;
return false
}
});
})
},
//
verifylogin(params) {
this.loginForm.verifyCode = params.captchaVerification;
this.loginForm.verifyCode = params.captchaVerification
if (this.loginForm.verifyCode) {
this.loginApi();
this.loginApi()
}
},
//
handleLogin() {
this.$refs.loginForm.validate(valid => {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.loading = true;
this.loading = true
//
if (this.needCaptcha) {
this.useVerify();
return;
this.useVerify()
return
}
this.loginApi();
this.loginApi()
} else {
return false;
return false
}
});
})
},
async loginApi() {
let obj = {
username: this.loginForm.username,
password: transPsw(this.loginForm.password),
verifyCode: ""
};
const { code, data } = await login(obj);
console.log(data);
this.loading = false;
if (code != "200") return;
setItem("token", data.token);
setItem("username", data.username);
verifyCode: '',
}
const { code, data } = await login(obj)
console.log(data)
this.loading = false
if (code != '200') return
setItem('token', data.token)
setItem('username', data.username)
// cookie,15
this.rememberPsw &&
cookies.set(
`u_${this.loginForm.username}`,
Encrypt(this.loginForm.password),
{ expires: 15 }
);
)
if (data && data.captcha) {
this.needCaptcha = true;
this.needCaptcha = true
} else {
this.needCaptcha = false;
this.needCaptcha = false
this.$router.push({
path: this.redirect || "/index",
query: this.otherQuery
});
path: this.redirect || '/index',
query: this.otherQuery,
})
}
},
getOtherQuery(query) {
return Object.keys(query).reduce((acc, cur) => {
if (cur !== "redirect") {
acc[cur] = query[cur];
}
return acc;
}, {});
if (cur !== 'redirect') {
acc[cur] = query[cur]
}
}
};
return acc
}, {})
},
},
}
</script>
<style lang="scss">
@ -431,7 +381,7 @@ export default {
height: 14px;
}
& > input:checked::before {
content: "\2713";
content: '\2713';
background-color: #f5ab1b;
position: absolute;
top: 0;

@ -4922,7 +4922,7 @@ const widgetTools = [
name: 'layerName',
required: false,
placeholder: '',
value: '图',
value: '南丁格尔玫瑰图',
},
{
type: 'vue-color',

@ -6,7 +6,6 @@
</template>
<script>
import echarts from "echarts";
export default {
name: "WidgetPieNightingaleRoseArea", // https://echarts.apache.org/examples/zh/editor.html?c=pie-roseType-simple
components: {},
@ -28,7 +27,7 @@ export default {
},
series: [
{
name: "面积模式",
//name: "",
type: "pie",
radius: ["10%", "50%"],
center: ["50%", "50%"],
@ -36,21 +35,13 @@ export default {
itemStyle: {
borderRadius: 8
},
data: [
{ value: 40, name: "rose 1" },
{ value: 38, name: "rose 2" },
{ value: 32, name: "rose 3" },
{ value: 30, name: "rose 4" },
{ value: 28, name: "rose 5" },
{ value: 26, name: "rose 6" },
{ value: 22, name: "rose 7" },
{ value: 18, name: "rose 8" }
]
data: []
}
]
},
optionsStyle: {}, //
optionsData: {}, //
optionsCollapse: {}, //
optionsSetup: {}
};
},
@ -90,13 +81,10 @@ export default {
// options
editorOptions () {
this.setOptionsTitle();
// this.setOptionsX()
// this.setOptionsY()
// this.setOptionsTop()
// this.setOptionsTooltip()
// this.setOptionsMargin()
// this.setOptionsLegend()
// this.setOptionsColor()
this.setOptionsValue();
this.setOptionsTooltip();
this.setOptionsLegend();
this.setOptionsColor();
this.setOptionsData();
},
//
@ -117,104 +105,35 @@ export default {
fontWeight: optionsCollapse.subTextFontWeight,
fontSize: optionsCollapse.subTextFontSize
};
this.options.title = title;
},
// X
setOptionsX () {
const optionsCollapse = this.optionsSetup;
const xAxis = {
type: "category",
show: optionsCollapse.hideX, //
name: optionsCollapse.xName, //
nameTextStyle: {
color: optionsCollapse.xNameColor,
fontSize: optionsCollapse.xNameFontSize
},
nameRotate: optionsCollapse.textAngle, //
inverse: optionsCollapse.reversalX, //
axisLabel: {
show: true,
interval: optionsCollapse.textInterval, //
rotate: optionsCollapse.textAngle, //
textStyle: {
color: optionsCollapse.Xcolor, // x
fontSize: optionsCollapse.fontSizeX
}
},
axisLine: {
show: true,
lineStyle: {
color: optionsCollapse.lineColorX
}
},
splitLine: {
show: optionsCollapse.isShowSplitLineX,
lineStyle: {
color: optionsCollapse.splitLineColorX
},
},
};
this.options.xAxis = xAxis;
},
// Y
setOptionsY () {
const optionsCollapse = this.optionsSetup;
const yAxis = {
type: "value",
show: optionsCollapse.isShowY, //
name: optionsCollapse.textNameY, //
nameTextStyle: {
color: optionsCollapse.NameColorY,
fontSize: optionsCollapse.NameFontSizeY
},
inverse: optionsCollapse.reversalY, //
axisLabel: {
show: true,
textStyle: {
color: optionsCollapse.colorY, // x
fontSize: optionsCollapse.fontSizeY
}
},
splitLine: {
show: false
},
axisLine: {
show: true,
lineStyle: {
color: optionsCollapse.lineColorY
}
},
splitLine: {
show: optionsCollapse.isShowSplitLineY,
lineStyle: {
color: optionsCollapse.splitLineColorY
},
},
};
this.options.yAxis = yAxis;
},
// or
setOptionsTop () {
//
setOptionsValue() {
const optionsCollapse = this.optionsSetup;
const series = this.options.series;
for (const key in series) {
if (series[key].type == "bar") {
series[key].label = {
const numberValue = optionsCollapse.numberValue ? "{c}" : "";
const percentage = optionsCollapse.percentage ? "({d})%" : "";
const label = {
show: optionsCollapse.isShow,
position: "top",
distance: 10,
fontSize: optionsCollapse.fontSize,
formatter: `{a|{b}${numberValue} ${percentage}}`,
rich: {
a: {
padding: [-30, 15, -20, 15],
color: optionsCollapse.subTextColor,
fontSize: optionsCollapse.fontSize,
fontWeight: optionsCollapse.fontWeight
}
},
fontSize: optionsCollapse.fontSize,
fontWeight: optionsCollapse.optionsCollapse
};
series[key].barWidth = optionsCollapse.maxWidth;
series[key].barMinHeight = optionsCollapse.minHeight;
for (const key in series) {
if (series[key].type == "pie") {
series[key].label = label;
series[key].labelLine = { show: optionsCollapse.isShow };
}
}
this.options.series = series;
},
// tooltip
setOptionsTooltip () {
@ -259,7 +178,7 @@ export default {
legend.itemWidth = optionsCollapse.lengedWidth;
},
//
setOptionsColor () {
setOptionsColor() {
const optionsCollapse = this.optionsSetup;
const customColor = optionsCollapse.customColor;
if (!customColor) return;
@ -267,76 +186,45 @@ export default {
for (let i = 0; i < customColor.length; i++) {
arrColor.push(customColor[i].color);
}
const itemStyle = {
normal: {
color: params => {
return arrColor[params.dataIndex];
},
barBorderRadius: optionsCollapse.radius
}
};
for (const key in this.options.series) {
if (this.options.series[key].type == "bar") {
this.options.series[key].itemStyle = itemStyle;
}
}
this.options.color = arrColor;
this.options = Object.assign({}, this.options);
},
//
setOptionsData () {
const optionsSetup = this.optionsSetup;
console.log(optionsSetup);
setOptionsData() {
const optionsData = this.optionsData; // or
console.log(optionsData);
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData, optionsSetup)
: this.dynamicDataFn(optionsData.dynamicData, optionsSetup);
? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
//
staticDataFn (val, optionsSetup) {
staticDataFn(val) {
const staticData = JSON.parse(val);
// x
if (optionsSetup.verticalShow) {
this.options.xAxis.data = [];
this.options.yAxis.data = staticData.categories;
this.options.xAxis.type = "value";
this.options.yAxis.type = "category";
} else {
this.options.xAxis.data = staticData.categories;
this.options.yAxis.data = [];
this.options.xAxis.type = "category";
this.options.yAxis.type = "value";
}
// series
const series = this.options.series;
for (const i in series) {
if (series[i].type == "bar") {
series[i].data = staticData.series[0].data;
for (const key in this.options.series) {
if (this.options.series[key].type == "pie") {
this.options.series[key].data = staticData;
}
}
},
//
dynamicDataFn (val, optionsSetup) {
console.log(val);
dynamicDataFn(val, refreshTime) {
if (!val) return;
// x
if (optionsSetup.verticalShow) {
this.options.xAxis.data = [];
this.options.yAxis.data = val.xAxis;
this.options.xAxis.type = "value";
this.options.yAxis.type = "category";
if (this.ispreview) {
this.getEchartData(val);
this.flagInter = setInterval(() => {
this.getEchartData(val);
}, refreshTime);
} else {
this.options.xAxis.data = val.xAxis;
this.options.yAxis.data = [];
this.options.xAxis.type = "category";
this.options.yAxis.type = "value";
this.getEchartData(val);
}
// series
const series = this.options.series;
for (const i in series) {
if (series[i].type == "bar") {
series[i].data = val.series[i].data;
},
getEchartData(val) {
const data = this.queryEchartsData(val);
data.then(res => {
this.renderingFn(res);
});
},
renderingFn(val) {
for (const key in this.options.series) {
if (this.options.series[key].type == "pie") {
this.options.series[key].data = val;
}
}
}

@ -11,142 +11,64 @@
<el-row :gutter="10">
<el-col :xs="24" :sm="20" :md="12" :lg="6" :xl="4">
<el-form-item label="数据源名称">
<el-input
v-model.trim="params.sourceName"
size="mini"
clearable
placeholder="数据源名称"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-input v-model.trim="params.sourceName" size="mini" clearable placeholder="数据源名称" class="filter-item" @keyup.enter.native="crud.toQuery" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="20" :md="12" :lg="6" :xl="4">
<el-form-item label="数据源编码">
<el-input
v-model.trim="params.sourceCode"
size="mini"
clearable
placeholder="数据源Code"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-input v-model.trim="params.sourceCode" size="mini" clearable placeholder="数据源Code" class="filter-item" @keyup.enter.native="crud.toQuery" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="20" :md="12" :lg="6" :xl="4" class="query">
<el-form-item label="数据源类型" size="mini">
<Dictionary
v-model="params.sourceType"
:updata-dict="params.sourceType"
:dict-key="'SOURCE_TYPE'"
/>
<Dictionary v-model="params.sourceType" :updata-dict="params.sourceType" :dict-key="'SOURCE_TYPE'" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="20" :md="4" :lg="4" :xl="4" class="query">
<el-button type="primary" size="mini" @click="search('form')"
>查询</el-button
>
<el-button type="danger" size="mini" @click="reset('form')"
>重置</el-button
>
<el-button type="primary" size="mini" @click="search('form')"></el-button>
<el-button type="danger" size="mini" @click="reset('form')"></el-button>
</el-col>
</el-row>
</el-form>
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="showAddLogModel()"
>新增</el-button
>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="showAddLogModel()"></el-button>
<!--表格渲染-->
<el-table
v-loading="listLoading"
border
:data="list"
class="mt10"
element-loading-text="Loading"
style="width: 100%"
>
<el-table-column
align="center"
label="序号"
type="index"
min-width="40"
/>
<el-table-column prop="sourceType" label="数据源类型" />
<el-table-column prop="sourceNameCode" label="数据源名称[编码]" />
<el-table-column prop="sourceDesc" label="数据源描述" />
<el-table-column prop="createBy" label="创建人" width="100" />
<el-table-column prop="createTime" label="创建时间" width="140" />
<el-table-column prop="updateBy" label="修改人" width="100" />
<el-table-column prop="updateTime" label="修改时间" width="140" />
<el-table-column label="操作" width="120px" align="center">
<el-table v-loading="listLoading" border :data="list" class="mt10" element-loading-text="Loading" style="width: 100%">
<el-table-column align="center" label="序号" type="index" min-width="60px" />
<el-table-column prop="sourceType" label="数据源类型" min-width="140px" />
<el-table-column prop="sourceNameCode" label="数据源名称[编码]" min-width="250px" />
<el-table-column prop="sourceDesc" label="数据源描述" min-width="250px" />
<el-table-column prop="createBy" label="创建人" min-width="100px" />
<el-table-column prop="createTime" label="创建时间" min-width="150px" />
<el-table-column prop="updateBy" label="修改人" min-width="100px" />
<el-table-column prop="updateTime" label="修改时间" min-width="150px" />
<el-table-column label="操作" align="center" min-width="120px">
<template slot-scope="scope">
<el-button type="text" @click="showAddLogModel(scope.row)"
>编辑</el-button
>
<el-button type="text" @click="showAddLogModel(scope.row)"></el-button>
<!-- <el-popconfirm :title="'确定删除' + scope.row.sourceNameCode + '吗?'"
@onConfirm="delData(scope.row)"> -->
<el-button slot="reference" @click="delData(scope.row)" type="text"
>删除</el-button
>
<el-button slot="reference" @click="delData(scope.row)" type="text">删除</el-button>
<!-- </el-popconfirm> -->
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:total="totalCount"
:page-sizes="[10, 20, 50, 100]"
:page-size="params.pageSize"
:current-page="params.pageNumber"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
<el-pagination :total="totalCount" :page-sizes="[10, 20, 50, 100]" :page-size="params.pageSize" :current-page="params.pageNumber" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
<!--表单组件-->
<el-dialog
title="项目基础配置"
width="50%"
:close-on-click-modal="false"
center
:visible.sync="basicDialog"
@close="closeDialog"
>
<el-form
ref="userForm"
:model="dialogForm"
:rules="rules"
size="small"
label-width="100px"
>
<el-dialog title="项目基础配置" width="50%" :close-on-click-modal="false" center :visible.sync="basicDialog" @close="closeDialog">
<el-form ref="userForm" :model="dialogForm" :rules="rules" size="small" label-width="100px">
<el-row :gutter="10">
<el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
<el-form-item label="数据源类型" prop="sourceType">
<el-select
v-model.trim="dialogForm.sourceType"
placeholder="请选择"
clearable
@change="selectChange"
>
<el-option
v-for="item in dictionaryOptions"
:key="item.id"
:label="item.text"
:value="item.id"
/>
<el-select v-model.trim="dialogForm.sourceType" placeholder="请选择" clearable @change="selectChange">
<el-option v-for="item in dictionaryOptions" :key="item.id" :label="item.text" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="20" :md="7" :lg="7" :xl="7">
<el-form-item label="数据源编码" prop="sourceCode">
<el-input
:disabled="updataDisabled"
v-model.trim="dialogForm.sourceCode"
/>
<el-input :disabled="updataDisabled" v-model.trim="dialogForm.sourceCode" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="20" :md="7" :lg="7" :xl="7">
@ -156,24 +78,12 @@
</el-col>
<el-col :xs="24" :sm="20" :md="20" :lg="20" :xl="20">
<el-form-item label="数据源描述">
<el-input
v-model.trim="dialogForm.sourceDesc"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4 }"
/>
<el-input v-model.trim="dialogForm.sourceDesc" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col
v-for="(data, index) in dataLink"
:key="index"
:xs="24"
:sm="20"
:md="20"
:lg="20"
:xl="20"
>
<el-col v-for="(data, index) in dataLink" :key="index" :xs="24" :sm="20" :md="20" :lg="20" :xl="20">
<el-form-item :label="data.labelValue">
<el-input v-model.trim="data.value" />
</el-form-item>
@ -183,9 +93,7 @@
<div slot="footer" class="dialog-footer">
<el-button @click="closeDialog"></el-button>
<el-button type="warning" @click="test"></el-button>
<el-button type="primary" @click="UserConfirm('userForm')"
>确定</el-button
>
<el-button type="primary" @click="UserConfirm('userForm')"></el-button>
</div>
</el-dialog>
</div>
@ -197,19 +105,19 @@ import {
testConnection,
addDataSource,
editDataSource,
deleteDataSource
} from "@/api/report";
import { getDictList } from "@/api/dict-data"; //
import Dictionary from "@/components/Dictionary/index";
deleteDataSource,
} from '@/api/report'
import { getDictList } from '@/api/dict-data' //
import Dictionary from '@/components/Dictionary/index'
export default {
name: "Support",
name: 'Support',
components: { Dictionary },
data() {
return {
dictionaryOptions: [], //
selectedList: [],
clickType: "",
clickType: '',
formData: {},
list: null,
totalCount: 0,
@ -219,206 +127,206 @@ export default {
dialogFormVisible: false,
basicDialog: false,
params: {
sourceName: "",
sourceCode: "",
sourceType: "",
sourceName: '',
sourceCode: '',
sourceType: '',
pageNumber: 1,
pageSize: 10,
order: "DESC",
sort: "update_time"
order: 'DESC',
sort: 'update_time',
},
dialogForm: {
sourceName: "",
sourceCode: "",
sourceType: "",
sourceDesc: "",
sourceConfig: ""
sourceName: '',
sourceCode: '',
sourceType: '',
sourceDesc: '',
sourceConfig: '',
},
dataLink: [],
rules: {
sourceType: [
{ required: true, message: "数据集名称必选", trigger: "change" }
{ required: true, message: '数据集名称必选', trigger: 'change' },
],
sourceCode: [
{ required: true, message: "数据集编码必填", trigger: "blur" }
{ required: true, message: '数据集编码必填', trigger: 'blur' },
],
sourceName: [
{ required: true, message: "数据源名称必选", trigger: "blur" }
]
{ required: true, message: '数据源名称必选', trigger: 'blur' },
],
},
value: "",
value: '',
updataDisabled: false,
testReplyCode: null
};
testReplyCode: null,
}
},
watch: {},
// beforeCreatethis
beforeCreate: function() {},
beforeCreate: function () {},
mounted() {},
created() {
this.getSystem();
this.queryByPage();
this.getSystem()
this.queryByPage()
},
methods: {
//
search() {
this.params.pageNumber = 1;
this.queryByPage();
this.params.pageNumber = 1
this.queryByPage()
},
//
reset(formName) {
// this.$refs[formName].resetFields()
this.params.sourceName = "";
this.params.sourceCode = "";
this.params.pageNumber = 1;
this.params.sourceType = "";
this.queryByPage();
this.params.sourceName = ''
this.params.sourceCode = ''
this.params.pageNumber = 1
this.params.sourceType = ''
this.queryByPage()
},
async queryByPage() {
const res = await pageList(this.params);
if (res.code != "200") return;
this.listLoading = true;
this.list = res.data.records;
this.list.forEach(value => {
value["sourceNameCode"] =
value.sourceName + "[" + value.sourceCode + "]";
});
this.totalCount = res.data.total;
this.totalPage = res.data.pages;
this.listLoading = false;
const res = await pageList(this.params)
if (res.code != '200') return
this.listLoading = true
this.list = res.data.records
this.list.forEach((value) => {
value['sourceNameCode'] =
value.sourceName + '[' + value.sourceCode + ']'
})
this.totalCount = res.data.total
this.totalPage = res.data.pages
this.listLoading = false
},
handleSizeChange(val) {
this.params.pageSize = val;
this.queryByPage();
this.params.pageSize = val
this.queryByPage()
},
handleCurrentChange(val) {
this.params.pageNumber = val;
this.queryByPage();
this.params.pageNumber = val
this.queryByPage()
},
//
closeDialog(bool) {
// bool && this.search('form') //
// this.$refs['userForm'].resetFields()
this.basicDialog = false;
this.basicDialog = false
},
//
showAddLogModel(val) {
this.basicDialog = true;
this.basicDialog = true
if (val == undefined) {
this.updataDisabled = false;
this.getSystem();
this.updataDisabled = false
this.getSystem()
this.dialogForm = {
sourceName: "",
sourceCode: "",
sourceType: "",
sourceDesc: "",
sourceConfig: ""
};
sourceName: '',
sourceCode: '',
sourceType: '',
sourceDesc: '',
sourceConfig: '',
}
} else {
this.updataDisabled = true;
this.dialogForm = val;
const newSourceType = this.dialogForm;
let newDataLink = [];
this.dictionaryOptions.map(item => {
this.updataDisabled = true
this.dialogForm = val
const newSourceType = this.dialogForm
let newDataLink = []
this.dictionaryOptions.map((item) => {
if (item.id == newSourceType.sourceType) {
newDataLink = JSON.parse(item.extend);
var sourceConfigJson = JSON.parse(newSourceType.sourceConfig);
newDataLink = JSON.parse(item.extend)
var sourceConfigJson = JSON.parse(newSourceType.sourceConfig)
for (var i = 0; i < newDataLink.length; i++) {
newDataLink[i].value = sourceConfigJson[newDataLink[i].label];
newDataLink[i].value = sourceConfigJson[newDataLink[i].label]
}
}
});
this.dataLink = newDataLink;
})
this.dataLink = newDataLink
}
},
//
async getSystem() {
const { code, data } = await getDictList("SOURCE_TYPE");
if (code != "200") return;
this.dictionaryOptions = data;
this.dialogForm.sourceType = this.dictionaryOptions[0].text;
this.dataLink = JSON.parse(this.dictionaryOptions[0].extend);
const { code, data } = await getDictList('SOURCE_TYPE')
if (code != '200') return
this.dictionaryOptions = data
this.dialogForm.sourceType = this.dictionaryOptions[0].text
this.dataLink = JSON.parse(this.dictionaryOptions[0].extend)
},
selectChange(val) {
this.dataLink = [];
const extendJSON = this.dictionaryOptions.find(function(obj) {
return obj.id == val;
});
this.dataLink = JSON.parse(extendJSON.extend);
this.dataLink = []
const extendJSON = this.dictionaryOptions.find(function (obj) {
return obj.id == val
})
this.dataLink = JSON.parse(extendJSON.extend)
},
//
test() {
const newList = {};
this.dataLink.forEach(item => {
newList[item.label] = item.value;
});
this.dialogForm.sourceConfig = JSON.stringify(newList);
testConnection(this.dialogForm).then(data => {
if (data.code == "200") {
this.testReplyCode = data.code;
const newList = {}
this.dataLink.forEach((item) => {
newList[item.label] = item.value
})
this.dialogForm.sourceConfig = JSON.stringify(newList)
testConnection(this.dialogForm).then((data) => {
if (data.code == '200') {
this.testReplyCode = data.code
this.$message({
message: "测试成功!",
type: "success"
});
message: '测试成功!',
type: 'success',
})
} else {
this.testReplyCode = null;
this.testReplyCode = null
}
});
})
},
async delData(val) {
this.$confirm("确定删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
this.$emit("deletelayer");
this.visible = false;
const { code, data } = await deleteDataSource(val);
if (code != "200") return;
this.queryByPage();
this.$emit('deletelayer')
this.visible = false
const { code, data } = await deleteDataSource(val)
if (code != '200') return
this.queryByPage()
this.$message({
type: "success",
message: "删除成功!"
});
type: 'success',
message: '删除成功!',
})
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除"
});
});
type: 'info',
message: '已取消删除',
})
})
},
//
async UserConfirm(formName) {
const newList = {};
this.dataLink.forEach(item => {
newList[item.label] = item.value;
});
this.dialogForm.sourceConfig = JSON.stringify(newList);
const newList = {}
this.dataLink.forEach((item) => {
newList[item.label] = item.value
})
this.dialogForm.sourceConfig = JSON.stringify(newList)
this.$refs[formName].validate(async (valid, obj) => {
if (valid) {
if (this.testReplyCode != "200") {
this.$message.error("测试结果为成功后方可保存!");
return;
if (this.testReplyCode != '200') {
this.$message.error('测试结果为成功后方可保存!')
return
}
if (this.dialogForm.id == undefined) {
const { code } = await addDataSource(this.dialogForm);
if (code != "200") return;
this.queryByPage();
const { code } = await addDataSource(this.dialogForm)
if (code != '200') return
this.queryByPage()
} else {
const { code } = await editDataSource(this.dialogForm);
if (code != "200") return;
this.queryByPage();
const { code } = await editDataSource(this.dialogForm)
if (code != '200') return
this.queryByPage()
}
this.closeDialog(false);
this.closeDialog(false)
} else {
return;
}
});
}
return
}
};
})
},
},
}
</script>
<style lang="scss" scoped>
.title {

Loading…
Cancel
Save