Commit 395c9be5 by chenyu

update: update

parent 52a7184a
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="shortcut icon" href="./favicon.ico" /> <link rel="shortcut icon" href="./favicon.ico" />
<title>限流控制管理平台</title> <title>达摩工具管理平台</title>
<link rel="stylesheet" type="text/css" href="//web-1251519181.file.myqcloud.com/custom-element/custom-element.1.0.28.css" /> <link rel="stylesheet" type="text/css" href="//web-1251519181.file.myqcloud.com/custom-element/custom-element.1.0.28.css" />
</head> </head>
......
...@@ -13,9 +13,9 @@ import { Message } from 'element-ui'; ...@@ -13,9 +13,9 @@ import { Message } from 'element-ui';
Vue.axios.defaults.timeout = 500000; Vue.axios.defaults.timeout = 500000;
let local = window.location.origin; let local = window.location.origin;
/* if (local.indexOf('localhost') != -1) { if (local.indexOf('localhost') != -1) {
local = 'https://www.gicdev.com'; local = 'https://www.gicdev.com';
} */ }
let axiosPromiseArr = []; //储存cancel toke let axiosPromiseArr = []; //储存cancel toke
let pending = []; //声明一个数组用于存储每个ajax请求的取消函数和ajax标识 let pending = []; //声明一个数组用于存储每个ajax请求的取消函数和ajax标识
let CancelToken = Vue.axios.CancelToken; let CancelToken = Vue.axios.CancelToken;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<template> <template>
<div class="navheader"> <div class="navheader">
<!-- logo --> <!-- logo -->
<div class="navheader-logo fl cursor-pointer" :class="{ moveleft: isCollapse, moveright: !isCollapse }" @click="toIndex"><span class="pro-name">限流控制管理平台</span></div> <div class="navheader-logo fl cursor-pointer" :class="{ moveleft: isCollapse, moveright: !isCollapse }" @click="toIndex"><span class="pro-name">达摩工具管理平台</span></div>
<div class="navheader-item fl"> <div class="navheader-item fl">
<!-- <a class="itemlink icon-collapse" @click="handleCollapse"> <!-- <a class="itemlink icon-collapse" @click="handleCollapse">
<i class="iconfont" :class="{ 'icon-shouqi': !isCollapse, 'icon-zhankai': isCollapse }"></i> <i class="iconfont" :class="{ 'icon-shouqi': !isCollapse, 'icon-zhankai': isCollapse }"></i>
......
...@@ -41,7 +41,7 @@ export const constantRouterMap = [ ...@@ -41,7 +41,7 @@ export const constantRouterMap = [
{ {
path: '/', path: '/',
name: '/', name: '/',
redirect: 'index' redirect: 'module'
}, },
{ {
path: '/login', path: '/login',
...@@ -51,28 +51,42 @@ export const constantRouterMap = [ ...@@ -51,28 +51,42 @@ export const constantRouterMap = [
{ {
// 审核中心 // 审核中心
path: '/index', path: '/module',
name: '审核中心', name: '审核中心',
redirect: 'index', redirect: 'module/first',
component: _import('module', 'index'), component: _import('module', 'index'),
children: [ children: [
{ {
path: '/index', path: '/module/first',
name: '模块', name: '模块',
component: _import('module', 'home') component: _import('module', 'home')
}, },
{ {
path: '/second', path: '/module/second',
name: '限流', name: '限流',
component: _import('module', 'second') component: _import('module', 'second')
}, },
{ {
path: '/third', path: '/module/third',
name: '关系', name: '关系',
component: _import('module', 'third') component: _import('module', 'third')
} }
] ]
}, },
{
// 索引
path: '/index',
name: '索引',
redirect: 'index/first',
component: _import('index', 'index'),
children: [
{
path: '/index/first',
name: '索引',
component: _import('index', 'home')
},
]
},
{ {
path: '/gic-error', path: '/gic-error',
......
<!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2018-10-10 14:44:45
* @LastEditors: 无尘
* @LastEditTime: 2020-12-04 16:25:00
-->
<template>
<div class="unreview-wrap common-set-wrap">
<div class="right-content">
<div class="right-box" style="min-height: calc(100vh - 126px)">
<div class="m-b-20 flex">
<div class="search-items">
<p class="search-items-label">是否处理:</p>
<el-select style="width:140px;" v-model="searchParams.dealFlag" placeholder="请选择是否处理" clearable @change="searchPage">
<el-option label="是" :value="1"></el-option>
<el-option label="否" :value="0"></el-option>
<el-option label="无" :value="-1"></el-option>
</el-select>
</div>
<div class="search-items">
<p class="search-items-label">库地址:</p>
<el-select style="width:140px;" v-model="searchParams.dataSourceId" placeholder="请选择库地址" clearable @change="searchPage">
<el-option v-for="item in sqlUrlOpts" :label="item.name" :value="item.key" :key="item.key"></el-option>
</el-select>
</div>
<div class="search-items">
<p class="search-items-label">库名:</p>
<el-input style="width:140px;" placeholder="请输入库名" v-model="searchParams.scame" clearable @change="searchPage"> </el-input>
</div>
<div class="search-items">
<p class="search-items-label">表名:</p>
<el-input style="width:140px;" placeholder="请输入表名" v-model="searchParams.tableName" clearable @change="searchPage"> </el-input>
</div>
</div>
<div class="reviewed-body-content">
<el-table ref="multipleTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column label="uuid" prop="uuid" show-overflow-tooltip></el-table-column>
<el-table-column label="时间" prop="updateTime" show-overflow-tooltip></el-table-column>
<el-table-column label="sql内容" prop="sqlContent" show-overflow-tooltip></el-table-column>
<el-table-column label="处理后的索引" prop="useIndex" show-overflow-tooltip></el-table-column>
<el-table-column label="是否处理所有" prop="sureFlag" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.sureFlag === 0 ? '否' : '是' }}
</template>
</el-table-column>
<el-table-column label="可能的索引" prop="sureUseIndex" show-overflow-tooltip></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" @click="openDailog(scope.row)">设置索引</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
<!-- 设置索引 -->
<el-dialog title="设置索引" :visible.sync="showDailog" width="600px" :before-close="handleClose">
<div class="">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="索引" prop="moudleName">
<el-input v-model="ruleForm.moudleName" placeholder="请输入模块名称"></el-input>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import errMsg from '@/common/js/error';
// import { _debounce } from '@/common/js/public';
import { getRequest } from '@/api/api';
export default {
name: 'unreview',
data() {
return {
wxEnterpriseId: localStorage.getItem('userInfos') ? JSON.parse(localStorage.getItem('userInfos')).wxEnterpriseId : '',
loading: false,
tableData: [],
sqlUrlOpts: [],
searchParams: {
tableName: '', // 表名 必填
dataSourceId: '', // 库地址 必填
scame: '', // 库名 必填
dealFlag: -1 // 是否处理索引默认-1 1已处理 0未处理
},
showDailog: true,
ruleForm: {
indexName: '',
uuid: ''
},
rules: {
indexName: [{ required: true, message: '请输入索引', trigger: 'blur' }]
}
};
},
methods: {
/**
* 弹窗操作
*/
openDailog(item) {
const that = this;
that.ruleForm = {
indexName: item.sureUseIndex,
uuid: item.uuid
};
that.showDailog = true;
},
handleClose() {
const that = this;
that.showDailog = false;
that.$refs['ruleForm'].resetFields();
},
submitForm() {
const that = this;
let para = { ...this.ruleForm };
getRequest('/redis-limiter-web/sql/set-index', para)
.then(res => {
let resData = res.data;
errMsg.errorMsg(resData);
that.handleClose();
that.getTableList();
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
},
searchPage() {
const { tableName, dataSourceId, scame } = this.searchParams;
if (tableName && dataSourceId && scame) this.getTableList();
},
/**
* 获取列表数据
*/
getTableList() {
const that = this;
that.loading = true;
let para = { ...this.searchParams };
getRequest('/redis-limiter-web/sql/sql-index-check', para)
.then(res => {
let resData = res.data;
that.loading = false;
if (resData.errorCode == 1) {
that.tableData = resData.result || [];
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
})
.finally(_ => (that.loading = false));
},
/**
* 获取sql地址列表
*/
getSqlList() {
const that = this;
getRequest('/redis-limiter-web/sql/jdbc-url-list', {})
.then(res => {
let resData = res.data;
that.loading = false;
if (resData.errorCode == 1) {
that.sqlUrlOpts = resData.result || [];
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.loading = false;
that.$message.error({
duration: 1000,
message: error.message
});
});
}
},
mounted() {
const that = this;
that.$emit('showTab', 2);
that.getSqlList();
},
components: {}
};
</script>
<style lang="scss" scoped>
.search-items {
display: flex;
align-items: center;
margin-right: 10px;
.search-items-label {
font-size: 14px;
color: #303133;
}
}
</style>
<!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2018-10-10 14:44:45
* @LastEditors: 无尘
* @LastEditTime: 2020-12-04 14:08:59
-->
<template>
<div class="review-wrap">
<!-- 公共头部菜单插件 -->
<vue-office-header :projectName="projectName" @collapseTag="collapseTag" @toRouterView="toRouterView"> </vue-office-header>
<div class="setting-wrap__body">
<div id="content" class="content">
<div class="content-body">
<div class="content-body-inner flex border-box">
<div class="apps-content-left w-157" style="min-height: calc(100vh - 86px);">
<common-detail-left :tabListData="tabListData" :activeSelTab="activeSelTab" @setSelectTab="setSelectTab"></common-detail-left>
</div>
<div class="apps-content-right border-box">
<transition name="fade" mode="out-in">
<router-view :brandId="activeBrand" :activeGroupId="activeGroup" :tabType="activeTab" @showTab="showTab"></router-view>
</transition>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import vueOfficeHeader from '@/components/vue-office-header';
import commonDetailLeft from '@/components/app/app-detail-left.vue';
export default {
name: 'reviewed',
components: {
vueOfficeHeader,
commonDetailLeft
},
data() {
return {
projectName: 'haoban-manage-web', // 当前项目名
collapseFlag: false, // 折叠参数
contentHeight: '0px', //页面内容高度
activeSelTab: '2',
activeTab: '2',
tabListData: [
{
tabId: '1',
tabName: '模块',
icon: 'icondaishenhe_orange'
},
{
tabId: '2',
tabName: '索引',
icon: 'icondaishenhe_orange'
}
]
};
},
computed: {},
methods: {
/**
* 路由跳转
*/
changeRoute(path) {
this.$router.push(path);
},
/**
* 选择后返回tabId,做各路由判断
*/
setSelectTab(item) {
let that = this;
that.activeTab = item.tabId;
switch (item.tabId) {
case '1':
that.changeRoute(`/module/first`);
break;
case '2':
that.changeRoute(`/index/first`);
break;
}
},
/**
* 各路由返回 tabId
*/
showTab(id) {
let that = this;
that.activeTab = id;
that.activeSelTab = id;
that.tabListData.forEach(ele => {
if (ele.tabId == id) {
ele.onlyIconActive = false;
}
if (!!ele.children) {
ele.children.forEach(el => {
if (el.tabId == id) {
ele.onlyIconActive = true;
}
if (!!el.children) {
el.children.forEach(item => {
if (item.tabId == id) {
ele.onlyIconActive = true;
}
});
}
});
}
});
},
// 处理路由跳转
toRouterView(val) {
const that = this;
// 模拟检查数据,有两个参数
/*{
name:,
path:
}*/
that.$router.push({
path: val.path
});
},
// 折叠事件
collapseTag(val) {
const that = this;
that.collapseFlag = val;
}
},
watch: {
$route: {
handler: function(val, oldVal) {
// this.$refs.asideMenu.refreshRoute();
},
// 深度观察监听
deep: true
}
},
mounted() {
const that = this;
that.activeTab = '2';
that.contentHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 64 + 'px';
}
};
</script>
<style lang="scss">
.review-wrap {
background-color: #f0f2f5;
}
.setting-wrap__body {
.content {
padding-top: 46px;
/* height: calc(100% - 64px);
overflow-y: auto;*/
min-width: 1400px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
.content-body {
.content-body-inner {
padding: 20px;
min-height: calc(100% - 86px);
}
.apps-content-left {
min-width: 157px;
// height: 100%;
background: #fff;
overflow-x: hidden;
overflow-y: auto;
}
.apps-content-right {
width: calc(100% - 157px);
padding-left: 10px;
background: #f0f2f5;
}
.common-set-wrap {
position: relative;
width: 100%;
height: 100%;
overflow-y: auto;
.right-content {
/*width: 100%;*/
min-height: calc(100% - 86px);
.right-box {
background: #fff;
padding: 20px;
}
}
}
}
}
}
.el-table__body-wrapper .el-table__empty-block {
height: 256px;
}
.el-table__empty-text {
width: auto;
margin-bottom: 80px;
&::before {
content: ' ';
display: block;
width: 60px;
height: 60px;
background: url(../../assets/no-data_icon.png) no-repeat center;
margin: 0px auto 22px auto;
}
}
.el-table__empty-text {
margin-bottom: 0;
}
</style>
<!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2018-10-10 14:44:45
* @LastEditors: 无尘
* @LastEditTime: 2020-12-04 17:15:25
-->
<template>
<div class="unreview-wrap common-set-wrap">
<div class="right-content">
<div class="right-box" style="min-height: calc(100vh - 126px)">
<div class="m-b-20">
<nav-crumb :navpath="navpath"> </nav-crumb>
</div>
<div class="text-right m-b-20"><el-button @click="handleAdd('')" type="primary">新增限流</el-button></div>
<div class="reviewed-body-content">
<el-table ref="multipleTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column label="限流名称">
<template slot-scope="scope" show-overflow-tooltip>
{{ scope.row.rateName || '--' }}
</template>
</el-table-column>
<el-table-column label="Code" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.rateCode || '--' }}
</template>
</el-table-column>
<!-- <el-table-column label="提交时间" show-overflow-tooltip>
<template slot-scope="scope">
<div class="line-h-18">{{ scope.row.createTime | timeStampToYmd }}</div>
<div class="line-h-18">{{ scope.row.createTime | timeStampToHms }}</div>
</template>
</el-table-column> -->
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" @click="toNext(scope.row)">查看详情</el-button>
<el-button @click="handleAdd(scope.row)" type="text">编辑</el-button>
<el-button @click="handlDel(scope.$index, scope.row)" type="text">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- <div class="block common-wrap__page text-right" v-if="tableData.length != 0">
<dm-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </dm-pagination>
</div> -->
</div>
</div>
</div>
<!-- 编辑 -->
<el-dialog :title="!!ruleForm.rateId ? '编辑限流' : '新建限流'" :visible.sync="showAdd" width="600px" :before-close="handleClose">
<div class="">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="限流名称" prop="rateName">
<el-input v-model="ruleForm.rateName" placeholder="请输入限流"></el-input>
<!-- <el-select v-model="ruleForm.id" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select> -->
</el-form-item>
<el-form-item label="Code" prop="rateCode">
<el-input v-model="ruleForm.rateCode" placeholder="请输入code"></el-input>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="toCancel">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import navCrumb from '@/components/nav/nav-app.vue';
import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';
import { _debounce } from '@/common/js/public';
import { getRequest, postRequest } from '@/api/api';
export default {
name: 'unreview',
components: { navCrumb },
data() {
return {
wxEnterpriseId: localStorage.getItem('userInfos') ? JSON.parse(localStorage.getItem('userInfos')).wxEnterpriseId : '',
auditName: localStorage.getItem('userInfos') && JSON.parse(localStorage.getItem('userInfos')).staffDTO ? JSON.parse(localStorage.getItem('userInfos')).staffDTO.staffName : '',
// 面包屑参数
navpath: [
{
name: '模块',
path: '/index'
},
{
name: '限流',
path: ''
}
],
loading: false,
tableData: [],
options: [
{
value: '选项1',
label: '黄金糕'
}
],
// 分页参数
currentPage: 1,
pageSize: 20,
total: 0,
showAdd: false,
ruleForm: {
rateId: '',
rateName: '',
rateCode: ''
},
rules: {
rateName: [{ required: true, message: '请输入限流名称', trigger: 'blur' }],
rateCode: [{ required: true, message: '请输入限流code', trigger: 'blur' }]
}
};
},
methods: {
/**
* 跳转详情
*/
toNext(row) {
const that = this;
that.$router.push(`/third?rateId=${row.rateId}&moudleId=${that.$route.query.moudleId}`);
},
/**
* 弹窗操作
*/
toCancel() {
const that = this;
that.closeText();
that.$refs['ruleForm'].resetFields();
},
handleClose(done) {
const that = this;
that.closeText();
that.$refs['ruleForm'].resetFields();
},
submitForm: _debounce(function(formName) {
const that = this;
that.$refs[formName].validate(valid => {
if (valid) {
that.postSave();
}
});
}, 300),
postSave() {
const that = this;
const data = {
rateId: that.ruleForm.rateId,
rateName: that.ruleForm.rateName,
rateCode: that.ruleForm.rateCode,
moudleId: that.$route.query.moudleId
};
postRequest('/redis-limiter-web/redislimiter/save-rate', data)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
showMsg.showmsg('操作成功', 'success');
that.$refs['ruleForm'].resetFields();
that.closeText();
} else {
errMsg.errorMsg(resData);
}
})
.catch(error => {
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/**
* 新增或编辑
*/
handleAdd(row) {
const that = this;
if (row) {
that.ruleForm = JSON.parse(JSON.stringify(row));
}
that.showAdd = true;
},
closeText() {
const that = this;
that.ruleForm = {
rateId: '',
rateName: '',
rateCode: ''
};
that.showAdd = false;
that.currentPage = 1;
that.getTableList();
},
/**
* 分页---页码变化
* @param {Number} val
*/
handleSizeChange(val) {
const that = this;
that.currentPage = 1;
that.pageSize = val;
that.getTableList();
},
/**
* 分页---当前页变化
* @param {Number} val
*/
handleCurrentChange(val) {
const that = this;
that.currentPage = val;
that.getTableList();
},
/**
* 操作
*/
handlDel(index, item) {
const that = this;
that
.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.postApprove(item);
})
.catch(() => {});
},
/**
* 确定同意删除
*/
postApprove(item) {
const that = this;
let para = {
rateId: item.rateId
};
postRequest('/redis-limiter-web/redislimiter/del-rate', para)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
showMsg.showmsg('操作成功', 'success');
that.currentPage = 1;
that.getTableList();
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/**
* 获取列表数据
*/
getTableList(val) {
const that = this;
if (val) {
that.currentPage = 1;
}
that.loading = true;
let para = {
moudleId: that.$route.query.moudleId,
pageNum: that.currentPage, // 当前页
pageSize: that.pageSize // 一页显示个数
};
getRequest('/redis-limiter-web/redislimiter/list-rate', para)
.then(res => {
let resData = res.data;
that.loading = false;
if (resData.errorCode == 1) {
that.tableData = resData.result || [];
// that.total = resData.result.totalCount;
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.loading = false;
that.$message.error({
duration: 1000,
message: error.message
});
});
}
},
mounted() {
const that = this;
that.$emit('showTab', 1);
// that.wxEnterpriseId = await that.toLogin();
that.getTableList();
}
};
</script>
<style lang="scss" scoped>
.w-250 {
width: 250px;
}
/* flex */
.flex {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.flex-1 {
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
.flex-column {
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
-o-flex-direction: column;
flex-direction: column;
}
.flex-row {
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
}
.flex-align-center {
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.flex-pack-center {
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
.flex-wrap {
-webkit-flex-wrap: wrap;
-moz-flex-wrap: wrap;
-ms-flex-wrap: wrap;
-o-flex-wrap: wrap;
flex-wrap: wrap;
}
.flex-space-between {
-webkit-justify-content: space-between;
-moz-justify-content: space-between;
-ms-justify-content: space-between;
-o-justify-content: space-between;
justify-content: space-between;
}
.flex-start {
-webkit-justify-content: flex-start;
-moz-justify-content: flex-start;
-ms-justify-content: flex-start;
-o-justify-content: flex-start;
justify-content: flex-start;
}
.bg-82C5FF {
background: #82c5ff;
}
.color-508CEE {
color: #508cee;
}
.color-FF585C {
color: #ff585c;
}
.font-13 {
font-size: 13px;
}
.font-14 {
font-size: 14px;
}
.line-h-18 {
line-height: 18px;
}
.line-hidden-2 {
display: flex;
align-items: center;
justify-content: flex-start;
height: 46px;
overflow: hidden;
span {
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
box-orient: vertical;
max-height: 46px;
overflow: hidden;
}
}
.w-80 {
width: 80px;
}
.w-130 {
display: inline-block;
width: 130px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.w-168 {
display: inline-block;
width: 168px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.common-wrap__page {
margin-top: 24px;
}
.text-center {
text-align: center;
}
.text-right {
text-align: right;
}
.right-content {
min-height: calc(100% - 126px);
.right-box {
background: #fff;
min-height: 500px;
padding: 20px;
.w-280 {
width: 280px;
}
.w-514 {
width: 514px;
}
.m-l-20 {
margin-left: 20px;
}
.m-t-45 {
margin-top: 45px;
}
.v-align-b {
vertical-align: bottom;
}
.reviewed-body-head {
margin-bottom: 22px;
}
.table-head-pic {
width: 35px;
height: 35px;
border-radius: 4px;
i {
font-size: 20px;
color: #e5f3ff;
}
img {
width: 35px;
height: 35px;
border-radius: 3px;
}
}
.apply-info {
margin-left: 15px;
line-height: 18px;
span {
font-size: 14px;
color: #606266;
&.font-13 {
font-size: 13px;
}
}
}
}
}
.apply-info-detail {
/*padding: 18px;*/
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
.apply-info-img {
width: 64px;
height: 64px;
border-radius: 12px;
text-align: center;
i {
font-size: 106px;
color: #e5f3ff;
}
img {
width: 64px;
height: 64px;
border-radius: 12px;
}
}
.apply-info-name {
font-size: 16px;
color: #606266;
}
.apply-info-right {
width: 229px;
padding-left: 16px;
font-size: 13px;
color: #606266;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
.w-80 {
display: inline-block;
vertical-align: top;
color: #606266;
}
.w-130 {
color: #606266;
}
}
}
.approve-dialog {
.el-icon-success {
display: inline-block;
vertical-align: middle;
font-size: 24px;
color: #67c23a;
}
.approve-icon-tip {
display: inline-block;
vertical-align: middle;
margin-left: 6px;
font-size: 18px;
color: #303133;
}
.approve-tip {
margin-top: 31px;
font-size: 14px;
color: #606266;
}
>>> .el-dialog__body {
padding-top: 0;
}
>>> .el-dialog__footer {
border: none;
padding: 18px 20px 22px 20px;
}
}
.refuse-dialog {
.refuse-tip {
margin-bottom: 20px;
font-size: 14px;
color: #606266;
}
>>> .el-dialog__footer {
border: none;
/*padding: 18px 20px 22px 20px;*/
}
.el-textarea {
>>> .el-textarea__inner {
font-size: 14px;
color: #606266;
background-color: rgba(255, 255, 255, 0.1);
resize: none;
}
}
}
</style>
<!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2018-10-10 14:44:45
* @LastEditors: 无尘
* @LastEditTime: 2020-12-07 16:38:07
-->
<template>
<div class="unreview-wrap common-set-wrap">
<div class="right-content">
<div class="right-box" style="min-height: calc(100vh - 126px)">
<div class="m-b-20">
<nav-crumb :navpath="navpath"> </nav-crumb>
</div>
<div class="text-right m-b-20"><el-button @click="handleAdd('')" type="primary">新增企业关系</el-button></div>
<div class="reviewed-body-content">
<el-table ref="multipleTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column label="企业名称" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.enterpriseName || '--' }}
</template>
</el-table-column>
<el-table-column label="企业ID" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.enterpriseId || '--' }}
</template>
</el-table-column>
<el-table-column label="QPS" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.count || '--' }}
</template>
</el-table-column>
<el-table-column label="关联类型" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.relationType == 0 ? 'GIC' : '自定义' }}
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<!-- <el-button type="text" @click="toNext(scope.row)">查看详情</el-button> -->
<el-button @click="handleAdd(scope.row)" type="text">编辑</el-button>
<el-button @click="handlDel(scope.$index, scope.row)" type="text">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- <div class="block common-wrap__page text-right" v-if="tableData.length != 0">
<dm-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </dm-pagination>
</div> -->
</div>
</div>
</div>
<!-- 编辑 -->
<el-dialog :title="!!ruleForm.rateEnterpriseId ? '编辑企业关系' : '新建企业关系'" :visible.sync="showAdd" width="600px" :before-close="handleClose">
<div class="">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item v-if="ruleForm.rateEnterpriseId ? false : true" label="关联类型" prop="relationType">
<el-select class="w-360" v-model="ruleForm.relationType" placeholder="请选择关联类型" @change="changeType">
<el-option label="GIC" value="0"> </el-option>
<el-option label="自定义" value="1"> </el-option>
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.relationType == 1" label="商户 ID" prop="enterpriseId">
<el-input class="w-360" :disabled="ruleForm.rateEnterpriseId ? true : false" v-model="ruleForm.enterpriseId" placeholder="请输入商户 ID"></el-input>
</el-form-item>
<el-form-item v-if="ruleForm.relationType == 1" label="商户名称" prop="enterpriseName">
<el-input class="w-360" :disabled="ruleForm.rateEnterpriseId ? true : false" v-model="ruleForm.enterpriseName" placeholder="请输入商户名称"></el-input>
</el-form-item>
<el-form-item v-if="ruleForm.relationType == 0" label="选择企业" prop="enterpriseDatas">
<!-- <el-input v-model="ruleForm.name" placeholder="请输入企业关系"></el-input> -->
<!-- <el-select class="w-360" :disabled="ruleForm.rateEnterpriseId ? true : false" multiple v-model="ruleForm.enterpriseDatas" placeholder="请选择">
<el-option v-for="item in options" :key="item.enterpriseId" :label="item.enterpriseName" :value="item.enterpriseId"> </el-option>
</el-select> -->
<el-select class="w-360" :disabled="ruleForm.rateEnterpriseId ? true : false" v-model="ruleForm.eids" multiple filterable remote reserve-keyword placeholder="请输入企业名称搜索" :remote-method="remoteMethod" :loading="loading">
<el-option v-for="item in options" :key="item.enterpriseId" :label="item.enterpriseName" :value="item.enterpriseId"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="QPS" prop="count">
<el-input-number class="w-360" v-model="ruleForm.count" placeholder="请输入" controls-position="right" :min="1" :max="90000000"></el-input-number>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="toCancel">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import navCrumb from '@/components/nav/nav-app.vue';
import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';
import { _debounce } from '@/common/js/public';
import { getRequest, postRequest } from '@/api/api';
export default {
name: 'unreview',
components: { navCrumb },
data() {
const validateId = (rule, value, callback) => {
if (this.ruleForm.relationType == 1 && value === '') {
callback(new Error('请输入商户 ID'));
} else {
callback();
}
};
const validateName = (rule, value, callback) => {
if (this.ruleForm.relationType == 1 && value === '') {
callback(new Error('请输入商户名称'));
} else {
callback();
}
};
return {
wxEnterpriseId: localStorage.getItem('userInfos') ? JSON.parse(localStorage.getItem('userInfos')).wxEnterpriseId : '',
auditName: localStorage.getItem('userInfos') && JSON.parse(localStorage.getItem('userInfos')).staffDTO ? JSON.parse(localStorage.getItem('userInfos')).staffDTO.staffName : '',
// 面包屑参数
navpath: [
{
name: '模块',
path: '/index'
},
{
name: '限流',
path: `/second?moudleId=${this.$route.query.moudleId}`
},
{
name: '企业关系',
path: ''
}
],
loading: false,
tableData: [],
options: [],
// 分页参数
currentPage: 1,
pageSize: 20,
total: 0,
showAdd: false,
ruleForm: {
relationType: '0',
enterpriseId: '',
enterpriseName: '',
rateEnterpriseId: '',
eids: [],
enterpriseDatas: [],
count: ''
},
rules: {
enterpriseId: [{ required: true, validator: validateId, message: '请输入商户 ID', trigger: 'blur' }],
enterpriseName: [{ required: true, validator: validateName, message: '请输入商户名称', trigger: 'blur' }],
enterpriseDatas: [{ type: 'array', required: true, message: '请选择企业', trigger: 'blur' }],
count: [{ required: true, message: '请输入', trigger: 'blur' }]
},
optionsCopy: []
};
},
methods: {
changeType(e) {
const that = this;
that.$refs['ruleForm'].resetFields();
that.ruleForm.relationType = e;
that.ruleForm.enterpriseDatas = [];
that.ruleForm.eids = [];
that.ruleForm.enterpriseId = '';
that.ruleForm.enterpriseName = '';
},
remoteMethod(query) {
const that = this;
if (query !== '') {
that.loading = true;
setTimeout(() => {
that.loading = false;
that.options = that.optionsCopy.filter(ele => {
return ele.enterpriseName.indexOf(query) != -1;
});
}, 200);
} else {
that.options = JSON.parse(JSON.stringify(that.optionsCopy));
}
},
/**
* 弹窗操作
*/
toCancel() {
const that = this;
that.closeText();
that.$refs['ruleForm'].resetFields();
},
handleClose(done) {
const that = this;
that.closeText();
that.$refs['ruleForm'].resetFields();
},
submitForm: _debounce(function(formName) {
const that = this;
if (that.ruleForm.relationType == 1) {
that.ruleForm.enterpriseDatas = [
{
enterpriseId: that.ruleForm.enterpriseId,
enterpriseName: that.ruleForm.enterpriseName
}
];
} else {
that.ruleForm.enterpriseDatas = that.optionsCopy.filter(ele => {
if (that.ruleForm.eids.indexOf(ele.enterpriseId) != -1) {
return { enterpriseId: ele.enterpriseId, enterpriseName: ele.enterpriseName };
}
});
}
that.$refs[formName].validate(valid => {
if (valid) {
that.postSave();
}
});
}, 300),
postSave() {
const that = this;
const data = {
rateId: that.$route.query.rateId,
relationType: that.ruleForm.relationType,
rateEnterpriseId: that.ruleForm.rateEnterpriseId,
enterpriseDatas: !that.ruleForm.rateEnterpriseId ? JSON.stringify(that.ruleForm.enterpriseDatas) : '',
count: that.ruleForm.count
};
postRequest(!that.ruleForm.rateEnterpriseId ? '/redis-limiter-web/redislimiter/save-rate-enterprise' : '/redis-limiter-web/redislimiter/save-rate-enterprise-single', data)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
showMsg.showmsg('操作成功', 'success');
that.$refs['ruleForm'].resetFields();
that.closeText();
} else {
errMsg.errorMsg(resData);
}
})
.catch(error => {
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/**
* 新增或编辑
*/
handleAdd(row) {
const that = this;
that.getEntepriseList();
if (row) {
row.eids = [row.enterpriseId];
row.enterpriseDatas = [
{
enterpriseId: row.enterpriseId,
enterpriseName: row.enterpriseName
}
];
that.ruleForm = JSON.parse(JSON.stringify(row));
}
that.showAdd = true;
},
closeText() {
const that = this;
that.ruleForm = {
relationType: '0',
enterpriseId: '',
enterpriseName: '',
rateEnterpriseId: '',
eids: [],
enterpriseDatas: [],
count: ''
};
that.showAdd = false;
that.currentPage = 1;
that.getTableList();
},
/**
* 分页---页码变化
* @param {Number} val
*/
handleSizeChange(val) {
const that = this;
that.currentPage = 1;
that.pageSize = val;
that.getTableList();
},
/**
* 分页---当前页变化
* @param {Number} val
*/
handleCurrentChange(val) {
const that = this;
that.currentPage = val;
that.getTableList();
},
/**
* 操作
*/
handlDel(index, item) {
const that = this;
that
.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.postApprove(item);
})
.catch(() => {});
},
/**
* 确定同意删除
*/
postApprove(item) {
const that = this;
let para = {
rateEnterpriseId: item.rateEnterpriseId
};
postRequest('/redis-limiter-web/redislimiter/del-rate-enterprise', para)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
showMsg.showmsg('操作成功', 'success');
that.currentPage = 1;
that.getTableList();
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/**
* 获取列表数据
*/
getTableList() {
const that = this;
that.loading = true;
let para = {
rateId: that.$route.query.rateId,
pageNum: that.currentPage, // 当前页
pageSize: that.pageSize // 一页显示个数
};
getRequest('/redis-limiter-web/redislimiter/list-rate-enterprise', para)
.then(res => {
let resData = res.data;
that.loading = false;
if (resData.errorCode == 1) {
that.tableData = resData.result || [];
// that.total = resData.result.totalCount;
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.loading = false;
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/**
* 获取列表数据
*/
getEntepriseList() {
const that = this;
let para = {};
getRequest('/redis-limiter-web/redislimiter/list-enterprise', para)
.then(res => {
let resData = res.data;
that.loading = false;
if (resData.errorCode == 1) {
that.options = resData.result || [];
that.optionsCopy = JSON.parse(JSON.stringify(resData.result || []));
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
}
},
mounted() {
const that = this;
that.$emit('showTab', 1);
// that.wxEnterpriseId = await that.toLogin();
that.getTableList();
}
};
</script>
<style lang="scss" scoped>
.w-250 {
width: 250px;
}
/* flex */
.flex {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.flex-1 {
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
.flex-column {
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
-o-flex-direction: column;
flex-direction: column;
}
.flex-row {
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
}
.flex-align-center {
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.flex-pack-center {
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
.flex-wrap {
-webkit-flex-wrap: wrap;
-moz-flex-wrap: wrap;
-ms-flex-wrap: wrap;
-o-flex-wrap: wrap;
flex-wrap: wrap;
}
.flex-space-between {
-webkit-justify-content: space-between;
-moz-justify-content: space-between;
-ms-justify-content: space-between;
-o-justify-content: space-between;
justify-content: space-between;
}
.flex-start {
-webkit-justify-content: flex-start;
-moz-justify-content: flex-start;
-ms-justify-content: flex-start;
-o-justify-content: flex-start;
justify-content: flex-start;
}
.bg-82C5FF {
background: #82c5ff;
}
.color-508CEE {
color: #508cee;
}
.color-FF585C {
color: #ff585c;
}
.font-13 {
font-size: 13px;
}
.font-14 {
font-size: 14px;
}
.line-h-18 {
line-height: 18px;
}
.line-hidden-2 {
display: flex;
align-items: center;
justify-content: flex-start;
height: 46px;
overflow: hidden;
span {
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
box-orient: vertical;
max-height: 46px;
overflow: hidden;
}
}
.w-80 {
width: 80px;
}
.w-130 {
display: inline-block;
width: 130px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.w-360 {
width: 360px;
}
.w-168 {
display: inline-block;
width: 168px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.common-wrap__page {
margin-top: 24px;
}
.text-center {
text-align: center;
}
.text-right {
text-align: right;
}
.right-content {
min-height: calc(100% - 126px);
.right-box {
background: #fff;
min-height: 500px;
padding: 20px;
.w-280 {
width: 280px;
}
.w-514 {
width: 514px;
}
.m-l-20 {
margin-left: 20px;
}
.m-t-45 {
margin-top: 45px;
}
.v-align-b {
vertical-align: bottom;
}
.reviewed-body-head {
margin-bottom: 22px;
}
.table-head-pic {
width: 35px;
height: 35px;
border-radius: 4px;
i {
font-size: 20px;
color: #e5f3ff;
}
img {
width: 35px;
height: 35px;
border-radius: 3px;
}
}
.apply-info {
margin-left: 15px;
line-height: 18px;
span {
font-size: 14px;
color: #606266;
&.font-13 {
font-size: 13px;
}
}
}
}
}
.apply-info-detail {
/*padding: 18px;*/
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
.apply-info-img {
width: 64px;
height: 64px;
border-radius: 12px;
text-align: center;
i {
font-size: 106px;
color: #e5f3ff;
}
img {
width: 64px;
height: 64px;
border-radius: 12px;
}
}
.apply-info-name {
font-size: 16px;
color: #606266;
}
.apply-info-right {
width: 229px;
padding-left: 16px;
font-size: 13px;
color: #606266;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
.w-80 {
display: inline-block;
vertical-align: top;
color: #606266;
}
.w-130 {
color: #606266;
}
}
}
.approve-dialog {
.el-icon-success {
display: inline-block;
vertical-align: middle;
font-size: 24px;
color: #67c23a;
}
.approve-icon-tip {
display: inline-block;
vertical-align: middle;
margin-left: 6px;
font-size: 18px;
color: #303133;
}
.approve-tip {
margin-top: 31px;
font-size: 14px;
color: #606266;
}
>>> .el-dialog__body {
padding-top: 0;
}
>>> .el-dialog__footer {
border: none;
padding: 18px 20px 22px 20px;
}
}
.refuse-dialog {
.refuse-tip {
margin-bottom: 20px;
font-size: 14px;
color: #606266;
}
>>> .el-dialog__footer {
border: none;
/*padding: 18px 20px 22px 20px;*/
}
.el-textarea {
>>> .el-textarea__inner {
font-size: 14px;
color: #606266;
background-color: rgba(255, 255, 255, 0.1);
resize: none;
}
}
}
</style>
...@@ -50,6 +50,11 @@ export default { ...@@ -50,6 +50,11 @@ export default {
tabId: '1', tabId: '1',
tabName: '模块', tabName: '模块',
icon: 'icondaishenhe_orange' icon: 'icondaishenhe_orange'
},
{
tabId: '2',
tabName: '索引',
icon: 'icondaishenhe_orange'
} }
] ]
}; };
...@@ -70,7 +75,10 @@ export default { ...@@ -70,7 +75,10 @@ export default {
that.activeTab = item.tabId; that.activeTab = item.tabId;
switch (item.tabId) { switch (item.tabId) {
case '1': case '1':
that.changeRoute(`index`); that.changeRoute(`/module/first`);
break;
case '2':
that.changeRoute(`/index/first`);
break; break;
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment