2
schangxiang@126.com
2025-05-12 6177ed5cb88df34f2a67d9d0610e3e0dc7030e70
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<template>
  <div class="pagination-content">
    <span class="info">
      {{ _t('共') }}{{ total }}{{ _t('条记录') }} {{ _t('当前第') }}{{ pageNum
      }}{{ _t('页') }} {{ _t('共') }}{{ totalNum }}{{ _t('页') }} {{ _t('每页')
      }}{{ pageSize }}{{ _t('条记录') }}
    </span>
    <div class="pagination">
      <div class="without-pagination">
        <el-pagination
          layout="prev, pager, next"
          :total="total"
          size="small"
          :page-size="pageSize"
          v-model:current-page="pageNum"
          @current-change="onCurrentChange"
        />
      </div>
      <div class="numb">
        {{ _t('第') }}
        <el-input-number
          @change="onChange"
          :min="1"
          :controls="false"
          :max="max"
          v-model="pageNum"
          controls-position="right"
          style="width: 58px; height: 30px"
        />
        {{ _t('页') }}
      </div>
    </div>
  </div>
</template>
 
<script lang="ts" setup>
import { _t } from '@/libs/Language/Language'
import { computed, ref } from 'vue'
 
const props = defineProps<{
  pageSize: number
  total: number
}>()
const pageNum = ref(1)
const totalNum = computed(() =>
  props.total ? Math.ceil(props.total / props.pageSize) : 1
)
const emit = defineEmits(['check', 'sort', 'page'])
 
const onChange = () => {
  onCurrentChange(Number(pageNum.value))
}
 
const max = computed(() => {
  if (props.total && props.pageSize) {
    return Math.ceil(props.total / props.pageSize)
  }
  return 1
})
 
const onCurrentChange = (current: number) => {
  pageNum.value = current
  emit('page', current)
}
</script>
<style scoped lang="scss">
.pagination-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 21px;
  height: 50px;
  .pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    :deep(.cs-pager) {
      .number {
        width: 28px !important;
        height: 30px;
        background: #ffffff;
        border-radius: 2px 2px 2px 2px;
        opacity: 1;
        border: 1px solid #dde0e4;
        color: #333;
      }
      .is-active {
        width: 28px !important;
        height: 30px;
        background: #262626;
        border-radius: 2px 2px 2px 2px;
        opacity: 1;
        border: 1px solid #dde0e4;
        font-size: 14px;
        font-weight: bold;
        color: #ffffff;
      }
    }
  }
 
  .info {
    width: 300px;
    height: 20px;
    font-size: 14px;
    font-weight: 400;
    color: #333333;
  }
  .numb {
    margin-left: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100px;
    font-size: 14px;
    font-weight: bold;
    color: #333333;
    :deep(.cs-input__inner) {
      background-color: #fff !important;
      font-size: 14px;
      color: #333;
      text-align: center;
    }
  }
}
</style>