Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
|
baaeeebe8c | |
|
62f28a9563 | |
|
294d6702fa | |
|
6bb088ddbe | |
|
c256f728f9 | |
|
ee71c1d68b | |
|
9f032af1c9 |
|
@ -2,10 +2,10 @@
|
|||
|
||||
```bash
|
||||
# 克隆项目
|
||||
git clone https://gitee.com/y_project/MuYu-Vue
|
||||
git clone https://gitea.qinmian.online/ruoyi/cloud-ui.git
|
||||
|
||||
# 进入项目目录
|
||||
cd muyu-ui
|
||||
cd cloud-ui
|
||||
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
|
|
@ -28,7 +28,6 @@ if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
|
|||
if (report) {
|
||||
console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
run(`vue-cli-service build ${args}`)
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询数据源列表
|
||||
export function listDetabase(query) {
|
||||
return request({
|
||||
url: '/detabase/detabase/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询数据源详细
|
||||
export function getDetabase(id) {
|
||||
return request({
|
||||
url: '/detabase/detabase/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
//测试数据库连接
|
||||
export function testConnection(data) {
|
||||
return request({
|
||||
url: '/detabase/detabase/testConnection',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//查询数据库名称
|
||||
|
||||
export function selectDatabaseList(data) {
|
||||
return request({
|
||||
url: '/detabase/detabase/selectDatabaseList',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
//查询数据库下表名
|
||||
export function selectedDatabaseList(data) {
|
||||
return request({
|
||||
url: '/detabase/detabase/selectedDatabaseList',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 新增数据源
|
||||
export function addDetabase(data) {
|
||||
return request({
|
||||
url: '/detabase/detabase',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改数据源
|
||||
export function updateDetabase(data) {
|
||||
return request({
|
||||
url: '/detabase/detabase/'+data.id,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除数据源
|
||||
export function delDetabase(id) {
|
||||
return request({
|
||||
url: '/detabase/detabase/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -16,3 +16,11 @@ export function forceLogout(tokenId) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function findTokenId(query) {
|
||||
return request({
|
||||
url: '/system/online/findTokenId',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||
// 查询参数列表
|
||||
export function listConfig(query) {
|
||||
return request({
|
||||
url: '/system/config/plus/list',
|
||||
url: '/system/config/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
@ -12,7 +12,7 @@ export function listConfig(query) {
|
|||
// 查询参数详细
|
||||
export function getConfig(configId) {
|
||||
return request({
|
||||
url: '/system/config/plus/' + configId,
|
||||
url: '/system/config/' + configId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ export function getConfig(configId) {
|
|||
// 根据参数键名查询参数值
|
||||
export function getConfigKey(configKey) {
|
||||
return request({
|
||||
url: '/system/config/plus/configKey/' + configKey,
|
||||
url: '/system/config/configKey/' + configKey,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export function getConfigKey(configKey) {
|
|||
// 新增参数配置
|
||||
export function addConfig(data) {
|
||||
return request({
|
||||
url: '/system/config/plus',
|
||||
url: '/system/config',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
|
@ -37,7 +37,7 @@ export function addConfig(data) {
|
|||
// 修改参数配置
|
||||
export function updateConfig(data) {
|
||||
return request({
|
||||
url: '/system/config/plus',
|
||||
url: '/system/config',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
|
@ -46,7 +46,7 @@ export function updateConfig(data) {
|
|||
// 删除参数配置
|
||||
export function delConfig(configId) {
|
||||
return request({
|
||||
url: '/system/config/plus/' + configId,
|
||||
url: '/system/config/' + configId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ export function delConfig(configId) {
|
|||
// 刷新参数缓存
|
||||
export function refreshCache() {
|
||||
return request({
|
||||
url: '/system/config/plus/refreshCache',
|
||||
url: '/system/config/refreshCache',
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -57,4 +57,4 @@ export function delMenu(menuId) {
|
|||
url: '/system/menu/' + menuId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,27 @@ export function listNotice(query) {
|
|||
})
|
||||
}
|
||||
|
||||
/*公告列表*/
|
||||
export function noticList() {
|
||||
return request({
|
||||
url: '/system/notice/noticList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
/*公告详情列表*/
|
||||
export function noticListDetail() {
|
||||
return request({
|
||||
url: '/system/notice/noticListDetail',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
//阅读公告
|
||||
export function readNotic(noticeId) {
|
||||
return request({
|
||||
url: '/system/notice/readNotic/?noticeId=' + noticeId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 查询公告详细
|
||||
export function getNotice(noticeId) {
|
||||
return request({
|
||||
|
@ -41,4 +62,4 @@ export function delNotice(noticeId) {
|
|||
url: '/system/notice/' + noticeId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
<top-nav v-if="topNav" id="topmenu-container" class="topmenu-container"/>
|
||||
|
||||
<div class="right-menu">
|
||||
<el-badge :value="12" style="margin-right: 50px" class="item">
|
||||
<el-button size="mini" @click="drawer = true">公告</el-button>
|
||||
</el-badge>
|
||||
|
||||
<template v-if="device!=='mobile'">
|
||||
<search id="header-search" class="right-menu-item"/>
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect"/>
|
||||
|
@ -35,6 +39,63 @@
|
|||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<el-drawer
|
||||
title="我是标题"
|
||||
:visible.sync="drawer"
|
||||
:with-header="false">
|
||||
<span>
|
||||
<el-tabs type="border-card">
|
||||
|
||||
<el-tab-pane>
|
||||
<el-card>
|
||||
<el-button @click="all">全部</el-button>
|
||||
<el-button @click="notice">通知</el-button>
|
||||
<el-button @click="announcementList">公告</el-button>
|
||||
</el-card>
|
||||
<el-button @click="readNotic">通知已读</el-button>
|
||||
<el-button @click="noReadNotic">通知未读</el-button>
|
||||
<el-button @click="announcementListReadNotic">公告已读</el-button>
|
||||
<el-button @click="announcementListNoReadNotic">公告未读</el-button>
|
||||
<el-descriptions class="margin-top" v-for="(notice, index) in inform" :title=notice.noticeTitle :column="3" border>
|
||||
<template slot="extra">
|
||||
<el-button type="primary" size="small" @click="readMessage(notice)">阅读消息</el-button>
|
||||
</template>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-user"></i>
|
||||
消息发布时间
|
||||
</template>
|
||||
{{notice.createTime}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item style="width: 200px">
|
||||
<template slot="label">
|
||||
<i class="el-icon-mobile-phone"></i>
|
||||
消息发布人
|
||||
</template>
|
||||
{{notice.createBy}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item >
|
||||
<template slot="label">
|
||||
<i class="el-icon-tickets"></i>
|
||||
当前状态
|
||||
</template>
|
||||
<el-tag size="small" v-if="notice.flag==='0'">未读</el-tag>
|
||||
<el-tag type="success" size="small" v-if="notice.flag==='1'">已读</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-office-building"></i>
|
||||
消息类型
|
||||
</template>
|
||||
<el-tag size="small" v-if="notice.noticeType==='1'">通知</el-tag>
|
||||
<el-tag size="small" v-if="notice.noticeType==='2'">公告</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
</span>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -46,8 +107,18 @@ import Hamburger from '@/components/Hamburger'
|
|||
import Screenfull from '@/components/Screenfull'
|
||||
import SizeSelect from '@/components/SizeSelect'
|
||||
import Search from '@/components/HeaderSearch'
|
||||
import {noticList, readNotic} from "@/api/system/notice";
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
drawer: false,
|
||||
notic: [],
|
||||
/*通知*/
|
||||
inform: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Breadcrumb,
|
||||
TopNav,
|
||||
|
@ -77,9 +148,94 @@ export default {
|
|||
get() {
|
||||
return this.$store.state.settings.topNav
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
created() {
|
||||
this.noticList()
|
||||
},
|
||||
methods: {
|
||||
|
||||
/*全部*/
|
||||
all(){
|
||||
this.inform = []
|
||||
this.notic.forEach(item => {
|
||||
this.inform.push(item)
|
||||
})
|
||||
},
|
||||
/*通知*/
|
||||
notice(){
|
||||
this.inform = []
|
||||
this.notic.forEach(item => {
|
||||
if (item.noticeType === '1') {
|
||||
this.inform.push(item)
|
||||
}
|
||||
})
|
||||
},
|
||||
/*通知已读*/
|
||||
readNotic(){
|
||||
this.inform = []
|
||||
this.notic.forEach(item => {
|
||||
if (item.noticeType === '1' && item.flag == 1) {
|
||||
this.inform.push(item)
|
||||
}
|
||||
})
|
||||
},
|
||||
/*公告已读*/
|
||||
announcementListReadNotic(){
|
||||
this.inform = []
|
||||
this.notic.forEach(item => {
|
||||
if (item.noticeType === '2' && item.flag == 1) {
|
||||
this.inform.push(item)
|
||||
}
|
||||
})
|
||||
},
|
||||
/*通知未读*/
|
||||
noReadNotic(){
|
||||
this.inform = []
|
||||
this.notic.forEach(item => {
|
||||
if (item.noticeType === '1' && item.flag == 0) {
|
||||
this.inform.push(item)
|
||||
}
|
||||
})
|
||||
},
|
||||
/*通知未读*/
|
||||
announcementListNoReadNotic(){
|
||||
this.inform = []
|
||||
this.notic.forEach(item => {
|
||||
if (item.noticeType === '2' && item.flag == 0) {
|
||||
this.inform.push(item)
|
||||
}
|
||||
})
|
||||
},
|
||||
/*公告*/
|
||||
announcementList(){
|
||||
this.inform = []
|
||||
this.notic.forEach(item => {
|
||||
if (item.noticeType === '2') {
|
||||
this.inform.push(item)
|
||||
}
|
||||
})
|
||||
},
|
||||
/*阅读*/
|
||||
readMessage(notice){
|
||||
|
||||
readNotic(notice.noticeId).then(
|
||||
res=>{
|
||||
this. noticList()
|
||||
}
|
||||
)
|
||||
this.$router.push({ path: '/system/notice', query: { openDialog: 'true' ,noticeId: notice.noticeId} });
|
||||
},
|
||||
/*打开公告*/
|
||||
noticList() {
|
||||
noticList().then(
|
||||
res => {
|
||||
console.log(res)
|
||||
this.notic = res.data
|
||||
}
|
||||
)
|
||||
},
|
||||
toggleSideBar() {
|
||||
this.$store.dispatch('app/toggleSideBar')
|
||||
},
|
||||
|
@ -99,6 +255,7 @@ export default {
|
|||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar {
|
||||
height: 50px;
|
||||
|
@ -143,6 +300,7 @@ export default {
|
|||
outline: none;
|
||||
}
|
||||
|
||||
|
||||
.right-menu-item {
|
||||
display: inline-block;
|
||||
padding: 0 8px;
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import Cookies from 'js-cookie'
|
||||
import request from "@/utils/request";
|
||||
|
||||
const TokenKey = 'Admin-Token'
|
||||
|
||||
const ExpiresInKey = 'Admin-Expires-In'
|
||||
|
||||
|
||||
|
||||
export function getToken() {
|
||||
return Cookies.get(TokenKey)
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ service.interceptors.request.use(config => {
|
|||
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(res => {
|
||||
debugger
|
||||
|
||||
// 未设置状态码则默认成功状态
|
||||
const code = res.data.code || 200;
|
||||
// 获取错误信息
|
||||
|
|
|
@ -0,0 +1,246 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-container style="height: 80%; border: 1px solid #eee">
|
||||
<el-aside width="400px" style="background-color: rgb(238, 241, 246)">
|
||||
<el-menu @select="handleSelectdata">
|
||||
<el-submenu
|
||||
v-for="(item, index) in menuList"
|
||||
:key="index"
|
||||
:index="item.id"
|
||||
>
|
||||
<span slot="title" @click="handSubmenuTitle(item)">{{ item.name }}</span>
|
||||
<el-menu-item
|
||||
v-for="(database, dbIndex) in item.databaseList"
|
||||
:key="dbIndex"
|
||||
:index="item.id + '-' + (dbIndex + 1)"
|
||||
class="custom-menu-item"
|
||||
>
|
||||
<span>{{ database}}</span>
|
||||
<el-select
|
||||
clearable
|
||||
v-model="select[dbIndex]"
|
||||
style="margin-left: 10px"
|
||||
class="custom-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in tableList"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
{{item}}
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
|
||||
<el-container>
|
||||
<el-main>
|
||||
<el-card style="height: 500px">
|
||||
<el-container>
|
||||
<el-header style="height: 200px">
|
||||
<h1 style=" margin-top: -2px; font-size: 50px; text-align: center; width: 100%; font-weight: 600; line-height: 100px ">{{title}}--资产结构概述</h1>
|
||||
|
||||
<el-row style="margin-top: -50px" justify="center">
|
||||
<el-col :span="12">
|
||||
<el-card style="width: 80%;" class="centered-card"></el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-card style="width: 80%;" class="centered-card"></el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-header>
|
||||
<el-container>
|
||||
<el-aside width="200px">Aside</el-aside>
|
||||
<el-container>
|
||||
<el-main>Main</el-main>
|
||||
<el-footer>Footer</el-footer>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</el-container>
|
||||
<textarea v-model="selectSqlResp.sql" style="height: 400px;width: 100%">
|
||||
|
||||
</textarea>
|
||||
<el-button type="primary" @click="selectSql">查询</el-button>
|
||||
</el-card>
|
||||
<el-card style="height: 100%">
|
||||
|
||||
</el-card>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
listDetabase,
|
||||
selectDatabaseList,
|
||||
selectedDatabase,
|
||||
selectedDatabaseList,
|
||||
selectedMenu
|
||||
} from "@/api/detabase/detabase";
|
||||
|
||||
export default {
|
||||
name: 'Index',
|
||||
data() {
|
||||
const item = {
|
||||
date: '2016-05-02',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1518 弄'
|
||||
};
|
||||
return {
|
||||
tableData: Array(20).fill(item),
|
||||
menuList:[
|
||||
|
||||
],
|
||||
/*数据源查询条件*/
|
||||
queryParams: {},
|
||||
databaseList:[],
|
||||
tableList:[],
|
||||
select:[],
|
||||
selectSqlResp:{},
|
||||
title:''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
watch:{
|
||||
"select":{
|
||||
handler(val){
|
||||
val.forEach(item=>{
|
||||
if(item){
|
||||
this.selectSqlResp.tableName=item
|
||||
}
|
||||
})
|
||||
},
|
||||
deep:true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectSql(){
|
||||
console.log(this.selectSqlResp)
|
||||
},
|
||||
/*选中标题*/
|
||||
handSubmenuTitle(item){
|
||||
this.title=item.name
|
||||
let databaseConnect={};
|
||||
item.databaseList=[]
|
||||
databaseConnect.username=item.username;
|
||||
databaseConnect.password=item.password;
|
||||
databaseConnect.host=item.host;
|
||||
databaseConnect.type=item.type;
|
||||
selectDatabaseList(databaseConnect).then(
|
||||
res=>{
|
||||
/*所有数据库*/
|
||||
//item.databaseList=res.data
|
||||
res.data.forEach(item1=>{
|
||||
if(item1==item.databaseName){
|
||||
item.databaseList.push(item1)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
console.log(item)
|
||||
},
|
||||
/*选中下拉*/
|
||||
handleSelectdata(key){
|
||||
console.log(key)
|
||||
const [menuId, databaseIndex] = key.split('-').map(Number);
|
||||
console.log(menuId, databaseIndex)
|
||||
const selectedMenu = this.menuList.find(item => item.id == menuId);
|
||||
console.log(selectedMenu)
|
||||
if (selectedMenu) {
|
||||
const selectedDatabase = selectedMenu.databaseList[databaseIndex - 1];
|
||||
console.log(selectedDatabase);
|
||||
//根据selectedDatabase 名字 找下面包含的表
|
||||
let databaseConnect={};
|
||||
databaseConnect.username=selectedMenu.username;
|
||||
databaseConnect.password=selectedMenu.password;
|
||||
databaseConnect.host=selectedMenu.host;
|
||||
databaseConnect.port=selectedMenu.port;
|
||||
databaseConnect.type=selectedMenu.type;
|
||||
databaseConnect.tableName=selectedDatabase
|
||||
|
||||
console.log(databaseConnect)
|
||||
selectedDatabaseList(databaseConnect).then(
|
||||
res=>{
|
||||
this.tableList=res.data
|
||||
console.log(res.data)
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
/** 查询数据源列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDetabase(this.queryParams).then(response => {
|
||||
const menuListWithStringIds = response.data.rows.map(item => ({
|
||||
...item, // 复制对象的其他属性
|
||||
id: String(item.id),
|
||||
name: item.name,
|
||||
host: item.host,
|
||||
port: item.port,
|
||||
username: item.username,
|
||||
password: item.password,
|
||||
type: item.type,
|
||||
connectionParam: item.connectionParam,
|
||||
databaseName: item.databaseName,
|
||||
databaseList:[
|
||||
|
||||
]
|
||||
}));
|
||||
|
||||
this.menuList=menuListWithStringIds
|
||||
console.log(this.menuList)
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
.centered-card {
|
||||
display: flex;
|
||||
justify-content: center; /* 水平居中 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
flex-direction: column; /* 如果需要垂直堆叠内容 */
|
||||
}
|
||||
|
||||
.el-header {
|
||||
background-color: #B3C0D1;
|
||||
color: #333;
|
||||
line-height: 60px;
|
||||
}
|
||||
|
||||
.el-aside {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.custom-menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.custom-select {
|
||||
margin-left: 10px; /* 根据需要调整间距 */
|
||||
}
|
||||
|
||||
.el-header, .el-footer {
|
||||
background-color: white;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
line-height: 60px;
|
||||
}
|
||||
|
||||
|
||||
.el-main {
|
||||
background-color: #E9EEF3;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
line-height: 160px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,580 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="接入源名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入接入源名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据来源系统名称" prop="systemName">
|
||||
<el-input
|
||||
v-model="queryParams.systemName"
|
||||
placeholder="请输入数据来源系统名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="主机地址" prop="host">
|
||||
<el-input
|
||||
v-model="queryParams.host"
|
||||
placeholder="请输入主机地址"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据库名称" prop="databaseName">
|
||||
<el-input
|
||||
v-model="queryParams.databaseName"
|
||||
placeholder="请输入数据库名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据连接参数" prop="connectionParam">
|
||||
<el-input
|
||||
v-model="queryParams.connectionParam"
|
||||
placeholder="请输入数据连接参数"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="初始连接数量" prop="initNum">
|
||||
<el-input
|
||||
v-model="queryParams.initNum"
|
||||
placeholder="请输入初始连接数量"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="最大连接数量" prop="maxNum">
|
||||
<el-input
|
||||
v-model="queryParams.maxNum"
|
||||
placeholder="请输入最大连接数量"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="最大等待时间" prop="maxWaitTime">
|
||||
<el-input
|
||||
v-model="queryParams.maxWaitTime"
|
||||
placeholder="请输入最大等待时间"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="最大等待次数" prop="maxWaitSize">
|
||||
<el-input
|
||||
v-model="queryParams.maxWaitSize"
|
||||
placeholder="请输入最大等待次数"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['detabase:detabase:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['detabase:detabase:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['detabase:detabase:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['detabase:detabase:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="detabaseList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="数据源密码" align="center" prop="id" />
|
||||
<el-table-column label="接入源名称" align="center" prop="name" />
|
||||
<el-table-column label="数据来源系统名称" align="center" prop="systemName" />
|
||||
<el-table-column label="主机地址" align="center" prop="host" />
|
||||
<el-table-column label="主机端口" align="center" prop="port" />
|
||||
<el-table-column label="用户名" align="center" prop="username" />
|
||||
<el-table-column label="用户密码" align="center" prop="password" />
|
||||
<el-table-column label="数据接入类型" align="center" prop="type" />
|
||||
<el-table-column label="数据库名称" align="center" prop="databaseName" />
|
||||
<el-table-column label="数据连接参数" align="center" prop="connectionParam" />
|
||||
<el-table-column label="初始连接数量" align="center" prop="initNum" />
|
||||
<el-table-column label="最大连接数量" align="center" prop="maxNum" />
|
||||
<el-table-column label="最大等待时间" align="center" prop="maxWaitTime" />
|
||||
<el-table-column label="最大等待次数" align="center" prop="maxWaitSize" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="testContest(scope.row)"
|
||||
>测试连接</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['detabase:detabase:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['detabase:detabase:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改数据源对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
||||
<el-card>
|
||||
<div slot="header" class="clearfix">
|
||||
<span>基础配置信息</span>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="接入源名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入接入源名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="数据来源系统名称" prop="systemName">
|
||||
<el-input v-model="form.systemName" placeholder="请输入数据来源系统名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row >
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="form.username" placeholder="请输入用户名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入用户密码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="主机地址" prop="host">
|
||||
<el-input v-model="form.host" placeholder="请输入主机地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="主机端口" prop="port">
|
||||
<el-input v-model="form.port" placeholder="请输入主机端口" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="数据接入类型" prop="type">
|
||||
<el-select style="width: 100%" v-model="form.type">
|
||||
<el-option label="MySql" value="MySql">MySql</el-option>
|
||||
<el-option label="Oracle" value="Oracle">Oracle</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="数据库名称" prop="databaseName">
|
||||
<el-select v-model="form.databaseName" placeholder="请选择数据库名称">
|
||||
<el-option
|
||||
v-for="item in databaseList"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
{{item}}
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-card>
|
||||
<div slot="header" class="clearfix">
|
||||
<span>数据连接参数</span>
|
||||
</div>
|
||||
<el-col :sm="24">
|
||||
<el-form-item label="数据连接参数" prop="connectionParam">
|
||||
<el-input v-model="form.connectionParam" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-row :gutter="10" style="margin: 10px 0">
|
||||
<el-col :span="2">
|
||||
<el-button type="primary" @click="addParam()">新增参数</el-button>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button type="danger" @click="deleteParam(null)">清空参数</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-col :md="8" :xs="12" style="margin: 10px 0" v-for="(dataSourceParam, dataSourceParamIndex) in dataSourceParamList">
|
||||
<el-col :span="10">
|
||||
<el-input v-model="dataSourceParam.name" placeholder="请输入参数键" @keyup.native="processParam"/>
|
||||
</el-col>
|
||||
<el-col :span="1"><span style="font-size: 28px; margin: 0 3px 0 0;">:</span></el-col>
|
||||
<el-col :span="10">
|
||||
<el-input v-model="dataSourceParam.val" placeholder="请输入参数值" @keyup.native="processParam"/>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-button type="danger" @click="deleteParam(dataSourceParamIndex)">删除</el-button>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 20px">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>连接池配置</span>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="初始连接数量" prop="initNum">
|
||||
<el-input v-model="form.initNum" placeholder="请输入初始连接数量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="最大连接数量" prop="maxNum">
|
||||
<el-input v-model="form.maxNum" placeholder="请输入最大连接数量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="最大等待时间" prop="maxWaitTime">
|
||||
<el-input v-model="form.maxWaitTime" placeholder="请输入最大等待时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="最大等待次数" prop="maxWaitSize">
|
||||
<el-input v-model="form.maxWaitSize" placeholder="请输入最大等待次数" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin-top: 20px">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>其他信息</span>
|
||||
</div>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-card>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listDetabase,
|
||||
getDetabase,
|
||||
delDetabase,
|
||||
addDetabase,
|
||||
updateDetabase,
|
||||
testConnection, selectDatabaseList
|
||||
} from "@/api/detabase/detabase";
|
||||
|
||||
export default {
|
||||
name: "Detabase",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 数据源表格数据
|
||||
detabaseList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
systemName: null,
|
||||
host: null,
|
||||
type: null,
|
||||
databaseName: null,
|
||||
connectionParam: null,
|
||||
initNum: null,
|
||||
maxNum: null,
|
||||
maxWaitTime: null,
|
||||
maxWaitSize: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "数据源密码不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
dataSourceParamList: [
|
||||
{
|
||||
name: null,
|
||||
val: null
|
||||
}
|
||||
],
|
||||
/*数据库名称列表*/
|
||||
databaseList:[]
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
"form.type":{
|
||||
handler(){
|
||||
this.checkDatabaseList();
|
||||
},
|
||||
deep:true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.processParam()
|
||||
},
|
||||
methods: {
|
||||
/*监测*/
|
||||
checkDatabaseList(){
|
||||
if( this.form.username && this.form.password && this.form.host && this.form.type){
|
||||
let databaseConnect={};
|
||||
databaseConnect.username=this.form.username;
|
||||
databaseConnect.password=this.form.password;
|
||||
databaseConnect.host=this.form.host;
|
||||
databaseConnect.type=this.form.type;
|
||||
console.log(databaseConnect)
|
||||
selectDatabaseList(databaseConnect).then(
|
||||
res=>{
|
||||
console.log(res.data)
|
||||
this.databaseList=res.data
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
// 新增参数
|
||||
addParam(){
|
||||
this.dataSourceParamList.push({
|
||||
name: null,
|
||||
val: null
|
||||
})
|
||||
},
|
||||
//删除参数
|
||||
deleteParam(index){
|
||||
console.log(index)
|
||||
if(index==null){
|
||||
this.dataSourceParamList=[]
|
||||
}else{
|
||||
this.dataSourceParamList.splice(index,1)
|
||||
}
|
||||
this.processParam()
|
||||
},
|
||||
// 处理参数
|
||||
processParam(){
|
||||
this.form.connectionParam=this.dataSourceParamList
|
||||
.filter(item=>item.name!=null || item.val!=null)
|
||||
.map(item=>{
|
||||
return item.name+"="+item.val
|
||||
}).join("&")
|
||||
console.log(this.form.connectionParam)
|
||||
},
|
||||
/** 查询数据源列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDetabase(this.queryParams).then(response => {
|
||||
this.detabaseList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
systemName: null,
|
||||
host: null,
|
||||
type: null,
|
||||
databaseName: null,
|
||||
connectionParam: null,
|
||||
initNum: null,
|
||||
maxNum: null,
|
||||
maxWaitTime: null,
|
||||
maxWaitSize: null,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加数据源";
|
||||
},
|
||||
/*测试连接*/
|
||||
testContest(row){
|
||||
let params = {}
|
||||
params.host=row.host
|
||||
params.port=row.port
|
||||
params.username=row.username
|
||||
params.password=row.password
|
||||
params.connectionParam=row.connectionParam
|
||||
params.databaseName=row.databaseName
|
||||
params.type=row.type
|
||||
console.log(params)
|
||||
testConnection(params).then(
|
||||
res=>{
|
||||
this.$message.success(res.data)
|
||||
}
|
||||
)
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate: function (row) {
|
||||
this.reset();
|
||||
this.form = row
|
||||
this.dataSourceParamList = [];
|
||||
this.form.connectionParam.split("&").forEach(param => {
|
||||
var split = param.split("=");
|
||||
this.dataSourceParamList.push({
|
||||
name: split[0],
|
||||
val: split[1]
|
||||
})
|
||||
})
|
||||
const id = row.id || this.ids
|
||||
getDetabase(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改数据源";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateDetabase(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addDetabase(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除数据源编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delDetabase(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('detabase/detabase/export', {
|
||||
...this.queryParams
|
||||
}, `detabase_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -77,7 +77,8 @@ export default {
|
|||
// 查询参数
|
||||
queryParams: {
|
||||
ipaddr: undefined,
|
||||
userName: undefined
|
||||
userName: undefined,
|
||||
name:undefined,
|
||||
}
|
||||
};
|
||||
},
|
||||
|
@ -113,7 +114,8 @@ export default {
|
|||
this.$modal.msgSuccess("强退成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -311,6 +311,7 @@ export default {
|
|||
refreshTable: true,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
parentId: 0,
|
||||
menuName: undefined,
|
||||
visible: undefined
|
||||
},
|
||||
|
@ -342,6 +343,7 @@ export default {
|
|||
getList() {
|
||||
this.loading = true;
|
||||
listMenu(this.queryParams).then(response => {
|
||||
console.log(response)
|
||||
this.menuList = this.handleTree(response.data, "menuId");
|
||||
this.loading = false;
|
||||
});
|
||||
|
|
|
@ -99,6 +99,13 @@
|
|||
</el-table-column>
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="noticDetail(scope.row)"
|
||||
>查看详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['system:notice:edit']"
|
||||
icon="el-icon-edit"
|
||||
|
@ -128,17 +135,17 @@
|
|||
/>
|
||||
|
||||
<!-- 添加或修改公告对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" append-to-body width="780px">
|
||||
<el-dialog :title="title" :visible.sync="open" append-to-body width="780px" class="dialog" >
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="公告标题" prop="noticeTitle">
|
||||
<el-input v-model="form.noticeTitle" placeholder="请输入公告标题"/>
|
||||
<el-input :disabled="isTitleDisabled" v-model="form.noticeTitle" placeholder="请输入公告标题"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="公告类型" prop="noticeType">
|
||||
<el-select v-model="form.noticeType" placeholder="请选择公告类型">
|
||||
<el-select :disabled="isTitleDisabled" v-model="form.noticeType" placeholder="请选择公告类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_notice_type"
|
||||
:key="dict.value"
|
||||
|
@ -150,7 +157,7 @@
|
|||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio-group :disabled="isTitleDisabled" v-model="form.status">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.sys_notice_status"
|
||||
:key="dict.value"
|
||||
|
@ -160,11 +167,94 @@
|
|||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="form.noticeType==='2' && title !== '公告详情'">
|
||||
<el-form-item label="公告时间">
|
||||
<el-date-picker
|
||||
v-model="form.startTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
-
|
||||
<el-date-picker
|
||||
v-model="form.endTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="内容">
|
||||
<editor v-model="form.noticeContent" :min-height="192"/>
|
||||
<editor v-model="form.noticeContent" :min-height="50"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="form.noticeType==='1' && title !== '公告详情'">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="通知人员">
|
||||
<div class="block">
|
||||
<el-cascader
|
||||
placeholder="试试搜索:指南"
|
||||
:options="dept"
|
||||
value="id"
|
||||
show-all-levels:true
|
||||
@change="handleChange"
|
||||
:props="{ multiple: true }"
|
||||
filterable></el-cascader>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="cities.length>0">
|
||||
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选
|
||||
</el-checkbox>
|
||||
<div style="margin: 15px 0;"></div>
|
||||
<el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
|
||||
<el-checkbox v-for="city in cities"
|
||||
:label="city"
|
||||
:key="city"
|
||||
:value="city">
|
||||
{{ city }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if=" title === '公告详情'">
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<div>
|
||||
<el-statistic title="总通知">
|
||||
<template slot="formatter">
|
||||
{{ read.totalNum }}
|
||||
</template>
|
||||
</el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<div>
|
||||
<el-statistic title="已阅读">
|
||||
<template slot="formatter">
|
||||
{{ read.readEd }}
|
||||
</template>
|
||||
</el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<div>
|
||||
<el-statistic title="未阅读">
|
||||
<template slot="formatter">
|
||||
{{ read.noRead }}
|
||||
</template>
|
||||
</el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
@ -176,8 +266,20 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {addNotice, delNotice, getNotice, listNotice, updateNotice} from "@/api/system/notice";
|
||||
import {
|
||||
addNotice,
|
||||
delNotice,
|
||||
getNotice,
|
||||
listNotice,
|
||||
noticList,
|
||||
noticListDetail,
|
||||
updateNotice
|
||||
} from "@/api/system/notice";
|
||||
import {listDept} from "@/api/system/dept";
|
||||
import {listUser} from "@/api/system/user";
|
||||
import {listPost} from "@/api/system/post";
|
||||
|
||||
const cityOptions = ['上海', '北京', '广州', '深圳'];
|
||||
export default {
|
||||
name: "Notice",
|
||||
dicts: ['sys_notice_status', 'sys_notice_type'],
|
||||
|
@ -210,7 +312,16 @@ export default {
|
|||
status: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
form: {
|
||||
userNames: "",
|
||||
createBy: "",
|
||||
},
|
||||
/*阅读量*/
|
||||
read:{
|
||||
totalNum: 2,
|
||||
readEd: 2,
|
||||
noRead: 2,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
noticeTitle: [
|
||||
|
@ -219,13 +330,148 @@ export default {
|
|||
noticeType: [
|
||||
{required: true, message: "公告类型不能为空", trigger: "change"}
|
||||
]
|
||||
},
|
||||
dept: [],
|
||||
//多选
|
||||
options: [],
|
||||
/*用户查询参数*/
|
||||
userListFind: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
userName: undefined,
|
||||
phonenumber: undefined,
|
||||
status: undefined,
|
||||
deptId: undefined
|
||||
},
|
||||
// 日期范围
|
||||
dateRange: [],
|
||||
/*多选*/
|
||||
checkAll: false,
|
||||
checkedCities: [],
|
||||
cities: [],
|
||||
isIndeterminate: true,
|
||||
/*详情*/
|
||||
noticDetail(row) {
|
||||
/*公告已阅读*/
|
||||
noticListDetail().then(
|
||||
res => {
|
||||
res.data.forEach(item => {
|
||||
if(item.noticeId === row.noticeId){
|
||||
this.read.readEd=item.readNum;
|
||||
this.read.totalNum=item.totalNum;
|
||||
this.read.noRead=item.totalNum-item.readNum;
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
this.reset();
|
||||
const noticeId = row.noticeId || this.ids
|
||||
getNotice(noticeId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "公告详情";
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDeptList();
|
||||
const shouldOpenDialog = this.$route.query.openDialog === 'true';
|
||||
const noticeId = this.$route.query.noticeId
|
||||
if (shouldOpenDialog) {
|
||||
/*公告已阅读*/
|
||||
noticListDetail().then(
|
||||
res => {
|
||||
res.data.forEach(item => {
|
||||
if(item.noticeId ===noticeId){
|
||||
this.read.readEd=item.readNum;
|
||||
this.read.totalNum=item.totalNum;
|
||||
this.read.noRead=item.totalNum-item.readNum;
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
this.reset();
|
||||
getNotice(noticeId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "公告详情";
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
isTitleDisabled() {
|
||||
return this.title === '公告详情';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
/*多选框*/
|
||||
handleCheckAllChange(val) {
|
||||
this.checkedCities = val ? this.cities : [];
|
||||
this.isIndeterminate = false;
|
||||
},
|
||||
handleCheckedCitiesChange(value) {
|
||||
let userNames = "";
|
||||
let checkedCount = value.length;
|
||||
this.checkAll = checkedCount === this.cities.length;
|
||||
this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
|
||||
userNames += "," + value + ",";
|
||||
//去掉最后一个,号
|
||||
userNames = userNames.substring(1, userNames.length - 1);
|
||||
this.form.userNames = userNames;
|
||||
|
||||
},
|
||||
getDeptList() {
|
||||
this.loading = true;
|
||||
listDept(this.queryParams).then(response => {
|
||||
this.options = this.handleTree(response.data, "deptId");
|
||||
// 递归函数,用于转换children的格式
|
||||
function convertChildren(item) {
|
||||
return {
|
||||
id: item.deptId,
|
||||
value: item.deptId,
|
||||
label: item.deptName,
|
||||
children: item.children && item.children.length > 0? item.children.map(convertChildren) : undefined
|
||||
};
|
||||
}
|
||||
|
||||
// 转换整个options数组
|
||||
const data = this.options.map(convertChildren);
|
||||
this.dept = data;
|
||||
})
|
||||
},
|
||||
/*选中特定人员tab框*/
|
||||
handleChange(val) {
|
||||
const userList1 = [];
|
||||
console.log(val)
|
||||
const lastNumbers = val.map(array => {
|
||||
// 过滤掉 Observer 对象,只保留数字
|
||||
const filteredArray = array.filter(item => typeof item === 'number');
|
||||
// 获取最后一个数字
|
||||
return filteredArray[filteredArray.length - 1];
|
||||
});
|
||||
const promises = lastNumbers.map(item => {
|
||||
this.userListFind.deptId = item;
|
||||
return listUser(this.addDateRange(this.userListFind, this.dateRange)).then(response => {
|
||||
console.log(response)
|
||||
if (response.data.rows.length > 0) {
|
||||
response.data.rows.forEach(item => {
|
||||
userList1.push(
|
||||
item.userName
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.cities = userList1;
|
||||
|
||||
|
||||
},
|
||||
/** 查询公告列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
@ -294,6 +540,7 @@ export default {
|
|||
this.getList();
|
||||
});
|
||||
} else {
|
||||
console.log(this.form)
|
||||
addNotice(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
|
@ -317,3 +564,4 @@ export default {
|
|||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -374,6 +374,7 @@ import {
|
|||
import {getToken} from "@/utils/auth";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import {findTokenId, forceLogout} from "@/api/monitor/online";
|
||||
|
||||
export default {
|
||||
name: "User",
|
||||
|
@ -478,6 +479,12 @@ export default {
|
|||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
/*强退*/
|
||||
tokenParams: {
|
||||
ipaddr: undefined,
|
||||
userName: undefined,
|
||||
name:undefined,
|
||||
}
|
||||
};
|
||||
},
|
||||
|
@ -551,7 +558,7 @@ export default {
|
|||
status: "0",
|
||||
remark: undefined,
|
||||
postIds: [],
|
||||
roleIds: []
|
||||
roleIds: [],
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
@ -615,6 +622,15 @@ export default {
|
|||
},
|
||||
/** 重置密码按钮操作 */
|
||||
handleResetPwd(row) {
|
||||
let tokenId="";
|
||||
this.tokenParams.name=row.userName
|
||||
findTokenId(this.tokenParams).then(
|
||||
res=>{
|
||||
console.log(res.data)
|
||||
tokenId=res.data
|
||||
}
|
||||
)
|
||||
|
||||
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
|
@ -624,6 +640,10 @@ export default {
|
|||
}).then(({value}) => {
|
||||
resetUserPwd(row.userId, value).then(response => {
|
||||
this.$modal.msgSuccess("修改成功,新密码是:" + value);
|
||||
if(tokenId!==""){
|
||||
forceLogout(tokenId)
|
||||
}
|
||||
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: `http://localhost:8080`,
|
||||
target: `http://localhost:8081`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
|
Loading…
Reference in New Issue