Compare commits
2 Commits
8ca03ed7ac
...
2140efbacf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2140efbacf | ||
|
|
8cc86369a2 |
@@ -164,6 +164,8 @@
|
|||||||
actions?: ((row: any) => TableAction[]) | null
|
actions?: ((row: any) => TableAction[]) | null
|
||||||
/** 操作列宽度 */
|
/** 操作列宽度 */
|
||||||
actionsWidth?: number
|
actionsWidth?: number
|
||||||
|
/** 直接显示的操作按钮数量,默认2个 */
|
||||||
|
inlineActionsCount?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<TableProps>(), {
|
const props = withDefaults(defineProps<TableProps>(), {
|
||||||
@@ -192,7 +194,8 @@
|
|||||||
treeProps: undefined,
|
treeProps: undefined,
|
||||||
defaultExpandAll: false,
|
defaultExpandAll: false,
|
||||||
actions: null,
|
actions: null,
|
||||||
actionsWidth: 140
|
actionsWidth: 140,
|
||||||
|
inlineActionsCount: 2
|
||||||
})
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -371,8 +374,8 @@
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果操作数量 <= 3,直接显示所有按钮
|
// 如果操作数量 <= inlineActionsCount,直接显示所有按钮
|
||||||
if (actionList.length <= 3) {
|
if (actionList.length <= props.inlineActionsCount) {
|
||||||
return h(
|
return h(
|
||||||
'div',
|
'div',
|
||||||
{ style: 'display: flex; gap: 8px;' },
|
{ style: 'display: flex; gap: 8px;' },
|
||||||
@@ -390,19 +393,21 @@
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果操作数量 > 3,显示第一个 + 更多下拉菜单
|
// 如果操作数量 > inlineActionsCount,显示前 inlineActionsCount 个 + 更多下拉菜单
|
||||||
const firstAction = actionList[0]
|
const inlineActions = actionList.slice(0, props.inlineActionsCount)
|
||||||
const moreActions = actionList.slice(1)
|
const moreActions = actionList.slice(props.inlineActionsCount)
|
||||||
|
|
||||||
return h('div', { style: 'display: flex; gap: 12px; align-items: center;' }, [
|
return h('div', { style: 'display: flex; gap: 12px; align-items: center;' }, [
|
||||||
h(
|
...inlineActions.map((action) =>
|
||||||
ElButton,
|
h(
|
||||||
{
|
ElButton,
|
||||||
type: firstAction.type === 'danger' ? 'danger' : 'primary',
|
{
|
||||||
link: true,
|
type: action.type === 'danger' ? 'danger' : 'primary',
|
||||||
onClick: () => firstAction.handler(row)
|
link: true,
|
||||||
},
|
onClick: () => action.handler(row)
|
||||||
() => firstAction.label
|
},
|
||||||
|
() => action.label
|
||||||
|
)
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
ElDropdown,
|
ElDropdown,
|
||||||
|
|||||||
@@ -35,7 +35,8 @@
|
|||||||
:total="pagination.total"
|
:total="pagination.total"
|
||||||
:marginTop="10"
|
:marginTop="10"
|
||||||
:actions="getActions"
|
:actions="getActions"
|
||||||
:actionsWidth="250"
|
:actionsWidth="230"
|
||||||
|
:inlineActionsCount="2"
|
||||||
@size-change="handleSizeChange"
|
@size-change="handleSizeChange"
|
||||||
@current-change="handleCurrentChange"
|
@current-change="handleCurrentChange"
|
||||||
>
|
>
|
||||||
@@ -302,7 +303,6 @@
|
|||||||
} from '@/types/api'
|
} from '@/types/api'
|
||||||
import type { SearchFormItem } from '@/types'
|
import type { SearchFormItem } from '@/types'
|
||||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||||
import { useUserStore } from '@/store/modules/user'
|
|
||||||
import { formatDateTime } from '@/utils/business/format'
|
import { formatDateTime } from '@/utils/business/format'
|
||||||
import { RoutesAlias } from '@/router/routesAlias'
|
import { RoutesAlias } from '@/router/routesAlias'
|
||||||
import { useAuth } from '@/composables/useAuth'
|
import { useAuth } from '@/composables/useAuth'
|
||||||
@@ -848,8 +848,9 @@
|
|||||||
: undefined,
|
: undefined,
|
||||||
remark: approveForm.remark || undefined
|
remark: approveForm.remark || undefined
|
||||||
}
|
}
|
||||||
|
const refundId = currentRefund.value?.id
|
||||||
await RefundService.approveRefund(currentRefund.value.id, data)
|
if (!refundId) return
|
||||||
|
await RefundService.approveRefund(refundId, data)
|
||||||
ElMessage.success('审批通过成功')
|
ElMessage.success('审批通过成功')
|
||||||
approveDialogVisible.value = false
|
approveDialogVisible.value = false
|
||||||
await getTableData()
|
await getTableData()
|
||||||
@@ -883,7 +884,9 @@
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
rejectLoading.value = true
|
rejectLoading.value = true
|
||||||
try {
|
try {
|
||||||
await RefundService.rejectRefund(currentRefund.value.id, rejectForm)
|
const refundId = currentRefund.value?.id
|
||||||
|
if (!refundId) return
|
||||||
|
await RefundService.rejectRefund(refundId, rejectForm)
|
||||||
ElMessage.success('审批拒绝成功')
|
ElMessage.success('审批拒绝成功')
|
||||||
rejectDialogVisible.value = false
|
rejectDialogVisible.value = false
|
||||||
await getTableData()
|
await getTableData()
|
||||||
@@ -917,7 +920,9 @@
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
returnLoading.value = true
|
returnLoading.value = true
|
||||||
try {
|
try {
|
||||||
await RefundService.returnRefund(currentRefund.value.id, returnForm)
|
const refundId = currentRefund.value?.id
|
||||||
|
if (!refundId) return
|
||||||
|
await RefundService.returnRefund(refundId, returnForm)
|
||||||
ElMessage.success('退回成功')
|
ElMessage.success('退回成功')
|
||||||
returnDialogVisible.value = false
|
returnDialogVisible.value = false
|
||||||
await getTableData()
|
await getTableData()
|
||||||
@@ -957,6 +962,8 @@
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
resubmitLoading.value = true
|
resubmitLoading.value = true
|
||||||
try {
|
try {
|
||||||
|
const refundId = currentRefund.value?.id
|
||||||
|
if (!refundId) return
|
||||||
const data: ResubmitRefundRequest = {
|
const data: ResubmitRefundRequest = {
|
||||||
requested_refund_amount: resubmitForm.requested_refund_amount
|
requested_refund_amount: resubmitForm.requested_refund_amount
|
||||||
? resubmitForm.requested_refund_amount * 100
|
? resubmitForm.requested_refund_amount * 100
|
||||||
@@ -967,7 +974,7 @@
|
|||||||
refund_reason: resubmitForm.refund_reason || undefined
|
refund_reason: resubmitForm.refund_reason || undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
await RefundService.resubmitRefund(currentRefund.value.id, data)
|
await RefundService.resubmitRefund(refundId, data)
|
||||||
ElMessage.success('重新提交成功')
|
ElMessage.success('重新提交成功')
|
||||||
resubmitDialogVisible.value = false
|
resubmitDialogVisible.value = false
|
||||||
await getTableData()
|
await getTableData()
|
||||||
|
|||||||
Reference in New Issue
Block a user