Merge branch 'main' into safetywarning-ui
This commit is contained in:
		
						commit
						ee6f9851af
					
				| 
						 | 
				
			
			@ -92,6 +92,12 @@ export function getLogSize(data) {
 | 
			
		|||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
export function handleNoWarningLog(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/system/sys/sysLog/logWarn',
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
      );
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // 通知后端告警已处理
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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("修改成功");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue