Blame view

ant-design-vue-jeecg/src/views/system/DataLogList.vue 4.13 KB
肖超群 authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="表名">
              <a-input placeholder="请输入表名" v-model="queryParam.dataTable"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="数据ID">
              <a-input placeholder="请输入ID" v-model="queryParam.dataId"></a-input>
            </a-form-item>
          </a-col>

          <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
               <a-col :md="6" :sm="24">
20
21
                  <a-button type="primary" @click="searchQuery">{{ $t('button.search') }}</a-button>
                  <a-button style="margin-left: 8px" @click="searchReset">{{ $t('button.reset') }}</a-button>
肖超群 authored
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
               </a-col>
            </span>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleCompare()" type="primary" icon="plus">数据比较</a-button>
    </div>

    <!--table区 -->
    <div>
      <!--已选择的清空 -->
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
37
38
39
        <i class="anticon anticon-info-circle ant-alert-icon"></i> {{ $t('button.selected') }}
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> {{ $t('button.item') }}
        <a style="margin-left: 24px" @click="onClearSelected">{{ $t('button.clearAll') }}</a>
肖超群 authored
40
      </div>
41
肖超群 authored
42
43
44
45
46
47
48
49
50
51
52
53
54
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys,onChange: onSelectChange}"
        @change="handleTableChange"
      >
        <!-- 字符串超长截取省略号显示-->
55
        <span slot="dataContent" slot-scope="text">
肖超群 authored
56
          <j-ellipsis :value="text" :length="80"/>
肖超群 authored
57
58
59
60
61
62
63
64
        </span>
      </a-table>
    </div>
    <data-log-modal ref="modalForm" @ok="modalFormOk"></data-log-modal>
  </a-card>
</template>

<script>
肖超群 authored
65
66
67
import DataLogModal from './modules/DataLogModal'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import JEllipsis from "@/components/jeecg/JEllipsis";
肖超群 authored
68
肖超群 authored
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
export default {
  name: 'DataLogList',
  mixins: [JeecgListMixin],
  components: {
    JEllipsis,
    DataLogModal
  },
  data() {
    return {
      description: '数据日志管理页面',
      //表头
      columns: [
        {
          title: '表名',
          align: 'center',
          dataIndex: 'dataTable',
          width: "120"
        }, {
          title: '数据ID',
          align: 'center',
          dataIndex: 'dataId',
          width: "120"
        }, {
          title: '版本号',
          align: 'center',
          dataIndex: 'dataVersion',
          width: "50"
        }, {
          title: '数据内容',
          align: 'center',
          dataIndex: 'dataContent',
          width: "150",
          scopedSlots: {customRender: 'dataContent'},
        }, {
103
          title: this.$t('system.createBy'),
肖超群 authored
104
105
106
          align: 'center',
          dataIndex: 'createBy',
          width: "100"
肖超群 authored
107
        },
肖超群 authored
108
109
110
      ],
      url: {
        list: "/sys/dataLog/list",
肖超群 authored
111
112
      },
    }
肖超群 authored
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
  },
  methods: {
    handleCompare: function () {
      if (!this.selectionRows || this.selectionRows.length != 2) {
        this.openNotifIcon('请选择两条数据');
        return false;
      } else if (this.selectionRows[0].dataId != this.selectionRows[1].dataId) {
        this.openNotifIcon('请选择相同的数据库表和数据ID进行比较');
        return false;
      } else {
        this.$refs.modalForm.addModal(this.selectionRows);
        this.$refs.modalForm.title = "数据比较";
      }
    },
    openNotifIcon(msg) {
      this.$notification['warning']({
        message: '提示信息',
        description: msg,
      });
    },
肖超群 authored
133
134
  }
肖超群 authored
135
136
}
肖超群 authored
137
138
</script>
<style scoped>
肖超群 authored
139
@import '~@assets/less/common.less'
肖超群 authored
140
</style>