This commit is contained in:
@@ -10,6 +10,30 @@
|
||||
返回
|
||||
</ElButton>
|
||||
<h2 class="detail-title">换货单详情</h2>
|
||||
<ElButton
|
||||
v-if="exchangeAuditTarget && hasAuth(exchangeAuditPermission)"
|
||||
type="primary"
|
||||
plain
|
||||
@click="openAuditInvestigation(exchangeAuditTarget)"
|
||||
>
|
||||
{{ userType === 3 ? '活动记录' : '换货审计' }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="oldAssetAuditTarget && hasAuth(AUDIT_PERMISSIONS.resourceTimeline)"
|
||||
type="primary"
|
||||
plain
|
||||
@click="openAuditInvestigation(oldAssetAuditTarget)"
|
||||
>
|
||||
旧资产审计
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="newAssetAuditTarget && hasAuth(AUDIT_PERMISSIONS.resourceTimeline)"
|
||||
type="primary"
|
||||
plain
|
||||
@click="openAuditInvestigation(newAssetAuditTarget)"
|
||||
>
|
||||
新资产审计
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<!-- 详情内容 -->
|
||||
@@ -35,15 +59,51 @@
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import DetailPage from '@/components/common/DetailPage.vue'
|
||||
import type { DetailSection } from '@/components/common/DetailPage.vue'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
|
||||
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
|
||||
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
|
||||
|
||||
defineOptions({ name: 'ExchangeDetail' })
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const loading = ref(false)
|
||||
const exchangeDetail = ref<ExchangeResponse | null>(null)
|
||||
const exchangeId = ref<number>(0)
|
||||
const userType = computed(() => Number(userStore.info.user_type))
|
||||
const exchangeAuditPermission = computed(() =>
|
||||
userType.value === 3 ? AUDIT_PERMISSIONS.agentActivity : AUDIT_PERMISSIONS.resourceTimeline
|
||||
)
|
||||
const exchangeAuditTarget = computed(() => {
|
||||
if (!exchangeDetail.value || userType.value === 4) return null
|
||||
return resolveAuditResourceTarget({
|
||||
userType: userType.value,
|
||||
resourceType: 'exchange_order',
|
||||
internalId: exchangeDetail.value.id,
|
||||
businessIdentifier: exchangeDetail.value.exchange_no
|
||||
})
|
||||
})
|
||||
const oldAssetAuditTarget = computed(() => {
|
||||
if (!exchangeDetail.value || ![1, 2].includes(userType.value)) return null
|
||||
return resolveAuditResourceTarget({
|
||||
userType: userType.value,
|
||||
resourceType: exchangeDetail.value.old_asset_type,
|
||||
internalId: exchangeDetail.value.old_asset_id
|
||||
})
|
||||
})
|
||||
const newAssetAuditTarget = computed(() => {
|
||||
if (!exchangeDetail.value || ![1, 2].includes(userType.value)) return null
|
||||
return resolveAuditResourceTarget({
|
||||
userType: userType.value,
|
||||
resourceType: exchangeDetail.value.new_asset_type || '',
|
||||
internalId: exchangeDetail.value.new_asset_id
|
||||
})
|
||||
})
|
||||
|
||||
const formatExchangeShopName = (shopName?: string | null, shopId?: number | null) => {
|
||||
if (shopName) return shopName
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
:total="pagination.total"
|
||||
:marginTop="10"
|
||||
:actions="getActions"
|
||||
:actionsWidth="120"
|
||||
:actionsWidth="160"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
@@ -438,10 +438,15 @@
|
||||
getProcessingStatusText
|
||||
} from '@/utils/business/approvalSummary'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
|
||||
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
|
||||
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
|
||||
|
||||
defineOptions({ name: 'ExchangeManagement' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
|
||||
const currentExchangeRow = ref<ExchangeResponse | null>(null)
|
||||
@@ -1548,6 +1553,45 @@
|
||||
const actions: any[] = []
|
||||
const status = row.status
|
||||
const flowType = row.flow_type || 'shipping' // 历史数据兼容
|
||||
const userType = Number(userStore.info.user_type)
|
||||
const entryPermission =
|
||||
userType === 3 ? AUDIT_PERMISSIONS.agentActivity : AUDIT_PERMISSIONS.resourceTimeline
|
||||
if (userType !== 4 && hasAuth(entryPermission)) {
|
||||
const exchangeTarget = resolveAuditResourceTarget({
|
||||
userType,
|
||||
resourceType: 'exchange_order',
|
||||
internalId: row.id,
|
||||
businessIdentifier: row.exchange_no
|
||||
})
|
||||
if (exchangeTarget)
|
||||
actions.push({
|
||||
label: userType === 3 ? '活动记录' : '换货审计',
|
||||
handler: () => openAuditInvestigation(exchangeTarget),
|
||||
type: 'primary'
|
||||
})
|
||||
if ([1, 2].includes(userType)) {
|
||||
const oldAssetTarget = resolveAuditResourceTarget({
|
||||
resourceType: row.old_asset_type,
|
||||
internalId: row.old_asset_id
|
||||
})
|
||||
if (oldAssetTarget)
|
||||
actions.push({
|
||||
label: '旧资产审计',
|
||||
handler: () => openAuditInvestigation(oldAssetTarget),
|
||||
type: 'primary'
|
||||
})
|
||||
const newAssetTarget = resolveAuditResourceTarget({
|
||||
resourceType: row.new_asset_type || '',
|
||||
internalId: row.new_asset_id
|
||||
})
|
||||
if (newAssetTarget)
|
||||
actions.push({
|
||||
label: '新资产审计',
|
||||
handler: () => openAuditInvestigation(newAssetTarget),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 直接换货不支持任何操作(发货、确认完成、取消)
|
||||
if (flowType === 'direct') {
|
||||
|
||||
Reference in New Issue
Block a user