前后端分目录

This commit is contained in:
andywang
2022-07-14 12:55:31 +08:00
parent cd72c43d62
commit bb8cf90f53
1155 changed files with 47237 additions and 14446 deletions

View File

@@ -0,0 +1,56 @@
<template>
<div class="error-page">
<div class="error-code">4<span>0</span>3</div>
<div class="error-desc">啊哦~ 你没有权限访问该页面哦</div>
<div class="error-handle">
<router-link to="/">
<el-button type="primary" size="large">返回首页</el-button>
</router-link>
<el-button class="error-btn" type="primary" size="large" @click="goBack">返回上一页</el-button>
</div>
</div>
</template>
<script>
export default {
methods: {
goBack(){
this.$router.go(-1);
}
}
}
</script>
<style scoped>
.error-page{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 100%;
height: 100%;
background: #f3f3f3;
box-sizing: border-box;
}
.error-code{
line-height: 1;
font-size: 250px;
font-weight: bolder;
color: #f02d2d;
}
.error-code span{
color: #00a854;
}
.error-desc{
font-size: 30px;
color: #777;
}
.error-handle{
margin-top: 30px;
padding-bottom: 200px;
}
.error-btn{
margin-left: 100px;
}
</style>

View File

@@ -0,0 +1,56 @@
<template>
<div class="error-page">
<div class="error-code">4<span>0</span>4</div>
<div class="error-desc">啊哦~ 你所访问的页面不存在</div>
<div class="error-handle">
<router-link to="/">
<el-button type="primary" size="large">返回首页</el-button>
</router-link>
<el-button class="error-btn" type="primary" size="large" @click="goBack">返回上一页</el-button>
</div>
</div>
</template>
<script>
export default {
methods: {
goBack(){
this.$router.go(-1);
}
}
}
</script>
<style scoped>
.error-page{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 100%;
height: 100%;
background: #f3f3f3;
box-sizing: border-box;
}
.error-code{
line-height: 1;
font-size: 250px;
font-weight: bolder;
color: #2d8cf0;
}
.error-code span{
color: #00a854;
}
.error-desc{
font-size: 30px;
color: #777;
}
.error-handle{
margin-top: 30px;
padding-bottom: 200px;
}
.error-btn{
margin-left: 100px;
}
</style>

View File

@@ -0,0 +1,420 @@
<template>
<div>
<el-row :gutter="20">
<el-col :span="8">
<el-card shadow="hover" class="mgb20" style="height:252px;">
<div class="user-info">
<img src="../../assets/img/img.jpg" class="user-avator" alt />
<div class="user-info-cont">
<div class="user-info-name">{{name}}</div>
<!-- <div>{{role}}</div> -->
</div>
</div>
<div class="user-info-list">
上次登录时间
<span>{{lastLoginTime | formatDate}}</span>
</div>
</el-card>
<el-card shadow="hover" style="height:252px;">
<div slot="header" class="clearfix">
<span>指标详情</span>
</div>
<charts sid="dashboardLeft" height='250px' width='100%' :option="options"></charts>
</el-card>
</el-col>
<el-col :span="16">
<el-row :gutter="20" class="mgb20">
<el-col :span="8">
<el-card shadow="hover" :body-style="{padding: '0px'}">
<div class="grid-content grid-con-1">
<i class="el-icon-lx-people grid-con-icon"></i>
<div class="grid-cont-right">
<div class="grid-num">{{fieldCount}}</div>
<div>指标数量</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="8">
<el-card shadow="hover" :body-style="{padding: '0px'}">
<div class="grid-content grid-con-2">
<i class="el-icon-lx-notice grid-con-icon"></i>
<div class="grid-cont-right">
<div class="grid-num">{{interfaceCount}}</div>
<div>接口数量</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="8">
<el-card shadow="hover" :body-style="{padding: '0px'}">
<div class="grid-content grid-con-3">
<i class="el-icon-lx-goods grid-con-icon"></i>
<div class="grid-cont-right">
<div class="grid-num">{{databaseCount}}</div>
<div>数据源数量</div>
</div>
</div>
</el-card>
</el-col>
</el-row>
<el-card shadow="hover" style="height:403px;">
<div slot="header" class="clearfix">
<span>活动日志</span>
</div>
<el-table :show-header="false" :data="todoList" style="width:100%;">
<el-table-column>
<template slot-scope="scope">
<div class="todo-item">{{scope.row.opUserName}} {{scope.row.ip}}
{{scope.row.startTime | formatDate}}
{{scope.row.opName}}
</div>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-card shadow="hover">
<p style="text-align: center;font-size: 18px;font-weight: bold;color: #666;">指标调用次数</p>
<div style="display: flex;flex-wrap: wrap;">
<p v-for="value in CallCountList" style="width: 50%;font-size: 16px;text-align: center;">{{value.name}}:{{value.value}}</p>
</div>
</el-card>
</el-col>
<!-- <el-col :span="12">
<el-card shadow="hover">
<charts sid="dashboardRight" height='250px' width='100%' :option="options2"></charts>
</el-card>
</el-col> -->
</el-row>
</div>
</template>
<script>
import charts from '@/components/common/charts.vue'
import bus from '../common/bus';
import {
getIndexInfo,
getFieldCallCountList
} from '../../api/index';
export default {
name: 'dashboard',
components: {
// Schart,
charts
},
data() {
return {
name: localStorage.getItem('ms_username'),
lastLoginTime: null,
fieldCount: null,
interfaceCount: null,
databaseCount: null,
fieldTypeName:{
1:'基础指标',
2:'数据库指标',
3:'衍生指标',
4:'接口指标',
5:'常量指标',
6:'实时指标',
},
CallCountList:[],
todoList: [],
options: {
grid: {
// top:'20%'
},
tooltip: {
trigger: 'item',
formatter: '{b} : {c} ({d}%)'
},
legend: {
left: 'center',
top: 'bottom',
},
series: [{
name: 'Area Mode',
type: 'pie',
radius: [10, 60],
center: ['50%', '30%'],
roseType: 'area',
itemStyle: {
borderRadius: 5
},
data: [
]
}]
},
options2: {
title: {
text: '最近几个月引擎使用趋势图',
left: 'center'
},
grid: {
bottom: '10% '
},
xAxis: [{
type: 'category',
axisTick: {
show: false
},
data: []
}],
yAxis: [{
type: 'value'
}],
tooltip: {
trigger: 'item'
},
series: []
},
};
},
computed: {
role() {
return this.name === 'admin' ? '超级管理员' : '普通用户';
}
},
// created() {
// this.handleListener();
// this.changeDate();
// },
// activated() {
// this.handleListener();
// },
// deactivated() {
// window.removeEventListener('resize', this.renderChart);
// bus.$off('collapse', this.handleBus);
// },
created() {
this.getIndexInfos();
getFieldCallCountList({}).then(res=>{
if(res.status=='1'){
this.CallCountList=res.data.map(value=>{
return {
name:value.fieldCn,
value:value.callCount
}
})
}
})
},
methods: {
changeDate() {
const now = new Date().getTime();
this.data.forEach((item, index) => {
const date = new Date(now - (6 - index) * 86400000);
item.name = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
});
},
async getIndexInfos() {
const result = await getIndexInfo();
const data = result.data;
// 引擎基本信息
this.fieldCount = data.fieldCount;
this.interfaceCount = data.interfaceCount;
this.databaseCount = data.databaseCount;
// 引擎使用占比
// 最近几天引擎使用情况
// var labelOption = {
// show: true,
// position: 'insideBottomRight',
// distance: 10,
// align: 'left',
// verticalAlign: 'middle',
// rotate: 90,
// // formatter: '{c} {name|{a}}',
// fontSize: 12,
// rich: {
// name: {}
// }
// };
this.options.series[0].data=data.fieldTypeGroup.map(value=>{
return {
value:value.fieldCount,
name:this.fieldTypeName[value.fieldType]
}
})
// // 最近几个月引擎使用情况
// this.options2.xAxis[0].data = data.recentMonthMap.labels;
// this.options2.series = data.recentMonthMap.datasets.map(value => {
// return {
// name: value.label,
// type: 'line',
// barGap: 0,
// label: labelOption,
// emphasis: {
// focus: 'series'
// },
// data: value.data
// }
// })
// 上次登录时间
this.lastLoginTime = data.lastLoginTime;
// 活动日志
this.todoList = data.logList;
}
},
filters: {
formatDate: function(value) {
let date = new Date(value);
let y = date.getFullYear();
let MM = date.getMonth() + 1;
MM = MM < 10 ? ('0' + MM) : MM;
let d = date.getDate();
d = d < 10 ? ('0' + d) : d;
let h = date.getHours();
h = h < 10 ? ('0' + h) : h;
let m = date.getMinutes();
m = m < 10 ? ('0' + m) : m;
let s = date.getSeconds();
s = s < 10 ? ('0' + s) : s;
return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
}
}
};
</script>
<style scoped>
.el-row {
margin-bottom: 20px;
}
.grid-content {
display: flex;
align-items: center;
height: 100px;
}
.grid-cont-right {
flex: 1;
text-align: center;
font-size: 14px;
color: #999;
}
.grid-num {
font-size: 30px;
font-weight: bold;
}
.grid-con-icon {
font-size: 50px;
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
color: #fff;
}
.grid-con-1 .grid-con-icon {
background: rgb(45, 140, 240);
}
.grid-con-1 .grid-num {
color: rgb(45, 140, 240);
}
.grid-con-2 .grid-con-icon {
background: rgb(100, 213, 114);
}
.grid-con-2 .grid-num {
color: rgb(45, 140, 240);
}
.grid-con-3 .grid-con-icon {
background: rgb(242, 94, 67);
}
.grid-con-3 .grid-num {
color: rgb(242, 94, 67);
}
.user-info {
display: flex;
align-items: center;
padding-bottom: 20px;
border-bottom: 2px solid #ccc;
margin-bottom: 20px;
}
.user-avator {
width: 120px;
height: 120px;
border-radius: 50%;
}
.user-info-cont {
padding-left: 50px;
flex: 1;
font-size: 14px;
color: #999;
}
.user-info-cont div:first-child {
font-size: 30px;
color: #222;
}
.user-info-list {
font-size: 14px;
color: #999;
line-height: 25px;
}
.user-info-list span {
margin-left: 70px;
}
.mgb20 {
margin-bottom: 20px;
}
.todo-item {
font-size: 14px;
}
.todo-item-del {
text-decoration: line-through;
color: #999;
}
.schart {
width: 100%;
height: 300px;
}
</style>

