Files
laws-sinotruk-client/src/views/system/DataLogList.vue
T
2023-08-14 17:10:11 +08:00

139 lines
4.2 KiB
Vue

<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="$t('log.tableName')">
<a-input :placeholder="$t('pleaseEnter') + $t('log.tableName')" v-model="queryParam.dataTable"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item :label="$t('log.dataID')">
<a-input :placeholder="$t('pleaseEnter') + '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">
<a-button type="primary" @click="searchQuery">{{ $t('query') }}</a-button>
<a-button style="margin-left: 8px" @click="searchReset">{{ $t('reset') }}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleCompare()" type="primary" icon="plus">{{ $t('log.dataComparison') }}</a-button>
</div>
<!--table区 -->
<div>
<!--已选择的清空 -->
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i>{{$t('selected')}}&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>{{ $t('term') }}&nbsp;&nbsp;
<a style="margin-left: 24px" @click="onClearSelected">{{ $t('empty') }}</a>
</div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys,onChange: onSelectChange}"
@change="handleTableChange"
>
<!-- 字符串超长截取省略号显示-->
<span slot="dataContent" slot-scope="text">
<j-ellipsis :value="text" :length="80" />
</span>
</a-table>
</div>
<data-log-modal ref="modalForm" @ok="modalFormOk"></data-log-modal>
</a-card>
</template>
<script>
import DataLogModal from './modules/DataLogModal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JEllipsis from '@/components/jero/JEllipsis'
export default {
name: 'DataLogList',
mixins: [JeroListMixin],
components: {
JEllipsis,
DataLogModal
},
data () {
return {
description: '数据日志管理页面',
// 表头
columns: [
{
title: this.$t('log.tableName'),
align: 'center',
dataIndex: 'dataTable',
width: '120'
}, {
title: this.$t('log.dataID'),
align: 'center',
dataIndex: 'dataId',
width: '120'
}, {
title: this.$t('log.versionNumber'),
align: 'center',
dataIndex: 'dataVersion',
width: '50'
}, {
title: this.$t('log.dataContent'),
align: 'center',
dataIndex: 'dataContent',
width: '150',
scopedSlots: { customRender: 'dataContent' }
}, {
title: this.$t('creator'),
align: 'center',
dataIndex: 'createBy',
width: '100'
}
],
url: {
list: '/sys/dataLog/page'
}
}
},
methods: {
handleCompare: function () {
if (!this.selectionRows || this.selectionRows.length !== 2) {
this.openNotifIcon(this.$t('log.selectTwoPiecesData'))
return false
} else if (this.selectionRows[0].dataId !== this.selectionRows[1].dataId) {
this.openNotifIcon(this.$t('log.selectSameDatabase'))
return false
} else {
this.$refs.modalForm.addModal(this.selectionRows)
this.$refs.modalForm.title = this.$t('log.dataComparison')
}
},
openNotifIcon (msg) {
this.$notification.warning({
message: this.$t('log.promptInformation'),
description: msg
})
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>