list.vue 3.8 KB
<template>
  <div class="main device-list">
    <template v-for="(i,index) in list">
      <div
        :key="index"
        class="items"
      >
        <div class="top">
          <div class="time">
            {{i.time}}
          </div>
          <div class="info">
            <div class="info-box">
              <div class="item">
                <div class="sprite-icon icon-device-sn"></div>
                SN码:
                <div class="no">{{i.sn}}</div>
              </div>
              <div class="item">
                <div class="sprite-icon  icon-device-vin"></div>
                VIN码:
                <div class="no">{{i.vin}}</div>
              </div>
            </div>
            <div class="sprite-icon icon-device-bind"></div>
          </div>
        </div>
        <div class="bottom">
          <div class="label">操作地址</div>
          <div class="address">{{i.address}}</div>
        </div>
      </div>
    </template>
    <device-tabbar
      routeName="device.index"
      :tabIndex="1"
    ></device-tabbar>
  </div>
</template>

<script type='text/ecmascript-6'>
import DeviceTabBar from '@c/DeviceTabBar'
import { device } from '@r/api'
export default {
  name: 'list',
  data () {
    return {
      list: []
    }
  },
  components: {
    'device-tabbar': DeviceTabBar
  },
  mounted () {
    this.showLoading()
    device.getInstallationList().then(res => {
      console.log(res)
      if (res) {
        let { code, data, message } = res
        if (code == 0) {
          data.map(e => {
            e.time = new Date(e.updatedDate).format('yyyy.MM.dd hh:mm:ss')
          })
          this.list = data
        } else {
          this.showToast(message)
        }
      } else {
        this.showToast('系统异常')
      }
    })
  },
  methods: {
  }
}
</script>

<style   lang='scss'>
html,
body {
  background-color: rgb(247, 247, 247);
}
.device-list {
  padding-bottom: 60px;
  .items {
    background: #ffffff;
    border-bottom: 0.2px solid #c8c8c8;
    border-top: 0.2px solid #c8c8c8;
    margin-top: 16px;
    position: relative;
    &::before {
      position: absolute;
      content: "";
      background: #ededed;
      height: 100%;
      width: 2px;
      left: 66px;
      top: 0;
      z-index: 2;
    }
    .top {
      display: grid;
      grid-template-columns: 68px 1fr;
      color: #333333;
      position: relative;
      &::before {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 62px;
        background: #ffffff;
        border: 2px solid #ededed;
        content: "";
        width: 10px;
        height: 10px;
        border-radius: 100%;
        z-index: 3;
        box-sizing: border-box;
      }
      .time,
      .info {
        display: flex;
        align-items: center;
      }
      .time {
        font-size: 10px;
        text-align: center;
        line-height: 14px;
      }
      .info {
        font-size: 14px;
        display: grid;
        padding: 16px 12px;
        grid-template-columns: 229px 54px;
        &-box {
          .item {
            display: flex;
            align-items: center;
            .sprite-icon {
              margin-right: 4px;
            }
            .no {
              word-break: break-all;
              max-width: 152px;
              margin-left: 6px;
            }
          }
          .item:first-of-type {
            margin-bottom: 8px;
          }
        }
      }
    }
    .bottom {
      border-top: 1.5px solid #ededed;
      display: grid;
      grid-template-columns: 68px 1fr;
      min-height: 22.5px;
      font-size: 10px;
      color: #999999;
      .label,
      .address {
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .address {
        padding: 3.5px 12px;
        justify-content: flex-start;
      }
    }
  }
}
</style>