View File

@@ -0,0 +1,706 @@
<template>
<div style="height: 90%; ">
<!-- 创建和搜索 -->
<div class="datasou_top" style="height: 10%;">
<el-row style="margin-bottom: 30px;margin-top: 20px;">
<el-col :span="15">
<el-button style="margin-right:20px;" type="primary" @click="createEngine">创建数据源</el-button>
<el-select v-model="sourceType" placeholder="请选择数据源类型" @change="changeSource">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-col>
</el-row>
</div>
<div class="datasou_cont" style="height: 80%;" v-if="data">
<div class="datasou_table">
<el-row>
<el-table border :data="data.data.data" style="width: 100%" v-loading="loading">
<el-table-column label="序号" align="center">
<template slot-scope="scope">
{{((pageNo-1)*10+scope.$index+1)}}
</template>
</el-table-column>
<el-table-column prop="name" label="name" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column v-if="sourceType == 'Spark'" prop="sparkHome" label="park-home" align="center"
show-overflow-tooltip>
</el-table-column>
<el-table-column v-if="sourceType == 'Spark'" prop="appName" label="app-name" align="center"
show-overflow-tooltip>
</el-table-column>
<el-table-column v-if="sourceType == 'Spark'" prop="masterUrl" label="master" align="center"
show-overflow-tooltip>
</el-table-column>
<el-table-column v-if="sourceType == 'Hive'" prop="url" label="url" align="center"
show-overflow-tooltip>
</el-table-column>
<el-table-column v-if="sourceType != 'Hive'&&sourceType!='Spark'" prop="host" label="host"
align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column v-if="sourceType != 'Hive'&&sourceType!='Spark'" prop="port" label="port"
align="center">
</el-table-column>
<el-table-column v-if="sourceType !='Hive'&&sourceType!='Spark'" prop="dbName" label="db-name"
align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column v-if="sourceType!='Spark'" prop="userName"
label="user-name" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="updataTime" label="最后更新时间" align="center">
<template slot-scope="scope">
<span style="white-space: nowrap;">{{
new Date(scope.row.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row.updateTime).toTimeString().substr(0, 8)
}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" size="s">
<template slot-scope="scope">
<div>
<el-button icon="el-icon-search" circle size="mini"
@click="dialogShow(scope.$index)"></el-button>
<el-button type="primary" icon="el-icon-edit" circle size="mini"
@click="modificationShow(scope.row.id)"></el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini"
@click="deletelistsor(scope.row.id)"></el-button>
</div>
</template>
</el-table-column>
</el-table>
</el-row>
</div>
<div style="float: right;margin-right: 120px;margin-top: 40px;">
<el-pagination :current-page="pageNo" @current-change="currpage" background layout="prev, pager, next"
:total="data.data.pager.total" v-if="data!==null">
</el-pagination>
</div>
</div>
<el-dialog title="数据库详情" :visible.sync="dialogVisible" width="40%" :before-close="handleClose"
class="DataSource_look">
<div v-if="tempDialogData!==null">
<div class="textLayout">
<p>连接名称</p>
<p v-if="tempDialogData.name">{{tempDialogData.name}}</p>
</div>
<div class="textLayout" v-if="tempDialogData.type == 'Spark'">
<p>spark-home</p>
<p v-if="tempDialogData.sparkHome">{{tempDialogData.sparkHome}}</p>
</div>
<div class="textLayout" v-if="tempDialogData.type == 'Spark'">
<p>app-name</p>
<p v-if="tempDialogData.appName">{{tempDialogData.appName}}</p>
</div>
<div class="textLayout" v-if="tempDialogData.type == 'Spark'">
<p>master</p>
<p v-if="tempDialogData.masterUrl">{{tempDialogData.masterUrl}}</p>
</div>
<div class="textLayout" v-if="tempDialogData.type == 'Hive'">
<p>地址</p>
<p v-if="tempDialogData.url">{{tempDialogData.url}}</p>
</div>
<div class="textLayout" v-if="tempDialogData.type != 'Hive'&&tempDialogData.type!='Spark'">
<p>主机地址</p>
<p v-if="tempDialogData.host">{{tempDialogData.host}}</p>
</div>
<div class="textLayout" v-if="tempDialogData.type != 'Hive'&&tempDialogData.type!='Spark'">
<p>端口</p>
<p v-if="tempDialogData.port">{{tempDialogData.port}}</p>
</div>
<div class="textLayout" v-if="tempDialogData.type !='Hive'&&tempDialogData.type!='Spark'">
<p>数据库名称</p>
<p v-if="tempDialogData.dbName">{{tempDialogData.dbName}}</p>
</div>
<div class="textLayout" v-if="tempDialogData.type!='Spark'">
<p>用户名</p>
<p v-if="tempDialogData.userName">{{tempDialogData.userName}}</p>
</div>
<div class="textLayout">
<p>创建时间</p>
<p v-if="tempDialogData.createTime">
{{new Date(tempDialogData.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(tempDialogData.updateTime).toTimeString().substr(0, 8)}}
</p>
</div>
<div class="textLayout">
<p>创建人</p>
<p v-if="tempDialogData.creator">{{tempDialogData.creatorName}}</p>
</div>
<div class="textLayout">
<p>修改时间</p>
<p v-if="tempDialogData.updateTime">
{{new Date(tempDialogData.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(tempDialogData.updateTime).toTimeString().substr(0, 8)}}
</p>
</div>
<div class="textLayout">
<p>修改人</p>
<p v-if="tempDialogData.modifier">{{tempDialogData.modifierName}}</p>
</div>
<div class="textLayout">
<p>数据库类型</p>
<p v-if="tempDialogData.type">{{tempDialogData.type}}</p>
</div>
</div>
<div v-else>
数据错误 请重新尝试
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false;tempDialogData=null"> </el-button>
</span>
</el-dialog>
<el-dialog :title="modificationId===null?'创建'+sourceType+'数据源':'修改'+sourceType+'数据源'"
:visible.sync="modificationVisible" width="35%" :before-close="handleClose">
<div>
<div class="textLayout">
<p>name</p>
<p>
<el-input placeholder="名称" v-model="modificationData.name" clearable maxlength="20">
</el-input>
</p>
</div>
<div class="textLayout" v-if="sourceType == 'Spark'">
<p>spark-home</p>
<p>
<el-input placeholder="如:/opt/soft/spark-2.4.6-bin-hadoop2.7"
v-model="modificationData.sparkHome" clearable>
</el-input>
</p>
</div>
<div class="textLayout" v-if="sourceType == 'Spark'">
<p>app-name</p>
<p>
<el-input placeholder="如sparkTest" v-model="modificationData.appName" clearable>
</el-input>
</p>
</div>
<div class="textLayout" v-if="sourceType == 'Spark'">
<p>master</p>
<p>
<el-input placeholder="如local[4]" v-model="modificationData.masterUrl" clearable>
</el-input>
</p>
</div>
<div class="textLayout" v-if="sourceType != 'Hive'&&sourceType!='Spark'">
<p>host</p>
<p>
<el-input placeholder="如:192.168.1.1" v-model="modificationData.host" clearable maxlength="20">
</el-input>
</p>
</div>
<div class="textLayout" v-if="sourceType == 'Hive'">
<p>url</p>
<p>
<el-input placeholder="请输入地址" v-model="modificationData.url" clearable maxlength="50">
</el-input>
</p>
</div>
<div class="textLayout" v-if="sourceType != 'Hive'&&sourceType!='Spark'">
<p>port</p>
<p>
<el-input :placeholder="sourceType=='Redis'?'如6379':'如3306'" v-model="modificationData.port"
clearable maxlength="20">
</el-input>
</p>
</div>
<div class="textLayout" v-if="sourceType !='Hive'&&sourceType!='Spark'">
<p>db</p>
<p v-if="sourceType =='MySQL'||sourceType =='Oracle'||sourceType =='Sqlserver'">
<el-input placeholder="请输入数据库名称" v-model="modificationData.dbName" clearable maxlength="50">
</el-input>
</p>
<p v-if="sourceType =='Redis'">
<el-input placeholder="0~15" type="number" v-model="modificationData.dbName" clearable>
</el-input>
</p>
</div>
<div class="textLayout" v-if="sourceType!='Spark'">
<p>user-name</p>
<p>
<el-input placeholder="请输入用户名" v-model="modificationData.userName" clearable maxlength="50">
</el-input>
</p>
</div>
<div class="textLayout" v-if="sourceType!='Spark'">
<p>password</p>
<p>
<el-input placeholder="请输入密码" v-model="modificationData.password" clearable maxlength="50"
auto-complete="new-password" show-password>
</el-input>
</p>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="modificationSure"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
getDataSourcelist
} from '../../api/index';
import {
setDataSource
} from '../../api/index';
import {
deleteDataSource,
updataDataSource
} from '../../api/index';
export default {
name: 'datasource',
data() {
return {
loading: false,
searchString: "",
data: null,
currentPage: null,
dialogVisible: false,
tempDialogData: null,
pageNo: 1,
modificationId: null,
modificationVisible: false,
modificationData: {
name: "",
host: "",
url: "",
port: "",
dbName: "",
userName: "",
password: "",
sparkHome: "",
appName: "",
masterUrl: ""
},
options: [{
value: 'MySQL',
label: 'MySQL'
}, {
value: 'Redis',
label: 'Redis'
}, {
value: 'Hive',
label: 'Hive'
}, {
value: 'Spark',
label: 'Spark'
}, {
value: 'Oracle',
label: 'Oracle'
}, {
value: 'Sqlserver',
label: 'Sqlserver'
}],
sourceType: 'MySQL'
}
},
created() {
this.initData();
},
methods: {
initData() {
let params = {
pageNo: this.pageNo,
pageSize: 10,
typeList: [this.sourceType]
}
this.getDataSourcelists(params)
},
changeSource(e) {
this.initData();
},
// 关闭弹窗所有弹窗 且清除临时数据
handleClose() {
this.dialogVisible = false
this.modificationVisible = false
this.tempDialogData = null
this.modificationData = {
host: "",
userName: "",
dbName: "",
name: "",
password: "",
port: "",
}
this.modificationId = null
},
// 查看 弹窗显示
dialogShow(index) {
this.tempDialogData = this.data.data.data[index]
this.dialogVisible = true
},
// 修改 弹窗显示
modificationShow(id) {
this.modificationId = id
this.data.data.data.forEach(value => {
if (value.id === id) {
this.modificationData = {
...value
}
}
})
this.modificationVisible = true
},
checkMySql() {
if (this.modificationData.name.indexOf(' ') !== -1 || String(this.modificationData.host).indexOf(' ') !== -
1 ||
this.modificationData.userName.indexOf(' ') !== -1 || this.modificationData.password.indexOf(' ') !== -
1 || this.modificationData
.port.indexOf(' ') !== -1 || this.modificationData.dbName.indexOf(' ') !== -1) {
this.$message.error('不允许出现空格!')
return false;
} else {
if (this.modificationData.name.length < 4 || this.modificationData.host.length < 4 || this
.modificationData.userName
.length < 4 || this.modificationData.password.length < 4 || this.modificationData.port.length <
4 || this.modificationData
.dbName.length < 4) {
this.$message.error('均为必填项且长度不小于4')
return false;
} else {
if (this.isChinese(this.modificationData.host) || this.isChinese(this.modificationData.userName) ||
this.isChinese(this.modificationData.port)) {
this.$message.error('主机地址,端口,用户名 不允许出现中文')
return
}
let params = {}
params.name = this.modificationData.name
params.host = this.modificationData.host
params.userName = this.modificationData.userName
params.password = this.modificationData.password
params.port = this.modificationData.port
params.dbName = this.modificationData.dbName
return params;
}
}
},
checkRedis() {
if (this.modificationData.name.indexOf(' ') !== -1 || String(this.modificationData.host).indexOf(' ') !== -
1 ||
this.modificationData.password.indexOf(' ') !== -1 || this.modificationData
.port.indexOf(' ') !== -1 || this.modificationData.dbName.indexOf(' ') !== -1) {
this.$message.error('不允许出现空格!')
return false;
} else {
if (this.modificationData.name.length < 4 || this.modificationData.host.length < 4 || this
.modificationData.password.length < 4 || this.modificationData.port.length < 4) {
this.$message.error('均为必填项且长度不小于4')
return false;
} else {
if (this.isChinese(this.modificationData.host) || this.isChinese(this.modificationData.port)) {
this.$message.error('主机地址,端口 不允许出现中文')
return
}
if (this.modificationData.dbName < 0 || this.modificationData.dbName > 15) {
this.$message.error('db超出有效范围')
return
}
console.log(this.modificationData.dbName);
let params = {}
params.name = this.modificationData.name
params.host = this.modificationData.host
params.userName = this.modificationData.userName
params.password = this.modificationData.password
params.port = this.modificationData.port
params.dbName = this.modificationData.dbName ? this.modificationData.dbName : 0;
return params;
}
}
},
checkHive() {
if (this.modificationData.name.indexOf(' ') !== -1 || this.modificationData.userName.indexOf(' ') !== -1 ||
this.modificationData.password.indexOf(' ') !== -1 || this.modificationData
.url.indexOf(' ') !== -1) {
this.$message.error('不允许出现空格!')
return false;
} else {
if (this.modificationData.name.length < 4 || this.modificationData.url.length < 4 || this
.modificationData.password.length < 4 || this.modificationData.userName.length < 4) {
this.$message.error('均为必填项且长度不小于4')
return false;
} else {
if (this.isChinese(this.modificationData.url) || this.isChinese(this.modificationData.userName)) {
this.$message.error('连接地址,用户名 不允许出现中文')
return false
}
let params = {}
params.name = this.modificationData.name
params.url = this.modificationData.url
params.userName = this.modificationData.userName
params.password = this.modificationData.password
return params;
}
}
},
checkSpark() {
if (this.modificationData.name.indexOf(' ') !== -1 || this.modificationData.sparkHome.indexOf(' ') !== -
1 ||
this.modificationData.appName.indexOf(' ') !== -1 || this.modificationData.masterUrl.indexOf(' ') !== -
1) {
this.$message.error('不允许出现空格!')
return false;
} else {
if (this.modificationData.name.length < 4 || this.modificationData.sparkHome.length < 4 || this
.modificationData.appName.length < 4 || this.modificationData.masterUrl.length < 4) {
this.$message.error('均为必填项且长度不小于4')
return false;
} else {
if (this.isChinese(this.modificationData.sparkHome) || this.isChinese(this.modificationData
.appName) || this.isChinese(this.modificationData.masterUrl)) {
this.$message.error('spark-homeapp-namemaster 不允许出现中文')
return false
}
let params = {}
params.name = this.modificationData.name
params.sparkHome = this.modificationData.sparkHome
params.appName = this.modificationData.appName
params.masterUrl = this.modificationData.masterUrl
return params;
}
}
},
// 确定修改或者添加
modificationSure() {
let params = null;
switch (this.sourceType) {
case 'MySQL':
params = this.checkMySql();
break;
case 'Redis':
params = this.checkRedis();
break;
case 'Hive':
params = this.checkHive();
break;
case 'Spark':
params = this.checkSpark();
break;
case 'Oracle':
params = this.checkMySql();
break;
case 'Sqlserver':
params = this.checkMySql();
break;
default:
break;
}
if (params) {
params.type = this.sourceType;
if (this.modificationId !== null) {
params.id = this.modificationData.id
this.updataDataSource(params).then(res => {
if (res.status === "1") {
this.data.data.data.forEach((value, index) => {
if (value.id === this.modificationData.id) {
console.log(value.id, this.modificationData.id)
this.$set(this.data.data.data, index, {
...this.modificationData
})
}
})
this.$message({
message: '修改成功',
type: 'success'
});
this.handleClose()
}
})
} else {
params.id = ""
this.setDataSources(params).then(res => {
if (res.status === "1") {
// 创建成功方法
this.initData();
// this.pageNo = 1
// this.getDataSourcelists({
// pageNo: this.pageNo,
// pageSize: 10
// })
this.$message({
message: '创建成功',
type: 'success'
});
this.handleClose()
}
})
}
}
// }
// }
// console.log(this.modificationData.name.indexOf(' '))
},
// 新增数据源
async setDataSources(params) {
this.loading = true
const data = await setDataSource(params)
this.loading = false
return data
},
// 修改数据源信息
async updataDataSource(params) {
this.loading = true
const data = await updataDataSource(params)
this.loading = false;
return data
},
createEngine() {
this.modificationVisible = true
},
searchEngine() {},
async getDataSourcelists(params) {
this.loading = true
const data = await getDataSourcelist(params)
if (data.status === "1") {
this.data = data
this.pageSize = data.data.pager.pages
} else {
this.$message.error('访问出错了-_-');
}
this.loading = false
},
deletelistsor(id) {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error'
}).then(() => {
this.deletelists(id)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
deletelists(id) {
this.deletelist(id).then(res => {
if (res.status === "1") {
this.initData();
// this.getDataSourcelists({
// pageNo: this.pageNo,
// pageSize: 10
// })
this.$message({
message: '删除成功',
type: 'success'
});
}
})
},
async deletelist(id) {
this.loading = true
return await deleteDataSource(id)
this.loading = false
},
currpage(num) {
this.pageNo = num
this.getDataSourcelists({
pageNo: this.pageNo,
pageSize: 10,
typeList:[this.sourceType]
})
console.log(this.pageNo)
},
isChinese(temp) {
// var re = /[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
// if (re.test(temp)) {
// console.log(temp)
// return false
// };
// return true;
if (escape(temp).indexOf("%u") < 0) {
return false
} else {
return true;
}
}
}
}
</script>
<style>
.el-pagination.is-background .btn-next,
.el-pagination.is-background .btn-prev,
.el-pagination.is-background .el-pager li {
background-color: #fff !important;
}
.el-pagination.is-background .el-pager li:not(.disabled).active {
background-color: #409EFF !important;
}
.textLayout {
display: flex;
font-size: 16px;
height: 40px;
padding-left: 30px;
margin-top: 10px;
}
.textLayout>p {
height: 100%;
line-height: 30px;
}
.textLayout>p:nth-of-type(1) {
width: 42%;
text-align: right;
margin-right: 20px;
line-height: 40px;
}
.DataSource_look .textLayout>p:nth-of-type(2) {
border-radius: 5px;
line-height: 40px;
box-sizing: border-box;
}
.el-dialog {
border-radius: 20px !important;
}
</style>

View File

@@ -0,0 +1,119 @@
<template>
<div>
<cont title="指标管理" :getData="getDataFun"></cont>
</div>
</template>
<script>
import cont from '@/components/common/cont.vue'
import {
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
} from '@/api/index.js'
export default {
name:'datamanage',
components: {
cont
},
data() {
return {
getDataFun: {
type:1,
row: [ {
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type: 'type'
}, {
label: '状态',
row: 'status',
type: 'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type: 'Time'
} ],
redact: "dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
return res
})
},
async getlist(e) {
e.fType = 1
return await getfieldList(e).then(res => {
return res
})
},
async addlist(e) {
return await addfieldList(e).then(res => {
return res
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e) {
// console.log(e)
return await getfieldInfo(e).then(res => {
return res
})
},
async updatafield(e) {
return await updatafield(e).then(res => {
return res
})
},
async fieldusing(e) {
return await fieldusing(e).then(res => {
return res
})
},
async down(e) {
return await fielddownTemplate(e).then(res => {
return res
})
},
async fieldsubmit(e) {
return await fieldupdata(e).then(res => {
return res
})
}
},
};
}
};
</script>
<style>
</style>

View File

@@ -0,0 +1,124 @@
<template>
<div>
<cont title="衍生指标" :getData="getDataFun"></cont>
</div>
</template>
<script>
import cont from '@/components/common/cont.vue'
import {
getfieldList,
addfieldList,
getfieldListTree,
updatafieldList,
getfieldsave,
getfieldInfo,
updatafield,
fieldusing,
fielddownTemplate,
fieldupdata
} from '@/api/index.js'
export default {
name:'derivemanage',
components: {
cont
},
data() {
return {
getDataFun: {
type: 3,
row: [{
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type:'type'
}, {
label: '状态',
row: 'status',
type: 'State'
}, {
label: '创建人',
row: 'nickName'
}, {
label: '创建时间',
row: 'created',
type: 'Time'
}, ],
redact: "dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
return res
})
},
async getlist(e) {
e.fType = 3
return await getfieldList(e).then(res => {
return res
})
},
async addlist(e) {
return await addfieldList(e).then(res => {
return res
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e) {
return await getfieldInfo(e).then(res => {
return res
})
},
async updatafield(e) {
return await updatafield(e).then(res => {
return res
})
},
async fieldusing(e) {
return await fieldusing(e).then(res => {
return res
})
},
async down(e) {
return await fielddownTemplate(e).then(res => {
return res
})
},
async fieldsubmit(e) {
return await fieldupdata(e).then(res => {
return res
})
}
},
};
}
};
</script>
<style>
</style>

View File

@@ -0,0 +1,247 @@
<template>
<div style="height: 100%;overflow: scroll;">
<div style="background-color: #fff;border-radius: 10px;padding: 10px;">
<span style="font-size: 20px;font-weight: bold;">
计算指标统计:
</span>
<div>
<div v-for="value in from" style="border-top:1px dotted #ddd;margin-top: 20px;" v-loading="value.loading">
{{value.name}}
<div style="display: flex;justify-content: flex-end;">
<el-input v-model="value.searchKey" placeholder="请输入搜索" size="mini"
style="width: 200px;margin-right: 20px;"></el-input>
<el-date-picker v-model="value.time" type="daterange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" size="mini" style="margin-right: 20px;">
</el-date-picker>
<el-button icon="el-icon-search" circle size="mini" @click="getData(value)"></el-button>
</div>
<div style="display: flex;flex-wrap: wrap;margin: 10px;">
<div v-for="item in value.data">
<div
style="display: flex;font-size: 14px;border-right: 1px solid #ddd;align-items: center;">
<div style="width: 200px;text-align: center;">
<el-button type="text" @click="getlogData(value,item.id)" :disabled="!item.callCount">{{item.fieldCn}}</el-button>
<!-- <el-button type="text" @click="getlogData(value)" :disabled="!item.callCount">{{item.fieldCn}}</el-button> -->
</div>
:
<div style="width: 150px;text-align: center;" >{{item.callCount}}</div>
</div>
</div>
</div>
<div style="display: flex;justify-content: flex-end;padding-right: 20px;padding-top: 20px;">
<el-pagination @size-change="getData(value)" @current-change="getData(value)"
:current-page.sync="value.pageNum" :page-sizes="[10,100, 200, 300, 400]"
:page-size.sync="value.pageSize" layout="sizes, prev, pager, next" :total="value.total">
</el-pagination>
</div>
</div>
</div>
</div>
<el-dialog title="调用日志" :visible.sync="dialogVisible" width="40%" :close-on-click-modal="false"
@close="resetlogfrom">
<div v-loading="logfrom.loading">
<el-table :data="logfrom.data" style="width: 100%">
<el-table-column prop="duration" label="耗时/ms" align="center">
</el-table-column>
<el-table-column prop="createTime" label="调用时间" align="center">
<template slot-scope="scope">
{{new Date(scope.row.createTime).format('yyyy-MM-dd hh:mm:ss')}}
</template>
</el-table-column>
<el-table-column prop="fieldValue" label="调用结果" align="center">
</el-table-column>
<el-table-column prop="address" label="请求参数" align="center">
<template slot-scope="scope">
<el-button type="text" @click="showinputParam(scope.row.inputParam)">查看入参</el-button>
</template>
</el-table-column>
</el-table>
<div style="display: flex;justify-content: flex-end;padding-right: 20px;">
<el-pagination layout="prev, pager, next" :current-page.sync="logfrom.pageNum" @current-change="getlogData(logfrom)" :total="logfrom.total">
</el-pagination>
</div>
<el-dialog width="60%" title="查看入参" :visible.sync="innerVisible" append-to-body @close="inputParam=''">
<div>
<el-input type="textarea" :rows="20" placeholder="" v-model="inputParam" disabled>
</el-input>
</div>
</el-dialog>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
getFieldCallList,
getFieldCallLogList
} from '@/api/index.js'
const logfromOr = {
"loading":false,
"data": [],
"pageSize": 10,
"pageNum": 1,
"total": 0,
time:[],
fieldType:'',
fieldCn:'',
fieldId:0
}
export default {
data() {
return {
from: [{
"loading":false,
"name": '数据源指标统计:',
"time": [new Date().getTomorrow(-1), new Date()],
"fieldType": 2,
"searchKey": "",
"data": [],
"pageSize": 10,
"pageNum": 1,
"total": 0
},
{
"loading":false,
"name": '接口指标统计:',
"time": [new Date().getTomorrow(-1), new Date()],
"fieldType": 4,
"searchKey": "",
"data": [],
"pageSize": 10,
"pageNum": 1,
"total": 0
},
{
"loading":false,
"name": '衍生指标统计:',
"time": [new Date().getTomorrow(-1), new Date()],
"fieldType": 3,
"searchKey": "",
"data": [],
"pageSize": 10,
"pageNum": 1,
"total": 0
},
],
logfrom: Object.assign({}, JSON.parse(JSON.stringify(logfromOr))),
dialogVisible: false,
inputParam: '',
innerVisible: false
}
},
created() {
this.from.forEach(value => {
this.getData(value)
})
},
methods: {
resetlogfrom() {
this.logfrom = Object.assign({}, JSON.parse(JSON.stringify(logfromOr)))
},
getData(param) {
param.loading = true
getFieldCallList({
"entity": {
"queryTimeStart": new Date(param.time[0]),
"queryTimeEnd": new Date(param.time[1]),
"fieldType": param.fieldType,
"searchKey": param.searchKey
},
"pageSize": param.pageSize,
"pageNum": param.pageNum
}).then(res => {
if (res.status == '1') {
param.total = res.data.total
param.data = res.data.list
}
param.loading = false
})
},
showinputParam(inputParam) {
// console.log(inputParam)
this.inputParam = JSON.stringify(JSON.parse(inputParam), null, 4)
// console.log(this.inputParam)
this.innerVisible = true
},
getlogData(param,id) {
console.log(param)
this.dialogVisible = true
this.logfrom.loading=true
getFieldCallLogList({
"entity": {
"queryTimeStart": new Date(param.time[0]),
"queryTimeEnd": new Date(param.time[1]),
"fieldType": param.fieldType,
"fieldId":id
},
"pageSize": this.logfrom.pageSize,
"pageNum": this.logfrom.pageNum
}).then(res => {
if (res.status == '1') {
this.logfrom.total = res.data.total
this.logfrom.data = res.data.list
this.logfrom.time = JSON.parse(JSON.stringify(param.time))
this.logfrom.fieldType = param.fieldType
this.logfrom.fieldCn = param.fieldCn
this.logfrom.fieldId = id
}
this.logfrom.loading=false
})
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,47 @@
<template>
<section class="main">
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item><i class="el-icon-lx-global"></i> {{$t('i18n.breadcrumb')}}</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="container">
<span>{{$t('i18n.tips')}}</span>
<el-button type="primary" @click="$i18n.locale = $i18n.locale === 'zh'?'en':'zh';">{{$t('i18n.btn')}}</el-button>
<div class="list">
<h2>{{$t('i18n.title1')}}</h2>
<p>{{$t('i18n.p1')}}</p>
<p>{{$t('i18n.p2')}}</p>
<p>{{$t('i18n.p3')}}</p>
</div>
<h2>{{$t('i18n.title2')}}</h2>
<div>
<i18n path="i18n.info" tag="p">
<a place="action" href="https://element.eleme.cn/2.0/#/zh-CN/component/i18n">{{ $t('i18n.value') }}</a>
</i18n>
</div>
</div>
</section>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style scoped>
.list{
padding: 30px 0;
}
.list p{
margin-bottom: 20px;
}
a{
color: #409eff;
}
</style>

View File

@@ -0,0 +1,225 @@
<template>
<div>
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item><i class="el-icon-lx-emoji"></i> 自定义图标</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="container">
<h2>使用方法</h2>
<p style="line-height: 50px;">
直接通过设置类名为 el-icon-lx-iconName 来使用即可例如{{iconList.length}}个图标
</p>
<p class="example-p">
<i class="el-icon-lx-redpacket_fill" style="font-size: 30px;color: #ff5900"></i>
<span>&lt;i class=&quot;el-icon-lx-redpacket_fill&quot;&gt;&lt;/i&gt;</span>
</p>
<p class="example-p">
<i class="el-icon-lx-weibo" style="font-size: 30px;color:#fd5656"></i>
<span>&lt;i class=&quot;el-icon-lx-weibo&quot;&gt;&lt;/i&gt;</span>
</p>
<p class="example-p">
<i class="el-icon-lx-emojifill" style="font-size: 30px;color: #ffc300"></i>
<span>&lt;i class=&quot;el-icon-lx-emojifill&quot;&gt;&lt;/i&gt;</span>
</p>
<br>
<h2>图标</h2>
<div class="search-box">
<el-input class="search" size="large" v-model="keyword" clearable placeholder="请输入图标名称"></el-input>
</div>
<ul>
<li class="icon-li" v-for="(item,index) in list" :key="index">
<div class="icon-li-content">
<i :class="`el-icon-lx-${item}`"></i>
<span>{{item}}</span>
</div>
</li>
</ul>
</div>
</div>
</template>
<script>
export default {
data: function(){
return {
keyword: '',
iconList: [
'attentionforbid',
'attentionforbidfill',
'attention',
'attentionfill',
'tag',
'tagfill',
'people',
'peoplefill',
'notice',
'noticefill',
'mobile',
'mobilefill',
'voice',
'voicefill',
'unlock',
'lock',
'home',
'homefill',
'delete',
'deletefill',
'notification',
'notificationfill',
'notificationforbidfill',
'like',
'likefill',
'comment',
'commentfill',
'camera',
'camerafill',
'warn',
'warnfill',
'time',
'timefill',
'location',
'locationfill',
'favor',
'favorfill',
'skin',
'skinfill',
'news',
'newsfill',
'record',
'recordfill',
'emoji',
'emojifill',
'message',
'messagefill',
'goods',
'goodsfill',
'crown',
'crownfill',
'move',
'add',
'hot',
'hotfill',
'service',
'servicefill',
'present',
'presentfill',
'pic',
'picfill',
'rank',
'rankfill',
'male',
'female',
'down',
'top',
'recharge',
'rechargefill',
'forward',
'forwardfill',
'info',
'infofill',
'redpacket',
'redpacket_fill',
'roundadd',
'roundaddfill',
'friendadd',
'friendaddfill',
'cart',
'cartfill',
'more',
'moreandroid',
'back',
'right',
'shop',
'shopfill',
'question',
'questionfill',
'roundclose',
'roundclosefill',
'roundcheck',
'roundcheckfill',
'global',
'mail',
'punch',
'exit',
'upload',
'read',
'file',
'link',
'full',
'group',
'friend',
'profile',
'addressbook',
'calendar',
'text',
'copy',
'share',
'wifi',
'vipcard',
'weibo',
'remind',
'refresh',
'filter',
'settings',
'scan',
'qrcode',
'cascades',
'apps',
'sort',
'searchlist',
'search',
'edit'
]
}
},
computed: {
list(){
return this.iconList.filter((item) => {
return item.indexOf(this.keyword) !== -1;
})
}
}
}
</script>
<style scoped>
.example-p{
height: 45px;
display: flex;
align-items: center;
}
.search-box{
text-align: center;
margin-top: 10px;
}
.search{
width: 300px;
}
ul,li{
list-style: none;
}
.icon-li{
display: inline-block;
padding: 10px;
width: 120px;
height: 120px;
}
.icon-li-content{
display: flex;
height: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
cursor: pointer;
}
.icon-li-content i{
font-size: 36px;
color: #606266;
}
.icon-li-content span{
margin-top: 10px;
color: #787878;
}
</style>

View File

@@ -0,0 +1,134 @@
<template>
<div class="login-wrap">
<div class="ms-login">
<div class="ms-title">数据中心</div>
<el-form :model="param" :rules="rules" ref="login" label-width="0px" class="ms-content">
<el-form-item prop="username">
<el-input v-model="param.username" placeholder="username">
<el-button slot="prepend" icon="el-icon-lx-people"></el-button>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
type="password"
placeholder="password"
v-model="param.password"
@keyup.enter.native="submitForm()"
>
<el-button slot="prepend" icon="el-icon-lx-lock"></el-button>
</el-input>
</el-form-item>
<div class="login-btn">
<el-button type="primary" @click="submitForm()">登录</el-button>
</div>
</el-form>
</div>
</div>
</template>
<script>
import { getLogin } from '../../api/index';
export default {
created() {
// if(this.$route.query.type=="token"){
// this.$message.error('登陆授权码已过期')
// this.$route.query.type=""
// }
},
data: function() {
return {
param: {
username: '',
password: '',
},
rules: {
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
},
};
},
methods: {
submitForm() {
this.$refs.login.validate(valid => {
if (valid) {
// 调用登录接口
this.getLogins();
} else {
this.$message.error('请输入账号和密码');
console.log('error submit!!');
return false;
}
});
},
async getLogins() {
// var formdata = new FormData();
// formdata.append('account', this.param.username);
// formdata.append('password', this.param.password);
var params ={
account:this.param.username,
password:this.param.password
}
const data = await getLogin(params);
console.log('登录接口返回的数据',data);
const code = data.code;
if(data.status==="1"){
this.$message.success('登录成功,即将跳转');
localStorage.setItem('ms_username', this.param.username);
localStorage.setItem('token', data.data.token);
this.$router.push('/');
this.mixinReGetStorage()
}
else{
this.$message.error(data.msg);
}
}
},
};
</script>
<style scoped>
.login-wrap {
position: relative;
width: 100%;
height: 100%;
background-image: url(../../assets/img/login-bg.jpg);
background-size: 100%;
}
.ms-title {
width: 100%;
line-height: 50px;
text-align: center;
font-size: 20px;
color: #fff;
border-bottom: 1px solid #ddd;
}
.ms-login {
position: absolute;
left: 50%;
top: 50%;
width: 350px;
margin: -190px 0 0 -175px;
border-radius: 5px;
background: rgba(255, 255, 255, 0.3);
overflow: hidden;
}
.ms-content {
padding: 30px 30px;
}
.login-btn {
text-align: center;
}
.login-btn button {
width: 100%;
height: 36px;
margin-bottom: 10px;
}
.login-tips {
font-size: 12px;
line-height: 30px;
color: #fff;
}
</style>

View File

@@ -0,0 +1,300 @@
<template>
<div>
<div style="padding-top: 20px;">
<el-button type="primary" @click="add">添加队列</el-button>
<el-select v-model="search.type" placeholder="请选择队列类型" style="margin-left: 20px;">
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</div>
<el-table :data="list" border style="width: 100%;margin-top: 20px;" v-loading="loading">
<el-table-column prop="name" label="name" align="center">
</el-table-column>
<el-table-column prop="type" label="类型" align="center">
</el-table-column>
<el-table-column prop="serverAddrs" label="serverAddrs" align="center">
</el-table-column>
<el-table-column prop="groupId" label="groupId" align="center">
</el-table-column>
<el-table-column prop="topic" label="topic" align="center">
</el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center">
<template slot-scope="scope">
{{new Date(scope.row.createTime).format('yyyy-MM-dd hh:mm:ss')}}
</template>
</el-table-column>
<el-table-column prop="" label="操作" align="center">
<template slot-scope="scope">
<div style="display: flex;justify-content: center;">
<el-button type="primary" icon="el-icon-edit" circle size="mini" @click="update(scope.row)">
</el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini"
@click="deleteMq(scope.row.id)"></el-button>
</div>
</template>
</el-table-column>
</el-table>
<div style="display: flex;justify-content: flex-end;padding-top: 20px;padding-right: 20px;">
<el-pagination background layout="prev, pager, next" :current-page.sync="pageNum" :total="total"
@current-change="getList">
</el-pagination>
</div>
<el-dialog title="添加/修改" :visible.sync="dialogVisible" v-if="dialogVisible" width="800px" @close="close">
<div v-loading="dialogLoading">
<el-form ref="form" :model="form" label-width="120px" :rules="rules">
<el-form-item label="name" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="serverAddrs" prop="serverAddrs">
<el-input v-model="form.serverAddrs"></el-input>
</el-form-item>
<el-form-item label="groupId" prop="groupId">
<el-input v-model="form.groupId"></el-input>
</el-form-item>
<el-form-item label="topic" prop="topic">
<el-input v-model="form.topic"></el-input>
</el-form-item>
<el-form-item label="messageBody" prop="messageBody">
<div style="overflow: hidden;position: relative;line-height: 16px;">
<codemirror v-model="form.messageBody" MYname="json" mime="text/javascript"
:autocomplete="false">
</codemirror>
</div>
</el-form-item>
</el-form>
<div style="display: flex;justify-content: flex-end;">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogCallBack"> </el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import codemirror from '@/components/common/codemirror.vue'
import {
getMqSourceList,
addMqSource,
updateMqSource,
MqupdateStatus,
} from '@/api/index.js'
const formOr = {
id: '',
name: '',
type: 'kafka',
serverAddrs: '',
groupId: '',
topic: '',
messageBody: ''
}
export default {
components: {
codemirror
},
data() {
return {
list: [],
pageNum: 1,
total: 0,
dialogVisible: false,
loading: false,
dialogLoading: false,
typeList: [{
label: 'kafka',
value: 'kafka'
}],
codeKey: 0,
search: {
type: 'kafka'
},
rules: {
name: [{
required: true,
message: '请输入name',
trigger: 'blur'
}, ],
serverAddrs: [{
required: true,
message: '请输入serverAddrs',
trigger: 'blur'
}, ],
groupId: [{
required: true,
message: '请输入groupId',
trigger: 'blur'
}, ],
topic: [{
required: true,
message: '请输入topic',
trigger: 'blur'
}, ],
messageBody: [{
required: true,
message: '请输入messageBody',
trigger: 'blur'
}, ],
},
form: JSON.parse(JSON.stringify(formOr)),
dialogCallBack: () => {}
}
},
created() {
this.getList()
},
methods: {
deleteMq(id) {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error'
}).then(() => {
MqupdateStatus({
ids: id,
status: -1
}).then(res => {
if (res.status == '1') {
this.getList()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
close() {
this.form = JSON.parse(JSON.stringify(formOr))
this.dialogCallBack = () => {}
},
update(item) {
this.form = {
id: item.id,
name: item.name,
type: item.type,
serverAddrs: item.serverAddrs,
groupId: item.groupId,
topic: item.topic,
messageBody: JSON.stringify(JSON.parse(item.messageBody),null,4),
}
this.dialogVisible = true
this.dialogCallBack = () => {
if (this.verify()) {
return
}
this.dialogLoading = true
updateMqSource(this.form).then(res => {
if (res.status == '1') {
this.dialogVisible = false
this.getList()
}
this.dialogLoading = false
})
}
},
add() {
this.dialogVisible = true
this.form.type = this.search.type
this.dialogCallBack = () => {
if (this.verify()) {
return
}
delete this.form.id
this.dialogLoading = true
addMqSource(this.form).then(res => {
if (res.status == '1') {
this.dialogVisible = false
this.getList()
}
this.dialogLoading = false
})
}
},
verify() {
let is = {
is: false,
msg: ''
}
if(!this.isJSON(this.form.messageBody)){
is.is = true
is.msg = 'messageBody必须为JSON对象'
}
if (!this.form.messageBody || this.form.messageBody.trim() === '') {
is.is = true
is.msg = '请输入messageBody'
}
if (!this.form.topic || this.form.topic.trim() === '') {
is.is = true
is.msg = '请输入topic'
}
if (!this.form.groupId || this.form.groupId.trim() === '') {
is.is = true
is.msg = '请输入groupId'
}
if (!this.form.serverAddrs || this.form.serverAddrs.trim() === '') {
is.is = true
is.msg = '请输入serverAddrs'
}
if (!this.form.type || this.form.type.trim() === '') {
is.is = true
is.msg = '请输入队列类型'
}
if (!this.form.name || this.form.name.trim() === '') {
is.is = true
is.msg = '请输入name'
}
if (is.is) {
this.$message.error(is.msg)
}
return is.is
},
getList() {
this.loading = true
getMqSourceList({
pageNum: this.pageNum,
pageSize: 10
}).then(res => {
if (res.status == 1) {
this.list = res.data.list
this.total = res.data.total
}
this.loading = false
})
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,129 @@
<template>
<div>
<cont title="数据源指标" :getData="getDataFun"></cont>
</div>
</template>
<script>
import cont from '@/components/common/cont.vue'
import {
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
} from '@/api/index.js'
export default {
name:'SQLManage',
components: {
cont
},
data() {
return {
getDataFun: {
type:2,
row: [ {
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '数据源类型',
row: 'dataSourceId',
fn:(res)=>{
let obj = this.$store.state.Sourcelist.find(x=>x.id==res)
return obj&&obj.type
},
}, {
label: '字段类型',
row: 'valueType',
type:'type'
}, {
label: '状态',
row: 'status',
type:'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type:'Time'
},],
redact:"dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
return res
})
},
async getlist(e) {
e.fType = 2
return await getfieldList(e).then(res => {
return res
})
},
async addlist(e) {
return await addfieldList(e).then(res => {
return res
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e){
return await getfieldInfo(e).then(res=>{
return res
})
},
async updatafield(e){
return await updatafield(e).then(res=>{
return res
})
},
async fieldusing(e){
return await fieldusing(e).then(res=>{
return res
})
},
async down(e){
return await fielddownTemplate(e).then(res=>{
return res
})
},
async fieldsubmit(e){
return await fieldupdata(e).then(res=>{
return res
})
}
},
};
}
};
</script>
<style>
</style>

View File

@@ -0,0 +1,6 @@
import Vue from 'vue';
// 使用 Event Bus
const bus = new Vue();
export default bus;

View File

@@ -0,0 +1,117 @@
<template>
<div>
<cont title="接口指标" :getData="getDataFun"></cont>
</div>
</template>
<script>
import cont from '@/components/common/cont.vue'
import {
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
} from '@/api/index.js'
export default {
name:'portManage',
components: {
cont
},
data() {
return {
getDataFun: {
type:4,
row: [ {
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type:'type'
}, {
label: '状态',
row: 'status',
type:'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type:'Time'
},],
redact:"dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
return res
})
},
async getlist(e) {
e.fType = 4
return await getfieldList(e).then(res => {
return res
})
},
async addlist(e) {
return await addfieldList(e).then(res => {
return res
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e){
return await getfieldInfo(e).then(res=>{
return res
})
},
async updatafield(e){
return await updatafield(e).then(res=>{
return res
})
},
async fieldusing(e){
return await fieldusing(e).then(res=>{
return res
})
},
async down(e){
return await fielddownTemplate(e).then(res=>{
return res
})
},
async fieldsubmit(e){
return await fieldupdata(e).then(res=>{
return res
})
}
},
};
}
};
</script>
<style>
</style>

View File

@@ -0,0 +1,730 @@
<template>
<div style="height: 90%; " class="portS">
<!-- 创建和搜索 -->
<div class="datasou_top" style="height: 10%;">
<el-row style="margin-bottom: 30px;margin-top: 20px;">
<el-col :span="15">
<el-button type="primary" @click="createEngine">创建接口</el-button>
</el-col>
</el-row>
</div>
<div class="datasou_cont" style="height: 80%;" v-if="data">
<div class="datasou_table">
<el-row>
<el-table border :data="data.data.klist" style="width: 100%" :cell-style="{padding: '10px'}"
v-loading="loading">
<el-table-column prop="id" label="ID" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="name" label="连接名称" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="url" label="连接地址" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="method" label="请求方法" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="requestBody" label="请求体类型" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="" label="调用量" align="center" show-overflow-tooltip>
{{1}}
</el-table-column>
<el-table-column prop="creatorName" label="创建人" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="updataTime" label="最后更新时间" align="center">
<template slot-scope="scope">
<span style="white-space: nowrap;">{{
new Date(scope.row.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row.updateTime).toTimeString().substr(0, 8)
}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" size="s">
<template slot-scope="scope">
<div style="display: flex;">
<el-button icon="el-icon-search" circle size="mini"
@click="modificationShow(scope.row.id,true)"></el-button>
<el-button type="primary" icon="el-icon-edit" circle size="mini"
@click="modificationShow(scope.row.id)"></el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini"
@click="deletelistsor(scope.row.id)"></el-button>
</div>
</template>
</el-table-column>
</el-table>
</el-row>
</div>
<div style="float: right;margin-right: 120px;margin-top: 40px;">
<el-pagination :current-page="pageNum" @current-change="currpage" background layout="prev, pager, next"
:total="data.data.pageInfo.total" v-if="data!==null">
</el-pagination>
</div>
</div>
<!--
<el-dialog title="接口详情" :visible.sync="dialogVisible" width="40%" :before-close="handleClose"
class="DataSource_look">
<div v-if="tempDialogData!==null">
<div class="port_textLayout">
<p>连接名称</p>
<p v-if="tempDialogData.name">{{tempDialogData.name}}</p>
</div>
<div class="port_textLayout">
<p>连接地址</p>
<p v-if="tempDialogData.url">{{tempDialogData.url}}</p>
</div>
<div class="port_textLayout">
<p>请求方式</p>
<p v-if="tempDialogData.method">{{tempDialogData.method}}</p>
</div>
<div class="port_textLayout" >
<p>请求头</p>
<div v-if="tempDialogData.requestHeaders" >
<p
v-for="value in typeof tempDialogData.requestHeaders == 'string'?JSON.parse(tempDialogData.requestHeaders):tempDialogData.requestHeaders">
{{value.key}}:{{value.value}}
</p>
</div>
</div>
<div class="port_textLayout" >
<p>请求入参</p>
<div v-if="tempDialogData.bindParam" >
<p>变量:</p>
<p v-for="value in JSON.parse(tempDialogData.bindParam).variable">
{{value.key}} : {{value.value}}
</p>
<p>字典变量:</p>
<p v-for="value in JSON.parse(tempDialogData.bindParam).dictVariable">
{{value.key}} : {{value.type}} :{{value.value}}
</p>
</div>
</div>
<div class="port_textLayout" style="margin-top: 20px;">
<p>请求体</p>
<el-input type="textarea" rows="8" placeholder="格式:{page:1} 变量格式:name:{name}"
v-model="tempDialogData.requestBody" disabled style="width: 400px;">
</el-input>
</div>
<div class="port_textLayout">
<p>响应体</p>
<el-input type="textarea" rows="8" v-model="tempDialogData.responseBody" disabled
style="width: 400px;">
</el-input>
</div>
<div class="port_textLayout">
<p>创建时间</p>
<p v-if="tempDialogData.createTime">
{{new Date(tempDialogData.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(tempDialogData.updateTime).toTimeString().substr(0, 8)}}
</p>
</div>
<div class="port_textLayout">
<p>创建人</p>
<p v-if="tempDialogData.creatorName">{{tempDialogData.creatorName}}</p>
</div>
<div class="port_textLayout">
<p>修改时间</p>
<p v-if="tempDialogData.updateTime">
{{new Date(tempDialogData.updateTime).toLocaleDateString().replace(/\//g, "-") + " " + new Date(tempDialogData.updateTime).toTimeString().substr(0, 8)}}
</p>
</div>
<div class="port_textLayout">
<p>修改人</p>
<p v-if="tempDialogData.modifierName">{{tempDialogData.modifierName}}</p>
</div>
</div>
<div v-else>
数据错误 请重新尝试
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false;tempDialogData=null"> </el-button>
</span>
</el-dialog> -->
<el-dialog :title="show?'查看详情':modificationId===null?'创建接口':'修改接口'" :visible.sync="modificationVisible" width="60%"
class="portS_dialog" :before-close="handleClose">
<div v-loading="dialogLoading">
<div class="port_textLayout">
<p><span style="color: red;">*</span>接口名称</p>
<p>
<el-input placeholder="请输入连接名称" v-model="modificationData.name" clearable maxlength="20" :disabled="show">
</el-input>
</p>
</div>
<div class="port_textLayout">
<p><span style="color: red;">*</span>请求地址</p>
<p>
<el-input placeholder="如:192.168.1.1" v-model="modificationData.url" clearable maxlength="100" :disabled="show">
</el-input>
</p>
</div>
<div class="port_textLayout">
<p><span style="color: red;">*</span>请求方法</p>
<p>
<el-select v-model="modificationData.method" placeholder="请选择请求方法" :disabled="show">
<el-option label="Get" value="GET"></el-option>
<el-option label="Post" value="POST"></el-option>
</el-select>
</p>
</div>
<div class="port_textLayout">
<p>请求头参数</p>
<div>
<p style="display: flex;align-items: center;margin-top: 5px;">
<el-input placeholder="key" v-model="modificationData.requestHeaders[0].key" disabled
clearable size="mini" :disabled="show"></el-input>
<span>:</span>
<el-select v-model="modificationData.requestHeaders[0].value" size="mini" :disabled="show"
placeholder="请选择请求方法">
<el-option label="/json" value="application/json"></el-option>
<el-option label="/x-www-form-urlencoded" value="application/x-www-form-urlencoded">
</el-option>
</el-select>
<i class="el-icon-circle-plus-outline" style="color: #409EFF;font-size: 20px;"
v-if="!show" @click="addheader(0)"></i>
<i class="el-icon-circle-close" style="color: #ddd;font-size: 20px;" v-if="!show"></i>
</p>
<p v-for="(value,index) in modificationData.requestHeaders"
style="display: flex;align-items: center;margin-top: 5px;" v-if="index!=0">
<el-input placeholder="key" v-model="value.key" clearable size="mini" :disabled="show"></el-input>
<span>:</span>
<el-input placeholder="value" v-model="value.value" clearable size="mini" :disabled="show"></el-input>
<i class="el-icon-circle-plus-outline" style="color: #409EFF;font-size: 20px;"
@click="addheader(index)" v-if="!show"></i>
<i class="el-icon-circle-close" style="color: #F56C6C;font-size: 20px;"
@click="delectheader(index)" v-if="!show"></i>
</p>
</div>
</div>
<div class="port_textLayout">
<p>请求入参</p>
<bindParam v-if="modificationVisible" :Variable="modificationData.bindParam.variable" :disabled="show" :dictVariable="modificationData.bindParam.dictVariable" size="mini"></bindParam>
</div>
<div class="port_textLayout">
<p>请求体</p>
<p>
<el-input type="textarea" rows="12" placeholder="格式:{page:1} 变量格式:name:{name}"
v-model="modificationData.requestBody" style="width: 400px;" :disabled="show">
</el-input>
</p>
</div>
<div class="port_textLayout">
<p>测试请求</p>
<p>
<el-button plain @click="getHttpResponses" :disabled="show">请求测试</el-button>
<el-button plain @click="lookBig">大屏查看请求响应体</el-button>
</p>
</div>
<div class="port_textLayout">
<p>响应体</p>
<p>
<el-input type="textarea" :disabled="show" placeholder="点击请求测试获取此值" v-model="modificationData.responseBody"
style="width: 400px;">
</el-input>
</p>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose" :disabled="dialogLoading?'disabled':false"> </el-button>
<el-button type="primary" :disabled="dialogLoading?'disabled':false" @click="modificationSure">
</el-button>
</span>
<el-dialog width="70%" title="数据" :visible.sync="dialogVisibleBigData" append-to-body :close-on-click-modal="false">
<span>
ps:在此处也可以修改数据
</span>
<div style="display: flex;justify-content: space-between;width: 100%;">
<div style="width: 50%;">
<p>请求体</p>
<p>
<el-input type="textarea" rows="26" placeholder="格式:{page:1} 变量格式:name:{name}" :disabled="show"
v-model="modificationData.requestBody" >
</el-input>
</p>
</div>
<div style="width: 50%;">
<p>响应体</p>
<p>
<el-input type="textarea" rows="26" :disabled="show" placeholder="点击请求测试获取此值" v-model="modificationData.responseBody"
>
</el-input>
</p>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisibleBigData=false">
</el-button>
</span>
</el-dialog>
</el-dialog>
</div>
</template>
<script>
import {
getInterfaceList,
addInterface,
updateInterface,
deleteInterface,
getHttpResponse
} from '../../api/index';
import bindParam from '@/components/common/bindParam.vue'
const bindParamOr = {
variable:[],
dictVariable:[],
}
export default {
name: "portSource",
components:{bindParam},
data() {
return {
dialogLoading: false,
loading: false,
searchString: "",
data: null,
currentPage: null,
dialogVisible: false,
tempDialogData: null,
pageNum: 1,
modificationId: null,
modificationVisible: false,
show:false,
modificationData: {
name: "",
url: '',
method: '',
requestBody: '',
requestHeaders: [{
key: 'Content-Type',
value: 'application/json'
}],
responseBody: '',
bindParam:{
variable:[],
dictVariable:[],
},
// bindParam:null
},
dialogVisibleBigData: false,
}
},
created() {
let params = {
pageNum: this.pageNum,
pageSize: 10,
"interfaceInfo": {}
}
this.getInterfaceLists(params)
},
methods: {
lookBig() {
this.dialogVisibleBigData = true
},
random() {
return Math.floor(Math.random() * 5000)
},
addheader(index) {
this.modificationData.requestHeaders.splice(index + 1, 0, {
key: '',
value: ''
})
},
delectheader(index) {
this.modificationData.requestHeaders.splice(index, 1)
},
// 测试连接
getHttpResponses() {
let subobj = {}
this.modificationData.requestHeaders.forEach(value => {
subobj[value.key] = value.value
})
let Params = {
url: this.modificationData.url,
method: this.modificationData.method,
requestHeaders: JSON.stringify(subobj),
requestBody: this.modificationData.requestBody,
bindParam : JSON.stringify(this.modificationData.bindParam)
}
this.dialogLoading = true
getHttpResponse(Params).then(res => {
if (res.status == "1") {
this.modificationData.responseBody = JSON.stringify(JSON.parse(res.data), null, 4)
}
this.dialogLoading = false
})
},
// 关闭弹窗所有弹窗 且清除临时数据
handleClose() {
this.dialogVisible = false
this.modificationVisible = false
this.show = false
this.tempDialogData = null
this.modificationData = {
name: "",
url: '',
method: '',
requestBody: '',
requestHeaders: [{
key: 'Content-Type',
value: 'application/json'
}],
responseBody: '',
bindParam:{
variable:[],
dictVariable:[],
},
}
this.modificationId = null
},
// 查看 弹窗显示
dialogShow(index) {
this.tempDialogData = this.data.data.klist[index]
console.log(this.tempDialogData)
// this.tempDialogData.requestHeaders = JSON.parse(this.tempDialogData.requestHeaders)
this.dialogVisible = true
},
// 修改 弹窗显示
modificationShow(id,show) {
this.modificationId = id
this.data.data.klist.forEach(value => {
if (value.id === id) {
this.modificationData = {
...value
}
this.modificationData.bindParam = value.bindParam?JSON.parse(value.bindParam) : JSON.parse(JSON.stringify(bindParamOr))
if (value.requestHeaders) {
if (typeof this.modificationData.requestHeaders == "string") {
this.modificationData.requestHeaders = JSON.parse(value.requestHeaders)
}
} else {
this.modificationData.requestHeaders = [{
key: 'Content-Type',
value: 'application/json'
}]
}
}
})
this.modificationVisible = true
if(show){
this.show = true
}
},
// 确定修改或者添加
modificationSure() {
if(this.show){
this.handleClose()
return
}
if (this.modificationData.name.indexOf(' ') !== -1 || this.modificationData.url.indexOf(' ') !== -1 || this
.modificationData
.method == "") {
this.$message.error('必填项不允许出现空格!')
} else {
if (this.modificationData.name.length < 4 || this.modificationData.url.length < 4) {
this.$message.error('请检查必填项且长度不小于4')
} else {
let is = false
this.modificationData.requestHeaders.forEach(value => {
if (value.key.trim() == "" || value.value.trim() == "") {
is = true
}
})
if (is) {
this.$message.error('请填入请求头');
return
}
// this.modificationData.responseBody
if (!this.isJSON(this.modificationData.responseBody)) {
this.$message.error('请检查 响应体 是否为JSON格式');
return
}
this.dialogLoading = true
let params = {
name : this.modificationData.name,
url : this.modificationData.url,
method : this.modificationData.method,
requestBody : this.modificationData.requestBody,
responseBody : this.modificationData.responseBody,
bindParam : JSON.stringify(this.modificationData.bindParam)
}
let subobj = {}
this.modificationData.requestHeaders.forEach(value => {
subobj[value.key] = value.value
})
params.requestHeaders = String(JSON.stringify(subobj))
if (this.modificationId !== null) {
params.id = this.modificationData.id
updateInterface(params).then(res => {
if (res.status == "1") {
this.data.data.klist.forEach((value, index) => {
if (value.id === this.modificationData.id) {
this.modificationData.bindParam = JSON.stringify(this.modificationData.bindParam)
this.$set(this.data.data.klist, index, {
...this.modificationData
})
}
})
this.$message({
message: '修改成功',
type: 'success'
});
this.dialogLoading = false
this.handleClose()
}
})
} else {
params.id = ""
this.setDataSources(params).then(res => {
if (res.status === "1") {
// 创建成功方法
this.pageNum = 1
this.getInterfaceLists({
pageNum: this.pageNum,
pageSize: 10,
"interfaceInfo": {}
})
this.$message({
message: '创建成功',
type: 'success'
});
this.dialogLoading = false
this.handleClose()
}
})
}
}
}
// console.log(this.modificationData.name.indexOf(' '))
},
async setDataSources(params) {
this.loading = true
const data = await addInterface(params)
this.loading = false
return data
},
createEngine() {
this.modificationVisible = true
},
searchEngine() {},
async getInterfaceLists(params) {
this.loading = true
const data = await getInterfaceList(params)
if (data.status === "1") {
this.data = data
data.data.klist = data.data.klist.map(value => {
value.requestBody = this.isJSON(value.requestBody) ? JSON.stringify(JSON.parse(value
.requestBody), null, 4) : ''
value.responseBody = this.isJSON(value.responseBody) ? JSON.stringify(JSON.parse(value
.responseBody), null, 4) : ''
if (!Array.isArray(JSON.parse(value.requestHeaders))) { //讲 key:value 格式 更改为老格式
value.requestHeaders = JSON.stringify(this.format(JSON.parse(value
.requestHeaders)))
}
return value
})
this.page = data.data.pageInfo
} else {
this.$message.error('访问出错了-_-');
}
this.loading = false
},
format(obj) {
return Object.keys(obj).map(value => {
return {
key: value,
value: obj[value]
}
})
},
deletelistsor(id) {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error'
}).then(() => {
this.deletelists({
id: id
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
deletelists(id) {
this.deletelist(id).then(res => {
if (res.status === "1") {
this.getInterfaceLists({
pageNum: this.pageNum,
pageSize: 10,
"interfaceInfo": {}
})
this.$message({
message: '删除成功',
type: 'success'
});
}
})
},
async deletelist(id) {
this.loading = true
return await deleteInterface(id)
this.loading = false
},
currpage(num) {
this.pageNum = num
this.getInterfaceLists({
pageNum: this.pageNum,
pageSize: 10,
"interfaceInfo": {}
})
console.log(this.pageNum)
},
isChinese(temp) {
// var re = /[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
// if (re.test(temp)) {
// console.log(temp)
// return false
// };
// return true;
if (escape(temp).indexOf("%u") < 0) {
return false
} else {
return true;
}
},
isJSON(str) {
if (typeof str == 'string') {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
console.log('error' + str + '!!!' + e);
return false;
}
}
},
}
}
</script>
<style>
.el-pagination.is-background .btn-next,
.el-pagination.is-background .btn-prev,
.el-pagination.is-background .el-pager li {
background-color: #fff !important;
}
.el-pagination.is-background .el-pager li:not(.disabled).active {
background-color: #409EFF !important;
}
.portS_dialog .port_textLayout {
display: flex;
font-size: 16px;
height: 40px;
padding-left: 0px;
margin-top: 10px;
}
.port_textLayout>p {
height: 100%;
line-height: 30px;
}
.portS_dialog .port_textLayout>p:nth-of-type(1) {
width: 32%;
text-align: right;
margin-right: 20px;
line-height: 40px;
}
.portS .DataSource_look .port_textLayout {
display: flex;
align-items: center;
margin-top: 5px;
}
.DataSource_look .port_textLayout>p:nth-of-type(2) {
border-radius: 5px;
line-height: 40px;
box-sizing: border-box;
}
.el-dialog {
border-radius: 20px !important;
}
.portS_dialog .port_textLayout {
height: unset !important;
}
</style>

View File

@@ -0,0 +1,129 @@
<template>
<div>
<cont title="实时指标" :getData="getDataFun"></cont>
</div>
</template>
<script>
import cont from '@/components/common/cont.vue'
import {
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
} from '@/api/index.js'
export default {
name:'SQLManage',
components: {
cont
},
data() {
return {
getDataFun: {
type:6,
row: [ {
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '消息队列类型',
row: 'mqSourceId',
fn:(res)=>{
let obj = this.$store.state.Mqlist.find(x=>x.id==res)
return obj&&obj.type
},
}, {
label: '字段类型',
row: 'valueType',
type:'type'
}, {
label: '状态',
row: 'status',
type:'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type:'Time'
},],
redact:"dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
return res
})
},
async getlist(e) {
e.fType = 6
return await getfieldList(e).then(res => {
return res
})
},
async addlist(e) {
return await addfieldList(e).then(res => {
return res
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e){
return await getfieldInfo(e).then(res=>{
return res
})
},
async updatafield(e){
return await updatafield(e).then(res=>{
return res
})
},
async fieldusing(e){
return await fieldusing(e).then(res=>{
return res
})
},
async down(e){
return await fielddownTemplate(e).then(res=>{
return res
})
},
async fieldsubmit(e){
return await fieldupdata(e).then(res=>{
return res
})
}
},
};
}
};
</script>
<style>
</style>

View File

@@ -0,0 +1,13 @@
<script>
export default {
created() {
const { params, query } = this.$route
console.log(params);
const { path } = params
this.$router.replace({ path: '/' + path, query })
},
render: function(h) {
return h() // avoid warning message
}
}
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,121 @@
<template>
<div>
<cont title="常量指标" :getData="getDataFun"></cont>
</div>
</template>
<script>
import cont from '@/components/common/cont.vue'
import {
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
} from '@/api/index.js'
export default {
name:'SQLManage',
components: {
cont
},
data() {
return {
getDataFun: {
type:5,
row: [ {
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type: 'type'
}, {
label: '状态',
row: 'status',
type: 'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type: 'Time'
} ],
redact:"dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
return res
})
},
async getlist(e) {
e.fType = 5
return await getfieldList(e).then(res => {
return res
})
},
async addlist(e) {
return await addfieldList(e).then(res => {
return res
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e){
return await getfieldInfo(e).then(res=>{
return res
})
},
async updatafield(e){
return await updatafield(e).then(res=>{
return res
})
},
async fieldusing(e){
return await fieldusing(e).then(res=>{
return res
})
},
async down(e){
return await fielddownTemplate(e).then(res=>{
return res
})
},
async fieldsubmit(e){
return await fieldupdata(e).then(res=>{
return res
})
}
},
};
}
};
</script>
<style>
</style>