|
|
@@ -39,19 +39,17 @@
|
|
|
<text>{{ getNoteText(row, locale, userStore) }}</text>
|
|
|
</view>
|
|
|
<view v-else-if="column.type === 'action'" class="action-wrapper">
|
|
|
- <cwg-droplist
|
|
|
- v-if="getComputedMenuList(column.menuList, row).length > 0"
|
|
|
- :menuList="getComputedMenuList(column.menuList, row)"
|
|
|
- placement="bottom-end"
|
|
|
- @menuClick="(payload) => handleActionClick(payload, row)"
|
|
|
- >
|
|
|
+ <cwg-droplist v-if="getComputedMenuList(column.menuList, row).length > 0"
|
|
|
+ :menuList="getComputedMenuList(column.menuList, row)" placement="bottom-end"
|
|
|
+ @menuClick="(payload) => handleActionClick(payload, row)">
|
|
|
<view class="action-trigger">
|
|
|
<cwg-icon name="crm-ellipsis" :size="24" color="#000" />
|
|
|
</view>
|
|
|
</cwg-droplist>
|
|
|
</view>
|
|
|
<template v-else-if="column.type === 'more'">
|
|
|
- <cwg-icon v-if="isMobile" name="crm-chevron-down" class="crm-chevron-down" :size="16" color="#007" />
|
|
|
+ <cwg-icon v-if="isMobile" name="crm-chevron-down" class="crm-chevron-down" :size="16"
|
|
|
+ color="#007" />
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
@@ -128,12 +126,13 @@
|
|
|
<view class="pagination">
|
|
|
<view class="page-item prev" :class="{ disabled: pagination.current === 1 }"
|
|
|
@click="handlePageChange('prev')">
|
|
|
- <uni-icons type="arrowright" size="14" :color="pagination.current === 1 ? '#c0c4cc' : '#606266'" class="arrow-left"/>
|
|
|
+ <uni-icons type="arrowright" size="14" :color="pagination.current === 1 ? '#c0c4cc' : '#606266'"
|
|
|
+ class="arrow-left" />
|
|
|
</view>
|
|
|
|
|
|
<view class="page-numbers">
|
|
|
<view v-for="(page, index) in visiblePages" :key="index" class="page-number"
|
|
|
- :class="{ active: pagination.current === page, ellipsis: page === '...' }"
|
|
|
+ :class="{ active: pagination.current === page, ellipsis: page === '...' }"
|
|
|
@click="page !== '...' && handlePageChange(page)">
|
|
|
{{ page }}
|
|
|
</view>
|
|
|
@@ -141,7 +140,8 @@
|
|
|
|
|
|
<view class="page-item next" :class="{ disabled: pagination.current === pagination.pages }"
|
|
|
@click="handlePageChange('next')">
|
|
|
- <uni-icons type="arrowright" size="14" :color="pagination.current === pagination.pages ? '#c0c4cc' : '#606266'" />
|
|
|
+ <uni-icons type="arrowright" size="14"
|
|
|
+ :color="pagination.current === pagination.pages ? '#c0c4cc' : '#606266'" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -149,9 +149,9 @@
|
|
|
<!-- <cwg-detail-popup v-model:visible="detailVisible" title="详情" :items="detailItems" /> -->
|
|
|
<cwg-detail-popup v-model:visible="detailVisible" title="详情" :row="detailRow" :columns="detailColumns">
|
|
|
<template v-for="col in detailColumns" :key="col.prop" #[`cell-${col.prop}`]="{ row, column }">
|
|
|
- <view v-if="col.type === 'file'">
|
|
|
- <cwg-file :path="row[column.prop]" />
|
|
|
- </view>
|
|
|
+ <view v-if="col.type === 'file'">
|
|
|
+ <cwg-file :path="row[column.prop]" />
|
|
|
+ </view>
|
|
|
<slot v-else-if="col.slot" :name="col.slot" :row="row" :column="column" :index="0" />
|
|
|
</template>
|
|
|
</cwg-detail-popup>
|
|
|
@@ -221,6 +221,7 @@ const props = defineProps({
|
|
|
headerStyle: { type: Object, default: () => ({}) },
|
|
|
stickyHeader: { type: Boolean, default: true },
|
|
|
stickyOffset: { type: [String, Number], default: '0' },
|
|
|
+ // 是否跳转页面
|
|
|
isPages: { type: Boolean, default: false },
|
|
|
// 自定义详情的时候,手机端才跳转,pc端不跳转
|
|
|
pagesToDetail: { type: Boolean, default: false },
|
|
|
@@ -346,13 +347,13 @@ const visiblePages = computed(() => {
|
|
|
const totalPages = pagination.value.pages
|
|
|
const currentPage = pagination.value.current
|
|
|
const maxVisible = 4 // 显示的页码数量(包括第一页和最后一页)
|
|
|
-
|
|
|
+
|
|
|
if (totalPages <= maxVisible) {
|
|
|
return Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
let pages = []
|
|
|
-
|
|
|
+
|
|
|
if (currentPage <= 2) {
|
|
|
// 当前页靠前:[1, 2, '...', 最后一页]
|
|
|
pages = [1, 2, '...', totalPages]
|
|
|
@@ -364,7 +365,7 @@ const visiblePages = computed(() => {
|
|
|
// 或者:[1, 当前页, '...', 最后一页] 以确保当前页能点到
|
|
|
pages = [1, '...', currentPage, totalPages]
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return pages
|
|
|
})
|
|
|
// ========== 工具函数 ==========
|
|
|
@@ -540,23 +541,17 @@ const toggleRowExpand = (rowIndex) => {
|
|
|
// 打开详情弹窗(移动端使用)
|
|
|
// 修改 openRowDetail
|
|
|
const openRowDetail = (row) => {
|
|
|
-
|
|
|
if (props.isPages) {
|
|
|
- if (props.pagesToDetail){
|
|
|
- if (isMobile.value){
|
|
|
- emit('go-pages', row)
|
|
|
- }
|
|
|
- }else {
|
|
|
- }
|
|
|
- } else if (!isMobile.value) {
|
|
|
- // 只有移动端才打开详情弹窗
|
|
|
emit('go-pages', row)
|
|
|
- return
|
|
|
} else {
|
|
|
- // 保存当前行和需要显示的列(有 prop 且有 label) pc 详情不展示操作按钮
|
|
|
- detailRow.value = { ...row, note: getNoteText(row, locale.value, userStore) }
|
|
|
- detailColumns.value = !isMobile.value ? props.columns.filter(col => col && col.prop && col.label && col.type !== 'action') : props.columns.filter(col => col && col.prop && col.label)
|
|
|
- detailVisible.value = true
|
|
|
+ if (props.pagesToDetail) {
|
|
|
+ emit('go-pages', row)
|
|
|
+ } else if (isMobile.value) {
|
|
|
+ // 保存当前行和需要显示的列(有 prop 且有 label) pc 详情不展示操作按钮
|
|
|
+ detailRow.value = { ...row, note: getNoteText(row, locale.value, userStore) }
|
|
|
+ detailColumns.value = !isMobile.value ? props.columns.filter(col => col && col.prop && col.label && col.type !== 'action') : props.columns.filter(col => col && col.prop && col.label)
|
|
|
+ detailVisible.value = true
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
const setDetailVisible = (visible) => {
|
|
|
@@ -773,8 +768,8 @@ defineExpose({
|
|
|
|
|
|
.table-container {
|
|
|
width: 100%;
|
|
|
- overflow-x: auto;
|
|
|
- -webkit-overflow-scrolling: touch;
|
|
|
+ overflow-x: auto;
|
|
|
+ -webkit-overflow-scrolling: touch;
|
|
|
margin-top: px2rpx(20);
|
|
|
max-height: calc(100vh - 209px);
|
|
|
color: var(--color-slate-800);
|
|
|
@@ -817,11 +812,11 @@ defineExpose({
|
|
|
|
|
|
/* 强制显示滚动条并美化 */
|
|
|
&::-webkit-scrollbar {
|
|
|
- width: 4px!important;
|
|
|
- height: 4px!important;
|
|
|
- display: block!important;
|
|
|
+ width: 4px !important;
|
|
|
+ height: 4px !important;
|
|
|
+ display: block !important;
|
|
|
/* 强制在某些webkit浏览器中显示 */
|
|
|
- background-color: transparent!important;
|
|
|
+ background-color: transparent !important;
|
|
|
}
|
|
|
|
|
|
&::-webkit-scrollbar-track {
|
|
|
@@ -1039,7 +1034,7 @@ defineExpose({
|
|
|
cursor: pointer;
|
|
|
transition: all 0.3s;
|
|
|
font-weight: 500;
|
|
|
-
|
|
|
+
|
|
|
&.ellipsis {
|
|
|
cursor: default;
|
|
|
background: transparent;
|
|
|
@@ -1056,7 +1051,7 @@ defineExpose({
|
|
|
background-color: #cf1322;
|
|
|
color: #fff;
|
|
|
border-color: #cf1322;
|
|
|
-
|
|
|
+
|
|
|
&:hover {
|
|
|
color: #fff;
|
|
|
}
|
|
|
@@ -1092,7 +1087,7 @@ defineExpose({
|
|
|
width: 100%;
|
|
|
overflow-x: auto;
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
-
|
|
|
+
|
|
|
&::-webkit-scrollbar {
|
|
|
display: none;
|
|
|
}
|