ll
liukangdong
2024-12-03 b2e8e233d59d107615a8336dce9da36f1f8bcde0
1
2
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
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
<template>
  <GlobalWindow title="巡检任务详情" :showConfirm="false" :visible.sync="isShowModal">
    <QueryForm v-model="filters" :query-form-config="queryFormConfig" @handleQuery="getDetail(1)" @clear="clear" />
    <el-table v-loading="loading" :data="list" stripe>
      <el-table-column prop="pointName" label="巡检点名称" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="状态" min-width="100" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span v-if="row.status == 0">待开始</span>
          <span v-if="row.status == 1">已巡检</span>
        </template>
      </el-table-column>
      <el-table-column prop="realname" label="巡检人" min-width="100" show-overflow-tooltip />
      <el-table-column prop="editDate" label="巡检时间" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="巡检结果" min-width="100" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span class="gray" v-if="row.dealStatus == 0">正常</span>
          <span class="red" v-if="row.dealStatus == 1">异常</span>
        </template>
      </el-table-column>
      <el-table-column prop="dealInfo" label="巡检说明" min-width="100" show-overflow-tooltip />
    </el-table>
    <div class="mt20">
      <Pagination @size-change="handleSizeChange" @current-change="getDetail" :pagination="pagination" />
    </div>
  </GlobalWindow>
</template>
 
<script>
import GlobalWindow from '@/components/common/GlobalWindow'
import QueryForm from '@/components/common/QueryForm'
import Pagination from '@/components/common/Pagination'
import { getDetail } from '@/api/Inspection/ywPatrolTask'
import dayjs from 'dayjs'
export default {
  components: { GlobalWindow, QueryForm, Pagination },
  data() {
    return {
      isShowModal: false,
      id: '',
      pagination: {
        pageSize: 10,
        page: 1,
        total: 0
      },
      loading:false,
      filters: {},
      list: [],
      total: 0,
      queryFormConfig: {
        formItems: [
          {
            filed: 'pointName',
            type: 'input',
            label: '巡检点名称'
          },
          {
            filed: 'status',
            type: 'select',
            label: '状态',
            placeholder: '全部',
            options: [
              { label: '待开始', value: 0 },
              { label: '已巡检', value: 1 },
            ]
          },
        ],
        online: true
      }
    }
  },
  methods: {
    getDetail(page) {
      const { pagination, filters, id } = this
      this.loading = true
      getDetail({
        model: {
          ...filters,
          taskId: id,
        },
        sorts: [{ direction: 'DESC', property: 'param1' }],
        capacity: pagination.pageSize,
        page: page || pagination.page,
      }).then(res => {
        this.loading = false
        this.list = res.records || []
        this.pagination.total = res.total
        // this.list.forEach(item => {
        //   item.inTypeTemp = item.inType == 0 ? '整托盘' : '件烟'
        //   item.taskOrigin = 'WMS获取'
        //   item.workTime = dayjs.duration(item.param3, 'seconds').format('H时m分s秒')
        // })
        this.pagination.total = res.total || 0
      }, () => {
        this.loading = false
      })
    },
    clear() {
      this.filters = {}
      this.pagination.pageSize = 10
      this.pagination.page = 1
      this.getDetail()
    },
    handleSizeChange(capacity) {
      this.pagination.pageSize = capacity
      this.getDetail()
    }
  }
}
</script>