peng
2026-03-24 05c7478c26954ee6031f98fce6c8c9901abb98a0
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
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
<template>
  <a-modal centered width="60%" :footer="false" v-model="visibleShow" title="详情" @cancel="cancelClick">
    <div class="modal-box">
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px; height: 48px">
        <span style="float: right">
          <a-date-picker
            style="margin-right: 10px"
            :default-value="queryForm.dateDay"
            format="YYYY-MM-DD"
            @change="dateChange"
          />
          <a @click="init"><a-icon type="sync" />刷新</a>
        </span>
      </div>
 
      <a-table
        ref="table"
        size="middle"
        class="infoTable"
        rowKey="id"
        :pagination="ipagination"
        :columns="defaultColumns"
        :dataSource="dataSource"
        @change="TableChange"
        :loading="loading"
        :scroll="{ y: 400 }"
      >
      </a-table>
    </div>
  </a-modal>
</template>
 
<script>
import { getAction } from '@tievd/cube-block/lib/api/manage'
import moment from 'moment'
import { clearEmptyPro } from '@/utils/util'
export default {
  created() {},
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    dialogQueryParam: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      visibleShow: false,
      // 列定义
      defaultColumns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: '120px',
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '车辆ID',
          width: '200px',
          align: 'center',
          dataIndex: 'licenseNum',
        },
        {
          title: '车型',
          width: '300px',
          align: 'center',
          dataIndex: 'modelName',
        },
        {
          title: '加油量',
          width: '200px',
          align: 'center',
          dataIndex: 'oilVolume',
        },
        {
          title: '进站时间',
          //   width: '100px',
          align: 'center',
          dataIndex: 'startTime',
        },
      ],
      loading: false,
      queryForm: {},
      dataSource: [],
      /* 分页参数 */
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: function showTotal(total, range) {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0,
      },
    }
  },
  watch: {
    visible(val) {
      this.visibleShow = val
    },
    dialogQueryParam(val) {
      this.queryForm = { ...val, pageNo: 1, pageSize: 10 }
      if (val) this.init()
      // console.log(this.queryForm)
    },
  },
  methods: {
    moment,
    // 点击关闭或者是遮罩发射关闭信号给父组件,控制关闭
    cancelClick() {
      this.$emit('modalClose')
    },
    // 加油记录
    init() {
      this.loading = true
      getAction('/jyz/oilRecord/descOilVolume', this.queryForm).then((res) => {
        if (res.code == 200) {
          this.loading = false
          const { records, total } = res.result
          this.dataSource = records.length !== 0 ? clearEmptyPro(records) : []
          this.ipagination.total = parseInt(total)
        }
      })
    },
    //分页
    TableChange(val) {
      const { current, pageSize } = val
      this.queryForm.pageNo = current
      this.queryForm.pageSize = pageSize
      this.init()
    },
    //监听切换
    dateChange(val, date) {
      this.queryForm.dateDay = date
      this.init()
    },
  },
}
</script>
 
<style scoped lang="less">
 
</style>