Merge branch 'main' into safetywarning-ui

This commit is contained in:
bonus 2024-11-13 14:20:30 +08:00
commit ee6f9851af
4 changed files with 64 additions and 24 deletions

View File

@ -92,6 +92,12 @@ export function getLogSize(data) {
})
}
export function handleNoWarningLog(data) {
return request({
url: '/system/sys/sysLog/logWarn',
method: 'get'
})
}

View File

@ -25,10 +25,6 @@
<el-form-item label="确认密码" prop="confirmPassword">
<el-input v-model="user.confirmPassword" placeholder="请确认新密码" type="password" show-password/>
</el-form-item>
<!-- <el-form-item>
<el-button type="primary" size="mini" @click="submit">保存</el-button>
<el-button type="danger" size="mini" @click="close">关闭</el-button>
</el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit"> </el-button>
@ -46,6 +42,7 @@ import { mapState } from 'vuex'
import variables from '@/assets/styles/variables.scss'
import { validateNewPassword } from '@/utils/validate'
import { updateUserPwd, checkPasswordStatus } from '@/api/system/user'
import { handleNoWarningLog } from '@/api/system/log'
import {MessageBox} from "element-ui";
export default {
@ -81,7 +78,7 @@ export default {
]
},
socket: null,
wsUrl: 'ws://localhost:18082/ws', // WebSocket
wsUrl: JSON.parse(localStorage.getItem('systemConfig')).webSocketurl,//'ws://localhost:18082/ws', // WebSocket
isConnected: false, //
reconnectInterval: 5000 //
@ -123,6 +120,7 @@ export default {
if (this.roles.includes("audit") || this.roles.includes("systemAdmin")) {
this.connectWebSocket();
}
this.handleNoWarningLog()
},
methods: {
checkPasswordStatus() {
@ -133,6 +131,13 @@ export default {
}
})
},
handleNoWarningLog(){
handleNoWarningLog().then(response => {
})
},
handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
},
@ -158,7 +163,7 @@ export default {
console.log("WebSocket 已连接");
return;
}
console.log("WebSocket URL:{}",this.wsUrl)
this.socket = new WebSocket(this.wsUrl);
// WebSocket
@ -204,24 +209,39 @@ export default {
//
handleWarning(warning) {
console.log(warning)
// const formattedTime = new Date(warning.warningTime).toLocaleString();
//
MessageBox.alert(
`
<p><strong>操作人</strong>${warning.operaUserName}</p>
<p><strong>事件</strong>${warning.warningEvent}</p>
<p><strong>IP</strong>${warning.warningIp}</p>
<p><strong>时间</strong>${warning.warningTime}</p>
`,
'告警通知',
{
dangerouslyUseHTMLString: true,
confirmButtonText: '确认',
callback: () => {
this.notifyBackend(warning.warningId);
let warningContent = '';
if (warning.operaUserName) {
warningContent += `<p><strong>操作人:</strong>${warning.operaUserName}</p>`;
}
if (warning.warningEvent) {
warningContent += `<p><strong>事件:</strong>${warning.warningEvent}</p>`;
}
if (warning.warningIp) {
warningContent += `<p><strong>IP</strong>${warning.warningIp}</p>`;
}
if (warning.operaTime) {
warningContent += `<p><strong>时间:</strong>${warning.operaTime}</p>`;
}
if (warningContent) {
MessageBox.alert(
warningContent,
'告警通知',
{
dangerouslyUseHTMLString: true,
confirmButtonText: '确认',
customClass: 'custom-message-box',
callback: () => {
this.notifyBackend(warning.warningId);
}
}
}
);
);
}
},
//

View File

@ -300,6 +300,11 @@ export default {
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.configKey === "sys.visit.tokentime" && (this.form.configValue <=0 || this.form.configValue > 30 ))
{
this.$modal.msgError("系统访问token有效期必须在0-30分钟之间");
return;
}
if (this.form.configId != undefined) {
updateConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功");

View File

@ -97,7 +97,11 @@
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber"
v-if="columns[4].visible"
width="120"
/>
>
<template slot-scope="scope">
<span>{{ hidePhone(scope.row.phonenumber) }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
<template slot-scope="scope">
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1"
@ -470,6 +474,11 @@ export default {
})
},
methods: {
/* 手机号码脱敏 */
hidePhone(phone) {
if (!phone) return '';
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
},
/* 表单登录权限自定义校验 */
validateLoginType(rule, value, callback) {
if (this.loginTypeArr.length > 0) {