Newer
Older
xc-metering-front / src / views / tested / dashboard / components / deviceDetail.vue
dutingting on 29 Nov 4 KB 临时提交
<!-- 智能模型详情 -->
<script lang="ts" setup name="Dashboard">
// import verificationDetail from './components/verificationDetail.vue'
const width = ref(document.body.clientWidth - 180)
const height = ref(document.body.clientHeight - 50 - 60 - 10)
window.addEventListener('resize', () => {
  const bodyWidth = document.body.clientWidth - 180
  width.value = bodyWidth
  const bodyHeight = document.body.clientHeight - 50 - 60
  height.value = bodyHeight
})
const data1 = ref()
const data2 = ref()
const tableList = ref([
  {
    status: 0,
    content: '任务单RWD234849已检完',
    time: '2023-05-12 13:12',
  },
  {
    status: 0,
    content: '任务单RWD234849已检完',
    time: '2023-05-12 13:12',
  },
  {
    status: 1,
    content: '受检智能模型SJSB234849已退回 ',
    time: '2023-05-12 13:12',
  },
  {
    status: 0,
    content: '任务单RWD234849已检完',
    time: '2023-05-12 13:12',
  },
])
onMounted(() => {
  setTimeout(() => {
    data1.value = [
      {
        name: '压力计',
        value: 250,
      },
      {
        name: '万用表',
        value: 270,
      },
    ]
    data2.value = [
      {
        name: '力学',
        value: 250,
      },
      {
        name: '热力',
        value: 270,
      },
      {
        name: '无线电',
        value: 270,
      },
    ]
  }, 1000)
})
</script>

<template>
  <div style="width: 49%;">
    <div class="detail-container" :style="`height:${(height / 2) * 0.55}px;margin-top:5px;`">
      <div class="top">
        <div class="title">
          智能模型详情
        </div>
        <span />
      </div>
      <div class="search">
        <el-input class="input" placeholder="所属岗位" />
        <span>计量计划完成率: 20%</span>
      </div>
      <div class="content">
        <div class="pie1" :style="`height:${(height / 2) * 0.55 - 65}px`">
          <pie-chart
            :data="data1"
            :radius=" ['50%', '70%']"
            :legend="{ show: false }"
          />
          <div class="title">
            智能模型类型
          </div>
        </div>
        <div class="pie1" :style="`height:${(height / 2) * 0.55 - 65}px`">
          <pie-chart
            :data="data2"
            :radius=" ['50%', '70%']"
            :legend="{ show: false }"
          />
          <div class="title">
            计量专业分类
          </div>
        </div>
      </div>
    </div>
    <div class="detail-container" :style="`height:${(height / 2) * 0.44}px;margin-top:5px;`">
      <div class="top">
        <div class="title">
          检定通知
        </div>
        <div class="more">
          查看更多
        </div>
      </div>
      <div class="table">
        <el-table :data="tableList" :max-height="`height:${(height / 2) * 0.44 - 22}px`">
          <el-table-column label="" prop="status" width="50" aligin="center">
            <template #default="props">
              <div :class="`${props.row.status ? 'green' : 'red'}`" />
            </template>
          </el-table-column>
          <el-table-column label="" prop="content" aligin="center" />
          <el-table-column label="" prop="time" width="150" aligin="center" />
        </el-table>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.green {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: green;
}

.red {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgb(228 85 29);
}

.detail-container {
  background: #fff;
  width: 100%;
  border-radius: 8px;
  padding: 10px;
  overflow: hidden;
  box-sizing: border-box;

  ::v-deep(.el-table__header-wrapper) {
    display: none;
  }

  .top {
    display: flex;
    justify-content: space-between;

    .title {
      padding-left: 10px;
      font-size: 16px;
      font-weight: 700;
    }

    .more {
      color: blue;
    }
  }

  .search {
    display: flex;
    padding: 5px 10px;
    justify-content: space-between;

    .input {
      padding-left: 15px;
      width: 30%;
    }
  }

  .content {
    width: 100%;
    display: flex;
    justify-content: space-between;

    .pie1,
    .pie2 {
      width: 50%;
      position: relative;

      .title {
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
      }
    }
  }
}
</style>