Blame view

src/components/system/carDetailHis.vue 5.02 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
ce5e1a2a   wuxw   系统模块开发中
2
    <div class="car-detail-his">
1d33ddab   wuxw   开发完成车辆详情页面
3
4
      <el-table :data="carDetailHisInfo.cars" border style="width: 100%" v-loading="loading">
        <el-table-column prop="carNum" :label="$t('carDetailHis.carNum')" align="center">
ce5e1a2a   wuxw   系统模块开发中
5
        </el-table-column>
1d33ddab   wuxw   开发完成车辆详情页面
6
        <el-table-column :label="$t('carDetailHis.leaseType')" align="center">
ce5e1a2a   wuxw   系统模块开发中
7
8
9
10
11
          <template slot-scope="scope">
            <span v-if="scope.row.leaseType === 'T'">{{ $t('carDetailHis.tempCar') }}</span>
            <span v-else>{{ scope.row.leaseTypeName }}</span>
          </template>
        </el-table-column>
963f5a4f   wuxw   车辆功能测试完成
12
        <el-table-column :label="$t('carDetailHis.carType')" align="center">
ce5e1a2a   wuxw   系统模块开发中
13
14
15
16
          <template slot-scope="scope">
            {{ scope.row.carTypeName || '-' }}
          </template>
        </el-table-column>
963f5a4f   wuxw   车辆功能测试完成
17
        <el-table-column :label="$t('carDetailHis.color')" align="center">
ce5e1a2a   wuxw   系统模块开发中
18
19
20
21
          <template slot-scope="scope">
            {{ scope.row.carColor || '-' }}
          </template>
        </el-table-column>
1d33ddab   wuxw   开发完成车辆详情页面
22
        <el-table-column :label="$t('carDetailHis.owner')" align="center">
ce5e1a2a   wuxw   系统模块开发中
23
24
25
26
27
28
          <template slot-scope="scope">
            <div class="hand">
              {{ scope.row.ownerName }}({{ scope.row.link }})
            </div>
          </template>
        </el-table-column>
1d33ddab   wuxw   开发完成车辆详情页面
29
        <el-table-column :label="$t('carDetailHis.parkingSpace')" align="center">
ce5e1a2a   wuxw   系统模块开发中
30
31
32
33
34
          <template slot-scope="scope">
            <span v-if="scope.row.areaNum && scope.row.state === '1001'">
              {{ scope.row.areaNum }}-{{ scope.row.num }}
            </span>
            <span v-else>
963f5a4f   wuxw   车辆功能测试完成
35
              {{ $t('carDetailHis.spaceReleased') }}
ce5e1a2a   wuxw   系统模块开发中
36
37
38
            </span>
          </template>
        </el-table-column>
963f5a4f   wuxw   车辆功能测试完成
39
        <el-table-column :label="$t('carDetailHis.validPeriod')" align="center">
ce5e1a2a   wuxw   系统模块开发中
40
41
42
43
44
45
46
          <template slot-scope="scope">
            <div v-if="scope.row.leaseType === 'H'">
              {{ scope.row.startTime }}<br>~{{ scope.row.endTime }}
            </div>
            <div v-else>--</div>
          </template>
        </el-table-column>
963f5a4f   wuxw   车辆功能测试完成
47
        <el-table-column :label="$t('common.operation')" align="center">
ce5e1a2a   wuxw   系统模块开发中
48
49
50
51
          <template slot-scope="scope">
            {{ _getHisOperate(scope.row) }}
          </template>
        </el-table-column>
963f5a4f   wuxw   车辆功能测试完成
52
        <el-table-column :label="$t('carDetailHis.operator')" align="center">
ce5e1a2a   wuxw   系统模块开发中
53
54
55
56
          <template slot-scope="scope">
            {{ scope.row.userName || '-' }}
          </template>
        </el-table-column>
963f5a4f   wuxw   车辆功能测试完成
57
        <el-table-column :label="$t('carDetailHis.operateTime')" align="center">
ce5e1a2a   wuxw   系统模块开发中
58
59
60
61
62
63
          <template slot-scope="scope">
            {{ scope.row.createTime }}
          </template>
        </el-table-column>
      </el-table>
  
1d33ddab   wuxw   开发完成车辆详情页面
64
65
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page.current"
        :page-sizes="[10, 20, 30, 50]" :page-size="page.size" layout="total, sizes, prev, pager, next, jumper"
ce5e1a2a   wuxw   系统模块开发中
66
67
68
69
70
71
72
        :total="page.total">
      </el-pagination>
    </div>
  </template>
  
  <script>
  import { queryHisOwnerCar } from '@/api/system/operateDataLogApi'
1d33ddab   wuxw   开发完成车辆详情页面
73
  import { getCommunityId } from '@/api/community/communityApi'
ce5e1a2a   wuxw   系统模块开发中
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
  
  export default {
    name: 'CarDetailHis',
    data() {
      return {
        loading: false,
        carDetailHisInfo: {
          cars: [],
          carId: '',
          memberId: '',
          carNum: '',
          carNumLike: '',
          logStartTime: '',
          logEndTime: '',
          paId: ''
        },
        page: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    methods: {
      open(conditions) {
        this.carDetailHisInfo = {
          ...this.carDetailHisInfo,
          ...conditions
        }
        this._loadCarDetailHisData()
      },
      async _loadCarDetailHisData() {
        try {
          this.loading = true
          const params = {
            page: this.page.current,
            row: this.page.size,
            carNum: this.carDetailHisInfo.carNum,
            carNumLike: this.carDetailHisInfo.carNumLike,
            logStartTime: this.carDetailHisInfo.logStartTime,
1d33ddab   wuxw   开发完成车辆详情页面
114
115
            logEndTime: this.carDetailHisInfo.logEndTime,
            communityId: getCommunityId()
ce5e1a2a   wuxw   系统模块开发中
116
          }
1d33ddab   wuxw   开发完成车辆详情页面
117
  
ce5e1a2a   wuxw   系统模块开发中
118
119
120
121
122
123
124
125
126
127
128
          const { data, total } = await queryHisOwnerCar(params)
          this.carDetailHisInfo.cars = data
          this.page.total = total
        } catch (error) {
          console.error('Failed to load car history:', error)
        } finally {
          this.loading = false
        }
      },
      _getHisOperate(car) {
        const carCount = this.carDetailHisInfo.cars.filter(item => item.bId === car.bId).length
1d33ddab   wuxw   开发完成车辆详情页面
129
  
ce5e1a2a   wuxw   系统模块开发中
130
131
132
133
134
        if (carCount <= 1) {
          if (car.operate === 'ADD') return this.$t('carDetailHis.add')
          if (car.operate === 'DEL') return this.$t('carDetailHis.delete')
          return '-'
        }
1d33ddab   wuxw   开发完成车辆详情页面
135
  
ce5e1a2a   wuxw   系统模块开发中
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
        if (car.operate === 'ADD') return this.$t('carDetailHis.modifyNew')
        if (car.operate === 'DEL') return this.$t('carDetailHis.modifyOld')
        return '-'
      },
      handleSizeChange(size) {
        this.page.size = size
        this._loadCarDetailHisData()
      },
      handleCurrentChange(current) {
        this.page.current = current
        this._loadCarDetailHisData()
      }
    }
  }
  </script>
  
  <style scoped>
  .car-detail-his {
    padding: 20px;
  }
  
  .hand {
    cursor: pointer;
  }
  
  .el-pagination {
    margin-top: 20px;
    text-align: right;
  }
  </style>