<template>
  <div class="warn-set">
    <navigation-name :msg="msg"/>
    <div class="content" v-if="needLogin">
      <login-box v-if="loginBoxVisible" @success="handleLoginSuccess"/>
      <div style="width: 100%;" v-else>
        <warn-set-modal/>
      </div>
    </div>
    <div v-else>
      <warn-set-modal/>
    </div>
  </div>
</template>

<script>
import NavigationName from '@/components/NavigationName'
import LoginBox from '@/components/LoginBox'
import WarnSetModal from '@/views/WarnSet/WarnSetModal'

export default {
  name: 'WarnSet',
  components: { WarnSetModal, LoginBox, NavigationName },
  data() {
    return {
      msg: '告警阈值设置',
      loginBoxVisible: true,
      needLogin: false,
      tableColumns: [
        {
          label: '设备名称',
          prop: 'station',
          width: '300',
          className: 'first-column',
        },
        {
          label: '噪声',
          prop: 'noise',
        },
      ],
      tableData: [
        {
          id: 1,
          site: '1332工房',
          station: '捏合机',
          noise: '2.101',
        },
      ],
    }
  },
  methods: {
    handleLoginSuccess(flag) {
      this.loginBoxVisible = flag
    },
  },
}
</script>

<style lang="less" scoped>
  .warn-set {
    height: 100%;
    padding: 0 40px;
    font-size: 16px;
    display: flex;
    flex-direction: column;

    .content {
      display: flex;
      justify-content: center;
    }
  }
</style>
