server DB email三个模块的overview 功能联调

This commit is contained in:
renpy 2023-07-28 15:20:44 +08:00
parent 52b2beae09
commit f4292bad10
4 changed files with 432 additions and 126 deletions

View File

@ -87,7 +87,10 @@ export default {
this.innerSelectedRowKeys = [key] this.innerSelectedRowKeys = [key]
} }
} }
} },
dblclick: () => {
this.$emit("rowDbclick",record)
},
} }
} }
}, },

View File

@ -12,16 +12,16 @@
<a-button class="view-btn" @click="onEdit"> <a-button class="view-btn" @click="onEdit">
<img class="icon-add" src="@/assets/images/global/edit.png" alt="" /> <img class="icon-add" src="@/assets/images/global/edit.png" alt="" />
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
edit Edit
</span> </span>
</a-button> </a-button>
<a-button class="view-btn"> <a-button class="view-btn" @click="onDelete">
<img class="icon-add" src="@/assets/images/global/delete.png" alt="" /> <img class="icon-add" src="@/assets/images/global/delete.png" alt="" />
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
Delete Delete
</span> </span>
</a-button> </a-button>
<a-button class="view-btn"> <a-button class="view-btn" @click="getSysDatabase">
<img class="icon-add" src="@/assets/images/global/reset-pwd.png" alt="" /> <img class="icon-add" src="@/assets/images/global/reset-pwd.png" alt="" />
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
Refresh Refresh
@ -30,6 +30,7 @@
</div> </div>
</div> </div>
<div class="view-main"> <div class="view-main">
<div class="view-main-table">
<TableList <TableList
size="middle" size="middle"
rowKey="id" rowKey="id"
@ -37,6 +38,7 @@
:list="dataSource" :list="dataSource"
:pagination="false" :pagination="false"
@rowClick="onRowClick" @rowClick="onRowClick"
@rowDbclick="onRowDbclick"
> >
<template slot="status" slot-scope="{record}"> <template slot="status" slot-scope="{record}">
<div> <div>
@ -58,6 +60,7 @@
<span :class="[record.diskRed?'isRed':'','alarm-text']">{{ text?text:"--" }}</span> <span :class="[record.diskRed?'isRed':'','alarm-text']">{{ text?text:"--" }}</span>
</template> </template>
</TableList> </TableList>
</div>
<a-pagination <a-pagination
size="small" size="small"
v-model="ipagination.current" v-model="ipagination.current"
@ -77,15 +80,73 @@
v-model="visible" v-model="visible"
@cancel="onCancel" @cancel="onCancel"
> >
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 17 }"> <a-form :form="form" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
<a-form-item label="DB Username">
<a-input
v-decorator="[
'username',
{
rules: [{ required: true, message: 'Please input username!' }],
initialVale: this.formVal.username
}
]"
/>
</a-form-item>
<a-form-item label="DB Password">
<a-input
v-decorator="[
'password',
{
rules: [{ required: true, message: 'Please input DB Password!' }],
initialVale: this.formVal.password
}
]"
/>
</a-form-item>
<a-form-item label="Name"> <a-form-item label="Name">
<a-input <a-input
v-decorator="['name', { rules: [{ required: true, message: 'Please input your name!' }] }]" v-decorator="[
'name',
{
rules: [{ required: true, message: 'Please input name!' }],
initialVale: this.formVal.name
}
]"
/>
</a-form-item>
<a-form-item label="DB Type">
<j-dict-select-tag
placeholder="请选择数据库类型"
dict-code="database_type"
v-decorator="[
'type',
{
rules: [{ required: true, message: 'Please select a DB Type!' }],
initialVale: this.formVal.type
}
]"
/>
</a-form-item>
<a-form-item label="DB Port">
<a-input-number
v-decorator="[
'port',
{
rules: [{ required: true, message: 'Please input port!' }],
initialVale: this.formVal.port
}
]"
/> />
</a-form-item> </a-form-item>
<a-form-item label="Ip Address"> <a-form-item label="Ip Address">
<a-input <a-input
v-decorator="['ipAddress', { rules: [{ required: true, message: 'Please input your ipAddress!' }] }]" v-decorator="[
'ipAddress',
{
rules: [{ required: true, message: 'Please input ip address!' }],
initialVale: this.formVal.ipAddress
}
]"
/> />
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -134,7 +195,7 @@ const columns = [
customRender: 'alarms', customRender: 'alarms',
} }
},{ },{
title: 'CPU UUTILZATION', title: 'CPU UTILIZATION',
align: 'left', align: 'left',
dataIndex: 'cpuUutilzation', dataIndex: 'cpuUutilzation',
scopedSlots: { scopedSlots: {
@ -166,7 +227,11 @@ export default {
visible: false, visible: false,
form: this.$form.createForm(this), form: this.$form.createForm(this),
formVal: { formVal: {
username: "",
password: "",
name: "", name: "",
type: undefined,
port: "",
ipAddress:"" ipAddress:""
}, },
currentId:"", currentId:"",
@ -224,10 +289,45 @@ export default {
this.getSysDatabase() this.getSysDatabase()
}, },
onAdd() { onAdd() {
this.isAdd = true
this.visible = true this.visible = true
}, },
onEdit() { onEdit() {
this.isAdd = false
this.visible = true this.visible = true
getAction("/sysDatabase/findInfo", {id:this.currentId}).then(res => {
if (res.success) {
this.form.setFieldsValue({
username: res.result.username,
password: res.result.password,
name: res.result.name,
type: res.result.type,
port: res.result.port,
ipAddress: res.result.ipAddress
});
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
})
},
onDelete() {
let _this = this
this.$confirm({
title: 'Are you sure to delete this item?',
onOk() {
deleteAction("/sysDatabase/deleteById", {id:_this.currentId}).then(res => {
if (res.success) {
_this.$message.success("success")
_this.getSysDatabase()
} else {
_this.$message.warning("This operation fails. Contact your system administrator")
}
})
},
onCancel() {
console.log('Cancel');
},
});
}, },
onRowClick(record) { onRowClick(record) {
this.currentId = record.id this.currentId = record.id
@ -236,15 +336,15 @@ export default {
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
console.log('Received values of form: ', values); console.log('Received values of form: ', values);
// this.visible = false
if (this.isAdd) { if (this.isAdd) {
postAction("/sysServer/create", values).then(res => { postAction("/sysDatabase/create", values).then(res => {
if (res.success) { if (res.success) {
this.form.resetFields()
this.visible = false this.visible = false
this.$message.success("success") this.$message.success("success")
this.getSysServer() this.getSysDatabase()
} else { } else {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.info(res.result.message)
} }
}) })
} else { } else {
@ -252,13 +352,14 @@ export default {
id: this.currentId, id: this.currentId,
...values ...values
} }
httpAction("/sysServer/update", params, "put").then(res => { httpAction("/sysDatabase/update", params, "put").then(res => {
if (res.success) { if (res.success) {
this.form.resetFields()
this.visible = false this.visible = false
this.$message.success("success") this.$message.success("success")
this.getSysServer() this.getSysDatabase()
} else { } else {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.info(res.result.message)
} }
}) })
} }
@ -266,7 +367,11 @@ export default {
}); });
}, },
onCancel() { onCancel() {
this.form.resetFields()
this.visible = false this.visible = false
},
onRowDbclick() {
this.$router.push("/alarm/databaseMonitor/instances")
} }
}, },
} }
@ -305,11 +410,15 @@ export default {
} }
} }
.view-main{ .view-main{
height: calc(100% - 65px); height: calc(100% - 50px);
margin-left: 20px; margin-left: 20px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
padding-top: 15px; padding-top: 15px;
&-table{
height: calc(100% - 30px);
overflow: auto;
}
.ant-pagination{ .ant-pagination{
position: absolute; position: absolute;
left: 50%; left: 50%;
@ -350,4 +459,8 @@ export default {
/deep/.ant-modal-title{ /deep/.ant-modal-title{
letter-spacing: 1px; letter-spacing: 1px;
} }
.ant-input-number{
width: 100%;
background-color: #03353f !important
}
</style> </style>

View File

@ -12,16 +12,16 @@
<a-button class="view-btn" @click="onEdit"> <a-button class="view-btn" @click="onEdit">
<img class="icon-add" src="@/assets/images/global/edit.png" alt="" /> <img class="icon-add" src="@/assets/images/global/edit.png" alt="" />
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
edit Edit
</span> </span>
</a-button> </a-button>
<a-button class="view-btn"> <a-button class="view-btn" @click="onDelete">
<img class="icon-add" src="@/assets/images/global/delete.png" alt="" /> <img class="icon-add" src="@/assets/images/global/delete.png" alt="" />
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
Delete Delete
</span> </span>
</a-button> </a-button>
<a-button class="view-btn"> <a-button class="view-btn" @click="getSysEmail">
<img class="icon-add" src="@/assets/images/global/reset-pwd.png" alt="" /> <img class="icon-add" src="@/assets/images/global/reset-pwd.png" alt="" />
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
Refresh Refresh
@ -30,12 +30,15 @@
</div> </div>
</div> </div>
<div class="view-main"> <div class="view-main">
<div class="view-main-table">
<TableList <TableList
size="middle" size="middle"
rowKey="id" rowKey="id"
:columns="columns" :columns="columns"
:list="dataSource" :list="dataSource"
:pagination="false" :pagination="false"
@rowClick="onRowClick"
@rowDbclick="onRowDbclick"
> >
<template slot="status" slot-scope="{record}"> <template slot="status" slot-scope="{record}">
<div> <div>
@ -60,6 +63,7 @@
<span :class="[record.cpuRed?'isRed':'','alarm-text']">{{ text?text:"--" }}</span> <span :class="[record.cpuRed?'isRed':'','alarm-text']">{{ text?text:"--" }}</span>
</template> </template>
</TableList> </TableList>
</div>
<a-pagination <a-pagination
size="small" size="small"
v-model="ipagination.current" v-model="ipagination.current"
@ -79,15 +83,91 @@
v-model="visible" v-model="visible"
@cancel="onCancel" @cancel="onCancel"
> >
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 17 }"> <a-form :form="form" :label-col="{ span: 9 }" :wrapper-col="{ span: 14 }">
<a-form-item label="Name"> <a-form-item label="Name">
<a-input <a-input
v-decorator="['name', { rules: [{ required: true, message: 'Please input your name!' }] }]" v-decorator="[
'name',
{
rules: [{ required: true, message: 'Please input name!' }],
initialVale: this.formVal.name
}
]"
/> />
</a-form-item> </a-form-item>
<a-form-item label="Ip Address"> <a-form-item label="Email Servier Address">
<a-input <a-input
v-decorator="['ipAddress', { rules: [{ required: true, message: 'Please input your ipAddress!' }] }]" v-decorator="[
'emailServerAddress',
{
rules: [{ required: true, message: 'Please input email server address!' }],
initialVale: this.formVal.emailServerAddress
}
]"
/>
</a-form-item>
<a-form-item label="Email Address">
<a-input
v-decorator="[
'username',
{
rules: [{ required: true, message: 'Please input email address!' }],
initialVale: this.formVal.username
}
]"
/>
</a-form-item>
<a-form-item label="Password">
<a-input
v-decorator="[
'password',
{
rules: [{ required: true, message: 'Please input password!' }],
initialVale: this.formVal.password
}
]"
/>
</a-form-item>
<a-form-item label="Emil Type">
<j-dict-select-tag
placeholder="请选择邮箱类型"
dict-code="email_type"
v-decorator="[
'emilType',
{
rules: [{ required: true, message: 'Please input your name!' }],
initialVale: this.formVal.emilType
}
]"
/>
</a-form-item>
<a-form-item label="Station">
<a-select
v-decorator="[
'enabled',
{
rules: [{ required: true, message: 'Please select a Station!' }],
initialVale: this.formVal.enabled
}
]"
>
<a-select-option value="1">
Enable
</a-select-option>
<a-select-option value="0">
Disabled
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="Port">
<a-input-number
v-decorator="[
'port',
{
rules: [{ required: true, message: 'Please input port!' }],
initialVale: this.formVal.port
}
]"
/> />
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -168,7 +248,12 @@ export default {
form: this.$form.createForm(this), form: this.$form.createForm(this),
formVal: { formVal: {
name: "", name: "",
ipAddress:"" emailServerAddress: "",
username: "",
password: "",
emilType: "",
enabled: "",
port: ""
}, },
currentId:"", currentId:"",
columns, columns,
@ -225,27 +310,64 @@ export default {
this.getSysEmail() this.getSysEmail()
}, },
onAdd() { onAdd() {
this.isAdd = true
this.visible = true this.visible = true
}, },
onEdit() { onEdit() {
this.isAdd = false
this.visible = true this.visible = true
getAction("/sysEmail/findInfo", {id:this.currentId}).then(res => {
if (res.success) {
this.form.setFieldsValue({
name: res.result.username,
emailServerAddress: res.result.emailServerAddress,
username: res.result.username,
password: res.result.password,
emilType: res.result.emilType,
enabled: res.result.enabled,
port: res.result.port
});
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
})
},
onDelete() {
let _this = this
this.$confirm({
title: 'Are you sure to delete this item?',
onOk() {
deleteAction("/sysEmail/deleteById", {id:_this.currentId}).then(res => {
if (res.success) {
_this.$message.success("success")
_this.getSysEmail()
} else {
_this.$message.warning("This operation fails. Contact your system administrator")
}
})
},
onCancel() {
console.log('Cancel');
},
});
}, },
onRowClick(record) { onRowClick(record) {
console.log(record);
this.currentId = record.id this.currentId = record.id
}, },
onSave() { onSave() {
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
console.log('Received values of form: ', values); console.log('Received values of form: ', values);
// this.visible = false
if (this.isAdd) { if (this.isAdd) {
postAction("/sysServer/create", values).then(res => { postAction("/sysEmail/create", values).then(res => {
if (res.success) { if (res.success) {
this.form.resetFields()
this.visible = false this.visible = false
this.$message.success("success") this.$message.success("success")
this.getSysServer() this.getSysEmail()
} else { } else {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.info(res.result.message)
} }
}) })
} else { } else {
@ -253,13 +375,14 @@ export default {
id: this.currentId, id: this.currentId,
...values ...values
} }
httpAction("/sysServer/update", params, "put").then(res => { httpAction("/sysEmail/update", params, "put").then(res => {
if (res.success) { if (res.success) {
this.form.resetFields()
this.visible = false this.visible = false
this.$message.success("success") this.$message.success("success")
this.getSysServer() this.getSysEmail()
} else { } else {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.info(res.result.message)
} }
}) })
} }
@ -267,7 +390,11 @@ export default {
}); });
}, },
onCancel() { onCancel() {
this.form.resetFields()
this.visible = false this.visible = false
},
onRowDbclick() {
this.$router.push("/alarm/emailMonitor/instances")
} }
}, },
} }
@ -306,11 +433,15 @@ export default {
} }
} }
.view-main{ .view-main{
height: calc(100% - 65px); height: calc(100% - 50px);
margin-left: 20px; margin-left: 20px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
padding-top: 15px; padding-top: 15px;
&-table{
height: calc(100% - 30px);
overflow: auto;
}
.ant-pagination{ .ant-pagination{
position: absolute; position: absolute;
left: 50%; left: 50%;
@ -351,4 +482,8 @@ export default {
/deep/.ant-modal-title{ /deep/.ant-modal-title{
letter-spacing: 1px; letter-spacing: 1px;
} }
.ant-input-number{
width: 100%;
background-color: #03353f !important
}
</style> </style>

View File

@ -12,16 +12,16 @@
<a-button class="view-btn" @click="onEdit"> <a-button class="view-btn" @click="onEdit">
<img class="icon-add" src="@/assets/images/global/edit.png" alt="" /> <img class="icon-add" src="@/assets/images/global/edit.png" alt="" />
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
edit Edit
</span> </span>
</a-button> </a-button>
<a-button class="view-btn"> <a-button class="view-btn" @click="onDelete">
<img class="icon-add" src="@/assets/images/global/delete.png" alt="" /> <img class="icon-add" src="@/assets/images/global/delete.png" alt="" />
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
Delete Delete
</span> </span>
</a-button> </a-button>
<a-button class="view-btn"> <a-button class="view-btn" @click="getSysServer">
<img class="icon-add" src="@/assets/images/global/reset-pwd.png" alt="" /> <img class="icon-add" src="@/assets/images/global/reset-pwd.png" alt="" />
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
Refresh Refresh
@ -30,6 +30,7 @@
</div> </div>
</div> </div>
<div class="view-main"> <div class="view-main">
<div class="view-main-table">
<TableList <TableList
size="middle" size="middle"
rowKey="id" rowKey="id"
@ -37,6 +38,7 @@
:list="dataSource" :list="dataSource"
:pagination="false" :pagination="false"
@rowClick="onRowClick" @rowClick="onRowClick"
@rowDbclick="onRowDbclick"
> >
<template slot="status" slot-scope="{text,record}"> <template slot="status" slot-scope="{text,record}">
<div> <div>
@ -58,6 +60,7 @@
<span :class="[record.diskRed?'isRed':'','alarm-text']">{{ text?text:"--" }}</span> <span :class="[record.diskRed?'isRed':'','alarm-text']">{{ text?text:"--" }}</span>
</template> </template>
</TableList> </TableList>
</div>
<a-pagination <a-pagination
size="small" size="small"
v-model="ipagination.current" v-model="ipagination.current"
@ -80,12 +83,24 @@
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 17 }"> <a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 17 }">
<a-form-item label="Name"> <a-form-item label="Name">
<a-input <a-input
v-decorator="['name', { rules: [{ required: true, message: 'Please input your name!' }] }]" v-decorator="[
'name',
{
rules: [{ required: true, message: 'Please input name!' }],
initialVale: this.formVal.name
}
]"
/> />
</a-form-item> </a-form-item>
<a-form-item label="Ip Address"> <a-form-item label="Ip Address">
<a-input <a-input
v-decorator="['ipAddress', { rules: [{ required: true, message: 'Please input your ipAddress!' }] }]" v-decorator="[
'ipAddress',
{
rules: [{ required: true, message: 'Please input ip address!' }],
initialVale: this.formVal.ipAddress
}
]"
/> />
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -126,7 +141,7 @@ const columns = [
customRender: 'alarms', customRender: 'alarms',
} }
},{ },{
title: 'CPU UUTILZATION', title: 'CPU UTILIZATION',
align: 'left', align: 'left',
dataIndex: 'cpuUutilzation', dataIndex: 'cpuUutilzation',
scopedSlots: { scopedSlots: {
@ -216,10 +231,41 @@ export default {
this.getSysServer() this.getSysServer()
}, },
onAdd() { onAdd() {
this.isAdd = true
this.visible = true this.visible = true
}, },
onEdit() { onEdit() {
this.isAdd = false
this.visible = true this.visible = true
getAction("/sysServer/findInfo", {id:this.currentId}).then(res => {
if (res.success) {
this.form.setFieldsValue({
name: res.result.name,
ipAddress: res.result.ipAddress
});
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
})
},
onDelete() {
let _this = this
this.$confirm({
title: 'Are you sure to delete this item?',
onOk() {
deleteAction("/sysServer/deleteById", {id:_this.currentId}).then(res => {
if (res.success) {
_this.$message.success("success")
_this.getSysServer()
} else {
_this.$message.warning("This operation fails. Contact your system administrator")
}
})
},
onCancel() {
console.log('Cancel');
},
});
}, },
onRowClick(record) { onRowClick(record) {
this.currentId = record.id this.currentId = record.id
@ -228,10 +274,10 @@ export default {
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
console.log('Received values of form: ', values); console.log('Received values of form: ', values);
// this.visible = false
if (this.isAdd) { if (this.isAdd) {
postAction("/sysServer/create", values).then(res => { postAction("/sysServer/create", values).then(res => {
if (res.success) { if (res.success) {
this.form.resetFields()
this.visible = false this.visible = false
this.$message.success("success") this.$message.success("success")
this.getSysServer() this.getSysServer()
@ -246,6 +292,7 @@ export default {
} }
httpAction("/sysServer/update", params, "put").then(res => { httpAction("/sysServer/update", params, "put").then(res => {
if (res.success) { if (res.success) {
this.form.resetFields()
this.visible = false this.visible = false
this.$message.success("success") this.$message.success("success")
this.getSysServer() this.getSysServer()
@ -258,7 +305,11 @@ export default {
}); });
}, },
onCancel() { onCancel() {
this.form.resetFields()
this.visible = false this.visible = false
},
onRowDbclick() {
this.$router.push("/alarm/serverMonitor/instances")
} }
}, },
} }
@ -297,11 +348,15 @@ export default {
} }
} }
.view-main{ .view-main{
height: calc(100% - 65px); height: calc(100% - 50px);
margin-left: 20px; margin-left: 20px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
padding-top: 15px; padding-top: 15px;
&-table{
height: calc(100% - 30px);
overflow: auto;
}
.ant-pagination{ .ant-pagination{
position: absolute; position: absolute;
left: 50%; left: 50%;