china
2023-05-11 c7bc3eb18e1fda4254ca0195e2133d2ed978de11
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
<template>
  <div class="app-main">
    <div class="app-container">
      <my-table-v3 ref="myTable" :filter="filterForm" :table="table" />
    </div>
  </div>
</template>
 
<script>
  import myTableV3 from '@/views/components/myTableV3';
  // import myButtonV2 from "@/views/components/myButtonV2";
  // import edit from "@/views/system/config/edit";
 
  export default {
    name: "Connection",
    components: {myTableV3},
    data(){
      return {
 
        /** 搜索条件*/
        filterForm: {
 
        },
 
        table: {
          showIndex: false, // 是否显示序号
          expand: false, // 是否显示详情数据
          checkBox: false, // 是否显示复选框
          url: globalConf.baseUrl + '/tcp/connection/list', // 请求地址
          // 工具条
          tools: {
            columnsCtrl: {// 列控制按钮
              show: false
            },
            generalExport: {// 通用导出按钮
              show: false
            }
          },
          columns: [
            { title: '通道ID', field: 'id', align: 'left', width: 260 },
            { title: '绑定终端', field: 'name', align: 'left', width: 200 },
            { title: '连接创建', field: 'createTimeMills', align: 'left', width: 170 },
            { title: '最后活跃', field: 'lastTime', align: 'left', width: 170},
            { title: '所属引擎', field: 'engineId', align: 'left', width: 130, formatter: row => {
                let title = '';
                switch (row.engineId) {
                  case 1:
                    title = 'TCP'
                    break
                  case 2:
                    title = 'WEBSOCKET'
                    break
                }
                return { value: title, type: 'primary' }
              }
            }
          ],
          // 操作信息
          operation: {
            show: true, // 显示操作列
            width: '200', // 列宽
            attr: [
              {
                title: '强制断开',
                checkPermission: 'tcp:connection:broken',
                events: row => {
                  this.broken(row)
                }
              }
            ]
          },
          paging: {
            show: true, // 显示分页
            // 分页信息
            page: {
              small: false,
              pageNum: 1,
              pageSize: 256,
              total: 0
            }
          }
        }
 
      }
    },
 
    methods: {
      // 查询table列表
      search(pageNum) {
        if (pageNum != undefined) {
          this.$refs.myTable.search({ pageNum: pageNum })
        } else {
          this.$refs.myTable.search()
        }
      },
      // 表单重置
      reset() {
        this.filterForm = {
          // configName: null,
          // configKey: null,
          // configType: null
        }
        this.search(1)
      },
 
      broken(row) {
 
      }
    }
  }
</script>
 
<style scoped>
 
</style>