|
@@ -12,9 +12,14 @@
|
|
|
height: '50px'
|
|
|
}"
|
|
|
>
|
|
|
- <el-table-column label="序号" width="60" align="center" v-if="showIndex">
|
|
|
+ <el-table-column label="序号" width="60" align="center">
|
|
|
<template #default="scope">{{ scope.$index + 1 }}</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="日期" width="130">
|
|
|
+ <template #default="scope">{{
|
|
|
+ moment(scope.row.createTime).format('YYYY-MM-DD')
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
v-for="item in column"
|
|
|
:key="item.prop"
|
|
@@ -22,25 +27,27 @@
|
|
|
:label="item.label"
|
|
|
:width="item.width"
|
|
|
:align="item.align"
|
|
|
+ :show-overflow-tooltip="item.tooltip"
|
|
|
/>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
- <div class="pageBox" v-if="dataSource.length > 0">
|
|
|
- <el-pagination
|
|
|
- :page-size="20"
|
|
|
- background
|
|
|
- layout="total, prev, pager, next"
|
|
|
- :total="pageTotal"
|
|
|
- :current-page="pageNo"
|
|
|
- @current-change="currentChange"
|
|
|
- />
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ <div class="pageBox" v-if="dataSource.length > 0">
|
|
|
+ <el-pagination
|
|
|
+ :page-size="20"
|
|
|
+ background
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ :total="pageTotal"
|
|
|
+ :current-page="pageNo"
|
|
|
+ @current-change="currentChange"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, onMounted } from 'vue'
|
|
|
import http from '@/config/axios'
|
|
|
import PubsubService from '@/utils/PubsubService'
|
|
|
+import moment from 'moment'
|
|
|
|
|
|
interface ITable {
|
|
|
pageKey: string // 页面的唯一标识
|
|
@@ -60,7 +67,7 @@ interface ITable {
|
|
|
}
|
|
|
|
|
|
const props = defineProps<ITable>()
|
|
|
-const { pageKey, request, column, showIndex } = props
|
|
|
+const { pageKey, request, column } = props
|
|
|
|
|
|
const loading = ref(false)
|
|
|
const dataSource = ref([])
|
|
@@ -90,17 +97,23 @@ onMounted(() => {
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
window.removeEventListener('resize', updateTableHeight)
|
|
|
+ // 取消订阅
|
|
|
+ if (PubsubService.hasSubsByTopic(pageKey)) {
|
|
|
+ PubsubService.clearSubsByTopic(pageKey)
|
|
|
+ }
|
|
|
})
|
|
|
-
|
|
|
// 获取数据
|
|
|
const getDataSource = (params = {}) => {
|
|
|
if (!request.url || request.url == '') return
|
|
|
loading.value = true
|
|
|
http
|
|
|
- .get({
|
|
|
- url: request.url,
|
|
|
- params: { ...request.params, ...params, pageNo: pageNo.value, pageSize: 20 }
|
|
|
- })
|
|
|
+ .get(
|
|
|
+ {
|
|
|
+ url: request.url,
|
|
|
+ params: { ...request.params, ...params, pageNo: pageNo.value, pageSize: 20 }
|
|
|
+ },
|
|
|
+ '/business'
|
|
|
+ )
|
|
|
.then((res) => {
|
|
|
ElMessage.success(`数据查询成功`)
|
|
|
loading.value = false
|
|
@@ -123,8 +136,12 @@ const currentChange = (page) => {
|
|
|
<style scoped lang="scss">
|
|
|
.tableBox {
|
|
|
margin-top: 10px;
|
|
|
+ width: 100%;
|
|
|
+ overflow-x: auto;
|
|
|
}
|
|
|
.pageBox {
|
|
|
margin-top: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
}
|
|
|
</style>
|