123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <a-card size="small" :bordered="false">
- <div class="operateJournal">
- <!-- 搜索框 -->
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="操作时间">
- <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="操作信息">
- <a-input allowClear v-model.trim="queryParam.actDesc" placeholder="请输入操作信息" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="操作人">
- <a-input allowClear v-model.trim="queryParam.actorName" placeholder="请输入操作人" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="operateJournal-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="operateJournal-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- rowKey="id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- bordered>
- <span slot="actDesc" slot-scope="text, record">{{ record.actDate }}-{{ record.actDesc }}</span>
- <span slot="actorName" slot-scope="text, record">{{ record.actorName }}-{{ record.actorPhone }}</span>
- </s-table>
- </div>
- </a-card>
- </template>
- <script>
- import getDate from '@/libs/getDate'
- import { STable } from '@/components'
- import { journalList } from '@/api/OperateJournal.js'
- import rangeDate from '@/views/common/rangeDate.vue'
- export default {
- name: 'OperateJournal',
- components: { STable, rangeDate },
- data () {
- return {
- advanced: false, // 高级搜索 展开/关闭
- disabled: false, // 查询、重置按钮是否可操作
- tableHeight: 0,
- time: [
- getDate.getThreeday().starttime,
- getDate.getThreeday().endtime
- ],
- queryParam: {
- beginDate: getDate.getThreeday().starttime, // 查询的开始时间
- endDate: getDate.getThreeday().endtime, // 查询的结束时间
- actDesc: '',
- actorName: ''
- },
- dateFormat: 'YYYY-MM-DD',
- columns: [
- { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
- { title: '操作时间', dataIndex: 'actDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
- { title: 'IP', dataIndex: 'ip', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作人', dataIndex: 'actorName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '操作信息', dataIndex: 'actDesc', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.queryParam.beginDate = this.queryParam.beginDate + ' 00:00:00'
- this.queryParam.endDate = this.queryParam.endDate + ' 23:59:59'
- return journalList(Object.assign(parameter, this.queryParam)).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.disabled = false
- }
- return data
- })
- }
- }
- },
- methods: {
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate(this.time)
- this.queryParam.beginDate = getDate.getThreeday().starttime
- this.queryParam.endDate = getDate.getThreeday().endtime
- this.queryParam.actDesc = ''
- this.queryParam.actorName = ''
- this.$refs.table.refresh(true)
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 195
- }
- },
- watch: {
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- }
- }
- </script>
- <style lang="less">
- .operateJournal{
- .sTable{
- margin-top: 0;
- }
- }
- </style>
|