Blame view

src/components/inspection/maintainanceTaskDetail.vue 4.89 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
27918d40   wuxw   v1.9 测试完成设备下的功能
2
3
4
5
6
7
8
9
    <el-dialog :title="$t('maintainanceTaskDetail.title')" :visible.sync="visible" width="90%" top="5vh"
      @close="handleClose">
      <el-table :data="taskDetails" border style="width: 100%" v-loading="loading">
        <el-table-column prop="machineName" :label="$t('maintainanceTaskDetail.machineName')" align="center" />
        <el-table-column prop="planName" :label="$t('maintainanceTaskDetail.planName')" align="center" />
        <el-table-column prop="standardName" :label="$t('maintainanceTaskDetail.standardName')" align="center" />
        <el-table-column prop="planUserName" :label="$t('maintainanceTaskDetail.planUserName')" align="center" />
        <el-table-column :label="$t('maintainanceTaskDetail.timeRange')" align="center">
788477fb   wuxw   保养功能开发完成
10
11
12
13
          <template slot-scope="scope">
            {{ scope.row.planInsTime }}<br />{{ scope.row.planEndTime }}
          </template>
        </el-table-column>
27918d40   wuxw   v1.9 测试完成设备下的功能
14
        <el-table-column :label="$t('maintainanceTaskDetail.actInsTime')" align="center">
788477fb   wuxw   保养功能开发完成
15
16
17
18
          <template slot-scope="scope">
            {{ scope.row.inspectionTime || '-' }}
          </template>
        </el-table-column>
27918d40   wuxw   v1.9 测试完成设备下的功能
19
        <el-table-column :label="$t('maintainanceTaskDetail.actUserName')" align="center">
788477fb   wuxw   保养功能开发完成
20
21
22
23
          <template slot-scope="scope">
            {{ scope.row.actUserName || '-' }}
          </template>
        </el-table-column>
27918d40   wuxw   v1.9 测试完成设备下的功能
24
25
        <el-table-column prop="stateName" :label="$t('maintainanceTaskDetail.stateName')" align="center" />
        <el-table-column :label="$t('maintainanceTaskDetail.description')" align="center">
788477fb   wuxw   保养功能开发完成
26
27
28
29
30
31
          <template slot-scope="scope">
            <span class="text-primary">
              {{ scope.row.description || '-' }}
            </span>
          </template>
        </el-table-column>
27918d40   wuxw   v1.9 测试完成设备下的功能
32
        <el-table-column :label="$t('maintainanceTaskDetail.photos')" align="center">
788477fb   wuxw   保养功能开发完成
33
34
          <template slot-scope="scope">
            <div v-if="scope.row.photos && scope.row.photos.length > 0" class="photo-container">
27918d40   wuxw   v1.9 测试完成设备下的功能
35
36
37
              <el-image v-for="(photo, index) in scope.row.photos" :key="index" :src="photo.url"
                :preview-src-list="scope.row.photos.map(p => p.url)" style="width: 60px; height: 60px; margin-right: 5px;"
                fit="cover" />
788477fb   wuxw   保养功能开发完成
38
39
40
41
            </div>
            <span v-else>-</span>
          </template>
        </el-table-column>
27918d40   wuxw   v1.9 测试完成设备下的功能
42
43
        <el-table-column prop="createTime" :label="$t('maintainanceTaskDetail.createTime')" align="center" />
        <el-table-column :label="$t('common.operation')" align="center" width="100">
788477fb   wuxw   保养功能开发完成
44
          <template slot-scope="scope">
27918d40   wuxw   v1.9 测试完成设备下的功能
45
46
            <el-button type="text" @click="handleViewDetail(scope.row.taskDetailId)">
              {{ $t('common.detail') }}
788477fb   wuxw   保养功能开发完成
47
48
49
50
51
52
            </el-button>
          </template>
        </el-table-column>
      </el-table>
  
      <div class="pagination-wrapper">
27918d40   wuxw   v1.9 测试完成设备下的功能
53
54
55
        <el-pagination :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size"
          :total="pagination.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
          @current-change="handleCurrentChange" />
788477fb   wuxw   保养功能开发完成
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { listMaintainanceTaskDetail } from '@/api/inspection/maintainanceTaskManageApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'MaintainanceTaskDetail',
    data() {
      return {
        visible: false,
        loading: false,
        taskDetails: [],
        taskId: '',
        pagination: {
          current: 1,
          size: 10,
          total: 0
        },
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
    },
    methods: {
      open(data) {
        this.taskId = data.taskId
        this.visible = true
        this.loadTaskDetails()
      },
      handleClose() {
        this.taskDetails = []
        this.pagination.current = 1
      },
      loadTaskDetails() {
        this.loading = true
        const params = {
          page: this.pagination.current,
          row: this.pagination.size,
          taskId: this.taskId,
          communityId: this.communityId
        }
  
        listMaintainanceTaskDetail(params)
          .then(response => {
            this.taskDetails = response.data || []
            this.pagination.total = response.total || 0
          })
          .catch(error => {
            console.error('获取任务详情失败:', error)
            this.$message.error(this.$t('maintainanceTaskDetail.fetchError'))
          })
          .finally(() => {
            this.loading = false
          })
      },
      handleSizeChange(val) {
        this.pagination.size = val
        this.loadTaskDetails()
      },
      handleCurrentChange(val) {
        this.pagination.current = val
        this.loadTaskDetails()
      },
      handleViewDetail(taskDetailId) {
27918d40   wuxw   v1.9 测试完成设备下的功能
124
        window.open(`/#/views/inspection/maintainanceTaskDetailView?taskDetailId=${taskDetailId}`, '_blank')
788477fb   wuxw   保养功能开发完成
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
      }
    }
  }
  </script>
  
  <style scoped>
  .photo-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .text-primary {
    color: #409EFF;
  }
  
  .pagination-wrapper {
    margin-top: 20px;
    text-align: right;
  }
  </style>