删除多余代码
This commit is contained in:
@@ -18,7 +18,9 @@
|
||||
@refresh="handleRefresh"
|
||||
>
|
||||
<template #left>
|
||||
<ElButton type="primary" @click="showCreateDialog">创建退款申请</ElButton>
|
||||
<ElButton type="primary" @click="showCreateDialog" v-if="hasAuth('refund:create')"
|
||||
>创建退款申请</ElButton
|
||||
>
|
||||
</template>
|
||||
</ArtTableHeader>
|
||||
|
||||
@@ -32,34 +34,21 @@
|
||||
:pageSize="pagination.page_size"
|
||||
:total="pagination.total"
|
||||
:marginTop="10"
|
||||
:row-class-name="getRowClassName"
|
||||
:actions="getActions"
|
||||
:actionsWidth="160"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
@row-contextmenu="handleRowContextMenu"
|
||||
@cell-mouse-enter="handleCellMouseEnter"
|
||||
@cell-mouse-leave="handleCellMouseLeave"
|
||||
>
|
||||
<template #default>
|
||||
<ElTableColumn v-for="col in columns" :key="col.prop || col.type" v-bind="col" />
|
||||
</template>
|
||||
</ArtTable>
|
||||
|
||||
<!-- 鼠标悬浮提示 -->
|
||||
<TableContextMenuHint :visible="showContextMenuHint" :position="hintPosition" />
|
||||
|
||||
<!-- 退款操作右键菜单 -->
|
||||
<ArtMenuRight
|
||||
ref="refundOperationMenuRef"
|
||||
:menu-items="refundOperationMenuItems"
|
||||
:menu-width="140"
|
||||
@select="handleRefundOperationMenuSelect"
|
||||
/>
|
||||
|
||||
<!-- 创建退款申请对话框 -->
|
||||
<ElDialog
|
||||
v-model="createDialogVisible"
|
||||
title="创建退款申请"
|
||||
width="500px"
|
||||
width="30%"
|
||||
@closed="handleCreateDialogClosed"
|
||||
>
|
||||
<ElForm ref="createFormRef" :model="createForm" :rules="createRules" label-width="120px">
|
||||
@@ -321,17 +310,15 @@
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { useTableContextMenu } from '@/composables/useTableContextMenu'
|
||||
import ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
|
||||
import TableContextMenuHint from '@/components/core/others/TableContextMenuHint.vue'
|
||||
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
|
||||
defineOptions({ name: 'RefundList' })
|
||||
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const { hasAuth } = useAuth()
|
||||
|
||||
const loading = ref(false)
|
||||
const createLoading = ref(false)
|
||||
@@ -348,10 +335,6 @@
|
||||
const resubmitDialogVisible = ref(false)
|
||||
const currentRefund = ref<Refund | null>(null)
|
||||
|
||||
// 右键菜单
|
||||
const refundOperationMenuRef = ref<InstanceType<typeof ArtMenuRight>>()
|
||||
const currentOperatingRefund = ref<Refund | null>(null)
|
||||
|
||||
// 搜索表单初始值
|
||||
const initialSearchState: RefundQueryParams = {
|
||||
status: undefined,
|
||||
@@ -971,88 +954,52 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 退款操作菜单项配置
|
||||
const refundOperationMenuItems = computed((): MenuItemType[] => {
|
||||
const items: MenuItemType[] = []
|
||||
|
||||
if (!currentOperatingRefund.value) return items
|
||||
// 获取操作按钮
|
||||
const getActions = (row: Refund) => {
|
||||
const actions: any[] = []
|
||||
|
||||
// 待审批状态可以审批通过、拒绝或退回
|
||||
if (currentOperatingRefund.value.status === 1) {
|
||||
items.push({
|
||||
key: 'approve',
|
||||
label: '审批通过'
|
||||
})
|
||||
items.push({
|
||||
key: 'reject',
|
||||
label: '审批拒绝'
|
||||
})
|
||||
items.push({
|
||||
key: 'return',
|
||||
label: '退回'
|
||||
})
|
||||
if (row.status === 1) {
|
||||
// 退回按钮直接显示
|
||||
if (hasAuth('refund:return')) {
|
||||
actions.push({
|
||||
label: '退回',
|
||||
handler: () => handleShowReturn(row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
// 审批通过和审批拒绝放到更多里
|
||||
if (hasAuth('refund:approve')) {
|
||||
actions.push({
|
||||
label: '审批通过',
|
||||
handler: () => handleShowApprove(row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
if (hasAuth('refund:reject')) {
|
||||
actions.push({
|
||||
label: '审批拒绝',
|
||||
handler: () => handleShowReject(row),
|
||||
type: 'danger'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 已拒绝或已退回状态可以重新提交
|
||||
if (currentOperatingRefund.value.status === 3 || currentOperatingRefund.value.status === 4) {
|
||||
items.push({
|
||||
key: 'resubmit',
|
||||
label: '重新提交'
|
||||
if (row.status === 3 || row.status === 4) {
|
||||
actions.push({
|
||||
label: '重新提交',
|
||||
handler: () => handleShowResubmit(row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
return items
|
||||
})
|
||||
|
||||
// 显示退款操作右键菜单
|
||||
const showRefundOperationMenu = (e: MouseEvent, row: Refund) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
currentOperatingRefund.value = row
|
||||
refundOperationMenuRef.value?.show(e)
|
||||
return actions
|
||||
}
|
||||
|
||||
// 处理表格行右键菜单
|
||||
const handleRowContextMenu = (row: Refund, column: any, event: MouseEvent) => {
|
||||
showRefundOperationMenu(event, row)
|
||||
}
|
||||
|
||||
// 处理退款操作菜单选择
|
||||
const handleRefundOperationMenuSelect = (item: MenuItemType) => {
|
||||
if (!currentOperatingRefund.value) return
|
||||
|
||||
switch (item.key) {
|
||||
case 'approve':
|
||||
handleShowApprove(currentOperatingRefund.value)
|
||||
break
|
||||
case 'reject':
|
||||
handleShowReject(currentOperatingRefund.value)
|
||||
break
|
||||
case 'return':
|
||||
handleShowReturn(currentOperatingRefund.value)
|
||||
break
|
||||
case 'resubmit':
|
||||
handleShowResubmit(currentOperatingRefund.value)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 使用表格右键菜单功能
|
||||
const {
|
||||
showContextMenuHint,
|
||||
hintPosition,
|
||||
getRowClassName,
|
||||
handleCellMouseEnter,
|
||||
handleCellMouseLeave
|
||||
} = useTableContextMenu()
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.refund-page {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
:deep(.el-table__row.table-row-with-context-menu) {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user