【modify】使用ESLint格式化代码
This commit is contained in:
@@ -111,93 +111,93 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SysMessageModal from './modules/SysMessageModal'
|
||||
import {JeroListMixin} from '@/mixins/JeroListMixin'
|
||||
import JEllipsis from "@/components/jero/JEllipsis";
|
||||
import SysMessageModal from './modules/SysMessageModal'
|
||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||
import JEllipsis from '@/components/jero/JEllipsis'
|
||||
|
||||
export default {
|
||||
name: "SysMessageList",
|
||||
mixins: [JeroListMixin],
|
||||
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'},
|
||||
export default {
|
||||
name: 'SysMessageList',
|
||||
mixins: [JeroListMixin],
|
||||
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
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/sys/message/sysMessage/page",
|
||||
delete: "/sys/message/sysMessage/delete",
|
||||
deleteBatch: "/sys/message/sysMessage/deleteBatch",
|
||||
exportXlsUrl: "sys/message/sysMessage/exportXls",
|
||||
importExcelUrl: "sys/message/sysMessage/importExcel",
|
||||
},
|
||||
{
|
||||
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: '/sys/message/sysMessage/page',
|
||||
delete: '/sys/message/sysMessage/delete',
|
||||
deleteBatch: '/sys/message/sysMessage/deleteBatch',
|
||||
exportXlsUrl: 'sys/message/sysMessage/exportXls',
|
||||
importExcelUrl: 'sys/message/sysMessage/importExcel'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function () {
|
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function () {
|
||||
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
/** Button按钮间距 */
|
||||
@@ -235,4 +235,4 @@
|
||||
height: 90% !important;
|
||||
overflow-y: hidden
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -89,7 +89,6 @@
|
||||
<j-ellipsis :value="text" :length="25" />
|
||||
</span>
|
||||
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
@@ -121,98 +120,98 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SysMessageTemplateModal from './modules/SysMessageTemplateModal'
|
||||
import SysMessageTestModal from './modules/SysMessageTestModal'
|
||||
import {JeroListMixin} from '@/mixins/JeroListMixin'
|
||||
import JEllipsis from "@/components/jero/JEllipsis";
|
||||
import SysMessageTemplateModal from './modules/SysMessageTemplateModal'
|
||||
import SysMessageTestModal from './modules/SysMessageTestModal'
|
||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||
import JEllipsis from '@/components/jero/JEllipsis'
|
||||
|
||||
export default {
|
||||
name: "SysMessageTemplateList",
|
||||
mixins: [JeroListMixin],
|
||||
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 "微信";
|
||||
}
|
||||
if(text=='4') {
|
||||
return "系统";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: "center",
|
||||
scopedSlots: {customRender: 'action'},
|
||||
export default {
|
||||
name: 'SysMessageTemplateList',
|
||||
mixins: [JeroListMixin],
|
||||
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
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/sys/message/sysMessageTemplate/page",
|
||||
delete: "/sys/message/sysMessageTemplate/delete",
|
||||
deleteBatch: "/sys/message/sysMessageTemplate/deleteBatch",
|
||||
exportXlsUrl: "sys/message/sysMessageTemplate/exportXls",
|
||||
importExcelUrl: "sys/message/sysMessageTemplate/importExcel",
|
||||
},
|
||||
{
|
||||
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 '微信'
|
||||
}
|
||||
if (text == '4') {
|
||||
return '系统'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
scopedSlots: { customRender: 'action' }
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: '/sys/message/sysMessageTemplate/page',
|
||||
delete: '/sys/message/sysMessageTemplate/delete',
|
||||
deleteBatch: '/sys/message/sysMessageTemplate/deleteBatch',
|
||||
exportXlsUrl: 'sys/message/sysMessageTemplate/exportXls',
|
||||
importExcelUrl: 'sys/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 = "发送测试";
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
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按钮间距 */
|
||||
@@ -250,4 +249,4 @@
|
||||
height: 90% !important;
|
||||
overflow-y: hidden
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -84,102 +84,98 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {httpAction} from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import moment from "moment"
|
||||
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},
|
||||
},
|
||||
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: "/sys/message/sysMessage/add",
|
||||
edit: "/sys/message/sysMessage/edit",
|
||||
},
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
validatorRules: {},
|
||||
disableSubmit: true,
|
||||
url: {
|
||||
add: '/sys/message/sysMessage/add',
|
||||
edit: '/sys/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()
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
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'
|
||||
}
|
||||
const 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>
|
||||
</style>
|
||||
|
||||
@@ -81,143 +81,140 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {httpAction} from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import { duplicateCheck } from '@/api/api'
|
||||
import JEditor from '@/components/jero/JEditor'
|
||||
import { httpAction } from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import { duplicateCheck } from '@/api/api'
|
||||
import JEditor from '@/components/jero/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: "/sys/message/sysMessageTemplate/add",
|
||||
edit: "/sys/message/sysMessageTemplate/edit",
|
||||
},
|
||||
useEditor:false,
|
||||
templateEditorContent:""
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
add() {
|
||||
this.disable = false;
|
||||
this.edit({});
|
||||
export default {
|
||||
name: 'SysMessageTemplateModal',
|
||||
components: {
|
||||
JEditor
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title: '操作',
|
||||
visible: false,
|
||||
disable: true,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 }
|
||||
},
|
||||
edit(record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.useEditor = (record.templateType==2 || record.templateType==4)
|
||||
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'))
|
||||
}
|
||||
});
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 }
|
||||
},
|
||||
close() {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
this.disable = true;
|
||||
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: '请输入模板类型!' }] }
|
||||
},
|
||||
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();
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
url: {
|
||||
add: '/sys/message/sysMessageTemplate/add',
|
||||
edit: '/sys/message/sysMessageTemplate/edit'
|
||||
},
|
||||
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 || value==4)
|
||||
}
|
||||
|
||||
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 || record.templateType == 4)
|
||||
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'
|
||||
}
|
||||
const 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 || value == 4)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -49,74 +49,74 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {httpAction} from '@/api/manage'
|
||||
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},
|
||||
},
|
||||
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: "/sys/message/sysMessageTemplate/sendMsg",
|
||||
},
|
||||
templateName: "",
|
||||
templateContent: "",
|
||||
receiver: "",
|
||||
msgType: "",
|
||||
testData: "",
|
||||
sendParams: {}
|
||||
}
|
||||
confirmLoading: false,
|
||||
url: {
|
||||
send: '/sys/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
|
||||
},
|
||||
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() {
|
||||
close () {
|
||||
this.receiver = ''
|
||||
this.msgType = ''
|
||||
this.sendParams = {}
|
||||
this.visible = false
|
||||
},
|
||||
handleOk () {
|
||||
const httpurl = this.url.send
|
||||
const 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>
|
||||
</style>
|
||||
|
||||
@@ -11,39 +11,39 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction } from '@/api/manage'
|
||||
import DashChartDemo from '@/components/chart/DashChartDemo'
|
||||
import ARow from 'ant-design-vue/es/grid/Row'
|
||||
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:'sys/actuator/redis/queryDiskInfo',
|
||||
}
|
||||
export default {
|
||||
name: 'DiskMonitoring',
|
||||
components: {
|
||||
ARow,
|
||||
DashChartDemo
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '磁盘监控',
|
||||
// 数据集
|
||||
diskInfo: [],
|
||||
url: {
|
||||
queryDiskInfo: 'sys/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;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
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>
|
||||
</style>
|
||||
|
||||
@@ -36,134 +36,131 @@
|
||||
</a-skeleton>
|
||||
</template>
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
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()
|
||||
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: '秒' }
|
||||
},
|
||||
|
||||
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
|
||||
// 当一条记录中需要取出多条数据的时候需要配置该字段
|
||||
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) => {
|
||||
const info = []
|
||||
res.forEach((value, id) => {
|
||||
let more = this.moreInfo[value.name]
|
||||
if (!(more instanceof Array)) {
|
||||
more = ['']
|
||||
}
|
||||
more.forEach((item, idx) => {
|
||||
const 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>
|
||||
|
||||
@@ -22,168 +22,166 @@
|
||||
</a-skeleton>
|
||||
</template>
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
import AreaChartTy from '@/components/chart/AreaChartTy'
|
||||
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: '/sys/actuator/redis/keysSize',
|
||||
memoryInfo: '/sys/actuator/redis/memoryInfo',
|
||||
info: '/sys/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)
|
||||
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'
|
||||
},
|
||||
|
||||
/** 关闭定时器 */
|
||||
closeTimer() {
|
||||
if (this.timer) clearInterval(this.timer)
|
||||
// 内存实时占用情况
|
||||
memory: {
|
||||
title: 'Radis 内存实时占用情况(KB)',
|
||||
dataSource: [],
|
||||
y: '内存(KB)',
|
||||
min: 0,
|
||||
max: 3000,
|
||||
height: 340,
|
||||
lineSize: 8
|
||||
},
|
||||
|
||||
/** 查询数据 */
|
||||
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
|
||||
})
|
||||
|
||||
redisInfo: [],
|
||||
columns: [{
|
||||
title: 'Key',
|
||||
align: 'center',
|
||||
dataIndex: 'key'
|
||||
}, {
|
||||
title: 'Description',
|
||||
align: 'left',
|
||||
dataIndex: 'description'
|
||||
}, {
|
||||
title: 'Value',
|
||||
align: 'center',
|
||||
dataIndex: 'value'
|
||||
}],
|
||||
url: {
|
||||
keysSize: '/sys/actuator/redis/keysSize',
|
||||
memoryInfo: '/sys/actuator/redis/memoryInfo',
|
||||
info: '/sys/actuator/redis/info'
|
||||
},
|
||||
|
||||
// 获取一组数据中最大和最小的值
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
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) => {
|
||||
const time = moment().format('hh:mm:ss')
|
||||
|
||||
const [{ dbSize: currentSize }, memoryInfo] = res
|
||||
const 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 最大最小值
|
||||
const 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 最大最小值
|
||||
const 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; let minValue = null
|
||||
dataSource.forEach(item => {
|
||||
const 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>
|
||||
|
||||
@@ -36,102 +36,102 @@
|
||||
</a-skeleton>
|
||||
</template>
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
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() {
|
||||
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()
|
||||
},
|
||||
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 = ['']
|
||||
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) => {
|
||||
const info = []
|
||||
res.forEach((value, id) => {
|
||||
let more = this.moreInfo[value.name]
|
||||
if (!(more instanceof Array)) {
|
||||
more = ['']
|
||||
}
|
||||
more.forEach((item, idx) => {
|
||||
const param = value.name + item
|
||||
let val = value.measurements[idx].value
|
||||
if (param === 'system.cpu.usage' || param === 'process.cpu.usage') {
|
||||
val = this.convert(val, Number)
|
||||
}
|
||||
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 })
|
||||
})
|
||||
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
|
||||
})
|
||||
},
|
||||
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
|
||||
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>
|
||||
|
||||
@@ -37,114 +37,115 @@
|
||||
</a-skeleton>
|
||||
</template>
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
import moment from 'moment'
|
||||
import { getAction } from '@/api/manage'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
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: '个' },
|
||||
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.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.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()
|
||||
'tomcat.threads.current': { color: 'pink', text: 'tomcat 当前线程数(包括守护线程)', unit: '个' },
|
||||
'tomcat.threads.config.max': { color: 'pink', text: 'tomcat 配置的线程最大数', unit: '个' }
|
||||
},
|
||||
|
||||
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'),
|
||||
// 2.3.5.RELEASE 无此API
|
||||
// getAction('actuator/metrics/tomcat.global.sent'),
|
||||
// getAction('actuator/metrics/tomcat.global.request.max'),
|
||||
// getAction('actuator/metrics/tomcat.global.request'),
|
||||
// getAction('actuator/metrics/tomcat.threads.current'),
|
||||
// getAction('actuator/metrics/tomcat.threads.config.max')
|
||||
// 2.1.3.RELEASE 无此API
|
||||
//getAction('actuator/metrics/tomcat.servlet.request'),
|
||||
// getAction('actuator/metrics/tomcat.servlet.request.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
|
||||
})
|
||||
// 当一条记录中需要取出多条数据的时候需要配置该字段
|
||||
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')
|
||||
// 2.3.5.RELEASE 无此API
|
||||
// getAction('actuator/metrics/tomcat.global.sent'),
|
||||
// getAction('actuator/metrics/tomcat.global.request.max'),
|
||||
// getAction('actuator/metrics/tomcat.global.request'),
|
||||
// getAction('actuator/metrics/tomcat.threads.current'),
|
||||
// getAction('actuator/metrics/tomcat.threads.config.max')
|
||||
// 2.1.3.RELEASE 无此API
|
||||
// getAction('actuator/metrics/tomcat.servlet.request'),
|
||||
// getAction('actuator/metrics/tomcat.servlet.request.max'),
|
||||
]).then((res) => {
|
||||
const tomcatInfo = []
|
||||
res.forEach((value, id) => {
|
||||
let more = this.moreInfo[value.name]
|
||||
if (!(more instanceof Array)) {
|
||||
more = ['']
|
||||
}
|
||||
more.forEach((item, idx) => {
|
||||
const 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>
|
||||
|
||||
@@ -76,105 +76,105 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {JeroListMixin} from '@/mixins/JeroListMixin'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||
const Base64 = require('js-base64').Base64
|
||||
export default {
|
||||
name: "OSSFileList",
|
||||
mixins: [JeroListMixin],
|
||||
data() {
|
||||
return {
|
||||
description: '文件列表',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key: 'rowIndex',
|
||||
width: 60,
|
||||
align: "center",
|
||||
customRender: function (t, r, index) {
|
||||
return parseInt(index) + 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '文件名称',
|
||||
align: "center",
|
||||
dataIndex: 'fileName'
|
||||
},
|
||||
{
|
||||
title: '文件地址',
|
||||
align: "center",
|
||||
dataIndex: 'url'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: "center",
|
||||
scopedSlots: {customRender: 'action'},
|
||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
const Base64 = require('js-base64').Base64
|
||||
export default {
|
||||
name: 'OSSFileList',
|
||||
mixins: [JeroListMixin],
|
||||
data () {
|
||||
return {
|
||||
description: '文件列表',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key: 'rowIndex',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: function (t, r, index) {
|
||||
return parseInt(index) + 1
|
||||
}
|
||||
],
|
||||
url: {
|
||||
upload: "/sys/common/upload",
|
||||
list: "/sys/oss/file/page",
|
||||
delete: "/sys/oss/file/delete",
|
||||
},
|
||||
{
|
||||
title: '文件名称',
|
||||
align: 'center',
|
||||
dataIndex: 'fileName'
|
||||
},
|
||||
{
|
||||
title: '文件地址',
|
||||
align: 'center',
|
||||
dataIndex: 'url'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
scopedSlots: { customRender: 'action' }
|
||||
}
|
||||
],
|
||||
url: {
|
||||
upload: '/sys/common/upload',
|
||||
list: '/sys/oss/file/page',
|
||||
delete: '/sys/oss/file/delete'
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
uploadAction () {
|
||||
return window._CONFIG.domianURL + this.url.upload
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
beforeUpload (file) {
|
||||
var fileType = file.type
|
||||
if (fileType === 'image') {
|
||||
if (fileType.indexOf('image') < 0) {
|
||||
this.$message.warning('请上传图片')
|
||||
return false
|
||||
}
|
||||
} else if (fileType === 'file') {
|
||||
if (fileType.indexOf('image') >= 0) {
|
||||
this.$message.warning('请上传文件')
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
},
|
||||
computed: {
|
||||
uploadAction() {
|
||||
return window._CONFIG['domianURL'] + this.url.upload;
|
||||
handleChange (info) {
|
||||
console.log('ok')
|
||||
if (info.file.status === 'done') {
|
||||
if (info.file.response.success) {
|
||||
this.loadData()
|
||||
this.$message.success(`${info.file.name} 上传成功!`)
|
||||
} else {
|
||||
this.$message.error(`${info.file.response.message}`)
|
||||
}
|
||||
} else if (info.file.status === 'error') {
|
||||
this.$message.error(`${info.file.response.message}`)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
beforeUpload(file) {
|
||||
var fileType = file.type;
|
||||
if (fileType === 'image') {
|
||||
if (fileType.indexOf('image') < 0) {
|
||||
this.$message.warning('请上传图片');
|
||||
return false;
|
||||
}
|
||||
} else if (fileType === 'file') {
|
||||
if (fileType.indexOf('image') >= 0) {
|
||||
this.$message.warning('请上传文件');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true
|
||||
},
|
||||
handleChange(info) {
|
||||
console.log("ok")
|
||||
if (info.file.status === 'done') {
|
||||
if (info.file.response.success) {
|
||||
this.loadData()
|
||||
this.$message.success(`${info.file.name} 上传成功!`);
|
||||
} else {
|
||||
this.$message.error(`${info.file.response.message}`);
|
||||
}
|
||||
} else if (info.file.status === 'error') {
|
||||
this.$message.error(`${info.file.response.message}`);
|
||||
}
|
||||
},
|
||||
ossDelete(id) {
|
||||
var that = this;
|
||||
that.$confirm({
|
||||
title: "确认删除",
|
||||
content: "是否删除选中文件?",
|
||||
onOk: function () {
|
||||
that.handleDelete(id)
|
||||
}
|
||||
});
|
||||
},
|
||||
handlePreview(record) {
|
||||
if (record && record.url) {
|
||||
var fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${record.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${record.fileName}`
|
||||
let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
|
||||
window.open(url)
|
||||
ossDelete (id) {
|
||||
var that = this
|
||||
that.$confirm({
|
||||
title: '确认删除',
|
||||
content: '是否删除选中文件?',
|
||||
onOk: function () {
|
||||
that.handleDelete(id)
|
||||
}
|
||||
})
|
||||
},
|
||||
handlePreview (record) {
|
||||
if (record && record.url) {
|
||||
var fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/download/${record.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${record.fileName}`
|
||||
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
|
||||
window.open(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user