Blame view

src/components/inspection/InspectionTaskDetail.vue 4.57 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
56c7fec9   wuxw   巡检功能测试完成
2
3
4
    <el-dialog :title="$t('inspectionTaskDetail.taskDetails')" :visible.sync="visible" width="90%" top="5vh"
      @close="close">
  
1d73dc48   wuxw   继续晚上巡检功能
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
        <el-table :data="taskDetails" border style="width: 100%">
          <el-table-column prop="taskDetailId" :label="$t('inspectionTaskDetail.taskDetails') + 'ID'" align="center"
            width="100" />
          <el-table-column prop="inspectionName" :label="$t('inspectionTaskDetail.inspectionPoint')" align="center" />
          <el-table-column prop="stateName" :label="$t('inspectionTaskDetail.inspectionStatus')" align="center" />
          <el-table-column :label="$t('inspectionTaskDetail.signStatus')" align="center">
            <template slot-scope="{row}">
              <span v-if="row.inspectionState === '60000'" class="text-primary">
                {{ row.inspectionStateName || '-' }}
              </span>
              <span v-else class="text-danger font-bold">
                {{ row.inspectionStateName || '-' }}
              </span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('inspectionTaskDetail.inspectorTime')" align="center">
            <template slot-scope="{row}">
              {{ row.planInsTime }}<br>{{ row.planEndTime }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('inspectionTaskDetail.pointTime')" align="center">
            <template slot-scope="{row}">
              {{ row.pointStartTime }}<br>{{ row.pointEndTime }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('inspectionTaskDetail.actualTime')" align="center">
            <template slot-scope="{row}">
              {{ row.inspectionTime || '-' }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('inspectionTaskDetail.inspectionSituation')" align="center">
            <template slot-scope="{row}">
              {{ row.description || '-' }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('inspectionTaskDetail.inspectionPhotos')" align="center">
            <template slot-scope="{row}">
              <span v-for="photo in row.photos" :key="photo.url" class="photo-item">
                <el-image style="width: 60px; height: 60px; margin-right: 5px;" :src="photo.url"
                  :preview-src-list="[photo.url]" fit="cover" />
              </span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('inspectionTaskDetail.locationInfo')" align="center" width="120">
            <template slot-scope="{row}">
              <el-button type="info" size="mini" @click="openMap(row.latitude, row.longitude)">
                {{ $t('inspectionTaskDetail.view') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
  
        <el-pagination :current-page="currentPage" :page-size="pageSize" :total="total"
          layout="total, prev, pager, next, jumper" @current-change="handlePageChange" />
56c7fec9   wuxw   巡检功能测试完成
59
  
1d73dc48   wuxw   继续晚上巡检功能
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  
      <ViewMap ref="viewMap" />
      <ViewImage ref="viewImage" />
    </el-dialog>
  </template>
  
  <script>
  import ViewMap from '@/components/system/ViewMap'
  import ViewImage from '@/components/system/viewImage'
  import { listInspectionTaskDetails } from '@/api/inspection/inspectionTaskApi'
  
  export default {
    name: 'InspectionTaskDetail',
    components: { ViewMap, ViewImage },
    data() {
      return {
        visible: false,
        taskDetails: [],
        taskId: '',
        currentPage: 1,
        pageSize: 10,
        total: 0
      }
    },
    methods: {
      open(task) {
        this.taskId = task.taskId
        this.visible = true
        this.loadTaskDetails()
      },
      close() {
        this.taskDetails = []
        this.taskId = ''
        this.currentPage = 1
        this.total = 0
      },
      async loadTaskDetails() {
        try {
          const res = await listInspectionTaskDetails({
            page: this.currentPage,
            row: this.pageSize,
            taskId: this.taskId
          })
          this.taskDetails = res.inspectionTaskDetails || []
f9f29297   wuxw   v1.9 分页 record 传给...
104
          this.total = res.total || 0
1d73dc48   wuxw   继续晚上巡检功能
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
        } catch (error) {
          console.error('加载任务详情失败:', error)
          this.$message.error('加载任务详情失败')
        }
      },
      handlePageChange(page) {
        this.currentPage = page
        this.loadTaskDetails()
      },
      openMap(lat, lng) {
        if (!lat || !lng) {
          this.$message.warning(this.$t('inspectionTaskDetail.noLocation'))
          return
        }
        this.$refs.viewMap.open({ lat, lng })
      }
    }
  }
  </script>
  
  <style scoped>
  .photo-item {
    display: inline-block;
    margin-right: 5px;
  }
  
  .text-primary {
    color: #409EFF;
  }
  
  .text-danger {
    color: #F56C6C;
  }
  
  .font-bold {
    font-weight: bold;
  }
  </style>