zxl
2026-03-20 155dbc01da52ccee7a968bfe7297b5fc0357e6bb
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<template>
  <a-modal centered width="60%" :footer="false" v-model="visibleShow" title="下发记录" @cancel="cancelClick">
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px; height: 38px">
        <span style="float: right">
          <a @click="init"><a-icon type="sync" />刷新</a>
        </span>
      </div>
 
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :pagination="ipagination"
        :columns="defaultColumns"
        :dataSource="dataSource"
        @change="TableChange"
        :scroll="{ y: 400 }"
      >
        <div slot="status" slot-scope="text, record">
          <a-tag :color="record.status === 0 ? '#f50' : record.status === 2 ? '#2db7f5' : '#87d068'">
            {{ record.status | filterStatus }}
          </a-tag>
        </div>
      </a-table>
    </div>
  </a-modal>
</template>
 
<script>
import { getAction } from '@tievd/cube-block/lib/api/manage'
export default {
  created() {},
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    upgradeId: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      visibleShow: false,
      // 列定义
      defaultColumns: [
        {
          title: '序号',
          key: 'rowIndex',
          width: 150,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '创建时间',
          width: 150,
          align: 'center',
          dataIndex: 'createTime',
        },
        {
          title: '下发时间',
          width: 150,
          align: 'center',
          dataIndex: 'issueTime',
        },
        {
          title: '设备名称',
          width: 150,
          align: 'center',
          dataIndex: 'deviceName',
        },
        {
          title: '所属机构',
          width: 150,
          align: 'center',
          dataIndex: 'departName',
        },
 
        {
          title: '失败原因',
          width: 150,
          align: 'center',
          dataIndex: 'issueFailReason',
        },
        {
          title: '下发状态',
          align: 'center',
          scopedSlots: { customRender: 'status' },
        },
        // {
        //   title: '操作',
        //   dataIndex: 'action',
        //   width: 250,
        //   align: 'center',
        //   scopedSlots: { customRender: 'action' },
        // },
      ],
      queryForm: {
        pageNo: 1,
        pageSize: 10,
        upgradeId: 0,
      },
      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) {
      if (val) this.init()
      this.visibleShow = val
    },
    upgradeId(val) {
      this.queryForm.upgradeId = val
    },
  },
  filters: {
    filterStatus(val) {
      let text = ''
      switch (val) {
        case 0:
          text = '失败'
          break
        case 1:
          text = '成功'
          break
        case 2:
          text = '下发中'
          break
        default:
          break
      }
      return text
    },
  },
  methods: {
    // 点击关闭或者是遮罩发射关闭信号给父组件,控制关闭
    cancelClick() {
      this.$emit('modalClose')
    },
    // 下发记录
    init() {
      getAction('/jyz/upgradeRecord/tables', this.queryForm).then((res) => {
        if (res.code == 200) {
          const { records, total } = res.result
          this.dataSource = records
          this.ipagination.total = parseInt(total)
        }
      })
    },
    //分页
    TableChange(val) {
      console.log(val)
      const { current, pageSize } = val
      this.queryForm.pageNo = current
      this.queryForm.pageSize = pageSize
    },
  },
}
</script>
<!-- @import '~@assets/less/dialog.less'; -->
<style scoped lang="less"></style>