Blame view

src/components/work/repairDetailPhotos.vue 2.18 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
72de60dc   wuxw   优化报修完成
2
    <div class="margin-top text-left">
4927ce37   wuxw   开发完成报修功能
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
      <div v-if="photos.length > 0" class="row padding">
        <div class="text-title">{{ $t('repairDetail.orderPhotos') }}</div>
        <div v-for="(item, index) in photos" :key="index" class="form-group margin-left">
          <el-image style="width: 120px; height: 120px;" :src="item.url" :preview-src-list="[item.url]" fit="cover"
            @click="openFile(item)"></el-image>
        </div>
      </div>
  
      <div v-if="beforePhotos.length > 0" class="row padding">
        <div class="text-title">{{ $t('repairDetail.beforeRepairPhotos') }}</div>
        <div v-for="(item, index) in beforePhotos" :key="index" class="form-group margin-left">
          <el-image style="width: 120px; height: 120px;" :src="item.url" :preview-src-list="[item.url]" fit="cover"
            @click="openFile(item)"></el-image>
        </div>
      </div>
  
      <div v-if="afterPhotos.length > 0" class="row padding">
        <div class="text-title">{{ $t('repairDetail.afterRepairPhotos') }}</div>
        <div v-for="(item, index) in afterPhotos" :key="index" class="form-group margin-left">
          <el-image style="width: 120px; height: 120px;" :src="item.url" :preview-src-list="[item.url]" fit="cover"
            @click="openFile(item)"></el-image>
        </div>
      </div>
    </div>
  </template>
  
  <script>
  import { getRepairPhotos } from '@/api/work/repairDetailApi'
  
  export default {
    name: 'RepairDetailPhotos',
    props: {
      repairId: {
        type: String,
        required: true
      }
    },
    data() {
      return {
        photos: [],
        beforePhotos: [],
        afterPhotos: []
      }
    },
    methods: {
      async loadData() {
        try {
          console.log(this.repairId)
          const data = await getRepairPhotos(this.repairId)
          this.photos = data.photos
          this.beforePhotos = data.beforePhotos
          this.afterPhotos = data.afterPhotos
        } catch (error) {
          this.$message.error(error.message)
        }
      },
      openFile(item) {
        this.$emit('show-image', item)
      }
    }
  }
  </script>
  
  <style scoped>
  .padding {
    padding: 10px 0;
  }
  
  .text-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
  }
  
  .margin-left {
    margin-left: 10px;
    display: inline-block;
  }
  </style>