<template> <app-container> <search-area :need-clear="true" :need-search-more="false" type="seperate" search-more-type="default" @search="search" @clear="clearInput"> <!--一般查询条件--> <search-item> <el-input v-model.trim="listQuery.caseId" placeholder="事件编号" size="small" clearable/> </search-item> <search-item/> <search-item> <el-input v-model.trim="listQuery.title" placeholder="事件标题" size="small" clearable/> </search-item> <search-item> <el-date-picker v-model="timeRange" type="datetimerange" size="small" range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="请示开始时间" end-placeholder="请示结束时间"/> </search-item> </search-area> <normal-table :data="list" :head="tableOption.head" :query="listQuery" :total="total" :columns="columns" :list-loading="listLoading" :options="tableOption.options" :tools-option="tableOption.toolsOption" @change="changePage"> <template slot="columns"> <el-table-column label="操作" align="center" width="100"> <template slot-scope="scope"> <el-button type="text" size="small" @click.stop="goDetail(scope.row)">详情</el-button> </template> </el-table-column> </template> </normal-table> </app-container> </template> <script> import NormalTable from '@/components/NomalTable' import AppContainer from '@/components/layout/AppContainer' import SearchArea from '@/components/SearchArea/SearchArea' import SearchItem from '@/components/SearchArea/SearchItem' import { searchReportList } from '@/api/caseReport' export default { name: 'SearchReportList', components: { SearchItem, SearchArea, AppContainer, NormalTable }, data() { return { listQuery: { caseId: '', // 事件编号 title: '', // 事件标题 startTime: '', endTime: '', offset: 1, limit: 20, sort: 'reportTime', order: 'desc' }, // 筛选条件 timeRange: [], columns: [ { text: '事件标题', value: 'title', align: 'center' }, { text: '事件状态', value: 'stateName', align: 'center' }, { text: '请示人', value: 'reportUserName', align: 'center' }, { text: '请示内容', value: 'reportContent', align: 'center' }, { text: '请示时间', value: 'reportTime', align: 'center' }, { text: '处理人', value: 'processUserName', align: 'center' }, { text: '处理状态', value: 'processStateName', align: 'center' }, { text: '处理方式', value: 'processTypeName', align: 'center' }, { text: '处理时间', value: 'processTime', align: 'center' }, { text: '处理结果', value: 'processContent', align: 'center' }, { text: '限办日期', value: 'limitedTime', align: 'center' } ], // 显示列 list: [], // 列表数据 total: 0, // 数据总数 listLoading: true, // 列表加载动画 tableOption: { head: { show: false, // 是否需要标题栏, text: '数据列表' // 标题名称 }, options: { needIndex: false // 是否需要序号列 }, toolsOption: { selectColumns: false, // 是否需要筛选列 refresh: false // 是否需要刷新按钮 } } // 表格属性 } }, watch: { timeRange(val) { if (val && val.length > 0) { this.listQuery.startTime = val[0] this.listQuery.endTime = val[1] } else { this.listQuery.startTime = '' this.listQuery.endTime = '' } } }, created() { this.fetchData() }, methods: { fetchData() { this.listLoading = true searchReportList(this.listQuery).then(res => { this.list = res.data.rows this.total = res.data.total this.listLoading = false }) }, search() { this.listQuery.offset = 1 this.fetchData() }, // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 changePage(val) { if (val && val.size) { this.listQuery.limit = val.size } if (val && val.page) { this.listQuery.offset = val.page } this.fetchData() }, // 重置后的操作, 若不需要显示重置按钮则不需要写 clearInput() { this.listQuery.caseId = '' this.listQuery.title = '' this.timeRange = [] }, // 查看详情 goDetail(row) { this.$router.push({ path: '/caseDetail/' + row.caseId, query: { showProcess: false } }) } } } </script> <style scoped> </style>