Blame view

src/components/aCommunity/aCarDetailTransactionCar.vue 3.03 KB
0b8f34f9   wuxw   完成admin下的房屋详情页面,业...
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
  <template>
    <div class="margin-top">
      <el-row class="margin-top-lg"></el-row>
      
      <div class="margin-top">
        <el-table :data="aCarDetailTransactionCarInfo.translates" style="width: 100%">
          <el-table-column prop="machineTranslateId" :label="$t('carDetailTransaction.syncId')" align="center"></el-table-column>
          <el-table-column prop="machineCode" :label="$t('carDetailTransaction.deviceCode')" align="center"></el-table-column>
          <el-table-column prop="typeCdName" :label="$t('carDetailTransaction.objectType')" align="center"></el-table-column>
          <el-table-column prop="objName" :label="$t('carDetailTransaction.objectName')" align="center"></el-table-column>
          <el-table-column prop="machineCmdName" :label="$t('carDetailTransaction.command')" align="center"></el-table-column>
          <el-table-column prop="stateName" :label="$t('carDetailTransaction.status')" align="center"></el-table-column>
          <el-table-column prop="remark" :label="$t('carDetailTransaction.remark')" align="center" width="80"></el-table-column>
          <el-table-column prop="updateTime" :label="$t('carDetailTransaction.syncTime')" align="center"></el-table-column>
        </el-table>
  
        <el-row class="margin-top">
          <el-col :span="12"></el-col>
          <el-col :span="12" class="text-right">
            <el-pagination
              @current-change="handlePageChange"
              :current-page="currentPage"
              :page-size="pageSize"
              layout="total, prev, pager, next"
              :total="total">
            </el-pagination>
          </el-col>
        </el-row>
      </div>
    </div>
  </template>
  
  <script>
  import { listAdminMachineTranslates } from '@/api/aCommunity/aCarDetailTransactionCarApi'
  
  export default {
    name: 'ACarDetailTransactionCar',
    data() {
      return {
        aCarDetailTransactionCarInfo: {
          translates: [],
          ownerId: '',
          carId: '',
          memberId: ''
        },
        currentPage: 1,
        pageSize: 10,
        total: 0
      }
    },
    methods: {
      open(data) {
        this.handleSwitch(data)
      },
      handleSwitch(data) {
        this.aCarDetailTransactionCarInfo.carId = data.carId
        this.aCarDetailTransactionCarInfo.memberId = data.memberId
        this._loadACarDetailTransactionCarData(1, this.pageSize)
      },
      handlePageChange(page) {
        this.currentPage = page
        this._loadACarDetailTransactionCarData(page, this.pageSize)
      },
      async _loadACarDetailTransactionCarData(page, row) {
        try {
          const param = {
            page,
            row,
            objId: this.aCarDetailTransactionCarInfo.memberId,
            typeCd: '4455'
          }
          const response = await listAdminMachineTranslates(param)
          this.aCarDetailTransactionCarInfo.translates = response.machineTranslates
          this.total = response.records
        } catch (error) {
          console.error('Failed to load transaction data:', error)
        }
      }
    }
  }
  </script>
  
  <style scoped>
  .margin-top {
    margin-top: 20px;
  }
  .margin-top-lg {
    margin-top: 40px;
  }
  .text-right {
    text-align: right;
  }
  </style>