前后端分目录
This commit is contained in:
63
h5-datax-manager/src/App.vue
Normal file
63
h5-datax-manager/src/App.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
|
||||
<!-- <keep-alive include="history"> -->
|
||||
<router-view></router-view>
|
||||
<!-- </keep-alive> -->
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import {
|
||||
// fieldusing
|
||||
// } from '@/api/index.js'
|
||||
export default {
|
||||
name: 'App',
|
||||
created() {
|
||||
|
||||
// getV({page:2}).then(res=>{
|
||||
|
||||
// console.log(String(res))
|
||||
// })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
@import "./assets/css/main.css";
|
||||
@import "./assets/css/color-dark.css";
|
||||
|
||||
/*深色主题*/
|
||||
/*@import "./assets/css/theme-green/color-green.css"; 浅绿色主题*/
|
||||
.setting-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.setting-wrapper .line {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.call-mode-wrapper,
|
||||
.setting-wrapper {
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.conditions-wrapper {
|
||||
/* display: flex; */
|
||||
margin: 15px 0;
|
||||
/* align-items: center; */
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.type3_submit_home {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
left: 80%;
|
||||
margin-top: 30px;
|
||||
top: 74.5vh;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
111
h5-datax-manager/src/api/index.js
Normal file
111
h5-datax-manager/src/api/index.js
Normal file
@@ -0,0 +1,111 @@
|
||||
import request from '../utils/request';
|
||||
// console.log(request)
|
||||
|
||||
// export const getV = (params) => request.get(`${window.location.origin}/index.html?time=${new Date().getTime()}`)
|
||||
|
||||
|
||||
|
||||
export const fetchData = (params) => request.get('./table.json',{params})
|
||||
// 登录接口
|
||||
export const getLogin = (params) => request.post('Riskmanage/v2/login/login',params)
|
||||
// 登出接口
|
||||
export const getLogout = (params) => request.post('Riskmanage/v2/login/logout',params)
|
||||
// 查询菜单权限接口
|
||||
export const getMenus = (params) => request.post('Riskmanage/v2/sysMenu/getMenus',params)
|
||||
// 查询首页统计信息
|
||||
export const getIndexInfo = (params) => request.post('Riskmanage/DataX/home/getIndexInfo',params)
|
||||
// 获取调用最多的10条
|
||||
export const getFieldCallCountList = (params) => request.post('Riskmanage/DataX/statistics/getFieldCallCountList',params)
|
||||
|
||||
|
||||
|
||||
// 数据源 数据库列表
|
||||
export const getDataSourcelist = (params) => request.post('/Riskmanage/datasource/getDataSourceList',params)
|
||||
// 数据源 修改以及创建数据库
|
||||
export const setDataSource = (params) => request.post('/Riskmanage/datasource/save',params)
|
||||
// 数据源 删除
|
||||
export const deleteDataSource = (id) => request.delete('/Riskmanage/datasource/'+id)
|
||||
// 数据源 修改数据源
|
||||
export const updataDataSource = (params) => request.post('/Riskmanage/datasource/update',params)
|
||||
|
||||
|
||||
// 指标管理 listTree 获取
|
||||
export const getfieldListTree = (params) => request.post('/Riskmanage/v2/datamanage/field/newListTree',params)
|
||||
|
||||
// 指标管理 指标列表 获取
|
||||
export const getfieldList = (params) => request.post('/Riskmanage/v2/datamanage/field/list',params)
|
||||
|
||||
// 指标管理 指标列表 获取
|
||||
export const addfieldList = (params) => request.post('/Riskmanage/v2/datamanage/field/addTree',params)
|
||||
// 指标管理 更新类型 名称
|
||||
export const updatafieldList = (params) => request.post('/Riskmanage/v2/datamanage/field/updateTree',params)
|
||||
// 指标管理 更新类型 名称
|
||||
export const getFieldUser = (params) => request.post('/Riskmanage/v2/datamanage/field/findFieldByUser',params)
|
||||
|
||||
// 保存 增加属性
|
||||
export const getfieldsave = (params) => request.post('/Riskmanage/v2/datamanage/field/save',params)
|
||||
// 编辑保存
|
||||
export const updatafield = (params) => request.post('/Riskmanage/v2/datamanage/field/update',params)
|
||||
// 启用等
|
||||
export const fieldusing = (params) => request.post('/Riskmanage/v2/datamanage/field/updateStatus',params)
|
||||
// 指标导入模板下载
|
||||
export const fielddownTemplate = (params) => request.post('/Riskmanage/v2/datamanage/field/downTemplate',params)
|
||||
// 指标批量模板上传
|
||||
export const fieldupdata = (params) => request.post('/Riskmanage/v2/datamanage/field/upload',params)
|
||||
// 获取指标管理
|
||||
export const getfieldInfo = (id,params) => request.post('/Riskmanage/v2/datamanage/field/getFieldInfo/'+id,{params})
|
||||
|
||||
// 指标文件夹移动
|
||||
export const updateFieldFolder = (params) => request.post('/Riskmanage/v2/datamanage/field/updateFieldFolder',params)
|
||||
|
||||
|
||||
// =====================接口管理==============================
|
||||
// 获取list
|
||||
export const getInterfaceList = (params) => request.post('/Riskmanage/v3/interface/getInterfaceList',params)
|
||||
// 新增list
|
||||
export const addInterface = (params) => request.post('/Riskmanage/v3/interface/addInterface',params)
|
||||
// 修改list
|
||||
export const updateInterface = (params) => request.post('/Riskmanage/v3/interface/updateInterface',params)
|
||||
// 删除list
|
||||
export const deleteInterface = (params) => request.post('/Riskmanage/v3/interface/deleteInterface',params)
|
||||
// 测试接口
|
||||
export const getHttpResponse = (params) => request.post('/Riskmanage/v3/interface/getHttpResponse',params)
|
||||
|
||||
// =====================消息队列管理==============================
|
||||
// 获取list
|
||||
export const getMqSourceList = (params) => request.post('/Riskmanage/mqSource/getMqSourceList',params)
|
||||
// 新增list
|
||||
export const addMqSource = (params) => request.post('/Riskmanage/mqSource/addMqSource',params)
|
||||
// 修改list
|
||||
export const updateMqSource = (params) => request.post('/Riskmanage/mqSource/updateMqSource',params)
|
||||
// 删除list
|
||||
export const MqupdateStatus = (params) => request.post('/Riskmanage/mqSource/updateStatus',params)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ======================接口管理 ==============================
|
||||
|
||||
export const getengineSummaryList = (params) => request.post('/Riskmanage/v3/1',params)
|
||||
|
||||
|
||||
// =====================指标统计========================
|
||||
// 获取指标调用次数
|
||||
export const getFieldCallList = (params) => request.post('/Riskmanage/DataX/statistics/getFieldCallList',params)
|
||||
|
||||
// 获取指标日志
|
||||
export const getFieldCallLogList = (params) => request.post('/Riskmanage/DataX/statistics/getFieldCallLogList',params)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getV = (params) => request.post('/list/product',params)
|
||||
|
||||
|
||||
|
||||
159
h5-datax-manager/src/assets/css/ManageRedact.css
Normal file
159
h5-datax-manager/src/assets/css/ManageRedact.css
Normal file
@@ -0,0 +1,159 @@
|
||||
.dataManageRedact {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.MR_header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
padding:20px;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 1px solid #ddd;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.MR_header>div:nth-of-type(1) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 12%;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.MR_input {
|
||||
|
||||
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
border-bottom: 1px solid #ddd;
|
||||
transition: all 0.2s;
|
||||
|
||||
padding: 20px 0 20px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.MR_input input {
|
||||
|
||||
|
||||
transition: all 0.2s;
|
||||
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.MR_scope {
|
||||
border-bottom: 1px solid #ddd;
|
||||
transition: all 0.2s;
|
||||
padding: 20px 0 20px 0;
|
||||
font-size: 16px;
|
||||
/* display: flex; */
|
||||
}
|
||||
|
||||
.MR_scope input {
|
||||
height: 40px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.MR_headerSmall {
|
||||
padding:8px 20px 8px 20px;
|
||||
|
||||
}
|
||||
.MR_inputSmall {
|
||||
padding: 0;
|
||||
font-size: 14px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.MR_inputSmall input {
|
||||
height: 25px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.MR_scopeSmall input {
|
||||
height: 25px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.MR_scopeSmall {
|
||||
padding:0;
|
||||
font-size: 14px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.MR_input>div {
|
||||
width: 30%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
margin-left: 2%;
|
||||
}
|
||||
|
||||
.MR_input>div>p {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.MR_checkbox {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.MR_scope>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 2%;
|
||||
}
|
||||
|
||||
.MR_scope>div>p {
|
||||
width: 7.6%;
|
||||
}
|
||||
|
||||
.MR_derive {
|
||||
|
||||
margin: 0 40px 0 40px;
|
||||
|
||||
}
|
||||
|
||||
.MR_rule_home {
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.MR_rule_home::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.MR_toolbar {
|
||||
background-color: #F0F0F0;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
}
|
||||
|
||||
.MR_toolbar>p:hover {
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
265
h5-datax-manager/src/assets/css/alicdn.css
Normal file
265
h5-datax-manager/src/assets/css/alicdn.css
Normal file
File diff suppressed because one or more lines are too long
28
h5-datax-manager/src/assets/css/color-dark.css
Normal file
28
h5-datax-manager/src/assets/css/color-dark.css
Normal file
@@ -0,0 +1,28 @@
|
||||
.header{
|
||||
background-color: #242f42;
|
||||
}
|
||||
.login-wrap{
|
||||
background: #324157;
|
||||
}
|
||||
.plugins-tips{
|
||||
background: #eef1f6;
|
||||
}
|
||||
.plugins-tips a{
|
||||
color: #20a0ff;
|
||||
}
|
||||
.el-upload--text em {
|
||||
color: #20a0ff;
|
||||
}
|
||||
.pure-button{
|
||||
background: #20a0ff;
|
||||
}
|
||||
.tags-li.active {
|
||||
border: 1px solid #409EFF;
|
||||
background-color: #409EFF;
|
||||
}
|
||||
.message-title{
|
||||
color: #20a0ff;
|
||||
}
|
||||
.collapse-btn:hover{
|
||||
background: rgb(40,52,70);
|
||||
}
|
||||
124
h5-datax-manager/src/assets/css/cont.css
Normal file
124
h5-datax-manager/src/assets/css/cont.css
Normal file
@@ -0,0 +1,124 @@
|
||||
.cont_cont {
|
||||
display: flex;
|
||||
border-radius: 20px;
|
||||
height: 85vh;
|
||||
}
|
||||
|
||||
.cont_left {
|
||||
width: 200px;
|
||||
flex-shrink: 0;
|
||||
background-color: #fff;
|
||||
border-radius: 10px 0 0 10px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.cont_list {
|
||||
height: 70vh;
|
||||
overflow: scroll;
|
||||
scrollbar-width: none;
|
||||
/* Firefox */
|
||||
-ms-overflow-style: none;
|
||||
/* IE 10+ */
|
||||
overflow-x: hidden;
|
||||
/* position: relative; */
|
||||
}
|
||||
|
||||
.cont_list::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.cont_left::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
||||
border-radius: 10px;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
.cont_header {
|
||||
margin-left: 20px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.cont_header_title {
|
||||
color: #444;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.cont_header_subtitle {
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.cont_new_file {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
font-size: 16px;
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 10px 0 10px 15px;
|
||||
box-sizing: border-box;
|
||||
margin-top: 15px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.cont_new_file>div{
|
||||
margin-left: 10px;
|
||||
}
|
||||
.file_select {
|
||||
border: #409EFF 2px solid;
|
||||
border-radius: 2px;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.cont_right {
|
||||
flex-grow: 1;
|
||||
overflow: hidden;
|
||||
background-color: #fafafa;
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
}
|
||||
|
||||
.cont_right_hint {
|
||||
font-size: 100px;
|
||||
color: #00000011;
|
||||
text-align: center;
|
||||
line-height: 80vh;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.cont_right_top {
|
||||
padding: 21px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 2px solid #eee;
|
||||
}
|
||||
.contText{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: block;
|
||||
}
|
||||
.contText:hover{
|
||||
white-space:inherit !important
|
||||
}
|
||||
.fileHint{
|
||||
position: fixed;
|
||||
background-color: #fafafa;
|
||||
padding: 5px;
|
||||
|
||||
}
|
||||
.fileHint>p{
|
||||
border-bottom: 1px solid #000;
|
||||
}
|
||||
.fileHint>p:hover{
|
||||
color: #409EFF;
|
||||
}
|
||||
4
h5-datax-manager/src/assets/css/icon.css
Normal file
4
h5-datax-manager/src/assets/css/icon.css
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
[class*=" el-icon-lx"], [class^=el-icon-lx] {
|
||||
font-family: lx-iconfont!important;
|
||||
}
|
||||
185
h5-datax-manager/src/assets/css/main.css
Normal file
185
h5-datax-manager/src/assets/css/main.css
Normal file
@@ -0,0 +1,185 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app,
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
|
||||
.content-box {
|
||||
position: absolute;
|
||||
left: 250px;
|
||||
right: 0;
|
||||
top: 70px;
|
||||
bottom: 0;
|
||||
padding-bottom: 30px;
|
||||
-webkit-transition: left .3s ease-in-out;
|
||||
transition: left .3s ease-in-out;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: auto;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
/* overflow-y: scroll; */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.content-collapse {
|
||||
left: 65px;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 30px;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.crumbs {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.el-table th {
|
||||
background-color: #f5f7fa !important;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
margin: 20px 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.plugins-tips {
|
||||
padding: 20px 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.el-button+.el-tooltip {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.el-table tr:hover {
|
||||
background: #f6faff;
|
||||
}
|
||||
|
||||
.mgb20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.move-enter-active,
|
||||
.move-leave-active {
|
||||
transition: opacity .5s;
|
||||
}
|
||||
|
||||
.move-enter,
|
||||
.move-leave {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/*BaseForm*/
|
||||
|
||||
.form-box {
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.form-box .line {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.el-time-panel__content::after,
|
||||
.el-time-panel__content::before {
|
||||
margin-top: -7px;
|
||||
}
|
||||
|
||||
.el-time-spinner__wrapper .el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default) {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
/*Upload*/
|
||||
|
||||
.pure-button {
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.g-core-image-corp-container .info-aside {
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.el-upload--text {
|
||||
background-color: #fff;
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
box-sizing: border-box;
|
||||
width: 360px;
|
||||
height: 180px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.el-upload--text .el-icon-upload {
|
||||
font-size: 67px;
|
||||
color: #97a8be;
|
||||
margin: 40px 0 16px;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
.el-upload--text {
|
||||
color: #97a8be;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.el-upload--text em {
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
/*VueEditor*/
|
||||
|
||||
.ql-container {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.ql-snow .ql-tooltip {
|
||||
transform: translateX(117.5px) translateY(10px) !important;
|
||||
}
|
||||
|
||||
.editor-btn {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/*markdown*/
|
||||
|
||||
.v-note-wrapper .v-note-panel {
|
||||
min-height: 500px;
|
||||
}
|
||||
|
||||
.content-wrapper{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 21px;
|
||||
}
|
||||
29
h5-datax-manager/src/assets/css/theme-green/color-green.css
Normal file
29
h5-datax-manager/src/assets/css/theme-green/color-green.css
Normal file
@@ -0,0 +1,29 @@
|
||||
.header{
|
||||
background-color: #07c4a8;
|
||||
}
|
||||
.login-wrap{
|
||||
background: rgba(56, 157, 170, 0.82);;
|
||||
}
|
||||
.plugins-tips{
|
||||
background: #f2f2f2;
|
||||
}
|
||||
.plugins-tips a{
|
||||
color: #00d1b2;
|
||||
}
|
||||
.el-upload--text em {
|
||||
color: #00d1b2;
|
||||
}
|
||||
.pure-button{
|
||||
background: #00d1b2;
|
||||
}
|
||||
.pagination > .active > a, .pagination > .active > a:hover, .pagination > .active > a:focus, .pagination > .active > span, .pagination > .active > span:hover, .pagination > .active > span:focus {
|
||||
background-color: #00d1b2 !important;
|
||||
border-color: #00d1b2 !important;
|
||||
}
|
||||
.tags-li.active {
|
||||
border: 1px solid #00d1b2;
|
||||
background-color: #00d1b2;
|
||||
}
|
||||
.collapse-btn:hover{
|
||||
background: #00d1b2;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
1
h5-datax-manager/src/assets/css/theme-green/index.css
Normal file
1
h5-datax-manager/src/assets/css/theme-green/index.css
Normal file
File diff suppressed because one or more lines are too long
BIN
h5-datax-manager/src/assets/img/img.jpg
Normal file
BIN
h5-datax-manager/src/assets/img/img.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
h5-datax-manager/src/assets/img/img(1).jpg
Normal file
BIN
h5-datax-manager/src/assets/img/img(1).jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.0 KiB |
BIN
h5-datax-manager/src/assets/img/login-bg.jpg
Normal file
BIN
h5-datax-manager/src/assets/img/login-bg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
BIN
h5-datax-manager/src/assets/logo.png
Normal file
BIN
h5-datax-manager/src/assets/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
24
h5-datax-manager/src/assets/utils.js
Normal file
24
h5-datax-manager/src/assets/utils.js
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
export function formatDate (date, fmt) {
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
|
||||
}
|
||||
let o = {
|
||||
'M+': date.getMonth() + 1,
|
||||
'd+': date.getDate(),
|
||||
'h+': date.getHours(),
|
||||
'm+': date.getMinutes(),
|
||||
's+': date.getSeconds()
|
||||
};
|
||||
for (let k in o) {
|
||||
if (new RegExp(`(${k})`).test(fmt)) {
|
||||
let str = o[k] + '';
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
};
|
||||
|
||||
function padLeftZero (str) {
|
||||
return ('00' + str).substr(str.length);
|
||||
};
|
||||
328
h5-datax-manager/src/components/common/Header.vue
Normal file
328
h5-datax-manager/src/components/common/Header.vue
Normal file
@@ -0,0 +1,328 @@
|
||||
<template>
|
||||
<div class="header">
|
||||
<!-- 折叠按钮 -->
|
||||
<div class="collapse-btn" @click="collapseChage">
|
||||
<i v-if="!collapse" class="el-icon-s-fold"></i>
|
||||
<i v-else class="el-icon-s-unfold"></i>
|
||||
</div>
|
||||
<div class="logo">数据中心</div>
|
||||
<div class="header-right">
|
||||
<!-- {{fielduser}} -->
|
||||
<!-- {{ruleList}} -->
|
||||
|
||||
<!-- {{fielduser==''}} -->
|
||||
<!-- {{ruleList==null}} -->
|
||||
<div class="header-user-con">
|
||||
<div style="display: flex;font-size: 14px;">
|
||||
|
||||
|
||||
<div v-for="value in link.d" class="header_link" @click="go(value)">
|
||||
{{value.title}}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- -->
|
||||
<div class="btn-fullscreen" @click="ReGetStorage">
|
||||
<!-- {{fielduser}} -->
|
||||
<!-- {{ruleList=='[]'}} -->
|
||||
<el-tooltip effect="dark" content="刷新缓存" placement="bottom">
|
||||
|
||||
<i :class="Loading?'el-icon-loading':'el-icon-refresh'"></i>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
<!-- 全屏显示 -->
|
||||
<div class="btn-fullscreen" @click="handleFullScreen">
|
||||
<el-tooltip effect="dark" :content="fullscreen?`取消全屏`:`全屏`" placement="bottom">
|
||||
<i class="el-icon-rank"></i>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<!-- 消息中心
|
||||
<div class="btn-bell">
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="message?`有${message}条未读消息`:`消息中心`"
|
||||
placement="bottom"
|
||||
>
|
||||
<router-link to="/tabs">
|
||||
<i class="el-icon-bell"></i>
|
||||
</router-link>
|
||||
</el-tooltip>
|
||||
<span class="btn-bell-badge" v-if="message"></span>
|
||||
</div> -->
|
||||
<!-- 用户头像 -->
|
||||
<div class="user-avator">
|
||||
<img src="../../assets/img/img.jpg" />
|
||||
</div>
|
||||
<!-- 用户名下拉菜单 -->
|
||||
<el-dropdown class="user-name" trigger="click" @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
{{username}}
|
||||
<i class="el-icon-caret-bottom"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item divided command="loginout">退出登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import bus from '../common/bus';
|
||||
import {
|
||||
getLogout
|
||||
} from '../../api/index';
|
||||
import linkOr from '@/utils/link.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
collapse: false,
|
||||
fullscreen: false,
|
||||
name: '',
|
||||
message: 2,
|
||||
link:[]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
this.link = linkOr
|
||||
bus.$on('collapseHeader', res => {
|
||||
this.busCollapseChage(res)
|
||||
})
|
||||
bus.$on('regetcache',res=>{
|
||||
|
||||
this.$store.dispatch('regetcache',res)
|
||||
})
|
||||
|
||||
this.$store.dispatch('getfielduser')
|
||||
|
||||
|
||||
|
||||
Object.keys(this.$store.state.cacheList).forEach(value => {
|
||||
|
||||
this.$store.dispatch('getcache', value)
|
||||
})
|
||||
|
||||
this.$store.commit('setbarShrink', this.collapse)
|
||||
},
|
||||
computed: {
|
||||
username() {
|
||||
if (localStorage.getItem('ms_username')) {
|
||||
return localStorage.getItem('ms_username');
|
||||
} else {
|
||||
return "未命名"
|
||||
}
|
||||
},
|
||||
fielduser() {
|
||||
if (this.$store.state.FieldUser) {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
} else {
|
||||
|
||||
return null
|
||||
}
|
||||
},
|
||||
ruleList() {
|
||||
if (this.$store.state.RuleList) {
|
||||
return this.$store.state.RuleList
|
||||
|
||||
} else {
|
||||
|
||||
return null
|
||||
}
|
||||
},
|
||||
Loading() {
|
||||
if (this.$store.state.FieldUser == null) {
|
||||
return true
|
||||
}
|
||||
|
||||
let is = false
|
||||
Object.keys(this.$store.state.cacheList).forEach(value => {
|
||||
if (this.$store.state[value] == null) {
|
||||
is = true
|
||||
}
|
||||
})
|
||||
if(is) return true
|
||||
|
||||
|
||||
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
go(value) {
|
||||
var url = window.location.href
|
||||
|
||||
if (value[url.split('#')[0]]) {
|
||||
window.open(value[url.split('#')[0]])
|
||||
} else {
|
||||
this.$message.error('请检查跳转配置')
|
||||
}
|
||||
},
|
||||
ReGetStorage() {
|
||||
|
||||
if (this.Loading) {
|
||||
return
|
||||
}
|
||||
|
||||
this.mixinReGetStorage()
|
||||
},
|
||||
// 用户名下拉菜单选择事件
|
||||
handleCommand(command) {
|
||||
if (command == 'loginout') {
|
||||
// 调用退出登录接口
|
||||
getLogout();
|
||||
localStorage.removeItem("engineId");
|
||||
// localStorage.removeItem("token");
|
||||
localStorage.removeItem('ms_username');
|
||||
this.$router.push('/login');
|
||||
}
|
||||
},
|
||||
// Bus侧边栏折叠
|
||||
busCollapseChage(res) {
|
||||
this.collapse = res;
|
||||
this.$store.commit('setbarShrink', this.collapse)
|
||||
bus.$emit('collapse', this.collapse);
|
||||
},
|
||||
// 侧边栏折叠
|
||||
collapseChage() {
|
||||
this.collapse = !this.collapse;
|
||||
this.$store.commit('setbarShrink', this.collapse)
|
||||
bus.$emit('collapse', this.collapse);
|
||||
},
|
||||
// 全屏事件
|
||||
handleFullScreen() {
|
||||
let element = document.documentElement;
|
||||
if (this.fullscreen) {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.webkitCancelFullScreen) {
|
||||
document.webkitCancelFullScreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
}
|
||||
} else {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen();
|
||||
} else if (element.webkitRequestFullScreen) {
|
||||
element.webkitRequestFullScreen();
|
||||
} else if (element.mozRequestFullScreen) {
|
||||
element.mozRequestFullScreen();
|
||||
} else if (element.msRequestFullscreen) {
|
||||
// IE11
|
||||
element.msRequestFullscreen();
|
||||
}
|
||||
}
|
||||
this.fullscreen = !this.fullscreen;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (document.body.clientWidth < 1500) {
|
||||
this.collapseChage();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.header {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
font-size: 22px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.collapse-btn {
|
||||
float: left;
|
||||
padding: 0 21px;
|
||||
cursor: pointer;
|
||||
line-height: 70px;
|
||||
}
|
||||
.header_link {
|
||||
padding: 4px;
|
||||
margin-right: 20px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.header_link:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
.header .logo {
|
||||
float: left;
|
||||
width: 250px;
|
||||
line-height: 70px;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
float: right;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.header-user-con {
|
||||
display: flex;
|
||||
height: 70px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-fullscreen {
|
||||
transform: rotate(45deg);
|
||||
margin-right: 5px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.btn-bell,
|
||||
.btn-fullscreen {
|
||||
position: relative;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
text-align: center;
|
||||
border-radius: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-bell-badge {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: -2px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 4px;
|
||||
background: #f56c6c;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-bell .el-icon-bell {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.user-avator {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.user-avator img {
|
||||
display: block;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.el-dropdown-menu__item {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
51
h5-datax-manager/src/components/common/Home.vue
Normal file
51
h5-datax-manager/src/components/common/Home.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<v-head></v-head>
|
||||
<v-sidebar></v-sidebar>
|
||||
<div class="content-box" :class="{'content-collapse':collapse}">
|
||||
<v-tags></v-tags>
|
||||
<div class="content" >
|
||||
<transition name="move" mode="out-in">
|
||||
<keep-alive :include="tagsList">
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
</transition>
|
||||
<el-backtop target=".content"></el-backtop>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import vHead from './Header.vue';
|
||||
import vSidebar from './Sidebar.vue';
|
||||
import vTags from './Tags.vue';
|
||||
import bus from './bus';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tagsList: [],
|
||||
collapse: false
|
||||
};
|
||||
},
|
||||
components: {
|
||||
vHead,
|
||||
vSidebar,
|
||||
vTags
|
||||
},
|
||||
created() {
|
||||
bus.$on('collapse-content', msg => {
|
||||
this.collapse = msg;
|
||||
});
|
||||
|
||||
// 只有在标签页列表里的页面才使用keep-alive,即关闭标签之后就不保存到内存中了。
|
||||
bus.$on('tags', msg => {
|
||||
let arr = [];
|
||||
for (let i = 0, len = msg.length; i < len; i++) {
|
||||
msg[i].name && arr.push(msg[i].name);
|
||||
}
|
||||
this.tagsList = arr;
|
||||
});
|
||||
},
|
||||
};
|
||||
</script>
|
||||
103
h5-datax-manager/src/components/common/Sidebar.vue
Normal file
103
h5-datax-manager/src/components/common/Sidebar.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<div class="sidebar">
|
||||
<el-menu class="sidebar-el-menu" :default-active="onRoutes" :collapse="collapse" background-color="#324157"
|
||||
text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened :router="true">
|
||||
<template v-for="item in items">
|
||||
<template v-if="item.subs">
|
||||
<el-submenu :index="item.index" :key="item.index">
|
||||
<template slot="title">
|
||||
<i :class="item.icon"></i>
|
||||
<span slot="title">{{ item.title }}</span>
|
||||
</template>
|
||||
<template v-for="subItem in item.subs">
|
||||
<el-submenu v-if="subItem.subs" :index="subItem.index" :key="subItem.index">
|
||||
<template slot="title">{{ subItem.title }}</template>
|
||||
<el-menu-item v-for="(threeItem,i) in subItem.subs" :key="i" :index="threeItem.index">{{ threeItem.title }}</el-menu-item>
|
||||
</el-submenu>
|
||||
<el-menu-item v-else :index="subItem.index" :key="subItem.index">{{ subItem.title }}</el-menu-item>
|
||||
</template>
|
||||
</el-submenu>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-menu-item :index="item.index" :key="item.index">
|
||||
<i :class="item.icon"></i>
|
||||
<span slot="title">{{ item.title }}</span>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
</el-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from './bus';
|
||||
import {
|
||||
getMenus
|
||||
} from '../../api/index';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
collapse: false,
|
||||
items: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
onRoutes() {
|
||||
return this.$route.path
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 通过 Event Bus 进行组件间通信,来折叠侧边栏
|
||||
bus.$on('collapse', msg => {
|
||||
this.collapse = msg;
|
||||
// bus.$emit('setcanvasn',msg)
|
||||
bus.$emit('collapse-content', msg);
|
||||
});
|
||||
|
||||
// 获取菜单接口
|
||||
this.getMenus()
|
||||
},
|
||||
methods: {
|
||||
async getMenus() {
|
||||
const data = await getMenus({entity:{resourceSystem:'DataX'}});
|
||||
// console.log('菜单接口返回的数据',data);
|
||||
if (data.status === "0") {
|
||||
this.$message.error(data.msg);
|
||||
if (data.error === "01000103") {
|
||||
this.$router.push('/login')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.items = data.data;
|
||||
if(this.items.length == 0){
|
||||
this.$message.error('您没有导航权限,请联系管理员');
|
||||
}
|
||||
// console.log("items", this.items);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.sidebar {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 70px;
|
||||
bottom: 0;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.sidebar::-webkit-scrollbar {
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.sidebar-el-menu:not(.el-menu--collapse) {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.sidebar>ul {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
186
h5-datax-manager/src/components/common/Tags.vue
Normal file
186
h5-datax-manager/src/components/common/Tags.vue
Normal file
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<div class="tags" v-if="showTags">
|
||||
<ul>
|
||||
<li class="tags-li" v-for="(item,index) in tagsList" :class="{'active': isActive(item.path)}" :key="index">
|
||||
<router-link :to="item.path" class="tags-li-title">
|
||||
{{item.title}}
|
||||
</router-link>
|
||||
<span class="tags-li-icon" @click="closeTags(index)"><i class="el-icon-close"></i></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tags-close-box">
|
||||
<el-dropdown @command="handleTags">
|
||||
<el-button size="mini" type="primary">
|
||||
标签选项<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-dropdown-menu size="small" slot="dropdown">
|
||||
<el-dropdown-item command="other">关闭其他</el-dropdown-item>
|
||||
<el-dropdown-item command="all">关闭所有</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from './bus';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tagsList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isActive(path) {
|
||||
return path === this.$route.fullPath;
|
||||
},
|
||||
// 关闭单个标签
|
||||
closeTags(index) {
|
||||
const delItem = this.tagsList.splice(index, 1)[0];
|
||||
const item = this.tagsList[index] ? this.tagsList[index] : this.tagsList[index - 1];
|
||||
if (item) {
|
||||
delItem.path === this.$route.fullPath && this.$router.push(item.path);
|
||||
}else{
|
||||
this.$router.push('/');
|
||||
}
|
||||
},
|
||||
// 关闭全部标签
|
||||
closeAll(){
|
||||
this.tagsList = [];
|
||||
this.$router.push('/');
|
||||
},
|
||||
// 关闭其他标签
|
||||
closeOther(){
|
||||
const curItem = this.tagsList.filter(item => {
|
||||
return item.path === this.$route.fullPath;
|
||||
})
|
||||
this.tagsList = curItem;
|
||||
},
|
||||
// 设置标签
|
||||
setTags(route){
|
||||
const isExist = this.tagsList.some(item => {
|
||||
return item.path === route.fullPath;
|
||||
})
|
||||
if(!isExist){
|
||||
if(this.tagsList.length >= 8){
|
||||
this.tagsList.shift();
|
||||
}
|
||||
this.tagsList.push({
|
||||
title: route.meta.title,
|
||||
path: route.fullPath,
|
||||
name: route.matched[1].components.default.name
|
||||
})
|
||||
}
|
||||
bus.$emit('tags', this.tagsList);
|
||||
},
|
||||
handleTags(command){
|
||||
command === 'other' ? this.closeOther() : this.closeAll();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showTags() {
|
||||
return this.tagsList.length > 0;
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
$route(newValue, oldValue){
|
||||
this.setTags(newValue);
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.setTags(this.$route);
|
||||
// 监听关闭当前页面的标签页
|
||||
bus.$on('close_current_tags', () => {
|
||||
for (let i = 0, len = this.tagsList.length; i < len; i++) {
|
||||
const item = this.tagsList[i];
|
||||
if(item.path === this.$route.fullPath){
|
||||
if(i < len - 1){
|
||||
this.$router.push(this.tagsList[i+1].path);
|
||||
}else if(i > 0){
|
||||
this.$router.push(this.tagsList[i-1].path);
|
||||
}else{
|
||||
this.$router.push('/');
|
||||
}
|
||||
this.tagsList.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
.tags {
|
||||
position: relative;
|
||||
height: 30px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
padding-right: 120px;
|
||||
box-shadow: 0 5px 10px #ddd;
|
||||
}
|
||||
|
||||
.tags ul {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tags-li {
|
||||
float: left;
|
||||
margin: 3px 5px 2px 3px;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
height: 23px;
|
||||
line-height: 23px;
|
||||
border: 1px solid #e9eaec;
|
||||
background: #fff;
|
||||
padding: 0 5px 0 12px;
|
||||
vertical-align: middle;
|
||||
color: #666;
|
||||
-webkit-transition: all .3s ease-in;
|
||||
-moz-transition: all .3s ease-in;
|
||||
transition: all .3s ease-in;
|
||||
}
|
||||
|
||||
.tags-li:not(.active):hover {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.tags-li.active {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tags-li-title {
|
||||
float: left;
|
||||
max-width: 80px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
margin-right: 5px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tags-li.active .tags-li-title {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tags-close-box {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
box-sizing: border-box;
|
||||
padding-top: 1px;
|
||||
text-align: center;
|
||||
width: 110px;
|
||||
height: 30px;
|
||||
background: #fff;
|
||||
box-shadow: -3px 0 15px 3px rgba(0, 0, 0, .1);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
</style>
|
||||
94
h5-datax-manager/src/components/common/bindParam.vue
Normal file
94
h5-datax-manager/src/components/common/bindParam.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<div>
|
||||
<p style="margin-top: 20px;padding-top: 10px;display: flex;align-items: center;">
|
||||
变量:<i class="el-icon-circle-plus-outline" style="color:#409EFF;font-size: 24px;" @click="addVariable"></i>
|
||||
</p>
|
||||
|
||||
<div v-for="(value,index) in Variable" style="display: flex;align-items: center;margin-top: 10px;">
|
||||
<el-input v-model="value.key" style="width: 200px;" placeholder="键" :size="size"></el-input>
|
||||
<p style="margin:10px;">:</p>
|
||||
<el-input v-model="value.value" style="width: 200px;" placeholder="默认值" :size="size"></el-input>
|
||||
<i class="el-icon-circle-close" :style="{color:'#F56C6C',fontSize: '24px',marginLeft:'10px'}"
|
||||
@click="delectVariable(index)"></i>
|
||||
</div>
|
||||
|
||||
|
||||
<p style="margin-top: 20px;display: flex;align-items: center;">
|
||||
字典变量:<i class="el-icon-circle-plus-outline" style="color:#409EFF;font-size: 24px;"
|
||||
@click="addDictVariable"></i></p>
|
||||
|
||||
<div v-for="(value,index) in dictVariable" style="display: flex;align-items: center;margin-top: 10px;">
|
||||
<el-input v-model="value.key" style="width: 200px;" placeholder="键" :size="size"></el-input>
|
||||
<p style="margin:10px;">:</p>
|
||||
<el-select v-model="value.type" placeholder="请选择类型" :size="size">
|
||||
<el-option v-for="item in dictVariableType" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-input v-model="value.value" style="width: 200px;margin-left: 20px;" placeholder="格式" :size="size"></el-input>
|
||||
<i class="el-icon-circle-close" :style="{color:'#F56C6C',fontSize: '24px',marginLeft:'10px'}"
|
||||
@click="delectDictVariable(index)"></i>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
Variable: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
dictVariable: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
size:{
|
||||
type: String,
|
||||
default:''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dictVariableType: [{
|
||||
label: '时间',
|
||||
value: 'date'
|
||||
}]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addVariable() {
|
||||
this.Variable.push({
|
||||
value: '',
|
||||
key: ''
|
||||
})
|
||||
},
|
||||
delectVariable(index) {
|
||||
this.Variable.splice(index, 1)
|
||||
},
|
||||
addDictVariable() {
|
||||
this.dictVariable.push({
|
||||
key: '',
|
||||
type: '',
|
||||
value: ''
|
||||
})
|
||||
},
|
||||
delectDictVariable(index) {
|
||||
|
||||
this.dictVariable.splice(index, 1)
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
6
h5-datax-manager/src/components/common/bus.js
Normal file
6
h5-datax-manager/src/components/common/bus.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// 使用 Event Bus
|
||||
const bus = new Vue();
|
||||
|
||||
export default bus;
|
||||
55
h5-datax-manager/src/components/common/charts.vue
Normal file
55
h5-datax-manager/src/components/common/charts.vue
Normal file
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div :id="sid" :style="{height: height,width:width}">
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as echarts from 'echarts';
|
||||
export default {
|
||||
props: {
|
||||
sid: {
|
||||
type: String,
|
||||
default: 'echartsId'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
},
|
||||
option: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chartDom: null,
|
||||
myChart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.chartDom = document.getElementById(this.sid);
|
||||
this.myChart = echarts.init(this.chartDom);
|
||||
this.myChart.setOption(this.option);
|
||||
},
|
||||
watch: {
|
||||
option: {
|
||||
handler: function() {
|
||||
this.myChart.clear()
|
||||
this.myChart.setOption(this.option);
|
||||
},
|
||||
// 开启深度监听:只要obj中的任何一个属性发生改变,都会触发相应的代码
|
||||
deep: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
102
h5-datax-manager/src/components/common/codemirror.vue
Normal file
102
h5-datax-manager/src/components/common/codemirror.vue
Normal file
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
|
||||
<textarea :ref="MYname" class="codesql" :value="value" style="height:200px;width:600px;" :key="keynum"></textarea>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import "codemirror/theme/ambiance.css";
|
||||
import "codemirror/theme/ayu-dark.css";
|
||||
import "codemirror/lib/codemirror.css";
|
||||
import "codemirror/addon/hint/show-hint.css";
|
||||
|
||||
let CodeMirror = require("codemirror/lib/codemirror");
|
||||
require("codemirror/addon/edit/matchbrackets");
|
||||
require("codemirror/addon/selection/active-line");
|
||||
require("codemirror/mode/javascript/javascript");
|
||||
require("codemirror/mode/sql/sql");
|
||||
require("codemirror/mode/lua/lua");
|
||||
require("codemirror/addon/hint/show-hint");
|
||||
require("codemirror/addon/hint/sql-hint");
|
||||
require("codemirror/addon/hint/javascript-hint");
|
||||
export default {
|
||||
name: "codeMirror",
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: '123'
|
||||
},
|
||||
mime: {
|
||||
type: String,
|
||||
default: 'text/javascript'
|
||||
},
|
||||
autocomplete: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
MYname: {
|
||||
type: String,
|
||||
default: 'mycode'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keynum: 0,
|
||||
editor: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.keynum = 1
|
||||
this.keynum = 0
|
||||
// console.log(this.value)
|
||||
},
|
||||
watch:{
|
||||
mime() {
|
||||
|
||||
this.editor.setOption("mode", this.mime)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// let mime = 'text/x-sql'
|
||||
let mime = this.mime
|
||||
let theme = 'ayu-dark' //设置主题,不设置的会使用默认主题
|
||||
let extraKeys = this.autocomplete ? {
|
||||
'Ctrl': 'autocomplete'
|
||||
} : {}
|
||||
|
||||
this.editor = CodeMirror.fromTextArea(this.$refs[this.MYname], {
|
||||
mode: mime, //选择对应代码编辑器的语言,我这边选的是数据库,根据个人情况自行设置即可
|
||||
indentWithTabs: true,
|
||||
smartIndent: true,
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
theme: theme,
|
||||
// autofocus: true,
|
||||
extraKeys: extraKeys, //自定义快捷键
|
||||
hintOptions: { //自定义提示选项
|
||||
tables: {
|
||||
users: ['name', 'score', 'birthDate'],
|
||||
countries: ['name', 'population', 'size']
|
||||
}
|
||||
}
|
||||
})
|
||||
this.editor.on('changes', (e,e2) => {
|
||||
|
||||
this.$emit('input', e.getValue())
|
||||
})
|
||||
|
||||
//
|
||||
},
|
||||
beforeUnmount() {
|
||||
// console.log(1)
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.codesql {
|
||||
font-size: 11pt;
|
||||
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
}
|
||||
</style>
|
||||
351
h5-datax-manager/src/components/common/cont.vue
Normal file
351
h5-datax-manager/src/components/common/cont.vue
Normal file
@@ -0,0 +1,351 @@
|
||||
|
||||
|
||||
<template>
|
||||
<div class="cont_cont">
|
||||
|
||||
<div class="cont_left" v-loading="leftloading">
|
||||
<div class="cont_header">
|
||||
<p class="cont_header_title">{{title}}</p>
|
||||
<p class="cont_header_subtitle">{{title}}</p>
|
||||
</div>
|
||||
|
||||
<contNewFule v-model="tempNewF" :newf.sync="newf" @newFileSure="newFileSure" @newFile="newFile" ></contNewFule>
|
||||
<div class="cont_list">
|
||||
<fileHome :data="list" @curr="clickCurrid" :currid="currid" @RenameFun="RenameFun" @RenameClose="RenameClose"
|
||||
@updatafilelist="updatafilelist" @delectFun="delectFun">
|
||||
</fileHome>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;">
|
||||
<div v-if="!listRedact">
|
||||
<div v-if="showRight===false" class="cont_right_hint">
|
||||
请先选择左侧文件夹
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cont_right_top">
|
||||
<div>
|
||||
<el-button type="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>
|
||||
<el-button type="danger" @click="using(-1)" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
|
||||
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
|
||||
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
|
||||
<!-- <el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'" filterable @change="mixinMoveChange"> -->
|
||||
<el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'"
|
||||
filterable @change="moveChange">
|
||||
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
|
||||
</el-select>
|
||||
<!-- 断点 准备移动 -->
|
||||
</div>
|
||||
<div v-if="getData.type==1">
|
||||
<el-button @click="upShow=true">批量导入</el-button>
|
||||
<el-button @click="down">模板下载</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cont_right_cont">
|
||||
<div v-if="data">
|
||||
<el-table border :data="data.data.klist" @select-all="selectAll" @select="select" style="width: 100%"
|
||||
:cell-style="{padding: '10px'}">
|
||||
<el-table-column type="selection" width="70">
|
||||
</el-table-column>
|
||||
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="item.type==='Blooen'">
|
||||
{{scope.row[item.row]?"是":"否"}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='State'">
|
||||
{{scope.row[item.row]=="1"?'启用':'未启用'}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='type'">
|
||||
{{scope.row[item.row]=="1"?'数值型':(scope.row[item.row]=="2"?'字符型':(scope.row[item.row]=="3"?'枚举型':(scope.row[item.row]=="4"?'小数型':(scope.row[item.row]=="5"?'数组型':(scope.row[item.row]=="6"?'JSON型':'')))))}}
|
||||
</span>
|
||||
<span v-else-if="item.fn">
|
||||
{{item.fn(scope.row[item.row])}}
|
||||
</span>
|
||||
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
|
||||
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
|
||||
}}</span>
|
||||
<span class="contText" v-else>
|
||||
{{scope.row[item.row]}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" size="s">
|
||||
<template slot-scope="scope">
|
||||
<el-button icon="el-icon-setting" circle size="mini" @click="dialogShow(scope.row.id)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
|
||||
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pager.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<template v-else>
|
||||
<dataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist();currPage=1"
|
||||
:updata="getData.updatafield" :id='tempRedactId' :fieldTypeId="currid" :setsave="getData.setsave" :getInfo="getData.getInfo"
|
||||
:ftype="getData.type"></dataManageRedact>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<el-dialog title="上传文件" :visible.sync="upShow" width="30%" :before-close="upShowClose">
|
||||
<div style="margin: 0 auto;display: flex;justify-content: center;">
|
||||
<el-upload class="upload-demo" ref="upload" action="doUpload" :limit="1" :file-list="fileList" :before-upload="beforeUpload"
|
||||
v-loading="Uploadloading">
|
||||
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传excel文件,且不超过5MB</div>
|
||||
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="upShow = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitUpload()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import contNewFule from '@/components/common/contNewFile.vue'
|
||||
import '@/assets/css/cont.css'
|
||||
import fileHome from '@/components/common/fileHome.vue'
|
||||
import dataManageRedact from '@/components/common/dataManageRedact.vue'
|
||||
import contmixin from '@/utils/contminxin/contmixin.js'
|
||||
import {
|
||||
updateFieldFolder
|
||||
} from '@/api/index.js'
|
||||
export default {
|
||||
mixins: [
|
||||
contmixin
|
||||
],
|
||||
components: {
|
||||
fileHome,
|
||||
dataManageRedact,
|
||||
updateFieldFolder,
|
||||
contNewFule
|
||||
},
|
||||
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
getData: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
list() {
|
||||
if (this.list.length > 0) {
|
||||
this.leftloading = false
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
Uploadloading: false,
|
||||
tempMove: '',
|
||||
leftloading: true,
|
||||
fileName: "",
|
||||
fileList: [],
|
||||
upShow: false,
|
||||
currPage: 1,
|
||||
currid: null,
|
||||
data: null,
|
||||
contloading: false,
|
||||
newf: false,
|
||||
tempNewF: "",
|
||||
tempHintTop: null,
|
||||
tempHintLeft: null,
|
||||
tempId: null,
|
||||
listRedact: false, //新增页面开启
|
||||
tempRedactId: 0,
|
||||
selection: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getData.getTree({
|
||||
type: this.getData.type
|
||||
}).then(res => {
|
||||
this.list = this.listTreeDeep(res.data, 1)
|
||||
this.clickCurrid(99999999)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
moveChange(e) { //移动文件夹
|
||||
let arr = this.selection.map((value) => {
|
||||
return value.id
|
||||
})
|
||||
if (arr.length < 1) {
|
||||
this.$message.error('未选择任何文件');
|
||||
return
|
||||
}
|
||||
let params = {
|
||||
ids: arr,
|
||||
folderId: e
|
||||
}
|
||||
updateFieldFolder(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.clickCurrid(this.currid)
|
||||
this.$message({
|
||||
message: '移动成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.selection = []
|
||||
}
|
||||
})
|
||||
this.tempMove = ""
|
||||
},
|
||||
|
||||
down() {
|
||||
window.open(window.origin + '/Riskmanage/v2/datamanage/field/downTemplate')
|
||||
},
|
||||
delectFun(id) {
|
||||
let name
|
||||
this.deepGetCurr(id, this.list, (value) => {
|
||||
name = value.name
|
||||
})
|
||||
let params = {
|
||||
status: -1,
|
||||
id: id,
|
||||
fieldType: name
|
||||
}
|
||||
this.getData.updatalist(params).then(res => {
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
|
||||
this.deepGetCurr(id, this.list, (value, item, index) => {
|
||||
item.splice(index, 1)
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
this.leftloading = false
|
||||
this.currid = 99999999
|
||||
this.getlist()
|
||||
|
||||
}).catch(() => {
|
||||
this.$message.error("请求失败了" + '-_-');
|
||||
this.leftloading = false
|
||||
})
|
||||
},
|
||||
updatafilelist(params) {
|
||||
this.leftloading = true
|
||||
let tempNum = null
|
||||
|
||||
this.deepGetCurr(params.id, this.list, (value) => {
|
||||
tempNum = value.parentId
|
||||
})
|
||||
params.parentId = tempNum == 99999999 ? 0 : tempNum
|
||||
tempNum = null
|
||||
let obj = {
|
||||
fieldType: params.name,
|
||||
id: params.id,
|
||||
parentId: params.parentId
|
||||
}
|
||||
this.getData.updatalist(obj).then(res => {
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.deepGetCurr(params.id, this.list, (value) => {
|
||||
value.name = params.name
|
||||
value.Rename = false
|
||||
})
|
||||
this.leftloading = false
|
||||
} else {
|
||||
this.leftloading = false
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error("请求失败了" + '-_-');
|
||||
this.leftloading = false
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
getlist() {
|
||||
this.contloading = true
|
||||
this.listRedact = false
|
||||
let params = {
|
||||
"isCommon": 1,
|
||||
"fieldTypeId": String(this.currid),
|
||||
"pageNo": 1
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
this.data = res
|
||||
this.contloading = false
|
||||
})
|
||||
|
||||
},
|
||||
clickpage(e) {
|
||||
this.currPage = e
|
||||
this.contloading = true
|
||||
let params = {
|
||||
"isCommon": 1,
|
||||
"fieldTypeId": String(this.currid),
|
||||
"pageNo": e
|
||||
}
|
||||
this.getData.getlist(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.data = res
|
||||
this.selection = []
|
||||
this.contloading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
using(id) {
|
||||
|
||||
let arr = this.selection.map((value) => {
|
||||
return value.id
|
||||
})
|
||||
if (arr.length < 1) {
|
||||
this.$message.error('未选择任何文件');
|
||||
return
|
||||
}
|
||||
let params = {
|
||||
status: id,
|
||||
ids: arr.join(','),
|
||||
fieldTypeId: this.currid
|
||||
}
|
||||
|
||||
this.getData.fieldusing(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.getlist()
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
}
|
||||
})
|
||||
},
|
||||
newFileSure() {
|
||||
this.leftloading = true
|
||||
let params = {
|
||||
parentId: this.currid,
|
||||
fieldType: this.tempNewF,
|
||||
type: this.getData.type
|
||||
}
|
||||
if(this.mixnewFileZindexVerify(this.list,this.currid)==6){
|
||||
this.$message.error('已达到最深层级')
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
|
||||
this.mixnewFileSure(params)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
45
h5-datax-manager/src/components/common/contNewFile.vue
Normal file
45
h5-datax-manager/src/components/common/contNewFile.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div class="cont_new_file">
|
||||
<div v-if="!newf" @click="newFile"><i class="el-icon-folder-add" @click="newFile" style="margin-right: 10px;"></i>新建文件夹</div>
|
||||
<div v-else style="padding: 5px;box-sizing:border-box;">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<i class="el-icon-folder-add" @click="newFile" style="margin-right: 10px;"></i>
|
||||
<el-input :value="value" @input="$emit('input',$event)" placeholder="请输入新文件夹名字,最长20个字符" size="small" @keyup.enter.native="newFileSure"></el-input>
|
||||
</div>
|
||||
<el-button style="margin-left: 60px;margin-top: 10px;" type="danger" icon="el-icon-close" circle size="mini"
|
||||
@click="newFileClose"></el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle size="mini" @click="newFileSure"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
props:{
|
||||
newf:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
value:{
|
||||
type:String,
|
||||
default:''
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
newFile(){
|
||||
this.$emit('newFile')
|
||||
},
|
||||
newFileSure(){
|
||||
this.$emit('newFileSure')
|
||||
},
|
||||
newFileClose(){
|
||||
this.$emit('input','')
|
||||
this.$emit('update:newf',false)
|
||||
// newf=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
903
h5-datax-manager/src/components/common/dataManageRedact.vue
Normal file
903
h5-datax-manager/src/components/common/dataManageRedact.vue
Normal file
@@ -0,0 +1,903 @@
|
||||
<style>
|
||||
.dataManageRedact {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.MR_checkbox {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.MR_scope {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.MR_scope>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.MR_scope>div>p {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.MR_derive {
|
||||
|
||||
margin: 0 40px 0 30px;
|
||||
|
||||
}
|
||||
|
||||
.MR_rule_home {
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.MR_rule_home::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
|
||||
.MR_toolbar {
|
||||
background-color: #F0F0F0;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
}
|
||||
|
||||
.MR_toolbar>p:hover {
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
|
||||
.codemirrirPs {
|
||||
padding: 5px;
|
||||
margin: 30px 0;
|
||||
background-color: #999;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.codemirrirPs>span:nth-of-type(1) {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="dataManageRedact" v-loading="loading">
|
||||
<div :class="smallHeader?'MR_header MR_headerSmall':'MR_header'">
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-arrow-left" circle @click="$emit('close')"></el-button>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="id===0">新增字段 :</span>
|
||||
<span v-else>编辑字段 :</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<el-button :icon="smallHeader?'el-icon-bottom':'el-icon-top'" circle @click="openHeader">
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-check" circle @click="submit"></el-button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div :class="smallHeader?'MR_input MR_inputSmall':'MR_input'">
|
||||
<div>
|
||||
<p>字段名称: </p>
|
||||
<el-input placeholder="请输入字段名" maxlength="30" v-model="fieldEn" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>字段中文名: </p>
|
||||
<el-input placeholder="请输入字段中文名" maxlength="20" v-model="fieldCn" clearable></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<p>值类型 : </p>
|
||||
<el-select v-model="valueType" placeholder="请选择">
|
||||
<el-option label="数值型" :value="1" v-if="ftype!=5" />
|
||||
<el-option label="字符型" :value="2" v-if="ftype!=5" />
|
||||
<!-- <el-option label="枚举型" :value="3" /> -->
|
||||
<!-- <el-option label="小数型" :value="4" /> -->
|
||||
<!-- <el-option label="数组型" :value="5" /> -->
|
||||
<el-option label="JSON型" :value="6" />
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div style="flex: 1;overflow: auto;">
|
||||
|
||||
<div v-show="isDerivative=='Derivative'" class="MR_derive">
|
||||
|
||||
<el-tabs v-model="activeName">
|
||||
<!-- <el-tab-pane label="条件区域" name="first">
|
||||
<div class="MR_rule_home">
|
||||
<rule :Data="ruledata" @faadd="faadd" @fadelect="fadelect" @sonadd="sonadd"
|
||||
@sondelect="sondelect" @change="change"></rule>
|
||||
</div>
|
||||
</el-tab-pane> -->
|
||||
<el-tab-pane label="公式编辑" name="second">
|
||||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="groovy脚本" name="third">
|
||||
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div v-show="activeName!=='first'">
|
||||
<teV2 v-model="formula" :hint="activeName=='second'">
|
||||
|
||||
</teV2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="Sourcelist">
|
||||
<div v-if="isDerivative=='SQL'" class="MR_derive">
|
||||
|
||||
<el-select v-model="SQLType" placeholder="请选择数据源类型" style="margin-top: 20px;width: 200px;"
|
||||
@change="SQLName = ''">
|
||||
<el-option v-for="item in SourcelistType" :key="item.type" :label="item.type"
|
||||
:value="item.type">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-select v-model="SQLName" placeholder="请选择数据源" style="margin-top: 20px;margin-left: 20px;">
|
||||
<el-option v-for="item in Sourcelist" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
<bindParam :Variable="sqlVariable" :dictVariable="dictVariable"></bindParam>
|
||||
|
||||
<div class="codemirrirPs">
|
||||
<span>
|
||||
{{sqlplaceholder[SQLType]&&sqlplaceholder[SQLType].placeholder}} 按Ctrl唤醒提示
|
||||
|
||||
|
||||
</span>
|
||||
<codemirror v-model="SQLItem" :MYname="sqlplaceholder[SQLType]&&sqlplaceholder[SQLType].mime"
|
||||
:mime="sqlplaceholder[SQLType]&&sqlplaceholder[SQLType].mime"></codemirror>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="ftype==4">
|
||||
<el-select v-model="interfaceId" placeholder="请选择接口" style="margin-top: 20px;margin-left: 20px;">
|
||||
<el-option v-for="item in interfaceList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-cascader style="margin-left: 20px;" placeholder="请选择接口下的字段" v-model="interfaceParseField"
|
||||
:key="keynum" :options="dataJson" :props="{ checkStrictly: true }" clearable></el-cascader>
|
||||
</div>
|
||||
<div v-if="valueType==6" class="MR_derive">
|
||||
<p style="margin-top: 20px;">JSON:</p>
|
||||
<!-- <el-input type="textarea" v-model="jsonValue" :rows="9" style="margin-top: 20px;"
|
||||
placeholder="请输入格式JSON">
|
||||
</el-input> -->
|
||||
<div class="codemirrirPs">
|
||||
<span>
|
||||
请输入 JSON 按住Ctrl键再按删除可以删掉固定语法
|
||||
</span>
|
||||
<codemirror v-model="jsonValue" MYname="json" mime="text/javascript" :autocomplete="false">
|
||||
</codemirror>
|
||||
<!-- <p style="background-color: #fff;padding: 5px;border-radius: 3px;"> -->
|
||||
<!-- <el-checkbox v-model="isStaticJsonValue" style="color: #fff;"></el-checkbox><span style="color: #fff;font-size: 12px;margin-left: 10px;">静态</span> -->
|
||||
<!-- </p> -->
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="ftype==6">
|
||||
<div v-if="codeKey" class="MR_derive">
|
||||
|
||||
<el-select v-model="MqType" placeholder="请选择类型" style="margin-top: 20px;width: 200px;"
|
||||
@change="MqId = ''">
|
||||
<el-option v-for="item in MqlistType" :key="item.type" :label="item.type"
|
||||
:value="item.type">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-select v-model="MqId" placeholder="请选择消息队列源" style="margin-top: 20px;margin-left: 20px;">
|
||||
<el-option v-for="item in Mqlist" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
|
||||
<!-- <bindParam :Variable="sqlVariable" :dictVariable="dictVariable"></bindParam> -->
|
||||
|
||||
<div class="codemirrirPs">
|
||||
<span>
|
||||
sql 按Ctrl唤醒提示
|
||||
|
||||
</span>
|
||||
<codemirror v-model="SQLItem" :MYname="'text/x-sql2'" :mime="'text/x-sql'"></codemirror>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import codemirror from '@/components/common/codemirror.vue'
|
||||
// import fieldUserTable from './fieldUserTable.vue'
|
||||
import bindParam from '@/components/common/bindParam.vue'
|
||||
import '@/assets/css/ManageRedact.css'
|
||||
import teV2 from '@/components/common/teV2.vue'
|
||||
import mangeRedactMixin from '@/utils/contminxin/MangeRedactMixin.js'
|
||||
// import {
|
||||
// getInterfaceList
|
||||
// } from '@/api/index.js'
|
||||
import rule from './rule.vue'
|
||||
export default {
|
||||
mixins: [mangeRedactMixin],
|
||||
components: {
|
||||
// getInterfaceList,
|
||||
// fieldUserTable,
|
||||
rule,
|
||||
teV2,
|
||||
bindParam,
|
||||
codemirror
|
||||
},
|
||||
props: {
|
||||
fieldTypeId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
setsave: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
getInfo: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
updata: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
ftype: {
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
codeKey:0, //方便code输入框重新渲染
|
||||
sqlVariable: [],
|
||||
interfaceParseField: [],
|
||||
keynum: 1,
|
||||
interfaceId: '',
|
||||
jsonValue: '',
|
||||
loading: false,
|
||||
SQLItem: '',
|
||||
SQLName: '',
|
||||
tempFormula: '',
|
||||
formula: '',
|
||||
fieldEn: '',
|
||||
fieldCn: '',
|
||||
valueType: '',
|
||||
SQLType: '',
|
||||
MqType: '',
|
||||
MqId: '',
|
||||
isDerivative: "",
|
||||
isOutput: false,
|
||||
activeName: 'second',
|
||||
isrecord: false, //开始记录
|
||||
text: '', //剪出的字符串
|
||||
tempIndex: null, //暂存index
|
||||
lest: "", //暂存末尾
|
||||
isshow: false,
|
||||
islest: true,
|
||||
isStaticJsonValue: 0, //json是否为静态的 0为否
|
||||
// interfaceList: [],
|
||||
ruledata: [{
|
||||
"fieldSubCond": [{
|
||||
"fieldId": '',
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"logical": ""
|
||||
}],
|
||||
"conditionValue": "",
|
||||
"fieldValue": ""
|
||||
}],
|
||||
dictVariable: [],
|
||||
sqlplaceholder: {
|
||||
MySQL: {
|
||||
placeholder: '请输入sql语句',
|
||||
mime: 'text/x-sql'
|
||||
},
|
||||
Redis: {
|
||||
placeholder: '请输入lua脚本',
|
||||
mime: 'text/x-lua'
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
this.$store.dispatch('getfielduser')
|
||||
if (this.id != 0) {
|
||||
this.loading = true
|
||||
this.getInfo(this.id, {}).then(res => {
|
||||
this.loading = false
|
||||
|
||||
if (res.status === "1") {
|
||||
this.jsonValue = JSON.stringify(JSON.parse(res.data.fieldVo.jsonValue), null, 4)
|
||||
|
||||
this.fieldCn = res.data.fieldVo.fieldCn
|
||||
// this.isStaticJsonValue = res.data.fieldVo.isStaticJsonValue
|
||||
|
||||
|
||||
|
||||
this.fieldEn = res.data.fieldVo.fieldEn
|
||||
this.valueType = res.data.fieldVo.valueType
|
||||
this.interfaceId = res.data.fieldVo.interfaceId
|
||||
this.interfaceParseField = res.data.fieldVo.interfaceParseField ? res.data.fieldVo
|
||||
.interfaceParseField.split('.') : ''
|
||||
this.fid = res.data.fieldVo.fieldTypeId
|
||||
this.isOutput = res.data.fieldVo.isOutput == 1 ? true : false
|
||||
|
||||
if (res.data.fieldVo.isDerivative) {
|
||||
this.isDerivative = 'Derivative'
|
||||
} else if (res.data.fieldVo.useSql) {
|
||||
this.isDerivative = 'SQL'
|
||||
this.SQLType = this.$store.state.Sourcelist.find(x => x.id == res.data.fieldVo
|
||||
.dataSourceId).type
|
||||
|
||||
this.SQLName = res.data.fieldVo.dataSourceId
|
||||
this.SQLItem = res.data.fieldVo.sqlStatement
|
||||
}
|
||||
if (res.data.hasFormula == "y" || res.data.hasGroovy == "y") {
|
||||
this.formula = JSON.parse(res.data.fieldVo.formula)[0].formula
|
||||
if (res.data.hasFormula == "y") {
|
||||
this.activeName = "second"
|
||||
}
|
||||
if (res.data.hasGroovy == "y") {
|
||||
this.activeName = "third"
|
||||
}
|
||||
} else if (res.data.fieldVo.fieldCondList.length > 0) {
|
||||
|
||||
this.ruledata = res.data.fieldVo.fieldCondList
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
if (res.data.fieldVo.sqlVariable == null) {
|
||||
this.sqlVariable = []
|
||||
} else {
|
||||
this.sqlVariable = JSON.parse(res.data.fieldVo.sqlVariable)
|
||||
}
|
||||
if (res.data.fieldVo.dictVariable == null) {
|
||||
this.dictVariable = []
|
||||
} else {
|
||||
this.dictVariable = JSON.parse(res.data.fieldVo.dictVariable)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(this.ftype ==6){
|
||||
this.MqType = this.$store.state.Mqlist.find(x => x.id == res.data.fieldVo
|
||||
.mqSourceId).type
|
||||
this.MqId = res.data.fieldVo.mqSourceId
|
||||
this.SQLItem = res.data.fieldVo.sqlStatement
|
||||
console.log(res.data.fieldVo.sqlStatement,this.SQLItem)
|
||||
}
|
||||
// console.log(res.data.fieldVo.fieldCondList)
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
this.isDerivative = 'SQL'
|
||||
console.log(1)
|
||||
} else if (this.ftype == 3) {
|
||||
this.isDerivative = 'Derivative'
|
||||
}
|
||||
this.codeKey = 1
|
||||
|
||||
})
|
||||
} else {
|
||||
if (this.ftype == 2) {
|
||||
this.isDerivative = 'SQL'
|
||||
} else if (this.ftype == 3) {
|
||||
this.isDerivative = 'Derivative'
|
||||
}
|
||||
this.codeKey = 1
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
computed: {
|
||||
interfaceList() {
|
||||
return this.$store.state.Interface
|
||||
},
|
||||
dataJson() {
|
||||
if (this.ftype != 4) {
|
||||
return {}
|
||||
}
|
||||
let obj = {}
|
||||
this.interfaceList.forEach(value => {
|
||||
if (value.id == this.interfaceId) {
|
||||
obj = JSON.parse(value.responseBody)
|
||||
}
|
||||
})
|
||||
|
||||
obj = this.deepGetLayout(obj)
|
||||
console.log(obj)
|
||||
return obj
|
||||
},
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser
|
||||
},
|
||||
SourcelistType() {
|
||||
let arr = []
|
||||
if (this.$store.state.Sourcelist) {
|
||||
this.$store.state.Sourcelist.forEach(value => {
|
||||
let sarr = arr.find(x => x.type == value.type)
|
||||
if (sarr) {
|
||||
sarr.data.push(value)
|
||||
} else {
|
||||
arr.push({
|
||||
type: value.type,
|
||||
data: [value]
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
console.log(arr)
|
||||
return arr
|
||||
},
|
||||
Sourcelist() {
|
||||
let arr = this.SourcelistType.find(x => x.type == this.SQLType)
|
||||
if (arr) {
|
||||
return arr.data
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
},
|
||||
MqlistType() {
|
||||
let arr = []
|
||||
if (this.$store.state.Mqlist) {
|
||||
this.$store.state.Mqlist.forEach(value => {
|
||||
let sarr = arr.find(x => x.type == value.type)
|
||||
if (sarr) {
|
||||
sarr.data.push(value)
|
||||
} else {
|
||||
arr.push({
|
||||
type: value.type,
|
||||
data: [value]
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
console.log(arr)
|
||||
return arr
|
||||
},
|
||||
Mqlist() {
|
||||
let arr = this.MqlistType.find(x => x.type == this.MqType)
|
||||
if (arr) {
|
||||
return arr.data
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
// if (e.key === 'Backspace') {
|
||||
// this.text = ""
|
||||
// }
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
|
||||
deepGetLayout(obj) {
|
||||
let sobj = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (typeof obj[key] == 'object' && !Array.isArray(obj[key]) && obj[key] != null) {
|
||||
sobj.push({
|
||||
label: key,
|
||||
value: key,
|
||||
children: this.deepGetLayout(obj[key])
|
||||
})
|
||||
|
||||
} else if (typeof obj[key] == 'object' && Array.isArray(obj[key]) && obj[key] != null) {
|
||||
sobj.push({
|
||||
label: key,
|
||||
value: key,
|
||||
children: [{
|
||||
label: '元素',
|
||||
value: '[]',
|
||||
children: this.deepGetLayout(obj[key][0])
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
sobj.push({
|
||||
label: key,
|
||||
value: key,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return sobj
|
||||
},
|
||||
submit() {
|
||||
let reg = /[\u4e00-\u9fa5]+/g;
|
||||
if (this.fieldEn.match(reg) != null) {
|
||||
this.$message.error('代码不允许出现中文');
|
||||
return
|
||||
}
|
||||
if (this.verificationCode(this.fieldEn) || this.verificationName(this.fieldCn)) {
|
||||
return
|
||||
}
|
||||
if (this.fieldEn.trim() == '' || this.fieldCn.trim() == '' || this.valueType == '') {
|
||||
this.$message.error('请填入所有字段,并检查空格');
|
||||
return
|
||||
}
|
||||
if (this.isDerivative == 'SQL' && (!this.SQLName || !this.SQLType)) {
|
||||
this.$message.error('请选择数据源');
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (this.ftype == 4 && (!this.interfaceId || this.interfaceParseField.length == 0)) {
|
||||
this.$message.error('请选择接口');
|
||||
return
|
||||
}
|
||||
if (this.ftype == 6 && (!this.MqType || !this.MqId)) {
|
||||
this.$message.error('请选择队列');
|
||||
return
|
||||
}
|
||||
|
||||
let is = {
|
||||
is: true,
|
||||
msg: '请填入页面中未填的部分'
|
||||
}
|
||||
if (this.isDerivative == "Derivative" && this.activeName == 'first') {
|
||||
this.ruledata.forEach(value => {
|
||||
if (value.conditionValue.length < 1) {
|
||||
is.is = false
|
||||
}
|
||||
value.fieldSubCond.forEach((item, inde) => {
|
||||
if (item.fieldId == "" || item.operator == "" || item.fieldValue.length < 1) {
|
||||
is.is = false
|
||||
}
|
||||
if (item.logical == "" && inde !== value.fieldSubCond.length - 1) {
|
||||
is.is = false
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
this.sqlVariable.forEach(value => {
|
||||
if (value.value.trim() === "" || value.key.trim() === "") {
|
||||
is.is = false
|
||||
}
|
||||
})
|
||||
|
||||
this.dictVariable.forEach(value => {
|
||||
if (value.key.trim() === "" || value.type === "" || value.value.trim() === "") {
|
||||
is.is = false
|
||||
}
|
||||
})
|
||||
|
||||
let arr = []
|
||||
arr.push(...this.sqlVariable.map(value => value.key))
|
||||
arr.push(...this.dictVariable.map(value => value.key))
|
||||
|
||||
if (arr.length != Array.from(new Set(arr)).length) {
|
||||
is.is = false
|
||||
is.msg = '不允许出现重复的变量'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (this.ftype == 4 && !this.interfaceId) {
|
||||
is.is = false
|
||||
}
|
||||
if (is.is === false) {
|
||||
this.$message.error(is.msg);
|
||||
return
|
||||
}
|
||||
|
||||
if (this.valueType == 6 && !this.isJSON(this.jsonValue)) {
|
||||
this.$message.error('请检查JSON格式');
|
||||
return
|
||||
}
|
||||
|
||||
let obj = {
|
||||
searchKey: '',
|
||||
fieldEn: this.fieldEn,
|
||||
fieldCn: this.fieldCn,
|
||||
valueType: this.valueType, //字段值类型
|
||||
isDerivative: this.isDerivative == "Derivative" ? 1 : 0, //是否衍生字段
|
||||
isOutput: this.isOutput ? 1 : 0, //是否输出字段
|
||||
// valueScope: this.valueScope, //字段约束范围
|
||||
fieldCondList: '',
|
||||
isStaticJsonValue: this.valueType == 6 ? this.isStaticJsonValue : 0,
|
||||
formulaHidden: '',
|
||||
isUseSql: this.isDerivative == "SQL" ? true : false, //是否使用sql
|
||||
dataSourceId: 0,
|
||||
sqlStatement: '', //sql语句
|
||||
sourceType: this.ftype,
|
||||
|
||||
}
|
||||
if (this.valueType == 6) {
|
||||
obj.jsonValue = this.jsonValue
|
||||
}
|
||||
if (this.ftype == 2) {
|
||||
if (this.sqlVariable.length == 0) {
|
||||
obj.sqlVariable = null
|
||||
} else {
|
||||
obj.sqlVariable = JSON.stringify(this.sqlVariable)
|
||||
}
|
||||
obj.dictVariable = JSON.stringify(this.dictVariable)
|
||||
}
|
||||
if (this.ftype == 4) {
|
||||
obj.isInterface = 1
|
||||
obj.interfaceId = this.interfaceId
|
||||
obj.interfaceParseField = this.interfaceParseField.join('.')
|
||||
} else {
|
||||
obj.isInterface = 0
|
||||
}
|
||||
// console.log(this.isDerivative)
|
||||
if (this.isDerivative == "Derivative") {
|
||||
if (this.activeName == "first") {
|
||||
obj.fieldCondList = JSON.stringify(this.ruledata)
|
||||
} else if (this.activeName == "second" || this.activeName == "third") {
|
||||
let tempArr = []
|
||||
let num = 0
|
||||
for (let i of this.formula) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 0 && num != 0) {
|
||||
this.formula.match(/@.*?@/g).forEach(value => {
|
||||
let tempObj = {
|
||||
fieldCN: value.substring(1, value.length - 1),
|
||||
fieldCond: ''
|
||||
}
|
||||
tempArr.push(tempObj)
|
||||
})
|
||||
}
|
||||
obj.formulaHidden = JSON.stringify([{
|
||||
fvalue: '',
|
||||
formula: this.formula.trim(),
|
||||
idx: '0',
|
||||
farr: tempArr,
|
||||
}])
|
||||
}
|
||||
|
||||
} else if (this.isDerivative == "SQL") {
|
||||
obj.dataSourceId = this.SQLName
|
||||
obj.sqlStatement = this.SQLItem
|
||||
|
||||
}
|
||||
if(this.ftype == 6){
|
||||
obj.mqSourceId = this.MqId
|
||||
obj.sqlStatement = this.SQLItem
|
||||
}
|
||||
|
||||
let isT = true;
|
||||
if (this.isDerivative == "SQL") {
|
||||
let sqlCheck = obj.sqlStatement.match(/(create|update|delete|truncate|alert|drop)\s+/im);
|
||||
if (sqlCheck != null) {
|
||||
isT = false;
|
||||
this.$message.error('存在有风险sql关键词:' + sqlCheck[0].toUpperCase());
|
||||
}
|
||||
}
|
||||
if (isT) {
|
||||
if (this.id == 0) {
|
||||
obj.fieldTypeId = this.fieldTypeId == 99999999 ? 0 : this.fieldTypeId,
|
||||
this.loading = true
|
||||
this.setsave(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
// this.$store.dispatch('reGetisOutput')
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
} else {
|
||||
obj.id = this.id
|
||||
obj.fieldTypeId = this.fid
|
||||
this.loading = true
|
||||
this.updata(obj).then(res => {
|
||||
this.loading = false
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('Ok')
|
||||
|
||||
// this.$store.dispatch('reGetisOutput')
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('网络出现问题-_-');
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
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;
|
||||
}
|
||||
}
|
||||
},
|
||||
change(index, inde) {
|
||||
this.ruledata[index].fieldSubCond[inde].operator = ""
|
||||
this.ruledata[index].fieldSubCond[inde].fieldValue = ""
|
||||
},
|
||||
sondelect(index, inde) {
|
||||
this.ruledata[index].fieldSubCond.splice(inde, 1)
|
||||
},
|
||||
sonadd(index, inde) {
|
||||
this.ruledata[index].fieldSubCond.splice(inde + 1, 0, {
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"logical": ""
|
||||
})
|
||||
},
|
||||
faadd(index) { //rule父节点添加
|
||||
this.ruledata.splice(index + 1, 0, {
|
||||
"conditionValue": "",
|
||||
"fieldSubCond": [{
|
||||
"fieldId": "",
|
||||
"operator": "",
|
||||
"fieldValue": "",
|
||||
"logical": "",
|
||||
|
||||
|
||||
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
fadelect(index) {
|
||||
this.ruledata.splice(index, 1)
|
||||
},
|
||||
textareaAdd(text) {
|
||||
if (text === "fx") {
|
||||
this.formula = "def main(_){\n\n}"
|
||||
} else {
|
||||
this.formula += text
|
||||
}
|
||||
},
|
||||
dbclick(e) {
|
||||
let T = ""
|
||||
T = this.formula.split("")
|
||||
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula = T.join("")
|
||||
this.isshow = false
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
jsonValue() {
|
||||
// console.log(this.jsonValue)
|
||||
},
|
||||
SQLItem() {
|
||||
// console.log(this.SQLItem)
|
||||
},
|
||||
interfaceId() {
|
||||
this.keynum++
|
||||
},
|
||||
formula() {
|
||||
let num = 0
|
||||
for (let i of this.formula) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula) {
|
||||
if (this.formula[i] !== this.tempFormula[i] && this.formula[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula.substring(parseInt(this.tempIndex) + 1, this.formula.length)
|
||||
this.islest = false
|
||||
}
|
||||
// console.log('字段:' + this.formula[i] + "暂存字段:" + this.tempFormula[i])
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula.substring(parseInt(this.tempIndex) + 1, this.formula.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.tempFormula = this.formula
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
80
h5-datax-manager/src/components/common/directives.js
Normal file
80
h5-datax-manager/src/components/common/directives.js
Normal file
@@ -0,0 +1,80 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// v-dialogDrag: 弹窗拖拽属性
|
||||
Vue.directive('dialogDrag', {
|
||||
bind(el, binding, vnode, oldVnode) {
|
||||
const dialogHeaderEl = el.querySelector('.el-dialog__header');
|
||||
const dragDom = el.querySelector('.el-dialog');
|
||||
|
||||
dialogHeaderEl.style.cssText += ';cursor:move;'
|
||||
dragDom.style.cssText += ';top:0px;'
|
||||
|
||||
// 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
|
||||
const sty = (() => {
|
||||
if (window.document.currentStyle) {
|
||||
return (dom, attr) => dom.currentStyle[attr];
|
||||
} else {
|
||||
return (dom, attr) => getComputedStyle(dom, false)[attr];
|
||||
}
|
||||
})()
|
||||
|
||||
dialogHeaderEl.onmousedown = (e) => {
|
||||
// 鼠标按下,计算当前元素距离可视区的距离
|
||||
const disX = e.clientX - dialogHeaderEl.offsetLeft;
|
||||
const disY = e.clientY - dialogHeaderEl.offsetTop;
|
||||
|
||||
const screenWidth = document.body.clientWidth; // body当前宽度
|
||||
const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取)
|
||||
|
||||
const dragDomWidth = dragDom.offsetWidth; // 对话框宽度
|
||||
const dragDomheight = dragDom.offsetHeight; // 对话框高度
|
||||
|
||||
const minDragDomLeft = dragDom.offsetLeft;
|
||||
const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth;
|
||||
|
||||
const minDragDomTop = dragDom.offsetTop;
|
||||
const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight;
|
||||
|
||||
|
||||
// 获取到的值带px 正则匹配替换
|
||||
let styL = sty(dragDom, 'left');
|
||||
let styT = sty(dragDom, 'top');
|
||||
|
||||
// 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
|
||||
if (styL.includes('%')) {
|
||||
styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100);
|
||||
styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100);
|
||||
} else {
|
||||
styL = +styL.replace(/\px/g, '');
|
||||
styT = +styT.replace(/\px/g, '');
|
||||
};
|
||||
|
||||
document.onmousemove = function (e) {
|
||||
// 通过事件委托,计算移动的距离
|
||||
let left = e.clientX - disX;
|
||||
let top = e.clientY - disY;
|
||||
|
||||
// 边界处理
|
||||
if (-(left) > minDragDomLeft) {
|
||||
left = -(minDragDomLeft);
|
||||
} else if (left > maxDragDomLeft) {
|
||||
left = maxDragDomLeft;
|
||||
}
|
||||
|
||||
if (-(top) > minDragDomTop) {
|
||||
top = -(minDragDomTop);
|
||||
} else if (top > maxDragDomTop) {
|
||||
top = maxDragDomTop;
|
||||
}
|
||||
|
||||
// 移动当前元素
|
||||
dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
|
||||
};
|
||||
|
||||
document.onmouseup = function (e) {
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
208
h5-datax-manager/src/components/common/fieldUserTable.vue
Normal file
208
h5-datax-manager/src/components/common/fieldUserTable.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<style>
|
||||
.fieldUserTable {
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
overflow: hidden;
|
||||
z-index: 9;
|
||||
border: 6px solid #9bcdff;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
.FUT_header {
|
||||
background-color: #3584d3;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 3px;
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
.FUT_table::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* Chrome Safari */
|
||||
}
|
||||
.FUT_table{
|
||||
height: 93%;
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
margin-top: 30px;
|
||||
|
||||
}
|
||||
.FUT_table>p {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.FUT_table>p:hover {
|
||||
color: #fff;
|
||||
background-color: #9bcdff;
|
||||
}
|
||||
#fieldUserTabletempcurr{
|
||||
background-color: #d9ebff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div v-show="show" class="fieldUserTable" @mousedown="mousedowm" ref="UserTable" :style="{top:this.tempTop+'px',left:this.tempLeft+'px'}">
|
||||
<div class="FUT_header" >
|
||||
<p>字段列表</p>
|
||||
<p><i class="el-icon-close" @click="$emit('close')"></i></p>
|
||||
</div>
|
||||
<div class="FUT_table" v-show="fieldUserRemind.length>0" id="FUT_table">
|
||||
<p v-for="(item,index) in fieldUserRemind" @dblclick="dbc(item.fieldCn)" :id="index==tempCurIndex?'fieldUserTabletempcurr':''">{{item.fieldCn?item.fieldCn:item.fieldEn}}</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
text: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
fieldUser: {
|
||||
type: Array||Boolean,
|
||||
default: false
|
||||
},
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tempCurIndex:0,
|
||||
tempTop:300,
|
||||
tempLeft:800,
|
||||
drag:false,
|
||||
tempClientX:0,
|
||||
tempClientY:0,
|
||||
tempOffsetLeft:0,
|
||||
tempOffsetTop:0,
|
||||
temptext:"",
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
beforeUnmount() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
window.onmousemove=(e)=>{
|
||||
if(this.drag){
|
||||
this.tempTop=e.clientY-(this.tempClientY-this.tempOffsetTop)
|
||||
this.tempLeft=e.clientX-(this.tempClientX-this.tempOffsetLeft)
|
||||
}
|
||||
},
|
||||
window.onmouseup=()=>{
|
||||
this.drag=false
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
computed: {
|
||||
fieldUserRemind() {
|
||||
if (this.show === true) {
|
||||
let arr = []
|
||||
|
||||
this.fieldUser.forEach(value => {
|
||||
|
||||
if (value.fieldCn.indexOf(this.text) !== -1) {
|
||||
arr.push({ ...value
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
return arr
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show(){
|
||||
// console.log(this.show)
|
||||
if(this.show){
|
||||
window.onkeydown=(e)=>{
|
||||
if(e.key=='ArrowUp'||e.key=='ArrowDown'){
|
||||
e.preventDefault()
|
||||
var tempcurrDom = document.getElementById('fieldUserTabletempcurr')
|
||||
var FUTTable = document.getElementById('FUT_table')
|
||||
if(e.key=='ArrowUp'&&this.tempCurIndex>0){
|
||||
this.tempCurIndex--
|
||||
}
|
||||
if(e.key=='ArrowDown'&&this.tempCurIndex<this.fieldUserRemind.length-1){
|
||||
this.tempCurIndex++
|
||||
}
|
||||
FUTTable.scrollTop = tempcurrDom.offsetTop-180
|
||||
}
|
||||
if(e.key=='Enter'){
|
||||
e.preventDefault()
|
||||
this.dbc(this.fieldUserRemind[this.tempCurIndex].fieldCn)
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
window.onkeydown=()=>{
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
text(){
|
||||
this.tempCurIndex = 0
|
||||
var FUTTable = document.getElementById('FUT_table')
|
||||
FUTTable.scrollTop =0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
mousedowm(e){
|
||||
this.tempClientX = e.clientX;
|
||||
this.tempClientY = e.clientY;
|
||||
this.tempOffsetLeft=this.$refs.UserTable.offsetLeft
|
||||
this.tempOffsetTop=this.$refs.UserTable.offsetTop
|
||||
|
||||
|
||||
|
||||
this.drag=true
|
||||
|
||||
},
|
||||
dbc(e){
|
||||
this.$emit('dbc',e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
139
h5-datax-manager/src/components/common/file.vue
Normal file
139
h5-datax-manager/src/components/common/file.vue
Normal file
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
|
||||
<div :style="{display:show?'block':'none',position:'relative'}">
|
||||
<div @click="opening()" :style="{marginLeft:(5+retract*10)+'px',display:show?'flex':'none'}" class="file_file" @contextmenu.prevent="opening();$emit('fileRight',{e:$event,item:item})">
|
||||
<p style="width: 16px;">
|
||||
<i :class="open?'el-icon-arrow-down':'el-icon-arrow-right'" :style="{display:iconshow?'inline':'none'}"></i>
|
||||
</p>
|
||||
<i :class="iconshow?open?'el-icon-folder-opened file_icon':'el-icon-folder file_icon':'el-icon-folder file_icon'"></i>
|
||||
<span class="file_name" v-show="Rename">
|
||||
<el-input v-model="inputValue" placeholder="回车键确认,esc取消" size="mini" ref="input" @keyup.enter="submit"></el-input>
|
||||
</span>
|
||||
<span class="file_name" v-show="!Rename">{{name}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from '@/components/common/bus.js'
|
||||
export default {
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
Rename: '',
|
||||
retract: '',
|
||||
open: '',
|
||||
show: '',
|
||||
|
||||
id: '',
|
||||
inputValue: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.input.$refs.input.onkeydown = (e) => {
|
||||
this.keyDown(e)
|
||||
}
|
||||
this.setItem(this.item)
|
||||
},
|
||||
methods: {
|
||||
setItem(e){
|
||||
this.name =e.name
|
||||
this.Rename=e.Rename
|
||||
this.retract=e.ZIndex
|
||||
this.open=e.open
|
||||
this.show=e.show
|
||||
this.id=e.id
|
||||
},
|
||||
keyDown(e) {
|
||||
// console.log(e)
|
||||
if (e.key === "Enter") {
|
||||
if (this.inputValue.length > 20) {
|
||||
this.$message({
|
||||
message: '最大长度20个字符',
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
let params = {
|
||||
name: this.inputValue.trim(),
|
||||
id: this.id
|
||||
}
|
||||
this.$emit("updatafilelist", params)
|
||||
|
||||
|
||||
}
|
||||
} else if (e.key === "Escape") {
|
||||
this.inputValue = ""
|
||||
this.$emit('RenameClose', this.id)
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
opening() {
|
||||
if (!this.Rename) {
|
||||
this.$emit('curr', this.id)
|
||||
}
|
||||
|
||||
},
|
||||
submit(e) {
|
||||
console.log(1)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
Rename() {
|
||||
if (this.Rename === true) {
|
||||
setTimeout(() => {
|
||||
this.$refs.input.focus()
|
||||
}, 10)
|
||||
}
|
||||
},
|
||||
item: {
|
||||
deep: true, //深度监听设置为 true
|
||||
handler: function(e) {
|
||||
this.setItem(e)
|
||||
}
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
iconshow(){
|
||||
return !!this.item.children.length
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.file_file {
|
||||
transition: all .3s;
|
||||
align-items: center;
|
||||
padding: 5px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.file_icon {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.file_name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
147
h5-datax-manager/src/components/common/fileHome.vue
Normal file
147
h5-datax-manager/src/components/common/fileHome.vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-for="item in data">
|
||||
<file :class="item.id===currid?'file_select':''" @curr="curr" :item="item"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
<div v-for="value in item.children">
|
||||
|
||||
<file :class="value.id===currid?'file_select':''" @curr="curr" :item="value"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
<div v-for="cont in value.children">
|
||||
|
||||
<file :class="cont.id===currid?'file_select':''" @curr="curr" :item="cont"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
<div v-for="cont1 in cont.children">
|
||||
|
||||
<file :class="cont1.id===currid?'file_select':''" @curr="curr" :item="cont1"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
<div v-for="cont2 in cont1.children">
|
||||
|
||||
<file :class="cont2.id===currid?'file_select':''" @curr="curr" :item="cont2"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
<div v-for="cont3 in cont2.children">
|
||||
|
||||
<file :class="cont3.id===currid?'file_select':''" @curr="curr" :item="cont3"
|
||||
@RenameClose="RenameClose" @updatafilelist="updatafilelist" @fileRight="fileRight"></file>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="fileHint" :style="{top:tempHintTop+'px',left:tempHintLeft+'px',display:tempHintTop&&tempHintLeft?'block':'none'}">
|
||||
<p>
|
||||
<el-button type="text" size="mini" @click="RenameFun">重命名</el-button>
|
||||
</p>
|
||||
<p>
|
||||
<el-button type="text" size="mini" @click="delectFun">删除</el-button>
|
||||
</p>
|
||||
<p>
|
||||
<el-button type="text" size="mini" @click="tempHintLeft=null;tempHintTop=null">取消</el-button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import file from './file.vue'
|
||||
export default {
|
||||
components: {
|
||||
file
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
tempHintTop : null,
|
||||
tempHintLeft :null,
|
||||
tempId:null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
currid:{
|
||||
type:Number,
|
||||
default : 99999999
|
||||
}
|
||||
},
|
||||
created() {
|
||||
setTimeout(() => {
|
||||
console.log(this.data)
|
||||
}, 1000)
|
||||
},
|
||||
methods: {
|
||||
curr(e) {
|
||||
this.tempHintLeft = null
|
||||
this.tempHintTop = null
|
||||
this.tempId = null
|
||||
this.$emit('curr',e)
|
||||
},
|
||||
RenameClose() {
|
||||
this.$emit('RenameClose',this.tempId )
|
||||
},
|
||||
updatafilelist(e) {
|
||||
this.$emit('updatafilelist',e)
|
||||
},
|
||||
fileRight(e){
|
||||
this.tempHintLeft = e.e.x
|
||||
this.tempHintTop = e.e.y
|
||||
this.tempId = e.item.id
|
||||
},
|
||||
RenameFun(){
|
||||
this.$emit('RenameFun',this.tempId )
|
||||
this.tempHintTop = null,
|
||||
this.tempHintLeft =null,
|
||||
this.tempId=null
|
||||
},
|
||||
delectFun(){
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit('delectFun',this.tempId )
|
||||
this.tempHintTop = null,
|
||||
this.tempHintLeft =null,
|
||||
this.tempId=null
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
this.tempHintTop = null
|
||||
this.tempHintLeft = null
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
109
h5-datax-manager/src/components/common/rule.vue
Normal file
109
h5-datax-manager/src/components/common/rule.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.rule_home {
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.rule_fa {
|
||||
display: flex;
|
||||
width: 20%;
|
||||
height: 30%;
|
||||
margin: 10px 10px 0 0;
|
||||
}
|
||||
|
||||
.rule_son {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="Data&&FieldUser">
|
||||
<div v-for="(item,index) in Data" class="rule_home">
|
||||
<div class="rule_fa">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('faadd',index)"></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('fadelect',index)" :disabled="index===0?'disabled':false" style="margin-right: 10px;"></el-button>
|
||||
<el-input v-model="item.conditionValue" style="width: 200px;" maxlength="20" placeholder="请输入内容"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<div v-for="(value,inde) in item.fieldSubCond" class="rule_son">
|
||||
<el-button icon="el-icon-plus" circle @click="$emit('sonadd',index,inde)" ></el-button>
|
||||
<el-button icon="el-icon-close" circle @click="$emit('sondelect',index,inde)" :disabled="inde===0?'disabled':false" style="margin-right: 10px;"></el-button>
|
||||
<el-select v-model="value.fieldId" placeholder="请选择" filterable style="width: 200px;" @change="$emit('change',index,inde)">
|
||||
<el-option v-for="cont in FieldUser.data.fieldList" :key="cont.id" :label="cont.fieldCn" :value="cont.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<ruleRelation v-model="value.operator" :value2.sync="value.fieldValue" :valueType="getvalueType(value.fieldId)" ></ruleRelation>
|
||||
<!-- <el-input v-model="value.fieldValue" maxlength="30" placeholder="请输入内容,最长30位" style="width: 300px;margin-left: 10px;" v-show="getvalueType(value.fieldId)!==3">
|
||||
</el-input>
|
||||
<el-select v-model="value.fieldValue" placeholder="请选择" style="width: 300px;margin-left: 10px;" v-show="getvalueType(value.fieldId)===3">
|
||||
<el-option label="是" value="1"></el-option>
|
||||
<el-option label="否" value="0"></el-option>
|
||||
</el-select> -->
|
||||
<el-select v-model="value.logical" placeholder="请选择" style="width: 100px;margin-left: 10px;" v-show="inde!==item.fieldSubCond.length-1">
|
||||
<el-option label="and" value="&&"></el-option>
|
||||
<el-option label="or" value="or"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ruleRelation from '@/components/common/ruleRelation.vue'
|
||||
export default {
|
||||
components:{
|
||||
ruleRelation
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.Data)
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser
|
||||
}
|
||||
},
|
||||
props: {
|
||||
Data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
getvalueType(cont){
|
||||
let num
|
||||
this.FieldUser.data.fieldList.forEach(value=>{
|
||||
if(value.id===cont){
|
||||
num = value.valueType
|
||||
}
|
||||
})
|
||||
return num
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
140
h5-datax-manager/src/components/common/ruleRelation.vue
Normal file
140
h5-datax-manager/src/components/common/ruleRelation.vue
Normal file
@@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<div style="display: inline;">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-select v-model="data" :size="size" :filterable="type==2?'filterable':false" placeholder="请选择"
|
||||
ref="select" style="width: 100px;margin-left: 10px;" @change="change" @blur="$emit('blur')">
|
||||
<el-option label="大于" value=">" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="大于等于" value=">=" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="等于" value="==" v-show="[5].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="小于" value="<" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="小于等于" value="<=" v-show="[2,3,5,6].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="不等于" value="!=" v-show="[5].indexOf(valueType)==-1"></el-option>
|
||||
<el-option label="包含" value="contains" v-show="[2,5,6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="不包含" value="not contains" v-show="[2,5,6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="为空" value="is empty" v-show="[6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="不为空" value="not empty" v-show="[6].indexOf(valueType)!=-1"></el-option>
|
||||
<el-option label="正则匹配" value="regex" v-show="[2].indexOf(valueType)!=-1"></el-option>
|
||||
</el-select>
|
||||
|
||||
<el-input :value="value2" @input="$emit('update:value2',$event)" maxlength="30" :size="size"
|
||||
placeholder="请输入内容,最长30位" style="width: 100px;margin-left: 10px;"
|
||||
v-if="!variableType&&openValue2&&valueType!==3&&['is empty','not empty'].indexOf(data)==-1">
|
||||
</el-input>
|
||||
<el-select :value="value2" @input="$emit('update:value2',$event)" placeholder="请选择" :size="size"
|
||||
style="width: 100px;margin-left: 10px;" v-if="!variableType&&openValue2&&valueType===3">
|
||||
<el-option label="是" value="="></el-option>
|
||||
<el-option label="否" value="!="></el-option>
|
||||
</el-select>
|
||||
<varialeSelect v-if="variableType" :valueType="valueType"
|
||||
:disabled="variableDisList" :variableType="variableType"
|
||||
@update:variableType="$emit('update:variableType',$event)" :value="value2"
|
||||
@input="$emit('update:value2',$event)" v-bind="$attrs" @CustomCallback="$emit('CustomCallback',$event)" style="margin-left: 10px;"></varialeSelect>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import varialeSelect from '@/components/models/varialeSelect.vue'
|
||||
export default {
|
||||
components: {
|
||||
varialeSelect
|
||||
},
|
||||
props: {
|
||||
openValue2: { //是否打开后半截输入框
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
value2: { //后半截输入框的Key
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
type: { //是否打开搜索
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
openSelect: { //是否自动打开下拉选择框
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
value: { //大于小于等信息
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
valueType: { //数字 或者字符串 或者 JSON
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
size: { //大小
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
variableType: { //是否打开 常量变量自定义 以及默认为哪个 0为不打开
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
variableDis: { //禁用常量变量自定义
|
||||
type: Array || null,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.data = this.value
|
||||
// console.log(this.$listeners)
|
||||
},
|
||||
methods: {
|
||||
change() {
|
||||
this.$emit('change')
|
||||
if (['is empty', 'not empty'].indexOf(this.data) == -1) {
|
||||
if (this.data == 'regex') {
|
||||
this.$emit('update:value2', '')
|
||||
} else {
|
||||
this.$emit('update:value2', '0')
|
||||
}
|
||||
}
|
||||
if (this.data == 'regex') { //如果选择正则匹配 则只能为变量
|
||||
this.$emit('update:variableType', 1)
|
||||
}
|
||||
|
||||
|
||||
this.$emit('input', this.data)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
variableDisList() {
|
||||
|
||||
let arr = []
|
||||
if (this.variableDis) {
|
||||
|
||||
arr.push(...this.variableDis)
|
||||
}
|
||||
if (this.data == 'regex') {
|
||||
arr.push(...[2, 3])
|
||||
}
|
||||
arr = Array.from(new Set(arr))
|
||||
return arr
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value() {
|
||||
this.data = this.value
|
||||
},
|
||||
openSelect() {
|
||||
if (this.openSelect) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.select.focus()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
372
h5-datax-manager/src/components/common/teV2.vue
Normal file
372
h5-datax-manager/src/components/common/teV2.vue
Normal file
@@ -0,0 +1,372 @@
|
||||
<style>
|
||||
.te_top {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: #aaa;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
}
|
||||
|
||||
.te_top>p {
|
||||
color: #eee;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.te_top>p:hover {
|
||||
color: #fff;
|
||||
cursor: pointer
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
|
||||
<p style="font-size:14px;margin-bottom: 5px;color: #aaa;">
|
||||
‘@’字符选择变量
|
||||
</p>
|
||||
<slot></slot>
|
||||
<div class="te_top" v-if="hint==true">
|
||||
<p @click="textareaAdd('+')">+</p>
|
||||
<p @click="textareaAdd('-')">-</p>
|
||||
<p @click="textareaAdd('*')">*</p>
|
||||
<p @click="textareaAdd('/')">/</p>
|
||||
<p @click="textareaAdd('sqrt(,)')">sqrt</p>
|
||||
<p @click="textareaAdd('In(,)')">In</p>
|
||||
<p @click="textareaAdd('avg(,)')">avg()</p>
|
||||
<p @click="textareaAdd('(,)')">()</p>
|
||||
<p @click="textareaAdd('abs(,)')">abs</p>
|
||||
<p @click="textareaAdd('max(,)')">max</p>
|
||||
<p @click="textareaAdd('min(,)')">min</p>
|
||||
<p @click="textareaAdd('lg(,)')">lg</p>
|
||||
<p @click="textareaAdd('exp(,)')">exp</p>
|
||||
<p @click="textareaAdd('ceil(,)')">ceil</p>
|
||||
<p @click="textareaAdd('floor(,)')">floor</p>
|
||||
</div>
|
||||
<el-input type="textarea" rows="9" placeholder="请输入内容" v-model="formula_show" ref="textarea"
|
||||
@input="$emit('input',formula_show)">
|
||||
</el-input>
|
||||
<fieldUserTable :text="text" :fieldUser="FieldUser" refs="t" @dbc="dbclick" :show="isshow"
|
||||
@close="isshow=false"></fieldUserTable>
|
||||
<!-- <el-dialog :title="'当前编辑'+nowCurr" :visible.sync="dialogVisible" width="30%" append-to-body>
|
||||
<el-button @click="delect">删除字段</el-button>
|
||||
</el-dialog> -->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import fieldUserTable from '@/components/common/fieldUserTable.vue'
|
||||
|
||||
// import bus from './SCO/bus.js'
|
||||
export default {
|
||||
components: {
|
||||
fieldUserTable
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
hint:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tempsection: [],
|
||||
sectionVisible: false, //区间编辑弹窗
|
||||
nowCurr: '',
|
||||
dialogVisible: false,
|
||||
isshow: false,
|
||||
text: '',
|
||||
tempIndex: '',
|
||||
lest: '',
|
||||
islest: false,
|
||||
tempFormula: '',
|
||||
formula_show: '',
|
||||
cursorfront: '',
|
||||
cursorlest: '',
|
||||
lastKeyDown: '',
|
||||
// fields: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.textarea.$refs.textarea.onkeydown = (e) => {
|
||||
|
||||
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
if (e.key == "Backspace" || e.key == "Delete") {
|
||||
this.lastKeyDown = e.key
|
||||
|
||||
if (e.key == "Backspace" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart - 1,
|
||||
this.$refs.textarea.$refs.textarea.selectionStart) == '@' && (this.isodd(this.formula_show,
|
||||
'@') == false)) {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Backspace")
|
||||
}
|
||||
if (e.key == "Delete" && this.formula_show.substring(this.$refs.textarea.$refs.textarea
|
||||
.selectionStart, this.$refs
|
||||
.textarea.$refs.textarea.selectionStart + 1) == '@') {
|
||||
e.preventDefault()
|
||||
this.countCurr()
|
||||
this.delect("Delete")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser.data.fieldList
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.formula_show = this.value
|
||||
|
||||
// console.log(this.formula_show, this.value)
|
||||
// bus.$on('getOk', (e) => {
|
||||
// this.formula_show = e.formula_show
|
||||
// this.tempFormula = e.formula_show
|
||||
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
setCaretPosition(ctrl, pos) { //设置光标位置函数
|
||||
if (ctrl.setSelectionRange) {
|
||||
ctrl.focus();
|
||||
this.$nextTick(() => {
|
||||
ctrl.setSelectionRange(pos, pos);
|
||||
})
|
||||
} else if (ctrl.createTextRange) {
|
||||
var range = ctrl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
},
|
||||
textareaAdd(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea
|
||||
.selectionStart)
|
||||
this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
if (e.split(',')[1]) {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + e.split(',')[1] + this.cursorlest
|
||||
} else {
|
||||
this.formula_show = this.cursorfront + e.split(',')[0] + this.cursorlest
|
||||
}
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront + e.split(',')[0])
|
||||
.length)
|
||||
},
|
||||
|
||||
// 获取 字符串中 有 多少个指定字符
|
||||
getTempIndex(string, str) {
|
||||
let temp = 0
|
||||
for (let num = 0;;) {
|
||||
|
||||
|
||||
if (string.indexOf(str, temp) != -1) {
|
||||
temp = string.indexOf(str, temp)
|
||||
temp++
|
||||
num++
|
||||
} else {
|
||||
return num
|
||||
}
|
||||
}
|
||||
// console.log(string, str)
|
||||
},
|
||||
getTempArreyIndex(array, str) {
|
||||
let num = 0
|
||||
array.forEach((value) => {
|
||||
if (value.field_name == "str") {
|
||||
num++
|
||||
}
|
||||
})
|
||||
return num
|
||||
|
||||
|
||||
},
|
||||
countCurr() {
|
||||
if ((this.isodd(this.cursorfront, '@') == true) && (this.isodd(this.cursorlest, '@') == true)) {} else if (
|
||||
this.lastKeyDown == "Backspace") {
|
||||
this.cursorfront = this.cursorfront.substring(0, this.cursorfront.length - 1)
|
||||
this.cursorlest = '@' + this.cursorlest
|
||||
|
||||
} else if (this.lastKeyDown == "Delete") {
|
||||
this.cursorfront = this.cursorfront + '@'
|
||||
this.cursorlest = this.cursorlest.substr(1);
|
||||
|
||||
}
|
||||
let str = this.cursorfront.substring(this.cursorfront.lastIndexOf('@')) + this.cursorlest
|
||||
.substring(0, this.cursorlest
|
||||
.indexOf('@') + 1)
|
||||
|
||||
this.nowCurr = str + '|' + this.getTempIndex(this.cursorfront, str)
|
||||
// console.log(this.nowCurr)
|
||||
|
||||
},
|
||||
delect(type) {
|
||||
let str = this.nowCurr.split('|')[0]
|
||||
let index = this.nowCurr.split('|')[1]
|
||||
|
||||
// this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// this.cursorlest = this.formula_show.substring(this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
|
||||
this.delectShow(str, parseInt(index))
|
||||
if(type=='Backspace'){
|
||||
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length-str.length+1))
|
||||
}else if(type=='Delete'){
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length-1))
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.cursorfront = ""
|
||||
this.cursorlest = ""
|
||||
this.nowCurr = ""
|
||||
this.lastKeyDown = ""
|
||||
|
||||
},
|
||||
|
||||
delectShow(str, index) { // 回显删除
|
||||
|
||||
this.formula_show = this.formula_show.substring(0, this.cursorfront.lastIndexOf('@')) + this
|
||||
.formula_show.substring(
|
||||
this.cursorfront.lastIndexOf('@') + str.length, )
|
||||
this.tempFormula = this.formula_show
|
||||
|
||||
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
dbclick(e) {
|
||||
this.cursorfront = this.formula_show.substring(0, this.$refs.textarea.$refs.textarea.selectionStart)
|
||||
// console.log(this.cursorfront)
|
||||
let T = ""
|
||||
T = this.formula_show.split("")
|
||||
T.splice(this.tempIndex, this.text.length + 1, '@' + e + '@')
|
||||
this.formula_show = T.join("")
|
||||
this.setCaretPosition(this.$refs.textarea.$refs.textarea, (this.cursorfront.length+e.length+1-this.text.length))
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
},
|
||||
deepClone(obj) {
|
||||
if (this.getType(obj) === 'Array') {
|
||||
var res = []
|
||||
} else if (this.getType(obj) === 'Object') {
|
||||
var res = {}
|
||||
} else {
|
||||
return obj
|
||||
}
|
||||
for (var i in obj) {
|
||||
res[i] = this.deepClone(obj[i])
|
||||
}
|
||||
return res
|
||||
},
|
||||
getType(obj) {
|
||||
var res = Object.prototype.toString.call(obj)
|
||||
//截取注意[] 符号,和空格
|
||||
return res.slice(8, -1) // 也可以res.length-1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
formula_show() {
|
||||
let num = 0
|
||||
|
||||
for (let i of this.formula_show) {
|
||||
if (i === "@") {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
this.isshow = true
|
||||
for (let i in this.formula_show) {
|
||||
if (this.formula_show[i] !== this.tempFormula[i] && this.formula_show[i] == "@") {
|
||||
|
||||
if (this.islest) {
|
||||
this.tempIndex = i
|
||||
|
||||
this.lest = this.formula_show.substring(parseInt(this.tempIndex) + 1, this
|
||||
.formula_show.length)
|
||||
this.islest = false
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let T = this.formula_show.substring(parseInt(this.tempIndex) + 1, this.formula_show.length)
|
||||
if (this.lest !== "") {
|
||||
// console.log(T)
|
||||
T = T.substring(0, T.indexOf(this.lest))
|
||||
|
||||
} else {
|
||||
T = T.substring(0, T.length)
|
||||
}
|
||||
|
||||
this.text = T
|
||||
if (this.text === "@") {
|
||||
this.text = ""
|
||||
}
|
||||
// console.log('lest:' + this.lest, 'index:' + this.tempIndex, "T:" + T)
|
||||
|
||||
} else {
|
||||
this.islest = true
|
||||
this.text = ""
|
||||
this.tempIndex = null
|
||||
this.isshow = false
|
||||
// console.log(1)
|
||||
}
|
||||
this.tempFormula = this.formula_show
|
||||
this.data.formula_show = this.formula_show
|
||||
this.$emit('input', this.formula_show)
|
||||
},
|
||||
fields: {
|
||||
handler: function() {
|
||||
this.data.fields = this.fields
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
value(value){
|
||||
console.log(value)
|
||||
this.formula_show = this.value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
229
h5-datax-manager/src/components/models/varialeSelect.vue
Normal file
229
h5-datax-manager/src/components/models/varialeSelect.vue
Normal file
@@ -0,0 +1,229 @@
|
||||
<template>
|
||||
<div class="variateSelect" :style="{width:width,height:height}">
|
||||
<div style="width: 35%;" class="variateSelectLeft" :style="{height:height}">
|
||||
<el-dropdown trigger="click" @command="em">
|
||||
<span class="el-dropdown-link" style="color: #fff;">
|
||||
{{variableType==1?"常量":variableType==2?"变量":variableType==3?"自定义":"错误"}}<i
|
||||
class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="1" :disabled="disabled.indexOf(1)!=-1">常量
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="2" :disabled="disabled.indexOf(2)!=-1">变量
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-caret-right" :command="3" :disabled="disabled.indexOf(3)!=-1">自定义
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- 常量 -->
|
||||
<el-input style="margin-left: -10%;width: 75%;" :value="value" :size="size" placeholder="请输入内容"
|
||||
v-if="variableType===1" @input="$emit('input',$event)"></el-input>
|
||||
|
||||
|
||||
<!-- 变量 -->
|
||||
<el-select style="margin-left: -10%;width: 75%;" :size="size" :value="value" filterable
|
||||
@change="$emit('input',$event)" v-else-if="variableType===2&&!variableCascader">
|
||||
<el-option v-for="item in MyFieldUser" :key="item.id" :label="item.fieldCn" :value="item.fieldEn">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<!-- 变量级联 -->
|
||||
|
||||
<el-cascader style="margin-left: -10%;width: 75%;" :value="value" :size="size" v-else-if="variableType===2&&variableCascader" filterable :options="FieldUserObj"
|
||||
:key="(value.random?value.random:0)" @visible-change="randomAdd(value,$event)" @change="$emit('input',$event)"
|
||||
:props="{ expandTrigger: 'hover' }" ></el-cascader>
|
||||
|
||||
<!-- 自定义按钮 -->
|
||||
<el-button plain @click="CustomClick" v-else-if="variableType===3"
|
||||
:style="{height:height}" class="varialeType3Button" :size="size">
|
||||
{{value==""||JSON.parse(value).formula===""?'请输入自定义内容':JSON.parse(value).formula}}</el-button>
|
||||
<!-- 自定义的弹框 -->
|
||||
<el-dialog title="自定义" v-if="dialogVisible" :visible.sync="dialogVisible" width="70%"
|
||||
:close-on-click-modal="false" append-to-body>
|
||||
<teV2 v-model="tempValue"></teV2>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible=false;tempValue=''">取 消</el-button>
|
||||
<el-button type="primary" @click="sectionSure" :disabled="type3Sure">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import teV2 from '@/components/common/teV2.vue'
|
||||
export default {
|
||||
components: {
|
||||
teV2
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tempValue: ''
|
||||
}
|
||||
},
|
||||
props: {
|
||||
size: {
|
||||
type: String,
|
||||
default: 'mini'
|
||||
},
|
||||
variableType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
value: {
|
||||
type: String|Array,
|
||||
default: ""
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '28px'
|
||||
},
|
||||
disabled: {
|
||||
type: Array,
|
||||
default(){
|
||||
return []
|
||||
}
|
||||
},
|
||||
valueType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
interceptCustom: { //是否拦截自定义点击
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
variableCascader:{
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
variableCascaderValue:{
|
||||
type: Array,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// console.log(this.variableType)
|
||||
if (!this.variableType) {
|
||||
this.$emit('update:variableType', 1)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
CustomClick() {
|
||||
if(this.interceptCustom){
|
||||
this.$emit('CustomCallback',this.value)
|
||||
return
|
||||
}
|
||||
this.tempValue = this.value === '' ? this.value : JSON.parse(this.value).formula;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
sectionSure(e) {
|
||||
let arr = String(this.tempValue).match(/@(.|\n)*?@/g) === null ? [] : this.tempValue.match(/@(.|\n)*?@/g);
|
||||
let is = false
|
||||
// console.log(arr,this.tempValue)
|
||||
arr = Array.from(new Set(arr))
|
||||
// console.log(arr)
|
||||
arr = arr.map(value => {
|
||||
console.log(value)
|
||||
value = value.split('')
|
||||
value.pop()
|
||||
value.shift()
|
||||
value = value.join('')
|
||||
if (this.mixinGetValueByCn(value)) {
|
||||
return this.mixinGetValueByCn(value)
|
||||
} else {
|
||||
is = true
|
||||
this.$message.error(`没有找到指标:${value}`);
|
||||
return this.mixinGetValueByCn(value)
|
||||
}
|
||||
|
||||
})
|
||||
// console.log(arr)
|
||||
// console.log(e)
|
||||
if (is) {
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
farr: arr,
|
||||
formula: this.tempValue.trim()
|
||||
}
|
||||
|
||||
|
||||
// console.log(this.tempValue)
|
||||
this.$emit('input', JSON.stringify(obj))
|
||||
this.dialogVisible = false
|
||||
},
|
||||
em(e) {
|
||||
this.$emit('update:variableType', e)
|
||||
this.$emit('input', "")
|
||||
},
|
||||
isodd(text, str) { // 判断某个字符串中 某个字符是否是奇数
|
||||
let num = 0
|
||||
for (let i of text) {
|
||||
if (i === str) {
|
||||
num++
|
||||
}
|
||||
}
|
||||
if (num % 2 === 1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
FieldUserObj(){
|
||||
|
||||
if(this.variableCascaderValue===undefined){
|
||||
|
||||
if(this.$store.state.FieldUserObj){
|
||||
return this.$store.state.FieldUserObj.data.fieldList
|
||||
}else{
|
||||
return []
|
||||
}
|
||||
}
|
||||
return this.variableCascaderValue
|
||||
|
||||
},
|
||||
MyFieldUser(e) {
|
||||
if (this.valueType) {
|
||||
return this.FieldUser.filter(x => x.valueType == this.valueType)
|
||||
} else {
|
||||
return this.FieldUser
|
||||
}
|
||||
},
|
||||
type3Sure() {
|
||||
return this.isodd(this.tempValue, '@')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.variateSelect {
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.variateSelectLeft {
|
||||
background-color: #ddd;
|
||||
border-radius: 5px;
|
||||
padding-right: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 6px;
|
||||
padding-right: 30px;
|
||||
justify-content: center;
|
||||
}
|
||||
.varialeType3Button{
|
||||
flex-shrink: 0;flex-grow: 1; margin-left: -10%;width: 75%;overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
56
h5-datax-manager/src/components/page/403.vue
Normal file
56
h5-datax-manager/src/components/page/403.vue
Normal 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>
|
||||
56
h5-datax-manager/src/components/page/404.vue
Normal file
56
h5-datax-manager/src/components/page/404.vue
Normal 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>
|
||||
420
h5-datax-manager/src/components/page/Dashboard.vue
Normal file
420
h5-datax-manager/src/components/page/Dashboard.vue
Normal 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>
|
||||
706
h5-datax-manager/src/components/page/DataSource.vue
Normal file
706
h5-datax-manager/src/components/page/DataSource.vue
Normal 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-home,app-name,master 不允许出现中文')
|
||||
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>
|
||||
119
h5-datax-manager/src/components/page/Datamanage.vue
Normal file
119
h5-datax-manager/src/components/page/Datamanage.vue
Normal 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>
|
||||
124
h5-datax-manager/src/components/page/DeriveManage.vue
Normal file
124
h5-datax-manager/src/components/page/DeriveManage.vue
Normal 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>
|
||||
247
h5-datax-manager/src/components/page/FieldStatistics.vue
Normal file
247
h5-datax-manager/src/components/page/FieldStatistics.vue
Normal 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>
|
||||
47
h5-datax-manager/src/components/page/I18n.vue
Normal file
47
h5-datax-manager/src/components/page/I18n.vue
Normal 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>
|
||||
225
h5-datax-manager/src/components/page/Icon.vue
Normal file
225
h5-datax-manager/src/components/page/Icon.vue
Normal 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><i class="el-icon-lx-redpacket_fill"></i></span>
|
||||
</p>
|
||||
<p class="example-p">
|
||||
<i class="el-icon-lx-weibo" style="font-size: 30px;color:#fd5656"></i>
|
||||
<span><i class="el-icon-lx-weibo"></i></span>
|
||||
</p>
|
||||
<p class="example-p">
|
||||
<i class="el-icon-lx-emojifill" style="font-size: 30px;color: #ffc300"></i>
|
||||
<span><i class="el-icon-lx-emojifill"></i></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>
|
||||
134
h5-datax-manager/src/components/page/Login.vue
Normal file
134
h5-datax-manager/src/components/page/Login.vue
Normal 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>
|
||||
300
h5-datax-manager/src/components/page/MqSource.vue
Normal file
300
h5-datax-manager/src/components/page/MqSource.vue
Normal 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>
|
||||
129
h5-datax-manager/src/components/page/SQLManage.vue
Normal file
129
h5-datax-manager/src/components/page/SQLManage.vue
Normal 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>
|
||||
6
h5-datax-manager/src/components/page/bus.js
Normal file
6
h5-datax-manager/src/components/page/bus.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// 使用 Event Bus
|
||||
const bus = new Vue();
|
||||
|
||||
export default bus;
|
||||
117
h5-datax-manager/src/components/page/portManage.vue
Normal file
117
h5-datax-manager/src/components/page/portManage.vue
Normal 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>
|
||||
730
h5-datax-manager/src/components/page/portSource.vue
Normal file
730
h5-datax-manager/src/components/page/portSource.vue
Normal 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>
|
||||
129
h5-datax-manager/src/components/page/realTimeManage.vue
Normal file
129
h5-datax-manager/src/components/page/realTimeManage.vue
Normal 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>
|
||||
13
h5-datax-manager/src/components/page/redirect/index.vue
Normal file
13
h5-datax-manager/src/components/page/redirect/index.vue
Normal 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>
|
||||
BIN
h5-datax-manager/src/components/page/start.png
Normal file
BIN
h5-datax-manager/src/components/page/start.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
121
h5-datax-manager/src/components/page/staticManage.vue
Normal file
121
h5-datax-manager/src/components/page/staticManage.vue
Normal 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>
|
||||
70
h5-datax-manager/src/components/upload/singleUpload.vue
Normal file
70
h5-datax-manager/src/components/upload/singleUpload.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-upload
|
||||
:headers="header"
|
||||
class="upload-demo"
|
||||
action="Riskmanage/models/uploadAndParseFile"
|
||||
:on-remove="handleRemove"
|
||||
:before-remove="beforeRemove"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="handleUploadSuccess"
|
||||
:file-list="fileList">
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传pmml模型文件,且不超过10MB</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'singleUpload',
|
||||
props: {
|
||||
fileList: Array
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
header:{
|
||||
token:localStorage.getItem('token')
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList);
|
||||
},
|
||||
beforeRemove(file, fileList) {
|
||||
return this.$confirm(`确定移除 ${ file.name }?`);
|
||||
},
|
||||
beforeUpload(file) {
|
||||
var fileType = file.name.substring(file.name.lastIndexOf('.') + 1);
|
||||
const extension = fileType === 'pmml';
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
if(!extension) {
|
||||
this.$message({
|
||||
message: '上传文件只能是pmml格式!',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
|
||||
if(!isLt10M) {
|
||||
this.$message({
|
||||
message: '上传文件大小不能超过 10MB!',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
return extension && isLt10M;
|
||||
},
|
||||
handleUploadSuccess(response, file, fileList) {
|
||||
console.log(file, fileList);
|
||||
this.$emit('getMessage', response.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
75
h5-datax-manager/src/main.js
Normal file
75
h5-datax-manager/src/main.js
Normal file
@@ -0,0 +1,75 @@
|
||||
import Vue from 'vue';
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
import ElementUI from 'element-ui';
|
||||
import 'element-ui/lib/theme-chalk/index.css'; // 默认主题
|
||||
import './assets/css/icon.css';
|
||||
import './components/common/directives';
|
||||
import 'babel-polyfill';
|
||||
|
||||
import store from './store'
|
||||
|
||||
import './styles/index.scss'; // global css
|
||||
import myMixin from '@/utils/mixin.js';
|
||||
|
||||
Vue.use(myMixin);
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Vue.use(ElementUI);
|
||||
|
||||
|
||||
|
||||
|
||||
Date.prototype.format = function(fmt) {
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, //月份
|
||||
"d+": this.getDate(), //日
|
||||
"h+": this.getHours(), //小时
|
||||
"m+": this.getMinutes(), //分
|
||||
"s+": this.getSeconds(), //秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
"S": this.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
}
|
||||
for (var k in o) {
|
||||
if (new RegExp("(" + k + ")").test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
}
|
||||
|
||||
Date.prototype.getTomorrow = function(num){
|
||||
let Time = new Date(this.getTime()+(Number(num)*86400000))
|
||||
Time.setHours(0)
|
||||
Time.setMinutes(0)
|
||||
Time.setSeconds(0)
|
||||
return Time
|
||||
}
|
||||
|
||||
|
||||
//使用钩子函数对路由进行权限跳转
|
||||
router.beforeEach((to, from, next) => {
|
||||
document.title = `${to.meta.title}`;
|
||||
const role = localStorage.getItem('token');
|
||||
if (!role && to.path !== '/login') {
|
||||
next('/login');
|
||||
} else {
|
||||
// 简单的判断IE10及以下不进入富文本编辑器,该组件不兼容
|
||||
if (navigator.userAgent.indexOf('MSIE') > -1 && to.path === '/editor') {
|
||||
Vue.prototype.$alert('vue-quill-editor组件不兼容IE10及以下浏览器,请使用更高版本的浏览器查看', '浏览器不兼容通知', {
|
||||
confirmButtonText: '确定'
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
}).$mount('#app');
|
||||
101
h5-datax-manager/src/router/index.js
Normal file
101
h5-datax-manager/src/router/index.js
Normal file
@@ -0,0 +1,101 @@
|
||||
import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
export default new Router({
|
||||
routes: [
|
||||
{
|
||||
path: '/redirect/:path(.*)',
|
||||
component: () => import('../components/page/redirect/index.vue'),
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/dashboard'
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
component: () => import('../components/page/Login.vue'),
|
||||
meta: { title: '登录' }
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('../components/common/Home.vue'),
|
||||
meta: { title: '自述文件' },
|
||||
children: [
|
||||
{
|
||||
path: '/dashboard',
|
||||
component: () => import('../components/page/Dashboard.vue'),
|
||||
meta: { title: '系统首页' }
|
||||
},
|
||||
{
|
||||
path: '/dataManage',
|
||||
component: () => import('../components/page/Datamanage.vue'),
|
||||
meta: { title: '基础指标' }
|
||||
},
|
||||
{
|
||||
path: '/staticManage',
|
||||
component: () => import('../components/page/staticManage.vue'),
|
||||
meta: { title: '常量指标' }
|
||||
},
|
||||
{
|
||||
path: '/SQLmanage',
|
||||
component: () => import('../components/page/SQLManage.vue'),
|
||||
meta: { title: '数据库指标' }
|
||||
},{
|
||||
path: '/realTimeManage',
|
||||
component: () => import('../components/page/realTimeManage.vue'),
|
||||
meta: { title: '实时指标' }
|
||||
},
|
||||
{
|
||||
path: '/derivemanage',
|
||||
component: () => import('../components/page/DeriveManage.vue'),
|
||||
meta: { title: '衍生指标' }
|
||||
},
|
||||
|
||||
{
|
||||
path: '/portManage',
|
||||
component: () => import('@/components/page/portManage.vue'),
|
||||
meta: {title: '接口指标'}
|
||||
},
|
||||
|
||||
{
|
||||
path: '/DataSource',
|
||||
component: () => import('@/components/page/DataSource.vue'),
|
||||
meta: {title: '数据库源'}
|
||||
},
|
||||
{
|
||||
path: '/portSource',
|
||||
component: () => import('@/components/page/portSource.vue'),
|
||||
meta: {title: '接口源'}
|
||||
},
|
||||
{
|
||||
path: '/MqSource',
|
||||
component: () => import('@/components/page/MqSource.vue'),
|
||||
meta: {title: '消息队列源'}
|
||||
},
|
||||
{
|
||||
path: '/FieldStatistics',
|
||||
component: () => import('@/components/page/FieldStatistics.vue'),
|
||||
meta: {title: '指标统计'}
|
||||
},
|
||||
|
||||
{
|
||||
path: '/404',
|
||||
component: () => import('../components/page/404.vue'),
|
||||
meta: { title: '404' }
|
||||
},
|
||||
{
|
||||
path: '/403',
|
||||
component: () => import('../components/page/403.vue'),
|
||||
meta: { title: '403' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '*',
|
||||
redirect: '/404'
|
||||
}
|
||||
]
|
||||
});
|
||||
194
h5-datax-manager/src/store/index.js
Normal file
194
h5-datax-manager/src/store/index.js
Normal file
@@ -0,0 +1,194 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
// import request from '../utils/request.js'
|
||||
import {
|
||||
GetdeepObj
|
||||
} from '@/utils/GetdeepObj.js'
|
||||
import {
|
||||
getFieldUser,
|
||||
getDataSourcelist, //获取数据库列表
|
||||
getInterfaceList,//获取接口
|
||||
getMqSourceList //获取消息队列
|
||||
} from '../api/index.js'
|
||||
Vue.use(Vuex)
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
barShrink: false,
|
||||
isFieldUser: true,
|
||||
FieldUser: null,
|
||||
FieldUserObj: null,
|
||||
Sourcelist: null,
|
||||
Interface:null,
|
||||
Mqlist:null,
|
||||
cacheList: {
|
||||
Interface: {
|
||||
allow: true,
|
||||
url: getInterfaceList,
|
||||
dataStr: 'klist',
|
||||
body: {
|
||||
pageNum: 0,
|
||||
pageSize: 0,
|
||||
}
|
||||
},
|
||||
Sourcelist: {
|
||||
allow: true,
|
||||
url: getDataSourcelist,
|
||||
dataStr: 'data',
|
||||
body: {
|
||||
pageNum: 0,
|
||||
pageSize: 0,
|
||||
}
|
||||
},
|
||||
Mqlist: {
|
||||
allow: true,
|
||||
url: getMqSourceList,
|
||||
dataStr: 'list',
|
||||
body: {
|
||||
pageNum: 0,
|
||||
pageSize: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
mutations: {
|
||||
setCache(state, res) {
|
||||
|
||||
state[res.str] = res.data
|
||||
},
|
||||
setbarShrink(state, res) {
|
||||
state.barShrink = res
|
||||
},
|
||||
setFieldUser(state, res) {
|
||||
// debugger
|
||||
state.FieldUser = res
|
||||
},
|
||||
setFieldUserObj(state, res) {
|
||||
state.FieldUserObj = res
|
||||
},
|
||||
getfielduserObj(state, res) {
|
||||
if (res.status !== '1') return
|
||||
res.data.fieldList = res.data.fieldList.map(value => {
|
||||
if (value.valueType === 6) {
|
||||
return {
|
||||
label: value.fieldCn,
|
||||
value: value.fieldEn,
|
||||
valueType: value.valueType,
|
||||
jsonValue: value.jsonValue,
|
||||
children: GetdeepObj(JSON.parse(value.jsonValue))
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
label: value.fieldCn,
|
||||
value: value.fieldEn,
|
||||
valueType: value.valueType,
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
state.FieldUserObj = res
|
||||
|
||||
localStorage.setItem("fielduserObj", JSON.stringify(res))
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
getcache(context, str) {
|
||||
|
||||
let obj = context.state.cacheList[str]
|
||||
|
||||
if (context.state[str] != null || !obj.allow) {
|
||||
return
|
||||
}
|
||||
obj.allow = false
|
||||
if (window.localStorage.getItem(str)) {
|
||||
if (JSON.parse(window.localStorage.getItem(str))) {
|
||||
|
||||
context.commit('setCache', {
|
||||
str: str,
|
||||
data: JSON.parse(window.localStorage.getItem(str))
|
||||
})
|
||||
}
|
||||
obj.allow = true
|
||||
return
|
||||
}
|
||||
|
||||
obj.url(obj.body).then(res => {
|
||||
if (res.status == 1) {
|
||||
|
||||
|
||||
context.commit('setCache', {
|
||||
str: str,
|
||||
data: res.data[obj.dataStr]
|
||||
})
|
||||
localStorage.setItem(str, JSON.stringify(res.data[obj.dataStr]))
|
||||
|
||||
}
|
||||
obj.allow = true
|
||||
})
|
||||
},
|
||||
regetcache(context, str) {
|
||||
context.commit('setCache', {
|
||||
str: str,
|
||||
data: null
|
||||
})
|
||||
localStorage.setItem(str, "")
|
||||
context.dispatch('getcache', str)
|
||||
},
|
||||
getfielduser(context) {
|
||||
if (context.state.FieldUser == null && context.state.isFieldUser) {
|
||||
context.state.isFieldUser = false
|
||||
let success = {
|
||||
fielduser: false,
|
||||
fielduserObj: false
|
||||
}
|
||||
|
||||
if (window.localStorage.getItem("fielduser")) {
|
||||
if (JSON.parse(window.localStorage.getItem("fielduser")).status == "1") {
|
||||
|
||||
context.commit('setFieldUser', JSON.parse(window.localStorage.getItem("fielduser")))
|
||||
success.fielduser = true
|
||||
}
|
||||
}
|
||||
if (window.localStorage.getItem("fielduserObj")) {
|
||||
if (JSON.parse(window.localStorage.getItem("fielduserObj")).status == "1") {
|
||||
context.commit('setFieldUserObj', JSON.parse(window.localStorage.getItem(
|
||||
"fielduserObj")))
|
||||
success.fielduserObj = true
|
||||
}
|
||||
}
|
||||
|
||||
if (success.fielduser && success.fielduserObj) {
|
||||
context.state.isFieldUser = true
|
||||
return
|
||||
}
|
||||
getFieldUser({}).then(res => {
|
||||
if (res.status == 1) {
|
||||
// debugger
|
||||
context.commit('setFieldUser', res)
|
||||
localStorage.setItem("fielduser", JSON.stringify(res))
|
||||
// debugger
|
||||
context.commit('getfielduserObj', JSON.parse(JSON.stringify(res)))
|
||||
}
|
||||
context.state.isFieldUser = true
|
||||
})
|
||||
}
|
||||
},
|
||||
reGetfielduser(context) {
|
||||
// debugger
|
||||
context.commit('setFieldUser', null)
|
||||
localStorage.setItem("fielduser", "")
|
||||
|
||||
localStorage.setItem("fielduserObj", "")
|
||||
context.dispatch('getfielduser')
|
||||
}
|
||||
},
|
||||
modules: {},
|
||||
getters: {
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
29
h5-datax-manager/src/styles/element-ui.scss
Normal file
29
h5-datax-manager/src/styles/element-ui.scss
Normal file
@@ -0,0 +1,29 @@
|
||||
//to reset element-ui default css
|
||||
.el-upload {
|
||||
input[type="file"] {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.el-upload__input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
//暂时性解决diolag 问题 https://github.com/ElemeFE/element/issues/2461
|
||||
.el-dialog {
|
||||
transform: none;
|
||||
left: 0;
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
//element ui upload
|
||||
.upload-container {
|
||||
.el-upload {
|
||||
width: 100%;
|
||||
.el-upload-dragger {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
}
|
||||
}
|
||||
}
|
||||
158
h5-datax-manager/src/styles/index.scss
Normal file
158
h5-datax-manager/src/styles/index.scss
Normal file
@@ -0,0 +1,158 @@
|
||||
@import './variables.scss';
|
||||
@import './mixin.scss';
|
||||
@import './transition.scss';
|
||||
@import './element-ui.scss';
|
||||
@import './sidebar.scss';
|
||||
|
||||
body {
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
|
||||
}
|
||||
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
div:focus{
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a:focus,
|
||||
a:active {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a,
|
||||
a:focus,
|
||||
a:hover {
|
||||
cursor: pointer;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.clearfix {
|
||||
&:after {
|
||||
visibility: hidden;
|
||||
display: block;
|
||||
font-size: 0;
|
||||
content: " ";
|
||||
clear: both;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
//main-container全局样式
|
||||
.app-main{
|
||||
min-height: 100%
|
||||
}
|
||||
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
//搜索栏样式
|
||||
.filter-container {
|
||||
|
||||
}
|
||||
|
||||
//操作栏样式
|
||||
.operate-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.operate-container .btn-add {
|
||||
float: right;
|
||||
}
|
||||
|
||||
//表格栏样式
|
||||
.table-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
//批量操作栏样式
|
||||
.batch-operate-container {
|
||||
display: inline-block;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
//分页栏样式
|
||||
.pagination-container {
|
||||
display: inline-block;
|
||||
float: right;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
//添加、更新表单样式
|
||||
.form-container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 720px;
|
||||
padding: 35px 35px 15px 35px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
//主标题
|
||||
.font-extra-large {
|
||||
font-size: 20px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
//标题
|
||||
.font-title-large {
|
||||
font-size: 18px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
//小标题
|
||||
.font-title-medium {
|
||||
font-size: 16px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
//正文
|
||||
.font-medium {
|
||||
font-size: 16px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
//正文
|
||||
.font-small {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
//正文(小)
|
||||
.font-extra-small {
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.color-main {
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.color-success {
|
||||
color: #67C23A;
|
||||
}
|
||||
|
||||
.color-warning {
|
||||
color: #E6A23C;
|
||||
}
|
||||
|
||||
.color-danger {
|
||||
color: #F56C6C;
|
||||
}
|
||||
|
||||
.color-info {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
27
h5-datax-manager/src/styles/mixin.scss
Normal file
27
h5-datax-manager/src/styles/mixin.scss
Normal file
@@ -0,0 +1,27 @@
|
||||
@mixin clearfix {
|
||||
&:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin scrollBar {
|
||||
&::-webkit-scrollbar-track-piece {
|
||||
background: #d3dce6;
|
||||
}
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #99a9bf;
|
||||
border-radius: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin relative {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
105
h5-datax-manager/src/styles/sidebar.scss
Normal file
105
h5-datax-manager/src/styles/sidebar.scss
Normal file
@@ -0,0 +1,105 @@
|
||||
#app {
|
||||
|
||||
// 主体区域
|
||||
.main-container {
|
||||
min-height: 100%;
|
||||
transition: margin-left .28s;
|
||||
margin-left: 180px;
|
||||
}
|
||||
|
||||
// 侧边栏
|
||||
.sidebar-container {
|
||||
.horizontal-collapse-transition {
|
||||
transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
|
||||
}
|
||||
transition: width .28s;
|
||||
width: 180px !important;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
font-size: 0px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1001;
|
||||
overflow: hidden;
|
||||
a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
.svg-icon {
|
||||
margin-right: 16px;
|
||||
}
|
||||
.el-menu {
|
||||
border: none;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.hideSidebar {
|
||||
.sidebar-container {
|
||||
width: 36px !important;
|
||||
}
|
||||
.main-container {
|
||||
margin-left: 36px;
|
||||
}
|
||||
.submenu-title-noDropdown {
|
||||
padding-left: 10px !important;
|
||||
position: relative;
|
||||
.el-tooltip {
|
||||
padding: 0 10px !important;
|
||||
}
|
||||
}
|
||||
.el-submenu {
|
||||
&>.el-submenu__title {
|
||||
padding-left: 10px !important;
|
||||
&>span {
|
||||
height: 0;
|
||||
width: 0;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
display: inline-block;
|
||||
}
|
||||
.el-submenu__icon-arrow {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-container .nest-menu .el-submenu>.el-submenu__title,
|
||||
.sidebar-container .el-submenu .el-menu-item {
|
||||
min-width: 180px !important;
|
||||
background-color: $subMenuBg !important;
|
||||
&:hover {
|
||||
background-color: $menuHover !important;
|
||||
}
|
||||
}
|
||||
.el-menu--collapse .el-menu .el-submenu {
|
||||
min-width: 180px !important;
|
||||
}
|
||||
|
||||
//适配移动端
|
||||
.mobile {
|
||||
.main-container {
|
||||
margin-left: 0px;
|
||||
}
|
||||
.sidebar-container {
|
||||
top: 50px;
|
||||
transition: transform .28s;
|
||||
width: 180px !important;
|
||||
}
|
||||
&.hideSidebar {
|
||||
.sidebar-container {
|
||||
transition-duration: 0.3s;
|
||||
transform: translate3d(-180px, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.withoutAnimation {
|
||||
.main-container,
|
||||
.sidebar-container {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
h5-datax-manager/src/styles/transition.scss
Normal file
32
h5-datax-manager/src/styles/transition.scss
Normal file
@@ -0,0 +1,32 @@
|
||||
//globl transition css
|
||||
|
||||
/*fade*/
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
transition: opacity 0.28s;
|
||||
}
|
||||
|
||||
.fade-enter,
|
||||
.fade-leave-active {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/*fade*/
|
||||
.breadcrumb-enter-active,
|
||||
.breadcrumb-leave-active {
|
||||
transition: all .5s;
|
||||
}
|
||||
|
||||
.breadcrumb-enter,
|
||||
.breadcrumb-leave-active {
|
||||
opacity: 0;
|
||||
transform: translateX(20px);
|
||||
}
|
||||
|
||||
.breadcrumb-move {
|
||||
transition: all .5s;
|
||||
}
|
||||
|
||||
.breadcrumb-leave-active {
|
||||
position: absolute;
|
||||
}
|
||||
4
h5-datax-manager/src/styles/variables.scss
Normal file
4
h5-datax-manager/src/styles/variables.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
//sidebar
|
||||
$menuBg:#304156;
|
||||
$subMenuBg:#1f2d3d;
|
||||
$menuHover:#001528;
|
||||
54
h5-datax-manager/src/utils/GetdeepObj.js
Normal file
54
h5-datax-manager/src/utils/GetdeepObj.js
Normal file
@@ -0,0 +1,54 @@
|
||||
export const GetdeepObj = (obj,length=true) =>{
|
||||
if (typeof obj == 'object' && !Array.isArray(obj)) {
|
||||
let arr = []
|
||||
for (let key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (Array.isArray(obj[key])) {
|
||||
let obj = {
|
||||
value: key,
|
||||
label: key,
|
||||
}
|
||||
if(length){
|
||||
obj.children=[{
|
||||
value: 'length()',
|
||||
label: '长度',
|
||||
valueType: 1,
|
||||
}]
|
||||
}else{
|
||||
obj.children=[]
|
||||
}
|
||||
|
||||
|
||||
arr.push(obj)
|
||||
} else if (typeof obj[key] == 'object' && obj[key] != null) {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
children:GetdeepObj(obj[key],length)
|
||||
})
|
||||
} else {
|
||||
arr.push({
|
||||
value: key,
|
||||
label: key,
|
||||
valueType: typeof obj[key] == 'string' ? 2 : 1,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return arr
|
||||
} else if (Array.isArray(obj)) {
|
||||
let obj
|
||||
if(length){
|
||||
obj=[{
|
||||
value: 'length()',
|
||||
label: '长度',
|
||||
valueType: 1,
|
||||
}]
|
||||
}else{
|
||||
obj=[]
|
||||
}
|
||||
|
||||
return obj
|
||||
}
|
||||
}
|
||||
20
h5-datax-manager/src/utils/contminxin/MangeRedactMixin.js
Normal file
20
h5-datax-manager/src/utils/contminxin/MangeRedactMixin.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import bus from '@/components/common/bus.js';
|
||||
export default {
|
||||
created(){
|
||||
bus.$emit('collapseHeader',true)
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
smallHeader:false
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
openHeader(){
|
||||
this.smallHeader = !this.smallHeader
|
||||
},
|
||||
mixinClose(){
|
||||
this.$emit('close')
|
||||
bus.$emit('collapseHeader',false)
|
||||
}
|
||||
}
|
||||
}
|
||||
385
h5-datax-manager/src/utils/contminxin/contmixin.js
Normal file
385
h5-datax-manager/src/utils/contminxin/contmixin.js
Normal file
@@ -0,0 +1,385 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
computed: {
|
||||
showRight() {
|
||||
if (this.currid) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
listunfold() {
|
||||
let arr = []
|
||||
|
||||
this.deepGetListunfold(this.list, arr)
|
||||
|
||||
console.log(arr)
|
||||
return arr
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
|
||||
deepGetListunfold(list, arr) {
|
||||
list.forEach(value => {
|
||||
arr.push(value)
|
||||
if (value.children.length > 0) {
|
||||
this.deepGetListunfold(value.children, arr)
|
||||
}
|
||||
})
|
||||
},
|
||||
mixnewFileZindexVerify(arr,id){
|
||||
let ZIndex = 1
|
||||
b(arr)
|
||||
function b(arr){
|
||||
console.log(arr)
|
||||
arr.forEach(value=>{
|
||||
if(value.id==id){
|
||||
ZIndex = value.ZIndex
|
||||
}
|
||||
if(value.children.length>0){
|
||||
b(value.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return ZIndex
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
mixnewFileSure(params) {
|
||||
let is = false
|
||||
let parentId = params.parentId
|
||||
let tempId = this.currid
|
||||
if (this.tempNewF.trim() == "") {
|
||||
this.$message.error('文件夹名不能为空');
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
|
||||
this.tempNewF = this.tempNewF.trim()
|
||||
this.deepGetCurr(parentId, this.list, (value) => {
|
||||
value.children.forEach(item => {
|
||||
if (item.name == params.name || item.name == params.fieldType) {
|
||||
is = true
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 验证重名
|
||||
|
||||
if (is) {
|
||||
this.$message.error('同一文件夹下不允许同名');
|
||||
this.leftloading = false
|
||||
return
|
||||
}
|
||||
|
||||
if (params.parentId == "99999999") {
|
||||
params.parentId = "0"
|
||||
}
|
||||
this.getData.addlist(params).then((res) => {
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.leftloading = false
|
||||
this.deepGetCurr(parentId, this.list, (value) => {
|
||||
value.children.push({
|
||||
ZIndex: value.ZIndex + 1,
|
||||
name: this.tempNewF,
|
||||
id: res.data.fieldTypeId || res.data.node.id,
|
||||
open: false,
|
||||
show: value.open,
|
||||
Rename: false,
|
||||
parentId: parentId,
|
||||
children: []
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
this.newf = false
|
||||
this.tempNewF = ""
|
||||
}).catch(() => {
|
||||
this.$message.error("请求失败了" + '-_-');
|
||||
this.leftloading = false
|
||||
})
|
||||
},
|
||||
using(id) {
|
||||
let arr = this.selection.map((value) => {
|
||||
return value.id
|
||||
})
|
||||
if (arr.length < 1) {
|
||||
this.$message.error('未选择任何文件');
|
||||
return
|
||||
}
|
||||
let params = {
|
||||
status: id,
|
||||
ids: arr.join(','),
|
||||
nameId: this.currid
|
||||
}
|
||||
|
||||
this.getData.fieldusing(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
});
|
||||
if (this.getData.type == 1 || this.getData.type == 2) {
|
||||
this.$store.dispatch('reGetRuleList')
|
||||
}
|
||||
this.getlist()
|
||||
this.selection = []
|
||||
}
|
||||
})
|
||||
},
|
||||
clickCurrid(id) {
|
||||
|
||||
this.currid = id
|
||||
this.currPage = 1
|
||||
|
||||
this.listRedact = false;
|
||||
this.tempRedactId = 0
|
||||
this.selection = []
|
||||
let tempIs = false
|
||||
this.list.forEach(value => {
|
||||
if (value.id === id && value.Rename) {
|
||||
tempIs = true
|
||||
}
|
||||
})
|
||||
if (!tempIs) {
|
||||
this.RenameFun()
|
||||
}
|
||||
this.getlist()
|
||||
this.deepGetCurr(id, this.list, deepSetCurr)
|
||||
|
||||
// 递归寻找文件夹
|
||||
|
||||
|
||||
// 打开关闭文件夹
|
||||
function deepSetCurr(obj) {
|
||||
if (obj.open) {
|
||||
// 关闭文件夹
|
||||
obj.open = false
|
||||
deepCloseFile(obj)
|
||||
} else {
|
||||
// 打开文件夹
|
||||
obj.open = true
|
||||
obj.children.forEach(value => {
|
||||
value.show = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function deepCloseFile(obj) {
|
||||
|
||||
if (obj.children.length > 0) {
|
||||
obj.children.forEach(value => {
|
||||
value.show = false
|
||||
deepCloseFile(value)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
deepGetCurr(id, item, fn, fn2) {
|
||||
item.forEach((value, index) => {
|
||||
if (value.id == id) {
|
||||
fn(value, item, index)
|
||||
} else {
|
||||
if (fn2) {
|
||||
fn2(value, item, index)
|
||||
}
|
||||
if (value.children.length > 0) {
|
||||
this.deepGetCurr(id, value.children, fn, fn2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
listTreeDeep(item, num) {
|
||||
let arr = item.map((value) => {
|
||||
return {
|
||||
id: value.id,
|
||||
parentId: value.parentId,
|
||||
name: value.name || value.fieldType,
|
||||
ZIndex: num,
|
||||
open: false,
|
||||
show: num === 1 ? true : false,
|
||||
Rename: false,
|
||||
children: this.listTreeDeep(value.children, num + 1)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
return arr
|
||||
},
|
||||
RenameFun(id) {
|
||||
this.deepGetCurr(id, this.list, (value) => {
|
||||
value.Rename = true
|
||||
}, (value) => {
|
||||
value.Rename = false
|
||||
})
|
||||
},
|
||||
newFile() {
|
||||
if (!this.currid) {
|
||||
this.$message({
|
||||
message: '请先选择左侧文件夹',
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
this.newf = true
|
||||
}
|
||||
},
|
||||
RenameClose() {
|
||||
this.deepGetCurr(0, this.list, () => {}, (value) => {
|
||||
value.Rename = false
|
||||
})
|
||||
},
|
||||
updatafilelist(params) {
|
||||
this.leftloading = true
|
||||
let tempNum = null
|
||||
|
||||
this.deepGetCurr(params.id, this.list, (value) => {
|
||||
tempNum = value.parentId
|
||||
})
|
||||
params.parentId = tempNum == 99999999 ? 0 : tempNum
|
||||
tempNum = null
|
||||
this.getData.updatalist(params).then(res => {
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.deepGetCurr(params.id, this.list, (value) => {
|
||||
value.name = params.name
|
||||
value.Rename = false
|
||||
})
|
||||
this.leftloading = false
|
||||
} else {
|
||||
this.leftloading = false
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error("请求失败了" + '-_-');
|
||||
this.leftloading = false
|
||||
})
|
||||
},
|
||||
delectFun(id) {
|
||||
let name
|
||||
let parentId
|
||||
this.deepGetCurr(id, this.list, (value) => {
|
||||
name = value.name
|
||||
parentId = value.parentId
|
||||
})
|
||||
let params = {
|
||||
status: "-1",
|
||||
id: id,
|
||||
name: name,
|
||||
"type": "1",
|
||||
"engineId": "",
|
||||
"parentId": parentId == 99999999 ? 0 : parentId
|
||||
}
|
||||
this.getData.updatalist(params).then(res => {
|
||||
if (res.status === "1") {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
|
||||
this.deepGetCurr(id, this.list, (value, item, index) => {
|
||||
item.splice(index, 1)
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
this.leftloading = false
|
||||
this.currid = 99999999
|
||||
this.getlist()
|
||||
|
||||
}).catch(() => {
|
||||
this.$message.error("请求失败了" + '-_-');
|
||||
this.leftloading = false
|
||||
})
|
||||
},
|
||||
dialogShow(id) {
|
||||
this.tempRedactId = id
|
||||
this.listRedact = true
|
||||
},
|
||||
select(selection) {
|
||||
this.selection = selection
|
||||
},
|
||||
selectAll(selection) {
|
||||
this.selection = selection
|
||||
},
|
||||
fileRight(e, item) {
|
||||
this.tempHintLeft = e.x
|
||||
this.tempHintTop = e.y
|
||||
this.tempId = item.id
|
||||
},
|
||||
beforeUpload(file) {
|
||||
console.log(file, '文件');
|
||||
this.files = file;
|
||||
const extension = file.name.split('.')[1] === 'xls'
|
||||
const extension2 = file.name.split('.')[1] === 'xlsx'
|
||||
const isLt2M = file.size / 1024 / 1024 < 5
|
||||
if (!extension && !extension2) {
|
||||
this.$message.warning('上传模板只能是 xls、xlsx格式!')
|
||||
return
|
||||
}
|
||||
if (!isLt2M) {
|
||||
this.$message.warning('上传模板大小不能超过 5MB!')
|
||||
return
|
||||
}
|
||||
this.fileName = file.name;
|
||||
return false // 返回false不会自动上传
|
||||
},
|
||||
submitUpload() {
|
||||
this.Uploadloading = true
|
||||
console.log('上传' + this.files.name)
|
||||
if (this.fileName == "") {
|
||||
this.$message.warning('请选择要上传的文件!')
|
||||
this.Uploadloading = false
|
||||
return false
|
||||
}
|
||||
let fileFormData = new FormData();
|
||||
fileFormData.append('file', this.files); //filename是键,file是值,就是要传的文件,test.zip是要传的文件名
|
||||
this.getData.fieldsubmit(fileFormData).then(res => {
|
||||
if (res.status === "1") {
|
||||
|
||||
|
||||
|
||||
this.callbackresult = res.data
|
||||
this.upCallbackShow = true
|
||||
this.upShowClose()
|
||||
this.getlist()
|
||||
// this.$store.dispatch('reGetRuleList')
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
}
|
||||
this.Uploadloading = false
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
upShowClose() {
|
||||
this.upShow = false
|
||||
}
|
||||
}
|
||||
}
|
||||
1
h5-datax-manager/src/utils/iframeurl.js
Normal file
1
h5-datax-manager/src/utils/iframeurl.js
Normal file
@@ -0,0 +1 @@
|
||||
export const iframeurl = window.location.protocol+'//'+window.location.host;
|
||||
43
h5-datax-manager/src/utils/link.js
Normal file
43
h5-datax-manager/src/utils/link.js
Normal file
@@ -0,0 +1,43 @@
|
||||
export default {
|
||||
e: [{
|
||||
title: '数据中心',
|
||||
'http://ex.fibo.cn/': 'http://dx.fibo.cn',
|
||||
'http://ex.demo.fibo.cn/': 'http://dx.demo.fibo.cn',
|
||||
'http://47.102.125.25/': 'http://47.102.125.25:81'
|
||||
},
|
||||
{
|
||||
title: '权限系统',
|
||||
'http://ex.fibo.cn/': 'http://ax.fibo.cn',
|
||||
'http://ex.demo.fibo.cn/': 'http://ax.demo.fibo.cn',
|
||||
'http://47.102.125.25/': 'http://47.102.125.25:82'
|
||||
},
|
||||
],
|
||||
|
||||
d: [{
|
||||
title: '决策平台',
|
||||
'http://dx.fibo.cn/': 'http://ex.fibo.cn',
|
||||
'http://dx.demo.fibo.cn/': 'http://ex.demo.fibo.cn',
|
||||
'http://47.102.125.25:81/': 'http://47.102.125.25'
|
||||
},
|
||||
{
|
||||
title: '权限系统',
|
||||
'http://dx.fibo.cn/': 'http://ax.fibo.cn',
|
||||
'http://dx.demo.fibo.cn/': 'http://ax.demo.fibo.cn',
|
||||
'http://47.102.125.25:81/': 'http://47.102.125.25:82'
|
||||
},
|
||||
],
|
||||
|
||||
a: [{
|
||||
title: '决策平台',
|
||||
'http://ax.fibo.cn/': 'http://ex.fibo.cn',
|
||||
'http://ax.demo.fibo.cn/': 'http://ex.demo.fibo.cn',
|
||||
'http://47.102.125.25:82/': 'http://47.102.125.25'
|
||||
},{
|
||||
title: '数据中心',
|
||||
'http://ax.fibo.cn/': 'http://dx.fibo.cn',
|
||||
'http://ax.demo.fibo.cn/': 'http://dx.demo.fibo.cn',
|
||||
'http://47.102.125.25:82/': 'http://47.102.125.25:81'
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
273
h5-datax-manager/src/utils/mixin.js
Normal file
273
h5-datax-manager/src/utils/mixin.js
Normal file
@@ -0,0 +1,273 @@
|
||||
export default {
|
||||
install(Vue) {
|
||||
Vue.mixin({
|
||||
data() {
|
||||
return {
|
||||
mixinlogical: [{
|
||||
value: '&&',
|
||||
label: 'AND'
|
||||
},{
|
||||
value: '||',
|
||||
label: 'OR'
|
||||
}]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
computed: {
|
||||
FieldUserObj() {
|
||||
return this.$store.state.FieldUserObj ? this.$store.state.FieldUserObj.data.fieldList : []
|
||||
},
|
||||
FieldUser() {
|
||||
return this.$store.state.FieldUser ? this.$store.state.FieldUser.data.fieldList : []
|
||||
},
|
||||
Sourcelist() {
|
||||
return this.$store.state.Sourcelist ? this.$store.state.Sourcelist:[]
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
isJSON(str) {
|
||||
if (typeof str == 'string') {
|
||||
try {
|
||||
var obj = JSON.parse(str);
|
||||
if (typeof obj == 'object' && obj) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
randomAdd(item,is) {
|
||||
if(is||!item){
|
||||
return
|
||||
}
|
||||
if (item.random) {
|
||||
setTimeout(() => {
|
||||
item.random++
|
||||
}, 200)
|
||||
} else {
|
||||
// item.random=1
|
||||
setTimeout(() => {
|
||||
this.$set(item, 'random', 1)
|
||||
}, 200)
|
||||
}
|
||||
},
|
||||
verificationCode(str){
|
||||
let z = /^(?!_)(?!.*?_$)[a-zA-Z0-9_]+$/
|
||||
if(!z.test(str)){
|
||||
this.$message.error('Code只允许使用 字母 数字 下划线 且不能以下划线开头')
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
verificationName(str){
|
||||
let z = /^(?!_)(?!.*?_$)[a-zA-Z0-9_\u4e00-\u9fa5]+$/
|
||||
if(!z.test(str)){
|
||||
this.$message.error('名称只允许使用 中文 字母 数字 下划线 且不能以下划线开头')
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
mixinSaveJSON(data, filename){
|
||||
if(!data) {
|
||||
this.$message.error('保存的数据为空');
|
||||
return;
|
||||
}
|
||||
if(!filename)
|
||||
filename = 'json.json'
|
||||
if(typeof data === 'object'){
|
||||
data = JSON.stringify(data, undefined, 4)
|
||||
}
|
||||
var blob = new Blob([data], {type: 'text/json'}),
|
||||
e = document.createEvent('MouseEvents'),
|
||||
a = document.createElement('a')
|
||||
a.download = filename
|
||||
a.href = window.URL.createObjectURL(blob)
|
||||
a.dataset.downloadurl = ['text/json', a.download, a.href].join(':')
|
||||
e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
|
||||
a.dispatchEvent(e)
|
||||
},
|
||||
mixinGetValueTypeByJSONEn(e){
|
||||
if(!e||e.length==0) return
|
||||
if(!Array.isArray(e)) e=e.split('.')
|
||||
let obj =this.FieldUserObj
|
||||
e.forEach((value,index)=>{
|
||||
if(index) obj = obj['children']
|
||||
obj = obj.find(x=>x.value==value)
|
||||
})
|
||||
return obj.valueType
|
||||
|
||||
},
|
||||
mixinGetValueByCn(e) {
|
||||
let num = this.FieldUser.find(x=>x.fieldCn===e)
|
||||
// this.FieldUser.forEach(value => {
|
||||
// if (value.fieldCn === e) {
|
||||
// num = value
|
||||
// }
|
||||
// })
|
||||
return num
|
||||
},
|
||||
mixinReGetStorage(){
|
||||
this.$store.dispatch('reGetfielduser')
|
||||
// this.$store.dispatch('reGetRuleList')
|
||||
|
||||
Object.keys(this.$store.state.cacheList).forEach(value=>{
|
||||
this.$store.dispatch('regetcache', value)
|
||||
})
|
||||
|
||||
},
|
||||
mixinGetLogical(str){
|
||||
let num = this.mixinlogical.find(x=>x.value===str)
|
||||
// this.mixinlogical.forEach(value=>{
|
||||
// if(str==value.value){
|
||||
// num = value.label
|
||||
// }
|
||||
// })
|
||||
return num&&num.label
|
||||
|
||||
},
|
||||
mixinGetValueById(e) {
|
||||
let num =this.FieldUser.find(x=>x.id===e)
|
||||
// this.FieldUser.forEach(value => {
|
||||
// if (value.id === e) {
|
||||
// num = value
|
||||
// }
|
||||
// })
|
||||
return num
|
||||
},
|
||||
mixinGetCnByEn(e) {
|
||||
let num =this.FieldUser.find(x=>x.fieldEn===e)
|
||||
// this.FieldUser.forEach(value => {
|
||||
// if (value.fieldEn === e) {
|
||||
// num = value.fieldCn
|
||||
// }
|
||||
// })
|
||||
return num&&num.fieldCn
|
||||
},
|
||||
mixinGetIdByEn(e) {
|
||||
let num =this.FieldUser.find(x=>x.fieldEn===e)
|
||||
// this.FieldUser.forEach(value => {
|
||||
// if (value.fieldEn === e) {
|
||||
// num = value.id
|
||||
// }
|
||||
// })
|
||||
return num&&num.id
|
||||
},
|
||||
mixinGetValueTypeByEn(e) {
|
||||
let num =this.FieldUser.find(x=>x.fieldEn===e)
|
||||
// this.FieldUser.forEach(value => {
|
||||
// if (value.fieldEn === e) {
|
||||
// num = value.valueType
|
||||
// }
|
||||
// })
|
||||
return num&&num.valueType
|
||||
},
|
||||
mixinGetFieldByEn(e) {
|
||||
let num =this.FieldUser.find(x=>x.fieldEn=== e)
|
||||
// this.FieldUser.forEach(value => {
|
||||
// if (value.fieldEn === e) {
|
||||
// num = value
|
||||
// }
|
||||
// })
|
||||
return num
|
||||
},
|
||||
mixinMoveChange(e) {
|
||||
|
||||
let arr = this.selection.map((value) => {
|
||||
return value.id
|
||||
})
|
||||
if (arr.length < 1) {
|
||||
this.$message.error('未选择任何文件');
|
||||
return
|
||||
}
|
||||
let params = {
|
||||
ids: arr,
|
||||
folderId: e
|
||||
}
|
||||
this.getData.updateParent(params).then(res => {
|
||||
if (res.status == "1") {
|
||||
this.clickCurrid(this.currid)
|
||||
this.$message({
|
||||
message: '移动成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.selection = []
|
||||
}
|
||||
})
|
||||
|
||||
this.tempMove = ""
|
||||
},
|
||||
mixinDeepCopy() {
|
||||
let result;
|
||||
if (typeof target === 'object') {
|
||||
if (Array.isArray(target)) {
|
||||
result = [];
|
||||
for (let i in target) {
|
||||
result.push(this.mixinDeepCopy(target[i]))
|
||||
}
|
||||
} else if (target === null) {
|
||||
result = null;
|
||||
} else if (target.constructor === RegExp) {
|
||||
result = target;
|
||||
} else {
|
||||
result = {};
|
||||
for (let i in target) {
|
||||
result[i] = this.mixinDeepCopy(target[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = target;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
mixinGetvalueType(cont) {
|
||||
let num = this.FieldUser.find(x=>x.id===parseInt(cont))
|
||||
|
||||
|
||||
// this.FieldUser.forEach(value => {
|
||||
// if (value.id === parseInt(cont)) {
|
||||
// num = value.valueType
|
||||
// }
|
||||
// })
|
||||
|
||||
return num&&num.valueType
|
||||
},
|
||||
mixinGetvalueEn(cont) {
|
||||
let num = this.FieldUser.find(x=>x.id===parseInt(cont))
|
||||
// this.FieldUser.forEach(value => {
|
||||
// if (value.id === parseInt(cont)) {
|
||||
// num = value.fieldEn
|
||||
// }
|
||||
// })
|
||||
return num&&num.fieldEn
|
||||
},
|
||||
mixinGetvalueCn(cont) {
|
||||
let num = this.FieldUser.find(x=>x.id===parseInt(cont))
|
||||
// this.FieldUser.forEach(value => {
|
||||
// if (value.id === parseInt(cont)) {
|
||||
// num = value.fieldCn
|
||||
// }
|
||||
// })
|
||||
if(!num&&cont!==""&&cont!==null){
|
||||
console.log(num,cont)
|
||||
num="(此字段丢失)"
|
||||
}
|
||||
return num&&num.fieldCn
|
||||
},
|
||||
mixinGetvalueCode(cont) {
|
||||
let num = this.FieldUser.find(x=>x.id===parseInt(cont))
|
||||
|
||||
return num &&num.fieldCode
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
270
h5-datax-manager/src/utils/mock.js
Normal file
270
h5-datax-manager/src/utils/mock.js
Normal file
@@ -0,0 +1,270 @@
|
||||
var Mock = require('mockjs')
|
||||
|
||||
|
||||
// Mock.mock("/Riskmanage/datasource/save", {
|
||||
// "status": "1",
|
||||
// data: {
|
||||
|
||||
// }
|
||||
// })
|
||||
Mock.mock("/Riskmanage/v3/qvshi2", {
|
||||
"status": "1",
|
||||
data: {
|
||||
dycs: [{
|
||||
dycslabel: '0609',
|
||||
'dycsvalue|10-100': 1
|
||||
},{
|
||||
dycslabel: '0608',
|
||||
'dycsvalue|10-100': 1
|
||||
},{
|
||||
dycslabel: '0607',
|
||||
'dycsvalue|10-100': 1
|
||||
},{
|
||||
dycslabel: '0606',
|
||||
'dycsvalue|10-100': 1
|
||||
},{
|
||||
dycslabel: '0605',
|
||||
'dycsvalue|10-100': 1
|
||||
}],
|
||||
'jcjg':[{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
},{
|
||||
'jcjglabel':Mock.mock('@cname()'),
|
||||
'jcjgvalue|20-39':1
|
||||
}],
|
||||
gzmz:{
|
||||
gzmztime:['0603','0604','0605','0606','0607','0608','0609'],
|
||||
gzmzdata:[
|
||||
{
|
||||
gzmzlabel:'规则1',
|
||||
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
|
||||
},
|
||||
{
|
||||
gzmzlabel:Mock.mock('@cname()'),
|
||||
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
|
||||
},
|
||||
{
|
||||
gzmzlabel:Mock.mock('@cname()'),
|
||||
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
|
||||
},
|
||||
{
|
||||
gzmzlabel:Mock.mock('@cname()'),
|
||||
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
|
||||
},
|
||||
{
|
||||
gzmzlabel:Mock.mock('@cname()'),
|
||||
gzmzvalue:[parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70),parseInt(Math.random()*70)]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Mock.mock("/Riskmanage/v3/qvshi1", {
|
||||
"status": "1",
|
||||
data: {
|
||||
klist: [{ // 每一个模板
|
||||
engindId: 1, //引擎ID
|
||||
engName: 'XX引擎', //引擎name
|
||||
time: { //时间
|
||||
startTime: '', // 开始时间
|
||||
endTime: '' // 结束时间
|
||||
},
|
||||
dimensions: [ // 统计维度们
|
||||
{
|
||||
dimension: 'call', // 调用次数维度
|
||||
field: [] // 此维度下的指标
|
||||
},
|
||||
{
|
||||
dimension: 'rule',
|
||||
field: []
|
||||
},
|
||||
],
|
||||
chart: [{
|
||||
Time: '4.15',
|
||||
value: {
|
||||
call: 20,
|
||||
rule: 80,
|
||||
}
|
||||
|
||||
}, {
|
||||
Time: '4.15',
|
||||
value: {
|
||||
call: 30,
|
||||
rule: 90,
|
||||
}
|
||||
}, {
|
||||
Time: '4.15',
|
||||
value: {
|
||||
call: 40,
|
||||
rule: 100,
|
||||
}
|
||||
}, {
|
||||
Time: '4.15',
|
||||
value: {
|
||||
call: 50,
|
||||
rule: 200,
|
||||
}
|
||||
}, {
|
||||
Time: '4.15',
|
||||
value: {
|
||||
call: 60,
|
||||
rule: 400,
|
||||
}
|
||||
}, {
|
||||
Time: '4.15',
|
||||
value: {
|
||||
call: 70,
|
||||
rule: 800,
|
||||
}
|
||||
}, {
|
||||
Time: '4.15',
|
||||
value: {
|
||||
call: 80,
|
||||
rule: 1000,
|
||||
}
|
||||
}]
|
||||
|
||||
|
||||
|
||||
}]
|
||||
}
|
||||
})
|
||||
Mock.mock("/Riskmanage/v3/1", {
|
||||
"status": "1",
|
||||
data: {
|
||||
klist: [{
|
||||
name: '1引擎', //引擎名
|
||||
id: 1, //id
|
||||
top: false, // 是否置顶
|
||||
call: { // 调用次数
|
||||
'yesterday': 1, // 昨天
|
||||
'today': 456, // 今天
|
||||
'todayPredict': 789, // 今天预计
|
||||
},
|
||||
result: { // 决策结果
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
},
|
||||
hit: { // 命中规则
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
}
|
||||
|
||||
}, {
|
||||
name: '2引擎',
|
||||
id: 2,
|
||||
top: false,
|
||||
call: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
},
|
||||
result: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
},
|
||||
hit: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
}
|
||||
|
||||
}, {
|
||||
name: '3引擎',
|
||||
id: 3,
|
||||
top: false,
|
||||
call: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
},
|
||||
result: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
},
|
||||
hit: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
}
|
||||
|
||||
}, {
|
||||
name: '4引擎',
|
||||
id: 4,
|
||||
top: false,
|
||||
call: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
},
|
||||
result: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
},
|
||||
hit: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
}
|
||||
|
||||
}, {
|
||||
name: '5引擎',
|
||||
id: 5,
|
||||
top: false,
|
||||
call: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
},
|
||||
result: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
},
|
||||
hit: {
|
||||
yesterday: 123,
|
||||
today: 456,
|
||||
todayPredict: 789,
|
||||
}
|
||||
|
||||
}]
|
||||
}
|
||||
})
|
||||
222
h5-datax-manager/src/utils/request.js
Normal file
222
h5-datax-manager/src/utils/request.js
Normal file
@@ -0,0 +1,222 @@
|
||||
import axios from 'axios'
|
||||
import router from '../router';
|
||||
import ElementUI from 'element-ui';
|
||||
import bus from '@/components/common/bus.js'
|
||||
var url = window.location.origin || window.location.protocol + '//' + window.location.hostname + (window.location.port ?
|
||||
':' + window.location.port : '')
|
||||
|
||||
|
||||
const storeUrl = [{
|
||||
regetcache: 'decisionTable',
|
||||
url: [
|
||||
'/v3/decisionTables/addDecisionTables',
|
||||
'/v3/decisionTables/updateDecisionTables',
|
||||
'/v3/decisionTables/updateDecisionTablesStatus',
|
||||
'/v3/decisionTables/version/addVersion',
|
||||
'/v3/decisionTables/version/copyVersion',
|
||||
'/v3/decisionTables/version/updateVersion',
|
||||
'/v3/decisionTables/version/updateVersionStatus',
|
||||
]
|
||||
}, {
|
||||
regetcache: 'Engine',
|
||||
url: [
|
||||
'/v2/engine/update'
|
||||
]
|
||||
}, {
|
||||
regetcache: 'Interface',
|
||||
url: [
|
||||
'/v3/interface/addInterface',
|
||||
'/v3/interface/updateInterface',
|
||||
'/v3/interface/deleteInterface'
|
||||
]
|
||||
},
|
||||
{
|
||||
regetcache: 'SCO',
|
||||
url: [
|
||||
'/v3/scorecard/updateStatus',
|
||||
'/v3/scorecard/add',
|
||||
'/v3/scorecardVersion/addScorecardVersion',
|
||||
'/v3/scorecardVersion/updateScorecardVersionStatus',
|
||||
'/v3/scorecardVersion/copyScorecardVersion',
|
||||
'/v3/scorecardVersion/updateScorecardVersion',
|
||||
'/v3/scorecard/update'
|
||||
]
|
||||
},
|
||||
{
|
||||
regetcache: 'decisionTree',
|
||||
url: [
|
||||
'/v3/decisionTree/addDecisionTree',
|
||||
'/v3/decisionTree/updateDecisionTree',
|
||||
'/v3/decisionTree/updateDecisionTreeStatus',
|
||||
'/v3/decisionTree/version/addVersion',
|
||||
'/v3/decisionTree/version/copyVersion',
|
||||
'/v3/decisionTree/version/updateVersion',
|
||||
'/v3/decisionTree/version/updateVersionStatus',
|
||||
]
|
||||
},
|
||||
{
|
||||
regetcache: 'Sourcelist',
|
||||
url: [
|
||||
'/datasource/save',
|
||||
'/datasource/',
|
||||
'/datasource/update'
|
||||
]
|
||||
}, {
|
||||
regetcache: 'listOperation',
|
||||
url: [
|
||||
'/v3/listOperation/addListOperation',
|
||||
'/v3/listOperation/updateListOperation',
|
||||
'/v3/listOperation/updateListOperationStatus',
|
||||
'/v3/listOperation/version/addVersion',
|
||||
'/v3/listOperation/version/copyVersion',
|
||||
'/v3/listOperation/version/updateVersion',
|
||||
'/v3/listOperation/version/updateVersionStatus',
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: process.env.NODE_ENV.indexOf(['produce','release','test','development','jia','niu','wang'])!=-1? '/' : url,
|
||||
timeout: 500000,
|
||||
})
|
||||
|
||||
|
||||
|
||||
instance.interceptors.request.use((config) => {
|
||||
// config.headers['AAA'] = 'AAA';
|
||||
|
||||
// console.log(config)
|
||||
deepTirm(config)
|
||||
|
||||
if (config.data) {
|
||||
if (config.data.getexcel) {
|
||||
config.headers['responseType'] = 'blob'
|
||||
}
|
||||
}
|
||||
if (localStorage.getItem('token')) {
|
||||
config.headers['token'] = localStorage.getItem('token');
|
||||
}
|
||||
return config
|
||||
})
|
||||
instance.interceptors.response.use((response) => {
|
||||
const {
|
||||
data,
|
||||
config
|
||||
} = response
|
||||
|
||||
|
||||
let result = data
|
||||
|
||||
if (response.data.status === "0") {
|
||||
if (response.data.error === "01000103") {
|
||||
if (document.getElementsByClassName('el-message').length === 0) {
|
||||
ElementUI.Message.error(response.data.msg);
|
||||
router.push({
|
||||
path: '/login',
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
ElementUI.Message.error(response.data.msg);
|
||||
}
|
||||
} else {
|
||||
|
||||
storeUrl.forEach(value => {
|
||||
|
||||
let is = false
|
||||
value.url.forEach(item => {
|
||||
let str = response.request.responseURL
|
||||
if (item[item.length - 1] == '/') {
|
||||
let arr = str.split('/')
|
||||
if (!isNaN(Number(arr[arr.length - 1]))) {
|
||||
arr.pop()
|
||||
str = arr.join('/') + '/'
|
||||
}
|
||||
}
|
||||
|
||||
str = str.substring(str.length - item.length, str.length)
|
||||
if (item == str) {
|
||||
|
||||
bus.$emit('regetcache', value.regetcache)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}, (error) => {
|
||||
// console.log('error', error)
|
||||
if (error.message.match(/timeout/)) {
|
||||
ElementUI.Message.error('请求超时,请稍后再试!');
|
||||
} else if (error.response.status === 500) {
|
||||
ElementUI.Message.error('连接失败,请稍后再试!');
|
||||
} else if (error.response.status === 502) {
|
||||
ElementUI.Message.error('网关超时,请稍后再试!');
|
||||
} else {
|
||||
ElementUI.Message.error('连接失败,请稍后再试!');
|
||||
}
|
||||
return Promise.reject(error)
|
||||
});
|
||||
|
||||
function deepTirm(e) {
|
||||
Object.keys(e).forEach(value => {
|
||||
if (typeof e[value] == 'string' && (e[value][0] === " " || e[value][e[value].length - 1] === " ")) {
|
||||
e[value] = e[value].trim()
|
||||
}
|
||||
if (isJSON(e[value])) {
|
||||
e[value] = JSON.stringify(deepTirm(JSON.parse(e[value])))
|
||||
}
|
||||
if (typeof e[value] === "object" && e[value] !== null) {
|
||||
if (Array.isArray(e[value])) {
|
||||
e[value].forEach(item => {
|
||||
if (typeof item === 'string' && (item[0] === " " || item[item.length - 1] ===
|
||||
" ")) {
|
||||
item = item.trim()
|
||||
}
|
||||
if (typeof item === 'object') {
|
||||
item = deepTirm(item)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
deepTirm(e[value])
|
||||
}
|
||||
}
|
||||
})
|
||||
return e
|
||||
}
|
||||
|
||||
function isJSON(str) {
|
||||
if (typeof str == 'string') {
|
||||
try {
|
||||
var obj = JSON.parse(str);
|
||||
if (typeof obj == 'object' && obj) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default instance
|
||||
Reference in New Issue
Block a user