回收站添加占位

This commit is contained in:
浅念
2025-07-25 15:48:49 +08:00
parent 382011d592
commit 48b95e252f
+92 -88
View File
@@ -2,7 +2,8 @@
<div class="recycle-page"> <div class="recycle-page">
<el-card class="recycle-card"> <el-card class="recycle-card">
<div class="recycle-title"> <div class="recycle-title">
<span class="title-dot"></span>回收站 <span class="title-dot"></span>
回收站
</div> </div>
<ArtTable <ArtTable
ref="tableRef" ref="tableRef"
@@ -21,9 +22,11 @@
<el-table-column prop="contacts" label="姓名" min-width="120"></el-table-column> <el-table-column prop="contacts" label="姓名" min-width="120"></el-table-column>
<el-table-column prop="phone" label="联系方式" min-width="120"></el-table-column> <el-table-column prop="phone" label="联系方式" min-width="120"></el-table-column>
<el-table-column fixed="right" label="操作" width="160px"> <el-table-column fixed="right" label="操作" width="160px">
<template #default="scope"> <template #default="scope">
<el-button type="primary" @click="onDetail(scope.row)" size="small">恢复客户</el-button> <el-button type="primary" @click="onDetail(scope.row)" size="small"
</template> >恢复客户
</el-button>
</template>
</el-table-column> </el-table-column>
</template> </template>
</ArtTable> </ArtTable>
@@ -32,103 +35,104 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue' import { ref, onMounted } from 'vue'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import { CrmService } from '@/api/crmApi' import { CrmService } from '@/api/crmApi'
const loading = ref(false) const loading = ref(false)
const pagination = reactive({ const pagination = reactive({
currentPage: 1, currentPage: 1,
pageSize: 20, pageSize: 20,
total: 0 total: 0
}) })
const tableData = ref<any[]>([]) const tableData = ref<any[]>([])
// 获取列表数据 // 获取列表数据
const gettableList = async () => { const gettableList = async () => {
loading.value = true loading.value = true
try { try {
const { currentPage, pageSize } = pagination const { currentPage, pageSize } = pagination
const params: any = { const params: any = {
current: currentPage, current: currentPage,
size: pageSize, size: pageSize,
recycle:'recycle' recycle: 'recycle'
}
const { data, current, size, total } = await CrmService.getcustomerList(params)
tableData.value = data.map((item: any) => ({
...item
}))
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
console.error('获取用户列表失败:', error)
} finally {
loading.value = false
} }
const { data, current, size, total } = await CrmService.getcustomerList(params)
tableData.value = data.map((item: any, index: number) => ({
...item
}))
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
console.error('获取用户列表失败:', error)
} finally {
loading.value = false
} }
} // 选中的行数据
// 选中的行数据 const selectedRows = ref<any[]>([])
const selectedRows = ref<any[]>([]) // 处理表格行选择变化
// 处理表格行选择变化 const handleSelectionChange = (selection: any[]) => {
const handleSelectionChange = (selection: any[]) => {
selectedRows.value = selection selectedRows.value = selection
} }
// 处理表格分页变化 // 处理表格分页变化
const handleSizeChange = (newPageSize: number) => { const handleSizeChange = (newPageSize: number) => {
pagination.pageSize = newPageSize pagination.pageSize = newPageSize
gettableList() gettableList()
} }
const handleCurrentChange = (newCurrentPage: number) => { const handleCurrentChange = (newCurrentPage: number) => {
pagination.currentPage = newCurrentPage pagination.currentPage = newCurrentPage
gettableList() gettableList()
} }
onMounted(() => { onMounted(() => {
gettableList() gettableList()
}) })
const onDetail = async (row: any) => { const onDetail = async (row: any) => {
ElMessageBox.confirm( ElMessageBox.confirm('确定要恢复此客户吗?', '提示', {
'确定要恢复此客户吗?',
'提示',
{
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning'
} })
).then(async () => { .then(async () => {
const res = await CrmService.customerrestore({id:row.id}) const res = await CrmService.customerrestore({ id: row.id })
ElMessage.success(res?.message || '提交成功!') ElMessage.success(res?.message || '提交成功!')
gettableList() gettableList()
// 你可以在这里调用接口或做后续处理 // 你可以在这里调用接口或做后续处理
}).catch(() => { })
// 用户点击了取消 .catch(() => {
}) // 用户点击了取消
} })
}
</script> </script>
<style scoped> <style scoped>
.recycle-page { .recycle-page {
background: #fafbfc; background: #fafbfc;
min-height: 100vh; min-height: 100vh;
padding: 24px; padding: 24px;
} }
.recycle-card { .recycle-card {
border-radius: 8px; border-radius: 8px;
background: #fff; background: #fff;
} }
.recycle-title { .recycle-title {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
margin-bottom: 8px; margin-bottom: 8px;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.title-dot { .title-dot {
display: inline-block; display: inline-block;
width: 6px; width: 6px;
height: 16px; height: 16px;
background: #3471FF; background: #3471FF;
border-radius: 2px; border-radius: 2px;
margin-right: 8px; margin-right: 8px;
} }
.el-table .hide-header th { .el-table .hide-header th {
display: none; display: none;
} }
:deep(.el-table__empty-block) {
height: 300px !important;
}
</style> </style>