Blame view

src/components/simplify/simplifyOwnerTransactionCar.vue 4.96 KB
0a41b92e   wuxw   开发完成业务受理页面
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
  <template>
    <div>
      <el-row class="margin-top">
        <el-col :span="4">
          <el-select v-model="simplifyOwnerTransactionCarInfo.carId" @change="changeTransactionCar">
            <el-option
              v-for="(item,index) in simplifyOwnerTransactionCarInfo.ownerCars"
              :key="index"
              :label="item.carNum"
              :value="item.carId"
            ></el-option>
          </el-select>
        </el-col>
        <el-col :span="20"></el-col>
      </el-row>
      <div>
        <el-table
          :data="simplifyOwnerTransactionCarInfo.machineTranslates"
          style="margin-top:10px"
          border
        >
          <el-table-column prop="machineTranslateId" :label="$t('simplifyOwnerTransactionCar.syncId')" align="center"></el-table-column>
          <el-table-column prop="typeCdName" :label="$t('simplifyOwnerTransactionCar.objectType')" align="center"></el-table-column>
          <el-table-column prop="objName" :label="$t('simplifyOwnerTransactionCar.objectName')" align="center"></el-table-column>
          <el-table-column prop="machineCmdName" :label="$t('simplifyOwnerTransactionCar.command')" align="center"></el-table-column>
          <el-table-column prop="stateName" :label="$t('simplifyOwnerTransactionCar.status')" align="center"></el-table-column>
          <el-table-column prop="remark" :label="$t('simplifyOwnerTransactionCar.remark')" align="center" width="80px"></el-table-column>
          <el-table-column prop="updateTime" :label="$t('simplifyOwnerTransactionCar.syncTime')" align="center"></el-table-column>
92c405db   wuxw   优化业务受理中部分选项打不开bug
29
          <!-- <el-table-column :label="$t('simplifyOwnerTransactionCar.operation')" align="center">
0a41b92e   wuxw   开发完成业务受理页面
30
31
32
33
34
35
            <template slot-scope="scope">
              <el-button
                size="mini"
                @click="_openEditCarTranslateModel(scope.row)"
              >{{$t('simplifyOwnerTransactionCar.resync')}}</el-button>
            </template>
92c405db   wuxw   优化业务受理中部分选项打不开bug
36
          </el-table-column> -->
0a41b92e   wuxw   开发完成业务受理页面
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
        </el-table>
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="pageSize"
          layout="total, prev, pager, next"
          :total="total"
          class="pagination"
        ></el-pagination>
      </div>
    </div>
  </template>
  
  <script>
  import { listMachineTranslates, queryOwnerCars } from '@/api/simplify/simplifyOwnerTransactionCarApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'SimplifyOwnerTransactionCar',
    data() {
      return {
        simplifyOwnerTransactionCarInfo: {
          machineTranslates: [],
          ownerId: '',
          carId: '',
          ownerCars: []
        },
        currentPage: 1,
        pageSize: 10,
        total: 0,
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
0a41b92e   wuxw   开发完成业务受理页面
72
73
    },
    methods: {
92c405db   wuxw   优化业务受理中部分选项打不开bug
74
75
76
      open(params) {
        this.handleSwitch(params)
      },
0a41b92e   wuxw   开发完成业务受理页面
77
78
79
80
81
82
83
84
85
      handleSwitch(params) {
        if (!params.ownerId) return
        this.clearSimplifyOwnerTransactionCarInfo()
        Object.assign(this.simplifyOwnerTransactionCarInfo, params)
        this.listTransactionOwnerCar().then(() => {
          this.listMachineTranslates()
        })
      },
      async listMachineTranslates() {
946eab95   wuxw   v1.9 优化客户周反馈bug
86
        if(!this.simplifyOwnerTransactionCarInfo.carId) return
0a41b92e   wuxw   开发完成业务受理页面
87
88
89
90
91
92
93
94
95
        try {
          const params = {
            page: this.currentPage,
            row: this.pageSize,
            communityId: this.communityId,
            objId: this.simplifyOwnerTransactionCarInfo.carId,
            typeCd: '4455'
          }
          const res = await listMachineTranslates(params)
92c405db   wuxw   优化业务受理中部分选项打不开bug
96
97
          this.simplifyOwnerTransactionCarInfo.machineTranslates = res.machineTranslates
          this.total = res.total
0a41b92e   wuxw   开发完成业务受理页面
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
        } catch (error) {
          console.error('Failed to load machine translates:', error)
        }
      },
      async listTransactionOwnerCar() {
        try {
          const params = {
            page: 1,
            row: 50,
            ownerId: this.simplifyOwnerTransactionCarInfo.ownerId,
            communityId: this.communityId
          }
          const res = await queryOwnerCars(params)
          this.simplifyOwnerTransactionCarInfo.ownerCars = res.data
          if (res.data.length > 0) {
            this.simplifyOwnerTransactionCarInfo.carId = res.data[0].carId
          }
        } catch (error) {
          console.error('Failed to load owner cars:', error)
        }
      },
      changeTransactionCar() {
        const car = this.simplifyOwnerTransactionCarInfo.ownerCars.find(
          item => item.carId === this.simplifyOwnerTransactionCarInfo.carId
        )
        if (!car) return
        this.listMachineTranslates()
      },
      clearSimplifyOwnerTransactionCarInfo() {
        this.simplifyOwnerTransactionCarInfo = {
          machineTranslates: [],
          ownerId: '',
          carId: '',
          ownerCars: []
        }
      },
      handleCurrentChange(val) {
        this.currentPage = val
        this.listMachineTranslates()
      },
      _openEditCarTranslateModel(machineTranslate) {
        this.$emit('edit-machine-translate', machineTranslate)
      }
    }
  }
  </script>
  
  <style scoped>
  .margin-top {
    margin-top: 15px;
  }
  .pagination {
    margin-top: 15px;
    text-align: right;
  }
  </style>