Newer
Older
smartwell_front / src / views / mobile / record / detail.vue
liyaguang on 26 Feb 6 KB 新装设备完成
<!--
  Description: h5-运维详情
  Author: 李亚光
  Date: 2025-01-03
 -->
<script lang="ts" setup name="H5OperationDetail">
import showPosition from '@/views/mobile/info/components/showPosition.vue'
import { showToast, showLoadingToast, closeToast,showImagePreview } from 'vant'
import { getDeviceDetail } from '@/api/mobile/record'
const $route = useRoute()
// 基本信息
const detailInfo = ref<any>({})
const imagesList = ref<string[]>([])
detailInfo.value = JSON.parse($route.query.row as string)
imagesList.value = [detailInfo.value.photo1, detailInfo.value.photo2, detailInfo.value.photo3]
imagesList.value = imagesList.value.filter((item) => item)
// 查看位置
const locationRef = ref()
const viewLocation = () => {
  showLoadingToast({
    duration: 0,
    forbidClick: true,
    message: '加载中...',
  })
  // 查询
  getDeviceDetail(detailInfo.value.devcode).then(res => {
     closeToast()
     if(res.data?.lng && res.data?.lat) {
      locationRef.value.initDialog([res.data?.lng, res.data?.lat])
     }
     else {
      showToast('该位置缺少坐标信息');
     }
  }).catch(() => {
    closeToast()
  })
}
// 图片地址
const getPhotoUrl = computed(() => {
  return (url: string) => {
    return `${window.localStorage.getItem('url-bj-well')}/static/${url}`
  }
})

// 预览图片
const previewPhoto = (index: number) => {
  showImagePreview({
    images: imagesList.value.map((item: any) => getPhotoUrl.value(item)),
    startPosition: index
  })
}
</script>
<template>
  <div class="info-container">
    <!-- 位置弹窗 -->
    <show-position ref="locationRef" />
    <!-- 基本信息 -->
    <div id="base-info" class="search-info">
      <div class="cell">
        <div class="title">运维类型</div>
        <div class="value">{{ detailInfo.repairType }}</div>
      </div>
      <div class="cell">
        <div class="title">设备编号</div>
        <div class="value">{{ detailInfo.devcode }}</div>
      </div>
      <div class="cell">
        <div class="title">安装位置</div>
        <div class="value">{{ detailInfo.ledgerNumber }}</div>
      </div>
      <div class="cell">
        <div class="title">位置名称</div>
        <div class="value">{{ detailInfo.ledgerName }}</div>
      </div>
      <div class="cell">
        <div class="title">详细位置</div>
        <div class="value" @click="viewLocation">{{ detailInfo.position }}
          <span class="location"></span>
        </div>
      </div>
      <div class="cell">
        <div class="title">运维日期</div>
        <div class="value">{{ detailInfo.repairTime }}</div>
      </div>
      <div class="cell">
        <div class="title">运维人员</div>
        <div class="value">{{ detailInfo.repairPerson }}</div>
      </div>
      <div class="cell">
        <div class="title">运维内容</div>
        <div class="value">{{ detailInfo.repairContent }}</div>
      </div>
      <div class="cell">
        <div class="title">现场照片</div>
        <div class="value">
          <img v-for="(item, index) in imagesList" :src="getPhotoUrl(item)" alt="" srcset="" width="45px" height="45px"
            @click="previewPhoto(index)" style="margin: 0 5px;">
          <!-- <img v-if="detailInfo.photo2" :src="getPhotoUrl(detailInfo.photo2)" alt="" srcset="" width="30px" height="30px"
            @click="previewPhoto(1)" style="margin: 0 5px;">
          <img v-if="detailInfo.photo3" :src="getPhotoUrl(detailInfo.photo3)" alt="" srcset="" width="30px" height="30px"
            @click="previewPhoto(2)" style="margin: 0 5px;"> -->
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.info-container {
  width: 100%;
  height: calc(100vh - 40px);
  overflow: hidden;
  color: #444;

  .search-info {
    background-color: #fff;
    width: 96%;
    margin: 0 auto;
    margin-top: 1vh;
    border-radius: 6px;
    padding: 4px;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
    padding-left: 0.8rem;
    font-size: 1.1rem;

    .cell {
      display: flex;
      justify-content: space-between;
      padding-top: 6px;
      padding-bottom: 6px;
      padding-right: 14px;
      align-items: center;

      .value {
        color: #888;
        width: 80%;
        text-align: right;
        font-size: 1rem;
        vertical-align: middle;
        // display: flex;
        // flex-direction: column;
        // justify-content: center;
        display: flex;
        align-items: center;
        justify-content: flex-end;

        .location {
          display: inline-block;
          width: 22px;
          height: 22px;
          background: url('@/assets/icons/icon-location.svg') no-repeat center center / cover;
          vertical-align: middle;
          margin-left: 8px;
        }
      }

      .title {
        width: 20%;
        white-space: nowrap;
        font-weight: 500;
      }

      // .title,
      // .value {
      //   white-space: nowrap;
      //   overflow: hidden;
      //   text-overflow: ellipsis;
      // }
    }
  }

  .search-result {
    background-color: #fff;
    width: 96%;
    margin: 0 auto;
    margin-top: 1vh;
    border-radius: 6px;
    padding: 4px;
    padding-left: 0.6rem;

    .title {
      display: flex;
      font-size: 1.1rem;

      .symbol {
        width: 4px;
        height: 22px;
        background-color: #0d76d4;
        border-radius: 4px;
        margin-right: 8px;
      }
    }

    .top-border {
      border-top: 1px solid #e4e7ed;
      // margin-top: 8px;
    }

    .result-item {
      .cell {
        display: flex;
        justify-content: space-between;
        padding-top: 6px;
        padding-bottom: 6px;
        padding-right: 18px;
        align-items: center;

        .value {
          color: #888;
          width: 80%;
          text-align: right;
          font-size: 1rem;
          vertical-align: middle;
          // display: flex;
          // flex-direction: column;
          // justify-content: center;
          display: flex;
          align-items: center;
          justify-content: flex-end;

        }

        .title {
          width: 20%;
          white-space: nowrap;
        }
      }
    }

  }
}
</style>