Blame view

src/components/inspection/InspectionRoutePoint.vue 4.87 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
48ea9c43   wuxw   巡检开发完成
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
    <div class="inspection-route-point-container">
      <div class="text-right margin-bottom">
        <el-button type="primary" size="small" @click="_openAddInspectionRoutePointModal">
          {{ $t('common.add') }}
        </el-button>
      </div>
  
      <el-table :data="inspectionRoutePointInfo.inspectionPoints" border style="width: 100%">
        <el-table-column prop="inspectionId" :label="$t('inspectionRoute.pointId')" align="center" />
        <el-table-column prop="inspectionName" :label="$t('inspectionRoute.pointName')" align="center" />
        <el-table-column prop="pointTypeName" :label="$t('inspectionRoute.pointType')" align="center" />
        <el-table-column prop="pointObjName" :label="$t('inspectionRoute.pointLocation')" align="center" />
        <el-table-column :label="$t('inspectionRoute.startTime')" align="center">
          <template slot-scope="scope">
            {{ scope.row.pointStartTime || '-' }}
          </template>
        </el-table-column>
        <el-table-column :label="$t('inspectionRoute.endTime')" align="center">
          <template slot-scope="scope">
            {{ scope.row.pointEndTime || '-' }}
          </template>
        </el-table-column>
        <el-table-column :label="$t('inspectionRoute.sortNumber')" align="center">
          <template slot-scope="scope">
            {{ scope.row.sortNumber || '-' }}
          </template>
        </el-table-column>
        <el-table-column :label="$t('common.operation')" align="center" width="200">
          <template slot-scope="scope">
            <el-button size="mini" @click="_openEditInspectionRoutePointModel(scope.row)">
              {{ $t('common.edit') }}
            </el-button>
            <el-button size="mini" type="danger" @click="_openDeleteInspectionRoutePointModel(scope.row)">
              {{ $t('common.delete') }}
            </el-button>
          </template>
        </el-table-column>
      </el-table>
  
      <el-pagination :current-page.sync="page.current" :page-size="page.size" :total="page.total"
        layout="total, prev, pager, next" @current-change="handlePageChange" />
  
      <choose-inspection-route-point ref="chooseInspectionRoutePoint" @success="handleSuccess" />
      <edit-inspection-route-point ref="editInspectionRoutePoint" @success="handleSuccess" />
      <delete-inspection-route-point ref="deleteInspectionRoutePoint" @success="handleSuccess" />
    </div>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import { listInspectionRoutePoints } from '@/api/inspection/inspectionRouteApi'
  import ChooseInspectionRoutePoint from './ChooseInspectionRoutePoint'
  import EditInspectionRoutePoint from './EditInspectionRoutePoint'
  import DeleteInspectionRoutePoint from './DeleteInspectionRoutePoint'
  
  export default {
    name: 'InspectionRoutePoint',
    components: {
      ChooseInspectionRoutePoint,
      EditInspectionRoutePoint,
      DeleteInspectionRoutePoint
    },
    data() {
      return {
        inspectionRoutePointInfo: {
          inspectionPoints: [],
          inspectionRouteId: ''
        },
        page: {
          current: 1,
          size: 10,
          total: 0
        },
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
    },
    beforeDestroy() {
    },
    methods: {
56c7fec9   wuxw   巡检功能测试完成
84
85
86
87
      open(params) {
        this.inspectionRoutePointInfo.inspectionRouteId = params.inspectionRouteId
        this._listInspectionRoutePoints()
      },
48ea9c43   wuxw   巡检开发完成
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
124
125
126
127
128
129
130
131
132
133
134
      loadData(params) {
        this.inspectionRoutePointInfo.inspectionRouteId = params.inspectionRouteId
        this._listInspectionRoutePoints()
      },
      async _listInspectionRoutePoints() {
        try {
          const params = {
            page: this.page.current,
            row: this.page.size,
            communityId: this.communityId,
            inspectionRouteId: this.inspectionRoutePointInfo.inspectionRouteId
          }
          const { inspectionPoints, total } = await listInspectionRoutePoints(params)
          this.inspectionRoutePointInfo.inspectionPoints = inspectionPoints
          this.page.total = total
        } catch (error) {
          console.error('获取巡检点列表失败:', error)
        }
      },
      handleSwitch(params) {
        this.inspectionRoutePointInfo.inspectionRouteId = params.inspectionRouteId
        this._listInspectionRoutePoints()
      },
      _openAddInspectionRoutePointModal() {
        this.$refs.chooseInspectionRoutePoint.open({
          inspectionRouteId: this.inspectionRoutePointInfo.inspectionRouteId
        })
      },
      _openEditInspectionRoutePointModel(point) {
        this.$refs.editInspectionRoutePoint.open(point)
      },
      _openDeleteInspectionRoutePointModel(point) {
        this.$refs.deleteInspectionRoutePoint.open(point)
      },
      handlePageChange(currentPage) {
        this.page.current = currentPage
        this._listInspectionRoutePoints()
      },
      handleSuccess() {
        this._listInspectionRoutePoints()
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .inspection-route-point-container {
cbeb361b   wuxw   v1.9 巡检功能修复一些显示的bug
135
    padding: 10px;
48ea9c43   wuxw   巡检开发完成
136
137
138
139
140
141
  
    .margin-bottom {
      margin-bottom: 20px;
    }
  }
  </style>