mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-03 20:35:29 +08:00
JEECG-BOOT 2.0.2版本发布
This commit is contained in:
@ -0,0 +1,238 @@
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline">
|
||||
<a-row :gutter="24">
|
||||
<a-col :md="6" :sm="8">
|
||||
<a-form-item label="消息标题">
|
||||
<a-input placeholder="请输入消息标题" v-model="queryParam.esTitle"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="6" :sm="8">
|
||||
<a-form-item label="发送内容">
|
||||
<a-input placeholder="请输入发送内容" v-model="queryParam.esContent"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<template v-if="toggleSearchStatus">
|
||||
<a-col :md="6" :sm="8">
|
||||
<a-form-item label="接收人">
|
||||
<a-input placeholder="请输入接收人" v-model="queryParam.esReceiver"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</template>
|
||||
<a-col :md="6" :sm="8">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" v-show="show" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" v-show="show" icon="download" @click="handleExportXls('消息')">导出</a-button>
|
||||
<a-upload v-show="show" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
|
||||
@change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel">
|
||||
<a-icon type="delete"/>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作
|
||||
<a-icon type="down"/>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
|
||||
selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange">
|
||||
|
||||
<!-- 字符串超长截取省略号显示-->
|
||||
<span slot="esContent" slot-scope="text">
|
||||
<j-ellipsis :value="text" :length="10" />
|
||||
</span>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a href="javascript:;" @click="handleDetail(record)">详情</a>
|
||||
<a-divider type="vertical"/>
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多<a-icon type="down"/></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item v-show="show">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
<!-- table区域-end -->
|
||||
|
||||
<!-- 表单区域 -->
|
||||
<sysMessage-modal ref="modalForm" @ok="modalFormOk"></sysMessage-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SysMessageModal from './modules/SysMessageModal'
|
||||
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
|
||||
import JEllipsis from "@/components/jeecg/JEllipsis";
|
||||
|
||||
export default {
|
||||
name: "SysMessageList",
|
||||
mixins: [JeecgListMixin],
|
||||
components: {
|
||||
JEllipsis,
|
||||
SysMessageModal
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
description: '消息管理页面',
|
||||
// 新增修改按钮是否显示
|
||||
show: false,
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key: 'rowIndex',
|
||||
width: 60,
|
||||
align: "center",
|
||||
customRender: function (t, r, index) {
|
||||
return parseInt(index) + 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '消息标题',
|
||||
align: "center",
|
||||
dataIndex: 'esTitle'
|
||||
},
|
||||
{
|
||||
title: '发送内容',
|
||||
align: "center",
|
||||
dataIndex: 'esContent',
|
||||
scopedSlots: {customRender: 'esContent'},
|
||||
},
|
||||
{
|
||||
title: '接收人',
|
||||
align: "center",
|
||||
dataIndex: 'esReceiver'
|
||||
},
|
||||
{
|
||||
title: '发送次数',
|
||||
align: "center",
|
||||
dataIndex: 'esSendNum'
|
||||
},
|
||||
{
|
||||
title: '发送状态',
|
||||
align: 'center',
|
||||
dataIndex: 'esSendStatus_dictText'
|
||||
},
|
||||
{
|
||||
title: '发送时间',
|
||||
align: "center",
|
||||
dataIndex: 'esSendTime'
|
||||
},
|
||||
{
|
||||
title: '发送方式',
|
||||
align: 'center',
|
||||
dataIndex: 'esType_dictText'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: "center",
|
||||
scopedSlots: {customRender: 'action'},
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/message/sysMessage/list",
|
||||
delete: "/message/sysMessage/delete",
|
||||
deleteBatch: "/message/sysMessage/deleteBatch",
|
||||
exportXlsUrl: "message/sysMessage/exportXls",
|
||||
importExcelUrl: "message/sysMessage/importExcel",
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function () {
|
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
/** Button按钮间距 */
|
||||
.ant-btn {
|
||||
margin-left: 3px
|
||||
}
|
||||
|
||||
.ant-card-body .table-operator {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.ant-table-tbody .ant-table-row td {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.anty-row-operator button {
|
||||
margin: 0 5px
|
||||
}
|
||||
|
||||
.ant-btn-danger {
|
||||
background-color: #ffffff
|
||||
}
|
||||
|
||||
.ant-modal-cust-warp {
|
||||
height: 100%
|
||||
}
|
||||
|
||||
.ant-modal-cust-warp .ant-modal-body {
|
||||
height: calc(100% - 110px) !important;
|
||||
overflow-y: auto
|
||||
}
|
||||
|
||||
.ant-modal-cust-warp .ant-modal-content {
|
||||
height: 90% !important;
|
||||
overflow-y: hidden
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,250 @@
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline">
|
||||
<a-row :gutter="24">
|
||||
|
||||
<a-col :md="6" :sm="8">
|
||||
<a-form-item label="模板CODE">
|
||||
<a-input placeholder="请输入模板CODE" v-model="queryParam.templateCode"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="6" :sm="8">
|
||||
<a-form-item label="模板内容">
|
||||
<a-input placeholder="请输入模板内容" v-model="queryParam.templateContent"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<template v-if="toggleSearchStatus">
|
||||
<a-col :md="6" :sm="8">
|
||||
<a-form-item label="模板标题">
|
||||
<a-input placeholder="请输入模板标题" v-model="queryParam.templateName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="6" :sm="8">
|
||||
<a-form-item label="模板类型">
|
||||
<a-input placeholder="请输入模板类型" v-model="queryParam.templateType"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</template>
|
||||
<a-col :md="6" :sm="8">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('消息模板')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
|
||||
@change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel">
|
||||
<a-icon type="delete"/>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作
|
||||
<a-icon type="down"/>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
|
||||
selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange">
|
||||
|
||||
<!-- 字符串超长截取省略号显示-->
|
||||
<span slot="templateContent" slot-scope="text">
|
||||
<j-ellipsis :value="text" :length="25" />
|
||||
</span>
|
||||
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical"/>
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a @click="handleTest(record)">发送测试</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
<!-- table区域-end -->
|
||||
|
||||
<!-- 表单区域 -->
|
||||
<sysMessageTemplate-modal ref="modalForm" @ok="modalFormOk"></sysMessageTemplate-modal>
|
||||
|
||||
<sysMessageTest-modal ref="testModal"></sysMessageTest-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SysMessageTemplateModal from './modules/SysMessageTemplateModal'
|
||||
import SysMessageTestModal from './modules/SysMessageTestModal'
|
||||
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
|
||||
import JEllipsis from "@/components/jeecg/JEllipsis";
|
||||
|
||||
export default {
|
||||
name: "SysMessageTemplateList",
|
||||
mixins: [JeecgListMixin],
|
||||
components: {
|
||||
JEllipsis,
|
||||
SysMessageTemplateModal,
|
||||
SysMessageTestModal
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
description: '消息模板管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key: 'rowIndex',
|
||||
width: 60,
|
||||
align: "center",
|
||||
customRender: function (t, r, index) {
|
||||
return parseInt(index) + 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '模板CODE',
|
||||
align: "center",
|
||||
dataIndex: 'templateCode'
|
||||
},
|
||||
{
|
||||
title: '模板标题',
|
||||
align: "center",
|
||||
dataIndex: 'templateName'
|
||||
},
|
||||
{
|
||||
title: '模板内容',
|
||||
align: "center",
|
||||
dataIndex: 'templateContent',
|
||||
scopedSlots: {customRender: 'templateContent'},
|
||||
},
|
||||
{
|
||||
title: '模板类型',
|
||||
align: "center",
|
||||
dataIndex: 'templateType',
|
||||
customRender: function (text) {
|
||||
if(text=='1') {
|
||||
return "短信";
|
||||
}
|
||||
if(text=='2') {
|
||||
return "邮件";
|
||||
}
|
||||
if(text=='3') {
|
||||
return "微信";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: "center",
|
||||
scopedSlots: {customRender: 'action'},
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/message/sysMessageTemplate/list",
|
||||
delete: "/message/sysMessageTemplate/delete",
|
||||
deleteBatch: "/message/sysMessageTemplate/deleteBatch",
|
||||
exportXlsUrl: "message/sysMessageTemplate/exportXls",
|
||||
importExcelUrl: "message/sysMessageTemplate/importExcel",
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function () {
|
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleTest(record){
|
||||
this.$refs.testModal.open(record);
|
||||
this.$refs.testModal.title = "发送测试";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
/** Button按钮间距 */
|
||||
.ant-btn {
|
||||
margin-left: 3px
|
||||
}
|
||||
|
||||
.ant-card-body .table-operator {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.ant-table-tbody .ant-table-row td {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.anty-row-operator button {
|
||||
margin: 0 5px
|
||||
}
|
||||
|
||||
.ant-btn-danger {
|
||||
background-color: #ffffff
|
||||
}
|
||||
|
||||
.ant-modal-cust-warp {
|
||||
height: 100%
|
||||
}
|
||||
|
||||
.ant-modal-cust-warp .ant-modal-body {
|
||||
height: calc(100% - 110px) !important;
|
||||
overflow-y: auto
|
||||
}
|
||||
|
||||
.ant-modal-cust-warp .ant-modal-content {
|
||||
height: 90% !important;
|
||||
overflow-y: hidden
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,185 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
:maskClosable="true"
|
||||
width=650
|
||||
placement="right"
|
||||
:closable="true"
|
||||
@close="close"
|
||||
:visible="visible"
|
||||
style="height: calc(100% - 55px);overflow: auto;padding-bottom: 53px;">
|
||||
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="消息标题">
|
||||
<a-input placeholder="请输入消息标题" v-decorator="['esTitle', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="发送内容">
|
||||
<a-input placeholder="请输入发送内容" v-decorator="['esContent', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="发送所需参数">
|
||||
<a-input placeholder="请输入发送所需参数Json格式" v-decorator="['esParam', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="接收人">
|
||||
<a-input placeholder="请输入接收人" v-decorator="['esReceiver', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="发送方式">
|
||||
<j-dict-select-tag :triggerChange="true" dictCode="msgType" v-decorator="[ 'esType', {}]" placeholder="请选择发送方式">
|
||||
</j-dict-select-tag>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="发送时间">
|
||||
<a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ 'esSendTime', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="发送状态">
|
||||
<j-dict-select-tag :triggerChange="true" dictCode="msgSendStatus" v-decorator="[ 'esSendStatus', {}]" placeholder="请选择发送状态">
|
||||
</j-dict-select-tag>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="发送次数">
|
||||
<a-input-number v-decorator="[ 'esSendNum', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="发送失败原因">
|
||||
<a-input v-decorator="['esResult', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="备注">
|
||||
<a-input v-decorator="['remark', {}]"/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
<div v-show="!disableSubmit">
|
||||
<a-button style="margin-right: .8rem" @confirm="handleCancel">取消</a-button>
|
||||
<a-button @click="handleOk" type="primary" :loading="confirmLoading">提交</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {httpAction} from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import moment from "moment"
|
||||
|
||||
export default {
|
||||
name: "SysMessageModal",
|
||||
data() {
|
||||
return {
|
||||
title: "操作",
|
||||
visible: false,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 5},
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 16},
|
||||
},
|
||||
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
validatorRules: {},
|
||||
disableSubmit: true,
|
||||
url: {
|
||||
add: "/message/sysMessage/add",
|
||||
edit: "/message/sysMessage/edit",
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
add() {
|
||||
this.edit({});
|
||||
},
|
||||
edit(record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'esContent', 'esParam', 'esReceiver', 'esResult', 'esSendNum', 'esSendStatus', 'esTitle', 'esType', 'remark'))
|
||||
//时间格式化
|
||||
this.form.setFieldsValue({esSendTime: this.model.esSendTime ? moment(this.model.esSendTime) : null})
|
||||
});
|
||||
|
||||
},
|
||||
close() {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk() {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if (!this.model.id) {
|
||||
httpurl += this.url.add;
|
||||
method = 'post';
|
||||
} else {
|
||||
httpurl += this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
let formData = Object.assign(this.model, values);
|
||||
//时间格式化
|
||||
formData.esSendTime = formData.esSendTime ? formData.esSendTime.format('YYYY-MM-DD HH:mm:ss') : null;
|
||||
|
||||
console.log(formData)
|
||||
httpAction(httpurl, formData, method).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel() {
|
||||
this.close()
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="模板CODE">
|
||||
<a-input
|
||||
:disabled="disable"
|
||||
placeholder="请输入模板编码"
|
||||
v-decorator="['templateCode', validatorRules.templateCode ]"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="模板标题">
|
||||
<a-input
|
||||
placeholder="请输入模板标题"
|
||||
v-decorator="['templateName', validatorRules.templateName]"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="模板类型">
|
||||
<j-dict-select-tag @change="handleChangeTemplateType" :triggerChange="true" dictCode="msgType" v-decorator="['templateType', validatorRules.templateType ]" placeholder="请选择模板类型">
|
||||
</j-dict-select-tag>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
v-show="!useEditor"
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="模板内容">
|
||||
<a-textarea placeholder="请输入模板内容" v-decorator="['templateContent', validatorRules.templateContent ]" :autosize="{ minRows: 8, maxRows: 8 }" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
v-show="useEditor"
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="模板内容">
|
||||
<j-editor v-model="templateEditorContent"></j-editor>
|
||||
</a-form-item>
|
||||
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {httpAction} from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import { duplicateCheck } from '@/api/api'
|
||||
import JEditor from '@/components/jeecg/JEditor'
|
||||
|
||||
export default {
|
||||
name: "SysMessageTemplateModal",
|
||||
components:{
|
||||
JEditor
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: "操作",
|
||||
visible: false,
|
||||
disable: true,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 5},
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 16},
|
||||
},
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
validatorRules: {
|
||||
templateCode: {rules: [{required: true, message: '请输入模板CODE!' },{validator: this.validateTemplateCode}]},
|
||||
templateName: {rules: [{required: true, message: '请输入模板标题!'}]},
|
||||
templateContent: {rules: []},
|
||||
templateType: {rules: [{required: true, message: '请输入模板类型!'}]},
|
||||
},
|
||||
url: {
|
||||
add: "/message/sysMessageTemplate/add",
|
||||
edit: "/message/sysMessageTemplate/edit",
|
||||
},
|
||||
useEditor:false,
|
||||
templateEditorContent:""
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
add() {
|
||||
this.disable = false;
|
||||
this.edit({});
|
||||
},
|
||||
edit(record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.useEditor = (record.templateType==2)
|
||||
if(this.useEditor){
|
||||
this.templateEditorContent=record.templateContent
|
||||
}else{
|
||||
this.templateEditorContent=''
|
||||
}
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
if(this.useEditor){
|
||||
this.form.setFieldsValue(pick(this.model, 'templateCode', 'templateName', 'templateTestJson', 'templateType'))
|
||||
}else{
|
||||
this.form.setFieldsValue(pick(this.model, 'templateCode', 'templateContent', 'templateName', 'templateTestJson', 'templateType'))
|
||||
}
|
||||
});
|
||||
},
|
||||
close() {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
this.disable = true;
|
||||
},
|
||||
handleOk() {
|
||||
this.model.templateType = this.templateType;
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if (!this.model.id) {
|
||||
httpurl += this.url.add;
|
||||
method = 'post';
|
||||
} else {
|
||||
httpurl += this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
let formData = Object.assign(this.model, values);
|
||||
//时间格式化
|
||||
|
||||
if(this.useEditor){
|
||||
formData.templateContent=this.templateEditorContent
|
||||
}
|
||||
console.log(formData)
|
||||
httpAction(httpurl, formData, method).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
validateTemplateCode(rule, value, callback){
|
||||
var params = {
|
||||
tableName: "sys_sms_template",
|
||||
fieldName: "template_code",
|
||||
fieldVal: value,
|
||||
dataId: this.model.id
|
||||
}
|
||||
duplicateCheck(params).then((res)=>{
|
||||
if(res.success){
|
||||
callback();
|
||||
}else{
|
||||
callback(res.message);
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
handleCancel() {
|
||||
this.close()
|
||||
},
|
||||
handleChangeTemplateType(value){
|
||||
//如果是邮件类型那么则改变模板内容是富文本编辑器
|
||||
this.useEditor = value==2
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="模板标题">
|
||||
<a-input disabled v-model="templateName"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="模板内容">
|
||||
<a-textarea disabled v-model="templateContent" :autosize="{ minRows: 5, maxRows: 8 }"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="测试数据">
|
||||
<a-textarea placeholder="请输入json格式测试数据" v-model="testData" :autosize="{ minRows: 5, maxRows: 8 }"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="消息类型">
|
||||
<j-dict-select-tag
|
||||
v-model="msgType"
|
||||
placeholder="请选择消息类型"
|
||||
dictCode="msgType"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="消息接收方">
|
||||
<a-input placeholder="请输入消息接收方" v-model="receiver"/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {httpAction} from '@/api/manage'
|
||||
|
||||
export default {
|
||||
name: "SysMessageTestModal",
|
||||
data() {
|
||||
return {
|
||||
title: "操作",
|
||||
visible: false,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 5},
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 16},
|
||||
},
|
||||
|
||||
confirmLoading: false,
|
||||
url: {
|
||||
send: "/message/sysMessageTemplate/sendMsg",
|
||||
},
|
||||
templateName: "",
|
||||
templateContent: "",
|
||||
receiver: "",
|
||||
msgType: "",
|
||||
testData: "",
|
||||
sendParams: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(record) {
|
||||
this.sendParams.templateCode = record.templateCode;
|
||||
this.templateName = record.templateName;
|
||||
this.templateContent = record.templateContent;
|
||||
this.testData = record.templateTestJson;
|
||||
this.visible = true;
|
||||
},
|
||||
close() {
|
||||
this.receiver = "";
|
||||
this.msgType = "";
|
||||
this.sendParams = {};
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk() {
|
||||
let httpurl = this.url.send;
|
||||
let method = 'post';
|
||||
this.sendParams.testData = this.testData;
|
||||
this.sendParams.receiver = this.receiver;
|
||||
this.sendParams.msgType = this.msgType;
|
||||
httpAction(httpurl, this.sendParams, method).then((res) => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message);
|
||||
} else {
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false;
|
||||
this.close();
|
||||
})
|
||||
},
|
||||
handleCancel() {
|
||||
this.close()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<a-card title="磁盘监控">
|
||||
<a-row>
|
||||
<template v-if="diskInfo && diskInfo.length>0">
|
||||
<a-col :span="8" v-for="(item,index) in diskInfo" :key=" 'diskInfo'+index ">
|
||||
<dash-chart-demo :title="item.name" :datasource="item.restPPT"></dash-chart-demo>
|
||||
</a-col>
|
||||
</template>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction } from '@/api/manage'
|
||||
import DashChartDemo from '@/components/chart/DashChartDemo'
|
||||
import ARow from 'ant-design-vue/es/grid/Row'
|
||||
|
||||
export default {
|
||||
name: 'DiskMonitoring',
|
||||
components:{
|
||||
ARow,
|
||||
DashChartDemo,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
description: '磁盘监控',
|
||||
//数据集
|
||||
diskInfo:[],
|
||||
url:{
|
||||
queryDiskInfo:'actuator/redis/queryDiskInfo',
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
getAction(this.url.queryDiskInfo).then((res)=>{
|
||||
if(res.success){
|
||||
for(var i=0;i<res.result.length;i++){
|
||||
res.result[i].restPPT = res.result[i].restPPT/10;
|
||||
}
|
||||
this.diskInfo = res.result;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
148
ant-design-vue-jeecg/src/views/modules/monitor/HttpTrace.vue
Normal file
148
ant-design-vue-jeecg/src/views/modules/monitor/HttpTrace.vue
Normal file
@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
|
||||
<a-card :bordered="false" class="card-area">
|
||||
|
||||
<a-alert type="info" :showIcon="true">
|
||||
<div slot="message">
|
||||
共追踪到 {{ dataSource.length }} 条近期HTTP请求记录
|
||||
<a-divider type="vertical"/>
|
||||
<a @click="handleClickUpdate">立即刷新</a>
|
||||
</div>
|
||||
</a-alert>
|
||||
|
||||
<!-- 表格区域 -->
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="pagination"
|
||||
:loading="tableLoading"
|
||||
:scroll="{ x: 900 }"
|
||||
style="margin-top: 20px;"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="timeTaken" slot-scope="text">
|
||||
<a-tag v-if="text < 500" color="green">{{ text }} ms</a-tag>
|
||||
<a-tag v-else-if="text < 1000" color="cyan">{{ text }} ms</a-tag>
|
||||
<a-tag v-else-if="text < 1500" color="orange">{{ text }} ms</a-tag>
|
||||
<a-tag v-else color="red">{{ text }} ms</a-tag>
|
||||
</template>
|
||||
|
||||
<template slot="responseStatus" slot-scope="text">
|
||||
<a-tag v-if="text < 200" color="pink">{{ text }} </a-tag>
|
||||
<a-tag v-else-if="text < 201" color="green">{{ text }} </a-tag>
|
||||
<a-tag v-else-if="text < 399" color="cyan">{{ text }} </a-tag>
|
||||
<a-tag v-else-if="text < 403" color="orange">{{ text }} </a-tag>
|
||||
<a-tag v-else-if="text < 501" color="red">{{ text }} </a-tag>
|
||||
<span v-else>{{ text }}</span>
|
||||
</template>
|
||||
|
||||
<template slot="requestMethod" slot-scope="text">
|
||||
<a-tag v-if="text === 'GET'" color="#87d068">{{ text }}</a-tag>
|
||||
<a-tag v-else-if="text === 'POST'" color="#2db7f5">{{ text }}</a-tag>
|
||||
<a-tag v-else-if="text === 'PUT'" color="#ffba5a">{{ text }}</a-tag>
|
||||
<a-tag v-else-if="text === 'DELETE'" color="#f50">{{ text }}</a-tag>
|
||||
<span v-else>{{ text }} ms</span>
|
||||
</template>
|
||||
|
||||
</a-table>
|
||||
|
||||
</a-card>
|
||||
</a-skeleton>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
advanced: false,
|
||||
dataSource: [],
|
||||
pagination: {
|
||||
defaultPageSize: 10,
|
||||
defaultCurrent: 1,
|
||||
pageSizeOptions: ['10', '20', '30', '40', '100'],
|
||||
showQuickJumper: true,
|
||||
showSizeChanger: true,
|
||||
showTotal: (total, range) => `显示 ${range[0]} ~ ${range[1]} 条记录,共 ${total} 条记录`
|
||||
},
|
||||
loading: true,
|
||||
tableLoading: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
columns() {
|
||||
return [{
|
||||
title: '请求时间',
|
||||
dataIndex: 'timestamp',
|
||||
customRender(text) {
|
||||
return moment(text).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
}, {
|
||||
title: '请求方法',
|
||||
dataIndex: 'request.method',
|
||||
scopedSlots: { customRender: 'requestMethod' },
|
||||
filters: [
|
||||
{ text: 'GET', value: 'GET' },
|
||||
{ text: 'POST', value: 'POST' },
|
||||
{ text: 'PUT', value: 'PUT' },
|
||||
{ text: 'DELETE', value: 'DELETE' }
|
||||
],
|
||||
filterMultiple: true,
|
||||
onFilter: (value, record) => record.request.method.includes(value)
|
||||
}, {
|
||||
title: '请求URL',
|
||||
dataIndex: 'request.uri',
|
||||
customRender(text) {
|
||||
return text.split('?')[0]
|
||||
}
|
||||
}, {
|
||||
title: '响应状态',
|
||||
dataIndex: 'response.status',
|
||||
scopedSlots: { customRender: 'responseStatus' }
|
||||
}, {
|
||||
title: '请求耗时',
|
||||
dataIndex: 'timeTaken',
|
||||
scopedSlots: { customRender: 'timeTaken' }
|
||||
}]
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fetch()
|
||||
},
|
||||
methods: {
|
||||
|
||||
handleClickUpdate() {
|
||||
this.fetch()
|
||||
},
|
||||
|
||||
handleTableChange() {
|
||||
this.fetch()
|
||||
},
|
||||
|
||||
fetch() {
|
||||
this.tableLoading = true
|
||||
getAction('actuator/httptrace').then((data) => {
|
||||
let filterData = []
|
||||
for (let d of data.traces) {
|
||||
if (d.request.method !== 'OPTIONS' && d.request.uri.indexOf('httptrace') === -1) {
|
||||
filterData.push(d)
|
||||
}
|
||||
}
|
||||
this.dataSource = filterData
|
||||
}).catch((e) => {
|
||||
console.error(e)
|
||||
this.$message.error('获取HTTP信息失败')
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
this.tableLoading = false
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style></style>
|
||||
169
ant-design-vue-jeecg/src/views/modules/monitor/JvmInfo.vue
Normal file
169
ant-design-vue-jeecg/src/views/modules/monitor/JvmInfo.vue
Normal file
@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
|
||||
<a-card :bordered="false">
|
||||
|
||||
<a-alert type="info" :showIcon="true">
|
||||
<div slot="message">
|
||||
上次更新时间:{{ this.time }}
|
||||
<a-divider type="vertical"/>
|
||||
<a @click="handleClickUpdate">立即更新</a>
|
||||
</div>
|
||||
</a-alert>
|
||||
|
||||
<a-table
|
||||
rowKey="id"
|
||||
size="middle"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="false"
|
||||
:loading="tableLoading"
|
||||
style="margin-top: 20px;">
|
||||
|
||||
<template slot="param" slot-scope="text, record">
|
||||
<a-tag :color="textInfo[record.param].color">{{ text }}</a-tag>
|
||||
</template>
|
||||
|
||||
<template slot="text" slot-scope="text, record">
|
||||
{{ textInfo[record.param].text }}
|
||||
</template>
|
||||
|
||||
<template slot="value" slot-scope="text, record">
|
||||
{{ text }} {{ textInfo[record.param].unit }}
|
||||
</template>
|
||||
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-skeleton>
|
||||
</template>
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
time: '',
|
||||
loading: true,
|
||||
tableLoading: true,
|
||||
columns: [{
|
||||
title: '参数',
|
||||
width: '30%',
|
||||
dataIndex: 'param',
|
||||
scopedSlots: { customRender: 'param' }
|
||||
}, {
|
||||
title: '描述',
|
||||
width: '40%',
|
||||
dataIndex: 'text',
|
||||
scopedSlots: { customRender: 'text' }
|
||||
}, {
|
||||
title: '当前值',
|
||||
width: '30%',
|
||||
dataIndex: 'value',
|
||||
scopedSlots: { customRender: 'value' }
|
||||
}],
|
||||
dataSource: [],
|
||||
// 列表通过 textInfo 渲染出颜色、描述和单位
|
||||
textInfo: {
|
||||
'jvm.memory.max': { color: 'purple', text: 'JVM 最大内存', unit: 'MB' },
|
||||
'jvm.memory.committed': { color: 'purple', text: 'JVM 可用内存', unit: 'MB' },
|
||||
'jvm.memory.used': { color: 'purple', text: 'JVM 已用内存', unit: 'MB' },
|
||||
'jvm.buffer.memory.used': { color: 'cyan', text: 'JVM 缓冲区已用内存', unit: 'MB' },
|
||||
'jvm.buffer.count': { color: 'cyan', text: '当前缓冲区数量', unit: '个' },
|
||||
'jvm.threads.daemon': { color: 'green', text: 'JVM 守护线程数量', unit: '个' },
|
||||
'jvm.threads.live': { color: 'green', text: 'JVM 当前活跃线程数量', unit: '个' },
|
||||
'jvm.threads.peak': { color: 'green', text: 'JVM 峰值线程数量', unit: '个' },
|
||||
'jvm.classes.loaded': { color: 'orange', text: 'JVM 已加载 Class 数量', unit: '个' },
|
||||
'jvm.classes.unloaded': { color: 'orange', text: 'JVM 未加载 Class 数量', unit: '个' },
|
||||
'jvm.gc.memory.allocated': { color: 'pink', text: 'GC 时, 年轻代分配的内存空间', unit: 'MB' },
|
||||
'jvm.gc.memory.promoted': { color: 'pink', text: 'GC 时, 老年代分配的内存空间', unit: 'MB' },
|
||||
'jvm.gc.max.data.size': { color: 'pink', text: 'GC 时, 老年代的最大内存空间', unit: 'MB' },
|
||||
'jvm.gc.live.data.size': { color: 'pink', text: 'FullGC 时, 老年代的内存空间', unit: 'MB' },
|
||||
'jvm.gc.pause.count': { color: 'blue', text: '系统启动以来GC 次数', unit: '次' },
|
||||
'jvm.gc.pause.totalTime': { color: 'blue', text: '系统启动以来GC 总耗时', unit: '秒' }
|
||||
},
|
||||
// 当一条记录中需要取出多条数据的时候需要配置该字段
|
||||
moreInfo: {
|
||||
'jvm.gc.pause': ['.count', '.totalTime']
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadTomcatInfo()
|
||||
},
|
||||
methods: {
|
||||
|
||||
handleClickUpdate() {
|
||||
this.loadTomcatInfo()
|
||||
},
|
||||
|
||||
loadTomcatInfo() {
|
||||
this.tableLoading = true
|
||||
this.time = moment().format('YYYY年MM月DD日 HH时mm分ss秒')
|
||||
Promise.all([
|
||||
getAction('actuator/metrics/jvm.memory.max'),
|
||||
getAction('actuator/metrics/jvm.memory.committed'),
|
||||
getAction('actuator/metrics/jvm.memory.used'),
|
||||
getAction('actuator/metrics/jvm.buffer.memory.used'),
|
||||
getAction('actuator/metrics/jvm.buffer.count'),
|
||||
getAction('actuator/metrics/jvm.threads.daemon'),
|
||||
getAction('actuator/metrics/jvm.threads.live'),
|
||||
getAction('actuator/metrics/jvm.threads.peak'),
|
||||
getAction('actuator/metrics/jvm.classes.loaded'),
|
||||
getAction('actuator/metrics/jvm.classes.unloaded'),
|
||||
getAction('actuator/metrics/jvm.gc.memory.allocated'),
|
||||
getAction('actuator/metrics/jvm.gc.memory.promoted'),
|
||||
getAction('actuator/metrics/jvm.gc.max.data.size'),
|
||||
getAction('actuator/metrics/jvm.gc.live.data.size'),
|
||||
getAction('actuator/metrics/jvm.gc.pause')
|
||||
]).then((res) => {
|
||||
|
||||
let info = []
|
||||
res.forEach((value, id) => {
|
||||
let more = this.moreInfo[value.name]
|
||||
if (!(more instanceof Array)) {
|
||||
more = ['']
|
||||
}
|
||||
more.forEach((item, idx) => {
|
||||
let param = value.name + item
|
||||
let val = value.measurements[idx].value
|
||||
|
||||
if (param === 'jvm.memory.max'
|
||||
|| param === 'jvm.memory.committed'
|
||||
|| param === 'jvm.memory.used'
|
||||
|| param === 'jvm.buffer.memory.used'
|
||||
|| param === 'jvm.gc.memory.allocated'
|
||||
|| param === 'jvm.gc.memory.promoted'
|
||||
|| param === 'jvm.gc.max.data.size'
|
||||
|| param === 'jvm.gc.live.data.size'
|
||||
) {
|
||||
val = this.convert(val, Number)
|
||||
}
|
||||
info.push({ id: param + id, param, text: 'false value', value: val })
|
||||
})
|
||||
})
|
||||
this.dataSource = info
|
||||
|
||||
|
||||
}).catch((e) => {
|
||||
console.error(e)
|
||||
this.$message.error('获取JVM信息失败')
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
this.tableLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
convert(value, type) {
|
||||
if (type === Number) {
|
||||
return Number(value / 1048576).toFixed(3)
|
||||
} else if (type === Date) {
|
||||
return moment(value * 1000).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style></style>
|
||||
189
ant-design-vue-jeecg/src/views/modules/monitor/RedisInfo.vue
Normal file
189
ant-design-vue-jeecg/src/views/modules/monitor/RedisInfo.vue
Normal file
@ -0,0 +1,189 @@
|
||||
<template>
|
||||
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
|
||||
<a-card>
|
||||
<!-- Radis 信息实时监控 -->
|
||||
<a-row :gutter="8">
|
||||
<a-col :sm="24" :xl="12">
|
||||
<area-chart-ty v-bind="memory"/>
|
||||
</a-col>
|
||||
<a-col :sm="24" :xl="12">
|
||||
<area-chart-ty v-bind="key"/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<h3>Redis 详细信息</h3>
|
||||
<a-table
|
||||
:loading="tableLoading"
|
||||
:columns="columns"
|
||||
:dataSource="redisInfo"
|
||||
:pagination="false"/>
|
||||
|
||||
</a-card>
|
||||
</a-skeleton>
|
||||
</template>
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
import AreaChartTy from '@/components/chart/AreaChartTy'
|
||||
|
||||
export default {
|
||||
name: 'RedisInfo',
|
||||
components: {
|
||||
AreaChartTy
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
tableLoading: true,
|
||||
// 定时器ID
|
||||
timer: null,
|
||||
// 定时器周期
|
||||
millisec: 3000,
|
||||
// Key 实时数量
|
||||
key: {
|
||||
title: 'Radis Key 实时数量(个)',
|
||||
dataSource: [],
|
||||
y: '数量(个)',
|
||||
height: 340,
|
||||
min: 0,
|
||||
max: 100,
|
||||
color: '#FF6987',
|
||||
lineSize: 8,
|
||||
lineColor: '#DC143C'
|
||||
},
|
||||
// 内存实时占用情况
|
||||
memory: {
|
||||
title: 'Radis 内存实时占用情况(KB)',
|
||||
dataSource: [],
|
||||
y: '内存(KB)',
|
||||
min: 0,
|
||||
max: 3000,
|
||||
height: 340,
|
||||
lineSize: 8
|
||||
},
|
||||
redisInfo: [],
|
||||
columns: [{
|
||||
title: 'Key',
|
||||
align: 'center',
|
||||
dataIndex: 'key'
|
||||
}, {
|
||||
title: 'Description',
|
||||
align: 'left',
|
||||
dataIndex: 'description'
|
||||
}, {
|
||||
title: 'Value',
|
||||
align: 'center',
|
||||
dataIndex: 'value'
|
||||
}],
|
||||
url: {
|
||||
keysSize: '/actuator/redis/keysSize',
|
||||
memoryInfo: '/actuator/redis/memoryInfo',
|
||||
info: '/actuator/redis/info'
|
||||
},
|
||||
path: '/monitor/redis/info'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.openTimer()
|
||||
this.loadRedisInfo()
|
||||
setTimeout(() => {
|
||||
this.loadData()
|
||||
}, 1000)
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.closeTimer()
|
||||
},
|
||||
methods: {
|
||||
|
||||
/** 开启定时器 */
|
||||
openTimer() {
|
||||
this.loadData()
|
||||
this.closeTimer()
|
||||
this.timer = setInterval(() => {
|
||||
if (this.$route.path === this.path) {
|
||||
this.loadData()
|
||||
}
|
||||
}, this.millisec)
|
||||
},
|
||||
|
||||
/** 关闭定时器 */
|
||||
closeTimer() {
|
||||
if (this.timer) clearInterval(this.timer)
|
||||
},
|
||||
|
||||
/** 查询数据 */
|
||||
loadData() {
|
||||
Promise.all([
|
||||
getAction(this.url.keysSize),
|
||||
getAction(this.url.memoryInfo)
|
||||
]).then((res) => {
|
||||
let time = moment().format('hh:mm:ss')
|
||||
|
||||
let [{ dbSize: currentSize }, memoryInfo] = res
|
||||
let currentMemory = memoryInfo.used_memory / 1000
|
||||
|
||||
// push 数据
|
||||
this.key.dataSource.push({ x: time, y: currentSize })
|
||||
this.memory.dataSource.push({ x: time, y: currentMemory })
|
||||
// 最大长度为6
|
||||
if (this.key.dataSource.length > 6) {
|
||||
this.key.dataSource.splice(0, 1)
|
||||
this.memory.dataSource.splice(0, 1)
|
||||
}
|
||||
|
||||
// 计算 Key 最大最小值
|
||||
let keyPole = this.getMaxAndMin(this.key.dataSource, 'y')
|
||||
this.key.max = Math.floor(keyPole[0]) + 10
|
||||
this.key.min = Math.floor(keyPole[1]) - 10
|
||||
if (this.key.min < 0) this.key.min = 0
|
||||
|
||||
// 计算 Memory 最大最小值
|
||||
let memoryPole = this.getMaxAndMin(this.memory.dataSource, 'y')
|
||||
this.memory.max = Math.floor(memoryPole[0]) + 100
|
||||
this.memory.min = Math.floor(memoryPole[1]) - 100
|
||||
if (this.memory.min < 0) this.memory.min = 0
|
||||
|
||||
}).catch((e) => {
|
||||
console.error(e)
|
||||
this.closeTimer()
|
||||
this.$message.error('获取 Redis 信息失败')
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
// 获取一组数据中最大和最小的值
|
||||
getMaxAndMin(dataSource, field) {
|
||||
let maxValue = null, minValue = null
|
||||
dataSource.forEach(item => {
|
||||
let value = Number.parseInt(item[field])
|
||||
// max
|
||||
if (maxValue == null) {
|
||||
maxValue = value
|
||||
} else if (value > maxValue) {
|
||||
maxValue = value
|
||||
}
|
||||
// min
|
||||
if (minValue == null) {
|
||||
minValue = value
|
||||
} else if (value < minValue) {
|
||||
minValue = value
|
||||
}
|
||||
})
|
||||
return [maxValue, minValue]
|
||||
},
|
||||
|
||||
loadRedisInfo() {
|
||||
this.tableLoading = true
|
||||
getAction(this.url.info).then((res) => {
|
||||
this.redisInfo = res.result
|
||||
}).finally(() => {
|
||||
this.tableLoading = false
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style></style>
|
||||
@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>Redis终端</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'RedisTerminal'
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
137
ant-design-vue-jeecg/src/views/modules/monitor/SystemInfo.vue
Normal file
137
ant-design-vue-jeecg/src/views/modules/monitor/SystemInfo.vue
Normal file
@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
|
||||
<a-card :bordered="false">
|
||||
|
||||
<a-alert type="info" :showIcon="true">
|
||||
<div slot="message">
|
||||
上次更新时间:{{ this.time }}
|
||||
<a-divider type="vertical"/>
|
||||
<a @click="handleClickUpdate">立即更新</a>
|
||||
</div>
|
||||
</a-alert>
|
||||
|
||||
<a-table
|
||||
rowKey="id"
|
||||
size="middle"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="false"
|
||||
:loading="tableLoading"
|
||||
style="margin-top: 20px;">
|
||||
|
||||
<template slot="param" slot-scope="text, record">
|
||||
<a-tag :color="textInfo[record.param].color">{{ text }}</a-tag>
|
||||
</template>
|
||||
|
||||
<template slot="text" slot-scope="text, record">
|
||||
{{ textInfo[record.param].text }}
|
||||
</template>
|
||||
|
||||
<template slot="value" slot-scope="text, record">
|
||||
{{ text }} {{ textInfo[record.param].unit }}
|
||||
</template>
|
||||
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-skeleton>
|
||||
</template>
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
time: '',
|
||||
loading: true,
|
||||
tableLoading: true,
|
||||
columns: [{
|
||||
title: '参数',
|
||||
width: '30%',
|
||||
dataIndex: 'param',
|
||||
scopedSlots: { customRender: 'param' }
|
||||
}, {
|
||||
title: '描述',
|
||||
width: '40%',
|
||||
dataIndex: 'text',
|
||||
scopedSlots: { customRender: 'text' }
|
||||
}, {
|
||||
title: '当前值',
|
||||
width: '30%',
|
||||
dataIndex: 'value',
|
||||
scopedSlots: { customRender: 'value' }
|
||||
}],
|
||||
dataSource: [],
|
||||
// 列表通过 textInfo 渲染出颜色、描述和单位
|
||||
textInfo: {
|
||||
'system.cpu.count': { color: 'green', text: 'CPU 数量', unit: '核' },
|
||||
'system.cpu.usage': { color: 'green', text: '系统 CPU 使用率', unit: '%' },
|
||||
'process.start.time': { color: 'purple', text: '应用启动时间点', unit: '' },
|
||||
'process.uptime': { color: 'purple', text: '应用已运行时间', unit: '秒' },
|
||||
'process.cpu.usage': { color: 'purple', text: '当前应用 CPU 使用率', unit: '%' }
|
||||
},
|
||||
// 当一条记录中需要取出多条数据的时候需要配置该字段
|
||||
moreInfo: {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadTomcatInfo()
|
||||
},
|
||||
methods: {
|
||||
|
||||
handleClickUpdate() {
|
||||
this.loadTomcatInfo()
|
||||
},
|
||||
|
||||
loadTomcatInfo() {
|
||||
this.tableLoading = true
|
||||
this.time = moment().format('YYYY年MM月DD日 HH时mm分ss秒')
|
||||
Promise.all([
|
||||
getAction('actuator/metrics/system.cpu.count'),
|
||||
getAction('actuator/metrics/system.cpu.usage'),
|
||||
getAction('actuator/metrics/process.start.time'),
|
||||
getAction('actuator/metrics/process.uptime'),
|
||||
getAction('actuator/metrics/process.cpu.usage')
|
||||
]).then((res) => {
|
||||
let info = []
|
||||
res.forEach((value, id) => {
|
||||
let more = this.moreInfo[value.name]
|
||||
if (!(more instanceof Array)) {
|
||||
more = ['']
|
||||
}
|
||||
more.forEach((item, idx) => {
|
||||
let param = value.name + item
|
||||
let val = value.measurements[idx].value
|
||||
if (param === 'system.cpu.usage' || param === 'process.cpu.usage') {
|
||||
val = this.convert(val, Number)
|
||||
}
|
||||
if (param === 'process.start.time') {
|
||||
val = this.convert(val, Date)
|
||||
}
|
||||
info.push({ id: param + id, param, text: 'false value', value: val })
|
||||
})
|
||||
})
|
||||
this.dataSource = info
|
||||
}).catch((e) => {
|
||||
console.error(e)
|
||||
this.$message.error('获取服务器信息失败')
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
this.tableLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
convert(value, type) {
|
||||
if (type === Number) {
|
||||
return Number(value * 100).toFixed(2)
|
||||
} else if (type === Date) {
|
||||
return moment(value * 1000).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style></style>
|
||||
149
ant-design-vue-jeecg/src/views/modules/monitor/TomcatInfo.vue
Normal file
149
ant-design-vue-jeecg/src/views/modules/monitor/TomcatInfo.vue
Normal file
@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
|
||||
<a-card :bordered="false">
|
||||
|
||||
<a-alert type="info" :showIcon="true">
|
||||
<div slot="message">
|
||||
上次更新时间:{{ this.time }}
|
||||
<a-divider type="vertical"/>
|
||||
<a @click="handleClickUpdate">立即更新</a>
|
||||
</div>
|
||||
</a-alert>
|
||||
|
||||
<a-table
|
||||
rowKey="id"
|
||||
size="middle"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="false"
|
||||
:loading="tableLoading"
|
||||
style="margin-top: 20px;">
|
||||
|
||||
<template slot="param" slot-scope="text, record">
|
||||
<a-tag :color="textInfo[record.param].color">{{ text }}</a-tag>
|
||||
</template>
|
||||
|
||||
<template slot="text" slot-scope="text, record">
|
||||
{{ textInfo[record.param].text }}
|
||||
</template>
|
||||
|
||||
<template slot="value" slot-scope="text, record">
|
||||
{{ text }} {{ textInfo[record.param].unit }}
|
||||
</template>
|
||||
|
||||
</a-table>
|
||||
|
||||
</a-card>
|
||||
</a-skeleton>
|
||||
</template>
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
time: '',
|
||||
loading: true,
|
||||
tableLoading: true,
|
||||
columns: [{
|
||||
title: '参数',
|
||||
width: '30%',
|
||||
dataIndex: 'param',
|
||||
scopedSlots: { customRender: 'param' }
|
||||
}, {
|
||||
title: '描述',
|
||||
width: '40%',
|
||||
dataIndex: 'text',
|
||||
scopedSlots: { customRender: 'text' }
|
||||
}, {
|
||||
title: '当前值',
|
||||
width: '30%',
|
||||
dataIndex: 'value',
|
||||
scopedSlots: { customRender: 'value' }
|
||||
}],
|
||||
dataSource: [],
|
||||
// 列表通过 textInfo 渲染出颜色、描述和单位
|
||||
textInfo: {
|
||||
'tomcat.sessions.created': { color: 'green', text: 'tomcat 已创建 session 数', unit: '个' },
|
||||
'tomcat.sessions.expired': { color: 'green', text: 'tomcat 已过期 session 数', unit: '个' },
|
||||
'tomcat.sessions.active.current': { color: 'green', text: 'tomcat 当前活跃 session 数', unit: '个' },
|
||||
'tomcat.sessions.active.max': { color: 'green', text: 'tomcat 活跃 session 数峰值', unit: '个' },
|
||||
'tomcat.sessions.rejected': { color: 'green', text: '超过session 最大配置后,拒绝的 session 个数', unit: '个' },
|
||||
|
||||
'tomcat.global.sent': { color: 'purple', text: '发送的字节数', unit: 'bytes' },
|
||||
'tomcat.global.request.max': { color: 'purple', text: 'request 请求最长耗时', unit: '秒' },
|
||||
'tomcat.global.request.count': { color: 'purple', text: '全局 request 请求次数', unit: '次' },
|
||||
'tomcat.global.request.totalTime': { color: 'purple', text: '全局 request 请求总耗时', unit: '秒' },
|
||||
|
||||
'tomcat.servlet.request.max': { color: 'cyan', text: 'servlet 请求最长耗时', unit: '秒' },
|
||||
'tomcat.servlet.request.count': { color: 'cyan', text: 'servlet 总请求次数', unit: '次' },
|
||||
'tomcat.servlet.request.totalTime': { color: 'cyan', text: 'servlet 请求总耗时', unit: '秒' },
|
||||
|
||||
'tomcat.threads.current': { color: 'pink', text: 'tomcat 当前线程数(包括守护线程)', unit: '个' },
|
||||
'tomcat.threads.config.max': { color: 'pink', text: 'tomcat 配置的线程最大数', unit: '个' }
|
||||
},
|
||||
// 当一条记录中需要取出多条数据的时候需要配置该字段
|
||||
moreInfo: {
|
||||
'tomcat.global.request': ['.count', '.totalTime'],
|
||||
'tomcat.servlet.request': ['.count', '.totalTime']
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadTomcatInfo()
|
||||
},
|
||||
methods: {
|
||||
|
||||
handleClickUpdate() {
|
||||
this.loadTomcatInfo()
|
||||
},
|
||||
|
||||
loadTomcatInfo() {
|
||||
this.tableLoading = true
|
||||
this.time = moment().format('YYYY年MM月DD日 HH时mm分ss秒')
|
||||
Promise.all([
|
||||
getAction('actuator/metrics/tomcat.sessions.created'),
|
||||
getAction('actuator/metrics/tomcat.sessions.expired'),
|
||||
getAction('actuator/metrics/tomcat.sessions.active.current'),
|
||||
getAction('actuator/metrics/tomcat.sessions.active.max'),
|
||||
getAction('actuator/metrics/tomcat.sessions.rejected'),
|
||||
getAction('actuator/metrics/tomcat.global.sent'),
|
||||
getAction('actuator/metrics/tomcat.global.request.max'),
|
||||
getAction('actuator/metrics/tomcat.global.request'),
|
||||
// 2.1.3.RELEASE 无此API
|
||||
//getAction('actuator/metrics/tomcat.servlet.request'),
|
||||
// getAction('actuator/metrics/tomcat.servlet.request.max'),
|
||||
getAction('actuator/metrics/tomcat.threads.current'),
|
||||
getAction('actuator/metrics/tomcat.threads.config.max')
|
||||
]).then((res) => {
|
||||
let tomcatInfo = []
|
||||
res.forEach((value, id) => {
|
||||
let more = this.moreInfo[value.name]
|
||||
if (!(more instanceof Array)) {
|
||||
more = ['']
|
||||
}
|
||||
more.forEach((item, idx) => {
|
||||
let param = value.name + item
|
||||
tomcatInfo.push({
|
||||
id: param + id, param,
|
||||
text: 'false value',
|
||||
value: value.measurements[idx].value
|
||||
})
|
||||
})
|
||||
})
|
||||
this.dataSource = tomcatInfo
|
||||
}).catch((e) => {
|
||||
console.error(e)
|
||||
this.$message.error('获取Tomcat信息失败')
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
this.tableLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style></style>
|
||||
Reference in New Issue
Block a user